@cetusprotocol/terminal 0.0.5 → 0.0.7
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.
- package/dist/cetus-swap.cjs.js +27 -27
- package/dist/cetus-swap.cjs.js.gz +0 -0
- package/dist/cetus-swap.es.js +6223 -6198
- package/dist/cetus-swap.es.js.gz +0 -0
- package/dist/cetus-swap.umd.js +29 -29
- package/dist/cetus-swap.umd.js.gz +0 -0
- package/dist/hooks/swap/useSwapHelper.d.ts +1 -1
- package/dist/stores/swap.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/style.css.gz +0 -0
- package/dist/utils/common.d.ts +1 -0
- package/package.json +1 -1
package/dist/cetus-swap.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var F3=Object.defineProperty;var U3=(e,t,r)=>t in e?F3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var vt=(e,t,r)=>(U3(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("react"),nl=require("react-dom"),Lr=require("@mysten/dapp-kit");function Kv(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=Kv(se),Jv=Kv(nl);function z3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xv={exports:{}},or=Xv.exports={},qn,Wn;function gd(){throw new Error("setTimeout has not been defined")}function vd(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?qn=setTimeout:qn=gd}catch{qn=gd}try{typeof clearTimeout=="function"?Wn=clearTimeout:Wn=vd}catch{Wn=vd}})();function Yv(e){if(qn===setTimeout)return setTimeout(e,0);if((qn===gd||!qn)&&setTimeout)return qn=setTimeout,setTimeout(e,0);try{return qn(e,0)}catch{try{return qn.call(null,e,0)}catch{return qn.call(this,e,0)}}}function V3(e){if(Wn===clearTimeout)return clearTimeout(e);if((Wn===vd||!Wn)&&clearTimeout)return Wn=clearTimeout,clearTimeout(e);try{return Wn(e)}catch{try{return Wn.call(null,e)}catch{return Wn.call(this,e)}}}var Ei=[],To=!1,Bs,Hc=-1;function q3(){!To||!Bs||(To=!1,Bs.length?Ei=Bs.concat(Ei):Hc=-1,Ei.length&&Zv())}function Zv(){if(!To){var e=Yv(q3);To=!0;for(var t=Ei.length;t;){for(Bs=Ei,Ei=[];++Hc<t;)Bs&&Bs[Hc].run();Hc=-1,t=Ei.length}Bs=null,To=!1,V3(e)}}or.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];Ei.push(new Qv(e,t)),Ei.length===1&&!To&&Yv(Zv)};function Qv(e,t){this.fun=e,this.array=t}Qv.prototype.run=function(){this.fun.apply(null,this.array)};or.title="browser";or.browser=!0;or.env={};or.argv=[];or.version="";or.versions={};function Di(){}or.on=Di;or.addListener=Di;or.once=Di;or.off=Di;or.removeListener=Di;or.removeAllListeners=Di;or.emit=Di;or.prependListener=Di;or.prependOnceListener=Di;or.listeners=function(e){return[]};or.binding=function(e){throw new Error("process.binding is not supported")};or.cwd=function(){return"/"};or.chdir=function(e){throw new Error("process.chdir is not supported")};or.umask=function(){return 0};var W3=Xv.exports;const Tn=z3(W3);var Rr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function il(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 yd={exports:{}},fa={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,56 +6,56 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Q0;function G3(){if(Q0)return fa;Q0=1;var e=se,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 fa.Fragment=r,fa.jsx=o,fa.jsxs=o,fa}var da={},em;function H3(){return em||(em=1,Tn.env.NODE_ENV!=="production"&&function(){var e=se,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 A(z){if(z===null||typeof z!="object")return null;var oe=b&&z[b]||z[w];return typeof oe=="function"?oe:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(z){{for(var oe=arguments.length,he=new Array(oe>1?oe-1:0),ke=1;ke<oe;ke++)he[ke-1]=arguments[ke];N("error",z,he)}}function N(z,oe,he){{var ke=P.ReactDebugCurrentFrame,He=ke.getStackAddendum();He!==""&&(oe+="%s",he=he.concat([He]));var Re=he.map(function(ze){return String(ze)});Re.unshift("Warning: "+oe),Function.prototype.apply.call(console[z],console,Re)}}var F=!1,L=!1,G=!1,q=!1,J=!1,ne;ne=Symbol.for("react.module.reference");function ae(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===s||J||z===i||z===u||z===l||q||z===y||F||L||G||typeof z=="object"&&z!==null&&(z.$$typeof===h||z.$$typeof===f||z.$$typeof===o||z.$$typeof===a||z.$$typeof===c||z.$$typeof===ne||z.getModuleId!==void 0))}function ce(z,oe,he){var ke=z.displayName;if(ke)return ke;var He=oe.displayName||oe.name||"";return He!==""?he+"("+He+")":he}function V(z){return z.displayName||"Context"}function $(z){if(z==null)return null;if(typeof z.tag=="number"&&R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof z=="function")return z.displayName||z.name||null;if(typeof z=="string")return z;switch(z){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 z=="object")switch(z.$$typeof){case a:var oe=z;return V(oe)+".Consumer";case o:var he=z;return V(he._context)+".Provider";case c:return ce(z,z.render,"ForwardRef");case f:var ke=z.displayName||null;return ke!==null?ke:$(z.type)||"Memo";case h:{var He=z,Re=He._payload,ze=He._init;try{return $(ze(Re))}catch{return null}}}return null}var p=Object.assign,d=0,m,x,M,E,O,C,g;function v(){}v.__reactDisabledLog=!0;function j(){{if(d===0){m=console.log,x=console.info,M=console.warn,E=console.error,O=console.group,C=console.groupCollapsed,g=console.groupEnd;var z={configurable:!0,enumerable:!0,value:v,writable:!0};Object.defineProperties(console,{info:z,log:z,warn:z,error:z,group:z,groupCollapsed:z,groupEnd:z})}d++}}function ee(){{if(d--,d===0){var z={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:p({},z,{value:m}),info:p({},z,{value:x}),warn:p({},z,{value:M}),error:p({},z,{value:E}),group:p({},z,{value:O}),groupCollapsed:p({},z,{value:C}),groupEnd:p({},z,{value:g})})}d<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=P.ReactCurrentDispatcher,ve;function pe(z,oe,he){{if(ve===void 0)try{throw Error()}catch(He){var ke=He.stack.trim().match(/\n( *(at )?)/);ve=ke&&ke[1]||""}return`
|
|
10
10
|
`+ve+z}}var Ee=!1,Se;{var Ke=typeof WeakMap=="function"?WeakMap:Map;Se=new Ke}function Ue(z,oe){if(!z||Ee)return"";{var he=Se.get(z);if(he!==void 0)return he}var ke;Ee=!0;var He=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Re;Re=ie.current,ie.current=null,j();try{if(oe){var ze=function(){throw Error()};if(Object.defineProperty(ze.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ze,[])}catch(Kt){ke=Kt}Reflect.construct(z,[],ze)}else{try{ze.call()}catch(Kt){ke=Kt}z.call(ze.prototype)}}else{try{throw Error()}catch(Kt){ke=Kt}z()}}catch(Kt){if(Kt&&ke&&typeof Kt.stack=="string"){for(var at=Kt.stack.split(`
|
|
11
11
|
`),Ht=ke.stack.split(`
|
|
12
12
|
`),Rt=at.length-1,Dt=Ht.length-1;Rt>=1&&Dt>=0&&at[Rt]!==Ht[Dt];)Dt--;for(;Rt>=1&&Dt>=0;Rt--,Dt--)if(at[Rt]!==Ht[Dt]){if(Rt!==1||Dt!==1)do if(Rt--,Dt--,Dt<0||at[Rt]!==Ht[Dt]){var er=`
|
|
13
|
-
`+at[Rt].replace(" at new "," at ");return z.displayName&&er.includes("<anonymous>")&&(er=er.replace("<anonymous>",z.displayName)),typeof z=="function"&&Se.set(z,er),er}while(Rt>=1&&Dt>=0);break}}}finally{Ee=!1,ie.current=Re,ee(),Error.prepareStackTrace=He}var
|
|
13
|
+
`+at[Rt].replace(" at new "," at ");return z.displayName&&er.includes("<anonymous>")&&(er=er.replace("<anonymous>",z.displayName)),typeof z=="function"&&Se.set(z,er),er}while(Rt>=1&&Dt>=0);break}}}finally{Ee=!1,ie.current=Re,ee(),Error.prepareStackTrace=He}var yr=z?z.displayName||z.name:"",ir=yr?pe(yr):"";return typeof z=="function"&&Se.set(z,ir),ir}function lt(z,oe,he){return Ue(z,!1)}function ht(z){var oe=z.prototype;return!!(oe&&oe.isReactComponent)}function $e(z,oe,he){if(z==null)return"";if(typeof z=="function")return Ue(z,ht(z));if(typeof z=="string")return pe(z);switch(z){case u:return pe("Suspense");case l:return pe("SuspenseList")}if(typeof z=="object")switch(z.$$typeof){case c:return lt(z.render);case f:return $e(z.type,oe,he);case h:{var ke=z,He=ke._payload,Re=ke._init;try{return $e(Re(He),oe,he)}catch{}}}return""}var mt=Object.prototype.hasOwnProperty,_e={},ge=P.ReactDebugCurrentFrame;function Ae(z){if(z){var oe=z._owner,he=$e(z.type,z._source,oe?oe.type:null);ge.setExtraStackFrame(he)}else ge.setExtraStackFrame(null)}function qe(z,oe,he,ke,He){{var Re=Function.call.bind(mt);for(var ze in z)if(Re(z,ze)){var at=void 0;try{if(typeof z[ze]!="function"){var Ht=Error((ke||"React class")+": "+he+" type `"+ze+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof z[ze]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ht.name="Invariant Violation",Ht}at=z[ze](oe,ze,ke,he,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Rt){at=Rt}at&&!(at instanceof Error)&&(Ae(He),R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ke||"React class",he,ze,typeof at),Ae(null)),at instanceof Error&&!(at.message in _e)&&(_e[at.message]=!0,Ae(He),R("Failed %s type: %s",he,at.message),Ae(null))}}}var De=Array.isArray;function Oe(z){return De(z)}function Ie(z){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,he=oe&&z[Symbol.toStringTag]||z.constructor.name||"Object";return he}}function Fe(z){try{return ft(z),!1}catch{return!0}}function ft(z){return""+z}function dt(z){if(Fe(z))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ie(z)),ft(z)}var Ge=P.ReactCurrentOwner,jt={key:!0,ref:!0,__self:!0,__source:!0},xt,Ze,Tt;Tt={};function Nt(z){if(mt.call(z,"ref")){var oe=Object.getOwnPropertyDescriptor(z,"ref").get;if(oe&&oe.isReactWarning)return!1}return z.ref!==void 0}function nt(z){if(mt.call(z,"key")){var oe=Object.getOwnPropertyDescriptor(z,"key").get;if(oe&&oe.isReactWarning)return!1}return z.key!==void 0}function St(z,oe){if(typeof z.ref=="string"&&Ge.current&&oe&&Ge.current.stateNode!==oe){var he=$(Ge.current.type);Tt[he]||(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',$(Ge.current.type),z.ref),Tt[he]=!0)}}function At(z,oe){{var he=function(){xt||(xt=!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))};he.isReactWarning=!0,Object.defineProperty(z,"key",{get:he,configurable:!0})}}function st(z,oe){{var he=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))};he.isReactWarning=!0,Object.defineProperty(z,"ref",{get:he,configurable:!0})}}var kt=function(z,oe,he,ke,He,Re,ze){var at={$$typeof:t,type:z,key:oe,ref:he,props:ze,_owner:Re};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:ke}),Object.defineProperty(at,"_source",{configurable:!1,enumerable:!1,writable:!1,value:He}),Object.freeze&&(Object.freeze(at.props),Object.freeze(at)),at};function It(z,oe,he,ke,He){{var Re,ze={},at=null,Ht=null;he!==void 0&&(dt(he),at=""+he),nt(oe)&&(dt(oe.key),at=""+oe.key),Nt(oe)&&(Ht=oe.ref,St(oe,He));for(Re in oe)mt.call(oe,Re)&&!jt.hasOwnProperty(Re)&&(ze[Re]=oe[Re]);if(z&&z.defaultProps){var Rt=z.defaultProps;for(Re in Rt)ze[Re]===void 0&&(ze[Re]=Rt[Re])}if(at||Ht){var Dt=typeof z=="function"?z.displayName||z.name||"Unknown":z;at&&At(ze,Dt),Ht&&st(ze,Dt)}return kt(z,at,Ht,He,ke,Ge.current,ze)}}var it=P.ReactCurrentOwner,bt=P.ReactDebugCurrentFrame;function Ct(z){if(z){var oe=z._owner,he=$e(z.type,z._source,oe?oe.type:null);bt.setExtraStackFrame(he)}else bt.setExtraStackFrame(null)}var Ye;Ye=!1;function gt(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function Pt(){{if(it.current){var z=$(it.current.type);if(z)return`
|
|
14
14
|
|
|
15
15
|
Check the render method of \``+z+"`."}return""}}function ot(z){{if(z!==void 0){var oe=z.fileName.replace(/^.*[\\\/]/,""),he=z.lineNumber;return`
|
|
16
16
|
|
|
17
17
|
Check your code at `+oe+":"+he+"."}return""}}var wt={};function Ft(z){{var oe=Pt();if(!oe){var he=typeof z=="string"?z:z.displayName||z.name;he&&(oe=`
|
|
18
18
|
|
|
19
|
-
Check the top-level render call using <`+he+">.")}return oe}}function k(z,oe){{if(!z._store||z._store.validated||z.key!=null)return;z._store.validated=!0;var he=Ft(oe);if(wt[he])return;wt[he]=!0;var ke="";z&&z._owner&&z._owner!==it.current&&(ke=" It was passed a child from "+$(z._owner.type)+"."),Ct(z),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',he,ke),Ct(null)}}function S(z,oe){{if(typeof z!="object")return;if(Oe(z))for(var he=0;he<z.length;he++){var ke=z[he];gt(ke)&&k(ke,oe)}else if(gt(z))z._store&&(z._store.validated=!0);else if(z){var He=A(z);if(typeof He=="function"&&He!==z.entries)for(var Re=He.call(z),ze;!(ze=Re.next()).done;)gt(ze.value)&&k(ze.value,oe)}}}function T(z){{var oe=z.type;if(oe==null||typeof oe=="string")return;var he;if(typeof oe=="function")he=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===c||oe.$$typeof===f))he=oe.propTypes;else return;if(he){var ke=$(oe);qe(he,z.props,"prop",ke,z)}else if(oe.PropTypes!==void 0&&!Ye){Ye=!0;var He=$(oe);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",He||"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 B(z){{for(var oe=Object.keys(z.props),he=0;he<oe.length;he++){var ke=oe[he];if(ke!=="children"&&ke!=="key"){Ct(z),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),Ct(null);break}}z.ref!==null&&(Ct(z),R("Invalid attribute `ref` supplied to `React.Fragment`."),Ct(null))}}var K={};function Z(z,oe,he,ke,He,Re){{var ze=ae(z);if(!ze){var at="";(z===void 0||typeof z=="object"&&z!==null&&Object.keys(z).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 Ht=ot(He);Ht?at+=Ht:at+=Pt();var Rt;z===null?Rt="null":Oe(z)?Rt="array":z!==void 0&&z.$$typeof===t?(Rt="<"+($(z.type)||"Unknown")+" />",at=" Did you accidentally export a JSX literal instead of a component?"):Rt=typeof z,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Rt,at)}var Dt=It(z,oe,he,He,Re);if(Dt==null)return Dt;if(ze){var er=oe.children;if(er!==void 0)if(ke)if(Oe(er)){for(var
|
|
19
|
+
Check the top-level render call using <`+he+">.")}return oe}}function k(z,oe){{if(!z._store||z._store.validated||z.key!=null)return;z._store.validated=!0;var he=Ft(oe);if(wt[he])return;wt[he]=!0;var ke="";z&&z._owner&&z._owner!==it.current&&(ke=" It was passed a child from "+$(z._owner.type)+"."),Ct(z),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',he,ke),Ct(null)}}function S(z,oe){{if(typeof z!="object")return;if(Oe(z))for(var he=0;he<z.length;he++){var ke=z[he];gt(ke)&&k(ke,oe)}else if(gt(z))z._store&&(z._store.validated=!0);else if(z){var He=A(z);if(typeof He=="function"&&He!==z.entries)for(var Re=He.call(z),ze;!(ze=Re.next()).done;)gt(ze.value)&&k(ze.value,oe)}}}function T(z){{var oe=z.type;if(oe==null||typeof oe=="string")return;var he;if(typeof oe=="function")he=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===c||oe.$$typeof===f))he=oe.propTypes;else return;if(he){var ke=$(oe);qe(he,z.props,"prop",ke,z)}else if(oe.PropTypes!==void 0&&!Ye){Ye=!0;var He=$(oe);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",He||"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 B(z){{for(var oe=Object.keys(z.props),he=0;he<oe.length;he++){var ke=oe[he];if(ke!=="children"&&ke!=="key"){Ct(z),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),Ct(null);break}}z.ref!==null&&(Ct(z),R("Invalid attribute `ref` supplied to `React.Fragment`."),Ct(null))}}var K={};function Z(z,oe,he,ke,He,Re){{var ze=ae(z);if(!ze){var at="";(z===void 0||typeof z=="object"&&z!==null&&Object.keys(z).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 Ht=ot(He);Ht?at+=Ht:at+=Pt();var Rt;z===null?Rt="null":Oe(z)?Rt="array":z!==void 0&&z.$$typeof===t?(Rt="<"+($(z.type)||"Unknown")+" />",at=" Did you accidentally export a JSX literal instead of a component?"):Rt=typeof z,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Rt,at)}var Dt=It(z,oe,he,He,Re);if(Dt==null)return Dt;if(ze){var er=oe.children;if(er!==void 0)if(ke)if(Oe(er)){for(var yr=0;yr<er.length;yr++)S(er[yr],z);Object.freeze&&Object.freeze(er)}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 S(er,z)}if(mt.call(oe,"key")){var ir=$(z),Kt=Object.keys(oe).filter(function(Dr){return Dr!=="key"}),gr=Kt.length>0?"{key: someKey, "+Kt.join(": ..., ")+": ...}":"{key: someKey}";if(!K[ir+gr]){var pn=Kt.length>0?"{"+Kt.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} />`,gr,ir,hn,ir),K[ir+gr]=!0}}return z===n?B(Dt):T(Dt),Dt}}function te(z,oe,he){return Z(z,oe,he,!0)}function Be(z,oe,he){return Z(z,oe,he,!1)}var tt=Be,Ne=te;da.Fragment=n,da.jsx=tt,da.jsxs=Ne}()),da}Tn.env.NODE_ENV==="production"?md.exports=q3():md.exports=W3();var _=md.exports;window._iconfont_svg_string_4776227='<svg><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);function Gn(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 G3="1.18.0",H3="1.40.0",K3={"-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 Sh extends Error{}class Eh extends Sh{constructor(t,r){super(t),this.code=r,this.type=K3[r]??"ServerError"}}class Qv extends Sh{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var e1=e=>{throw TypeError(e)},Ch=(e,t,r)=>t.has(e)||e1("Cannot "+r),tr=(e,t,r)=>(Ch(e,t,"read from private field"),r?r.call(e):t.get(e)),ys=(e,t,r)=>t.has(e)?e1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ao=(e,t,r,n)=>(Ch(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),t1=(e,t,r)=>(Ch(e,t,"access private method"),r),J3=(e,t,r,n)=>({set _(i){Ao(e,t,i,r)},get _(){return tr(e,t,n)}}),Ms,ja,bi,Bs,Wa,Oo,vu,r1,n1;function X3(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const Y3={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class Z3{constructor(t,r={}){if(ys(this,vu),ys(this,Ms,0),ys(this,ja,0),ys(this,bi,null),ys(this,Bs,null),ys(this,Wa,new Set),ys(this,Oo,new Map),this.endpoint=t,this.options={...Y3,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=X3(this.endpoint))}async makeRequest(t,r){const n=await t1(this,vu,r1).call(this);return new Promise((i,s)=>{Ao(this,Ms,tr(this,Ms)+1),tr(this,Oo).set(tr(this,Ms),{resolve:i,reject:s,timeout:setTimeout(()=>{tr(this,Oo).delete(tr(this,Ms)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:tr(this,Ms),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new Eh(i.message,i.code);return s})}async subscribe(t){const r=new Q3(t);return tr(this,Wa).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}Ms=new WeakMap;ja=new WeakMap;bi=new WeakMap;Bs=new WeakMap;Wa=new WeakMap;Oo=new WeakMap;vu=new WeakSet;r1=function(){return tr(this,Bs)?tr(this,Bs):(Ao(this,Bs,new Promise(e=>{var t;(t=tr(this,bi))==null||t.close(),Ao(this,bi,new this.options.WebSocketConstructor(this.endpoint)),tr(this,bi).addEventListener("open",()=>{Ao(this,ja,0),e(tr(this,bi))}),tr(this,bi).addEventListener("close",()=>{J3(this,ja)._++,tr(this,ja)<=this.options.maxReconnects&&setTimeout(()=>{t1(this,vu,n1).call(this)},this.options.reconnectTimeout)}),tr(this,bi).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,Oo).has(n.id)){const{resolve:i,timeout:s}=tr(this,Oo).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,Bs))};n1=async function(){var e;return(e=tr(this,bi))==null||e.close(),Ao(this,Bs,null),Promise.allSettled([...tr(this,Wa)].map(t=>t.subscribe(this)))};class Q3{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 i1=e=>{throw TypeError(e)},Mh=(e,t,r)=>t.has(e)||i1("Cannot "+r),tn=(e,t,r)=>(Mh(e,t,"read from private field"),r?r.call(e):t.get(e)),Pc=(e,t,r)=>t.has(e)?i1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),gd=(e,t,r,n)=>(Mh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),eE=(e,t,r)=>(Mh(e,t,"access private method"),r),Ca,bn,ka,vd,s1;class o1{constructor(t){Pc(this,vd),Pc(this,Ca,0),Pc(this,bn),Pc(this,ka),gd(this,bn,t)}fetch(t,r){const n=tn(this,bn).fetch??fetch;if(!n)throw new Error("The current environment does not support fetch, you can provide a fetch implementation in the options for SuiHTTPTransport.");return n(t,r)}async request(t){var i,s;gd(this,Ca,tn(this,Ca)+1);const r=await this.fetch(((i=tn(this,bn).rpc)==null?void 0:i.url)??tn(this,bn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":G3,"Client-Target-Api-Version":H3,"Client-Request-Method":t.method,...(s=tn(this,bn).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:tn(this,Ca),method:t.method,params:t.params})});if(!r.ok)throw new Qv(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new Eh(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await eE(this,vd,s1).call(this).subscribe(t);return async()=>!!await r()}}Ca=new WeakMap;bn=new WeakMap;ka=new WeakMap;vd=new WeakSet;s1=function(){var e;if(!tn(this,ka)){const t=tn(this,bn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");gd(this,ka,new Z3(((e=tn(this,bn).websocket)==null?void 0:e.url)??tn(this,bn).url,{WebSocketConstructor:t,...tn(this,bn).websocket}))}return tn(this,ka)};function a1(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 tE(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 R=u[h],N=0;for(let F=b-1;(R!==0||N<f)&&F!==-1;F--,N++)R+=256*w[F]>>>0,w[F]=R%r>>>0,R=R/r>>>0;if(R!==0)throw new Error("Non-zero carry");f=N,h++}let A=b-f;for(;A!==b&&w[A]===0;)A++;let P=n.repeat(l);for(;A<b;++A)P+=e.charAt(w[A]);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 R=t[u.charCodeAt(l)];if(R===255)return;let N=0;for(let F=y-1;(R!==0||N<h)&&F!==-1;F--,N++)R+=r*b[F]>>>0,b[F]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");h=N,l++}let w=y-h;for(;w!==y&&b[w]===0;)w++;const A=new Uint8Array(f+(y-w));let P=f;for(;w!==y;)A[P++]=b[w++];return A}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 rE="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const c1=tE(rE),qo=e=>c1.encode(e),Pi=e=>c1.decode(e),nE=qo,iE=Pi;function Pn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const cf=8192;function qr(e){if(e.length<cf)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=cf){const n=e.slice(r,r+cf);t+=String.fromCharCode(...n)}return btoa(t)}const u1=qr,l1=Pn;function Wo(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 ji(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const f1=ji,d1=Wo;function Th(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 sE(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 h1{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}=sE(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 p1(e,t){switch(t){case"base58":return qo(e);case"base64":return qr(e);case"hex":return ji(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function oE(e,t){switch(t){case"base58":return Pi(e);case"base64":return Pn(e);case"hex":return Wo(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function Ah(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 m1{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 uf(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return uf(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return uf(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return Th(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 p1(this.toBytes(),t)}}function uf(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 g1=e=>{throw TypeError(e)},v1=(e,t,r)=>t.has(e)||g1("Cannot "+r),wn=(e,t,r)=>(v1(e,t,"read from private field"),r?r.call(e):t.get(e)),yu=(e,t,r)=>t.has(e)?g1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),bu=(e,t,r,n)=>(v1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),po,Ma,Hc,qi;const aE=class y1{constructor(t){yu(this,po),yu(this,Ma),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),bu(this,po,t.write),bu(this,Ma,t.serialize??((r,n)=>{const i=new m1({initialSize:this.serializedSize(r)??void 0,...n});return wn(this,po).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),wn(this,po).call(this,t,r)}serialize(t,r){return this.validate(t),new w1(this,wn(this,Ma).call(this,t,r))}parse(t){const r=new h1(t);return this.read(r)}fromHex(t){return this.parse(Wo(t))}fromBase58(t){return this.parse(Pi(t))}fromBase64(t){return this.parse(Pn(t))}transform({name:t,input:r,output:n,validate:i}){return new y1({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>wn(this,po).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>wn(this,Ma).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};po=new WeakMap;Ma=new WeakMap;let Hn=aE;const b1=Symbol.for("@mysten/serialized-bcs");function cE(e){return!!e&&typeof e=="object"&&e[b1]===!0}class w1{constructor(t,r){yu(this,Hc),yu(this,qi),bu(this,Hc,t),bu(this,qi,r)}get[b1](){return!0}toBytes(){return wn(this,qi)}toHex(){return ji(wn(this,qi))}toBase64(){return qr(wn(this,qi))}toBase58(){return qo(wn(this,qi))}parse(){return wn(this,Hc).parse(wn(this,qi))}}Hc=new WeakMap;qi=new WeakMap;function wu({size:e,...t}){return new Hn({...t,serializedSize:()=>e})}function lf({readMethod:e,writeMethod:t,...r}){return wu({...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 ff({readMethod:e,writeMethod:t,...r}){return wu({...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 uE({serialize:e,...t}){const r=new Hn({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function lE({toBytes:e,fromBytes:t,...r}){return new Hn({...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=Th(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 fE(e){let t=null;function r(){return t||(t=e()),t}return new Hn({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 lf({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return lf({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return lf({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return ff({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return ff({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return ff({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return wu({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 uE({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(Th(t)),...e})},bytes(e,t){return wu({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 lE({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Hn({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 Hn({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 Hn({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 Hn({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 Hn({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 fE(e)}},dE=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:h1,BcsType:Hn,BcsWriter:m1,SerializedBcs:w1,bcs:W,decodeStr:oE,encodeStr:p1,fromB58:iE,fromB64:l1,fromBase58:Pi,fromBase64:Pn,fromHEX:d1,fromHex:Wo,isSerializedBcs:cE,splitGenericParameters:Ah,toB58:nE,toB64:u1,toBase58:qo,toBase64:qr,toHEX:f1,toHex:ji},Symbol.toStringTag,{value:"Module"})),hE=32;function yd(e){try{return Pi(e).length===hE}catch{return!1}}const il=32;function wi(e){return mE(e)&&gE(e)===il}function Ta(e){return wi(e)}function pE(e){return e.includes("::")?Oh(e):e}function Oh(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("<")?Ah(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>pE(o.trim())):[];return{address:$r(t),module:r,name:i,typeParams:s}}function _1(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Oh(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:_1(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function $r(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(il*2,"0")}`}function Ci(e,t=!1){return $r(e,t)}function mE(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function gE(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const vE=/^vector<(.+)>$/,yE=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let em=class mo{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(vE);if(n)return{vector:mo.parseFromStr(n[1],r)};const i=t.match(yE);if(i)return{struct:{address:r?$r(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:mo.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return Ah(t).map(n=>mo.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<${mo.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(mo.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function bE(e){return W.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function wE(e){return W.enum("Option",{None:null,Some:e})}const Qt=W.bytes(il).transform({validate:e=>{const t=typeof e=="string"?e:ji(e);if(!t||!wi($r(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?Wo($r(e)):e,output:e=>$r(ji(e))}),Sn=W.vector(W.u8()).transform({name:"ObjectDigest",input:e=>Pi(e),output:e=>qo(new Uint8Array(e)),validate:e=>{if(Pi(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Qr=W.struct("SuiObjectRef",{objectId:Qt,version:W.u64(),digest:Sn}),x1=W.struct("SharedObjectRef",{objectId:Qt,initialSharedVersion:W.u64(),mutable:W.bool()}),S1=W.enum("ObjectArg",{ImmOrOwnedObject:Qr,SharedObject:x1,Receiving:Qr}),E1=W.enum("CallArg",{Pure:W.struct("Pure",{bytes:W.vector(W.u8()).transform({input:e=>typeof e=="string"?Pn(e):e,output:e=>qr(new Uint8Array(e))})}),Object:S1}),Ih=W.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:W.lazy(()=>Ih),struct:W.lazy(()=>I1),u16:null,u32:null,u256:null}),Ph=Ih.transform({input:e=>typeof e=="string"?em.parseFromStr(e,!0):e,output:e=>em.tagToString(e)}),zn=W.enum("Argument",{GasCoin:null,Input:W.u16(),Result:W.u16(),NestedResult:W.tuple([W.u16(),W.u16()])}),C1=W.struct("ProgrammableMoveCall",{package:Qt,module:W.string(),function:W.string(),typeArguments:W.vector(Ph),arguments:W.vector(zn)}),M1=W.enum("Command",{MoveCall:C1,TransferObjects:W.struct("TransferObjects",{objects:W.vector(zn),address:zn}),SplitCoins:W.struct("SplitCoins",{coin:zn,amounts:W.vector(zn)}),MergeCoins:W.struct("MergeCoins",{destination:zn,sources:W.vector(zn)}),Publish:W.struct("Publish",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?Pn(e):e,output:e=>qr(new Uint8Array(e))})),dependencies:W.vector(Qt)}),MakeMoveVec:W.struct("MakeMoveVec",{type:wE(Ph).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:W.vector(zn)}),Upgrade:W.struct("Upgrade",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?Pn(e):e,output:e=>qr(new Uint8Array(e))})),dependencies:W.vector(Qt),package:Qt,ticket:zn})}),T1=W.struct("ProgrammableTransaction",{inputs:W.vector(E1),commands:W.vector(M1)}),A1=W.enum("TransactionKind",{ProgrammableTransaction:T1,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),O1=W.enum("TransactionExpiration",{None:null,Epoch:bE()}),I1=W.struct("StructTag",{address:Qt,module:W.string(),name:W.string(),typeParams:W.vector(Ih)}),P1=W.struct("GasData",{payment:W.vector(Qr),owner:Qt,price:W.u64(),budget:W.u64()}),j1=W.struct("TransactionDataV1",{kind:A1,sender:Qt,gasData:P1,expiration:O1}),k1=W.enum("TransactionData",{V1:j1}),R1=W.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),N1=W.enum("IntentVersion",{V0:null}),D1=W.enum("AppId",{Sui:null}),$1=W.struct("Intent",{scope:R1,version:N1,appId:D1});function B1(e){return W.struct(`IntentMessage<${e.name}>`,{intent:$1,value:e})}const L1=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())}),F1=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())}),U1=W.struct("MultiSigPkMap",{pubKey:F1,weight:W.u8()}),z1=W.struct("MultiSigPublicKey",{pk_map:W.vector(U1),threshold:W.u16()}),_E=W.struct("MultiSig",{sigs:W.vector(L1),bitmap:W.u16(),multisig_pk:z1}),xE=W.vector(W.u8()).transform({input:e=>typeof e=="string"?Pn(e):e,output:e=>qr(new Uint8Array(e))}),V1=W.struct("SenderSignedTransaction",{intentMessage:B1(k1),txSignatures:W.vector(xE)}),SE=W.vector(V1,{name:"SenderSignedData"}),EE=W.struct("PasskeyAuthenticator",{authenticatorData:W.vector(W.u8()),clientDataJson:W.string(),userSignature:W.vector(W.u8())}),CE=W.enum("PackageUpgradeError",{UnableToFetchPackage:W.struct("UnableToFetchPackage",{packageId:Qt}),NotAPackage:W.struct("NotAPackage",{objectId:Qt}),IncompatibleUpgrade:null,DigestDoesNotMatch:W.struct("DigestDoesNotMatch",{digest:W.vector(W.u8())}),UnknownUpgradePolicy:W.struct("UnknownUpgradePolicy",{policy:W.u8()}),PackageIDDoesNotMatch:W.struct("PackageIDDoesNotMatch",{packageId:Qt,ticketId:Qt})}),ME=W.struct("ModuleId",{address:Qt,name:W.string()}),tm=W.struct("MoveLocation",{module:ME,function:W.u16(),instruction:W.u16(),functionName:W.option(W.string())}),TE=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}),AE=W.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),OE=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:Qt}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:W.option(tm),MoveAbort:W.tuple([tm,W.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:W.struct("CommandArgumentError",{argIdx:W.u16(),kind:TE}),TypeArgumentError:W.struct("TypeArgumentError",{argumentIdx:W.u16(),kind:AE}),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:CE}),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(Qt)}),AddressDeniedForCoin:W.struct("AddressDeniedForCoin",{address:Qt,coinType:W.string()}),CoinTypeGlobalPause:W.struct("CoinTypeGlobalPause",{coinType:W.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),q1=W.enum("ExecutionStatus",{Success:null,Failed:W.struct("ExecutionFailed",{error:OE,command:W.option(W.u64())})}),W1=W.struct("GasCostSummary",{computationCost:W.u64(),storageCost:W.u64(),storageRebate:W.u64(),nonRefundableStorageFee:W.u64()}),bo=W.enum("Owner",{AddressOwner:Qt,ObjectOwner:Qt,Shared:W.struct("Shared",{initialSharedVersion:W.u64()}),Immutable:null}),IE=W.struct("TransactionEffectsV1",{status:q1,executedEpoch:W.u64(),gasUsed:W1,modifiedAtVersions:W.vector(W.tuple([Qt,W.u64()])),sharedObjects:W.vector(Qr),transactionDigest:Sn,created:W.vector(W.tuple([Qr,bo])),mutated:W.vector(W.tuple([Qr,bo])),unwrapped:W.vector(W.tuple([Qr,bo])),deleted:W.vector(Qr),unwrappedThenDeleted:W.vector(Qr),wrapped:W.vector(Qr),gasObject:W.tuple([Qr,bo]),eventsDigest:W.option(Sn),dependencies:W.vector(Sn)}),jh=W.tuple([W.u64(),Sn]),PE=W.enum("ObjectIn",{NotExist:null,Exist:W.tuple([jh,bo])}),jE=W.enum("ObjectOut",{NotExist:null,ObjectWrite:W.tuple([Sn,bo]),PackageWrite:jh}),kE=W.enum("IDOperation",{None:null,Created:null,Deleted:null}),RE=W.struct("EffectsObjectChange",{inputState:PE,outputState:jE,idOperation:kE}),NE=W.enum("UnchangedSharedKind",{ReadOnlyRoot:jh,MutateDeleted:W.u64(),ReadDeleted:W.u64(),Cancelled:W.u64(),PerEpochConfig:null}),DE=W.struct("TransactionEffectsV2",{status:q1,executedEpoch:W.u64(),gasUsed:W1,transactionDigest:Sn,gasObjectIndex:W.option(W.u32()),eventsDigest:W.option(Sn),dependencies:W.vector(Sn),lamportVersion:W.u64(),changedObjects:W.vector(W.tuple([Qt,RE])),unchangedSharedObjects:W.vector(W.tuple([Qt,NE])),auxDataDigest:W.option(Sn)}),$E=W.enum("TransactionEffects",{V1:IE,V2:DE}),df={...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:Qt,AppId:D1,Argument:zn,CallArg:E1,CompressedSignature:L1,GasData:P1,Intent:$1,IntentMessage:B1,IntentScope:R1,IntentVersion:N1,MultiSig:_E,MultiSigPkMap:U1,MultiSigPublicKey:z1,ObjectArg:S1,ObjectDigest:Sn,ProgrammableMoveCall:C1,ProgrammableTransaction:T1,PublicKey:F1,SenderSignedData:SE,SenderSignedTransaction:V1,SharedObjectRef:x1,StructTag:I1,SuiObjectRef:Qr,Command:M1,TransactionData:k1,TransactionDataV1:j1,TransactionExpiration:O1,TransactionKind:A1,TypeTag:Ph,TransactionEffects:$E,PasskeyAuthenticator:EE},G1="…";function BE(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${G1}${e.slice(-4)}`}function LE(e){return`${e.slice(0,10)}${G1}`}const H1=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,K1=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,FE=235;function J1(e){return e.length>FE?!1:e.includes("@")?H1.test(e):K1.test(e)}function X1(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!H1.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!K1.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 UE=9,zE=BigInt(1e9),VE="0x1",Y1="0x2",qE="0x3",WE=Ci("0x6"),GE="sui_system",kh=`${Y1}::sui::SUI`,HE=Ci("0x5"),KE=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,JE=/^\d+$/,XE=64,Z1="/",Q1=e=>{const t=e.split(Z1);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!JE.test(i)||!J1(r)?!1:KE.test(n)&&n.length<XE},YE=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(Z1)&&!Q1(r))return!1;return!0};function hf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ZE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ey(e,...t){if(!ZE(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 rm(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 QE(e,t){ey(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 _u=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Ts=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),ty=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,vi=Ts?e=>e:e=>ty(e);function ro(e){for(let t=0;t<e.length;t++)e[t]=ty(e[t])}function eC(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Ra(e){return typeof e=="string"&&(e=eC(e)),ey(e),e}let tC=class{clone(){return this._cloneInto()}};function rC(e){const t=(n,i)=>e(i).update(Ra(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const nC=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 iC extends tC{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,hf(t),hf(r),hf(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=_u(this.buffer)}update(t){rm(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=Ra(t);const s=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<s;){this.pos===r&&(Ts||ro(i),this.compress(i,0,!1),Ts||ro(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||ro(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);Ts||ro(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){rm(this),QE(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),Ts||ro(n),this.compress(n,0,!0),Ts||ro(n);const i=_u(t);this.get().forEach((s,o)=>i[o]=vi(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 jc=BigInt(2**32-1),bd=BigInt(32);function ry(e,t=!1){return t?{h:Number(e&jc),l:Number(e>>bd&jc)}:{h:Number(e>>bd&jc)|0,l:Number(e&jc)|0}}function sC(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}=ry(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const oC=(e,t)=>BigInt(e>>>0)<<bd|BigInt(t>>>0),aC=(e,t,r)=>e>>>r,cC=(e,t,r)=>e<<32-r|t>>>r,uC=(e,t,r)=>e>>>r|t<<32-r,lC=(e,t,r)=>e<<32-r|t>>>r,fC=(e,t,r)=>e<<64-r|t>>>r-32,dC=(e,t,r)=>e>>>r-32|t<<64-r,hC=(e,t)=>t,pC=(e,t)=>e,mC=(e,t,r)=>e<<r|t>>>32-r,gC=(e,t,r)=>t<<r|e>>>32-r,vC=(e,t,r)=>t<<r-32|e>>>64-r,yC=(e,t,r)=>e<<r-32|t>>>64-r;function bC(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const wC=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),_C=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,xC=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),SC=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,EC=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),CC=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0,MC={fromBig:ry,split:sC,toBig:oC,shrSH:aC,shrSL:cC,rotrSH:uC,rotrSL:lC,rotrBH:fC,rotrBL:dC,rotr32H:hC,rotr32L:pC,rotlSH:mC,rotlSL:gC,rotlBH:vC,rotlBL:yC,add:bC,add3L:wC,add3H:_C,add4L:xC,add4H:SC,add5H:CC,add5L:EC},Pr=MC,lr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Pe=new Uint32Array(32);function Ui(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],A=Pr.add3L(c,l,o);u=Pr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Pr.rotr32H(w,b),Dl:Pr.rotr32L(w,b)},{h:y,l:h}=Pr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Pr.rotrSH(f,l,24),Bl:Pr.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 zi(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],A=Pr.add3L(c,l,o);u=Pr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Pr.rotrSH(w,b,16),Dl:Pr.rotrSL(w,b,16)},{h:y,l:h}=Pr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Pr.rotrBH(f,l,63),Bl:Pr.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 ny extends iC{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=lr[0]|0,this.v0h=lr[1]|0,this.v1l=lr[2]|0,this.v1h=lr[3]|0,this.v2l=lr[4]|0,this.v2h=lr[5]|0,this.v3l=lr[6]|0,this.v3h=lr[7]|0,this.v4l=lr[8]|0,this.v4h=lr[9]|0,this.v5l=lr[10]|0,this.v5h=lr[11]|0,this.v6l=lr[12]|0,this.v6h=lr[13]|0,this.v7l=lr[14]|0,this.v7h=lr[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=_u(Ra(t.salt));this.v4l^=vi(n[0]),this.v4h^=vi(n[1]),this.v5l^=vi(n[2]),this.v5h^=vi(n[3])}if(t.personalization){const n=_u(Ra(t.personalization));this.v6l^=vi(n[0]),this.v6h^=vi(n[1]),this.v7l^=vi(n[2]),this.v7h^=vi(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(Ra(t.key)),this.update(n)}}get(){let{v0l:t,v0h:r,v1l:n,v1h:i,v2l:s,v2h:o,v3l:a,v3h:c,v4l:u,v4h:l,v5l:f,v5h:h,v6l:y,v6h:b,v7l:w,v7h:A}=this;return[t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,A]}set(t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,A){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=A|0}compress(t,r,n){this.get().forEach((c,u)=>Pe[u]=c),Pe.set(lr,16);let{h:i,l:s}=Pr.fromBig(BigInt(this.length));Pe[24]=lr[8]^s,Pe[25]=lr[9]^i,n&&(Pe[28]=~Pe[28],Pe[29]=~Pe[29]);let o=0;const a=nC;for(let c=0;c<12;c++)Ui(0,4,8,12,t,r+2*a[o++]),zi(0,4,8,12,t,r+2*a[o++]),Ui(1,5,9,13,t,r+2*a[o++]),zi(1,5,9,13,t,r+2*a[o++]),Ui(2,6,10,14,t,r+2*a[o++]),zi(2,6,10,14,t,r+2*a[o++]),Ui(3,7,11,15,t,r+2*a[o++]),zi(3,7,11,15,t,r+2*a[o++]),Ui(0,5,10,15,t,r+2*a[o++]),zi(0,5,10,15,t,r+2*a[o++]),Ui(1,6,11,12,t,r+2*a[o++]),zi(1,6,11,12,t,r+2*a[o++]),Ui(2,7,8,13,t,r+2*a[o++]),zi(2,7,8,13,t,r+2*a[o++]),Ui(3,4,9,14,t,r+2*a[o++]),zi(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 iy=rC(e=>new ny(e)),TC=Object.freeze(Object.defineProperty({__proto__:null,BLAKE2b:ny,blake2b:iy},Symbol.toStringTag,{value:"Module"}));function AC(e,t,r){const n=df.Address.serialize(e).toBytes(),i=df.TypeTag.serialize(t).toBytes(),s=df.u64().serialize(r.length).toBytes(),o=iy.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${ji(o.digest().slice(0,32))}`}const OC=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:zE,MOVE_STDLIB_ADDRESS:VE,SUI_ADDRESS_LENGTH:il,SUI_CLOCK_OBJECT_ID:WE,SUI_DECIMALS:UE,SUI_FRAMEWORK_ADDRESS:Y1,SUI_SYSTEM_ADDRESS:qE,SUI_SYSTEM_MODULE_NAME:GE,SUI_SYSTEM_STATE_OBJECT_ID:HE,SUI_TYPE_ARG:kh,deriveDynamicFieldID:AC,formatAddress:BE,formatDigest:LE,fromB64:l1,fromBase58:Pi,fromBase64:Pn,fromHEX:d1,fromHex:Wo,isValidNamedPackage:Q1,isValidNamedType:YE,isValidSuiAddress:wi,isValidSuiNSName:J1,isValidSuiObjectId:Ta,isValidTransactionDigest:yd,normalizeStructTag:_1,normalizeSuiAddress:$r,normalizeSuiNSName:X1,normalizeSuiObjectId:Ci,parseStructTag:Oh,toB64:u1,toBase58:qo,toBase64:qr,toHEX:f1,toHex:ji},Symbol.toStringTag,{value:"Module"}));var Rh=Object.defineProperty,IC=Object.getOwnPropertyDescriptor,PC=Object.getOwnPropertyNames,jC=Object.prototype.hasOwnProperty,kC=(e,t)=>{for(var r in t)Rh(e,r,{get:t[r],enumerable:!0})},RC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of PC(t))!jC.call(e,i)&&i!==r&&Rh(e,i,{get:()=>t[i],enumerable:!(n=IC(t,i))||n.enumerable});return e},NC=e=>RC(Rh({},"__esModule",{value:!0}),e),sy={};kC(sy,{BIC_REGEX:()=>ay,CUID2_REGEX:()=>cy,DECIMAL_REGEX:()=>uy,EMAIL_REGEX:()=>ly,EMOJI_REGEX:()=>fy,HEXADECIMAL_REGEX:()=>dy,HEX_COLOR_REGEX:()=>hy,IMEI_REGEX:()=>py,IPV4_REGEX:()=>my,IPV6_REGEX:()=>gy,IP_REGEX:()=>vy,ISO_DATE_REGEX:()=>yy,ISO_DATE_TIME_REGEX:()=>by,ISO_TIMESTAMP_REGEX:()=>xy,ISO_TIME_REGEX:()=>wy,ISO_TIME_SECOND_REGEX:()=>_y,ISO_WEEK_REGEX:()=>Sy,MAC48_REGEX:()=>Ey,MAC64_REGEX:()=>Cy,MAC_REGEX:()=>My,OCTAL_REGEX:()=>Ty,ULID_REGEX:()=>Ay,UUID_REGEX:()=>Oy,ValiError:()=>sl,_addIssue:()=>le,_isLuhnAlgo:()=>Nh,_isValidObjectKey:()=>Js,_stringify:()=>Nr,any:()=>uw,array:()=>lw,arrayAsync:()=>fw,awaitAsync:()=>oy,bic:()=>Ry,bigint:()=>dw,blob:()=>hw,boolean:()=>pw,brand:()=>Ny,bytes:()=>Dy,check:()=>$y,checkAsync:()=>By,checkItems:()=>Ly,config:()=>QC,creditCard:()=>Fy,cuid2:()=>Uy,custom:()=>mw,customAsync:()=>gw,date:()=>vw,decimal:()=>zy,deleteGlobalConfig:()=>$C,deleteGlobalMessage:()=>LC,deleteSchemaMessage:()=>UC,deleteSpecificMessage:()=>VC,email:()=>Vy,emoji:()=>qy,empty:()=>Wy,endsWith:()=>Gy,entriesFromList:()=>WC,enum:()=>Ed,enum_:()=>Ed,everyItem:()=>Hy,excludes:()=>Ky,fallback:()=>eM,fallbackAsync:()=>tM,file:()=>yw,filterItems:()=>Jy,findItem:()=>Xy,finite:()=>Yy,flatten:()=>rM,forward:()=>nM,forwardAsync:()=>iM,function:()=>Cd,function_:()=>Cd,getDefault:()=>$i,getDefaults:()=>wd,getDefaultsAsync:()=>_d,getDotPath:()=>ky,getFallback:()=>pc,getFallbacks:()=>xd,getFallbacksAsync:()=>Sd,getGlobalConfig:()=>hc,getGlobalMessage:()=>Iy,getSchemaMessage:()=>Py,getSpecificMessage:()=>jy,hash:()=>Zy,hexColor:()=>eb,hexadecimal:()=>Qy,imei:()=>tb,includes:()=>rb,instance:()=>bw,integer:()=>nb,intersect:()=>ww,intersectAsync:()=>_w,ip:()=>ib,ipv4:()=>sb,ipv6:()=>ob,is:()=>sM,isOfKind:()=>GC,isOfType:()=>HC,isValiError:()=>KC,isoDate:()=>ab,isoDateTime:()=>cb,isoTime:()=>ub,isoTimeSecond:()=>lb,isoTimestamp:()=>fb,isoWeek:()=>db,keyof:()=>oM,lazy:()=>xw,lazyAsync:()=>Sw,length:()=>hb,literal:()=>Ew,looseObject:()=>Cw,looseObjectAsync:()=>Mw,looseTuple:()=>Tw,looseTupleAsync:()=>Aw,mac:()=>pb,mac48:()=>mb,mac64:()=>gb,map:()=>Ow,mapAsync:()=>Iw,mapItems:()=>vb,maxBytes:()=>yb,maxLength:()=>bb,maxSize:()=>wb,maxValue:()=>_b,mimeType:()=>xb,minBytes:()=>Sb,minLength:()=>Eb,minSize:()=>Cb,minValue:()=>Mb,multipleOf:()=>Tb,nan:()=>Pw,never:()=>jw,nonEmpty:()=>Ab,nonNullable:()=>kw,nonNullableAsync:()=>Rw,nonNullish:()=>Nw,nonNullishAsync:()=>Dw,nonOptional:()=>Dh,nonOptionalAsync:()=>$h,normalize:()=>Ob,notBytes:()=>Ib,notLength:()=>Pb,notSize:()=>jb,notValue:()=>kb,null:()=>Md,null_:()=>Md,nullable:()=>$w,nullableAsync:()=>Bw,nullish:()=>Lw,nullishAsync:()=>Fw,number:()=>Uw,object:()=>zw,objectAsync:()=>Vw,objectWithRest:()=>qw,objectWithRestAsync:()=>Ww,octal:()=>Rb,omit:()=>aM,optional:()=>Bh,optionalAsync:()=>Lh,parse:()=>d2,parseAsync:()=>h2,parser:()=>cM,parserAsync:()=>uM,partial:()=>lM,partialAsync:()=>fM,partialCheck:()=>Db,partialCheckAsync:()=>$b,pick:()=>dM,picklist:()=>Fh,pipe:()=>hM,pipeAsync:()=>pM,promise:()=>Gw,rawCheck:()=>Bb,rawCheckAsync:()=>Lb,rawTransform:()=>Fb,rawTransformAsync:()=>Ub,readonly:()=>zb,record:()=>Hw,recordAsync:()=>Kw,reduceItems:()=>Vb,regex:()=>qb,required:()=>mM,requiredAsync:()=>gM,safeInteger:()=>Wb,safeParse:()=>p2,safeParseAsync:()=>m2,safeParser:()=>vM,safeParserAsync:()=>yM,set:()=>Jw,setAsync:()=>Xw,setGlobalConfig:()=>DC,setGlobalMessage:()=>BC,setSchemaMessage:()=>FC,setSpecificMessage:()=>zC,size:()=>Gb,someItem:()=>Hb,sortItems:()=>Kb,startsWith:()=>Jb,strictObject:()=>Yw,strictObjectAsync:()=>Zw,strictTuple:()=>Qw,strictTupleAsync:()=>e2,string:()=>t2,symbol:()=>r2,toLowerCase:()=>Xb,toMaxValue:()=>Yb,toMinValue:()=>Zb,toUpperCase:()=>Qb,transform:()=>ew,transformAsync:()=>tw,trim:()=>rw,trimEnd:()=>nw,trimStart:()=>iw,tuple:()=>n2,tupleAsync:()=>i2,tupleWithRest:()=>s2,tupleWithRestAsync:()=>o2,ulid:()=>sw,undefined:()=>Td,undefined_:()=>Td,union:()=>a2,unionAsync:()=>c2,unknown:()=>u2,unwrap:()=>bM,url:()=>ow,uuid:()=>aw,value:()=>cw,variant:()=>l2,variantAsync:()=>f2,void:()=>Ad,void_:()=>Ad});var ps=NC(sy);function oy(){return{kind:"transformation",type:"await",reference:oy,async:!0,async _run(e){return e.value=await e.value,e}}}var ay=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,cy=/^[a-z][\da-z]*$/u,uy=/^\d+$/u,ly=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,fy=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,dy=/^(?:0h|0x)?[\da-f]+$/iu,hy=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,py=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,my=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,gy=/^(?:(?:[\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,vy=/^(?:(?:[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,yy=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,by=/^\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,wy=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,_y=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,xy=/^\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,Sy=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,Ey=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,Cy=/^(?:[\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,My=/^(?:[\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,Ty=/^(?:0o)?[0-7]+$/iu,Ay=/^[\da-hjkmnp-tv-z]{26}$/iu,Oy=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,Zr;function DC(e){Zr={...Zr,...e}}function hc(e){return{lang:(e==null?void 0:e.lang)??(Zr==null?void 0:Zr.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(Zr==null?void 0:Zr.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(Zr==null?void 0:Zr.abortPipeEarly)}}function $C(){Zr=void 0}var Ai;function BC(e,t){Ai||(Ai=new Map),Ai.set(t,e)}function Iy(e){return Ai==null?void 0:Ai.get(e)}function LC(e){Ai==null||Ai.delete(e)}var Oi;function FC(e,t){Oi||(Oi=new Map),Oi.set(t,e)}function Py(e){return Oi==null?void 0:Oi.get(e)}function UC(e){Oi==null||Oi.delete(e)}var xn;function zC(e,t,r){xn||(xn=new Map),xn.get(e)||xn.set(e,new Map),xn.get(e).set(r,t)}function jy(e,t){var r;return(r=xn==null?void 0:xn.get(e))==null?void 0:r.get(t)}function VC(e,t){var r;(r=xn==null?void 0:xn.get(e))==null||r.delete(t)}function Nr(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)??Nr(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??jy(e.reference,c.lang)??(u?Py(c.lang):null)??n.message??Iy(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 qC=/\D/gu;function Nh(e){const t=e.replace(qC,"");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 Js(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function WC(e,t){const r={};for(const n of e)r[n]=t;return r}function ky(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 GC(e,t){return t.kind===e}function HC(e,t){return t.type===e}function KC(e){return e instanceof sl}var sl=class extends Error{constructor(t){super(t[0].message);vt(this,"issues");this.name="ValiError",this.issues=t}};function Ry(e){return{kind:"validation",type:"bic",reference:Ry,async:!1,expects:null,requirement:ay,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"BIC",t,r),t}}}function Ny(e){return{kind:"transformation",type:"brand",reference:Ny,async:!1,name:e,_run(t){return t}}}function Dy(e,t){return{kind:"validation",type:"bytes",reference:Dy,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 $y(e,t){return{kind:"validation",type:"check",reference:$y,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 By(e,t){return{kind:"validation",type:"check",reference:By,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 Ly(e,t){return{kind:"validation",type:"check_items",reference:Ly,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 JC=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,XC=/[- ]/gu,YC=[/^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 Fy(e){return{kind:"validation",type:"credit_card",reference:Fy,async:!1,expects:null,requirement(t){let r;return JC.test(t)&&(r=t.replace(XC,""))&&YC.some(n=>n.test(r))&&Nh(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"credit card",t,r),t}}}function Uy(e){return{kind:"validation",type:"cuid2",reference:Uy,async:!1,expects:null,requirement:cy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"Cuid2",t,r),t}}}function zy(e){return{kind:"validation",type:"decimal",reference:zy,async:!1,expects:null,requirement:uy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"decimal",t,r),t}}}function Vy(e){return{kind:"validation",type:"email",reference:Vy,expects:null,async:!1,requirement:ly,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"email",t,r),t}}}function qy(e){return{kind:"validation",type:"emoji",reference:qy,async:!1,expects:null,requirement:fy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"emoji",t,r),t}}}function Wy(e){return{kind:"validation",type:"empty",reference:Wy,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 Gy(e,t){return{kind:"validation",type:"ends_with",reference:Gy,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 Hy(e,t){return{kind:"validation",type:"every_item",reference:Hy,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 Ky(e,t){const r=Nr(e);return{kind:"validation",type:"excludes",reference:Ky,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 Jy(e){return{kind:"transformation",type:"filter_items",reference:Jy,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function Xy(e){return{kind:"transformation",type:"find_item",reference:Xy,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function Yy(e){return{kind:"validation",type:"finite",reference:Yy,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 ZC={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 Zy(e,t){return{kind:"validation",type:"hash",reference:Zy,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${ZC[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"hash",r,n),r}}}function Qy(e){return{kind:"validation",type:"hexadecimal",reference:Qy,async:!1,expects:null,requirement:dy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hexadecimal",t,r),t}}}function eb(e){return{kind:"validation",type:"hex_color",reference:eb,async:!1,expects:null,requirement:hy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hex color",t,r),t}}}function tb(e){return{kind:"validation",type:"imei",reference:tb,async:!1,expects:null,requirement(t){return py.test(t)&&Nh(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"IMEI",t,r),t}}}function rb(e,t){const r=Nr(e);return{kind:"validation",type:"includes",reference:rb,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 nb(e){return{kind:"validation",type:"integer",reference:nb,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 ib(e){return{kind:"validation",type:"ip",reference:ib,async:!1,expects:null,requirement:vy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IP",t,r),t}}}function sb(e){return{kind:"validation",type:"ipv4",reference:sb,async:!1,expects:null,requirement:my,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv4",t,r),t}}}function ob(e){return{kind:"validation",type:"ipv6",reference:ob,async:!1,expects:null,requirement:gy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv6",t,r),t}}}function ab(e){return{kind:"validation",type:"iso_date",reference:ab,async:!1,expects:null,requirement:yy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date",t,r),t}}}function cb(e){return{kind:"validation",type:"iso_date_time",reference:cb,async:!1,expects:null,requirement:by,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date-time",t,r),t}}}function ub(e){return{kind:"validation",type:"iso_time",reference:ub,async:!1,expects:null,requirement:wy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time",t,r),t}}}function lb(e){return{kind:"validation",type:"iso_time_second",reference:lb,async:!1,expects:null,requirement:_y,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time-second",t,r),t}}}function fb(e){return{kind:"validation",type:"iso_timestamp",reference:fb,async:!1,expects:null,requirement:xy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"timestamp",t,r),t}}}function db(e){return{kind:"validation",type:"iso_week",reference:db,async:!1,expects:null,requirement:Sy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"week",t,r),t}}}function hb(e,t){return{kind:"validation",type:"length",reference:hb,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 pb(e){return{kind:"validation",type:"mac",reference:pb,async:!1,expects:null,requirement:My,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"MAC",t,r),t}}}function mb(e){return{kind:"validation",type:"mac48",reference:mb,async:!1,expects:null,requirement:Ey,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"48-bit MAC",t,r),t}}}function gb(e){return{kind:"validation",type:"mac64",reference:gb,async:!1,expects:null,requirement:Cy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"64-bit MAC",t,r),t}}}function vb(e){return{kind:"transformation",type:"map_items",reference:vb,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function yb(e,t){return{kind:"validation",type:"max_bytes",reference:yb,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 bb(e,t){return{kind:"validation",type:"max_length",reference:bb,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 wb(e,t){return{kind:"validation",type:"max_size",reference:wb,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 _b(e,t){return{kind:"validation",type:"max_value",reference:_b,async:!1,expects:`<=${e instanceof Date?e.toJSON():Nr(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():Nr(r.value)}),r}}}function xb(e,t){return{kind:"validation",type:"mime_type",reference:xb,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 Sb(e,t){return{kind:"validation",type:"min_bytes",reference:Sb,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 Eb(e,t){return{kind:"validation",type:"min_length",reference:Eb,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 Cb(e,t){return{kind:"validation",type:"min_size",reference:Cb,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 Mb(e,t){return{kind:"validation",type:"min_value",reference:Mb,async:!1,expects:`>=${e instanceof Date?e.toJSON():Nr(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():Nr(r.value)}),r}}}function Tb(e,t){return{kind:"validation",type:"multiple_of",reference:Tb,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 Ab(e){return{kind:"validation",type:"non_empty",reference:Ab,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 Ob(e){return{kind:"transformation",type:"normalize",reference:Ob,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function Ib(e,t){return{kind:"validation",type:"not_bytes",reference:Ib,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 Pb(e,t){return{kind:"validation",type:"not_length",reference:Pb,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 jb(e,t){return{kind:"validation",type:"not_size",reference:jb,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 kb(e,t){return{kind:"validation",type:"not_value",reference:kb,async:!1,expects:e instanceof Date?`!${e.toJSON()}`:`!${Nr(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():Nr(r.value)}),r}}}function Rb(e){return{kind:"validation",type:"octal",reference:Rb,async:!1,expects:null,requirement:Ty,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"octal",t,r),t}}}function Nb(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 Db(e,t,r){return{kind:"validation",type:"partial_check",reference:Db,async:!1,expects:null,requirement:t,message:r,_run(n,i){return Nb(n,e)&&!this.requirement(n.value)&&le(this,"input",n,i),n}}}function $b(e,t,r){return{kind:"validation",type:"partial_check",reference:$b,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return Nb(n,e)&&!await this.requirement(n.value)&&le(this,"input",n,i),n}}}function Bb(e){return{kind:"validation",type:"raw_check",reference:Bb,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 Lb(e){return{kind:"validation",type:"raw_check",reference:Lb,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 Fb(e){return{kind:"transformation",type:"raw_transform",reference:Fb,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 Ub(e){return{kind:"transformation",type:"raw_transform",reference:Ub,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 zb(){return{kind:"transformation",type:"readonly",reference:zb,async:!1,_run(e){return e}}}function Vb(e,t){return{kind:"transformation",type:"reduce_items",reference:Vb,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function qb(e,t){return{kind:"validation",type:"regex",reference:qb,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 Wb(e){return{kind:"validation",type:"safe_integer",reference:Wb,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 Gb(e,t){return{kind:"validation",type:"size",reference:Gb,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 Hb(e,t){return{kind:"validation",type:"some_item",reference:Hb,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 Kb(e){return{kind:"transformation",type:"sort_items",reference:Kb,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function Jb(e,t){return{kind:"validation",type:"starts_with",reference:Jb,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 Xb(){return{kind:"transformation",type:"to_lower_case",reference:Xb,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function Yb(e){return{kind:"transformation",type:"to_max_value",reference:Yb,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function Zb(e){return{kind:"transformation",type:"to_min_value",reference:Zb,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function Qb(){return{kind:"transformation",type:"to_upper_case",reference:Qb,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function ew(e){return{kind:"transformation",type:"transform",reference:ew,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function tw(e){return{kind:"transformation",type:"transform",reference:tw,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function rw(){return{kind:"transformation",type:"trim",reference:rw,async:!1,_run(e){return e.value=e.value.trim(),e}}}function nw(){return{kind:"transformation",type:"trim_end",reference:nw,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function iw(){return{kind:"transformation",type:"trim_start",reference:iw,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function sw(e){return{kind:"validation",type:"ulid",reference:sw,async:!1,expects:null,requirement:Ay,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"ULID",t,r),t}}}function ow(e){return{kind:"validation",type:"url",reference:ow,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 aw(e){return{kind:"validation",type:"uuid",reference:aw,async:!1,expects:null,requirement:Oy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"UUID",t,r),t}}}function cw(e,t){return{kind:"validation",type:"value",reference:cw,async:!1,expects:e instanceof Date?e.toJSON():Nr(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():Nr(r.value)}),r}}}function QC(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function pc(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function eM(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:pc(this,r,n)}:r}}}function tM(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await pc(this,r,n)}:r}}}function rM(e){const t={};for(const r of e)if(r.path){const n=ky(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 nM(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 iM(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 $i(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function wd(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=wd(e.entries[r]);return t}return"items"in e?e.items.map(wd):$i(e)}async function _d(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await _d(r)]))):"items"in e?Promise.all(e.items.map(_d)):$i(e)}function xd(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=xd(e.entries[r]);return t}return"items"in e?e.items.map(xd):pc(e)}async function Sd(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Sd(r)]))):"items"in e?Promise.all(e.items.map(Sd)):pc(e)}function sM(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function uw(){return{kind:"schema",type:"any",reference:uw,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function lw(e,t){return{kind:"schema",type:"array",reference:lw,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 fw(e,t){return{kind:"schema",type:"array",reference:fw,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 dw(e){return{kind:"schema",type:"bigint",reference:dw,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:le(this,"type",t,r),t}}}function hw(e){return{kind:"schema",type:"blob",reference:hw,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:le(this,"type",t,r),t}}}function pw(e){return{kind:"schema",type:"boolean",reference:pw,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:le(this,"type",t,r),t}}}function mw(e,t){return{kind:"schema",type:"custom",reference:mw,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 gw(e,t){return{kind:"schema",type:"custom",reference:gw,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 vw(e){return{kind:"schema",type:"date",reference:vw,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 Ed(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:Ed,expects:r.map(Nr).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 yw(e){return{kind:"schema",type:"file",reference:yw,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:le(this,"type",t,r),t}}}function Cd(e){return{kind:"schema",type:"function",reference:Cd,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:le(this,"type",t,r),t}}}function bw(e,t){return{kind:"schema",type:"instance",reference:bw,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 xu(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=xu(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=xu(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function ww(e,t){return{kind:"schema",type:"intersect",reference:ww,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=xu(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 _w(e,t){return{kind:"schema",type:"intersect",reference:_w,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=xu(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 xw(e){return{kind:"schema",type:"lazy",reference:xw,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function Sw(e){return{kind:"schema",type:"lazy",reference:Sw,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function Ew(e,t){return{kind:"schema",type:"literal",reference:Ew,expects:Nr(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 Cw(e,t){return{kind:"schema",type:"loose_object",reference:Cw,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)Js(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else le(this,"type",r,n);return r}}}function Mw(e,t){return{kind:"schema",type:"loose_object",reference:Mw,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)Js(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else le(this,"type",r,n);return r}}}function Tw(e,t){return{kind:"schema",type:"loose_tuple",reference:Tw,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 Aw(e,t){return{kind:"schema",type:"loose_tuple",reference:Aw,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 Ow(e,t,r){return{kind:"schema",type:"map",reference:Ow,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 Iw(e,t,r){return{kind:"schema",type:"map",reference:Iw,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 Pw(e){return{kind:"schema",type:"nan",reference:Pw,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function jw(e){return{kind:"schema",type:"never",reference:jw,expects:"never",async:!1,message:e,_run(t,r){return le(this,"type",t,r),t}}}function kw(e,t){return{kind:"schema",type:"non_nullable",reference:kw,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 Rw(e,t){return{kind:"schema",type:"non_nullable",reference:Rw,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 Nw(e,t){return{kind:"schema",type:"non_nullish",reference:Nw,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 Dw(e,t){return{kind:"schema",type:"non_nullish",reference:Dw,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 Dh(e,t){return{kind:"schema",type:"non_optional",reference:Dh,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 $h(e,t){return{kind:"schema",type:"non_optional",reference:$h,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 Md(e){return{kind:"schema",type:"null",reference:Md,expects:"null",async:!1,message:e,_run(t,r){return t.value===null?t.typed=!0:le(this,"type",t,r),t}}}function $w(e,...t){const r={kind:"schema",type:"nullable",reference:$w,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=$i(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 Bw(e,...t){const r={kind:"schema",type:"nullable",reference:Bw,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await $i(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 Lw(e,...t){const r={kind:"schema",type:"nullish",reference:Lw,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=$i(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 Fw(e,...t){const r={kind:"schema",type:"nullish",reference:Fw,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 $i(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 Uw(e){return{kind:"schema",type:"number",reference:Uw,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 zw(e,t){return{kind:"schema",type:"object",reference:zw,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 Vw(e,t){return{kind:"schema",type:"object",reference:Vw,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 qw(e,t,r){return{kind:"schema",type:"object_with_rest",reference:qw,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(Js(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 Ww(e,t,r){return{kind:"schema",type:"object_with_rest",reference:Ww,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])=>Js(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 Bh(e,...t){const r={kind:"schema",type:"optional",reference:Bh,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=$i(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 Lh(e,...t){const r={kind:"schema",type:"optional",reference:Lh,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await $i(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 Fh(e,t){return{kind:"schema",type:"picklist",reference:Fh,expects:e.map(Nr).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 Gw(e){return{kind:"schema",type:"promise",reference:Gw,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:le(this,"type",t,r),t}}}function Hw(e,t,r){return{kind:"schema",type:"record",reference:Hw,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(Js(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 Kw(e,t,r){return{kind:"schema",type:"record",reference:Kw,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])=>Js(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 Jw(e,t){return{kind:"schema",type:"set",reference:Jw,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 Xw(e,t){return{kind:"schema",type:"set",reference:Xw,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 Yw(e,t){return{kind:"schema",type:"strict_object",reference:Yw,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 Zw(e,t){return{kind:"schema",type:"strict_object",reference:Zw,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 Qw(e,t){return{kind:"schema",type:"strict_tuple",reference:Qw,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 e2(e,t){return{kind:"schema",type:"strict_tuple",reference:e2,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 t2(e){return{kind:"schema",type:"string",reference:t2,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:le(this,"type",t,r),t}}}function r2(e){return{kind:"schema",type:"symbol",reference:r2,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:le(this,"type",t,r),t}}}function n2(e,t){return{kind:"schema",type:"tuple",reference:n2,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 i2(e,t){return{kind:"schema",type:"tuple",reference:i2,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 s2(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:s2,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 o2(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:o2,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 Td(e){return{kind:"schema",type:"undefined",reference:Td,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function Su(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function a2(e,t){return{kind:"schema",type:"union",reference:a2,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:Su(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Su(o)})}return r}}}function c2(e,t){return{kind:"schema",type:"union",reference:c2,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:Su(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Su(o)})}return r}}}function u2(){return{kind:"schema",type:"unknown",reference:u2,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function Uh(e,t,r=new Set){for(const n of t)n.type==="variant"?Uh(e,n.options,r):r.add(n.entries[e].expects);return r}function l2(e,t,r){let n;return{kind:"schema",type:"variant",reference:l2,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=[...Uh(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 f2(e,t,r){let n;return{kind:"schema",type:"variant",reference:f2,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=[...Uh(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 Ad(e){return{kind:"schema",type:"void",reference:Ad,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function oM(e,t){return Fh(Object.keys(e.entries),t)}function aM(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function d2(e,t,r){const n=e._run({typed:!1,value:t},hc(r));if(n.issues)throw new sl(n.issues);return n.value}async function h2(e,t,r){const n=await e._run({typed:!1,value:t},hc(r));if(n.issues)throw new sl(n.issues);return n.value}function cM(e,t){const r=n=>d2(e,n,t);return r.schema=e,r.config=t,r}function uM(e,t){const r=n=>h2(e,n,t);return r.schema=e,r.config=t,r}function lM(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Bh(e.entries[n]):e.entries[n];return{...e,entries:r}}function fM(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Lh(e.entries[n]):e.entries[n];return{...e,entries:r}}function dM(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function hM(...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 pM(...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 mM(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)?Dh(e.entries[o],i):e.entries[o];return{...e,entries:s}}function gM(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)?$h(e.entries[o],i):e.entries[o];return{...e,entries:s}}function p2(e,t,r){const n=e._run({typed:!1,value:t},hc(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function m2(e,t,r){const n=await e._run({typed:!1,value:t},hc(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function vM(e,t){const r=n=>p2(e,n,t);return r.schema=e,r.config=t,r}function yM(e,t){const r=n=>m2(e,n,t);return r.schema=e,r.config=t,r}function bM(e){return e.wrapped}const wM=Symbol.for("@mysten/transaction");function _M(e){return!!e&&typeof e=="object"&&e[wM]===!0}const g2=Symbol.for("@mysten/SuiClient");function xM(e){return typeof e=="object"&&e!==null&&e[g2]===!0}class Ga{get[g2](){return!0}constructor(t){this.transport=t.transport??new o1({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!wi($r(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||!wi($r(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||!wi($r(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||!wi($r(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||!wi($r(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||!Ta(Ci(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||!Ta(Ci(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(!yd(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(!yd(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:qr(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||!wi($r(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||!Ta(Ci(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(_M(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=qr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=qr(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:qr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!Ta(Ci(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=Pi(t.digest);return ji(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=>X1(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 SM=Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:Eh,SuiClient:Ga,SuiHTTPStatusError:Qv,SuiHTTPTransport:o1,SuiHTTPTransportError:Sh,getFullnodeUrl:a1,isSuiClient:xM},Symbol.toStringTag,{value:"Module"})),EM=nl(SM),v2=nl(OC),Or=nl(dE);var zh=Object.defineProperty,CM=Object.getOwnPropertyDescriptor,MM=Object.getOwnPropertyNames,TM=Object.prototype.hasOwnProperty,AM=(e,t)=>{for(var r in t)zh(e,r,{get:t[r],enumerable:!0})},OM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MM(t))!TM.call(e,i)&&i!==r&&zh(e,i,{get:()=>t[i],enumerable:!(n=CM(t,i))||n.enumerable});return e},IM=e=>OM(zh({},"__esModule",{value:!0}),e),y2={};AM(y2,{SUI_ADDRESS_LENGTH:()=>Vh,isValidSuiAddress:()=>w2,isValidSuiObjectId:()=>kM,isValidTransactionDigest:()=>jM,normalizeStructTag:()=>_2,normalizeSuiAddress:()=>Wh,normalizeSuiObjectId:()=>NM,parseStructTag:()=>qh});var Jr=IM(y2),b2=Or;const PM=32;function jM(e){try{return(0,b2.fromBase58)(e).length===PM}catch{return!1}}const Vh=32;function w2(e){return DM(e)&&$M(e)===Vh}function kM(e){return w2(e)}function RM(e){return e.includes("::")?qh(e):e}function qh(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,b2.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>RM(o.trim())):[];return{address:Wh(t),module:r,name:i,typeParams:s}}function _2(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?qh(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:_2(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Wh(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Vh*2,"0")}`}function NM(e,t=!1){return Wh(e,t)}function DM(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function $M(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var Gh=Object.defineProperty,BM=Object.getOwnPropertyDescriptor,LM=Object.getOwnPropertyNames,FM=Object.prototype.hasOwnProperty,UM=(e,t)=>{for(var r in t)Gh(e,r,{get:t[r],enumerable:!0})},zM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LM(t))!FM.call(e,i)&&i!==r&&Gh(e,i,{get:()=>t[i],enumerable:!(n=BM(t,i))||n.enumerable});return e},VM=e=>zM(Gh({},"__esModule",{value:!0}),e),x2={};UM(x2,{TypeTagSerializer:()=>ks});var S2=VM(x2),qM=Or,WM=Jr;const GM=/^vector<(.+)>$/,HM=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class ks{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(GM);if(n)return{vector:ks.parseFromStr(n[1],r)};const i=t.match(HM);if(i)return{struct:{address:r?(0,WM.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:ks.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,qM.splitGenericParameters)(t).map(n=>ks.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<${ks.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(ks.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var Hh=Object.defineProperty,KM=Object.getOwnPropertyDescriptor,JM=Object.getOwnPropertyNames,XM=Object.prototype.hasOwnProperty,YM=(e,t)=>{for(var r in t)Hh(e,r,{get:t[r],enumerable:!0})},ZM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of JM(t))!XM.call(e,i)&&i!==r&&Hh(e,i,{get:()=>t[i],enumerable:!(n=KM(t,i))||n.enumerable});return e},QM=e=>ZM(Hh({},"__esModule",{value:!0}),e),E2={};YM(E2,{Address:()=>Jn,AppId:()=>U2,Argument:()=>Vn,CallArg:()=>O2,Command:()=>P2,CompressedSignature:()=>q2,GasData:()=>D2,Intent:()=>z2,IntentMessage:()=>V2,IntentScope:()=>L2,IntentVersion:()=>F2,MultiSig:()=>rT,MultiSigPkMap:()=>G2,MultiSigPublicKey:()=>H2,ObjectArg:()=>A2,ObjectDigest:()=>M2,PasskeyAuthenticator:()=>iT,ProgrammableMoveCall:()=>I2,ProgrammableTransaction:()=>j2,PublicKey:()=>W2,SenderSignedData:()=>nT,SenderSignedTransaction:()=>J2,SharedObjectRef:()=>T2,StructTag:()=>N2,SuiObjectRef:()=>Eu,TransactionData:()=>B2,TransactionDataV1:()=>$2,TransactionExpiration:()=>R2,TransactionKind:()=>k2,TypeTag:()=>Jh,base64String:()=>K2});var C2=QM(E2),de=Or,ha=Jr,nm=S2;function eT(e){return de.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function tT(e){return de.bcs.enum("Option",{None:null,Some:e})}const Jn=de.bcs.bytes(ha.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,de.toHex)(e);if(!t||!(0,ha.isValidSuiAddress)((0,ha.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,de.fromHex)((0,ha.normalizeSuiAddress)(e)):e,output:e=>(0,ha.normalizeSuiAddress)((0,de.toHex)(e))}),M2=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")}}),Eu=de.bcs.struct("SuiObjectRef",{objectId:Jn,version:de.bcs.u64(),digest:M2}),T2=de.bcs.struct("SharedObjectRef",{objectId:Jn,initialSharedVersion:de.bcs.u64(),mutable:de.bcs.bool()}),A2=de.bcs.enum("ObjectArg",{ImmOrOwnedObject:Eu,SharedObject:T2,Receiving:Eu}),O2=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:A2}),Kh=de.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:de.bcs.lazy(()=>Kh),struct:de.bcs.lazy(()=>N2),u16:null,u32:null,u256:null}),Jh=Kh.transform({input:e=>typeof e=="string"?nm.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>nm.TypeTagSerializer.tagToString(e)}),Vn=de.bcs.enum("Argument",{GasCoin:null,Input:de.bcs.u16(),Result:de.bcs.u16(),NestedResult:de.bcs.tuple([de.bcs.u16(),de.bcs.u16()])}),I2=de.bcs.struct("ProgrammableMoveCall",{package:Jn,module:de.bcs.string(),function:de.bcs.string(),typeArguments:de.bcs.vector(Jh),arguments:de.bcs.vector(Vn)}),P2=de.bcs.enum("Command",{MoveCall:I2,TransferObjects:de.bcs.struct("TransferObjects",{objects:de.bcs.vector(Vn),address:Vn}),SplitCoins:de.bcs.struct("SplitCoins",{coin:Vn,amounts:de.bcs.vector(Vn)}),MergeCoins:de.bcs.struct("MergeCoins",{destination:Vn,sources:de.bcs.vector(Vn)}),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(Jn)}),MakeMoveVec:de.bcs.struct("MakeMoveVec",{type:tT(Jh).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:de.bcs.vector(Vn)}),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(Jn),package:Jn,ticket:Vn})}),j2=de.bcs.struct("ProgrammableTransaction",{inputs:de.bcs.vector(O2),commands:de.bcs.vector(P2)}),k2=de.bcs.enum("TransactionKind",{ProgrammableTransaction:j2,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),R2=de.bcs.enum("TransactionExpiration",{None:null,Epoch:eT()}),N2=de.bcs.struct("StructTag",{address:Jn,module:de.bcs.string(),name:de.bcs.string(),typeParams:de.bcs.vector(Kh)}),D2=de.bcs.struct("GasData",{payment:de.bcs.vector(Eu),owner:Jn,price:de.bcs.u64(),budget:de.bcs.u64()}),$2=de.bcs.struct("TransactionDataV1",{kind:k2,sender:Jn,gasData:D2,expiration:R2}),B2=de.bcs.enum("TransactionData",{V1:$2}),L2=de.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),F2=de.bcs.enum("IntentVersion",{V0:null}),U2=de.bcs.enum("AppId",{Sui:null}),z2=de.bcs.struct("Intent",{scope:L2,version:F2,appId:U2});function V2(e){return de.bcs.struct(`IntentMessage<${e.name}>`,{intent:z2,value:e})}const q2=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())}),W2=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())}),G2=de.bcs.struct("MultiSigPkMap",{pubKey:W2,weight:de.bcs.u8()}),H2=de.bcs.struct("MultiSigPublicKey",{pk_map:de.bcs.vector(G2),threshold:de.bcs.u16()}),rT=de.bcs.struct("MultiSig",{sigs:de.bcs.vector(q2),bitmap:de.bcs.u16(),multisig_pk:H2}),K2=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))}),J2=de.bcs.struct("SenderSignedTransaction",{intentMessage:V2(B2),txSignatures:de.bcs.vector(K2)}),nT=de.bcs.vector(J2,{name:"SenderSignedData"}),iT=de.bcs.struct("PasskeyAuthenticator",{authenticatorData:de.bcs.vector(de.bcs.u8()),clientDataJson:de.bcs.string(),userSignature:de.bcs.vector(de.bcs.u8())});var Xh=Object.defineProperty,sT=Object.getOwnPropertyDescriptor,oT=Object.getOwnPropertyNames,aT=Object.prototype.hasOwnProperty,cT=(e,t)=>{for(var r in t)Xh(e,r,{get:t[r],enumerable:!0})},uT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oT(t))!aT.call(e,i)&&i!==r&&Xh(e,i,{get:()=>t[i],enumerable:!(n=sT(t,i))||n.enumerable});return e},lT=e=>uT(Xh({},"__esModule",{value:!0}),e),X2={};cT(X2,{TransactionEffects:()=>ET});var fT=lT(X2),ye=Or,Lt=C2;const dT=ye.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:ye.bcs.struct("UnableToFetchPackage",{packageId:Lt.Address}),NotAPackage:ye.bcs.struct("NotAPackage",{objectId:Lt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:ye.bcs.struct("DigestDoesNotMatch",{digest:ye.bcs.vector(ye.bcs.u8())}),UnknownUpgradePolicy:ye.bcs.struct("UnknownUpgradePolicy",{policy:ye.bcs.u8()}),PackageIDDoesNotMatch:ye.bcs.struct("PackageIDDoesNotMatch",{packageId:Lt.Address,ticketId:Lt.Address})}),hT=ye.bcs.struct("ModuleId",{address:Lt.Address,name:ye.bcs.string()}),im=ye.bcs.struct("MoveLocation",{module:hT,function:ye.bcs.u16(),instruction:ye.bcs.u16(),functionName:ye.bcs.option(ye.bcs.string())}),pT=ye.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:ye.bcs.struct("IndexOutOfBounds",{idx:ye.bcs.u16()}),SecondaryIndexOutOfBounds:ye.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:ye.bcs.u16(),secondaryIdx:ye.bcs.u16()}),InvalidResultArity:ye.bcs.struct("InvalidResultArity",{resultIdx:ye.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),mT=ye.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),gT=ye.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:ye.bcs.struct("MoveObjectTooBig",{objectSize:ye.bcs.u64(),maxObjectSize:ye.bcs.u64()}),MovePackageTooBig:ye.bcs.struct("MovePackageTooBig",{objectSize:ye.bcs.u64(),maxObjectSize:ye.bcs.u64()}),CircularObjectOwnership:ye.bcs.struct("CircularObjectOwnership",{object:Lt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:ye.bcs.option(im),MoveAbort:ye.bcs.tuple([im,ye.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:ye.bcs.struct("CommandArgumentError",{argIdx:ye.bcs.u16(),kind:pT}),TypeArgumentError:ye.bcs.struct("TypeArgumentError",{argumentIdx:ye.bcs.u16(),kind:mT}),UnusedValueWithoutDrop:ye.bcs.struct("UnusedValueWithoutDrop",{resultIdx:ye.bcs.u16(),secondaryIdx:ye.bcs.u16()}),InvalidPublicFunctionReturnType:ye.bcs.struct("InvalidPublicFunctionReturnType",{idx:ye.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:ye.bcs.struct("EffectsTooLarge",{currentSize:ye.bcs.u64(),maxSize:ye.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:ye.bcs.struct("PackageUpgradeError",{upgradeError:dT}),WrittenObjectsTooLarge:ye.bcs.struct("WrittenObjectsTooLarge",{currentSize:ye.bcs.u64(),maxSize:ye.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:ye.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:ye.bcs.vector(Lt.Address)}),AddressDeniedForCoin:ye.bcs.struct("AddressDeniedForCoin",{address:Lt.Address,coinType:ye.bcs.string()}),CoinTypeGlobalPause:ye.bcs.struct("CoinTypeGlobalPause",{coinType:ye.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Y2=ye.bcs.enum("ExecutionStatus",{Success:null,Failed:ye.bcs.struct("ExecutionFailed",{error:gT,command:ye.bcs.option(ye.bcs.u64())})}),Z2=ye.bcs.struct("GasCostSummary",{computationCost:ye.bcs.u64(),storageCost:ye.bcs.u64(),storageRebate:ye.bcs.u64(),nonRefundableStorageFee:ye.bcs.u64()}),wo=ye.bcs.enum("Owner",{AddressOwner:Lt.Address,ObjectOwner:Lt.Address,Shared:ye.bcs.struct("Shared",{initialSharedVersion:ye.bcs.u64()}),Immutable:null}),vT=ye.bcs.struct("TransactionEffectsV1",{status:Y2,executedEpoch:ye.bcs.u64(),gasUsed:Z2,modifiedAtVersions:ye.bcs.vector(ye.bcs.tuple([Lt.Address,ye.bcs.u64()])),sharedObjects:ye.bcs.vector(Lt.SuiObjectRef),transactionDigest:Lt.ObjectDigest,created:ye.bcs.vector(ye.bcs.tuple([Lt.SuiObjectRef,wo])),mutated:ye.bcs.vector(ye.bcs.tuple([Lt.SuiObjectRef,wo])),unwrapped:ye.bcs.vector(ye.bcs.tuple([Lt.SuiObjectRef,wo])),deleted:ye.bcs.vector(Lt.SuiObjectRef),unwrappedThenDeleted:ye.bcs.vector(Lt.SuiObjectRef),wrapped:ye.bcs.vector(Lt.SuiObjectRef),gasObject:ye.bcs.tuple([Lt.SuiObjectRef,wo]),eventsDigest:ye.bcs.option(Lt.ObjectDigest),dependencies:ye.bcs.vector(Lt.ObjectDigest)}),Yh=ye.bcs.tuple([ye.bcs.u64(),Lt.ObjectDigest]),yT=ye.bcs.enum("ObjectIn",{NotExist:null,Exist:ye.bcs.tuple([Yh,wo])}),bT=ye.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:ye.bcs.tuple([Lt.ObjectDigest,wo]),PackageWrite:Yh}),wT=ye.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),_T=ye.bcs.struct("EffectsObjectChange",{inputState:yT,outputState:bT,idOperation:wT}),xT=ye.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:Yh,MutateDeleted:ye.bcs.u64(),ReadDeleted:ye.bcs.u64(),Cancelled:ye.bcs.u64(),PerEpochConfig:null}),ST=ye.bcs.struct("TransactionEffectsV2",{status:Y2,executedEpoch:ye.bcs.u64(),gasUsed:Z2,transactionDigest:Lt.ObjectDigest,gasObjectIndex:ye.bcs.option(ye.bcs.u32()),eventsDigest:ye.bcs.option(Lt.ObjectDigest),dependencies:ye.bcs.vector(Lt.ObjectDigest),lamportVersion:ye.bcs.u64(),changedObjects:ye.bcs.vector(ye.bcs.tuple([Lt.Address,_T])),unchangedSharedObjects:ye.bcs.vector(ye.bcs.tuple([Lt.Address,xT])),auxDataDigest:ye.bcs.option(Lt.ObjectDigest)}),ET=ye.bcs.enum("TransactionEffects",{V1:vT,V2:ST});var Zh=Object.defineProperty,CT=Object.getOwnPropertyDescriptor,MT=Object.getOwnPropertyNames,TT=Object.prototype.hasOwnProperty,AT=(e,t)=>{for(var r in t)Zh(e,r,{get:t[r],enumerable:!0})},OT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MT(t))!TT.call(e,i)&&i!==r&&Zh(e,i,{get:()=>t[i],enumerable:!(n=CT(t,i))||n.enumerable});return e},IT=e=>OT(Zh({},"__esModule",{value:!0}),e),Q2={};AT(Q2,{BcsType:()=>kT.BcsType,TypeTagSerializer:()=>jT.TypeTagSerializer,bcs:()=>RT});var si=IT(Q2),$n=Or,Bt=C2,PT=fT,jT=S2,kT=Or;const RT={...$n.bcs,U8:$n.bcs.u8(),U16:$n.bcs.u16(),U32:$n.bcs.u32(),U64:$n.bcs.u64(),U128:$n.bcs.u128(),U256:$n.bcs.u256(),ULEB128:$n.bcs.uleb128(),Bool:$n.bcs.bool(),String:$n.bcs.string(),Address:Bt.Address,AppId:Bt.AppId,Argument:Bt.Argument,CallArg:Bt.CallArg,CompressedSignature:Bt.CompressedSignature,GasData:Bt.GasData,Intent:Bt.Intent,IntentMessage:Bt.IntentMessage,IntentScope:Bt.IntentScope,IntentVersion:Bt.IntentVersion,MultiSig:Bt.MultiSig,MultiSigPkMap:Bt.MultiSigPkMap,MultiSigPublicKey:Bt.MultiSigPublicKey,ObjectArg:Bt.ObjectArg,ObjectDigest:Bt.ObjectDigest,ProgrammableMoveCall:Bt.ProgrammableMoveCall,ProgrammableTransaction:Bt.ProgrammableTransaction,PublicKey:Bt.PublicKey,SenderSignedData:Bt.SenderSignedData,SenderSignedTransaction:Bt.SenderSignedTransaction,SharedObjectRef:Bt.SharedObjectRef,StructTag:Bt.StructTag,SuiObjectRef:Bt.SuiObjectRef,Command:Bt.Command,TransactionData:Bt.TransactionData,TransactionDataV1:Bt.TransactionDataV1,TransactionExpiration:Bt.TransactionExpiration,TransactionKind:Bt.TransactionKind,TypeTag:Bt.TypeTag,TransactionEffects:PT.TransactionEffects,PasskeyAuthenticator:Bt.PasskeyAuthenticator};var Qh=Object.defineProperty,NT=Object.getOwnPropertyDescriptor,DT=Object.getOwnPropertyNames,$T=Object.prototype.hasOwnProperty,BT=(e,t)=>{for(var r in t)Qh(e,r,{get:t[r],enumerable:!0})},LT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of DT(t))!$T.call(e,i)&&i!==r&&Qh(e,i,{get:()=>t[i],enumerable:!(n=NT(t,i))||n.enumerable});return e},FT=e=>LT(Qh({},"__esModule",{value:!0}),e),e_={};BT(e_,{formatAddress:()=>zT,formatDigest:()=>VT});var UT=FT(e_);const t_="…";function zT(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${t_}${e.slice(-4)}`}function VT(e){return`${e.slice(0,10)}${t_}`}var ep=Object.defineProperty,qT=Object.getOwnPropertyDescriptor,WT=Object.getOwnPropertyNames,GT=Object.prototype.hasOwnProperty,HT=(e,t)=>{for(var r in t)ep(e,r,{get:t[r],enumerable:!0})},KT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of WT(t))!GT.call(e,i)&&i!==r&&ep(e,i,{get:()=>t[i],enumerable:!(n=qT(t,i))||n.enumerable});return e},JT=e=>KT(ep({},"__esModule",{value:!0}),e),r_={};HT(r_,{isValidSuiNSName:()=>YT,normalizeSuiNSName:()=>ZT});var n_=JT(r_);const i_=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,s_=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,XT=235;function YT(e){return e.length>XT?!1:e.includes("@")?i_.test(e):s_.test(e)}function ZT(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!i_.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!s_.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 tp=Object.defineProperty,QT=Object.getOwnPropertyDescriptor,eA=Object.getOwnPropertyNames,tA=Object.prototype.hasOwnProperty,rA=(e,t)=>{for(var r in t)tp(e,r,{get:t[r],enumerable:!0})},nA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of eA(t))!tA.call(e,i)&&i!==r&&tp(e,i,{get:()=>t[i],enumerable:!(n=QT(t,i))||n.enumerable});return e},iA=e=>nA(tp({},"__esModule",{value:!0}),e),o_={};rA(o_,{MIST_PER_SUI:()=>aA,MOVE_STDLIB_ADDRESS:()=>cA,SUI_CLOCK_OBJECT_ID:()=>lA,SUI_DECIMALS:()=>oA,SUI_FRAMEWORK_ADDRESS:()=>c_,SUI_SYSTEM_ADDRESS:()=>uA,SUI_SYSTEM_MODULE_NAME:()=>fA,SUI_SYSTEM_STATE_OBJECT_ID:()=>hA,SUI_TYPE_ARG:()=>dA});var sA=iA(o_),a_=Jr;const oA=9,aA=BigInt(1e9),cA="0x1",c_="0x2",uA="0x3",lA=(0,a_.normalizeSuiObjectId)("0x6"),fA="sui_system",dA=`${c_}::sui::SUI`,hA=(0,a_.normalizeSuiObjectId)("0x5");var rp=Object.defineProperty,pA=Object.getOwnPropertyDescriptor,mA=Object.getOwnPropertyNames,gA=Object.prototype.hasOwnProperty,vA=(e,t)=>{for(var r in t)rp(e,r,{get:t[r],enumerable:!0})},yA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mA(t))!gA.call(e,i)&&i!==r&&rp(e,i,{get:()=>t[i],enumerable:!(n=pA(t,i))||n.enumerable});return e},bA=e=>yA(rp({},"__esModule",{value:!0}),e),u_={};vA(u_,{isValidNamedPackage:()=>d_,isValidNamedType:()=>EA});var l_=bA(u_),wA=n_;const _A=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,xA=/^\d+$/,SA=64,f_="/",d_=e=>{const t=e.split(f_);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!xA.test(i)||!(0,wA.isValidSuiNSName)(r)?!1:_A.test(n)&&n.length<SA},EA=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(f_)&&!d_(r))return!1;return!0},h_=nl(TC);var np=Object.defineProperty,CA=Object.getOwnPropertyDescriptor,MA=Object.getOwnPropertyNames,TA=Object.prototype.hasOwnProperty,AA=(e,t)=>{for(var r in t)np(e,r,{get:t[r],enumerable:!0})},OA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MA(t))!TA.call(e,i)&&i!==r&&np(e,i,{get:()=>t[i],enumerable:!(n=CA(t,i))||n.enumerable});return e},IA=e=>OA(np({},"__esModule",{value:!0}),e),p_={};AA(p_,{deriveDynamicFieldID:()=>RA});var PA=IA(p_),jA=Or,kA=h_,pf=si;function RA(e,t,r){const n=pf.bcs.Address.serialize(e).toBytes(),i=pf.bcs.TypeTag.serialize(t).toBytes(),s=pf.bcs.u64().serialize(r.length).toBytes(),o=kA.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,jA.toHex)(o.digest().slice(0,32))}`}var ip=Object.defineProperty,NA=Object.getOwnPropertyDescriptor,DA=Object.getOwnPropertyNames,$A=Object.prototype.hasOwnProperty,BA=(e,t)=>{for(var r in t)ip(e,r,{get:t[r],enumerable:!0})},LA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of DA(t))!$A.call(e,i)&&i!==r&&ip(e,i,{get:()=>t[i],enumerable:!(n=NA(t,i))||n.enumerable});return e},FA=e=>LA(ip({},"__esModule",{value:!0}),e),m_={};BA(m_,{MIST_PER_SUI:()=>hi.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>hi.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>Vi.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>hi.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>hi.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>hi.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>hi.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>hi.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>hi.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>hi.SUI_TYPE_ARG,deriveDynamicFieldID:()=>UA.deriveDynamicFieldID,formatAddress:()=>sm.formatAddress,formatDigest:()=>sm.formatDigest,fromB64:()=>Bn.fromB64,fromBase58:()=>Bn.fromBase58,fromBase64:()=>Bn.fromBase64,fromHEX:()=>Bn.fromHEX,fromHex:()=>Bn.fromHex,isValidNamedPackage:()=>am.isValidNamedPackage,isValidNamedType:()=>am.isValidNamedType,isValidSuiAddress:()=>Vi.isValidSuiAddress,isValidSuiNSName:()=>om.isValidSuiNSName,isValidSuiObjectId:()=>Vi.isValidSuiObjectId,isValidTransactionDigest:()=>Vi.isValidTransactionDigest,normalizeStructTag:()=>Vi.normalizeStructTag,normalizeSuiAddress:()=>Vi.normalizeSuiAddress,normalizeSuiNSName:()=>om.normalizeSuiNSName,normalizeSuiObjectId:()=>Vi.normalizeSuiObjectId,parseStructTag:()=>Vi.parseStructTag,toB64:()=>Bn.toB64,toBase58:()=>Bn.toBase58,toBase64:()=>Bn.toBase64,toHEX:()=>Bn.toHEX,toHex:()=>Bn.toHex});var g_=FA(m_),sm=UT,Vi=Jr,Bn=Or,om=n_,hi=sA,am=l_,UA=PA,sp=Object.defineProperty,zA=Object.getOwnPropertyDescriptor,VA=Object.getOwnPropertyNames,qA=Object.prototype.hasOwnProperty,WA=(e,t)=>{for(var r in t)sp(e,r,{get:t[r],enumerable:!0})},GA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of VA(t))!qA.call(e,i)&&i!==r&&sp(e,i,{get:()=>t[i],enumerable:!(n=zA(t,i))||n.enumerable});return e},HA=e=>GA(sp({},"__esModule",{value:!0}),e),v_={};WA(v_,{getPureBcsSchema:()=>Od,isTxContext:()=>r5,normalizedTypeToMoveTypeSignature:()=>n5,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>b_});var y_=HA(v_),Yt=si,cm=g_,Na=Jr;const KA="object",JA="ID",XA="ascii",YA="String",ZA="string",QA="String",e5="option",t5="Option";function r5(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,Na.normalizeSuiAddress)(t.package)===(0,Na.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function Od(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Yt.bcs.vector(Yt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=Od(e.vector);return t?Yt.bcs.vector(t):null}if("datatype"in e){const t=(0,Na.normalizeSuiAddress)(e.datatype.package);if(t===(0,Na.normalizeSuiAddress)(cm.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===XA&&e.datatype.type===YA||e.datatype.module===ZA&&e.datatype.type===QA)return Yt.bcs.String;if(e.datatype.module===e5&&e.datatype.type===t5){const r=Od(e.datatype.typeParameters[0]);return r?Yt.bcs.vector(r):null}}if(t===(0,Na.normalizeSuiAddress)(cm.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===KA&&e.datatype.type===JA)return Yt.bcs.Address}return null}function n5(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Da(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Da(e.MutableReference)}:{ref:null,body:Da(e)}}function Da(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:Da(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(Da)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function b_(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Yt.bcs.vector(b_(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var op=Object.defineProperty,i5=Object.getOwnPropertyDescriptor,s5=Object.getOwnPropertyNames,o5=Object.prototype.hasOwnProperty,a5=(e,t)=>{for(var r in t)op(e,r,{get:t[r],enumerable:!0})},c5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of s5(t))!o5.call(e,i)&&i!==r&&op(e,i,{get:()=>t[i],enumerable:!(n=i5(t,i))||n.enumerable});return e},u5=e=>c5(op({},"__esModule",{value:!0}),e),w_={};a5(w_,{Inputs:()=>d5});var ol=u5(w_),l5=Or,mf=Jr;function f5(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,l5.toBase64)(e):e.toBase64()}}}const d5={Pure:f5,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:(0,mf.normalizeSuiAddress)(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:(0,mf.normalizeSuiAddress)(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:(0,mf.normalizeSuiAddress)(e)}}}}};var ap=Object.defineProperty,h5=Object.getOwnPropertyDescriptor,p5=Object.getOwnPropertyNames,m5=Object.prototype.hasOwnProperty,g5=(e,t)=>{for(var r in t)ap(e,r,{get:t[r],enumerable:!0})},v5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of p5(t))!m5.call(e,i)&&i!==r&&ap(e,i,{get:()=>t[i],enumerable:!(n=h5(t,i))||n.enumerable});return e},y5=e=>v5(ap({},"__esModule",{value:!0}),e),__={};g5(__,{$Intent:()=>E_,Argument:()=>en,BCSBytes:()=>Ha,Command:()=>C_,GasData:()=>x_,JsonU64:()=>ss,NormalizedCallArg:()=>x5,ObjectArg:()=>cp,ObjectID:()=>Us,ObjectRef:()=>Cu,OpenMoveTypeSignature:()=>S_,OpenMoveTypeSignatureBody:()=>Mu,StructTag:()=>b5,SuiAddress:()=>mc,TransactionData:()=>S5,TransactionExpiration:()=>M_,safeEnum:()=>Ho});var Go=y5(__),ue=ps,um=Jr;function Ho(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 mc=(0,ue.pipe)((0,ue.string)(),(0,ue.transform)(e=>(0,um.normalizeSuiAddress)(e)),(0,ue.check)(um.isValidSuiAddress)),Us=mc,Ha=(0,ue.string)(),ss=(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")),Cu=(0,ue.object)({objectId:mc,version:ss,digest:(0,ue.string)()}),en=(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]}))),x_=(0,ue.object)({budget:(0,ue.nullable)(ss),price:(0,ue.nullable)(ss),owner:(0,ue.nullable)(mc),payment:(0,ue.nullable)((0,ue.array)(Cu))}),b5=(0,ue.object)({address:(0,ue.string)(),module:(0,ue.string)(),name:(0,ue.string)(),typeParams:(0,ue.array)((0,ue.string)())}),Mu=(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)(()=>Mu)}),(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)(()=>Mu))})}),(0,ue.object)({typeParameter:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())})]),S_=(0,ue.object)({ref:(0,ue.nullable)((0,ue.union)([(0,ue.literal)("&"),(0,ue.literal)("&mut")])),body:Mu}),w5=(0,ue.object)({package:Us,module:(0,ue.string)(),function:(0,ue.string)(),typeArguments:(0,ue.array)((0,ue.string)()),arguments:(0,ue.array)(en),_argumentTypes:(0,ue.optional)((0,ue.nullable)((0,ue.array)(S_)))}),E_=(0,ue.object)({name:(0,ue.string)(),inputs:(0,ue.record)((0,ue.string)(),(0,ue.union)([en,(0,ue.array)(en)])),data:(0,ue.record)((0,ue.string)(),(0,ue.unknown)())}),C_=Ho({MoveCall:w5,TransferObjects:(0,ue.object)({objects:(0,ue.array)(en),address:en}),SplitCoins:(0,ue.object)({coin:en,amounts:(0,ue.array)(en)}),MergeCoins:(0,ue.object)({destination:en,sources:(0,ue.array)(en)}),Publish:(0,ue.object)({modules:(0,ue.array)(Ha),dependencies:(0,ue.array)(Us)}),MakeMoveVec:(0,ue.object)({type:(0,ue.nullable)((0,ue.string)()),elements:(0,ue.array)(en)}),Upgrade:(0,ue.object)({modules:(0,ue.array)(Ha),dependencies:(0,ue.array)(Us),package:Us,ticket:en}),$Intent:E_}),cp=Ho({ImmOrOwnedObject:Cu,SharedObject:(0,ue.object)({objectId:Us,initialSharedVersion:ss,mutable:(0,ue.boolean)()}),Receiving:Cu}),_5=Ho({Object:cp,Pure:(0,ue.object)({bytes:Ha}),UnresolvedPure:(0,ue.object)({value:(0,ue.unknown)()}),UnresolvedObject:(0,ue.object)({objectId:Us,version:(0,ue.optional)((0,ue.nullable)(ss)),digest:(0,ue.optional)((0,ue.nullable)((0,ue.string)())),initialSharedVersion:(0,ue.optional)((0,ue.nullable)(ss))})}),x5=Ho({Object:cp,Pure:(0,ue.object)({bytes:Ha})}),M_=Ho({None:(0,ue.literal)(!0),Epoch:ss}),S5=(0,ue.object)({version:(0,ue.literal)(2),sender:(0,ue.nullish)(mc),expiration:(0,ue.nullish)(M_),gasData:x_,inputs:(0,ue.array)(_5),commands:(0,ue.array)(C_)});var up=Object.defineProperty,E5=Object.getOwnPropertyDescriptor,C5=Object.getOwnPropertyNames,M5=Object.prototype.hasOwnProperty,T5=(e,t)=>{for(var r in t)up(e,r,{get:t[r],enumerable:!0})},A5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of C5(t))!M5.call(e,i)&&i!==r&&up(e,i,{get:()=>t[i],enumerable:!(n=E5(t,i))||n.enumerable});return e},O5=e=>A5(up({},"__esModule",{value:!0}),e),T_={};T5(T_,{Commands:()=>I5,UpgradePolicy:()=>A_});var lp=O5(T_),lm=Or,Ln=ps,fm=Jr,Fn=Go,A_=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(A_||{});const I5={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,Ln.parse)(Fn.Argument,r)),address:(0,Ln.parse)(Fn.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,Ln.parse)(Fn.Argument,e),amounts:t.map(r=>(0,Ln.parse)(Fn.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,Ln.parse)(Fn.Argument,e),sources:t.map(r=>(0,Ln.parse)(Fn.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,lm.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,fm.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,lm.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,fm.normalizeSuiObjectId)(i)),package:r,ticket:(0,Ln.parse)(Fn.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,Ln.parse)(Fn.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,Ln.parse)(Fn.Argument,s)):(0,Ln.parse)(Fn.Argument,i)])),data:r}}}};var fp=Object.defineProperty,P5=Object.getOwnPropertyDescriptor,j5=Object.getOwnPropertyNames,k5=Object.prototype.hasOwnProperty,R5=(e,t)=>{for(var r in t)fp(e,r,{get:t[r],enumerable:!0})},N5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of j5(t))!k5.call(e,i)&&i!==r&&fp(e,i,{get:()=>t[i],enumerable:!(n=P5(t,i))||n.enumerable});return e},D5=e=>N5(fp({},"__esModule",{value:!0}),e),O_={};R5(O_,{NormalizedCallArg:()=>Id,ObjectRef:()=>Tu,SerializedTransactionDataV1:()=>X5,StructTag:()=>k_,TransactionArgument:()=>Qn,TypeTag:()=>al,serializeV1TransactionData:()=>Y5,transactionDataFromV1:()=>Z5});var I_=D5(O_),Io=Or,re=ps,P_=si,$a=Go;const Tu=(0,re.object)({digest:(0,re.string)(),objectId:(0,re.string)(),version:(0,re.union)([(0,re.pipe)((0,re.number)(),(0,re.integer)()),(0,re.string)(),(0,re.bigint)()])}),$5=(0,$a.safeEnum)({ImmOrOwned:Tu,Shared:(0,re.object)({objectId:$a.ObjectID,initialSharedVersion:$a.JsonU64,mutable:(0,re.boolean)()}),Receiving:Tu}),Id=(0,$a.safeEnum)({Object:$5,Pure:(0,re.array)((0,re.pipe)((0,re.number)(),(0,re.integer)()))}),j_=(0,re.union)([(0,re.object)({kind:(0,re.literal)("Input"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)()),value:(0,re.unknown)(),type:(0,re.optional)((0,re.literal)("object"))}),(0,re.object)({kind:(0,re.literal)("Input"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)()),value:(0,re.unknown)(),type:(0,re.literal)("pure")})]),B5=(0,re.union)([(0,re.object)({Epoch:(0,re.pipe)((0,re.number)(),(0,re.integer)())}),(0,re.object)({None:(0,re.nullable)((0,re.literal)(!0))})]),dm=(0,re.pipe)((0,re.union)([(0,re.number)(),(0,re.string)(),(0,re.bigint)()]),(0,re.check)(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),al=(0,re.union)([(0,re.object)({bool:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u8:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u64:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u128:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({address:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({signer:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({vector:(0,re.lazy)(()=>al)}),(0,re.object)({struct:(0,re.lazy)(()=>k_)}),(0,re.object)({u16:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u32:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u256:(0,re.nullable)((0,re.literal)(!0))})]),k_=(0,re.object)({address:(0,re.string)(),module:(0,re.string)(),name:(0,re.string)(),typeParams:(0,re.array)(al)}),L5=(0,re.object)({budget:(0,re.optional)(dm),price:(0,re.optional)(dm),payment:(0,re.optional)((0,re.array)(Tu)),owner:(0,re.optional)((0,re.string)())}),F5=[j_,(0,re.object)({kind:(0,re.literal)("GasCoin")}),(0,re.object)({kind:(0,re.literal)("Result"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)())}),(0,re.object)({kind:(0,re.literal)("NestedResult"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)()),resultIndex:(0,re.pipe)((0,re.number)(),(0,re.integer)())})],Qn=(0,re.union)([...F5]),U5=(0,re.object)({kind:(0,re.literal)("MoveCall"),target:(0,re.pipe)((0,re.string)(),(0,re.check)(e=>e.split("::").length===3)),typeArguments:(0,re.array)((0,re.string)()),arguments:(0,re.array)(Qn)}),z5=(0,re.object)({kind:(0,re.literal)("TransferObjects"),objects:(0,re.array)(Qn),address:Qn}),V5=(0,re.object)({kind:(0,re.literal)("SplitCoins"),coin:Qn,amounts:(0,re.array)(Qn)}),q5=(0,re.object)({kind:(0,re.literal)("MergeCoins"),destination:Qn,sources:(0,re.array)(Qn)}),W5=(0,re.object)({kind:(0,re.literal)("MakeMoveVec"),type:(0,re.union)([(0,re.object)({Some:al}),(0,re.object)({None:(0,re.nullable)((0,re.literal)(!0))})]),objects:(0,re.array)(Qn)}),G5=(0,re.object)({kind:(0,re.literal)("Publish"),modules:(0,re.array)((0,re.array)((0,re.pipe)((0,re.number)(),(0,re.integer)()))),dependencies:(0,re.array)((0,re.string)())}),H5=(0,re.object)({kind:(0,re.literal)("Upgrade"),modules:(0,re.array)((0,re.array)((0,re.pipe)((0,re.number)(),(0,re.integer)()))),dependencies:(0,re.array)((0,re.string)()),packageId:(0,re.string)(),ticket:Qn}),K5=[U5,z5,V5,q5,G5,H5,W5],J5=(0,re.union)([...K5]),X5=(0,re.object)({version:(0,re.literal)(1),sender:(0,re.optional)((0,re.string)()),expiration:(0,re.nullish)(B5),gasConfig:L5,inputs:(0,re.array)(j_),transactions:(0,re.array)(J5)});function Y5(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,Io.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:P_.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>pi(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:pi(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>pi(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=>pi(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from((0,Io.fromBase64)(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:pi(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>pi(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>pi(i,t)),address:pi(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from((0,Io.fromBase64)(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:pi(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function pi(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 Z5(e){var t,r,n;return(0,re.parse)($a.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,re.is)(Id,i.value)){const s=(0,re.parse)(Id,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,Io.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?P_.TypeTagSerializer.tagToString(i.type.Some):null,elements:i.objects.map(s=>mi(s))}};case"MergeCoins":return{MergeCoins:{destination:mi(i.destination),sources:i.sources.map(s=>mi(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=>mi(c))}}}case"Publish":return{Publish:{modules:i.modules.map(s=>(0,Io.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:mi(i.coin),amounts:i.amounts.map(s=>mi(s))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(s=>mi(s)),address:mi(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(s=>(0,Io.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies,package:i.packageId,ticket:mi(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function mi(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 dp=Object.defineProperty,Q5=Object.getOwnPropertyDescriptor,eO=Object.getOwnPropertyNames,tO=Object.prototype.hasOwnProperty,rO=(e,t)=>{for(var r in t)dp(e,r,{get:t[r],enumerable:!0})},nO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of eO(t))!tO.call(e,i)&&i!==r&&dp(e,i,{get:()=>t[i],enumerable:!(n=Q5(t,i))||n.enumerable});return e},iO=e=>nO(dp({},"__esModule",{value:!0}),e),R_={};rO(R_,{SerializedTransactionDataV2:()=>hO});var sO=iO(R_),je=ps,cr=Go;function gc(e){return(0,je.union)(Object.entries(e).map(([t,r])=>(0,je.object)({[t]:r})))}const vn=gc({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)())])}),oO=(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))}),aO=(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)(vn)}),cO=(0,je.object)({name:(0,je.string)(),inputs:(0,je.record)((0,je.string)(),(0,je.union)([vn,(0,je.array)(vn)])),data:(0,je.record)((0,je.string)(),(0,je.unknown)())}),uO=gc({MoveCall:aO,TransferObjects:(0,je.object)({objects:(0,je.array)(vn),address:vn}),SplitCoins:(0,je.object)({coin:vn,amounts:(0,je.array)(vn)}),MergeCoins:(0,je.object)({destination:vn,sources:(0,je.array)(vn)}),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)(vn)}),Upgrade:(0,je.object)({modules:(0,je.array)(cr.BCSBytes),dependencies:(0,je.array)(cr.ObjectID),package:cr.ObjectID,ticket:vn}),$Intent:cO}),lO=gc({ImmOrOwnedObject:cr.ObjectRef,SharedObject:(0,je.object)({objectId:cr.ObjectID,initialSharedVersion:cr.JsonU64,mutable:(0,je.boolean)()}),Receiving:cr.ObjectRef}),fO=gc({Object:lO,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))})}),dO=gc({None:(0,je.literal)(!0),Epoch:cr.JsonU64}),hO=(0,je.object)({version:(0,je.literal)(2),sender:(0,je.nullish)(cr.SuiAddress),expiration:(0,je.nullish)(dO),gasData:oO,inputs:(0,je.array)(fO),commands:(0,je.array)(uO)});var hp=Object.defineProperty,pO=Object.getOwnPropertyDescriptor,mO=Object.getOwnPropertyNames,gO=Object.prototype.hasOwnProperty,vO=(e,t)=>{for(var r in t)hp(e,r,{get:t[r],enumerable:!0})},yO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mO(t))!gO.call(e,i)&&i!==r&&hp(e,i,{get:()=>t[i],enumerable:!(n=pO(t,i))||n.enumerable});return e},bO=e=>yO(hp({},"__esModule",{value:!0}),e),N_={};vO(N_,{getClient:()=>Ko,resolveTransactionData:()=>CO});var D_=bO(N_),wO=ps,hm=si,Pd=g_,_O=Go,Ba=ol,gf=y_;const xO=50,SO=1000n,EO=5e10;async function CO(e,t,r){return await IO(e,t),await OO(e,t),t.onlyTransactionKind||(await MO(e,t),await TO(e,t),await AO(e,t)),await PO(e),await r()}async function MO(e,t){e.gasConfig.price||(e.gasConfig.price=String(await Ko(t).getReferenceGasPrice()))}async function TO(e,t){if(e.gasConfig.budget)return;const r=await Ko(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(EO),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=SO*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 AO(e,t){if(!e.gasConfig.payment){const n=(await Ko(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Pd.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,wO.parse)(_O.ObjectRef,i))}}async function OO(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,Pd.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?NO(n,xO):[],s=(await Promise.all(i.map(l=>Ko(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,Pd.normalizeSuiAddress)(f.UnresolvedObject.objectId),b=u.get(y);f.UnresolvedObject.initialSharedVersion??(b==null?void 0:b.initialSharedVersion)?h=Ba.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(b==null?void 0:b.initialSharedVersion),mutable:jO(e,l)}):kO(e,l)&&(h=Ba.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??Ba.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 IO(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=>{pm(c,hm.bcs.U64,e)});break;case"TransferObjects":pm(a.TransferObjects.address,hm.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=Ko(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,gf.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,gf.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 R,N;const y=c.arguments[h];if(y.$kind!=="Input")return;const b=r[y.Input];if(!b.UnresolvedPure&&!b.UnresolvedObject)return;const w=((R=b.UnresolvedPure)==null?void 0:R.value)??((N=b.UnresolvedObject)==null?void 0:N.objectId),A=(0,gf.getPureBcsSchema)(f.body);if(A){y.type="pure",r[r.indexOf(b)]=Ba.Inputs.Pure(A.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 PO(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 pm(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=Ba.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function jO(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 kO(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=RO(i.MoveCall._argumentTypes[s])||r}}),r}function RO(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 Ko(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 NO(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var pp=Object.defineProperty,DO=Object.getOwnPropertyDescriptor,$O=Object.getOwnPropertyNames,BO=Object.prototype.hasOwnProperty,LO=(e,t)=>{for(var r in t)pp(e,r,{get:t[r],enumerable:!0})},FO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $O(t))!BO.call(e,i)&&i!==r&&pp(e,i,{get:()=>t[i],enumerable:!(n=DO(t,i))||n.enumerable});return e},UO=e=>FO(pp({},"__esModule",{value:!0}),e),$_={};LO($_,{createObjectMethods:()=>zO});var B_=UO($_);function zO(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 mp=Object.defineProperty,VO=Object.getOwnPropertyDescriptor,qO=Object.getOwnPropertyNames,WO=Object.prototype.hasOwnProperty,GO=(e,t)=>{for(var r in t)mp(e,r,{get:t[r],enumerable:!0})},HO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qO(t))!WO.call(e,i)&&i!==r&&mp(e,i,{get:()=>t[i],enumerable:!(n=VO(t,i))||n.enumerable});return e},KO=e=>HO(mp({},"__esModule",{value:!0}),e),L_={};GO(L_,{createPure:()=>XO});var F_=KO(L_),JO=Or,nr=si;function XO(e){function t(r,n){if(typeof r=="string")return e(La(r).serialize(n));if(r instanceof Uint8Array||(0,JO.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(nr.bcs.U8.serialize(r)),t.u16=r=>e(nr.bcs.U16.serialize(r)),t.u32=r=>e(nr.bcs.U32.serialize(r)),t.u64=r=>e(nr.bcs.U64.serialize(r)),t.u128=r=>e(nr.bcs.U128.serialize(r)),t.u256=r=>e(nr.bcs.U256.serialize(r)),t.bool=r=>e(nr.bcs.Bool.serialize(r)),t.string=r=>e(nr.bcs.String.serialize(r)),t.address=r=>e(nr.bcs.Address.serialize(r)),t.id=t.address,t.vector=(r,n)=>e(nr.bcs.vector(La(r)).serialize(n)),t.option=(r,n)=>e(nr.bcs.option(La(r)).serialize(n)),t}function La(e){switch(e){case"u8":return nr.bcs.u8();case"u16":return nr.bcs.u16();case"u32":return nr.bcs.u32();case"u64":return nr.bcs.u64();case"u128":return nr.bcs.u128();case"u256":return nr.bcs.u256();case"bool":return nr.bcs.bool();case"string":return nr.bcs.string();case"id":case"address":return nr.bcs.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?nr.bcs.vector(La(n)):nr.bcs.option(La(n))}throw new Error(`Invalid Pure type name: ${e}`)}var gp=Object.defineProperty,YO=Object.getOwnPropertyDescriptor,ZO=Object.getOwnPropertyNames,QO=Object.prototype.hasOwnProperty,eI=(e,t)=>{for(var r in t)gp(e,r,{get:t[r],enumerable:!0})},tI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ZO(t))!QO.call(e,i)&&i!==r&&gp(e,i,{get:()=>t[i],enumerable:!(n=YO(t,i))||n.enumerable});return e},rI=e=>tI(gp({},"__esModule",{value:!0}),e),U_={};eI(U_,{hashTypedData:()=>sI});var nI=rI(U_),iI=h_;function sI(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,iI.blake2b)(n,{dkLen:32})}var vp=Object.defineProperty,oI=Object.getOwnPropertyDescriptor,aI=Object.getOwnPropertyNames,cI=Object.prototype.hasOwnProperty,uI=(e,t)=>{for(var r in t)vp(e,r,{get:t[r],enumerable:!0})},lI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aI(t))!cI.call(e,i)&&i!==r&&vp(e,i,{get:()=>t[i],enumerable:!(n=oI(t,i))||n.enumerable});return e},fI=e=>lI(vp({},"__esModule",{value:!0}),e),z_={};uI(z_,{TransactionDataBuilder:()=>Rs});var yp=fI(z_),dI=Or,vf=ps,kc=si,hI=Jr,yf=Go,pI=I_,mI=nI;function mm(e){return(0,hI.normalizeSuiAddress)(e).replace("0x","")}class Rs{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=kc.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return Rs.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=kc.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 Rs.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 Rs((0,vf.parse)(yf.TransactionData,t)):new Rs((0,vf.parse)(yf.TransactionData,(0,pI.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,mI.hashTypedData)("TransactionData",t);return(0,dI.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 kc.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:mm(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:mm(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return kc.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 Rs.getDigestFromBytes(t)}snapshot(){return(0,vf.parse)(yf.TransactionData,this)}}var bp=Object.defineProperty,gI=Object.getOwnPropertyDescriptor,vI=Object.getOwnPropertyNames,yI=Object.prototype.hasOwnProperty,bI=(e,t)=>{for(var r in t)bp(e,r,{get:t[r],enumerable:!0})},wI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vI(t))!yI.call(e,i)&&i!==r&&bp(e,i,{get:()=>t[i],enumerable:!(n=gI(t,i))||n.enumerable});return e},_I=e=>wI(bp({},"__esModule",{value:!0}),e),V_={};bI(V_,{extractMutableReference:()=>q_,extractReference:()=>W_,extractStructTag:()=>SI,getIdFromCallArg:()=>EI});var xI=_I(V_),pa=Jr;function q_(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function W_(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function SI(e){if(typeof e=="object"&&"Struct"in e)return e;const t=W_(e),r=q_(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function EI(e){if(typeof e=="string")return(0,pa.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,pa.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,pa.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,pa.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,pa.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var wp=Object.defineProperty,CI=Object.getOwnPropertyDescriptor,MI=Object.getOwnPropertyNames,TI=Object.prototype.hasOwnProperty,G_=e=>{throw TypeError(e)},AI=(e,t)=>{for(var r in t)wp(e,r,{get:t[r],enumerable:!0})},OI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MI(t))!TI.call(e,i)&&i!==r&&wp(e,i,{get:()=>t[i],enumerable:!(n=CI(t,i))||n.enumerable});return e},II=e=>OI(wp({},"__esModule",{value:!0}),e),_p=(e,t,r)=>t.has(e)||G_("Cannot "+r),Mt=(e,t,r)=>(_p(e,t,"read from private field"),r?r.call(e):t.get(e)),ma=(e,t,r)=>t.has(e)?G_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),bs=(e,t,r,n)=>(_p(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),yi=(e,t,r)=>(_p(e,t,"access private method"),r),H_={};AI(H_,{Transaction:()=>$I,isTransaction:()=>J_});var cl=II(H_),Kc=Or,Ki=ps,PI=Jr,ws=lp,Ns=Go,gm=I_,jI=sO,Rc=ol,kI=D_,RI=B_,NI=F_,ga=yp,vm=xI,Aa,Fa,As,Ot,yn,Jc,xp,jd,Sp;function ym(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 K_=Symbol.for("@mysten/transaction");function J_(e){return!!e&&typeof e=="object"&&e[K_]===!0}const bm={buildPlugins:new Map,serializationPlugins:new Map},bf=Symbol.for("@mysten/transaction/registry");function va(){try{const e=globalThis;return e[bf]||(e[bf]=bm),e[bf]}catch{return bm}}const DI=class kd{constructor(){ma(this,yn),ma(this,Aa),ma(this,Fa),ma(this,As,new Map),ma(this,Ot),this.object=(0,RI.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Ki.is)(Ns.Argument,r))return r;const n=(0,vm.getIdFromCallArg)(r),i=Mt(this,Ot).inputs.find(a=>n===(0,vm.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:Mt(this,Ot).inputs.indexOf(i),type:"object"}:Mt(this,Ot).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,PI.normalizeSuiAddress)(r)}}:r)});const t=va();bs(this,Ot,new ga.TransactionDataBuilder),bs(this,Fa,[...t.buildPlugins.values()]),bs(this,Aa,[...t.serializationPlugins.values()])}static fromKind(t){const r=new kd;return bs(r,Ot,ga.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,Kc.fromBase64)(t):t)),r}static from(t){const r=new kd;return J_(t)?bs(r,Ot,new ga.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?bs(r,Ot,ga.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,Kc.fromBase64)(t):t)):bs(r,Ot,ga.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){va().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){va().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){va().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){va().buildPlugins.delete(t)}addSerializationPlugin(t){Mt(this,Aa).push(t)}addBuildPlugin(t){Mt(this,Fa).push(t)}addIntentResolver(t,r){if(Mt(this,As).has(t)&&Mt(this,As).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Mt(this,As).set(t,r)}setSender(t){Mt(this,Ot).sender=t}setSenderIfNotSet(t){Mt(this,Ot).sender||(Mt(this,Ot).sender=t)}setExpiration(t){Mt(this,Ot).expiration=t?(0,Ki.parse)(Ns.TransactionExpiration,t):null}setGasPrice(t){Mt(this,Ot).gasConfig.price=String(t)}setGasBudget(t){Mt(this,Ot).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Mt(this,Ot).gasData.budget==null&&(Mt(this,Ot).gasConfig.budget=String(t))}setGasOwner(t){Mt(this,Ot).gasConfig.owner=t}setGasPayment(t){Mt(this,Ot).gasConfig.payment=t.map(r=>(0,Ki.parse)(Ns.ObjectRef,r))}get blockData(){return(0,gm.serializeV1TransactionData)(Mt(this,Ot).snapshot())}getData(){return Mt(this,Ot).snapshot()}get[K_](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,NI.createPure)(t=>(0,Kc.isSerializedBcs)(t)?Mt(this,Ot).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Mt(this,Ot).addInput("pure",(0,Ki.is)(Ns.NormalizedCallArg,t)?(0,Ki.parse)(Ns.NormalizedCallArg,t):t instanceof Uint8Array?Rc.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(Rc.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(Rc.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(Rc.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Mt(this,Ot).commands.push(t);return ym(r-1)}splitCoins(t,r){const n=ws.Commands.SplitCoins(typeof t=="string"?this.object(t):yi(this,yn,xp).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):yi(this,yn,Jc).call(this,s))),i=Mt(this,Ot).commands.push(n);return ym(i-1,r.length)}mergeCoins(t,r){return this.add(ws.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(ws.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(ws.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(ws.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>yi(this,yn,Jc).call(this,n))}))}transferObjects(t,r){return this.add(ws.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):yi(this,yn,Jc).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(ws.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,gm.serializeV1TransactionData)(Mt(this,Ot).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Ki.parse)(jI.SerializedTransactionDataV2,Mt(this,Ot).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 yi(this,yn,jd).call(this,t),Mt(this,Ot).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await yi(this,yn,jd).call(this,t),Mt(this,Ot).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of Mt(this,Ot).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...Mt(this,Aa)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!Mt(this,As).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(Mt(this,As).get(s))}await yi(this,yn,Sp).call(this,n,t)}};Aa=new WeakMap;Fa=new WeakMap;As=new WeakMap;Ot=new WeakMap;yn=new WeakSet;Jc=function(e){return(0,Kc.isSerializedBcs)(e)?this.pure(e):yi(this,yn,xp).call(this,e)};xp=function(e){return typeof e=="function"?(0,Ki.parse)(Ns.Argument,e(this)):(0,Ki.parse)(Ns.Argument,e)};jd=async function(e){if(!e.onlyTransactionKind&&!Mt(this,Ot).sender)throw new Error("Missing transaction sender");await yi(this,yn,Sp).call(this,[...Mt(this,Fa),kI.resolveTransactionData],e)};Sp=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(Mt(this,Ot),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 $I=DI;var Ep=Object.defineProperty,BI=Object.getOwnPropertyDescriptor,LI=Object.getOwnPropertyNames,FI=Object.prototype.hasOwnProperty,X_=e=>{throw TypeError(e)},UI=(e,t)=>{for(var r in t)Ep(e,r,{get:t[r],enumerable:!0})},zI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LI(t))!FI.call(e,i)&&i!==r&&Ep(e,i,{get:()=>t[i],enumerable:!(n=BI(t,i))||n.enumerable});return e},VI=e=>zI(Ep({},"__esModule",{value:!0}),e),Y_=(e,t,r)=>t.has(e)||X_("Cannot "+r),dr=(e,t,r)=>(Y_(e,t,"read from private field"),r?r.call(e):t.get(e)),Rd=(e,t,r)=>t.has(e)?X_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),wm=(e,t,r,n)=>(Y_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Z_={};UI(Z_,{AsyncCache:()=>ex,InMemoryCache:()=>tx,ObjectCache:()=>qI});var Q_=VI(Z_),wf=Jr,Os,Er,Xc;class ex{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,wf.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,wf.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,wf.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 tx extends ex{constructor(){super(...arguments),Rd(this,Os,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return dr(this,Os)[t].get(r)??null}async set(t,r,n){dr(this,Os)[t].set(r,n)}async delete(t,r){dr(this,Os)[t].delete(r)}async clear(t){if(t)dr(this,Os)[t].clear();else for(const r of Object.values(dr(this,Os)))r.clear()}}Os=new WeakMap;class qI{constructor({cache:t=new tx,onEffects:r}){Rd(this,Er),Rd(this,Xc),wm(this,Er,t),wm(this,Xc,r)}asPlugin(){return async(t,r,n)=>{const i=t.inputs.filter(a=>a.UnresolvedObject).map(a=>a.UnresolvedObject.objectId),s=(await dr(this,Er).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,Er).addMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function,parameters:a.MoveCall._argumentTypes})}))}}async clear(){await dr(this,Er).clear()}async getMoveFunctionDefinition(t){return dr(this,Er).getMoveFunctionDefinition(t)}async getObjects(t){return dr(this,Er).getObjects(t)}async deleteObjects(t){return dr(this,Er).deleteObjects(t)}async clearOwnedObjects(){await dr(this,Er).clear("OwnedObject")}async clearCustom(){await dr(this,Er).clear("Custom")}async getCustom(t){return dr(this,Er).getCustom(t)}async setCustom(t,r){return dr(this,Er).setCustom(t,r)}async deleteCustom(t){return dr(this,Er).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,Er).addObjects(o),dr(this,Er).deleteObjects(s),(r=dr(this,Xc))==null?void 0:r.call(this,t)])}}Er=new WeakMap;Xc=new WeakMap;var Cp=Object.defineProperty,WI=Object.getOwnPropertyDescriptor,GI=Object.getOwnPropertyNames,HI=Object.prototype.hasOwnProperty,rx=e=>{throw TypeError(e)},KI=(e,t)=>{for(var r in t)Cp(e,r,{get:t[r],enumerable:!0})},JI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GI(t))!HI.call(e,i)&&i!==r&&Cp(e,i,{get:()=>t[i],enumerable:!(n=WI(t,i))||n.enumerable});return e},XI=e=>JI(Cp({},"__esModule",{value:!0}),e),nx=(e,t,r)=>t.has(e)||rx("Cannot "+r),ya=(e,t,r)=>(nx(e,t,"read from private field"),r?r.call(e):t.get(e)),_m=(e,t,r)=>t.has(e)?rx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),_f=(e,t,r,n)=>(nx(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ix={};KI(ix,{CachingTransactionExecutor:()=>eP});var sx=XI(ix),YI=si,ZI=Q_,QI=cl,go,vo;class eP{constructor({client:t,...r}){_m(this,go),_m(this,vo,null),_f(this,go,t),this.cache=new ZI.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:ya(this,go),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,QI.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await ya(this,go).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=YI.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;_f(this,vo,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){ya(this,vo)&&(await ya(this,go).waitForTransaction({digest:ya(this,vo)}),_f(this,vo,null))}}go=new WeakMap;vo=new WeakMap;var Mp=Object.defineProperty,tP=Object.getOwnPropertyDescriptor,rP=Object.getOwnPropertyNames,nP=Object.prototype.hasOwnProperty,ox=e=>{throw TypeError(e)},iP=(e,t)=>{for(var r in t)Mp(e,r,{get:t[r],enumerable:!0})},sP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rP(t))!nP.call(e,i)&&i!==r&&Mp(e,i,{get:()=>t[i],enumerable:!(n=tP(t,i))||n.enumerable});return e},oP=e=>sP(Mp({},"__esModule",{value:!0}),e),aP=(e,t,r)=>t.has(e)||ox("Cannot "+r),_n=(e,t,r)=>(aP(e,t,"read from private field"),r?r.call(e):t.get(e)),ax=(e,t,r)=>t.has(e)?ox("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),cx={};iP(cx,{ParallelQueue:()=>uP,SerialQueue:()=>cP});var ux=oP(cx),Wi,Is;class cP{constructor(){ax(this,Wi,[])}async runTask(t){return new Promise((r,n)=>{_n(this,Wi).push(()=>{t().finally(()=>{_n(this,Wi).shift(),_n(this,Wi).length>0&&_n(this,Wi)[0]()}).then(r,n)}),_n(this,Wi).length===1&&_n(this,Wi)[0]()})}}Wi=new WeakMap;class uP{constructor(t){ax(this,Is,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{_n(this,Is).length>0?_n(this,Is).shift()():this.activeTasks--}).then(r,n)):_n(this,Is).push(()=>{t().finally(()=>{_n(this,Is).length>0?_n(this,Is).shift()():this.activeTasks--}).then(r,n)})})}}Is=new WeakMap;var Tp=Object.defineProperty,lP=Object.getOwnPropertyDescriptor,fP=Object.getOwnPropertyNames,dP=Object.prototype.hasOwnProperty,lx=e=>{throw TypeError(e)},hP=(e,t)=>{for(var r in t)Tp(e,r,{get:t[r],enumerable:!0})},pP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fP(t))!dP.call(e,i)&&i!==r&&Tp(e,i,{get:()=>t[i],enumerable:!(n=lP(t,i))||n.enumerable});return e},mP=e=>pP(Tp({},"__esModule",{value:!0}),e),fx=(e,t,r)=>t.has(e)||lx("Cannot "+r),Sr=(e,t,r)=>(fx(e,t,"read from private field"),r?r.call(e):t.get(e)),no=(e,t,r)=>t.has(e)?lx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),xf=(e,t,r,n)=>(fx(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),dx={};hP(dx,{SerialTransactionExecutor:()=>bP,getGasCoinFromEffects:()=>px});var hx=mP(dx),gP=Or,xm=cl,vP=sx,yP=ux,Yc,Oa,gn,Zc,Nd,Qc;class bP{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){no(this,Yc,new yP.SerialQueue),no(this,Oa),no(this,gn),no(this,Zc),no(this,Nd,async i=>{if(!i.V2)return;const s=px(i).ref;s?Sr(this,gn).cache.setCustom("gasCoin",s):Sr(this,gn).cache.deleteCustom("gasCoin")}),no(this,Qc,async i=>{const s=await Sr(this,gn).cache.getCustom("gasCoin"),o=xm.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(Sr(this,Zc)),o.setSenderIfNotSet(Sr(this,Oa).toSuiAddress()),Sr(this,gn).buildTransaction({transaction:o})}),xf(this,Oa,t),xf(this,Zc,r),xf(this,gn,new vP.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>Sr(this,Nd).call(this,i)}))}async applyEffects(t){return Sr(this,gn).applyEffects(t)}async buildTransaction(t){return Sr(this,Yc).runTask(()=>Sr(this,Qc).call(this,t))}resetCache(){return Sr(this,gn).reset()}waitForLastTransaction(){return Sr(this,gn).waitForLastTransaction()}executeTransaction(t,r){return Sr(this,Yc).runTask(async()=>{const n=(0,xm.isTransaction)(t)?await Sr(this,Qc).call(this,t):t,{signature:i}=await Sr(this,Oa).signTransaction(n),s=await Sr(this,gn).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,gP.toBase64)(o),data:s}})}}Yc=new WeakMap;Oa=new WeakMap;gn=new WeakMap;Zc=new WeakMap;Nd=new WeakMap;Qc=new WeakMap;function px(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 Ap=Object.defineProperty,wP=Object.getOwnPropertyDescriptor,_P=Object.getOwnPropertyNames,xP=Object.prototype.hasOwnProperty,mx=e=>{throw TypeError(e)},SP=(e,t)=>{for(var r in t)Ap(e,r,{get:t[r],enumerable:!0})},EP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _P(t))!xP.call(e,i)&&i!==r&&Ap(e,i,{get:()=>t[i],enumerable:!(n=wP(t,i))||n.enumerable});return e},CP=e=>EP(Ap({},"__esModule",{value:!0}),e),Op=(e,t,r)=>t.has(e)||mx("Cannot "+r),We=(e,t,r)=>(Op(e,t,"read from private field"),r?r.call(e):t.get(e)),fr=(e,t,r)=>t.has(e)?mx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),rr=(e,t,r,n)=>(Op(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),sn=(e,t,r)=>(Op(e,t,"access private method"),r),Sm=(e,t,r,n)=>({set _(i){rr(e,t,i,r)},get _(){return We(e,t,n)}}),gx={};SP(gx,{ParallelTransactionExecutor:()=>PP});var MP=CP(gx),TP=Or,vx=si,AP=cl,OP=yp,IP=sx,Em=ux,yx=hx,rs,Xn,Au,Ka,Ua,Ja,Ou,Po,kr,ns,zs,Ls,Ip,eu,Xa,_o,No,_i,Br,bx,wx,Ya,Pp,_x,Dd,xx;const ba={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class PP{constructor(t){fr(this,Br),fr(this,rs),fr(this,Xn),fr(this,Au),fr(this,Ka),fr(this,Ua),fr(this,Ja),fr(this,Ou),fr(this,Po),fr(this,kr),fr(this,ns,[]),fr(this,zs),fr(this,Ls,new Map),fr(this,Ip,new Em.SerialQueue),fr(this,eu),fr(this,Xa,null),fr(this,_o,null),fr(this,No,0),fr(this,_i,null),rr(this,rs,t.signer),rr(this,Xn,t.client),rr(this,Au,t.coinBatchSize??ba.coinBatchSize),rr(this,Ka,t.initialCoinBalance??ba.initialCoinBalance),rr(this,Ua,t.minimumCoinBalance??ba.minimumCoinBalance),rr(this,Ou,t.defaultGasBudget??We(this,Ua)),rr(this,Ja,t.epochBoundaryWindow??ba.epochBoundaryWindow),rr(this,Po,t.maxPoolSize??ba.maxPoolSize),rr(this,zs,new IP.CachingTransactionExecutor({client:t.client,cache:t.cache})),rr(this,eu,new Em.ParallelQueue(We(this,Po))),rr(this,kr,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return rr(this,_i,null),sn(this,Br,Ya).call(this,()=>We(this,zs).reset())}async waitForLastTransaction(){await sn(this,Br,Ya).call(this,()=>sn(this,Br,Pp).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=jP(),o=await sn(this,Br,bx).call(this,t),a=()=>{We(this,eu).runTask(()=>sn(this,Br,wx).call(this,t,o,r).then(i,s))},c=new Set;return o.forEach(u=>{We(this,Ls).get(u)?(c.add(u),We(this,Ls).get(u).push(()=>{c.delete(u),c.size===0&&a()})):We(this,Ls).set(u,[])}),c.size===0&&a(),n}}rs=new WeakMap;Xn=new WeakMap;Au=new WeakMap;Ka=new WeakMap;Ua=new WeakMap;Ja=new WeakMap;Ou=new WeakMap;Po=new WeakMap;kr=new WeakMap;ns=new WeakMap;zs=new WeakMap;Ls=new WeakMap;Ip=new WeakMap;eu=new WeakMap;Xa=new WeakMap;_o=new WeakMap;No=new WeakMap;_i=new WeakMap;Br=new WeakSet;bx=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:We(this,Xn)}),t};wx=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(We(this,rs).toSuiAddress()),await We(this,Ip).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await sn(this,Br,Dd).call(this)),e.setGasBudgetIfNotSet(We(this,Ou)),await sn(this,Br,Ya).call(this),n=await sn(this,Br,_x).call(this),Sm(this,No)._++,e.setGasPayment([{objectId:n.id,version:n.version,digest:n.digest}]),await We(this,zs).buildTransaction({transaction:e,onlyTransactionKind:!0})});const s=await e.build({client:We(this,Xn)}),{signature:o}=await We(this,rs).signTransaction(s),a=await We(this,zs).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=vx.bcs.TransactionEffects.parse(c),l=(0,yx.getGasCoinFromEffects)(u),f=(i=u.V2)==null?void 0:i.gasUsed;if(n&&f&&l.owner===We(this,rs).toSuiAddress()){const h=BigInt(f.computationCost)+BigInt(f.storageCost)+BigInt(f.storageCost)-BigInt(f.storageRebate);let y=!1;new OP.TransactionDataBuilder(e.getData()).mapArguments(b=>(b.$kind==="GasCoin"&&(y=!0),b)),!y&&n.balance>=We(this,Ua)?We(this,ns).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(We(this,kr)||rr(this,kr,new Map),We(this,kr).set(l.ref.objectId,l.ref))}return rr(this,Xa,a.digest),{digest:a.digest,effects:(0,TP.toBase64)(c),data:a}}catch(s){throw n&&(We(this,kr)||rr(this,kr,new Map),We(this,kr).set(n.id,null)),await sn(this,Br,Ya).call(this,async()=>{await Promise.all([We(this,zs).cache.deleteObjects([...t]),sn(this,Br,Pp).call(this)])}),s}finally{t.forEach(s=>{const o=We(this,Ls).get(s);o&&o.length>0?o.shift()():o&&We(this,Ls).delete(s)}),Sm(this,No)._--}};Ya=async function(e){We(this,_o)&&await We(this,_o),rr(this,_o,(e==null?void 0:e().then(()=>{rr(this,_o,null)},()=>{}))??null)};Pp=async function(){const e=We(this,Xa);e&&(rr(this,Xa,null),await We(this,Xn).waitForTransaction({digest:e}))};_x=async function(){if(We(this,ns).length===0&&We(this,No)<=We(this,Po)&&await sn(this,Br,xx).call(this),We(this,ns).length===0)throw new Error("No coins available");return We(this,ns).shift()};Dd=async function(){if((We(this,_i)?We(this,_i).expiration-We(this,Ja)-Date.now():0)>0)return We(this,_i).price;if(We(this,_i)){const r=Math.max(We(this,_i).expiration+We(this,Ja)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await We(this,Xn).getLatestSuiSystemState();return rr(this,_i,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),sn(this,Br,Dd).call(this)};xx=async function(){var u;const e=Math.min(We(this,Au),We(this,Po)-(We(this,ns).length+We(this,No))+1);if(e===0)return;const t=new AP.Transaction,r=We(this,rs).toSuiAddress();if(t.setSender(r),We(this,kr)){const l=[],f=[];for(const[h,y]of We(this,kr))y?l.push(y):f.push(h);if(f.length>0){const h=await We(this,Xn).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),rr(this,kr,new Map)}const n=new Array(e).fill(We(this,Ka)),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 We(this,Xn).signAndExecuteTransaction({transaction:t,signer:We(this,rs),options:{showRawEffects:!0}}),a=vx.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||We(this,ns).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(We(this,Ka))})}),We(this,kr)||rr(this,kr,new Map);const c=(0,yx.getGasCoinFromEffects)(a).ref;We(this,kr).set(c.objectId,c),await We(this,Xn).waitForTransaction({digest:o.digest})};function jP(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var jp=Object.defineProperty,kP=Object.getOwnPropertyDescriptor,RP=Object.getOwnPropertyNames,NP=Object.prototype.hasOwnProperty,DP=(e,t)=>{for(var r in t)jp(e,r,{get:t[r],enumerable:!0})},$P=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of RP(t))!NP.call(e,i)&&i!==r&&jp(e,i,{get:()=>t[i],enumerable:!(n=kP(t,i))||n.enumerable});return e},BP=e=>$P(jp({},"__esModule",{value:!0}),e),Sx={};DP(Sx,{coinWithBalance:()=>zP});var LP=BP(Sx),tu=ps,FP=si,Ex=Jr,ru=lp,Cm=ol,UP=D_;const Iu="CoinWithBalance",Mm=(0,Ex.normalizeStructTag)("0x2::sui::SUI");function zP({type:e=Mm,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(Iu,qP);const i=e==="gas"?e:(0,Ex.normalizeStructTag)(e);return n.add(ru.Commands.Intent({name:Iu,inputs:{},data:{type:i===Mm&&r?"gas":i,balance:BigInt(t)}}))}}const VP=(0,tu.object)({type:(0,tu.string)(),balance:(0,tu.bigint)()});async function qP(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===Iu){const{type:h,balance:y}=(0,tu.parse)(VP,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,UP.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await WP({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!==Iu)continue;const{type:y,balance:b}=h.$Intent.data;if(b===0n){e.replaceCommand(f,ru.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const w=[];if(!c.has(y)){const[A,...P]=o.get(y).map(R=>e.addInput("object",Cm.Inputs.ObjectRef({objectId:R.coinObjectId,digest:R.digest,version:R.version})));P.length>0&&w.push(ru.Commands.MergeCoins(A,P)),c.set(y,A)}w.push(ru.Commands.SplitCoins(c.get(y),[e.addInput("pure",Cm.Inputs.Pure(FP.bcs.u64().serialize(b)))])),e.replaceCommand(f,w),e.mapArguments(A=>A.$kind==="Result"&&A.Result===f?{$kind:"NestedResult",NestedResult:[f+w.length-1,0]}:A)}return r()}async function WP({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 kp=Object.defineProperty,GP=Object.getOwnPropertyDescriptor,HP=Object.getOwnPropertyNames,KP=Object.prototype.hasOwnProperty,JP=(e,t)=>{for(var r in t)kp(e,r,{get:t[r],enumerable:!0})},XP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of HP(t))!KP.call(e,i)&&i!==r&&kp(e,i,{get:()=>t[i],enumerable:!(n=GP(t,i))||n.enumerable});return e},YP=e=>XP(kp({},"__esModule",{value:!0}),e),Cx={};JP(Cx,{Arguments:()=>t7});var ZP=YP(Cx),QP=B_,e7=F_;const t7={pure:(0,e7.createPure)(e=>t=>t.pure(e)),object:(0,QP.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 Rp=Object.defineProperty,r7=Object.getOwnPropertyDescriptor,n7=Object.getOwnPropertyNames,i7=Object.prototype.hasOwnProperty,s7=(e,t)=>{for(var r in t)Rp(e,r,{get:t[r],enumerable:!0})},o7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of n7(t))!i7.call(e,i)&&i!==r&&Rp(e,i,{get:()=>t[i],enumerable:!(n=r7(t,i))||n.enumerable});return e},a7=e=>o7(Rp({},"__esModule",{value:!0}),e),Mx={};s7(Mx,{findTransactionBlockNames:()=>u7,listToRequests:()=>f7,replaceNames:()=>l7});var c7=a7(Mx),Tx=l_;const xo="/",u7=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){Tm([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(xo)){if(!(0,Tx.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}Tm(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function Tm(e){const t=new Set;for(const r of e)if(r.includes(xo)){if(!(0,Tx.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const l7=(e,t)=>{var r;for(const n of e.commands){if((r=n.MakeMoveVec)!=null&&r.type){if(!n.MakeMoveVec.type.includes(xo))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(xo)&&!t.packages[o])throw new Error(`No address found for package: ${o}`);o.includes(xo)&&(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(xo)){if(!t.types[a[c]])throw new Error(`No resolution found for type: ${a[c]}`);a[c]=t.types[a[c]]}i.typeArguments=a}}},f7=(e,t)=>{const r=[],n=Am(e.packages),i=Am(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 d7(r,t)},Am=e=>[...new Set(e)],d7=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var Np=Object.defineProperty,h7=Object.getOwnPropertyDescriptor,p7=Object.getOwnPropertyNames,m7=Object.prototype.hasOwnProperty,g7=(e,t)=>{for(var r in t)Np(e,r,{get:t[r],enumerable:!0})},v7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of p7(t))!m7.call(e,i)&&i!==r&&Np(e,i,{get:()=>t[i],enumerable:!(n=h7(t,i))||n.enumerable});return e},y7=e=>v7(Np({},"__esModule",{value:!0}),e),Ax={};g7(Ax,{namedPackagesPlugin:()=>w7});var b7=y7(Ax),Sf=c7;const w7=({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,Sf.findTransactionBlockNames)(s),u=(0,Sf.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,Sf.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`${
|
|
24
|
+
<%s key={someKey} {...props} />`,gr,ir,pn,ir),K[ir+gr]=!0}}return z===n?B(Dt):T(Dt),Dt}}function te(z,oe,he){return Z(z,oe,he,!0)}function Be(z,oe,he){return Z(z,oe,he,!1)}var tt=Be,Ne=te;da.Fragment=n,da.jsx=tt,da.jsxs=Ne}()),da}Tn.env.NODE_ENV==="production"?yd.exports=G3():yd.exports=H3();var _=yd.exports;window._iconfont_svg_string_4776227='<svg><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);function Gn(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 K3="1.18.0",J3="1.40.0",X3={"-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 Mh extends Error{}class Th extends Mh{constructor(t,r){super(t),this.code=r,this.type=X3[r]??"ServerError"}}class e1 extends Mh{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var t1=e=>{throw TypeError(e)},Ah=(e,t,r)=>t.has(e)||t1("Cannot "+r),tr=(e,t,r)=>(Ah(e,t,"read from private field"),r?r.call(e):t.get(e)),bs=(e,t,r)=>t.has(e)?t1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ao=(e,t,r,n)=>(Ah(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),r1=(e,t,r)=>(Ah(e,t,"access private method"),r),Y3=(e,t,r,n)=>({set _(i){Ao(e,t,i,r)},get _(){return tr(e,t,n)}}),Ts,ja,bi,Ls,Wa,Oo,yu,n1,i1;function Z3(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const Q3={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class eE{constructor(t,r={}){if(bs(this,yu),bs(this,Ts,0),bs(this,ja,0),bs(this,bi,null),bs(this,Ls,null),bs(this,Wa,new Set),bs(this,Oo,new Map),this.endpoint=t,this.options={...Q3,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=Z3(this.endpoint))}async makeRequest(t,r){const n=await r1(this,yu,n1).call(this);return new Promise((i,s)=>{Ao(this,Ts,tr(this,Ts)+1),tr(this,Oo).set(tr(this,Ts),{resolve:i,reject:s,timeout:setTimeout(()=>{tr(this,Oo).delete(tr(this,Ts)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:tr(this,Ts),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new Th(i.message,i.code);return s})}async subscribe(t){const r=new tE(t);return tr(this,Wa).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}Ts=new WeakMap;ja=new WeakMap;bi=new WeakMap;Ls=new WeakMap;Wa=new WeakMap;Oo=new WeakMap;yu=new WeakSet;n1=function(){return tr(this,Ls)?tr(this,Ls):(Ao(this,Ls,new Promise(e=>{var t;(t=tr(this,bi))==null||t.close(),Ao(this,bi,new this.options.WebSocketConstructor(this.endpoint)),tr(this,bi).addEventListener("open",()=>{Ao(this,ja,0),e(tr(this,bi))}),tr(this,bi).addEventListener("close",()=>{Y3(this,ja)._++,tr(this,ja)<=this.options.maxReconnects&&setTimeout(()=>{r1(this,yu,i1).call(this)},this.options.reconnectTimeout)}),tr(this,bi).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,Oo).has(n.id)){const{resolve:i,timeout:s}=tr(this,Oo).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,Ls))};i1=async function(){var e;return(e=tr(this,bi))==null||e.close(),Ao(this,Ls,null),Promise.allSettled([...tr(this,Wa)].map(t=>t.subscribe(this)))};class tE{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 s1=e=>{throw TypeError(e)},Oh=(e,t,r)=>t.has(e)||s1("Cannot "+r),tn=(e,t,r)=>(Oh(e,t,"read from private field"),r?r.call(e):t.get(e)),Pc=(e,t,r)=>t.has(e)?s1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),bd=(e,t,r,n)=>(Oh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),rE=(e,t,r)=>(Oh(e,t,"access private method"),r),Ca,wn,ka,wd,o1;class a1{constructor(t){Pc(this,wd),Pc(this,Ca,0),Pc(this,wn),Pc(this,ka),bd(this,wn,t)}fetch(t,r){const n=tn(this,wn).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;bd(this,Ca,tn(this,Ca)+1);const r=await this.fetch(((i=tn(this,wn).rpc)==null?void 0:i.url)??tn(this,wn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":K3,"Client-Target-Api-Version":J3,"Client-Request-Method":t.method,...(s=tn(this,wn).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:tn(this,Ca),method:t.method,params:t.params})});if(!r.ok)throw new e1(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new Th(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await rE(this,wd,o1).call(this).subscribe(t);return async()=>!!await r()}}Ca=new WeakMap;wn=new WeakMap;ka=new WeakMap;wd=new WeakSet;o1=function(){var e;if(!tn(this,ka)){const t=tn(this,wn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");bd(this,ka,new eE(((e=tn(this,wn).websocket)==null?void 0:e.url)??tn(this,wn).url,{WebSocketConstructor:t,...tn(this,wn).websocket}))}return tn(this,ka)};function c1(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 nE(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 R=u[h],N=0;for(let F=b-1;(R!==0||N<f)&&F!==-1;F--,N++)R+=256*w[F]>>>0,w[F]=R%r>>>0,R=R/r>>>0;if(R!==0)throw new Error("Non-zero carry");f=N,h++}let A=b-f;for(;A!==b&&w[A]===0;)A++;let P=n.repeat(l);for(;A<b;++A)P+=e.charAt(w[A]);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 R=t[u.charCodeAt(l)];if(R===255)return;let N=0;for(let F=y-1;(R!==0||N<h)&&F!==-1;F--,N++)R+=r*b[F]>>>0,b[F]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");h=N,l++}let w=y-h;for(;w!==y&&b[w]===0;)w++;const A=new Uint8Array(f+(y-w));let P=f;for(;w!==y;)A[P++]=b[w++];return A}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 iE="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const u1=nE(iE),qo=e=>u1.encode(e),Pi=e=>u1.decode(e),sE=qo,oE=Pi;function Pn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const ff=8192;function Wr(e){if(e.length<ff)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=ff){const n=e.slice(r,r+ff);t+=String.fromCharCode(...n)}return btoa(t)}const l1=Wr,f1=Pn;function Wo(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 ji(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const d1=ji,h1=Wo;function Ih(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 aE(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 p1{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}=aE(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 m1(e,t){switch(t){case"base58":return qo(e);case"base64":return Wr(e);case"hex":return ji(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function cE(e,t){switch(t){case"base58":return Pi(e);case"base64":return Pn(e);case"hex":return Wo(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function Ph(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 g1{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 df(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return df(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return df(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return Ih(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 m1(this.toBytes(),t)}}function df(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 v1=e=>{throw TypeError(e)},y1=(e,t,r)=>t.has(e)||v1("Cannot "+r),_n=(e,t,r)=>(y1(e,t,"read from private field"),r?r.call(e):t.get(e)),bu=(e,t,r)=>t.has(e)?v1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),wu=(e,t,r,n)=>(y1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),po,Ma,Kc,qi;const uE=class b1{constructor(t){bu(this,po),bu(this,Ma),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),wu(this,po,t.write),wu(this,Ma,t.serialize??((r,n)=>{const i=new g1({initialSize:this.serializedSize(r)??void 0,...n});return _n(this,po).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),_n(this,po).call(this,t,r)}serialize(t,r){return this.validate(t),new _1(this,_n(this,Ma).call(this,t,r))}parse(t){const r=new p1(t);return this.read(r)}fromHex(t){return this.parse(Wo(t))}fromBase58(t){return this.parse(Pi(t))}fromBase64(t){return this.parse(Pn(t))}transform({name:t,input:r,output:n,validate:i}){return new b1({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>_n(this,po).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>_n(this,Ma).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};po=new WeakMap;Ma=new WeakMap;let Hn=uE;const w1=Symbol.for("@mysten/serialized-bcs");function lE(e){return!!e&&typeof e=="object"&&e[w1]===!0}class _1{constructor(t,r){bu(this,Kc),bu(this,qi),wu(this,Kc,t),wu(this,qi,r)}get[w1](){return!0}toBytes(){return _n(this,qi)}toHex(){return ji(_n(this,qi))}toBase64(){return Wr(_n(this,qi))}toBase58(){return qo(_n(this,qi))}parse(){return _n(this,Kc).parse(_n(this,qi))}}Kc=new WeakMap;qi=new WeakMap;function _u({size:e,...t}){return new Hn({...t,serializedSize:()=>e})}function hf({readMethod:e,writeMethod:t,...r}){return _u({...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 pf({readMethod:e,writeMethod:t,...r}){return _u({...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 fE({serialize:e,...t}){const r=new Hn({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function dE({toBytes:e,fromBytes:t,...r}){return new Hn({...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=Ih(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 hE(e){let t=null;function r(){return t||(t=e()),t}return new Hn({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 hf({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return hf({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return hf({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return pf({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return pf({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return pf({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return _u({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 fE({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(Ih(t)),...e})},bytes(e,t){return _u({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 dE({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Hn({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 Hn({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 Hn({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 Hn({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 Hn({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 hE(e)}},pE=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:p1,BcsType:Hn,BcsWriter:g1,SerializedBcs:_1,bcs:W,decodeStr:cE,encodeStr:m1,fromB58:oE,fromB64:f1,fromBase58:Pi,fromBase64:Pn,fromHEX:h1,fromHex:Wo,isSerializedBcs:lE,splitGenericParameters:Ph,toB58:sE,toB64:l1,toBase58:qo,toBase64:Wr,toHEX:d1,toHex:ji},Symbol.toStringTag,{value:"Module"})),mE=32;function _d(e){try{return Pi(e).length===mE}catch{return!1}}const sl=32;function wi(e){return vE(e)&&yE(e)===sl}function Ta(e){return wi(e)}function gE(e){return e.includes("::")?jh(e):e}function jh(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("<")?Ph(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>gE(o.trim())):[];return{address:$r(t),module:r,name:i,typeParams:s}}function x1(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?jh(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:x1(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function $r(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(sl*2,"0")}`}function Ci(e,t=!1){return $r(e,t)}function vE(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function yE(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const bE=/^vector<(.+)>$/,wE=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let tm=class mo{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(bE);if(n)return{vector:mo.parseFromStr(n[1],r)};const i=t.match(wE);if(i)return{struct:{address:r?$r(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:mo.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return Ph(t).map(n=>mo.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<${mo.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(mo.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function _E(e){return W.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function xE(e){return W.enum("Option",{None:null,Some:e})}const Qt=W.bytes(sl).transform({validate:e=>{const t=typeof e=="string"?e:ji(e);if(!t||!wi($r(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?Wo($r(e)):e,output:e=>$r(ji(e))}),En=W.vector(W.u8()).transform({name:"ObjectDigest",input:e=>Pi(e),output:e=>qo(new Uint8Array(e)),validate:e=>{if(Pi(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Qr=W.struct("SuiObjectRef",{objectId:Qt,version:W.u64(),digest:En}),S1=W.struct("SharedObjectRef",{objectId:Qt,initialSharedVersion:W.u64(),mutable:W.bool()}),E1=W.enum("ObjectArg",{ImmOrOwnedObject:Qr,SharedObject:S1,Receiving:Qr}),C1=W.enum("CallArg",{Pure:W.struct("Pure",{bytes:W.vector(W.u8()).transform({input:e=>typeof e=="string"?Pn(e):e,output:e=>Wr(new Uint8Array(e))})}),Object:E1}),kh=W.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:W.lazy(()=>kh),struct:W.lazy(()=>P1),u16:null,u32:null,u256:null}),Rh=kh.transform({input:e=>typeof e=="string"?tm.parseFromStr(e,!0):e,output:e=>tm.tagToString(e)}),zn=W.enum("Argument",{GasCoin:null,Input:W.u16(),Result:W.u16(),NestedResult:W.tuple([W.u16(),W.u16()])}),M1=W.struct("ProgrammableMoveCall",{package:Qt,module:W.string(),function:W.string(),typeArguments:W.vector(Rh),arguments:W.vector(zn)}),T1=W.enum("Command",{MoveCall:M1,TransferObjects:W.struct("TransferObjects",{objects:W.vector(zn),address:zn}),SplitCoins:W.struct("SplitCoins",{coin:zn,amounts:W.vector(zn)}),MergeCoins:W.struct("MergeCoins",{destination:zn,sources:W.vector(zn)}),Publish:W.struct("Publish",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?Pn(e):e,output:e=>Wr(new Uint8Array(e))})),dependencies:W.vector(Qt)}),MakeMoveVec:W.struct("MakeMoveVec",{type:xE(Rh).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:W.vector(zn)}),Upgrade:W.struct("Upgrade",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?Pn(e):e,output:e=>Wr(new Uint8Array(e))})),dependencies:W.vector(Qt),package:Qt,ticket:zn})}),A1=W.struct("ProgrammableTransaction",{inputs:W.vector(C1),commands:W.vector(T1)}),O1=W.enum("TransactionKind",{ProgrammableTransaction:A1,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),I1=W.enum("TransactionExpiration",{None:null,Epoch:_E()}),P1=W.struct("StructTag",{address:Qt,module:W.string(),name:W.string(),typeParams:W.vector(kh)}),j1=W.struct("GasData",{payment:W.vector(Qr),owner:Qt,price:W.u64(),budget:W.u64()}),k1=W.struct("TransactionDataV1",{kind:O1,sender:Qt,gasData:j1,expiration:I1}),R1=W.enum("TransactionData",{V1:k1}),N1=W.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),D1=W.enum("IntentVersion",{V0:null}),$1=W.enum("AppId",{Sui:null}),B1=W.struct("Intent",{scope:N1,version:D1,appId:$1});function L1(e){return W.struct(`IntentMessage<${e.name}>`,{intent:B1,value:e})}const F1=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())}),U1=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())}),z1=W.struct("MultiSigPkMap",{pubKey:U1,weight:W.u8()}),V1=W.struct("MultiSigPublicKey",{pk_map:W.vector(z1),threshold:W.u16()}),SE=W.struct("MultiSig",{sigs:W.vector(F1),bitmap:W.u16(),multisig_pk:V1}),EE=W.vector(W.u8()).transform({input:e=>typeof e=="string"?Pn(e):e,output:e=>Wr(new Uint8Array(e))}),q1=W.struct("SenderSignedTransaction",{intentMessage:L1(R1),txSignatures:W.vector(EE)}),CE=W.vector(q1,{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:Qt}),NotAPackage:W.struct("NotAPackage",{objectId:Qt}),IncompatibleUpgrade:null,DigestDoesNotMatch:W.struct("DigestDoesNotMatch",{digest:W.vector(W.u8())}),UnknownUpgradePolicy:W.struct("UnknownUpgradePolicy",{policy:W.u8()}),PackageIDDoesNotMatch:W.struct("PackageIDDoesNotMatch",{packageId:Qt,ticketId:Qt})}),AE=W.struct("ModuleId",{address:Qt,name:W.string()}),rm=W.struct("MoveLocation",{module:AE,function:W.u16(),instruction:W.u16(),functionName:W.option(W.string())}),OE=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}),IE=W.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),PE=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:Qt}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:W.option(rm),MoveAbort:W.tuple([rm,W.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:W.struct("CommandArgumentError",{argIdx:W.u16(),kind:OE}),TypeArgumentError:W.struct("TypeArgumentError",{argumentIdx:W.u16(),kind:IE}),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(Qt)}),AddressDeniedForCoin:W.struct("AddressDeniedForCoin",{address:Qt,coinType:W.string()}),CoinTypeGlobalPause:W.struct("CoinTypeGlobalPause",{coinType:W.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),W1=W.enum("ExecutionStatus",{Success:null,Failed:W.struct("ExecutionFailed",{error:PE,command:W.option(W.u64())})}),G1=W.struct("GasCostSummary",{computationCost:W.u64(),storageCost:W.u64(),storageRebate:W.u64(),nonRefundableStorageFee:W.u64()}),bo=W.enum("Owner",{AddressOwner:Qt,ObjectOwner:Qt,Shared:W.struct("Shared",{initialSharedVersion:W.u64()}),Immutable:null}),jE=W.struct("TransactionEffectsV1",{status:W1,executedEpoch:W.u64(),gasUsed:G1,modifiedAtVersions:W.vector(W.tuple([Qt,W.u64()])),sharedObjects:W.vector(Qr),transactionDigest:En,created:W.vector(W.tuple([Qr,bo])),mutated:W.vector(W.tuple([Qr,bo])),unwrapped:W.vector(W.tuple([Qr,bo])),deleted:W.vector(Qr),unwrappedThenDeleted:W.vector(Qr),wrapped:W.vector(Qr),gasObject:W.tuple([Qr,bo]),eventsDigest:W.option(En),dependencies:W.vector(En)}),Nh=W.tuple([W.u64(),En]),kE=W.enum("ObjectIn",{NotExist:null,Exist:W.tuple([Nh,bo])}),RE=W.enum("ObjectOut",{NotExist:null,ObjectWrite:W.tuple([En,bo]),PackageWrite:Nh}),NE=W.enum("IDOperation",{None:null,Created:null,Deleted:null}),DE=W.struct("EffectsObjectChange",{inputState:kE,outputState:RE,idOperation:NE}),$E=W.enum("UnchangedSharedKind",{ReadOnlyRoot:Nh,MutateDeleted:W.u64(),ReadDeleted:W.u64(),Cancelled:W.u64(),PerEpochConfig:null}),BE=W.struct("TransactionEffectsV2",{status:W1,executedEpoch:W.u64(),gasUsed:G1,transactionDigest:En,gasObjectIndex:W.option(W.u32()),eventsDigest:W.option(En),dependencies:W.vector(En),lamportVersion:W.u64(),changedObjects:W.vector(W.tuple([Qt,DE])),unchangedSharedObjects:W.vector(W.tuple([Qt,$E])),auxDataDigest:W.option(En)}),LE=W.enum("TransactionEffects",{V1:jE,V2:BE}),mf={...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:Qt,AppId:$1,Argument:zn,CallArg:C1,CompressedSignature:F1,GasData:j1,Intent:B1,IntentMessage:L1,IntentScope:N1,IntentVersion:D1,MultiSig:SE,MultiSigPkMap:z1,MultiSigPublicKey:V1,ObjectArg:E1,ObjectDigest:En,ProgrammableMoveCall:M1,ProgrammableTransaction:A1,PublicKey:U1,SenderSignedData:CE,SenderSignedTransaction:q1,SharedObjectRef:S1,StructTag:P1,SuiObjectRef:Qr,Command:T1,TransactionData:R1,TransactionDataV1:k1,TransactionExpiration:I1,TransactionKind:O1,TypeTag:Rh,TransactionEffects:LE,PasskeyAuthenticator:ME},H1="…";function FE(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${H1}${e.slice(-4)}`}function UE(e){return`${e.slice(0,10)}${H1}`}const K1=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,J1=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,zE=235;function X1(e){return e.length>zE?!1:e.includes("@")?K1.test(e):J1.test(e)}function Y1(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!K1.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!J1.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 VE=9,qE=BigInt(1e9),WE="0x1",Z1="0x2",GE="0x3",HE=Ci("0x6"),KE="sui_system",Dh=`${Z1}::sui::SUI`,JE=Ci("0x5"),XE=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,YE=/^\d+$/,ZE=64,Q1="/",ey=e=>{const t=e.split(Q1);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!YE.test(i)||!X1(r)?!1:XE.test(n)&&n.length<ZE},QE=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(Q1)&&!ey(r))return!1;return!0};function gf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function eC(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ty(e,...t){if(!eC(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 nm(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 tC(e,t){ty(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 xu=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),As=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),ry=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,vi=As?e=>e:e=>ry(e);function ro(e){for(let t=0;t<e.length;t++)e[t]=ry(e[t])}function rC(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Ra(e){return typeof e=="string"&&(e=rC(e)),ty(e),e}let nC=class{clone(){return this._cloneInto()}};function iC(e){const t=(n,i)=>e(i).update(Ra(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const sC=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 oC extends nC{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,gf(t),gf(r),gf(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=xu(this.buffer)}update(t){nm(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=Ra(t);const s=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<s;){this.pos===r&&(As||ro(i),this.compress(i,0,!1),As||ro(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));As||ro(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);As||ro(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){nm(this),tC(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),As||ro(n),this.compress(n,0,!0),As||ro(n);const i=xu(t);this.get().forEach((s,o)=>i[o]=vi(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 jc=BigInt(2**32-1),xd=BigInt(32);function ny(e,t=!1){return t?{h:Number(e&jc),l:Number(e>>xd&jc)}:{h:Number(e>>xd&jc)|0,l:Number(e&jc)|0}}function aC(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}=ny(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const cC=(e,t)=>BigInt(e>>>0)<<xd|BigInt(t>>>0),uC=(e,t,r)=>e>>>r,lC=(e,t,r)=>e<<32-r|t>>>r,fC=(e,t,r)=>e>>>r|t<<32-r,dC=(e,t,r)=>e<<32-r|t>>>r,hC=(e,t,r)=>e<<64-r|t>>>r-32,pC=(e,t,r)=>e>>>r-32|t<<64-r,mC=(e,t)=>t,gC=(e,t)=>e,vC=(e,t,r)=>e<<r|t>>>32-r,yC=(e,t,r)=>t<<r|e>>>32-r,bC=(e,t,r)=>t<<r-32|e>>>64-r,wC=(e,t,r)=>e<<r-32|t>>>64-r;function _C(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const xC=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),SC=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,EC=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),CC=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,MC=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),TC=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0,AC={fromBig:ny,split:aC,toBig:cC,shrSH:uC,shrSL:lC,rotrSH:fC,rotrSL:dC,rotrBH:hC,rotrBL:pC,rotr32H:mC,rotr32L:gC,rotlSH:vC,rotlSL:yC,rotlBH:bC,rotlBL:wC,add:_C,add3L:xC,add3H:SC,add4L:EC,add4H:CC,add5H:TC,add5L:MC},Pr=AC,lr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Pe=new Uint32Array(32);function Ui(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],A=Pr.add3L(c,l,o);u=Pr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Pr.rotr32H(w,b),Dl:Pr.rotr32L(w,b)},{h:y,l:h}=Pr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Pr.rotrSH(f,l,24),Bl:Pr.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 zi(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],A=Pr.add3L(c,l,o);u=Pr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Pr.rotrSH(w,b,16),Dl:Pr.rotrSL(w,b,16)},{h:y,l:h}=Pr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Pr.rotrBH(f,l,63),Bl:Pr.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 iy extends oC{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=lr[0]|0,this.v0h=lr[1]|0,this.v1l=lr[2]|0,this.v1h=lr[3]|0,this.v2l=lr[4]|0,this.v2h=lr[5]|0,this.v3l=lr[6]|0,this.v3h=lr[7]|0,this.v4l=lr[8]|0,this.v4h=lr[9]|0,this.v5l=lr[10]|0,this.v5h=lr[11]|0,this.v6l=lr[12]|0,this.v6h=lr[13]|0,this.v7l=lr[14]|0,this.v7h=lr[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=xu(Ra(t.salt));this.v4l^=vi(n[0]),this.v4h^=vi(n[1]),this.v5l^=vi(n[2]),this.v5h^=vi(n[3])}if(t.personalization){const n=xu(Ra(t.personalization));this.v6l^=vi(n[0]),this.v6h^=vi(n[1]),this.v7l^=vi(n[2]),this.v7h^=vi(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(Ra(t.key)),this.update(n)}}get(){let{v0l:t,v0h:r,v1l:n,v1h:i,v2l:s,v2h:o,v3l:a,v3h:c,v4l:u,v4h:l,v5l:f,v5h:h,v6l:y,v6h:b,v7l:w,v7h:A}=this;return[t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,A]}set(t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,A){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=A|0}compress(t,r,n){this.get().forEach((c,u)=>Pe[u]=c),Pe.set(lr,16);let{h:i,l:s}=Pr.fromBig(BigInt(this.length));Pe[24]=lr[8]^s,Pe[25]=lr[9]^i,n&&(Pe[28]=~Pe[28],Pe[29]=~Pe[29]);let o=0;const a=sC;for(let c=0;c<12;c++)Ui(0,4,8,12,t,r+2*a[o++]),zi(0,4,8,12,t,r+2*a[o++]),Ui(1,5,9,13,t,r+2*a[o++]),zi(1,5,9,13,t,r+2*a[o++]),Ui(2,6,10,14,t,r+2*a[o++]),zi(2,6,10,14,t,r+2*a[o++]),Ui(3,7,11,15,t,r+2*a[o++]),zi(3,7,11,15,t,r+2*a[o++]),Ui(0,5,10,15,t,r+2*a[o++]),zi(0,5,10,15,t,r+2*a[o++]),Ui(1,6,11,12,t,r+2*a[o++]),zi(1,6,11,12,t,r+2*a[o++]),Ui(2,7,8,13,t,r+2*a[o++]),zi(2,7,8,13,t,r+2*a[o++]),Ui(3,4,9,14,t,r+2*a[o++]),zi(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 sy=iC(e=>new iy(e)),OC=Object.freeze(Object.defineProperty({__proto__:null,BLAKE2b:iy,blake2b:sy},Symbol.toStringTag,{value:"Module"}));function IC(e,t,r){const n=mf.Address.serialize(e).toBytes(),i=mf.TypeTag.serialize(t).toBytes(),s=mf.u64().serialize(r.length).toBytes(),o=sy.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${ji(o.digest().slice(0,32))}`}const PC=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:qE,MOVE_STDLIB_ADDRESS:WE,SUI_ADDRESS_LENGTH:sl,SUI_CLOCK_OBJECT_ID:HE,SUI_DECIMALS:VE,SUI_FRAMEWORK_ADDRESS:Z1,SUI_SYSTEM_ADDRESS:GE,SUI_SYSTEM_MODULE_NAME:KE,SUI_SYSTEM_STATE_OBJECT_ID:JE,SUI_TYPE_ARG:Dh,deriveDynamicFieldID:IC,formatAddress:FE,formatDigest:UE,fromB64:f1,fromBase58:Pi,fromBase64:Pn,fromHEX:h1,fromHex:Wo,isValidNamedPackage:ey,isValidNamedType:QE,isValidSuiAddress:wi,isValidSuiNSName:X1,isValidSuiObjectId:Ta,isValidTransactionDigest:_d,normalizeStructTag:x1,normalizeSuiAddress:$r,normalizeSuiNSName:Y1,normalizeSuiObjectId:Ci,parseStructTag:jh,toB64:l1,toBase58:qo,toBase64:Wr,toHEX:d1,toHex:ji},Symbol.toStringTag,{value:"Module"}));var $h=Object.defineProperty,jC=Object.getOwnPropertyDescriptor,kC=Object.getOwnPropertyNames,RC=Object.prototype.hasOwnProperty,NC=(e,t)=>{for(var r in t)$h(e,r,{get:t[r],enumerable:!0})},DC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kC(t))!RC.call(e,i)&&i!==r&&$h(e,i,{get:()=>t[i],enumerable:!(n=jC(t,i))||n.enumerable});return e},$C=e=>DC($h({},"__esModule",{value:!0}),e),oy={};NC(oy,{BIC_REGEX:()=>cy,CUID2_REGEX:()=>uy,DECIMAL_REGEX:()=>ly,EMAIL_REGEX:()=>fy,EMOJI_REGEX:()=>dy,HEXADECIMAL_REGEX:()=>hy,HEX_COLOR_REGEX:()=>py,IMEI_REGEX:()=>my,IPV4_REGEX:()=>gy,IPV6_REGEX:()=>vy,IP_REGEX:()=>yy,ISO_DATE_REGEX:()=>by,ISO_DATE_TIME_REGEX:()=>wy,ISO_TIMESTAMP_REGEX:()=>Sy,ISO_TIME_REGEX:()=>_y,ISO_TIME_SECOND_REGEX:()=>xy,ISO_WEEK_REGEX:()=>Ey,MAC48_REGEX:()=>Cy,MAC64_REGEX:()=>My,MAC_REGEX:()=>Ty,OCTAL_REGEX:()=>Ay,ULID_REGEX:()=>Oy,UUID_REGEX:()=>Iy,ValiError:()=>ol,_addIssue:()=>le,_isLuhnAlgo:()=>Bh,_isValidObjectKey:()=>Xs,_stringify:()=>Nr,any:()=>lw,array:()=>fw,arrayAsync:()=>dw,awaitAsync:()=>ay,bic:()=>Ny,bigint:()=>hw,blob:()=>pw,boolean:()=>mw,brand:()=>Dy,bytes:()=>$y,check:()=>By,checkAsync:()=>Ly,checkItems:()=>Fy,config:()=>tM,creditCard:()=>Uy,cuid2:()=>zy,custom:()=>gw,customAsync:()=>vw,date:()=>yw,decimal:()=>Vy,deleteGlobalConfig:()=>LC,deleteGlobalMessage:()=>UC,deleteSchemaMessage:()=>VC,deleteSpecificMessage:()=>WC,email:()=>qy,emoji:()=>Wy,empty:()=>Gy,endsWith:()=>Hy,entriesFromList:()=>HC,enum:()=>Td,enum_:()=>Td,everyItem:()=>Ky,excludes:()=>Jy,fallback:()=>rM,fallbackAsync:()=>nM,file:()=>bw,filterItems:()=>Xy,findItem:()=>Yy,finite:()=>Zy,flatten:()=>iM,forward:()=>sM,forwardAsync:()=>oM,function:()=>Ad,function_:()=>Ad,getDefault:()=>$i,getDefaults:()=>Sd,getDefaultsAsync:()=>Ed,getDotPath:()=>Ry,getFallback:()=>mc,getFallbacks:()=>Cd,getFallbacksAsync:()=>Md,getGlobalConfig:()=>pc,getGlobalMessage:()=>Py,getSchemaMessage:()=>jy,getSpecificMessage:()=>ky,hash:()=>Qy,hexColor:()=>tb,hexadecimal:()=>eb,imei:()=>rb,includes:()=>nb,instance:()=>ww,integer:()=>ib,intersect:()=>_w,intersectAsync:()=>xw,ip:()=>sb,ipv4:()=>ob,ipv6:()=>ab,is:()=>aM,isOfKind:()=>KC,isOfType:()=>JC,isValiError:()=>XC,isoDate:()=>cb,isoDateTime:()=>ub,isoTime:()=>lb,isoTimeSecond:()=>fb,isoTimestamp:()=>db,isoWeek:()=>hb,keyof:()=>cM,lazy:()=>Sw,lazyAsync:()=>Ew,length:()=>pb,literal:()=>Cw,looseObject:()=>Mw,looseObjectAsync:()=>Tw,looseTuple:()=>Aw,looseTupleAsync:()=>Ow,mac:()=>mb,mac48:()=>gb,mac64:()=>vb,map:()=>Iw,mapAsync:()=>Pw,mapItems:()=>yb,maxBytes:()=>bb,maxLength:()=>wb,maxSize:()=>_b,maxValue:()=>xb,mimeType:()=>Sb,minBytes:()=>Eb,minLength:()=>Cb,minSize:()=>Mb,minValue:()=>Tb,multipleOf:()=>Ab,nan:()=>jw,never:()=>kw,nonEmpty:()=>Ob,nonNullable:()=>Rw,nonNullableAsync:()=>Nw,nonNullish:()=>Dw,nonNullishAsync:()=>$w,nonOptional:()=>Lh,nonOptionalAsync:()=>Fh,normalize:()=>Ib,notBytes:()=>Pb,notLength:()=>jb,notSize:()=>kb,notValue:()=>Rb,null:()=>Od,null_:()=>Od,nullable:()=>Bw,nullableAsync:()=>Lw,nullish:()=>Fw,nullishAsync:()=>Uw,number:()=>zw,object:()=>Vw,objectAsync:()=>qw,objectWithRest:()=>Ww,objectWithRestAsync:()=>Gw,octal:()=>Nb,omit:()=>uM,optional:()=>Uh,optionalAsync:()=>zh,parse:()=>h2,parseAsync:()=>p2,parser:()=>lM,parserAsync:()=>fM,partial:()=>dM,partialAsync:()=>hM,partialCheck:()=>$b,partialCheckAsync:()=>Bb,pick:()=>pM,picklist:()=>Vh,pipe:()=>mM,pipeAsync:()=>gM,promise:()=>Hw,rawCheck:()=>Lb,rawCheckAsync:()=>Fb,rawTransform:()=>Ub,rawTransformAsync:()=>zb,readonly:()=>Vb,record:()=>Kw,recordAsync:()=>Jw,reduceItems:()=>qb,regex:()=>Wb,required:()=>vM,requiredAsync:()=>yM,safeInteger:()=>Gb,safeParse:()=>m2,safeParseAsync:()=>g2,safeParser:()=>bM,safeParserAsync:()=>wM,set:()=>Xw,setAsync:()=>Yw,setGlobalConfig:()=>BC,setGlobalMessage:()=>FC,setSchemaMessage:()=>zC,setSpecificMessage:()=>qC,size:()=>Hb,someItem:()=>Kb,sortItems:()=>Jb,startsWith:()=>Xb,strictObject:()=>Zw,strictObjectAsync:()=>Qw,strictTuple:()=>e2,strictTupleAsync:()=>t2,string:()=>r2,symbol:()=>n2,toLowerCase:()=>Yb,toMaxValue:()=>Zb,toMinValue:()=>Qb,toUpperCase:()=>ew,transform:()=>tw,transformAsync:()=>rw,trim:()=>nw,trimEnd:()=>iw,trimStart:()=>sw,tuple:()=>i2,tupleAsync:()=>s2,tupleWithRest:()=>o2,tupleWithRestAsync:()=>a2,ulid:()=>ow,undefined:()=>Id,undefined_:()=>Id,union:()=>c2,unionAsync:()=>u2,unknown:()=>l2,unwrap:()=>_M,url:()=>aw,uuid:()=>cw,value:()=>uw,variant:()=>f2,variantAsync:()=>d2,void:()=>Pd,void_:()=>Pd});var ps=$C(oy);function ay(){return{kind:"transformation",type:"await",reference:ay,async:!0,async _run(e){return e.value=await e.value,e}}}var cy=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,uy=/^[a-z][\da-z]*$/u,ly=/^\d+$/u,fy=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,dy=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,hy=/^(?:0h|0x)?[\da-f]+$/iu,py=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,my=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,gy=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,vy=/^(?:(?:[\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,yy=/^(?:(?:[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,by=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,wy=/^\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,_y=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,xy=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,Sy=/^\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,Ey=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,Cy=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,My=/^(?:[\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,Ty=/^(?:[\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,Ay=/^(?:0o)?[0-7]+$/iu,Oy=/^[\da-hjkmnp-tv-z]{26}$/iu,Iy=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,Zr;function BC(e){Zr={...Zr,...e}}function pc(e){return{lang:(e==null?void 0:e.lang)??(Zr==null?void 0:Zr.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(Zr==null?void 0:Zr.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(Zr==null?void 0:Zr.abortPipeEarly)}}function LC(){Zr=void 0}var Ai;function FC(e,t){Ai||(Ai=new Map),Ai.set(t,e)}function Py(e){return Ai==null?void 0:Ai.get(e)}function UC(e){Ai==null||Ai.delete(e)}var Oi;function zC(e,t){Oi||(Oi=new Map),Oi.set(t,e)}function jy(e){return Oi==null?void 0:Oi.get(e)}function VC(e){Oi==null||Oi.delete(e)}var Sn;function qC(e,t,r){Sn||(Sn=new Map),Sn.get(e)||Sn.set(e,new Map),Sn.get(e).set(r,t)}function ky(e,t){var r;return(r=Sn==null?void 0:Sn.get(e))==null?void 0:r.get(t)}function WC(e,t){var r;(r=Sn==null?void 0:Sn.get(e))==null||r.delete(t)}function Nr(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)??Nr(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??ky(e.reference,c.lang)??(u?jy(c.lang):null)??n.message??Py(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 GC=/\D/gu;function Bh(e){const t=e.replace(GC,"");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 Xs(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function HC(e,t){const r={};for(const n of e)r[n]=t;return r}function Ry(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 KC(e,t){return t.kind===e}function JC(e,t){return t.type===e}function XC(e){return e instanceof ol}var ol=class extends Error{constructor(t){super(t[0].message);vt(this,"issues");this.name="ValiError",this.issues=t}};function Ny(e){return{kind:"validation",type:"bic",reference:Ny,async:!1,expects:null,requirement:cy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"BIC",t,r),t}}}function Dy(e){return{kind:"transformation",type:"brand",reference:Dy,async:!1,name:e,_run(t){return t}}}function $y(e,t){return{kind:"validation",type:"bytes",reference:$y,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 By(e,t){return{kind:"validation",type:"check",reference:By,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 Ly(e,t){return{kind:"validation",type:"check",reference:Ly,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 Fy(e,t){return{kind:"validation",type:"check_items",reference:Fy,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 YC=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,ZC=/[- ]/gu,QC=[/^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 Uy(e){return{kind:"validation",type:"credit_card",reference:Uy,async:!1,expects:null,requirement(t){let r;return YC.test(t)&&(r=t.replace(ZC,""))&&QC.some(n=>n.test(r))&&Bh(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"credit card",t,r),t}}}function zy(e){return{kind:"validation",type:"cuid2",reference:zy,async:!1,expects:null,requirement:uy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"Cuid2",t,r),t}}}function Vy(e){return{kind:"validation",type:"decimal",reference:Vy,async:!1,expects:null,requirement:ly,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"decimal",t,r),t}}}function qy(e){return{kind:"validation",type:"email",reference:qy,expects:null,async:!1,requirement:fy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"email",t,r),t}}}function Wy(e){return{kind:"validation",type:"emoji",reference:Wy,async:!1,expects:null,requirement:dy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"emoji",t,r),t}}}function Gy(e){return{kind:"validation",type:"empty",reference:Gy,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 Hy(e,t){return{kind:"validation",type:"ends_with",reference:Hy,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 Ky(e,t){return{kind:"validation",type:"every_item",reference:Ky,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 Jy(e,t){const r=Nr(e);return{kind:"validation",type:"excludes",reference:Jy,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 Xy(e){return{kind:"transformation",type:"filter_items",reference:Xy,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function Yy(e){return{kind:"transformation",type:"find_item",reference:Yy,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function Zy(e){return{kind:"validation",type:"finite",reference:Zy,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 eM={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 Qy(e,t){return{kind:"validation",type:"hash",reference:Qy,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${eM[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"hash",r,n),r}}}function eb(e){return{kind:"validation",type:"hexadecimal",reference:eb,async:!1,expects:null,requirement:hy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hexadecimal",t,r),t}}}function tb(e){return{kind:"validation",type:"hex_color",reference:tb,async:!1,expects:null,requirement:py,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hex color",t,r),t}}}function rb(e){return{kind:"validation",type:"imei",reference:rb,async:!1,expects:null,requirement(t){return my.test(t)&&Bh(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"IMEI",t,r),t}}}function nb(e,t){const r=Nr(e);return{kind:"validation",type:"includes",reference:nb,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 ib(e){return{kind:"validation",type:"integer",reference:ib,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 sb(e){return{kind:"validation",type:"ip",reference:sb,async:!1,expects:null,requirement:yy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IP",t,r),t}}}function ob(e){return{kind:"validation",type:"ipv4",reference:ob,async:!1,expects:null,requirement:gy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv4",t,r),t}}}function ab(e){return{kind:"validation",type:"ipv6",reference:ab,async:!1,expects:null,requirement:vy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv6",t,r),t}}}function cb(e){return{kind:"validation",type:"iso_date",reference:cb,async:!1,expects:null,requirement:by,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date",t,r),t}}}function ub(e){return{kind:"validation",type:"iso_date_time",reference:ub,async:!1,expects:null,requirement:wy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date-time",t,r),t}}}function lb(e){return{kind:"validation",type:"iso_time",reference:lb,async:!1,expects:null,requirement:_y,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time",t,r),t}}}function fb(e){return{kind:"validation",type:"iso_time_second",reference:fb,async:!1,expects:null,requirement:xy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time-second",t,r),t}}}function db(e){return{kind:"validation",type:"iso_timestamp",reference:db,async:!1,expects:null,requirement:Sy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"timestamp",t,r),t}}}function hb(e){return{kind:"validation",type:"iso_week",reference:hb,async:!1,expects:null,requirement:Ey,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"week",t,r),t}}}function pb(e,t){return{kind:"validation",type:"length",reference:pb,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 mb(e){return{kind:"validation",type:"mac",reference:mb,async:!1,expects:null,requirement:Ty,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"MAC",t,r),t}}}function gb(e){return{kind:"validation",type:"mac48",reference:gb,async:!1,expects:null,requirement:Cy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"48-bit MAC",t,r),t}}}function vb(e){return{kind:"validation",type:"mac64",reference:vb,async:!1,expects:null,requirement:My,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"64-bit MAC",t,r),t}}}function yb(e){return{kind:"transformation",type:"map_items",reference:yb,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function bb(e,t){return{kind:"validation",type:"max_bytes",reference:bb,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 wb(e,t){return{kind:"validation",type:"max_length",reference:wb,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 _b(e,t){return{kind:"validation",type:"max_size",reference:_b,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 xb(e,t){return{kind:"validation",type:"max_value",reference:xb,async:!1,expects:`<=${e instanceof Date?e.toJSON():Nr(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():Nr(r.value)}),r}}}function Sb(e,t){return{kind:"validation",type:"mime_type",reference:Sb,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 Eb(e,t){return{kind:"validation",type:"min_bytes",reference:Eb,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 Cb(e,t){return{kind:"validation",type:"min_length",reference:Cb,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 Mb(e,t){return{kind:"validation",type:"min_size",reference:Mb,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 Tb(e,t){return{kind:"validation",type:"min_value",reference:Tb,async:!1,expects:`>=${e instanceof Date?e.toJSON():Nr(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():Nr(r.value)}),r}}}function Ab(e,t){return{kind:"validation",type:"multiple_of",reference:Ab,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 Ob(e){return{kind:"validation",type:"non_empty",reference:Ob,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 Ib(e){return{kind:"transformation",type:"normalize",reference:Ib,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function Pb(e,t){return{kind:"validation",type:"not_bytes",reference:Pb,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 jb(e,t){return{kind:"validation",type:"not_length",reference:jb,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 kb(e,t){return{kind:"validation",type:"not_size",reference:kb,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 Rb(e,t){return{kind:"validation",type:"not_value",reference:Rb,async:!1,expects:e instanceof Date?`!${e.toJSON()}`:`!${Nr(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():Nr(r.value)}),r}}}function Nb(e){return{kind:"validation",type:"octal",reference:Nb,async:!1,expects:null,requirement:Ay,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"octal",t,r),t}}}function Db(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 $b(e,t,r){return{kind:"validation",type:"partial_check",reference:$b,async:!1,expects:null,requirement:t,message:r,_run(n,i){return Db(n,e)&&!this.requirement(n.value)&&le(this,"input",n,i),n}}}function Bb(e,t,r){return{kind:"validation",type:"partial_check",reference:Bb,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return Db(n,e)&&!await this.requirement(n.value)&&le(this,"input",n,i),n}}}function Lb(e){return{kind:"validation",type:"raw_check",reference:Lb,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 Fb(e){return{kind:"validation",type:"raw_check",reference:Fb,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 Ub(e){return{kind:"transformation",type:"raw_transform",reference:Ub,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 zb(e){return{kind:"transformation",type:"raw_transform",reference:zb,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 Vb(){return{kind:"transformation",type:"readonly",reference:Vb,async:!1,_run(e){return e}}}function qb(e,t){return{kind:"transformation",type:"reduce_items",reference:qb,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function Wb(e,t){return{kind:"validation",type:"regex",reference:Wb,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 Gb(e){return{kind:"validation",type:"safe_integer",reference:Gb,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 Hb(e,t){return{kind:"validation",type:"size",reference:Hb,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 Kb(e,t){return{kind:"validation",type:"some_item",reference:Kb,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 Jb(e){return{kind:"transformation",type:"sort_items",reference:Jb,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function Xb(e,t){return{kind:"validation",type:"starts_with",reference:Xb,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 Yb(){return{kind:"transformation",type:"to_lower_case",reference:Yb,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function Zb(e){return{kind:"transformation",type:"to_max_value",reference:Zb,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function Qb(e){return{kind:"transformation",type:"to_min_value",reference:Qb,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function ew(){return{kind:"transformation",type:"to_upper_case",reference:ew,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function tw(e){return{kind:"transformation",type:"transform",reference:tw,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function rw(e){return{kind:"transformation",type:"transform",reference:rw,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function nw(){return{kind:"transformation",type:"trim",reference:nw,async:!1,_run(e){return e.value=e.value.trim(),e}}}function iw(){return{kind:"transformation",type:"trim_end",reference:iw,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function sw(){return{kind:"transformation",type:"trim_start",reference:sw,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function ow(e){return{kind:"validation",type:"ulid",reference:ow,async:!1,expects:null,requirement:Oy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"ULID",t,r),t}}}function aw(e){return{kind:"validation",type:"url",reference:aw,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 cw(e){return{kind:"validation",type:"uuid",reference:cw,async:!1,expects:null,requirement:Iy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"UUID",t,r),t}}}function uw(e,t){return{kind:"validation",type:"value",reference:uw,async:!1,expects:e instanceof Date?e.toJSON():Nr(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():Nr(r.value)}),r}}}function tM(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function mc(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function rM(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:mc(this,r,n)}:r}}}function nM(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await mc(this,r,n)}:r}}}function iM(e){const t={};for(const r of e)if(r.path){const n=Ry(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 sM(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 oM(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 $i(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function Sd(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=Sd(e.entries[r]);return t}return"items"in e?e.items.map(Sd):$i(e)}async function Ed(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Ed(r)]))):"items"in e?Promise.all(e.items.map(Ed)):$i(e)}function Cd(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=Cd(e.entries[r]);return t}return"items"in e?e.items.map(Cd):mc(e)}async function Md(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Md(r)]))):"items"in e?Promise.all(e.items.map(Md)):mc(e)}function aM(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function lw(){return{kind:"schema",type:"any",reference:lw,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function fw(e,t){return{kind:"schema",type:"array",reference:fw,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 dw(e,t){return{kind:"schema",type:"array",reference:dw,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 hw(e){return{kind:"schema",type:"bigint",reference:hw,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:le(this,"type",t,r),t}}}function pw(e){return{kind:"schema",type:"blob",reference:pw,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:le(this,"type",t,r),t}}}function mw(e){return{kind:"schema",type:"boolean",reference:mw,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:le(this,"type",t,r),t}}}function gw(e,t){return{kind:"schema",type:"custom",reference:gw,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 vw(e,t){return{kind:"schema",type:"custom",reference:vw,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 yw(e){return{kind:"schema",type:"date",reference:yw,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 Td(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:Td,expects:r.map(Nr).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 bw(e){return{kind:"schema",type:"file",reference:bw,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:le(this,"type",t,r),t}}}function Ad(e){return{kind:"schema",type:"function",reference:Ad,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:le(this,"type",t,r),t}}}function ww(e,t){return{kind:"schema",type:"instance",reference:ww,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 Su(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=Su(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=Su(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function _w(e,t){return{kind:"schema",type:"intersect",reference:_w,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=Su(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 xw(e,t){return{kind:"schema",type:"intersect",reference:xw,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=Su(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 Sw(e){return{kind:"schema",type:"lazy",reference:Sw,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function Ew(e){return{kind:"schema",type:"lazy",reference:Ew,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function Cw(e,t){return{kind:"schema",type:"literal",reference:Cw,expects:Nr(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 Mw(e,t){return{kind:"schema",type:"loose_object",reference:Mw,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)Xs(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else le(this,"type",r,n);return r}}}function Tw(e,t){return{kind:"schema",type:"loose_object",reference:Tw,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)Xs(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else le(this,"type",r,n);return r}}}function Aw(e,t){return{kind:"schema",type:"loose_tuple",reference:Aw,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 Ow(e,t){return{kind:"schema",type:"loose_tuple",reference:Ow,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 Iw(e,t,r){return{kind:"schema",type:"map",reference:Iw,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 Pw(e,t,r){return{kind:"schema",type:"map",reference:Pw,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 jw(e){return{kind:"schema",type:"nan",reference:jw,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function kw(e){return{kind:"schema",type:"never",reference:kw,expects:"never",async:!1,message:e,_run(t,r){return le(this,"type",t,r),t}}}function Rw(e,t){return{kind:"schema",type:"non_nullable",reference:Rw,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 Nw(e,t){return{kind:"schema",type:"non_nullable",reference:Nw,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 Dw(e,t){return{kind:"schema",type:"non_nullish",reference:Dw,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 $w(e,t){return{kind:"schema",type:"non_nullish",reference:$w,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 Lh(e,t){return{kind:"schema",type:"non_optional",reference:Lh,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 Fh(e,t){return{kind:"schema",type:"non_optional",reference:Fh,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 Od(e){return{kind:"schema",type:"null",reference:Od,expects:"null",async:!1,message:e,_run(t,r){return t.value===null?t.typed=!0:le(this,"type",t,r),t}}}function Bw(e,...t){const r={kind:"schema",type:"nullable",reference:Bw,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=$i(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 Lw(e,...t){const r={kind:"schema",type:"nullable",reference:Lw,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await $i(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 Fw(e,...t){const r={kind:"schema",type:"nullish",reference:Fw,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=$i(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 Uw(e,...t){const r={kind:"schema",type:"nullish",reference:Uw,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 $i(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 zw(e){return{kind:"schema",type:"number",reference:zw,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 Vw(e,t){return{kind:"schema",type:"object",reference:Vw,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 qw(e,t){return{kind:"schema",type:"object",reference:qw,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 Ww(e,t,r){return{kind:"schema",type:"object_with_rest",reference:Ww,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(Xs(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 Gw(e,t,r){return{kind:"schema",type:"object_with_rest",reference:Gw,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])=>Xs(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 Uh(e,...t){const r={kind:"schema",type:"optional",reference:Uh,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=$i(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 zh(e,...t){const r={kind:"schema",type:"optional",reference:zh,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await $i(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 Vh(e,t){return{kind:"schema",type:"picklist",reference:Vh,expects:e.map(Nr).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 Hw(e){return{kind:"schema",type:"promise",reference:Hw,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:le(this,"type",t,r),t}}}function Kw(e,t,r){return{kind:"schema",type:"record",reference:Kw,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(Xs(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 Jw(e,t,r){return{kind:"schema",type:"record",reference:Jw,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])=>Xs(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 Xw(e,t){return{kind:"schema",type:"set",reference:Xw,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 Yw(e,t){return{kind:"schema",type:"set",reference:Yw,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 Zw(e,t){return{kind:"schema",type:"strict_object",reference:Zw,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 Qw(e,t){return{kind:"schema",type:"strict_object",reference:Qw,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 e2(e,t){return{kind:"schema",type:"strict_tuple",reference:e2,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 t2(e,t){return{kind:"schema",type:"strict_tuple",reference:t2,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 r2(e){return{kind:"schema",type:"string",reference:r2,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:le(this,"type",t,r),t}}}function n2(e){return{kind:"schema",type:"symbol",reference:n2,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:le(this,"type",t,r),t}}}function i2(e,t){return{kind:"schema",type:"tuple",reference:i2,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 s2(e,t){return{kind:"schema",type:"tuple",reference:s2,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 o2(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:o2,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 a2(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:a2,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 Id(e){return{kind:"schema",type:"undefined",reference:Id,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function Eu(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function c2(e,t){return{kind:"schema",type:"union",reference:c2,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:Eu(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Eu(o)})}return r}}}function u2(e,t){return{kind:"schema",type:"union",reference:u2,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:Eu(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Eu(o)})}return r}}}function l2(){return{kind:"schema",type:"unknown",reference:l2,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function qh(e,t,r=new Set){for(const n of t)n.type==="variant"?qh(e,n.options,r):r.add(n.entries[e].expects);return r}function f2(e,t,r){let n;return{kind:"schema",type:"variant",reference:f2,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=[...qh(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 d2(e,t,r){let n;return{kind:"schema",type:"variant",reference:d2,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=[...qh(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 Pd(e){return{kind:"schema",type:"void",reference:Pd,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function cM(e,t){return Vh(Object.keys(e.entries),t)}function uM(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function h2(e,t,r){const n=e._run({typed:!1,value:t},pc(r));if(n.issues)throw new ol(n.issues);return n.value}async function p2(e,t,r){const n=await e._run({typed:!1,value:t},pc(r));if(n.issues)throw new ol(n.issues);return n.value}function lM(e,t){const r=n=>h2(e,n,t);return r.schema=e,r.config=t,r}function fM(e,t){const r=n=>p2(e,n,t);return r.schema=e,r.config=t,r}function dM(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Uh(e.entries[n]):e.entries[n];return{...e,entries:r}}function hM(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?zh(e.entries[n]):e.entries[n];return{...e,entries:r}}function pM(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function mM(...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 gM(...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 vM(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)?Lh(e.entries[o],i):e.entries[o];return{...e,entries:s}}function yM(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)?Fh(e.entries[o],i):e.entries[o];return{...e,entries:s}}function m2(e,t,r){const n=e._run({typed:!1,value:t},pc(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function g2(e,t,r){const n=await e._run({typed:!1,value:t},pc(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function bM(e,t){const r=n=>m2(e,n,t);return r.schema=e,r.config=t,r}function wM(e,t){const r=n=>g2(e,n,t);return r.schema=e,r.config=t,r}function _M(e){return e.wrapped}const xM=Symbol.for("@mysten/transaction");function SM(e){return!!e&&typeof e=="object"&&e[xM]===!0}const v2=Symbol.for("@mysten/SuiClient");function EM(e){return typeof e=="object"&&e!==null&&e[v2]===!0}class Ga{get[v2](){return!0}constructor(t){this.transport=t.transport??new a1({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!wi($r(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||!wi($r(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||!wi($r(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||!wi($r(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||!wi($r(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||!Ta(Ci(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||!Ta(Ci(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(!_d(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(!_d(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:Wr(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||!wi($r(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||!Ta(Ci(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(SM(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=Wr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=Wr(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:Wr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!Ta(Ci(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=Pi(t.digest);return ji(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=>Y1(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 CM=Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:Th,SuiClient:Ga,SuiHTTPStatusError:e1,SuiHTTPTransport:a1,SuiHTTPTransportError:Mh,getFullnodeUrl:c1,isSuiClient:EM},Symbol.toStringTag,{value:"Module"})),MM=il(CM),y2=il(PC),Or=il(pE);var Wh=Object.defineProperty,TM=Object.getOwnPropertyDescriptor,AM=Object.getOwnPropertyNames,OM=Object.prototype.hasOwnProperty,IM=(e,t)=>{for(var r in t)Wh(e,r,{get:t[r],enumerable:!0})},PM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of AM(t))!OM.call(e,i)&&i!==r&&Wh(e,i,{get:()=>t[i],enumerable:!(n=TM(t,i))||n.enumerable});return e},jM=e=>PM(Wh({},"__esModule",{value:!0}),e),b2={};IM(b2,{SUI_ADDRESS_LENGTH:()=>Gh,isValidSuiAddress:()=>_2,isValidSuiObjectId:()=>NM,isValidTransactionDigest:()=>RM,normalizeStructTag:()=>x2,normalizeSuiAddress:()=>Kh,normalizeSuiObjectId:()=>$M,parseStructTag:()=>Hh});var Jr=jM(b2),w2=Or;const kM=32;function RM(e){try{return(0,w2.fromBase58)(e).length===kM}catch{return!1}}const Gh=32;function _2(e){return BM(e)&&LM(e)===Gh}function NM(e){return _2(e)}function DM(e){return e.includes("::")?Hh(e):e}function Hh(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,w2.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>DM(o.trim())):[];return{address:Kh(t),module:r,name:i,typeParams:s}}function x2(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Hh(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:x2(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Kh(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Gh*2,"0")}`}function $M(e,t=!1){return Kh(e,t)}function BM(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function LM(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var Jh=Object.defineProperty,FM=Object.getOwnPropertyDescriptor,UM=Object.getOwnPropertyNames,zM=Object.prototype.hasOwnProperty,VM=(e,t)=>{for(var r in t)Jh(e,r,{get:t[r],enumerable:!0})},qM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of UM(t))!zM.call(e,i)&&i!==r&&Jh(e,i,{get:()=>t[i],enumerable:!(n=FM(t,i))||n.enumerable});return e},WM=e=>qM(Jh({},"__esModule",{value:!0}),e),S2={};VM(S2,{TypeTagSerializer:()=>Rs});var E2=WM(S2),GM=Or,HM=Jr;const KM=/^vector<(.+)>$/,JM=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class Rs{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(KM);if(n)return{vector:Rs.parseFromStr(n[1],r)};const i=t.match(JM);if(i)return{struct:{address:r?(0,HM.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Rs.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,GM.splitGenericParameters)(t).map(n=>Rs.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<${Rs.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Rs.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var Xh=Object.defineProperty,XM=Object.getOwnPropertyDescriptor,YM=Object.getOwnPropertyNames,ZM=Object.prototype.hasOwnProperty,QM=(e,t)=>{for(var r in t)Xh(e,r,{get:t[r],enumerable:!0})},eT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YM(t))!ZM.call(e,i)&&i!==r&&Xh(e,i,{get:()=>t[i],enumerable:!(n=XM(t,i))||n.enumerable});return e},tT=e=>eT(Xh({},"__esModule",{value:!0}),e),C2={};QM(C2,{Address:()=>Jn,AppId:()=>z2,Argument:()=>Vn,CallArg:()=>I2,Command:()=>j2,CompressedSignature:()=>W2,GasData:()=>$2,Intent:()=>V2,IntentMessage:()=>q2,IntentScope:()=>F2,IntentVersion:()=>U2,MultiSig:()=>iT,MultiSigPkMap:()=>H2,MultiSigPublicKey:()=>K2,ObjectArg:()=>O2,ObjectDigest:()=>T2,PasskeyAuthenticator:()=>oT,ProgrammableMoveCall:()=>P2,ProgrammableTransaction:()=>k2,PublicKey:()=>G2,SenderSignedData:()=>sT,SenderSignedTransaction:()=>X2,SharedObjectRef:()=>A2,StructTag:()=>D2,SuiObjectRef:()=>Cu,TransactionData:()=>L2,TransactionDataV1:()=>B2,TransactionExpiration:()=>N2,TransactionKind:()=>R2,TypeTag:()=>Zh,base64String:()=>J2});var M2=tT(C2),de=Or,ha=Jr,im=E2;function rT(e){return de.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function nT(e){return de.bcs.enum("Option",{None:null,Some:e})}const Jn=de.bcs.bytes(ha.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,de.toHex)(e);if(!t||!(0,ha.isValidSuiAddress)((0,ha.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,de.fromHex)((0,ha.normalizeSuiAddress)(e)):e,output:e=>(0,ha.normalizeSuiAddress)((0,de.toHex)(e))}),T2=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")}}),Cu=de.bcs.struct("SuiObjectRef",{objectId:Jn,version:de.bcs.u64(),digest:T2}),A2=de.bcs.struct("SharedObjectRef",{objectId:Jn,initialSharedVersion:de.bcs.u64(),mutable:de.bcs.bool()}),O2=de.bcs.enum("ObjectArg",{ImmOrOwnedObject:Cu,SharedObject:A2,Receiving:Cu}),I2=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:O2}),Yh=de.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:de.bcs.lazy(()=>Yh),struct:de.bcs.lazy(()=>D2),u16:null,u32:null,u256:null}),Zh=Yh.transform({input:e=>typeof e=="string"?im.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>im.TypeTagSerializer.tagToString(e)}),Vn=de.bcs.enum("Argument",{GasCoin:null,Input:de.bcs.u16(),Result:de.bcs.u16(),NestedResult:de.bcs.tuple([de.bcs.u16(),de.bcs.u16()])}),P2=de.bcs.struct("ProgrammableMoveCall",{package:Jn,module:de.bcs.string(),function:de.bcs.string(),typeArguments:de.bcs.vector(Zh),arguments:de.bcs.vector(Vn)}),j2=de.bcs.enum("Command",{MoveCall:P2,TransferObjects:de.bcs.struct("TransferObjects",{objects:de.bcs.vector(Vn),address:Vn}),SplitCoins:de.bcs.struct("SplitCoins",{coin:Vn,amounts:de.bcs.vector(Vn)}),MergeCoins:de.bcs.struct("MergeCoins",{destination:Vn,sources:de.bcs.vector(Vn)}),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(Jn)}),MakeMoveVec:de.bcs.struct("MakeMoveVec",{type:nT(Zh).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:de.bcs.vector(Vn)}),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(Jn),package:Jn,ticket:Vn})}),k2=de.bcs.struct("ProgrammableTransaction",{inputs:de.bcs.vector(I2),commands:de.bcs.vector(j2)}),R2=de.bcs.enum("TransactionKind",{ProgrammableTransaction:k2,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),N2=de.bcs.enum("TransactionExpiration",{None:null,Epoch:rT()}),D2=de.bcs.struct("StructTag",{address:Jn,module:de.bcs.string(),name:de.bcs.string(),typeParams:de.bcs.vector(Yh)}),$2=de.bcs.struct("GasData",{payment:de.bcs.vector(Cu),owner:Jn,price:de.bcs.u64(),budget:de.bcs.u64()}),B2=de.bcs.struct("TransactionDataV1",{kind:R2,sender:Jn,gasData:$2,expiration:N2}),L2=de.bcs.enum("TransactionData",{V1:B2}),F2=de.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),U2=de.bcs.enum("IntentVersion",{V0:null}),z2=de.bcs.enum("AppId",{Sui:null}),V2=de.bcs.struct("Intent",{scope:F2,version:U2,appId:z2});function q2(e){return de.bcs.struct(`IntentMessage<${e.name}>`,{intent:V2,value:e})}const W2=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())}),G2=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())}),H2=de.bcs.struct("MultiSigPkMap",{pubKey:G2,weight:de.bcs.u8()}),K2=de.bcs.struct("MultiSigPublicKey",{pk_map:de.bcs.vector(H2),threshold:de.bcs.u16()}),iT=de.bcs.struct("MultiSig",{sigs:de.bcs.vector(W2),bitmap:de.bcs.u16(),multisig_pk:K2}),J2=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))}),X2=de.bcs.struct("SenderSignedTransaction",{intentMessage:q2(L2),txSignatures:de.bcs.vector(J2)}),sT=de.bcs.vector(X2,{name:"SenderSignedData"}),oT=de.bcs.struct("PasskeyAuthenticator",{authenticatorData:de.bcs.vector(de.bcs.u8()),clientDataJson:de.bcs.string(),userSignature:de.bcs.vector(de.bcs.u8())});var Qh=Object.defineProperty,aT=Object.getOwnPropertyDescriptor,cT=Object.getOwnPropertyNames,uT=Object.prototype.hasOwnProperty,lT=(e,t)=>{for(var r in t)Qh(e,r,{get:t[r],enumerable:!0})},fT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cT(t))!uT.call(e,i)&&i!==r&&Qh(e,i,{get:()=>t[i],enumerable:!(n=aT(t,i))||n.enumerable});return e},dT=e=>fT(Qh({},"__esModule",{value:!0}),e),Y2={};lT(Y2,{TransactionEffects:()=>MT});var hT=dT(Y2),ye=Or,Lt=M2;const pT=ye.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:ye.bcs.struct("UnableToFetchPackage",{packageId:Lt.Address}),NotAPackage:ye.bcs.struct("NotAPackage",{objectId:Lt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:ye.bcs.struct("DigestDoesNotMatch",{digest:ye.bcs.vector(ye.bcs.u8())}),UnknownUpgradePolicy:ye.bcs.struct("UnknownUpgradePolicy",{policy:ye.bcs.u8()}),PackageIDDoesNotMatch:ye.bcs.struct("PackageIDDoesNotMatch",{packageId:Lt.Address,ticketId:Lt.Address})}),mT=ye.bcs.struct("ModuleId",{address:Lt.Address,name:ye.bcs.string()}),sm=ye.bcs.struct("MoveLocation",{module:mT,function:ye.bcs.u16(),instruction:ye.bcs.u16(),functionName:ye.bcs.option(ye.bcs.string())}),gT=ye.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:ye.bcs.struct("IndexOutOfBounds",{idx:ye.bcs.u16()}),SecondaryIndexOutOfBounds:ye.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:ye.bcs.u16(),secondaryIdx:ye.bcs.u16()}),InvalidResultArity:ye.bcs.struct("InvalidResultArity",{resultIdx:ye.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),vT=ye.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),yT=ye.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:ye.bcs.struct("MoveObjectTooBig",{objectSize:ye.bcs.u64(),maxObjectSize:ye.bcs.u64()}),MovePackageTooBig:ye.bcs.struct("MovePackageTooBig",{objectSize:ye.bcs.u64(),maxObjectSize:ye.bcs.u64()}),CircularObjectOwnership:ye.bcs.struct("CircularObjectOwnership",{object:Lt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:ye.bcs.option(sm),MoveAbort:ye.bcs.tuple([sm,ye.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:ye.bcs.struct("CommandArgumentError",{argIdx:ye.bcs.u16(),kind:gT}),TypeArgumentError:ye.bcs.struct("TypeArgumentError",{argumentIdx:ye.bcs.u16(),kind:vT}),UnusedValueWithoutDrop:ye.bcs.struct("UnusedValueWithoutDrop",{resultIdx:ye.bcs.u16(),secondaryIdx:ye.bcs.u16()}),InvalidPublicFunctionReturnType:ye.bcs.struct("InvalidPublicFunctionReturnType",{idx:ye.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:ye.bcs.struct("EffectsTooLarge",{currentSize:ye.bcs.u64(),maxSize:ye.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:ye.bcs.struct("PackageUpgradeError",{upgradeError:pT}),WrittenObjectsTooLarge:ye.bcs.struct("WrittenObjectsTooLarge",{currentSize:ye.bcs.u64(),maxSize:ye.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:ye.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:ye.bcs.vector(Lt.Address)}),AddressDeniedForCoin:ye.bcs.struct("AddressDeniedForCoin",{address:Lt.Address,coinType:ye.bcs.string()}),CoinTypeGlobalPause:ye.bcs.struct("CoinTypeGlobalPause",{coinType:ye.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Z2=ye.bcs.enum("ExecutionStatus",{Success:null,Failed:ye.bcs.struct("ExecutionFailed",{error:yT,command:ye.bcs.option(ye.bcs.u64())})}),Q2=ye.bcs.struct("GasCostSummary",{computationCost:ye.bcs.u64(),storageCost:ye.bcs.u64(),storageRebate:ye.bcs.u64(),nonRefundableStorageFee:ye.bcs.u64()}),wo=ye.bcs.enum("Owner",{AddressOwner:Lt.Address,ObjectOwner:Lt.Address,Shared:ye.bcs.struct("Shared",{initialSharedVersion:ye.bcs.u64()}),Immutable:null}),bT=ye.bcs.struct("TransactionEffectsV1",{status:Z2,executedEpoch:ye.bcs.u64(),gasUsed:Q2,modifiedAtVersions:ye.bcs.vector(ye.bcs.tuple([Lt.Address,ye.bcs.u64()])),sharedObjects:ye.bcs.vector(Lt.SuiObjectRef),transactionDigest:Lt.ObjectDigest,created:ye.bcs.vector(ye.bcs.tuple([Lt.SuiObjectRef,wo])),mutated:ye.bcs.vector(ye.bcs.tuple([Lt.SuiObjectRef,wo])),unwrapped:ye.bcs.vector(ye.bcs.tuple([Lt.SuiObjectRef,wo])),deleted:ye.bcs.vector(Lt.SuiObjectRef),unwrappedThenDeleted:ye.bcs.vector(Lt.SuiObjectRef),wrapped:ye.bcs.vector(Lt.SuiObjectRef),gasObject:ye.bcs.tuple([Lt.SuiObjectRef,wo]),eventsDigest:ye.bcs.option(Lt.ObjectDigest),dependencies:ye.bcs.vector(Lt.ObjectDigest)}),ep=ye.bcs.tuple([ye.bcs.u64(),Lt.ObjectDigest]),wT=ye.bcs.enum("ObjectIn",{NotExist:null,Exist:ye.bcs.tuple([ep,wo])}),_T=ye.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:ye.bcs.tuple([Lt.ObjectDigest,wo]),PackageWrite:ep}),xT=ye.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),ST=ye.bcs.struct("EffectsObjectChange",{inputState:wT,outputState:_T,idOperation:xT}),ET=ye.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:ep,MutateDeleted:ye.bcs.u64(),ReadDeleted:ye.bcs.u64(),Cancelled:ye.bcs.u64(),PerEpochConfig:null}),CT=ye.bcs.struct("TransactionEffectsV2",{status:Z2,executedEpoch:ye.bcs.u64(),gasUsed:Q2,transactionDigest:Lt.ObjectDigest,gasObjectIndex:ye.bcs.option(ye.bcs.u32()),eventsDigest:ye.bcs.option(Lt.ObjectDigest),dependencies:ye.bcs.vector(Lt.ObjectDigest),lamportVersion:ye.bcs.u64(),changedObjects:ye.bcs.vector(ye.bcs.tuple([Lt.Address,ST])),unchangedSharedObjects:ye.bcs.vector(ye.bcs.tuple([Lt.Address,ET])),auxDataDigest:ye.bcs.option(Lt.ObjectDigest)}),MT=ye.bcs.enum("TransactionEffects",{V1:bT,V2:CT});var tp=Object.defineProperty,TT=Object.getOwnPropertyDescriptor,AT=Object.getOwnPropertyNames,OT=Object.prototype.hasOwnProperty,IT=(e,t)=>{for(var r in t)tp(e,r,{get:t[r],enumerable:!0})},PT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of AT(t))!OT.call(e,i)&&i!==r&&tp(e,i,{get:()=>t[i],enumerable:!(n=TT(t,i))||n.enumerable});return e},jT=e=>PT(tp({},"__esModule",{value:!0}),e),e_={};IT(e_,{BcsType:()=>NT.BcsType,TypeTagSerializer:()=>RT.TypeTagSerializer,bcs:()=>DT});var si=jT(e_),$n=Or,Bt=M2,kT=hT,RT=E2,NT=Or;const DT={...$n.bcs,U8:$n.bcs.u8(),U16:$n.bcs.u16(),U32:$n.bcs.u32(),U64:$n.bcs.u64(),U128:$n.bcs.u128(),U256:$n.bcs.u256(),ULEB128:$n.bcs.uleb128(),Bool:$n.bcs.bool(),String:$n.bcs.string(),Address:Bt.Address,AppId:Bt.AppId,Argument:Bt.Argument,CallArg:Bt.CallArg,CompressedSignature:Bt.CompressedSignature,GasData:Bt.GasData,Intent:Bt.Intent,IntentMessage:Bt.IntentMessage,IntentScope:Bt.IntentScope,IntentVersion:Bt.IntentVersion,MultiSig:Bt.MultiSig,MultiSigPkMap:Bt.MultiSigPkMap,MultiSigPublicKey:Bt.MultiSigPublicKey,ObjectArg:Bt.ObjectArg,ObjectDigest:Bt.ObjectDigest,ProgrammableMoveCall:Bt.ProgrammableMoveCall,ProgrammableTransaction:Bt.ProgrammableTransaction,PublicKey:Bt.PublicKey,SenderSignedData:Bt.SenderSignedData,SenderSignedTransaction:Bt.SenderSignedTransaction,SharedObjectRef:Bt.SharedObjectRef,StructTag:Bt.StructTag,SuiObjectRef:Bt.SuiObjectRef,Command:Bt.Command,TransactionData:Bt.TransactionData,TransactionDataV1:Bt.TransactionDataV1,TransactionExpiration:Bt.TransactionExpiration,TransactionKind:Bt.TransactionKind,TypeTag:Bt.TypeTag,TransactionEffects:kT.TransactionEffects,PasskeyAuthenticator:Bt.PasskeyAuthenticator};var rp=Object.defineProperty,$T=Object.getOwnPropertyDescriptor,BT=Object.getOwnPropertyNames,LT=Object.prototype.hasOwnProperty,FT=(e,t)=>{for(var r in t)rp(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&&rp(e,i,{get:()=>t[i],enumerable:!(n=$T(t,i))||n.enumerable});return e},zT=e=>UT(rp({},"__esModule",{value:!0}),e),t_={};FT(t_,{formatAddress:()=>qT,formatDigest:()=>WT});var VT=zT(t_);const r_="…";function qT(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${r_}${e.slice(-4)}`}function WT(e){return`${e.slice(0,10)}${r_}`}var np=Object.defineProperty,GT=Object.getOwnPropertyDescriptor,HT=Object.getOwnPropertyNames,KT=Object.prototype.hasOwnProperty,JT=(e,t)=>{for(var r in t)np(e,r,{get:t[r],enumerable:!0})},XT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of HT(t))!KT.call(e,i)&&i!==r&&np(e,i,{get:()=>t[i],enumerable:!(n=GT(t,i))||n.enumerable});return e},YT=e=>XT(np({},"__esModule",{value:!0}),e),n_={};JT(n_,{isValidSuiNSName:()=>QT,normalizeSuiNSName:()=>eA});var i_=YT(n_);const s_=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,o_=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,ZT=235;function QT(e){return e.length>ZT?!1:e.includes("@")?s_.test(e):o_.test(e)}function eA(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!s_.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!o_.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 ip=Object.defineProperty,tA=Object.getOwnPropertyDescriptor,rA=Object.getOwnPropertyNames,nA=Object.prototype.hasOwnProperty,iA=(e,t)=>{for(var r in t)ip(e,r,{get:t[r],enumerable:!0})},sA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rA(t))!nA.call(e,i)&&i!==r&&ip(e,i,{get:()=>t[i],enumerable:!(n=tA(t,i))||n.enumerable});return e},oA=e=>sA(ip({},"__esModule",{value:!0}),e),a_={};iA(a_,{MIST_PER_SUI:()=>uA,MOVE_STDLIB_ADDRESS:()=>lA,SUI_CLOCK_OBJECT_ID:()=>dA,SUI_DECIMALS:()=>cA,SUI_FRAMEWORK_ADDRESS:()=>u_,SUI_SYSTEM_ADDRESS:()=>fA,SUI_SYSTEM_MODULE_NAME:()=>hA,SUI_SYSTEM_STATE_OBJECT_ID:()=>mA,SUI_TYPE_ARG:()=>pA});var aA=oA(a_),c_=Jr;const cA=9,uA=BigInt(1e9),lA="0x1",u_="0x2",fA="0x3",dA=(0,c_.normalizeSuiObjectId)("0x6"),hA="sui_system",pA=`${u_}::sui::SUI`,mA=(0,c_.normalizeSuiObjectId)("0x5");var sp=Object.defineProperty,gA=Object.getOwnPropertyDescriptor,vA=Object.getOwnPropertyNames,yA=Object.prototype.hasOwnProperty,bA=(e,t)=>{for(var r in t)sp(e,r,{get:t[r],enumerable:!0})},wA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vA(t))!yA.call(e,i)&&i!==r&&sp(e,i,{get:()=>t[i],enumerable:!(n=gA(t,i))||n.enumerable});return e},_A=e=>wA(sp({},"__esModule",{value:!0}),e),l_={};bA(l_,{isValidNamedPackage:()=>h_,isValidNamedType:()=>MA});var f_=_A(l_),xA=i_;const SA=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,EA=/^\d+$/,CA=64,d_="/",h_=e=>{const t=e.split(d_);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!EA.test(i)||!(0,xA.isValidSuiNSName)(r)?!1:SA.test(n)&&n.length<CA},MA=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(d_)&&!h_(r))return!1;return!0},p_=il(OC);var op=Object.defineProperty,TA=Object.getOwnPropertyDescriptor,AA=Object.getOwnPropertyNames,OA=Object.prototype.hasOwnProperty,IA=(e,t)=>{for(var r in t)op(e,r,{get:t[r],enumerable:!0})},PA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of AA(t))!OA.call(e,i)&&i!==r&&op(e,i,{get:()=>t[i],enumerable:!(n=TA(t,i))||n.enumerable});return e},jA=e=>PA(op({},"__esModule",{value:!0}),e),m_={};IA(m_,{deriveDynamicFieldID:()=>DA});var kA=jA(m_),RA=Or,NA=p_,vf=si;function DA(e,t,r){const n=vf.bcs.Address.serialize(e).toBytes(),i=vf.bcs.TypeTag.serialize(t).toBytes(),s=vf.bcs.u64().serialize(r.length).toBytes(),o=NA.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,RA.toHex)(o.digest().slice(0,32))}`}var ap=Object.defineProperty,$A=Object.getOwnPropertyDescriptor,BA=Object.getOwnPropertyNames,LA=Object.prototype.hasOwnProperty,FA=(e,t)=>{for(var r in t)ap(e,r,{get:t[r],enumerable:!0})},UA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of BA(t))!LA.call(e,i)&&i!==r&&ap(e,i,{get:()=>t[i],enumerable:!(n=$A(t,i))||n.enumerable});return e},zA=e=>UA(ap({},"__esModule",{value:!0}),e),g_={};FA(g_,{MIST_PER_SUI:()=>hi.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>hi.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>Vi.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>hi.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>hi.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>hi.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>hi.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>hi.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>hi.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>hi.SUI_TYPE_ARG,deriveDynamicFieldID:()=>VA.deriveDynamicFieldID,formatAddress:()=>om.formatAddress,formatDigest:()=>om.formatDigest,fromB64:()=>Bn.fromB64,fromBase58:()=>Bn.fromBase58,fromBase64:()=>Bn.fromBase64,fromHEX:()=>Bn.fromHEX,fromHex:()=>Bn.fromHex,isValidNamedPackage:()=>cm.isValidNamedPackage,isValidNamedType:()=>cm.isValidNamedType,isValidSuiAddress:()=>Vi.isValidSuiAddress,isValidSuiNSName:()=>am.isValidSuiNSName,isValidSuiObjectId:()=>Vi.isValidSuiObjectId,isValidTransactionDigest:()=>Vi.isValidTransactionDigest,normalizeStructTag:()=>Vi.normalizeStructTag,normalizeSuiAddress:()=>Vi.normalizeSuiAddress,normalizeSuiNSName:()=>am.normalizeSuiNSName,normalizeSuiObjectId:()=>Vi.normalizeSuiObjectId,parseStructTag:()=>Vi.parseStructTag,toB64:()=>Bn.toB64,toBase58:()=>Bn.toBase58,toBase64:()=>Bn.toBase64,toHEX:()=>Bn.toHEX,toHex:()=>Bn.toHex});var v_=zA(g_),om=VT,Vi=Jr,Bn=Or,am=i_,hi=aA,cm=f_,VA=kA,cp=Object.defineProperty,qA=Object.getOwnPropertyDescriptor,WA=Object.getOwnPropertyNames,GA=Object.prototype.hasOwnProperty,HA=(e,t)=>{for(var r in t)cp(e,r,{get:t[r],enumerable:!0})},KA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of WA(t))!GA.call(e,i)&&i!==r&&cp(e,i,{get:()=>t[i],enumerable:!(n=qA(t,i))||n.enumerable});return e},JA=e=>KA(cp({},"__esModule",{value:!0}),e),y_={};HA(y_,{getPureBcsSchema:()=>jd,isTxContext:()=>i5,normalizedTypeToMoveTypeSignature:()=>s5,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>w_});var b_=JA(y_),Yt=si,um=v_,Na=Jr;const XA="object",YA="ID",ZA="ascii",QA="String",e5="string",t5="String",r5="option",n5="Option";function i5(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,Na.normalizeSuiAddress)(t.package)===(0,Na.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function jd(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Yt.bcs.vector(Yt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=jd(e.vector);return t?Yt.bcs.vector(t):null}if("datatype"in e){const t=(0,Na.normalizeSuiAddress)(e.datatype.package);if(t===(0,Na.normalizeSuiAddress)(um.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===ZA&&e.datatype.type===QA||e.datatype.module===e5&&e.datatype.type===t5)return Yt.bcs.String;if(e.datatype.module===r5&&e.datatype.type===n5){const r=jd(e.datatype.typeParameters[0]);return r?Yt.bcs.vector(r):null}}if(t===(0,Na.normalizeSuiAddress)(um.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===XA&&e.datatype.type===YA)return Yt.bcs.Address}return null}function s5(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Da(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Da(e.MutableReference)}:{ref:null,body:Da(e)}}function Da(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:Da(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(Da)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function w_(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Yt.bcs.vector(w_(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var up=Object.defineProperty,o5=Object.getOwnPropertyDescriptor,a5=Object.getOwnPropertyNames,c5=Object.prototype.hasOwnProperty,u5=(e,t)=>{for(var r in t)up(e,r,{get:t[r],enumerable:!0})},l5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of a5(t))!c5.call(e,i)&&i!==r&&up(e,i,{get:()=>t[i],enumerable:!(n=o5(t,i))||n.enumerable});return e},f5=e=>l5(up({},"__esModule",{value:!0}),e),__={};u5(__,{Inputs:()=>p5});var al=f5(__),d5=Or,yf=Jr;function h5(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,d5.toBase64)(e):e.toBase64()}}}const p5={Pure:h5,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:(0,yf.normalizeSuiAddress)(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:(0,yf.normalizeSuiAddress)(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:(0,yf.normalizeSuiAddress)(e)}}}}};var lp=Object.defineProperty,m5=Object.getOwnPropertyDescriptor,g5=Object.getOwnPropertyNames,v5=Object.prototype.hasOwnProperty,y5=(e,t)=>{for(var r in t)lp(e,r,{get:t[r],enumerable:!0})},b5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of g5(t))!v5.call(e,i)&&i!==r&&lp(e,i,{get:()=>t[i],enumerable:!(n=m5(t,i))||n.enumerable});return e},w5=e=>b5(lp({},"__esModule",{value:!0}),e),x_={};y5(x_,{$Intent:()=>C_,Argument:()=>en,BCSBytes:()=>Ha,Command:()=>M_,GasData:()=>S_,JsonU64:()=>ss,NormalizedCallArg:()=>E5,ObjectArg:()=>fp,ObjectID:()=>zs,ObjectRef:()=>Mu,OpenMoveTypeSignature:()=>E_,OpenMoveTypeSignatureBody:()=>Tu,StructTag:()=>_5,SuiAddress:()=>gc,TransactionData:()=>C5,TransactionExpiration:()=>T_,safeEnum:()=>Ho});var Go=w5(x_),ue=ps,lm=Jr;function Ho(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 gc=(0,ue.pipe)((0,ue.string)(),(0,ue.transform)(e=>(0,lm.normalizeSuiAddress)(e)),(0,ue.check)(lm.isValidSuiAddress)),zs=gc,Ha=(0,ue.string)(),ss=(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")),Mu=(0,ue.object)({objectId:gc,version:ss,digest:(0,ue.string)()}),en=(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]}))),S_=(0,ue.object)({budget:(0,ue.nullable)(ss),price:(0,ue.nullable)(ss),owner:(0,ue.nullable)(gc),payment:(0,ue.nullable)((0,ue.array)(Mu))}),_5=(0,ue.object)({address:(0,ue.string)(),module:(0,ue.string)(),name:(0,ue.string)(),typeParams:(0,ue.array)((0,ue.string)())}),Tu=(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)(()=>Tu)}),(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)(()=>Tu))})}),(0,ue.object)({typeParameter:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())})]),E_=(0,ue.object)({ref:(0,ue.nullable)((0,ue.union)([(0,ue.literal)("&"),(0,ue.literal)("&mut")])),body:Tu}),x5=(0,ue.object)({package:zs,module:(0,ue.string)(),function:(0,ue.string)(),typeArguments:(0,ue.array)((0,ue.string)()),arguments:(0,ue.array)(en),_argumentTypes:(0,ue.optional)((0,ue.nullable)((0,ue.array)(E_)))}),C_=(0,ue.object)({name:(0,ue.string)(),inputs:(0,ue.record)((0,ue.string)(),(0,ue.union)([en,(0,ue.array)(en)])),data:(0,ue.record)((0,ue.string)(),(0,ue.unknown)())}),M_=Ho({MoveCall:x5,TransferObjects:(0,ue.object)({objects:(0,ue.array)(en),address:en}),SplitCoins:(0,ue.object)({coin:en,amounts:(0,ue.array)(en)}),MergeCoins:(0,ue.object)({destination:en,sources:(0,ue.array)(en)}),Publish:(0,ue.object)({modules:(0,ue.array)(Ha),dependencies:(0,ue.array)(zs)}),MakeMoveVec:(0,ue.object)({type:(0,ue.nullable)((0,ue.string)()),elements:(0,ue.array)(en)}),Upgrade:(0,ue.object)({modules:(0,ue.array)(Ha),dependencies:(0,ue.array)(zs),package:zs,ticket:en}),$Intent:C_}),fp=Ho({ImmOrOwnedObject:Mu,SharedObject:(0,ue.object)({objectId:zs,initialSharedVersion:ss,mutable:(0,ue.boolean)()}),Receiving:Mu}),S5=Ho({Object:fp,Pure:(0,ue.object)({bytes:Ha}),UnresolvedPure:(0,ue.object)({value:(0,ue.unknown)()}),UnresolvedObject:(0,ue.object)({objectId:zs,version:(0,ue.optional)((0,ue.nullable)(ss)),digest:(0,ue.optional)((0,ue.nullable)((0,ue.string)())),initialSharedVersion:(0,ue.optional)((0,ue.nullable)(ss))})}),E5=Ho({Object:fp,Pure:(0,ue.object)({bytes:Ha})}),T_=Ho({None:(0,ue.literal)(!0),Epoch:ss}),C5=(0,ue.object)({version:(0,ue.literal)(2),sender:(0,ue.nullish)(gc),expiration:(0,ue.nullish)(T_),gasData:S_,inputs:(0,ue.array)(S5),commands:(0,ue.array)(M_)});var dp=Object.defineProperty,M5=Object.getOwnPropertyDescriptor,T5=Object.getOwnPropertyNames,A5=Object.prototype.hasOwnProperty,O5=(e,t)=>{for(var r in t)dp(e,r,{get:t[r],enumerable:!0})},I5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of T5(t))!A5.call(e,i)&&i!==r&&dp(e,i,{get:()=>t[i],enumerable:!(n=M5(t,i))||n.enumerable});return e},P5=e=>I5(dp({},"__esModule",{value:!0}),e),A_={};O5(A_,{Commands:()=>j5,UpgradePolicy:()=>O_});var hp=P5(A_),fm=Or,Ln=ps,dm=Jr,Fn=Go,O_=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(O_||{});const j5={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,Ln.parse)(Fn.Argument,r)),address:(0,Ln.parse)(Fn.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,Ln.parse)(Fn.Argument,e),amounts:t.map(r=>(0,Ln.parse)(Fn.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,Ln.parse)(Fn.Argument,e),sources:t.map(r=>(0,Ln.parse)(Fn.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,fm.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,dm.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,fm.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,dm.normalizeSuiObjectId)(i)),package:r,ticket:(0,Ln.parse)(Fn.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,Ln.parse)(Fn.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,Ln.parse)(Fn.Argument,s)):(0,Ln.parse)(Fn.Argument,i)])),data:r}}}};var pp=Object.defineProperty,k5=Object.getOwnPropertyDescriptor,R5=Object.getOwnPropertyNames,N5=Object.prototype.hasOwnProperty,D5=(e,t)=>{for(var r in t)pp(e,r,{get:t[r],enumerable:!0})},$5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of R5(t))!N5.call(e,i)&&i!==r&&pp(e,i,{get:()=>t[i],enumerable:!(n=k5(t,i))||n.enumerable});return e},B5=e=>$5(pp({},"__esModule",{value:!0}),e),I_={};D5(I_,{NormalizedCallArg:()=>kd,ObjectRef:()=>Au,SerializedTransactionDataV1:()=>Z5,StructTag:()=>R_,TransactionArgument:()=>Qn,TypeTag:()=>cl,serializeV1TransactionData:()=>Q5,transactionDataFromV1:()=>eO});var P_=B5(I_),Io=Or,re=ps,j_=si,$a=Go;const Au=(0,re.object)({digest:(0,re.string)(),objectId:(0,re.string)(),version:(0,re.union)([(0,re.pipe)((0,re.number)(),(0,re.integer)()),(0,re.string)(),(0,re.bigint)()])}),L5=(0,$a.safeEnum)({ImmOrOwned:Au,Shared:(0,re.object)({objectId:$a.ObjectID,initialSharedVersion:$a.JsonU64,mutable:(0,re.boolean)()}),Receiving:Au}),kd=(0,$a.safeEnum)({Object:L5,Pure:(0,re.array)((0,re.pipe)((0,re.number)(),(0,re.integer)()))}),k_=(0,re.union)([(0,re.object)({kind:(0,re.literal)("Input"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)()),value:(0,re.unknown)(),type:(0,re.optional)((0,re.literal)("object"))}),(0,re.object)({kind:(0,re.literal)("Input"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)()),value:(0,re.unknown)(),type:(0,re.literal)("pure")})]),F5=(0,re.union)([(0,re.object)({Epoch:(0,re.pipe)((0,re.number)(),(0,re.integer)())}),(0,re.object)({None:(0,re.nullable)((0,re.literal)(!0))})]),hm=(0,re.pipe)((0,re.union)([(0,re.number)(),(0,re.string)(),(0,re.bigint)()]),(0,re.check)(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),cl=(0,re.union)([(0,re.object)({bool:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u8:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u64:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u128:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({address:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({signer:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({vector:(0,re.lazy)(()=>cl)}),(0,re.object)({struct:(0,re.lazy)(()=>R_)}),(0,re.object)({u16:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u32:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u256:(0,re.nullable)((0,re.literal)(!0))})]),R_=(0,re.object)({address:(0,re.string)(),module:(0,re.string)(),name:(0,re.string)(),typeParams:(0,re.array)(cl)}),U5=(0,re.object)({budget:(0,re.optional)(hm),price:(0,re.optional)(hm),payment:(0,re.optional)((0,re.array)(Au)),owner:(0,re.optional)((0,re.string)())}),z5=[k_,(0,re.object)({kind:(0,re.literal)("GasCoin")}),(0,re.object)({kind:(0,re.literal)("Result"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)())}),(0,re.object)({kind:(0,re.literal)("NestedResult"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)()),resultIndex:(0,re.pipe)((0,re.number)(),(0,re.integer)())})],Qn=(0,re.union)([...z5]),V5=(0,re.object)({kind:(0,re.literal)("MoveCall"),target:(0,re.pipe)((0,re.string)(),(0,re.check)(e=>e.split("::").length===3)),typeArguments:(0,re.array)((0,re.string)()),arguments:(0,re.array)(Qn)}),q5=(0,re.object)({kind:(0,re.literal)("TransferObjects"),objects:(0,re.array)(Qn),address:Qn}),W5=(0,re.object)({kind:(0,re.literal)("SplitCoins"),coin:Qn,amounts:(0,re.array)(Qn)}),G5=(0,re.object)({kind:(0,re.literal)("MergeCoins"),destination:Qn,sources:(0,re.array)(Qn)}),H5=(0,re.object)({kind:(0,re.literal)("MakeMoveVec"),type:(0,re.union)([(0,re.object)({Some:cl}),(0,re.object)({None:(0,re.nullable)((0,re.literal)(!0))})]),objects:(0,re.array)(Qn)}),K5=(0,re.object)({kind:(0,re.literal)("Publish"),modules:(0,re.array)((0,re.array)((0,re.pipe)((0,re.number)(),(0,re.integer)()))),dependencies:(0,re.array)((0,re.string)())}),J5=(0,re.object)({kind:(0,re.literal)("Upgrade"),modules:(0,re.array)((0,re.array)((0,re.pipe)((0,re.number)(),(0,re.integer)()))),dependencies:(0,re.array)((0,re.string)()),packageId:(0,re.string)(),ticket:Qn}),X5=[V5,q5,W5,G5,K5,J5,H5],Y5=(0,re.union)([...X5]),Z5=(0,re.object)({version:(0,re.literal)(1),sender:(0,re.optional)((0,re.string)()),expiration:(0,re.nullish)(F5),gasConfig:U5,inputs:(0,re.array)(k_),transactions:(0,re.array)(Y5)});function Q5(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,Io.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:j_.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>pi(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:pi(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>pi(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=>pi(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from((0,Io.fromBase64)(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:pi(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>pi(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>pi(i,t)),address:pi(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from((0,Io.fromBase64)(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:pi(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function pi(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 eO(e){var t,r,n;return(0,re.parse)($a.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,re.is)(kd,i.value)){const s=(0,re.parse)(kd,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,Io.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?j_.TypeTagSerializer.tagToString(i.type.Some):null,elements:i.objects.map(s=>mi(s))}};case"MergeCoins":return{MergeCoins:{destination:mi(i.destination),sources:i.sources.map(s=>mi(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=>mi(c))}}}case"Publish":return{Publish:{modules:i.modules.map(s=>(0,Io.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:mi(i.coin),amounts:i.amounts.map(s=>mi(s))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(s=>mi(s)),address:mi(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(s=>(0,Io.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies,package:i.packageId,ticket:mi(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function mi(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 mp=Object.defineProperty,tO=Object.getOwnPropertyDescriptor,rO=Object.getOwnPropertyNames,nO=Object.prototype.hasOwnProperty,iO=(e,t)=>{for(var r in t)mp(e,r,{get:t[r],enumerable:!0})},sO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rO(t))!nO.call(e,i)&&i!==r&&mp(e,i,{get:()=>t[i],enumerable:!(n=tO(t,i))||n.enumerable});return e},oO=e=>sO(mp({},"__esModule",{value:!0}),e),N_={};iO(N_,{SerializedTransactionDataV2:()=>mO});var aO=oO(N_),je=ps,cr=Go;function vc(e){return(0,je.union)(Object.entries(e).map(([t,r])=>(0,je.object)({[t]:r})))}const yn=vc({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)())])}),cO=(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))}),uO=(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)(yn)}),lO=(0,je.object)({name:(0,je.string)(),inputs:(0,je.record)((0,je.string)(),(0,je.union)([yn,(0,je.array)(yn)])),data:(0,je.record)((0,je.string)(),(0,je.unknown)())}),fO=vc({MoveCall:uO,TransferObjects:(0,je.object)({objects:(0,je.array)(yn),address:yn}),SplitCoins:(0,je.object)({coin:yn,amounts:(0,je.array)(yn)}),MergeCoins:(0,je.object)({destination:yn,sources:(0,je.array)(yn)}),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)(yn)}),Upgrade:(0,je.object)({modules:(0,je.array)(cr.BCSBytes),dependencies:(0,je.array)(cr.ObjectID),package:cr.ObjectID,ticket:yn}),$Intent:lO}),dO=vc({ImmOrOwnedObject:cr.ObjectRef,SharedObject:(0,je.object)({objectId:cr.ObjectID,initialSharedVersion:cr.JsonU64,mutable:(0,je.boolean)()}),Receiving:cr.ObjectRef}),hO=vc({Object:dO,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))})}),pO=vc({None:(0,je.literal)(!0),Epoch:cr.JsonU64}),mO=(0,je.object)({version:(0,je.literal)(2),sender:(0,je.nullish)(cr.SuiAddress),expiration:(0,je.nullish)(pO),gasData:cO,inputs:(0,je.array)(hO),commands:(0,je.array)(fO)});var gp=Object.defineProperty,gO=Object.getOwnPropertyDescriptor,vO=Object.getOwnPropertyNames,yO=Object.prototype.hasOwnProperty,bO=(e,t)=>{for(var r in t)gp(e,r,{get:t[r],enumerable:!0})},wO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vO(t))!yO.call(e,i)&&i!==r&&gp(e,i,{get:()=>t[i],enumerable:!(n=gO(t,i))||n.enumerable});return e},_O=e=>wO(gp({},"__esModule",{value:!0}),e),D_={};bO(D_,{getClient:()=>Ko,resolveTransactionData:()=>TO});var $_=_O(D_),xO=ps,pm=si,Rd=v_,SO=Go,Ba=al,bf=b_;const EO=50,CO=1000n,MO=5e10;async function TO(e,t,r){return await jO(e,t),await PO(e,t),t.onlyTransactionKind||(await AO(e,t),await OO(e,t),await IO(e,t)),await kO(e),await r()}async function AO(e,t){e.gasConfig.price||(e.gasConfig.price=String(await Ko(t).getReferenceGasPrice()))}async function OO(e,t){if(e.gasConfig.budget)return;const r=await Ko(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(MO),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=CO*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 IO(e,t){if(!e.gasConfig.payment){const n=(await Ko(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Rd.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,xO.parse)(SO.ObjectRef,i))}}async function PO(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,Rd.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?$O(n,EO):[],s=(await Promise.all(i.map(l=>Ko(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,Rd.normalizeSuiAddress)(f.UnresolvedObject.objectId),b=u.get(y);f.UnresolvedObject.initialSharedVersion??(b==null?void 0:b.initialSharedVersion)?h=Ba.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(b==null?void 0:b.initialSharedVersion),mutable:RO(e,l)}):NO(e,l)&&(h=Ba.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??Ba.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 jO(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=>{mm(c,pm.bcs.U64,e)});break;case"TransferObjects":mm(a.TransferObjects.address,pm.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=Ko(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,bf.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,bf.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 R,N;const y=c.arguments[h];if(y.$kind!=="Input")return;const b=r[y.Input];if(!b.UnresolvedPure&&!b.UnresolvedObject)return;const w=((R=b.UnresolvedPure)==null?void 0:R.value)??((N=b.UnresolvedObject)==null?void 0:N.objectId),A=(0,bf.getPureBcsSchema)(f.body);if(A){y.type="pure",r[r.indexOf(b)]=Ba.Inputs.Pure(A.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 kO(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 mm(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=Ba.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function RO(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 NO(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=DO(i.MoveCall._argumentTypes[s])||r}}),r}function DO(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 Ko(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 $O(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var vp=Object.defineProperty,BO=Object.getOwnPropertyDescriptor,LO=Object.getOwnPropertyNames,FO=Object.prototype.hasOwnProperty,UO=(e,t)=>{for(var r in t)vp(e,r,{get:t[r],enumerable:!0})},zO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LO(t))!FO.call(e,i)&&i!==r&&vp(e,i,{get:()=>t[i],enumerable:!(n=BO(t,i))||n.enumerable});return e},VO=e=>zO(vp({},"__esModule",{value:!0}),e),B_={};UO(B_,{createObjectMethods:()=>qO});var L_=VO(B_);function qO(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 yp=Object.defineProperty,WO=Object.getOwnPropertyDescriptor,GO=Object.getOwnPropertyNames,HO=Object.prototype.hasOwnProperty,KO=(e,t)=>{for(var r in t)yp(e,r,{get:t[r],enumerable:!0})},JO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GO(t))!HO.call(e,i)&&i!==r&&yp(e,i,{get:()=>t[i],enumerable:!(n=WO(t,i))||n.enumerable});return e},XO=e=>JO(yp({},"__esModule",{value:!0}),e),F_={};KO(F_,{createPure:()=>ZO});var U_=XO(F_),YO=Or,nr=si;function ZO(e){function t(r,n){if(typeof r=="string")return e(La(r).serialize(n));if(r instanceof Uint8Array||(0,YO.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(nr.bcs.U8.serialize(r)),t.u16=r=>e(nr.bcs.U16.serialize(r)),t.u32=r=>e(nr.bcs.U32.serialize(r)),t.u64=r=>e(nr.bcs.U64.serialize(r)),t.u128=r=>e(nr.bcs.U128.serialize(r)),t.u256=r=>e(nr.bcs.U256.serialize(r)),t.bool=r=>e(nr.bcs.Bool.serialize(r)),t.string=r=>e(nr.bcs.String.serialize(r)),t.address=r=>e(nr.bcs.Address.serialize(r)),t.id=t.address,t.vector=(r,n)=>e(nr.bcs.vector(La(r)).serialize(n)),t.option=(r,n)=>e(nr.bcs.option(La(r)).serialize(n)),t}function La(e){switch(e){case"u8":return nr.bcs.u8();case"u16":return nr.bcs.u16();case"u32":return nr.bcs.u32();case"u64":return nr.bcs.u64();case"u128":return nr.bcs.u128();case"u256":return nr.bcs.u256();case"bool":return nr.bcs.bool();case"string":return nr.bcs.string();case"id":case"address":return nr.bcs.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?nr.bcs.vector(La(n)):nr.bcs.option(La(n))}throw new Error(`Invalid Pure type name: ${e}`)}var bp=Object.defineProperty,QO=Object.getOwnPropertyDescriptor,eI=Object.getOwnPropertyNames,tI=Object.prototype.hasOwnProperty,rI=(e,t)=>{for(var r in t)bp(e,r,{get:t[r],enumerable:!0})},nI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of eI(t))!tI.call(e,i)&&i!==r&&bp(e,i,{get:()=>t[i],enumerable:!(n=QO(t,i))||n.enumerable});return e},iI=e=>nI(bp({},"__esModule",{value:!0}),e),z_={};rI(z_,{hashTypedData:()=>aI});var sI=iI(z_),oI=p_;function aI(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,oI.blake2b)(n,{dkLen:32})}var wp=Object.defineProperty,cI=Object.getOwnPropertyDescriptor,uI=Object.getOwnPropertyNames,lI=Object.prototype.hasOwnProperty,fI=(e,t)=>{for(var r in t)wp(e,r,{get:t[r],enumerable:!0})},dI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of uI(t))!lI.call(e,i)&&i!==r&&wp(e,i,{get:()=>t[i],enumerable:!(n=cI(t,i))||n.enumerable});return e},hI=e=>dI(wp({},"__esModule",{value:!0}),e),V_={};fI(V_,{TransactionDataBuilder:()=>Ns});var _p=hI(V_),pI=Or,wf=ps,kc=si,mI=Jr,_f=Go,gI=P_,vI=sI;function gm(e){return(0,mI.normalizeSuiAddress)(e).replace("0x","")}class Ns{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=kc.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return Ns.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=kc.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 Ns.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 Ns((0,wf.parse)(_f.TransactionData,t)):new Ns((0,wf.parse)(_f.TransactionData,(0,gI.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,vI.hashTypedData)("TransactionData",t);return(0,pI.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 kc.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:gm(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:gm(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return kc.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 Ns.getDigestFromBytes(t)}snapshot(){return(0,wf.parse)(_f.TransactionData,this)}}var xp=Object.defineProperty,yI=Object.getOwnPropertyDescriptor,bI=Object.getOwnPropertyNames,wI=Object.prototype.hasOwnProperty,_I=(e,t)=>{for(var r in t)xp(e,r,{get:t[r],enumerable:!0})},xI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bI(t))!wI.call(e,i)&&i!==r&&xp(e,i,{get:()=>t[i],enumerable:!(n=yI(t,i))||n.enumerable});return e},SI=e=>xI(xp({},"__esModule",{value:!0}),e),q_={};_I(q_,{extractMutableReference:()=>W_,extractReference:()=>G_,extractStructTag:()=>CI,getIdFromCallArg:()=>MI});var EI=SI(q_),pa=Jr;function W_(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function G_(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function CI(e){if(typeof e=="object"&&"Struct"in e)return e;const t=G_(e),r=W_(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function MI(e){if(typeof e=="string")return(0,pa.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,pa.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,pa.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,pa.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,pa.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var Sp=Object.defineProperty,TI=Object.getOwnPropertyDescriptor,AI=Object.getOwnPropertyNames,OI=Object.prototype.hasOwnProperty,H_=e=>{throw TypeError(e)},II=(e,t)=>{for(var r in t)Sp(e,r,{get:t[r],enumerable:!0})},PI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of AI(t))!OI.call(e,i)&&i!==r&&Sp(e,i,{get:()=>t[i],enumerable:!(n=TI(t,i))||n.enumerable});return e},jI=e=>PI(Sp({},"__esModule",{value:!0}),e),Ep=(e,t,r)=>t.has(e)||H_("Cannot "+r),Mt=(e,t,r)=>(Ep(e,t,"read from private field"),r?r.call(e):t.get(e)),ma=(e,t,r)=>t.has(e)?H_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ws=(e,t,r,n)=>(Ep(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),yi=(e,t,r)=>(Ep(e,t,"access private method"),r),K_={};II(K_,{Transaction:()=>LI,isTransaction:()=>X_});var ul=jI(K_),Jc=Or,Ki=ps,kI=Jr,_s=hp,Ds=Go,vm=P_,RI=aO,Rc=al,NI=$_,DI=L_,$I=U_,ga=_p,ym=EI,Aa,Fa,Os,Ot,bn,Xc,Cp,Nd,Mp;function bm(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 J_=Symbol.for("@mysten/transaction");function X_(e){return!!e&&typeof e=="object"&&e[J_]===!0}const wm={buildPlugins:new Map,serializationPlugins:new Map},xf=Symbol.for("@mysten/transaction/registry");function va(){try{const e=globalThis;return e[xf]||(e[xf]=wm),e[xf]}catch{return wm}}const BI=class Dd{constructor(){ma(this,bn),ma(this,Aa),ma(this,Fa),ma(this,Os,new Map),ma(this,Ot),this.object=(0,DI.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Ki.is)(Ds.Argument,r))return r;const n=(0,ym.getIdFromCallArg)(r),i=Mt(this,Ot).inputs.find(a=>n===(0,ym.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:Mt(this,Ot).inputs.indexOf(i),type:"object"}:Mt(this,Ot).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,kI.normalizeSuiAddress)(r)}}:r)});const t=va();ws(this,Ot,new ga.TransactionDataBuilder),ws(this,Fa,[...t.buildPlugins.values()]),ws(this,Aa,[...t.serializationPlugins.values()])}static fromKind(t){const r=new Dd;return ws(r,Ot,ga.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,Jc.fromBase64)(t):t)),r}static from(t){const r=new Dd;return X_(t)?ws(r,Ot,new ga.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?ws(r,Ot,ga.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,Jc.fromBase64)(t):t)):ws(r,Ot,ga.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){va().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){va().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){va().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){va().buildPlugins.delete(t)}addSerializationPlugin(t){Mt(this,Aa).push(t)}addBuildPlugin(t){Mt(this,Fa).push(t)}addIntentResolver(t,r){if(Mt(this,Os).has(t)&&Mt(this,Os).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Mt(this,Os).set(t,r)}setSender(t){Mt(this,Ot).sender=t}setSenderIfNotSet(t){Mt(this,Ot).sender||(Mt(this,Ot).sender=t)}setExpiration(t){Mt(this,Ot).expiration=t?(0,Ki.parse)(Ds.TransactionExpiration,t):null}setGasPrice(t){Mt(this,Ot).gasConfig.price=String(t)}setGasBudget(t){Mt(this,Ot).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Mt(this,Ot).gasData.budget==null&&(Mt(this,Ot).gasConfig.budget=String(t))}setGasOwner(t){Mt(this,Ot).gasConfig.owner=t}setGasPayment(t){Mt(this,Ot).gasConfig.payment=t.map(r=>(0,Ki.parse)(Ds.ObjectRef,r))}get blockData(){return(0,vm.serializeV1TransactionData)(Mt(this,Ot).snapshot())}getData(){return Mt(this,Ot).snapshot()}get[J_](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,$I.createPure)(t=>(0,Jc.isSerializedBcs)(t)?Mt(this,Ot).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Mt(this,Ot).addInput("pure",(0,Ki.is)(Ds.NormalizedCallArg,t)?(0,Ki.parse)(Ds.NormalizedCallArg,t):t instanceof Uint8Array?Rc.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(Rc.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(Rc.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(Rc.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Mt(this,Ot).commands.push(t);return bm(r-1)}splitCoins(t,r){const n=_s.Commands.SplitCoins(typeof t=="string"?this.object(t):yi(this,bn,Cp).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):yi(this,bn,Xc).call(this,s))),i=Mt(this,Ot).commands.push(n);return bm(i-1,r.length)}mergeCoins(t,r){return this.add(_s.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(_s.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(_s.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(_s.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>yi(this,bn,Xc).call(this,n))}))}transferObjects(t,r){return this.add(_s.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):yi(this,bn,Xc).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(_s.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,vm.serializeV1TransactionData)(Mt(this,Ot).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Ki.parse)(RI.SerializedTransactionDataV2,Mt(this,Ot).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 yi(this,bn,Nd).call(this,t),Mt(this,Ot).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await yi(this,bn,Nd).call(this,t),Mt(this,Ot).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of Mt(this,Ot).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...Mt(this,Aa)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!Mt(this,Os).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(Mt(this,Os).get(s))}await yi(this,bn,Mp).call(this,n,t)}};Aa=new WeakMap;Fa=new WeakMap;Os=new WeakMap;Ot=new WeakMap;bn=new WeakSet;Xc=function(e){return(0,Jc.isSerializedBcs)(e)?this.pure(e):yi(this,bn,Cp).call(this,e)};Cp=function(e){return typeof e=="function"?(0,Ki.parse)(Ds.Argument,e(this)):(0,Ki.parse)(Ds.Argument,e)};Nd=async function(e){if(!e.onlyTransactionKind&&!Mt(this,Ot).sender)throw new Error("Missing transaction sender");await yi(this,bn,Mp).call(this,[...Mt(this,Fa),NI.resolveTransactionData],e)};Mp=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(Mt(this,Ot),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 LI=BI;var Tp=Object.defineProperty,FI=Object.getOwnPropertyDescriptor,UI=Object.getOwnPropertyNames,zI=Object.prototype.hasOwnProperty,Y_=e=>{throw TypeError(e)},VI=(e,t)=>{for(var r in t)Tp(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))!zI.call(e,i)&&i!==r&&Tp(e,i,{get:()=>t[i],enumerable:!(n=FI(t,i))||n.enumerable});return e},WI=e=>qI(Tp({},"__esModule",{value:!0}),e),Z_=(e,t,r)=>t.has(e)||Y_("Cannot "+r),dr=(e,t,r)=>(Z_(e,t,"read from private field"),r?r.call(e):t.get(e)),$d=(e,t,r)=>t.has(e)?Y_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),_m=(e,t,r,n)=>(Z_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Q_={};VI(Q_,{AsyncCache:()=>tx,InMemoryCache:()=>rx,ObjectCache:()=>GI});var ex=WI(Q_),Sf=Jr,Is,Er,Yc;class tx{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,Sf.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,Sf.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,Sf.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 rx extends tx{constructor(){super(...arguments),$d(this,Is,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return dr(this,Is)[t].get(r)??null}async set(t,r,n){dr(this,Is)[t].set(r,n)}async delete(t,r){dr(this,Is)[t].delete(r)}async clear(t){if(t)dr(this,Is)[t].clear();else for(const r of Object.values(dr(this,Is)))r.clear()}}Is=new WeakMap;class GI{constructor({cache:t=new rx,onEffects:r}){$d(this,Er),$d(this,Yc),_m(this,Er,t),_m(this,Yc,r)}asPlugin(){return async(t,r,n)=>{const i=t.inputs.filter(a=>a.UnresolvedObject).map(a=>a.UnresolvedObject.objectId),s=(await dr(this,Er).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,Er).addMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function,parameters:a.MoveCall._argumentTypes})}))}}async clear(){await dr(this,Er).clear()}async getMoveFunctionDefinition(t){return dr(this,Er).getMoveFunctionDefinition(t)}async getObjects(t){return dr(this,Er).getObjects(t)}async deleteObjects(t){return dr(this,Er).deleteObjects(t)}async clearOwnedObjects(){await dr(this,Er).clear("OwnedObject")}async clearCustom(){await dr(this,Er).clear("Custom")}async getCustom(t){return dr(this,Er).getCustom(t)}async setCustom(t,r){return dr(this,Er).setCustom(t,r)}async deleteCustom(t){return dr(this,Er).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,Er).addObjects(o),dr(this,Er).deleteObjects(s),(r=dr(this,Yc))==null?void 0:r.call(this,t)])}}Er=new WeakMap;Yc=new WeakMap;var Ap=Object.defineProperty,HI=Object.getOwnPropertyDescriptor,KI=Object.getOwnPropertyNames,JI=Object.prototype.hasOwnProperty,nx=e=>{throw TypeError(e)},XI=(e,t)=>{for(var r in t)Ap(e,r,{get:t[r],enumerable:!0})},YI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of KI(t))!JI.call(e,i)&&i!==r&&Ap(e,i,{get:()=>t[i],enumerable:!(n=HI(t,i))||n.enumerable});return e},ZI=e=>YI(Ap({},"__esModule",{value:!0}),e),ix=(e,t,r)=>t.has(e)||nx("Cannot "+r),ya=(e,t,r)=>(ix(e,t,"read from private field"),r?r.call(e):t.get(e)),xm=(e,t,r)=>t.has(e)?nx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ef=(e,t,r,n)=>(ix(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),sx={};XI(sx,{CachingTransactionExecutor:()=>rP});var ox=ZI(sx),QI=si,eP=ex,tP=ul,go,vo;class rP{constructor({client:t,...r}){xm(this,go),xm(this,vo,null),Ef(this,go,t),this.cache=new eP.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:ya(this,go),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,tP.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await ya(this,go).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=QI.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;Ef(this,vo,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){ya(this,vo)&&(await ya(this,go).waitForTransaction({digest:ya(this,vo)}),Ef(this,vo,null))}}go=new WeakMap;vo=new WeakMap;var Op=Object.defineProperty,nP=Object.getOwnPropertyDescriptor,iP=Object.getOwnPropertyNames,sP=Object.prototype.hasOwnProperty,ax=e=>{throw TypeError(e)},oP=(e,t)=>{for(var r in t)Op(e,r,{get:t[r],enumerable:!0})},aP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of iP(t))!sP.call(e,i)&&i!==r&&Op(e,i,{get:()=>t[i],enumerable:!(n=nP(t,i))||n.enumerable});return e},cP=e=>aP(Op({},"__esModule",{value:!0}),e),uP=(e,t,r)=>t.has(e)||ax("Cannot "+r),xn=(e,t,r)=>(uP(e,t,"read from private field"),r?r.call(e):t.get(e)),cx=(e,t,r)=>t.has(e)?ax("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ux={};oP(ux,{ParallelQueue:()=>fP,SerialQueue:()=>lP});var lx=cP(ux),Wi,Ps;class lP{constructor(){cx(this,Wi,[])}async runTask(t){return new Promise((r,n)=>{xn(this,Wi).push(()=>{t().finally(()=>{xn(this,Wi).shift(),xn(this,Wi).length>0&&xn(this,Wi)[0]()}).then(r,n)}),xn(this,Wi).length===1&&xn(this,Wi)[0]()})}}Wi=new WeakMap;class fP{constructor(t){cx(this,Ps,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{xn(this,Ps).length>0?xn(this,Ps).shift()():this.activeTasks--}).then(r,n)):xn(this,Ps).push(()=>{t().finally(()=>{xn(this,Ps).length>0?xn(this,Ps).shift()():this.activeTasks--}).then(r,n)})})}}Ps=new WeakMap;var Ip=Object.defineProperty,dP=Object.getOwnPropertyDescriptor,hP=Object.getOwnPropertyNames,pP=Object.prototype.hasOwnProperty,fx=e=>{throw TypeError(e)},mP=(e,t)=>{for(var r in t)Ip(e,r,{get:t[r],enumerable:!0})},gP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hP(t))!pP.call(e,i)&&i!==r&&Ip(e,i,{get:()=>t[i],enumerable:!(n=dP(t,i))||n.enumerable});return e},vP=e=>gP(Ip({},"__esModule",{value:!0}),e),dx=(e,t,r)=>t.has(e)||fx("Cannot "+r),Sr=(e,t,r)=>(dx(e,t,"read from private field"),r?r.call(e):t.get(e)),no=(e,t,r)=>t.has(e)?fx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Cf=(e,t,r,n)=>(dx(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),hx={};mP(hx,{SerialTransactionExecutor:()=>_P,getGasCoinFromEffects:()=>mx});var px=vP(hx),yP=Or,Sm=ul,bP=ox,wP=lx,Zc,Oa,vn,Qc,Bd,eu;class _P{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){no(this,Zc,new wP.SerialQueue),no(this,Oa),no(this,vn),no(this,Qc),no(this,Bd,async i=>{if(!i.V2)return;const s=mx(i).ref;s?Sr(this,vn).cache.setCustom("gasCoin",s):Sr(this,vn).cache.deleteCustom("gasCoin")}),no(this,eu,async i=>{const s=await Sr(this,vn).cache.getCustom("gasCoin"),o=Sm.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(Sr(this,Qc)),o.setSenderIfNotSet(Sr(this,Oa).toSuiAddress()),Sr(this,vn).buildTransaction({transaction:o})}),Cf(this,Oa,t),Cf(this,Qc,r),Cf(this,vn,new bP.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>Sr(this,Bd).call(this,i)}))}async applyEffects(t){return Sr(this,vn).applyEffects(t)}async buildTransaction(t){return Sr(this,Zc).runTask(()=>Sr(this,eu).call(this,t))}resetCache(){return Sr(this,vn).reset()}waitForLastTransaction(){return Sr(this,vn).waitForLastTransaction()}executeTransaction(t,r){return Sr(this,Zc).runTask(async()=>{const n=(0,Sm.isTransaction)(t)?await Sr(this,eu).call(this,t):t,{signature:i}=await Sr(this,Oa).signTransaction(n),s=await Sr(this,vn).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,yP.toBase64)(o),data:s}})}}Zc=new WeakMap;Oa=new WeakMap;vn=new WeakMap;Qc=new WeakMap;Bd=new WeakMap;eu=new WeakMap;function mx(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 Pp=Object.defineProperty,xP=Object.getOwnPropertyDescriptor,SP=Object.getOwnPropertyNames,EP=Object.prototype.hasOwnProperty,gx=e=>{throw TypeError(e)},CP=(e,t)=>{for(var r in t)Pp(e,r,{get:t[r],enumerable:!0})},MP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of SP(t))!EP.call(e,i)&&i!==r&&Pp(e,i,{get:()=>t[i],enumerable:!(n=xP(t,i))||n.enumerable});return e},TP=e=>MP(Pp({},"__esModule",{value:!0}),e),jp=(e,t,r)=>t.has(e)||gx("Cannot "+r),We=(e,t,r)=>(jp(e,t,"read from private field"),r?r.call(e):t.get(e)),fr=(e,t,r)=>t.has(e)?gx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),rr=(e,t,r,n)=>(jp(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),sn=(e,t,r)=>(jp(e,t,"access private method"),r),Em=(e,t,r,n)=>({set _(i){rr(e,t,i,r)},get _(){return We(e,t,n)}}),vx={};CP(vx,{ParallelTransactionExecutor:()=>kP});var AP=TP(vx),OP=Or,yx=si,IP=ul,PP=_p,jP=ox,Cm=lx,bx=px,rs,Xn,Ou,Ka,Ua,Ja,Iu,Po,kr,ns,Vs,Fs,kp,tu,Xa,_o,No,_i,Br,wx,_x,Ya,Rp,xx,Ld,Sx;const ba={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class kP{constructor(t){fr(this,Br),fr(this,rs),fr(this,Xn),fr(this,Ou),fr(this,Ka),fr(this,Ua),fr(this,Ja),fr(this,Iu),fr(this,Po),fr(this,kr),fr(this,ns,[]),fr(this,Vs),fr(this,Fs,new Map),fr(this,kp,new Cm.SerialQueue),fr(this,tu),fr(this,Xa,null),fr(this,_o,null),fr(this,No,0),fr(this,_i,null),rr(this,rs,t.signer),rr(this,Xn,t.client),rr(this,Ou,t.coinBatchSize??ba.coinBatchSize),rr(this,Ka,t.initialCoinBalance??ba.initialCoinBalance),rr(this,Ua,t.minimumCoinBalance??ba.minimumCoinBalance),rr(this,Iu,t.defaultGasBudget??We(this,Ua)),rr(this,Ja,t.epochBoundaryWindow??ba.epochBoundaryWindow),rr(this,Po,t.maxPoolSize??ba.maxPoolSize),rr(this,Vs,new jP.CachingTransactionExecutor({client:t.client,cache:t.cache})),rr(this,tu,new Cm.ParallelQueue(We(this,Po))),rr(this,kr,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return rr(this,_i,null),sn(this,Br,Ya).call(this,()=>We(this,Vs).reset())}async waitForLastTransaction(){await sn(this,Br,Ya).call(this,()=>sn(this,Br,Rp).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=RP(),o=await sn(this,Br,wx).call(this,t),a=()=>{We(this,tu).runTask(()=>sn(this,Br,_x).call(this,t,o,r).then(i,s))},c=new Set;return o.forEach(u=>{We(this,Fs).get(u)?(c.add(u),We(this,Fs).get(u).push(()=>{c.delete(u),c.size===0&&a()})):We(this,Fs).set(u,[])}),c.size===0&&a(),n}}rs=new WeakMap;Xn=new WeakMap;Ou=new WeakMap;Ka=new WeakMap;Ua=new WeakMap;Ja=new WeakMap;Iu=new WeakMap;Po=new WeakMap;kr=new WeakMap;ns=new WeakMap;Vs=new WeakMap;Fs=new WeakMap;kp=new WeakMap;tu=new WeakMap;Xa=new WeakMap;_o=new WeakMap;No=new WeakMap;_i=new WeakMap;Br=new WeakSet;wx=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:We(this,Xn)}),t};_x=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(We(this,rs).toSuiAddress()),await We(this,kp).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await sn(this,Br,Ld).call(this)),e.setGasBudgetIfNotSet(We(this,Iu)),await sn(this,Br,Ya).call(this),n=await sn(this,Br,xx).call(this),Em(this,No)._++,e.setGasPayment([{objectId:n.id,version:n.version,digest:n.digest}]),await We(this,Vs).buildTransaction({transaction:e,onlyTransactionKind:!0})});const s=await e.build({client:We(this,Xn)}),{signature:o}=await We(this,rs).signTransaction(s),a=await We(this,Vs).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=yx.bcs.TransactionEffects.parse(c),l=(0,bx.getGasCoinFromEffects)(u),f=(i=u.V2)==null?void 0:i.gasUsed;if(n&&f&&l.owner===We(this,rs).toSuiAddress()){const h=BigInt(f.computationCost)+BigInt(f.storageCost)+BigInt(f.storageCost)-BigInt(f.storageRebate);let y=!1;new PP.TransactionDataBuilder(e.getData()).mapArguments(b=>(b.$kind==="GasCoin"&&(y=!0),b)),!y&&n.balance>=We(this,Ua)?We(this,ns).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(We(this,kr)||rr(this,kr,new Map),We(this,kr).set(l.ref.objectId,l.ref))}return rr(this,Xa,a.digest),{digest:a.digest,effects:(0,OP.toBase64)(c),data:a}}catch(s){throw n&&(We(this,kr)||rr(this,kr,new Map),We(this,kr).set(n.id,null)),await sn(this,Br,Ya).call(this,async()=>{await Promise.all([We(this,Vs).cache.deleteObjects([...t]),sn(this,Br,Rp).call(this)])}),s}finally{t.forEach(s=>{const o=We(this,Fs).get(s);o&&o.length>0?o.shift()():o&&We(this,Fs).delete(s)}),Em(this,No)._--}};Ya=async function(e){We(this,_o)&&await We(this,_o),rr(this,_o,(e==null?void 0:e().then(()=>{rr(this,_o,null)},()=>{}))??null)};Rp=async function(){const e=We(this,Xa);e&&(rr(this,Xa,null),await We(this,Xn).waitForTransaction({digest:e}))};xx=async function(){if(We(this,ns).length===0&&We(this,No)<=We(this,Po)&&await sn(this,Br,Sx).call(this),We(this,ns).length===0)throw new Error("No coins available");return We(this,ns).shift()};Ld=async function(){if((We(this,_i)?We(this,_i).expiration-We(this,Ja)-Date.now():0)>0)return We(this,_i).price;if(We(this,_i)){const r=Math.max(We(this,_i).expiration+We(this,Ja)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await We(this,Xn).getLatestSuiSystemState();return rr(this,_i,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),sn(this,Br,Ld).call(this)};Sx=async function(){var u;const e=Math.min(We(this,Ou),We(this,Po)-(We(this,ns).length+We(this,No))+1);if(e===0)return;const t=new IP.Transaction,r=We(this,rs).toSuiAddress();if(t.setSender(r),We(this,kr)){const l=[],f=[];for(const[h,y]of We(this,kr))y?l.push(y):f.push(h);if(f.length>0){const h=await We(this,Xn).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),rr(this,kr,new Map)}const n=new Array(e).fill(We(this,Ka)),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 We(this,Xn).signAndExecuteTransaction({transaction:t,signer:We(this,rs),options:{showRawEffects:!0}}),a=yx.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||We(this,ns).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(We(this,Ka))})}),We(this,kr)||rr(this,kr,new Map);const c=(0,bx.getGasCoinFromEffects)(a).ref;We(this,kr).set(c.objectId,c),await We(this,Xn).waitForTransaction({digest:o.digest})};function RP(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var Np=Object.defineProperty,NP=Object.getOwnPropertyDescriptor,DP=Object.getOwnPropertyNames,$P=Object.prototype.hasOwnProperty,BP=(e,t)=>{for(var r in t)Np(e,r,{get:t[r],enumerable:!0})},LP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of DP(t))!$P.call(e,i)&&i!==r&&Np(e,i,{get:()=>t[i],enumerable:!(n=NP(t,i))||n.enumerable});return e},FP=e=>LP(Np({},"__esModule",{value:!0}),e),Ex={};BP(Ex,{coinWithBalance:()=>qP});var UP=FP(Ex),ru=ps,zP=si,Cx=Jr,nu=hp,Mm=al,VP=$_;const Pu="CoinWithBalance",Tm=(0,Cx.normalizeStructTag)("0x2::sui::SUI");function qP({type:e=Tm,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(Pu,GP);const i=e==="gas"?e:(0,Cx.normalizeStructTag)(e);return n.add(nu.Commands.Intent({name:Pu,inputs:{},data:{type:i===Tm&&r?"gas":i,balance:BigInt(t)}}))}}const WP=(0,ru.object)({type:(0,ru.string)(),balance:(0,ru.bigint)()});async function GP(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===Pu){const{type:h,balance:y}=(0,ru.parse)(WP,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,VP.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await HP({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!==Pu)continue;const{type:y,balance:b}=h.$Intent.data;if(b===0n){e.replaceCommand(f,nu.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const w=[];if(!c.has(y)){const[A,...P]=o.get(y).map(R=>e.addInput("object",Mm.Inputs.ObjectRef({objectId:R.coinObjectId,digest:R.digest,version:R.version})));P.length>0&&w.push(nu.Commands.MergeCoins(A,P)),c.set(y,A)}w.push(nu.Commands.SplitCoins(c.get(y),[e.addInput("pure",Mm.Inputs.Pure(zP.bcs.u64().serialize(b)))])),e.replaceCommand(f,w),e.mapArguments(A=>A.$kind==="Result"&&A.Result===f?{$kind:"NestedResult",NestedResult:[f+w.length-1,0]}:A)}return r()}async function HP({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 Dp=Object.defineProperty,KP=Object.getOwnPropertyDescriptor,JP=Object.getOwnPropertyNames,XP=Object.prototype.hasOwnProperty,YP=(e,t)=>{for(var r in t)Dp(e,r,{get:t[r],enumerable:!0})},ZP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of JP(t))!XP.call(e,i)&&i!==r&&Dp(e,i,{get:()=>t[i],enumerable:!(n=KP(t,i))||n.enumerable});return e},QP=e=>ZP(Dp({},"__esModule",{value:!0}),e),Mx={};YP(Mx,{Arguments:()=>n7});var e7=QP(Mx),t7=L_,r7=U_;const n7={pure:(0,r7.createPure)(e=>t=>t.pure(e)),object:(0,t7.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 $p=Object.defineProperty,i7=Object.getOwnPropertyDescriptor,s7=Object.getOwnPropertyNames,o7=Object.prototype.hasOwnProperty,a7=(e,t)=>{for(var r in t)$p(e,r,{get:t[r],enumerable:!0})},c7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of s7(t))!o7.call(e,i)&&i!==r&&$p(e,i,{get:()=>t[i],enumerable:!(n=i7(t,i))||n.enumerable});return e},u7=e=>c7($p({},"__esModule",{value:!0}),e),Tx={};a7(Tx,{findTransactionBlockNames:()=>f7,listToRequests:()=>h7,replaceNames:()=>d7});var l7=u7(Tx),Ax=f_;const xo="/",f7=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){Am([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(xo)){if(!(0,Ax.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}Am(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function Am(e){const t=new Set;for(const r of e)if(r.includes(xo)){if(!(0,Ax.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const d7=(e,t)=>{var r;for(const n of e.commands){if((r=n.MakeMoveVec)!=null&&r.type){if(!n.MakeMoveVec.type.includes(xo))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(xo)&&!t.packages[o])throw new Error(`No address found for package: ${o}`);o.includes(xo)&&(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(xo)){if(!t.types[a[c]])throw new Error(`No resolution found for type: ${a[c]}`);a[c]=t.types[a[c]]}i.typeArguments=a}}},h7=(e,t)=>{const r=[],n=Om(e.packages),i=Om(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 p7(r,t)},Om=e=>[...new Set(e)],p7=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var Bp=Object.defineProperty,m7=Object.getOwnPropertyDescriptor,g7=Object.getOwnPropertyNames,v7=Object.prototype.hasOwnProperty,y7=(e,t)=>{for(var r in t)Bp(e,r,{get:t[r],enumerable:!0})},b7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of g7(t))!v7.call(e,i)&&i!==r&&Bp(e,i,{get:()=>t[i],enumerable:!(n=m7(t,i))||n.enumerable});return e},w7=e=>b7(Bp({},"__esModule",{value:!0}),e),Ox={};y7(Ox,{namedPackagesPlugin:()=>x7});var _7=w7(Ox),Mf=l7;const x7=({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,Mf.findTransactionBlockNames)(s),u=(0,Mf.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,Mf.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`${Im(l.id)}: ${f}(name:"${l.name}") {
|
|
26
26
|
${h}
|
|
27
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=
|
|
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=Im(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}},Im=e=>`key_${e}`;var Lp=Object.defineProperty,S7=Object.getOwnPropertyDescriptor,E7=Object.getOwnPropertyNames,C7=Object.prototype.hasOwnProperty,M7=(e,t)=>{for(var r in t)Lp(e,r,{get:t[r],enumerable:!0})},T7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of E7(t))!C7.call(e,i)&&i!==r&&Lp(e,i,{get:()=>t[i],enumerable:!(n=S7(t,i))||n.enumerable});return e},A7=e=>T7(Lp({},"__esModule",{value:!0}),e),Ix={};M7(Ix,{Arguments:()=>R7.Arguments,AsyncCache:()=>Rm.AsyncCache,Commands:()=>jm.Commands,Inputs:()=>O7.Inputs,ObjectCache:()=>Rm.ObjectCache,ParallelTransactionExecutor:()=>j7.ParallelTransactionExecutor,SerialTransactionExecutor:()=>P7.SerialTransactionExecutor,Transaction:()=>km.Transaction,TransactionDataBuilder:()=>I7.TransactionDataBuilder,UpgradePolicy:()=>jm.UpgradePolicy,coinWithBalance:()=>k7.coinWithBalance,getPureBcsSchema:()=>Pm.getPureBcsSchema,isTransaction:()=>km.isTransaction,namedPackagesPlugin:()=>N7.namedPackagesPlugin,normalizedTypeToMoveTypeSignature:()=>Pm.normalizedTypeToMoveTypeSignature});var So=A7(Ix),Pm=b_,O7=al,jm=hp,km=ul,I7=_p,Rm=ex,P7=px,j7=AP,k7=UP,R7=e7,N7=_7,Px={},ll={},Fp={},fl={},Up={},dl={};Object.defineProperty(dl,"__esModule",{value:!0});dl.Convert=void 0;class D7{static toPriceFeed(t){return Tf(t,xi("PriceFeed"))}static priceFeedToJson(t){return Af(t,xi("PriceFeed"))}static toPrice(t){return Tf(t,xi("Price"))}static priceToJson(t){return Af(t,xi("Price"))}static toPriceFeedMetadata(t){return Tf(t,xi("PriceFeedMetadata"))}static priceFeedMetadataToJson(t){return Af(t,xi("PriceFeedMetadata"))}}dl.Convert=D7;function gi(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 $7(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 B7(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 Eo(e,t,r,n=""){function i(l,f){return typeof l==typeof f?f:gi(l,f,n)}function s(l,f){const h=l.length;for(let y=0;y<h;y++){const b=l[y];try{return Eo(f,b,r)}catch{}}return gi(l,f)}function o(l,f){return l.indexOf(f)!==-1?f:gi(l,f)}function a(l,f){return Array.isArray(f)?f.map(h=>Eo(h,l,r)):gi("array",f)}function c(l){if(l===null)return null;const f=new Date(l);return isNaN(f.valueOf())?gi("Date",l):f}function u(l,f,h){if(h===null||typeof h!="object"||Array.isArray(h))return gi("object",h);const y={};return Object.getOwnPropertyNames(l).forEach(b=>{const w=l[b],A=Object.prototype.hasOwnProperty.call(h,b)?h[b]:void 0;y[w.key]=Eo(A,w.typ,r,w.key)}),Object.getOwnPropertyNames(h).forEach(b=>{Object.prototype.hasOwnProperty.call(l,b)||(y[b]=Eo(h[b],f,r,b))}),y}if(t==="any")return e;if(t===null)return e===null?e:gi(t,e);if(t===!1)return gi(t,e);for(;typeof t=="object"&&t.ref!==void 0;)t=L7[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):gi(t,e):t===Date&&typeof e!="number"?c(e):i(t,e)}function Tf(e,t){return Eo(e,t,$7)}function Af(e,t){return Eo(e,t,B7)}function xs(...e){return{unionMembers:e}}function Of(e,t){return{props:e,additional:t}}function xi(e){return{ref:e}}const L7={PriceFeed:Of([{json:"ema_price",js:"ema_price",typ:xi("Price")},{json:"id",js:"id",typ:""},{json:"metadata",js:"metadata",typ:xs(void 0,xi("PriceFeedMetadata"))},{json:"price",js:"price",typ:xi("Price")},{json:"vaa",js:"vaa",typ:xs(void 0,"")}],"any"),Price:Of([{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:Of([{json:"attestation_time",js:"attestation_time",typ:xs(void 0,0)},{json:"emitter_chain",js:"emitter_chain",typ:0},{json:"prev_publish_time",js:"prev_publish_time",typ:xs(void 0,0)},{json:"price_service_receive_time",js:"price_service_receive_time",typ:xs(void 0,0)},{json:"sequence_number",js:"sequence_number",typ:xs(void 0,0)},{json:"slot",js:"slot",typ:xs(void 0,0)}],"any")};var If={},Nm;function hl(){return Nm||(Nm=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(R){var N=R.length;if(N%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=R.indexOf("=");F===-1&&(F=N);var L=F===N?0:4-F%4;return[F,L]}function l(R){var N=u(R),F=N[0],L=N[1];return(F+L)*3/4-L}function f(R,N,F){return(N+F)*3/4-F}function h(R){var N,F=u(R),L=F[0],G=F[1],q=new s(f(R,L,G)),J=0,ne=G>0?L-4:L,ae;for(ae=0;ae<ne;ae+=4)N=i[R.charCodeAt(ae)]<<18|i[R.charCodeAt(ae+1)]<<12|i[R.charCodeAt(ae+2)]<<6|i[R.charCodeAt(ae+3)],q[J++]=N>>16&255,q[J++]=N>>8&255,q[J++]=N&255;return G===2&&(N=i[R.charCodeAt(ae)]<<2|i[R.charCodeAt(ae+1)]>>4,q[J++]=N&255),G===1&&(N=i[R.charCodeAt(ae)]<<10|i[R.charCodeAt(ae+1)]<<4|i[R.charCodeAt(ae+2)]>>2,q[J++]=N>>8&255,q[J++]=N&255),q}function y(R){return n[R>>18&63]+n[R>>12&63]+n[R>>6&63]+n[R&63]}function b(R,N,F){for(var L,G=[],q=N;q<F;q+=3)L=(R[q]<<16&16711680)+(R[q+1]<<8&65280)+(R[q+2]&255),G.push(y(L));return G.join("")}function w(R){for(var N,F=R.length,L=F%3,G=[],q=16383,J=0,ne=F-L;J<ne;J+=q)G.push(b(R,J,J+q>ne?ne:J+q));return L===1?(N=R[F-1],G.push(n[N>>2]+n[N<<4&63]+"==")):L===2&&(N=(R[F-2]<<8)+R[F-1],G.push(n[N>>10]+n[N>>4&63]+n[N<<2&63]+"=")),G.join("")}var A={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */A.read=function(R,N,F,L,G){var q,J,ne=G*8-L-1,ae=(1<<ne)-1,ce=ae>>1,V=-7,$=F?G-1:0,p=F?-1:1,d=R[N+$];for($+=p,q=d&(1<<-V)-1,d>>=-V,V+=ne;V>0;q=q*256+R[N+$],$+=p,V-=8);for(J=q&(1<<-V)-1,q>>=-V,V+=L;V>0;J=J*256+R[N+$],$+=p,V-=8);if(q===0)q=1-ce;else{if(q===ae)return J?NaN:(d?-1:1)*(1/0);J=J+Math.pow(2,L),q=q-ce}return(d?-1:1)*J*Math.pow(2,q-L)},A.write=function(R,N,F,L,G,q){var J,ne,ae,ce=q*8-G-1,V=(1<<ce)-1,$=V>>1,p=G===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=L?0:q-1,m=L?1:-1,x=N<0||N===0&&1/N<0?1:0;for(N=Math.abs(N),isNaN(N)||N===1/0?(ne=isNaN(N)?1:0,J=V):(J=Math.floor(Math.log(N)/Math.LN2),N*(ae=Math.pow(2,-J))<1&&(J--,ae*=2),J+$>=1?N+=p/ae:N+=p*Math.pow(2,1-$),N*ae>=2&&(J++,ae/=2),J+$>=V?(ne=0,J=V):J+$>=1?(ne=(N*ae-1)*Math.pow(2,G),J=J+$):(ne=N*Math.pow(2,$-1)*Math.pow(2,G),J=0));G>=8;R[F+d]=ne&255,d+=m,ne/=256,G-=8);for(J=J<<G|ne,ce+=G;ce>0;R[F+d]=J&255,d+=m,J/=256,ce-=8);R[F+d-m]|=x*128};/*!
|
|
29
29
|
* The buffer module from node.js, for the browser.
|
|
30
30
|
*
|
|
31
31
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
32
32
|
* @license MIT
|
|
33
|
-
*/(function(R){const N=r,F=A,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;R.Buffer=V,R.SlowBuffer=v,R.INSPECT_MAX_BYTES=50;const G=2147483647;R.kMaxLength=G;const{Uint8Array:q,ArrayBuffer:J,SharedArrayBuffer:ne}=globalThis;V.TYPED_ARRAY_SUPPORT=ae(),!V.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 k=new q(1),S={foo:function(){return 42}};return Object.setPrototypeOf(S,q.prototype),Object.setPrototypeOf(k,S),k.foo()===42}catch{return!1}}Object.defineProperty(V.prototype,"parent",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.buffer}}),Object.defineProperty(V.prototype,"offset",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.byteOffset}});function ce(k){if(k>G)throw new RangeError('The value "'+k+'" is invalid for option "size"');const S=new q(k);return Object.setPrototypeOf(S,V.prototype),S}function V(k,S,T){if(typeof k=="number"){if(typeof S=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(k)}return $(k,S,T)}V.poolSize=8192;function $(k,S,T){if(typeof k=="string")return x(k,S);if(J.isView(k))return E(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(gt(k,J)||k&>(k.buffer,J)||typeof ne<"u"&&(gt(k,ne)||k&>(k.buffer,ne)))return O(k,S,T);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const B=k.valueOf&&k.valueOf();if(B!=null&&B!==k)return V.from(B,S,T);const K=C(k);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return V.from(k[Symbol.toPrimitive]("string"),S,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}V.from=function(k,S,T){return $(k,S,T)},Object.setPrototypeOf(V.prototype,q.prototype),Object.setPrototypeOf(V,q);function p(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function d(k,S,T){return p(k),k<=0?ce(k):S!==void 0?typeof T=="string"?ce(k).fill(S,T):ce(k).fill(S):ce(k)}V.alloc=function(k,S,T){return d(k,S,T)};function m(k){return p(k),ce(k<0?0:g(k)|0)}V.allocUnsafe=function(k){return m(k)},V.allocUnsafeSlow=function(k){return m(k)};function x(k,S){if((typeof S!="string"||S==="")&&(S="utf8"),!V.isEncoding(S))throw new TypeError("Unknown encoding: "+S);const T=j(k,S)|0;let B=ce(T);const K=B.write(k,S);return K!==T&&(B=B.slice(0,K)),B}function M(k){const S=k.length<0?0:g(k.length)|0,T=ce(S);for(let B=0;B<S;B+=1)T[B]=k[B]&255;return T}function E(k){if(gt(k,q)){const S=new q(k);return O(S.buffer,S.byteOffset,S.byteLength)}return M(k)}function O(k,S,T){if(S<0||k.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(k.byteLength<S+(T||0))throw new RangeError('"length" is outside of buffer bounds');let B;return S===void 0&&T===void 0?B=new q(k):T===void 0?B=new q(k,S):B=new q(k,S,T),Object.setPrototypeOf(B,V.prototype),B}function C(k){if(V.isBuffer(k)){const S=g(k.length)|0,T=ce(S);return T.length===0||k.copy(T,0,0,S),T}if(k.length!==void 0)return typeof k.length!="number"||Pt(k.length)?ce(0):M(k);if(k.type==="Buffer"&&Array.isArray(k.data))return M(k.data)}function g(k){if(k>=G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");return k|0}function v(k){return+k!=k&&(k=0),V.alloc(+k)}V.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==V.prototype},V.compare=function(S,T){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),gt(T,q)&&(T=V.from(T,T.offset,T.byteLength)),!V.isBuffer(S)||!V.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===T)return 0;let B=S.length,K=T.length;for(let Z=0,te=Math.min(B,K);Z<te;++Z)if(S[Z]!==T[Z]){B=S[Z],K=T[Z];break}return B<K?-1:K<B?1:0},V.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}},V.concat=function(S,T){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return V.alloc(0);let B;if(T===void 0)for(T=0,B=0;B<S.length;++B)T+=S[B].length;const K=V.allocUnsafe(T);let Z=0;for(B=0;B<S.length;++B){let te=S[B];if(gt(te,q))Z+te.length>K.length?(V.isBuffer(te)||(te=V.from(te)),te.copy(K,Z)):q.prototype.set.call(K,te,Z);else if(V.isBuffer(te))te.copy(K,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=te.length}return K};function j(k,S){if(V.isBuffer(k))return k.length;if(J.isView(k)||gt(k,J))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const T=k.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&T===0)return 0;let K=!1;for(;;)switch(S){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return It(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return Ct(k).length;default:if(K)return B?-1:It(k).length;S=(""+S).toLowerCase(),K=!0}}V.byteLength=j;function ee(k,S,T){let B=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,S>>>=0,T<=S))return"";for(k||(k="utf8");;)switch(k){case"hex":return qe(this,S,T);case"utf8":case"utf-8":return $e(this,S,T);case"ascii":return ge(this,S,T);case"latin1":case"binary":return Ae(this,S,T);case"base64":return ht(this,S,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,S,T);default:if(B)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),B=!0}}V.prototype._isBuffer=!0;function ie(k,S,T){const B=k[S];k[S]=k[T],k[T]=B}V.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 T=0;T<S;T+=2)ie(this,T,T+1);return this},V.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 T=0;T<S;T+=4)ie(this,T,T+3),ie(this,T+1,T+2);return this},V.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 T=0;T<S;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},V.prototype.toString=function(){const S=this.length;return S===0?"":arguments.length===0?$e(this,0,S):ee.apply(this,arguments)},V.prototype.toLocaleString=V.prototype.toString,V.prototype.equals=function(S){if(!V.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:V.compare(this,S)===0},V.prototype.inspect=function(){let S="";const T=R.INSPECT_MAX_BYTES;return S=this.toString("hex",0,T).replace(/(.{2})/g,"$1 ").trim(),this.length>T&&(S+=" ... "),"<Buffer "+S+">"},L&&(V.prototype[L]=V.prototype.inspect),V.prototype.compare=function(S,T,B,K,Z){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),!V.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(T===void 0&&(T=0),B===void 0&&(B=S?S.length:0),K===void 0&&(K=0),Z===void 0&&(Z=this.length),T<0||B>S.length||K<0||Z>this.length)throw new RangeError("out of range index");if(K>=Z&&T>=B)return 0;if(K>=Z)return-1;if(T>=B)return 1;if(T>>>=0,B>>>=0,K>>>=0,Z>>>=0,this===S)return 0;let te=Z-K,Be=B-T;const tt=Math.min(te,Be),Ne=this.slice(K,Z),z=S.slice(T,B);for(let oe=0;oe<tt;++oe)if(Ne[oe]!==z[oe]){te=Ne[oe],Be=z[oe];break}return te<Be?-1:Be<te?1:0};function ve(k,S,T,B,K){if(k.length===0)return-1;if(typeof T=="string"?(B=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,Pt(T)&&(T=K?0:k.length-1),T<0&&(T=k.length+T),T>=k.length){if(K)return-1;T=k.length-1}else if(T<0)if(K)T=0;else return-1;if(typeof S=="string"&&(S=V.from(S,B)),V.isBuffer(S))return S.length===0?-1:pe(k,S,T,B,K);if(typeof S=="number")return S=S&255,typeof q.prototype.indexOf=="function"?K?q.prototype.indexOf.call(k,S,T):q.prototype.lastIndexOf.call(k,S,T):pe(k,[S],T,B,K);throw new TypeError("val must be string, number or Buffer")}function pe(k,S,T,B,K){let Z=1,te=k.length,Be=S.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(k.length<2||S.length<2)return-1;Z=2,te/=2,Be/=2,T/=2}function tt(z,oe){return Z===1?z[oe]:z.readUInt16BE(oe*Z)}let Ne;if(K){let z=-1;for(Ne=T;Ne<te;Ne++)if(tt(k,Ne)===tt(S,z===-1?0:Ne-z)){if(z===-1&&(z=Ne),Ne-z+1===Be)return z*Z}else z!==-1&&(Ne-=Ne-z),z=-1}else for(T+Be>te&&(T=te-Be),Ne=T;Ne>=0;Ne--){let z=!0;for(let oe=0;oe<Be;oe++)if(tt(k,Ne+oe)!==tt(S,oe)){z=!1;break}if(z)return Ne}return-1}V.prototype.includes=function(S,T,B){return this.indexOf(S,T,B)!==-1},V.prototype.indexOf=function(S,T,B){return ve(this,S,T,B,!0)},V.prototype.lastIndexOf=function(S,T,B){return ve(this,S,T,B,!1)};function Ee(k,S,T,B){T=Number(T)||0;const K=k.length-T;B?(B=Number(B),B>K&&(B=K)):B=K;const Z=S.length;B>Z/2&&(B=Z/2);let te;for(te=0;te<B;++te){const Be=parseInt(S.substr(te*2,2),16);if(Pt(Be))return te;k[T+te]=Be}return te}function Se(k,S,T,B){return Ye(It(S,k.length-T),k,T,B)}function Ke(k,S,T,B){return Ye(it(S),k,T,B)}function Ue(k,S,T,B){return Ye(Ct(S),k,T,B)}function lt(k,S,T,B){return Ye(bt(S,k.length-T),k,T,B)}V.prototype.write=function(S,T,B,K){if(T===void 0)K="utf8",B=this.length,T=0;else if(B===void 0&&typeof T=="string")K=T,B=this.length,T=0;else if(isFinite(T))T=T>>>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-T;if((B===void 0||B>Z)&&(B=Z),S.length>0&&(B<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");K||(K="utf8");let te=!1;for(;;)switch(K){case"hex":return Ee(this,S,T,B);case"utf8":case"utf-8":return Se(this,S,T,B);case"ascii":case"latin1":case"binary":return Ke(this,S,T,B);case"base64":return Ue(this,S,T,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lt(this,S,T,B);default:if(te)throw new TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),te=!0}},V.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ht(k,S,T){return S===0&&T===k.length?N.fromByteArray(k):N.fromByteArray(k.slice(S,T))}function $e(k,S,T){T=Math.min(k.length,T);const B=[];let K=S;for(;K<T;){const Z=k[K];let te=null,Be=Z>239?4:Z>223?3:Z>191?2:1;if(K+Be<=T){let tt,Ne,z,oe;switch(Be){case 1:Z<128&&(te=Z);break;case 2:tt=k[K+1],(tt&192)===128&&(oe=(Z&31)<<6|tt&63,oe>127&&(te=oe));break;case 3:tt=k[K+1],Ne=k[K+2],(tt&192)===128&&(Ne&192)===128&&(oe=(Z&15)<<12|(tt&63)<<6|Ne&63,oe>2047&&(oe<55296||oe>57343)&&(te=oe));break;case 4:tt=k[K+1],Ne=k[K+2],z=k[K+3],(tt&192)===128&&(Ne&192)===128&&(z&192)===128&&(oe=(Z&15)<<18|(tt&63)<<12|(Ne&63)<<6|z&63,oe>65535&&oe<1114112&&(te=oe))}}te===null?(te=65533,Be=1):te>65535&&(te-=65536,B.push(te>>>10&1023|55296),te=56320|te&1023),B.push(te),K+=Be}return _e(B)}const mt=4096;function _e(k){const S=k.length;if(S<=mt)return String.fromCharCode.apply(String,k);let T="",B=0;for(;B<S;)T+=String.fromCharCode.apply(String,k.slice(B,B+=mt));return T}function ge(k,S,T){let B="";T=Math.min(k.length,T);for(let K=S;K<T;++K)B+=String.fromCharCode(k[K]&127);return B}function Ae(k,S,T){let B="";T=Math.min(k.length,T);for(let K=S;K<T;++K)B+=String.fromCharCode(k[K]);return B}function qe(k,S,T){const B=k.length;(!S||S<0)&&(S=0),(!T||T<0||T>B)&&(T=B);let K="";for(let Z=S;Z<T;++Z)K+=ot[k[Z]];return K}function De(k,S,T){const B=k.slice(S,T);let K="";for(let Z=0;Z<B.length-1;Z+=2)K+=String.fromCharCode(B[Z]+B[Z+1]*256);return K}V.prototype.slice=function(S,T){const B=this.length;S=~~S,T=T===void 0?B:~~T,S<0?(S+=B,S<0&&(S=0)):S>B&&(S=B),T<0?(T+=B,T<0&&(T=0)):T>B&&(T=B),T<S&&(T=S);const K=this.subarray(S,T);return Object.setPrototypeOf(K,V.prototype),K};function Oe(k,S,T){if(k%1!==0||k<0)throw new RangeError("offset is not uint");if(k+S>T)throw new RangeError("Trying to access beyond buffer length")}V.prototype.readUintLE=V.prototype.readUIntLE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S],Z=1,te=0;for(;++te<T&&(Z*=256);)K+=this[S+te]*Z;return K},V.prototype.readUintBE=V.prototype.readUIntBE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S+--T],Z=1;for(;T>0&&(Z*=256);)K+=this[S+--T]*Z;return K},V.prototype.readUint8=V.prototype.readUInt8=function(S,T){return S=S>>>0,T||Oe(S,1,this.length),this[S]},V.prototype.readUint16LE=V.prototype.readUInt16LE=function(S,T){return S=S>>>0,T||Oe(S,2,this.length),this[S]|this[S+1]<<8},V.prototype.readUint16BE=V.prototype.readUInt16BE=function(S,T){return S=S>>>0,T||Oe(S,2,this.length),this[S]<<8|this[S+1]},V.prototype.readUint32LE=V.prototype.readUInt32LE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},V.prototype.readUint32BE=V.prototype.readUInt32BE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},V.prototype.readBigUInt64LE=wt(function(S){S=S>>>0,St(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&At(S,this.length-8);const K=T+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))}),V.prototype.readBigUInt64BE=wt(function(S){S=S>>>0,St(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&At(S,this.length-8);const K=T*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)}),V.prototype.readIntLE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S],Z=1,te=0;for(;++te<T&&(Z*=256);)K+=this[S+te]*Z;return Z*=128,K>=Z&&(K-=Math.pow(2,8*T)),K},V.prototype.readIntBE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=T,Z=1,te=this[S+--K];for(;K>0&&(Z*=256);)te+=this[S+--K]*Z;return Z*=128,te>=Z&&(te-=Math.pow(2,8*T)),te},V.prototype.readInt8=function(S,T){return S=S>>>0,T||Oe(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},V.prototype.readInt16LE=function(S,T){S=S>>>0,T||Oe(S,2,this.length);const B=this[S]|this[S+1]<<8;return B&32768?B|4294901760:B},V.prototype.readInt16BE=function(S,T){S=S>>>0,T||Oe(S,2,this.length);const B=this[S+1]|this[S]<<8;return B&32768?B|4294901760:B},V.prototype.readInt32LE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},V.prototype.readInt32BE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},V.prototype.readBigInt64LE=wt(function(S){S=S>>>0,St(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&At(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(T+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24)}),V.prototype.readBigInt64BE=wt(function(S){S=S>>>0,St(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&At(S,this.length-8);const K=(T<<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)}),V.prototype.readFloatLE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),F.read(this,S,!0,23,4)},V.prototype.readFloatBE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),F.read(this,S,!1,23,4)},V.prototype.readDoubleLE=function(S,T){return S=S>>>0,T||Oe(S,8,this.length),F.read(this,S,!0,52,8)},V.prototype.readDoubleBE=function(S,T){return S=S>>>0,T||Oe(S,8,this.length),F.read(this,S,!1,52,8)};function Ie(k,S,T,B,K,Z){if(!V.isBuffer(k))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(T+B>k.length)throw new RangeError("Index out of range")}V.prototype.writeUintLE=V.prototype.writeUIntLE=function(S,T,B,K){if(S=+S,T=T>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,T,B,Be,0)}let Z=1,te=0;for(this[T]=S&255;++te<B&&(Z*=256);)this[T+te]=S/Z&255;return T+B},V.prototype.writeUintBE=V.prototype.writeUIntBE=function(S,T,B,K){if(S=+S,T=T>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,T,B,Be,0)}let Z=B-1,te=1;for(this[T+Z]=S&255;--Z>=0&&(te*=256);)this[T+Z]=S/te&255;return T+B},V.prototype.writeUint8=V.prototype.writeUInt8=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,1,255,0),this[T]=S&255,T+1},V.prototype.writeUint16LE=V.prototype.writeUInt16LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,65535,0),this[T]=S&255,this[T+1]=S>>>8,T+2},V.prototype.writeUint16BE=V.prototype.writeUInt16BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,65535,0),this[T]=S>>>8,this[T+1]=S&255,T+2},V.prototype.writeUint32LE=V.prototype.writeUInt32LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,4294967295,0),this[T+3]=S>>>24,this[T+2]=S>>>16,this[T+1]=S>>>8,this[T]=S&255,T+4},V.prototype.writeUint32BE=V.prototype.writeUInt32BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,4294967295,0),this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=S&255,T+4};function Fe(k,S,T,B,K){nt(S,B,K,k,T,7);let Z=Number(S&BigInt(4294967295));k[T++]=Z,Z=Z>>8,k[T++]=Z,Z=Z>>8,k[T++]=Z,Z=Z>>8,k[T++]=Z;let te=Number(S>>BigInt(32)&BigInt(4294967295));return k[T++]=te,te=te>>8,k[T++]=te,te=te>>8,k[T++]=te,te=te>>8,k[T++]=te,T}function ft(k,S,T,B,K){nt(S,B,K,k,T,7);let Z=Number(S&BigInt(4294967295));k[T+7]=Z,Z=Z>>8,k[T+6]=Z,Z=Z>>8,k[T+5]=Z,Z=Z>>8,k[T+4]=Z;let te=Number(S>>BigInt(32)&BigInt(4294967295));return k[T+3]=te,te=te>>8,k[T+2]=te,te=te>>8,k[T+1]=te,te=te>>8,k[T]=te,T+8}V.prototype.writeBigUInt64LE=wt(function(S,T=0){return Fe(this,S,T,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeBigUInt64BE=wt(function(S,T=0){return ft(this,S,T,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeIntLE=function(S,T,B,K){if(S=+S,T=T>>>0,!K){const tt=Math.pow(2,8*B-1);Ie(this,S,T,B,tt-1,-tt)}let Z=0,te=1,Be=0;for(this[T]=S&255;++Z<B&&(te*=256);)S<0&&Be===0&&this[T+Z-1]!==0&&(Be=1),this[T+Z]=(S/te>>0)-Be&255;return T+B},V.prototype.writeIntBE=function(S,T,B,K){if(S=+S,T=T>>>0,!K){const tt=Math.pow(2,8*B-1);Ie(this,S,T,B,tt-1,-tt)}let Z=B-1,te=1,Be=0;for(this[T+Z]=S&255;--Z>=0&&(te*=256);)S<0&&Be===0&&this[T+Z+1]!==0&&(Be=1),this[T+Z]=(S/te>>0)-Be&255;return T+B},V.prototype.writeInt8=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,1,127,-128),S<0&&(S=255+S+1),this[T]=S&255,T+1},V.prototype.writeInt16LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,32767,-32768),this[T]=S&255,this[T+1]=S>>>8,T+2},V.prototype.writeInt16BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,32767,-32768),this[T]=S>>>8,this[T+1]=S&255,T+2},V.prototype.writeInt32LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,2147483647,-2147483648),this[T]=S&255,this[T+1]=S>>>8,this[T+2]=S>>>16,this[T+3]=S>>>24,T+4},V.prototype.writeInt32BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=S&255,T+4},V.prototype.writeBigInt64LE=wt(function(S,T=0){return Fe(this,S,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),V.prototype.writeBigInt64BE=wt(function(S,T=0){return ft(this,S,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function dt(k,S,T,B,K,Z){if(T+B>k.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function Ge(k,S,T,B,K){return S=+S,T=T>>>0,K||dt(k,S,T,4),F.write(k,S,T,B,23,4),T+4}V.prototype.writeFloatLE=function(S,T,B){return Ge(this,S,T,!0,B)},V.prototype.writeFloatBE=function(S,T,B){return Ge(this,S,T,!1,B)};function jt(k,S,T,B,K){return S=+S,T=T>>>0,K||dt(k,S,T,8),F.write(k,S,T,B,52,8),T+8}V.prototype.writeDoubleLE=function(S,T,B){return jt(this,S,T,!0,B)},V.prototype.writeDoubleBE=function(S,T,B){return jt(this,S,T,!1,B)},V.prototype.copy=function(S,T,B,K){if(!V.isBuffer(S))throw new TypeError("argument should be a Buffer");if(B||(B=0),!K&&K!==0&&(K=this.length),T>=S.length&&(T=S.length),T||(T=0),K>0&&K<B&&(K=B),K===B||S.length===0||this.length===0)return 0;if(T<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-T<K-B&&(K=S.length-T+B);const Z=K-B;return this===S&&typeof q.prototype.copyWithin=="function"?this.copyWithin(T,B,K):q.prototype.set.call(S,this.subarray(B,K),T),Z},V.prototype.fill=function(S,T,B,K){if(typeof S=="string"){if(typeof T=="string"?(K=T,T=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"&&!V.isEncoding(K))throw new TypeError("Unknown encoding: "+K);if(S.length===1){const te=S.charCodeAt(0);(K==="utf8"&&te<128||K==="latin1")&&(S=te)}}else typeof S=="number"?S=S&255:typeof S=="boolean"&&(S=Number(S));if(T<0||this.length<T||this.length<B)throw new RangeError("Out of range index");if(B<=T)return this;T=T>>>0,B=B===void 0?this.length:B>>>0,S||(S=0);let Z;if(typeof S=="number")for(Z=T;Z<B;++Z)this[Z]=S;else{const te=V.isBuffer(S)?S:V.from(S,K),Be=te.length;if(Be===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(Z=0;Z<B-T;++Z)this[Z+T]=te[Z%Be]}return this};const xt={};function Ze(k,S,T){xt[k]=class extends T{constructor(){super(),Object.defineProperty(this,"message",{value:S.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${k}]`,this.stack,delete this.name}get code(){return k}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${k}]: ${this.message}`}}}Ze("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ze("ERR_INVALID_ARG_TYPE",function(k,S){return`The "${k}" argument must be of type number. Received type ${typeof S}`},TypeError),Ze("ERR_OUT_OF_RANGE",function(k,S,T){let B=`The value of "${k}" is out of range.`,K=T;return Number.isInteger(T)&&Math.abs(T)>2**32?K=Tt(String(T)):typeof T=="bigint"&&(K=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(K=Tt(K)),K+="n"),B+=` It must be ${S}. Received ${K}`,B},RangeError);function Tt(k){let S="",T=k.length;const B=k[0]==="-"?1:0;for(;T>=B+4;T-=3)S=`_${k.slice(T-3,T)}${S}`;return`${k.slice(0,T)}${S}`}function Nt(k,S,T){St(S,"offset"),(k[S]===void 0||k[S+T]===void 0)&&At(S,k.length-(T+1))}function nt(k,S,T,B,K,Z){if(k>T||k<S){const te=typeof S=="bigint"?"n":"";let Be;throw Z>3?S===0||S===BigInt(0)?Be=`>= 0${te} and < 2${te} ** ${(Z+1)*8}${te}`:Be=`>= -(2${te} ** ${(Z+1)*8-1}${te}) and < 2 ** ${(Z+1)*8-1}${te}`:Be=`>= ${S}${te} and <= ${T}${te}`,new xt.ERR_OUT_OF_RANGE("value",Be,k)}Nt(B,K,Z)}function St(k,S){if(typeof k!="number")throw new xt.ERR_INVALID_ARG_TYPE(S,"number",k)}function At(k,S,T){throw Math.floor(k)!==k?(St(k,T),new xt.ERR_OUT_OF_RANGE(T||"offset","an integer",k)):S<0?new xt.ERR_BUFFER_OUT_OF_BOUNDS:new xt.ERR_OUT_OF_RANGE(T||"offset",`>= ${T?1:0} and <= ${S}`,k)}const st=/[^+/0-9A-Za-z-_]/g;function kt(k){if(k=k.split("=")[0],k=k.trim().replace(st,""),k.length<2)return"";for(;k.length%4!==0;)k=k+"=";return k}function It(k,S){S=S||1/0;let T;const B=k.length;let K=null;const Z=[];for(let te=0;te<B;++te){if(T=k.charCodeAt(te),T>55295&&T<57344){if(!K){if(T>56319){(S-=3)>-1&&Z.push(239,191,189);continue}else if(te+1===B){(S-=3)>-1&&Z.push(239,191,189);continue}K=T;continue}if(T<56320){(S-=3)>-1&&Z.push(239,191,189),K=T;continue}T=(K-55296<<10|T-56320)+65536}else K&&(S-=3)>-1&&Z.push(239,191,189);if(K=null,T<128){if((S-=1)<0)break;Z.push(T)}else if(T<2048){if((S-=2)<0)break;Z.push(T>>6|192,T&63|128)}else if(T<65536){if((S-=3)<0)break;Z.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((S-=4)<0)break;Z.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return Z}function it(k){const S=[];for(let T=0;T<k.length;++T)S.push(k.charCodeAt(T)&255);return S}function bt(k,S){let T,B,K;const Z=[];for(let te=0;te<k.length&&!((S-=2)<0);++te)T=k.charCodeAt(te),B=T>>8,K=T%256,Z.push(K),Z.push(B);return Z}function Ct(k){return N.toByteArray(kt(k))}function Ye(k,S,T,B){let K;for(K=0;K<B&&!(K+T>=S.length||K>=k.length);++K)S[K+T]=k[K];return K}function gt(k,S){return k instanceof S||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===S.name}function Pt(k){return k!==k}const ot=function(){const k="0123456789abcdef",S=new Array(256);for(let T=0;T<16;++T){const B=T*16;for(let K=0;K<16;++K)S[B+K]=k[T]+k[K]}return S}();function wt(k){return typeof BigInt>"u"?Ft:k}function Ft(){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}(Tf)),Tf}var B7=dl();const $d=dc(B7);var on={},Lp={exports:{}};Lp.exports;(function(e){(function(t,r){function n($,p){if(!$)throw new Error(p||"Assertion failed")}function i($,p){$.super_=p;var d=function(){};d.prototype=p.prototype,$.prototype=new d,$.prototype.constructor=$}function s($,p,d){if(s.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((p==="le"||p==="be")&&(d=p,p=10),this._init($||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=dl().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 M,E,O=0;if(m==="be")for(x=p.length-1,M=0;x>=0;x-=3)E=p[x]|p[x-1]<<8|p[x-2]<<16,this.words[M]|=E<<O&67108863,this.words[M+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,M++);else if(m==="le")for(x=0,M=0;x<p.length;x+=3)E=p[x]|p[x+1]<<8|p[x+2]<<16,this.words[M]|=E<<O&67108863,this.words[M+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,M++);return this._strip()};function a($,p){var 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 "+$)}function c($,p,d){var m=a($,d);return d-1>=p&&(m|=a($,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 M=0,E=0,O;if(m==="be")for(x=p.length-1;x>=d;x-=2)O=c(p,d,x)<<M,this.words[E]|=O&67108863,M>=18?(M-=18,E+=1,this.words[E]|=O>>>26):M+=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)<<M,this.words[E]|=O&67108863,M>=18?(M-=18,E+=1,this.words[E]|=O>>>26):M+=8}this._strip()};function u($,p,d,m){for(var x=0,M=0,E=Math.min($.length,d),O=p;O<E;O++){var C=$.charCodeAt(O)-48;x*=m,C>=49?M=C-49+10:C>=17?M=C-17+10:M=C,n(C>=0&&M<m,"Invalid character"),x+=M}return x}s.prototype._parseBase=function(p,d,m){this.words=[0],this.length=1;for(var x=0,M=1;M<=67108863;M*=d)x++;x--,M=M/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(M),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($,p){$.words=p.words,$.length=p.length,$.negative=p.negative,$.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,M=0,E=0;E<this.length;E++){var O=this.words[E],C=((O<<x|M)&16777215).toString(16);M=O>>>24-x&16777215,x+=2,x>=26&&(x-=26,E--),M!==0||E!==this.length-1?m=h[6-C.length]+C+m:m=C+m}for(M!==0&&(m=M.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(),M=m||Math.max(1,x);n(x<=M,"byte array longer than desired length"),n(M>0,"Requested array length <= 0");var E=w(p,M),O=d==="le"?"LE":"BE";return this["_toArrayLike"+O](E,x),E},s.prototype._toArrayLikeLE=function(p,d){for(var m=0,x=0,M=0,E=0;M<this.length;M++){var O=this.words[M]<<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,M=0,E=0;M<this.length;M++){var O=this.words[M]<<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 A($){for(var p=new Array($.bitLength()),d=0;d<p.length;d++){var m=d/26|0,x=d%26;p[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 M=0,E=0;E<x.length;E++)d=(m.words[E]|0)+(x.words[E]|0)+M,this.words[E]=d&67108863,M=d>>>26;for(;M!==0&&E<m.length;E++)d=(m.words[E]|0)+M,this.words[E]=d&67108863,M=d>>>26;if(this.length=m.length,M!==0)this.words[this.length]=M,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,M;m>0?(x=this,M=p):(x=p,M=this);for(var E=0,O=0;O<M.length;O++)d=(x.words[O]|0)-(M.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($,p,d){d.negative=p.negative^$.negative;var m=$.length+p.length|0;d.length=m,m=m-1|0;var x=$.words[0]|0,M=p.words[0]|0,E=x*M,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),ie=Math.max(0,g-$.length+1);ie<=ee;ie++){var ve=g-ie|0;x=$.words[ve]|0,M=p.words[ie]|0,E=x*M+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 R=function(p,d,m){var x=p.words,M=d.words,E=m.words,O=0,C,g,v,j=x[0]|0,ee=j&8191,ie=j>>>13,ve=x[1]|0,pe=ve&8191,Ee=ve>>>13,Se=x[2]|0,Ke=Se&8191,Ue=Se>>>13,lt=x[3]|0,ht=lt&8191,$e=lt>>>13,mt=x[4]|0,_e=mt&8191,ge=mt>>>13,Ae=x[5]|0,qe=Ae&8191,De=Ae>>>13,Oe=x[6]|0,Ie=Oe&8191,Fe=Oe>>>13,ft=x[7]|0,dt=ft&8191,Ge=ft>>>13,jt=x[8]|0,xt=jt&8191,Ze=jt>>>13,Tt=x[9]|0,Nt=Tt&8191,nt=Tt>>>13,St=M[0]|0,At=St&8191,st=St>>>13,kt=M[1]|0,It=kt&8191,it=kt>>>13,bt=M[2]|0,Ct=bt&8191,Ye=bt>>>13,gt=M[3]|0,Pt=gt&8191,ot=gt>>>13,wt=M[4]|0,Ft=wt&8191,k=wt>>>13,S=M[5]|0,T=S&8191,B=S>>>13,K=M[6]|0,Z=K&8191,te=K>>>13,Be=M[7]|0,tt=Be&8191,Ne=Be>>>13,z=M[8]|0,oe=z&8191,he=z>>>13,ke=M[9]|0,He=ke&8191,Re=ke>>>13;m.negative=p.negative^d.negative,m.length=19,C=Math.imul(ee,At),g=Math.imul(ee,st),g=g+Math.imul(ie,At)|0,v=Math.imul(ie,st);var ze=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ze>>>26)|0,ze&=67108863,C=Math.imul(pe,At),g=Math.imul(pe,st),g=g+Math.imul(Ee,At)|0,v=Math.imul(Ee,st),C=C+Math.imul(ee,It)|0,g=g+Math.imul(ee,it)|0,g=g+Math.imul(ie,It)|0,v=v+Math.imul(ie,it)|0;var at=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(at>>>26)|0,at&=67108863,C=Math.imul(Ke,At),g=Math.imul(Ke,st),g=g+Math.imul(Ue,At)|0,v=Math.imul(Ue,st),C=C+Math.imul(pe,It)|0,g=g+Math.imul(pe,it)|0,g=g+Math.imul(Ee,It)|0,v=v+Math.imul(Ee,it)|0,C=C+Math.imul(ee,Ct)|0,g=g+Math.imul(ee,Ye)|0,g=g+Math.imul(ie,Ct)|0,v=v+Math.imul(ie,Ye)|0;var Ht=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,C=Math.imul(ht,At),g=Math.imul(ht,st),g=g+Math.imul($e,At)|0,v=Math.imul($e,st),C=C+Math.imul(Ke,It)|0,g=g+Math.imul(Ke,it)|0,g=g+Math.imul(Ue,It)|0,v=v+Math.imul(Ue,it)|0,C=C+Math.imul(pe,Ct)|0,g=g+Math.imul(pe,Ye)|0,g=g+Math.imul(Ee,Ct)|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(ie,Pt)|0,v=v+Math.imul(ie,ot)|0;var Rt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,C=Math.imul(_e,At),g=Math.imul(_e,st),g=g+Math.imul(ge,At)|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(Ke,Ct)|0,g=g+Math.imul(Ke,Ye)|0,g=g+Math.imul(Ue,Ct)|0,v=v+Math.imul(Ue,Ye)|0,C=C+Math.imul(pe,Pt)|0,g=g+Math.imul(pe,ot)|0,g=g+Math.imul(Ee,Pt)|0,v=v+Math.imul(Ee,ot)|0,C=C+Math.imul(ee,Ft)|0,g=g+Math.imul(ee,k)|0,g=g+Math.imul(ie,Ft)|0,v=v+Math.imul(ie,k)|0;var Dt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,C=Math.imul(qe,At),g=Math.imul(qe,st),g=g+Math.imul(De,At)|0,v=Math.imul(De,st),C=C+Math.imul(_e,It)|0,g=g+Math.imul(_e,it)|0,g=g+Math.imul(ge,It)|0,v=v+Math.imul(ge,it)|0,C=C+Math.imul(ht,Ct)|0,g=g+Math.imul(ht,Ye)|0,g=g+Math.imul($e,Ct)|0,v=v+Math.imul($e,Ye)|0,C=C+Math.imul(Ke,Pt)|0,g=g+Math.imul(Ke,ot)|0,g=g+Math.imul(Ue,Pt)|0,v=v+Math.imul(Ue,ot)|0,C=C+Math.imul(pe,Ft)|0,g=g+Math.imul(pe,k)|0,g=g+Math.imul(Ee,Ft)|0,v=v+Math.imul(Ee,k)|0,C=C+Math.imul(ee,T)|0,g=g+Math.imul(ee,B)|0,g=g+Math.imul(ie,T)|0,v=v+Math.imul(ie,B)|0;var er=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(er>>>26)|0,er&=67108863,C=Math.imul(Ie,At),g=Math.imul(Ie,st),g=g+Math.imul(Fe,At)|0,v=Math.imul(Fe,st),C=C+Math.imul(qe,It)|0,g=g+Math.imul(qe,it)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,it)|0,C=C+Math.imul(_e,Ct)|0,g=g+Math.imul(_e,Ye)|0,g=g+Math.imul(ge,Ct)|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(Ke,Ft)|0,g=g+Math.imul(Ke,k)|0,g=g+Math.imul(Ue,Ft)|0,v=v+Math.imul(Ue,k)|0,C=C+Math.imul(pe,T)|0,g=g+Math.imul(pe,B)|0,g=g+Math.imul(Ee,T)|0,v=v+Math.imul(Ee,B)|0,C=C+Math.imul(ee,Z)|0,g=g+Math.imul(ee,te)|0,g=g+Math.imul(ie,Z)|0,v=v+Math.imul(ie,te)|0;var vr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(vr>>>26)|0,vr&=67108863,C=Math.imul(dt,At),g=Math.imul(dt,st),g=g+Math.imul(Ge,At)|0,v=Math.imul(Ge,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(qe,Ct)|0,g=g+Math.imul(qe,Ye)|0,g=g+Math.imul(De,Ct)|0,v=v+Math.imul(De,Ye)|0,C=C+Math.imul(_e,Pt)|0,g=g+Math.imul(_e,ot)|0,g=g+Math.imul(ge,Pt)|0,v=v+Math.imul(ge,ot)|0,C=C+Math.imul(ht,Ft)|0,g=g+Math.imul(ht,k)|0,g=g+Math.imul($e,Ft)|0,v=v+Math.imul($e,k)|0,C=C+Math.imul(Ke,T)|0,g=g+Math.imul(Ke,B)|0,g=g+Math.imul(Ue,T)|0,v=v+Math.imul(Ue,B)|0,C=C+Math.imul(pe,Z)|0,g=g+Math.imul(pe,te)|0,g=g+Math.imul(Ee,Z)|0,v=v+Math.imul(Ee,te)|0,C=C+Math.imul(ee,tt)|0,g=g+Math.imul(ee,Ne)|0,g=g+Math.imul(ie,tt)|0,v=v+Math.imul(ie,Ne)|0;var ir=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ir>>>26)|0,ir&=67108863,C=Math.imul(xt,At),g=Math.imul(xt,st),g=g+Math.imul(Ze,At)|0,v=Math.imul(Ze,st),C=C+Math.imul(dt,It)|0,g=g+Math.imul(dt,it)|0,g=g+Math.imul(Ge,It)|0,v=v+Math.imul(Ge,it)|0,C=C+Math.imul(Ie,Ct)|0,g=g+Math.imul(Ie,Ye)|0,g=g+Math.imul(Fe,Ct)|0,v=v+Math.imul(Fe,Ye)|0,C=C+Math.imul(qe,Pt)|0,g=g+Math.imul(qe,ot)|0,g=g+Math.imul(De,Pt)|0,v=v+Math.imul(De,ot)|0,C=C+Math.imul(_e,Ft)|0,g=g+Math.imul(_e,k)|0,g=g+Math.imul(ge,Ft)|0,v=v+Math.imul(ge,k)|0,C=C+Math.imul(ht,T)|0,g=g+Math.imul(ht,B)|0,g=g+Math.imul($e,T)|0,v=v+Math.imul($e,B)|0,C=C+Math.imul(Ke,Z)|0,g=g+Math.imul(Ke,te)|0,g=g+Math.imul(Ue,Z)|0,v=v+Math.imul(Ue,te)|0,C=C+Math.imul(pe,tt)|0,g=g+Math.imul(pe,Ne)|0,g=g+Math.imul(Ee,tt)|0,v=v+Math.imul(Ee,Ne)|0,C=C+Math.imul(ee,oe)|0,g=g+Math.imul(ee,he)|0,g=g+Math.imul(ie,oe)|0,v=v+Math.imul(ie,he)|0;var Kt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,C=Math.imul(Nt,At),g=Math.imul(Nt,st),g=g+Math.imul(nt,At)|0,v=Math.imul(nt,st),C=C+Math.imul(xt,It)|0,g=g+Math.imul(xt,it)|0,g=g+Math.imul(Ze,It)|0,v=v+Math.imul(Ze,it)|0,C=C+Math.imul(dt,Ct)|0,g=g+Math.imul(dt,Ye)|0,g=g+Math.imul(Ge,Ct)|0,v=v+Math.imul(Ge,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(qe,Ft)|0,g=g+Math.imul(qe,k)|0,g=g+Math.imul(De,Ft)|0,v=v+Math.imul(De,k)|0,C=C+Math.imul(_e,T)|0,g=g+Math.imul(_e,B)|0,g=g+Math.imul(ge,T)|0,v=v+Math.imul(ge,B)|0,C=C+Math.imul(ht,Z)|0,g=g+Math.imul(ht,te)|0,g=g+Math.imul($e,Z)|0,v=v+Math.imul($e,te)|0,C=C+Math.imul(Ke,tt)|0,g=g+Math.imul(Ke,Ne)|0,g=g+Math.imul(Ue,tt)|0,v=v+Math.imul(Ue,Ne)|0,C=C+Math.imul(pe,oe)|0,g=g+Math.imul(pe,he)|0,g=g+Math.imul(Ee,oe)|0,v=v+Math.imul(Ee,he)|0,C=C+Math.imul(ee,He)|0,g=g+Math.imul(ee,Re)|0,g=g+Math.imul(ie,He)|0,v=v+Math.imul(ie,Re)|0;var gr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(gr>>>26)|0,gr&=67108863,C=Math.imul(Nt,It),g=Math.imul(Nt,it),g=g+Math.imul(nt,It)|0,v=Math.imul(nt,it),C=C+Math.imul(xt,Ct)|0,g=g+Math.imul(xt,Ye)|0,g=g+Math.imul(Ze,Ct)|0,v=v+Math.imul(Ze,Ye)|0,C=C+Math.imul(dt,Pt)|0,g=g+Math.imul(dt,ot)|0,g=g+Math.imul(Ge,Pt)|0,v=v+Math.imul(Ge,ot)|0,C=C+Math.imul(Ie,Ft)|0,g=g+Math.imul(Ie,k)|0,g=g+Math.imul(Fe,Ft)|0,v=v+Math.imul(Fe,k)|0,C=C+Math.imul(qe,T)|0,g=g+Math.imul(qe,B)|0,g=g+Math.imul(De,T)|0,v=v+Math.imul(De,B)|0,C=C+Math.imul(_e,Z)|0,g=g+Math.imul(_e,te)|0,g=g+Math.imul(ge,Z)|0,v=v+Math.imul(ge,te)|0,C=C+Math.imul(ht,tt)|0,g=g+Math.imul(ht,Ne)|0,g=g+Math.imul($e,tt)|0,v=v+Math.imul($e,Ne)|0,C=C+Math.imul(Ke,oe)|0,g=g+Math.imul(Ke,he)|0,g=g+Math.imul(Ue,oe)|0,v=v+Math.imul(Ue,he)|0,C=C+Math.imul(pe,He)|0,g=g+Math.imul(pe,Re)|0,g=g+Math.imul(Ee,He)|0,v=v+Math.imul(Ee,Re)|0;var hn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(hn>>>26)|0,hn&=67108863,C=Math.imul(Nt,Ct),g=Math.imul(Nt,Ye),g=g+Math.imul(nt,Ct)|0,v=Math.imul(nt,Ye),C=C+Math.imul(xt,Pt)|0,g=g+Math.imul(xt,ot)|0,g=g+Math.imul(Ze,Pt)|0,v=v+Math.imul(Ze,ot)|0,C=C+Math.imul(dt,Ft)|0,g=g+Math.imul(dt,k)|0,g=g+Math.imul(Ge,Ft)|0,v=v+Math.imul(Ge,k)|0,C=C+Math.imul(Ie,T)|0,g=g+Math.imul(Ie,B)|0,g=g+Math.imul(Fe,T)|0,v=v+Math.imul(Fe,B)|0,C=C+Math.imul(qe,Z)|0,g=g+Math.imul(qe,te)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,te)|0,C=C+Math.imul(_e,tt)|0,g=g+Math.imul(_e,Ne)|0,g=g+Math.imul(ge,tt)|0,v=v+Math.imul(ge,Ne)|0,C=C+Math.imul(ht,oe)|0,g=g+Math.imul(ht,he)|0,g=g+Math.imul($e,oe)|0,v=v+Math.imul($e,he)|0,C=C+Math.imul(Ke,He)|0,g=g+Math.imul(Ke,Re)|0,g=g+Math.imul(Ue,He)|0,v=v+Math.imul(Ue,Re)|0;var Dr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,C=Math.imul(Nt,Pt),g=Math.imul(Nt,ot),g=g+Math.imul(nt,Pt)|0,v=Math.imul(nt,ot),C=C+Math.imul(xt,Ft)|0,g=g+Math.imul(xt,k)|0,g=g+Math.imul(Ze,Ft)|0,v=v+Math.imul(Ze,k)|0,C=C+Math.imul(dt,T)|0,g=g+Math.imul(dt,B)|0,g=g+Math.imul(Ge,T)|0,v=v+Math.imul(Ge,B)|0,C=C+Math.imul(Ie,Z)|0,g=g+Math.imul(Ie,te)|0,g=g+Math.imul(Fe,Z)|0,v=v+Math.imul(Fe,te)|0,C=C+Math.imul(qe,tt)|0,g=g+Math.imul(qe,Ne)|0,g=g+Math.imul(De,tt)|0,v=v+Math.imul(De,Ne)|0,C=C+Math.imul(_e,oe)|0,g=g+Math.imul(_e,he)|0,g=g+Math.imul(ge,oe)|0,v=v+Math.imul(ge,he)|0,C=C+Math.imul(ht,He)|0,g=g+Math.imul(ht,Re)|0,g=g+Math.imul($e,He)|0,v=v+Math.imul($e,Re)|0;var pn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(pn>>>26)|0,pn&=67108863,C=Math.imul(Nt,Ft),g=Math.imul(Nt,k),g=g+Math.imul(nt,Ft)|0,v=Math.imul(nt,k),C=C+Math.imul(xt,T)|0,g=g+Math.imul(xt,B)|0,g=g+Math.imul(Ze,T)|0,v=v+Math.imul(Ze,B)|0,C=C+Math.imul(dt,Z)|0,g=g+Math.imul(dt,te)|0,g=g+Math.imul(Ge,Z)|0,v=v+Math.imul(Ge,te)|0,C=C+Math.imul(Ie,tt)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Fe,tt)|0,v=v+Math.imul(Fe,Ne)|0,C=C+Math.imul(qe,oe)|0,g=g+Math.imul(qe,he)|0,g=g+Math.imul(De,oe)|0,v=v+Math.imul(De,he)|0,C=C+Math.imul(_e,He)|0,g=g+Math.imul(_e,Re)|0,g=g+Math.imul(ge,He)|0,v=v+Math.imul(ge,Re)|0;var ui=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ui>>>26)|0,ui&=67108863,C=Math.imul(Nt,T),g=Math.imul(Nt,B),g=g+Math.imul(nt,T)|0,v=Math.imul(nt,B),C=C+Math.imul(xt,Z)|0,g=g+Math.imul(xt,te)|0,g=g+Math.imul(Ze,Z)|0,v=v+Math.imul(Ze,te)|0,C=C+Math.imul(dt,tt)|0,g=g+Math.imul(dt,Ne)|0,g=g+Math.imul(Ge,tt)|0,v=v+Math.imul(Ge,Ne)|0,C=C+Math.imul(Ie,oe)|0,g=g+Math.imul(Ie,he)|0,g=g+Math.imul(Fe,oe)|0,v=v+Math.imul(Fe,he)|0,C=C+Math.imul(qe,He)|0,g=g+Math.imul(qe,Re)|0,g=g+Math.imul(De,He)|0,v=v+Math.imul(De,Re)|0;var li=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(li>>>26)|0,li&=67108863,C=Math.imul(Nt,Z),g=Math.imul(Nt,te),g=g+Math.imul(nt,Z)|0,v=Math.imul(nt,te),C=C+Math.imul(xt,tt)|0,g=g+Math.imul(xt,Ne)|0,g=g+Math.imul(Ze,tt)|0,v=v+Math.imul(Ze,Ne)|0,C=C+Math.imul(dt,oe)|0,g=g+Math.imul(dt,he)|0,g=g+Math.imul(Ge,oe)|0,v=v+Math.imul(Ge,he)|0,C=C+Math.imul(Ie,He)|0,g=g+Math.imul(Ie,Re)|0,g=g+Math.imul(Fe,He)|0,v=v+Math.imul(Fe,Re)|0;var mn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(mn>>>26)|0,mn&=67108863,C=Math.imul(Nt,tt),g=Math.imul(Nt,Ne),g=g+Math.imul(nt,tt)|0,v=Math.imul(nt,Ne),C=C+Math.imul(xt,oe)|0,g=g+Math.imul(xt,he)|0,g=g+Math.imul(Ze,oe)|0,v=v+Math.imul(Ze,he)|0,C=C+Math.imul(dt,He)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(Ge,He)|0,v=v+Math.imul(Ge,Re)|0;var fi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(fi>>>26)|0,fi&=67108863,C=Math.imul(Nt,oe),g=Math.imul(Nt,he),g=g+Math.imul(nt,oe)|0,v=Math.imul(nt,he),C=C+Math.imul(xt,He)|0,g=g+Math.imul(xt,Re)|0,g=g+Math.imul(Ze,He)|0,v=v+Math.imul(Ze,Re)|0;var di=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(di>>>26)|0,di&=67108863,C=Math.imul(Nt,He),g=Math.imul(Nt,Re),g=g+Math.imul(nt,He)|0,v=Math.imul(nt,Re);var D=(O+C|0)+((g&8191)<<13)|0;return O=(v+(g>>>13)|0)+(D>>>26)|0,D&=67108863,E[0]=ze,E[1]=at,E[2]=Ht,E[3]=Rt,E[4]=Dt,E[5]=er,E[6]=vr,E[7]=ir,E[8]=Kt,E[9]=gr,E[10]=hn,E[11]=Dr,E[12]=pn,E[13]=ui,E[14]=li,E[15]=mn,E[16]=fi,E[17]=di,E[18]=D,O!==0&&(E[19]=O,m.length++),m};Math.imul||(R=P);function N($,p,d){d.negative=p.negative^$.negative,d.length=$.length+p.length;for(var m=0,x=0,M=0;M<d.length-1;M++){var E=x;x=0;for(var O=m&67108863,C=Math.min(M,p.length-1),g=Math.max(0,M-$.length+1);g<=C;g++){var v=M-g,j=$.words[v]|0,ee=p.words[g]|0,ie=j*ee,ve=ie&67108863;E=E+(ie/67108864|0)|0,ve=ve+O|0,O=ve&67108863,E=E+(ve>>>26)|0,x+=E>>>26,E&=67108863}d.words[M]=O,m=E,E=x}return m!==0?d.words[M]=m:d.length--,d._strip()}function F($,p,d){return N($,p,d)}s.prototype.mulTo=function(p,d){var m,x=this.length+p.length;return this.length===10&&p.length===10?m=R(this,p,d):x<63?m=P(this,p,d):x<1024?m=N(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 M=(this.words[x]|0)*p,E=(M&67108863)+(m&67108863);m>>=26,m+=M/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=A(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 M=m.sqr();x<d.length;x++,M=M.sqr())d[x]!==0&&(m=m.mul(M));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,M;if(d!==0){var E=0;for(M=0;M<this.length;M++){var O=this.words[M]&x,C=(this.words[M]|0)-O<<d;this.words[M]=C|E,E=O>>>26-d}E&&(this.words[M]=E,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()},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 M=p%26,E=Math.min((p-M)/26,this.length),O=67108863^67108863>>>M<<M,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-M|j>>>M,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 M=this.words[m];return!!(M&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,M;this._expand(x);var E,O=0;for(M=0;M<p.length;M++){E=(this.words[M+m]|0)+O;var C=(p.words[M]|0)*d;E-=C&67108863,O=(E>>26)-(C/67108864|0),this.words[M+m]=E&67108863}for(;M<this.length-m;M++)E=(this.words[M+m]|0)+O,O=E>>26,this.words[M+m]=E&67108863;if(O===0)return this._strip();for(n(O===-1),O=0,M=0;M<this.length;M++)E=-(this.words[M]|0)+O,O=E>>26,this.words[M]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var m=this.length-p.length,x=this.clone(),M=p,E=M.words[M.length-1]|0,O=this._countBits(E);m=26-O,m!==0&&(M=M.ushln(m),x.iushln(m),E=M.words[M.length-1]|0);var C=x.length-M.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(M,1,C);j.negative===0&&(x=j,g&&(g.words[C]=1));for(var ee=C-1;ee>=0;ee--){var ie=(x.words[M.length+ee]|0)*67108864+(x.words[M.length+ee-1]|0);for(ie=Math.min(ie/E|0,67108863),x._ishlnsubmul(M,ie,ee);x.negative!==0;)ie--,x.negative=0,x._ishlnsubmul(M,1,ee),x.isZero()||(x.negative^=1);g&&(g.words[ee]=ie)}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,M,E;return this.negative!==0&&p.negative===0?(E=this.neg().divmod(p,d),d!=="mod"&&(x=E.div.neg()),d!=="div"&&(M=E.mod.neg(),m&&M.negative!==0&&M.iadd(p)),{div:x,mod:M}):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"&&(M=E.mod.neg(),m&&M.negative!==0&&M.isub(p)),{div:E.div,mod:M}):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),M=p.andln(1),E=m.cmp(x);return E<0||M===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,M=this.length-1;M>=0;M--)x=(m*x+(this.words[M]|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 M=(this.words[x]|0)+m*67108864;this.words[x]=M/p|0,m=M%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),M=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()||M.isOdd())&&(x.iadd(g),M.isub(v)),x.iushrn(1),M.iushrn(1);for(var ie=0,ve=1;!(m.words[0]&ve)&&ie<26;++ie,ve<<=1);if(ie>0)for(m.iushrn(ie);ie-- >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),M.isub(O)):(m.isub(d),E.isub(x),O.isub(M))}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),M=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;)M.isOdd()&&M.iadd(E),M.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(M)):(m.isub(d),M.isub(x))}var j;return d.cmpn(1)===0?j=x:j=M,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 M=d.cmp(m);if(M<0){var E=d;d=m,m=E}else if(M===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 M=x,E=m;M!==0&&E<this.length;E++){var O=this.words[E]|0;O+=M,M=O>>>26,O&=67108863,this.words[E]=O}return M!==0&&(this.words[E]=M,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,M=p.words[m]|0;if(x!==M){x<M?d=-1:x>M&&(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($,p){this.name=$,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),M=0;M<x;M++)d.words[M]=p.words[M];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,M=10;M<p.length;M++){var O=p.words[M]|0;p.words[M-10]=(O&m)<<4|E>>>22,E=O}E>>>=22,p.words[M-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 J(){G.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(J,G);function ne(){G.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ne,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,M=x&67108863;x>>>=26,p.words[m]=M,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 J;else if(p==="p192")d=new ne;else if(p==="p25519")d=new ae;else throw new Error("Unknown prime "+p);return L[p]=d,d};function ce($){if(typeof $=="string"){var p=s._prime($);this.m=p.p,this.prime=p}else n($.gtn(1),"modulus must be greater than 1"),this.m=$,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),M=0;!x.isZero()&&x.andln(1)===0;)M++,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),ie=M;ee.cmp(E)!==0;){for(var ve=ee,pe=0;ve.cmp(E)!==0;pe++)ve=ve.redSqr();n(pe<ie);var Ee=this.pow(v,new s(1).iushln(ie-pe-1));j=j.redMul(Ee),v=Ee.redSqr(),ee=ee.redMul(v),ie=pe}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 M=2;M<x.length;M++)x[M]=this.mul(x[M-1],p);var E=x[0],O=0,C=0,g=d.bitLength()%26;for(g===0&&(g=26),M=d.length-1;M>=0;M--){for(var v=d.words[M],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&&(M!==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 V(p)};function V($){ce.call(this,$),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(V,ce),V.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},V.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},V.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),M=m.isub(x).iushrn(this.shift),E=M;return M.cmp(this.m)>=0?E=M.isub(this.m):M.cmpn(0)<0&&(E=M.iadd(this.m)),E._forceRed(this)},V.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),M=m.isub(x).iushrn(this.shift),E=M;return M.cmp(this.m)>=0?E=M.isub(this.m):M.cmpn(0)<0&&(E=M.iadd(this.m)),E._forceRed(this)},V.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(e,Rr)})(Lp);var Px=Lp.exports;const Nm=dc(Px);var L7=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(on,"__esModule",{value:!0});on.parseAccumulatorUpdateData=on.sliceAccumulatorUpdateData=on.parseTwapMessage=on.parsePriceFeedMessage=on.isAccumulatorUpdateData=void 0;const rn=L7(Px),F7="504e4155",U7=1,z7=0,Bd=20,V7=0,q7=1;function Fp(e){return e.toString("hex").slice(0,8)===F7&&e[4]===U7&&e[5]===z7}on.isAccumulatorUpdateData=Fp;function W7(e){let t=0;if(e.readUInt8(t)!==V7)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new rn.default(e.subarray(t,t+8),"be");t+=8;const s=new rn.default(e.subarray(t,t+8),"be");t+=8;const o=e.readInt32BE(t);t+=4;const a=new rn.default(e.subarray(t,t+8),"be");t+=8;const c=new rn.default(e.subarray(t,t+8),"be");t+=8;const u=new rn.default(e.subarray(t,t+8),"be");t+=8;const l=new rn.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}}on.parsePriceFeedMessage=W7;function G7(e){let t=0;if(e.readUInt8(t)!==q7)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new rn.default(e.subarray(t,t+16),"be");t+=16;const s=new rn.default(e.subarray(t,t+16),"be");t+=16;const o=new rn.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new rn.default(e.subarray(t,t+8),"be");t+=8;const u=new rn.default(e.subarray(t,t+8),"be");t+=8;const l=new rn.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}}on.parseTwapMessage=G7;function H7(e,t,r){if(!Fp(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+=Bd*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 $d.concat([e.subarray(0,o),$d.from([u.length]),...a.slice(t,r)])}on.sliceAccumulatorUpdateData=H7;function K7(e){if(!Fp(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+Bd))),t+=Bd;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}}on.parseAccumulatorUpdateData=K7;(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=fl;var r=on;Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"sliceAccumulatorUpdateData",{enumerable:!0,get:function(){return r.sliceAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}}),Object.defineProperty(e,"parsePriceFeedMessage",{enumerable:!0,get:function(){return r.parsePriceFeedMessage}}),Object.defineProperty(e,"parseTwapMessage",{enumerable:!0,get:function(){return r.parseTwapMessage}});class n{constructor(a){vt(this,"conf");vt(this,"expo");vt(this,"price");vt(this,"publishTime");this.conf=a.conf,this.expo=a.expo,this.price=a.price,this.publishTime=a.publishTime}getPriceAsNumberUnchecked(){return Number(this.price)*10**this.expo}getConfAsNumberUnchecked(){return Number(this.conf)*10**this.expo}static fromJson(a){const c=t.Convert.toPrice(a);return new n({conf:c.conf,expo:c.expo,price:c.price,publishTime:c.publish_time})}toJson(){const a={conf:this.conf,expo:this.expo,price:this.price,publish_time:this.publishTime};return t.Convert.priceToJson(a)}}e.Price=n;class i{constructor(a){vt(this,"attestationTime");vt(this,"emitterChain");vt(this,"priceServiceReceiveTime");vt(this,"sequenceNumber");vt(this,"slot");vt(this,"prevPublishTime");this.attestationTime=a.attestationTime,this.emitterChain=a.emitterChain,this.priceServiceReceiveTime=a.receiveTime,this.sequenceNumber=a.sequenceNumber,this.slot=a.slot,this.prevPublishTime=a.prevPublishTime}static fromJson(a){if(a===void 0)return;const c=t.Convert.toPriceFeedMetadata(a);return new i({attestationTime:c.attestation_time,emitterChain:c.emitter_chain,receiveTime:c.price_service_receive_time,sequenceNumber:c.sequence_number,slot:c.slot,prevPublishTime:c.prev_publish_time})}toJson(){const a={attestation_time:this.attestationTime,emitter_chain:this.emitterChain,price_service_receive_time:this.priceServiceReceiveTime,sequence_number:this.sequenceNumber,slot:this.slot,prev_publish_time:this.prevPublishTime};return t.Convert.priceFeedMetadataToJson(a)}}e.PriceFeedMetadata=i;let s=class jx{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 jx({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})(Bp);function kx(e,t){return function(){return e.apply(t,arguments)}}const{toString:J7}=Object.prototype,{getPrototypeOf:Up}=Object,hl=(e=>t=>{const r=J7.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Rn=e=>(e=e.toLowerCase(),t=>hl(t)===e),pl=e=>t=>typeof t===e,{isArray:Jo}=Array,Za=pl("undefined");function X7(e){return e!==null&&!Za(e)&&e.constructor!==null&&!Za(e.constructor)&&Wr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Rx=Rn("ArrayBuffer");function Y7(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Rx(e.buffer),t}const Z7=pl("string"),Wr=pl("function"),Nx=pl("number"),ml=e=>e!==null&&typeof e=="object",Q7=e=>e===!0||e===!1,nu=e=>{if(hl(e)!=="object")return!1;const t=Up(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ej=Rn("Date"),tj=Rn("File"),rj=Rn("Blob"),nj=Rn("FileList"),ij=e=>ml(e)&&Wr(e.pipe),sj=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Wr(e.append)&&((t=hl(e))==="formdata"||t==="object"&&Wr(e.toString)&&e.toString()==="[object FormData]"))},oj=Rn("URLSearchParams"),[aj,cj,uj,lj]=["ReadableStream","Request","Response","Headers"].map(Rn),fj=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vc(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Jo(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 Dx(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 Fs=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Rr)(),$x=e=>!Za(e)&&e!==Fs;function Ld(){const{caseless:e}=$x(this)&&this||{},t={},r=(n,i)=>{const s=e&&Dx(t,i)||i;nu(t[s])&&nu(n)?t[s]=Ld(t[s],n):nu(n)?t[s]=Ld({},n):Jo(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&vc(arguments[n],r);return t}const dj=(e,t,r,{allOwnKeys:n}={})=>(vc(t,(i,s)=>{r&&Wr(i)?e[s]=kx(i,r):e[s]=i},{allOwnKeys:n}),e),hj=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),pj=(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)},mj=(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&&Up(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},gj=(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},vj=e=>{if(!e)return null;if(Jo(e))return e;let t=e.length;if(!Nx(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},yj=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Up(Uint8Array)),bj=(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])}},wj=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},_j=Rn("HTMLFormElement"),xj=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),Dm=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Sj=Rn("RegExp"),Bx=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};vc(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},Ej=e=>{Bx(e,(t,r)=>{if(Wr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Wr(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+"'")})}})},Cj=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Jo(e)?n(e):n(String(e).split(t)),r},Mj=()=>{},Tj=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Af="abcdefghijklmnopqrstuvwxyz",$m="0123456789",Lx={DIGIT:$m,ALPHA:Af,ALPHA_DIGIT:Af+Af.toUpperCase()+$m},Aj=(e=16,t=Lx.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function Oj(e){return!!(e&&Wr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Ij=e=>{const t=new Array(10),r=(n,i)=>{if(ml(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=Jo(n)?[]:{};return vc(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)},Pj=Rn("AsyncFunction"),jj=e=>e&&(ml(e)||Wr(e))&&Wr(e.then)&&Wr(e.catch),Fx=((e,t)=>e?setImmediate:t?((r,n)=>(Fs.addEventListener("message",({source:i,data:s})=>{i===Fs&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Fs.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Wr(Fs.postMessage)),kj=typeof queueMicrotask<"u"?queueMicrotask.bind(Fs):typeof Tn<"u"&&Tn.nextTick||Fx;var fe={isArray:Jo,isArrayBuffer:Rx,isBuffer:X7,isFormData:sj,isArrayBufferView:Y7,isString:Z7,isNumber:Nx,isBoolean:Q7,isObject:ml,isPlainObject:nu,isReadableStream:aj,isRequest:cj,isResponse:uj,isHeaders:lj,isUndefined:Za,isDate:ej,isFile:tj,isBlob:rj,isRegExp:Sj,isFunction:Wr,isStream:ij,isURLSearchParams:oj,isTypedArray:yj,isFileList:nj,forEach:vc,merge:Ld,extend:dj,trim:fj,stripBOM:hj,inherits:pj,toFlatObject:mj,kindOf:hl,kindOfTest:Rn,endsWith:gj,toArray:vj,forEachEntry:bj,matchAll:wj,isHTMLForm:_j,hasOwnProperty:Dm,hasOwnProp:Dm,reduceDescriptors:Bx,freezeMethods:Ej,toObjectSet:Cj,toCamelCase:xj,noop:Mj,toFiniteNumber:Tj,findKey:Dx,global:Fs,isContextDefined:$x,ALPHABET:Lx,generateString:Aj,isSpecCompliantForm:Oj,toJSONObject:Ij,isAsyncFn:Pj,isThenable:jj,setImmediate:Fx,asap:kj};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 Ux=pt.prototype,zx={};["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=>{zx[e]={value:e}});Object.defineProperties(pt,zx);Object.defineProperty(Ux,"isAxiosError",{value:!0});pt.from=(e,t,r,n,i,s)=>{const o=Object.create(Ux);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 Rj=null;function Fd(e){return fe.isPlainObject(e)||fe.isArray(e)}function Vx(e){return fe.endsWith(e,"[]")?e.slice(0,-2):e}function Bm(e,t,r){return e?e.concat(t).map(function(i,s){return i=Vx(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function Nj(e){return fe.isArray(e)&&!e.some(Fd)}const Dj=fe.toFlatObject(fe,{},null,function(t){return/^is[A-Z]/.test(t)});function gl(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,A){return!fe.isUndefined(A[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]):$d.from(b):b}function l(b,w,A){let P=b;if(b&&!A&&typeof b=="object"){if(fe.endsWith(w,"{}"))w=n?w:w.slice(0,-2),b=JSON.stringify(b);else if(fe.isArray(b)&&Nj(b)||(fe.isFileList(b)||fe.endsWith(w,"[]"))&&(P=fe.toArray(b)))return w=Vx(w),P.forEach(function(N,F){!(fe.isUndefined(N)||N===null)&&t.append(o===!0?Bm([w],F,s):o===null?w:w+"[]",u(N))}),!1}return Fd(b)?!0:(t.append(Bm(A,w,s),u(b)),!1)}const f=[],h=Object.assign(Dj,{defaultVisitor:l,convertValue:u,isVisitable:Fd});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,R){(!(fe.isUndefined(P)||P===null)&&i.call(t,P,fe.isString(R)?R.trim():R,w,h))===!0&&y(P,w?w.concat(R):[R])}),f.pop()}}if(!fe.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Lm(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function zp(e,t){this._pairs=[],e&&gl(e,this,t)}const qx=zp.prototype;qx.append=function(t,r){this._pairs.push([t,r])};qx.toString=function(t){const r=t?function(n){return t.call(this,n,Lm)}:Lm;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function $j(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Wx(e,t,r){if(!t)return e;const n=r&&r.encode||$j;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 zp(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Bj{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 Fm=Bj,Gx={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Lj=typeof URLSearchParams<"u"?URLSearchParams:zp,Fj=typeof FormData<"u"?FormData:null,Uj=typeof Blob<"u"?Blob:null,zj={isBrowser:!0,classes:{URLSearchParams:Lj,FormData:Fj,Blob:Uj},protocols:["http","https","file","blob","url","data"]};const Vp=typeof window<"u"&&typeof document<"u",Ud=typeof navigator=="object"&&navigator||void 0,Vj=Vp&&(!Ud||["ReactNative","NativeScript","NS"].indexOf(Ud.product)<0),qj=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Wj=Vp&&window.location.href||"http://localhost";var Gj=Object.freeze({__proto__:null,hasBrowserEnv:Vp,hasStandardBrowserWebWorkerEnv:qj,hasStandardBrowserEnv:Vj,navigator:Ud,origin:Wj}),Cr={...Gj,...zj};function Hj(e,t){return gl(e,new Cr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Cr.isNode&&fe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Kj(e){return fe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Jj(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 Hx(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]=Jj(i[o])),!a)}if(fe.isFormData(e)&&fe.isFunction(e.entries)){const r={};return fe.forEachEntry(e,(n,i)=>{t(Kj(n),i,r,0)}),r}return null}function Xj(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 qp={transitional:Gx,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(Hx(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 Hj(t,this.formSerializer).toString();if((a=fe.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return gl(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Xj(t)):t}],transformResponse:[function(t){const r=this.transitional||qp.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:Cr.classes.FormData,Blob:Cr.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=>{qp.headers[e]={}});var Wp=qp;const Yj=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 Zj=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]&&
|
|
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[Um]=this[Um]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=wa(o);n[a]||(rk(i,o),n[a]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}vl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors(vl.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});fe.freezeMethods(vl);var An=vl;function If(e,t){const r=this||Wp,n=t||r,i=An.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 Kx(e){return!!(e&&e.__CANCEL__)}function Xo(e,t,r){pt.call(this,e??"canceled",pt.ERR_CANCELED,t,r),this.name="CanceledError"}fe.inherits(Xo,pt,{__CANCEL__:!0});function Jx(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 nk(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function ik(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 sk(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 Pu=(e,t,r=3)=>{let n=0;const i=ik(50,250);return sk(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)},zm=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Vm=e=>(...t)=>fe.asap(()=>e(...t));var ok=Cr.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Cr.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Cr.origin),Cr.navigator&&/(msie|trident)/i.test(Cr.navigator.userAgent)):()=>!0,ak=Cr.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 ck(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function uk(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Xx(e,t){return e&&!ck(t)?uk(e,t):t}const qm=e=>e instanceof An?{...e}:e;function Ws(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(qm(u),qm(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 Yx=e=>{const t=Ws({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=An.from(o),t.url=Wx(Xx(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(Cr.hasStandardBrowserEnv||Cr.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(Cr.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&ok(t.url))){const u=i&&s&&ak.read(s);u&&o.set(i,u)}return t};const lk=typeof XMLHttpRequest<"u";var fk=lk&&function(e){return new Promise(function(r,n){const i=Yx(e);let s=i.data;const o=An.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 A=new XMLHttpRequest;A.open(i.method.toUpperCase(),i.url,!0),A.timeout=i.timeout;function P(){if(!A)return;const N=An.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:N,config:e,request:A};Jx(function(q){r(q),w()},function(q){n(q),w()},L),A=null}"onloadend"in A?A.onloadend=P:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(P)},A.onabort=function(){A&&(n(new pt("Request aborted",pt.ECONNABORTED,e,A)),A=null)},A.onerror=function(){n(new pt("Network Error",pt.ERR_NETWORK,e,A)),A=null},A.ontimeout=function(){let F=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const L=i.transitional||Gx;i.timeoutErrorMessage&&(F=i.timeoutErrorMessage),n(new pt(F,L.clarifyTimeoutError?pt.ETIMEDOUT:pt.ECONNABORTED,e,A)),A=null},s===void 0&&o.setContentType(null),"setRequestHeader"in A&&fe.forEach(o.toJSON(),function(F,L){A.setRequestHeader(L,F)}),fe.isUndefined(i.withCredentials)||(A.withCredentials=!!i.withCredentials),a&&a!=="json"&&(A.responseType=i.responseType),u&&([h,b]=Pu(u,!0),A.addEventListener("progress",h)),c&&A.upload&&([f,y]=Pu(c),A.upload.addEventListener("progress",f),A.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=N=>{A&&(n(!N||N.type?new Xo(null,e,A):N),A.abort(),A=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const R=nk(i.url);if(R&&Cr.protocols.indexOf(R)===-1){n(new pt("Unsupported protocol "+R+":",pt.ERR_BAD_REQUEST,e));return}A.send(s||null)})};const dk=(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 Xo(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}};var hk=dk;const pk=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},mk=async function*(e,t){for await(const r of gk(e))yield*pk(r,t)},gk=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()}},Wm=(e,t,r,n)=>{const i=mk(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})},yl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Zx=yl&&typeof ReadableStream=="function",vk=yl&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Qx=(e,...t)=>{try{return!!e(...t)}catch{return!1}},yk=Zx&&Qx(()=>{let e=!1;const t=new Request(Cr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Gm=64*1024,zd=Zx&&Qx(()=>fe.isReadableStream(new Response("").body)),ju={stream:zd&&(e=>e.body)};yl&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!ju[t]&&(ju[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 bk=async e=>{if(e==null)return 0;if(fe.isBlob(e))return e.size;if(fe.isSpecCompliantForm(e))return(await new Request(Cr.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 vk(e)).byteLength},wk=async(e,t)=>{const r=fe.toFiniteNumber(e.getContentLength());return r??bk(t)};var _k=yl&&(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}=Yx(e);u=u?(u+"").toLowerCase():"text";let y=hk([i,s&&s.toAbortSignal()],o),b;const w=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let A;try{if(c&&yk&&r!=="get"&&r!=="head"&&(A=await wk(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,J]=zm(A,Pu(Vm(c)));n=Wm(L.body,Gm,q,J)}}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 R=await fetch(b);const N=zd&&(u==="stream"||u==="response");if(zd&&(a||N&&w)){const L={};["status","statusText","headers"].forEach(ne=>{L[ne]=R[ne]});const G=fe.toFiniteNumber(R.headers.get("content-length")),[q,J]=a&&zm(G,Pu(Vm(a),!0))||[];R=new Response(Wm(R.body,Gm,q,()=>{J&&J(),w&&w()}),L)}u=u||"text";let F=await ju[fe.findKey(ju,u)||"text"](R,e);return!N&&w&&w(),await new Promise((L,G)=>{Jx(L,G,{data:F,headers:An.from(R.headers),status:R.status,statusText:R.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 Vd={http:Rj,xhr:fk,fetch:_k};fe.forEach(Vd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Hm=e=>`- ${e}`,xk=e=>fe.isFunction(e)||e===null||e===!1;var e4={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,!xk(r)&&(n=Vd[(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(
|
|
37
|
-
`):" "+
|
|
38
|
-
`+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Ws(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&su.assertOptions(n,{silentJSONParsing:Un.transitional(Un.boolean),forcedJSONParsing:Un.transitional(Un.boolean),clarifyTimeoutError:Un.transitional(Un.boolean)},!1),i!=null&&(fe.isFunction(i)?r.paramsSerializer={serialize:i}:su.assertOptions(i,{encode:Un.function,serialize:Un.function},!0)),su.assertOptions(r,{baseUrl:Un.spelling("baseURL"),withXsrfToken:Un.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=An.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=[Km.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(A){w.call(this,A);break}}try{l=Km.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=Ws(this.defaults,t);const r=Xx(t.baseURL,t.url);return Wx(r,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){ku.prototype[t]=function(r,n){return this.request(Ws(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(Ws(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ku.prototype[t]=r(),ku.prototype[t+"Form"]=r(!0)});var ou=ku;class Gp{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 Xo(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 Gp(function(i){t=i}),cancel:t}}}var Ek=Gp;function Ck(e){return function(r){return e.apply(null,r)}}function Mk(e){return fe.isObject(e)&&e.isAxiosError===!0}const qd={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(qd).forEach(([e,t])=>{qd[t]=e});var Tk=qd;function r4(e){const t=new ou(e),r=kx(ou.prototype.request,t);return fe.extend(r,ou.prototype,t,{allOwnKeys:!0}),fe.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return r4(Ws(e,i))},r}const ur=r4(Wp);ur.Axios=ou;ur.CanceledError=Xo;ur.CancelToken=Ek;ur.isCancel=Kx;ur.VERSION=t4;ur.toFormData=gl;ur.AxiosError=pt;ur.Cancel=ur.CanceledError;ur.all=function(t){return Promise.all(t)};ur.spread=Ck;ur.isAxiosError=Mk;ur.mergeConfig=Ws;ur.AxiosHeaders=An;ur.formToJSON=e=>Hx(fe.isHTMLForm(e)?new FormData(e):e);ur.getAdapter=e4.getAdapter;ur.HttpStatusCode=Tk;ur.default=ur;var n4=ur,Hp={exports:{}},Hr={},i4={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})(i4);var Ak=i4.exports,jf={exports:{}},kf={exports:{}},Xm;function wl(){return Xm||(Xm=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}(kf)),kf.exports}var Ym;function Ok(){return Ym||(Ym=1,function(e){var t=wl().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:$(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",A="suspendedYield",P="executing",R="completed",N={};function F(){}function L(){}function G(){}var q={};h(q,u,function(){return this});var J=Object.getPrototypeOf,ne=J&&J(J(M([])));ne&&ne!==s&&o.call(ne,u)&&(q=ne);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 V(E,O){function C(v,j,ee,ie){var ve=b(E[v],E,j);if(ve.type!=="throw"){var pe=ve.arg,Ee=pe.value;return Ee&&t(Ee)=="object"&&o.call(Ee,"__await")?O.resolve(Ee.__await).then(function(Se){C("next",Se,ee,ie)},function(Se){C("throw",Se,ee,ie)}):O.resolve(Ee).then(function(Se){pe.value=Se,ee(pe)},function(Se){return C("throw",Se,ee,ie)})}ie(ve.arg)}var g;a(this,"_invoke",{value:function(j,ee){function ie(){return new O(function(ve,pe){C(j,ee,ve,pe)})}return g=g?g.then(ie,ie):ie()}})}function $(E,O,C){var g=w;return function(v,j){if(g===P)throw Error("Generator is already running");if(g===R){if(v==="throw")throw j;return{value:n,done:!0}}for(C.method=v,C.arg=j;;){var ee=C.delegate;if(ee){var ie=p(ee,C);if(ie){if(ie===N)continue;return ie}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(g===w)throw g=R,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);g=P;var ve=b(E,O,C);if(ve.type==="normal"){if(g=C.done?R:A,ve.arg===N)continue;return{value:ve.arg,done:C.done}}ve.type==="throw"&&(g=R,C.method="throw",C.arg=ve.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")),N;var v=b(g,E.iterator,O.arg);if(v.type==="throw")return O.method="throw",O.arg=v.arg,O.delegate=null,N;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,N):j:(O.method="throw",O.arg=new TypeError("iterator result is not an object"),O.delegate=null,N)}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 M(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(V.prototype),h(V.prototype,l,function(){return this}),i.AsyncIterator=V,i.async=function(E,O,C,g,v){v===void 0&&(v=Promise);var j=new V(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=M,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(pe,Ee){return ee.type="throw",ee.arg=O,C.next=pe,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 ie=o.call(j,"catchLoc"),ve=o.call(j,"finallyLoc");if(ie&&ve){if(this.prev<j.catchLoc)return g(j.catchLoc,!0);if(this.prev<j.finallyLoc)return g(j.finallyLoc)}else if(ie){if(this.prev<j.catchLoc)return g(j.catchLoc,!0)}else{if(!ve)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,N):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),N},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),N}},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:M(O),resultName:C,nextLoc:g},this.method==="next"&&(this.arg=n),N}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(jf)),jf.exports}var Rf,Zm;function Ik(){if(Zm)return Rf;Zm=1;var e=Ok()();Rf=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return Rf}var Nf={exports:{}},Qm;function Pk(){return Qm||(Qm=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}(Nf)),Nf.exports}var Df={exports:{}},$f={exports:{}},Bf={exports:{}},eg;function jk(){return eg||(eg=1,function(e){var t=wl().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}(Bf)),Bf.exports}var tg;function kk(){return tg||(tg=1,function(e){var t=wl().default,r=jk();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}($f)),$f.exports}var rg;function Rk(){return rg||(rg=1,function(e){var t=kk();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}(Df)),Df.exports}var Lf,ng;function Nk(){if(ng)return Lf;ng=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 Lf=t=>!e.has(t&&t.code),Lf}var yc=Ak;Object.defineProperty(Hr,"__esModule",{value:!0});Hr.isNetworkError=Jp;Hr.isRetryableError=_l;Hr.isSafeRequestError=a4;Hr.isIdempotentRequestError=Xp;Hr.isNetworkOrIdempotentRequestError=Yp;Hr.exponentialDelay=c4;Hr.default=Xs;Hr.DEFAULT_OPTIONS=Hr.namespace=void 0;var Ru=yc(Ik()),Dk=yc(wl()),s4=yc(Pk()),$k=yc(Rk()),Bk=yc(Nk());function ig(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 Ff(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ig(Object(r),!0).forEach(function(n){(0,$k.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ig(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Kp="axios-retry";Hr.namespace=Kp;function Jp(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,Bk.default)(e)}var o4=["get","head","options"],Lk=o4.concat(["put","delete"]);function _l(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function a4(e){return e.config?_l(e)&&o4.indexOf(e.config.method)!==-1:!1}function Xp(e){return e.config?_l(e)&&Lk.indexOf(e.config.method)!==-1:!1}function Yp(e){return Jp(e)||Xp(e)}function Fk(){return 0}function c4(){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 u4={retries:3,retryCondition:Yp,retryDelay:Fk,shouldResetTimeout:!1,onRetry:function(){}};Hr.DEFAULT_OPTIONS=u4;function Uk(e,t){return Ff(Ff(Ff({},u4),t),e[Kp])}function sg(e,t){var r=Uk(e,t);return r.retryCount=r.retryCount||0,e[Kp]=r,r}function zk(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 Vk(e,t){return Wd.apply(this,arguments)}function Wd(){return Wd=(0,s4.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,Dk.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]])})),Wd.apply(this,arguments)}function Xs(e,t){var r=e.interceptors.request.use(function(i){var s=sg(i,t);return s.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,s4.default)(Ru.default.mark(function s(o){var a,c,u,l,f,h,y,b;return Ru.default.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(a=o.config,a){A.next=3;break}return A.abrupt("return",Promise.reject(o));case 3:return c=sg(a,t),A.next=6,Vk(c,o);case 6:if(!A.sent){A.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,f=c.onRetry,h=u(c.retryCount,o),zk(e,a),!(!l&&a.timeout&&c.lastRequestTime)){A.next=17;break}if(y=Date.now()-c.lastRequestTime,b=a.timeout-y-h,!(b<=0)){A.next=16;break}return A.abrupt("return",Promise.reject(o));case 16:a.timeout=b;case 17:return a.transformRequest=[function(P){return P}],A.next=20,f(c.retryCount,o,a);case 20:return A.abrupt("return",new Promise(function(P){return setTimeout(function(){return P(e(a))},h)}));case 21:return A.abrupt("return",Promise.reject(o));case 22:case"end":return A.stop()}},s)}));return function(s){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}Xs.isNetworkError=Jp;Xs.isSafeRequestError=a4;Xs.isIdempotentRequestError=Xp;Xs.isNetworkOrIdempotentRequestError=Yp;Xs.exponentialDelay=c4;Xs.isRetryableError=_l;const l4=Hr.default;Hp.exports=l4;Hp.exports.default=l4;var qk=Hp.exports,xl={},yo=null;typeof WebSocket<"u"?yo=WebSocket:typeof MozWebSocket<"u"?yo=MozWebSocket:typeof Rr<"u"?yo=Rr.WebSocket||Rr.MozWebSocket:typeof window<"u"?yo=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(yo=self.WebSocket||self.MozWebSocket);var Wk=yo,Gk=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xl,"__esModule",{value:!0});xl.ResilientWebSocket=void 0;const Hk=Gk(Wk),Kk=3e4+3e3;class Jk{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 Hk.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=Xk(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await og(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()},Kk)}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 og(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}}xl.ResilientWebSocket=Jk;async function og(e){return new Promise(t=>setTimeout(t,e))}function Xk(e){return 2**e*100}var Do={};Object.defineProperty(Do,"__esModule",{value:!0});Do.removeLeading0xIfExists=Do.makeWebsocketUrl=void 0;function Yk(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}Do.makeWebsocketUrl=Yk;function Zk(e){return e.startsWith("0x")?e.substring(2):e}Do.removeLeading0xIfExists=Zk;var f4=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ll,"__esModule",{value:!0});ll.PriceServiceConnection=void 0;const Uf=Bp,Qk=f4(n4),ag=f4(qk),e9=xl,zf=Do;class t9{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=Qk.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,ag.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:ag.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 Tn<"u"&&typeof Tn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),Tn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,zf.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=>Uf.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 Uf.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,zf.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,zf.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 e9.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=Uf.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()}}ll.PriceServiceConnection=t9;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=ll;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=Bp;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}})})($p);Object.defineProperty(ul,"__esModule",{value:!0});ul.SuiPriceServiceConnection=void 0;const r9=$p,n9=dl();class i9 extends r9.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>n9.Buffer.from(n,"base64"))}}ul.SuiPriceServiceConnection=i9;var Sl={};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.SuiPythClient=void 0;const Nc=v2,io=si,s9=dl(),Vf=16*1024;class o9{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(io.bcs.vector(io.bcs.U8).serialize(Array.from(s),{maxSize:Vf}).toBytes()),r.object(Nc.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(io.bcs.vector(io.bcs.U8).serialize(Array.from(r[0]),{maxSize:Vf}).toBytes()),a[0],t.object(Nc.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(Nc.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(io.bcs.vector(io.bcs.U8).serialize(Array.from(r[0]),{maxSize:Vf}).toBytes()),s[0],t.object(Nc.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(s9.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)}}Sl.SuiPythClient=o9;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=ul;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=Sl;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=$p;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})})(Ix);var cg=EM,Gd=v2,a9=So,Dc=Ix,c9=Object.create,Zp=Object.defineProperty,u9=Object.defineProperties,l9=Object.getOwnPropertyDescriptor,f9=Object.getOwnPropertyDescriptors,d4=Object.getOwnPropertyNames,ug=Object.getOwnPropertySymbols,d9=Object.getPrototypeOf,h4=Object.prototype.hasOwnProperty,h9=Object.prototype.propertyIsEnumerable,lg=(e,t,r)=>t in e?Zp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,p9=(e,t)=>{for(var r in t||(t={}))h4.call(t,r)&&lg(e,r,t[r]);if(ug)for(var r of ug(t))h9.call(t,r)&&lg(e,r,t[r]);return e},m9=(e,t)=>u9(e,f9(t)),g9=(e=>typeof Gn<"u"?Gn:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Gn<"u"?Gn:t)[r]}):e)(function(e){if(typeof Gn<"u")return Gn.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),v9=(e,t)=>function(){return t||(0,e[d4(e)[0]])((t={exports:{}}).exports,t),t.exports},y9=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of d4(t))!h4.call(e,i)&&i!==r&&Zp(e,i,{get:()=>t[i],enumerable:!(n=l9(t,i))||n.enumerable});return e},Yo=(e,t,r)=>(r=e!=null?c9(d9(e)):{},y9(!e||!e.__esModule?Zp(r,"default",{value:e,enumerable:!0}):r,e)),Et=(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())}),Zo=v9({"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=g9("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 M=0;d[0]==="-"&&(M++,this.negative=1),M<d.length&&(m===16?this._parseHex(d,M,x):(this._parseBase(d,m,M),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 M=0;M<this.length;M++)this.words[M]=0;var E,O,C=0;if(x==="be")for(M=d.length-1,E=0;M>=0;M-=3)O=d[M]|d[M-1]<<8|d[M-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(M=0,E=0;M<d.length;M+=3)O=d[M]|d[M+1]<<8|d[M+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 M=0;M<this.length;M++)this.words[M]=0;var E=0,O=0,C;if(x==="be")for(M=d.length-1;M>=m;M-=2)C=u(d,m,M)<<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(M=g%2===0?m+1:m;M<d.length;M+=2)C=u(d,m,M)<<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 M=0,E=0,O=Math.min(p.length,m),C=d;C<O;C++){var g=p.charCodeAt(C)-48;M*=x,g>=49?E=g-49+10:g>=17?E=g-17+10:E=g,i(g>=0&&E<x,"Invalid character"),M+=E}return M}o.prototype._parseBase=function(d,m,x){this.words=[0],this.length=1;for(var M=0,E=1;E<=67108863;E*=m)M++;M--,E=E/m|0;for(var O=d.length-x,C=O%M,g=Math.min(O,O-C)+x,v=0,j=x;j<g;j+=M)v=l(d,j,j+M,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 M=0,E=0,O=0;O<this.length;O++){var C=this.words[O],g=((C<<M|E)&16777215).toString(16);E=C>>>24-M&16777215,M+=2,M>=26&&(M-=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 ie=ee.modrn(j).toString(d);ee=ee.idivn(j),ee.isZero()?x=ie+x:x=y[v-ie.length]+ie+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 A=function(d,m){return d.allocUnsafe?d.allocUnsafe(m):new d(m)};o.prototype.toArrayLike=function(d,m,x){this._strip();var M=this.byteLength(),E=x||Math.max(1,M);i(M<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0");var O=A(d,E),C=m==="le"?"LE":"BE";return this["_toArrayLike"+C](O,M),O},o.prototype._toArrayLikeLE=function(d,m){for(var x=0,M=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|M;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),M=0,O=0):(M=C>>>24,O+=2)}if(x<d.length)for(d[x++]=M;x<d.length;)d[x++]=0},o.prototype._toArrayLikeBE=function(d,m){for(var x=d.length-1,M=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|M;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),M=0,O=0):(M=C>>>24,O+=2)}if(x>=0)for(d[x--]=M;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,M=m%26;d[m]=p.words[x]>>>M&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 M=0;M<x.length;M++)this.words[M]=m.words[M]^x.words[M];if(this!==m)for(;M<m.length;M++)this.words[M]=m.words[M];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 M=0;M<m;M++)this.words[M]=~this.words[M]&67108863;return x>0&&(this.words[M]=~this.words[M]&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,M=d%26;return this._expand(x+1),m?this.words[x]=this.words[x]|1<<M:this.words[x]=this.words[x]&~(1<<M),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,M;this.length>d.length?(x=this,M=d):(x=d,M=this);for(var E=0,O=0;O<M.length;O++)m=(x.words[O]|0)+(M.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 M,E;x>0?(M=this,E=d):(M=d,E=this);for(var O=0,C=0;C<E.length;C++)m=(M.words[C]|0)-(E.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;for(;O!==0&&C<M.length;C++)m=(M.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;if(O===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()},o.prototype.sub=function(d){return this.clone().isub(d)};function R(p,d,m){m.negative=d.negative^p.negative;var x=p.length+d.length|0;m.length=x,x=x-1|0;var M=p.words[0]|0,E=d.words[0]|0,O=M*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,ie=Math.min(v,d.length-1),ve=Math.max(0,v-p.length+1);ve<=ie;ve++){var pe=v-ve|0;M=p.words[pe]|0,E=d.words[ve]|0,O=M*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 N=function(d,m,x){var M=d.words,E=m.words,O=x.words,C=0,g,v,j,ee=M[0]|0,ie=ee&8191,ve=ee>>>13,pe=M[1]|0,Ee=pe&8191,Se=pe>>>13,Ke=M[2]|0,Ue=Ke&8191,lt=Ke>>>13,ht=M[3]|0,$e=ht&8191,mt=ht>>>13,_e=M[4]|0,ge=_e&8191,Ae=_e>>>13,qe=M[5]|0,De=qe&8191,Oe=qe>>>13,Ie=M[6]|0,Fe=Ie&8191,ft=Ie>>>13,dt=M[7]|0,Ge=dt&8191,jt=dt>>>13,xt=M[8]|0,Ze=xt&8191,Tt=xt>>>13,Nt=M[9]|0,nt=Nt&8191,St=Nt>>>13,At=E[0]|0,st=At&8191,kt=At>>>13,It=E[1]|0,it=It&8191,bt=It>>>13,Ct=E[2]|0,Ye=Ct&8191,gt=Ct>>>13,Pt=E[3]|0,ot=Pt&8191,wt=Pt>>>13,Ft=E[4]|0,k=Ft&8191,S=Ft>>>13,T=E[5]|0,B=T&8191,K=T>>>13,Z=E[6]|0,te=Z&8191,Be=Z>>>13,tt=E[7]|0,Ne=tt&8191,z=tt>>>13,oe=E[8]|0,he=oe&8191,ke=oe>>>13,He=E[9]|0,Re=He&8191,ze=He>>>13;x.negative=d.negative^m.negative,x.length=19,g=Math.imul(ie,st),v=Math.imul(ie,kt),v=v+Math.imul(ve,st)|0,j=Math.imul(ve,kt);var at=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(at>>>26)|0,at&=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(ie,it)|0,v=v+Math.imul(ie,bt)|0,v=v+Math.imul(ve,it)|0,j=j+Math.imul(ve,bt)|0;var Ht=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,g=Math.imul(Ue,st),v=Math.imul(Ue,kt),v=v+Math.imul(lt,st)|0,j=Math.imul(lt,kt),g=g+Math.imul(Ee,it)|0,v=v+Math.imul(Ee,bt)|0,v=v+Math.imul(Se,it)|0,j=j+Math.imul(Se,bt)|0,g=g+Math.imul(ie,Ye)|0,v=v+Math.imul(ie,gt)|0,v=v+Math.imul(ve,Ye)|0,j=j+Math.imul(ve,gt)|0;var Rt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Rt>>>26)|0,Rt&=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,bt)|0,v=v+Math.imul(lt,it)|0,j=j+Math.imul(lt,bt)|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(ie,ot)|0,v=v+Math.imul(ie,wt)|0,v=v+Math.imul(ve,ot)|0,j=j+Math.imul(ve,wt)|0;var Dt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,g=Math.imul(ge,st),v=Math.imul(ge,kt),v=v+Math.imul(Ae,st)|0,j=Math.imul(Ae,kt),g=g+Math.imul($e,it)|0,v=v+Math.imul($e,bt)|0,v=v+Math.imul(mt,it)|0,j=j+Math.imul(mt,bt)|0,g=g+Math.imul(Ue,Ye)|0,v=v+Math.imul(Ue,gt)|0,v=v+Math.imul(lt,Ye)|0,j=j+Math.imul(lt,gt)|0,g=g+Math.imul(Ee,ot)|0,v=v+Math.imul(Ee,wt)|0,v=v+Math.imul(Se,ot)|0,j=j+Math.imul(Se,wt)|0,g=g+Math.imul(ie,k)|0,v=v+Math.imul(ie,S)|0,v=v+Math.imul(ve,k)|0,j=j+Math.imul(ve,S)|0;var er=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(er>>>26)|0,er&=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,bt)|0,v=v+Math.imul(Ae,it)|0,j=j+Math.imul(Ae,bt)|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,wt)|0,v=v+Math.imul(lt,ot)|0,j=j+Math.imul(lt,wt)|0,g=g+Math.imul(Ee,k)|0,v=v+Math.imul(Ee,S)|0,v=v+Math.imul(Se,k)|0,j=j+Math.imul(Se,S)|0,g=g+Math.imul(ie,B)|0,v=v+Math.imul(ie,K)|0,v=v+Math.imul(ve,B)|0,j=j+Math.imul(ve,K)|0;var vr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(vr>>>26)|0,vr&=67108863,g=Math.imul(Fe,st),v=Math.imul(Fe,kt),v=v+Math.imul(ft,st)|0,j=Math.imul(ft,kt),g=g+Math.imul(De,it)|0,v=v+Math.imul(De,bt)|0,v=v+Math.imul(Oe,it)|0,j=j+Math.imul(Oe,bt)|0,g=g+Math.imul(ge,Ye)|0,v=v+Math.imul(ge,gt)|0,v=v+Math.imul(Ae,Ye)|0,j=j+Math.imul(Ae,gt)|0,g=g+Math.imul($e,ot)|0,v=v+Math.imul($e,wt)|0,v=v+Math.imul(mt,ot)|0,j=j+Math.imul(mt,wt)|0,g=g+Math.imul(Ue,k)|0,v=v+Math.imul(Ue,S)|0,v=v+Math.imul(lt,k)|0,j=j+Math.imul(lt,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(ie,te)|0,v=v+Math.imul(ie,Be)|0,v=v+Math.imul(ve,te)|0,j=j+Math.imul(ve,Be)|0;var ir=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(Ge,st),v=Math.imul(Ge,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,bt)|0,v=v+Math.imul(ft,it)|0,j=j+Math.imul(ft,bt)|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,wt)|0,v=v+Math.imul(Ae,ot)|0,j=j+Math.imul(Ae,wt)|0,g=g+Math.imul($e,k)|0,v=v+Math.imul($e,S)|0,v=v+Math.imul(mt,k)|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(lt,B)|0,j=j+Math.imul(lt,K)|0,g=g+Math.imul(Ee,te)|0,v=v+Math.imul(Ee,Be)|0,v=v+Math.imul(Se,te)|0,j=j+Math.imul(Se,Be)|0,g=g+Math.imul(ie,Ne)|0,v=v+Math.imul(ie,z)|0,v=v+Math.imul(ve,Ne)|0,j=j+Math.imul(ve,z)|0;var Kt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(Ze,st),v=Math.imul(Ze,kt),v=v+Math.imul(Tt,st)|0,j=Math.imul(Tt,kt),g=g+Math.imul(Ge,it)|0,v=v+Math.imul(Ge,bt)|0,v=v+Math.imul(jt,it)|0,j=j+Math.imul(jt,bt)|0,g=g+Math.imul(Fe,Ye)|0,v=v+Math.imul(Fe,gt)|0,v=v+Math.imul(ft,Ye)|0,j=j+Math.imul(ft,gt)|0,g=g+Math.imul(De,ot)|0,v=v+Math.imul(De,wt)|0,v=v+Math.imul(Oe,ot)|0,j=j+Math.imul(Oe,wt)|0,g=g+Math.imul(ge,k)|0,v=v+Math.imul(ge,S)|0,v=v+Math.imul(Ae,k)|0,j=j+Math.imul(Ae,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,te)|0,v=v+Math.imul(Ue,Be)|0,v=v+Math.imul(lt,te)|0,j=j+Math.imul(lt,Be)|0,g=g+Math.imul(Ee,Ne)|0,v=v+Math.imul(Ee,z)|0,v=v+Math.imul(Se,Ne)|0,j=j+Math.imul(Se,z)|0,g=g+Math.imul(ie,he)|0,v=v+Math.imul(ie,ke)|0,v=v+Math.imul(ve,he)|0,j=j+Math.imul(ve,ke)|0;var gr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(gr>>>26)|0,gr&=67108863,g=Math.imul(nt,st),v=Math.imul(nt,kt),v=v+Math.imul(St,st)|0,j=Math.imul(St,kt),g=g+Math.imul(Ze,it)|0,v=v+Math.imul(Ze,bt)|0,v=v+Math.imul(Tt,it)|0,j=j+Math.imul(Tt,bt)|0,g=g+Math.imul(Ge,Ye)|0,v=v+Math.imul(Ge,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,wt)|0,v=v+Math.imul(ft,ot)|0,j=j+Math.imul(ft,wt)|0,g=g+Math.imul(De,k)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(Oe,k)|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(Ae,B)|0,j=j+Math.imul(Ae,K)|0,g=g+Math.imul($e,te)|0,v=v+Math.imul($e,Be)|0,v=v+Math.imul(mt,te)|0,j=j+Math.imul(mt,Be)|0,g=g+Math.imul(Ue,Ne)|0,v=v+Math.imul(Ue,z)|0,v=v+Math.imul(lt,Ne)|0,j=j+Math.imul(lt,z)|0,g=g+Math.imul(Ee,he)|0,v=v+Math.imul(Ee,ke)|0,v=v+Math.imul(Se,he)|0,j=j+Math.imul(Se,ke)|0,g=g+Math.imul(ie,Re)|0,v=v+Math.imul(ie,ze)|0,v=v+Math.imul(ve,Re)|0,j=j+Math.imul(ve,ze)|0;var hn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(hn>>>26)|0,hn&=67108863,g=Math.imul(nt,it),v=Math.imul(nt,bt),v=v+Math.imul(St,it)|0,j=Math.imul(St,bt),g=g+Math.imul(Ze,Ye)|0,v=v+Math.imul(Ze,gt)|0,v=v+Math.imul(Tt,Ye)|0,j=j+Math.imul(Tt,gt)|0,g=g+Math.imul(Ge,ot)|0,v=v+Math.imul(Ge,wt)|0,v=v+Math.imul(jt,ot)|0,j=j+Math.imul(jt,wt)|0,g=g+Math.imul(Fe,k)|0,v=v+Math.imul(Fe,S)|0,v=v+Math.imul(ft,k)|0,j=j+Math.imul(ft,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,te)|0,v=v+Math.imul(ge,Be)|0,v=v+Math.imul(Ae,te)|0,j=j+Math.imul(Ae,Be)|0,g=g+Math.imul($e,Ne)|0,v=v+Math.imul($e,z)|0,v=v+Math.imul(mt,Ne)|0,j=j+Math.imul(mt,z)|0,g=g+Math.imul(Ue,he)|0,v=v+Math.imul(Ue,ke)|0,v=v+Math.imul(lt,he)|0,j=j+Math.imul(lt,ke)|0,g=g+Math.imul(Ee,Re)|0,v=v+Math.imul(Ee,ze)|0,v=v+Math.imul(Se,Re)|0,j=j+Math.imul(Se,ze)|0;var Dr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,g=Math.imul(nt,Ye),v=Math.imul(nt,gt),v=v+Math.imul(St,Ye)|0,j=Math.imul(St,gt),g=g+Math.imul(Ze,ot)|0,v=v+Math.imul(Ze,wt)|0,v=v+Math.imul(Tt,ot)|0,j=j+Math.imul(Tt,wt)|0,g=g+Math.imul(Ge,k)|0,v=v+Math.imul(Ge,S)|0,v=v+Math.imul(jt,k)|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(ft,B)|0,j=j+Math.imul(ft,K)|0,g=g+Math.imul(De,te)|0,v=v+Math.imul(De,Be)|0,v=v+Math.imul(Oe,te)|0,j=j+Math.imul(Oe,Be)|0,g=g+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,z)|0,v=v+Math.imul(Ae,Ne)|0,j=j+Math.imul(Ae,z)|0,g=g+Math.imul($e,he)|0,v=v+Math.imul($e,ke)|0,v=v+Math.imul(mt,he)|0,j=j+Math.imul(mt,ke)|0,g=g+Math.imul(Ue,Re)|0,v=v+Math.imul(Ue,ze)|0,v=v+Math.imul(lt,Re)|0,j=j+Math.imul(lt,ze)|0;var pn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(pn>>>26)|0,pn&=67108863,g=Math.imul(nt,ot),v=Math.imul(nt,wt),v=v+Math.imul(St,ot)|0,j=Math.imul(St,wt),g=g+Math.imul(Ze,k)|0,v=v+Math.imul(Ze,S)|0,v=v+Math.imul(Tt,k)|0,j=j+Math.imul(Tt,S)|0,g=g+Math.imul(Ge,B)|0,v=v+Math.imul(Ge,K)|0,v=v+Math.imul(jt,B)|0,j=j+Math.imul(jt,K)|0,g=g+Math.imul(Fe,te)|0,v=v+Math.imul(Fe,Be)|0,v=v+Math.imul(ft,te)|0,j=j+Math.imul(ft,Be)|0,g=g+Math.imul(De,Ne)|0,v=v+Math.imul(De,z)|0,v=v+Math.imul(Oe,Ne)|0,j=j+Math.imul(Oe,z)|0,g=g+Math.imul(ge,he)|0,v=v+Math.imul(ge,ke)|0,v=v+Math.imul(Ae,he)|0,j=j+Math.imul(Ae,ke)|0,g=g+Math.imul($e,Re)|0,v=v+Math.imul($e,ze)|0,v=v+Math.imul(mt,Re)|0,j=j+Math.imul(mt,ze)|0;var ui=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ui>>>26)|0,ui&=67108863,g=Math.imul(nt,k),v=Math.imul(nt,S),v=v+Math.imul(St,k)|0,j=Math.imul(St,S),g=g+Math.imul(Ze,B)|0,v=v+Math.imul(Ze,K)|0,v=v+Math.imul(Tt,B)|0,j=j+Math.imul(Tt,K)|0,g=g+Math.imul(Ge,te)|0,v=v+Math.imul(Ge,Be)|0,v=v+Math.imul(jt,te)|0,j=j+Math.imul(jt,Be)|0,g=g+Math.imul(Fe,Ne)|0,v=v+Math.imul(Fe,z)|0,v=v+Math.imul(ft,Ne)|0,j=j+Math.imul(ft,z)|0,g=g+Math.imul(De,he)|0,v=v+Math.imul(De,ke)|0,v=v+Math.imul(Oe,he)|0,j=j+Math.imul(Oe,ke)|0,g=g+Math.imul(ge,Re)|0,v=v+Math.imul(ge,ze)|0,v=v+Math.imul(Ae,Re)|0,j=j+Math.imul(Ae,ze)|0;var li=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(li>>>26)|0,li&=67108863,g=Math.imul(nt,B),v=Math.imul(nt,K),v=v+Math.imul(St,B)|0,j=Math.imul(St,K),g=g+Math.imul(Ze,te)|0,v=v+Math.imul(Ze,Be)|0,v=v+Math.imul(Tt,te)|0,j=j+Math.imul(Tt,Be)|0,g=g+Math.imul(Ge,Ne)|0,v=v+Math.imul(Ge,z)|0,v=v+Math.imul(jt,Ne)|0,j=j+Math.imul(jt,z)|0,g=g+Math.imul(Fe,he)|0,v=v+Math.imul(Fe,ke)|0,v=v+Math.imul(ft,he)|0,j=j+Math.imul(ft,ke)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,ze)|0,v=v+Math.imul(Oe,Re)|0,j=j+Math.imul(Oe,ze)|0;var mn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(mn>>>26)|0,mn&=67108863,g=Math.imul(nt,te),v=Math.imul(nt,Be),v=v+Math.imul(St,te)|0,j=Math.imul(St,Be),g=g+Math.imul(Ze,Ne)|0,v=v+Math.imul(Ze,z)|0,v=v+Math.imul(Tt,Ne)|0,j=j+Math.imul(Tt,z)|0,g=g+Math.imul(Ge,he)|0,v=v+Math.imul(Ge,ke)|0,v=v+Math.imul(jt,he)|0,j=j+Math.imul(jt,ke)|0,g=g+Math.imul(Fe,Re)|0,v=v+Math.imul(Fe,ze)|0,v=v+Math.imul(ft,Re)|0,j=j+Math.imul(ft,ze)|0;var fi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(fi>>>26)|0,fi&=67108863,g=Math.imul(nt,Ne),v=Math.imul(nt,z),v=v+Math.imul(St,Ne)|0,j=Math.imul(St,z),g=g+Math.imul(Ze,he)|0,v=v+Math.imul(Ze,ke)|0,v=v+Math.imul(Tt,he)|0,j=j+Math.imul(Tt,ke)|0,g=g+Math.imul(Ge,Re)|0,v=v+Math.imul(Ge,ze)|0,v=v+Math.imul(jt,Re)|0,j=j+Math.imul(jt,ze)|0;var di=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(di>>>26)|0,di&=67108863,g=Math.imul(nt,he),v=Math.imul(nt,ke),v=v+Math.imul(St,he)|0,j=Math.imul(St,ke),g=g+Math.imul(Ze,Re)|0,v=v+Math.imul(Ze,ze)|0,v=v+Math.imul(Tt,Re)|0,j=j+Math.imul(Tt,ze)|0;var D=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(D>>>26)|0,D&=67108863,g=Math.imul(nt,Re),v=Math.imul(nt,ze),v=v+Math.imul(St,Re)|0,j=Math.imul(St,ze);var H=(C+g|0)+((v&8191)<<13)|0;return C=(j+(v>>>13)|0)+(H>>>26)|0,H&=67108863,O[0]=at,O[1]=Ht,O[2]=Rt,O[3]=Dt,O[4]=er,O[5]=vr,O[6]=ir,O[7]=Kt,O[8]=gr,O[9]=hn,O[10]=Dr,O[11]=pn,O[12]=ui,O[13]=li,O[14]=mn,O[15]=fi,O[16]=di,O[17]=D,O[18]=H,C!==0&&(O[19]=C,x.length++),x};Math.imul||(N=R);function F(p,d,m){m.negative=d.negative^p.negative,m.length=p.length+d.length;for(var x=0,M=0,E=0;E<m.length-1;E++){var O=M;M=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,ie=d.words[v]|0,ve=ee*ie,pe=ve&67108863;O=O+(ve/67108864|0)|0,pe=pe+C|0,C=pe&67108863,O=O+(pe>>>26)|0,M+=O>>>26,O&=67108863}m.words[E]=C,x=O,O=M}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,M=this.length+d.length;return this.length===10&&d.length===10?x=N(this,d,m):M<63?x=R(this,d,m):M<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,M=0;M<this.length;M++){var E=(this.words[M]|0)*d,O=(E&67108863)+(x&67108863);x>>=26,x+=E/67108864|0,x+=O>>>26,this.words[M]=O&67108863}return x!==0&&(this.words[M]=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,M=0;M<m.length&&m[M]===0;M++,x=x.sqr());if(++M<m.length)for(var E=x.sqr();M<m.length;M++,E=E.sqr())m[M]!==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,M=67108863>>>26-m<<26-m,E;if(m!==0){var O=0;for(E=0;E<this.length;E++){var C=this.words[E]&M,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 M;m?M=(m-m%26)/26:M=0;var E=d%26,O=Math.min((d-E)/26,this.length),C=67108863^67108863>>>E<<E,g=x;if(M-=O,M=Math.max(0,M),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>=M);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,M=1<<m;if(this.length<=x)return!1;var E=this.words[x];return!!(E&M)},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 M=67108863^67108863>>>m<<m;this.words[this.length-1]&=M}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 M=d.length+x,E;this._expand(M);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,M=this.clone(),E=d,O=E.words[E.length-1]|0,C=this._countBits(O);x=26-C,x!==0&&(E=E.ushln(x),M.iushln(x),O=E.words[E.length-1]|0);var g=M.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=M.clone()._ishlnsubmul(E,1,g);ee.negative===0&&(M=ee,v&&(v.words[g]=1));for(var ie=g-1;ie>=0;ie--){var ve=(M.words[E.length+ie]|0)*67108864+(M.words[E.length+ie-1]|0);for(ve=Math.min(ve/O|0,67108863),M._ishlnsubmul(E,ve,ie);M.negative!==0;)ve--,M.negative=0,M._ishlnsubmul(E,1,ie),M.isZero()||(M.negative^=1);v&&(v.words[ie]=ve)}return v&&v._strip(),M._strip(),m!=="div"&&x!==0&&M.iushrn(x),{div:v||null,mod:M}},o.prototype.divmod=function(d,m,x){if(i(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var M,E,O;return this.negative!==0&&d.negative===0?(O=this.neg().divmod(d,m),m!=="mod"&&(M=O.div.neg()),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.iadd(d)),{div:M,mod:E}):this.negative===0&&d.negative!==0?(O=this.divmod(d.neg(),m),m!=="mod"&&(M=O.div.neg()),{div:M,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,M=d.ushrn(1),E=d.andln(1),O=x.cmp(M);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,M=0,E=this.length-1;E>=0;E--)M=(x*M+(this.words[E]|0))%d;return m?-M:M},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,M=this.length-1;M>=0;M--){var E=(this.words[M]|0)+x*67108864;this.words[M]=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 M=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,ie=1;!(m.words[0]&ie)&&ee<26;++ee,ie<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(M.isOdd()||E.isOdd())&&(M.iadd(v),E.isub(j)),M.iushrn(1),E.iushrn(1);for(var ve=0,pe=1;!(x.words[0]&pe)&&ve<26;++ve,pe<<=1);if(ve>0)for(x.iushrn(ve);ve-- >0;)(O.isOdd()||C.isOdd())&&(O.iadd(v),C.isub(j)),O.iushrn(1),C.iushrn(1);m.cmp(x)>=0?(m.isub(x),M.isub(O),E.isub(C)):(x.isub(m),O.isub(M),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 M=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;)M.isOdd()&&M.iadd(O),M.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),M.isub(E)):(x.isub(m),E.isub(M))}var ee;return m.cmpn(1)===0?ee=M: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 M=0;m.isEven()&&x.isEven();M++)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(M)},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,M=1<<m;if(this.length<=x)return this._expand(x+1),this.words[x]|=M,this;for(var E=M,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 M=this.words[0]|0;x=M===d?0:M<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 M=this.words[x]|0,E=d.words[x]|0;if(M!==E){M<E?m=-1:M>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 V(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 M=x<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(d,m){d.iushrn(this.n,0,m)},q.prototype.imulK=function(d){return d.imul(this.k)};function J(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(J,q),J.prototype.split=function(d,m){for(var x=4194303,M=Math.min(d.length,9),E=0;E<M;E++)m.words[E]=d.words[E];if(m.length=M,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},J.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 M=d.words[x]|0;m+=M*977,d.words[x]=m&67108863,m=M*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function ne(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(ne,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 M=(d.words[x]|0)*19+m,E=M&67108863;M>>>=26,d.words[x]=E,m=M}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 J;else if(d==="p224")m=new ne;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 V(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}V.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},V.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")},V.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(f(d,d.umod(this.m)._forceRed(this)),d)},V.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},V.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)},V.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},V.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)},V.prototype.isub=function(d,m){this._verify2(d,m);var x=d.isub(m);return x.cmpn(0)<0&&x.iadd(this.m),x},V.prototype.shl=function(d,m){return this._verify1(d),this.imod(d.ushln(m))},V.prototype.imul=function(d,m){return this._verify2(d,m),this.imod(d.imul(m))},V.prototype.mul=function(d,m){return this._verify2(d,m),this.imod(d.mul(m))},V.prototype.isqr=function(d){return this.imul(d,d.clone())},V.prototype.sqr=function(d){return this.mul(d,d)},V.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 M=this.m.subn(1),E=0;!M.isZero()&&M.andln(1)===0;)E++,M.iushrn(1);i(!M.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,M),ee=this.pow(d,M.addn(1).iushrn(1)),ie=this.pow(d,M),ve=E;ie.cmp(O)!==0;){for(var pe=ie,Ee=0;pe.cmp(O)!==0;Ee++)pe=pe.redSqr();i(Ee<ve);var Se=this.pow(j,new o(1).iushln(ve-Ee-1));ee=ee.redMul(Se),j=Se.redSqr(),ie=ie.redMul(j),ve=Ee}return ee},V.prototype.invm=function(d){var m=d._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},V.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,M=new Array(1<<x);M[0]=new o(1).toRed(this),M[1]=d;for(var E=2;E<M.length;E++)M[E]=this.mul(M[E-1],d);var O=M[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 ie=j>>ee&1;if(O!==M[0]&&(O=this.sqr(O)),ie===0&&C===0){g=0;continue}C<<=1,C|=ie,g++,!(g!==x&&(E!==0||ee!==0))&&(O=this.mul(O,M[C]),g=0,C=0)}v=26}return O},V.prototype.convertTo=function(d){var m=d.umod(this.m);return m===d?m.clone():m},V.prototype.convertFrom=function(d){var m=d.clone();return m.red=null,m},o.mont=function(d){return new $(d)};function $(p){V.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($,V),$.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},$.prototype.convertFrom=function(d){var m=this.imod(d.mul(this.rinv));return m.red=null,m},$.prototype.imul=function(d,m){if(d.isZero()||m.isZero())return d.words[0]=0,d.length=1,d;var x=d.imul(m),M=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(M).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)},$.prototype.mul=function(d,m){if(d.isZero()||m.isZero())return new o(0)._forceRed(this);var x=d.mul(m),M=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(M).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)},$.prototype.invm=function(d){var m=this.imod(d._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),Co=9e15,ms=1e9,Hd="0123456789abcdef",Nu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Du="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Kd={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Co,maxE:Co,crypto:!1},p4,Mi,ct=!0,El="[DecimalError] ",os=El+"Invalid argument: ",m4=El+"Precision limit exceeded",g4=El+"crypto unavailable",v4="[object Decimal]",Tr=Math.floor,hr=Math.pow,b9=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,w9=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,_9=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,y4=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,On=1e7,Qe=7,x9=9007199254740991,S9=Nu.length-1,Jd=Du.length-1,be={toStringTag:v4};be.absoluteValue=be.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Je(e)};be.ceil=function(){return Je(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(os+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())+Qe,n.rounding=1,r=E9(n,S4(n,r)),n.precision=e,n.rounding=t,Je(Mi==2||Mi==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(ct=!1,s=l.s*hr(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=hr(r,1/3),e=Tr((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=Vt(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)};be.decimalPlaces=be.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Tr(this.e/Qe))*Qe,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};be.dividedBy=be.div=function(e){return Vt(this,new this.constructor(e))};be.dividedToIntegerBy=be.divToInt=function(e){var t=this,r=t.constructor;return Je(Vt(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 Je(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/Ml(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 Je(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/Ml(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,Je(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,Vt(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()?En(r,i,s):new r(0):new r(NaN):t.isZero()?En(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=En(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,ct=!1,r=r.times(r).minus(1).sqrt().plus(r),ct=!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,ct=!1,r=r.times(r).plus(1).sqrt().plus(r),ct=!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?Je(new s(i),e,t,!0):(s.precision=r=n-i.e,i=Vt(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=En(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<=Jd)return o=En(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=Jd)return o=En(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)};be.isFinite=function(){return!!this.d};be.isInteger=be.isInt=function(){return!!this.d&&Tr(this.e/Qe)>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(ct=!1,a=f+y,o=Zi(u,a),n=t?$u(l,a+10):Zi(e,a),c=Vt(o,n,a,1),Qa(c.d,i=f,h))do if(a+=10,o=Zi(u,a),n=t?$u(l,a+10):Zi(e,a),c=Vt(o,n,a,1),!s){+_r(c.d).slice(i+1,i+15)+1==1e14&&(c=Je(c,f+1,0));break}while(Qa(c.d,i+=10,h));return ct=!0,Je(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 ct?Je(e,a,c):e}if(r=Tr(e.e/Qe),l=Tr(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]=On-1;--u[i],u[n]+=On}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=Cl(u,r),ct?Je(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]?Je(new n(r),n.precision,n.rounding):(ct=!1,n.modulo==9?(t=Vt(r,e.abs(),0,3,1),t.s*=e.s):t=Vt(r,e,0,n.modulo,1),t=t.times(e),ct=!0,r.minus(t))};be.naturalExponential=be.exp=function(){return Xd(this)};be.naturalLogarithm=be.ln=function(){return Zi(this)};be.negated=be.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Je(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)),ct?Je(e,a,c):e;if(s=Tr(f.e/Qe),n=Tr(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)/On|0,u[i]%=On;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Cl(u,n),ct?Je(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(os+e);return r.d?(t=b4(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};be.round=function(){var e=this,t=e.constructor;return Je(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())+Qe,n.rounding=1,r=M9(n,S4(n,r)),n.precision=e,n.rounding=t,Je(Mi>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(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=Tr((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(Vt(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)};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=Vt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Je(Mi==2||Mi==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=Tr(l.e/Qe)+Tr(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%On|0,t=a/On|0;s[i]=(s[i]+t)%On|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Cl(s,r),ct?Je(e,f.precision,f.rounding):e};be.toBinary=function(e,t){return Qp(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:(Fr(e,0,ms),t===void 0?t=n.rounding:Fr(t,0,8),Je(r,e+r.e+1,t))};be.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ei(n,!0):(Fr(e,0,ms),t===void 0?t=i.rounding:Fr(t,0,8),n=Je(new i(n),e+1,t),r=ei(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=ei(i):(Fr(e,0,ms),t===void 0?t=s.rounding:Fr(t,0,8),n=Je(new s(i),e+i.e+1,t),r=ei(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=b4(b)-y.e-1,o=s%Qe,t.d[0]=hr(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(os+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=Vt(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=Vt(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=Vt(u,n,s,1).minus(y).abs().cmp(Vt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,ct=!0,h};be.toHexadecimal=be.toHex=function(e,t){return Qp(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:Fr(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=Vt(r,e,0,t,1).times(e),ct=!0,Je(r)):(e.s=r.s,r=e),r};be.toNumber=function(){return+this};be.toOctal=function(e,t){return Qp(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(hr(+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=Tr(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=x9)return i=w4(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=hr(+a,u),t=r==0||!isFinite(r)?Tr(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=Xd(e.times(Zi(a,n+r)),n),i.d&&(i=Je(i,n+5,1),Qa(i.d,n,s)&&(t=n+10,i=Je(Xd(e.times(Zi(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))};be.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ei(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Fr(e,1,ms),t===void 0?t=i.rounding:Fr(t,0,8),n=Je(new i(n),e,t),r=ei(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):(Fr(e,1,ms),t===void 0?t=n.rounding:Fr(t,0,8)),Je(new n(r),e,t)};be.toString=function(){var e=this,t=e.constructor,r=ei(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};be.truncated=be.trunc=function(){return Je(new this.constructor(this),this.e+1,1)};be.valueOf=be.toJSON=function(){var e=this,t=e.constructor,r=ei(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+=Ji(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=Ji(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Fr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(os+e)}function Qa(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=hr(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)==hr(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)==hr(10,t-3)-1,o}function au(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]+=Hd.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 E9(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Ml(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 Vt=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,A,P,R,N,F,L,G,q,J,ne,ae,ce,V,$=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new $(!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=On,y=Qe,l=Tr(n.e/y)-Tr(i.e/y)),ce=m.length,ne=d.length,P=new $(p),R=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=$.precision,o=$.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)R.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ne||h)&&G--;f++)q=h*c+(d[f]||0),R[f]=q/m|0,h=q%m|0;b=h||f<ne}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ne=d.length),J=ce,N=d.slice(0,ce),F=N.length;F<ce;)N[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,N,ce,F),u<0?(L=N[0],ce!=F&&(L=L*c+(N[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,F=N.length,u=t(w,N,A,F),u==1&&(h--,r(w,ce<A?V:m,A,c))):(h==0&&(u=h=1),w=m.slice()),A=w.length,A<F&&w.unshift(0),r(N,w,F,c),u==-1&&(F=N.length,u=t(m,N,ce,F),u<1&&(h++,r(N,ce<F?V:m,F,c))),F=N.length):u===0&&(h++,N=[0]),R[f++]=h,u&&N[0]?N[F++]=d[J]||0:(N=[d[J]],F=1);while((J++<ne||N[0]!==void 0)&&G--);b=N[0]!==void 0}R[0]||R.shift()}if(y==1)P.e=l,p4=b;else{for(f=1,h=R[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/hr(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/hr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%hr(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/hr(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]=hr(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=hr(10,Qe-s),f[h]=o>0?(l/hr(10,i-o)%hr(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]==On&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=On)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 ei(e,t,r){if(!e.isFinite())return x4(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)+Ji(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Ji(-i-1)+s,r&&(n=r-o)>0&&(s+=Ji(n))):i>=o?(s+=Ji(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+Ji(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=Ji(n))),s}function Cl(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function $u(e,t,r){if(t>S9)throw ct=!0,r&&(e.precision=r),Error(m4);return Je(new e(Nu),t,1,!0)}function En(e,t,r){if(t>Jd)throw Error(m4);return Je(new e(Du),t,r,!0)}function b4(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 Ji(e){for(var t="";e--;)t+="0";return t}function w4(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),dg(s.d,o)&&(i=!0)),r=Tr(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),dg(t.d,o)}return ct=!0,s}function fg(e){return e.d[e.d.length-1]&1}function _4(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 Xd(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(hr(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(Vt(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&&Qa(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 Zi(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,A=w.d,P=w.constructor,R=P.rounding,N=P.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(ct=!1,l=N):l=t,P.precision=l+=b,r=_r(A),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=$u(P,l+2,N).times(s+""),w=Zi(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=N,t==null?Je(w,N,R,ct=!0):w;for(f=w,c=o=w=Vt(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(Vt(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($u(P,l+2,N).times(s+""))),c=Vt(c,new P(y),l,1),t==null)if(Qa(c.d,l-b,R,a))P.precision=l+=b,u=o=w=Vt(f.minus(1),f.plus(1),l,1),h=Je(w.times(w),l,1),i=a=1;else return Je(c,P.precision=N,R,ct=!0);else return P.precision=N,c;c=u,i+=2}}function x4(e){return String(e.s*e.s/0)}function Yd(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 C9(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),y4.test(t))return Yd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(w9.test(t))r=16,t=t.toLowerCase();else if(b9.test(t))r=2;else if(_9.test(t))r=8;else throw Error(os+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=w4(n,new n(r),s,s*2)),u=au(t,r,On),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Cl(u,l),e.d=u,ct=!1,o&&(e=Vt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?hr(2,c):bc.pow(2,c))),ct=!0,e)}function M9(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/Ml(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/Qe);for(ct=!1,c=r.times(r),a=new e(n);;){if(o=Vt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=Vt(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 Ml(e,t){for(var r=e;--t;)r*=e;return r}function S4(e,t){var r,n=t.s<0,i=En(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Mi=n?4:1,t;if(r=t.divToInt(i),r.isZero())Mi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Mi=fg(r)?n?2:3:n?4:1,t;Mi=fg(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Qp(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(Fr(r,1,ms),n===void 0?n=y.rounding:Fr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=x4(e);else{for(l=ei(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=au(ei(h),10,i),h.e=h.d.length),f=au(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=Vt(e,h,r,n,0,i),f=e.d,s=e.e,u=p4),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+=Hd.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=au(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Hd.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 dg(e,t){if(e.length>t)return e.length=t,!0}function T9(e){return new this(e).abs()}function A9(e){return new this(e).acos()}function O9(e){return new this(e).acosh()}function I9(e,t){return new this(e).plus(t)}function P9(e){return new this(e).asin()}function j9(e){return new this(e).asinh()}function k9(e){return new this(e).atan()}function R9(e){return new this(e).atanh()}function N9(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=En(this,s,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,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(Vt(e,t,s,1)),t=En(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Vt(e,t,s,1)),r}function D9(e){return new this(e).cbrt()}function $9(e){return Je(e=new this(e),e.e+1,2)}function B9(e,t,r){return new this(e).clamp(t,r)}function L9(e){if(!e||typeof e!="object")throw Error(El+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,ms,"rounding",0,8,"toExpNeg",-Co,0,"toExpPos",0,Co,"maxE",0,Co,"minE",-Co,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=Kd[r]),(n=e[r])!==void 0)if(Tr(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(os+r+": "+n);if(r="crypto",i&&(this[r]=Kd[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(g4);else this[r]=!1;else throw Error(os+r+": "+n);return this}function F9(e){return new this(e).cos()}function U9(e){return new this(e).cosh()}function E4(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,hg(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 Yd(u,s.toString())}else if(c!=="string")throw Error(os+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),y4.test(s)?Yd(u,s):C9(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=L9,i.clone=E4,i.isDecimal=hg,i.abs=T9,i.acos=A9,i.acosh=O9,i.add=I9,i.asin=P9,i.asinh=j9,i.atan=k9,i.atanh=R9,i.atan2=N9,i.cbrt=D9,i.ceil=$9,i.clamp=B9,i.cos=F9,i.cosh=U9,i.div=z9,i.exp=V9,i.floor=q9,i.hypot=W9,i.ln=G9,i.log=H9,i.log10=J9,i.log2=K9,i.max=X9,i.min=Y9,i.mod=Z9,i.mul=Q9,i.pow=eR,i.random=tR,i.round=rR,i.sign=nR,i.sin=iR,i.sinh=sR,i.sqrt=oR,i.sub=aR,i.sum=cR,i.tan=uR,i.tanh=lR,i.trunc=fR,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 z9(e,t){return new this(e).div(t)}function V9(e){return new this(e).exp()}function q9(e){return Je(e=new this(e),e.e+1,3)}function W9(){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 hg(e){return e instanceof bc||e&&e.toStringTag===v4||!1}function G9(e){return new this(e).ln()}function H9(e,t){return new this(e).log(t)}function K9(e){return new this(e).log(2)}function J9(e){return new this(e).log(10)}function X9(){return _4(this,arguments,"lt")}function Y9(){return _4(this,arguments,"gt")}function Z9(e,t){return new this(e).mod(t)}function Q9(e,t){return new this(e).mul(t)}function eR(e,t){return new this(e).pow(t)}function tR(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Fr(e,1,ms),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(g4);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Qe,n&&e&&(i=hr(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 rR(e){return Je(e=new this(e),e.e+1,this.rounding)}function nR(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function iR(e){return new this(e).sin()}function sR(e){return new this(e).sinh()}function oR(e){return new this(e).sqrt()}function aR(e,t){return new this(e).sub(t)}function cR(){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 uR(e){return new this(e).tan()}function lR(e){return new this(e).tanh()}function fR(e){return Je(e=new this(e),e.e+1,1)}be[Symbol.for("nodejs.util.inspect.custom")]=be.toString;be[Symbol.toStringTag]="Decimal";var bc=be.constructor=E4(Kd);Nu=new bc(Nu);Du=new bc(Du);var cu=bc,Qi=Yo(Zo()),qf=Yo(Zo()),dR=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 qf.default(e).mul(new qf.default(this.slippage)).div(new qf.default("1000000000000000000")).toString()}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,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 l=[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];return t.moveCall({target:`${e.publishedAt()}::aftermath::${a}`,typeArguments:[c,u,r.extendedDetails.aftermathLpSupplyType],arguments:l})})}},pg="0x000000000000000000000000000000000000000000000000000000000000dee9",hR=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return Et(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:pg,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 Et(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${pg}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=yield this.getOrCreateAccountCap(t,e.client,e.signer),f=[t.object(r.id),n,l.accountCap,t.object(ti)],h=t.moveCall({target:`${e.publishedAt()}::deepbook::${a}`,typeArguments:[c,u],arguments:f});return l.isCreate&&t.transferObjects([l.accountCap],e.signer),h})}},pR=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n];return t.moveCall({target:`${e.publishedAt()}::kriya_amm::${a}`,typeArguments:[c,u],arguments:l})})}},mR=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n,t.object(this.version),t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::kriya_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},gR=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.container),n];return t.moveCall({target:`${e.publishedAt()}::flowx_amm::${a}`,typeArguments:[c,u],arguments:l})})}},vR=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){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.poolRegistry),t.pure.u64(r.feeRate*1e6),n,t.object(this.versioned),t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::flowx_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},yR=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,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 l=[t.object(r.id),n,t.object(ti),t.object(this.versioned)];return t.moveCall({target:`${e.publishedAt()}::turbos::${a}`,typeArguments:[c,u,r.extendedDetails.turbosFeeType],arguments:l})})}},mg=class{constructor(e,t){this.globalConfig=e===0?"0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f":"0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e",this.partner=t??(e===0?"0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b":"0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5")}flash_swap(e,t,r,n){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["flash_swap_a2b",s,o]:["flash_swap_b2a",o,s];let l=n?r.amountIn:r.amountOut;const f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),t.pure.u64(l),t.pure.bool(n),t.object(ti)],h=t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:f});return{targetCoin:h[0],flashReceipt:h[1],payAmount:h[2]}}repay_flash_swap(e,t,r,n,i){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["repay_flash_swap_a2b",o,a]:["repay_flash_swap_b2a",a,o],f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,i];return t.moveCall({target:`${e.publishedAt()}::cetus::${c}`,typeArguments:[u,l],arguments:f})[0]}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:l})})}};function gg(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 bR(e){return e.split("::")[0]}function Vs(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=Vs(r),u=m9(p9({},c),{type_arguments:i.map(l=>Vs(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>Ps.isSuiCoin(l)?l:Vs(l).source_address),u.source_address=gg(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===C4||r===xR?"0x2":Gd.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=gg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function vg(e){return Vs(e).source_address}var wR="0x2::coin::Coin",_R=/^0x2::coin::Coin<(.+)>$/,C4="0x2::sui::SUI",xR="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",Ps=class Gi{static getCoinTypeArg(t){const r=t.type.match(_R);return r?r[1]:null}static isSUI(t){const r=Gi.getCoinTypeArg(t);return r?Gi.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`${wR}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{vg(i.coinAddress)===vg(t)&&n.push(i)}),n}static isSuiCoin(t){return Vs(t).full_address===C4}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=Gi.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=Gi.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=Gi.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:Gi.sortByBalance(a),remainingCoins:Gi.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 Wf(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 SR(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 M4(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function Gf(e,t,r,n){const i=Ps.getCoinAssets(n,t);if(r===BigInt(0)&&i.length===0)return{targetCoin:M4(e,n),isMintZeroCoin:!0,targetCoinAmount:0};if(Ps.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(Ps.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=Ps.sortByBalance(i);o.slice(0,3).reduce((f,h)=>f+h.balance,BigInt(0))<BigInt(r)&&(o=Ps.sortByBalanceDes(i));let c=Ps.selectCoinObjectIdGreaterThanOrEqual(o,r);const[u,...l]=c.objectArray;return l.length>0&&e.mergeCoins(u,l.map(f=>e.object(f))),{targetCoin:e.object(u),isMintZeroCoin:!1,targetCoinAmount:Number(r.toString())}}function ER(e,t=!0){return Et(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 CR(e){return!(!e.startsWith("0x")||e.length!==66)}var so=Yo(Zo()),es=Yo(Zo()),wc=Yo(Zo()),Si=new wc.default(0);new wc.default(1);var MR=new wc.default(2);MR.pow(new wc.default(128));var TR=new wc.default("18446744073709551615"),nn=1e9;function AR(e,t,r){let n=Si;return t?n=e.mul(new es.default(nn-r*nn)).div(new es.default(nn)):n=e.mul(new es.default(nn+r*nn)).div(new es.default(nn)),Number(n.toString())}function OR(e,t,r){let n=Si;return t?n=e.mul(new es.default(nn-r*nn)).div(new es.default(nn)):n=e.mul(new es.default(nn+r*nn)).div(new es.default(nn)),n}function IR(e,t,r){return new cu(e).mul(cu.pow(2,-64)).pow(2).mul(cu.pow(10,t-r))}function PR(e,t,r,n){return Et(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),A=new a9.Transaction,P=SR(b,w),R=n===0?"0x3a5aa90ffa33d09100d7b6941ea1c0ffe6ab66e77062ddd26320c1b073aabb10":"0x19dd42e05fa6c9988a60d30686ee3feb776672b5547e328d6dab16563da65293",N=P?b:w,F=P?w:b,L=[N,F];console.log("typeArguments",L,R);for(let C=0;C<y.length;C++){const g=[A.object(y[C]),A.pure.bool(P),A.pure.bool(h),A.pure.u64(f.toString())];A.moveCall({target:`${R}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:L})}if(!CR(r))throw new AggregateError("Aggregator package not set","InvalidWallet");ER(A);const G=yield e.devInspectTransactionBlock({transactionBlock:A,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 J=h?Si:TR,ne=0;for(let C=0;C<q.length;C+=1)if(!q[C].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new so.BN(q[C].parsedJson.data.amount_out);g.gt(J)&&(ne=C,J=g)}else{const g=new so.BN(q[C].parsedJson.data.amount_out);g.lt(J)&&(ne=C,J=g)}const ae=q[ne].parsedJson.data;console.log("event",JSON.stringify(ae,null,2));const ce=ae.step_results[0].current_sqrt_price,[V,$]=yield Promise.all([e.getCoinMetadata({coinType:N}).then(C=>C==null?void 0:C.decimals),e.getCoinMetadata({coinType:F}).then(C=>C==null?void 0:C.decimals)]);if(V==null||$==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const p=IR(ce,V,$),d=Number(ae.fee_rate)/1e6,m=new so.BN((s=ae.amount_in)!=null?s:0),x=new so.BN((o=ae.fee_amount)!=null?o:0),M=m.add(x),E={amountIn:M,amountOut:new so.BN((a=ae.amount_out)!=null?a:0),routes:[{path:[{id:y[ne],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:M,amountOut:new so.BN((c=ae.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1};return{isExceed:ae.is_exceed,routeData:E}})}var jR=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Haedal not support b2a swap");const s="swap_a2b",o=[t.object(r.id),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::haedal::${s}`,typeArguments:[],arguments:o})})}},kR=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){return Et(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Afsui not support b2a swap");const s="swap_a2b",o=[t.object(this.stakedSuiVault),t.object(this.safe),t.object("0x5"),t.object(this.referVault),t.object(this.validator),n];return t.moveCall({target:`${e.publishedAt()}::afsui::${s}`,typeArguments:[],arguments:o})})}},RR=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){return Et(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Volo not support b2a swap");const s="swap_a2b",o=[t.object(this.nativePool),t.object(this.metadata),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::volo::${s}`,typeArguments:[],arguments:o})})}},NR=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.dexInfo),n];return t.moveCall({target:`${e.publishedAt()}::bluemove::${a}`,typeArguments:[c,u],arguments:l})})}},DR=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i){return Et(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;i?f=i:f=M4(t,e.deepbookv3DeepFeeType());const h=[t.object(this.deepbookV3Config),t.object(r.id),n,f,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::deepbookv3::${c}`,typeArguments:[u,l],arguments:h})})}},$R=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){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",s,o];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 l=[t.object(this.version),t.object(this.market),t.object(r.extendedDetails.scallopScoinTreasury),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::scallop::${a}`,typeArguments:[c,u],arguments:l})})}},BR=class{constructor(e){if(e!==0)throw new Error("Suilend only supported on mainnet");this.liquid_staking_pool=e===0?"0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b":"0x0",this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c]=i?["swap_a2b",o]:["swap_b2a",s],u=[t.object(this.liquid_staking_pool),t.object(this.sui_system_state),n];return t.moveCall({target:`${e.publishedAtV2()}::suilend::${a}`,typeArguments:[c],arguments:u})})}},LR=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::bluefin::${a}`,typeArguments:[c,u],arguments:l})})}},FR=class{constructor(e,t){if(e===1){this.connection=new Dc.SuiPriceServiceConnection("https://hermes-beta.pyth.network");const r="0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",n="0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";this.pythClient=new Dc.SuiPythClient(t,n,r)}else{this.connection=new Dc.SuiPriceServiceConnection("https://hermes.pyth.network");const r="0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",n="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";this.pythClient=new Dc.SuiPythClient(t,n,r)}}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];let l,f;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");l=r.extendedDetails.haedalPmmBasePriceSeed,f=r.extendedDetails.haedalPmmQuotePriceSeed;const h=[l,f],y=yield this.connection.getPriceFeedsUpdateData(h),b=yield this.pythClient.updatePriceFeeds(t,y,h),w=[t.object(r.id),t.object(b[0]),t.object(b[1]),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::haedalpmm::${a}`,typeArguments:[c,u],arguments:w})})}},T4="CETUS",UR="DEEPBOOK",zR="KRIYA",VR="FLOWX",qR="FLOWXV3",WR="KRIYAV3",A4="TURBOS",Zd="AFTERMATH",GR="HAEDAL",HR="VOLO",KR="AFSUI",JR="BLUEMOVE",O4="DEEPBOOKV3",I4="SCALLOP",XR="SUILEND",YR="BLUEFIN",P4="HAEDALPMM",ZR="https://api-sui.cetus.zone/router_v2",QR=class{constructor(e,t,r,n){this.endpoint=e?tN(e):ZR,this.client=r||new cg.SuiClient({url:cg.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return Et(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:Vs(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 Et(this,null,function*(){return rN(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s){return Et(this,null,function*(){if(r.length===0)throw new Error("No router found");const o=r.map(h=>h.amountIn.toString()),a=r[0].path[0].from,c=r[0].path[r[0].path.length-1].target,u=e.splitCoins(t,o),l=[];for(let h=0;h<r.length;h++){if(r[h].path.length===0)throw new Error("Empty path");let y=u[h];for(const b of r[h].path)y=yield this.newDex(b.provider,i).swap(this,e,b,y,s);l.push(y)}return this.transferOrDestoryCoin(e,t,a),this.checkCoinThresholdAndMergeCoin(e,l,c,n)})}expectOutputSwap(e,t,r,n){return Et(this,null,function*(){const i=[],s=[],o=[],a=new mg(this.env,n);for(let u=0;u<r.length;u++){const l=r[u];for(let h=l.path.length-1;h>=0;h--){const y=l.path[h],b=a.flash_swap(this,e,y,!1);i.unshift(b.targetCoin),s.unshift(b.flashReceipt)}let f=t;for(let h=0;h<l.path.length;h++){const y=l.path[h],b=a.repay_flash_swap(this,e,y,f,s[h]);f=i[h],h===0?t=b:this.transferOrDestoryCoin(e,b,y.from),h===l.path.length-1&&o.push(f)}}const c=r[0].path[0].from;if(this.transferOrDestoryCoin(e,t,c),o.length>1){const u=e.makeMoveVec({elements:o.slice(1)});e.moveCall({target:`${Gd.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r[0].path[r[0].path.length-1].target],arguments:[o[0],u]})}return o[0]})}swapInPools(e){return Et(this,null,function*(){let t;try{t=yield PR(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return Et(this,null,function*(){const{routers:t,inputCoin:r,slippage:n,byAmountIn:i,txb:s,partner:o,deepbookv3DeepFee:a}=e,c=t.reduce((y,b)=>y.add(b.amountIn),new Qi.default(0)),u=t.reduce((y,b)=>y.add(b.amountOut),new Qi.default(0)),l=OR(i?u:c,i,n);if(i)return yield this.expectInputSwap(s,r,t,l,o,a);const f=s.splitCoins(r,[l.toString()]);return this.transferOrDestoryCoin(s,r,t[0].path[0].from),yield this.expectOutputSwap(s,f[0],t,o)})}fastRouterSwap(e){return Et(this,null,function*(){const{routers:t,byAmountIn:r,slippage:n,txb:i,partner:s,isMergeTragetCoin:o,refreshAllCoins:a,payDeepFeeAmount:c}=e,u=t[0].path[0].from;let l=yield this.getCoins(u,a);const f=t[0].path[t[0].path.length-1].target,h=t.reduce((N,F)=>N.add(F.amountIn),new Qi.default(0)),y=t.reduce((N,F)=>N.add(F.amountOut),new Qi.default(0)),b=AR(r?y:h,r,n),A=Gf(i,l,BigInt((r?h:b).toString()),u);let P;if(c&&c>0){let N=yield this.getCoins(this.deepbookv3DeepFeeType());P=Gf(i,N,BigInt(c),this.deepbookv3DeepFeeType()).targetCoin}const R=yield this.routerSwap({routers:t,inputCoin:A.targetCoin,slippage:n,byAmountIn:r,txb:i,partner:s,deepbookv3DeepFee:P});if(o){let N=yield this.getCoins(f,a);const F=Gf(i,N,BigInt(0),f);i.mergeCoins(F.targetCoin,[R]),F.isMintZeroCoin&&this.transferOrDestoryCoin(i,F.targetCoin,f)}else this.transferOrDestoryCoin(i,R,f)})}publishedAt(){return this.env===0?"0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2(){return this.env===0?"0x347dd58bbd11cd82c8b386b344729717c04a998da73386e82a239cc196d5706b":"0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"}deepbookv3DeepFeeType(){return this.env===0?"0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":"0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"}transferOrDestoryCoin(e,t,r){e.moveCall({target:`${this.publishedAt()}::utils::transfer_or_destroy_coin`,typeArguments:[r],arguments:[t]})}checkCoinThresholdAndMergeCoin(e,t,r,n){let i=t[0];if(t.length>1){let s=e.makeMoveVec({elements:t.slice(1)});e.moveCall({target:`${Gd.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r],arguments:[t[0],s]}),i=t[0]}return e.moveCall({target:`${this.publishedAt()}::utils::check_coin_threshold`,typeArguments:[r],arguments:[i,e.pure.u64(n.toString())]}),i}newDex(e,t){switch(e){case T4:return new mg(this.env,t);case UR:return new hR(this.env);case O4:return new DR(this.env);case zR:return new pR(this.env);case WR:return new mR(this.env);case VR:return new gR(this.env);case qR:return new vR(this.env);case A4:return new yR(this.env);case Zd:return new dR(this.env);case GR:return new jR(this.env);case KR:return new kR(this.env);case HR:return new RR(this.env);case JR:return new NR(this.env);case I4:return new $R(this.env);case XR:return new BR(this.env);case YR:return new LR(this.env);case P4:return new FR(this.env,this.client);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return Et(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return Et(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return Et(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return Et(this,null,function*(){const e=yield sN(this.endpoint);return e?e.data:null})}};function eN(e){let t=0;for(const n of e.routes)for(const i of n.path)i.extended_details&&i.extended_details.deepbookv3_deep_fee&&(t+=Number(i.extended_details.deepbookv3_deep_fee));return{amountIn:new Qi.default(e.amount_in.toString()),amountOut:new Qi.default(e.amount_out.toString()),insufficientLiquidity:!1,routes:e.routes.map(n=>({path:n.path.map(i=>{var s,o,a,c,u,l,f;let h;i.provider===Zd&&(h=i.extended_details.aftermath_pool_flatness===0?"v2":"v3");let y;return(i.provider===A4||i.provider===Zd||i.provider===T4||i.provider===O4||i.provider===I4||i.provider===P4)&&(y={aftermathLpSupplyType:(s=i.extended_details)==null?void 0:s.aftermath_lp_supply_type,turbosFeeType:(o=i.extended_details)==null?void 0:o.turbos_fee_type,afterSqrtPrice:(a=i.extended_details)==null?void 0:a.after_sqrt_price,deepbookv3DeepFee:(c=i.extended_details)==null?void 0:c.deepbookv3_deep_fee,scallopScoinTreasury:(u=i.extended_details)==null?void 0:u.scallop_scoin_treasury,haedalPmmBasePriceSeed:(l=i.extended_details)==null?void 0:l.haedal_pmm_base_price_seed,haedalPmmQuotePriceSeed:(f=i.extended_details)==null?void 0:f.haedal_pmm_quote_price_seed}),{id:i.id,direction:i.direction,provider:i.provider,from:i.from,target:i.target,feeRate:i.fee_rate,amountIn:i.amount_in,amountOut:i.amount_out,extendedDetails:y,version:h}}),amountIn:new Qi.default(n.amount_in.toString()),amountOut:new Qi.default(n.amount_out.toString()),initialPrice:new cu(n.initial_price.toString())})),totalDeepFee:t}}var ti="0x0000000000000000000000000000000000000000000000000000000000000006";Yo(Zo());function tN(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function rN(e,t){return Et(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield iN(e,t):r=yield nN(e,t),!r)return null;if(!r.ok)return{amountIn:Si,amountOut:Si,routes:[],insufficientLiquidity:!1,error:{code:10001,msg:Wf(10001)}};const n=yield r.json(),i=n.msg==="liquidity is not enough";return n.msg&&n.msg.indexOf("HoneyPot scam")>-1?{amountIn:Si,amountOut:Si,routes:[],insufficientLiquidity:i,error:{code:10004,msg:Wf(10004)}}:n.data!=null?eN(n.data):{amountIn:Si,amountOut:Si,routes:[],insufficientLiquidity:i,error:{code:10003,msg:Wf(10003)}}})}function nN(e,t){return Et(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=1000316",yield fetch(y)}catch(r){return console.error(r),null}})}function iN(e,t){return Et(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(","),A={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(A)})}catch(P){return console.error("Error:",P),null}})}function sN(e){return Et(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var j4=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(j4||{}),k4=QR,oN=j4,yg=bR,za=Vs;/*!
|
|
33
|
+
*/(function(R){const N=r,F=A,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;R.Buffer=V,R.SlowBuffer=v,R.INSPECT_MAX_BYTES=50;const G=2147483647;R.kMaxLength=G;const{Uint8Array:q,ArrayBuffer:J,SharedArrayBuffer:ne}=globalThis;V.TYPED_ARRAY_SUPPORT=ae(),!V.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 k=new q(1),S={foo:function(){return 42}};return Object.setPrototypeOf(S,q.prototype),Object.setPrototypeOf(k,S),k.foo()===42}catch{return!1}}Object.defineProperty(V.prototype,"parent",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.buffer}}),Object.defineProperty(V.prototype,"offset",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.byteOffset}});function ce(k){if(k>G)throw new RangeError('The value "'+k+'" is invalid for option "size"');const S=new q(k);return Object.setPrototypeOf(S,V.prototype),S}function V(k,S,T){if(typeof k=="number"){if(typeof S=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(k)}return $(k,S,T)}V.poolSize=8192;function $(k,S,T){if(typeof k=="string")return x(k,S);if(J.isView(k))return E(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(gt(k,J)||k&>(k.buffer,J)||typeof ne<"u"&&(gt(k,ne)||k&>(k.buffer,ne)))return O(k,S,T);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const B=k.valueOf&&k.valueOf();if(B!=null&&B!==k)return V.from(B,S,T);const K=C(k);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return V.from(k[Symbol.toPrimitive]("string"),S,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}V.from=function(k,S,T){return $(k,S,T)},Object.setPrototypeOf(V.prototype,q.prototype),Object.setPrototypeOf(V,q);function p(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function d(k,S,T){return p(k),k<=0?ce(k):S!==void 0?typeof T=="string"?ce(k).fill(S,T):ce(k).fill(S):ce(k)}V.alloc=function(k,S,T){return d(k,S,T)};function m(k){return p(k),ce(k<0?0:g(k)|0)}V.allocUnsafe=function(k){return m(k)},V.allocUnsafeSlow=function(k){return m(k)};function x(k,S){if((typeof S!="string"||S==="")&&(S="utf8"),!V.isEncoding(S))throw new TypeError("Unknown encoding: "+S);const T=j(k,S)|0;let B=ce(T);const K=B.write(k,S);return K!==T&&(B=B.slice(0,K)),B}function M(k){const S=k.length<0?0:g(k.length)|0,T=ce(S);for(let B=0;B<S;B+=1)T[B]=k[B]&255;return T}function E(k){if(gt(k,q)){const S=new q(k);return O(S.buffer,S.byteOffset,S.byteLength)}return M(k)}function O(k,S,T){if(S<0||k.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(k.byteLength<S+(T||0))throw new RangeError('"length" is outside of buffer bounds');let B;return S===void 0&&T===void 0?B=new q(k):T===void 0?B=new q(k,S):B=new q(k,S,T),Object.setPrototypeOf(B,V.prototype),B}function C(k){if(V.isBuffer(k)){const S=g(k.length)|0,T=ce(S);return T.length===0||k.copy(T,0,0,S),T}if(k.length!==void 0)return typeof k.length!="number"||Pt(k.length)?ce(0):M(k);if(k.type==="Buffer"&&Array.isArray(k.data))return M(k.data)}function g(k){if(k>=G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");return k|0}function v(k){return+k!=k&&(k=0),V.alloc(+k)}V.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==V.prototype},V.compare=function(S,T){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),gt(T,q)&&(T=V.from(T,T.offset,T.byteLength)),!V.isBuffer(S)||!V.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===T)return 0;let B=S.length,K=T.length;for(let Z=0,te=Math.min(B,K);Z<te;++Z)if(S[Z]!==T[Z]){B=S[Z],K=T[Z];break}return B<K?-1:K<B?1:0},V.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}},V.concat=function(S,T){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return V.alloc(0);let B;if(T===void 0)for(T=0,B=0;B<S.length;++B)T+=S[B].length;const K=V.allocUnsafe(T);let Z=0;for(B=0;B<S.length;++B){let te=S[B];if(gt(te,q))Z+te.length>K.length?(V.isBuffer(te)||(te=V.from(te)),te.copy(K,Z)):q.prototype.set.call(K,te,Z);else if(V.isBuffer(te))te.copy(K,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=te.length}return K};function j(k,S){if(V.isBuffer(k))return k.length;if(J.isView(k)||gt(k,J))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const T=k.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&T===0)return 0;let K=!1;for(;;)switch(S){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return It(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return Ct(k).length;default:if(K)return B?-1:It(k).length;S=(""+S).toLowerCase(),K=!0}}V.byteLength=j;function ee(k,S,T){let B=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,S>>>=0,T<=S))return"";for(k||(k="utf8");;)switch(k){case"hex":return qe(this,S,T);case"utf8":case"utf-8":return $e(this,S,T);case"ascii":return ge(this,S,T);case"latin1":case"binary":return Ae(this,S,T);case"base64":return ht(this,S,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,S,T);default:if(B)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),B=!0}}V.prototype._isBuffer=!0;function ie(k,S,T){const B=k[S];k[S]=k[T],k[T]=B}V.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 T=0;T<S;T+=2)ie(this,T,T+1);return this},V.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 T=0;T<S;T+=4)ie(this,T,T+3),ie(this,T+1,T+2);return this},V.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 T=0;T<S;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},V.prototype.toString=function(){const S=this.length;return S===0?"":arguments.length===0?$e(this,0,S):ee.apply(this,arguments)},V.prototype.toLocaleString=V.prototype.toString,V.prototype.equals=function(S){if(!V.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:V.compare(this,S)===0},V.prototype.inspect=function(){let S="";const T=R.INSPECT_MAX_BYTES;return S=this.toString("hex",0,T).replace(/(.{2})/g,"$1 ").trim(),this.length>T&&(S+=" ... "),"<Buffer "+S+">"},L&&(V.prototype[L]=V.prototype.inspect),V.prototype.compare=function(S,T,B,K,Z){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),!V.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(T===void 0&&(T=0),B===void 0&&(B=S?S.length:0),K===void 0&&(K=0),Z===void 0&&(Z=this.length),T<0||B>S.length||K<0||Z>this.length)throw new RangeError("out of range index");if(K>=Z&&T>=B)return 0;if(K>=Z)return-1;if(T>=B)return 1;if(T>>>=0,B>>>=0,K>>>=0,Z>>>=0,this===S)return 0;let te=Z-K,Be=B-T;const tt=Math.min(te,Be),Ne=this.slice(K,Z),z=S.slice(T,B);for(let oe=0;oe<tt;++oe)if(Ne[oe]!==z[oe]){te=Ne[oe],Be=z[oe];break}return te<Be?-1:Be<te?1:0};function ve(k,S,T,B,K){if(k.length===0)return-1;if(typeof T=="string"?(B=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,Pt(T)&&(T=K?0:k.length-1),T<0&&(T=k.length+T),T>=k.length){if(K)return-1;T=k.length-1}else if(T<0)if(K)T=0;else return-1;if(typeof S=="string"&&(S=V.from(S,B)),V.isBuffer(S))return S.length===0?-1:pe(k,S,T,B,K);if(typeof S=="number")return S=S&255,typeof q.prototype.indexOf=="function"?K?q.prototype.indexOf.call(k,S,T):q.prototype.lastIndexOf.call(k,S,T):pe(k,[S],T,B,K);throw new TypeError("val must be string, number or Buffer")}function pe(k,S,T,B,K){let Z=1,te=k.length,Be=S.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(k.length<2||S.length<2)return-1;Z=2,te/=2,Be/=2,T/=2}function tt(z,oe){return Z===1?z[oe]:z.readUInt16BE(oe*Z)}let Ne;if(K){let z=-1;for(Ne=T;Ne<te;Ne++)if(tt(k,Ne)===tt(S,z===-1?0:Ne-z)){if(z===-1&&(z=Ne),Ne-z+1===Be)return z*Z}else z!==-1&&(Ne-=Ne-z),z=-1}else for(T+Be>te&&(T=te-Be),Ne=T;Ne>=0;Ne--){let z=!0;for(let oe=0;oe<Be;oe++)if(tt(k,Ne+oe)!==tt(S,oe)){z=!1;break}if(z)return Ne}return-1}V.prototype.includes=function(S,T,B){return this.indexOf(S,T,B)!==-1},V.prototype.indexOf=function(S,T,B){return ve(this,S,T,B,!0)},V.prototype.lastIndexOf=function(S,T,B){return ve(this,S,T,B,!1)};function Ee(k,S,T,B){T=Number(T)||0;const K=k.length-T;B?(B=Number(B),B>K&&(B=K)):B=K;const Z=S.length;B>Z/2&&(B=Z/2);let te;for(te=0;te<B;++te){const Be=parseInt(S.substr(te*2,2),16);if(Pt(Be))return te;k[T+te]=Be}return te}function Se(k,S,T,B){return Ye(It(S,k.length-T),k,T,B)}function Ke(k,S,T,B){return Ye(it(S),k,T,B)}function Ue(k,S,T,B){return Ye(Ct(S),k,T,B)}function lt(k,S,T,B){return Ye(bt(S,k.length-T),k,T,B)}V.prototype.write=function(S,T,B,K){if(T===void 0)K="utf8",B=this.length,T=0;else if(B===void 0&&typeof T=="string")K=T,B=this.length,T=0;else if(isFinite(T))T=T>>>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-T;if((B===void 0||B>Z)&&(B=Z),S.length>0&&(B<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");K||(K="utf8");let te=!1;for(;;)switch(K){case"hex":return Ee(this,S,T,B);case"utf8":case"utf-8":return Se(this,S,T,B);case"ascii":case"latin1":case"binary":return Ke(this,S,T,B);case"base64":return Ue(this,S,T,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lt(this,S,T,B);default:if(te)throw new TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),te=!0}},V.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ht(k,S,T){return S===0&&T===k.length?N.fromByteArray(k):N.fromByteArray(k.slice(S,T))}function $e(k,S,T){T=Math.min(k.length,T);const B=[];let K=S;for(;K<T;){const Z=k[K];let te=null,Be=Z>239?4:Z>223?3:Z>191?2:1;if(K+Be<=T){let tt,Ne,z,oe;switch(Be){case 1:Z<128&&(te=Z);break;case 2:tt=k[K+1],(tt&192)===128&&(oe=(Z&31)<<6|tt&63,oe>127&&(te=oe));break;case 3:tt=k[K+1],Ne=k[K+2],(tt&192)===128&&(Ne&192)===128&&(oe=(Z&15)<<12|(tt&63)<<6|Ne&63,oe>2047&&(oe<55296||oe>57343)&&(te=oe));break;case 4:tt=k[K+1],Ne=k[K+2],z=k[K+3],(tt&192)===128&&(Ne&192)===128&&(z&192)===128&&(oe=(Z&15)<<18|(tt&63)<<12|(Ne&63)<<6|z&63,oe>65535&&oe<1114112&&(te=oe))}}te===null?(te=65533,Be=1):te>65535&&(te-=65536,B.push(te>>>10&1023|55296),te=56320|te&1023),B.push(te),K+=Be}return _e(B)}const mt=4096;function _e(k){const S=k.length;if(S<=mt)return String.fromCharCode.apply(String,k);let T="",B=0;for(;B<S;)T+=String.fromCharCode.apply(String,k.slice(B,B+=mt));return T}function ge(k,S,T){let B="";T=Math.min(k.length,T);for(let K=S;K<T;++K)B+=String.fromCharCode(k[K]&127);return B}function Ae(k,S,T){let B="";T=Math.min(k.length,T);for(let K=S;K<T;++K)B+=String.fromCharCode(k[K]);return B}function qe(k,S,T){const B=k.length;(!S||S<0)&&(S=0),(!T||T<0||T>B)&&(T=B);let K="";for(let Z=S;Z<T;++Z)K+=ot[k[Z]];return K}function De(k,S,T){const B=k.slice(S,T);let K="";for(let Z=0;Z<B.length-1;Z+=2)K+=String.fromCharCode(B[Z]+B[Z+1]*256);return K}V.prototype.slice=function(S,T){const B=this.length;S=~~S,T=T===void 0?B:~~T,S<0?(S+=B,S<0&&(S=0)):S>B&&(S=B),T<0?(T+=B,T<0&&(T=0)):T>B&&(T=B),T<S&&(T=S);const K=this.subarray(S,T);return Object.setPrototypeOf(K,V.prototype),K};function Oe(k,S,T){if(k%1!==0||k<0)throw new RangeError("offset is not uint");if(k+S>T)throw new RangeError("Trying to access beyond buffer length")}V.prototype.readUintLE=V.prototype.readUIntLE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S],Z=1,te=0;for(;++te<T&&(Z*=256);)K+=this[S+te]*Z;return K},V.prototype.readUintBE=V.prototype.readUIntBE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S+--T],Z=1;for(;T>0&&(Z*=256);)K+=this[S+--T]*Z;return K},V.prototype.readUint8=V.prototype.readUInt8=function(S,T){return S=S>>>0,T||Oe(S,1,this.length),this[S]},V.prototype.readUint16LE=V.prototype.readUInt16LE=function(S,T){return S=S>>>0,T||Oe(S,2,this.length),this[S]|this[S+1]<<8},V.prototype.readUint16BE=V.prototype.readUInt16BE=function(S,T){return S=S>>>0,T||Oe(S,2,this.length),this[S]<<8|this[S+1]},V.prototype.readUint32LE=V.prototype.readUInt32LE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},V.prototype.readUint32BE=V.prototype.readUInt32BE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},V.prototype.readBigUInt64LE=wt(function(S){S=S>>>0,St(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&At(S,this.length-8);const K=T+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))}),V.prototype.readBigUInt64BE=wt(function(S){S=S>>>0,St(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&At(S,this.length-8);const K=T*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)}),V.prototype.readIntLE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S],Z=1,te=0;for(;++te<T&&(Z*=256);)K+=this[S+te]*Z;return Z*=128,K>=Z&&(K-=Math.pow(2,8*T)),K},V.prototype.readIntBE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=T,Z=1,te=this[S+--K];for(;K>0&&(Z*=256);)te+=this[S+--K]*Z;return Z*=128,te>=Z&&(te-=Math.pow(2,8*T)),te},V.prototype.readInt8=function(S,T){return S=S>>>0,T||Oe(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},V.prototype.readInt16LE=function(S,T){S=S>>>0,T||Oe(S,2,this.length);const B=this[S]|this[S+1]<<8;return B&32768?B|4294901760:B},V.prototype.readInt16BE=function(S,T){S=S>>>0,T||Oe(S,2,this.length);const B=this[S+1]|this[S]<<8;return B&32768?B|4294901760:B},V.prototype.readInt32LE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},V.prototype.readInt32BE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},V.prototype.readBigInt64LE=wt(function(S){S=S>>>0,St(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&At(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(T+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24)}),V.prototype.readBigInt64BE=wt(function(S){S=S>>>0,St(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&At(S,this.length-8);const K=(T<<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)}),V.prototype.readFloatLE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),F.read(this,S,!0,23,4)},V.prototype.readFloatBE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),F.read(this,S,!1,23,4)},V.prototype.readDoubleLE=function(S,T){return S=S>>>0,T||Oe(S,8,this.length),F.read(this,S,!0,52,8)},V.prototype.readDoubleBE=function(S,T){return S=S>>>0,T||Oe(S,8,this.length),F.read(this,S,!1,52,8)};function Ie(k,S,T,B,K,Z){if(!V.isBuffer(k))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(T+B>k.length)throw new RangeError("Index out of range")}V.prototype.writeUintLE=V.prototype.writeUIntLE=function(S,T,B,K){if(S=+S,T=T>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,T,B,Be,0)}let Z=1,te=0;for(this[T]=S&255;++te<B&&(Z*=256);)this[T+te]=S/Z&255;return T+B},V.prototype.writeUintBE=V.prototype.writeUIntBE=function(S,T,B,K){if(S=+S,T=T>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,T,B,Be,0)}let Z=B-1,te=1;for(this[T+Z]=S&255;--Z>=0&&(te*=256);)this[T+Z]=S/te&255;return T+B},V.prototype.writeUint8=V.prototype.writeUInt8=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,1,255,0),this[T]=S&255,T+1},V.prototype.writeUint16LE=V.prototype.writeUInt16LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,65535,0),this[T]=S&255,this[T+1]=S>>>8,T+2},V.prototype.writeUint16BE=V.prototype.writeUInt16BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,65535,0),this[T]=S>>>8,this[T+1]=S&255,T+2},V.prototype.writeUint32LE=V.prototype.writeUInt32LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,4294967295,0),this[T+3]=S>>>24,this[T+2]=S>>>16,this[T+1]=S>>>8,this[T]=S&255,T+4},V.prototype.writeUint32BE=V.prototype.writeUInt32BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,4294967295,0),this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=S&255,T+4};function Fe(k,S,T,B,K){nt(S,B,K,k,T,7);let Z=Number(S&BigInt(4294967295));k[T++]=Z,Z=Z>>8,k[T++]=Z,Z=Z>>8,k[T++]=Z,Z=Z>>8,k[T++]=Z;let te=Number(S>>BigInt(32)&BigInt(4294967295));return k[T++]=te,te=te>>8,k[T++]=te,te=te>>8,k[T++]=te,te=te>>8,k[T++]=te,T}function ft(k,S,T,B,K){nt(S,B,K,k,T,7);let Z=Number(S&BigInt(4294967295));k[T+7]=Z,Z=Z>>8,k[T+6]=Z,Z=Z>>8,k[T+5]=Z,Z=Z>>8,k[T+4]=Z;let te=Number(S>>BigInt(32)&BigInt(4294967295));return k[T+3]=te,te=te>>8,k[T+2]=te,te=te>>8,k[T+1]=te,te=te>>8,k[T]=te,T+8}V.prototype.writeBigUInt64LE=wt(function(S,T=0){return Fe(this,S,T,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeBigUInt64BE=wt(function(S,T=0){return ft(this,S,T,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeIntLE=function(S,T,B,K){if(S=+S,T=T>>>0,!K){const tt=Math.pow(2,8*B-1);Ie(this,S,T,B,tt-1,-tt)}let Z=0,te=1,Be=0;for(this[T]=S&255;++Z<B&&(te*=256);)S<0&&Be===0&&this[T+Z-1]!==0&&(Be=1),this[T+Z]=(S/te>>0)-Be&255;return T+B},V.prototype.writeIntBE=function(S,T,B,K){if(S=+S,T=T>>>0,!K){const tt=Math.pow(2,8*B-1);Ie(this,S,T,B,tt-1,-tt)}let Z=B-1,te=1,Be=0;for(this[T+Z]=S&255;--Z>=0&&(te*=256);)S<0&&Be===0&&this[T+Z+1]!==0&&(Be=1),this[T+Z]=(S/te>>0)-Be&255;return T+B},V.prototype.writeInt8=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,1,127,-128),S<0&&(S=255+S+1),this[T]=S&255,T+1},V.prototype.writeInt16LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,32767,-32768),this[T]=S&255,this[T+1]=S>>>8,T+2},V.prototype.writeInt16BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,32767,-32768),this[T]=S>>>8,this[T+1]=S&255,T+2},V.prototype.writeInt32LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,2147483647,-2147483648),this[T]=S&255,this[T+1]=S>>>8,this[T+2]=S>>>16,this[T+3]=S>>>24,T+4},V.prototype.writeInt32BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=S&255,T+4},V.prototype.writeBigInt64LE=wt(function(S,T=0){return Fe(this,S,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),V.prototype.writeBigInt64BE=wt(function(S,T=0){return ft(this,S,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function dt(k,S,T,B,K,Z){if(T+B>k.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function Ge(k,S,T,B,K){return S=+S,T=T>>>0,K||dt(k,S,T,4),F.write(k,S,T,B,23,4),T+4}V.prototype.writeFloatLE=function(S,T,B){return Ge(this,S,T,!0,B)},V.prototype.writeFloatBE=function(S,T,B){return Ge(this,S,T,!1,B)};function jt(k,S,T,B,K){return S=+S,T=T>>>0,K||dt(k,S,T,8),F.write(k,S,T,B,52,8),T+8}V.prototype.writeDoubleLE=function(S,T,B){return jt(this,S,T,!0,B)},V.prototype.writeDoubleBE=function(S,T,B){return jt(this,S,T,!1,B)},V.prototype.copy=function(S,T,B,K){if(!V.isBuffer(S))throw new TypeError("argument should be a Buffer");if(B||(B=0),!K&&K!==0&&(K=this.length),T>=S.length&&(T=S.length),T||(T=0),K>0&&K<B&&(K=B),K===B||S.length===0||this.length===0)return 0;if(T<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-T<K-B&&(K=S.length-T+B);const Z=K-B;return this===S&&typeof q.prototype.copyWithin=="function"?this.copyWithin(T,B,K):q.prototype.set.call(S,this.subarray(B,K),T),Z},V.prototype.fill=function(S,T,B,K){if(typeof S=="string"){if(typeof T=="string"?(K=T,T=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"&&!V.isEncoding(K))throw new TypeError("Unknown encoding: "+K);if(S.length===1){const te=S.charCodeAt(0);(K==="utf8"&&te<128||K==="latin1")&&(S=te)}}else typeof S=="number"?S=S&255:typeof S=="boolean"&&(S=Number(S));if(T<0||this.length<T||this.length<B)throw new RangeError("Out of range index");if(B<=T)return this;T=T>>>0,B=B===void 0?this.length:B>>>0,S||(S=0);let Z;if(typeof S=="number")for(Z=T;Z<B;++Z)this[Z]=S;else{const te=V.isBuffer(S)?S:V.from(S,K),Be=te.length;if(Be===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(Z=0;Z<B-T;++Z)this[Z+T]=te[Z%Be]}return this};const xt={};function Ze(k,S,T){xt[k]=class extends T{constructor(){super(),Object.defineProperty(this,"message",{value:S.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${k}]`,this.stack,delete this.name}get code(){return k}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${k}]: ${this.message}`}}}Ze("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ze("ERR_INVALID_ARG_TYPE",function(k,S){return`The "${k}" argument must be of type number. Received type ${typeof S}`},TypeError),Ze("ERR_OUT_OF_RANGE",function(k,S,T){let B=`The value of "${k}" is out of range.`,K=T;return Number.isInteger(T)&&Math.abs(T)>2**32?K=Tt(String(T)):typeof T=="bigint"&&(K=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(K=Tt(K)),K+="n"),B+=` It must be ${S}. Received ${K}`,B},RangeError);function Tt(k){let S="",T=k.length;const B=k[0]==="-"?1:0;for(;T>=B+4;T-=3)S=`_${k.slice(T-3,T)}${S}`;return`${k.slice(0,T)}${S}`}function Nt(k,S,T){St(S,"offset"),(k[S]===void 0||k[S+T]===void 0)&&At(S,k.length-(T+1))}function nt(k,S,T,B,K,Z){if(k>T||k<S){const te=typeof S=="bigint"?"n":"";let Be;throw Z>3?S===0||S===BigInt(0)?Be=`>= 0${te} and < 2${te} ** ${(Z+1)*8}${te}`:Be=`>= -(2${te} ** ${(Z+1)*8-1}${te}) and < 2 ** ${(Z+1)*8-1}${te}`:Be=`>= ${S}${te} and <= ${T}${te}`,new xt.ERR_OUT_OF_RANGE("value",Be,k)}Nt(B,K,Z)}function St(k,S){if(typeof k!="number")throw new xt.ERR_INVALID_ARG_TYPE(S,"number",k)}function At(k,S,T){throw Math.floor(k)!==k?(St(k,T),new xt.ERR_OUT_OF_RANGE(T||"offset","an integer",k)):S<0?new xt.ERR_BUFFER_OUT_OF_BOUNDS:new xt.ERR_OUT_OF_RANGE(T||"offset",`>= ${T?1:0} and <= ${S}`,k)}const st=/[^+/0-9A-Za-z-_]/g;function kt(k){if(k=k.split("=")[0],k=k.trim().replace(st,""),k.length<2)return"";for(;k.length%4!==0;)k=k+"=";return k}function It(k,S){S=S||1/0;let T;const B=k.length;let K=null;const Z=[];for(let te=0;te<B;++te){if(T=k.charCodeAt(te),T>55295&&T<57344){if(!K){if(T>56319){(S-=3)>-1&&Z.push(239,191,189);continue}else if(te+1===B){(S-=3)>-1&&Z.push(239,191,189);continue}K=T;continue}if(T<56320){(S-=3)>-1&&Z.push(239,191,189),K=T;continue}T=(K-55296<<10|T-56320)+65536}else K&&(S-=3)>-1&&Z.push(239,191,189);if(K=null,T<128){if((S-=1)<0)break;Z.push(T)}else if(T<2048){if((S-=2)<0)break;Z.push(T>>6|192,T&63|128)}else if(T<65536){if((S-=3)<0)break;Z.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((S-=4)<0)break;Z.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return Z}function it(k){const S=[];for(let T=0;T<k.length;++T)S.push(k.charCodeAt(T)&255);return S}function bt(k,S){let T,B,K;const Z=[];for(let te=0;te<k.length&&!((S-=2)<0);++te)T=k.charCodeAt(te),B=T>>8,K=T%256,Z.push(K),Z.push(B);return Z}function Ct(k){return N.toByteArray(kt(k))}function Ye(k,S,T,B){let K;for(K=0;K<B&&!(K+T>=S.length||K>=k.length);++K)S[K+T]=k[K];return K}function gt(k,S){return k instanceof S||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===S.name}function Pt(k){return k!==k}const ot=function(){const k="0123456789abcdef",S=new Array(256);for(let T=0;T<16;++T){const B=T*16;for(let K=0;K<16;++K)S[B+K]=k[T]+k[K]}return S}();function wt(k){return typeof BigInt>"u"?Ft:k}function Ft(){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}(If)),If}var F7=hl();const Fd=hc(F7);var on={},zp={exports:{}};zp.exports;(function(e){(function(t,r){function n($,p){if(!$)throw new Error(p||"Assertion failed")}function i($,p){$.super_=p;var d=function(){};d.prototype=p.prototype,$.prototype=new d,$.prototype.constructor=$}function s($,p,d){if(s.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((p==="le"||p==="be")&&(d=p,p=10),this._init($||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=hl().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 M,E,O=0;if(m==="be")for(x=p.length-1,M=0;x>=0;x-=3)E=p[x]|p[x-1]<<8|p[x-2]<<16,this.words[M]|=E<<O&67108863,this.words[M+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,M++);else if(m==="le")for(x=0,M=0;x<p.length;x+=3)E=p[x]|p[x+1]<<8|p[x+2]<<16,this.words[M]|=E<<O&67108863,this.words[M+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,M++);return this._strip()};function a($,p){var 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 "+$)}function c($,p,d){var m=a($,d);return d-1>=p&&(m|=a($,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 M=0,E=0,O;if(m==="be")for(x=p.length-1;x>=d;x-=2)O=c(p,d,x)<<M,this.words[E]|=O&67108863,M>=18?(M-=18,E+=1,this.words[E]|=O>>>26):M+=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)<<M,this.words[E]|=O&67108863,M>=18?(M-=18,E+=1,this.words[E]|=O>>>26):M+=8}this._strip()};function u($,p,d,m){for(var x=0,M=0,E=Math.min($.length,d),O=p;O<E;O++){var C=$.charCodeAt(O)-48;x*=m,C>=49?M=C-49+10:C>=17?M=C-17+10:M=C,n(C>=0&&M<m,"Invalid character"),x+=M}return x}s.prototype._parseBase=function(p,d,m){this.words=[0],this.length=1;for(var x=0,M=1;M<=67108863;M*=d)x++;x--,M=M/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(M),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($,p){$.words=p.words,$.length=p.length,$.negative=p.negative,$.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,M=0,E=0;E<this.length;E++){var O=this.words[E],C=((O<<x|M)&16777215).toString(16);M=O>>>24-x&16777215,x+=2,x>=26&&(x-=26,E--),M!==0||E!==this.length-1?m=h[6-C.length]+C+m:m=C+m}for(M!==0&&(m=M.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(),M=m||Math.max(1,x);n(x<=M,"byte array longer than desired length"),n(M>0,"Requested array length <= 0");var E=w(p,M),O=d==="le"?"LE":"BE";return this["_toArrayLike"+O](E,x),E},s.prototype._toArrayLikeLE=function(p,d){for(var m=0,x=0,M=0,E=0;M<this.length;M++){var O=this.words[M]<<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,M=0,E=0;M<this.length;M++){var O=this.words[M]<<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 A($){for(var p=new Array($.bitLength()),d=0;d<p.length;d++){var m=d/26|0,x=d%26;p[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 M=0,E=0;E<x.length;E++)d=(m.words[E]|0)+(x.words[E]|0)+M,this.words[E]=d&67108863,M=d>>>26;for(;M!==0&&E<m.length;E++)d=(m.words[E]|0)+M,this.words[E]=d&67108863,M=d>>>26;if(this.length=m.length,M!==0)this.words[this.length]=M,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,M;m>0?(x=this,M=p):(x=p,M=this);for(var E=0,O=0;O<M.length;O++)d=(x.words[O]|0)-(M.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($,p,d){d.negative=p.negative^$.negative;var m=$.length+p.length|0;d.length=m,m=m-1|0;var x=$.words[0]|0,M=p.words[0]|0,E=x*M,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),ie=Math.max(0,g-$.length+1);ie<=ee;ie++){var ve=g-ie|0;x=$.words[ve]|0,M=p.words[ie]|0,E=x*M+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 R=function(p,d,m){var x=p.words,M=d.words,E=m.words,O=0,C,g,v,j=x[0]|0,ee=j&8191,ie=j>>>13,ve=x[1]|0,pe=ve&8191,Ee=ve>>>13,Se=x[2]|0,Ke=Se&8191,Ue=Se>>>13,lt=x[3]|0,ht=lt&8191,$e=lt>>>13,mt=x[4]|0,_e=mt&8191,ge=mt>>>13,Ae=x[5]|0,qe=Ae&8191,De=Ae>>>13,Oe=x[6]|0,Ie=Oe&8191,Fe=Oe>>>13,ft=x[7]|0,dt=ft&8191,Ge=ft>>>13,jt=x[8]|0,xt=jt&8191,Ze=jt>>>13,Tt=x[9]|0,Nt=Tt&8191,nt=Tt>>>13,St=M[0]|0,At=St&8191,st=St>>>13,kt=M[1]|0,It=kt&8191,it=kt>>>13,bt=M[2]|0,Ct=bt&8191,Ye=bt>>>13,gt=M[3]|0,Pt=gt&8191,ot=gt>>>13,wt=M[4]|0,Ft=wt&8191,k=wt>>>13,S=M[5]|0,T=S&8191,B=S>>>13,K=M[6]|0,Z=K&8191,te=K>>>13,Be=M[7]|0,tt=Be&8191,Ne=Be>>>13,z=M[8]|0,oe=z&8191,he=z>>>13,ke=M[9]|0,He=ke&8191,Re=ke>>>13;m.negative=p.negative^d.negative,m.length=19,C=Math.imul(ee,At),g=Math.imul(ee,st),g=g+Math.imul(ie,At)|0,v=Math.imul(ie,st);var ze=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ze>>>26)|0,ze&=67108863,C=Math.imul(pe,At),g=Math.imul(pe,st),g=g+Math.imul(Ee,At)|0,v=Math.imul(Ee,st),C=C+Math.imul(ee,It)|0,g=g+Math.imul(ee,it)|0,g=g+Math.imul(ie,It)|0,v=v+Math.imul(ie,it)|0;var at=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(at>>>26)|0,at&=67108863,C=Math.imul(Ke,At),g=Math.imul(Ke,st),g=g+Math.imul(Ue,At)|0,v=Math.imul(Ue,st),C=C+Math.imul(pe,It)|0,g=g+Math.imul(pe,it)|0,g=g+Math.imul(Ee,It)|0,v=v+Math.imul(Ee,it)|0,C=C+Math.imul(ee,Ct)|0,g=g+Math.imul(ee,Ye)|0,g=g+Math.imul(ie,Ct)|0,v=v+Math.imul(ie,Ye)|0;var Ht=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,C=Math.imul(ht,At),g=Math.imul(ht,st),g=g+Math.imul($e,At)|0,v=Math.imul($e,st),C=C+Math.imul(Ke,It)|0,g=g+Math.imul(Ke,it)|0,g=g+Math.imul(Ue,It)|0,v=v+Math.imul(Ue,it)|0,C=C+Math.imul(pe,Ct)|0,g=g+Math.imul(pe,Ye)|0,g=g+Math.imul(Ee,Ct)|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(ie,Pt)|0,v=v+Math.imul(ie,ot)|0;var Rt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,C=Math.imul(_e,At),g=Math.imul(_e,st),g=g+Math.imul(ge,At)|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(Ke,Ct)|0,g=g+Math.imul(Ke,Ye)|0,g=g+Math.imul(Ue,Ct)|0,v=v+Math.imul(Ue,Ye)|0,C=C+Math.imul(pe,Pt)|0,g=g+Math.imul(pe,ot)|0,g=g+Math.imul(Ee,Pt)|0,v=v+Math.imul(Ee,ot)|0,C=C+Math.imul(ee,Ft)|0,g=g+Math.imul(ee,k)|0,g=g+Math.imul(ie,Ft)|0,v=v+Math.imul(ie,k)|0;var Dt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,C=Math.imul(qe,At),g=Math.imul(qe,st),g=g+Math.imul(De,At)|0,v=Math.imul(De,st),C=C+Math.imul(_e,It)|0,g=g+Math.imul(_e,it)|0,g=g+Math.imul(ge,It)|0,v=v+Math.imul(ge,it)|0,C=C+Math.imul(ht,Ct)|0,g=g+Math.imul(ht,Ye)|0,g=g+Math.imul($e,Ct)|0,v=v+Math.imul($e,Ye)|0,C=C+Math.imul(Ke,Pt)|0,g=g+Math.imul(Ke,ot)|0,g=g+Math.imul(Ue,Pt)|0,v=v+Math.imul(Ue,ot)|0,C=C+Math.imul(pe,Ft)|0,g=g+Math.imul(pe,k)|0,g=g+Math.imul(Ee,Ft)|0,v=v+Math.imul(Ee,k)|0,C=C+Math.imul(ee,T)|0,g=g+Math.imul(ee,B)|0,g=g+Math.imul(ie,T)|0,v=v+Math.imul(ie,B)|0;var er=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(er>>>26)|0,er&=67108863,C=Math.imul(Ie,At),g=Math.imul(Ie,st),g=g+Math.imul(Fe,At)|0,v=Math.imul(Fe,st),C=C+Math.imul(qe,It)|0,g=g+Math.imul(qe,it)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,it)|0,C=C+Math.imul(_e,Ct)|0,g=g+Math.imul(_e,Ye)|0,g=g+Math.imul(ge,Ct)|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(Ke,Ft)|0,g=g+Math.imul(Ke,k)|0,g=g+Math.imul(Ue,Ft)|0,v=v+Math.imul(Ue,k)|0,C=C+Math.imul(pe,T)|0,g=g+Math.imul(pe,B)|0,g=g+Math.imul(Ee,T)|0,v=v+Math.imul(Ee,B)|0,C=C+Math.imul(ee,Z)|0,g=g+Math.imul(ee,te)|0,g=g+Math.imul(ie,Z)|0,v=v+Math.imul(ie,te)|0;var yr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(yr>>>26)|0,yr&=67108863,C=Math.imul(dt,At),g=Math.imul(dt,st),g=g+Math.imul(Ge,At)|0,v=Math.imul(Ge,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(qe,Ct)|0,g=g+Math.imul(qe,Ye)|0,g=g+Math.imul(De,Ct)|0,v=v+Math.imul(De,Ye)|0,C=C+Math.imul(_e,Pt)|0,g=g+Math.imul(_e,ot)|0,g=g+Math.imul(ge,Pt)|0,v=v+Math.imul(ge,ot)|0,C=C+Math.imul(ht,Ft)|0,g=g+Math.imul(ht,k)|0,g=g+Math.imul($e,Ft)|0,v=v+Math.imul($e,k)|0,C=C+Math.imul(Ke,T)|0,g=g+Math.imul(Ke,B)|0,g=g+Math.imul(Ue,T)|0,v=v+Math.imul(Ue,B)|0,C=C+Math.imul(pe,Z)|0,g=g+Math.imul(pe,te)|0,g=g+Math.imul(Ee,Z)|0,v=v+Math.imul(Ee,te)|0,C=C+Math.imul(ee,tt)|0,g=g+Math.imul(ee,Ne)|0,g=g+Math.imul(ie,tt)|0,v=v+Math.imul(ie,Ne)|0;var ir=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ir>>>26)|0,ir&=67108863,C=Math.imul(xt,At),g=Math.imul(xt,st),g=g+Math.imul(Ze,At)|0,v=Math.imul(Ze,st),C=C+Math.imul(dt,It)|0,g=g+Math.imul(dt,it)|0,g=g+Math.imul(Ge,It)|0,v=v+Math.imul(Ge,it)|0,C=C+Math.imul(Ie,Ct)|0,g=g+Math.imul(Ie,Ye)|0,g=g+Math.imul(Fe,Ct)|0,v=v+Math.imul(Fe,Ye)|0,C=C+Math.imul(qe,Pt)|0,g=g+Math.imul(qe,ot)|0,g=g+Math.imul(De,Pt)|0,v=v+Math.imul(De,ot)|0,C=C+Math.imul(_e,Ft)|0,g=g+Math.imul(_e,k)|0,g=g+Math.imul(ge,Ft)|0,v=v+Math.imul(ge,k)|0,C=C+Math.imul(ht,T)|0,g=g+Math.imul(ht,B)|0,g=g+Math.imul($e,T)|0,v=v+Math.imul($e,B)|0,C=C+Math.imul(Ke,Z)|0,g=g+Math.imul(Ke,te)|0,g=g+Math.imul(Ue,Z)|0,v=v+Math.imul(Ue,te)|0,C=C+Math.imul(pe,tt)|0,g=g+Math.imul(pe,Ne)|0,g=g+Math.imul(Ee,tt)|0,v=v+Math.imul(Ee,Ne)|0,C=C+Math.imul(ee,oe)|0,g=g+Math.imul(ee,he)|0,g=g+Math.imul(ie,oe)|0,v=v+Math.imul(ie,he)|0;var Kt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,C=Math.imul(Nt,At),g=Math.imul(Nt,st),g=g+Math.imul(nt,At)|0,v=Math.imul(nt,st),C=C+Math.imul(xt,It)|0,g=g+Math.imul(xt,it)|0,g=g+Math.imul(Ze,It)|0,v=v+Math.imul(Ze,it)|0,C=C+Math.imul(dt,Ct)|0,g=g+Math.imul(dt,Ye)|0,g=g+Math.imul(Ge,Ct)|0,v=v+Math.imul(Ge,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(qe,Ft)|0,g=g+Math.imul(qe,k)|0,g=g+Math.imul(De,Ft)|0,v=v+Math.imul(De,k)|0,C=C+Math.imul(_e,T)|0,g=g+Math.imul(_e,B)|0,g=g+Math.imul(ge,T)|0,v=v+Math.imul(ge,B)|0,C=C+Math.imul(ht,Z)|0,g=g+Math.imul(ht,te)|0,g=g+Math.imul($e,Z)|0,v=v+Math.imul($e,te)|0,C=C+Math.imul(Ke,tt)|0,g=g+Math.imul(Ke,Ne)|0,g=g+Math.imul(Ue,tt)|0,v=v+Math.imul(Ue,Ne)|0,C=C+Math.imul(pe,oe)|0,g=g+Math.imul(pe,he)|0,g=g+Math.imul(Ee,oe)|0,v=v+Math.imul(Ee,he)|0,C=C+Math.imul(ee,He)|0,g=g+Math.imul(ee,Re)|0,g=g+Math.imul(ie,He)|0,v=v+Math.imul(ie,Re)|0;var gr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(gr>>>26)|0,gr&=67108863,C=Math.imul(Nt,It),g=Math.imul(Nt,it),g=g+Math.imul(nt,It)|0,v=Math.imul(nt,it),C=C+Math.imul(xt,Ct)|0,g=g+Math.imul(xt,Ye)|0,g=g+Math.imul(Ze,Ct)|0,v=v+Math.imul(Ze,Ye)|0,C=C+Math.imul(dt,Pt)|0,g=g+Math.imul(dt,ot)|0,g=g+Math.imul(Ge,Pt)|0,v=v+Math.imul(Ge,ot)|0,C=C+Math.imul(Ie,Ft)|0,g=g+Math.imul(Ie,k)|0,g=g+Math.imul(Fe,Ft)|0,v=v+Math.imul(Fe,k)|0,C=C+Math.imul(qe,T)|0,g=g+Math.imul(qe,B)|0,g=g+Math.imul(De,T)|0,v=v+Math.imul(De,B)|0,C=C+Math.imul(_e,Z)|0,g=g+Math.imul(_e,te)|0,g=g+Math.imul(ge,Z)|0,v=v+Math.imul(ge,te)|0,C=C+Math.imul(ht,tt)|0,g=g+Math.imul(ht,Ne)|0,g=g+Math.imul($e,tt)|0,v=v+Math.imul($e,Ne)|0,C=C+Math.imul(Ke,oe)|0,g=g+Math.imul(Ke,he)|0,g=g+Math.imul(Ue,oe)|0,v=v+Math.imul(Ue,he)|0,C=C+Math.imul(pe,He)|0,g=g+Math.imul(pe,Re)|0,g=g+Math.imul(Ee,He)|0,v=v+Math.imul(Ee,Re)|0;var pn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(pn>>>26)|0,pn&=67108863,C=Math.imul(Nt,Ct),g=Math.imul(Nt,Ye),g=g+Math.imul(nt,Ct)|0,v=Math.imul(nt,Ye),C=C+Math.imul(xt,Pt)|0,g=g+Math.imul(xt,ot)|0,g=g+Math.imul(Ze,Pt)|0,v=v+Math.imul(Ze,ot)|0,C=C+Math.imul(dt,Ft)|0,g=g+Math.imul(dt,k)|0,g=g+Math.imul(Ge,Ft)|0,v=v+Math.imul(Ge,k)|0,C=C+Math.imul(Ie,T)|0,g=g+Math.imul(Ie,B)|0,g=g+Math.imul(Fe,T)|0,v=v+Math.imul(Fe,B)|0,C=C+Math.imul(qe,Z)|0,g=g+Math.imul(qe,te)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,te)|0,C=C+Math.imul(_e,tt)|0,g=g+Math.imul(_e,Ne)|0,g=g+Math.imul(ge,tt)|0,v=v+Math.imul(ge,Ne)|0,C=C+Math.imul(ht,oe)|0,g=g+Math.imul(ht,he)|0,g=g+Math.imul($e,oe)|0,v=v+Math.imul($e,he)|0,C=C+Math.imul(Ke,He)|0,g=g+Math.imul(Ke,Re)|0,g=g+Math.imul(Ue,He)|0,v=v+Math.imul(Ue,Re)|0;var Dr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,C=Math.imul(Nt,Pt),g=Math.imul(Nt,ot),g=g+Math.imul(nt,Pt)|0,v=Math.imul(nt,ot),C=C+Math.imul(xt,Ft)|0,g=g+Math.imul(xt,k)|0,g=g+Math.imul(Ze,Ft)|0,v=v+Math.imul(Ze,k)|0,C=C+Math.imul(dt,T)|0,g=g+Math.imul(dt,B)|0,g=g+Math.imul(Ge,T)|0,v=v+Math.imul(Ge,B)|0,C=C+Math.imul(Ie,Z)|0,g=g+Math.imul(Ie,te)|0,g=g+Math.imul(Fe,Z)|0,v=v+Math.imul(Fe,te)|0,C=C+Math.imul(qe,tt)|0,g=g+Math.imul(qe,Ne)|0,g=g+Math.imul(De,tt)|0,v=v+Math.imul(De,Ne)|0,C=C+Math.imul(_e,oe)|0,g=g+Math.imul(_e,he)|0,g=g+Math.imul(ge,oe)|0,v=v+Math.imul(ge,he)|0,C=C+Math.imul(ht,He)|0,g=g+Math.imul(ht,Re)|0,g=g+Math.imul($e,He)|0,v=v+Math.imul($e,Re)|0;var mn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(mn>>>26)|0,mn&=67108863,C=Math.imul(Nt,Ft),g=Math.imul(Nt,k),g=g+Math.imul(nt,Ft)|0,v=Math.imul(nt,k),C=C+Math.imul(xt,T)|0,g=g+Math.imul(xt,B)|0,g=g+Math.imul(Ze,T)|0,v=v+Math.imul(Ze,B)|0,C=C+Math.imul(dt,Z)|0,g=g+Math.imul(dt,te)|0,g=g+Math.imul(Ge,Z)|0,v=v+Math.imul(Ge,te)|0,C=C+Math.imul(Ie,tt)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Fe,tt)|0,v=v+Math.imul(Fe,Ne)|0,C=C+Math.imul(qe,oe)|0,g=g+Math.imul(qe,he)|0,g=g+Math.imul(De,oe)|0,v=v+Math.imul(De,he)|0,C=C+Math.imul(_e,He)|0,g=g+Math.imul(_e,Re)|0,g=g+Math.imul(ge,He)|0,v=v+Math.imul(ge,Re)|0;var ui=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ui>>>26)|0,ui&=67108863,C=Math.imul(Nt,T),g=Math.imul(Nt,B),g=g+Math.imul(nt,T)|0,v=Math.imul(nt,B),C=C+Math.imul(xt,Z)|0,g=g+Math.imul(xt,te)|0,g=g+Math.imul(Ze,Z)|0,v=v+Math.imul(Ze,te)|0,C=C+Math.imul(dt,tt)|0,g=g+Math.imul(dt,Ne)|0,g=g+Math.imul(Ge,tt)|0,v=v+Math.imul(Ge,Ne)|0,C=C+Math.imul(Ie,oe)|0,g=g+Math.imul(Ie,he)|0,g=g+Math.imul(Fe,oe)|0,v=v+Math.imul(Fe,he)|0,C=C+Math.imul(qe,He)|0,g=g+Math.imul(qe,Re)|0,g=g+Math.imul(De,He)|0,v=v+Math.imul(De,Re)|0;var li=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(li>>>26)|0,li&=67108863,C=Math.imul(Nt,Z),g=Math.imul(Nt,te),g=g+Math.imul(nt,Z)|0,v=Math.imul(nt,te),C=C+Math.imul(xt,tt)|0,g=g+Math.imul(xt,Ne)|0,g=g+Math.imul(Ze,tt)|0,v=v+Math.imul(Ze,Ne)|0,C=C+Math.imul(dt,oe)|0,g=g+Math.imul(dt,he)|0,g=g+Math.imul(Ge,oe)|0,v=v+Math.imul(Ge,he)|0,C=C+Math.imul(Ie,He)|0,g=g+Math.imul(Ie,Re)|0,g=g+Math.imul(Fe,He)|0,v=v+Math.imul(Fe,Re)|0;var gn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(gn>>>26)|0,gn&=67108863,C=Math.imul(Nt,tt),g=Math.imul(Nt,Ne),g=g+Math.imul(nt,tt)|0,v=Math.imul(nt,Ne),C=C+Math.imul(xt,oe)|0,g=g+Math.imul(xt,he)|0,g=g+Math.imul(Ze,oe)|0,v=v+Math.imul(Ze,he)|0,C=C+Math.imul(dt,He)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(Ge,He)|0,v=v+Math.imul(Ge,Re)|0;var fi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(fi>>>26)|0,fi&=67108863,C=Math.imul(Nt,oe),g=Math.imul(Nt,he),g=g+Math.imul(nt,oe)|0,v=Math.imul(nt,he),C=C+Math.imul(xt,He)|0,g=g+Math.imul(xt,Re)|0,g=g+Math.imul(Ze,He)|0,v=v+Math.imul(Ze,Re)|0;var di=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(di>>>26)|0,di&=67108863,C=Math.imul(Nt,He),g=Math.imul(Nt,Re),g=g+Math.imul(nt,He)|0,v=Math.imul(nt,Re);var D=(O+C|0)+((g&8191)<<13)|0;return O=(v+(g>>>13)|0)+(D>>>26)|0,D&=67108863,E[0]=ze,E[1]=at,E[2]=Ht,E[3]=Rt,E[4]=Dt,E[5]=er,E[6]=yr,E[7]=ir,E[8]=Kt,E[9]=gr,E[10]=pn,E[11]=Dr,E[12]=mn,E[13]=ui,E[14]=li,E[15]=gn,E[16]=fi,E[17]=di,E[18]=D,O!==0&&(E[19]=O,m.length++),m};Math.imul||(R=P);function N($,p,d){d.negative=p.negative^$.negative,d.length=$.length+p.length;for(var m=0,x=0,M=0;M<d.length-1;M++){var E=x;x=0;for(var O=m&67108863,C=Math.min(M,p.length-1),g=Math.max(0,M-$.length+1);g<=C;g++){var v=M-g,j=$.words[v]|0,ee=p.words[g]|0,ie=j*ee,ve=ie&67108863;E=E+(ie/67108864|0)|0,ve=ve+O|0,O=ve&67108863,E=E+(ve>>>26)|0,x+=E>>>26,E&=67108863}d.words[M]=O,m=E,E=x}return m!==0?d.words[M]=m:d.length--,d._strip()}function F($,p,d){return N($,p,d)}s.prototype.mulTo=function(p,d){var m,x=this.length+p.length;return this.length===10&&p.length===10?m=R(this,p,d):x<63?m=P(this,p,d):x<1024?m=N(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 M=(this.words[x]|0)*p,E=(M&67108863)+(m&67108863);m>>=26,m+=M/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=A(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 M=m.sqr();x<d.length;x++,M=M.sqr())d[x]!==0&&(m=m.mul(M));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,M;if(d!==0){var E=0;for(M=0;M<this.length;M++){var O=this.words[M]&x,C=(this.words[M]|0)-O<<d;this.words[M]=C|E,E=O>>>26-d}E&&(this.words[M]=E,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()},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 M=p%26,E=Math.min((p-M)/26,this.length),O=67108863^67108863>>>M<<M,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-M|j>>>M,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 M=this.words[m];return!!(M&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,M;this._expand(x);var E,O=0;for(M=0;M<p.length;M++){E=(this.words[M+m]|0)+O;var C=(p.words[M]|0)*d;E-=C&67108863,O=(E>>26)-(C/67108864|0),this.words[M+m]=E&67108863}for(;M<this.length-m;M++)E=(this.words[M+m]|0)+O,O=E>>26,this.words[M+m]=E&67108863;if(O===0)return this._strip();for(n(O===-1),O=0,M=0;M<this.length;M++)E=-(this.words[M]|0)+O,O=E>>26,this.words[M]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var m=this.length-p.length,x=this.clone(),M=p,E=M.words[M.length-1]|0,O=this._countBits(E);m=26-O,m!==0&&(M=M.ushln(m),x.iushln(m),E=M.words[M.length-1]|0);var C=x.length-M.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(M,1,C);j.negative===0&&(x=j,g&&(g.words[C]=1));for(var ee=C-1;ee>=0;ee--){var ie=(x.words[M.length+ee]|0)*67108864+(x.words[M.length+ee-1]|0);for(ie=Math.min(ie/E|0,67108863),x._ishlnsubmul(M,ie,ee);x.negative!==0;)ie--,x.negative=0,x._ishlnsubmul(M,1,ee),x.isZero()||(x.negative^=1);g&&(g.words[ee]=ie)}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,M,E;return this.negative!==0&&p.negative===0?(E=this.neg().divmod(p,d),d!=="mod"&&(x=E.div.neg()),d!=="div"&&(M=E.mod.neg(),m&&M.negative!==0&&M.iadd(p)),{div:x,mod:M}):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"&&(M=E.mod.neg(),m&&M.negative!==0&&M.isub(p)),{div:E.div,mod:M}):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),M=p.andln(1),E=m.cmp(x);return E<0||M===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,M=this.length-1;M>=0;M--)x=(m*x+(this.words[M]|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 M=(this.words[x]|0)+m*67108864;this.words[x]=M/p|0,m=M%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),M=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()||M.isOdd())&&(x.iadd(g),M.isub(v)),x.iushrn(1),M.iushrn(1);for(var ie=0,ve=1;!(m.words[0]&ve)&&ie<26;++ie,ve<<=1);if(ie>0)for(m.iushrn(ie);ie-- >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),M.isub(O)):(m.isub(d),E.isub(x),O.isub(M))}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),M=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;)M.isOdd()&&M.iadd(E),M.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(M)):(m.isub(d),M.isub(x))}var j;return d.cmpn(1)===0?j=x:j=M,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 M=d.cmp(m);if(M<0){var E=d;d=m,m=E}else if(M===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 M=x,E=m;M!==0&&E<this.length;E++){var O=this.words[E]|0;O+=M,M=O>>>26,O&=67108863,this.words[E]=O}return M!==0&&(this.words[E]=M,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,M=p.words[m]|0;if(x!==M){x<M?d=-1:x>M&&(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($,p){this.name=$,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),M=0;M<x;M++)d.words[M]=p.words[M];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,M=10;M<p.length;M++){var O=p.words[M]|0;p.words[M-10]=(O&m)<<4|E>>>22,E=O}E>>>=22,p.words[M-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 J(){G.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(J,G);function ne(){G.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ne,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,M=x&67108863;x>>>=26,p.words[m]=M,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 J;else if(p==="p192")d=new ne;else if(p==="p25519")d=new ae;else throw new Error("Unknown prime "+p);return L[p]=d,d};function ce($){if(typeof $=="string"){var p=s._prime($);this.m=p.p,this.prime=p}else n($.gtn(1),"modulus must be greater than 1"),this.m=$,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),M=0;!x.isZero()&&x.andln(1)===0;)M++,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),ie=M;ee.cmp(E)!==0;){for(var ve=ee,pe=0;ve.cmp(E)!==0;pe++)ve=ve.redSqr();n(pe<ie);var Ee=this.pow(v,new s(1).iushln(ie-pe-1));j=j.redMul(Ee),v=Ee.redSqr(),ee=ee.redMul(v),ie=pe}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 M=2;M<x.length;M++)x[M]=this.mul(x[M-1],p);var E=x[0],O=0,C=0,g=d.bitLength()%26;for(g===0&&(g=26),M=d.length-1;M>=0;M--){for(var v=d.words[M],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&&(M!==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 V(p)};function V($){ce.call(this,$),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(V,ce),V.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},V.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},V.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),M=m.isub(x).iushrn(this.shift),E=M;return M.cmp(this.m)>=0?E=M.isub(this.m):M.cmpn(0)<0&&(E=M.iadd(this.m)),E._forceRed(this)},V.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),M=m.isub(x).iushrn(this.shift),E=M;return M.cmp(this.m)>=0?E=M.isub(this.m):M.cmpn(0)<0&&(E=M.iadd(this.m)),E._forceRed(this)},V.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(e,Rr)})(zp);var jx=zp.exports;const Dm=hc(jx);var U7=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(on,"__esModule",{value:!0});on.parseAccumulatorUpdateData=on.sliceAccumulatorUpdateData=on.parseTwapMessage=on.parsePriceFeedMessage=on.isAccumulatorUpdateData=void 0;const rn=U7(jx),z7="504e4155",V7=1,q7=0,Ud=20,W7=0,G7=1;function Vp(e){return e.toString("hex").slice(0,8)===z7&&e[4]===V7&&e[5]===q7}on.isAccumulatorUpdateData=Vp;function H7(e){let t=0;if(e.readUInt8(t)!==W7)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new rn.default(e.subarray(t,t+8),"be");t+=8;const s=new rn.default(e.subarray(t,t+8),"be");t+=8;const o=e.readInt32BE(t);t+=4;const a=new rn.default(e.subarray(t,t+8),"be");t+=8;const c=new rn.default(e.subarray(t,t+8),"be");t+=8;const u=new rn.default(e.subarray(t,t+8),"be");t+=8;const l=new rn.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}}on.parsePriceFeedMessage=H7;function K7(e){let t=0;if(e.readUInt8(t)!==G7)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new rn.default(e.subarray(t,t+16),"be");t+=16;const s=new rn.default(e.subarray(t,t+16),"be");t+=16;const o=new rn.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new rn.default(e.subarray(t,t+8),"be");t+=8;const u=new rn.default(e.subarray(t,t+8),"be");t+=8;const l=new rn.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}}on.parseTwapMessage=K7;function J7(e,t,r){if(!Vp(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+=Ud*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 Fd.concat([e.subarray(0,o),Fd.from([u.length]),...a.slice(t,r)])}on.sliceAccumulatorUpdateData=J7;function X7(e){if(!Vp(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+Ud))),t+=Ud;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}}on.parseAccumulatorUpdateData=X7;(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=dl;var r=on;Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"sliceAccumulatorUpdateData",{enumerable:!0,get:function(){return r.sliceAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}}),Object.defineProperty(e,"parsePriceFeedMessage",{enumerable:!0,get:function(){return r.parsePriceFeedMessage}}),Object.defineProperty(e,"parseTwapMessage",{enumerable:!0,get:function(){return r.parseTwapMessage}});class n{constructor(a){vt(this,"conf");vt(this,"expo");vt(this,"price");vt(this,"publishTime");this.conf=a.conf,this.expo=a.expo,this.price=a.price,this.publishTime=a.publishTime}getPriceAsNumberUnchecked(){return Number(this.price)*10**this.expo}getConfAsNumberUnchecked(){return Number(this.conf)*10**this.expo}static fromJson(a){const c=t.Convert.toPrice(a);return new n({conf:c.conf,expo:c.expo,price:c.price,publishTime:c.publish_time})}toJson(){const a={conf:this.conf,expo:this.expo,price:this.price,publish_time:this.publishTime};return t.Convert.priceToJson(a)}}e.Price=n;class i{constructor(a){vt(this,"attestationTime");vt(this,"emitterChain");vt(this,"priceServiceReceiveTime");vt(this,"sequenceNumber");vt(this,"slot");vt(this,"prevPublishTime");this.attestationTime=a.attestationTime,this.emitterChain=a.emitterChain,this.priceServiceReceiveTime=a.receiveTime,this.sequenceNumber=a.sequenceNumber,this.slot=a.slot,this.prevPublishTime=a.prevPublishTime}static fromJson(a){if(a===void 0)return;const c=t.Convert.toPriceFeedMetadata(a);return new i({attestationTime:c.attestation_time,emitterChain:c.emitter_chain,receiveTime:c.price_service_receive_time,sequenceNumber:c.sequence_number,slot:c.slot,prevPublishTime:c.prev_publish_time})}toJson(){const a={attestation_time:this.attestationTime,emitter_chain:this.emitterChain,price_service_receive_time:this.priceServiceReceiveTime,sequence_number:this.sequenceNumber,slot:this.slot,prev_publish_time:this.prevPublishTime};return t.Convert.priceFeedMetadataToJson(a)}}e.PriceFeedMetadata=i;let s=class kx{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 kx({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})(Up);function Rx(e,t){return function(){return e.apply(t,arguments)}}const{toString:Y7}=Object.prototype,{getPrototypeOf:qp}=Object,pl=(e=>t=>{const r=Y7.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Rn=e=>(e=e.toLowerCase(),t=>pl(t)===e),ml=e=>t=>typeof t===e,{isArray:Jo}=Array,Za=ml("undefined");function Z7(e){return e!==null&&!Za(e)&&e.constructor!==null&&!Za(e.constructor)&&Gr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Nx=Rn("ArrayBuffer");function Q7(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Nx(e.buffer),t}const ej=ml("string"),Gr=ml("function"),Dx=ml("number"),gl=e=>e!==null&&typeof e=="object",tj=e=>e===!0||e===!1,iu=e=>{if(pl(e)!=="object")return!1;const t=qp(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},rj=Rn("Date"),nj=Rn("File"),ij=Rn("Blob"),sj=Rn("FileList"),oj=e=>gl(e)&&Gr(e.pipe),aj=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Gr(e.append)&&((t=pl(e))==="formdata"||t==="object"&&Gr(e.toString)&&e.toString()==="[object FormData]"))},cj=Rn("URLSearchParams"),[uj,lj,fj,dj]=["ReadableStream","Request","Response","Headers"].map(Rn),hj=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yc(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Jo(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 $x(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 Us=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Rr)(),Bx=e=>!Za(e)&&e!==Us;function zd(){const{caseless:e}=Bx(this)&&this||{},t={},r=(n,i)=>{const s=e&&$x(t,i)||i;iu(t[s])&&iu(n)?t[s]=zd(t[s],n):iu(n)?t[s]=zd({},n):Jo(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&yc(arguments[n],r);return t}const pj=(e,t,r,{allOwnKeys:n}={})=>(yc(t,(i,s)=>{r&&Gr(i)?e[s]=Rx(i,r):e[s]=i},{allOwnKeys:n}),e),mj=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),gj=(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)},vj=(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&&qp(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},yj=(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},bj=e=>{if(!e)return null;if(Jo(e))return e;let t=e.length;if(!Dx(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},wj=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&qp(Uint8Array)),_j=(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])}},xj=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Sj=Rn("HTMLFormElement"),Ej=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),$m=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Cj=Rn("RegExp"),Lx=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};yc(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},Mj=e=>{Lx(e,(t,r)=>{if(Gr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Gr(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+"'")})}})},Tj=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Jo(e)?n(e):n(String(e).split(t)),r},Aj=()=>{},Oj=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Pf="abcdefghijklmnopqrstuvwxyz",Bm="0123456789",Fx={DIGIT:Bm,ALPHA:Pf,ALPHA_DIGIT:Pf+Pf.toUpperCase()+Bm},Ij=(e=16,t=Fx.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function Pj(e){return!!(e&&Gr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const jj=e=>{const t=new Array(10),r=(n,i)=>{if(gl(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=Jo(n)?[]:{};return yc(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)},kj=Rn("AsyncFunction"),Rj=e=>e&&(gl(e)||Gr(e))&&Gr(e.then)&&Gr(e.catch),Ux=((e,t)=>e?setImmediate:t?((r,n)=>(Us.addEventListener("message",({source:i,data:s})=>{i===Us&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Us.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Gr(Us.postMessage)),Nj=typeof queueMicrotask<"u"?queueMicrotask.bind(Us):typeof Tn<"u"&&Tn.nextTick||Ux;var fe={isArray:Jo,isArrayBuffer:Nx,isBuffer:Z7,isFormData:aj,isArrayBufferView:Q7,isString:ej,isNumber:Dx,isBoolean:tj,isObject:gl,isPlainObject:iu,isReadableStream:uj,isRequest:lj,isResponse:fj,isHeaders:dj,isUndefined:Za,isDate:rj,isFile:nj,isBlob:ij,isRegExp:Cj,isFunction:Gr,isStream:oj,isURLSearchParams:cj,isTypedArray:wj,isFileList:sj,forEach:yc,merge:zd,extend:pj,trim:hj,stripBOM:mj,inherits:gj,toFlatObject:vj,kindOf:pl,kindOfTest:Rn,endsWith:yj,toArray:bj,forEachEntry:_j,matchAll:xj,isHTMLForm:Sj,hasOwnProperty:$m,hasOwnProp:$m,reduceDescriptors:Lx,freezeMethods:Mj,toObjectSet:Tj,toCamelCase:Ej,noop:Aj,toFiniteNumber:Oj,findKey:$x,global:Us,isContextDefined:Bx,ALPHABET:Fx,generateString:Ij,isSpecCompliantForm:Pj,toJSONObject:jj,isAsyncFn:kj,isThenable:Rj,setImmediate:Ux,asap:Nj};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 zx=pt.prototype,Vx={};["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=>{Vx[e]={value:e}});Object.defineProperties(pt,Vx);Object.defineProperty(zx,"isAxiosError",{value:!0});pt.from=(e,t,r,n,i,s)=>{const o=Object.create(zx);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 Dj=null;function Vd(e){return fe.isPlainObject(e)||fe.isArray(e)}function qx(e){return fe.endsWith(e,"[]")?e.slice(0,-2):e}function Lm(e,t,r){return e?e.concat(t).map(function(i,s){return i=qx(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function $j(e){return fe.isArray(e)&&!e.some(Vd)}const Bj=fe.toFlatObject(fe,{},null,function(t){return/^is[A-Z]/.test(t)});function vl(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,A){return!fe.isUndefined(A[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]):Fd.from(b):b}function l(b,w,A){let P=b;if(b&&!A&&typeof b=="object"){if(fe.endsWith(w,"{}"))w=n?w:w.slice(0,-2),b=JSON.stringify(b);else if(fe.isArray(b)&&$j(b)||(fe.isFileList(b)||fe.endsWith(w,"[]"))&&(P=fe.toArray(b)))return w=qx(w),P.forEach(function(N,F){!(fe.isUndefined(N)||N===null)&&t.append(o===!0?Lm([w],F,s):o===null?w:w+"[]",u(N))}),!1}return Vd(b)?!0:(t.append(Lm(A,w,s),u(b)),!1)}const f=[],h=Object.assign(Bj,{defaultVisitor:l,convertValue:u,isVisitable:Vd});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,R){(!(fe.isUndefined(P)||P===null)&&i.call(t,P,fe.isString(R)?R.trim():R,w,h))===!0&&y(P,w?w.concat(R):[R])}),f.pop()}}if(!fe.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Fm(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Wp(e,t){this._pairs=[],e&&vl(e,this,t)}const Wx=Wp.prototype;Wx.append=function(t,r){this._pairs.push([t,r])};Wx.toString=function(t){const r=t?function(n){return t.call(this,n,Fm)}:Fm;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Lj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Gx(e,t,r){if(!t)return e;const n=r&&r.encode||Lj;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 Wp(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Fj{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 Um=Fj,Hx={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Uj=typeof URLSearchParams<"u"?URLSearchParams:Wp,zj=typeof FormData<"u"?FormData:null,Vj=typeof Blob<"u"?Blob:null,qj={isBrowser:!0,classes:{URLSearchParams:Uj,FormData:zj,Blob:Vj},protocols:["http","https","file","blob","url","data"]};const Gp=typeof window<"u"&&typeof document<"u",qd=typeof navigator=="object"&&navigator||void 0,Wj=Gp&&(!qd||["ReactNative","NativeScript","NS"].indexOf(qd.product)<0),Gj=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Hj=Gp&&window.location.href||"http://localhost";var Kj=Object.freeze({__proto__:null,hasBrowserEnv:Gp,hasStandardBrowserWebWorkerEnv:Gj,hasStandardBrowserEnv:Wj,navigator:qd,origin:Hj}),Cr={...Kj,...qj};function Jj(e,t){return vl(e,new Cr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Cr.isNode&&fe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Xj(e){return fe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Yj(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 Kx(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]=Yj(i[o])),!a)}if(fe.isFormData(e)&&fe.isFunction(e.entries)){const r={};return fe.forEachEntry(e,(n,i)=>{t(Xj(n),i,r,0)}),r}return null}function Zj(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 Hp={transitional:Hx,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(Kx(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 Jj(t,this.formSerializer).toString();if((a=fe.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return vl(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Zj(t)):t}],transformResponse:[function(t){const r=this.transitional||Hp.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:Cr.classes.FormData,Blob:Cr.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=>{Hp.headers[e]={}});var Kp=Hp;const Qj=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 ek=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]&&Qj[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const zm=Symbol("internals");function wa(e){return e&&String(e).trim().toLowerCase()}function su(e){return e===!1||e==null?e:fe.isArray(e)?e.map(su):String(e)}function tk(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 rk=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function jf(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 nk(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function ik(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 yl{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function s(a,c,u){const l=wa(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]=su(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())&&!rk(t))o(ek(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=wa(t),t){const n=fe.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return tk(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=wa(t),t){const n=fe.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||jf(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function s(o){if(o=wa(o),o){const a=fe.findKey(n,o);a&&(!r||jf(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||jf(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]=su(i),delete r[s];return}const a=t?nk(s):String(s).trim();a!==s&&delete r[s],r[a]=su(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[zm]=this[zm]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=wa(o);n[a]||(ik(i,o),n[a]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}yl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors(yl.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});fe.freezeMethods(yl);var An=yl;function kf(e,t){const r=this||Kp,n=t||r,i=An.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 Jx(e){return!!(e&&e.__CANCEL__)}function Xo(e,t,r){pt.call(this,e??"canceled",pt.ERR_CANCELED,t,r),this.name="CanceledError"}fe.inherits(Xo,pt,{__CANCEL__:!0});function Xx(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 sk(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function ok(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 ak(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 ju=(e,t,r=3)=>{let n=0;const i=ok(50,250);return ak(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)},Vm=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},qm=e=>(...t)=>fe.asap(()=>e(...t));var ck=Cr.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Cr.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Cr.origin),Cr.navigator&&/(msie|trident)/i.test(Cr.navigator.userAgent)):()=>!0,uk=Cr.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 lk(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function fk(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Yx(e,t){return e&&!lk(t)?fk(e,t):t}const Wm=e=>e instanceof An?{...e}:e;function Gs(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(Wm(u),Wm(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 Zx=e=>{const t=Gs({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=An.from(o),t.url=Gx(Yx(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(Cr.hasStandardBrowserEnv||Cr.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(Cr.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&ck(t.url))){const u=i&&s&&uk.read(s);u&&o.set(i,u)}return t};const dk=typeof XMLHttpRequest<"u";var hk=dk&&function(e){return new Promise(function(r,n){const i=Zx(e);let s=i.data;const o=An.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 A=new XMLHttpRequest;A.open(i.method.toUpperCase(),i.url,!0),A.timeout=i.timeout;function P(){if(!A)return;const N=An.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:N,config:e,request:A};Xx(function(q){r(q),w()},function(q){n(q),w()},L),A=null}"onloadend"in A?A.onloadend=P:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(P)},A.onabort=function(){A&&(n(new pt("Request aborted",pt.ECONNABORTED,e,A)),A=null)},A.onerror=function(){n(new pt("Network Error",pt.ERR_NETWORK,e,A)),A=null},A.ontimeout=function(){let F=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const L=i.transitional||Hx;i.timeoutErrorMessage&&(F=i.timeoutErrorMessage),n(new pt(F,L.clarifyTimeoutError?pt.ETIMEDOUT:pt.ECONNABORTED,e,A)),A=null},s===void 0&&o.setContentType(null),"setRequestHeader"in A&&fe.forEach(o.toJSON(),function(F,L){A.setRequestHeader(L,F)}),fe.isUndefined(i.withCredentials)||(A.withCredentials=!!i.withCredentials),a&&a!=="json"&&(A.responseType=i.responseType),u&&([h,b]=ju(u,!0),A.addEventListener("progress",h)),c&&A.upload&&([f,y]=ju(c),A.upload.addEventListener("progress",f),A.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=N=>{A&&(n(!N||N.type?new Xo(null,e,A):N),A.abort(),A=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const R=sk(i.url);if(R&&Cr.protocols.indexOf(R)===-1){n(new pt("Unsupported protocol "+R+":",pt.ERR_BAD_REQUEST,e));return}A.send(s||null)})};const pk=(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 Xo(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}};var mk=pk;const gk=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},vk=async function*(e,t){for await(const r of yk(e))yield*gk(r,t)},yk=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()}},Gm=(e,t,r,n)=>{const i=vk(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})},bl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Qx=bl&&typeof ReadableStream=="function",bk=bl&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),e4=(e,...t)=>{try{return!!e(...t)}catch{return!1}},wk=Qx&&e4(()=>{let e=!1;const t=new Request(Cr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Hm=64*1024,Wd=Qx&&e4(()=>fe.isReadableStream(new Response("").body)),ku={stream:Wd&&(e=>e.body)};bl&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!ku[t]&&(ku[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 _k=async e=>{if(e==null)return 0;if(fe.isBlob(e))return e.size;if(fe.isSpecCompliantForm(e))return(await new Request(Cr.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 bk(e)).byteLength},xk=async(e,t)=>{const r=fe.toFiniteNumber(e.getContentLength());return r??_k(t)};var Sk=bl&&(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}=Zx(e);u=u?(u+"").toLowerCase():"text";let y=mk([i,s&&s.toAbortSignal()],o),b;const w=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let A;try{if(c&&wk&&r!=="get"&&r!=="head"&&(A=await xk(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,J]=Vm(A,ju(qm(c)));n=Gm(L.body,Hm,q,J)}}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 R=await fetch(b);const N=Wd&&(u==="stream"||u==="response");if(Wd&&(a||N&&w)){const L={};["status","statusText","headers"].forEach(ne=>{L[ne]=R[ne]});const G=fe.toFiniteNumber(R.headers.get("content-length")),[q,J]=a&&Vm(G,ju(qm(a),!0))||[];R=new Response(Gm(R.body,Hm,q,()=>{J&&J(),w&&w()}),L)}u=u||"text";let F=await ku[fe.findKey(ku,u)||"text"](R,e);return!N&&w&&w(),await new Promise((L,G)=>{Xx(L,G,{data:F,headers:An.from(R.headers),status:R.status,statusText:R.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 Gd={http:Dj,xhr:hk,fetch:Sk};fe.forEach(Gd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Km=e=>`- ${e}`,Ek=e=>fe.isFunction(e)||e===null||e===!1;var t4={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,!Ek(r)&&(n=Gd[(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(Km).join(`
|
|
37
|
+
`):" "+Km(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:Gd};function Rf(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xo(null,e)}function Jm(e){return Rf(e),e.headers=An.from(e.headers),e.data=kf.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),t4.getAdapter(e.adapter||Kp.adapter)(e).then(function(n){return Rf(e),n.data=kf.call(e,e.transformResponse,n),n.headers=An.from(n.headers),n},function(n){return Jx(n)||(Rf(e),n&&n.response&&(n.response.data=kf.call(e,e.transformResponse,n.response),n.response.headers=An.from(n.response.headers))),Promise.reject(n)})}const r4="1.7.9",wl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{wl[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Xm={};wl.transitional=function(t,r,n){function i(s,o){return"[Axios v"+r4+"] 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&&!Xm[o]&&(Xm[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}};wl.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Ck(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 ou={assertOptions:Ck,validators:wl};const Un=ou.validators;class Ru{constructor(t){this.defaults=t,this.interceptors={request:new Um,response:new Um}}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=Gs(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&ou.assertOptions(n,{silentJSONParsing:Un.transitional(Un.boolean),forcedJSONParsing:Un.transitional(Un.boolean),clarifyTimeoutError:Un.transitional(Un.boolean)},!1),i!=null&&(fe.isFunction(i)?r.paramsSerializer={serialize:i}:ou.assertOptions(i,{encode:Un.function,serialize:Un.function},!0)),ou.assertOptions(r,{baseUrl:Un.spelling("baseURL"),withXsrfToken:Un.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=An.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=[Jm.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(A){w.call(this,A);break}}try{l=Jm.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=Gs(this.defaults,t);const r=Yx(t.baseURL,t.url);return Gx(r,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){Ru.prototype[t]=function(r,n){return this.request(Gs(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(Gs(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Ru.prototype[t]=r(),Ru.prototype[t+"Form"]=r(!0)});var au=Ru;class Jp{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 Xo(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 Jp(function(i){t=i}),cancel:t}}}var Mk=Jp;function Tk(e){return function(r){return e.apply(null,r)}}function Ak(e){return fe.isObject(e)&&e.isAxiosError===!0}const Hd={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(Hd).forEach(([e,t])=>{Hd[t]=e});var Ok=Hd;function n4(e){const t=new au(e),r=Rx(au.prototype.request,t);return fe.extend(r,au.prototype,t,{allOwnKeys:!0}),fe.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return n4(Gs(e,i))},r}const ur=n4(Kp);ur.Axios=au;ur.CanceledError=Xo;ur.CancelToken=Mk;ur.isCancel=Jx;ur.VERSION=r4;ur.toFormData=vl;ur.AxiosError=pt;ur.Cancel=ur.CanceledError;ur.all=function(t){return Promise.all(t)};ur.spread=Tk;ur.isAxiosError=Ak;ur.mergeConfig=Gs;ur.AxiosHeaders=An;ur.formToJSON=e=>Kx(fe.isHTMLForm(e)?new FormData(e):e);ur.getAdapter=t4.getAdapter;ur.HttpStatusCode=Ok;ur.default=ur;var i4=ur,Xp={exports:{}},Kr={},s4={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})(s4);var Ik=s4.exports,Nf={exports:{}},Df={exports:{}},Ym;function _l(){return Ym||(Ym=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 Zm;function Pk(){return Zm||(Zm=1,function(e){var t=_l().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:$(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",A="suspendedYield",P="executing",R="completed",N={};function F(){}function L(){}function G(){}var q={};h(q,u,function(){return this});var J=Object.getPrototypeOf,ne=J&&J(J(M([])));ne&&ne!==s&&o.call(ne,u)&&(q=ne);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 V(E,O){function C(v,j,ee,ie){var ve=b(E[v],E,j);if(ve.type!=="throw"){var pe=ve.arg,Ee=pe.value;return Ee&&t(Ee)=="object"&&o.call(Ee,"__await")?O.resolve(Ee.__await).then(function(Se){C("next",Se,ee,ie)},function(Se){C("throw",Se,ee,ie)}):O.resolve(Ee).then(function(Se){pe.value=Se,ee(pe)},function(Se){return C("throw",Se,ee,ie)})}ie(ve.arg)}var g;a(this,"_invoke",{value:function(j,ee){function ie(){return new O(function(ve,pe){C(j,ee,ve,pe)})}return g=g?g.then(ie,ie):ie()}})}function $(E,O,C){var g=w;return function(v,j){if(g===P)throw Error("Generator is already running");if(g===R){if(v==="throw")throw j;return{value:n,done:!0}}for(C.method=v,C.arg=j;;){var ee=C.delegate;if(ee){var ie=p(ee,C);if(ie){if(ie===N)continue;return ie}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(g===w)throw g=R,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);g=P;var ve=b(E,O,C);if(ve.type==="normal"){if(g=C.done?R:A,ve.arg===N)continue;return{value:ve.arg,done:C.done}}ve.type==="throw"&&(g=R,C.method="throw",C.arg=ve.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")),N;var v=b(g,E.iterator,O.arg);if(v.type==="throw")return O.method="throw",O.arg=v.arg,O.delegate=null,N;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,N):j:(O.method="throw",O.arg=new TypeError("iterator result is not an object"),O.delegate=null,N)}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 M(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(V.prototype),h(V.prototype,l,function(){return this}),i.AsyncIterator=V,i.async=function(E,O,C,g,v){v===void 0&&(v=Promise);var j=new V(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=M,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(pe,Ee){return ee.type="throw",ee.arg=O,C.next=pe,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 ie=o.call(j,"catchLoc"),ve=o.call(j,"finallyLoc");if(ie&&ve){if(this.prev<j.catchLoc)return g(j.catchLoc,!0);if(this.prev<j.finallyLoc)return g(j.finallyLoc)}else if(ie){if(this.prev<j.catchLoc)return g(j.catchLoc,!0)}else{if(!ve)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,N):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),N},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),N}},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:M(O),resultName:C,nextLoc:g},this.method==="next"&&(this.arg=n),N}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Nf)),Nf.exports}var $f,Qm;function jk(){if(Qm)return $f;Qm=1;var e=Pk()();$f=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return $f}var Bf={exports:{}},eg;function kk(){return eg||(eg=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}(Bf)),Bf.exports}var Lf={exports:{}},Ff={exports:{}},Uf={exports:{}},tg;function Rk(){return tg||(tg=1,function(e){var t=_l().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}(Uf)),Uf.exports}var rg;function Nk(){return rg||(rg=1,function(e){var t=_l().default,r=Rk();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}(Ff)),Ff.exports}var ng;function Dk(){return ng||(ng=1,function(e){var t=Nk();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}(Lf)),Lf.exports}var zf,ig;function $k(){if(ig)return zf;ig=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 zf=t=>!e.has(t&&t.code),zf}var bc=Ik;Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isNetworkError=Zp;Kr.isRetryableError=xl;Kr.isSafeRequestError=c4;Kr.isIdempotentRequestError=Qp;Kr.isNetworkOrIdempotentRequestError=e0;Kr.exponentialDelay=u4;Kr.default=Ys;Kr.DEFAULT_OPTIONS=Kr.namespace=void 0;var Nu=bc(jk()),Bk=bc(_l()),o4=bc(kk()),Lk=bc(Dk()),Fk=bc($k());function sg(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 Vf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sg(Object(r),!0).forEach(function(n){(0,Lk.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sg(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Yp="axios-retry";Kr.namespace=Yp;function Zp(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,Fk.default)(e)}var a4=["get","head","options"],Uk=a4.concat(["put","delete"]);function xl(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function c4(e){return e.config?xl(e)&&a4.indexOf(e.config.method)!==-1:!1}function Qp(e){return e.config?xl(e)&&Uk.indexOf(e.config.method)!==-1:!1}function e0(e){return Zp(e)||Qp(e)}function zk(){return 0}function u4(){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 l4={retries:3,retryCondition:e0,retryDelay:zk,shouldResetTimeout:!1,onRetry:function(){}};Kr.DEFAULT_OPTIONS=l4;function Vk(e,t){return Vf(Vf(Vf({},l4),t),e[Yp])}function og(e,t){var r=Vk(e,t);return r.retryCount=r.retryCount||0,e[Yp]=r,r}function qk(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 Wk(e,t){return Kd.apply(this,arguments)}function Kd(){return Kd=(0,o4.default)(Nu.default.mark(function e(t,r){var n,i,s,o;return Nu.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,Bk.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]])})),Kd.apply(this,arguments)}function Ys(e,t){var r=e.interceptors.request.use(function(i){var s=og(i,t);return s.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,o4.default)(Nu.default.mark(function s(o){var a,c,u,l,f,h,y,b;return Nu.default.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(a=o.config,a){A.next=3;break}return A.abrupt("return",Promise.reject(o));case 3:return c=og(a,t),A.next=6,Wk(c,o);case 6:if(!A.sent){A.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,f=c.onRetry,h=u(c.retryCount,o),qk(e,a),!(!l&&a.timeout&&c.lastRequestTime)){A.next=17;break}if(y=Date.now()-c.lastRequestTime,b=a.timeout-y-h,!(b<=0)){A.next=16;break}return A.abrupt("return",Promise.reject(o));case 16:a.timeout=b;case 17:return a.transformRequest=[function(P){return P}],A.next=20,f(c.retryCount,o,a);case 20:return A.abrupt("return",new Promise(function(P){return setTimeout(function(){return P(e(a))},h)}));case 21:return A.abrupt("return",Promise.reject(o));case 22:case"end":return A.stop()}},s)}));return function(s){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}Ys.isNetworkError=Zp;Ys.isSafeRequestError=c4;Ys.isIdempotentRequestError=Qp;Ys.isNetworkOrIdempotentRequestError=e0;Ys.exponentialDelay=u4;Ys.isRetryableError=xl;const f4=Kr.default;Xp.exports=f4;Xp.exports.default=f4;var Gk=Xp.exports,Sl={},yo=null;typeof WebSocket<"u"?yo=WebSocket:typeof MozWebSocket<"u"?yo=MozWebSocket:typeof Rr<"u"?yo=Rr.WebSocket||Rr.MozWebSocket:typeof window<"u"?yo=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(yo=self.WebSocket||self.MozWebSocket);var Hk=yo,Kk=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.ResilientWebSocket=void 0;const Jk=Kk(Hk),Xk=3e4+3e3;class Yk{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 Jk.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 ag(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()},Xk)}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 ag(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}}Sl.ResilientWebSocket=Yk;async function ag(e){return new Promise(t=>setTimeout(t,e))}function Zk(e){return 2**e*100}var Do={};Object.defineProperty(Do,"__esModule",{value:!0});Do.removeLeading0xIfExists=Do.makeWebsocketUrl=void 0;function Qk(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}Do.makeWebsocketUrl=Qk;function e9(e){return e.startsWith("0x")?e.substring(2):e}Do.removeLeading0xIfExists=e9;var d4=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fl,"__esModule",{value:!0});fl.PriceServiceConnection=void 0;const qf=Up,t9=d4(i4),cg=d4(Gk),r9=Sl,Wf=Do;class n9{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=t9.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,cg.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:cg.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 Tn<"u"&&typeof Tn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),Tn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,Wf.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=>qf.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 qf.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,Wf.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,Wf.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 r9.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=qf.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()}}fl.PriceServiceConnection=n9;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=fl;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=Up;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}})})(Fp);Object.defineProperty(ll,"__esModule",{value:!0});ll.SuiPriceServiceConnection=void 0;const i9=Fp,s9=hl();class o9 extends i9.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>s9.Buffer.from(n,"base64"))}}ll.SuiPriceServiceConnection=o9;var El={};Object.defineProperty(El,"__esModule",{value:!0});El.SuiPythClient=void 0;const Nc=y2,io=si,a9=hl(),Gf=16*1024;class c9{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(io.bcs.vector(io.bcs.U8).serialize(Array.from(s),{maxSize:Gf}).toBytes()),r.object(Nc.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(io.bcs.vector(io.bcs.U8).serialize(Array.from(r[0]),{maxSize:Gf}).toBytes()),a[0],t.object(Nc.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(Nc.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(io.bcs.vector(io.bcs.U8).serialize(Array.from(r[0]),{maxSize:Gf}).toBytes()),s[0],t.object(Nc.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(a9.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)}}El.SuiPythClient=c9;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=ll;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=El;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=Fp;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})})(Px);var ug=MM,Jd=y2,u9=So,Dc=Px,l9=Object.create,t0=Object.defineProperty,f9=Object.defineProperties,d9=Object.getOwnPropertyDescriptor,h9=Object.getOwnPropertyDescriptors,h4=Object.getOwnPropertyNames,lg=Object.getOwnPropertySymbols,p9=Object.getPrototypeOf,p4=Object.prototype.hasOwnProperty,m9=Object.prototype.propertyIsEnumerable,fg=(e,t,r)=>t in e?t0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g9=(e,t)=>{for(var r in t||(t={}))p4.call(t,r)&&fg(e,r,t[r]);if(lg)for(var r of lg(t))m9.call(t,r)&&fg(e,r,t[r]);return e},v9=(e,t)=>f9(e,h9(t)),y9=(e=>typeof Gn<"u"?Gn:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Gn<"u"?Gn:t)[r]}):e)(function(e){if(typeof Gn<"u")return Gn.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),b9=(e,t)=>function(){return t||(0,e[h4(e)[0]])((t={exports:{}}).exports,t),t.exports},w9=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of h4(t))!p4.call(e,i)&&i!==r&&t0(e,i,{get:()=>t[i],enumerable:!(n=d9(t,i))||n.enumerable});return e},Yo=(e,t,r)=>(r=e!=null?l9(p9(e)):{},w9(!e||!e.__esModule?t0(r,"default",{value:e,enumerable:!0}):r,e)),Et=(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())}),Zo=b9({"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=y9("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 M=0;d[0]==="-"&&(M++,this.negative=1),M<d.length&&(m===16?this._parseHex(d,M,x):(this._parseBase(d,m,M),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 M=0;M<this.length;M++)this.words[M]=0;var E,O,C=0;if(x==="be")for(M=d.length-1,E=0;M>=0;M-=3)O=d[M]|d[M-1]<<8|d[M-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(M=0,E=0;M<d.length;M+=3)O=d[M]|d[M+1]<<8|d[M+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 M=0;M<this.length;M++)this.words[M]=0;var E=0,O=0,C;if(x==="be")for(M=d.length-1;M>=m;M-=2)C=u(d,m,M)<<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(M=g%2===0?m+1:m;M<d.length;M+=2)C=u(d,m,M)<<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 M=0,E=0,O=Math.min(p.length,m),C=d;C<O;C++){var g=p.charCodeAt(C)-48;M*=x,g>=49?E=g-49+10:g>=17?E=g-17+10:E=g,i(g>=0&&E<x,"Invalid character"),M+=E}return M}o.prototype._parseBase=function(d,m,x){this.words=[0],this.length=1;for(var M=0,E=1;E<=67108863;E*=m)M++;M--,E=E/m|0;for(var O=d.length-x,C=O%M,g=Math.min(O,O-C)+x,v=0,j=x;j<g;j+=M)v=l(d,j,j+M,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 M=0,E=0,O=0;O<this.length;O++){var C=this.words[O],g=((C<<M|E)&16777215).toString(16);E=C>>>24-M&16777215,M+=2,M>=26&&(M-=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 ie=ee.modrn(j).toString(d);ee=ee.idivn(j),ee.isZero()?x=ie+x:x=y[v-ie.length]+ie+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 A=function(d,m){return d.allocUnsafe?d.allocUnsafe(m):new d(m)};o.prototype.toArrayLike=function(d,m,x){this._strip();var M=this.byteLength(),E=x||Math.max(1,M);i(M<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0");var O=A(d,E),C=m==="le"?"LE":"BE";return this["_toArrayLike"+C](O,M),O},o.prototype._toArrayLikeLE=function(d,m){for(var x=0,M=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|M;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),M=0,O=0):(M=C>>>24,O+=2)}if(x<d.length)for(d[x++]=M;x<d.length;)d[x++]=0},o.prototype._toArrayLikeBE=function(d,m){for(var x=d.length-1,M=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|M;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),M=0,O=0):(M=C>>>24,O+=2)}if(x>=0)for(d[x--]=M;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,M=m%26;d[m]=p.words[x]>>>M&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 M=0;M<x.length;M++)this.words[M]=m.words[M]^x.words[M];if(this!==m)for(;M<m.length;M++)this.words[M]=m.words[M];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 M=0;M<m;M++)this.words[M]=~this.words[M]&67108863;return x>0&&(this.words[M]=~this.words[M]&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,M=d%26;return this._expand(x+1),m?this.words[x]=this.words[x]|1<<M:this.words[x]=this.words[x]&~(1<<M),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,M;this.length>d.length?(x=this,M=d):(x=d,M=this);for(var E=0,O=0;O<M.length;O++)m=(x.words[O]|0)+(M.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 M,E;x>0?(M=this,E=d):(M=d,E=this);for(var O=0,C=0;C<E.length;C++)m=(M.words[C]|0)-(E.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;for(;O!==0&&C<M.length;C++)m=(M.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;if(O===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()},o.prototype.sub=function(d){return this.clone().isub(d)};function R(p,d,m){m.negative=d.negative^p.negative;var x=p.length+d.length|0;m.length=x,x=x-1|0;var M=p.words[0]|0,E=d.words[0]|0,O=M*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,ie=Math.min(v,d.length-1),ve=Math.max(0,v-p.length+1);ve<=ie;ve++){var pe=v-ve|0;M=p.words[pe]|0,E=d.words[ve]|0,O=M*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 N=function(d,m,x){var M=d.words,E=m.words,O=x.words,C=0,g,v,j,ee=M[0]|0,ie=ee&8191,ve=ee>>>13,pe=M[1]|0,Ee=pe&8191,Se=pe>>>13,Ke=M[2]|0,Ue=Ke&8191,lt=Ke>>>13,ht=M[3]|0,$e=ht&8191,mt=ht>>>13,_e=M[4]|0,ge=_e&8191,Ae=_e>>>13,qe=M[5]|0,De=qe&8191,Oe=qe>>>13,Ie=M[6]|0,Fe=Ie&8191,ft=Ie>>>13,dt=M[7]|0,Ge=dt&8191,jt=dt>>>13,xt=M[8]|0,Ze=xt&8191,Tt=xt>>>13,Nt=M[9]|0,nt=Nt&8191,St=Nt>>>13,At=E[0]|0,st=At&8191,kt=At>>>13,It=E[1]|0,it=It&8191,bt=It>>>13,Ct=E[2]|0,Ye=Ct&8191,gt=Ct>>>13,Pt=E[3]|0,ot=Pt&8191,wt=Pt>>>13,Ft=E[4]|0,k=Ft&8191,S=Ft>>>13,T=E[5]|0,B=T&8191,K=T>>>13,Z=E[6]|0,te=Z&8191,Be=Z>>>13,tt=E[7]|0,Ne=tt&8191,z=tt>>>13,oe=E[8]|0,he=oe&8191,ke=oe>>>13,He=E[9]|0,Re=He&8191,ze=He>>>13;x.negative=d.negative^m.negative,x.length=19,g=Math.imul(ie,st),v=Math.imul(ie,kt),v=v+Math.imul(ve,st)|0,j=Math.imul(ve,kt);var at=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(at>>>26)|0,at&=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(ie,it)|0,v=v+Math.imul(ie,bt)|0,v=v+Math.imul(ve,it)|0,j=j+Math.imul(ve,bt)|0;var Ht=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,g=Math.imul(Ue,st),v=Math.imul(Ue,kt),v=v+Math.imul(lt,st)|0,j=Math.imul(lt,kt),g=g+Math.imul(Ee,it)|0,v=v+Math.imul(Ee,bt)|0,v=v+Math.imul(Se,it)|0,j=j+Math.imul(Se,bt)|0,g=g+Math.imul(ie,Ye)|0,v=v+Math.imul(ie,gt)|0,v=v+Math.imul(ve,Ye)|0,j=j+Math.imul(ve,gt)|0;var Rt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Rt>>>26)|0,Rt&=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,bt)|0,v=v+Math.imul(lt,it)|0,j=j+Math.imul(lt,bt)|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(ie,ot)|0,v=v+Math.imul(ie,wt)|0,v=v+Math.imul(ve,ot)|0,j=j+Math.imul(ve,wt)|0;var Dt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,g=Math.imul(ge,st),v=Math.imul(ge,kt),v=v+Math.imul(Ae,st)|0,j=Math.imul(Ae,kt),g=g+Math.imul($e,it)|0,v=v+Math.imul($e,bt)|0,v=v+Math.imul(mt,it)|0,j=j+Math.imul(mt,bt)|0,g=g+Math.imul(Ue,Ye)|0,v=v+Math.imul(Ue,gt)|0,v=v+Math.imul(lt,Ye)|0,j=j+Math.imul(lt,gt)|0,g=g+Math.imul(Ee,ot)|0,v=v+Math.imul(Ee,wt)|0,v=v+Math.imul(Se,ot)|0,j=j+Math.imul(Se,wt)|0,g=g+Math.imul(ie,k)|0,v=v+Math.imul(ie,S)|0,v=v+Math.imul(ve,k)|0,j=j+Math.imul(ve,S)|0;var er=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(er>>>26)|0,er&=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,bt)|0,v=v+Math.imul(Ae,it)|0,j=j+Math.imul(Ae,bt)|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,wt)|0,v=v+Math.imul(lt,ot)|0,j=j+Math.imul(lt,wt)|0,g=g+Math.imul(Ee,k)|0,v=v+Math.imul(Ee,S)|0,v=v+Math.imul(Se,k)|0,j=j+Math.imul(Se,S)|0,g=g+Math.imul(ie,B)|0,v=v+Math.imul(ie,K)|0,v=v+Math.imul(ve,B)|0,j=j+Math.imul(ve,K)|0;var yr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(yr>>>26)|0,yr&=67108863,g=Math.imul(Fe,st),v=Math.imul(Fe,kt),v=v+Math.imul(ft,st)|0,j=Math.imul(ft,kt),g=g+Math.imul(De,it)|0,v=v+Math.imul(De,bt)|0,v=v+Math.imul(Oe,it)|0,j=j+Math.imul(Oe,bt)|0,g=g+Math.imul(ge,Ye)|0,v=v+Math.imul(ge,gt)|0,v=v+Math.imul(Ae,Ye)|0,j=j+Math.imul(Ae,gt)|0,g=g+Math.imul($e,ot)|0,v=v+Math.imul($e,wt)|0,v=v+Math.imul(mt,ot)|0,j=j+Math.imul(mt,wt)|0,g=g+Math.imul(Ue,k)|0,v=v+Math.imul(Ue,S)|0,v=v+Math.imul(lt,k)|0,j=j+Math.imul(lt,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(ie,te)|0,v=v+Math.imul(ie,Be)|0,v=v+Math.imul(ve,te)|0,j=j+Math.imul(ve,Be)|0;var ir=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(Ge,st),v=Math.imul(Ge,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,bt)|0,v=v+Math.imul(ft,it)|0,j=j+Math.imul(ft,bt)|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,wt)|0,v=v+Math.imul(Ae,ot)|0,j=j+Math.imul(Ae,wt)|0,g=g+Math.imul($e,k)|0,v=v+Math.imul($e,S)|0,v=v+Math.imul(mt,k)|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(lt,B)|0,j=j+Math.imul(lt,K)|0,g=g+Math.imul(Ee,te)|0,v=v+Math.imul(Ee,Be)|0,v=v+Math.imul(Se,te)|0,j=j+Math.imul(Se,Be)|0,g=g+Math.imul(ie,Ne)|0,v=v+Math.imul(ie,z)|0,v=v+Math.imul(ve,Ne)|0,j=j+Math.imul(ve,z)|0;var Kt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(Ze,st),v=Math.imul(Ze,kt),v=v+Math.imul(Tt,st)|0,j=Math.imul(Tt,kt),g=g+Math.imul(Ge,it)|0,v=v+Math.imul(Ge,bt)|0,v=v+Math.imul(jt,it)|0,j=j+Math.imul(jt,bt)|0,g=g+Math.imul(Fe,Ye)|0,v=v+Math.imul(Fe,gt)|0,v=v+Math.imul(ft,Ye)|0,j=j+Math.imul(ft,gt)|0,g=g+Math.imul(De,ot)|0,v=v+Math.imul(De,wt)|0,v=v+Math.imul(Oe,ot)|0,j=j+Math.imul(Oe,wt)|0,g=g+Math.imul(ge,k)|0,v=v+Math.imul(ge,S)|0,v=v+Math.imul(Ae,k)|0,j=j+Math.imul(Ae,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,te)|0,v=v+Math.imul(Ue,Be)|0,v=v+Math.imul(lt,te)|0,j=j+Math.imul(lt,Be)|0,g=g+Math.imul(Ee,Ne)|0,v=v+Math.imul(Ee,z)|0,v=v+Math.imul(Se,Ne)|0,j=j+Math.imul(Se,z)|0,g=g+Math.imul(ie,he)|0,v=v+Math.imul(ie,ke)|0,v=v+Math.imul(ve,he)|0,j=j+Math.imul(ve,ke)|0;var gr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(gr>>>26)|0,gr&=67108863,g=Math.imul(nt,st),v=Math.imul(nt,kt),v=v+Math.imul(St,st)|0,j=Math.imul(St,kt),g=g+Math.imul(Ze,it)|0,v=v+Math.imul(Ze,bt)|0,v=v+Math.imul(Tt,it)|0,j=j+Math.imul(Tt,bt)|0,g=g+Math.imul(Ge,Ye)|0,v=v+Math.imul(Ge,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,wt)|0,v=v+Math.imul(ft,ot)|0,j=j+Math.imul(ft,wt)|0,g=g+Math.imul(De,k)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(Oe,k)|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(Ae,B)|0,j=j+Math.imul(Ae,K)|0,g=g+Math.imul($e,te)|0,v=v+Math.imul($e,Be)|0,v=v+Math.imul(mt,te)|0,j=j+Math.imul(mt,Be)|0,g=g+Math.imul(Ue,Ne)|0,v=v+Math.imul(Ue,z)|0,v=v+Math.imul(lt,Ne)|0,j=j+Math.imul(lt,z)|0,g=g+Math.imul(Ee,he)|0,v=v+Math.imul(Ee,ke)|0,v=v+Math.imul(Se,he)|0,j=j+Math.imul(Se,ke)|0,g=g+Math.imul(ie,Re)|0,v=v+Math.imul(ie,ze)|0,v=v+Math.imul(ve,Re)|0,j=j+Math.imul(ve,ze)|0;var pn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(pn>>>26)|0,pn&=67108863,g=Math.imul(nt,it),v=Math.imul(nt,bt),v=v+Math.imul(St,it)|0,j=Math.imul(St,bt),g=g+Math.imul(Ze,Ye)|0,v=v+Math.imul(Ze,gt)|0,v=v+Math.imul(Tt,Ye)|0,j=j+Math.imul(Tt,gt)|0,g=g+Math.imul(Ge,ot)|0,v=v+Math.imul(Ge,wt)|0,v=v+Math.imul(jt,ot)|0,j=j+Math.imul(jt,wt)|0,g=g+Math.imul(Fe,k)|0,v=v+Math.imul(Fe,S)|0,v=v+Math.imul(ft,k)|0,j=j+Math.imul(ft,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,te)|0,v=v+Math.imul(ge,Be)|0,v=v+Math.imul(Ae,te)|0,j=j+Math.imul(Ae,Be)|0,g=g+Math.imul($e,Ne)|0,v=v+Math.imul($e,z)|0,v=v+Math.imul(mt,Ne)|0,j=j+Math.imul(mt,z)|0,g=g+Math.imul(Ue,he)|0,v=v+Math.imul(Ue,ke)|0,v=v+Math.imul(lt,he)|0,j=j+Math.imul(lt,ke)|0,g=g+Math.imul(Ee,Re)|0,v=v+Math.imul(Ee,ze)|0,v=v+Math.imul(Se,Re)|0,j=j+Math.imul(Se,ze)|0;var Dr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,g=Math.imul(nt,Ye),v=Math.imul(nt,gt),v=v+Math.imul(St,Ye)|0,j=Math.imul(St,gt),g=g+Math.imul(Ze,ot)|0,v=v+Math.imul(Ze,wt)|0,v=v+Math.imul(Tt,ot)|0,j=j+Math.imul(Tt,wt)|0,g=g+Math.imul(Ge,k)|0,v=v+Math.imul(Ge,S)|0,v=v+Math.imul(jt,k)|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(ft,B)|0,j=j+Math.imul(ft,K)|0,g=g+Math.imul(De,te)|0,v=v+Math.imul(De,Be)|0,v=v+Math.imul(Oe,te)|0,j=j+Math.imul(Oe,Be)|0,g=g+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,z)|0,v=v+Math.imul(Ae,Ne)|0,j=j+Math.imul(Ae,z)|0,g=g+Math.imul($e,he)|0,v=v+Math.imul($e,ke)|0,v=v+Math.imul(mt,he)|0,j=j+Math.imul(mt,ke)|0,g=g+Math.imul(Ue,Re)|0,v=v+Math.imul(Ue,ze)|0,v=v+Math.imul(lt,Re)|0,j=j+Math.imul(lt,ze)|0;var mn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(mn>>>26)|0,mn&=67108863,g=Math.imul(nt,ot),v=Math.imul(nt,wt),v=v+Math.imul(St,ot)|0,j=Math.imul(St,wt),g=g+Math.imul(Ze,k)|0,v=v+Math.imul(Ze,S)|0,v=v+Math.imul(Tt,k)|0,j=j+Math.imul(Tt,S)|0,g=g+Math.imul(Ge,B)|0,v=v+Math.imul(Ge,K)|0,v=v+Math.imul(jt,B)|0,j=j+Math.imul(jt,K)|0,g=g+Math.imul(Fe,te)|0,v=v+Math.imul(Fe,Be)|0,v=v+Math.imul(ft,te)|0,j=j+Math.imul(ft,Be)|0,g=g+Math.imul(De,Ne)|0,v=v+Math.imul(De,z)|0,v=v+Math.imul(Oe,Ne)|0,j=j+Math.imul(Oe,z)|0,g=g+Math.imul(ge,he)|0,v=v+Math.imul(ge,ke)|0,v=v+Math.imul(Ae,he)|0,j=j+Math.imul(Ae,ke)|0,g=g+Math.imul($e,Re)|0,v=v+Math.imul($e,ze)|0,v=v+Math.imul(mt,Re)|0,j=j+Math.imul(mt,ze)|0;var ui=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ui>>>26)|0,ui&=67108863,g=Math.imul(nt,k),v=Math.imul(nt,S),v=v+Math.imul(St,k)|0,j=Math.imul(St,S),g=g+Math.imul(Ze,B)|0,v=v+Math.imul(Ze,K)|0,v=v+Math.imul(Tt,B)|0,j=j+Math.imul(Tt,K)|0,g=g+Math.imul(Ge,te)|0,v=v+Math.imul(Ge,Be)|0,v=v+Math.imul(jt,te)|0,j=j+Math.imul(jt,Be)|0,g=g+Math.imul(Fe,Ne)|0,v=v+Math.imul(Fe,z)|0,v=v+Math.imul(ft,Ne)|0,j=j+Math.imul(ft,z)|0,g=g+Math.imul(De,he)|0,v=v+Math.imul(De,ke)|0,v=v+Math.imul(Oe,he)|0,j=j+Math.imul(Oe,ke)|0,g=g+Math.imul(ge,Re)|0,v=v+Math.imul(ge,ze)|0,v=v+Math.imul(Ae,Re)|0,j=j+Math.imul(Ae,ze)|0;var li=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(li>>>26)|0,li&=67108863,g=Math.imul(nt,B),v=Math.imul(nt,K),v=v+Math.imul(St,B)|0,j=Math.imul(St,K),g=g+Math.imul(Ze,te)|0,v=v+Math.imul(Ze,Be)|0,v=v+Math.imul(Tt,te)|0,j=j+Math.imul(Tt,Be)|0,g=g+Math.imul(Ge,Ne)|0,v=v+Math.imul(Ge,z)|0,v=v+Math.imul(jt,Ne)|0,j=j+Math.imul(jt,z)|0,g=g+Math.imul(Fe,he)|0,v=v+Math.imul(Fe,ke)|0,v=v+Math.imul(ft,he)|0,j=j+Math.imul(ft,ke)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,ze)|0,v=v+Math.imul(Oe,Re)|0,j=j+Math.imul(Oe,ze)|0;var gn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(gn>>>26)|0,gn&=67108863,g=Math.imul(nt,te),v=Math.imul(nt,Be),v=v+Math.imul(St,te)|0,j=Math.imul(St,Be),g=g+Math.imul(Ze,Ne)|0,v=v+Math.imul(Ze,z)|0,v=v+Math.imul(Tt,Ne)|0,j=j+Math.imul(Tt,z)|0,g=g+Math.imul(Ge,he)|0,v=v+Math.imul(Ge,ke)|0,v=v+Math.imul(jt,he)|0,j=j+Math.imul(jt,ke)|0,g=g+Math.imul(Fe,Re)|0,v=v+Math.imul(Fe,ze)|0,v=v+Math.imul(ft,Re)|0,j=j+Math.imul(ft,ze)|0;var fi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(fi>>>26)|0,fi&=67108863,g=Math.imul(nt,Ne),v=Math.imul(nt,z),v=v+Math.imul(St,Ne)|0,j=Math.imul(St,z),g=g+Math.imul(Ze,he)|0,v=v+Math.imul(Ze,ke)|0,v=v+Math.imul(Tt,he)|0,j=j+Math.imul(Tt,ke)|0,g=g+Math.imul(Ge,Re)|0,v=v+Math.imul(Ge,ze)|0,v=v+Math.imul(jt,Re)|0,j=j+Math.imul(jt,ze)|0;var di=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(di>>>26)|0,di&=67108863,g=Math.imul(nt,he),v=Math.imul(nt,ke),v=v+Math.imul(St,he)|0,j=Math.imul(St,ke),g=g+Math.imul(Ze,Re)|0,v=v+Math.imul(Ze,ze)|0,v=v+Math.imul(Tt,Re)|0,j=j+Math.imul(Tt,ze)|0;var D=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(D>>>26)|0,D&=67108863,g=Math.imul(nt,Re),v=Math.imul(nt,ze),v=v+Math.imul(St,Re)|0,j=Math.imul(St,ze);var H=(C+g|0)+((v&8191)<<13)|0;return C=(j+(v>>>13)|0)+(H>>>26)|0,H&=67108863,O[0]=at,O[1]=Ht,O[2]=Rt,O[3]=Dt,O[4]=er,O[5]=yr,O[6]=ir,O[7]=Kt,O[8]=gr,O[9]=pn,O[10]=Dr,O[11]=mn,O[12]=ui,O[13]=li,O[14]=gn,O[15]=fi,O[16]=di,O[17]=D,O[18]=H,C!==0&&(O[19]=C,x.length++),x};Math.imul||(N=R);function F(p,d,m){m.negative=d.negative^p.negative,m.length=p.length+d.length;for(var x=0,M=0,E=0;E<m.length-1;E++){var O=M;M=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,ie=d.words[v]|0,ve=ee*ie,pe=ve&67108863;O=O+(ve/67108864|0)|0,pe=pe+C|0,C=pe&67108863,O=O+(pe>>>26)|0,M+=O>>>26,O&=67108863}m.words[E]=C,x=O,O=M}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,M=this.length+d.length;return this.length===10&&d.length===10?x=N(this,d,m):M<63?x=R(this,d,m):M<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,M=0;M<this.length;M++){var E=(this.words[M]|0)*d,O=(E&67108863)+(x&67108863);x>>=26,x+=E/67108864|0,x+=O>>>26,this.words[M]=O&67108863}return x!==0&&(this.words[M]=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,M=0;M<m.length&&m[M]===0;M++,x=x.sqr());if(++M<m.length)for(var E=x.sqr();M<m.length;M++,E=E.sqr())m[M]!==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,M=67108863>>>26-m<<26-m,E;if(m!==0){var O=0;for(E=0;E<this.length;E++){var C=this.words[E]&M,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 M;m?M=(m-m%26)/26:M=0;var E=d%26,O=Math.min((d-E)/26,this.length),C=67108863^67108863>>>E<<E,g=x;if(M-=O,M=Math.max(0,M),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>=M);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,M=1<<m;if(this.length<=x)return!1;var E=this.words[x];return!!(E&M)},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 M=67108863^67108863>>>m<<m;this.words[this.length-1]&=M}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 M=d.length+x,E;this._expand(M);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,M=this.clone(),E=d,O=E.words[E.length-1]|0,C=this._countBits(O);x=26-C,x!==0&&(E=E.ushln(x),M.iushln(x),O=E.words[E.length-1]|0);var g=M.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=M.clone()._ishlnsubmul(E,1,g);ee.negative===0&&(M=ee,v&&(v.words[g]=1));for(var ie=g-1;ie>=0;ie--){var ve=(M.words[E.length+ie]|0)*67108864+(M.words[E.length+ie-1]|0);for(ve=Math.min(ve/O|0,67108863),M._ishlnsubmul(E,ve,ie);M.negative!==0;)ve--,M.negative=0,M._ishlnsubmul(E,1,ie),M.isZero()||(M.negative^=1);v&&(v.words[ie]=ve)}return v&&v._strip(),M._strip(),m!=="div"&&x!==0&&M.iushrn(x),{div:v||null,mod:M}},o.prototype.divmod=function(d,m,x){if(i(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var M,E,O;return this.negative!==0&&d.negative===0?(O=this.neg().divmod(d,m),m!=="mod"&&(M=O.div.neg()),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.iadd(d)),{div:M,mod:E}):this.negative===0&&d.negative!==0?(O=this.divmod(d.neg(),m),m!=="mod"&&(M=O.div.neg()),{div:M,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,M=d.ushrn(1),E=d.andln(1),O=x.cmp(M);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,M=0,E=this.length-1;E>=0;E--)M=(x*M+(this.words[E]|0))%d;return m?-M:M},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,M=this.length-1;M>=0;M--){var E=(this.words[M]|0)+x*67108864;this.words[M]=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 M=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,ie=1;!(m.words[0]&ie)&&ee<26;++ee,ie<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(M.isOdd()||E.isOdd())&&(M.iadd(v),E.isub(j)),M.iushrn(1),E.iushrn(1);for(var ve=0,pe=1;!(x.words[0]&pe)&&ve<26;++ve,pe<<=1);if(ve>0)for(x.iushrn(ve);ve-- >0;)(O.isOdd()||C.isOdd())&&(O.iadd(v),C.isub(j)),O.iushrn(1),C.iushrn(1);m.cmp(x)>=0?(m.isub(x),M.isub(O),E.isub(C)):(x.isub(m),O.isub(M),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 M=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;)M.isOdd()&&M.iadd(O),M.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),M.isub(E)):(x.isub(m),E.isub(M))}var ee;return m.cmpn(1)===0?ee=M: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 M=0;m.isEven()&&x.isEven();M++)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(M)},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,M=1<<m;if(this.length<=x)return this._expand(x+1),this.words[x]|=M,this;for(var E=M,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 M=this.words[0]|0;x=M===d?0:M<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 M=this.words[x]|0,E=d.words[x]|0;if(M!==E){M<E?m=-1:M>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 V(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 M=x<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(d,m){d.iushrn(this.n,0,m)},q.prototype.imulK=function(d){return d.imul(this.k)};function J(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(J,q),J.prototype.split=function(d,m){for(var x=4194303,M=Math.min(d.length,9),E=0;E<M;E++)m.words[E]=d.words[E];if(m.length=M,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},J.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 M=d.words[x]|0;m+=M*977,d.words[x]=m&67108863,m=M*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function ne(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(ne,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 M=(d.words[x]|0)*19+m,E=M&67108863;M>>>=26,d.words[x]=E,m=M}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 J;else if(d==="p224")m=new ne;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 V(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}V.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},V.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")},V.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(f(d,d.umod(this.m)._forceRed(this)),d)},V.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},V.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)},V.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},V.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)},V.prototype.isub=function(d,m){this._verify2(d,m);var x=d.isub(m);return x.cmpn(0)<0&&x.iadd(this.m),x},V.prototype.shl=function(d,m){return this._verify1(d),this.imod(d.ushln(m))},V.prototype.imul=function(d,m){return this._verify2(d,m),this.imod(d.imul(m))},V.prototype.mul=function(d,m){return this._verify2(d,m),this.imod(d.mul(m))},V.prototype.isqr=function(d){return this.imul(d,d.clone())},V.prototype.sqr=function(d){return this.mul(d,d)},V.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 M=this.m.subn(1),E=0;!M.isZero()&&M.andln(1)===0;)E++,M.iushrn(1);i(!M.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,M),ee=this.pow(d,M.addn(1).iushrn(1)),ie=this.pow(d,M),ve=E;ie.cmp(O)!==0;){for(var pe=ie,Ee=0;pe.cmp(O)!==0;Ee++)pe=pe.redSqr();i(Ee<ve);var Se=this.pow(j,new o(1).iushln(ve-Ee-1));ee=ee.redMul(Se),j=Se.redSqr(),ie=ie.redMul(j),ve=Ee}return ee},V.prototype.invm=function(d){var m=d._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},V.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,M=new Array(1<<x);M[0]=new o(1).toRed(this),M[1]=d;for(var E=2;E<M.length;E++)M[E]=this.mul(M[E-1],d);var O=M[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 ie=j>>ee&1;if(O!==M[0]&&(O=this.sqr(O)),ie===0&&C===0){g=0;continue}C<<=1,C|=ie,g++,!(g!==x&&(E!==0||ee!==0))&&(O=this.mul(O,M[C]),g=0,C=0)}v=26}return O},V.prototype.convertTo=function(d){var m=d.umod(this.m);return m===d?m.clone():m},V.prototype.convertFrom=function(d){var m=d.clone();return m.red=null,m},o.mont=function(d){return new $(d)};function $(p){V.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($,V),$.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},$.prototype.convertFrom=function(d){var m=this.imod(d.mul(this.rinv));return m.red=null,m},$.prototype.imul=function(d,m){if(d.isZero()||m.isZero())return d.words[0]=0,d.length=1,d;var x=d.imul(m),M=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(M).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)},$.prototype.mul=function(d,m){if(d.isZero()||m.isZero())return new o(0)._forceRed(this);var x=d.mul(m),M=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(M).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)},$.prototype.invm=function(d){var m=this.imod(d._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),Co=9e15,ms=1e9,Xd="0123456789abcdef",Du="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",$u="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Yd={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Co,maxE:Co,crypto:!1},m4,Mi,ct=!0,Cl="[DecimalError] ",os=Cl+"Invalid argument: ",g4=Cl+"Precision limit exceeded",v4=Cl+"crypto unavailable",y4="[object Decimal]",Tr=Math.floor,hr=Math.pow,_9=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,x9=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,S9=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,b4=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,On=1e7,Qe=7,E9=9007199254740991,C9=Du.length-1,Zd=$u.length-1,be={toStringTag:y4};be.absoluteValue=be.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Je(e)};be.ceil=function(){return Je(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(os+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())+Qe,n.rounding=1,r=M9(n,E4(n,r)),n.precision=e,n.rounding=t,Je(Mi==2||Mi==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(ct=!1,s=l.s*hr(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=hr(r,1/3),e=Tr((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=Vt(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)};be.decimalPlaces=be.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Tr(this.e/Qe))*Qe,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};be.dividedBy=be.div=function(e){return Vt(this,new this.constructor(e))};be.dividedToIntegerBy=be.divToInt=function(e){var t=this,r=t.constructor;return Je(Vt(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 Je(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/Tl(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 Je(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/Tl(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,Je(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,Vt(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()?Cn(r,i,s):new r(0):new r(NaN):t.isZero()?Cn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Cn(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,ct=!1,r=r.times(r).minus(1).sqrt().plus(r),ct=!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,ct=!1,r=r.times(r).plus(1).sqrt().plus(r),ct=!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?Je(new s(i),e,t,!0):(s.precision=r=n-i.e,i=Vt(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=Cn(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<=Zd)return o=Cn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=Zd)return o=Cn(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)};be.isFinite=function(){return!!this.d};be.isInteger=be.isInt=function(){return!!this.d&&Tr(this.e/Qe)>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(ct=!1,a=f+y,o=Zi(u,a),n=t?Bu(l,a+10):Zi(e,a),c=Vt(o,n,a,1),Qa(c.d,i=f,h))do if(a+=10,o=Zi(u,a),n=t?Bu(l,a+10):Zi(e,a),c=Vt(o,n,a,1),!s){+_r(c.d).slice(i+1,i+15)+1==1e14&&(c=Je(c,f+1,0));break}while(Qa(c.d,i+=10,h));return ct=!0,Je(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 ct?Je(e,a,c):e}if(r=Tr(e.e/Qe),l=Tr(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]=On-1;--u[i],u[n]+=On}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=Ml(u,r),ct?Je(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]?Je(new n(r),n.precision,n.rounding):(ct=!1,n.modulo==9?(t=Vt(r,e.abs(),0,3,1),t.s*=e.s):t=Vt(r,e,0,n.modulo,1),t=t.times(e),ct=!0,r.minus(t))};be.naturalExponential=be.exp=function(){return Qd(this)};be.naturalLogarithm=be.ln=function(){return Zi(this)};be.negated=be.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Je(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)),ct?Je(e,a,c):e;if(s=Tr(f.e/Qe),n=Tr(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)/On|0,u[i]%=On;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Ml(u,n),ct?Je(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(os+e);return r.d?(t=w4(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};be.round=function(){var e=this,t=e.constructor;return Je(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())+Qe,n.rounding=1,r=A9(n,E4(n,r)),n.precision=e,n.rounding=t,Je(Mi>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(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=Tr((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(Vt(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)};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=Vt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Je(Mi==2||Mi==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=Tr(l.e/Qe)+Tr(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%On|0,t=a/On|0;s[i]=(s[i]+t)%On|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Ml(s,r),ct?Je(e,f.precision,f.rounding):e};be.toBinary=function(e,t){return r0(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:(Fr(e,0,ms),t===void 0?t=n.rounding:Fr(t,0,8),Je(r,e+r.e+1,t))};be.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ei(n,!0):(Fr(e,0,ms),t===void 0?t=i.rounding:Fr(t,0,8),n=Je(new i(n),e+1,t),r=ei(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=ei(i):(Fr(e,0,ms),t===void 0?t=s.rounding:Fr(t,0,8),n=Je(new s(i),e+i.e+1,t),r=ei(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=w4(b)-y.e-1,o=s%Qe,t.d[0]=hr(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(os+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=Vt(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=Vt(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=Vt(u,n,s,1).minus(y).abs().cmp(Vt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,ct=!0,h};be.toHexadecimal=be.toHex=function(e,t){return r0(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:Fr(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=Vt(r,e,0,t,1).times(e),ct=!0,Je(r)):(e.s=r.s,r=e),r};be.toNumber=function(){return+this};be.toOctal=function(e,t){return r0(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(hr(+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=Tr(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=E9)return i=_4(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=hr(+a,u),t=r==0||!isFinite(r)?Tr(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=Qd(e.times(Zi(a,n+r)),n),i.d&&(i=Je(i,n+5,1),Qa(i.d,n,s)&&(t=n+10,i=Je(Qd(e.times(Zi(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))};be.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ei(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Fr(e,1,ms),t===void 0?t=i.rounding:Fr(t,0,8),n=Je(new i(n),e,t),r=ei(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):(Fr(e,1,ms),t===void 0?t=n.rounding:Fr(t,0,8)),Je(new n(r),e,t)};be.toString=function(){var e=this,t=e.constructor,r=ei(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};be.truncated=be.trunc=function(){return Je(new this.constructor(this),this.e+1,1)};be.valueOf=be.toJSON=function(){var e=this,t=e.constructor,r=ei(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+=Ji(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=Ji(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Fr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(os+e)}function Qa(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=hr(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)==hr(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)==hr(10,t-3)-1,o}function cu(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]+=Xd.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 M9(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=$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 Vt=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,A,P,R,N,F,L,G,q,J,ne,ae,ce,V,$=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new $(!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=On,y=Qe,l=Tr(n.e/y)-Tr(i.e/y)),ce=m.length,ne=d.length,P=new $(p),R=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=$.precision,o=$.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)R.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ne||h)&&G--;f++)q=h*c+(d[f]||0),R[f]=q/m|0,h=q%m|0;b=h||f<ne}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ne=d.length),J=ce,N=d.slice(0,ce),F=N.length;F<ce;)N[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,N,ce,F),u<0?(L=N[0],ce!=F&&(L=L*c+(N[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,F=N.length,u=t(w,N,A,F),u==1&&(h--,r(w,ce<A?V:m,A,c))):(h==0&&(u=h=1),w=m.slice()),A=w.length,A<F&&w.unshift(0),r(N,w,F,c),u==-1&&(F=N.length,u=t(m,N,ce,F),u<1&&(h++,r(N,ce<F?V:m,F,c))),F=N.length):u===0&&(h++,N=[0]),R[f++]=h,u&&N[0]?N[F++]=d[J]||0:(N=[d[J]],F=1);while((J++<ne||N[0]!==void 0)&&G--);b=N[0]!==void 0}R[0]||R.shift()}if(y==1)P.e=l,m4=b;else{for(f=1,h=R[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/hr(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/hr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%hr(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/hr(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]=hr(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=hr(10,Qe-s),f[h]=o>0?(l/hr(10,i-o)%hr(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]==On&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=On)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 ei(e,t,r){if(!e.isFinite())return S4(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)+Ji(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Ji(-i-1)+s,r&&(n=r-o)>0&&(s+=Ji(n))):i>=o?(s+=Ji(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+Ji(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=Ji(n))),s}function Ml(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function Bu(e,t,r){if(t>C9)throw ct=!0,r&&(e.precision=r),Error(g4);return Je(new e(Du),t,1,!0)}function Cn(e,t,r){if(t>Zd)throw Error(g4);return Je(new e($u),t,r,!0)}function w4(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 Ji(e){for(var t="";e--;)t+="0";return t}function _4(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),hg(s.d,o)&&(i=!0)),r=Tr(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),hg(t.d,o)}return ct=!0,s}function dg(e){return e.d[e.d.length-1]&1}function x4(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 Qd(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(hr(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(Vt(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&&Qa(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 Zi(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,A=w.d,P=w.constructor,R=P.rounding,N=P.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(ct=!1,l=N):l=t,P.precision=l+=b,r=_r(A),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=Bu(P,l+2,N).times(s+""),w=Zi(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=N,t==null?Je(w,N,R,ct=!0):w;for(f=w,c=o=w=Vt(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(Vt(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(Bu(P,l+2,N).times(s+""))),c=Vt(c,new P(y),l,1),t==null)if(Qa(c.d,l-b,R,a))P.precision=l+=b,u=o=w=Vt(f.minus(1),f.plus(1),l,1),h=Je(w.times(w),l,1),i=a=1;else return Je(c,P.precision=N,R,ct=!0);else return P.precision=N,c;c=u,i+=2}}function S4(e){return String(e.s*e.s/0)}function eh(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 T9(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),b4.test(t))return eh(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(x9.test(t))r=16,t=t.toLowerCase();else if(_9.test(t))r=2;else if(S9.test(t))r=8;else throw Error(os+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=_4(n,new n(r),s,s*2)),u=cu(t,r,On),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Ml(u,l),e.d=u,ct=!1,o&&(e=Vt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?hr(2,c):wc.pow(2,c))),ct=!0,e)}function A9(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/Tl(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/Qe);for(ct=!1,c=r.times(r),a=new e(n);;){if(o=Vt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=Vt(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 E4(e,t){var r,n=t.s<0,i=Cn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Mi=n?4:1,t;if(r=t.divToInt(i),r.isZero())Mi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Mi=dg(r)?n?2:3:n?4:1,t;Mi=dg(r)?n?1:4:n?3:2}return t.minus(i).abs()}function r0(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(Fr(r,1,ms),n===void 0?n=y.rounding:Fr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=S4(e);else{for(l=ei(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=cu(ei(h),10,i),h.e=h.d.length),f=cu(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=Vt(e,h,r,n,0,i),f=e.d,s=e.e,u=m4),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+=Xd.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=cu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Xd.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 hg(e,t){if(e.length>t)return e.length=t,!0}function O9(e){return new this(e).abs()}function I9(e){return new this(e).acos()}function P9(e){return new this(e).acosh()}function j9(e,t){return new this(e).plus(t)}function k9(e){return new this(e).asin()}function R9(e){return new this(e).asinh()}function N9(e){return new this(e).atan()}function D9(e){return new this(e).atanh()}function $9(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=Cn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?Cn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=Cn(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(Vt(e,t,s,1)),t=Cn(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Vt(e,t,s,1)),r}function B9(e){return new this(e).cbrt()}function L9(e){return Je(e=new this(e),e.e+1,2)}function F9(e,t,r){return new this(e).clamp(t,r)}function U9(e){if(!e||typeof e!="object")throw Error(Cl+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,ms,"rounding",0,8,"toExpNeg",-Co,0,"toExpPos",0,Co,"maxE",0,Co,"minE",-Co,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=Yd[r]),(n=e[r])!==void 0)if(Tr(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(os+r+": "+n);if(r="crypto",i&&(this[r]=Yd[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(v4);else this[r]=!1;else throw Error(os+r+": "+n);return this}function z9(e){return new this(e).cos()}function V9(e){return new this(e).cosh()}function C4(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,pg(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 eh(u,s.toString())}else if(c!=="string")throw Error(os+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),b4.test(s)?eh(u,s):T9(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=U9,i.clone=C4,i.isDecimal=pg,i.abs=O9,i.acos=I9,i.acosh=P9,i.add=j9,i.asin=k9,i.asinh=R9,i.atan=N9,i.atanh=D9,i.atan2=$9,i.cbrt=B9,i.ceil=L9,i.clamp=F9,i.cos=z9,i.cosh=V9,i.div=q9,i.exp=W9,i.floor=G9,i.hypot=H9,i.ln=K9,i.log=J9,i.log10=Y9,i.log2=X9,i.max=Z9,i.min=Q9,i.mod=eR,i.mul=tR,i.pow=rR,i.random=nR,i.round=iR,i.sign=sR,i.sin=oR,i.sinh=aR,i.sqrt=cR,i.sub=uR,i.sum=lR,i.tan=fR,i.tanh=dR,i.trunc=hR,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 q9(e,t){return new this(e).div(t)}function W9(e){return new this(e).exp()}function G9(e){return Je(e=new this(e),e.e+1,3)}function H9(){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 pg(e){return e instanceof wc||e&&e.toStringTag===y4||!1}function K9(e){return new this(e).ln()}function J9(e,t){return new this(e).log(t)}function X9(e){return new this(e).log(2)}function Y9(e){return new this(e).log(10)}function Z9(){return x4(this,arguments,"lt")}function Q9(){return x4(this,arguments,"gt")}function eR(e,t){return new this(e).mod(t)}function tR(e,t){return new this(e).mul(t)}function rR(e,t){return new this(e).pow(t)}function nR(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Fr(e,1,ms),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(v4);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Qe,n&&e&&(i=hr(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 iR(e){return Je(e=new this(e),e.e+1,this.rounding)}function sR(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function oR(e){return new this(e).sin()}function aR(e){return new this(e).sinh()}function cR(e){return new this(e).sqrt()}function uR(e,t){return new this(e).sub(t)}function lR(){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 fR(e){return new this(e).tan()}function dR(e){return new this(e).tanh()}function hR(e){return Je(e=new this(e),e.e+1,1)}be[Symbol.for("nodejs.util.inspect.custom")]=be.toString;be[Symbol.toStringTag]="Decimal";var wc=be.constructor=C4(Yd);Du=new wc(Du);$u=new wc($u);var uu=wc,Qi=Yo(Zo()),Hf=Yo(Zo()),pR=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 Hf.default(e).mul(new Hf.default(this.slippage)).div(new Hf.default("1000000000000000000")).toString()}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,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 l=[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];return t.moveCall({target:`${e.publishedAt()}::aftermath::${a}`,typeArguments:[c,u,r.extendedDetails.aftermathLpSupplyType],arguments:l})})}},mg="0x000000000000000000000000000000000000000000000000000000000000dee9",mR=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return Et(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:mg,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 Et(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${mg}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=yield this.getOrCreateAccountCap(t,e.client,e.signer),f=[t.object(r.id),n,l.accountCap,t.object(ti)],h=t.moveCall({target:`${e.publishedAt()}::deepbook::${a}`,typeArguments:[c,u],arguments:f});return l.isCreate&&t.transferObjects([l.accountCap],e.signer),h})}},gR=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n];return t.moveCall({target:`${e.publishedAt()}::kriya_amm::${a}`,typeArguments:[c,u],arguments:l})})}},vR=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n,t.object(this.version),t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::kriya_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},yR=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.container),n];return t.moveCall({target:`${e.publishedAt()}::flowx_amm::${a}`,typeArguments:[c,u],arguments:l})})}},bR=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){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.poolRegistry),t.pure.u64(r.feeRate*1e6),n,t.object(this.versioned),t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::flowx_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},wR=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,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 l=[t.object(r.id),n,t.object(ti),t.object(this.versioned)];return t.moveCall({target:`${e.publishedAt()}::turbos::${a}`,typeArguments:[c,u,r.extendedDetails.turbosFeeType],arguments:l})})}},gg=class{constructor(e,t){this.globalConfig=e===0?"0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f":"0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e",this.partner=t??(e===0?"0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b":"0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5")}flash_swap(e,t,r,n){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["flash_swap_a2b",s,o]:["flash_swap_b2a",o,s];let l=n?r.amountIn:r.amountOut;const f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),t.pure.u64(l),t.pure.bool(n),t.object(ti)],h=t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:f});return{targetCoin:h[0],flashReceipt:h[1],payAmount:h[2]}}repay_flash_swap(e,t,r,n,i){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["repay_flash_swap_a2b",o,a]:["repay_flash_swap_b2a",a,o],f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,i];return t.moveCall({target:`${e.publishedAt()}::cetus::${c}`,typeArguments:[u,l],arguments:f})[0]}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:l})})}};function vg(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 _R(e){return e.split("::")[0]}function qs(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=qs(r),u=v9(g9({},c),{type_arguments:i.map(l=>qs(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>js.isSuiCoin(l)?l:qs(l).source_address),u.source_address=vg(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===M4||r===ER?"0x2":Jd.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=vg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function yg(e){return qs(e).source_address}var xR="0x2::coin::Coin",SR=/^0x2::coin::Coin<(.+)>$/,M4="0x2::sui::SUI",ER="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",js=class Gi{static getCoinTypeArg(t){const r=t.type.match(SR);return r?r[1]:null}static isSUI(t){const r=Gi.getCoinTypeArg(t);return r?Gi.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`${xR}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{yg(i.coinAddress)===yg(t)&&n.push(i)}),n}static isSuiCoin(t){return qs(t).full_address===M4}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=Gi.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=Gi.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=Gi.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:Gi.sortByBalance(a),remainingCoins:Gi.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 Kf(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 CR(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 T4(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function Jf(e,t,r,n){const i=js.getCoinAssets(n,t);if(r===BigInt(0)&&i.length===0)return{targetCoin:T4(e,n),isMintZeroCoin:!0,targetCoinAmount:0};if(js.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(js.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=js.sortByBalance(i);o.slice(0,3).reduce((f,h)=>f+h.balance,BigInt(0))<BigInt(r)&&(o=js.sortByBalanceDes(i));let c=js.selectCoinObjectIdGreaterThanOrEqual(o,r);const[u,...l]=c.objectArray;return l.length>0&&e.mergeCoins(u,l.map(f=>e.object(f))),{targetCoin:e.object(u),isMintZeroCoin:!1,targetCoinAmount:Number(r.toString())}}function MR(e,t=!0){return Et(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 TR(e){return!(!e.startsWith("0x")||e.length!==66)}var so=Yo(Zo()),es=Yo(Zo()),_c=Yo(Zo()),Si=new _c.default(0);new _c.default(1);var AR=new _c.default(2);AR.pow(new _c.default(128));var OR=new _c.default("18446744073709551615"),nn=1e9;function IR(e,t,r){let n=Si;return t?n=e.mul(new es.default(nn-r*nn)).div(new es.default(nn)):n=e.mul(new es.default(nn+r*nn)).div(new es.default(nn)),Number(n.toString())}function PR(e,t,r){let n=Si;return t?n=e.mul(new es.default(nn-r*nn)).div(new es.default(nn)):n=e.mul(new es.default(nn+r*nn)).div(new es.default(nn)),n}function jR(e,t,r){return new uu(e).mul(uu.pow(2,-64)).pow(2).mul(uu.pow(10,t-r))}function kR(e,t,r,n){return Et(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),A=new u9.Transaction,P=CR(b,w),R=n===0?"0x3a5aa90ffa33d09100d7b6941ea1c0ffe6ab66e77062ddd26320c1b073aabb10":"0x19dd42e05fa6c9988a60d30686ee3feb776672b5547e328d6dab16563da65293",N=P?b:w,F=P?w:b,L=[N,F];console.log("typeArguments",L,R);for(let C=0;C<y.length;C++){const g=[A.object(y[C]),A.pure.bool(P),A.pure.bool(h),A.pure.u64(f.toString())];A.moveCall({target:`${R}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:L})}if(!TR(r))throw new AggregateError("Aggregator package not set","InvalidWallet");MR(A);const G=yield e.devInspectTransactionBlock({transactionBlock:A,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 J=h?Si:OR,ne=0;for(let C=0;C<q.length;C+=1)if(!q[C].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new so.BN(q[C].parsedJson.data.amount_out);g.gt(J)&&(ne=C,J=g)}else{const g=new so.BN(q[C].parsedJson.data.amount_out);g.lt(J)&&(ne=C,J=g)}const ae=q[ne].parsedJson.data;console.log("event",JSON.stringify(ae,null,2));const ce=ae.step_results[0].current_sqrt_price,[V,$]=yield Promise.all([e.getCoinMetadata({coinType:N}).then(C=>C==null?void 0:C.decimals),e.getCoinMetadata({coinType:F}).then(C=>C==null?void 0:C.decimals)]);if(V==null||$==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const p=jR(ce,V,$),d=Number(ae.fee_rate)/1e6,m=new so.BN((s=ae.amount_in)!=null?s:0),x=new so.BN((o=ae.fee_amount)!=null?o:0),M=m.add(x),E={amountIn:M,amountOut:new so.BN((a=ae.amount_out)!=null?a:0),routes:[{path:[{id:y[ne],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:M,amountOut:new so.BN((c=ae.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1};return{isExceed:ae.is_exceed,routeData:E}})}var RR=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Haedal not support b2a swap");const s="swap_a2b",o=[t.object(r.id),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::haedal::${s}`,typeArguments:[],arguments:o})})}},NR=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){return Et(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Afsui not support b2a swap");const s="swap_a2b",o=[t.object(this.stakedSuiVault),t.object(this.safe),t.object("0x5"),t.object(this.referVault),t.object(this.validator),n];return t.moveCall({target:`${e.publishedAt()}::afsui::${s}`,typeArguments:[],arguments:o})})}},DR=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){return Et(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Volo not support b2a swap");const s="swap_a2b",o=[t.object(this.nativePool),t.object(this.metadata),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::volo::${s}`,typeArguments:[],arguments:o})})}},$R=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.dexInfo),n];return t.moveCall({target:`${e.publishedAt()}::bluemove::${a}`,typeArguments:[c,u],arguments:l})})}},BR=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i){return Et(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;i?f=i:f=T4(t,e.deepbookv3DeepFeeType());const h=[t.object(this.deepbookV3Config),t.object(r.id),n,f,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::deepbookv3::${c}`,typeArguments:[u,l],arguments:h})})}},LR=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){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",s,o];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 l=[t.object(this.version),t.object(this.market),t.object(r.extendedDetails.scallopScoinTreasury),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::scallop::${a}`,typeArguments:[c,u],arguments:l})})}},FR=class{constructor(e){if(e!==0)throw new Error("Suilend only supported on mainnet");this.liquid_staking_pool=e===0?"0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b":"0x0",this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c]=i?["swap_a2b",o]:["swap_b2a",s],u=[t.object(this.liquid_staking_pool),t.object(this.sui_system_state),n];return t.moveCall({target:`${e.publishedAtV2()}::suilend::${a}`,typeArguments:[c],arguments:u})})}},UR=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::bluefin::${a}`,typeArguments:[c,u],arguments:l})})}},zR=class{constructor(e,t){if(e===1){this.connection=new Dc.SuiPriceServiceConnection("https://hermes-beta.pyth.network");const r="0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",n="0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";this.pythClient=new Dc.SuiPythClient(t,n,r)}else{this.connection=new Dc.SuiPriceServiceConnection("https://hermes.pyth.network");const r="0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",n="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";this.pythClient=new Dc.SuiPythClient(t,n,r)}}swap(e,t,r,n){return Et(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];let l,f;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");l=r.extendedDetails.haedalPmmBasePriceSeed,f=r.extendedDetails.haedalPmmQuotePriceSeed;const h=[l,f],y=yield this.connection.getPriceFeedsUpdateData(h),b=yield this.pythClient.updatePriceFeeds(t,y,h),w=[t.object(r.id),t.object(b[0]),t.object(b[1]),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::haedalpmm::${a}`,typeArguments:[c,u],arguments:w})})}},A4="CETUS",VR="DEEPBOOK",qR="KRIYA",WR="FLOWX",GR="FLOWXV3",HR="KRIYAV3",O4="TURBOS",th="AFTERMATH",KR="HAEDAL",JR="VOLO",XR="AFSUI",YR="BLUEMOVE",I4="DEEPBOOKV3",P4="SCALLOP",ZR="SUILEND",QR="BLUEFIN",j4="HAEDALPMM",eN="https://api-sui.cetus.zone/router_v2",tN=class{constructor(e,t,r,n){this.endpoint=e?nN(e):eN,this.client=r||new ug.SuiClient({url:ug.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return Et(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:qs(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 Et(this,null,function*(){return iN(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s){return Et(this,null,function*(){if(r.length===0)throw new Error("No router found");const o=r.map(h=>h.amountIn.toString()),a=r[0].path[0].from,c=r[0].path[r[0].path.length-1].target,u=e.splitCoins(t,o),l=[];for(let h=0;h<r.length;h++){if(r[h].path.length===0)throw new Error("Empty path");let y=u[h];for(const b of r[h].path)y=yield this.newDex(b.provider,i).swap(this,e,b,y,s);l.push(y)}return this.transferOrDestoryCoin(e,t,a),this.checkCoinThresholdAndMergeCoin(e,l,c,n)})}expectOutputSwap(e,t,r,n){return Et(this,null,function*(){const i=[],s=[],o=[],a=new gg(this.env,n);for(let u=0;u<r.length;u++){const l=r[u];for(let h=l.path.length-1;h>=0;h--){const y=l.path[h],b=a.flash_swap(this,e,y,!1);i.unshift(b.targetCoin),s.unshift(b.flashReceipt)}let f=t;for(let h=0;h<l.path.length;h++){const y=l.path[h],b=a.repay_flash_swap(this,e,y,f,s[h]);f=i[h],h===0?t=b:this.transferOrDestoryCoin(e,b,y.from),h===l.path.length-1&&o.push(f)}}const c=r[0].path[0].from;if(this.transferOrDestoryCoin(e,t,c),o.length>1){const u=e.makeMoveVec({elements:o.slice(1)});e.moveCall({target:`${Jd.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r[0].path[r[0].path.length-1].target],arguments:[o[0],u]})}return o[0]})}swapInPools(e){return Et(this,null,function*(){let t;try{t=yield kR(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return Et(this,null,function*(){const{routers:t,inputCoin:r,slippage:n,byAmountIn:i,txb:s,partner:o,deepbookv3DeepFee:a}=e,c=t.reduce((y,b)=>y.add(b.amountIn),new Qi.default(0)),u=t.reduce((y,b)=>y.add(b.amountOut),new Qi.default(0)),l=PR(i?u:c,i,n);if(i)return yield this.expectInputSwap(s,r,t,l,o,a);const f=s.splitCoins(r,[l.toString()]);return this.transferOrDestoryCoin(s,r,t[0].path[0].from),yield this.expectOutputSwap(s,f[0],t,o)})}fastRouterSwap(e){return Et(this,null,function*(){const{routers:t,byAmountIn:r,slippage:n,txb:i,partner:s,isMergeTragetCoin:o,refreshAllCoins:a,payDeepFeeAmount:c}=e,u=t[0].path[0].from;let l=yield this.getCoins(u,a);const f=t[0].path[t[0].path.length-1].target,h=t.reduce((N,F)=>N.add(F.amountIn),new Qi.default(0)),y=t.reduce((N,F)=>N.add(F.amountOut),new Qi.default(0)),b=IR(r?y:h,r,n),A=Jf(i,l,BigInt((r?h:b).toString()),u);let P;if(c&&c>0){let N=yield this.getCoins(this.deepbookv3DeepFeeType());P=Jf(i,N,BigInt(c),this.deepbookv3DeepFeeType()).targetCoin}const R=yield this.routerSwap({routers:t,inputCoin:A.targetCoin,slippage:n,byAmountIn:r,txb:i,partner:s,deepbookv3DeepFee:P});if(o){let N=yield this.getCoins(f,a);const F=Jf(i,N,BigInt(0),f);i.mergeCoins(F.targetCoin,[R]),F.isMintZeroCoin&&this.transferOrDestoryCoin(i,F.targetCoin,f)}else this.transferOrDestoryCoin(i,R,f)})}publishedAt(){return this.env===0?"0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2(){return this.env===0?"0x347dd58bbd11cd82c8b386b344729717c04a998da73386e82a239cc196d5706b":"0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"}deepbookv3DeepFeeType(){return this.env===0?"0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":"0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"}transferOrDestoryCoin(e,t,r){e.moveCall({target:`${this.publishedAt()}::utils::transfer_or_destroy_coin`,typeArguments:[r],arguments:[t]})}checkCoinThresholdAndMergeCoin(e,t,r,n){let i=t[0];if(t.length>1){let s=e.makeMoveVec({elements:t.slice(1)});e.moveCall({target:`${Jd.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r],arguments:[t[0],s]}),i=t[0]}return e.moveCall({target:`${this.publishedAt()}::utils::check_coin_threshold`,typeArguments:[r],arguments:[i,e.pure.u64(n.toString())]}),i}newDex(e,t){switch(e){case A4:return new gg(this.env,t);case VR:return new mR(this.env);case I4:return new BR(this.env);case qR:return new gR(this.env);case HR:return new vR(this.env);case WR:return new yR(this.env);case GR:return new bR(this.env);case O4:return new wR(this.env);case th:return new pR(this.env);case KR:return new RR(this.env);case XR:return new NR(this.env);case JR:return new DR(this.env);case YR:return new $R(this.env);case P4:return new LR(this.env);case ZR:return new FR(this.env);case QR:return new UR(this.env);case j4:return new zR(this.env,this.client);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return Et(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return Et(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return Et(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return Et(this,null,function*(){const e=yield aN(this.endpoint);return e?e.data:null})}};function rN(e){let t=0;for(const n of e.routes)for(const i of n.path)i.extended_details&&i.extended_details.deepbookv3_deep_fee&&(t+=Number(i.extended_details.deepbookv3_deep_fee));return{amountIn:new Qi.default(e.amount_in.toString()),amountOut:new Qi.default(e.amount_out.toString()),insufficientLiquidity:!1,routes:e.routes.map(n=>({path:n.path.map(i=>{var s,o,a,c,u,l,f;let h;i.provider===th&&(h=i.extended_details.aftermath_pool_flatness===0?"v2":"v3");let y;return(i.provider===O4||i.provider===th||i.provider===A4||i.provider===I4||i.provider===P4||i.provider===j4)&&(y={aftermathLpSupplyType:(s=i.extended_details)==null?void 0:s.aftermath_lp_supply_type,turbosFeeType:(o=i.extended_details)==null?void 0:o.turbos_fee_type,afterSqrtPrice:(a=i.extended_details)==null?void 0:a.after_sqrt_price,deepbookv3DeepFee:(c=i.extended_details)==null?void 0:c.deepbookv3_deep_fee,scallopScoinTreasury:(u=i.extended_details)==null?void 0:u.scallop_scoin_treasury,haedalPmmBasePriceSeed:(l=i.extended_details)==null?void 0:l.haedal_pmm_base_price_seed,haedalPmmQuotePriceSeed:(f=i.extended_details)==null?void 0:f.haedal_pmm_quote_price_seed}),{id:i.id,direction:i.direction,provider:i.provider,from:i.from,target:i.target,feeRate:i.fee_rate,amountIn:i.amount_in,amountOut:i.amount_out,extendedDetails:y,version:h}}),amountIn:new Qi.default(n.amount_in.toString()),amountOut:new Qi.default(n.amount_out.toString()),initialPrice:new uu(n.initial_price.toString())})),totalDeepFee:t}}var ti="0x0000000000000000000000000000000000000000000000000000000000000006";Yo(Zo());function nN(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function iN(e,t){return Et(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield oN(e,t):r=yield sN(e,t),!r)return null;if(!r.ok)return{amountIn:Si,amountOut:Si,routes:[],insufficientLiquidity:!1,error:{code:10001,msg:Kf(10001)}};const n=yield r.json(),i=n.msg==="liquidity is not enough";return n.msg&&n.msg.indexOf("HoneyPot scam")>-1?{amountIn:Si,amountOut:Si,routes:[],insufficientLiquidity:i,error:{code:10004,msg:Kf(10004)}}:n.data!=null?rN(n.data):{amountIn:Si,amountOut:Si,routes:[],insufficientLiquidity:i,error:{code:10003,msg:Kf(10003)}}})}function sN(e,t){return Et(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=1000316",yield fetch(y)}catch(r){return console.error(r),null}})}function oN(e,t){return Et(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(","),A={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(A)})}catch(P){return console.error("Error:",P),null}})}function aN(e){return Et(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var k4=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(k4||{}),R4=tN,cN=k4,bg=_R,za=qs;const N4="0x2::sui::SUI",uN="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function D4(e){return Mr(e).full_address===N4}function wg(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 Mr(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={...Mr(r),type_arguments:i.map(l=>Mr(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>D4(l)?l:Mr(l).source_address),u.source_address=wg(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===N4||r===uN?"0x2":Ci(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=wg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function lN(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const ec=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=Ci(n);return t&&(i=lN(i)),`${i}::${r.join("::")}`};/*!
|
|
39
39
|
* decimal.js v10.4.3
|
|
40
40
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
41
41
|
* https://github.com/MikeMcl/decimal.js
|
|
42
42
|
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
43
43
|
* MIT Licence
|
|
44
|
-
*/var Mo=9e15,gs=1e9,Qd="0123456789abcdef",Bu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Lu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",eh={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Mo,maxE:Mo,crypto:!1},R4,Ti,ut=!0,Tl="[DecimalError] ",cs=Tl+"Invalid argument: ",N4=Tl+"Precision limit exceeded",D4=Tl+"crypto unavailable",$4="[object Decimal]",Ar=Math.floor,pr=Math.pow,aN=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,cN=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,uN=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,B4=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,In=1e7,et=7,lN=9007199254740991,fN=Bu.length-1,th=Lu.length-1,we={toStringTag:$4};we.absoluteValue=we.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Xe(e)};we.ceil=function(){return Xe(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(cs+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())+et,n.rounding=1,r=dN(n,V4(n,r)),n.precision=e,n.rounding=t,Xe(Ti==2||Ti==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(ut=!1,s=l.s*pr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=xr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=pr(r,1/3),e=Ar((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),xr(a.d).slice(0,o)===(r=xr(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 ut=!0,Xe(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-Ar(this.e/et))*et,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};we.dividedBy=we.div=function(e){return qt(this,new this.constructor(e))};we.dividedToIntegerBy=we.divToInt=function(e){var t=this,r=t.constructor;return Xe(qt(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 Xe(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/Ol(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Bo(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)};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=Bo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Ol(5,e)),i=Bo(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)};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,qt(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()?Cn(r,i,s):new r(0):new r(NaN):t.isZero()?Cn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Cn(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,ut=!1,r=r.times(r).minus(1).sqrt().plus(r),ut=!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,ut=!1,r=r.times(r).plus(1).sqrt().plus(r),ut=!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?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)};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=Cn(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<=th)return o=Cn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=th)return o=Cn(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/et+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ut=!1,t=Math.ceil(a/et),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)),ut=!0,Xe(o,l.precision=f,l.rounding=h,!0)};we.isFinite=function(){return!!this.d};we.isInteger=we.isInt=function(){return!!this.d&&Ar(this.e/et)>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(ut=!1,a=f+y,o=ts(u,a),n=t?Fu(l,a+10):ts(e,a),c=qt(o,n,a,1),ec(c.d,i=f,h))do if(a+=10,o=ts(u,a),n=t?Fu(l,a+10):ts(e,a),c=qt(o,n,a,1),!s){+xr(c.d).slice(i+1,i+15)+1==1e14&&(c=Xe(c,f+1,0));break}while(ec(c.d,i+=10,h));return ut=!0,Xe(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 ut?Xe(e,a,c):e}if(r=Ar(e.e/et),l=Ar(y.e/et),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/et),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=Al(u,r),ut?Xe(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]?Xe(new n(r),n.precision,n.rounding):(ut=!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),ut=!0,r.minus(t))};we.naturalExponential=we.exp=function(){return rh(this)};we.naturalLogarithm=we.ln=function(){return ts(this)};we.negated=we.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Xe(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)),ut?Xe(e,a,c):e;if(s=Ar(f.e/et),n=Ar(e.e/et),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/et),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=Al(u,n),ut?Xe(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(cs+e);return r.d?(t=L4(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};we.round=function(){var e=this,t=e.constructor;return Xe(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())+et,n.rounding=1,r=pN(n,V4(n,r)),n.precision=e,n.rounding=t,Xe(Ti>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(ut=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=xr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Ar((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),xr(s.d).slice(0,r)===(t=xr(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 ut=!0,Xe(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=qt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Xe(Ti==2||Ti==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=Ar(l.e/et)+Ar(e.e/et),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=Al(s,r),ut?Xe(e,f.precision,f.rounding):e};we.toBinary=function(e,t){return e0(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:(Ur(e,0,gs),t===void 0?t=n.rounding:Ur(t,0,8),Xe(r,e+r.e+1,t))};we.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ri(n,!0):(Ur(e,0,gs),t===void 0?t=i.rounding:Ur(t,0,8),n=Xe(new i(n),e+1,t),r=ri(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=ri(i):(Ur(e,0,gs),t===void 0?t=s.rounding:Ur(t,0,8),n=Xe(new s(i),e+i.e+1,t),r=ri(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=L4(b)-y.e-1,o=s%et,t.d[0]=pr(10,o<0?et+o:o),e==null)e=s>0?t:u;else{if(a=new w(e),!a.isInt()||a.lt(u))throw Error(cs+a);e=a.gt(t)?s>0?t:u:a}for(ut=!1,a=new w(xr(b)),l=w.precision,w.precision=s=b.length*et*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,ut=!0,h};we.toHexadecimal=we.toHex=function(e,t){return e0(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:Ur(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]?(ut=!1,r=qt(r,e,0,t,1).times(e),ut=!0,Xe(r)):(e.s=r.s,r=e),r};we.toNumber=function(){return+this};we.toOctal=function(e,t){return e0(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(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=Ar(e.e/et),t>=e.d.length-1&&(r=u<0?-u:u)<=lN)return i=F4(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)?Ar(u*(Math.log("0."+xr(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):(ut=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=rh(e.times(ts(a,n+r)),n),i.d&&(i=Xe(i,n+5,1),ec(i.d,n,s)&&(t=n+10,i=Xe(rh(e.times(ts(a,t+r)),t),t+5,1),+xr(i.d).slice(n+1,n+15)+1==1e14&&(i=Xe(i,n+1,0)))),i.s=o,ut=!0,c.rounding=s,Xe(i,n,s))};we.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ri(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ur(e,1,gs),t===void 0?t=i.rounding:Ur(t,0,8),n=Xe(new i(n),e,t),r=ri(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):(Ur(e,1,gs),t===void 0?t=n.rounding:Ur(t,0,8)),Xe(new n(r),e,t)};we.toString=function(){var e=this,t=e.constructor,r=ri(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};we.truncated=we.trunc=function(){return Xe(new this.constructor(this),this.e+1,1)};we.valueOf=we.toJSON=function(){var e=this,t=e.constructor,r=ri(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function xr(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=et-n.length,r&&(s+=Xi(r)),s+=n;o=e[t],n=o+"",r=et-n.length,r&&(s+=Xi(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Ur(e,t,r){if(e!==~~e||e<t||e>r)throw Error(cs+e)}function ec(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=et,i=0):(i=Math.ceil((t+1)/et),t%=et),s=pr(10,et-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 uu(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]+=Qd.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 dN(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Ol(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Bo(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,A,P,R,N,F,L,G,q,J,ne,ae,ce,V,$=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new $(!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=et,l=Ar(n.e/y)-Ar(i.e/y)),ce=m.length,ne=d.length,P=new $(p),R=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=$.precision,o=$.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)R.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ne||h)&&G--;f++)q=h*c+(d[f]||0),R[f]=q/m|0,h=q%m|0;b=h||f<ne}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ne=d.length),J=ce,N=d.slice(0,ce),F=N.length;F<ce;)N[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,N,ce,F),u<0?(L=N[0],ce!=F&&(L=L*c+(N[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,F=N.length,u=t(w,N,A,F),u==1&&(h--,r(w,ce<A?V:m,A,c))):(h==0&&(u=h=1),w=m.slice()),A=w.length,A<F&&w.unshift(0),r(N,w,F,c),u==-1&&(F=N.length,u=t(m,N,ce,F),u<1&&(h++,r(N,ce<F?V:m,F,c))),F=N.length):u===0&&(h++,N=[0]),R[f++]=h,u&&N[0]?N[F++]=d[J]||0:(N=[d[J]],F=1);while((J++<ne||N[0]!==void 0)&&G--);b=N[0]!==void 0}R[0]||R.shift()}if(y==1)P.e=l,R4=b;else{for(f=1,h=R[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+=et,o=t,l=f[h=0],c=l/pr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/et),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=et,o=s-et+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=et,o=s-et+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,(et-t%et)%et),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,et-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]==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 ut&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function ri(e,t,r){if(!e.isFinite())return z4(e);var n,i=e.e,s=xr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+Xi(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Xi(-i-1)+s,r&&(n=r-o)>0&&(s+=Xi(n))):i>=o?(s+=Xi(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+Xi(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=Xi(n))),s}function Al(e,t){var r=e[0];for(t*=et;r>=10;r/=10)t++;return t}function Fu(e,t,r){if(t>fN)throw ut=!0,r&&(e.precision=r),Error(N4);return Xe(new e(Bu),t,1,!0)}function Cn(e,t,r){if(t>th)throw Error(N4);return Xe(new e(Lu),t,r,!0)}function L4(e){var t=e.length-1,r=t*et+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 Xi(e){for(var t="";e--;)t+="0";return t}function F4(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/et+4);for(ut=!1;;){if(r%2&&(s=s.times(t),wg(s.d,o)&&(i=!0)),r=Ar(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),wg(t.d,o)}return ut=!0,s}function bg(e){return e.d[e.d.length-1]&1}function U4(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 rh(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?(ut=!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)),xr(a.d).slice(0,c)===xr(o.d).slice(0,c)){for(i=f;i--;)o=Xe(o.times(o),c,1);if(t==null)if(u<3&&ec(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,ut=!0);else return h.precision=b,o}o=a}}function ts(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,A=w.d,P=w.constructor,R=P.rounding,N=P.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(ut=!1,l=N):l=t,P.precision=l+=b,r=xr(A),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=xr(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=Fu(P,l+2,N).times(s+""),w=ts(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=N,t==null?Xe(w,N,R,ut=!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)),xr(u.d).slice(0,l)===xr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Fu(P,l+2,N).times(s+""))),c=qt(c,new P(y),l,1),t==null)if(ec(c.d,l-b,R,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=N,R,ut=!0);else return P.precision=N,c;c=u,i+=2}}function z4(e){return String(e.s*e.s/0)}function nh(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)%et,r<0&&(n+=et),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=et;n<i;)e.d.push(+t.slice(n,n+=et));t=t.slice(n),n=et-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),ut&&(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 hN(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),B4.test(t))return nh(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(cN.test(t))r=16,t=t.toLowerCase();else if(aN.test(t))r=2;else if(uN.test(t))r=8;else throw Error(cs+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=F4(n,new n(r),s,s*2)),u=uu(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=Al(u,l),e.d=u,ut=!1,o&&(e=qt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?pr(2,c):ln.pow(2,c))),ut=!0,e)}function pN(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Bo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Ol(5,r)),t=Bo(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 Bo(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/et);for(ut=!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 ut=!0,o.d.length=l+1,o}function Ol(e,t){for(var r=e;--t;)r*=e;return r}function V4(e,t){var r,n=t.s<0,i=Cn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Ti=n?4:1,t;if(r=t.divToInt(i),r.isZero())Ti=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Ti=bg(r)?n?2:3:n?4:1,t;Ti=bg(r)?n?1:4:n?3:2}return t.minus(i).abs()}function e0(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(Ur(r,1,gs),n===void 0?n=y.rounding:Ur(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=z4(e);else{for(l=ri(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=uu(ri(h),10,i),h.e=h.d.length),f=uu(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=R4),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+=Qd.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=uu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Qd.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 wg(e,t){if(e.length>t)return e.length=t,!0}function mN(e){return new this(e).abs()}function gN(e){return new this(e).acos()}function vN(e){return new this(e).acosh()}function yN(e,t){return new this(e).plus(t)}function bN(e){return new this(e).asin()}function wN(e){return new this(e).asinh()}function _N(e){return new this(e).atan()}function xN(e){return new this(e).atanh()}function SN(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=Cn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?Cn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=Cn(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=Cn(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 EN(e){return new this(e).cbrt()}function CN(e){return Xe(e=new this(e),e.e+1,2)}function MN(e,t,r){return new this(e).clamp(t,r)}function TN(e){if(!e||typeof e!="object")throw Error(Tl+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,gs,"rounding",0,8,"toExpNeg",-Mo,0,"toExpPos",0,Mo,"maxE",0,Mo,"minE",-Mo,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=eh[r]),(n=e[r])!==void 0)if(Ar(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(cs+r+": "+n);if(r="crypto",i&&(this[r]=eh[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(D4);else this[r]=!1;else throw Error(cs+r+": "+n);return this}function AN(e){return new this(e).cos()}function ON(e){return new this(e).cosh()}function q4(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,_g(s)){u.s=s.s,ut?!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++;ut?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 nh(u,s.toString())}else if(c!=="string")throw Error(cs+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),B4.test(s)?nh(u,s):hN(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=TN,i.clone=q4,i.isDecimal=_g,i.abs=mN,i.acos=gN,i.acosh=vN,i.add=yN,i.asin=bN,i.asinh=wN,i.atan=_N,i.atanh=xN,i.atan2=SN,i.cbrt=EN,i.ceil=CN,i.clamp=MN,i.cos=AN,i.cosh=ON,i.div=IN,i.exp=PN,i.floor=jN,i.hypot=kN,i.ln=RN,i.log=NN,i.log10=$N,i.log2=DN,i.max=BN,i.min=LN,i.mod=FN,i.mul=UN,i.pow=zN,i.random=VN,i.round=qN,i.sign=WN,i.sin=GN,i.sinh=HN,i.sqrt=KN,i.sub=JN,i.sum=XN,i.tan=YN,i.tanh=ZN,i.trunc=QN,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 IN(e,t){return new this(e).div(t)}function PN(e){return new this(e).exp()}function jN(e){return Xe(e=new this(e),e.e+1,3)}function kN(){var e,t,r=new this(0);for(ut=!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 ut=!0,new this(1/0);r=t}return ut=!0,r.sqrt()}function _g(e){return e instanceof ln||e&&e.toStringTag===$4||!1}function RN(e){return new this(e).ln()}function NN(e,t){return new this(e).log(t)}function DN(e){return new this(e).log(2)}function $N(e){return new this(e).log(10)}function BN(){return U4(this,arguments,"lt")}function LN(){return U4(this,arguments,"gt")}function FN(e,t){return new this(e).mod(t)}function UN(e,t){return new this(e).mul(t)}function zN(e,t){return new this(e).pow(t)}function VN(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Ur(e,1,gs),n=Math.ceil(e/et),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(D4);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=et,n&&e&&(i=pr(10,et-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-=et)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<et&&(r-=et-n)}return o.e=r,o.d=a,o}function qN(e){return Xe(e=new this(e),e.e+1,this.rounding)}function WN(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function GN(e){return new this(e).sin()}function HN(e){return new this(e).sinh()}function KN(e){return new this(e).sqrt()}function JN(e,t){return new this(e).sub(t)}function XN(){var e=0,t=arguments,r=new this(t[e]);for(ut=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return ut=!0,Xe(r,this.precision,this.rounding)}function YN(e){return new this(e).tan()}function ZN(e){return new this(e).tanh()}function QN(e){return Xe(e=new this(e),e.e+1,1)}we[Symbol.for("nodejs.util.inspect.custom")]=we.toString;we[Symbol.toStringTag]="Decimal";var ln=we.constructor=q4(eh);Bu=new ln(Bu);Lu=new ln(Lu);ln.config({precision:256,rounding:ln.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const an=(e,t,r,n=ln.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Le(e).equals(0))return"0";if(t!==void 0){const u=xs(e,t,n);if(!Le(u).equals(0))return r?u:Lo(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=xs(i,0,n):Le(o.length).gte(4)?c=xs(i,2,n):c=xs(i,4,n);else{xs(i,6,n);const u=iD(a);if(u<6)c=xs(i,u+6,n);else{if(u>30)return"0";c=xs(i,9+(u-6),n)}}return r||Le(o).lt(1)?c:Lo(c)},eD=(e,t=2)=>{if(typeof e>"u"||e==="undefined"||e!==0&&!e)return"--";if(Le(e).abs().gt(100))return"> 100%";if(Number(e)>=0&&Number(e)<=Math.pow(10,-t))return`<${Math.pow(10,-t)}%`;if(Number(e)<0&&Number(e)*-1<=Math.pow(10,-t))return` < -${Math.pow(10,-t)}%`;const r=nD(e,t);return Number(r)>0?`+${r}%`:`${r}%`},W4=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=an(e,t,!0,ln.ROUND_DOWN).toString();if(Le(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:Lo(i).toString();return o.includes("e")&&(o=n?i:Lo(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"$--"}},tD=(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=>ln.isDecimal(e)?e:new ln(typeof e>"u"||e==="undefined"||!e?0:e);function rD(e,t){return t===void 0?"":Le(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const xs=(e,t,r)=>Le(e).toDP(t,r).toString(),nD=(e,t)=>{try{return Le(e).toDP(t,ln.ROUND_DOWN).toString()}catch{return String(e)}},Lo=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 iD(e){let t=0;if(e)for(;t<e.length;){if(Le(e[t]).gt(0))return t+1;t++}return 0}function sD(e,t){const r=G4(Le(t));return Number(Le(e).mul(r))}function oD(e,t){const r=G4(Le(t));return Number(Le(e).div(r))}function G4(e){return Le(10).pow(Le(e).abs())}function ih(e,t){const r=oD(e,t);return aD(r.toString(),Number(t))}function aD(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return tD(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 Il(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const Gs=(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):"",t0=(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(!t0(e[i],t[i]))return!1;return!0};function xg(e){return!e||Object.keys(e).length===0}function H4(e){var t;return!!(((t=e.split("::"))==null?void 0:t.length)===3&&e.startsWith("0x"))}const Sg=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function cD(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=za(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===kh;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 Eg(e,t){if(t){const r=e[za(t.coin_type).full_address];if(r)return ih(Le(r.amount).abs().toFixed(0),t.decimals)}}function zt(e){return`https://archive.cetus.zone/assets/terminal${e}`}const Mn=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&Le(t).gt(0)?`${e.slice(0,t)}...`:e,K4="0x2::sui::SUI",uD="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function J4(e){return Mr(e).full_address===K4}function Cg(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 Mr(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={...Mr(r),type_arguments:i.map(l=>Mr(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>J4(l)?l:Mr(l).source_address),u.source_address=Cg(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===K4||r===uD?"0x2":Ci(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=Cg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function lD(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const r0=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=Ci(n);return t&&(i=lD(i)),`${i}::${r.join("::")}`},fD=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}},dD=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}},sh="tokenMap",X4="trustedTokenList",Y4="collectTokenMap",Z4="importTokenList";var Q4={exports:{}};/*!
|
|
44
|
+
*/var Mo=9e15,gs=1e9,rh="0123456789abcdef",Lu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Fu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",nh={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Mo,maxE:Mo,crypto:!1},$4,Ti,ut=!0,Al="[DecimalError] ",cs=Al+"Invalid argument: ",B4=Al+"Precision limit exceeded",L4=Al+"crypto unavailable",F4="[object Decimal]",Ar=Math.floor,pr=Math.pow,fN=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,dN=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,hN=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,U4=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,In=1e7,et=7,pN=9007199254740991,mN=Lu.length-1,ih=Fu.length-1,we={toStringTag:F4};we.absoluteValue=we.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Xe(e)};we.ceil=function(){return Xe(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(cs+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())+et,n.rounding=1,r=gN(n,G4(n,r)),n.precision=e,n.rounding=t,Xe(Ti==2||Ti==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(ut=!1,s=l.s*pr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=xr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=pr(r,1/3),e=Ar((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),xr(a.d).slice(0,o)===(r=xr(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 ut=!0,Xe(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-Ar(this.e/et))*et,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};we.dividedBy=we.div=function(e){return qt(this,new this.constructor(e))};we.dividedToIntegerBy=we.divToInt=function(e){var t=this,r=t.constructor;return Xe(qt(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 Xe(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/Il(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Bo(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)};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=Bo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Il(5,e)),i=Bo(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)};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,qt(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()?Mn(r,i,s):new r(0):new r(NaN):t.isZero()?Mn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Mn(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,ut=!1,r=r.times(r).minus(1).sqrt().plus(r),ut=!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,ut=!1,r=r.times(r).plus(1).sqrt().plus(r),ut=!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?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)};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=Mn(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<=ih)return o=Mn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=ih)return o=Mn(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/et+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ut=!1,t=Math.ceil(a/et),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)),ut=!0,Xe(o,l.precision=f,l.rounding=h,!0)};we.isFinite=function(){return!!this.d};we.isInteger=we.isInt=function(){return!!this.d&&Ar(this.e/et)>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(ut=!1,a=f+y,o=ts(u,a),n=t?Uu(l,a+10):ts(e,a),c=qt(o,n,a,1),tc(c.d,i=f,h))do if(a+=10,o=ts(u,a),n=t?Uu(l,a+10):ts(e,a),c=qt(o,n,a,1),!s){+xr(c.d).slice(i+1,i+15)+1==1e14&&(c=Xe(c,f+1,0));break}while(tc(c.d,i+=10,h));return ut=!0,Xe(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 ut?Xe(e,a,c):e}if(r=Ar(e.e/et),l=Ar(y.e/et),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/et),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=Ol(u,r),ut?Xe(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]?Xe(new n(r),n.precision,n.rounding):(ut=!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),ut=!0,r.minus(t))};we.naturalExponential=we.exp=function(){return sh(this)};we.naturalLogarithm=we.ln=function(){return ts(this)};we.negated=we.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Xe(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)),ut?Xe(e,a,c):e;if(s=Ar(f.e/et),n=Ar(e.e/et),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/et),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=Ol(u,n),ut?Xe(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(cs+e);return r.d?(t=z4(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};we.round=function(){var e=this,t=e.constructor;return Xe(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())+et,n.rounding=1,r=yN(n,G4(n,r)),n.precision=e,n.rounding=t,Xe(Ti>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(ut=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=xr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Ar((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),xr(s.d).slice(0,r)===(t=xr(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 ut=!0,Xe(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=qt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Xe(Ti==2||Ti==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=Ar(l.e/et)+Ar(e.e/et),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=Ol(s,r),ut?Xe(e,f.precision,f.rounding):e};we.toBinary=function(e,t){return n0(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:(Ur(e,0,gs),t===void 0?t=n.rounding:Ur(t,0,8),Xe(r,e+r.e+1,t))};we.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ri(n,!0):(Ur(e,0,gs),t===void 0?t=i.rounding:Ur(t,0,8),n=Xe(new i(n),e+1,t),r=ri(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=ri(i):(Ur(e,0,gs),t===void 0?t=s.rounding:Ur(t,0,8),n=Xe(new s(i),e+i.e+1,t),r=ri(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=z4(b)-y.e-1,o=s%et,t.d[0]=pr(10,o<0?et+o:o),e==null)e=s>0?t:u;else{if(a=new w(e),!a.isInt()||a.lt(u))throw Error(cs+a);e=a.gt(t)?s>0?t:u:a}for(ut=!1,a=new w(xr(b)),l=w.precision,w.precision=s=b.length*et*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,ut=!0,h};we.toHexadecimal=we.toHex=function(e,t){return n0(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:Ur(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]?(ut=!1,r=qt(r,e,0,t,1).times(e),ut=!0,Xe(r)):(e.s=r.s,r=e),r};we.toNumber=function(){return+this};we.toOctal=function(e,t){return n0(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(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=Ar(e.e/et),t>=e.d.length-1&&(r=u<0?-u:u)<=pN)return i=V4(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)?Ar(u*(Math.log("0."+xr(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):(ut=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=sh(e.times(ts(a,n+r)),n),i.d&&(i=Xe(i,n+5,1),tc(i.d,n,s)&&(t=n+10,i=Xe(sh(e.times(ts(a,t+r)),t),t+5,1),+xr(i.d).slice(n+1,n+15)+1==1e14&&(i=Xe(i,n+1,0)))),i.s=o,ut=!0,c.rounding=s,Xe(i,n,s))};we.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ri(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ur(e,1,gs),t===void 0?t=i.rounding:Ur(t,0,8),n=Xe(new i(n),e,t),r=ri(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):(Ur(e,1,gs),t===void 0?t=n.rounding:Ur(t,0,8)),Xe(new n(r),e,t)};we.toString=function(){var e=this,t=e.constructor,r=ri(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};we.truncated=we.trunc=function(){return Xe(new this.constructor(this),this.e+1,1)};we.valueOf=we.toJSON=function(){var e=this,t=e.constructor,r=ri(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function xr(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=et-n.length,r&&(s+=Xi(r)),s+=n;o=e[t],n=o+"",r=et-n.length,r&&(s+=Xi(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Ur(e,t,r){if(e!==~~e||e<t||e>r)throw Error(cs+e)}function tc(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=et,i=0):(i=Math.ceil((t+1)/et),t%=et),s=pr(10,et-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 lu(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]+=rh.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 gN(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Il(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Bo(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,A,P,R,N,F,L,G,q,J,ne,ae,ce,V,$=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new $(!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=et,l=Ar(n.e/y)-Ar(i.e/y)),ce=m.length,ne=d.length,P=new $(p),R=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=$.precision,o=$.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)R.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ne||h)&&G--;f++)q=h*c+(d[f]||0),R[f]=q/m|0,h=q%m|0;b=h||f<ne}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ne=d.length),J=ce,N=d.slice(0,ce),F=N.length;F<ce;)N[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,N,ce,F),u<0?(L=N[0],ce!=F&&(L=L*c+(N[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,F=N.length,u=t(w,N,A,F),u==1&&(h--,r(w,ce<A?V:m,A,c))):(h==0&&(u=h=1),w=m.slice()),A=w.length,A<F&&w.unshift(0),r(N,w,F,c),u==-1&&(F=N.length,u=t(m,N,ce,F),u<1&&(h++,r(N,ce<F?V:m,F,c))),F=N.length):u===0&&(h++,N=[0]),R[f++]=h,u&&N[0]?N[F++]=d[J]||0:(N=[d[J]],F=1);while((J++<ne||N[0]!==void 0)&&G--);b=N[0]!==void 0}R[0]||R.shift()}if(y==1)P.e=l,$4=b;else{for(f=1,h=R[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+=et,o=t,l=f[h=0],c=l/pr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/et),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=et,o=s-et+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=et,o=s-et+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,(et-t%et)%et),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,et-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]==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 ut&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function ri(e,t,r){if(!e.isFinite())return W4(e);var n,i=e.e,s=xr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+Xi(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Xi(-i-1)+s,r&&(n=r-o)>0&&(s+=Xi(n))):i>=o?(s+=Xi(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+Xi(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=Xi(n))),s}function Ol(e,t){var r=e[0];for(t*=et;r>=10;r/=10)t++;return t}function Uu(e,t,r){if(t>mN)throw ut=!0,r&&(e.precision=r),Error(B4);return Xe(new e(Lu),t,1,!0)}function Mn(e,t,r){if(t>ih)throw Error(B4);return Xe(new e(Fu),t,r,!0)}function z4(e){var t=e.length-1,r=t*et+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 Xi(e){for(var t="";e--;)t+="0";return t}function V4(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/et+4);for(ut=!1;;){if(r%2&&(s=s.times(t),xg(s.d,o)&&(i=!0)),r=Ar(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),xg(t.d,o)}return ut=!0,s}function _g(e){return e.d[e.d.length-1]&1}function q4(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 sh(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?(ut=!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)),xr(a.d).slice(0,c)===xr(o.d).slice(0,c)){for(i=f;i--;)o=Xe(o.times(o),c,1);if(t==null)if(u<3&&tc(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,ut=!0);else return h.precision=b,o}o=a}}function ts(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,A=w.d,P=w.constructor,R=P.rounding,N=P.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(ut=!1,l=N):l=t,P.precision=l+=b,r=xr(A),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=xr(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=Uu(P,l+2,N).times(s+""),w=ts(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=N,t==null?Xe(w,N,R,ut=!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)),xr(u.d).slice(0,l)===xr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Uu(P,l+2,N).times(s+""))),c=qt(c,new P(y),l,1),t==null)if(tc(c.d,l-b,R,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=N,R,ut=!0);else return P.precision=N,c;c=u,i+=2}}function W4(e){return String(e.s*e.s/0)}function oh(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)%et,r<0&&(n+=et),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=et;n<i;)e.d.push(+t.slice(n,n+=et));t=t.slice(n),n=et-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),ut&&(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 vN(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),U4.test(t))return oh(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(dN.test(t))r=16,t=t.toLowerCase();else if(fN.test(t))r=2;else if(hN.test(t))r=8;else throw Error(cs+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=V4(n,new n(r),s,s*2)),u=lu(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=Ol(u,l),e.d=u,ut=!1,o&&(e=qt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?pr(2,c):fn.pow(2,c))),ut=!0,e)}function yN(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Bo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Il(5,r)),t=Bo(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 Bo(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/et);for(ut=!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 ut=!0,o.d.length=l+1,o}function Il(e,t){for(var r=e;--t;)r*=e;return r}function G4(e,t){var r,n=t.s<0,i=Mn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Ti=n?4:1,t;if(r=t.divToInt(i),r.isZero())Ti=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Ti=_g(r)?n?2:3:n?4:1,t;Ti=_g(r)?n?1:4:n?3:2}return t.minus(i).abs()}function n0(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(Ur(r,1,gs),n===void 0?n=y.rounding:Ur(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=W4(e);else{for(l=ri(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=lu(ri(h),10,i),h.e=h.d.length),f=lu(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=$4),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+=rh.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=lu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=rh.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 xg(e,t){if(e.length>t)return e.length=t,!0}function bN(e){return new this(e).abs()}function wN(e){return new this(e).acos()}function _N(e){return new this(e).acosh()}function xN(e,t){return new this(e).plus(t)}function SN(e){return new this(e).asin()}function EN(e){return new this(e).asinh()}function CN(e){return new this(e).atan()}function MN(e){return new this(e).atanh()}function TN(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=Mn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?Mn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=Mn(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=Mn(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 AN(e){return new this(e).cbrt()}function ON(e){return Xe(e=new this(e),e.e+1,2)}function IN(e,t,r){return new this(e).clamp(t,r)}function PN(e){if(!e||typeof e!="object")throw Error(Al+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,gs,"rounding",0,8,"toExpNeg",-Mo,0,"toExpPos",0,Mo,"maxE",0,Mo,"minE",-Mo,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=nh[r]),(n=e[r])!==void 0)if(Ar(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(cs+r+": "+n);if(r="crypto",i&&(this[r]=nh[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(L4);else this[r]=!1;else throw Error(cs+r+": "+n);return this}function jN(e){return new this(e).cos()}function kN(e){return new this(e).cosh()}function H4(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,Sg(s)){u.s=s.s,ut?!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++;ut?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 oh(u,s.toString())}else if(c!=="string")throw Error(cs+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),U4.test(s)?oh(u,s):vN(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=PN,i.clone=H4,i.isDecimal=Sg,i.abs=bN,i.acos=wN,i.acosh=_N,i.add=xN,i.asin=SN,i.asinh=EN,i.atan=CN,i.atanh=MN,i.atan2=TN,i.cbrt=AN,i.ceil=ON,i.clamp=IN,i.cos=jN,i.cosh=kN,i.div=RN,i.exp=NN,i.floor=DN,i.hypot=$N,i.ln=BN,i.log=LN,i.log10=UN,i.log2=FN,i.max=zN,i.min=VN,i.mod=qN,i.mul=WN,i.pow=GN,i.random=HN,i.round=KN,i.sign=JN,i.sin=XN,i.sinh=YN,i.sqrt=ZN,i.sub=QN,i.sum=eD,i.tan=tD,i.tanh=rD,i.trunc=nD,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 RN(e,t){return new this(e).div(t)}function NN(e){return new this(e).exp()}function DN(e){return Xe(e=new this(e),e.e+1,3)}function $N(){var e,t,r=new this(0);for(ut=!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 ut=!0,new this(1/0);r=t}return ut=!0,r.sqrt()}function Sg(e){return e instanceof fn||e&&e.toStringTag===F4||!1}function BN(e){return new this(e).ln()}function LN(e,t){return new this(e).log(t)}function FN(e){return new this(e).log(2)}function UN(e){return new this(e).log(10)}function zN(){return q4(this,arguments,"lt")}function VN(){return q4(this,arguments,"gt")}function qN(e,t){return new this(e).mod(t)}function WN(e,t){return new this(e).mul(t)}function GN(e,t){return new this(e).pow(t)}function HN(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Ur(e,1,gs),n=Math.ceil(e/et),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(L4);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=et,n&&e&&(i=pr(10,et-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-=et)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<et&&(r-=et-n)}return o.e=r,o.d=a,o}function KN(e){return Xe(e=new this(e),e.e+1,this.rounding)}function JN(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function XN(e){return new this(e).sin()}function YN(e){return new this(e).sinh()}function ZN(e){return new this(e).sqrt()}function QN(e,t){return new this(e).sub(t)}function eD(){var e=0,t=arguments,r=new this(t[e]);for(ut=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return ut=!0,Xe(r,this.precision,this.rounding)}function tD(e){return new this(e).tan()}function rD(e){return new this(e).tanh()}function nD(e){return Xe(e=new this(e),e.e+1,1)}we[Symbol.for("nodejs.util.inspect.custom")]=we.toString;we[Symbol.toStringTag]="Decimal";var fn=we.constructor=H4(nh);Lu=new fn(Lu);Fu=new fn(Fu);fn.config({precision:256,rounding:fn.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const an=(e,t,r,n=fn.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Le(e).equals(0))return"0";if(t!==void 0){const u=Ss(e,t,n);if(!Le(u).equals(0))return r?u:Lo(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=Ss(i,0,n):Le(o.length).gte(4)?c=Ss(i,2,n):c=Ss(i,4,n);else{Ss(i,6,n);const u=cD(a);if(u<6)c=Ss(i,u+6,n);else{if(u>30)return"0";c=Ss(i,9+(u-6),n)}}return r||Le(o).lt(1)?c:Lo(c)},iD=(e,t=2)=>{if(typeof e>"u"||e==="undefined"||e!==0&&!e)return"--";if(Le(e).abs().gt(100))return"> 100%";if(Number(e)>=0&&Number(e)<=Math.pow(10,-t))return`<${Math.pow(10,-t)}%`;if(Number(e)<0&&Number(e)*-1<=Math.pow(10,-t))return` < -${Math.pow(10,-t)}%`;const r=aD(e,t);return Number(r)>0?`+${r}%`:`${r}%`},K4=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=an(e,t,!0,fn.ROUND_DOWN).toString();if(Le(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:Lo(i).toString();return o.includes("e")&&(o=n?i:Lo(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"$--"}},sD=(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=>fn.isDecimal(e)?e:new fn(typeof e>"u"||e==="undefined"||!e?0:e);function oD(e,t){return t===void 0?"":Le(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const Ss=(e,t,r)=>Le(e).toDP(t,r).toString(),aD=(e,t)=>{try{return Le(e).toDP(t,fn.ROUND_DOWN).toString()}catch{return String(e)}},Lo=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 cD(e){let t=0;if(e)for(;t<e.length;){if(Le(e[t]).gt(0))return t+1;t++}return 0}function uD(e,t){const r=J4(Le(t));return Number(Le(e).mul(r))}function lD(e,t){const r=J4(Le(t));return Number(Le(e).div(r))}function J4(e){return Le(10).pow(Le(e).abs())}function ah(e,t){const r=lD(e,t);return fD(r.toString(),Number(t))}function fD(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return sD(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 Pl(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):"",i0=(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(!i0(e[i],t[i]))return!1;return!0};function Eg(e){return!e||Object.keys(e).length===0}function X4(e){var t;return!!(((t=e.split("::"))==null?void 0:t.length)===3&&e.startsWith("0x"))}const Cg=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function dD(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=za(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===Dh;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 Mg(e,t){if(t){const r=e[za(t.coin_type).full_address];if(r)return ah(Le(r.amount).abs().toFixed(0),t.decimals)}}function zt(e){return`https://archive.cetus.zone/assets/terminal${e}`}const cn=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&Le(t).gt(0)?`${e.slice(0,t)}...`:e,$c=(e,t)=>ec(e||"")===ec(t||""),hD=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}},pD=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}},ch="tokenMap",Y4="trustedTokenList",Z4="collectTokenMap",Q4="importTokenList";var e6={exports:{}};/*!
|
|
45
45
|
localForage -- Offline Storage, Improved
|
|
46
46
|
Version 1.10.0
|
|
47
47
|
https://localforage.github.io/localForage
|
|
48
48
|
(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 Gn=="function"&&Gn;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 Gn=="function"&&Gn,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 A=s.document.createElement("script");A.onreadystatechange=function(){b(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},s.document.documentElement.appendChild(A)}:a=function(){setTimeout(b,0)};var h,y=[];function b(){h=!0;for(var A,P,R=y.length;R;){for(P=y,y=[],A=-1;++A<R;)P[A]();R=y.length}h=!1}n.exports=w;function w(A){y.push(A)===1&&!h&&a()}}).call(this,typeof Rr<"u"?Rr: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 J=this.state===u?L:G;y(q,J,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 J;try{J=G(q)}catch(ne){return a.reject(L,ne)}J===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,J)})}a.resolve=function(L,G){var q=A(b,G);if(q.status==="error")return a.reject(L,q.value);var J=q.value;if(J)w(L,J);else{L.state=u,L.outcome=G;for(var ne=-1,ae=L.queue.length;++ne<ae;)L.queue[ne].callFulfilled(G)}return L},a.reject=function(L,G){L.state=c,L.outcome=G;for(var q=-1,J=L.queue.length;++q<J;)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 J(V){q||(q=!0,a.reject(L,V))}function ne(V){q||(q=!0,a.resolve(L,V))}function ae(){G(ne,J)}var ce=A(ae);ce.status==="error"&&J(ce.value)}function A(L,G){var q={};try{q.value=L(G),q.status="success"}catch(J){q.status="error",q.value=J}return q}f.resolve=P;function P(L){return L instanceof this?L:a.resolve(new this(o),L)}f.reject=R;function R(L){var G=new this(o);return a.reject(G,L)}f.all=N;function N(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,J=!1;if(!q)return this.resolve([]);for(var ne=new Array(q),ae=0,ce=-1,V=new this(o);++ce<q;)$(L[ce],ce);return V;function $(p,d){G.resolve(p).then(m,function(x){J||(J=!0,a.reject(V,x))});function m(x){ne[d]=x,++ae===q&&!J&&(J=!0,a.resolve(V,ne))}}}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,J=!1;if(!q)return this.resolve([]);for(var ne=-1,ae=new this(o);++ne<q;)ce(L[ne]);return ae;function ce(V){G.resolve(V).then(function($){J||(J=!0,a.resolve(ae,$))},function($){J||(J=!0,a.reject(ae,$))})}}},{1:1}],3:[function(r,n,i){(function(s){typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof Rr<"u"?Rr: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(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D};function o(D,H){if(!(D 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 D=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(!D||H)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l(D,H){D=D||[],H=H||{};try{return new Blob(D,H)}catch(X){if(X.name!=="TypeError")throw X;for(var U=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,Y=new U,Q=0;Q<D.length;Q+=1)Y.append(D[Q]);return Y.getBlob(H.type)}}typeof Promise>"u"&&r(3);var f=Promise;function h(D,H){H&&D.then(function(U){H(null,U)},function(U){H(U)})}function y(D,H,U){typeof H=="function"&&D.then(H),typeof U=="function"&&D.catch(U)}function b(D){return typeof D!="string"&&(console.warn(D+" used as a key, but it is not a string."),D=String(D)),D}function w(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var A="local-forage-detect-blob-support",P=void 0,R={},N=Object.prototype.toString,F="readonly",L="readwrite";function G(D){for(var H=D.length,U=new ArrayBuffer(H),Y=new Uint8Array(U),Q=0;Q<H;Q++)Y[Q]=D.charCodeAt(Q);return U}function q(D){return new f(function(H){var U=D.transaction(A,L),Y=l([""]);U.objectStore(A).put(Y,"key"),U.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),H(!1)},U.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),X=navigator.userAgent.match(/Edge\//);H(X||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function J(D){return typeof P=="boolean"?f.resolve(P):q(D).then(function(H){return P=H,P})}function ne(D){var H=R[D.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(D){var H=R[D.name],U=H.deferredOperations.pop();if(U)return U.resolve(),U.promise}function ce(D,H){var U=R[D.name],Y=U.deferredOperations.pop();if(Y)return Y.reject(H),Y.promise}function V(D,H){return new f(function(U,Y){if(R[D.name]=R[D.name]||g(),D.db)if(H)ne(D),D.db.close();else return U(D.db);var Q=[D.name];H&&Q.push(D.version);var X=c.open.apply(c,Q);H&&(X.onupgradeneeded=function(me){var xe=X.result;try{xe.createObjectStore(D.storeName),me.oldVersion<=1&&xe.createObjectStore(A)}catch(Ce){if(Ce.name==="ConstraintError")console.warn('The database "'+D.name+'" has been upgraded from version '+me.oldVersion+" to version "+me.newVersion+', but the storage "'+D.storeName+'" already exists.');else throw Ce}}),X.onerror=function(me){me.preventDefault(),Y(X.error)},X.onsuccess=function(){var me=X.result;me.onversionchange=function(xe){xe.target.close()},U(me),ae(D)}})}function $(D){return V(D,!1)}function p(D){return V(D,!0)}function d(D,H){if(!D.db)return!0;var U=!D.db.objectStoreNames.contains(D.storeName),Y=D.version<D.db.version,Q=D.version>D.db.version;if(Y&&(D.version!==H&&console.warn('The database "'+D.name+`" can't be downgraded from version `+D.db.version+" to version "+D.version+"."),D.version=D.db.version),Q||U){if(U){var X=D.db.version+1;X>D.version&&(D.version=X)}return!0}return!1}function m(D){return new f(function(H,U){var Y=new FileReader;Y.onerror=U,Y.onloadend=function(Q){var X=btoa(Q.target.result||"");H({__local_forage_encoded_blob:!0,data:X,type:D.type})},Y.readAsBinaryString(D)})}function x(D){var H=G(atob(D.data));return l([H],{type:D.type})}function M(D){return D&&D.__local_forage_encoded_blob}function E(D){var H=this,U=H._initReady().then(function(){var Y=R[H._dbInfo.name];if(Y&&Y.dbReady)return Y.dbReady});return y(U,D,D),U}function O(D){ne(D);for(var H=R[D.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 D.db=null,$(D).then(function(X){return D.db=X,d(D)?p(D):X}).then(function(X){D.db=H.db=X;for(var me=0;me<U.length;me++)U[me]._dbInfo.db=X}).catch(function(X){throw ce(D,X),X})}function C(D,H,U,Y){Y===void 0&&(Y=1);try{var Q=D.db.transaction(D.storeName,H);U(null,Q)}catch(X){if(Y>0&&(!D.db||X.name==="InvalidStateError"||X.name==="NotFoundError"))return f.resolve().then(function(){if(!D.db||X.name==="NotFoundError"&&!D.db.objectStoreNames.contains(D.storeName)&&D.version<=D.db.version)return D.db&&(D.version=D.db.version+1),p(D)}).then(function(){return O(D).then(function(){C(D,H,U,Y-1)})}).catch(U);U(X)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v(D){var H=this,U={db:null};if(D)for(var Y in D)U[Y]=D[Y];var Q=R[U.name];Q||(Q=g(),R[U.name]=Q),Q.forages.push(H),H._initReady||(H._initReady=H.ready,H.ready=E);var X=[];function me(){return f.resolve()}for(var xe=0;xe<Q.forages.length;xe++){var Ce=Q.forages[xe];Ce!==H&&X.push(Ce._initReady().catch(me))}var Me=Q.forages.slice(0);return f.all(X).then(function(){return U.db=Q.db,$(U)}).then(function(Te){return U.db=Te,d(U,H._defaultConfig.version)?p(U):Te}).then(function(Te){U.db=Q.db=Te,H._dbInfo=U;for(var Ve=0;Ve<Me.length;Ve++){var yt=Me[Ve];yt!==H&&(yt._dbInfo.db=U.db,yt._dbInfo.version=U.version)}})}function j(D,H){var U=this;D=b(D);var Y=new f(function(Q,X){U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return X(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=Ce.get(D);Me.onsuccess=function(){var Te=Me.result;Te===void 0&&(Te=null),M(Te)&&(Te=x(Te)),Q(Te)},Me.onerror=function(){X(Me.error)}}catch(Te){X(Te)}})}).catch(X)});return h(Y,H),Y}function ee(D,H){var U=this,Y=new f(function(Q,X){U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return X(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=Ce.openCursor(),Te=1;Me.onsuccess=function(){var Ve=Me.result;if(Ve){var yt=Ve.value;M(yt)&&(yt=x(yt));var $t=D(yt,Ve.key,Te++);$t!==void 0?Q($t):Ve.continue()}else Q()},Me.onerror=function(){X(Me.error)}}catch(Ve){X(Ve)}})}).catch(X)});return h(Y,H),Y}function ie(D,H,U){var Y=this;D=b(D);var Q=new f(function(X,me){var xe;Y.ready().then(function(){return xe=Y._dbInfo,N.call(H)==="[object Blob]"?J(xe.db).then(function(Ce){return Ce?H:m(H)}):H}).then(function(Ce){C(Y._dbInfo,L,function(Me,Te){if(Me)return me(Me);try{var Ve=Te.objectStore(Y._dbInfo.storeName);Ce===null&&(Ce=void 0);var yt=Ve.put(Ce,D);Te.oncomplete=function(){Ce===void 0&&(Ce=null),X(Ce)},Te.onabort=Te.onerror=function(){var $t=yt.error?yt.error:yt.transaction.error;me($t)}}catch($t){me($t)}})}).catch(me)});return h(Q,U),Q}function ve(D,H){var U=this;D=b(D);var Y=new f(function(Q,X){U.ready().then(function(){C(U._dbInfo,L,function(me,xe){if(me)return X(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=Ce.delete(D);xe.oncomplete=function(){Q()},xe.onerror=function(){X(Me.error)},xe.onabort=function(){var Te=Me.error?Me.error:Me.transaction.error;X(Te)}}catch(Te){X(Te)}})}).catch(X)});return h(Y,H),Y}function pe(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,L,function(X,me){if(X)return Q(X);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.clear();me.oncomplete=function(){Y()},me.onabort=me.onerror=function(){var Me=Ce.error?Ce.error:Ce.transaction.error;Q(Me)}}catch(Me){Q(Me)}})}).catch(Q)});return h(U,D),U}function Ee(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(X,me){if(X)return Q(X);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.count();Ce.onsuccess=function(){Y(Ce.result)},Ce.onerror=function(){Q(Ce.error)}}catch(Me){Q(Me)}})}).catch(Q)});return h(U,D),U}function Se(D,H){var U=this,Y=new f(function(Q,X){if(D<0){Q(null);return}U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return X(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=!1,Te=Ce.openKeyCursor();Te.onsuccess=function(){var Ve=Te.result;if(!Ve){Q(null);return}D===0||Me?Q(Ve.key):(Me=!0,Ve.advance(D))},Te.onerror=function(){X(Te.error)}}catch(Ve){X(Ve)}})}).catch(X)});return h(Y,H),Y}function Ke(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(X,me){if(X)return Q(X);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.openKeyCursor(),Me=[];Ce.onsuccess=function(){var Te=Ce.result;if(!Te){Y(Me);return}Me.push(Te.key),Te.continue()},Ce.onerror=function(){Q(Ce.error)}}catch(Te){Q(Te)}})}).catch(Q)});return h(U,D),U}function Ue(D,H){H=w.apply(this,arguments);var U=this.config();D=typeof D!="function"&&D||{},D.name||(D.name=D.name||U.name,D.storeName=D.storeName||U.storeName);var Y=this,Q;if(!D.name)Q=f.reject("Invalid arguments");else{var X=D.name===U.name&&Y._dbInfo.db,me=X?f.resolve(Y._dbInfo.db):$(D).then(function(xe){var Ce=R[D.name],Me=Ce.forages;Ce.db=xe;for(var Te=0;Te<Me.length;Te++)Me[Te]._dbInfo.db=xe;return xe});D.storeName?Q=me.then(function(xe){if(xe.objectStoreNames.contains(D.storeName)){var Ce=xe.version+1;ne(D);var Me=R[D.name],Te=Me.forages;xe.close();for(var Ve=0;Ve<Te.length;Ve++){var yt=Te[Ve];yt._dbInfo.db=null,yt._dbInfo.version=Ce}var $t=new f(function(Ut,ar){var sr=c.open(D.name,Ce);sr.onerror=function(Yr){var la=sr.result;la.close(),ar(Yr)},sr.onupgradeneeded=function(){var Yr=sr.result;Yr.deleteObjectStore(D.storeName)},sr.onsuccess=function(){var Yr=sr.result;Yr.close(),Ut(Yr)}});return $t.then(function(Ut){Me.db=Ut;for(var ar=0;ar<Te.length;ar++){var sr=Te[ar];sr._dbInfo.db=Ut,ae(sr._dbInfo)}}).catch(function(Ut){throw(ce(D,Ut)||f.resolve()).catch(function(){}),Ut})}}):Q=me.then(function(xe){ne(D);var Ce=R[D.name],Me=Ce.forages;xe.close();for(var Te=0;Te<Me.length;Te++){var Ve=Me[Te];Ve._dbInfo.db=null}var yt=new f(function($t,Ut){var ar=c.deleteDatabase(D.name);ar.onerror=function(){var sr=ar.result;sr&&sr.close(),Ut(ar.error)},ar.onblocked=function(){console.warn('dropInstance blocked for database "'+D.name+'" until all open connections are closed')},ar.onsuccess=function(){var sr=ar.result;sr&&sr.close(),$t(sr)}});return yt.then(function($t){Ce.db=$t;for(var Ut=0;Ut<Me.length;Ut++){var ar=Me[Ut];ae(ar._dbInfo)}}).catch(function($t){throw(ce(D,$t)||f.resolve()).catch(function(){}),$t})})}return h(Q,H),Q}var lt={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:ee,getItem:j,setItem:ie,removeItem:ve,clear:pe,length:Ee,key:Se,keys:Ke,dropInstance:Ue};function ht(){return typeof openDatabase=="function"}var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",_e=/^~~local_forage_type~([^~]+)~/,ge="__lfsc__:",Ae=ge.length,qe="arbf",De="blob",Oe="si08",Ie="ui08",Fe="uic8",ft="si16",dt="si32",Ge="ur16",jt="ui32",xt="fl32",Ze="fl64",Tt=Ae+qe.length,Nt=Object.prototype.toString;function nt(D){var H=D.length*.75,U=D.length,Y,Q=0,X,me,xe,Ce;D[D.length-1]==="="&&(H--,D[D.length-2]==="="&&H--);var Me=new ArrayBuffer(H),Te=new Uint8Array(Me);for(Y=0;Y<U;Y+=4)X=$e.indexOf(D[Y]),me=$e.indexOf(D[Y+1]),xe=$e.indexOf(D[Y+2]),Ce=$e.indexOf(D[Y+3]),Te[Q++]=X<<2|me>>4,Te[Q++]=(me&15)<<4|xe>>2,Te[Q++]=(xe&3)<<6|Ce&63;return Me}function St(D){var H=new Uint8Array(D),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 At(D,H){var U="";if(D&&(U=Nt.call(D)),D&&(U==="[object ArrayBuffer]"||D.buffer&&Nt.call(D.buffer)==="[object ArrayBuffer]")){var Y,Q=ge;D instanceof ArrayBuffer?(Y=D,Q+=qe):(Y=D.buffer,U==="[object Int8Array]"?Q+=Oe:U==="[object Uint8Array]"?Q+=Ie:U==="[object Uint8ClampedArray]"?Q+=Fe:U==="[object Int16Array]"?Q+=ft:U==="[object Uint16Array]"?Q+=Ge:U==="[object Int32Array]"?Q+=dt:U==="[object Uint32Array]"?Q+=jt:U==="[object Float32Array]"?Q+=xt:U==="[object Float64Array]"?Q+=Ze:H(new Error("Failed to get type for BinaryArray"))),H(Q+St(Y))}else if(U==="[object Blob]"){var X=new FileReader;X.onload=function(){var me=mt+D.type+"~"+St(this.result);H(ge+De+me)},X.readAsArrayBuffer(D)}else try{H(JSON.stringify(D))}catch(me){console.error("Couldn't convert value into a JSON string: ",D),H(null,me)}}function st(D){if(D.substring(0,Ae)!==ge)return JSON.parse(D);var H=D.substring(Tt),U=D.substring(Ae,Tt),Y;if(U===De&&_e.test(H)){var Q=H.match(_e);Y=Q[1],H=H.substring(Q[0].length)}var X=nt(H);switch(U){case qe:return X;case De:return l([X],{type:Y});case Oe:return new Int8Array(X);case Ie:return new Uint8Array(X);case Fe:return new Uint8ClampedArray(X);case ft:return new Int16Array(X);case Ge:return new Uint16Array(X);case dt:return new Int32Array(X);case jt:return new Uint32Array(X);case xt:return new Float32Array(X);case Ze:return new Float64Array(X);default:throw new Error("Unkown type: "+U)}}var kt={serialize:At,deserialize:st,stringToBuffer:nt,bufferToString:St};function It(D,H,U,Y){D.executeSql("CREATE TABLE IF NOT EXISTS "+H.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],U,Y)}function it(D){var H=this,U={db:null};if(D)for(var Y in D)U[Y]=typeof D[Y]!="string"?D[Y].toString():D[Y];var Q=new f(function(X,me){try{U.db=openDatabase(U.name,String(U.version),U.description,U.size)}catch(xe){return me(xe)}U.db.transaction(function(xe){It(xe,U,function(){H._dbInfo=U,X()},function(Ce,Me){me(Me)})},me)});return U.serializer=kt,Q}function bt(D,H,U,Y,Q,X){D.executeSql(U,Y,Q,function(me,xe){xe.code===xe.SYNTAX_ERR?me.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[H.storeName],function(Ce,Me){Me.rows.length?X(Ce,xe):It(Ce,H,function(){Ce.executeSql(U,Y,Q,X)},X)},X):X(me,xe)},X)}function Ct(D,H){var U=this;D=b(D);var Y=new f(function(Q,X){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){bt(xe,me,"SELECT * FROM "+me.storeName+" WHERE key = ? LIMIT 1",[D],function(Ce,Me){var Te=Me.rows.length?Me.rows.item(0).value:null;Te&&(Te=me.serializer.deserialize(Te)),Q(Te)},function(Ce,Me){X(Me)})})}).catch(X)});return h(Y,H),Y}function Ye(D,H){var U=this,Y=new f(function(Q,X){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){bt(xe,me,"SELECT * FROM "+me.storeName,[],function(Ce,Me){for(var Te=Me.rows,Ve=Te.length,yt=0;yt<Ve;yt++){var $t=Te.item(yt),Ut=$t.value;if(Ut&&(Ut=me.serializer.deserialize(Ut)),Ut=D(Ut,$t.key,yt+1),Ut!==void 0){Q(Ut);return}}Q()},function(Ce,Me){X(Me)})})}).catch(X)});return h(Y,H),Y}function gt(D,H,U,Y){var Q=this;D=b(D);var X=new f(function(me,xe){Q.ready().then(function(){H===void 0&&(H=null);var Ce=H,Me=Q._dbInfo;Me.serializer.serialize(H,function(Te,Ve){Ve?xe(Ve):Me.db.transaction(function(yt){bt(yt,Me,"INSERT OR REPLACE INTO "+Me.storeName+" (key, value) VALUES (?, ?)",[D,Te],function(){me(Ce)},function($t,Ut){xe(Ut)})},function(yt){if(yt.code===yt.QUOTA_ERR){if(Y>0){me(gt.apply(Q,[D,Ce,U,Y-1]));return}xe(yt)}})})}).catch(xe)});return h(X,U),X}function Pt(D,H,U){return gt.apply(this,[D,H,U,1])}function ot(D,H){var U=this;D=b(D);var Y=new f(function(Q,X){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){bt(xe,me,"DELETE FROM "+me.storeName+" WHERE key = ?",[D],function(){Q()},function(Ce,Me){X(Me)})})}).catch(X)});return h(Y,H),Y}function wt(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var X=H._dbInfo;X.db.transaction(function(me){bt(me,X,"DELETE FROM "+X.storeName,[],function(){Y()},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,D),U}function Ft(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var X=H._dbInfo;X.db.transaction(function(me){bt(me,X,"SELECT COUNT(key) as c FROM "+X.storeName,[],function(xe,Ce){var Me=Ce.rows.item(0).c;Y(Me)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,D),U}function k(D,H){var U=this,Y=new f(function(Q,X){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){bt(xe,me,"SELECT key FROM "+me.storeName+" WHERE id = ? LIMIT 1",[D+1],function(Ce,Me){var Te=Me.rows.length?Me.rows.item(0).key:null;Q(Te)},function(Ce,Me){X(Me)})})}).catch(X)});return h(Y,H),Y}function S(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var X=H._dbInfo;X.db.transaction(function(me){bt(me,X,"SELECT key FROM "+X.storeName,[],function(xe,Ce){for(var Me=[],Te=0;Te<Ce.rows.length;Te++)Me.push(Ce.rows.item(Te).key);Y(Me)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,D),U}function T(D){return new f(function(H,U){D.transaction(function(Y){Y.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,X){for(var me=[],xe=0;xe<X.rows.length;xe++)me.push(X.rows.item(xe).name);H({db:D,storeNames:me})},function(Q,X){U(X)})},function(Y){U(Y)})})}function B(D,H){H=w.apply(this,arguments);var U=this.config();D=typeof D!="function"&&D||{},D.name||(D.name=D.name||U.name,D.storeName=D.storeName||U.storeName);var Y=this,Q;return D.name?Q=new f(function(X){var me;D.name===U.name?me=Y._dbInfo.db:me=openDatabase(D.name,"","",0),D.storeName?X({db:me,storeNames:[D.storeName]}):X(T(me))}).then(function(X){return new f(function(me,xe){X.db.transaction(function(Ce){function Me($t){return new f(function(Ut,ar){Ce.executeSql("DROP TABLE IF EXISTS "+$t,[],function(){Ut()},function(sr,Yr){ar(Yr)})})}for(var Te=[],Ve=0,yt=X.storeNames.length;Ve<yt;Ve++)Te.push(Me(X.storeNames[Ve]));f.all(Te).then(function(){me()}).catch(function($t){xe($t)})},function(Ce){xe(Ce)})})}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var K={_driver:"webSQLStorage",_initStorage:it,_support:ht(),iterate:Ye,getItem:Ct,setItem:Pt,removeItem:ot,clear:wt,length:Ft,key:k,keys:S,dropInstance:B};function Z(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function te(D,H){var U=D.name+"/";return D.storeName!==H.storeName&&(U+=D.storeName+"/"),U}function Be(){var D="_localforage_support_test";try{return localStorage.setItem(D,!0),localStorage.removeItem(D),!1}catch{return!0}}function tt(){return!Be()||localStorage.length>0}function Ne(D){var H=this,U={};if(D)for(var Y in D)U[Y]=D[Y];return U.keyPrefix=te(D,H._defaultConfig),tt()?(H._dbInfo=U,U.serializer=kt,f.resolve()):f.reject()}function z(D){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var X=localStorage.key(Q);X.indexOf(Y)===0&&localStorage.removeItem(X)}});return h(U,D),U}function oe(D,H){var U=this;D=b(D);var Y=U.ready().then(function(){var Q=U._dbInfo,X=localStorage.getItem(Q.keyPrefix+D);return X&&(X=Q.serializer.deserialize(X)),X});return h(Y,H),Y}function he(D,H){var U=this,Y=U.ready().then(function(){for(var Q=U._dbInfo,X=Q.keyPrefix,me=X.length,xe=localStorage.length,Ce=1,Me=0;Me<xe;Me++){var Te=localStorage.key(Me);if(Te.indexOf(X)===0){var Ve=localStorage.getItem(Te);if(Ve&&(Ve=Q.serializer.deserialize(Ve)),Ve=D(Ve,Te.substring(me),Ce++),Ve!==void 0)return Ve}}});return h(Y,H),Y}function ke(D,H){var U=this,Y=U.ready().then(function(){var Q=U._dbInfo,X;try{X=localStorage.key(D)}catch{X=null}return X&&(X=X.substring(Q.keyPrefix.length)),X});return h(Y,H),Y}function He(D){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo,Q=localStorage.length,X=[],me=0;me<Q;me++){var xe=localStorage.key(me);xe.indexOf(Y.keyPrefix)===0&&X.push(xe.substring(Y.keyPrefix.length))}return X});return h(U,D),U}function Re(D){var H=this,U=H.keys().then(function(Y){return Y.length});return h(U,D),U}function ze(D,H){var U=this;D=b(D);var Y=U.ready().then(function(){var Q=U._dbInfo;localStorage.removeItem(Q.keyPrefix+D)});return h(Y,H),Y}function at(D,H,U){var Y=this;D=b(D);var Q=Y.ready().then(function(){H===void 0&&(H=null);var X=H;return new f(function(me,xe){var Ce=Y._dbInfo;Ce.serializer.serialize(H,function(Me,Te){if(Te)xe(Te);else try{localStorage.setItem(Ce.keyPrefix+D,Me),me(X)}catch(Ve){(Ve.name==="QuotaExceededError"||Ve.name==="NS_ERROR_DOM_QUOTA_REACHED")&&xe(Ve),xe(Ve)}})})});return h(Q,U),Q}function Ht(D,H){if(H=w.apply(this,arguments),D=typeof D!="function"&&D||{},!D.name){var U=this.config();D.name=D.name||U.name,D.storeName=D.storeName||U.storeName}var Y=this,Q;return D.name?Q=new f(function(X){D.storeName?X(te(D,Y._defaultConfig)):X(D.name+"/")}).then(function(X){for(var me=localStorage.length-1;me>=0;me--){var xe=localStorage.key(me);xe.indexOf(X)===0&&localStorage.removeItem(xe)}}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var Rt={_driver:"localStorageWrapper",_initStorage:Ne,_support:Z(),iterate:he,getItem:oe,setItem:at,removeItem:ze,clear:z,length:Re,key:ke,keys:He,dropInstance:Ht},Dt=function(H,U){return H===U||typeof H=="number"&&typeof U=="number"&&isNaN(H)&&isNaN(U)},er=function(H,U){for(var Y=H.length,Q=0;Q<Y;){if(Dt(H[Q],U))return!0;Q++}return!1},vr=Array.isArray||function(D){return Object.prototype.toString.call(D)==="[object Array]"},ir={},Kt={},gr={INDEXEDDB:lt,WEBSQL:K,LOCALSTORAGE:Rt},hn=[gr.INDEXEDDB._driver,gr.WEBSQL._driver,gr.LOCALSTORAGE._driver],Dr=["dropInstance"],pn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Dr),ui={description:"",driver:hn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function li(D,H){D[H]=function(){var U=arguments;return D.ready().then(function(){return D[H].apply(D,U)})}}function mn(){for(var D=1;D<arguments.length;D++){var H=arguments[D];if(H)for(var U in H)H.hasOwnProperty(U)&&(vr(H[U])?arguments[0][U]=H[U].slice():arguments[0][U]=H[U])}return arguments[0]}var fi=function(){function D(H){o(this,D);for(var U in gr)if(gr.hasOwnProperty(U)){var Y=gr[U],Q=Y._driver;this[U]=Q,ir[Q]||this.defineDriver(Y)}this._defaultConfig=mn({},ui),this._config=mn({},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 D.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},D.prototype.defineDriver=function(U,Y,Q){var X=new f(function(me,xe){try{var Ce=U._driver,Me=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!U._driver){xe(Me);return}for(var Te=pn.concat("_initStorage"),Ve=0,yt=Te.length;Ve<yt;Ve++){var $t=Te[Ve],Ut=!er(Dr,$t);if((Ut||U[$t])&&typeof U[$t]!="function"){xe(Me);return}}var ar=function(){for(var la=function(D3){return function(){var $3=new Error("Method "+D3+" is not implemented by the current driver"),Y0=f.reject($3);return h(Y0,arguments[arguments.length-1]),Y0}},of=0,N3=Dr.length;of<N3;of++){var af=Dr[of];U[af]||(U[af]=la(af))}};ar();var sr=function(la){ir[Ce]&&console.info("Redefining LocalForage driver: "+Ce),ir[Ce]=U,Kt[Ce]=la,me()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(sr,xe):sr(!!U._support):sr(!0)}catch(Yr){xe(Yr)}});return y(X,Y,Q),X},D.prototype.driver=function(){return this._driver||null},D.prototype.getDriver=function(U,Y,Q){var X=ir[U]?f.resolve(ir[U]):f.reject(new Error("Driver not found."));return y(X,Y,Q),X},D.prototype.getSerializer=function(U){var Y=f.resolve(kt);return y(Y,U),Y},D.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},D.prototype.setDriver=function(U,Y,Q){var X=this;vr(U)||(U=[U]);var me=this._getSupportedDrivers(U);function xe(){X._config.driver=X.driver()}function Ce(Ve){return X._extend(Ve),xe(),X._ready=X._initStorage(X._config),X._ready}function Me(Ve){return function(){var yt=0;function $t(){for(;yt<Ve.length;){var Ut=Ve[yt];return yt++,X._dbInfo=null,X._ready=null,X.getDriver(Ut).then(Ce).catch($t)}xe();var ar=new Error("No available storage method found.");return X._driverSet=f.reject(ar),X._driverSet}return $t()}}var Te=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Te.then(function(){var Ve=me[0];return X._dbInfo=null,X._ready=null,X.getDriver(Ve).then(function(yt){X._driver=yt._driver,xe(),X._wrapLibraryMethodsWithReady(),X._initDriver=Me(me)})}).catch(function(){xe();var Ve=new Error("No available storage method found.");return X._driverSet=f.reject(Ve),X._driverSet}),y(this._driverSet,Y,Q),this._driverSet},D.prototype.supports=function(U){return!!Kt[U]},D.prototype._extend=function(U){mn(this,U)},D.prototype._getSupportedDrivers=function(U){for(var Y=[],Q=0,X=U.length;Q<X;Q++){var me=U[Q];this.supports(me)&&Y.push(me)}return Y},D.prototype._wrapLibraryMethodsWithReady=function(){for(var U=0,Y=pn.length;U<Y;U++)li(this,pn[U])},D.prototype.createInstance=function(U){return new D(U)},D}(),di=new fi;n.exports=di},{3:3}]},{},[4])(4)})})(Q4);var hD=Q4.exports;const Ia=dc(hD);Ia.config({name:"CetusSite",storeName:"tokens"});class Ii{static async setItem(t,r){try{await Ia.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await Ia.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await Ia.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await Ia.clear()}catch(t){console.error("Failed to clear storage",t)}}}const Pl=[{name:"SuiVision",link:"https://suivision.xyz",img:zt("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:zt("/images/logo_suiscan@2x.png"),isCustom:!1}],Uu=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],pD=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],mD="mainnet",gD={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"}},zu=gD[mD],vD=zt("/images/birdeye-logo.png"),yD=zt("/images/img-logo@2x.png"),bD=zt("/images/logo_CoinGecko@2x.png"),wD=zt("/images/logo_pyth.png");var Va=(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.SUILEND="SUILEND",e.BLUEFIN="BLUEFIN",e.HAEDALPMM="HAEDALPMM",e))(Va||{});const e6={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},_D={pyth:wD,coingecko:bD,birdeye:vD,Cetus:yD},yr={CETUS:zt("/images/aggregator-source/cetus.png"),KRIYA:zt("/images/aggregator-source/kriya.png"),FLOWX:zt("/images/aggregator-source/flowx.png"),AFTERMATH:zt("/images/aggregator-source/aftermath.png"),TURBOS:zt("/images/aggregator-source/turbos.png"),HAEDAL:zt("/images/aggregator-source/haedal.png"),VOLO:zt("/images/aggregator-source/volo.png"),AFSUI:zt("/images/aggregator-source/aftermath.png"),BLUEMOVE:zt("/images/aggregator-source/bluemove.png"),KRIYAV3:zt("/images/aggregator-source/kriya.png"),FLOWXV3:zt("/images/aggregator-source/flowx.png"),DEEPBOOKV3:zt("/images/aggregator-source/deepbook.png"),SCALLOP:zt("/images/aggregator-source/scallop.png"),SUILEND:zt("/images/aggregator-source/suilend.png"),BLUEFIN:zt("/images/aggregator-source/bluefin.png"),HAEDALPMM:zt("/images/aggregator-source/haedal.png")},t6={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},SUILEND:{name:"SpringSui",id:"SUILEND",logo:yr.SUILEND,type:"other",sort:60}},Mg=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},xD=e=>e?Mg(e):Mg,SD=e=>e;function ED(e,t=SD){const r=se.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return se.useDebugValue(r),r}const Tg=e=>{const t=xD(e),r=n=>ED(t,n);return Object.assign(r,t),r},Bi=e=>e?Tg(e):Tg;function CD(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 oh=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return oh(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return oh(n)(r)}}}},MD=(e,t)=>(r,n,i)=>{let s={storage:CD(()=>localStorage),partialize:w=>w,version:0,merge:(w,A)=>({...A,...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,A)=>{f(w,A),l()};const h=e((...w)=>{r(...w),l()},n,i);i.getInitialState=()=>h;let y;const b=()=>{var w,A;if(!u)return;o=!1,a.forEach(R=>{var N;return R((N=n())!=null?N:h)});const P=((A=s.onRehydrateStorage)==null?void 0:A.call(s,(w=n())!=null?w:h))||void 0;return oh(u.getItem.bind(u))(s.name).then(R=>{if(R)if(typeof R.version=="number"&&R.version!==s.version){if(s.migrate){const N=s.migrate(R.state,R.version);return N instanceof Promise?N.then(F=>[!0,F]):[!0,N]}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 N;const[F,L]=R;if(y=s.merge(L,(N=n())!=null?N:h),r(y,!0),F)return l()}).then(()=>{P==null||P(y,void 0),y=n(),o=!0,c.forEach(R=>R(y))}).catch(R=>{P==null||P(void 0,R)})};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},TD=MD,AD=(e,t)=>({currentExplorer:Pl[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:Uu,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:Uu[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(Va),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}))}}),Xr=Bi(TD(AD,{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o}}}));function Qo(){const{currentExplorer:e}=Xr();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${ID(n)}/${r}`:s=`${i}/${OD(n)}/${r}`,s}}}const OD=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"}},ID=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 r6(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 n6={exports:{}};/*!
|
|
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 Gn=="function"&&Gn;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 Gn=="function"&&Gn,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 A=s.document.createElement("script");A.onreadystatechange=function(){b(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},s.document.documentElement.appendChild(A)}:a=function(){setTimeout(b,0)};var h,y=[];function b(){h=!0;for(var A,P,R=y.length;R;){for(P=y,y=[],A=-1;++A<R;)P[A]();R=y.length}h=!1}n.exports=w;function w(A){y.push(A)===1&&!h&&a()}}).call(this,typeof Rr<"u"?Rr: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 J=this.state===u?L:G;y(q,J,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 J;try{J=G(q)}catch(ne){return a.reject(L,ne)}J===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,J)})}a.resolve=function(L,G){var q=A(b,G);if(q.status==="error")return a.reject(L,q.value);var J=q.value;if(J)w(L,J);else{L.state=u,L.outcome=G;for(var ne=-1,ae=L.queue.length;++ne<ae;)L.queue[ne].callFulfilled(G)}return L},a.reject=function(L,G){L.state=c,L.outcome=G;for(var q=-1,J=L.queue.length;++q<J;)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 J(V){q||(q=!0,a.reject(L,V))}function ne(V){q||(q=!0,a.resolve(L,V))}function ae(){G(ne,J)}var ce=A(ae);ce.status==="error"&&J(ce.value)}function A(L,G){var q={};try{q.value=L(G),q.status="success"}catch(J){q.status="error",q.value=J}return q}f.resolve=P;function P(L){return L instanceof this?L:a.resolve(new this(o),L)}f.reject=R;function R(L){var G=new this(o);return a.reject(G,L)}f.all=N;function N(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,J=!1;if(!q)return this.resolve([]);for(var ne=new Array(q),ae=0,ce=-1,V=new this(o);++ce<q;)$(L[ce],ce);return V;function $(p,d){G.resolve(p).then(m,function(x){J||(J=!0,a.reject(V,x))});function m(x){ne[d]=x,++ae===q&&!J&&(J=!0,a.resolve(V,ne))}}}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,J=!1;if(!q)return this.resolve([]);for(var ne=-1,ae=new this(o);++ne<q;)ce(L[ne]);return ae;function ce(V){G.resolve(V).then(function($){J||(J=!0,a.resolve(ae,$))},function($){J||(J=!0,a.reject(ae,$))})}}},{1:1}],3:[function(r,n,i){(function(s){typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof Rr<"u"?Rr: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(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D};function o(D,H){if(!(D 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 D=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(!D||H)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l(D,H){D=D||[],H=H||{};try{return new Blob(D,H)}catch(X){if(X.name!=="TypeError")throw X;for(var U=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,Y=new U,Q=0;Q<D.length;Q+=1)Y.append(D[Q]);return Y.getBlob(H.type)}}typeof Promise>"u"&&r(3);var f=Promise;function h(D,H){H&&D.then(function(U){H(null,U)},function(U){H(U)})}function y(D,H,U){typeof H=="function"&&D.then(H),typeof U=="function"&&D.catch(U)}function b(D){return typeof D!="string"&&(console.warn(D+" used as a key, but it is not a string."),D=String(D)),D}function w(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var A="local-forage-detect-blob-support",P=void 0,R={},N=Object.prototype.toString,F="readonly",L="readwrite";function G(D){for(var H=D.length,U=new ArrayBuffer(H),Y=new Uint8Array(U),Q=0;Q<H;Q++)Y[Q]=D.charCodeAt(Q);return U}function q(D){return new f(function(H){var U=D.transaction(A,L),Y=l([""]);U.objectStore(A).put(Y,"key"),U.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),H(!1)},U.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),X=navigator.userAgent.match(/Edge\//);H(X||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function J(D){return typeof P=="boolean"?f.resolve(P):q(D).then(function(H){return P=H,P})}function ne(D){var H=R[D.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(D){var H=R[D.name],U=H.deferredOperations.pop();if(U)return U.resolve(),U.promise}function ce(D,H){var U=R[D.name],Y=U.deferredOperations.pop();if(Y)return Y.reject(H),Y.promise}function V(D,H){return new f(function(U,Y){if(R[D.name]=R[D.name]||g(),D.db)if(H)ne(D),D.db.close();else return U(D.db);var Q=[D.name];H&&Q.push(D.version);var X=c.open.apply(c,Q);H&&(X.onupgradeneeded=function(me){var xe=X.result;try{xe.createObjectStore(D.storeName),me.oldVersion<=1&&xe.createObjectStore(A)}catch(Ce){if(Ce.name==="ConstraintError")console.warn('The database "'+D.name+'" has been upgraded from version '+me.oldVersion+" to version "+me.newVersion+', but the storage "'+D.storeName+'" already exists.');else throw Ce}}),X.onerror=function(me){me.preventDefault(),Y(X.error)},X.onsuccess=function(){var me=X.result;me.onversionchange=function(xe){xe.target.close()},U(me),ae(D)}})}function $(D){return V(D,!1)}function p(D){return V(D,!0)}function d(D,H){if(!D.db)return!0;var U=!D.db.objectStoreNames.contains(D.storeName),Y=D.version<D.db.version,Q=D.version>D.db.version;if(Y&&(D.version!==H&&console.warn('The database "'+D.name+`" can't be downgraded from version `+D.db.version+" to version "+D.version+"."),D.version=D.db.version),Q||U){if(U){var X=D.db.version+1;X>D.version&&(D.version=X)}return!0}return!1}function m(D){return new f(function(H,U){var Y=new FileReader;Y.onerror=U,Y.onloadend=function(Q){var X=btoa(Q.target.result||"");H({__local_forage_encoded_blob:!0,data:X,type:D.type})},Y.readAsBinaryString(D)})}function x(D){var H=G(atob(D.data));return l([H],{type:D.type})}function M(D){return D&&D.__local_forage_encoded_blob}function E(D){var H=this,U=H._initReady().then(function(){var Y=R[H._dbInfo.name];if(Y&&Y.dbReady)return Y.dbReady});return y(U,D,D),U}function O(D){ne(D);for(var H=R[D.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 D.db=null,$(D).then(function(X){return D.db=X,d(D)?p(D):X}).then(function(X){D.db=H.db=X;for(var me=0;me<U.length;me++)U[me]._dbInfo.db=X}).catch(function(X){throw ce(D,X),X})}function C(D,H,U,Y){Y===void 0&&(Y=1);try{var Q=D.db.transaction(D.storeName,H);U(null,Q)}catch(X){if(Y>0&&(!D.db||X.name==="InvalidStateError"||X.name==="NotFoundError"))return f.resolve().then(function(){if(!D.db||X.name==="NotFoundError"&&!D.db.objectStoreNames.contains(D.storeName)&&D.version<=D.db.version)return D.db&&(D.version=D.db.version+1),p(D)}).then(function(){return O(D).then(function(){C(D,H,U,Y-1)})}).catch(U);U(X)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v(D){var H=this,U={db:null};if(D)for(var Y in D)U[Y]=D[Y];var Q=R[U.name];Q||(Q=g(),R[U.name]=Q),Q.forages.push(H),H._initReady||(H._initReady=H.ready,H.ready=E);var X=[];function me(){return f.resolve()}for(var xe=0;xe<Q.forages.length;xe++){var Ce=Q.forages[xe];Ce!==H&&X.push(Ce._initReady().catch(me))}var Me=Q.forages.slice(0);return f.all(X).then(function(){return U.db=Q.db,$(U)}).then(function(Te){return U.db=Te,d(U,H._defaultConfig.version)?p(U):Te}).then(function(Te){U.db=Q.db=Te,H._dbInfo=U;for(var Ve=0;Ve<Me.length;Ve++){var yt=Me[Ve];yt!==H&&(yt._dbInfo.db=U.db,yt._dbInfo.version=U.version)}})}function j(D,H){var U=this;D=b(D);var Y=new f(function(Q,X){U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return X(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=Ce.get(D);Me.onsuccess=function(){var Te=Me.result;Te===void 0&&(Te=null),M(Te)&&(Te=x(Te)),Q(Te)},Me.onerror=function(){X(Me.error)}}catch(Te){X(Te)}})}).catch(X)});return h(Y,H),Y}function ee(D,H){var U=this,Y=new f(function(Q,X){U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return X(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=Ce.openCursor(),Te=1;Me.onsuccess=function(){var Ve=Me.result;if(Ve){var yt=Ve.value;M(yt)&&(yt=x(yt));var $t=D(yt,Ve.key,Te++);$t!==void 0?Q($t):Ve.continue()}else Q()},Me.onerror=function(){X(Me.error)}}catch(Ve){X(Ve)}})}).catch(X)});return h(Y,H),Y}function ie(D,H,U){var Y=this;D=b(D);var Q=new f(function(X,me){var xe;Y.ready().then(function(){return xe=Y._dbInfo,N.call(H)==="[object Blob]"?J(xe.db).then(function(Ce){return Ce?H:m(H)}):H}).then(function(Ce){C(Y._dbInfo,L,function(Me,Te){if(Me)return me(Me);try{var Ve=Te.objectStore(Y._dbInfo.storeName);Ce===null&&(Ce=void 0);var yt=Ve.put(Ce,D);Te.oncomplete=function(){Ce===void 0&&(Ce=null),X(Ce)},Te.onabort=Te.onerror=function(){var $t=yt.error?yt.error:yt.transaction.error;me($t)}}catch($t){me($t)}})}).catch(me)});return h(Q,U),Q}function ve(D,H){var U=this;D=b(D);var Y=new f(function(Q,X){U.ready().then(function(){C(U._dbInfo,L,function(me,xe){if(me)return X(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=Ce.delete(D);xe.oncomplete=function(){Q()},xe.onerror=function(){X(Me.error)},xe.onabort=function(){var Te=Me.error?Me.error:Me.transaction.error;X(Te)}}catch(Te){X(Te)}})}).catch(X)});return h(Y,H),Y}function pe(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,L,function(X,me){if(X)return Q(X);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.clear();me.oncomplete=function(){Y()},me.onabort=me.onerror=function(){var Me=Ce.error?Ce.error:Ce.transaction.error;Q(Me)}}catch(Me){Q(Me)}})}).catch(Q)});return h(U,D),U}function Ee(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(X,me){if(X)return Q(X);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.count();Ce.onsuccess=function(){Y(Ce.result)},Ce.onerror=function(){Q(Ce.error)}}catch(Me){Q(Me)}})}).catch(Q)});return h(U,D),U}function Se(D,H){var U=this,Y=new f(function(Q,X){if(D<0){Q(null);return}U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return X(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=!1,Te=Ce.openKeyCursor();Te.onsuccess=function(){var Ve=Te.result;if(!Ve){Q(null);return}D===0||Me?Q(Ve.key):(Me=!0,Ve.advance(D))},Te.onerror=function(){X(Te.error)}}catch(Ve){X(Ve)}})}).catch(X)});return h(Y,H),Y}function Ke(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(X,me){if(X)return Q(X);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.openKeyCursor(),Me=[];Ce.onsuccess=function(){var Te=Ce.result;if(!Te){Y(Me);return}Me.push(Te.key),Te.continue()},Ce.onerror=function(){Q(Ce.error)}}catch(Te){Q(Te)}})}).catch(Q)});return h(U,D),U}function Ue(D,H){H=w.apply(this,arguments);var U=this.config();D=typeof D!="function"&&D||{},D.name||(D.name=D.name||U.name,D.storeName=D.storeName||U.storeName);var Y=this,Q;if(!D.name)Q=f.reject("Invalid arguments");else{var X=D.name===U.name&&Y._dbInfo.db,me=X?f.resolve(Y._dbInfo.db):$(D).then(function(xe){var Ce=R[D.name],Me=Ce.forages;Ce.db=xe;for(var Te=0;Te<Me.length;Te++)Me[Te]._dbInfo.db=xe;return xe});D.storeName?Q=me.then(function(xe){if(xe.objectStoreNames.contains(D.storeName)){var Ce=xe.version+1;ne(D);var Me=R[D.name],Te=Me.forages;xe.close();for(var Ve=0;Ve<Te.length;Ve++){var yt=Te[Ve];yt._dbInfo.db=null,yt._dbInfo.version=Ce}var $t=new f(function(Ut,ar){var sr=c.open(D.name,Ce);sr.onerror=function(Yr){var la=sr.result;la.close(),ar(Yr)},sr.onupgradeneeded=function(){var Yr=sr.result;Yr.deleteObjectStore(D.storeName)},sr.onsuccess=function(){var Yr=sr.result;Yr.close(),Ut(Yr)}});return $t.then(function(Ut){Me.db=Ut;for(var ar=0;ar<Te.length;ar++){var sr=Te[ar];sr._dbInfo.db=Ut,ae(sr._dbInfo)}}).catch(function(Ut){throw(ce(D,Ut)||f.resolve()).catch(function(){}),Ut})}}):Q=me.then(function(xe){ne(D);var Ce=R[D.name],Me=Ce.forages;xe.close();for(var Te=0;Te<Me.length;Te++){var Ve=Me[Te];Ve._dbInfo.db=null}var yt=new f(function($t,Ut){var ar=c.deleteDatabase(D.name);ar.onerror=function(){var sr=ar.result;sr&&sr.close(),Ut(ar.error)},ar.onblocked=function(){console.warn('dropInstance blocked for database "'+D.name+'" until all open connections are closed')},ar.onsuccess=function(){var sr=ar.result;sr&&sr.close(),$t(sr)}});return yt.then(function($t){Ce.db=$t;for(var Ut=0;Ut<Me.length;Ut++){var ar=Me[Ut];ae(ar._dbInfo)}}).catch(function($t){throw(ce(D,$t)||f.resolve()).catch(function(){}),$t})})}return h(Q,H),Q}var lt={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:ee,getItem:j,setItem:ie,removeItem:ve,clear:pe,length:Ee,key:Se,keys:Ke,dropInstance:Ue};function ht(){return typeof openDatabase=="function"}var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",_e=/^~~local_forage_type~([^~]+)~/,ge="__lfsc__:",Ae=ge.length,qe="arbf",De="blob",Oe="si08",Ie="ui08",Fe="uic8",ft="si16",dt="si32",Ge="ur16",jt="ui32",xt="fl32",Ze="fl64",Tt=Ae+qe.length,Nt=Object.prototype.toString;function nt(D){var H=D.length*.75,U=D.length,Y,Q=0,X,me,xe,Ce;D[D.length-1]==="="&&(H--,D[D.length-2]==="="&&H--);var Me=new ArrayBuffer(H),Te=new Uint8Array(Me);for(Y=0;Y<U;Y+=4)X=$e.indexOf(D[Y]),me=$e.indexOf(D[Y+1]),xe=$e.indexOf(D[Y+2]),Ce=$e.indexOf(D[Y+3]),Te[Q++]=X<<2|me>>4,Te[Q++]=(me&15)<<4|xe>>2,Te[Q++]=(xe&3)<<6|Ce&63;return Me}function St(D){var H=new Uint8Array(D),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 At(D,H){var U="";if(D&&(U=Nt.call(D)),D&&(U==="[object ArrayBuffer]"||D.buffer&&Nt.call(D.buffer)==="[object ArrayBuffer]")){var Y,Q=ge;D instanceof ArrayBuffer?(Y=D,Q+=qe):(Y=D.buffer,U==="[object Int8Array]"?Q+=Oe:U==="[object Uint8Array]"?Q+=Ie:U==="[object Uint8ClampedArray]"?Q+=Fe:U==="[object Int16Array]"?Q+=ft:U==="[object Uint16Array]"?Q+=Ge:U==="[object Int32Array]"?Q+=dt:U==="[object Uint32Array]"?Q+=jt:U==="[object Float32Array]"?Q+=xt:U==="[object Float64Array]"?Q+=Ze:H(new Error("Failed to get type for BinaryArray"))),H(Q+St(Y))}else if(U==="[object Blob]"){var X=new FileReader;X.onload=function(){var me=mt+D.type+"~"+St(this.result);H(ge+De+me)},X.readAsArrayBuffer(D)}else try{H(JSON.stringify(D))}catch(me){console.error("Couldn't convert value into a JSON string: ",D),H(null,me)}}function st(D){if(D.substring(0,Ae)!==ge)return JSON.parse(D);var H=D.substring(Tt),U=D.substring(Ae,Tt),Y;if(U===De&&_e.test(H)){var Q=H.match(_e);Y=Q[1],H=H.substring(Q[0].length)}var X=nt(H);switch(U){case qe:return X;case De:return l([X],{type:Y});case Oe:return new Int8Array(X);case Ie:return new Uint8Array(X);case Fe:return new Uint8ClampedArray(X);case ft:return new Int16Array(X);case Ge:return new Uint16Array(X);case dt:return new Int32Array(X);case jt:return new Uint32Array(X);case xt:return new Float32Array(X);case Ze:return new Float64Array(X);default:throw new Error("Unkown type: "+U)}}var kt={serialize:At,deserialize:st,stringToBuffer:nt,bufferToString:St};function It(D,H,U,Y){D.executeSql("CREATE TABLE IF NOT EXISTS "+H.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],U,Y)}function it(D){var H=this,U={db:null};if(D)for(var Y in D)U[Y]=typeof D[Y]!="string"?D[Y].toString():D[Y];var Q=new f(function(X,me){try{U.db=openDatabase(U.name,String(U.version),U.description,U.size)}catch(xe){return me(xe)}U.db.transaction(function(xe){It(xe,U,function(){H._dbInfo=U,X()},function(Ce,Me){me(Me)})},me)});return U.serializer=kt,Q}function bt(D,H,U,Y,Q,X){D.executeSql(U,Y,Q,function(me,xe){xe.code===xe.SYNTAX_ERR?me.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[H.storeName],function(Ce,Me){Me.rows.length?X(Ce,xe):It(Ce,H,function(){Ce.executeSql(U,Y,Q,X)},X)},X):X(me,xe)},X)}function Ct(D,H){var U=this;D=b(D);var Y=new f(function(Q,X){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){bt(xe,me,"SELECT * FROM "+me.storeName+" WHERE key = ? LIMIT 1",[D],function(Ce,Me){var Te=Me.rows.length?Me.rows.item(0).value:null;Te&&(Te=me.serializer.deserialize(Te)),Q(Te)},function(Ce,Me){X(Me)})})}).catch(X)});return h(Y,H),Y}function Ye(D,H){var U=this,Y=new f(function(Q,X){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){bt(xe,me,"SELECT * FROM "+me.storeName,[],function(Ce,Me){for(var Te=Me.rows,Ve=Te.length,yt=0;yt<Ve;yt++){var $t=Te.item(yt),Ut=$t.value;if(Ut&&(Ut=me.serializer.deserialize(Ut)),Ut=D(Ut,$t.key,yt+1),Ut!==void 0){Q(Ut);return}}Q()},function(Ce,Me){X(Me)})})}).catch(X)});return h(Y,H),Y}function gt(D,H,U,Y){var Q=this;D=b(D);var X=new f(function(me,xe){Q.ready().then(function(){H===void 0&&(H=null);var Ce=H,Me=Q._dbInfo;Me.serializer.serialize(H,function(Te,Ve){Ve?xe(Ve):Me.db.transaction(function(yt){bt(yt,Me,"INSERT OR REPLACE INTO "+Me.storeName+" (key, value) VALUES (?, ?)",[D,Te],function(){me(Ce)},function($t,Ut){xe(Ut)})},function(yt){if(yt.code===yt.QUOTA_ERR){if(Y>0){me(gt.apply(Q,[D,Ce,U,Y-1]));return}xe(yt)}})})}).catch(xe)});return h(X,U),X}function Pt(D,H,U){return gt.apply(this,[D,H,U,1])}function ot(D,H){var U=this;D=b(D);var Y=new f(function(Q,X){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){bt(xe,me,"DELETE FROM "+me.storeName+" WHERE key = ?",[D],function(){Q()},function(Ce,Me){X(Me)})})}).catch(X)});return h(Y,H),Y}function wt(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var X=H._dbInfo;X.db.transaction(function(me){bt(me,X,"DELETE FROM "+X.storeName,[],function(){Y()},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,D),U}function Ft(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var X=H._dbInfo;X.db.transaction(function(me){bt(me,X,"SELECT COUNT(key) as c FROM "+X.storeName,[],function(xe,Ce){var Me=Ce.rows.item(0).c;Y(Me)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,D),U}function k(D,H){var U=this,Y=new f(function(Q,X){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){bt(xe,me,"SELECT key FROM "+me.storeName+" WHERE id = ? LIMIT 1",[D+1],function(Ce,Me){var Te=Me.rows.length?Me.rows.item(0).key:null;Q(Te)},function(Ce,Me){X(Me)})})}).catch(X)});return h(Y,H),Y}function S(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var X=H._dbInfo;X.db.transaction(function(me){bt(me,X,"SELECT key FROM "+X.storeName,[],function(xe,Ce){for(var Me=[],Te=0;Te<Ce.rows.length;Te++)Me.push(Ce.rows.item(Te).key);Y(Me)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,D),U}function T(D){return new f(function(H,U){D.transaction(function(Y){Y.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,X){for(var me=[],xe=0;xe<X.rows.length;xe++)me.push(X.rows.item(xe).name);H({db:D,storeNames:me})},function(Q,X){U(X)})},function(Y){U(Y)})})}function B(D,H){H=w.apply(this,arguments);var U=this.config();D=typeof D!="function"&&D||{},D.name||(D.name=D.name||U.name,D.storeName=D.storeName||U.storeName);var Y=this,Q;return D.name?Q=new f(function(X){var me;D.name===U.name?me=Y._dbInfo.db:me=openDatabase(D.name,"","",0),D.storeName?X({db:me,storeNames:[D.storeName]}):X(T(me))}).then(function(X){return new f(function(me,xe){X.db.transaction(function(Ce){function Me($t){return new f(function(Ut,ar){Ce.executeSql("DROP TABLE IF EXISTS "+$t,[],function(){Ut()},function(sr,Yr){ar(Yr)})})}for(var Te=[],Ve=0,yt=X.storeNames.length;Ve<yt;Ve++)Te.push(Me(X.storeNames[Ve]));f.all(Te).then(function(){me()}).catch(function($t){xe($t)})},function(Ce){xe(Ce)})})}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var K={_driver:"webSQLStorage",_initStorage:it,_support:ht(),iterate:Ye,getItem:Ct,setItem:Pt,removeItem:ot,clear:wt,length:Ft,key:k,keys:S,dropInstance:B};function Z(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function te(D,H){var U=D.name+"/";return D.storeName!==H.storeName&&(U+=D.storeName+"/"),U}function Be(){var D="_localforage_support_test";try{return localStorage.setItem(D,!0),localStorage.removeItem(D),!1}catch{return!0}}function tt(){return!Be()||localStorage.length>0}function Ne(D){var H=this,U={};if(D)for(var Y in D)U[Y]=D[Y];return U.keyPrefix=te(D,H._defaultConfig),tt()?(H._dbInfo=U,U.serializer=kt,f.resolve()):f.reject()}function z(D){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var X=localStorage.key(Q);X.indexOf(Y)===0&&localStorage.removeItem(X)}});return h(U,D),U}function oe(D,H){var U=this;D=b(D);var Y=U.ready().then(function(){var Q=U._dbInfo,X=localStorage.getItem(Q.keyPrefix+D);return X&&(X=Q.serializer.deserialize(X)),X});return h(Y,H),Y}function he(D,H){var U=this,Y=U.ready().then(function(){for(var Q=U._dbInfo,X=Q.keyPrefix,me=X.length,xe=localStorage.length,Ce=1,Me=0;Me<xe;Me++){var Te=localStorage.key(Me);if(Te.indexOf(X)===0){var Ve=localStorage.getItem(Te);if(Ve&&(Ve=Q.serializer.deserialize(Ve)),Ve=D(Ve,Te.substring(me),Ce++),Ve!==void 0)return Ve}}});return h(Y,H),Y}function ke(D,H){var U=this,Y=U.ready().then(function(){var Q=U._dbInfo,X;try{X=localStorage.key(D)}catch{X=null}return X&&(X=X.substring(Q.keyPrefix.length)),X});return h(Y,H),Y}function He(D){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo,Q=localStorage.length,X=[],me=0;me<Q;me++){var xe=localStorage.key(me);xe.indexOf(Y.keyPrefix)===0&&X.push(xe.substring(Y.keyPrefix.length))}return X});return h(U,D),U}function Re(D){var H=this,U=H.keys().then(function(Y){return Y.length});return h(U,D),U}function ze(D,H){var U=this;D=b(D);var Y=U.ready().then(function(){var Q=U._dbInfo;localStorage.removeItem(Q.keyPrefix+D)});return h(Y,H),Y}function at(D,H,U){var Y=this;D=b(D);var Q=Y.ready().then(function(){H===void 0&&(H=null);var X=H;return new f(function(me,xe){var Ce=Y._dbInfo;Ce.serializer.serialize(H,function(Me,Te){if(Te)xe(Te);else try{localStorage.setItem(Ce.keyPrefix+D,Me),me(X)}catch(Ve){(Ve.name==="QuotaExceededError"||Ve.name==="NS_ERROR_DOM_QUOTA_REACHED")&&xe(Ve),xe(Ve)}})})});return h(Q,U),Q}function Ht(D,H){if(H=w.apply(this,arguments),D=typeof D!="function"&&D||{},!D.name){var U=this.config();D.name=D.name||U.name,D.storeName=D.storeName||U.storeName}var Y=this,Q;return D.name?Q=new f(function(X){D.storeName?X(te(D,Y._defaultConfig)):X(D.name+"/")}).then(function(X){for(var me=localStorage.length-1;me>=0;me--){var xe=localStorage.key(me);xe.indexOf(X)===0&&localStorage.removeItem(xe)}}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var Rt={_driver:"localStorageWrapper",_initStorage:Ne,_support:Z(),iterate:he,getItem:oe,setItem:at,removeItem:ze,clear:z,length:Re,key:ke,keys:He,dropInstance:Ht},Dt=function(H,U){return H===U||typeof H=="number"&&typeof U=="number"&&isNaN(H)&&isNaN(U)},er=function(H,U){for(var Y=H.length,Q=0;Q<Y;){if(Dt(H[Q],U))return!0;Q++}return!1},yr=Array.isArray||function(D){return Object.prototype.toString.call(D)==="[object Array]"},ir={},Kt={},gr={INDEXEDDB:lt,WEBSQL:K,LOCALSTORAGE:Rt},pn=[gr.INDEXEDDB._driver,gr.WEBSQL._driver,gr.LOCALSTORAGE._driver],Dr=["dropInstance"],mn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Dr),ui={description:"",driver:pn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function li(D,H){D[H]=function(){var U=arguments;return D.ready().then(function(){return D[H].apply(D,U)})}}function gn(){for(var D=1;D<arguments.length;D++){var H=arguments[D];if(H)for(var U in H)H.hasOwnProperty(U)&&(yr(H[U])?arguments[0][U]=H[U].slice():arguments[0][U]=H[U])}return arguments[0]}var fi=function(){function D(H){o(this,D);for(var U in gr)if(gr.hasOwnProperty(U)){var Y=gr[U],Q=Y._driver;this[U]=Q,ir[Q]||this.defineDriver(Y)}this._defaultConfig=gn({},ui),this._config=gn({},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 D.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},D.prototype.defineDriver=function(U,Y,Q){var X=new f(function(me,xe){try{var Ce=U._driver,Me=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!U._driver){xe(Me);return}for(var Te=mn.concat("_initStorage"),Ve=0,yt=Te.length;Ve<yt;Ve++){var $t=Te[Ve],Ut=!er(Dr,$t);if((Ut||U[$t])&&typeof U[$t]!="function"){xe(Me);return}}var ar=function(){for(var la=function(B3){return function(){var L3=new Error("Method "+B3+" is not implemented by the current driver"),Z0=f.reject(L3);return h(Z0,arguments[arguments.length-1]),Z0}},uf=0,$3=Dr.length;uf<$3;uf++){var lf=Dr[uf];U[lf]||(U[lf]=la(lf))}};ar();var sr=function(la){ir[Ce]&&console.info("Redefining LocalForage driver: "+Ce),ir[Ce]=U,Kt[Ce]=la,me()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(sr,xe):sr(!!U._support):sr(!0)}catch(Yr){xe(Yr)}});return y(X,Y,Q),X},D.prototype.driver=function(){return this._driver||null},D.prototype.getDriver=function(U,Y,Q){var X=ir[U]?f.resolve(ir[U]):f.reject(new Error("Driver not found."));return y(X,Y,Q),X},D.prototype.getSerializer=function(U){var Y=f.resolve(kt);return y(Y,U),Y},D.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},D.prototype.setDriver=function(U,Y,Q){var X=this;yr(U)||(U=[U]);var me=this._getSupportedDrivers(U);function xe(){X._config.driver=X.driver()}function Ce(Ve){return X._extend(Ve),xe(),X._ready=X._initStorage(X._config),X._ready}function Me(Ve){return function(){var yt=0;function $t(){for(;yt<Ve.length;){var Ut=Ve[yt];return yt++,X._dbInfo=null,X._ready=null,X.getDriver(Ut).then(Ce).catch($t)}xe();var ar=new Error("No available storage method found.");return X._driverSet=f.reject(ar),X._driverSet}return $t()}}var Te=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Te.then(function(){var Ve=me[0];return X._dbInfo=null,X._ready=null,X.getDriver(Ve).then(function(yt){X._driver=yt._driver,xe(),X._wrapLibraryMethodsWithReady(),X._initDriver=Me(me)})}).catch(function(){xe();var Ve=new Error("No available storage method found.");return X._driverSet=f.reject(Ve),X._driverSet}),y(this._driverSet,Y,Q),this._driverSet},D.prototype.supports=function(U){return!!Kt[U]},D.prototype._extend=function(U){gn(this,U)},D.prototype._getSupportedDrivers=function(U){for(var Y=[],Q=0,X=U.length;Q<X;Q++){var me=U[Q];this.supports(me)&&Y.push(me)}return Y},D.prototype._wrapLibraryMethodsWithReady=function(){for(var U=0,Y=mn.length;U<Y;U++)li(this,mn[U])},D.prototype.createInstance=function(U){return new D(U)},D}(),di=new fi;n.exports=di},{3:3}]},{},[4])(4)})})(e6);var mD=e6.exports;const Ia=hc(mD);Ia.config({name:"CetusSite",storeName:"tokens"});class Ii{static async setItem(t,r){try{await Ia.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await Ia.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await Ia.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await Ia.clear()}catch(t){console.error("Failed to clear storage",t)}}}const jl=[{name:"SuiVision",link:"https://suivision.xyz",img:zt("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:zt("/images/logo_suiscan@2x.png"),isCustom:!1}],zu=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],gD=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],vD="mainnet",yD={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"}},Vu=yD[vD],bD=zt("/images/birdeye-logo.png"),wD=zt("/images/img-logo@2x.png"),_D=zt("/images/logo_CoinGecko@2x.png"),xD=zt("/images/logo_pyth.png");var Va=(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.SUILEND="SUILEND",e.BLUEFIN="BLUEFIN",e.HAEDALPMM="HAEDALPMM",e))(Va||{});const t6={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},SD={pyth:xD,coingecko:_D,birdeye:bD,Cetus:wD},vr={CETUS:zt("/images/aggregator-source/cetus.png"),KRIYA:zt("/images/aggregator-source/kriya.png"),FLOWX:zt("/images/aggregator-source/flowx.png"),AFTERMATH:zt("/images/aggregator-source/aftermath.png"),TURBOS:zt("/images/aggregator-source/turbos.png"),HAEDAL:zt("/images/aggregator-source/haedal.png"),VOLO:zt("/images/aggregator-source/volo.png"),AFSUI:zt("/images/aggregator-source/aftermath.png"),BLUEMOVE:zt("/images/aggregator-source/bluemove.png"),KRIYAV3:zt("/images/aggregator-source/kriya.png"),FLOWXV3:zt("/images/aggregator-source/flowx.png"),DEEPBOOKV3:zt("/images/aggregator-source/deepbook.png"),SCALLOP:zt("/images/aggregator-source/scallop.png"),SUILEND:zt("/images/aggregator-source/suilend.png"),BLUEFIN:zt("/images/aggregator-source/bluefin.png"),HAEDALPMM:zt("/images/aggregator-source/haedal.png")},r6={CETUS:{name:"Cetus",id:"CETUS",logo:vr.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:vr.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:vr.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:vr.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:vr.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:vr.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:vr.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:vr.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:vr.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:vr.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:vr.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:vr.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:vr.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:vr.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:vr.SCALLOP,type:"other",sort:70},SUILEND:{name:"SpringSui",id:"SUILEND",logo:vr.SUILEND,type:"other",sort:60}},Tg=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},ED=e=>e?Tg(e):Tg,CD=e=>e;function MD(e,t=CD){const r=se.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return se.useDebugValue(r),r}const Ag=e=>{const t=ED(e),r=n=>MD(t,n);return Object.assign(r,t),r},Bi=e=>e?Ag(e):Ag;function TD(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 uh=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return uh(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return uh(n)(r)}}}},AD=(e,t)=>(r,n,i)=>{let s={storage:TD(()=>localStorage),partialize:w=>w,version:0,merge:(w,A)=>({...A,...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,A)=>{f(w,A),l()};const h=e((...w)=>{r(...w),l()},n,i);i.getInitialState=()=>h;let y;const b=()=>{var w,A;if(!u)return;o=!1,a.forEach(R=>{var N;return R((N=n())!=null?N:h)});const P=((A=s.onRehydrateStorage)==null?void 0:A.call(s,(w=n())!=null?w:h))||void 0;return uh(u.getItem.bind(u))(s.name).then(R=>{if(R)if(typeof R.version=="number"&&R.version!==s.version){if(s.migrate){const N=s.migrate(R.state,R.version);return N instanceof Promise?N.then(F=>[!0,F]):[!0,N]}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 N;const[F,L]=R;if(y=s.merge(L,(N=n())!=null?N:h),r(y,!0),F)return l()}).then(()=>{P==null||P(y,void 0),y=n(),o=!0,c.forEach(R=>R(y))}).catch(R=>{P==null||P(void 0,R)})};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},OD=AD,ID=(e,t)=>({currentExplorer:jl[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:zu,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:zu[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(Va),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}))}}),Xr=Bi(OD(ID,{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o}}}));function Qo(){const{currentExplorer:e}=Xr();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${jD(n)}/${r}`:s=`${i}/${PD(n)}/${r}`,s}}}const PD=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"}},jD=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 n6(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 i6={exports:{}};/*!
|
|
50
50
|
Copyright (c) 2018 Jed Watson.
|
|
51
51
|
Licensed under the MIT License (MIT), see
|
|
52
52
|
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})()})(n6);var PD=n6.exports;const Xt=dc(PD);function rt(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 jD(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function jl(...e){return t=>e.forEach(r=>jD(r,t))}function Zt(...e){return I.useCallback(jl(...e),e)}function ea(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,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,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,kD(i,...t)]}function kD(...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 ki=I.forwardRef((e,t)=>{const{children:r,...n}=e,i=I.Children.toArray(r),s=i.find(RD);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(ah,{...n,ref:t,children:I.isValidElement(o)?I.cloneElement(o,void 0,a):null})}return _.jsx(ah,{...n,ref:t,children:r})});ki.displayName="Slot";var ah=I.forwardRef((e,t)=>{const{children:r,...n}=e;if(I.isValidElement(r)){const i=DD(r);return I.cloneElement(r,{...ND(n,r.props),ref:t?jl(t,i):i})}return I.Children.count(r)>1?I.Children.only(null):null});ah.displayName="SlotClone";var ta=({children:e})=>_.jsx(_.Fragment,{children:e});function RD(e){return I.isValidElement(e)&&e.type===ta}function ND(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 DD(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 $D=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Gt=$D.reduce((e,t)=>{const r=I.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?ki: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 i6(e,t){e&&Kv.flushSync(()=>e.dispatchEvent(t))}function mr(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 BD(e,t=globalThis==null?void 0:globalThis.document){const r=mr(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 LD="DismissableLayer",ch="dismissableLayer.update",FD="dismissableLayer.pointerDownOutside",UD="dismissableLayer.focusOutside",Ag,s6=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),n0=I.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=I.useContext(s6),[l,f]=I.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=I.useState({}),b=Zt(t,q=>f(q)),w=Array.from(u.layers),[A]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),P=w.indexOf(A),R=l?w.indexOf(l):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,F=R>=P,L=qD(q=>{const J=q.target,ne=[...u.branches].some(ae=>ae.contains(J));!F||ne||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),G=WD(q=>{const J=q.target;[...u.branches].some(ae=>ae.contains(J))||(s==null||s(q),o==null||o(q),q.defaultPrevented||a==null||a())},h);return BD(q=>{R===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&&(Ag=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),Og(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ag)}},[l,h,r,u]),I.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),Og())},[l,u]),I.useEffect(()=>{const q=()=>y({});return document.addEventListener(ch,q),()=>document.removeEventListener(ch,q)},[]),_.jsx(Gt.div,{...c,ref:b,style:{pointerEvents:N?F?"auto":"none":void 0,...e.style},onFocusCapture:rt(e.onFocusCapture,G.onFocusCapture),onBlurCapture:rt(e.onBlurCapture,G.onBlurCapture),onPointerDownCapture:rt(e.onPointerDownCapture,L.onPointerDownCapture)})});n0.displayName=LD;var zD="DismissableLayerBranch",VD=I.forwardRef((e,t)=>{const r=I.useContext(s6),n=I.useRef(null),i=Zt(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})});VD.displayName=zD;function qD(e,t=globalThis==null?void 0:globalThis.document){const r=mr(e),n=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){o6(FD,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 WD(e,t=globalThis==null?void 0:globalThis.document){const r=mr(e),n=I.useRef(!1);return I.useEffect(()=>{const i=s=>{s.target&&!n.current&&o6(UD,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 Og(){const e=new CustomEvent(ch);document.dispatchEvent(e)}function o6(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?i6(i,s):i.dispatchEvent(s)}var us=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},GD=I["useId".toString()]||(()=>{}),HD=0;function tc(e){const[t,r]=I.useState(GD());return us(()=>{e||r(n=>n??String(HD++))},[e]),e||(t?`radix-${t}`:"")}const KD=["top","right","bottom","left"],ls=Math.min,Vr=Math.max,Vu=Math.round,$c=Math.floor,Yn=e=>({x:e,y:e}),JD={left:"right",right:"left",bottom:"top",top:"bottom"},XD={start:"end",end:"start"};function uh(e,t,r){return Vr(e,ls(t,r))}function Ri(e,t){return typeof e=="function"?e(t):e}function Ni(e){return e.split("-")[0]}function ra(e){return e.split("-")[1]}function i0(e){return e==="x"?"y":"x"}function s0(e){return e==="y"?"height":"width"}function fs(e){return["top","bottom"].includes(Ni(e))?"y":"x"}function o0(e){return i0(fs(e))}function YD(e,t,r){r===void 0&&(r=!1);const n=ra(e),i=o0(e),s=s0(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=qu(o)),[o,qu(o)]}function ZD(e){const t=qu(e);return[lh(e),t,lh(t)]}function lh(e){return e.replace(/start|end/g,t=>XD[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 e$(e,t,r,n){const i=ra(e);let s=QD(Ni(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(lh)))),s}function qu(e){return e.replace(/left|right|bottom|top/g,t=>JD[t])}function t$(e){return{top:0,right:0,bottom:0,left:0,...e}}function a6(e){return typeof e!="number"?t$(e):{top:e,right:e,bottom:e,left:e}}function Wu(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 Ig(e,t,r){let{reference:n,floating:i}=e;const s=fs(t),o=o0(t),a=s0(o),c=Ni(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(ra(t)){case"start":y[o]-=h*(r&&u?-1:1);break;case"end":y[o]+=h*(r&&u?-1:1);break}return y}const r$=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}=Ig(u,n,c),h=n,y={},b=0;for(let w=0;w<a.length;w++){const{name:A,fn:P}=a[w],{x:R,y:N,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=R??l,f=N??f,y={...y,[A]:{...y[A],...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}=Ig(u,h,c)),w=-1)}return{x:l,y:f,placement:h,strategy:i,middlewareData:y}};async function rc(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}=Ri(t,e),b=a6(y),A=a[h?f==="floating"?"reference":"floating":f],P=Wu(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(A)))==null||r?A:A.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),R=f==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),F=await(s.isElement==null?void 0:s.isElement(N))?await(s.getScale==null?void 0:s.getScale(N))||{x:1,y:1}:{x:1,y:1},L=Wu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:N,strategy:c}):R);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 n$=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}=Ri(e,t)||{};if(u==null)return{};const f=a6(l),h={x:r,y:n},y=o0(i),b=s0(y),w=await o.getDimensions(u),A=y==="y",P=A?"top":"left",R=A?"bottom":"right",N=A?"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[N]:0;(!q||!await(o.isElement==null?void 0:o.isElement(G)))&&(q=a.floating[N]||s.floating[b]);const J=F/2-L/2,ne=q/2-w[b]/2-1,ae=ls(f[P],ne),ce=ls(f[R],ne),V=ae,$=q-w[b]-ce,p=q/2-w[b]/2+J,d=uh(V,p,$),m=!c.arrow&&ra(i)!=null&&p!==d&&s.reference[b]/2-(p<V?ae:ce)-w[b]/2<0,x=m?p<V?p-V:p-$:0;return{[y]:h[y]+x,data:{[y]:d,centerOffset:p-d-x,...m&&{alignmentOffset:x}},reset:m}}}),i$=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,...A}=Ri(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const P=Ni(i),R=fs(a),N=Ni(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(N||!w?[qu(a)]:ZD(a)),G=b!=="none";!h&&G&&L.push(...e$(a,w,b,F));const q=[a,...L],J=await rc(t,A),ne=[];let ae=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&ne.push(J[P]),f){const p=YD(i,o,F);ne.push(J[p[0]],J[p[1]])}if(ae=[...ae,{placement:i,overflows:ne}],!ne.every(p=>p<=0)){var ce,V;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=(V=ae.filter(x=>x.overflows[0]<=0).sort((x,M)=>x.overflows[1]-M.overflows[1])[0])==null?void 0:V.placement;if(!m)switch(y){case"bestFit":{var $;const x=($=ae.filter(M=>{if(G){const E=fs(M.placement);return E===R||E==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(E=>E>0).reduce((E,O)=>E+O,0)]).sort((M,E)=>M[1]-E[1])[0])==null?void 0:$[0];x&&(m=x);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function Pg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jg(e){return KD.some(t=>e[t]>=0)}const s$=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Ri(e,t);switch(n){case"referenceHidden":{const s=await rc(t,{...i,elementContext:"reference"}),o=Pg(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:jg(o)}}}case"escaped":{const s=await rc(t,{...i,altBoundary:!0}),o=Pg(s,r.floating);return{data:{escapedOffsets:o,escaped:jg(o)}}}default:return{}}}}};async function o$(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Ni(r),a=ra(r),c=fs(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Ri(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 a$=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 o$(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}}}}},c$=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:A=>{let{x:P,y:R}=A;return{x:P,y:R}}},...c}=Ri(e,t),u={x:r,y:n},l=await rc(t,c),f=fs(Ni(i)),h=i0(f);let y=u[h],b=u[f];if(s){const A=h==="y"?"top":"left",P=h==="y"?"bottom":"right",R=y+l[A],N=y-l[P];y=uh(R,y,N)}if(o){const A=f==="y"?"top":"left",P=f==="y"?"bottom":"right",R=b+l[A],N=b-l[P];b=uh(R,b,N)}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}}}}}},u$=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}=Ri(e,t),l={x:r,y:n},f=fs(i),h=i0(f);let y=l[h],b=l[f];const w=Ri(a,t),A=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const N=h==="y"?"height":"width",F=s.reference[h]-s.floating[N]+A.mainAxis,L=s.reference[h]+s.reference[N]-A.mainAxis;y<F?y=F:y>L&&(y=L)}if(u){var P,R;const N=h==="y"?"width":"height",F=["top","left"].includes(Ni(i)),L=s.reference[f]-s.floating[N]+(F&&((P=o.offset)==null?void 0:P[f])||0)+(F?0:A.crossAxis),G=s.reference[f]+s.reference[N]+(F?0:((R=o.offset)==null?void 0:R[f])||0)-(F?A.crossAxis:0);b<L?b=L:b>G&&(b=G)}return{[h]:y,[f]:b}}}},l$=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}=Ri(e,t),l=await rc(t,u),f=Ni(i),h=ra(i),y=fs(i)==="y",{width:b,height:w}=s.floating;let A,P;f==="top"||f==="bottom"?(A=f,P=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(P=f,A=h==="end"?"top":"bottom");const R=w-l.top-l.bottom,N=b-l.left-l.right,F=ls(w-l[A],R),L=ls(b-l[P],N),G=!t.middlewareData.shift;let q=F,J=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(J=N),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=R),G&&!h){const ae=Vr(l.left,0),ce=Vr(l.right,0),V=Vr(l.top,0),$=Vr(l.bottom,0);y?J=b-2*(ae!==0||ce!==0?ae+ce:Vr(l.left,l.right)):q=w-2*(V!==0||$!==0?V+$:Vr(l.top,l.bottom))}await c({...t,availableWidth:J,availableHeight:q});const ne=await o.getDimensions(a.floating);return b!==ne.width||w!==ne.height?{reset:{rects:!0}}:{}}}};function kl(){return typeof window<"u"}function na(e){return c6(e)?(e.nodeName||"").toLowerCase():"#document"}function Gr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oi(e){var t;return(t=(c6(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function c6(e){return kl()?e instanceof Node||e instanceof Gr(e).Node:!1}function jn(e){return kl()?e instanceof Element||e instanceof Gr(e).Element:!1}function ni(e){return kl()?e instanceof HTMLElement||e instanceof Gr(e).HTMLElement:!1}function kg(e){return!kl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Gr(e).ShadowRoot}function _c(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 f$(e){return["table","td","th"].includes(na(e))}function Rl(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function a0(e){const t=c0(),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 d$(e){let t=ds(e);for(;ni(t)&&!Fo(t);){if(a0(t))return t;if(Rl(t))return null;t=ds(t)}return null}function c0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Fo(e){return["html","body","#document"].includes(na(e))}function kn(e){return Gr(e).getComputedStyle(e)}function Nl(e){return jn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ds(e){if(na(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kg(e)&&e.host||oi(e);return kg(t)?t.host:t}function u6(e){const t=ds(e);return Fo(t)?e.ownerDocument?e.ownerDocument.body:e.body:ni(t)&&_c(t)?t:u6(t)}function nc(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=u6(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=Gr(i);if(s){const a=fh(o);return t.concat(o,o.visualViewport||[],_c(i)?i:[],a&&r?nc(a):[])}return t.concat(i,nc(i,[],r))}function fh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function l6(e){const t=kn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=ni(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=Vu(r)!==s||Vu(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function u0(e){return jn(e)?e:e.contextElement}function jo(e){const t=u0(e);if(!ni(t))return Yn(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=l6(t);let o=(s?Vu(r.width):r.width)/n,a=(s?Vu(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const h$=Yn(0);function f6(e){const t=Gr(e);return!c0()||!t.visualViewport?h$:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function p$(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Gr(e)?!1:t}function Hs(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=u0(e);let o=Yn(1);t&&(n?jn(n)&&(o=jo(n)):o=jo(e));const a=p$(s,r,n)?f6(s):Yn(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=Gr(s),y=n&&jn(n)?Gr(n):n;let b=h,w=fh(b);for(;w&&n&&y!==b;){const A=jo(w),P=w.getBoundingClientRect(),R=kn(w),N=P.left+(w.clientLeft+parseFloat(R.paddingLeft))*A.x,F=P.top+(w.clientTop+parseFloat(R.paddingTop))*A.y;c*=A.x,u*=A.y,l*=A.x,f*=A.y,c+=N,u+=F,b=Gr(w),w=fh(b)}}return Wu({width:l,height:f,x:c,y:u})}function l0(e,t){const r=Nl(e).scrollLeft;return t?t.left+r:Hs(oi(e)).left+r}function d6(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:l0(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function m$(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=oi(n),a=t?Rl(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=Yn(1);const l=Yn(0),f=ni(n);if((f||!f&&!s)&&((na(n)!=="body"||_c(o))&&(c=Nl(n)),ni(n))){const y=Hs(n);u=jo(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?d6(o,c,!0):Yn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+l.x+h.x,y:r.y*u.y-c.scrollTop*u.y+l.y+h.y}}function g$(e){return Array.from(e.getClientRects())}function v$(e){const t=oi(e),r=Nl(e),n=e.ownerDocument.body,i=Vr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Vr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+l0(e);const a=-r.scrollTop;return kn(n).direction==="rtl"&&(o+=Vr(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function y$(e,t){const r=Gr(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=c0();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function b$(e,t){const r=Hs(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=ni(e)?jo(e):Yn(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 Rg(e,t,r){let n;if(t==="viewport")n=y$(e,r);else if(t==="document")n=v$(oi(e));else if(jn(t))n=b$(t,r);else{const i=f6(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Wu(n)}function h6(e,t){const r=ds(e);return r===t||!jn(r)||Fo(r)?!1:kn(r).position==="fixed"||h6(r,t)}function w$(e,t){const r=t.get(e);if(r)return r;let n=nc(e,[],!1).filter(a=>jn(a)&&na(a)!=="body"),i=null;const s=kn(e).position==="fixed";let o=s?ds(e):e;for(;jn(o)&&!Fo(o);){const a=kn(o),c=a0(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||_c(o)&&!c&&h6(e,o))?n=n.filter(l=>l!==o):i=a,o=ds(o)}return t.set(e,n),n}function _$(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?Rl(t)?[]:w$(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=Rg(t,l,i);return u.top=Vr(f.top,u.top),u.right=ls(f.right,u.right),u.bottom=ls(f.bottom,u.bottom),u.left=Vr(f.left,u.left),u},Rg(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function x$(e){const{width:t,height:r}=l6(e);return{width:t,height:r}}function S$(e,t,r){const n=ni(t),i=oi(t),s=r==="fixed",o=Hs(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Yn(0);if(n||!n&&!s)if((na(t)!=="body"||_c(i))&&(a=Nl(t)),n){const h=Hs(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=l0(i));const u=i&&!n&&!s?d6(i,a):Yn(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 Hf(e){return kn(e).position==="static"}function Ng(e,t){if(!ni(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 p6(e,t){const r=Gr(e);if(Rl(e))return r;if(!ni(e)){let i=ds(e);for(;i&&!Fo(i);){if(jn(i)&&!Hf(i))return i;i=ds(i)}return r}let n=Ng(e,t);for(;n&&f$(n)&&Hf(n);)n=Ng(n,t);return n&&Fo(n)&&Hf(n)&&!a0(n)?r:n||d$(e)||r}const E$=async function(e){const t=this.getOffsetParent||p6,r=this.getDimensions,n=await r(e.floating);return{reference:S$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function C$(e){return kn(e).direction==="rtl"}const M$={convertOffsetParentRelativeRectToViewportRelativeRect:m$,getDocumentElement:oi,getClippingRect:_$,getOffsetParent:p6,getElementRects:E$,getClientRects:g$,getDimensions:x$,getScale:jo,isElement:jn,isRTL:C$};function T$(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=$c(l),b=$c(i.clientWidth-(u+f)),w=$c(i.clientHeight-(l+h)),A=$c(u),R={rootMargin:-y+"px "+-b+"px "+-w+"px "+-A+"px",threshold:Vr(0,ls(1,c))||1};let N=!0;function F(L){const G=L[0].intersectionRatio;if(G!==c){if(!N)return o();G?o(!1,G):n=setTimeout(()=>{o(!1,1e-7)},1e3)}N=!1}try{r=new IntersectionObserver(F,{...R,root:i.ownerDocument})}catch{r=new IntersectionObserver(F,R)}r.observe(e)}return o(!0),s}function A$(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=u0(e),l=i||s?[...u?nc(u):[],...nc(t)]:[];l.forEach(P=>{i&&P.addEventListener("scroll",r,{passive:!0}),s&&P.addEventListener("resize",r)});const f=u&&a?T$(u,r):null;let h=-1,y=null;o&&(y=new ResizeObserver(P=>{let[R]=P;R&&R.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var N;(N=y)==null||N.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let b,w=c?Hs(e):null;c&&A();function A(){const P=Hs(e);w&&(P.x!==w.x||P.y!==w.y||P.width!==w.width||P.height!==w.height)&&r(),w=P,b=requestAnimationFrame(A)}return r(),()=>{var P;l.forEach(R=>{i&&R.removeEventListener("scroll",r),s&&R.removeEventListener("resize",r)}),f==null||f(),(P=y)==null||P.disconnect(),y=null,c&&cancelAnimationFrame(b)}}const O$=a$,I$=c$,P$=i$,j$=l$,k$=s$,Dg=n$,R$=u$,N$=(e,t,r)=>{const n=new Map,i={platform:M$,...r},s={...i.platform,_c:n};return r$(e,t,{...i,platform:s})};var lu=typeof document<"u"?se.useLayoutEffect:se.useEffect;function Gu(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(!Gu(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)&&!Gu(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function m6(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $g(e,t){const r=m6(e);return Math.round(t*r)/r}function Kf(e){const t=I.useRef(e);return lu(()=>{t.current=e}),t}function D$(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);Gu(h,n)||y(n);const[b,w]=I.useState(null),[A,P]=I.useState(null),R=I.useCallback(M=>{M!==G.current&&(G.current=M,w(M))},[]),N=I.useCallback(M=>{M!==q.current&&(q.current=M,P(M))},[]),F=s||b,L=o||A,G=I.useRef(null),q=I.useRef(null),J=I.useRef(l),ne=c!=null,ae=Kf(c),ce=Kf(i),V=Kf(u),$=I.useCallback(()=>{if(!G.current||!q.current)return;const M={placement:t,strategy:r,middleware:h};ce.current&&(M.platform=ce.current),N$(G.current,q.current,M).then(E=>{const O={...E,isPositioned:V.current!==!1};p.current&&!Gu(J.current,O)&&(J.current=O,Kv.flushSync(()=>{f(O)}))})},[h,t,r,ce,V]);lu(()=>{u===!1&&J.current.isPositioned&&(J.current.isPositioned=!1,f(M=>({...M,isPositioned:!1})))},[u]);const p=I.useRef(!1);lu(()=>(p.current=!0,()=>{p.current=!1}),[]),lu(()=>{if(F&&(G.current=F),L&&(q.current=L),F&&L){if(ae.current)return ae.current(F,L,$);$()}},[F,L,$,ae,ne]);const d=I.useMemo(()=>({reference:G,floating:q,setReference:R,setFloating:N}),[R,N]),m=I.useMemo(()=>({reference:F,floating:L}),[F,L]),x=I.useMemo(()=>{const M={position:r,left:0,top:0};if(!m.floating)return M;const E=$g(m.floating,l.x),O=$g(m.floating,l.y);return a?{...M,transform:"translate("+E+"px, "+O+"px)",...m6(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:$,refs:d,elements:m,floatingStyles:x}),[l,$,d,m,x])}const $$=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?Dg({element:n.current,padding:i}).fn(r):{}:n?Dg({element:n,padding:i}).fn(r):{}}}},B$=(e,t)=>({...O$(e),options:[e,t]}),L$=(e,t)=>({...I$(e),options:[e,t]}),F$=(e,t)=>({...R$(e),options:[e,t]}),U$=(e,t)=>({...P$(e),options:[e,t]}),z$=(e,t)=>({...j$(e),options:[e,t]}),V$=(e,t)=>({...k$(e),options:[e,t]}),q$=(e,t)=>({...$$(e),options:[e,t]});var W$="Arrow",g6=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"})})});g6.displayName=W$;var G$=g6;function H$(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,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,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,K$(i,...t)]}function K$(...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 f0(e){const[t,r]=I.useState(void 0);return us(()=>{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 d0="Popper",[v6,Dl]=H$(d0),[J$,y6]=v6(d0),b6=e=>{const{__scopePopper:t,children:r}=e,[n,i]=I.useState(null);return _.jsx(J$,{scope:t,anchor:n,onAnchorChange:i,children:r})};b6.displayName=d0;var w6="PopperAnchor",_6=I.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=y6(w6,r),o=I.useRef(null),a=Zt(t,o);return I.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:_.jsx(Gt.div,{...i,ref:a})});_6.displayName=w6;var h0="PopperContent",[X$,Y$]=v6(h0),x6=I.forwardRef((e,t)=>{var ve,pe,Ee,Se,Ke,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,A=y6(h0,r),[P,R]=I.useState(null),N=Zt(t,lt=>R(lt)),[F,L]=I.useState(null),G=f0(F),q=(G==null?void 0:G.width)??0,J=(G==null?void 0:G.height)??0,ne=n+(s!=="center"?"-"+s:""),ae=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},ce=Array.isArray(u)?u:[u],V=ce.length>0,$={padding:ae,boundary:ce.filter(Q$),altBoundary:V},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:M}=D$({strategy:"fixed",placement:ne,whileElementsMounted:(...lt)=>A$(...lt,{animationFrame:y==="always"}),elements:{reference:A.anchor},middleware:[B$({mainAxis:i+J,alignmentAxis:o}),c&&L$({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?F$():void 0,...$}),c&&U$({...$}),z$({...$,apply:({elements:lt,rects:ht,availableWidth:$e,availableHeight:mt})=>{const{width:_e,height:ge}=ht.reference,Ae=lt.floating.style;Ae.setProperty("--radix-popper-available-width",`${$e}px`),Ae.setProperty("--radix-popper-available-height",`${mt}px`),Ae.setProperty("--radix-popper-anchor-width",`${_e}px`),Ae.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),F&&q$({element:F,padding:a}),eB({arrowWidth:q,arrowHeight:J}),h&&V$({strategy:"referenceHidden",...$})]}),[E,O]=C6(m),C=mr(b);us(()=>{x&&(C==null||C())},[x,C]);const g=(ve=M.arrow)==null?void 0:ve.x,v=(pe=M.arrow)==null?void 0:pe.y,j=((Ee=M.arrow)==null?void 0:Ee.centerOffset)!==0,[ee,ie]=I.useState();return us(()=>{P&&ie(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=M.transformOrigin)==null?void 0:Se.x,(Ke=M.transformOrigin)==null?void 0:Ke.y].join(" "),...((Ue=M.hide)==null?void 0:Ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:_.jsx(X$,{scope:r,placedSide:E,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:j,children:_.jsx(Gt.div,{"data-side":E,"data-align":O,...w,ref:N,style:{...w.style,animation:x?void 0:"none"}})})})});x6.displayName=h0;var S6="PopperArrow",Z$={top:"bottom",right:"left",bottom:"top",left:"right"},E6=I.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=Y$(S6,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(G$,{...i,ref:r,style:{...i.style,display:"block"}})})});E6.displayName=S6;function Q$(e){return e!==null}var eB=e=>({name:"transformOrigin",options:e,fn(t){var A,P,R;const{placement:r,rects:n,middlewareData:i}=t,o=((A=i.arrow)==null?void 0:A.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,l]=C6(r),f={start:"0%",center:"50%",end:"100%"}[l],h=(((P=i.arrow)==null?void 0:P.x)??0)+a/2,y=(((R=i.arrow)==null?void 0:R.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 C6(e){const[t,r="center"]=e.split("-");return[t,r]}var M6=b6,T6=_6,A6=x6,O6=E6,tB="Portal",I6=I.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=I.useState(!1);us(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?rl.createPortal(_.jsx(Gt.div,{...n,ref:t}),o):null});I6.displayName=tB;function rB(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var Nn=e=>{const{present:t,children:r}=e,n=nB(t),i=typeof r=="function"?r({present:n.isPresent}):I.Children.only(r),s=Zt(n.ref,iB(i));return typeof r=="function"||n.isPresent?I.cloneElement(i,{ref:s}):null};Nn.displayName="Presence";function nB(e){const[t,r]=I.useState(),n=I.useRef({}),i=I.useRef(e),s=I.useRef("none"),o=e?"mounted":"unmounted",[a,c]=rB(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const u=Bc(n.current);s.current=a==="mounted"?u:"none"},[a]),us(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=Bc(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]),us(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const w=Bc(n.current).includes(y.animationName);if(y.target===t&&w&&(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)})}},h=y=>{y.target===t&&(s.current=Bc(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 Bc(e){return(e==null?void 0:e.animationName)||"none"}function iB(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 xc({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=sB({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=mr(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 sB({defaultProp:e,onChange:t}){const r=I.useState(e),[n]=r,i=I.useRef(n),s=mr(t);return I.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var oB="VisuallyHidden",P6=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}}));P6.displayName=oB;var aB=P6,[$l,dX]=ea("Tooltip",[Dl]),p0=Dl(),j6="TooltipProvider",cB=700,Bg="tooltip.open",[uB,k6]=$l(j6),R6=e=>{const{__scopeTooltip:t,delayDuration:r=cB,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(uB,{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})};R6.displayName=j6;var N6="Tooltip",[hX,Bl]=$l(N6),dh="TooltipTrigger",lB=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Bl(dh,r),s=k6(dh,r),o=p0(r),a=I.useRef(null),c=Zt(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(T6,{asChild:!0,...o,children:_.jsx(Gt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:rt(e.onPointerMove,h=>{h.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:rt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:rt(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:rt(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:rt(e.onBlur,i.onClose),onClick:rt(e.onClick,i.onClose)})})});lB.displayName=dh;var fB="TooltipPortal",[pX,dB]=$l(fB,{forceMount:void 0}),Uo="TooltipContent",hB=I.forwardRef((e,t)=>{const r=dB(Uo,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=Bl(Uo,e.__scopeTooltip);return _.jsx(Nn,{present:n||o.open,children:o.disableHoverableContent?_.jsx(D6,{side:i,...s,ref:t}):_.jsx(pB,{side:i,...s,ref:t})})}),pB=I.forwardRef((e,t)=>{const r=Bl(Uo,e.__scopeTooltip),n=k6(Uo,e.__scopeTooltip),i=I.useRef(null),s=Zt(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 A=b.currentTarget,P={x:b.clientX,y:b.clientY},R=yB(P,A.getBoundingClientRect()),N=bB(P,R),F=wB(w.getBoundingClientRect()),L=xB([...N,...F]);a(L),f(!0)},[f]);return I.useEffect(()=>()=>h(),[h]),I.useEffect(()=>{if(c&&l){const b=A=>y(A,l),w=A=>y(A,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 A=w.target,P={x:w.clientX,y:w.clientY},R=(c==null?void 0:c.contains(A))||(l==null?void 0:l.contains(A)),N=!_B(P,o);R?h():N&&(h(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,l,o,u,h]),_.jsx(D6,{...e,ref:s})}),[mB,gB]=$l(N6,{isInside:!1}),D6=I.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=Bl(Uo,r),u=p0(r),{onClose:l}=c;return I.useEffect(()=>(document.addEventListener(Bg,l),()=>document.removeEventListener(Bg,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(n0,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:_.jsxs(A6,{"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(ta,{children:n}),_.jsx(mB,{scope:r,isInside:!0,children:_.jsx(aB,{id:c.contentId,role:"tooltip",children:i||n})})]})})});hB.displayName=Uo;var $6="TooltipArrow",vB=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=p0(r);return gB($6,r).isInside?null:_.jsx(O6,{...i,...n,ref:t})});vB.displayName=$6;function yB(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 bB(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 wB(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 _B(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 xB(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),SB(t)}function SB(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 EB=R6,B6=I.createContext(void 0),CB=e=>{const{dir:t,children:r}=e;return _.jsx(B6.Provider,{value:t,children:r})};function m0(e){const t=I.useContext(B6);return e||t||"ltr"}const MB=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],TB=["sky","mint","lime","yellow","amber"],AB=["gold","bronze"],OB=[...MB,...TB,...AB],IB="gray",PB=["mauve","slate","sage","olive","sand"],jB=[IB,...PB];function kB(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 RB=["inherit","light","dark"],NB=[...OB,"gray"],DB=[...jB,"auto"],$B=["solid","translucent"],BB=["none","small","medium","large","full"],LB=["90%","95%","100%","105%","110%"],jr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:RB,default:"inherit"},accentColor:{type:"enum",values:NB,default:"indigo"},grayColor:{type:"enum",values:DB,default:"auto"},panelBackground:{type:"enum",values:$B,default:"translucent"},radius:{type:"enum",values:BB,default:"medium"},scaling:{type:"enum",values:LB,default:"100%"}};function L6(e){return e==="gray"?"gray":kB(e)}const oo=()=>{},Hu=I.createContext(void 0);function FB(){const e=I.useContext(Hu);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const Ll=I.forwardRef((e,t)=>I.useContext(Hu)===void 0?I.createElement(EB,null,I.createElement(CB,{dir:"ltr"},I.createElement(F6,{...e,ref:t}))):I.createElement(g0,{...e,ref:t}));Ll.displayName="Theme";const F6=I.forwardRef((e,t)=>{const{appearance:r=jr.appearance.default,accentColor:n=jr.accentColor.default,grayColor:i=jr.grayColor.default,panelBackground:s=jr.panelBackground.default,radius:o=jr.radius.default,scaling:a=jr.scaling.default,hasBackground:c=jr.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[A,P]=I.useState(s);I.useEffect(()=>P(s),[s]);const[R,N]=I.useState(o);I.useEffect(()=>N(o),[o]);const[F,L]=I.useState(a);I.useEffect(()=>L(a),[a]);const G=I.memo(({appearance:J})=>I.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${J}';c.add('${J}');}catch(e){}})();`}}),()=>!0);G.displayName="ExplicitRootAppearanceScript",I.useEffect(()=>UB(r),[r]);const q=b==="auto"?L6(h):b;return I.createElement(I.Fragment,null,l!=="inherit"&&I.createElement(G,{appearance:l}),c&&I.createElement("style",{dangerouslySetInnerHTML:{__html:`
|
|
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})()})(i6);var kD=i6.exports;const Xt=hc(kD);function rt(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 RD(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function kl(...e){return t=>e.forEach(r=>RD(r,t))}function Zt(...e){return I.useCallback(kl(...e),e)}function ea(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,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,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,ND(i,...t)]}function ND(...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 ki=I.forwardRef((e,t)=>{const{children:r,...n}=e,i=I.Children.toArray(r),s=i.find(DD);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(lh,{...n,ref:t,children:I.isValidElement(o)?I.cloneElement(o,void 0,a):null})}return _.jsx(lh,{...n,ref:t,children:r})});ki.displayName="Slot";var lh=I.forwardRef((e,t)=>{const{children:r,...n}=e;if(I.isValidElement(r)){const i=BD(r);return I.cloneElement(r,{...$D(n,r.props),ref:t?kl(t,i):i})}return I.Children.count(r)>1?I.Children.only(null):null});lh.displayName="SlotClone";var ta=({children:e})=>_.jsx(_.Fragment,{children:e});function DD(e){return I.isValidElement(e)&&e.type===ta}function $D(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 BD(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 LD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Gt=LD.reduce((e,t)=>{const r=I.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?ki: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 s6(e,t){e&&Jv.flushSync(()=>e.dispatchEvent(t))}function mr(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 FD(e,t=globalThis==null?void 0:globalThis.document){const r=mr(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 UD="DismissableLayer",fh="dismissableLayer.update",zD="dismissableLayer.pointerDownOutside",VD="dismissableLayer.focusOutside",Og,o6=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),s0=I.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=I.useContext(o6),[l,f]=I.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=I.useState({}),b=Zt(t,q=>f(q)),w=Array.from(u.layers),[A]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),P=w.indexOf(A),R=l?w.indexOf(l):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,F=R>=P,L=GD(q=>{const J=q.target,ne=[...u.branches].some(ae=>ae.contains(J));!F||ne||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),G=HD(q=>{const J=q.target;[...u.branches].some(ae=>ae.contains(J))||(s==null||s(q),o==null||o(q),q.defaultPrevented||a==null||a())},h);return FD(q=>{R===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&&(Og=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),Ig(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Og)}},[l,h,r,u]),I.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),Ig())},[l,u]),I.useEffect(()=>{const q=()=>y({});return document.addEventListener(fh,q),()=>document.removeEventListener(fh,q)},[]),_.jsx(Gt.div,{...c,ref:b,style:{pointerEvents:N?F?"auto":"none":void 0,...e.style},onFocusCapture:rt(e.onFocusCapture,G.onFocusCapture),onBlurCapture:rt(e.onBlurCapture,G.onBlurCapture),onPointerDownCapture:rt(e.onPointerDownCapture,L.onPointerDownCapture)})});s0.displayName=UD;var qD="DismissableLayerBranch",WD=I.forwardRef((e,t)=>{const r=I.useContext(o6),n=I.useRef(null),i=Zt(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})});WD.displayName=qD;function GD(e,t=globalThis==null?void 0:globalThis.document){const r=mr(e),n=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){a6(zD,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 HD(e,t=globalThis==null?void 0:globalThis.document){const r=mr(e),n=I.useRef(!1);return I.useEffect(()=>{const i=s=>{s.target&&!n.current&&a6(VD,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 Ig(){const e=new CustomEvent(fh);document.dispatchEvent(e)}function a6(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?s6(i,s):i.dispatchEvent(s)}var us=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},KD=I["useId".toString()]||(()=>{}),JD=0;function rc(e){const[t,r]=I.useState(KD());return us(()=>{e||r(n=>n??String(JD++))},[e]),e||(t?`radix-${t}`:"")}const XD=["top","right","bottom","left"],ls=Math.min,qr=Math.max,qu=Math.round,Bc=Math.floor,Yn=e=>({x:e,y:e}),YD={left:"right",right:"left",bottom:"top",top:"bottom"},ZD={start:"end",end:"start"};function dh(e,t,r){return qr(e,ls(t,r))}function Ri(e,t){return typeof e=="function"?e(t):e}function Ni(e){return e.split("-")[0]}function ra(e){return e.split("-")[1]}function o0(e){return e==="x"?"y":"x"}function a0(e){return e==="y"?"height":"width"}function fs(e){return["top","bottom"].includes(Ni(e))?"y":"x"}function c0(e){return o0(fs(e))}function QD(e,t,r){r===void 0&&(r=!1);const n=ra(e),i=c0(e),s=a0(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Wu(o)),[o,Wu(o)]}function e$(e){const t=Wu(e);return[hh(e),t,hh(t)]}function hh(e){return e.replace(/start|end/g,t=>ZD[t])}function t$(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 r$(e,t,r,n){const i=ra(e);let s=t$(Ni(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(hh)))),s}function Wu(e){return e.replace(/left|right|bottom|top/g,t=>YD[t])}function n$(e){return{top:0,right:0,bottom:0,left:0,...e}}function c6(e){return typeof e!="number"?n$(e):{top:e,right:e,bottom:e,left:e}}function Gu(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 Pg(e,t,r){let{reference:n,floating:i}=e;const s=fs(t),o=c0(t),a=a0(o),c=Ni(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(ra(t)){case"start":y[o]-=h*(r&&u?-1:1);break;case"end":y[o]+=h*(r&&u?-1:1);break}return y}const i$=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}=Pg(u,n,c),h=n,y={},b=0;for(let w=0;w<a.length;w++){const{name:A,fn:P}=a[w],{x:R,y:N,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=R??l,f=N??f,y={...y,[A]:{...y[A],...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}=Pg(u,h,c)),w=-1)}return{x:l,y:f,placement:h,strategy:i,middlewareData:y}};async function nc(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}=Ri(t,e),b=c6(y),A=a[h?f==="floating"?"reference":"floating":f],P=Gu(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(A)))==null||r?A:A.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),R=f==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),F=await(s.isElement==null?void 0:s.isElement(N))?await(s.getScale==null?void 0:s.getScale(N))||{x:1,y:1}:{x:1,y:1},L=Gu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:N,strategy:c}):R);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 s$=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}=Ri(e,t)||{};if(u==null)return{};const f=c6(l),h={x:r,y:n},y=c0(i),b=a0(y),w=await o.getDimensions(u),A=y==="y",P=A?"top":"left",R=A?"bottom":"right",N=A?"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[N]:0;(!q||!await(o.isElement==null?void 0:o.isElement(G)))&&(q=a.floating[N]||s.floating[b]);const J=F/2-L/2,ne=q/2-w[b]/2-1,ae=ls(f[P],ne),ce=ls(f[R],ne),V=ae,$=q-w[b]-ce,p=q/2-w[b]/2+J,d=dh(V,p,$),m=!c.arrow&&ra(i)!=null&&p!==d&&s.reference[b]/2-(p<V?ae:ce)-w[b]/2<0,x=m?p<V?p-V:p-$:0;return{[y]:h[y]+x,data:{[y]:d,centerOffset:p-d-x,...m&&{alignmentOffset:x}},reset:m}}}),o$=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,...A}=Ri(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const P=Ni(i),R=fs(a),N=Ni(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(N||!w?[Wu(a)]:e$(a)),G=b!=="none";!h&&G&&L.push(...r$(a,w,b,F));const q=[a,...L],J=await nc(t,A),ne=[];let ae=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&ne.push(J[P]),f){const p=QD(i,o,F);ne.push(J[p[0]],J[p[1]])}if(ae=[...ae,{placement:i,overflows:ne}],!ne.every(p=>p<=0)){var ce,V;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=(V=ae.filter(x=>x.overflows[0]<=0).sort((x,M)=>x.overflows[1]-M.overflows[1])[0])==null?void 0:V.placement;if(!m)switch(y){case"bestFit":{var $;const x=($=ae.filter(M=>{if(G){const E=fs(M.placement);return E===R||E==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(E=>E>0).reduce((E,O)=>E+O,0)]).sort((M,E)=>M[1]-E[1])[0])==null?void 0:$[0];x&&(m=x);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function jg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kg(e){return XD.some(t=>e[t]>=0)}const a$=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Ri(e,t);switch(n){case"referenceHidden":{const s=await nc(t,{...i,elementContext:"reference"}),o=jg(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:kg(o)}}}case"escaped":{const s=await nc(t,{...i,altBoundary:!0}),o=jg(s,r.floating);return{data:{escapedOffsets:o,escaped:kg(o)}}}default:return{}}}}};async function c$(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Ni(r),a=ra(r),c=fs(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Ri(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 u$=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 c$(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}}}}},l$=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:A=>{let{x:P,y:R}=A;return{x:P,y:R}}},...c}=Ri(e,t),u={x:r,y:n},l=await nc(t,c),f=fs(Ni(i)),h=o0(f);let y=u[h],b=u[f];if(s){const A=h==="y"?"top":"left",P=h==="y"?"bottom":"right",R=y+l[A],N=y-l[P];y=dh(R,y,N)}if(o){const A=f==="y"?"top":"left",P=f==="y"?"bottom":"right",R=b+l[A],N=b-l[P];b=dh(R,b,N)}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}}}}}},f$=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}=Ri(e,t),l={x:r,y:n},f=fs(i),h=o0(f);let y=l[h],b=l[f];const w=Ri(a,t),A=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const N=h==="y"?"height":"width",F=s.reference[h]-s.floating[N]+A.mainAxis,L=s.reference[h]+s.reference[N]-A.mainAxis;y<F?y=F:y>L&&(y=L)}if(u){var P,R;const N=h==="y"?"width":"height",F=["top","left"].includes(Ni(i)),L=s.reference[f]-s.floating[N]+(F&&((P=o.offset)==null?void 0:P[f])||0)+(F?0:A.crossAxis),G=s.reference[f]+s.reference[N]+(F?0:((R=o.offset)==null?void 0:R[f])||0)-(F?A.crossAxis:0);b<L?b=L:b>G&&(b=G)}return{[h]:y,[f]:b}}}},d$=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}=Ri(e,t),l=await nc(t,u),f=Ni(i),h=ra(i),y=fs(i)==="y",{width:b,height:w}=s.floating;let A,P;f==="top"||f==="bottom"?(A=f,P=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(P=f,A=h==="end"?"top":"bottom");const R=w-l.top-l.bottom,N=b-l.left-l.right,F=ls(w-l[A],R),L=ls(b-l[P],N),G=!t.middlewareData.shift;let q=F,J=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(J=N),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=R),G&&!h){const ae=qr(l.left,0),ce=qr(l.right,0),V=qr(l.top,0),$=qr(l.bottom,0);y?J=b-2*(ae!==0||ce!==0?ae+ce:qr(l.left,l.right)):q=w-2*(V!==0||$!==0?V+$:qr(l.top,l.bottom))}await c({...t,availableWidth:J,availableHeight:q});const ne=await o.getDimensions(a.floating);return b!==ne.width||w!==ne.height?{reset:{rects:!0}}:{}}}};function Rl(){return typeof window<"u"}function na(e){return u6(e)?(e.nodeName||"").toLowerCase():"#document"}function Hr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oi(e){var t;return(t=(u6(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function u6(e){return Rl()?e instanceof Node||e instanceof Hr(e).Node:!1}function jn(e){return Rl()?e instanceof Element||e instanceof Hr(e).Element:!1}function ni(e){return Rl()?e instanceof HTMLElement||e instanceof Hr(e).HTMLElement:!1}function Rg(e){return!Rl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Hr(e).ShadowRoot}function xc(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 h$(e){return["table","td","th"].includes(na(e))}function Nl(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function u0(e){const t=l0(),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 p$(e){let t=ds(e);for(;ni(t)&&!Fo(t);){if(u0(t))return t;if(Nl(t))return null;t=ds(t)}return null}function l0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Fo(e){return["html","body","#document"].includes(na(e))}function kn(e){return Hr(e).getComputedStyle(e)}function Dl(e){return jn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ds(e){if(na(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Rg(e)&&e.host||oi(e);return Rg(t)?t.host:t}function l6(e){const t=ds(e);return Fo(t)?e.ownerDocument?e.ownerDocument.body:e.body:ni(t)&&xc(t)?t:l6(t)}function ic(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=l6(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=Hr(i);if(s){const a=ph(o);return t.concat(o,o.visualViewport||[],xc(i)?i:[],a&&r?ic(a):[])}return t.concat(i,ic(i,[],r))}function ph(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function f6(e){const t=kn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=ni(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=qu(r)!==s||qu(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function f0(e){return jn(e)?e:e.contextElement}function jo(e){const t=f0(e);if(!ni(t))return Yn(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=f6(t);let o=(s?qu(r.width):r.width)/n,a=(s?qu(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const m$=Yn(0);function d6(e){const t=Hr(e);return!l0()||!t.visualViewport?m$:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function g$(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Hr(e)?!1:t}function Ks(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=f0(e);let o=Yn(1);t&&(n?jn(n)&&(o=jo(n)):o=jo(e));const a=g$(s,r,n)?d6(s):Yn(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=Hr(s),y=n&&jn(n)?Hr(n):n;let b=h,w=ph(b);for(;w&&n&&y!==b;){const A=jo(w),P=w.getBoundingClientRect(),R=kn(w),N=P.left+(w.clientLeft+parseFloat(R.paddingLeft))*A.x,F=P.top+(w.clientTop+parseFloat(R.paddingTop))*A.y;c*=A.x,u*=A.y,l*=A.x,f*=A.y,c+=N,u+=F,b=Hr(w),w=ph(b)}}return Gu({width:l,height:f,x:c,y:u})}function d0(e,t){const r=Dl(e).scrollLeft;return t?t.left+r:Ks(oi(e)).left+r}function h6(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:d0(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function v$(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=oi(n),a=t?Nl(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=Yn(1);const l=Yn(0),f=ni(n);if((f||!f&&!s)&&((na(n)!=="body"||xc(o))&&(c=Dl(n)),ni(n))){const y=Ks(n);u=jo(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?h6(o,c,!0):Yn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+l.x+h.x,y:r.y*u.y-c.scrollTop*u.y+l.y+h.y}}function y$(e){return Array.from(e.getClientRects())}function b$(e){const t=oi(e),r=Dl(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+d0(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 w$(e,t){const r=Hr(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=l0();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function _$(e,t){const r=Ks(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=ni(e)?jo(e):Yn(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 Ng(e,t,r){let n;if(t==="viewport")n=w$(e,r);else if(t==="document")n=b$(oi(e));else if(jn(t))n=_$(t,r);else{const i=d6(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Gu(n)}function p6(e,t){const r=ds(e);return r===t||!jn(r)||Fo(r)?!1:kn(r).position==="fixed"||p6(r,t)}function x$(e,t){const r=t.get(e);if(r)return r;let n=ic(e,[],!1).filter(a=>jn(a)&&na(a)!=="body"),i=null;const s=kn(e).position==="fixed";let o=s?ds(e):e;for(;jn(o)&&!Fo(o);){const a=kn(o),c=u0(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||xc(o)&&!c&&p6(e,o))?n=n.filter(l=>l!==o):i=a,o=ds(o)}return t.set(e,n),n}function S$(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?Nl(t)?[]:x$(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=Ng(t,l,i);return u.top=qr(f.top,u.top),u.right=ls(f.right,u.right),u.bottom=ls(f.bottom,u.bottom),u.left=qr(f.left,u.left),u},Ng(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function E$(e){const{width:t,height:r}=f6(e);return{width:t,height:r}}function C$(e,t,r){const n=ni(t),i=oi(t),s=r==="fixed",o=Ks(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Yn(0);if(n||!n&&!s)if((na(t)!=="body"||xc(i))&&(a=Dl(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=d0(i));const u=i&&!n&&!s?h6(i,a):Yn(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 Xf(e){return kn(e).position==="static"}function Dg(e,t){if(!ni(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 m6(e,t){const r=Hr(e);if(Nl(e))return r;if(!ni(e)){let i=ds(e);for(;i&&!Fo(i);){if(jn(i)&&!Xf(i))return i;i=ds(i)}return r}let n=Dg(e,t);for(;n&&h$(n)&&Xf(n);)n=Dg(n,t);return n&&Fo(n)&&Xf(n)&&!u0(n)?r:n||p$(e)||r}const M$=async function(e){const t=this.getOffsetParent||m6,r=this.getDimensions,n=await r(e.floating);return{reference:C$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function T$(e){return kn(e).direction==="rtl"}const A$={convertOffsetParentRelativeRectToViewportRelativeRect:v$,getDocumentElement:oi,getClippingRect:S$,getOffsetParent:m6,getElementRects:M$,getClientRects:y$,getDimensions:E$,getScale:jo,isElement:jn,isRTL:T$};function O$(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=Bc(l),b=Bc(i.clientWidth-(u+f)),w=Bc(i.clientHeight-(l+h)),A=Bc(u),R={rootMargin:-y+"px "+-b+"px "+-w+"px "+-A+"px",threshold:qr(0,ls(1,c))||1};let N=!0;function F(L){const G=L[0].intersectionRatio;if(G!==c){if(!N)return o();G?o(!1,G):n=setTimeout(()=>{o(!1,1e-7)},1e3)}N=!1}try{r=new IntersectionObserver(F,{...R,root:i.ownerDocument})}catch{r=new IntersectionObserver(F,R)}r.observe(e)}return o(!0),s}function I$(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=f0(e),l=i||s?[...u?ic(u):[],...ic(t)]:[];l.forEach(P=>{i&&P.addEventListener("scroll",r,{passive:!0}),s&&P.addEventListener("resize",r)});const f=u&&a?O$(u,r):null;let h=-1,y=null;o&&(y=new ResizeObserver(P=>{let[R]=P;R&&R.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var N;(N=y)==null||N.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let b,w=c?Ks(e):null;c&&A();function A(){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(A)}return r(),()=>{var P;l.forEach(R=>{i&&R.removeEventListener("scroll",r),s&&R.removeEventListener("resize",r)}),f==null||f(),(P=y)==null||P.disconnect(),y=null,c&&cancelAnimationFrame(b)}}const P$=u$,j$=l$,k$=o$,R$=d$,N$=a$,$g=s$,D$=f$,$$=(e,t,r)=>{const n=new Map,i={platform:A$,...r},s={...i.platform,_c:n};return i$(e,t,{...i,platform:s})};var fu=typeof document<"u"?se.useLayoutEffect:se.useEffect;function Hu(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(!Hu(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)&&!Hu(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function g6(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bg(e,t){const r=g6(e);return Math.round(t*r)/r}function Yf(e){const t=I.useRef(e);return fu(()=>{t.current=e}),t}function B$(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);Hu(h,n)||y(n);const[b,w]=I.useState(null),[A,P]=I.useState(null),R=I.useCallback(M=>{M!==G.current&&(G.current=M,w(M))},[]),N=I.useCallback(M=>{M!==q.current&&(q.current=M,P(M))},[]),F=s||b,L=o||A,G=I.useRef(null),q=I.useRef(null),J=I.useRef(l),ne=c!=null,ae=Yf(c),ce=Yf(i),V=Yf(u),$=I.useCallback(()=>{if(!G.current||!q.current)return;const M={placement:t,strategy:r,middleware:h};ce.current&&(M.platform=ce.current),$$(G.current,q.current,M).then(E=>{const O={...E,isPositioned:V.current!==!1};p.current&&!Hu(J.current,O)&&(J.current=O,Jv.flushSync(()=>{f(O)}))})},[h,t,r,ce,V]);fu(()=>{u===!1&&J.current.isPositioned&&(J.current.isPositioned=!1,f(M=>({...M,isPositioned:!1})))},[u]);const p=I.useRef(!1);fu(()=>(p.current=!0,()=>{p.current=!1}),[]),fu(()=>{if(F&&(G.current=F),L&&(q.current=L),F&&L){if(ae.current)return ae.current(F,L,$);$()}},[F,L,$,ae,ne]);const d=I.useMemo(()=>({reference:G,floating:q,setReference:R,setFloating:N}),[R,N]),m=I.useMemo(()=>({reference:F,floating:L}),[F,L]),x=I.useMemo(()=>{const M={position:r,left:0,top:0};if(!m.floating)return M;const E=Bg(m.floating,l.x),O=Bg(m.floating,l.y);return a?{...M,transform:"translate("+E+"px, "+O+"px)",...g6(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:$,refs:d,elements:m,floatingStyles:x}),[l,$,d,m,x])}const L$=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?$g({element:n.current,padding:i}).fn(r):{}:n?$g({element:n,padding:i}).fn(r):{}}}},F$=(e,t)=>({...P$(e),options:[e,t]}),U$=(e,t)=>({...j$(e),options:[e,t]}),z$=(e,t)=>({...D$(e),options:[e,t]}),V$=(e,t)=>({...k$(e),options:[e,t]}),q$=(e,t)=>({...R$(e),options:[e,t]}),W$=(e,t)=>({...N$(e),options:[e,t]}),G$=(e,t)=>({...L$(e),options:[e,t]});var H$="Arrow",v6=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"})})});v6.displayName=H$;var K$=v6;function J$(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,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,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,X$(i,...t)]}function X$(...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 h0(e){const[t,r]=I.useState(void 0);return us(()=>{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 p0="Popper",[y6,$l]=J$(p0),[Y$,b6]=y6(p0),w6=e=>{const{__scopePopper:t,children:r}=e,[n,i]=I.useState(null);return _.jsx(Y$,{scope:t,anchor:n,onAnchorChange:i,children:r})};w6.displayName=p0;var _6="PopperAnchor",x6=I.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=b6(_6,r),o=I.useRef(null),a=Zt(t,o);return I.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:_.jsx(Gt.div,{...i,ref:a})});x6.displayName=_6;var m0="PopperContent",[Z$,Q$]=y6(m0),S6=I.forwardRef((e,t)=>{var ve,pe,Ee,Se,Ke,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,A=b6(m0,r),[P,R]=I.useState(null),N=Zt(t,lt=>R(lt)),[F,L]=I.useState(null),G=h0(F),q=(G==null?void 0:G.width)??0,J=(G==null?void 0:G.height)??0,ne=n+(s!=="center"?"-"+s:""),ae=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},ce=Array.isArray(u)?u:[u],V=ce.length>0,$={padding:ae,boundary:ce.filter(tB),altBoundary:V},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:M}=B$({strategy:"fixed",placement:ne,whileElementsMounted:(...lt)=>I$(...lt,{animationFrame:y==="always"}),elements:{reference:A.anchor},middleware:[F$({mainAxis:i+J,alignmentAxis:o}),c&&U$({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?z$():void 0,...$}),c&&V$({...$}),q$({...$,apply:({elements:lt,rects:ht,availableWidth:$e,availableHeight:mt})=>{const{width:_e,height:ge}=ht.reference,Ae=lt.floating.style;Ae.setProperty("--radix-popper-available-width",`${$e}px`),Ae.setProperty("--radix-popper-available-height",`${mt}px`),Ae.setProperty("--radix-popper-anchor-width",`${_e}px`),Ae.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),F&&G$({element:F,padding:a}),rB({arrowWidth:q,arrowHeight:J}),h&&W$({strategy:"referenceHidden",...$})]}),[E,O]=M6(m),C=mr(b);us(()=>{x&&(C==null||C())},[x,C]);const g=(ve=M.arrow)==null?void 0:ve.x,v=(pe=M.arrow)==null?void 0:pe.y,j=((Ee=M.arrow)==null?void 0:Ee.centerOffset)!==0,[ee,ie]=I.useState();return us(()=>{P&&ie(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=M.transformOrigin)==null?void 0:Se.x,(Ke=M.transformOrigin)==null?void 0:Ke.y].join(" "),...((Ue=M.hide)==null?void 0:Ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:_.jsx(Z$,{scope:r,placedSide:E,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:j,children:_.jsx(Gt.div,{"data-side":E,"data-align":O,...w,ref:N,style:{...w.style,animation:x?void 0:"none"}})})})});S6.displayName=m0;var E6="PopperArrow",eB={top:"bottom",right:"left",bottom:"top",left:"right"},C6=I.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=Q$(E6,n),o=eB[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(K$,{...i,ref:r,style:{...i.style,display:"block"}})})});C6.displayName=E6;function tB(e){return e!==null}var rB=e=>({name:"transformOrigin",options:e,fn(t){var A,P,R;const{placement:r,rects:n,middlewareData:i}=t,o=((A=i.arrow)==null?void 0:A.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,l]=M6(r),f={start:"0%",center:"50%",end:"100%"}[l],h=(((P=i.arrow)==null?void 0:P.x)??0)+a/2,y=(((R=i.arrow)==null?void 0:R.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 M6(e){const[t,r="center"]=e.split("-");return[t,r]}var T6=w6,A6=x6,O6=S6,I6=C6,nB="Portal",P6=I.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=I.useState(!1);us(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?nl.createPortal(_.jsx(Gt.div,{...n,ref:t}),o):null});P6.displayName=nB;function iB(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var Nn=e=>{const{present:t,children:r}=e,n=sB(t),i=typeof r=="function"?r({present:n.isPresent}):I.Children.only(r),s=Zt(n.ref,oB(i));return typeof r=="function"||n.isPresent?I.cloneElement(i,{ref:s}):null};Nn.displayName="Presence";function sB(e){const[t,r]=I.useState(),n=I.useRef({}),i=I.useRef(e),s=I.useRef("none"),o=e?"mounted":"unmounted",[a,c]=iB(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const u=Lc(n.current);s.current=a==="mounted"?u:"none"},[a]),us(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=Lc(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]),us(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const w=Lc(n.current).includes(y.animationName);if(y.target===t&&w&&(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)})}},h=y=>{y.target===t&&(s.current=Lc(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 Lc(e){return(e==null?void 0:e.animationName)||"none"}function oB(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 Sc({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=aB({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=mr(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 aB({defaultProp:e,onChange:t}){const r=I.useState(e),[n]=r,i=I.useRef(n),s=mr(t);return I.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var cB="VisuallyHidden",j6=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}}));j6.displayName=cB;var uB=j6,[Bl,hX]=ea("Tooltip",[$l]),g0=$l(),k6="TooltipProvider",lB=700,Lg="tooltip.open",[fB,R6]=Bl(k6),N6=e=>{const{__scopeTooltip:t,delayDuration:r=lB,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(fB,{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})};N6.displayName=k6;var D6="Tooltip",[pX,Ll]=Bl(D6),mh="TooltipTrigger",dB=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Ll(mh,r),s=R6(mh,r),o=g0(r),a=I.useRef(null),c=Zt(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(A6,{asChild:!0,...o,children:_.jsx(Gt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:rt(e.onPointerMove,h=>{h.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:rt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:rt(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:rt(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:rt(e.onBlur,i.onClose),onClick:rt(e.onClick,i.onClose)})})});dB.displayName=mh;var hB="TooltipPortal",[mX,pB]=Bl(hB,{forceMount:void 0}),Uo="TooltipContent",mB=I.forwardRef((e,t)=>{const r=pB(Uo,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=Ll(Uo,e.__scopeTooltip);return _.jsx(Nn,{present:n||o.open,children:o.disableHoverableContent?_.jsx($6,{side:i,...s,ref:t}):_.jsx(gB,{side:i,...s,ref:t})})}),gB=I.forwardRef((e,t)=>{const r=Ll(Uo,e.__scopeTooltip),n=R6(Uo,e.__scopeTooltip),i=I.useRef(null),s=Zt(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 A=b.currentTarget,P={x:b.clientX,y:b.clientY},R=wB(P,A.getBoundingClientRect()),N=_B(P,R),F=xB(w.getBoundingClientRect()),L=EB([...N,...F]);a(L),f(!0)},[f]);return I.useEffect(()=>()=>h(),[h]),I.useEffect(()=>{if(c&&l){const b=A=>y(A,l),w=A=>y(A,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 A=w.target,P={x:w.clientX,y:w.clientY},R=(c==null?void 0:c.contains(A))||(l==null?void 0:l.contains(A)),N=!SB(P,o);R?h():N&&(h(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,l,o,u,h]),_.jsx($6,{...e,ref:s})}),[vB,yB]=Bl(D6,{isInside:!1}),$6=I.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=Ll(Uo,r),u=g0(r),{onClose:l}=c;return I.useEffect(()=>(document.addEventListener(Lg,l),()=>document.removeEventListener(Lg,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(s0,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:_.jsxs(O6,{"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(ta,{children:n}),_.jsx(vB,{scope:r,isInside:!0,children:_.jsx(uB,{id:c.contentId,role:"tooltip",children:i||n})})]})})});mB.displayName=Uo;var B6="TooltipArrow",bB=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=g0(r);return yB(B6,r).isInside?null:_.jsx(I6,{...i,...n,ref:t})});bB.displayName=B6;function wB(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 _B(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 xB(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 SB(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 EB(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),CB(t)}function CB(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=N6,L6=I.createContext(void 0),TB=e=>{const{dir:t,children:r}=e;return _.jsx(L6.Provider,{value:t,children:r})};function v0(e){const t=I.useContext(L6);return e||t||"ltr"}const AB=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],OB=["sky","mint","lime","yellow","amber"],IB=["gold","bronze"],PB=[...AB,...OB,...IB],jB="gray",kB=["mauve","slate","sage","olive","sand"],RB=[jB,...kB];function NB(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 DB=["inherit","light","dark"],$B=[...PB,"gray"],BB=[...RB,"auto"],LB=["solid","translucent"],FB=["none","small","medium","large","full"],UB=["90%","95%","100%","105%","110%"],jr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:DB,default:"inherit"},accentColor:{type:"enum",values:$B,default:"indigo"},grayColor:{type:"enum",values:BB,default:"auto"},panelBackground:{type:"enum",values:LB,default:"translucent"},radius:{type:"enum",values:FB,default:"medium"},scaling:{type:"enum",values:UB,default:"100%"}};function F6(e){return e==="gray"?"gray":NB(e)}const oo=()=>{},Ku=I.createContext(void 0);function zB(){const e=I.useContext(Ku);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const Fl=I.forwardRef((e,t)=>I.useContext(Ku)===void 0?I.createElement(MB,null,I.createElement(TB,{dir:"ltr"},I.createElement(U6,{...e,ref:t}))):I.createElement(y0,{...e,ref:t}));Fl.displayName="Theme";const U6=I.forwardRef((e,t)=>{const{appearance:r=jr.appearance.default,accentColor:n=jr.accentColor.default,grayColor:i=jr.grayColor.default,panelBackground:s=jr.panelBackground.default,radius:o=jr.radius.default,scaling:a=jr.scaling.default,hasBackground:c=jr.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[A,P]=I.useState(s);I.useEffect(()=>P(s),[s]);const[R,N]=I.useState(o);I.useEffect(()=>N(o),[o]);const[F,L]=I.useState(a);I.useEffect(()=>L(a),[a]);const G=I.memo(({appearance:J})=>I.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${J}';c.add('${J}');}catch(e){}})();`}}),()=>!0);G.displayName="ExplicitRootAppearanceScript",I.useEffect(()=>VB(r),[r]);const q=b==="auto"?F6(h):b;return I.createElement(I.Fragment,null,l!=="inherit"&&I.createElement(G,{appearance:l}),c&&I.createElement("style",{dangerouslySetInnerHTML:{__html:`
|
|
54
54
|
:root, .light, .light-theme { --color-page-background: white; }
|
|
55
55
|
.dark, .dark-theme { --color-page-background: var(--${q}-1); }
|
|
56
56
|
body { background-color: var(--color-page-background); }
|
|
57
|
-
`}}),I.createElement(g0,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:h,grayColor:b,panelBackground:A,radius:R,scaling:F,onAppearanceChange:f,onAccentColorChange:y,onGrayColorChange:w,onPanelBackgroundChange:P,onRadiusChange:N,onScalingChange:L}))});F6.displayName="ThemeRoot";const g0=I.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=I.useContext(Hu),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:jr.appearance.default,accentColor:y=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:jr.accentColor.default,grayColor:b=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:jr.grayColor.default,panelBackground:w=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:jr.panelBackground.default,radius:A=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:jr.radius.default,scaling:P=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:jr.scaling.default,onAppearanceChange:R=oo,onAccentColorChange:N=oo,onGrayColorChange:F=oo,onPanelBackgroundChange:L=oo,onRadiusChange:G=oo,onScalingChange:q=oo,...J}=e,ne=u?ki:"div",ae=b==="auto"?L6(y):b,ce=e.appearance!==void 0&&e.appearance!=="inherit",V=e.grayColor!==void 0,$=!l&&(f===!0||f!==!1&&(ce||V));return I.createElement(Hu.Provider,{value:I.useMemo(()=>({appearance:h,accentColor:y,grayColor:b,resolvedGrayColor:ae,panelBackground:w,radius:A,scaling:P,onAppearanceChange:R,onAccentColorChange:N,onGrayColorChange:F,onPanelBackgroundChange:L,onRadiusChange:G,onScalingChange:q}),[h,y,b,ae,w,A,P,R,N,F,L,G,q])},I.createElement(ne,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":ae,"data-has-background":$?"true":"false","data-panel-background":w,"data-radius":A,"data-scaling":P,ref:t,...J,className:Xt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},J.className)}))});g0.displayName="ThemeImpl";function UB(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 Sc={type:"enum",values:jr.accentColor.values,default:void 0},Fl={type:"boolean",default:void 0};function _t(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 Ss=["0","1","2","3","4","5","6","7","8","9"],zB={p:{type:"enum",values:Ss,default:void 0,responsive:!0},px:{type:"enum",values:Ss,default:void 0,responsive:!0},py:{type:"enum",values:Ss,default:void 0,responsive:!0},pt:{type:"enum",values:Ss,default:void 0,responsive:!0},pr:{type:"enum",values:Ss,default:void 0,responsive:!0},pb:{type:"enum",values:Ss,default:void 0,responsive:!0},pl:{type:"enum",values:Ss,default:void 0,responsive:!0}};function VB(e){const{p:t=wr.p.default,px:r=wr.px.default,py:n=wr.py.default,pt:i=wr.pt.default,pr:s=wr.pr.default,pb:o=wr.pb.default,pl:a=wr.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:s,pb:o,pl:a,rest:c}}function qB(e){return[_t(e.p,"rt-r-p"),_t(e.px,"rt-r-px"),_t(e.py,"rt-r-py"),_t(e.pt,"rt-r-pt"),_t(e.pr,"rt-r-pr"),_t(e.pb,"rt-r-pb"),_t(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const WB=["static","relative","absolute","fixed","sticky"],_a=["auto","0","50%","100%"],Lg=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],GB=["0","1"],HB=["0","1"],wr={...zB,position:{type:"enum",values:WB,default:void 0,responsive:!0},inset:{type:"enum",values:_a,default:void 0,responsive:!0},top:{type:"enum",values:_a,default:void 0,responsive:!0},right:{type:"enum",values:_a,default:void 0,responsive:!0},bottom:{type:"enum",values:_a,default:void 0,responsive:!0},left:{type:"enum",values:_a,default:void 0,responsive:!0},width:{type:"enum",values:Lg,default:void 0,responsive:!0},height:{type:"enum",values:Lg,default:void 0,responsive:!0},shrink:{type:"enum",values:GB,default:void 0,responsive:!0},grow:{type:"enum",values:HB,default:void 0,responsive:!0}};function KB(e){const{rest:t,...r}=VB(e),{position:n=wr.position.default,width:i=wr.width.default,height:s=wr.height.default,inset:o=wr.inset.default,top:a=wr.top.default,bottom:c=wr.bottom.default,left:u=wr.left.default,right:l=wr.right.default,shrink:f=wr.shrink.default,grow:h=wr.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 JB(e){return[qB(e),_t(e.position,"rt-r-position"),_t(e.shrink,"rt-r-fs"),_t(e.grow,"rt-r-fg"),_t(e.width,"rt-r-w"),_t(e.height,"rt-r-h"),_t(e.inset,"rt-r-inset"),_t(e.top,"rt-r-top"),_t(e.bottom,"rt-r-bottom"),_t(e.left,"rt-r-left"),_t(e.right,"rt-r-right")].filter(Boolean).join(" ")}const Es=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Cs={m:{type:"enum",values:Es,default:void 0,responsive:!0},mx:{type:"enum",values:Es,default:void 0,responsive:!0},my:{type:"enum",values:Es,default:void 0,responsive:!0},mt:{type:"enum",values:Es,default:void 0,responsive:!0},mr:{type:"enum",values:Es,default:void 0,responsive:!0},mb:{type:"enum",values:Es,default:void 0,responsive:!0},ml:{type:"enum",values:Es,default:void 0,responsive:!0}};function ia(e){const{m:t=Cs.m.default,mx:r=Cs.mx.default,my:n=Cs.my.default,mt:i=Cs.mt.default,mr:s=Cs.mr.default,mb:o=Cs.mb.default,ml:a=Cs.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function sa(e){return[_t(e.m,"rt-r-m"),_t(e.mx,"rt-r-mx"),_t(e.my,"rt-r-my"),_t(e.mt,"rt-r-mt"),_t(e.mr,"rt-r-mr"),_t(e.mb,"rt-r-mb"),_t(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const v0={type:"enum",values:jr.radius.values,default:void 0},XB=["none","inline-flex","flex"],YB=["row","column","row-reverse","column-reverse"],ZB=["start","center","end","baseline","stretch"],QB=["start","center","end","between"],eL=["nowrap","wrap","wrap-reverse"],tL=["0","1","2","3","4","5","6","7","8","9"],ao={display:{type:"enum",values:XB,default:"flex",responsive:!0},direction:{type:"enum",values:YB,default:void 0,responsive:!0},align:{type:"enum",values:ZB,default:void 0,responsive:!0},justify:{type:"enum",values:QB,default:"start",responsive:!0},wrap:{type:"enum",values:eL,default:void 0,responsive:!0},gap:{type:"enum",values:tL,default:void 0,responsive:!0}},U6=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{rest:i,...s}=KB(r),{className:o,asChild:a,display:c=ao.display.default,direction:u=ao.direction.default,align:l=ao.align.default,justify:f=ao.justify.default,wrap:h=ao.wrap.default,gap:y=ao.gap.default,...b}=i,w=a?ki:"div";return I.createElement(w,{...b,ref:t,className:Xt("rt-Flex",o,_t(c,"rt-r-display"),_t(u,"rt-r-fd"),_t(l,"rt-r-ai"),_t(f,"rt-r-jc",{between:"space-between"}),_t(h,"rt-r-fw"),_t(y,"rt-r-gap"),JB(s),sa(n))})});U6.displayName="Flex";function z6(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 y0="Checkbox",[rL,mX]=ea(y0),[nL,iL]=rL(y0),V6=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=Zt(t,F=>y(F)),w=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,R]=xc({prop:i,defaultProp:s,onChange:u}),N=I.useRef(P);return I.useEffect(()=>{const F=h==null?void 0:h.form;if(F){const L=()=>R(N.current);return F.addEventListener("reset",L),()=>F.removeEventListener("reset",L)}},[h,R]),_.jsxs(nL,{scope:r,state:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"checkbox","aria-checked":is(P)?"mixed":P,"aria-required":o,"data-state":G6(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onKeyDown:rt(e.onKeyDown,F=>{F.key==="Enter"&&F.preventDefault()}),onClick:rt(e.onClick,F=>{R(L=>is(L)?!0:!L),A&&(w.current=F.isPropagationStopped(),w.current||F.stopPropagation())})}),A&&_.jsx(sL,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:is(s)?!1:s})]})});V6.displayName=y0;var q6="CheckboxIndicator",W6=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=iL(q6,r);return _.jsx(Nn,{present:n||is(s.state)||s.state===!0,children:_.jsx(Gt.span,{"data-state":G6(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});W6.displayName=q6;var sL=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=I.useRef(null),a=z6(r),c=f0(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=is(r),y.call(l,is(r)?!1:r),l.dispatchEvent(b)}},[a,r,n]);const u=I.useRef(is(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 is(e){return e==="indeterminate"}function G6(e){return is(e)?"indeterminate":e?"checked":"unchecked"}var oL=V6,aL=W6;const cL=["1","2","3"],uL=["classic","surface","soft"],Lc={size:{type:"enum",values:cL,default:"2",responsive:!0},variant:{type:"enum",values:uL,default:"surface"},color:Sc,highContrast:Fl},Ul=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"})));Ul.displayName="ThickCheckIcon";const lL=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"})));lL.displayName="ChevronDownIcon";const H6=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"})));H6.displayName="ThickChevronRightIcon";const fL=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"})));fL.displayName="InfoCircledIcon";const zl=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,style:s,size:o=Lc.size.default,variant:a=Lc.variant.default,color:c=Lc.color.default,highContrast:u=Lc.highContrast.default,...l}=r;return I.createElement("span",{className:Xt("rt-CheckboxRoot",i,_t(o,"rt-r-size"),sa(n)),style:s},I.createElement(oL,{"data-accent-color":c,...l,ref:t,className:Xt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},I.createElement(aL,{className:"rt-CheckboxIndicator"},I.createElement(Ul,{className:"rt-CheckboxIndicatorIcon"}))))});zl.displayName="Checkbox";function dL(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,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,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,hL(i,...t)]}function hL(...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 K6(e){const t=e+"CollectionProvider",[r,n]=dL(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:b,children:w}=y,A=se.useRef(null),P=se.useRef(new Map).current;return _.jsx(i,{scope:b,itemMap:P,collectionRef:A,children:w})};o.displayName=t;const a=e+"CollectionSlot",c=se.forwardRef((y,b)=>{const{scope:w,children:A}=y,P=s(a,w),R=Zt(b,P.collectionRef);return _.jsx(ki,{ref:R,children:A})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=se.forwardRef((y,b)=>{const{scope:w,children:A,...P}=y,R=se.useRef(null),N=Zt(b,R),F=s(u,w);return se.useEffect(()=>(F.itemMap.set(R,{ref:R,...P}),()=>void F.itemMap.delete(R))),_.jsx(ki,{[l]:"",ref:N,children:A})});f.displayName=u;function h(y){const b=s(e+"CollectionConsumer",y);return se.useCallback(()=>{const A=b.collectionRef.current;if(!A)return[];const P=Array.from(A.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 pL(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,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,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,mL(i,...t)]}function mL(...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 Jf="rovingFocusGroup.onEntryFocus",gL={bubbles:!1,cancelable:!0},Vl="RovingFocusGroup",[hh,J6,vL]=K6(Vl),[yL,X6]=pL(Vl,[vL]),[bL,wL]=yL(Vl),Y6=I.forwardRef((e,t)=>_.jsx(hh.Provider,{scope:e.__scopeRovingFocusGroup,children:_.jsx(hh.Slot,{scope:e.__scopeRovingFocusGroup,children:_.jsx(_L,{...e,ref:t})})}));Y6.displayName=Vl;var _L=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=Zt(t,h),b=m0(s),[w=null,A]=xc({prop:o,defaultProp:a,onChange:c}),[P,R]=I.useState(!1),N=mr(u),F=J6(r),L=I.useRef(!1),[G,q]=I.useState(0);return I.useEffect(()=>{const J=h.current;if(J)return J.addEventListener(Jf,N),()=>J.removeEventListener(Jf,N)},[N]),_.jsx(bL,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:w,onItemFocus:I.useCallback(J=>A(J),[A]),onItemShiftTab:I.useCallback(()=>R(!0),[]),onFocusableItemAdd:I.useCallback(()=>q(J=>J+1),[]),onFocusableItemRemove:I.useCallback(()=>q(J=>J-1),[]),children:_.jsx(Gt.div,{tabIndex:P||G===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:rt(e.onMouseDown,()=>{L.current=!0}),onFocus:rt(e.onFocus,J=>{const ne=!L.current;if(J.target===J.currentTarget&&ne&&!P){const ae=new CustomEvent(Jf,gL);if(J.currentTarget.dispatchEvent(ae),!ae.defaultPrevented){const ce=F().filter(m=>m.focusable),V=ce.find(m=>m.active),$=ce.find(m=>m.id===w),d=[V,$,...ce].filter(Boolean).map(m=>m.ref.current);eS(d,l)}}L.current=!1}),onBlur:rt(e.onBlur,()=>R(!1))})})}),Z6="RovingFocusGroupItem",Q6=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=tc(),c=s||a,u=wL(Z6,r),l=u.currentTabStopId===c,f=J6(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return I.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),_.jsx(hh.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:rt(e.onMouseDown,b=>{n?u.onItemFocus(c):b.preventDefault()}),onFocus:rt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:rt(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(R=>R.focusable).map(R=>R.ref.current);if(w==="last")P.reverse();else if(w==="prev"||w==="next"){w==="prev"&&P.reverse();const R=P.indexOf(b.currentTarget);P=u.loop?CL(P,R+1):P.slice(R+1)}setTimeout(()=>eS(P))}})})})});Q6.displayName=Z6;var xL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function SL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function EL(e,t,r){const n=SL(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return xL[n]}function eS(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function CL(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var ML=Y6,TL=Q6;function AL(e,[t,r]){return Math.min(r,Math.max(t,e))}var Xf=0;function OL(){I.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Fg()),document.body.insertAdjacentElement("beforeend",e[1]??Fg()),Xf++,()=>{Xf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Xf--}},[])}function Fg(){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 Yf="focusScope.autoFocusOnMount",Zf="focusScope.autoFocusOnUnmount",Ug={bubbles:!1,cancelable:!0},IL="FocusScope",tS=I.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=I.useState(null),u=mr(i),l=mr(s),f=I.useRef(null),h=Zt(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(N){if(y.paused||!a)return;const F=N.target;a.contains(F)?f.current=F:Hi(f.current,{select:!0})},A=function(N){if(y.paused||!a)return;const F=N.relatedTarget;F!==null&&(a.contains(F)||Hi(f.current,{select:!0}))},P=function(N){if(document.activeElement===document.body)for(const L of N)L.removedNodes.length>0&&Hi(a)};document.addEventListener("focusin",w),document.addEventListener("focusout",A);const R=new MutationObserver(P);return a&&R.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",A),R.disconnect()}}},[n,a,y.paused]),I.useEffect(()=>{if(a){Vg.add(y);const w=document.activeElement;if(!a.contains(w)){const P=new CustomEvent(Yf,Ug);a.addEventListener(Yf,u),a.dispatchEvent(P),P.defaultPrevented||(PL(DL(rS(a)),{select:!0}),document.activeElement===w&&Hi(a))}return()=>{a.removeEventListener(Yf,u),setTimeout(()=>{const P=new CustomEvent(Zf,Ug);a.addEventListener(Zf,l),a.dispatchEvent(P),P.defaultPrevented||Hi(w??document.body,{select:!0}),a.removeEventListener(Zf,l),Vg.remove(y)},0)}}},[a,u,l,y]);const b=I.useCallback(w=>{if(!r&&!n||y.paused)return;const A=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,P=document.activeElement;if(A&&P){const R=w.currentTarget,[N,F]=jL(R);N&&F?!w.shiftKey&&P===F?(w.preventDefault(),r&&Hi(N,{select:!0})):w.shiftKey&&P===N&&(w.preventDefault(),r&&Hi(F,{select:!0})):P===R&&w.preventDefault()}},[r,n,y.paused]);return _.jsx(Gt.div,{tabIndex:-1,...o,ref:h,onKeyDown:b})});tS.displayName=IL;function PL(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Hi(n,{select:t}),document.activeElement!==r)return}function jL(e){const t=rS(e),r=zg(t,e),n=zg(t.reverse(),e);return[r,n]}function rS(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 zg(e,t){for(const r of e)if(!kL(r,{upTo:t}))return r}function kL(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 RL(e){return e instanceof HTMLInputElement&&"select"in e}function Hi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&RL(e)&&t&&e.select()}}var Vg=NL();function NL(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=qg(e,t),e.unshift(t)},remove(t){var r;e=qg(e,t),(r=e[0])==null||r.resume()}}}function qg(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 $L=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},co=new WeakMap,Fc=new WeakMap,Uc={},Qf=0,nS=function(e){return e&&(e.host||nS(e.parentNode))},BL=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=nS(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})},LL=function(e,t,r,n){var i=BL(t,Array.isArray(e)?e:[e]);Uc[r]||(Uc[r]=new WeakMap);var s=Uc[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=(co.get(h)||0)+1,A=(s.get(h)||0)+1;co.set(h,w),s.set(h,A),o.push(h),w===1&&b&&Fc.set(h,!0),A===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(),Qf++,function(){o.forEach(function(f){var h=co.get(f)-1,y=s.get(f)-1;co.set(f,h),s.set(f,y),h||(Fc.has(f)||f.removeAttribute(n),Fc.delete(f)),y||f.removeAttribute(r)}),Qf--,Qf||(co=new WeakMap,co=new WeakMap,Fc=new WeakMap,Uc={})}},FL=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||$L(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),LL(n,i,r,"aria-hidden")):function(){return null}},Kn=function(){return Kn=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},Kn.apply(this,arguments)};function iS(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 UL(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))}var fu="right-scroll-bar-position",du="width-before-scroll-bar",zL="with-scroll-bars-hidden",VL="--removed-body-scroll-bar-size";function ed(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function qL(e,t){var r=se.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 WL=typeof window<"u"?I.useLayoutEffect:I.useEffect,Wg=new WeakMap;function GL(e,t){var r=qL(t||null,function(n){return e.forEach(function(i){return ed(i,n)})});return WL(function(){var n=Wg.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||ed(a,null)}),s.forEach(function(a){i.has(a)||ed(a,o)})}Wg.set(r,e)},[e]),r}function HL(e){return e}function KL(e,t){t===void 0&&(t=HL);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 JL(e){e===void 0&&(e={});var t=KL(null);return t.options=Kn({async:!0,ssr:!1},e),t}var sS=function(e){var t=e.sideCar,r=iS(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,Kn({},r))};sS.isSideCarExport=!0;function XL(e,t){return e.useMedium(t),sS}var oS=JL(),td=function(){},ql=I.forwardRef(function(e,t){var r=I.useRef(null),n=I.useState({onScrollCapture:td,onWheelCapture:td,onTouchMoveCapture:td}),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,A=e.as,P=A===void 0?"div":A,R=e.gapMode,N=iS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=h,L=GL([r,t]),G=Kn(Kn({},N),i);return I.createElement(I.Fragment,null,l&&I.createElement(F,{sideCar:oS,removeScrollBar:u,shards:f,noIsolation:y,inert:b,setCallbacks:s,allowPinchZoom:!!w,lockRef:r,gapMode:R}),o?I.cloneElement(I.Children.only(a),Kn(Kn({},G),{ref:L})):I.createElement(P,Kn({},G,{className:c,ref:L}),a))});ql.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ql.classNames={fullWidth:du,zeroRight:fu};var Gg,YL=function(){if(Gg)return Gg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ZL(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=YL();return t&&e.setAttribute("nonce",t),e}function QL(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function eF(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var tF=function(){var e=0,t=null;return{add:function(r){e==0&&(t=ZL())&&(QL(t,r),eF(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},rF=function(){var e=tF();return function(t,r){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},aS=function(){var e=rF(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},nF={left:0,top:0,right:0,gap:0},rd=function(e){return parseInt(e||"",10)||0},iF=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[rd(r),rd(n),rd(i)]},sF=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return nF;var t=iF(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])}},oF=aS(),ko="data-scroll-locked",aF=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(
|
|
57
|
+
`}}),I.createElement(y0,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:h,grayColor:b,panelBackground:A,radius:R,scaling:F,onAppearanceChange:f,onAccentColorChange:y,onGrayColorChange:w,onPanelBackgroundChange:P,onRadiusChange:N,onScalingChange:L}))});U6.displayName="ThemeRoot";const y0=I.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=I.useContext(Ku),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:jr.appearance.default,accentColor:y=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:jr.accentColor.default,grayColor:b=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:jr.grayColor.default,panelBackground:w=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:jr.panelBackground.default,radius:A=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:jr.radius.default,scaling:P=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:jr.scaling.default,onAppearanceChange:R=oo,onAccentColorChange:N=oo,onGrayColorChange:F=oo,onPanelBackgroundChange:L=oo,onRadiusChange:G=oo,onScalingChange:q=oo,...J}=e,ne=u?ki:"div",ae=b==="auto"?F6(y):b,ce=e.appearance!==void 0&&e.appearance!=="inherit",V=e.grayColor!==void 0,$=!l&&(f===!0||f!==!1&&(ce||V));return I.createElement(Ku.Provider,{value:I.useMemo(()=>({appearance:h,accentColor:y,grayColor:b,resolvedGrayColor:ae,panelBackground:w,radius:A,scaling:P,onAppearanceChange:R,onAccentColorChange:N,onGrayColorChange:F,onPanelBackgroundChange:L,onRadiusChange:G,onScalingChange:q}),[h,y,b,ae,w,A,P,R,N,F,L,G,q])},I.createElement(ne,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":ae,"data-has-background":$?"true":"false","data-panel-background":w,"data-radius":A,"data-scaling":P,ref:t,...J,className:Xt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},J.className)}))});y0.displayName="ThemeImpl";function VB(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 Ec={type:"enum",values:jr.accentColor.values,default:void 0},Ul={type:"boolean",default:void 0};function _t(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 Es=["0","1","2","3","4","5","6","7","8","9"],qB={p:{type:"enum",values:Es,default:void 0,responsive:!0},px:{type:"enum",values:Es,default:void 0,responsive:!0},py:{type:"enum",values:Es,default:void 0,responsive:!0},pt:{type:"enum",values:Es,default:void 0,responsive:!0},pr:{type:"enum",values:Es,default:void 0,responsive:!0},pb:{type:"enum",values:Es,default:void 0,responsive:!0},pl:{type:"enum",values:Es,default:void 0,responsive:!0}};function WB(e){const{p:t=wr.p.default,px:r=wr.px.default,py:n=wr.py.default,pt:i=wr.pt.default,pr:s=wr.pr.default,pb:o=wr.pb.default,pl:a=wr.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:s,pb:o,pl:a,rest:c}}function GB(e){return[_t(e.p,"rt-r-p"),_t(e.px,"rt-r-px"),_t(e.py,"rt-r-py"),_t(e.pt,"rt-r-pt"),_t(e.pr,"rt-r-pr"),_t(e.pb,"rt-r-pb"),_t(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const HB=["static","relative","absolute","fixed","sticky"],_a=["auto","0","50%","100%"],Fg=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],KB=["0","1"],JB=["0","1"],wr={...qB,position:{type:"enum",values:HB,default:void 0,responsive:!0},inset:{type:"enum",values:_a,default:void 0,responsive:!0},top:{type:"enum",values:_a,default:void 0,responsive:!0},right:{type:"enum",values:_a,default:void 0,responsive:!0},bottom:{type:"enum",values:_a,default:void 0,responsive:!0},left:{type:"enum",values:_a,default:void 0,responsive:!0},width:{type:"enum",values:Fg,default:void 0,responsive:!0},height:{type:"enum",values:Fg,default:void 0,responsive:!0},shrink:{type:"enum",values:KB,default:void 0,responsive:!0},grow:{type:"enum",values:JB,default:void 0,responsive:!0}};function XB(e){const{rest:t,...r}=WB(e),{position:n=wr.position.default,width:i=wr.width.default,height:s=wr.height.default,inset:o=wr.inset.default,top:a=wr.top.default,bottom:c=wr.bottom.default,left:u=wr.left.default,right:l=wr.right.default,shrink:f=wr.shrink.default,grow:h=wr.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 YB(e){return[GB(e),_t(e.position,"rt-r-position"),_t(e.shrink,"rt-r-fs"),_t(e.grow,"rt-r-fg"),_t(e.width,"rt-r-w"),_t(e.height,"rt-r-h"),_t(e.inset,"rt-r-inset"),_t(e.top,"rt-r-top"),_t(e.bottom,"rt-r-bottom"),_t(e.left,"rt-r-left"),_t(e.right,"rt-r-right")].filter(Boolean).join(" ")}const Cs=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Ms={m:{type:"enum",values:Cs,default:void 0,responsive:!0},mx:{type:"enum",values:Cs,default:void 0,responsive:!0},my:{type:"enum",values:Cs,default:void 0,responsive:!0},mt:{type:"enum",values:Cs,default:void 0,responsive:!0},mr:{type:"enum",values:Cs,default:void 0,responsive:!0},mb:{type:"enum",values:Cs,default:void 0,responsive:!0},ml:{type:"enum",values:Cs,default:void 0,responsive:!0}};function ia(e){const{m:t=Ms.m.default,mx:r=Ms.mx.default,my:n=Ms.my.default,mt:i=Ms.mt.default,mr:s=Ms.mr.default,mb:o=Ms.mb.default,ml:a=Ms.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function sa(e){return[_t(e.m,"rt-r-m"),_t(e.mx,"rt-r-mx"),_t(e.my,"rt-r-my"),_t(e.mt,"rt-r-mt"),_t(e.mr,"rt-r-mr"),_t(e.mb,"rt-r-mb"),_t(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const b0={type:"enum",values:jr.radius.values,default:void 0},ZB=["none","inline-flex","flex"],QB=["row","column","row-reverse","column-reverse"],eL=["start","center","end","baseline","stretch"],tL=["start","center","end","between"],rL=["nowrap","wrap","wrap-reverse"],nL=["0","1","2","3","4","5","6","7","8","9"],ao={display:{type:"enum",values:ZB,default:"flex",responsive:!0},direction:{type:"enum",values:QB,default:void 0,responsive:!0},align:{type:"enum",values:eL,default:void 0,responsive:!0},justify:{type:"enum",values:tL,default:"start",responsive:!0},wrap:{type:"enum",values:rL,default:void 0,responsive:!0},gap:{type:"enum",values:nL,default:void 0,responsive:!0}},z6=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{rest:i,...s}=XB(r),{className:o,asChild:a,display:c=ao.display.default,direction:u=ao.direction.default,align:l=ao.align.default,justify:f=ao.justify.default,wrap:h=ao.wrap.default,gap:y=ao.gap.default,...b}=i,w=a?ki:"div";return I.createElement(w,{...b,ref:t,className:Xt("rt-Flex",o,_t(c,"rt-r-display"),_t(u,"rt-r-fd"),_t(l,"rt-r-ai"),_t(f,"rt-r-jc",{between:"space-between"}),_t(h,"rt-r-fw"),_t(y,"rt-r-gap"),YB(s),sa(n))})});z6.displayName="Flex";function V6(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 w0="Checkbox",[iL,gX]=ea(w0),[sL,oL]=iL(w0),q6=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=Zt(t,F=>y(F)),w=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,R]=Sc({prop:i,defaultProp:s,onChange:u}),N=I.useRef(P);return I.useEffect(()=>{const F=h==null?void 0:h.form;if(F){const L=()=>R(N.current);return F.addEventListener("reset",L),()=>F.removeEventListener("reset",L)}},[h,R]),_.jsxs(sL,{scope:r,state:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"checkbox","aria-checked":is(P)?"mixed":P,"aria-required":o,"data-state":H6(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onKeyDown:rt(e.onKeyDown,F=>{F.key==="Enter"&&F.preventDefault()}),onClick:rt(e.onClick,F=>{R(L=>is(L)?!0:!L),A&&(w.current=F.isPropagationStopped(),w.current||F.stopPropagation())})}),A&&_.jsx(aL,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:is(s)?!1:s})]})});q6.displayName=w0;var W6="CheckboxIndicator",G6=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=oL(W6,r);return _.jsx(Nn,{present:n||is(s.state)||s.state===!0,children:_.jsx(Gt.span,{"data-state":H6(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});G6.displayName=W6;var aL=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=I.useRef(null),a=V6(r),c=h0(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=is(r),y.call(l,is(r)?!1:r),l.dispatchEvent(b)}},[a,r,n]);const u=I.useRef(is(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 is(e){return e==="indeterminate"}function H6(e){return is(e)?"indeterminate":e?"checked":"unchecked"}var cL=q6,uL=G6;const lL=["1","2","3"],fL=["classic","surface","soft"],Fc={size:{type:"enum",values:lL,default:"2",responsive:!0},variant:{type:"enum",values:fL,default:"surface"},color:Ec,highContrast:Ul},zl=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"})));zl.displayName="ThickCheckIcon";const dL=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"})));dL.displayName="ChevronDownIcon";const K6=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"})));K6.displayName="ThickChevronRightIcon";const hL=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"})));hL.displayName="InfoCircledIcon";const Vl=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,style:s,size:o=Fc.size.default,variant:a=Fc.variant.default,color:c=Fc.color.default,highContrast:u=Fc.highContrast.default,...l}=r;return I.createElement("span",{className:Xt("rt-CheckboxRoot",i,_t(o,"rt-r-size"),sa(n)),style:s},I.createElement(cL,{"data-accent-color":c,...l,ref:t,className:Xt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},I.createElement(uL,{className:"rt-CheckboxIndicator"},I.createElement(zl,{className:"rt-CheckboxIndicatorIcon"}))))});Vl.displayName="Checkbox";function pL(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,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,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,mL(i,...t)]}function mL(...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 J6(e){const t=e+"CollectionProvider",[r,n]=pL(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:b,children:w}=y,A=se.useRef(null),P=se.useRef(new Map).current;return _.jsx(i,{scope:b,itemMap:P,collectionRef:A,children:w})};o.displayName=t;const a=e+"CollectionSlot",c=se.forwardRef((y,b)=>{const{scope:w,children:A}=y,P=s(a,w),R=Zt(b,P.collectionRef);return _.jsx(ki,{ref:R,children:A})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=se.forwardRef((y,b)=>{const{scope:w,children:A,...P}=y,R=se.useRef(null),N=Zt(b,R),F=s(u,w);return se.useEffect(()=>(F.itemMap.set(R,{ref:R,...P}),()=>void F.itemMap.delete(R))),_.jsx(ki,{[l]:"",ref:N,children:A})});f.displayName=u;function h(y){const b=s(e+"CollectionConsumer",y);return se.useCallback(()=>{const A=b.collectionRef.current;if(!A)return[];const P=Array.from(A.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 gL(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,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,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,vL(i,...t)]}function vL(...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 Zf="rovingFocusGroup.onEntryFocus",yL={bubbles:!1,cancelable:!0},ql="RovingFocusGroup",[gh,X6,bL]=J6(ql),[wL,Y6]=gL(ql,[bL]),[_L,xL]=wL(ql),Z6=I.forwardRef((e,t)=>_.jsx(gh.Provider,{scope:e.__scopeRovingFocusGroup,children:_.jsx(gh.Slot,{scope:e.__scopeRovingFocusGroup,children:_.jsx(SL,{...e,ref:t})})}));Z6.displayName=ql;var SL=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=Zt(t,h),b=v0(s),[w=null,A]=Sc({prop:o,defaultProp:a,onChange:c}),[P,R]=I.useState(!1),N=mr(u),F=X6(r),L=I.useRef(!1),[G,q]=I.useState(0);return I.useEffect(()=>{const J=h.current;if(J)return J.addEventListener(Zf,N),()=>J.removeEventListener(Zf,N)},[N]),_.jsx(_L,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:w,onItemFocus:I.useCallback(J=>A(J),[A]),onItemShiftTab:I.useCallback(()=>R(!0),[]),onFocusableItemAdd:I.useCallback(()=>q(J=>J+1),[]),onFocusableItemRemove:I.useCallback(()=>q(J=>J-1),[]),children:_.jsx(Gt.div,{tabIndex:P||G===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:rt(e.onMouseDown,()=>{L.current=!0}),onFocus:rt(e.onFocus,J=>{const ne=!L.current;if(J.target===J.currentTarget&&ne&&!P){const ae=new CustomEvent(Zf,yL);if(J.currentTarget.dispatchEvent(ae),!ae.defaultPrevented){const ce=F().filter(m=>m.focusable),V=ce.find(m=>m.active),$=ce.find(m=>m.id===w),d=[V,$,...ce].filter(Boolean).map(m=>m.ref.current);tS(d,l)}}L.current=!1}),onBlur:rt(e.onBlur,()=>R(!1))})})}),Q6="RovingFocusGroupItem",eS=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=rc(),c=s||a,u=xL(Q6,r),l=u.currentTabStopId===c,f=X6(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return I.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),_.jsx(gh.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:rt(e.onMouseDown,b=>{n?u.onItemFocus(c):b.preventDefault()}),onFocus:rt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:rt(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=ML(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(R=>R.focusable).map(R=>R.ref.current);if(w==="last")P.reverse();else if(w==="prev"||w==="next"){w==="prev"&&P.reverse();const R=P.indexOf(b.currentTarget);P=u.loop?TL(P,R+1):P.slice(R+1)}setTimeout(()=>tS(P))}})})})});eS.displayName=Q6;var EL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function CL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ML(e,t,r){const n=CL(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return EL[n]}function tS(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 AL=Z6,OL=eS;function IL(e,[t,r]){return Math.min(r,Math.max(t,e))}var Qf=0;function PL(){I.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ug()),document.body.insertAdjacentElement("beforeend",e[1]??Ug()),Qf++,()=>{Qf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Qf--}},[])}function Ug(){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 ed="focusScope.autoFocusOnMount",td="focusScope.autoFocusOnUnmount",zg={bubbles:!1,cancelable:!0},jL="FocusScope",rS=I.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=I.useState(null),u=mr(i),l=mr(s),f=I.useRef(null),h=Zt(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(N){if(y.paused||!a)return;const F=N.target;a.contains(F)?f.current=F:Hi(f.current,{select:!0})},A=function(N){if(y.paused||!a)return;const F=N.relatedTarget;F!==null&&(a.contains(F)||Hi(f.current,{select:!0}))},P=function(N){if(document.activeElement===document.body)for(const L of N)L.removedNodes.length>0&&Hi(a)};document.addEventListener("focusin",w),document.addEventListener("focusout",A);const R=new MutationObserver(P);return a&&R.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",A),R.disconnect()}}},[n,a,y.paused]),I.useEffect(()=>{if(a){qg.add(y);const w=document.activeElement;if(!a.contains(w)){const P=new CustomEvent(ed,zg);a.addEventListener(ed,u),a.dispatchEvent(P),P.defaultPrevented||(kL(BL(nS(a)),{select:!0}),document.activeElement===w&&Hi(a))}return()=>{a.removeEventListener(ed,u),setTimeout(()=>{const P=new CustomEvent(td,zg);a.addEventListener(td,l),a.dispatchEvent(P),P.defaultPrevented||Hi(w??document.body,{select:!0}),a.removeEventListener(td,l),qg.remove(y)},0)}}},[a,u,l,y]);const b=I.useCallback(w=>{if(!r&&!n||y.paused)return;const A=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,P=document.activeElement;if(A&&P){const R=w.currentTarget,[N,F]=RL(R);N&&F?!w.shiftKey&&P===F?(w.preventDefault(),r&&Hi(N,{select:!0})):w.shiftKey&&P===N&&(w.preventDefault(),r&&Hi(F,{select:!0})):P===R&&w.preventDefault()}},[r,n,y.paused]);return _.jsx(Gt.div,{tabIndex:-1,...o,ref:h,onKeyDown:b})});rS.displayName=jL;function kL(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Hi(n,{select:t}),document.activeElement!==r)return}function RL(e){const t=nS(e),r=Vg(t,e),n=Vg(t.reverse(),e);return[r,n]}function nS(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 Vg(e,t){for(const r of e)if(!NL(r,{upTo:t}))return r}function NL(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 DL(e){return e instanceof HTMLInputElement&&"select"in e}function Hi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&DL(e)&&t&&e.select()}}var qg=$L();function $L(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Wg(e,t),e.unshift(t)},remove(t){var r;e=Wg(e,t),(r=e[0])==null||r.resume()}}}function Wg(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function BL(e){return e.filter(t=>t.tagName!=="A")}var LL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},co=new WeakMap,Uc=new WeakMap,zc={},rd=0,iS=function(e){return e&&(e.host||iS(e.parentNode))},FL=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=iS(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})},UL=function(e,t,r,n){var i=FL(t,Array.isArray(e)?e:[e]);zc[r]||(zc[r]=new WeakMap);var s=zc[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=(co.get(h)||0)+1,A=(s.get(h)||0)+1;co.set(h,w),s.set(h,A),o.push(h),w===1&&b&&Uc.set(h,!0),A===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(),rd++,function(){o.forEach(function(f){var h=co.get(f)-1,y=s.get(f)-1;co.set(f,h),s.set(f,y),h||(Uc.has(f)||f.removeAttribute(n),Uc.delete(f)),y||f.removeAttribute(r)}),rd--,rd||(co=new WeakMap,co=new WeakMap,Uc=new WeakMap,zc={})}},zL=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||LL(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),UL(n,i,r,"aria-hidden")):function(){return null}},Kn=function(){return Kn=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},Kn.apply(this,arguments)};function sS(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))}var du="right-scroll-bar-position",hu="width-before-scroll-bar",qL="with-scroll-bars-hidden",WL="--removed-body-scroll-bar-size";function nd(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function GL(e,t){var r=se.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 HL=typeof window<"u"?I.useLayoutEffect:I.useEffect,Gg=new WeakMap;function KL(e,t){var r=GL(t||null,function(n){return e.forEach(function(i){return nd(i,n)})});return HL(function(){var n=Gg.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||nd(a,null)}),s.forEach(function(a){i.has(a)||nd(a,o)})}Gg.set(r,e)},[e]),r}function JL(e){return e}function XL(e,t){t===void 0&&(t=JL);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 YL(e){e===void 0&&(e={});var t=XL(null);return t.options=Kn({async:!0,ssr:!1},e),t}var oS=function(e){var t=e.sideCar,r=sS(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,Kn({},r))};oS.isSideCarExport=!0;function ZL(e,t){return e.useMedium(t),oS}var aS=YL(),id=function(){},Wl=I.forwardRef(function(e,t){var r=I.useRef(null),n=I.useState({onScrollCapture:id,onWheelCapture:id,onTouchMoveCapture:id}),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,A=e.as,P=A===void 0?"div":A,R=e.gapMode,N=sS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=h,L=KL([r,t]),G=Kn(Kn({},N),i);return I.createElement(I.Fragment,null,l&&I.createElement(F,{sideCar:aS,removeScrollBar:u,shards:f,noIsolation:y,inert:b,setCallbacks:s,allowPinchZoom:!!w,lockRef:r,gapMode:R}),o?I.cloneElement(I.Children.only(a),Kn(Kn({},G),{ref:L})):I.createElement(P,Kn({},G,{className:c,ref:L}),a))});Wl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Wl.classNames={fullWidth:hu,zeroRight:du};var Hg,QL=function(){if(Hg)return Hg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function eF(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=QL();return t&&e.setAttribute("nonce",t),e}function tF(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function rF(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var nF=function(){var e=0,t=null;return{add:function(r){e==0&&(t=eF())&&(tF(t,r),rF(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},iF=function(){var e=nF();return function(t,r){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},cS=function(){var e=iF(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},sF={left:0,top:0,right:0,gap:0},sd=function(e){return parseInt(e||"",10)||0},oF=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[sd(r),sd(n),sd(i)]},aF=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return sF;var t=oF(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])}},cF=cS(),ko="data-scroll-locked",uF=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(qL,` {
|
|
59
59
|
overflow: hidden `).concat(n,`;
|
|
60
60
|
padding-right: `).concat(a,"px ").concat(n,`;
|
|
61
61
|
}
|
|
@@ -72,29 +72,29 @@ body { background-color: var(--color-page-background); }
|
|
|
72
72
|
`),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.`).concat(
|
|
75
|
+
.`).concat(du,` {
|
|
76
76
|
right: `).concat(a,"px ").concat(n,`;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
.`).concat(
|
|
79
|
+
.`).concat(hu,` {
|
|
80
80
|
margin-right: `).concat(a,"px ").concat(n,`;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
.`).concat(
|
|
83
|
+
.`).concat(du," .").concat(du,` {
|
|
84
84
|
right: 0 `).concat(n,`;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
.`).concat(
|
|
87
|
+
.`).concat(hu," .").concat(hu,` {
|
|
88
88
|
margin-right: 0 `).concat(n,`;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
body[`).concat(ko,`] {
|
|
92
|
-
`).concat(
|
|
92
|
+
`).concat(WL,": ").concat(a,`px;
|
|
93
93
|
}
|
|
94
|
-
`)},
|
|
94
|
+
`)},Kg=function(){var e=parseInt(document.body.getAttribute(ko)||"0",10);return isFinite(e)?e:0},lF=function(){I.useEffect(function(){return document.body.setAttribute(ko,(Kg()+1).toString()),function(){var e=Kg()-1;e<=0?document.body.removeAttribute(ko):document.body.setAttribute(ko,e.toString())}},[])},fF=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;lF();var s=I.useMemo(function(){return aF(i)},[i]);return I.createElement(cF,{styles:uF(s,!t,i,r?"":"!important")})},vh=!1;if(typeof window<"u")try{var Vc=Object.defineProperty({},"passive",{get:function(){return vh=!0,!0}});window.addEventListener("test",Vc,Vc),window.removeEventListener("test",Vc,Vc)}catch{vh=!1}var uo=vh?{passive:!1}:!1,dF=function(e){return e.tagName==="TEXTAREA"},uS=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!dF(e)&&r[t]==="visible")},hF=function(e){return uS(e,"overflowY")},pF=function(e){return uS(e,"overflowX")},Jg=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=lS(e,n);if(i){var s=fS(e,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},mF=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},gF=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},lS=function(e,t){return e==="v"?hF(t):pF(t)},fS=function(e,t){return e==="v"?mF(t):gF(t)},vF=function(e,t){return e==="h"&&t==="rtl"?-1:1},yF=function(e,t,r,n,i){var s=vF(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=fS(e,a),b=y[0],w=y[1],A=y[2],P=w-A-s*b;(b||P)&&lS(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},qc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Xg=function(e){return[e.deltaX,e.deltaY]},Yg=function(e){return e&&"current"in e?e.current:e},bF=function(e,t){return e[0]===t[0]&&e[1]===t[1]},wF=function(e){return`
|
|
95
95
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
96
96
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
97
|
-
`)},bF=0,lo=[];function wF(e){var t=I.useRef([]),r=I.useRef([0,0]),n=I.useRef(),i=I.useState(bF++)[0],s=I.useState(aS)[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=UL([e.lockRef.current],(e.shards||[]).map(Xg),!0).filter(Boolean);return w.forEach(function(A){return A.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=I.useCallback(function(w,A){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var P=Vc(w),R=r.current,N="deltaX"in w?w.deltaX:R[0]-P[0],F="deltaY"in w?w.deltaY:R[1]-P[1],L,G=w.target,q=Math.abs(N)>Math.abs(F)?"h":"v";if("touches"in w&&q==="h"&&G.type==="range")return!1;var J=Kg(q,G);if(!J)return!0;if(J?L=q:(L=q==="v"?"h":"v",J=Kg(q,G)),!J)return!1;if(!n.current&&"changedTouches"in w&&(N||F)&&(n.current=L),!L)return!0;var ne=n.current||L;return gF(ne,A,w,ne==="h"?N:F,!0)},[]),c=I.useCallback(function(w){var A=w;if(!(!lo.length||lo[lo.length-1]!==s)){var P="deltaY"in A?Jg(A):Vc(A),R=t.current.filter(function(L){return L.name===A.type&&(L.target===A.target||A.target===L.shadowParent)&&vF(L.delta,P)})[0];if(R&&R.should){A.cancelable&&A.preventDefault();return}if(!R){var N=(o.current.shards||[]).map(Xg).filter(Boolean).filter(function(L){return L.contains(A.target)}),F=N.length>0?a(A,N[0]):!o.current.noIsolation;F&&A.cancelable&&A.preventDefault()}}},[]),u=I.useCallback(function(w,A,P,R){var N={name:w,delta:A,target:P,should:R,shadowParent:_F(P)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(F){return F!==N})},1)},[]),l=I.useCallback(function(w){r.current=Vc(w),n.current=void 0},[]),f=I.useCallback(function(w){u(w.type,Jg(w),w.target,a(w,e.lockRef.current))},[]),h=I.useCallback(function(w){u(w.type,Vc(w),w.target,a(w,e.lockRef.current))},[]);I.useEffect(function(){return lo.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,uo),document.addEventListener("touchmove",c,uo),document.addEventListener("touchstart",l,uo),function(){lo=lo.filter(function(w){return w!==s}),document.removeEventListener("wheel",c,uo),document.removeEventListener("touchmove",c,uo),document.removeEventListener("touchstart",l,uo)}},[]);var y=e.removeScrollBar,b=e.inert;return I.createElement(I.Fragment,null,b?I.createElement(s,{styles:yF(i)}):null,y?I.createElement(uF,{gapMode:e.gapMode}):null)}function _F(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const xF=XL(oS,wF);var fS=I.forwardRef(function(e,t){return I.createElement(ql,Kn({},e,{ref:t,sideCar:xF}))});fS.classNames=ql.classNames;const SF=fS;function EF(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var b0="ScrollArea",[dS,gX]=ea(b0),[CF,fn]=dS(b0),hS=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,A]=I.useState(null),[P,R]=I.useState(0),[N,F]=I.useState(0),[L,G]=I.useState(!1),[q,J]=I.useState(!1),ne=Zt(t,ce=>c(ce)),ae=m0(i);return _.jsx(CF,{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:A,scrollbarYEnabled:q,onScrollbarYEnabledChange:J,onCornerWidthChange:R,onCornerHeightChange:F,children:_.jsx(Gt.div,{dir:ae,...o,ref:ne,style:{position:"relative","--radix-scroll-area-corner-width":P+"px","--radix-scroll-area-corner-height":N+"px",...e.style}})})});hS.displayName=b0;var pS="ScrollAreaViewport",mS=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=fn(pS,r),a=I.useRef(null),c=Zt(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})})]})});mS.displayName=pS;var ai="ScrollAreaScrollbar",gS=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=fn(ai,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(MF,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(TF,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(vS,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(w0,{...n,ref:t}):null});gS.displayName=ai;var MF=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=fn(ai,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(vS,{"data-state":s?"visible":"hidden",...n,ref:t})})}),TF=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=fn(ai,e.__scopeScrollArea),s=e.orientation==="horizontal",o=Gl(()=>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(w0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:rt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:rt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),vS=I.forwardRef((e,t)=>{const r=fn(ai,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=I.useState(!1),a=e.orientation==="horizontal",c=Gl(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return zo(r.viewport,c),zo(r.content,c),_.jsx(Nn,{present:n||s,children:_.jsx(w0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),w0=I.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=fn(ai,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=xS(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 kF(h,o.current,a,y)}return r==="horizontal"?_.jsx(AF,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,y=Yg(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(OF,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=Yg(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}),AF=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=fn(ai,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Zt(t,c,s.onScrollbarXChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(bS,{"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":Wl(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),ES(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:Ju(o.paddingLeft),paddingEnd:Ju(o.paddingRight)}})}})}),OF=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=fn(ai,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Zt(t,c,s.onScrollbarYChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(bS,{"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":Wl(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),ES(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:Ju(o.paddingTop),paddingEnd:Ju(o.paddingBottom)}})}})}),[IF,yS]=dS(ai),bS=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(ai,r),[b,w]=I.useState(null),A=Zt(t,ne=>w(ne)),P=I.useRef(null),R=I.useRef(""),N=y.viewport,F=n.content-n.viewport,L=mr(l),G=mr(c),q=Gl(f,10);function J(ne){if(P.current){const ae=ne.clientX-P.current.left,ce=ne.clientY-P.current.top;u({x:ae,y:ce})}}return I.useEffect(()=>{const ne=ae=>{const ce=ae.target;(b==null?void 0:b.contains(ce))&&L(ae,F)};return document.addEventListener("wheel",ne,{passive:!1}),()=>document.removeEventListener("wheel",ne,{passive:!1})},[N,b,F,L]),I.useEffect(G,[n,G]),zo(b,q),zo(y.content,q),_.jsx(IF,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:mr(s),onThumbPointerUp:mr(o),onThumbPositionChange:G,onThumbPointerDown:mr(a),children:_.jsx(Gt.div,{...h,ref:A,style:{position:"absolute",...h.style},onPointerDown:rt(e.onPointerDown,ne=>{ne.button===0&&(ne.target.setPointerCapture(ne.pointerId),P.current=b.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),J(ne))}),onPointerMove:rt(e.onPointerMove,J),onPointerUp:rt(e.onPointerUp,ne=>{const ae=ne.target;ae.hasPointerCapture(ne.pointerId)&&ae.releasePointerCapture(ne.pointerId),document.body.style.webkitUserSelect=R.current,y.viewport&&(y.viewport.style.scrollBehavior=""),P.current=null})})})}),Ku="ScrollAreaThumb",wS=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=yS(Ku,e.__scopeScrollArea);return _.jsx(Nn,{present:r||i.hasThumb,children:_.jsx(PF,{ref:t,...n})})}),PF=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=fn(Ku,r),o=yS(Ku,r),{onThumbPositionChange:a}=o,c=Zt(t,f=>o.onThumbChange(f)),u=I.useRef(),l=Gl(()=>{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=RF(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:rt(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:rt(e.onPointerUp,o.onThumbPointerUp)})});wS.displayName=Ku;var _0="ScrollAreaCorner",_S=I.forwardRef((e,t)=>{const r=fn(_0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(jF,{...e,ref:t}):null});_S.displayName=_0;var jF=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=fn(_0,r),[s,o]=I.useState(0),[a,c]=I.useState(0),u=!!(s&&a);return zo(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),zo(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 Ju(e){return e?parseInt(e,10):0}function xS(e,t){const r=e/t;return isNaN(r)?0:r}function Wl(e){const t=xS(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function kF(e,t,r,n="ltr"){const i=Wl(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 SS([c,u],f)(e)}function Yg(e,t,r="ltr"){const n=Wl(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=AL(e,c);return SS([0,o],[0,a])(u)}function SS(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 ES(e,t){return e>0&&e<t}var RF=(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 Gl(e,t){const r=mr(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 zo(e,t){const r=mr(t);us(()=>{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 NF=hS,DF=mS,Zg=gS,Qg=wS,$F=_S,x0="Switch",[BF,vX]=ea(x0),[LF,FF]=BF(x0),CS=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=Zt(t,N=>y(N)),w=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,R]=xc({prop:i,defaultProp:s,onChange:u});return _.jsxs(LF,{scope:r,checked:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"switch","aria-checked":P,"aria-required":o,"data-state":AS(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onClick:rt(e.onClick,N=>{R(F=>!F),A&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),A&&_.jsx(UF,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});CS.displayName=x0;var MS="SwitchThumb",TS=I.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=FF(MS,r);return _.jsx(Gt.span,{"data-state":AS(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});TS.displayName=MS;var UF=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=I.useRef(null),o=z6(r),a=f0(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 AS(e){return e?"checked":"unchecked"}var zF=CS,VF=TS;const qF=["1","2","3"],WF=["classic","surface","soft"],xa={size:{type:"enum",values:qF,default:"2",responsive:!0},variant:{type:"enum",values:WF,default:"surface"},color:Sc,highContrast:Fl,radius:v0},OS=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,style:s,size:o=xa.size.default,variant:a=xa.variant.default,color:c=xa.color.default,highContrast:u=xa.highContrast.default,radius:l=xa.radius.default,...f}=r;return I.createElement("span",{"data-radius":l,className:Xt("rt-SwitchRoot",i,_t(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},sa(n)),style:s},I.createElement(zF,{"data-accent-color":c,...f,ref:t,className:Xt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},I.createElement(VF,{className:Xt("rt-SwitchThumb",{"rt-high-contrast":u})})))});OS.displayName="Switch";var mh=["Enter"," "],GF=["ArrowDown","PageUp","Home"],IS=["ArrowUp","PageDown","End"],HF=[...GF,...IS],KF={ltr:[...mh,"ArrowRight"],rtl:[...mh,"ArrowLeft"]},JF={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ec="Menu",[ic,XF,YF]=K6(Ec),[Ys,PS]=ea(Ec,[YF,Dl,X6]),Cc=Dl(),jS=X6(),[kS,vs]=Ys(Ec),[ZF,Mc]=Ys(Ec),RS=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=Cc(t),[c,u]=I.useState(null),l=I.useRef(!1),f=mr(s),h=m0(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(M6,{...a,children:_.jsx(kS,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(ZF,{scope:t,onClose:I.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};RS.displayName=Ec;var QF="MenuAnchor",S0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Cc(r);return _.jsx(T6,{...i,...n,ref:t})});S0.displayName=QF;var E0="MenuPortal",[eU,NS]=Ys(E0,{forceMount:void 0}),DS=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=vs(E0,t);return _.jsx(eU,{scope:t,forceMount:r,children:_.jsx(Nn,{present:r||s.open,children:_.jsx(I6,{asChild:!0,container:i,children:n})})})};DS.displayName=E0;var cn="MenuContent",[tU,C0]=Ys(cn),$S=I.forwardRef((e,t)=>{const r=NS(cn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(cn,e.__scopeMenu),o=Mc(cn,e.__scopeMenu);return _.jsx(ic.Provider,{scope:e.__scopeMenu,children:_.jsx(Nn,{present:n||s.open,children:_.jsx(ic.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(rU,{...i,ref:t}):_.jsx(nU,{...i,ref:t})})})})}),rU=I.forwardRef((e,t)=>{const r=vs(cn,e.__scopeMenu),n=I.useRef(null),i=Zt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return FL(s)},[]),_.jsx(M0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:rt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),nU=I.forwardRef((e,t)=>{const r=vs(cn,e.__scopeMenu);return _.jsx(M0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),M0=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,A=vs(cn,r),P=Mc(cn,r),R=Cc(r),N=jS(r),F=XF(r),[L,G]=I.useState(null),q=I.useRef(null),J=Zt(t,q,A.onContentChange),ne=I.useRef(0),ae=I.useRef(""),ce=I.useRef(0),V=I.useRef(null),$=I.useRef("right"),p=I.useRef(0),d=b?SF:I.Fragment,m=b?{as:ki,allowPinchZoom:!0}:void 0,x=E=>{var ve,pe;const O=ae.current+E,C=F().filter(Ee=>!Ee.disabled),g=document.activeElement,v=(ve=C.find(Ee=>Ee.ref.current===g))==null?void 0:ve.textValue,j=C.map(Ee=>Ee.textValue),ee=mU(j,O,v),ie=(pe=C.find(Ee=>Ee.textValue===ee))==null?void 0:pe.ref.current;(function Ee(Se){ae.current=Se,window.clearTimeout(ne.current),Se!==""&&(ne.current=window.setTimeout(()=>Ee(""),1e3))})(O),ie&&setTimeout(()=>ie.focus())};I.useEffect(()=>()=>window.clearTimeout(ne.current),[]),OL();const M=I.useCallback(E=>{var C,g;return $.current===((C=V.current)==null?void 0:C.side)&&vU(E,(g=V.current)==null?void 0:g.area)},[]);return _.jsx(tU,{scope:r,searchRef:ae,onItemEnter:I.useCallback(E=>{M(E)&&E.preventDefault()},[M]),onItemLeave:I.useCallback(E=>{var O;M(E)||((O=q.current)==null||O.focus(),G(null))},[M]),onTriggerLeave:I.useCallback(E=>{M(E)&&E.preventDefault()},[M]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:I.useCallback(E=>{V.current=E},[]),children:_.jsx(d,{...m,children:_.jsx(tS,{asChild:!0,trapped:i,onMountAutoFocus:rt(s,E=>{var O;E.preventDefault(),(O=q.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(n0,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:_.jsx(ML,{asChild:!0,...N,dir:P.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:G,onEntryFocus:rt(c,E=>{P.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(A6,{role:"menu","aria-orientation":"vertical","data-state":e8(A.open),"data-radix-menu-content":"",dir:P.dir,...R,...w,ref:J,style:{outline:"none",...w.style},onKeyDown:rt(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||!HF.includes(E.key))return;E.preventDefault();const ie=F().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);IS.includes(E.key)&&ie.reverse(),hU(ie)}),onBlur:rt(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(ne.current),ae.current="")}),onPointerMove:rt(e.onPointerMove,sc(E=>{const O=E.target,C=p.current!==E.clientX;if(E.currentTarget.contains(O)&&C){const g=E.clientX>p.current?"right":"left";$.current=g,p.current=E.clientX}}))})})})})})})});$S.displayName=cn;var iU="MenuGroup",T0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"group",...n,ref:t})});T0.displayName=iU;var sU="MenuLabel",BS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{...n,ref:t})});BS.displayName=sU;var Xu="MenuItem",ev="menu.itemSelect",Hl=I.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=I.useRef(null),o=Mc(Xu,e.__scopeMenu),a=C0(Xu,e.__scopeMenu),c=Zt(t,s),u=I.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(ev,{bubbles:!0,cancelable:!0});f.addEventListener(ev,y=>n==null?void 0:n(y),{once:!0}),i6(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(LS,{...i,ref:c,disabled:r,onClick:rt(e.onClick,l),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:rt(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:rt(e.onKeyDown,f=>{const h=a.searchRef.current!=="";r||h&&f.key===" "||mh.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Hl.displayName=Xu;var LS=I.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=C0(Xu,r),a=jS(r),c=I.useRef(null),u=Zt(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(ic.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:_.jsx(TL,{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:rt(e.onPointerMove,sc(b=>{n?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:rt(e.onPointerLeave,sc(b=>o.onItemLeave(b))),onFocus:rt(e.onFocus,()=>f(!0)),onBlur:rt(e.onBlur,()=>f(!1))})})})}),oU="MenuCheckboxItem",FS=I.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(WS,{scope:e.__scopeMenu,checked:r,children:_.jsx(Hl,{role:"menuitemcheckbox","aria-checked":Yu(r)?"mixed":r,...i,ref:t,"data-state":I0(r),onSelect:rt(i.onSelect,()=>n==null?void 0:n(Yu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});FS.displayName=oU;var US="MenuRadioGroup",[aU,cU]=Ys(US,{value:void 0,onValueChange:()=>{}}),zS=I.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=mr(n);return _.jsx(aU,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(T0,{...i,ref:t})})});zS.displayName=US;var VS="MenuRadioItem",qS=I.forwardRef((e,t)=>{const{value:r,...n}=e,i=cU(VS,e.__scopeMenu),s=r===i.value;return _.jsx(WS,{scope:e.__scopeMenu,checked:s,children:_.jsx(Hl,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":I0(s),onSelect:rt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});qS.displayName=VS;var A0="MenuItemIndicator",[WS,uU]=Ys(A0,{checked:!1}),GS=I.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=uU(A0,r);return _.jsx(Nn,{present:n||Yu(s.checked)||s.checked===!0,children:_.jsx(Gt.span,{...i,ref:t,"data-state":I0(s.checked)})})});GS.displayName=A0;var lU="MenuSeparator",HS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});HS.displayName=lU;var fU="MenuArrow",KS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Cc(r);return _.jsx(O6,{...i,...n,ref:t})});KS.displayName=fU;var O0="MenuSub",[dU,JS]=Ys(O0),XS=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=vs(O0,t),o=Cc(t),[a,c]=I.useState(null),[u,l]=I.useState(null),f=mr(i);return I.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(M6,{...o,children:_.jsx(kS,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(dU,{scope:t,contentId:tc(),triggerId:tc(),trigger:a,onTriggerChange:c,children:r})})})};XS.displayName=O0;var Pa="MenuSubTrigger",YS=I.forwardRef((e,t)=>{const r=vs(Pa,e.__scopeMenu),n=Mc(Pa,e.__scopeMenu),i=JS(Pa,e.__scopeMenu),s=C0(Pa,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(S0,{asChild:!0,...u,children:_.jsx(LS,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":e8(r.open),...e,ref:jl(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:rt(e.onPointerMove,sc(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:rt(e.onPointerLeave,sc(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,A=w==="right",P=A?-5:5,R=h[A?"left":"right"],N=h[A?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+P,y:f.clientY},{x:R,y:h.top},{x:N,y:h.top},{x:N,y:h.bottom},{x:R,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:rt(e.onKeyDown,f=>{var y;const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||KF[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});YS.displayName=Pa;var ZS="MenuSubContent",QS=I.forwardRef((e,t)=>{const r=NS(cn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(cn,e.__scopeMenu),o=Mc(cn,e.__scopeMenu),a=JS(ZS,e.__scopeMenu),c=I.useRef(null),u=Zt(t,c);return _.jsx(ic.Provider,{scope:e.__scopeMenu,children:_.jsx(Nn,{present:n||s.open,children:_.jsx(ic.Slot,{scope:e.__scopeMenu,children:_.jsx(M0,{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:rt(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:rt(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:rt(e.onKeyDown,l=>{var y;const f=l.currentTarget.contains(l.target),h=JF[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});QS.displayName=ZS;function e8(e){return e?"open":"closed"}function Yu(e){return e==="indeterminate"}function I0(e){return Yu(e)?"indeterminate":e?"checked":"unchecked"}function hU(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function pU(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function mU(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=pU(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 gU(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 vU(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return gU(r,t)}function sc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var yU=RS,bU=S0,wU=DS,_U=$S,xU=T0,SU=BS,EU=Hl,CU=FS,MU=zS,TU=qS,AU=GS,OU=HS,IU=KS,PU=XS,jU=YS,kU=QS,P0="DropdownMenu",[RU,yX]=ea(P0,[PS]),Ir=PS(),[NU,t8]=RU(P0),r8=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Ir(t),u=I.useRef(null),[l=!1,f]=xc({prop:i,defaultProp:s,onChange:o});return _.jsx(NU,{scope:t,triggerId:tc(),triggerRef:u,contentId:tc(),open:l,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(h=>!h),[f]),modal:a,children:_.jsx(yU,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};r8.displayName=P0;var n8="DropdownMenuTrigger",i8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=t8(n8,r),o=Ir(r);return _.jsx(bU,{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:jl(t,s.triggerRef),onPointerDown:rt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:rt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});i8.displayName=n8;var DU="DropdownMenuPortal",s8=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Ir(t);return _.jsx(wU,{...n,...r})};s8.displayName=DU;var o8="DropdownMenuContent",a8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=t8(o8,r),s=Ir(r),o=I.useRef(!1);return _.jsx(_U,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:rt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:rt(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)"}})});a8.displayName=o8;var $U="DropdownMenuGroup",c8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(xU,{...i,...n,ref:t})});c8.displayName=$U;var BU="DropdownMenuLabel",u8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(SU,{...i,...n,ref:t})});u8.displayName=BU;var LU="DropdownMenuItem",l8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(EU,{...i,...n,ref:t})});l8.displayName=LU;var FU="DropdownMenuCheckboxItem",f8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(CU,{...i,...n,ref:t})});f8.displayName=FU;var UU="DropdownMenuRadioGroup",d8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(MU,{...i,...n,ref:t})});d8.displayName=UU;var zU="DropdownMenuRadioItem",h8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(TU,{...i,...n,ref:t})});h8.displayName=zU;var VU="DropdownMenuItemIndicator",p8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(AU,{...i,...n,ref:t})});p8.displayName=VU;var qU="DropdownMenuSeparator",m8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(OU,{...i,...n,ref:t})});m8.displayName=qU;var WU="DropdownMenuArrow",GU=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(IU,{...i,...n,ref:t})});GU.displayName=WU;var HU=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Ir(t),[a=!1,c]=xc({prop:n,defaultProp:s,onChange:i});return _.jsx(PU,{...o,open:a,onOpenChange:c,children:r})},KU="DropdownMenuSubTrigger",g8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(jU,{...i,...n,ref:t})});g8.displayName=KU;var JU="DropdownMenuSubContent",v8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(kU,{...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)"}})});v8.displayName=JU;var XU=r8,YU=i8,y8=s8,ZU=a8,QU=c8,ez=u8,tz=l8,rz=f8,nz=d8,iz=h8,b8=p8,sz=m8,oz=HU,az=g8,cz=v8;const uz=["1","2","3"],lz=["vertical","horizontal","both"],nd={size:{type:"enum",values:uz,default:"1",responsive:!0},radius:v0,scrollbars:{type:"enum",values:lz,default:"both"}},j0=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=nd.size.default,radius:l=nd.radius.default,scrollbars:f=nd.scrollbars.default,...h}=r;return I.createElement(NF,{type:o,scrollHideDelay:a,className:Xt("rt-ScrollAreaRoot",i,sa(n)),style:s},I.createElement(DF,{...h,ref:t,className:"rt-ScrollAreaViewport"}),I.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?I.createElement(Zg,{"data-radius":l,orientation:"horizontal",className:Xt("rt-ScrollAreaScrollbar",_t(u,"rt-r-size"))},I.createElement(Qg,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?I.createElement(Zg,{"data-radius":l,orientation:"vertical",className:Xt("rt-ScrollAreaScrollbar",_t(u,"rt-r-size"))},I.createElement(Qg,{className:"rt-ScrollAreaThumb"})):null,f==="both"?I.createElement($F,{className:"rt-ScrollAreaCorner"}):null)});j0.displayName="ScrollArea";const fz=["1","2"],dz=["solid","soft"],id={size:{type:"enum",values:fz,default:"2",responsive:!0},variant:{type:"enum",values:dz,default:"solid"},color:Sc,highContrast:Fl},w8={color:Sc,shortcut:{type:"string",default:void 0}},_8=e=>I.createElement(XU,{...e});_8.displayName="DropdownMenuRoot";const x8=I.forwardRef((e,t)=>I.createElement(YU,{...e,ref:t,asChild:!0}));x8.displayName="DropdownMenuTrigger";const S8=I.createContext({}),E8=I.forwardRef((e,t)=>{const r=FB(),{className:n,children:i,size:s=id.size.default,variant:o=id.variant.default,highContrast:a=id.highContrast.default,color:c=w8.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return I.createElement(y8,{container:u,forceMount:l},I.createElement(Ll,{asChild:!0},I.createElement(ZU,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Xt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,_t(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},I.createElement(j0,{type:"auto"},I.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},I.createElement(S8.Provider,{value:I.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});E8.displayName="DropdownMenuContent";const C8=I.forwardRef((e,t)=>I.createElement(ez,{...e,ref:t,className:Xt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));C8.displayName="DropdownMenuLabel";const M8=I.forwardRef((e,t)=>{const{className:r,children:n,color:i=w8.color.default,shortcut:s,...o}=e;return I.createElement(tz,{"data-accent-color":i,...o,ref:t,className:Xt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},I.createElement(ta,null,n),s&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});M8.displayName="DropdownMenuItem";const T8=I.forwardRef((e,t)=>I.createElement(QU,{...e,ref:t,className:Xt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));T8.displayName="DropdownMenuGroup";const A8=I.forwardRef((e,t)=>I.createElement(nz,{...e,ref:t,className:Xt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));A8.displayName="DropdownMenuRadioGroup";const O8=I.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return I.createElement(iz,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},I.createElement(ta,null,r),I.createElement(b8,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(Ul,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});O8.displayName="DropdownMenuRadioItem";const I8=I.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return I.createElement(rz,{...s,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},I.createElement(ta,null,r),I.createElement(b8,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(Ul,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});I8.displayName="DropdownMenuCheckboxItem";const P8=e=>I.createElement(oz,{...e});P8.displayName="DropdownMenuSub";const j8=I.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return I.createElement(az,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},I.createElement(ta,null,n),I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},I.createElement(H6,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});j8.displayName="DropdownMenuSubTrigger";const k8=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(S8);return I.createElement(y8,{container:i,forceMount:s},I.createElement(Ll,{asChild:!0},I.createElement(cz,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Xt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,_t(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},I.createElement(j0,{type:"auto"},I.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});k8.displayName="DropdownMenuSubContent";const R8=I.forwardRef((e,t)=>I.createElement(sz,{...e,ref:t,className:Xt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));R8.displayName="DropdownMenuSeparator";const un=Object.assign({},{Root:_8,Trigger:x8,Content:E8,Label:C8,Item:M8,Group:T8,RadioGroup:A8,RadioItem:O8,CheckboxItem:I8,Sub:P8,SubTrigger:j8,SubContent:k8,Separator:R8}),hz=["1","2","3","4"],pz=["classic","solid","soft","surface","outline","ghost"],Sa={size:{type:"enum",values:hz,default:"2",responsive:!0},variant:{type:"enum",values:pz,default:"solid"},color:Sc,highContrast:Fl,radius:v0},N8=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,asChild:s=!1,size:o=Sa.size.default,variant:a=Sa.variant.default,color:c=Sa.color.default,highContrast:u=Sa.highContrast.default,radius:l=Sa.radius.default,...f}=r,h=s?ki:"button";return I.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Xt("rt-reset","rt-BaseButton",i,_t(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},sa(n))})});N8.displayName="BaseButton";const D8=I.forwardRef((e,t)=>I.createElement(N8,{...e,ref:t,className:Xt("rt-Button",e.className)}));D8.displayName="Button";const mz={loading:{type:"boolean",default:!0}},oa=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,children:s,loading:o=mz.loading.default,...a}=r;if(!o)return I.createElement(I.Fragment,null,s);const c=I.isValidElement(s)?ki:"span";return I.createElement(c,{ref:t,"aria-hidden":!0,className:Xt("rt-Skeleton",i,sa(n)),"data-inline-skeleton":I.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});oa.displayName="Skeleton";const gz=zt("/images/ghost_loading.png"),vz=zt("/images/primary_loading.png"),yz={primary:vz,ghost:gz};function bz({size:e="24px",variant:t="primary",wrapStyle:r={}}){return _.jsx(U6,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:_.jsx("img",{src:yz[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const wz="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==",sd="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 Kr({src:e,alt:t,className:r,style:n,showWarn:i,...s}){const[o,a]=se.useState(sd),c=u=>{a(sd)};return se.useEffect(()=>{a(e||sd)},[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:wz})]})}function _z({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=Qo(),a=se.useMemo(()=>{if(n&&r)return n(r)},[r]),c=se.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(bz,{})}),_.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(r6,{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"}),Pl.map(u=>_.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:_.jsx(Kr,{src:u.img})},u.link))]})]}),_.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(s),children:_.jsx("use",{xlinkHref:"#icon-close"})})]})}const xz=Bi((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}=xz(),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=se.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),rl.createPortal(_.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>_.jsx(_z,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}};function Sz(){const{mevProtect:e,setMevProtect:t}=Xr();return _.jsxs(un.Root,{children:[_.jsx(un.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(un.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:zt("/images/icon_mev@2x.png")}),_.jsx("span",{children:"MEV Protect"})]}),_.jsx(OS,{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 Ez({onClick:e}){const[t,r]=se.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"})})})}function k0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(D8,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function Cz(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Xr();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(Mz,{onClose:()=>e(!1)})]})}function Mz({onClose:e}){const{slippage:t,setSlippage:r}=Xr(),[n,i]=se.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=se.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:"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:pD.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(k0,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function Tz({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(Cz,{}),_.jsx(Sz,{}),_.jsx(Ez,{onClick:e})]})]})})}function Az(){const[e,t]=se.useState(!1);return _.jsxs(un.Root,{open:e,onOpenChange:t,children:[_.jsx(un.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(un.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(Oz,{}),_.jsx(Pz,{onClose:()=>{t(!1)}})]})})]})}function Oz(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Xr(),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:Pl.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(zl,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),_.jsx("img",{src:s.img}),_.jsx("span",{children:s.name})]}))})]})}const Iz=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function Pz({onClose:e}){const{addTxToast:t}=aa(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=Xr(),[a,c]=se.useState(i),[u,l]=se.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(zl,{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(k0,{btnIsDisabled:Iz(a),text:"Save",onClick:b})]})]})]})}const Dn=Bi((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 jz=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()}},kz=jz,tv={"text/plain":"Text","text/html":"Url",default:"Text"},Rz="Copy to clipboard: #{key}, Enter";function Nz(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function Dz(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=kz(),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=tv[t.format]||tv.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=Nz("message"in t?t.message:Rz),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var $z=Dz;const $8=dc($z);function Bz({currentAccount:e}){const{mutate:t}=Lr.useSwitchAccount(),r=Lr.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=Dn(),s=()=>{i(!n)};se.useEffect(()=>()=>{i(!1)},[]);const o=se.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);se.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:Gs(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:Gs(c==null?void 0:c.address)})]}),_.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}function Lz({connect:e}){const t=Lr.useCurrentAccount();return se.useEffect(()=>{},[t]),_.jsx("div",{children:t?_.jsx(Fz,{}):_.jsx(k0,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})}function Fz(){const{mutate:e}=Lr.useDisconnectWallet(),t=Lr.useCurrentAccount(),{currentWallet:r}=Lr.useCurrentWallet(),{addCommonToast:n}=aa(),{getExplorerUrl:i}=Qo(),s=()=>{t&&($8(t.address||"",{debug:!1,message:"message"}),n("Copied"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return se.useEffect(()=>{},[r]),_.jsxs(un.Root,{children:[_.jsx(un.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:Gs(t==null?void 0:t.address)})]})}),_.jsx(un.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(Bz,{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 Uz(){Lr.useCurrentAccount(),Lr.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Dn();return Lr.useWallets(),_.jsx(_.Fragment,{children:_.jsx(Lr.ConnectModal,{trigger:_.jsx(Lz,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function zz({independentWallet:e,customWallet:t}){return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"widget-header",children:[_.jsx("img",{src:zt("/images/logo@2x.png"),className:"cetus-logo"}),_.jsxs("div",{className:"right",children:[e&&_.jsx(Uz,{}),_.jsx(Az,{})]})]}),_.jsx("div",{style:{marginTop:"20px"}})]})}const B8=()=>{const e=se.useRef(null);se.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 Vz({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=se.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(qz,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(Wz,{info:s,status:r,tx:i,onClose:e})]})}function qz({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(B8,{})}),_.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 Wz({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Qo();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"}),Pl.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 Kl(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await fD(`${i||zu.api}${t}`,n):await dD(`${i||zu.api}${t}`,n)}catch(s){throw s}}}}function Gz(){const{fetchByApi:e}=Kl(),{setProviders:t}=Xr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function Hz({interval:e,callback:t}){const r=se.useRef(),n=se.useRef(null);se.useEffect(()=>{r.current=t},[t]);const i=se.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=se.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return se.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const Zs=Bi((e,t)=>({suiClient:new Ga({url:zu.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new k4,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),Kz=(e,t)=>({requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=new Map(n);s.set(Mr(r.coin_type).full_address,r);const o=i.filter(a=>a!==r.coin_type);e(()=>({tokenMap:s,requestTokenList:[...o]})),Ii.setItem(sh,s)},tokenMap:new Map,setTokenMap:(r,n=!1)=>{e(()=>({tokenMap:r})),n||Ii.setItem(sh,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||Ii.setItem(X4,r)}}),Tc=Bi(Kz);Ii.getItem(sh).then(e=>{e!==null&&Tc.getState().setTokenMap(e,!0)});Ii.getItem(X4).then(e=>{e!==null&&Tc.getState().setTrustedTokenList(e,!0)});function Jz(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 Qs(){const{suiClient:e}=Zs(),{fetchByApi:t}=Kl(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=Tc(),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,A)=>(w.set(A.coin_type,A),A.is_trusted&&h.push({...A,coin_type:Mr(A.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){J4(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const b=Jz(y,f);return i(b),b}}catch{}},l=se.useCallback(f=>{if(f)return n.get(Mr(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function Zu(e){const{suiClient:t}=Zs(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Dn(),{fetchTokenInfo:s}=Qs(),[o,a]=se.useState([]),{tokenMap:c}=Tc(),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({})};se.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 A=y[w],P=await s(A.coinType),R=rD(A.totalBalance,P==null?void 0:P.decimals),N=an(R,4);b[Mr(A.coinType).full_address]={...A,displayBalance:N,totalBalanceFormat:R}}catch{continue}n(b)},h=se.useMemo(()=>{if(e&&r)return i[e]||i[Mr(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const Xz=(e,t)=>({defaultFromCoin:void 0,defaultToCoin:void 0,isOpenSecondary:!1,byAmountIn:!0,findRouterLoading:!1,fromAmount:"",toAmount:"",fromCoin:void 0,toCoin:void 0,routerData:void 0,setDefaultCoin:(r,n)=>{e(()=>({defaultFromCoin:r,defaultToCoin: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}))}}),dn=Bi(Xz),Yz={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"}},Zz={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"}},L8=Yz,F8=Zz;function Qz(e,t){const{fetchTokenInfo:r}=Qs(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s}=dn(),{setSlippage:o,setRpcList:a,setCurrentRpc:c}=Xr(),u=se.useRef({}),l=async(h,y)=>{const b=h?await r(h):L8,w=y?await r(y):F8;n(b),i(w),s(b,w)},f=(h,y)=>{const b=[Uu[0]];let w=Uu[0];h.forEach(A=>{const P={name:A,link:A,isCustom:!1};b.push(P),A===y&&(w=P)}),a([...b,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(w)};return se.useEffect(()=>{if(!t0(e,u.current)){const{defaultFromToken:h,defaultToToken:y,defaultSlippage:b,customRpcList:w,defaultRpc:A}=e;l(h,y),b&&o(b),(w==null?void 0:w.length)>0&&f(w,A),u.current=e}},[e]),{handleSetDefaultPair:l}}function eV(){const{currentRpc:e}=Xr(),{setSuiClient:t,setAggregatorSDK:r}=Zs(),{currentAccount:n}=Dn();se.useEffect(()=>{if(e){const i=new Ga({url:e.link});t(i)}},[e]),se.useEffect(()=>{if(e){const i=new k4(zu.aggregatorUrl,(n==null?void 0:n.address)||void 0,new Ga({url:e.link}),oN.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const tV=(e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Mr(i).full_address]}),e({coinPriceObj:{...n}})}}),U8=Bi(tV);function Jl(){const{fetchByApi:e}=Kl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=U8(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>r0(l,!1))})).prices;if(u){const l={};u.forEach(f=>{l[Mr(f.base_symbol).full_address]=f}),r(l)}return u}catch{return n(a),null}},s=se.useCallback(a=>{if(!a)return;const c=t[Mr(a).full_address];if(c)return c},[t]),o=se.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 R0=Bi((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),br=[];for(let e=0;e<256;++e)br.push((e+256).toString(16).slice(1));function rV(e,t=0){return(br[e[t+0]]+br[e[t+1]]+br[e[t+2]]+br[e[t+3]]+"-"+br[e[t+4]]+br[e[t+5]]+"-"+br[e[t+6]]+br[e[t+7]]+"-"+br[e[t+8]]+br[e[t+9]]+"-"+br[e[t+10]]+br[e[t+11]]+br[e[t+12]]+br[e[t+13]]+br[e[t+14]]+br[e[t+15]]).toLowerCase()}let od;const nV=new Uint8Array(16);function iV(){if(!od){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");od=crypto.getRandomValues.bind(crypto)}return od(nV)}const sV=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rv={randomUUID:sV};function nv(e,t,r){if(rv.randomUUID&&!t&&!e)return rv.randomUUID();e=e||{};const n=e.random||(e.rng||iV)();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 rV(n)}var qs=(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))(qs||{});const oV=new Ga({url:a1("mainnet")}),aV=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],cV=["deny_list","DenyList","DenyCap","create_regulated_currency"],uV={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},lV=async e=>{let t=!1;if(aV.includes(e))return t;const r=e.split("::"),n=r[0]&&$r(r[0]),i=r[1],s=await oV.getObject({id:n,options:uV}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(cV.join("|"),"i").test(o)&&(t=!0),t},fV=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>r0(i,!1)))==null?void 0:n.join(",")};function dV(){const{fetchByApi:e}=Kl(),t=async n=>{try{const i={...n},s=fV(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=zt("/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=>za(b).source_address);f=l==null?void 0:l.filter(b=>{var P,R;const w=za((P=b==null?void 0:b.coin_a)==null?void 0:P.address).source_address,A=za((R=b==null?void 0:b.coin_b)==null?void 0:R.address).source_address;return(y==null?void 0:y.length)>1&&y.includes(w)&&y.includes(A)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(w)||y.includes(A)))})}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 hV(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Xr(),{getPoolList:n,getLocalJsonPoolList:i}=dV();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 pV(e){const{routerData:t}=dn();return{priceAcceptRouterData:se.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 z8(e,t){return{amountLimit:se.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 mV(e){const{getTokenInfo:t,fetchTokenInfo:r}=Qs();return{formatSwapRouter:se.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 A=Mr(w.from).full_address,P=Mr(w.target).full_address,R=t(A),N=t(P);R||a.includes(A)&&a.push(A),N||a.includes(P)&&a.push(P);const F=w.provider===Va.SCALLOP||w.provider===Va.FLOWX||w.provider===Va.FLOWXV3;b.push({from_type:A,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 gV(){const{fromCoin:e,toCoin:t}=dn(),{getPoolListByCoinType:r}=hV();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function V8(e,t,r){return se.useMemo(()=>t&&r&&+t&&+r?e?Le(r).div(t).toString():Le(t).div(r).toString():"0",[t,r,e])}function iv(e){const[t,r]=se.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await lV(i.coin_type)}catch{}return!1};return se.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function vV(e,t){const{defaultFromCoin:r,defaultToCoin:n}=dn(),i=se.useMemo(()=>(r==null?void 0:r.coin_type)!==L8.coin_type||(n==null?void 0:n.coin_type)!==F8.coin_type,[r,n]),s=se.useCallback(a=>(r==null?void 0:r.coin_type)!==(a==null?void 0:a.coin_type)||(n==null?void 0:n.coin_type)!==(a==null?void 0:a.coin_type),[r,n]),o=se.useMemo(()=>{const a=[];return i&&(e&&!e.is_trusted&&s(e)&&a.push({...e}),t&&!t.is_trusted&&s(t)&&a.push({...t})),a},[e==null?void 0:e.coin_type,t==null?void 0:t.coin_type,i]);return{isCustomMode:i,customWarnTokenList:o}}function yV(){const{aggregatorSDK:e}=Zs(),{getSwapPoolAddress:t}=gV(),r=s=>s&&s.error?s.error.code===qs.InsufficientLiquidity||qs.HoneyPot||qs.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 Nm(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 Nm(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=ih(l.amountIn.toString(),c.decimals).toString(),b=ih(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 fo(e){const t=se.useRef(e);return se.useEffect(()=>{t.current=e},[e]),t}function bV(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function wV(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 xV(e){return bV(e)?"User rejected the request":wV(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 N0={};Object.defineProperty(N0,"__esModule",{value:!0});var SV=N0.executeAuction=q8,EV=n4,CV="https://rpc.getshio.com",MV=500,TV=300;function q8(e,t,r){r===void 0&&(r=MV);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),EV.default.post(CV,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,TV)}).catch(s)})}N0.default={executeAuction:q8};function AV(){const{suiClient:e}=Zs(),{currentAccount:t}=Dn(),{mutateAsync:r}=Lr.useSignTransaction(),{mutate:n}=Lr.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=se.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:So.Transaction.from(Pn(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=So.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=So.Transaction.from(c)),typeof c=="string"&&(c=So.Transaction.from(Pn(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 OV(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=AV(),{currentAccount:n}=Dn(),{suiClient:i}=Zs(),{setTransactionData:s}=R0(),{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 Sg(u),l(y,b+1)}}const f=async(y,b,w={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var F,L;const{useDevInspect:A=!1,useMev:P,txAction:R="signTransactionBlock"}=w;let N;b.status="confirmation",s(b);try{let G;if(R==="signTransactionBlock"){const J=await e(y),{bytes:ne,signature:ae}=J;if(P)try{const ce=await SV(ne,ae,500)}catch{}G=await t(ne,ae,A)}else G=await r(y,A);b.status="submitted",s({...b}),b.tx=G.digest,N=o(b),await Sg(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 J=cD(q,n==null?void 0:n.address,!1);if(b.buildShowInfo){const ne=b.buildShowInfo("success",J);b.buildShowInfo=ae=>ne}a(N),b.status="success",s({...b})}return q}catch(G){h(b,G)}},h=(y,b)=>{const w=xV(b);if(y.buildShowInfo){const A=y.buildShowInfo("confirmation");y.buildShowInfo=P=>(A.toastDescriptionContent=w,A.modalDescriptionText=w,A),y.status="rejected",s({...y})}else y.buildShowInfo=A=>{const P={};return P.toastDescriptionContent=w,P.modalDescriptionText=w,P},y.status="rejected",s({...y})};return{signAndExecuteTransaction:f}}function D0(e,t=1e3){const r=se.useRef(),n=se.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return se.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function IV(){const{aggregatorSDK:e}=Zs(),{findBestRouters:t}=yV(),{getTokenAmountValue:r,fetchTokenPrices:n}=Jl(),{providers:i,slippage:s,mevProtect:o}=Xr(),{signAndExecuteTransaction:a}=OV(),{setTransactionData:c}=R0(),{addTxToast:u}=aa(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:b,fromAmount:w,toAmount:A,setFromAmount:P,setFindRouterLoading:R,setRouterData:N,setByAmountIn:F,byAmountIn:L}=dn(),[G,q]=se.useState(""),J=fo(G),ne=fo(L),ae=fo(w),ce=fo(A),V=fo(l),$=fo(f),{balanceInfo:p,getOwnerCoinBalances:d}=Zu(l==null?void 0:l.coin_type),{balanceInfo:m}=Zu(f==null?void 0:f.coin_type),x=r(l==null?void 0:l.coin_type,w),M=r(f==null?void 0:f.coin_type,A),O=D0(async(Se,Ke,Ue)=>{if(V.current&&$.current&&+Se){(+ae.current||+ce.current)&&R(!0);const lt=sD(Se,Ke?V.current.decimals:$.current.decimals),ht=await t({fromToken:V.current,toToken:$.current,amount:lt.toString(),providersKeys:i,by_amount_in:Ke,uuid:Ue});R(!1),J.current===Ue&&(Ke?+ae.current?(b(ht.toAmountUi||""),N(ht)):b(""):+ce.current?(P(ht.fromAmountUi||"ß"),N(ht)):P(""))}else v(!Ke)},500),C=(Se,Ke,Ue=!1)=>{if(F(Ke),Ke?(P(Se),Ue&&b("")):(b(Se),Ue&&P("")),+Se){const lt=nv();q(lt),O(Se,Ke,lt)}else R(!1),N(void 0),v(!Ke)},g=(Se,Ke=!0)=>{v(),Ke?((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(""),R(!1),N(void 0)},j=()=>{const Se=ne.current?ae.current:ce.current;if(+Se){const Ke=nv();q(Ke),O(Se,ne.current,Ke)}},ee=async(Se,Ke)=>{const{routerData:Ue,byAmountIn:lt,fromAmountUi:ht,toAmountUi:$e}=Se,mt=new So.Transaction,_e={routers:Ue.routes,byAmountIn:lt,slippage:Number(s)/100,txb:mt};Ke&&(_e.partner=Ke);try{await e.fastRouterSwap(_e);const ge={status:"confirmation",buildShowInfo:(qe,De)=>{const Oe=`Swap ${an(ht,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${an($e,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Ie={modalDescriptionText:Oe,toastTitleText:Oe};if(qe==="success"){let Fe=ht,ft=$e;De&&(Fe=Eg(De,l)||ht,ft=Eg(De,f)||$e);const dt=`Swapped ${an(Fe,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${an(ft,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`;Ie.toastTitleText=dt,Ie.modalDescriptionText=dt}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(Ae,qe){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};se.useEffect(()=>{ie(),v()},[l==null?void 0:l.coin_type,f==null?void 0:f.coin_type]);const ie=()=>{const Se=[];l&&Se.push(l.coin_type),f&&Se.push(f.coin_type),Se.length>0&&n(Se)},{isScamsCoin:ve}=iv(l),{isScamsCoin:pe}=iv(f),Ee=se.useMemo(()=>{if(!(!ve&&!pe)){if(ve&&pe)return`${l==null?void 0:l.symbol} and ${f==null?void 0:f.symbol} are`;if(ve)return`${l==null?void 0:l.symbol} token is `;if(pe)return`${f==null?void 0:f.symbol} token is `}},[ve,pe]);return{handleAmountChange:C,handleSelectToken:g,fromBalanceInfo:p,toBalanceInfo:m,fromAmountValue:x,toAmountValue:M,doSwapAction:ee,reCalculateRouteData:j,refreshMarketPrice:ie,scamsText:Ee}}function PV(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=dn(),{currentAccount:o}=Dn(),a=se.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===qs.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===qs.NoRouter||s.errorCode===qs.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Le(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${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 W8({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:`
|
|
97
|
+
`)},_F=0,lo=[];function xF(e){var t=I.useRef([]),r=I.useRef([0,0]),n=I.useRef(),i=I.useState(_F++)[0],s=I.useState(cS)[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(Yg),!0).filter(Boolean);return w.forEach(function(A){return A.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=I.useCallback(function(w,A){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var P=qc(w),R=r.current,N="deltaX"in w?w.deltaX:R[0]-P[0],F="deltaY"in w?w.deltaY:R[1]-P[1],L,G=w.target,q=Math.abs(N)>Math.abs(F)?"h":"v";if("touches"in w&&q==="h"&&G.type==="range")return!1;var J=Jg(q,G);if(!J)return!0;if(J?L=q:(L=q==="v"?"h":"v",J=Jg(q,G)),!J)return!1;if(!n.current&&"changedTouches"in w&&(N||F)&&(n.current=L),!L)return!0;var ne=n.current||L;return yF(ne,A,w,ne==="h"?N:F,!0)},[]),c=I.useCallback(function(w){var A=w;if(!(!lo.length||lo[lo.length-1]!==s)){var P="deltaY"in A?Xg(A):qc(A),R=t.current.filter(function(L){return L.name===A.type&&(L.target===A.target||A.target===L.shadowParent)&&bF(L.delta,P)})[0];if(R&&R.should){A.cancelable&&A.preventDefault();return}if(!R){var N=(o.current.shards||[]).map(Yg).filter(Boolean).filter(function(L){return L.contains(A.target)}),F=N.length>0?a(A,N[0]):!o.current.noIsolation;F&&A.cancelable&&A.preventDefault()}}},[]),u=I.useCallback(function(w,A,P,R){var N={name:w,delta:A,target:P,should:R,shadowParent:SF(P)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(F){return F!==N})},1)},[]),l=I.useCallback(function(w){r.current=qc(w),n.current=void 0},[]),f=I.useCallback(function(w){u(w.type,Xg(w),w.target,a(w,e.lockRef.current))},[]),h=I.useCallback(function(w){u(w.type,qc(w),w.target,a(w,e.lockRef.current))},[]);I.useEffect(function(){return lo.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,uo),document.addEventListener("touchmove",c,uo),document.addEventListener("touchstart",l,uo),function(){lo=lo.filter(function(w){return w!==s}),document.removeEventListener("wheel",c,uo),document.removeEventListener("touchmove",c,uo),document.removeEventListener("touchstart",l,uo)}},[]);var y=e.removeScrollBar,b=e.inert;return I.createElement(I.Fragment,null,b?I.createElement(s,{styles:wF(i)}):null,y?I.createElement(fF,{gapMode:e.gapMode}):null)}function SF(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const EF=ZL(aS,xF);var dS=I.forwardRef(function(e,t){return I.createElement(Wl,Kn({},e,{ref:t,sideCar:EF}))});dS.classNames=Wl.classNames;const CF=dS;function MF(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var _0="ScrollArea",[hS,vX]=ea(_0),[TF,dn]=hS(_0),pS=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,A]=I.useState(null),[P,R]=I.useState(0),[N,F]=I.useState(0),[L,G]=I.useState(!1),[q,J]=I.useState(!1),ne=Zt(t,ce=>c(ce)),ae=v0(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:A,scrollbarYEnabled:q,onScrollbarYEnabledChange:J,onCornerWidthChange:R,onCornerHeightChange:F,children:_.jsx(Gt.div,{dir:ae,...o,ref:ne,style:{position:"relative","--radix-scroll-area-corner-width":P+"px","--radix-scroll-area-corner-height":N+"px",...e.style}})})});pS.displayName=_0;var mS="ScrollAreaViewport",gS=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=dn(mS,r),a=I.useRef(null),c=Zt(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})})]})});gS.displayName=mS;var ai="ScrollAreaScrollbar",vS=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=dn(ai,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(AF,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(OF,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(yS,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(x0,{...n,ref:t}):null});vS.displayName=ai;var AF=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=dn(ai,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(yS,{"data-state":s?"visible":"hidden",...n,ref:t})})}),OF=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=dn(ai,e.__scopeScrollArea),s=e.orientation==="horizontal",o=Hl(()=>c("SCROLL_END"),100),[a,c]=MF("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(x0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:rt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:rt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),yS=I.forwardRef((e,t)=>{const r=dn(ai,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=I.useState(!1),a=e.orientation==="horizontal",c=Hl(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return zo(r.viewport,c),zo(r.content,c),_.jsx(Nn,{present:n||s,children:_.jsx(x0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),x0=I.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=dn(ai,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=SS(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 NF(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=Zg(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(PF,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=Zg(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=dn(ai,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Zt(t,c,s.onScrollbarXChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(wS,{"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":Gl(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),CS(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:Xu(o.paddingLeft),paddingEnd:Xu(o.paddingRight)}})}})}),PF=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=dn(ai,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Zt(t,c,s.onScrollbarYChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(wS,{"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":Gl(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),CS(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:Xu(o.paddingTop),paddingEnd:Xu(o.paddingBottom)}})}})}),[jF,bS]=hS(ai),wS=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=dn(ai,r),[b,w]=I.useState(null),A=Zt(t,ne=>w(ne)),P=I.useRef(null),R=I.useRef(""),N=y.viewport,F=n.content-n.viewport,L=mr(l),G=mr(c),q=Hl(f,10);function J(ne){if(P.current){const ae=ne.clientX-P.current.left,ce=ne.clientY-P.current.top;u({x:ae,y:ce})}}return I.useEffect(()=>{const ne=ae=>{const ce=ae.target;(b==null?void 0:b.contains(ce))&&L(ae,F)};return document.addEventListener("wheel",ne,{passive:!1}),()=>document.removeEventListener("wheel",ne,{passive:!1})},[N,b,F,L]),I.useEffect(G,[n,G]),zo(b,q),zo(y.content,q),_.jsx(jF,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:mr(s),onThumbPointerUp:mr(o),onThumbPositionChange:G,onThumbPointerDown:mr(a),children:_.jsx(Gt.div,{...h,ref:A,style:{position:"absolute",...h.style},onPointerDown:rt(e.onPointerDown,ne=>{ne.button===0&&(ne.target.setPointerCapture(ne.pointerId),P.current=b.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),J(ne))}),onPointerMove:rt(e.onPointerMove,J),onPointerUp:rt(e.onPointerUp,ne=>{const ae=ne.target;ae.hasPointerCapture(ne.pointerId)&&ae.releasePointerCapture(ne.pointerId),document.body.style.webkitUserSelect=R.current,y.viewport&&(y.viewport.style.scrollBehavior=""),P.current=null})})})}),Ju="ScrollAreaThumb",_S=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=bS(Ju,e.__scopeScrollArea);return _.jsx(Nn,{present:r||i.hasThumb,children:_.jsx(kF,{ref:t,...n})})}),kF=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=dn(Ju,r),o=bS(Ju,r),{onThumbPositionChange:a}=o,c=Zt(t,f=>o.onThumbChange(f)),u=I.useRef(),l=Hl(()=>{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=DF(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:rt(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:rt(e.onPointerUp,o.onThumbPointerUp)})});_S.displayName=Ju;var S0="ScrollAreaCorner",xS=I.forwardRef((e,t)=>{const r=dn(S0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(RF,{...e,ref:t}):null});xS.displayName=S0;var RF=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=dn(S0,r),[s,o]=I.useState(0),[a,c]=I.useState(0),u=!!(s&&a);return zo(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),zo(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 Xu(e){return e?parseInt(e,10):0}function SS(e,t){const r=e/t;return isNaN(r)?0:r}function Gl(e){const t=SS(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function NF(e,t,r,n="ltr"){const i=Gl(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 ES([c,u],f)(e)}function Zg(e,t,r="ltr"){const n=Gl(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 ES([0,o],[0,a])(u)}function ES(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 CS(e,t){return e>0&&e<t}var DF=(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 Hl(e,t){const r=mr(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 zo(e,t){const r=mr(t);us(()=>{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 $F=pS,BF=gS,Qg=vS,ev=_S,LF=xS,E0="Switch",[FF,yX]=ea(E0),[UF,zF]=FF(E0),MS=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=Zt(t,N=>y(N)),w=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,R]=Sc({prop:i,defaultProp:s,onChange:u});return _.jsxs(UF,{scope:r,checked:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"switch","aria-checked":P,"aria-required":o,"data-state":OS(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onClick:rt(e.onClick,N=>{R(F=>!F),A&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),A&&_.jsx(VF,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});MS.displayName=E0;var TS="SwitchThumb",AS=I.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=zF(TS,r);return _.jsx(Gt.span,{"data-state":OS(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});AS.displayName=TS;var VF=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=I.useRef(null),o=V6(r),a=h0(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 OS(e){return e?"checked":"unchecked"}var qF=MS,WF=AS;const GF=["1","2","3"],HF=["classic","surface","soft"],xa={size:{type:"enum",values:GF,default:"2",responsive:!0},variant:{type:"enum",values:HF,default:"surface"},color:Ec,highContrast:Ul,radius:b0},IS=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,style:s,size:o=xa.size.default,variant:a=xa.variant.default,color:c=xa.color.default,highContrast:u=xa.highContrast.default,radius:l=xa.radius.default,...f}=r;return I.createElement("span",{"data-radius":l,className:Xt("rt-SwitchRoot",i,_t(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},sa(n)),style:s},I.createElement(qF,{"data-accent-color":c,...f,ref:t,className:Xt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},I.createElement(WF,{className:Xt("rt-SwitchThumb",{"rt-high-contrast":u})})))});IS.displayName="Switch";var yh=["Enter"," "],KF=["ArrowDown","PageUp","Home"],PS=["ArrowUp","PageDown","End"],JF=[...KF,...PS],XF={ltr:[...yh,"ArrowRight"],rtl:[...yh,"ArrowLeft"]},YF={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cc="Menu",[sc,ZF,QF]=J6(Cc),[Zs,jS]=ea(Cc,[QF,$l,Y6]),Mc=$l(),kS=Y6(),[RS,vs]=Zs(Cc),[eU,Tc]=Zs(Cc),NS=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=Mc(t),[c,u]=I.useState(null),l=I.useRef(!1),f=mr(s),h=v0(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(T6,{...a,children:_.jsx(RS,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(eU,{scope:t,onClose:I.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};NS.displayName=Cc;var tU="MenuAnchor",C0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Mc(r);return _.jsx(A6,{...i,...n,ref:t})});C0.displayName=tU;var M0="MenuPortal",[rU,DS]=Zs(M0,{forceMount:void 0}),$S=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=vs(M0,t);return _.jsx(rU,{scope:t,forceMount:r,children:_.jsx(Nn,{present:r||s.open,children:_.jsx(P6,{asChild:!0,container:i,children:n})})})};$S.displayName=M0;var un="MenuContent",[nU,T0]=Zs(un),BS=I.forwardRef((e,t)=>{const r=DS(un,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(un,e.__scopeMenu),o=Tc(un,e.__scopeMenu);return _.jsx(sc.Provider,{scope:e.__scopeMenu,children:_.jsx(Nn,{present:n||s.open,children:_.jsx(sc.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(iU,{...i,ref:t}):_.jsx(sU,{...i,ref:t})})})})}),iU=I.forwardRef((e,t)=>{const r=vs(un,e.__scopeMenu),n=I.useRef(null),i=Zt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return zL(s)},[]),_.jsx(A0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:rt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),sU=I.forwardRef((e,t)=>{const r=vs(un,e.__scopeMenu);return _.jsx(A0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),A0=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,A=vs(un,r),P=Tc(un,r),R=Mc(r),N=kS(r),F=ZF(r),[L,G]=I.useState(null),q=I.useRef(null),J=Zt(t,q,A.onContentChange),ne=I.useRef(0),ae=I.useRef(""),ce=I.useRef(0),V=I.useRef(null),$=I.useRef("right"),p=I.useRef(0),d=b?CF:I.Fragment,m=b?{as:ki,allowPinchZoom:!0}:void 0,x=E=>{var ve,pe;const O=ae.current+E,C=F().filter(Ee=>!Ee.disabled),g=document.activeElement,v=(ve=C.find(Ee=>Ee.ref.current===g))==null?void 0:ve.textValue,j=C.map(Ee=>Ee.textValue),ee=vU(j,O,v),ie=(pe=C.find(Ee=>Ee.textValue===ee))==null?void 0:pe.ref.current;(function Ee(Se){ae.current=Se,window.clearTimeout(ne.current),Se!==""&&(ne.current=window.setTimeout(()=>Ee(""),1e3))})(O),ie&&setTimeout(()=>ie.focus())};I.useEffect(()=>()=>window.clearTimeout(ne.current),[]),PL();const M=I.useCallback(E=>{var C,g;return $.current===((C=V.current)==null?void 0:C.side)&&bU(E,(g=V.current)==null?void 0:g.area)},[]);return _.jsx(nU,{scope:r,searchRef:ae,onItemEnter:I.useCallback(E=>{M(E)&&E.preventDefault()},[M]),onItemLeave:I.useCallback(E=>{var O;M(E)||((O=q.current)==null||O.focus(),G(null))},[M]),onTriggerLeave:I.useCallback(E=>{M(E)&&E.preventDefault()},[M]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:I.useCallback(E=>{V.current=E},[]),children:_.jsx(d,{...m,children:_.jsx(rS,{asChild:!0,trapped:i,onMountAutoFocus:rt(s,E=>{var O;E.preventDefault(),(O=q.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(s0,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:_.jsx(AL,{asChild:!0,...N,dir:P.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:G,onEntryFocus:rt(c,E=>{P.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(O6,{role:"menu","aria-orientation":"vertical","data-state":t8(A.open),"data-radix-menu-content":"",dir:P.dir,...R,...w,ref:J,style:{outline:"none",...w.style},onKeyDown:rt(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||!JF.includes(E.key))return;E.preventDefault();const ie=F().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);PS.includes(E.key)&&ie.reverse(),mU(ie)}),onBlur:rt(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(ne.current),ae.current="")}),onPointerMove:rt(e.onPointerMove,oc(E=>{const O=E.target,C=p.current!==E.clientX;if(E.currentTarget.contains(O)&&C){const g=E.clientX>p.current?"right":"left";$.current=g,p.current=E.clientX}}))})})})})})})});BS.displayName=un;var oU="MenuGroup",O0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"group",...n,ref:t})});O0.displayName=oU;var aU="MenuLabel",LS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{...n,ref:t})});LS.displayName=aU;var Yu="MenuItem",tv="menu.itemSelect",Kl=I.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=I.useRef(null),o=Tc(Yu,e.__scopeMenu),a=T0(Yu,e.__scopeMenu),c=Zt(t,s),u=I.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(tv,{bubbles:!0,cancelable:!0});f.addEventListener(tv,y=>n==null?void 0:n(y),{once:!0}),s6(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(FS,{...i,ref:c,disabled:r,onClick:rt(e.onClick,l),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:rt(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:rt(e.onKeyDown,f=>{const h=a.searchRef.current!=="";r||h&&f.key===" "||yh.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Kl.displayName=Yu;var FS=I.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=T0(Yu,r),a=kS(r),c=I.useRef(null),u=Zt(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(sc.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:_.jsx(OL,{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:rt(e.onPointerMove,oc(b=>{n?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:rt(e.onPointerLeave,oc(b=>o.onItemLeave(b))),onFocus:rt(e.onFocus,()=>f(!0)),onBlur:rt(e.onBlur,()=>f(!1))})})})}),cU="MenuCheckboxItem",US=I.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(GS,{scope:e.__scopeMenu,checked:r,children:_.jsx(Kl,{role:"menuitemcheckbox","aria-checked":Zu(r)?"mixed":r,...i,ref:t,"data-state":j0(r),onSelect:rt(i.onSelect,()=>n==null?void 0:n(Zu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});US.displayName=cU;var zS="MenuRadioGroup",[uU,lU]=Zs(zS,{value:void 0,onValueChange:()=>{}}),VS=I.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=mr(n);return _.jsx(uU,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(O0,{...i,ref:t})})});VS.displayName=zS;var qS="MenuRadioItem",WS=I.forwardRef((e,t)=>{const{value:r,...n}=e,i=lU(qS,e.__scopeMenu),s=r===i.value;return _.jsx(GS,{scope:e.__scopeMenu,checked:s,children:_.jsx(Kl,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":j0(s),onSelect:rt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});WS.displayName=qS;var I0="MenuItemIndicator",[GS,fU]=Zs(I0,{checked:!1}),HS=I.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=fU(I0,r);return _.jsx(Nn,{present:n||Zu(s.checked)||s.checked===!0,children:_.jsx(Gt.span,{...i,ref:t,"data-state":j0(s.checked)})})});HS.displayName=I0;var dU="MenuSeparator",KS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});KS.displayName=dU;var hU="MenuArrow",JS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Mc(r);return _.jsx(I6,{...i,...n,ref:t})});JS.displayName=hU;var P0="MenuSub",[pU,XS]=Zs(P0),YS=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=vs(P0,t),o=Mc(t),[a,c]=I.useState(null),[u,l]=I.useState(null),f=mr(i);return I.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(T6,{...o,children:_.jsx(RS,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(pU,{scope:t,contentId:rc(),triggerId:rc(),trigger:a,onTriggerChange:c,children:r})})})};YS.displayName=P0;var Pa="MenuSubTrigger",ZS=I.forwardRef((e,t)=>{const r=vs(Pa,e.__scopeMenu),n=Tc(Pa,e.__scopeMenu),i=XS(Pa,e.__scopeMenu),s=T0(Pa,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(C0,{asChild:!0,...u,children:_.jsx(FS,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":t8(r.open),...e,ref:kl(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:rt(e.onPointerMove,oc(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:rt(e.onPointerLeave,oc(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,A=w==="right",P=A?-5:5,R=h[A?"left":"right"],N=h[A?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+P,y:f.clientY},{x:R,y:h.top},{x:N,y:h.top},{x:N,y:h.bottom},{x:R,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:rt(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())})})})});ZS.displayName=Pa;var QS="MenuSubContent",e8=I.forwardRef((e,t)=>{const r=DS(un,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(un,e.__scopeMenu),o=Tc(un,e.__scopeMenu),a=XS(QS,e.__scopeMenu),c=I.useRef(null),u=Zt(t,c);return _.jsx(sc.Provider,{scope:e.__scopeMenu,children:_.jsx(Nn,{present:n||s.open,children:_.jsx(sc.Slot,{scope:e.__scopeMenu,children:_.jsx(A0,{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:rt(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:rt(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:rt(e.onKeyDown,l=>{var y;const f=l.currentTarget.contains(l.target),h=YF[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});e8.displayName=QS;function t8(e){return e?"open":"closed"}function Zu(e){return e==="indeterminate"}function j0(e){return Zu(e)?"indeterminate":e?"checked":"unchecked"}function mU(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function gU(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function vU(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=gU(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 yU(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 bU(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return yU(r,t)}function oc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var wU=NS,_U=C0,xU=$S,SU=BS,EU=O0,CU=LS,MU=Kl,TU=US,AU=VS,OU=WS,IU=HS,PU=KS,jU=JS,kU=YS,RU=ZS,NU=e8,k0="DropdownMenu",[DU,bX]=ea(k0,[jS]),Ir=jS(),[$U,r8]=DU(k0),n8=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Ir(t),u=I.useRef(null),[l=!1,f]=Sc({prop:i,defaultProp:s,onChange:o});return _.jsx($U,{scope:t,triggerId:rc(),triggerRef:u,contentId:rc(),open:l,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(h=>!h),[f]),modal:a,children:_.jsx(wU,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};n8.displayName=k0;var i8="DropdownMenuTrigger",s8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=r8(i8,r),o=Ir(r);return _.jsx(_U,{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:kl(t,s.triggerRef),onPointerDown:rt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:rt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});s8.displayName=i8;var BU="DropdownMenuPortal",o8=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Ir(t);return _.jsx(xU,{...n,...r})};o8.displayName=BU;var a8="DropdownMenuContent",c8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=r8(a8,r),s=Ir(r),o=I.useRef(!1);return _.jsx(SU,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:rt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:rt(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)"}})});c8.displayName=a8;var LU="DropdownMenuGroup",u8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(EU,{...i,...n,ref:t})});u8.displayName=LU;var FU="DropdownMenuLabel",l8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(CU,{...i,...n,ref:t})});l8.displayName=FU;var UU="DropdownMenuItem",f8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(MU,{...i,...n,ref:t})});f8.displayName=UU;var zU="DropdownMenuCheckboxItem",d8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(TU,{...i,...n,ref:t})});d8.displayName=zU;var VU="DropdownMenuRadioGroup",h8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(AU,{...i,...n,ref:t})});h8.displayName=VU;var qU="DropdownMenuRadioItem",p8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(OU,{...i,...n,ref:t})});p8.displayName=qU;var WU="DropdownMenuItemIndicator",m8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(IU,{...i,...n,ref:t})});m8.displayName=WU;var GU="DropdownMenuSeparator",g8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(PU,{...i,...n,ref:t})});g8.displayName=GU;var HU="DropdownMenuArrow",KU=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(jU,{...i,...n,ref:t})});KU.displayName=HU;var JU=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Ir(t),[a=!1,c]=Sc({prop:n,defaultProp:s,onChange:i});return _.jsx(kU,{...o,open:a,onOpenChange:c,children:r})},XU="DropdownMenuSubTrigger",v8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(RU,{...i,...n,ref:t})});v8.displayName=XU;var YU="DropdownMenuSubContent",y8=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(NU,{...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)"}})});y8.displayName=YU;var ZU=n8,QU=s8,b8=o8,ez=c8,tz=u8,rz=l8,nz=f8,iz=d8,sz=h8,oz=p8,w8=m8,az=g8,cz=JU,uz=v8,lz=y8;const fz=["1","2","3"],dz=["vertical","horizontal","both"],od={size:{type:"enum",values:fz,default:"1",responsive:!0},radius:b0,scrollbars:{type:"enum",values:dz,default:"both"}},R0=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=od.size.default,radius:l=od.radius.default,scrollbars:f=od.scrollbars.default,...h}=r;return I.createElement($F,{type:o,scrollHideDelay:a,className:Xt("rt-ScrollAreaRoot",i,sa(n)),style:s},I.createElement(BF,{...h,ref:t,className:"rt-ScrollAreaViewport"}),I.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?I.createElement(Qg,{"data-radius":l,orientation:"horizontal",className:Xt("rt-ScrollAreaScrollbar",_t(u,"rt-r-size"))},I.createElement(ev,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?I.createElement(Qg,{"data-radius":l,orientation:"vertical",className:Xt("rt-ScrollAreaScrollbar",_t(u,"rt-r-size"))},I.createElement(ev,{className:"rt-ScrollAreaThumb"})):null,f==="both"?I.createElement(LF,{className:"rt-ScrollAreaCorner"}):null)});R0.displayName="ScrollArea";const hz=["1","2"],pz=["solid","soft"],ad={size:{type:"enum",values:hz,default:"2",responsive:!0},variant:{type:"enum",values:pz,default:"solid"},color:Ec,highContrast:Ul},_8={color:Ec,shortcut:{type:"string",default:void 0}},x8=e=>I.createElement(ZU,{...e});x8.displayName="DropdownMenuRoot";const S8=I.forwardRef((e,t)=>I.createElement(QU,{...e,ref:t,asChild:!0}));S8.displayName="DropdownMenuTrigger";const E8=I.createContext({}),C8=I.forwardRef((e,t)=>{const r=zB(),{className:n,children:i,size:s=ad.size.default,variant:o=ad.variant.default,highContrast:a=ad.highContrast.default,color:c=_8.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return I.createElement(b8,{container:u,forceMount:l},I.createElement(Fl,{asChild:!0},I.createElement(ez,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Xt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,_t(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},I.createElement(R0,{type:"auto"},I.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},I.createElement(E8.Provider,{value:I.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});C8.displayName="DropdownMenuContent";const M8=I.forwardRef((e,t)=>I.createElement(rz,{...e,ref:t,className:Xt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));M8.displayName="DropdownMenuLabel";const T8=I.forwardRef((e,t)=>{const{className:r,children:n,color:i=_8.color.default,shortcut:s,...o}=e;return I.createElement(nz,{"data-accent-color":i,...o,ref:t,className:Xt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},I.createElement(ta,null,n),s&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});T8.displayName="DropdownMenuItem";const A8=I.forwardRef((e,t)=>I.createElement(tz,{...e,ref:t,className:Xt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));A8.displayName="DropdownMenuGroup";const O8=I.forwardRef((e,t)=>I.createElement(sz,{...e,ref:t,className:Xt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));O8.displayName="DropdownMenuRadioGroup";const I8=I.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return I.createElement(oz,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},I.createElement(ta,null,r),I.createElement(w8,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(zl,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});I8.displayName="DropdownMenuRadioItem";const P8=I.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return I.createElement(iz,{...s,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},I.createElement(ta,null,r),I.createElement(w8,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(zl,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});P8.displayName="DropdownMenuCheckboxItem";const j8=e=>I.createElement(cz,{...e});j8.displayName="DropdownMenuSub";const k8=I.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return I.createElement(uz,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},I.createElement(ta,null,n),I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},I.createElement(K6,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});k8.displayName="DropdownMenuSubTrigger";const R8=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(E8);return I.createElement(b8,{container:i,forceMount:s},I.createElement(Fl,{asChild:!0},I.createElement(lz,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Xt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,_t(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},I.createElement(R0,{type:"auto"},I.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});R8.displayName="DropdownMenuSubContent";const N8=I.forwardRef((e,t)=>I.createElement(az,{...e,ref:t,className:Xt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));N8.displayName="DropdownMenuSeparator";const ln=Object.assign({},{Root:x8,Trigger:S8,Content:C8,Label:M8,Item:T8,Group:A8,RadioGroup:O8,RadioItem:I8,CheckboxItem:P8,Sub:j8,SubTrigger:k8,SubContent:R8,Separator:N8}),mz=["1","2","3","4"],gz=["classic","solid","soft","surface","outline","ghost"],Sa={size:{type:"enum",values:mz,default:"2",responsive:!0},variant:{type:"enum",values:gz,default:"solid"},color:Ec,highContrast:Ul,radius:b0},D8=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,asChild:s=!1,size:o=Sa.size.default,variant:a=Sa.variant.default,color:c=Sa.color.default,highContrast:u=Sa.highContrast.default,radius:l=Sa.radius.default,...f}=r,h=s?ki:"button";return I.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Xt("rt-reset","rt-BaseButton",i,_t(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},sa(n))})});D8.displayName="BaseButton";const $8=I.forwardRef((e,t)=>I.createElement(D8,{...e,ref:t,className:Xt("rt-Button",e.className)}));$8.displayName="Button";const vz={loading:{type:"boolean",default:!0}},oa=I.forwardRef((e,t)=>{const{rest:r,...n}=ia(e),{className:i,children:s,loading:o=vz.loading.default,...a}=r;if(!o)return I.createElement(I.Fragment,null,s);const c=I.isValidElement(s)?ki:"span";return I.createElement(c,{ref:t,"aria-hidden":!0,className:Xt("rt-Skeleton",i,sa(n)),"data-inline-skeleton":I.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});oa.displayName="Skeleton";const yz=zt("/images/ghost_loading.png"),bz=zt("/images/primary_loading.png"),wz={primary:bz,ghost:yz};function _z({size:e="24px",variant:t="primary",wrapStyle:r={}}){return _.jsx(z6,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:_.jsx("img",{src:wz[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const xz="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==",cd="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 zr({src:e,alt:t,className:r,style:n,showWarn:i,...s}){const[o,a]=se.useState(cd),c=u=>{a(cd)};return se.useEffect(()=>{a(e||cd)},[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:xz})]})}function Sz({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=Qo(),a=se.useMemo(()=>{if(n&&r)return n(r)},[r]),c=se.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(_z,{})}),_.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(n6,{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"}),jl.map(u=>_.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:_.jsx(zr,{src:u.img})},u.link))]})]}),_.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(s),children:_.jsx("use",{xlinkHref:"#icon-close"})})]})}const Ez=Bi((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}=Ez(),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=se.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),nl.createPortal(_.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>_.jsx(Sz,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}};function Cz(){const{mevProtect:e,setMevProtect:t}=Xr();return _.jsxs(ln.Root,{children:[_.jsx(ln.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(ln.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:zt("/images/icon_mev@2x.png")}),_.jsx("span",{children:"MEV Protect"})]}),_.jsx(IS,{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 Mz({onClick:e}){const[t,r]=se.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"})})})}function N0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx($8,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function Tz(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Xr();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(Az,{onClose:()=>e(!1)})]})}function Az({onClose:e}){const{slippage:t,setSlippage:r}=Xr(),[n,i]=se.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=se.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:"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:gD.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(N0,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function Oz({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(Tz,{}),_.jsx(Cz,{}),_.jsx(Mz,{onClick:e})]})]})})}function Iz(){const[e,t]=se.useState(!1);return _.jsxs(ln.Root,{open:e,onOpenChange:t,children:[_.jsx(ln.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(ln.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(Pz,{}),_.jsx(kz,{onClose:()=>{t(!1)}})]})})]})}function Pz(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Xr(),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:jl.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(Vl,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),_.jsx("img",{src:s.img}),_.jsx("span",{children:s.name})]}))})]})}const jz=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function kz({onClose:e}){const{addTxToast:t}=aa(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=Xr(),[a,c]=se.useState(i),[u,l]=se.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(Vl,{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(N0,{btnIsDisabled:jz(a),text:"Save",onClick:b})]})]})]})}const Dn=Bi((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 Rz=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()}},Nz=Rz,rv={"text/plain":"Text","text/html":"Url",default:"Text"},Dz="Copy to clipboard: #{key}, Enter";function $z(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function Bz(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=Nz(),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=rv[t.format]||rv.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=$z("message"in t?t.message:Dz),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var Lz=Bz;const B8=hc(Lz);function Fz({currentAccount:e}){const{mutate:t}=Lr.useSwitchAccount(),r=Lr.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=Dn(),s=()=>{i(!n)};se.useEffect(()=>()=>{i(!1)},[]);const o=se.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);se.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"})]}))})]})}function Uz({connect:e}){const t=Lr.useCurrentAccount();return se.useEffect(()=>{},[t]),_.jsx("div",{children:t?_.jsx(zz,{}):_.jsx(N0,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})}function zz(){const{mutate:e}=Lr.useDisconnectWallet(),t=Lr.useCurrentAccount(),{currentWallet:r}=Lr.useCurrentWallet(),{addCommonToast:n}=aa(),{getExplorerUrl:i}=Qo(),s=()=>{t&&(B8(t.address||"",{debug:!1,message:"message"}),n("Copied"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return se.useEffect(()=>{},[r]),_.jsxs(ln.Root,{children:[_.jsx(ln.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(ln.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(Fz,{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 Vz(){Lr.useCurrentAccount(),Lr.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Dn();return Lr.useWallets(),_.jsx(_.Fragment,{children:_.jsx(Lr.ConnectModal,{trigger:_.jsx(Uz,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function qz({independentWallet:e,customWallet:t}){return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"widget-header",children:[_.jsx("img",{src:zt("/images/logo@2x.png"),className:"cetus-logo"}),_.jsxs("div",{className:"right",children:[e&&_.jsx(Vz,{}),_.jsx(Iz,{})]})]}),_.jsx("div",{style:{marginTop:"20px"}})]})}const L8=()=>{const e=se.useRef(null);se.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 Wz({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=se.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(Gz,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(Hz,{info:s,status:r,tx:i,onClose:e})]})}function Gz({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(L8,{})}),_.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 Hz({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Qo();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"}),jl.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 Jl(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await hD(`${i||Vu.api}${t}`,n):await pD(`${i||Vu.api}${t}`,n)}catch(s){throw s}}}}function Kz(){const{fetchByApi:e}=Jl(),{setProviders:t}=Xr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function Jz({interval:e,callback:t}){const r=se.useRef(),n=se.useRef(null);se.useEffect(()=>{r.current=t},[t]);const i=se.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=se.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return se.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const Qs=Bi((e,t)=>({suiClient:new Ga({url:Vu.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new R4,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),Xz=(e,t)=>({requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=new Map(n);s.set(Mr(r.coin_type).full_address,r);const o=i.filter(a=>a!==r.coin_type);e(()=>({tokenMap:s,requestTokenList:[...o]})),Ii.setItem(ch,s)},tokenMap:new Map,setTokenMap:(r,n=!1)=>{e(()=>({tokenMap:r})),n||Ii.setItem(ch,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||Ii.setItem(Y4,r)}}),Ac=Bi(Xz);Ii.getItem(ch).then(e=>{e!==null&&Ac.getState().setTokenMap(e,!0)});Ii.getItem(Y4).then(e=>{e!==null&&Ac.getState().setTrustedTokenList(e,!0)});function Yz(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 ys(){const{suiClient:e}=Qs(),{fetchByApi:t}=Jl(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=Ac(),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,A)=>(w.set(A.coin_type,A),A.is_trusted&&h.push({...A,coin_type:Mr(A.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){D4(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const b=Yz(y,f);return i(b),b}}catch{}},l=se.useCallback(f=>{if(f)return n.get(Mr(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function Qu(e){const{suiClient:t}=Qs(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Dn(),{fetchTokenInfo:s}=ys(),[o,a]=se.useState([]),{tokenMap:c}=Ac(),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({})};se.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 A=y[w],P=await s(A.coinType),R=oD(A.totalBalance,P==null?void 0:P.decimals),N=an(R,4);b[Mr(A.coinType).full_address]={...A,displayBalance:N,totalBalanceFormat:R}}catch{continue}n(b)},h=se.useMemo(()=>{if(e&&r)return i[e]||i[Mr(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const Zz=(e,t)=>({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}))}}),hn=Bi(Zz),Qz={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"}},eV={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"}},F8=Qz,U8=eV;function tV(e,t){const{fetchTokenInfo:r}=ys(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s}=hn(),{setSlippage:o,setRpcList:a,setCurrentRpc:c}=Xr(),u=se.useRef({}),l=async(h,y)=>{const b=h?await r(h):F8,w=y?await r(y):U8;n(b),i(w),s(b==null?void 0:b.coin_type,w==null?void 0:w.coin_type)},f=(h,y)=>{const b=[zu[0]];let w=zu[0];h.forEach(A=>{const P={name:A,link:A,isCustom:!1};b.push(P),A===y&&(w=P)}),a([...b,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(w)};return se.useEffect(()=>{if(!i0(e,u.current)){const{defaultFromToken:h,defaultToToken:y,defaultSlippage:b,customRpcList:w,defaultRpc:A}=e;l(h,y),b&&o(b),(w==null?void 0:w.length)>0&&f(w,A),u.current=e}},[e]),{handleSetDefaultPair:l}}function rV(){const{currentRpc:e}=Xr(),{setSuiClient:t,setAggregatorSDK:r}=Qs(),{currentAccount:n}=Dn();se.useEffect(()=>{if(e){const i=new Ga({url:e.link});t(i)}},[e]),se.useEffect(()=>{if(e){const i=new R4(Vu.aggregatorUrl,(n==null?void 0:n.address)||void 0,new Ga({url:e.link}),cN.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const nV=(e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Mr(i).full_address]}),e({coinPriceObj:{...n}})}}),z8=Bi(nV);function Xl(){const{fetchByApi:e}=Jl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=z8(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>ec(l,!1))})).prices;if(u){const l={};u.forEach(f=>{l[Mr(f.base_symbol).full_address]=f}),r(l)}return u}catch{return n(a),null}},s=se.useCallback(a=>{if(!a)return;const c=t[Mr(a).full_address];if(c)return c},[t]),o=se.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 D0=Bi((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),br=[];for(let e=0;e<256;++e)br.push((e+256).toString(16).slice(1));function iV(e,t=0){return(br[e[t+0]]+br[e[t+1]]+br[e[t+2]]+br[e[t+3]]+"-"+br[e[t+4]]+br[e[t+5]]+"-"+br[e[t+6]]+br[e[t+7]]+"-"+br[e[t+8]]+br[e[t+9]]+"-"+br[e[t+10]]+br[e[t+11]]+br[e[t+12]]+br[e[t+13]]+br[e[t+14]]+br[e[t+15]]).toLowerCase()}let ud;const sV=new Uint8Array(16);function oV(){if(!ud){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ud=crypto.getRandomValues.bind(crypto)}return ud(sV)}const aV=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),nv={randomUUID:aV};function iv(e,t,r){if(nv.randomUUID&&!t&&!e)return nv.randomUUID();e=e||{};const n=e.random||(e.rng||oV)();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 iV(n)}var Ws=(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))(Ws||{});const cV=new Ga({url:c1("mainnet")}),uV=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],lV=["deny_list","DenyList","DenyCap","create_regulated_currency"],fV={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},dV=async e=>{let t=!1;if(uV.includes(e))return t;const r=e.split("::"),n=r[0]&&$r(r[0]),i=r[1],s=await cV.getObject({id:n,options:fV}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(lV.join("|"),"i").test(o)&&(t=!0),t},hV=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>ec(i,!1)))==null?void 0:n.join(",")};function pV(){const{fetchByApi:e}=Jl(),t=async n=>{try{const i={...n},s=hV(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=zt("/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=>za(b).source_address);f=l==null?void 0:l.filter(b=>{var P,R;const w=za((P=b==null?void 0:b.coin_a)==null?void 0:P.address).source_address,A=za((R=b==null?void 0:b.coin_b)==null?void 0:R.address).source_address;return(y==null?void 0:y.length)>1&&y.includes(w)&&y.includes(A)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(w)||y.includes(A)))})}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 mV(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Xr(),{getPoolList:n,getLocalJsonPoolList:i}=pV();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 gV(e){const{routerData:t}=hn();return{priceAcceptRouterData:se.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 V8(e,t){return{amountLimit:se.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 vV(e){const{getTokenInfo:t,fetchTokenInfo:r}=ys();return{formatSwapRouter:se.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 A=Mr(w.from).full_address,P=Mr(w.target).full_address,R=t(A),N=t(P);R||a.includes(A)&&a.push(A),N||a.includes(P)&&a.push(P);const F=w.provider===Va.SCALLOP||w.provider===Va.FLOWX||w.provider===Va.FLOWXV3;b.push({from_type:A,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 yV(){const{fromCoin:e,toCoin:t}=hn(),{getPoolListByCoinType:r}=mV();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function q8(e,t,r){return se.useMemo(()=>t&&r&&+t&&+r?e?Le(r).div(t).toString():Le(t).div(r).toString():"0",[t,r,e])}function sv(e){const[t,r]=se.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await dV(i.coin_type)}catch{}return!1};return se.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function bV(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=hn(),{getTokenInfo:i}=ys(),s=i(e),o=i(t),a=se.useMemo(()=>!$c(r,F8.coin_type)||!$c(n,U8.coin_type),[r,n]),c=se.useCallback(l=>$c(r,l==null?void 0:l.coin_type)||$c(n,l==null?void 0:l.coin_type),[r,n]),u=se.useMemo(()=>{const l=[];return a&&(s&&!s.is_trusted&&c(s)&&l.push({...s}),o&&!o.is_trusted&&c(o)&&l.push({...o})),l},[s==null?void 0:s.coin_type,o==null?void 0:o.coin_type,a]);return{isCustomMode:a,customWarnTokenList:u}}function wV(){const{aggregatorSDK:e}=Qs(),{getSwapPoolAddress:t}=yV(),r=s=>s&&s.error?s.error.code===Ws.InsufficientLiquidity||Ws.HoneyPot||Ws.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 Dm(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 Dm(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=ah(l.amountIn.toString(),c.decimals).toString(),b=ah(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 fo(e){const t=se.useRef(e);return se.useEffect(()=>{t.current=e},[e]),t}function _V(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function xV(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function SV(e){return!!String(e).includes("Could not find the referenced transaction")}function EV(e){return _V(e)?"User rejected the request":xV(e)?"Exceeded price slippage":SV(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var $0={};Object.defineProperty($0,"__esModule",{value:!0});var CV=$0.executeAuction=W8,MV=i4,TV="https://rpc.getshio.com",AV=500,OV=300;function W8(e,t,r){r===void 0&&(r=AV);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),MV.default.post(TV,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,OV)}).catch(s)})}$0.default={executeAuction:W8};function IV(){const{suiClient:e}=Qs(),{currentAccount:t}=Dn(),{mutateAsync:r}=Lr.useSignTransaction(),{mutate:n}=Lr.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=se.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:So.Transaction.from(Pn(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=So.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=So.Transaction.from(c)),typeof c=="string"&&(c=So.Transaction.from(Pn(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 PV(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=IV(),{currentAccount:n}=Dn(),{suiClient:i}=Qs(),{setTransactionData:s}=D0(),{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 Cg(u),l(y,b+1)}}const f=async(y,b,w={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var F,L;const{useDevInspect:A=!1,useMev:P,txAction:R="signTransactionBlock"}=w;let N;b.status="confirmation",s(b);try{let G;if(R==="signTransactionBlock"){const J=await e(y),{bytes:ne,signature:ae}=J;if(P)try{const ce=await CV(ne,ae,500)}catch{}G=await t(ne,ae,A)}else G=await r(y,A);b.status="submitted",s({...b}),b.tx=G.digest,N=o(b),await Cg(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 J=dD(q,n==null?void 0:n.address,!1);if(b.buildShowInfo){const ne=b.buildShowInfo("success",J);b.buildShowInfo=ae=>ne}a(N),b.status="success",s({...b})}return q}catch(G){h(b,G)}},h=(y,b)=>{const w=EV(b);if(y.buildShowInfo){const A=y.buildShowInfo("confirmation");y.buildShowInfo=P=>(A.toastDescriptionContent=w,A.modalDescriptionText=w,A),y.status="rejected",s({...y})}else y.buildShowInfo=A=>{const P={};return P.toastDescriptionContent=w,P.modalDescriptionText=w,P},y.status="rejected",s({...y})};return{signAndExecuteTransaction:f}}function B0(e,t=1e3){const r=se.useRef(),n=se.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return se.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function jV(){const{aggregatorSDK:e}=Qs(),{findBestRouters:t}=wV(),{getTokenAmountValue:r,fetchTokenPrices:n}=Xl(),{providers:i,slippage:s,mevProtect:o}=Xr(),{signAndExecuteTransaction:a}=PV(),{setTransactionData:c}=D0(),{addTxToast:u}=aa(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:b,fromAmount:w,toAmount:A,setFromAmount:P,setFindRouterLoading:R,setRouterData:N,setByAmountIn:F,byAmountIn:L}=hn(),[G,q]=se.useState(""),J=fo(G),ne=fo(L),ae=fo(w),ce=fo(A),V=fo(l),$=fo(f),{balanceInfo:p,getOwnerCoinBalances:d}=Qu(l==null?void 0:l.coin_type),{balanceInfo:m}=Qu(f==null?void 0:f.coin_type),x=r(l==null?void 0:l.coin_type,w),M=r(f==null?void 0:f.coin_type,A),O=B0(async(Se,Ke,Ue)=>{if(V.current&&$.current&&+Se){(+ae.current||+ce.current)&&R(!0);const lt=uD(Se,Ke?V.current.decimals:$.current.decimals),ht=await t({fromToken:V.current,toToken:$.current,amount:lt.toString(),providersKeys:i,by_amount_in:Ke,uuid:Ue});R(!1),J.current===Ue&&(Ke?+ae.current?(b(ht.toAmountUi||""),N(ht)):b(""):+ce.current?(P(ht.fromAmountUi||"ß"),N(ht)):P(""))}else v(!Ke)},500),C=(Se,Ke,Ue=!1)=>{if(F(Ke),Ke?(P(Se),Ue&&b("")):(b(Se),Ue&&P("")),+Se){const lt=iv();q(lt),O(Se,Ke,lt)}else R(!1),N(void 0),v(!Ke)},g=(Se,Ke=!0)=>{v(),Ke?((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(""),R(!1),N(void 0)},j=()=>{const Se=ne.current?ae.current:ce.current;if(+Se){const Ke=iv();q(Ke),O(Se,ne.current,Ke)}},ee=async(Se,Ke)=>{const{routerData:Ue,byAmountIn:lt,fromAmountUi:ht,toAmountUi:$e}=Se,mt=new So.Transaction,_e={routers:Ue.routes,byAmountIn:lt,slippage:Number(s)/100,txb:mt};Ke&&(_e.partner=Ke);try{await e.fastRouterSwap(_e);const ge={status:"confirmation",buildShowInfo:(qe,De)=>{const Oe=`Swap ${an(ht,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${an($e,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Ie={modalDescriptionText:Oe,toastTitleText:Oe};if(qe==="success"){let Fe=ht,ft=$e;De&&(Fe=Mg(De,l)||ht,ft=Mg(De,f)||$e);const dt=`Swapped ${an(Fe,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${an(ft,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`;Ie.toastTitleText=dt,Ie.modalDescriptionText=dt}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(Ae,qe){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};se.useEffect(()=>{ie(),v()},[l==null?void 0:l.coin_type,f==null?void 0:f.coin_type]);const ie=()=>{const Se=[];l&&Se.push(l.coin_type),f&&Se.push(f.coin_type),Se.length>0&&n(Se)},{isScamsCoin:ve}=sv(l),{isScamsCoin:pe}=sv(f),Ee=se.useMemo(()=>{if(!(!ve&&!pe)){if(ve&&pe)return`${l==null?void 0:l.symbol} and ${f==null?void 0:f.symbol} are`;if(ve)return`${l==null?void 0:l.symbol} token is `;if(pe)return`${f==null?void 0:f.symbol} token is `}},[ve,pe]);return{handleAmountChange:C,handleSelectToken:g,fromBalanceInfo:p,toBalanceInfo:m,fromAmountValue:x,toAmountValue:M,doSwapAction:ee,reCalculateRouteData:j,refreshMarketPrice:ie,scamsText:Ee}}function kV(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=hn(),{currentAccount:o}=Dn(),a=se.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===Ws.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Ws.NoRouter||s.errorCode===Ws.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Le(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${cn(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[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 G8({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:`
|
|
98
98
|
@keyframes dash {
|
|
99
99
|
0% {
|
|
100
100
|
stroke-dashoffset: 0; /* 从起点开始 */
|
|
@@ -103,7 +103,7 @@ body { background-color: var(--color-page-background); }
|
|
|
103
103
|
stroke-dashoffset: -${o}; /* 一圈 */
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
`})]})}function $0({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[s,o]=se.useState(!0),a=V8(s,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[_.jsx(Kr,{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"," ",Mn(s?e.symbol:t.symbol)," ","="," ",i?_.jsx(oa,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):an(a,t.decimals)," ",Mn(s?t.symbol:e.symbol)]}),_.jsx(Kr,{src:s?t.logo_url:e.logo_url}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-swap"})})]})}function B0(){const[e,t]=se.useState(window.innerWidth),r=D0(()=>{t(window.innerWidth)},300);se.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=se.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function G8(e,t,r,n){const{getTokenPrice:i}=Jl(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=V8(!0,r,n),c=se.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=se.useMemo(()=>{if(c&&+a)return Le(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=se.useMemo(()=>{const y=[];return s&&y.push(s.market),o&&!y.includes(o.market)&&y.push(o.market),y},[s==null?void 0:s.market,o==null?void 0:o.market]),f=se.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(5):!1,[u]),h=se.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(10):!1,[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h}}function Ac({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=se.useState(!1),[o,a]=se.useState(!1),c=se.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};se.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=se.useRef(null),[y,b]=se.useState({left:void 0,top:void 0});return se.useEffect(()=>{var w;if(i&&h.current){const A=(w=h.current)==null?void 0:w.getBoundingClientRect();let P,R;r==="top"?(P=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.top-2*A.height-8}px`):r==="bottom"?(P=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.bottom}px`):r==="left"?(P=`${window.scrollX+A.left-8}px`,R=`${window.scrollY+A.top+A.height/2}px`):r==="right"?(P=`${window.scrollX+A.right+8}px`,R=`${window.scrollY+A.top+A.height/2}px`):(P=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.top+A.height/2}px`),b({left:P,top:R})}},[i]),_.jsxs("div",{ref:h,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&rl.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 jV({content:e,children:t,position:r,autoSwitchTooltip:n=!1}){const{isApp:i}=B0();return i&&n?_.jsxs(un.Root,{children:[_.jsx(un.Trigger,{children:t}),_.jsx(un.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"inline-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(Ac,{content:e,position:r,children:t})}function H8({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=dn();B0();const{priceImpact:a,sources:c,marketPrice:u}=G8(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi),l=se.useMemo(()=>{if(a){if(Le(a).gt(0))return"green";const f=Le(a).abs();return f.gt(1)&&f.lt(10)?"yellow":f.gte(10)?"red":"green"}return"yellow"},[a]);return _.jsxs(_.Fragment,{children:[!r&&Le(a).lte(-30)&&_.jsx("div",{className:"price-impact-tips red",children:"Price Impact Alert. 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 Impact"}),_.jsx(jV,{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,children:a?eD(a,2):"Incalculable"}),_.jsx("div",{className:"platforms",children:c.map(f=>_.jsx(Ac,{content:_.jsx("span",{style:{fontSize:"12px"},children:e6[f]}),position:"top",delay:300,children:_.jsx(Kr,{src:_D[f]})},f))})]})]})]})]})}function kV({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){const{isApp:s}=B0();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($0,{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=>e6[o]+" ").join("")})]})]})}function K8({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=dn();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:[an(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,ln.ROUND_DOWN)," ",Mn(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function RV({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(r6,{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 NV({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 L0({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(NV,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const qc=globalThis||void 0||self;var DV=typeof qc=="object"&&qc&&qc.Object===Object&&qc;const J8=DV;var $V=typeof self=="object"&&self&&self.Object===Object&&self,BV=J8||$V||Function("return this")();const ci=BV;var LV=ci.Symbol;const ii=LV;var X8=Object.prototype,FV=X8.hasOwnProperty,UV=X8.toString,Ea=ii?ii.toStringTag:void 0;function zV(e){var t=FV.call(e,Ea),r=e[Ea];try{e[Ea]=void 0;var n=!0}catch{}var i=UV.call(e);return n&&(t?e[Ea]=r:delete e[Ea]),i}var VV=Object.prototype,qV=VV.toString;function WV(e){return qV.call(e)}var GV="[object Null]",HV="[object Undefined]",sv=ii?ii.toStringTag:void 0;function ca(e){return e==null?e===void 0?HV:GV:sv&&sv in Object(e)?zV(e):WV(e)}function hs(e){return e!=null&&typeof e=="object"}var KV="[object Symbol]";function oc(e){return typeof e=="symbol"||hs(e)&&ca(e)==KV}function hu(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 JV=Array.isArray;const zr=JV;var XV=1/0,ov=ii?ii.prototype:void 0,av=ov?ov.toString:void 0;function Y8(e){if(typeof e=="string")return e;if(zr(e))return hu(e,Y8)+"";if(oc(e))return av?av.call(e):"";var t=e+"";return t=="0"&&1/e==-XV?"-0":t}function ua(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Z8(e){return e}var YV="[object AsyncFunction]",ZV="[object Function]",QV="[object GeneratorFunction]",eq="[object Proxy]";function Q8(e){if(!ua(e))return!1;var t=ca(e);return t==ZV||t==QV||t==YV||t==eq}var tq=ci["__core-js_shared__"];const ad=tq;var cv=function(){var e=/[^.]+$/.exec(ad&&ad.keys&&ad.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function rq(e){return!!cv&&cv in e}var nq=Function.prototype,iq=nq.toString;function eo(e){if(e!=null){try{return iq.call(e)}catch{}try{return e+""}catch{}}return""}var sq=/[\\^$.*+?()[\]{}|]/g,oq=/^\[object .+?Constructor\]$/,aq=Function.prototype,cq=Object.prototype,uq=aq.toString,lq=cq.hasOwnProperty,fq=RegExp("^"+uq.call(lq).replace(sq,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function dq(e){if(!ua(e)||rq(e))return!1;var t=Q8(e)?fq:oq;return t.test(eo(e))}function hq(e,t){return e==null?void 0:e[t]}function to(e,t){var r=hq(e,t);return dq(r)?r:void 0}var pq=to(ci,"WeakMap");const gh=pq;var uv=Object.create,mq=function(){function e(){}return function(t){if(!ua(t))return{};if(uv)return uv(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const gq=mq;function vq(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var yq=function(){try{var e=to(Object,"defineProperty");return e({},"",{}),e}catch{}}();const lv=yq;function bq(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var wq=9007199254740991,_q=/^(?:0|[1-9]\d*)$/;function e3(e,t){var r=typeof e;return t=t??wq,!!t&&(r=="number"||r!="symbol"&&_q.test(e))&&e>-1&&e%1==0&&e<t}function t3(e,t,r){t=="__proto__"&&lv?lv(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function F0(e,t){return e===t||e!==e&&t!==t}var xq=Object.prototype,Sq=xq.hasOwnProperty;function r3(e,t,r){var n=e[t];(!(Sq.call(e,t)&&F0(n,r))||r===void 0&&!(t in e))&&t3(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?t3(r,a,c):r3(r,a,c)}return r}var Eq=9007199254740991;function U0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Eq}function Yl(e){return e!=null&&U0(e.length)&&!Q8(e)}var Cq=Object.prototype;function z0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Cq;return e===r}function Mq(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Tq="[object Arguments]";function fv(e){return hs(e)&&ca(e)==Tq}var n3=Object.prototype,Aq=n3.hasOwnProperty,Oq=n3.propertyIsEnumerable,Iq=fv(function(){return arguments}())?fv:function(e){return hs(e)&&Aq.call(e,"callee")&&!Oq.call(e,"callee")};const i3=Iq;function Pq(){return!1}var s3=typeof exports=="object"&&exports&&!exports.nodeType&&exports,dv=s3&&typeof module=="object"&&module&&!module.nodeType&&module,jq=dv&&dv.exports===s3,hv=jq?ci.Buffer:void 0,kq=hv?hv.isBuffer:void 0,Rq=kq||Pq;const Qu=Rq;var Nq="[object Arguments]",Dq="[object Array]",$q="[object Boolean]",Bq="[object Date]",Lq="[object Error]",Fq="[object Function]",Uq="[object Map]",zq="[object Number]",Vq="[object Object]",qq="[object RegExp]",Wq="[object Set]",Gq="[object String]",Hq="[object WeakMap]",Kq="[object ArrayBuffer]",Jq="[object DataView]",Xq="[object Float32Array]",Yq="[object Float64Array]",Zq="[object Int8Array]",Qq="[object Int16Array]",eW="[object Int32Array]",tW="[object Uint8Array]",rW="[object Uint8ClampedArray]",nW="[object Uint16Array]",iW="[object Uint32Array]",Jt={};Jt[Xq]=Jt[Yq]=Jt[Zq]=Jt[Qq]=Jt[eW]=Jt[tW]=Jt[rW]=Jt[nW]=Jt[iW]=!0;Jt[Nq]=Jt[Dq]=Jt[Kq]=Jt[$q]=Jt[Jq]=Jt[Bq]=Jt[Lq]=Jt[Fq]=Jt[Uq]=Jt[zq]=Jt[Vq]=Jt[qq]=Jt[Wq]=Jt[Gq]=Jt[Hq]=!1;function sW(e){return hs(e)&&U0(e.length)&&!!Jt[ca(e)]}function Zl(e){return function(t){return e(t)}}var o3=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qa=o3&&typeof module=="object"&&module&&!module.nodeType&&module,oW=qa&&qa.exports===o3,cd=oW&&J8.process,aW=function(){try{var e=qa&&qa.require&&qa.require("util").types;return e||cd&&cd.binding&&cd.binding("util")}catch{}}();const Vo=aW;var pv=Vo&&Vo.isTypedArray,cW=pv?Zl(pv):sW;const a3=cW;var uW=Object.prototype,lW=uW.hasOwnProperty;function c3(e,t){var r=zr(e),n=!r&&i3(e),i=!r&&!n&&Qu(e),s=!r&&!n&&!i&&a3(e),o=r||n||i||s,a=o?Mq(e.length,String):[],c=a.length;for(var u in e)(t||lW.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||e3(u,c)))&&a.push(u);return a}function u3(e,t){return function(r){return e(t(r))}}var fW=u3(Object.keys,Object);const dW=fW;var hW=Object.prototype,pW=hW.hasOwnProperty;function mW(e){if(!z0(e))return dW(e);var t=[];for(var r in Object(e))pW.call(e,r)&&r!="constructor"&&t.push(r);return t}function Oc(e){return Yl(e)?c3(e):mW(e)}function gW(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var vW=Object.prototype,yW=vW.hasOwnProperty;function bW(e){if(!ua(e))return gW(e);var t=z0(e),r=[];for(var n in e)n=="constructor"&&(t||!yW.call(e,n))||r.push(n);return r}function V0(e){return Yl(e)?c3(e,!0):bW(e)}var wW=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_W=/^\w*$/;function q0(e,t){if(zr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||oc(e)?!0:_W.test(e)||!wW.test(e)||t!=null&&e in Object(t)}var xW=to(Object,"create");const ac=xW;function SW(){this.__data__=ac?ac(null):{},this.size=0}function EW(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var CW="__lodash_hash_undefined__",MW=Object.prototype,TW=MW.hasOwnProperty;function AW(e){var t=this.__data__;if(ac){var r=t[e];return r===CW?void 0:r}return TW.call(t,e)?t[e]:void 0}var OW=Object.prototype,IW=OW.hasOwnProperty;function PW(e){var t=this.__data__;return ac?t[e]!==void 0:IW.call(t,e)}var jW="__lodash_hash_undefined__";function kW(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ac&&t===void 0?jW:t,this}function Ks(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])}}Ks.prototype.clear=SW;Ks.prototype.delete=EW;Ks.prototype.get=AW;Ks.prototype.has=PW;Ks.prototype.set=kW;function RW(){this.__data__=[],this.size=0}function Ql(e,t){for(var r=e.length;r--;)if(F0(e[r][0],t))return r;return-1}var NW=Array.prototype,DW=NW.splice;function $W(e){var t=this.__data__,r=Ql(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():DW.call(t,r,1),--this.size,!0}function BW(e){var t=this.__data__,r=Ql(t,e);return r<0?void 0:t[r][1]}function LW(e){return Ql(this.__data__,e)>-1}function FW(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 Li(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])}}Li.prototype.clear=RW;Li.prototype.delete=$W;Li.prototype.get=BW;Li.prototype.has=LW;Li.prototype.set=FW;var UW=to(ci,"Map");const cc=UW;function zW(){this.size=0,this.__data__={hash:new Ks,map:new(cc||Li),string:new Ks}}function VW(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 VW(t)?r[typeof t=="string"?"string":"hash"]:r.map}function qW(e){var t=ef(this,e).delete(e);return this.size-=t?1:0,t}function WW(e){return ef(this,e).get(e)}function GW(e){return ef(this,e).has(e)}function HW(e,t){var r=ef(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,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=zW;Fi.prototype.delete=qW;Fi.prototype.get=WW;Fi.prototype.has=GW;Fi.prototype.set=HW;var KW="Expected a function";function W0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(KW);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(W0.Cache||Fi),r}W0.Cache=Fi;var JW=500;function XW(e){var t=W0(e,function(n){return r.size===JW&&r.clear(),n}),r=t.cache;return t}var YW=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ZW=/\\(\\)?/g,QW=XW(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(YW,function(r,n,i,s){t.push(i?s.replace(ZW,"$1"):n||r)}),t});const eG=QW;function tG(e){return e==null?"":Y8(e)}function l3(e,t){return zr(e)?e:q0(e,t)?[e]:eG(tG(e))}var rG=1/0;function tf(e){if(typeof e=="string"||oc(e))return e;var t=e+"";return t=="0"&&1/e==-rG?"-0":t}function G0(e,t){t=l3(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 nG(e,t,r){var n=e==null?void 0:G0(e,t);return n===void 0?r:n}function f3(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var iG=u3(Object.getPrototypeOf,Object);const d3=iG;function sG(){this.__data__=new Li,this.size=0}function oG(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function aG(e){return this.__data__.get(e)}function cG(e){return this.__data__.has(e)}var uG=200;function lG(e,t){var r=this.__data__;if(r instanceof Li){var n=r.__data__;if(!cc||n.length<uG-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Fi(n)}return r.set(e,t),this.size=r.size,this}function Zn(e){var t=this.__data__=new Li(e);this.size=t.size}Zn.prototype.clear=sG;Zn.prototype.delete=oG;Zn.prototype.get=aG;Zn.prototype.has=cG;Zn.prototype.set=lG;function fG(e,t){return e&&Xl(t,Oc(t),e)}function dG(e,t){return e&&Xl(t,V0(t),e)}var h3=typeof exports=="object"&&exports&&!exports.nodeType&&exports,mv=h3&&typeof module=="object"&&module&&!module.nodeType&&module,hG=mv&&mv.exports===h3,gv=hG?ci.Buffer:void 0,vv=gv?gv.allocUnsafe:void 0;function pG(e,t){if(t)return e.slice();var r=e.length,n=vv?vv(r):new e.constructor(r);return e.copy(n),n}function p3(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 m3(){return[]}var mG=Object.prototype,gG=mG.propertyIsEnumerable,yv=Object.getOwnPropertySymbols,vG=yv?function(e){return e==null?[]:(e=Object(e),p3(yv(e),function(t){return gG.call(e,t)}))}:m3;const H0=vG;function yG(e,t){return Xl(e,H0(e),t)}var bG=Object.getOwnPropertySymbols,wG=bG?function(e){for(var t=[];e;)f3(t,H0(e)),e=d3(e);return t}:m3;const g3=wG;function _G(e,t){return Xl(e,g3(e),t)}function v3(e,t,r){var n=t(e);return zr(e)?n:f3(n,r(e))}function vh(e){return v3(e,Oc,H0)}function xG(e){return v3(e,V0,g3)}var SG=to(ci,"DataView");const yh=SG;var EG=to(ci,"Promise");const bh=EG;var CG=to(ci,"Set");const wh=CG;var bv="[object Map]",MG="[object Object]",wv="[object Promise]",_v="[object Set]",xv="[object WeakMap]",Sv="[object DataView]",TG=eo(yh),AG=eo(cc),OG=eo(bh),IG=eo(wh),PG=eo(gh),js=ca;(yh&&js(new yh(new ArrayBuffer(1)))!=Sv||cc&&js(new cc)!=bv||bh&&js(bh.resolve())!=wv||wh&&js(new wh)!=_v||gh&&js(new gh)!=xv)&&(js=function(e){var t=ca(e),r=t==MG?e.constructor:void 0,n=r?eo(r):"";if(n)switch(n){case TG:return Sv;case AG:return bv;case OG:return wv;case IG:return _v;case PG:return xv}return t});const uc=js;var jG=Object.prototype,kG=jG.hasOwnProperty;function RG(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&kG.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var NG=ci.Uint8Array;const el=NG;function K0(e){var t=new e.constructor(e.byteLength);return new el(t).set(new el(e)),t}function DG(e,t){var r=t?K0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var $G=/\w*$/;function BG(e){var t=new e.constructor(e.source,$G.exec(e));return t.lastIndex=e.lastIndex,t}var Ev=ii?ii.prototype:void 0,Cv=Ev?Ev.valueOf:void 0;function LG(e){return Cv?Object(Cv.call(e)):{}}function FG(e,t){var r=t?K0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var UG="[object Boolean]",zG="[object Date]",VG="[object Map]",qG="[object Number]",WG="[object RegExp]",GG="[object Set]",HG="[object String]",KG="[object Symbol]",JG="[object ArrayBuffer]",XG="[object DataView]",YG="[object Float32Array]",ZG="[object Float64Array]",QG="[object Int8Array]",eH="[object Int16Array]",tH="[object Int32Array]",rH="[object Uint8Array]",nH="[object Uint8ClampedArray]",iH="[object Uint16Array]",sH="[object Uint32Array]";function oH(e,t,r){var n=e.constructor;switch(t){case JG:return K0(e);case UG:case zG:return new n(+e);case XG:return DG(e,r);case YG:case ZG:case QG:case eH:case tH:case rH:case nH:case iH:case sH:return FG(e,r);case VG:return new n;case qG:case HG:return new n(e);case WG:return BG(e);case GG:return new n;case KG:return LG(e)}}function aH(e){return typeof e.constructor=="function"&&!z0(e)?gq(d3(e)):{}}var cH="[object Map]";function uH(e){return hs(e)&&uc(e)==cH}var Mv=Vo&&Vo.isMap,lH=Mv?Zl(Mv):uH;const fH=lH;var dH="[object Set]";function hH(e){return hs(e)&&uc(e)==dH}var Tv=Vo&&Vo.isSet,pH=Tv?Zl(Tv):hH;const mH=pH;var gH=1,vH=2,yH=4,y3="[object Arguments]",bH="[object Array]",wH="[object Boolean]",_H="[object Date]",xH="[object Error]",b3="[object Function]",SH="[object GeneratorFunction]",EH="[object Map]",CH="[object Number]",w3="[object Object]",MH="[object RegExp]",TH="[object Set]",AH="[object String]",OH="[object Symbol]",IH="[object WeakMap]",PH="[object ArrayBuffer]",jH="[object DataView]",kH="[object Float32Array]",RH="[object Float64Array]",NH="[object Int8Array]",DH="[object Int16Array]",$H="[object Int32Array]",BH="[object Uint8Array]",LH="[object Uint8ClampedArray]",FH="[object Uint16Array]",UH="[object Uint32Array]",Wt={};Wt[y3]=Wt[bH]=Wt[PH]=Wt[jH]=Wt[wH]=Wt[_H]=Wt[kH]=Wt[RH]=Wt[NH]=Wt[DH]=Wt[$H]=Wt[EH]=Wt[CH]=Wt[w3]=Wt[MH]=Wt[TH]=Wt[AH]=Wt[OH]=Wt[BH]=Wt[LH]=Wt[FH]=Wt[UH]=!0;Wt[xH]=Wt[b3]=Wt[IH]=!1;function pu(e,t,r,n,i,s){var o,a=t&gH,c=t&vH,u=t&yH;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!ua(e))return e;var l=zr(e);if(l){if(o=RG(e),!a)return vq(e,o)}else{var f=uc(e),h=f==b3||f==SH;if(Qu(e))return pG(e,a);if(f==w3||f==y3||h&&!i){if(o=c||h?{}:aH(e),!a)return c?_G(e,dG(o,e)):yG(e,fG(o,e))}else{if(!Wt[f])return i?e:{};o=oH(e,f,a)}}s||(s=new Zn);var y=s.get(e);if(y)return y;s.set(e,o),mH(e)?e.forEach(function(A){o.add(pu(A,t,r,A,e,s))}):fH(e)&&e.forEach(function(A,P){o.set(P,pu(A,t,r,P,e,s))});var b=u?c?xG:vh:c?V0:Oc,w=l?void 0:b(e);return bq(w||e,function(A,P){w&&(P=A,A=e[P]),r3(o,P,pu(A,t,r,P,e,s))}),o}var zH=1,VH=4;function qH(e){return pu(e,zH|VH)}var WH="__lodash_hash_undefined__";function GH(e){return this.__data__.set(e,WH),this}function HH(e){return this.__data__.has(e)}function tl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Fi;++t<r;)this.add(e[t])}tl.prototype.add=tl.prototype.push=GH;tl.prototype.has=HH;function KH(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 JH(e,t){return e.has(t)}var XH=1,YH=2;function _3(e,t,r,n,i,s){var o=r&XH,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&YH?new tl:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var b=e[f],w=t[f];if(n)var A=o?n(w,b,f,t,e,s):n(b,w,f,e,t,s);if(A!==void 0){if(A)continue;h=!1;break}if(y){if(!KH(t,function(P,R){if(!JH(y,R)&&(b===P||i(b,P,r,n,s)))return y.push(R)})){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 ZH(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function QH(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var eK=1,tK=2,rK="[object Boolean]",nK="[object Date]",iK="[object Error]",sK="[object Map]",oK="[object Number]",aK="[object RegExp]",cK="[object Set]",uK="[object String]",lK="[object Symbol]",fK="[object ArrayBuffer]",dK="[object DataView]",Av=ii?ii.prototype:void 0,ud=Av?Av.valueOf:void 0;function hK(e,t,r,n,i,s,o){switch(r){case dK:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case fK:return!(e.byteLength!=t.byteLength||!s(new el(e),new el(t)));case rK:case nK:case oK:return F0(+e,+t);case iK:return e.name==t.name&&e.message==t.message;case aK:case uK:return e==t+"";case sK:var a=ZH;case cK:var c=n&eK;if(a||(a=QH),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=tK,o.set(e,t);var l=_3(a(e),a(t),n,i,s,o);return o.delete(e),l;case lK:if(ud)return ud.call(e)==ud.call(t)}return!1}var pK=1,mK=Object.prototype,gK=mK.hasOwnProperty;function vK(e,t,r,n,i,s){var o=r&pK,a=vh(e),c=a.length,u=vh(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:gK.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 A=o;++f<c;){h=a[f];var P=e[h],R=t[h];if(n)var N=o?n(R,P,h,t,e,s):n(P,R,h,e,t,s);if(!(N===void 0?P===R||i(P,R,r,n,s):N)){w=!1;break}A||(A=h=="constructor")}if(w&&!A){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 yK=1,Ov="[object Arguments]",Iv="[object Array]",Wc="[object Object]",bK=Object.prototype,Pv=bK.hasOwnProperty;function wK(e,t,r,n,i,s){var o=zr(e),a=zr(t),c=o?Iv:uc(e),u=a?Iv:uc(t);c=c==Ov?Wc:c,u=u==Ov?Wc:u;var l=c==Wc,f=u==Wc,h=c==u;if(h&&Qu(e)){if(!Qu(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new Zn),o||a3(e)?_3(e,t,r,n,i,s):hK(e,t,c,r,n,i,s);if(!(r&yK)){var y=l&&Pv.call(e,"__wrapped__"),b=f&&Pv.call(t,"__wrapped__");if(y||b){var w=y?e.value():e,A=b?t.value():t;return s||(s=new Zn),i(w,A,r,n,s)}}return h?(s||(s=new Zn),vK(e,t,r,n,i,s)):!1}function rf(e,t,r,n,i){return e===t?!0:e==null||t==null||!hs(e)&&!hs(t)?e!==e&&t!==t:wK(e,t,r,n,rf,i)}var _K=1,xK=2;function SK(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 Zn;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?rf(l,u,_K|xK,n,f):h))return!1}}return!0}function x3(e){return e===e&&!ua(e)}function EK(e){for(var t=Oc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,x3(i)]}return t}function S3(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function CK(e){var t=EK(e);return t.length==1&&t[0][2]?S3(t[0][0],t[0][1]):function(r){return r===e||SK(r,e,t)}}function MK(e,t){return e!=null&&t in Object(e)}function TK(e,t,r){t=l3(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&&U0(i)&&e3(o,i)&&(zr(e)||i3(e)))}function AK(e,t){return e!=null&&TK(e,t,MK)}var OK=1,IK=2;function PK(e,t){return q0(e)&&x3(t)?S3(tf(e),t):function(r){var n=nG(r,e);return n===void 0&&n===t?AK(r,e):rf(t,n,OK|IK)}}function jK(e){return function(t){return t==null?void 0:t[e]}}function kK(e){return function(t){return G0(t,e)}}function RK(e){return q0(e)?jK(tf(e)):kK(e)}function E3(e){return typeof e=="function"?e:e==null?Z8:typeof e=="object"?zr(e)?PK(e[0],e[1]):CK(e):RK(e)}function NK(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 DK=NK();const $K=DK;function BK(e,t){return e&&$K(e,t,Oc)}function LK(e,t){return function(r,n){if(r==null)return r;if(!Yl(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 FK=LK(BK);const C3=FK;function UK(e,t){var r=[];return C3(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function zK(e,t){var r=zr(e)?p3:UK;return r(e,E3(t))}function VK(e,t){var r=-1,n=Yl(e)?Array(e.length):[];return C3(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function qK(e,t){return rf(e,t)}function WK(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function GK(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=oc(e),o=t!==void 0,a=t===null,c=t===t,u=oc(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 HK(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=GK(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 KK(e,t,r){t.length?t=hu(t,function(s){return zr(s)?function(o){return G0(o,s.length===1?s[0]:s)}:s}):t=[Z8];var n=-1;t=hu(t,Zl(E3));var i=VK(e,function(s,o,a){var c=hu(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return WK(i,function(s,o){return HK(s,o,r)})}function JK(e,t,r,n){return e==null?[]:(zr(t)||(t=t==null?[]:[t]),r=n?void 0:r,zr(r)||(r=r==null?[]:[r]),KK(e,t,r))}function XK({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=dn(),s=se.useRef(!1),{slippage:o}=Xr(),[a,c]=se.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=z8(o,a),{showPriceImpactTips:y,showPriceImpactWarn:b}=G8(n,i,u,l),{priceAcceptRouterData:w}=pV(a),[A,P]=se.useState(!1),[R,N]=se.useState(!1);se.useMemo(()=>f?i:n,[f]);const F=se.useMemo(()=>w!==void 0,[w]),L=()=>{if(w){if(s.current)return;s.current=!0;const q=qH(w);c(q),setTimeout(()=>{s.current=!1},300)}},G=se.useMemo(()=>A?!1:!!b,[A,b]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(L0,{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:Lo(u||"")}),_.jsx("img",{src:n==null?void 0:n.logo_url}),_.jsx("span",{className:"symbol",children:Mn((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:Lo(l||"")}),_.jsx("img",{src:i==null?void 0:i.logo_url}),_.jsx("span",{className:"symbol",children:Mn((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($0,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),y&&_.jsx("div",{style:{paddingBottom:"10px",color:"var(--cs-warning)"},children:"Price Impact Alert. 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(K8,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),_.jsx(H8,{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:A?"#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||R,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{R||(N(!0),t(a))},children:R?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(W8,{})}):"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 nf(e){const{text:t,type:r}=e,[n,i]=se.useState(!1),{addCommonToast:s}=aa(),o=a=>{n||(Il(a),$8(t,{debug:!1,message:"message"}),s("Copied"),i(!n))};return se.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 YK({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=dn(),{getTokenInfo:a}=Qs(),c=se.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(L0,{title:"Route",backClick:e}),_.jsxs("div",{className:"route-dialog-content",children:[_.jsx("div",{className:"simple-router-box",children:_.jsx(M3,{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(Kr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:an(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(Ac,{position:"bottom",content:_.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[_.jsx(QK,{poolAddress:f.pool_address}),_.jsx(jv,{token:f.fromToken}),_.jsx(jv,{token:f.toToken})]}),children:_.jsx(ZK,{path:f})})},f.to_type))})]},l))})}),_.jsxs("div",{className:"center",style:{gap:"4px"},children:[_.jsx(Kr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:an(o,i==null?void 0:i.decimals)}),_.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function ZK({path:e}){var t,r,n;return _.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[_.jsx(Kr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),_.jsx(Kr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),_.jsxs("span",{className:"provider",children:[(n=t6[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&_.jsxs("div",{className:"fee-tier",children:[" ",Le(e.fee_rate).mul(100).toString(),"%"]})]})}function jv({token:e}){const{getExplorerUrl:t}=Qo();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(Kr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:Mn((e==null?void 0:e.symbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:Il,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:Gs(e==null?void 0:e.coin_type)}),_.jsx(nf,{text:(e==null?void 0:e.coin_type)||""})]})]})}function QK({poolAddress:e}){const{getExplorerUrl:t}=Qo();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:Il,href:t(e,"poolAddress"),target:"_blank",children:Gs(e)}),_.jsx(nf,{text:e})]})]}),e&&_.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function M3({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var a,c,u;const[n,i]=se.useState(!1),{getTokenInfo:s}=Qs(),o=se.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]);return _.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:o?(c=(a=r==null?void 0:r.routers[0])==null?void 0:a.paths)==null?void 0:c.map((l,f)=>{var h,y,b;return f===0?`${(h=s(l==null?void 0:l.from_type))==null?void 0:h.symbol} > ${(y=s(l==null?void 0:l.to_type))==null?void 0:y.symbol}`:(b=s(l==null?void 0:l.to_type))==null?void 0:b.symbol}).join(" > "):r==null?void 0:r.router_summery}),_.jsxs("div",{className:"providers",children:[(u=r==null?void 0:r.providers)==null?void 0:u.map((l,f)=>_.jsx(Ac,{content:_.jsx("div",{children:t6[l].name}),position:"top",delay:300,children:_.jsx(Kr,{src:yr[l],style:{width:"16px",height:"16px"}})},l)),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(YK,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const Ic=Bi((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||Ii.setItem(Y4,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=yg(r.coin_type);o=i.filter(c=>yg(c.coin_type)!==a)}return s(o),Ii.setItem(Z4,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}))}}));Ii.getItem(Y4).then(e=>{e!==null&&Ic.getState().setCollectTokenMap(e,!0)});Ii.getItem(Z4).then(e=>{e&&Ic.getState().setImportTokenList(e)});function T3(){const{setCollectTokenMap:e,collectTokenMap:t}=Ic(),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=se.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function eJ(e){const{trustedTokenList:t}=Tc(),{tokenBalanceObj:r,currentAccount:n}=Dn(),{coinPriceObj:i}=U8(),{getTokenAmountValue:s}=Jl(),{fetchTokenInfo:o}=Qs(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:b,setImportTokenIsLoading:w,currentImportTokenData:A,searchInput:P,setSearchInput:R,importTokenIsLoading:N,showTokenListIsLoading:F,setCurrentTypeTab:L}=Ic(),[G,q]=se.useState(!1);se.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[J,ne]=se.useState(!1);se.useEffect(()=>{xg(i)||ne(!0)},[i]);const ae=se.useRef({}),[ce,V]=se.useState(!1);se.useEffect(()=>{(!xg(r)||!t0(ae.current,r))&&(ae.current=r,V(!0))},[r]);const $=(v,j)=>{const ee=j&&j.toLocaleLowerCase().trim(),ie=v.map(pe=>{let Ee=0,Se=0;pe.symbol.toLowerCase()===ee||pe.name.toLowerCase()===ee||pe.coin_type.toLowerCase()===ee?(Ee=1e3,Se=2):pe.symbol.toLowerCase().indexOf(ee)>-1?(Ee=100,Se=0):pe.name.toLowerCase().indexOf(ee)>-1?(Ee=10,Se=0):pe.coin_type.toLowerCase().indexOf(ee)>-1?(Ee=1,Se=0):pe.coin_type.toLowerCase()=="0x2::sui::sui"&&(Se=1);let Ke=Array.isArray(pe==null?void 0:pe.coin_priority)?Number(pe.coin_priority[0])||0:Number(pe==null?void 0:pe.coin_priority)||0;return e===pe.coin_type&&!j&&(Se=12,Ee=1e3,Ke=1e4),{...pe,mark:Ee,sort:Se,coin_priority_sort:Ke,rateNumber:Number((pe==null?void 0:pe.rate)||"0"),balanceNumber:Number((pe==null?void 0:pe.balance)||"0")}});return JK(ie,[pe=>!j&&e===pe.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(),ie=["symbol","name","coin_type"];return zK(ee.length===0?l:[...l,...f],pe=>ie.some(Ee=>{const Se=pe[Ee];return typeof Se=="string"?(j?Se:Se.toLowerCase()).includes(ee):!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=$(j,v);u(ee)}},m=async v=>{var j;w(!0);try{if(H4(v)){const ee=v.trim(),ie=Mr(ee).full_address,ve=await o(ie);if(!ve){u([]);return}const pe=((j=r==null?void 0:r[ee])==null?void 0:j.totalBalanceFormat)||"0",Ee=Le(pe).gt("0")?s(ee,pe):"0",Se={...ve,balance:pe,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=$(f,P);u(j)}},M=()=>{if(A){const v=y(A,!0),j=$(v,P);u(j),b(void 0),R("")}},E=v=>{const j=y(v,!1),ee=$(j,P);u(ee)},O=v=>{const j=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=$(j,P);u(ee)};se.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],ie=(ee==null?void 0:ee.totalBalanceFormat)||"0",ve=(ee==null?void 0:ee.displayBalance)||"0",pe=Le(ie).gt("0")?s(j==null?void 0:j.coin_type,ie):"0";v.push({...j,balance:ve,rate:an(pe,4,!0)})}h(v)}},[G,J,ce,n==null?void 0:n.address]);const C=se.useRef([]);se.useEffect(()=>{if((l==null?void 0:l.length)>0&&!qK(C.current,l)){C.current=l;const v=$(l);e&&f.find(ee=>ee.coin_type===e)!==void 0?(L("Imported"),x("Imported")):u(v)}},[l,e]);const g=se.useMemo(()=>{if(a==="Default"){if(!F&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!N)return!0;return!1},[P,c,A,N,F]);return{showTokenList:c,handleSearch:d,handleChangePlatform:O,currentImportTokenData:A,handleChangeType:x,handleImportClick:M,handleDeleteImportClick:E,isNoData:g}}function tJ({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(rJ,{token:r,onHandleTokenAction:t},r.coin_type))})}function rJ({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 nJ=zt("/images/img_no_data@2x.png");function iJ(e){const{img:t=nJ,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 sJ({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 kv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function oJ(e,t){return!!(e===t||kv(e)&&kv(t))}function aJ(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!oJ(e[r],t[r]))return!1;return!0}function cJ(e,t){t===void 0&&(t=aJ);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 _h(){return _h=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},_h.apply(null,arguments)}function Rv(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xh(e,t){return xh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},xh(e,t)}function uJ(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,xh(e,t)}var Nv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function lJ(e,t){return!!(e===t||Nv(e)&&Nv(t))}function fJ(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!lJ(e[r],t[r]))return!1;return!0}function ld(e,t){t===void 0&&(t=fJ);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 Dv(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 dJ=typeof performance=="object"&&typeof performance.now=="function",$v=dJ?function(){return performance.now()}:function(){return Date.now()};function Bv(e){cancelAnimationFrame(e.id)}function hJ(e,t){var r=$v();function n(){$v()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var fd=-1;function Lv(e){if(e===void 0&&(e=!1),fd===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),fd=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return fd}var ho=null;function Fv(e){if(e===void 0&&(e=!1),ho===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?ho="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ho="negative":ho="positive-ascending"),document.body.removeChild(t),ho}return ho}Tn.env.NODE_ENV;var pJ=150,mJ=function(t,r){return t},mu=null,gu=null;Tn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(mu=new WeakSet,gu=new WeakSet);function gJ(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){uJ(h,f);function h(b){var w;return w=f.call(this,b)||this,w._instanceProps=c(w.props,Rv(w)),w._outerRef=void 0,w._resetIsScrollingTimeoutId=null,w.state={instance:Rv(w),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof w.props.initialScrollOffset=="number"?w.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},w._callOnItemsRendered=void 0,w._callOnItemsRendered=ld(function(A,P,R,N){return w.props.onItemsRendered({overscanStartIndex:A,overscanStopIndex:P,visibleStartIndex:R,visibleStopIndex:N})}),w._callOnScroll=void 0,w._callOnScroll=ld(function(A,P,R){return w.props.onScroll({scrollDirection:A,scrollOffset:P,scrollUpdateWasRequested:R})}),w._getItemStyle=void 0,w._getItemStyle=function(A){var P=w.props,R=P.direction,N=P.itemSize,F=P.layout,L=w._getItemStyleCache(u&&N,u&&F,u&&R),G;if(L.hasOwnProperty(A))G=L[A];else{var q=r(w.props,A,w._instanceProps),J=i(w.props,A,w._instanceProps),ne=R==="horizontal"||F==="horizontal",ae=R==="rtl",ce=ne?q:0;L[A]=G={position:"absolute",left:ae?void 0:ce,right:ae?ce:void 0,top:ne?0:q,height:ne?"100%":J,width:ne?J:"100%"}}return G},w._getItemStyleCache=void 0,w._getItemStyleCache=ld(function(A,P,R){return{}}),w._onScrollHorizontal=function(A){var P=A.currentTarget,R=P.clientWidth,N=P.scrollLeft,F=P.scrollWidth;w.setState(function(L){if(L.scrollOffset===N)return null;var G=w.props.direction,q=N;if(G==="rtl")switch(Fv()){case"negative":q=-N;break;case"positive-descending":q=F-R-N;break}return q=Math.max(0,Math.min(q,F-R)),{isScrolling:!0,scrollDirection:L.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._onScrollVertical=function(A){var P=A.currentTarget,R=P.clientHeight,N=P.scrollHeight,F=P.scrollTop;w.setState(function(L){if(L.scrollOffset===F)return null;var G=Math.max(0,Math.min(F,N-R));return{isScrolling:!0,scrollDirection:L.scrollOffset<G?"forward":"backward",scrollOffset:G,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._outerRefSetter=function(A){var P=w.props.outerRef;w._outerRef=A,typeof P=="function"?P(A):P!=null&&typeof P=="object"&&P.hasOwnProperty("current")&&(P.current=A)},w._resetIsScrollingDebounced=function(){w._resetIsScrollingTimeoutId!==null&&Bv(w._resetIsScrollingTimeoutId),w._resetIsScrollingTimeoutId=hJ(w._resetIsScrolling,pJ)},w._resetIsScrolling=function(){w._resetIsScrollingTimeoutId=null,w.setState({isScrolling:!1},function(){w._getItemStyleCache(-1,null)})},w}h.getDerivedStateFromProps=function(w,A){return vJ(w,A),l(w),null};var y=h.prototype;return y.scrollTo=function(w){w=Math.max(0,w),this.setState(function(A){return A.scrollOffset===w?null:{scrollDirection:A.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(w,A){A===void 0&&(A="auto");var P=this.props,R=P.itemCount,N=P.layout,F=this.state.scrollOffset;w=Math.max(0,Math.min(w,R-1));var L=0;if(this._outerRef){var G=this._outerRef;N==="vertical"?L=G.scrollWidth>G.clientWidth?Lv():0:L=G.scrollHeight>G.clientHeight?Lv():0}this.scrollTo(s(this.props,w,A,F,this._instanceProps,L))},y.componentDidMount=function(){var w=this.props,A=w.direction,P=w.initialScrollOffset,R=w.layout;if(typeof P=="number"&&this._outerRef!=null){var N=this._outerRef;A==="horizontal"||R==="horizontal"?N.scrollLeft=P:N.scrollTop=P}this._callPropsCallbacks()},y.componentDidUpdate=function(){var w=this.props,A=w.direction,P=w.layout,R=this.state,N=R.scrollOffset,F=R.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var L=this._outerRef;if(A==="horizontal"||P==="horizontal")if(A==="rtl")switch(Fv()){case"negative":L.scrollLeft=-N;break;case"positive-ascending":L.scrollLeft=N;break;default:var G=L.clientWidth,q=L.scrollWidth;L.scrollLeft=q-G-N;break}else L.scrollLeft=N;else L.scrollTop=N}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Bv(this._resetIsScrollingTimeoutId)},y.render=function(){var w=this.props,A=w.children,P=w.className,R=w.direction,N=w.height,F=w.innerRef,L=w.innerElementType,G=w.innerTagName,q=w.itemCount,J=w.itemData,ne=w.itemKey,ae=ne===void 0?mJ:ne,ce=w.layout,V=w.outerElementType,$=w.outerTagName,p=w.style,d=w.useIsScrolling,m=w.width,x=this.state.isScrolling,M=R==="horizontal"||ce==="horizontal",E=M?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(se.createElement(A,{data:J,key:ae(j,J),index:j,isScrolling:d?x:void 0,style:this._getItemStyle(j)}));var ee=n(this.props,this._instanceProps);return se.createElement(V||$||"div",{className:P,onScroll:E,ref:this._outerRefSetter,style:_h({position:"relative",height:N,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:R},p)},se.createElement(L||G||"div",{children:v,ref:F,style:{height:M?"100%":ee,pointerEvents:x?"none":void 0,width:M?ee:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var w=this.props.itemCount;if(w>0){var A=this._getRangeToRender(),P=A[0],R=A[1],N=A[2],F=A[3];this._callOnItemsRendered(P,R,N,F)}}if(typeof this.props.onScroll=="function"){var L=this.state,G=L.scrollDirection,q=L.scrollOffset,J=L.scrollUpdateWasRequested;this._callOnScroll(G,q,J)}},y._getRangeToRender=function(){var w=this.props,A=w.itemCount,P=w.overscanCount,R=this.state,N=R.isScrolling,F=R.scrollDirection,L=R.scrollOffset;if(A===0)return[0,0,0,0];var G=o(this.props,L,this._instanceProps),q=a(this.props,G,L,this._instanceProps),J=!N||F==="backward"?Math.max(1,P):1,ne=!N||F==="forward"?Math.max(1,P):1;return[Math.max(0,G-J),Math.max(0,Math.min(A-1,q+ne)),G,q]},h}(se.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var vJ=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(Tn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&gu&&!gu.has(l)&&(gu.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":mu&&!mu.has(l)&&(mu.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.'))}},yJ=gJ({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),A=Math.min(w,r*l),P=Math.max(0,r*l-b+l+o);switch(n==="smart"&&(i>=P-b&&i<=A+b?n="auto":n="center"),n){case"start":return A;case"end":return P;case"center":{var R=Math.round(P+(A-P)/2);return R<Math.ceil(b/2)?0:R>w+Math.floor(b/2)?w:R}case"auto":default:return i>=P&&i<=A?i:i<P?P: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,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(Tn.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 Uv(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 bJ=["style"],wJ=["style"];function _J(e,t){var r=e.style,n=Dv(e,bJ),i=t.style,s=Dv(t,wJ);return!Uv(r,i)&&!Uv(n,s)}const xJ=se.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(CJ,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},_J),SJ=cJ((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function EJ({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=se.useRef(null);se.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=SJ(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(yJ,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:xJ})})}function CJ({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=T3(),{getExplorerUrl:s}=Qo();return _.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(Kr,{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:Mn(e.symbol)})}),_.jsx("p",{className:"token-name",children:Mn(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:Il,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Gs(e==null?void 0:e.coin_type)}),_.jsx(nf,{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?W4(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 MJ({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 TJ({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=eJ(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:h,currentPlatformTab:y,setCurrentPlatformTab:b,platformList:w,isOpenImportDialog:A,setIsOpenImportDialog:P,setSearchInput:R,searchInput:N,importTokenIsLoading:F,currentImportTokenData:L,setCurrentImportTokenData:G}=Ic();se.useEffect(()=>()=>{R(""),b("All"),h("Default"),G(void 0)},[]);const{handleCollectToken:q,collectTokenMap:J}=T3(),ne=m=>{h(m),a(m)},ae=m=>{b(m),o(m)},ce=()=>{c(),P(!1)},V=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();R(x),x?$(x):($(""),ne("Default"))},$=D0(m=>{H4(m)?s(r0(m,!1)):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=se.useMemo(()=>Array.from(J.values()),[J]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(L0,{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:N,onChange:m=>V(m.target.value),style:{paddingRight:"40px"}}),N.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=>{V("")},children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&_.jsx(tJ,{tokenList:d,onHandleTokenAction:p}),N.length===0&&_.jsx(MJ,{currentType:f,changeTab:ne}),N.length===0&&f==="Default"&&_.jsx(sJ,{tabList:w,currentTab:y,changeTab:ae})]}),i&&_.jsx(AJ,{showTooltip:N.length>0,text:N.length>0||L===void 0?"No tokens found":"No Imported Tokens"}),F&&_.jsx(B8,{}),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(EJ,{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 AJ({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx(iJ,{text:t,subItem:e?_.jsx("div",{children:_.jsx(Ac,{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 OJ({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=se.useState(!1);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(s=>_.jsxs("div",{className:"import-token-info",children:[_.jsx(Kr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:s.logo_url}),_.jsxs("div",{className:"info",children:[_.jsx("div",{className:"name",children:_.jsxs("span",{children:[" ",s.symbol," "]})}),_.jsxs("div",{className:"address",children:[_.jsx("span",{children:Gs(s.coin_type)}),_.jsx(nf,{text:s.coin_type})]})]})]},s.coin_type)),_.jsxs("div",{className:"risk-checkbox",children:[_.jsx(zl,{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,children:"Confirm"})]})]})]})]})}function A3(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 lc;(function(e){e.event="event",e.props="prop"})(lc||(lc={}));function Yi(){}function IJ(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 fc(e){return!!(e||"").match(/\d/)}function Ro(e){return e==null}function PJ(e){return typeof e=="number"&&isNaN(e)}function O3(e){return Ro(e)||PJ(e)||typeof e=="number"&&!isFinite(e)}function I3(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function jJ(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 kJ(e,t,r){var n=jJ(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 RJ(e){var t=se.useRef(e);t.current=e;var r=se.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 NJ(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 zv(e,t){return Array(t+1).join(e)}function j3(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."+zv("0",Math.abs(o))+i:o>=a?i=i+zv("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function Vv(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,A,P){return w.length>P?(Number(w[0])+Number(A)).toString()+w.substring(1,w.length):A+w},l[0]));var h=P3(l[1]||"",t,r),y=a?"-":"",b=n?".":"";return""+y+f+b+h}function Ds(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 k3=IJ(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}}}),DJ=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function $J(e,t,r){return Math.min(Math.max(e,t),r)}function dd(e){return Math.max(e.selectionStart,e.selectionEnd)}function BJ(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function LJ(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function FJ(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function UJ(e,t,r,n,i,s,o){o===void 0&&(o=FJ);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 A=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:b});if(A&&f[b]!==!0){h[y]=b,f[b]=!0;break}}}for(var P=n;P<u&&(h[P]===-1||!s(r[P]));)P++;var R=P===u||h[P]===-1?l:h[P];for(P=n-1;P>0&&h[P]===-1;)P--;var N=P===-1||h[P]===-1?0:h[P]+1;return N>R?R:n-N<R-n?N:R}function qv(e,t,r,n){var i=e.length;if(t=$J(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 zJ(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(fc(e[r])||fc(e[r-1]));return t}function R3(e,t,r,n,i,s){s===void 0&&(s=Yi);var o=RJ(function(b,w){var A,P;return O3(b)?(P="",A=""):typeof b=="number"||w?(P=typeof b=="number"?j3(b):b,A=n(P)):(P=i(b,void 0),A=n(P)),{formattedValue:A,numAsString:P}}),a=se.useState(function(){return o(Ro(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;Ro(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return se.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function VJ(e){return e.replace(/[^0-9]/g,"")}function qJ(e){return e}function WJ(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=qJ);var a=e.removeFormatting;a===void 0&&(a=VJ);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=Yi);var y=e.onKeyDown;y===void 0&&(y=Yi);var b=e.onMouseUp;b===void 0&&(b=Yi);var w=e.onFocus;w===void 0&&(w=Yi);var A=e.onBlur;A===void 0&&(A=Yi);var P=e.value,R=e.getCaretBoundary;R===void 0&&(R=zJ);var N=e.isValidInputCharacter;N===void 0&&(N=fc);var F=e.isCharacterSame,L=A3(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),G=R3(P,c,!!u,o,a,l),q=G[0],J=q.formattedValue,ne=q.numAsString,ae=G[1],ce=se.useRef(),V=se.useRef({formattedValue:J,numAsString:ne}),$=function(_e,ge){V.current={formattedValue:_e.formattedValue,numAsString:_e.value},ae(_e,ge)},p=se.useState(!1),d=p[0],m=p[1],x=se.useRef(null),M=se.useRef({setCaretTimeout:null,focusTimeout:null});se.useEffect(function(){return m(!0),function(){clearTimeout(M.current.setCaretTimeout),clearTimeout(M.current.focusTimeout)}},[]);var E=o,O=function(_e,ge){var Ae=parseFloat(ge);return{formattedValue:_e,value:ge,floatValue:isNaN(Ae)?void 0:Ae}},C=function(_e,ge,Ae){_e.selectionStart===0&&_e.selectionEnd===_e.value.length||(Ds(_e,ge),M.current.setCaretTimeout=setTimeout(function(){_e.value===Ae&&_e.selectionStart!==ge&&Ds(_e,ge)},0))},g=function(_e,ge,Ae){return qv(_e,ge,R(_e),Ae)},v=function(_e,ge,Ae){var qe=R(ge),De=UJ(ge,J,_e,Ae,qe,N,F);return De=qv(ge,De,qe),De},j=function(_e){var ge=_e.formattedValue;ge===void 0&&(ge="");var Ae=_e.input,qe=_e.source,De=_e.event,Oe=_e.numAsString,Ie;if(Ae){var Fe=_e.inputValue||Ae.value,ft=dd(Ae);Ae.value=ge,Ie=v(Fe,ge,ft),Ie!==void 0&&C(Ae,Ie,ge)}ge!==J&&$(O(ge,Oe),{event:De,source:qe})};se.useEffect(function(){var _e=V.current,ge=_e.formattedValue,Ae=_e.numAsString;(J!==ge||ne!==Ae)&&$(O(J,ne),{event:void 0,source:lc.props})},[J,ne]);var ee=x.current?dd(x.current):void 0,ie=typeof window<"u"?se.useLayoutEffect:se.useEffect;ie(function(){var _e=x.current;if(J!==V.current.formattedValue&&_e){var ge=v(V.current.formattedValue,J,ee);_e.value=J,C(_e,ge,J)}},[J]);var ve=function(_e,ge,Ae){var qe=ge.target,De=ce.current?DJ(ce.current,qe.selectionEnd):k3(J,_e),Oe=Object.assign(Object.assign({},De),{lastValue:J}),Ie=a(_e,Oe),Fe=E(Ie);if(Ie=a(Fe,void 0),f&&!f(O(Fe,Ie))){var ft=ge.target,dt=dd(ft),Ge=v(_e,J,dt);return ft.value=J,C(ft,Ge,J),!1}return j({formattedValue:Fe,numAsString:Ie,inputValue:_e,event:ge,source:Ae,input:ge.target}),!0},pe=function(_e,ge){ge===void 0&&(ge=0);var Ae=_e.selectionStart,qe=_e.selectionEnd;ce.current={selectionStart:Ae,selectionEnd:qe+ge}},Ee=function(_e){var ge=_e.target,Ae=ge.value,qe=ve(Ae,_e,lc.event);qe&&h(_e),ce.current=void 0},Se=function(_e){var ge=_e.target,Ae=_e.key,qe=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie;Ae==="ArrowLeft"||Ae==="Backspace"?Ie=Math.max(qe-1,0):Ae==="ArrowRight"?Ie=Math.min(qe+1,Oe.length):Ae==="Delete"&&(Ie=qe);var Fe=0;Ae==="Delete"&&qe===De&&(Fe=1);var ft=Ae==="ArrowLeft"||Ae==="ArrowRight";if(Ie===void 0||qe!==De&&!ft){y(_e),pe(ge,Fe);return}var dt=Ie;if(ft){var Ge=Ae==="ArrowLeft"?"left":"right";dt=g(Oe,Ie,Ge),dt!==Ie&&_e.preventDefault()}else Ae==="Delete"&&!N(Oe[Ie])?dt=g(Oe,Ie,"right"):Ae==="Backspace"&&!N(Oe[Ie])&&(dt=g(Oe,Ie,"left"));dt!==Ie&&C(ge,dt,Oe),y(_e),pe(ge,Fe)},Ke=function(_e){var ge=_e.target,Ae=function(){var qe=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;if(Oe===void 0&&(Oe=""),qe===De){var Ie=g(Oe,qe);Ie!==qe&&C(ge,Ie,Oe)}};Ae(),requestAnimationFrame(function(){Ae()}),b(_e),pe(ge)},Ue=function(_e){_e.persist&&_e.persist();var ge=_e.target,Ae=_e.currentTarget;x.current=ge,M.current.focusTimeout=setTimeout(function(){var qe=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie=g(Oe,qe);Ie!==qe&&!(qe===0&&De===Oe.length)&&C(ge,Ie,Oe),w(Object.assign(Object.assign({},_e),{currentTarget:Ae}))},0)},lt=function(_e){x.current=null,clearTimeout(M.current.focusTimeout),clearTimeout(M.current.setCaretTimeout),A(_e)},ht=d&&BJ()?"numeric":void 0,$e=Object.assign({inputMode:ht},L,{type:t,value:J,onChange:Ee,onKeyDown:Se,onMouseUp:Ke,onFocus:Ue,onBlur:lt});if(r==="text")return i?se.createElement(se.Fragment,null,i(J,L)||null):se.createElement("span",Object.assign({},L,{ref:s}),J);if(n){var mt=n;return se.createElement(mt,Object.assign({},$e,{ref:s}))}return se.createElement("input",Object.assign({},$e,{ref:s}))}function Wv(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=sf(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=kJ(y,u,a)),i&&(y=i+y),s&&(b=b+s),w&&(y="-"+y),e=y+(f&&l||"")+b,e}function sf(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 GJ(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 HJ(e,t){return new RegExp("(^-)|[0-9]|"+I3(e),t?"g":void 0)}function KJ(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function JJ(e,t,r){var n;t===void 0&&(t=LJ(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=sf(r),y=h.allowedDecimalSeparators,b=h.decimalSeparator,w=e[f]===b;if(fc(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&y.indexOf(e[l])!==-1){var A=a===0?"":b;e=e.substring(0,l)+A+e.substring(l+1,e.length)}var P=function(x,M,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),M-=g,E-=g),{value:x,start:M,end:E,hasNegation:O}},R=P(e,l,f),N=R.hasNegation;n=R,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,J=e.substring(l,f);e.length&&q.length&&(L>q.length-o.length||G<s.length)&&!(J&&o.startsWith(J))&&(e=q);var ne=0;e.startsWith(s)?ne+=s.length:l<s.length&&(ne=l),e=e.substring(ne),f-=ne;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=GJ(N?"-"+e:e,i),e=(e.match(HJ(b,!0))||[]).join("");var V=e.indexOf(b);e=e.replace(new RegExp(I3(b),"g"),function(x,M){return M===V?".":""});var $=J0(e,i),p=$.beforeDecimal,d=$.afterDecimal,m=$.addNegation;return u.end-u.start<c.end-c.start&&p===""&&w&&!parseFloat(d)&&(e=m?"-":""),e}function XJ(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 YJ(e){var t=sf(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(`
|
|
106
|
+
`})]})}function L0({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[s,o]=se.useState(!0),a=q8(s,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[_.jsx(zr,{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"," ",cn(s?e.symbol:t.symbol)," ","="," ",i?_.jsx(oa,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):an(a,t.decimals)," ",cn(s?t.symbol:e.symbol)]}),_.jsx(zr,{src:s?t.logo_url:e.logo_url}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-swap"})})]})}function Yl(){const[e,t]=se.useState(window.innerWidth),r=B0(()=>{t(window.innerWidth)},300);se.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=se.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function H8(e,t,r,n){const{getTokenPrice:i}=Xl(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=q8(!0,r,n),c=se.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=se.useMemo(()=>{if(c&&+a)return Le(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=se.useMemo(()=>{const y=[];return s&&y.push(s.market),o&&!y.includes(o.market)&&y.push(o.market),y},[s==null?void 0:s.market,o==null?void 0:o.market]),f=se.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(5):!1,[u]),h=se.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(10):!1,[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h}}function Zl({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=se.useState(!1),[o,a]=se.useState(!1),c=se.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};se.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=se.useRef(null),[y,b]=se.useState({left:void 0,top:void 0});return se.useEffect(()=>{var w;if(i&&h.current){const A=(w=h.current)==null?void 0:w.getBoundingClientRect();let P,R;r==="top"?(P=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.top-2*A.height-8}px`):r==="bottom"?(P=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.bottom}px`):r==="left"?(P=`${window.scrollX+A.left-8}px`,R=`${window.scrollY+A.top+A.height/2}px`):r==="right"?(P=`${window.scrollX+A.right+8}px`,R=`${window.scrollY+A.top+A.height/2}px`):(P=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.top+A.height/2}px`),b({left:P,top:R})}},[i]),_.jsxs("div",{ref:h,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&nl.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 K8({content:e,children:t,position:r,autoSwitchTooltip:n=!1}){const{isApp:i}=Yl();return i&&n?_.jsxs(ln.Root,{children:[_.jsx(ln.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(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})]}):_.jsx(Zl,{content:e,position:r,children:t})}function J8({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=hn();Yl();const{priceImpact:a,sources:c,marketPrice:u}=H8(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi),l=se.useMemo(()=>{if(a){if(Le(a).gt(0))return"green";const f=Le(a).abs();return f.gt(1)&&f.lt(10)?"yellow":f.gte(10)?"red":"green"}return"yellow"},[a]);return _.jsxs(_.Fragment,{children:[!r&&Le(a).lte(-30)&&_.jsx("div",{className:"price-impact-tips red",children:"Price Impact Alert. 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 Impact"}),_.jsx(K8,{autoSwitchTooltip:!0,position:"top",content:_.jsx(RV,{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,children:a?iD(a,2):"Incalculable"}),_.jsx("div",{className:"platforms",children:c.map(f=>_.jsx(Zl,{content:_.jsx("span",{style:{fontSize:"12px"},children:t6[f]}),position:"top",delay:300,children:_.jsx(zr,{src:SD[f]})},f))})]})]})]})]})}function RV({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){const{isApp:s}=Yl();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(L0,{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=>t6[o]+" ").join("")})]})]})}function X8({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=hn();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:[an(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,fn.ROUND_DOWN)," ",cn(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function NV({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(n6,{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 DV({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 F0({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(DV,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const Wc=globalThis||void 0||self;var $V=typeof Wc=="object"&&Wc&&Wc.Object===Object&&Wc;const Y8=$V;var BV=typeof self=="object"&&self&&self.Object===Object&&self,LV=Y8||BV||Function("return this")();const ci=LV;var FV=ci.Symbol;const ii=FV;var Z8=Object.prototype,UV=Z8.hasOwnProperty,zV=Z8.toString,Ea=ii?ii.toStringTag:void 0;function VV(e){var t=UV.call(e,Ea),r=e[Ea];try{e[Ea]=void 0;var n=!0}catch{}var i=zV.call(e);return n&&(t?e[Ea]=r:delete e[Ea]),i}var qV=Object.prototype,WV=qV.toString;function GV(e){return WV.call(e)}var HV="[object Null]",KV="[object Undefined]",ov=ii?ii.toStringTag:void 0;function ca(e){return e==null?e===void 0?KV:HV:ov&&ov in Object(e)?VV(e):GV(e)}function hs(e){return e!=null&&typeof e=="object"}var JV="[object Symbol]";function ac(e){return typeof e=="symbol"||hs(e)&&ca(e)==JV}function pu(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 XV=Array.isArray;const Vr=XV;var YV=1/0,av=ii?ii.prototype:void 0,cv=av?av.toString:void 0;function Q8(e){if(typeof e=="string")return e;if(Vr(e))return pu(e,Q8)+"";if(ac(e))return cv?cv.call(e):"";var t=e+"";return t=="0"&&1/e==-YV?"-0":t}function ua(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function e3(e){return e}var ZV="[object AsyncFunction]",QV="[object Function]",eq="[object GeneratorFunction]",tq="[object Proxy]";function t3(e){if(!ua(e))return!1;var t=ca(e);return t==QV||t==eq||t==ZV||t==tq}var rq=ci["__core-js_shared__"];const ld=rq;var uv=function(){var e=/[^.]+$/.exec(ld&&ld.keys&&ld.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function nq(e){return!!uv&&uv in e}var iq=Function.prototype,sq=iq.toString;function eo(e){if(e!=null){try{return sq.call(e)}catch{}try{return e+""}catch{}}return""}var oq=/[\\^$.*+?()[\]{}|]/g,aq=/^\[object .+?Constructor\]$/,cq=Function.prototype,uq=Object.prototype,lq=cq.toString,fq=uq.hasOwnProperty,dq=RegExp("^"+lq.call(fq).replace(oq,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hq(e){if(!ua(e)||nq(e))return!1;var t=t3(e)?dq:aq;return t.test(eo(e))}function pq(e,t){return e==null?void 0:e[t]}function to(e,t){var r=pq(e,t);return hq(r)?r:void 0}var mq=to(ci,"WeakMap");const bh=mq;var lv=Object.create,gq=function(){function e(){}return function(t){if(!ua(t))return{};if(lv)return lv(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const vq=gq;function yq(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var bq=function(){try{var e=to(Object,"defineProperty");return e({},"",{}),e}catch{}}();const fv=bq;function wq(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var _q=9007199254740991,xq=/^(?:0|[1-9]\d*)$/;function r3(e,t){var r=typeof e;return t=t??_q,!!t&&(r=="number"||r!="symbol"&&xq.test(e))&&e>-1&&e%1==0&&e<t}function n3(e,t,r){t=="__proto__"&&fv?fv(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function U0(e,t){return e===t||e!==e&&t!==t}var Sq=Object.prototype,Eq=Sq.hasOwnProperty;function i3(e,t,r){var n=e[t];(!(Eq.call(e,t)&&U0(n,r))||r===void 0&&!(t in e))&&n3(e,t,r)}function Ql(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?n3(r,a,c):i3(r,a,c)}return r}var Cq=9007199254740991;function z0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Cq}function ef(e){return e!=null&&z0(e.length)&&!t3(e)}var Mq=Object.prototype;function V0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Mq;return e===r}function Tq(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Aq="[object Arguments]";function dv(e){return hs(e)&&ca(e)==Aq}var s3=Object.prototype,Oq=s3.hasOwnProperty,Iq=s3.propertyIsEnumerable,Pq=dv(function(){return arguments}())?dv:function(e){return hs(e)&&Oq.call(e,"callee")&&!Iq.call(e,"callee")};const o3=Pq;function jq(){return!1}var a3=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hv=a3&&typeof module=="object"&&module&&!module.nodeType&&module,kq=hv&&hv.exports===a3,pv=kq?ci.Buffer:void 0,Rq=pv?pv.isBuffer:void 0,Nq=Rq||jq;const el=Nq;var Dq="[object Arguments]",$q="[object Array]",Bq="[object Boolean]",Lq="[object Date]",Fq="[object Error]",Uq="[object Function]",zq="[object Map]",Vq="[object Number]",qq="[object Object]",Wq="[object RegExp]",Gq="[object Set]",Hq="[object String]",Kq="[object WeakMap]",Jq="[object ArrayBuffer]",Xq="[object DataView]",Yq="[object Float32Array]",Zq="[object Float64Array]",Qq="[object Int8Array]",eW="[object Int16Array]",tW="[object Int32Array]",rW="[object Uint8Array]",nW="[object Uint8ClampedArray]",iW="[object Uint16Array]",sW="[object Uint32Array]",Jt={};Jt[Yq]=Jt[Zq]=Jt[Qq]=Jt[eW]=Jt[tW]=Jt[rW]=Jt[nW]=Jt[iW]=Jt[sW]=!0;Jt[Dq]=Jt[$q]=Jt[Jq]=Jt[Bq]=Jt[Xq]=Jt[Lq]=Jt[Fq]=Jt[Uq]=Jt[zq]=Jt[Vq]=Jt[qq]=Jt[Wq]=Jt[Gq]=Jt[Hq]=Jt[Kq]=!1;function oW(e){return hs(e)&&z0(e.length)&&!!Jt[ca(e)]}function tf(e){return function(t){return e(t)}}var c3=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qa=c3&&typeof module=="object"&&module&&!module.nodeType&&module,aW=qa&&qa.exports===c3,fd=aW&&Y8.process,cW=function(){try{var e=qa&&qa.require&&qa.require("util").types;return e||fd&&fd.binding&&fd.binding("util")}catch{}}();const Vo=cW;var mv=Vo&&Vo.isTypedArray,uW=mv?tf(mv):oW;const u3=uW;var lW=Object.prototype,fW=lW.hasOwnProperty;function l3(e,t){var r=Vr(e),n=!r&&o3(e),i=!r&&!n&&el(e),s=!r&&!n&&!i&&u3(e),o=r||n||i||s,a=o?Tq(e.length,String):[],c=a.length;for(var u in e)(t||fW.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||r3(u,c)))&&a.push(u);return a}function f3(e,t){return function(r){return e(t(r))}}var dW=f3(Object.keys,Object);const hW=dW;var pW=Object.prototype,mW=pW.hasOwnProperty;function gW(e){if(!V0(e))return hW(e);var t=[];for(var r in Object(e))mW.call(e,r)&&r!="constructor"&&t.push(r);return t}function Oc(e){return ef(e)?l3(e):gW(e)}function vW(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var yW=Object.prototype,bW=yW.hasOwnProperty;function wW(e){if(!ua(e))return vW(e);var t=V0(e),r=[];for(var n in e)n=="constructor"&&(t||!bW.call(e,n))||r.push(n);return r}function q0(e){return ef(e)?l3(e,!0):wW(e)}var _W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xW=/^\w*$/;function W0(e,t){if(Vr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||ac(e)?!0:xW.test(e)||!_W.test(e)||t!=null&&e in Object(t)}var SW=to(Object,"create");const cc=SW;function EW(){this.__data__=cc?cc(null):{},this.size=0}function CW(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var MW="__lodash_hash_undefined__",TW=Object.prototype,AW=TW.hasOwnProperty;function OW(e){var t=this.__data__;if(cc){var r=t[e];return r===MW?void 0:r}return AW.call(t,e)?t[e]:void 0}var IW=Object.prototype,PW=IW.hasOwnProperty;function jW(e){var t=this.__data__;return cc?t[e]!==void 0:PW.call(t,e)}var kW="__lodash_hash_undefined__";function RW(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=cc&&t===void 0?kW:t,this}function Js(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])}}Js.prototype.clear=EW;Js.prototype.delete=CW;Js.prototype.get=OW;Js.prototype.has=jW;Js.prototype.set=RW;function NW(){this.__data__=[],this.size=0}function rf(e,t){for(var r=e.length;r--;)if(U0(e[r][0],t))return r;return-1}var DW=Array.prototype,$W=DW.splice;function BW(e){var t=this.__data__,r=rf(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():$W.call(t,r,1),--this.size,!0}function LW(e){var t=this.__data__,r=rf(t,e);return r<0?void 0:t[r][1]}function FW(e){return rf(this.__data__,e)>-1}function UW(e,t){var r=this.__data__,n=rf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Li(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])}}Li.prototype.clear=NW;Li.prototype.delete=BW;Li.prototype.get=LW;Li.prototype.has=FW;Li.prototype.set=UW;var zW=to(ci,"Map");const uc=zW;function VW(){this.size=0,this.__data__={hash:new Js,map:new(uc||Li),string:new Js}}function qW(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function nf(e,t){var r=e.__data__;return qW(t)?r[typeof t=="string"?"string":"hash"]:r.map}function WW(e){var t=nf(this,e).delete(e);return this.size-=t?1:0,t}function GW(e){return nf(this,e).get(e)}function HW(e){return nf(this,e).has(e)}function KW(e,t){var r=nf(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,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=VW;Fi.prototype.delete=WW;Fi.prototype.get=GW;Fi.prototype.has=HW;Fi.prototype.set=KW;var JW="Expected a function";function G0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(JW);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(G0.Cache||Fi),r}G0.Cache=Fi;var XW=500;function YW(e){var t=G0(e,function(n){return r.size===XW&&r.clear(),n}),r=t.cache;return t}var ZW=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,QW=/\\(\\)?/g,eG=YW(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(ZW,function(r,n,i,s){t.push(i?s.replace(QW,"$1"):n||r)}),t});const tG=eG;function rG(e){return e==null?"":Q8(e)}function d3(e,t){return Vr(e)?e:W0(e,t)?[e]:tG(rG(e))}var nG=1/0;function sf(e){if(typeof e=="string"||ac(e))return e;var t=e+"";return t=="0"&&1/e==-nG?"-0":t}function H0(e,t){t=d3(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[sf(t[r++])];return r&&r==n?e:void 0}function iG(e,t,r){var n=e==null?void 0:H0(e,t);return n===void 0?r:n}function h3(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var sG=f3(Object.getPrototypeOf,Object);const p3=sG;function oG(){this.__data__=new Li,this.size=0}function aG(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function cG(e){return this.__data__.get(e)}function uG(e){return this.__data__.has(e)}var lG=200;function fG(e,t){var r=this.__data__;if(r instanceof Li){var n=r.__data__;if(!uc||n.length<lG-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Fi(n)}return r.set(e,t),this.size=r.size,this}function Zn(e){var t=this.__data__=new Li(e);this.size=t.size}Zn.prototype.clear=oG;Zn.prototype.delete=aG;Zn.prototype.get=cG;Zn.prototype.has=uG;Zn.prototype.set=fG;function dG(e,t){return e&&Ql(t,Oc(t),e)}function hG(e,t){return e&&Ql(t,q0(t),e)}var m3=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gv=m3&&typeof module=="object"&&module&&!module.nodeType&&module,pG=gv&&gv.exports===m3,vv=pG?ci.Buffer:void 0,yv=vv?vv.allocUnsafe:void 0;function mG(e,t){if(t)return e.slice();var r=e.length,n=yv?yv(r):new e.constructor(r);return e.copy(n),n}function g3(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 v3(){return[]}var gG=Object.prototype,vG=gG.propertyIsEnumerable,bv=Object.getOwnPropertySymbols,yG=bv?function(e){return e==null?[]:(e=Object(e),g3(bv(e),function(t){return vG.call(e,t)}))}:v3;const K0=yG;function bG(e,t){return Ql(e,K0(e),t)}var wG=Object.getOwnPropertySymbols,_G=wG?function(e){for(var t=[];e;)h3(t,K0(e)),e=p3(e);return t}:v3;const y3=_G;function xG(e,t){return Ql(e,y3(e),t)}function b3(e,t,r){var n=t(e);return Vr(e)?n:h3(n,r(e))}function wh(e){return b3(e,Oc,K0)}function SG(e){return b3(e,q0,y3)}var EG=to(ci,"DataView");const _h=EG;var CG=to(ci,"Promise");const xh=CG;var MG=to(ci,"Set");const Sh=MG;var wv="[object Map]",TG="[object Object]",_v="[object Promise]",xv="[object Set]",Sv="[object WeakMap]",Ev="[object DataView]",AG=eo(_h),OG=eo(uc),IG=eo(xh),PG=eo(Sh),jG=eo(bh),ks=ca;(_h&&ks(new _h(new ArrayBuffer(1)))!=Ev||uc&&ks(new uc)!=wv||xh&&ks(xh.resolve())!=_v||Sh&&ks(new Sh)!=xv||bh&&ks(new bh)!=Sv)&&(ks=function(e){var t=ca(e),r=t==TG?e.constructor:void 0,n=r?eo(r):"";if(n)switch(n){case AG:return Ev;case OG:return wv;case IG:return _v;case PG:return xv;case jG:return Sv}return t});const lc=ks;var kG=Object.prototype,RG=kG.hasOwnProperty;function NG(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&RG.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var DG=ci.Uint8Array;const tl=DG;function J0(e){var t=new e.constructor(e.byteLength);return new tl(t).set(new tl(e)),t}function $G(e,t){var r=t?J0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var BG=/\w*$/;function LG(e){var t=new e.constructor(e.source,BG.exec(e));return t.lastIndex=e.lastIndex,t}var Cv=ii?ii.prototype:void 0,Mv=Cv?Cv.valueOf:void 0;function FG(e){return Mv?Object(Mv.call(e)):{}}function UG(e,t){var r=t?J0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var zG="[object Boolean]",VG="[object Date]",qG="[object Map]",WG="[object Number]",GG="[object RegExp]",HG="[object Set]",KG="[object String]",JG="[object Symbol]",XG="[object ArrayBuffer]",YG="[object DataView]",ZG="[object Float32Array]",QG="[object Float64Array]",eH="[object Int8Array]",tH="[object Int16Array]",rH="[object Int32Array]",nH="[object Uint8Array]",iH="[object Uint8ClampedArray]",sH="[object Uint16Array]",oH="[object Uint32Array]";function aH(e,t,r){var n=e.constructor;switch(t){case XG:return J0(e);case zG:case VG:return new n(+e);case YG:return $G(e,r);case ZG:case QG:case eH:case tH:case rH:case nH:case iH:case sH:case oH:return UG(e,r);case qG:return new n;case WG:case KG:return new n(e);case GG:return LG(e);case HG:return new n;case JG:return FG(e)}}function cH(e){return typeof e.constructor=="function"&&!V0(e)?vq(p3(e)):{}}var uH="[object Map]";function lH(e){return hs(e)&&lc(e)==uH}var Tv=Vo&&Vo.isMap,fH=Tv?tf(Tv):lH;const dH=fH;var hH="[object Set]";function pH(e){return hs(e)&&lc(e)==hH}var Av=Vo&&Vo.isSet,mH=Av?tf(Av):pH;const gH=mH;var vH=1,yH=2,bH=4,w3="[object Arguments]",wH="[object Array]",_H="[object Boolean]",xH="[object Date]",SH="[object Error]",_3="[object Function]",EH="[object GeneratorFunction]",CH="[object Map]",MH="[object Number]",x3="[object Object]",TH="[object RegExp]",AH="[object Set]",OH="[object String]",IH="[object Symbol]",PH="[object WeakMap]",jH="[object ArrayBuffer]",kH="[object DataView]",RH="[object Float32Array]",NH="[object Float64Array]",DH="[object Int8Array]",$H="[object Int16Array]",BH="[object Int32Array]",LH="[object Uint8Array]",FH="[object Uint8ClampedArray]",UH="[object Uint16Array]",zH="[object Uint32Array]",Wt={};Wt[w3]=Wt[wH]=Wt[jH]=Wt[kH]=Wt[_H]=Wt[xH]=Wt[RH]=Wt[NH]=Wt[DH]=Wt[$H]=Wt[BH]=Wt[CH]=Wt[MH]=Wt[x3]=Wt[TH]=Wt[AH]=Wt[OH]=Wt[IH]=Wt[LH]=Wt[FH]=Wt[UH]=Wt[zH]=!0;Wt[SH]=Wt[_3]=Wt[PH]=!1;function mu(e,t,r,n,i,s){var o,a=t&vH,c=t&yH,u=t&bH;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!ua(e))return e;var l=Vr(e);if(l){if(o=NG(e),!a)return yq(e,o)}else{var f=lc(e),h=f==_3||f==EH;if(el(e))return mG(e,a);if(f==x3||f==w3||h&&!i){if(o=c||h?{}:cH(e),!a)return c?xG(e,hG(o,e)):bG(e,dG(o,e))}else{if(!Wt[f])return i?e:{};o=aH(e,f,a)}}s||(s=new Zn);var y=s.get(e);if(y)return y;s.set(e,o),gH(e)?e.forEach(function(A){o.add(mu(A,t,r,A,e,s))}):dH(e)&&e.forEach(function(A,P){o.set(P,mu(A,t,r,P,e,s))});var b=u?c?SG:wh:c?q0:Oc,w=l?void 0:b(e);return wq(w||e,function(A,P){w&&(P=A,A=e[P]),i3(o,P,mu(A,t,r,P,e,s))}),o}var VH=1,qH=4;function WH(e){return mu(e,VH|qH)}var GH="__lodash_hash_undefined__";function HH(e){return this.__data__.set(e,GH),this}function KH(e){return this.__data__.has(e)}function rl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Fi;++t<r;)this.add(e[t])}rl.prototype.add=rl.prototype.push=HH;rl.prototype.has=KH;function JH(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 XH(e,t){return e.has(t)}var YH=1,ZH=2;function S3(e,t,r,n,i,s){var o=r&YH,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&ZH?new rl:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var b=e[f],w=t[f];if(n)var A=o?n(w,b,f,t,e,s):n(b,w,f,e,t,s);if(A!==void 0){if(A)continue;h=!1;break}if(y){if(!JH(t,function(P,R){if(!XH(y,R)&&(b===P||i(b,P,r,n,s)))return y.push(R)})){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 QH(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function eK(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var tK=1,rK=2,nK="[object Boolean]",iK="[object Date]",sK="[object Error]",oK="[object Map]",aK="[object Number]",cK="[object RegExp]",uK="[object Set]",lK="[object String]",fK="[object Symbol]",dK="[object ArrayBuffer]",hK="[object DataView]",Ov=ii?ii.prototype:void 0,dd=Ov?Ov.valueOf:void 0;function pK(e,t,r,n,i,s,o){switch(r){case hK:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case dK:return!(e.byteLength!=t.byteLength||!s(new tl(e),new tl(t)));case nK:case iK:case aK:return U0(+e,+t);case sK:return e.name==t.name&&e.message==t.message;case cK:case lK:return e==t+"";case oK:var a=QH;case uK:var c=n&tK;if(a||(a=eK),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=rK,o.set(e,t);var l=S3(a(e),a(t),n,i,s,o);return o.delete(e),l;case fK:if(dd)return dd.call(e)==dd.call(t)}return!1}var mK=1,gK=Object.prototype,vK=gK.hasOwnProperty;function yK(e,t,r,n,i,s){var o=r&mK,a=wh(e),c=a.length,u=wh(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:vK.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 A=o;++f<c;){h=a[f];var P=e[h],R=t[h];if(n)var N=o?n(R,P,h,t,e,s):n(P,R,h,e,t,s);if(!(N===void 0?P===R||i(P,R,r,n,s):N)){w=!1;break}A||(A=h=="constructor")}if(w&&!A){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 bK=1,Iv="[object Arguments]",Pv="[object Array]",Gc="[object Object]",wK=Object.prototype,jv=wK.hasOwnProperty;function _K(e,t,r,n,i,s){var o=Vr(e),a=Vr(t),c=o?Pv:lc(e),u=a?Pv:lc(t);c=c==Iv?Gc:c,u=u==Iv?Gc:u;var l=c==Gc,f=u==Gc,h=c==u;if(h&&el(e)){if(!el(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new Zn),o||u3(e)?S3(e,t,r,n,i,s):pK(e,t,c,r,n,i,s);if(!(r&bK)){var y=l&&jv.call(e,"__wrapped__"),b=f&&jv.call(t,"__wrapped__");if(y||b){var w=y?e.value():e,A=b?t.value():t;return s||(s=new Zn),i(w,A,r,n,s)}}return h?(s||(s=new Zn),yK(e,t,r,n,i,s)):!1}function of(e,t,r,n,i){return e===t?!0:e==null||t==null||!hs(e)&&!hs(t)?e!==e&&t!==t:_K(e,t,r,n,of,i)}var xK=1,SK=2;function EK(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 Zn;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?of(l,u,xK|SK,n,f):h))return!1}}return!0}function E3(e){return e===e&&!ua(e)}function CK(e){for(var t=Oc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,E3(i)]}return t}function C3(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function MK(e){var t=CK(e);return t.length==1&&t[0][2]?C3(t[0][0],t[0][1]):function(r){return r===e||EK(r,e,t)}}function TK(e,t){return e!=null&&t in Object(e)}function AK(e,t,r){t=d3(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=sf(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&&z0(i)&&r3(o,i)&&(Vr(e)||o3(e)))}function OK(e,t){return e!=null&&AK(e,t,TK)}var IK=1,PK=2;function jK(e,t){return W0(e)&&E3(t)?C3(sf(e),t):function(r){var n=iG(r,e);return n===void 0&&n===t?OK(r,e):of(t,n,IK|PK)}}function kK(e){return function(t){return t==null?void 0:t[e]}}function RK(e){return function(t){return H0(t,e)}}function NK(e){return W0(e)?kK(sf(e)):RK(e)}function M3(e){return typeof e=="function"?e:e==null?e3:typeof e=="object"?Vr(e)?jK(e[0],e[1]):MK(e):NK(e)}function DK(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 $K=DK();const BK=$K;function LK(e,t){return e&&BK(e,t,Oc)}function FK(e,t){return function(r,n){if(r==null)return r;if(!ef(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 UK=FK(LK);const T3=UK;function zK(e,t){var r=[];return T3(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function VK(e,t){var r=Vr(e)?g3:zK;return r(e,M3(t))}function qK(e,t){var r=-1,n=ef(e)?Array(e.length):[];return T3(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function WK(e,t){return of(e,t)}function GK(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function HK(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=ac(e),o=t!==void 0,a=t===null,c=t===t,u=ac(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 KK(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=HK(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 JK(e,t,r){t.length?t=pu(t,function(s){return Vr(s)?function(o){return H0(o,s.length===1?s[0]:s)}:s}):t=[e3];var n=-1;t=pu(t,tf(M3));var i=qK(e,function(s,o,a){var c=pu(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return GK(i,function(s,o){return KK(s,o,r)})}function XK(e,t,r,n){return e==null?[]:(Vr(t)||(t=t==null?[]:[t]),r=n?void 0:r,Vr(r)||(r=r==null?[]:[r]),JK(e,t,r))}function YK({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=hn(),s=se.useRef(!1),{slippage:o}=Xr(),[a,c]=se.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=V8(o,a),{showPriceImpactTips:y,showPriceImpactWarn:b}=H8(n,i,u,l),{priceAcceptRouterData:w}=gV(a),[A,P]=se.useState(!1),[R,N]=se.useState(!1);se.useMemo(()=>f?i:n,[f]);const F=se.useMemo(()=>w!==void 0,[w]),L=()=>{if(w){if(s.current)return;s.current=!0;const q=WH(w);c(q),setTimeout(()=>{s.current=!1},300)}},G=se.useMemo(()=>A?!1:!!b,[A,b]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(F0,{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:Lo(u||"")}),_.jsx("img",{src:n==null?void 0:n.logo_url}),_.jsx("span",{className:"symbol",children:cn((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:Lo(l||"")}),_.jsx("img",{src:i==null?void 0:i.logo_url}),_.jsx("span",{className:"symbol",children:cn((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(L0,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),y&&_.jsx("div",{style:{paddingBottom:"10px",color:"var(--cs-warning)"},children:"Price Impact Alert. 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(X8,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),_.jsx(J8,{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:A?"#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||R,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{R||(N(!0),t(a))},children:R?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(G8,{})}):"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 af(e){const{text:t,type:r}=e,[n,i]=se.useState(!1),{addCommonToast:s}=aa(),o=a=>{n||(Pl(a),B8(t,{debug:!1,message:"message"}),s("Copied"),i(!n))};return se.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 ZK({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=hn(),{getTokenInfo:a}=ys(),c=se.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(F0,{title:"Route",backClick:e}),_.jsxs("div",{className:"route-dialog-content",children:[_.jsx("div",{className:"simple-router-box",children:_.jsx(A3,{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(zr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:an(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(K8,{autoSwitchTooltip:!0,position:"bottom",content:_.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[_.jsx(eJ,{poolAddress:f.pool_address}),_.jsx(kv,{token:f.fromToken}),_.jsx(kv,{token:f.toToken})]}),children:_.jsx(QK,{path:f})})},f.to_type))})]},l))})}),_.jsxs("div",{className:"center",style:{gap:"4px"},children:[_.jsx(zr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:an(o,i==null?void 0:i.decimals)}),_.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function QK({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(zr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),_.jsx(zr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),_.jsxs("span",{className:"provider",children:[(n=r6[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&_.jsxs("div",{className:"fee-tier",children:[" ",Le(e.fee_rate).mul(100).toString(),"%"]})]})}function kv({token:e}){const{getExplorerUrl:t}=Qo();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(zr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:cn((e==null?void 0:e.symbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:Pl,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(af,{text:(e==null?void 0:e.coin_type)||""})]})]})}function eJ({poolAddress:e}){const{getExplorerUrl:t}=Qo();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:Pl,href:t(e,"poolAddress"),target:"_blank",children:Hs(e)}),_.jsx(af,{text:e})]})]}),e&&_.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function A3({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var c,u,l;const[n,i]=se.useState(!1),{isApp:s}=Yl(),{getTokenInfo:o}=ys(),a=se.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]);return _.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?(u=(c=r==null?void 0:r.routers[0])==null?void 0:c.paths)==null?void 0:u.map((f,h)=>{var y,b,w;return h===0?`${(y=o(f==null?void 0:f.from_type))==null?void 0:y.symbol} > ${(b=o(f==null?void 0:f.to_type))==null?void 0:b.symbol}`:(w=o(f==null?void 0:f.to_type))==null?void 0:w.symbol}).join(" > "):r==null?void 0:r.router_summery}),_.jsxs("div",{className:"providers",children:[(l=r==null?void 0:r.providers)==null?void 0:l.map((f,h)=>s?_.jsx(zr,{src:vr[f],style:{width:"16px",height:"16px"}}):_.jsx(Zl,{content:_.jsx("div",{children:r6[f].name}),position:"top",delay:300,children:_.jsx(zr,{src:vr[f],style:{width:"16px",height:"16px"}})},f)),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(ZK,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const Ic=Bi((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||Ii.setItem(Z4,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=bg(r.coin_type);o=i.filter(c=>bg(c.coin_type)!==a)}return s(o),Ii.setItem(Q4,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}))}}));Ii.getItem(Z4).then(e=>{e!==null&&Ic.getState().setCollectTokenMap(e,!0)});Ii.getItem(Q4).then(e=>{e&&Ic.getState().setImportTokenList(e)});function O3(){const{setCollectTokenMap:e,collectTokenMap:t}=Ic(),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=se.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function tJ(e){const{trustedTokenList:t}=Ac(),{tokenBalanceObj:r,currentAccount:n}=Dn(),{coinPriceObj:i}=z8(),{getTokenAmountValue:s}=Xl(),{fetchTokenInfo:o}=ys(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:b,setImportTokenIsLoading:w,currentImportTokenData:A,searchInput:P,setSearchInput:R,importTokenIsLoading:N,showTokenListIsLoading:F,setCurrentTypeTab:L}=Ic(),[G,q]=se.useState(!1);se.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[J,ne]=se.useState(!1);se.useEffect(()=>{Eg(i)||ne(!0)},[i]);const ae=se.useRef({}),[ce,V]=se.useState(!1);se.useEffect(()=>{(!Eg(r)||!i0(ae.current,r))&&(ae.current=r,V(!0))},[r]);const $=(v,j)=>{const ee=j&&j.toLocaleLowerCase().trim(),ie=v.map(pe=>{let Ee=0,Se=0;pe.symbol.toLowerCase()===ee||pe.name.toLowerCase()===ee||pe.coin_type.toLowerCase()===ee?(Ee=1e3,Se=2):pe.symbol.toLowerCase().indexOf(ee)>-1?(Ee=100,Se=0):pe.name.toLowerCase().indexOf(ee)>-1?(Ee=10,Se=0):pe.coin_type.toLowerCase().indexOf(ee)>-1?(Ee=1,Se=0):pe.coin_type.toLowerCase()=="0x2::sui::sui"&&(Se=1);let Ke=Array.isArray(pe==null?void 0:pe.coin_priority)?Number(pe.coin_priority[0])||0:Number(pe==null?void 0:pe.coin_priority)||0;return e===pe.coin_type&&!j&&(Se=12,Ee=1e3,Ke=1e4),{...pe,mark:Ee,sort:Se,coin_priority_sort:Ke,rateNumber:Number((pe==null?void 0:pe.rate)||"0"),balanceNumber:Number((pe==null?void 0:pe.balance)||"0")}});return XK(ie,[pe=>!j&&e===pe.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(),ie=["symbol","name","coin_type"];return VK(ee.length===0?l:[...l,...f],pe=>ie.some(Ee=>{const Se=pe[Ee];return typeof Se=="string"?(j?Se:Se.toLowerCase()).includes(ee):!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=$(j,v);u(ee)}},m=async v=>{var j;w(!0);try{if(X4(v)){const ee=v.trim(),ie=Mr(ee).full_address,ve=await o(ie);if(!ve){u([]);return}const pe=((j=r==null?void 0:r[ee])==null?void 0:j.totalBalanceFormat)||"0",Ee=Le(pe).gt("0")?s(ee,pe):"0",Se={...ve,balance:pe,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=$(f,P);u(j)}},M=()=>{if(A){const v=y(A,!0),j=$(v,P);u(j),b(void 0),R("")}},E=v=>{const j=y(v,!1),ee=$(j,P);u(ee)},O=v=>{const j=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=$(j,P);u(ee)};se.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],ie=(ee==null?void 0:ee.totalBalanceFormat)||"0",ve=(ee==null?void 0:ee.displayBalance)||"0",pe=Le(ie).gt("0")?s(j==null?void 0:j.coin_type,ie):"0";v.push({...j,balance:ve,rate:an(pe,4,!0)})}h(v)}},[G,J,ce,n==null?void 0:n.address]);const C=se.useRef([]);se.useEffect(()=>{if((l==null?void 0:l.length)>0&&!WK(C.current,l)){C.current=l;const v=$(l);e&&f.find(ee=>ee.coin_type===e)!==void 0?(L("Imported"),x("Imported")):u(v)}},[l,e]);const g=se.useMemo(()=>{if(a==="Default"){if(!F&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!N)return!0;return!1},[P,c,A,N,F]);return{showTokenList:c,handleSearch:d,handleChangePlatform:O,currentImportTokenData:A,handleChangeType:x,handleImportClick:M,handleDeleteImportClick:E,isNoData:g}}function rJ({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(nJ,{token:r,onHandleTokenAction:t},r.coin_type))})}function nJ({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 iJ=zt("/images/img_no_data@2x.png");function sJ(e){const{img:t=iJ,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 oJ({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 Rv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function aJ(e,t){return!!(e===t||Rv(e)&&Rv(t))}function cJ(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!aJ(e[r],t[r]))return!1;return!0}function uJ(e,t){t===void 0&&(t=cJ);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 Eh(){return Eh=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},Eh.apply(null,arguments)}function Nv(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ch(e,t){return Ch=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ch(e,t)}function lJ(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ch(e,t)}var Dv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function fJ(e,t){return!!(e===t||Dv(e)&&Dv(t))}function dJ(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!fJ(e[r],t[r]))return!1;return!0}function hd(e,t){t===void 0&&(t=dJ);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 $v(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 hJ=typeof performance=="object"&&typeof performance.now=="function",Bv=hJ?function(){return performance.now()}:function(){return Date.now()};function Lv(e){cancelAnimationFrame(e.id)}function pJ(e,t){var r=Bv();function n(){Bv()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var pd=-1;function Fv(e){if(e===void 0&&(e=!1),pd===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),pd=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return pd}var ho=null;function Uv(e){if(e===void 0&&(e=!1),ho===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?ho="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ho="negative":ho="positive-ascending"),document.body.removeChild(t),ho}return ho}Tn.env.NODE_ENV;var mJ=150,gJ=function(t,r){return t},gu=null,vu=null;Tn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(gu=new WeakSet,vu=new WeakSet);function vJ(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){lJ(h,f);function h(b){var w;return w=f.call(this,b)||this,w._instanceProps=c(w.props,Nv(w)),w._outerRef=void 0,w._resetIsScrollingTimeoutId=null,w.state={instance:Nv(w),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof w.props.initialScrollOffset=="number"?w.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},w._callOnItemsRendered=void 0,w._callOnItemsRendered=hd(function(A,P,R,N){return w.props.onItemsRendered({overscanStartIndex:A,overscanStopIndex:P,visibleStartIndex:R,visibleStopIndex:N})}),w._callOnScroll=void 0,w._callOnScroll=hd(function(A,P,R){return w.props.onScroll({scrollDirection:A,scrollOffset:P,scrollUpdateWasRequested:R})}),w._getItemStyle=void 0,w._getItemStyle=function(A){var P=w.props,R=P.direction,N=P.itemSize,F=P.layout,L=w._getItemStyleCache(u&&N,u&&F,u&&R),G;if(L.hasOwnProperty(A))G=L[A];else{var q=r(w.props,A,w._instanceProps),J=i(w.props,A,w._instanceProps),ne=R==="horizontal"||F==="horizontal",ae=R==="rtl",ce=ne?q:0;L[A]=G={position:"absolute",left:ae?void 0:ce,right:ae?ce:void 0,top:ne?0:q,height:ne?"100%":J,width:ne?J:"100%"}}return G},w._getItemStyleCache=void 0,w._getItemStyleCache=hd(function(A,P,R){return{}}),w._onScrollHorizontal=function(A){var P=A.currentTarget,R=P.clientWidth,N=P.scrollLeft,F=P.scrollWidth;w.setState(function(L){if(L.scrollOffset===N)return null;var G=w.props.direction,q=N;if(G==="rtl")switch(Uv()){case"negative":q=-N;break;case"positive-descending":q=F-R-N;break}return q=Math.max(0,Math.min(q,F-R)),{isScrolling:!0,scrollDirection:L.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._onScrollVertical=function(A){var P=A.currentTarget,R=P.clientHeight,N=P.scrollHeight,F=P.scrollTop;w.setState(function(L){if(L.scrollOffset===F)return null;var G=Math.max(0,Math.min(F,N-R));return{isScrolling:!0,scrollDirection:L.scrollOffset<G?"forward":"backward",scrollOffset:G,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._outerRefSetter=function(A){var P=w.props.outerRef;w._outerRef=A,typeof P=="function"?P(A):P!=null&&typeof P=="object"&&P.hasOwnProperty("current")&&(P.current=A)},w._resetIsScrollingDebounced=function(){w._resetIsScrollingTimeoutId!==null&&Lv(w._resetIsScrollingTimeoutId),w._resetIsScrollingTimeoutId=pJ(w._resetIsScrolling,mJ)},w._resetIsScrolling=function(){w._resetIsScrollingTimeoutId=null,w.setState({isScrolling:!1},function(){w._getItemStyleCache(-1,null)})},w}h.getDerivedStateFromProps=function(w,A){return yJ(w,A),l(w),null};var y=h.prototype;return y.scrollTo=function(w){w=Math.max(0,w),this.setState(function(A){return A.scrollOffset===w?null:{scrollDirection:A.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(w,A){A===void 0&&(A="auto");var P=this.props,R=P.itemCount,N=P.layout,F=this.state.scrollOffset;w=Math.max(0,Math.min(w,R-1));var L=0;if(this._outerRef){var G=this._outerRef;N==="vertical"?L=G.scrollWidth>G.clientWidth?Fv():0:L=G.scrollHeight>G.clientHeight?Fv():0}this.scrollTo(s(this.props,w,A,F,this._instanceProps,L))},y.componentDidMount=function(){var w=this.props,A=w.direction,P=w.initialScrollOffset,R=w.layout;if(typeof P=="number"&&this._outerRef!=null){var N=this._outerRef;A==="horizontal"||R==="horizontal"?N.scrollLeft=P:N.scrollTop=P}this._callPropsCallbacks()},y.componentDidUpdate=function(){var w=this.props,A=w.direction,P=w.layout,R=this.state,N=R.scrollOffset,F=R.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var L=this._outerRef;if(A==="horizontal"||P==="horizontal")if(A==="rtl")switch(Uv()){case"negative":L.scrollLeft=-N;break;case"positive-ascending":L.scrollLeft=N;break;default:var G=L.clientWidth,q=L.scrollWidth;L.scrollLeft=q-G-N;break}else L.scrollLeft=N;else L.scrollTop=N}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Lv(this._resetIsScrollingTimeoutId)},y.render=function(){var w=this.props,A=w.children,P=w.className,R=w.direction,N=w.height,F=w.innerRef,L=w.innerElementType,G=w.innerTagName,q=w.itemCount,J=w.itemData,ne=w.itemKey,ae=ne===void 0?gJ:ne,ce=w.layout,V=w.outerElementType,$=w.outerTagName,p=w.style,d=w.useIsScrolling,m=w.width,x=this.state.isScrolling,M=R==="horizontal"||ce==="horizontal",E=M?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(se.createElement(A,{data:J,key:ae(j,J),index:j,isScrolling:d?x:void 0,style:this._getItemStyle(j)}));var ee=n(this.props,this._instanceProps);return se.createElement(V||$||"div",{className:P,onScroll:E,ref:this._outerRefSetter,style:Eh({position:"relative",height:N,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:R},p)},se.createElement(L||G||"div",{children:v,ref:F,style:{height:M?"100%":ee,pointerEvents:x?"none":void 0,width:M?ee:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var w=this.props.itemCount;if(w>0){var A=this._getRangeToRender(),P=A[0],R=A[1],N=A[2],F=A[3];this._callOnItemsRendered(P,R,N,F)}}if(typeof this.props.onScroll=="function"){var L=this.state,G=L.scrollDirection,q=L.scrollOffset,J=L.scrollUpdateWasRequested;this._callOnScroll(G,q,J)}},y._getRangeToRender=function(){var w=this.props,A=w.itemCount,P=w.overscanCount,R=this.state,N=R.isScrolling,F=R.scrollDirection,L=R.scrollOffset;if(A===0)return[0,0,0,0];var G=o(this.props,L,this._instanceProps),q=a(this.props,G,L,this._instanceProps),J=!N||F==="backward"?Math.max(1,P):1,ne=!N||F==="forward"?Math.max(1,P):1;return[Math.max(0,G-J),Math.max(0,Math.min(A-1,q+ne)),G,q]},h}(se.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var yJ=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(Tn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&vu&&!vu.has(l)&&(vu.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":gu&&!gu.has(l)&&(gu.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.'))}},bJ=vJ({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),A=Math.min(w,r*l),P=Math.max(0,r*l-b+l+o);switch(n==="smart"&&(i>=P-b&&i<=A+b?n="auto":n="center"),n){case"start":return A;case"end":return P;case"center":{var R=Math.round(P+(A-P)/2);return R<Math.ceil(b/2)?0:R>w+Math.floor(b/2)?w:R}case"auto":default:return i>=P&&i<=A?i:i<P?P: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,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(Tn.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 zv(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 wJ=["style"],_J=["style"];function xJ(e,t){var r=e.style,n=$v(e,wJ),i=t.style,s=$v(t,_J);return!zv(r,i)&&!zv(n,s)}const SJ=se.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(MJ,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},xJ),EJ=uJ((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function CJ({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=se.useRef(null);se.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=EJ(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(bJ,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:SJ})})}function MJ({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=O3(),{getExplorerUrl:s}=Qo();return _.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(zr,{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:cn(e.symbol)})}),_.jsx("p",{className:"token-name",children:cn(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:Pl,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(af,{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?K4(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 TJ({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 AJ({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=tJ(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:h,currentPlatformTab:y,setCurrentPlatformTab:b,platformList:w,isOpenImportDialog:A,setIsOpenImportDialog:P,setSearchInput:R,searchInput:N,importTokenIsLoading:F,currentImportTokenData:L,setCurrentImportTokenData:G}=Ic();se.useEffect(()=>()=>{R(""),b("All"),h("Default"),G(void 0)},[]);const{handleCollectToken:q,collectTokenMap:J}=O3(),ne=m=>{h(m),a(m)},ae=m=>{b(m),o(m)},ce=()=>{c(),P(!1)},V=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();R(x),x?$(x):($(""),ne("Default"))},$=B0(m=>{X4(m)?s(ec(m,!1)):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=se.useMemo(()=>Array.from(J.values()),[J]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(F0,{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:N,onChange:m=>V(m.target.value),style:{paddingRight:"40px"}}),N.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=>{V("")},children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&_.jsx(rJ,{tokenList:d,onHandleTokenAction:p}),N.length===0&&_.jsx(TJ,{currentType:f,changeTab:ne}),N.length===0&&f==="Default"&&_.jsx(oJ,{tabList:w,currentTab:y,changeTab:ae})]}),i&&_.jsx(OJ,{showTooltip:N.length>0,text:N.length>0||L===void 0?"No tokens found":"No Imported Tokens"}),F&&_.jsx(L8,{}),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(CJ,{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 OJ({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx(sJ,{text:t,subItem:e?_.jsx("div",{children:_.jsx(Zl,{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 IJ({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=se.useState(!1);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(s=>_.jsxs("div",{className:"import-token-info",children:[_.jsx(zr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:s.logo_url}),_.jsxs("div",{className:"info",children:[_.jsx("div",{className:"name",children:_.jsxs("span",{children:[" ",s.symbol," "]})}),_.jsxs("div",{className:"address",children:[_.jsx("span",{children:Hs(s.coin_type)}),_.jsx(af,{text:s.coin_type})]})]})]},s.coin_type)),_.jsxs("div",{className:"risk-checkbox",children:[_.jsx(Vl,{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,children:"Confirm"})]})]})]})]})}function I3(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 fc;(function(e){e.event="event",e.props="prop"})(fc||(fc={}));function Yi(){}function PJ(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 dc(e){return!!(e||"").match(/\d/)}function Ro(e){return e==null}function jJ(e){return typeof e=="number"&&isNaN(e)}function P3(e){return Ro(e)||jJ(e)||typeof e=="number"&&!isFinite(e)}function j3(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function kJ(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 RJ(e,t,r){var n=kJ(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 NJ(e){var t=se.useRef(e);t.current=e;var r=se.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function X0(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 DJ(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 k3(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function Vv(e,t){return Array(t+1).join(e)}function R3(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."+Vv("0",Math.abs(o))+i:o>=a?i=i+Vv("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function qv(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=X0(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,A,P){return w.length>P?(Number(w[0])+Number(A)).toString()+w.substring(1,w.length):A+w},l[0]));var h=k3(l[1]||"",t,r),y=a?"-":"",b=n?".":"";return""+y+f+b+h}function $s(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 N3=PJ(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}}}),$J=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function BJ(e,t,r){return Math.min(Math.max(e,t),r)}function md(e){return Math.max(e.selectionStart,e.selectionEnd)}function LJ(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function FJ(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function UJ(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function zJ(e,t,r,n,i,s,o){o===void 0&&(o=UJ);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 A=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:b});if(A&&f[b]!==!0){h[y]=b,f[b]=!0;break}}}for(var P=n;P<u&&(h[P]===-1||!s(r[P]));)P++;var R=P===u||h[P]===-1?l:h[P];for(P=n-1;P>0&&h[P]===-1;)P--;var N=P===-1||h[P]===-1?0:h[P]+1;return N>R?R:n-N<R-n?N:R}function Wv(e,t,r,n){var i=e.length;if(t=BJ(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 VJ(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(dc(e[r])||dc(e[r-1]));return t}function D3(e,t,r,n,i,s){s===void 0&&(s=Yi);var o=NJ(function(b,w){var A,P;return P3(b)?(P="",A=""):typeof b=="number"||w?(P=typeof b=="number"?R3(b):b,A=n(P)):(P=i(b,void 0),A=n(P)),{formattedValue:A,numAsString:P}}),a=se.useState(function(){return o(Ro(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;Ro(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return se.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function qJ(e){return e.replace(/[^0-9]/g,"")}function WJ(e){return e}function GJ(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=WJ);var a=e.removeFormatting;a===void 0&&(a=qJ);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=Yi);var y=e.onKeyDown;y===void 0&&(y=Yi);var b=e.onMouseUp;b===void 0&&(b=Yi);var w=e.onFocus;w===void 0&&(w=Yi);var A=e.onBlur;A===void 0&&(A=Yi);var P=e.value,R=e.getCaretBoundary;R===void 0&&(R=VJ);var N=e.isValidInputCharacter;N===void 0&&(N=dc);var F=e.isCharacterSame,L=I3(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),G=D3(P,c,!!u,o,a,l),q=G[0],J=q.formattedValue,ne=q.numAsString,ae=G[1],ce=se.useRef(),V=se.useRef({formattedValue:J,numAsString:ne}),$=function(_e,ge){V.current={formattedValue:_e.formattedValue,numAsString:_e.value},ae(_e,ge)},p=se.useState(!1),d=p[0],m=p[1],x=se.useRef(null),M=se.useRef({setCaretTimeout:null,focusTimeout:null});se.useEffect(function(){return m(!0),function(){clearTimeout(M.current.setCaretTimeout),clearTimeout(M.current.focusTimeout)}},[]);var E=o,O=function(_e,ge){var Ae=parseFloat(ge);return{formattedValue:_e,value:ge,floatValue:isNaN(Ae)?void 0:Ae}},C=function(_e,ge,Ae){_e.selectionStart===0&&_e.selectionEnd===_e.value.length||($s(_e,ge),M.current.setCaretTimeout=setTimeout(function(){_e.value===Ae&&_e.selectionStart!==ge&&$s(_e,ge)},0))},g=function(_e,ge,Ae){return Wv(_e,ge,R(_e),Ae)},v=function(_e,ge,Ae){var qe=R(ge),De=zJ(ge,J,_e,Ae,qe,N,F);return De=Wv(ge,De,qe),De},j=function(_e){var ge=_e.formattedValue;ge===void 0&&(ge="");var Ae=_e.input,qe=_e.source,De=_e.event,Oe=_e.numAsString,Ie;if(Ae){var Fe=_e.inputValue||Ae.value,ft=md(Ae);Ae.value=ge,Ie=v(Fe,ge,ft),Ie!==void 0&&C(Ae,Ie,ge)}ge!==J&&$(O(ge,Oe),{event:De,source:qe})};se.useEffect(function(){var _e=V.current,ge=_e.formattedValue,Ae=_e.numAsString;(J!==ge||ne!==Ae)&&$(O(J,ne),{event:void 0,source:fc.props})},[J,ne]);var ee=x.current?md(x.current):void 0,ie=typeof window<"u"?se.useLayoutEffect:se.useEffect;ie(function(){var _e=x.current;if(J!==V.current.formattedValue&&_e){var ge=v(V.current.formattedValue,J,ee);_e.value=J,C(_e,ge,J)}},[J]);var ve=function(_e,ge,Ae){var qe=ge.target,De=ce.current?$J(ce.current,qe.selectionEnd):N3(J,_e),Oe=Object.assign(Object.assign({},De),{lastValue:J}),Ie=a(_e,Oe),Fe=E(Ie);if(Ie=a(Fe,void 0),f&&!f(O(Fe,Ie))){var ft=ge.target,dt=md(ft),Ge=v(_e,J,dt);return ft.value=J,C(ft,Ge,J),!1}return j({formattedValue:Fe,numAsString:Ie,inputValue:_e,event:ge,source:Ae,input:ge.target}),!0},pe=function(_e,ge){ge===void 0&&(ge=0);var Ae=_e.selectionStart,qe=_e.selectionEnd;ce.current={selectionStart:Ae,selectionEnd:qe+ge}},Ee=function(_e){var ge=_e.target,Ae=ge.value,qe=ve(Ae,_e,fc.event);qe&&h(_e),ce.current=void 0},Se=function(_e){var ge=_e.target,Ae=_e.key,qe=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie;Ae==="ArrowLeft"||Ae==="Backspace"?Ie=Math.max(qe-1,0):Ae==="ArrowRight"?Ie=Math.min(qe+1,Oe.length):Ae==="Delete"&&(Ie=qe);var Fe=0;Ae==="Delete"&&qe===De&&(Fe=1);var ft=Ae==="ArrowLeft"||Ae==="ArrowRight";if(Ie===void 0||qe!==De&&!ft){y(_e),pe(ge,Fe);return}var dt=Ie;if(ft){var Ge=Ae==="ArrowLeft"?"left":"right";dt=g(Oe,Ie,Ge),dt!==Ie&&_e.preventDefault()}else Ae==="Delete"&&!N(Oe[Ie])?dt=g(Oe,Ie,"right"):Ae==="Backspace"&&!N(Oe[Ie])&&(dt=g(Oe,Ie,"left"));dt!==Ie&&C(ge,dt,Oe),y(_e),pe(ge,Fe)},Ke=function(_e){var ge=_e.target,Ae=function(){var qe=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;if(Oe===void 0&&(Oe=""),qe===De){var Ie=g(Oe,qe);Ie!==qe&&C(ge,Ie,Oe)}};Ae(),requestAnimationFrame(function(){Ae()}),b(_e),pe(ge)},Ue=function(_e){_e.persist&&_e.persist();var ge=_e.target,Ae=_e.currentTarget;x.current=ge,M.current.focusTimeout=setTimeout(function(){var qe=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie=g(Oe,qe);Ie!==qe&&!(qe===0&&De===Oe.length)&&C(ge,Ie,Oe),w(Object.assign(Object.assign({},_e),{currentTarget:Ae}))},0)},lt=function(_e){x.current=null,clearTimeout(M.current.focusTimeout),clearTimeout(M.current.setCaretTimeout),A(_e)},ht=d&&LJ()?"numeric":void 0,$e=Object.assign({inputMode:ht},L,{type:t,value:J,onChange:Ee,onKeyDown:Se,onMouseUp:Ke,onFocus:Ue,onBlur:lt});if(r==="text")return i?se.createElement(se.Fragment,null,i(J,L)||null):se.createElement("span",Object.assign({},L,{ref:s}),J);if(n){var mt=n;return se.createElement(mt,Object.assign({},$e,{ref:s}))}return se.createElement("input",Object.assign({},$e,{ref:s}))}function Gv(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=cf(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,h=X0(e,o),y=h.beforeDecimal,b=h.afterDecimal,w=h.addNegation;return r!==void 0&&(b=k3(b,r,!!n)),u&&(y=RJ(y,u,a)),i&&(y=i+y),s&&(b=b+s),w&&(y="-"+y),e=y+(f&&l||"")+b,e}function cf(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 HJ(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 KJ(e,t){return new RegExp("(^-)|[0-9]|"+j3(e),t?"g":void 0)}function JJ(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function XJ(e,t,r){var n;t===void 0&&(t=FJ(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=cf(r),y=h.allowedDecimalSeparators,b=h.decimalSeparator,w=e[f]===b;if(dc(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&y.indexOf(e[l])!==-1){var A=a===0?"":b;e=e.substring(0,l)+A+e.substring(l+1,e.length)}var P=function(x,M,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),M-=g,E-=g),{value:x,start:M,end:E,hasNegation:O}},R=P(e,l,f),N=R.hasNegation;n=R,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,J=e.substring(l,f);e.length&&q.length&&(L>q.length-o.length||G<s.length)&&!(J&&o.startsWith(J))&&(e=q);var ne=0;e.startsWith(s)?ne+=s.length:l<s.length&&(ne=l),e=e.substring(ne),f-=ne;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=HJ(N?"-"+e:e,i),e=(e.match(KJ(b,!0))||[]).join("");var V=e.indexOf(b);e=e.replace(new RegExp(j3(b),"g"),function(x,M){return M===V?".":""});var $=X0(e,i),p=$.beforeDecimal,d=$.afterDecimal,m=$.addNegation;return u.end-u.start<c.end-c.start&&p===""&&w&&!parseFloat(d)&&(e=m?"-":""),e}function YJ(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 ZJ(e){var t=cf(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(`
|
|
107
107
|
Decimal separator can't be same as thousand separator.
|
|
108
108
|
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
109
109
|
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|
|
@@ -111,4 +111,4 @@ body { background-color: var(--color-page-background); }
|
|
|
111
111
|
Prefix can't start with '-' when allowNegative is true.
|
|
112
112
|
prefix: `+i+`
|
|
113
113
|
allowNegative: `+s+`
|
|
114
|
-
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function ZJ(e){e=YJ(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=Yi);var s=e.onBlur;s===void 0&&(s=Yi);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=A3(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=sf(e),A=w.decimalSeparator,P=w.allowedDecimalSeparators,R=function(m){return Wv(m,e)},N=function(m,x){return JJ(m,x,e)},F=Ro(f)?l:f,L=h??KJ(F,u,t);Ro(f)?Ro(l)||(L=L||typeof l=="number"):L=L||typeof f=="number";var G=function(m){return O3(m)?m:(typeof m=="number"&&(m=j3(m)),L&&typeof a=="number"?Vv(m,a,!!c):m)},q=R3(G(f),G(l),!!L,R,N,y),J=q[0],ne=J.numAsString,ae=J.formattedValue,ce=q[1],V=function(m){var x=m.target,M=m.key,E=x.selectionStart,O=x.selectionEnd,C=x.value;if(C===void 0&&(C=""),(M==="Backspace"||M==="Delete")&&O<u.length){m.preventDefault();return}if(E!==O){i(m);return}M==="Backspace"&&C[0]==="-"&&E===u.length+1&&r&&Ds(x,1),a&&c&&(M==="Backspace"&&C[E-1]===A?(Ds(x,E-1),m.preventDefault()):M==="Delete"&&C[E]===A&&m.preventDefault()),P!=null&&P.includes(M)&&C[E]===A&&Ds(x,E+1);var g=o===!0?",":o;M==="Backspace"&&C[E-1]===g&&Ds(x,E-1),M==="Delete"&&C[E]===g&&Ds(x,E+1),i(m)},$=function(m){var x=ne;if(x.match(/\d/g)||(x=""),n||(x=NJ(x)),c&&a&&(x=Vv(x,a,c)),x!==ne){var M=Wv(x,e);ce({formattedValue:M,value:x,floatValue:parseFloat(x)},{event:m,source:lc.event})}s(m)},p=function(m){return m===A?!0:fc(m)},d=function(m){var x=m.currentValue,M=m.lastValue,E=m.formattedValue,O=m.currentValueIndex,C=m.formattedValueIndex,g=x[O],v=E[C],j=k3(M,x),ee=j.to,ie=function(ve){return N(ve).indexOf(".")+u.length};return f===0&&c&&a&&x[ee.start]===A&&ie(x)<O&&ie(E)>C?!1:O>=ee.start&&O<ee.end&&P&&P.includes(g)&&v===A?!0:g===v};return Object.assign(Object.assign({},b),{value:ae,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:ce,format:R,removeFormatting:N,getCaretBoundary:function(m){return XJ(m,e)},onKeyDown:V,onBlur:$})}function QJ(e){var t=ZJ(e);return se.createElement(WJ,Object.assign({},t))}function eX(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 A;const b=((A=y==null?void 0:y.target)==null?void 0:A.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(QJ,{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 tX(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(Kr,{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]})}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function Gv({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]=se.useState(!1),{currentAccount:b}=Dn(),w=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||"0").div(2),R=an(P.toString(),o==null?void 0:o.decimals,!0).toString();t&&Le(R).eq(t)||i(R)},A=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||0),R=Mr((o==null?void 0:o.coin_type)||"").full_address===kh,N=.05;let F=P;R&&Le(P).gt(N)&&(F=F.sub(N)),!(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(eX,{inputAllowed:l,value:t,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>y(!0),onBlur:()=>y(!1)}),_.jsx(tX,{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:W4(r,2)}):_.jsx("div",{}),b&&_.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:A,children:"MAX"})]})]})]})]})}function rX({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Dn(),{getOwnerCoinBalances:s}=Zu(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:f,routerData:h,isOpenSecondary:y,setIsOpenSecondary:b}=dn(),{handleAmountChange:w,handleSelectToken:A,fromBalanceInfo:P,toBalanceInfo:R,fromAmountValue:N,toAmountValue:F,doSwapAction:L,reCalculateRouteData:G,refreshMarketPrice:q,scamsText:J}=IV(),{slippage:ne}=Xr(),{isCustomMode:ae,customWarnTokenList:ce}=vV(o,a),{amountLimit:V}=z8(ne,h),{formatSwapRouter:$}=mV(h),[p,d]=se.useState(!1),{btnText:m,btnDisabled:x}=PV(P==null?void 0:P.totalBalanceFormat),[M,E]=se.useState(!1),[O,C]=se.useState(!1),[g,v]=se.useState(!1);se.useEffect(()=>{y?e>=5&&j():e>=20&&j()},[e]);const j=()=>{G(),n&&s(),q()},ee=()=>({...h}),ie=async()=>{a&&A(a,!0)},ve=se.useMemo(()=>!(M||y),[M,y]);return _.jsxs("div",{className:"swap-trade-box",children:[_.jsxs("div",{className:"trade-form",style:{flexDirection:"column",display:"flex"},children:[_.jsx(Gv,{loading:!f&&l,balance:P,amountValue:N,handleTokenSelectClick:()=>{C(!0),E(!0)},onInputChange:pe=>{w(pe,!0)},amount:c,token:o}),_.jsx("div",{onClick:ie,className:"swap-icon",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{cursor:"pointer"},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:p?"rotate(90deg)":"none",width:p?"16px":"14px",height:p?"16px":"14px"},children:_.jsx("use",{xlinkHref:p?"#icon-swap":"#icon-trade"})})}),_.jsx(Gv,{marginTop:"-20px",loading:f&&l,balance:R,showHalf:!1,showMax:!1,amountValue:F,handleTokenSelectClick:()=>{C(!1),E(!0)},onInputChange:pe=>{w(pe,!1)},inputAllowed:!1,amount:u,token:a})]}),J&&_.jsx(RV,{scamsText:J}),_.jsxs("div",{className:"swap-bottom-block",style:{border:x?"0px solid #2a3238":"1px solid #2a3238"},children:[_.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:x||l,onClick:()=>{n?ae&&ce.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(W8,{})}):m}),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($0,{baseToken:o,quoteToken:a,baseAmount:h.fromAmountUi||"",quoteAmount:h.toAmountUi||"",loading:l}),_.jsx(H8,{isLoading:l,routerData:h})]}),_.jsx(K8,{isLoading:l,amountLimit:V}),_.jsx(M3,{hasSubMenu:!0,formatSwapRouter:$,isLoading:l})]})]}),y&&_.jsx(XK,{data:ee(),toBack:()=>b(!1),onSubmitClick:async pe=>{try{await L(pe,r==null?void 0:r.partner)}finally{b(!1)}}}),M&&_.jsx(TJ,{currToken:O?o:a,backClick:()=>E(!1),onSelectToken:pe=>{A(pe,O),E(!1)}}),g&&ce.length>0&&_.jsx(OJ,{onClose:()=>{v(!1)},tokenList:ce,onSureClick:()=>{v(!1),b(!0)}})]})}function nX({initProps:e={},customWallet:t}){eV();const{ToastContainer:r}=aa(),{fetchRouterConfig:n}=Gz(),{getTokens:i}=Qs(),{fetchTokenPrices:s}=Jl(),{transactionData:o,setTransactionData:a}=R0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=dn(),[y,b]=se.useState(0),w=se.useRef(y);Qz(e),se.useEffect(()=>{i(),s([]),n()},[]),se.useEffect(()=>{w.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),Hz({interval:1e3,callback:()=>{w.current=w.current+1,c?w.current>=5&&A():w.current>=20&&A()}});const A=()=>{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(zz,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),_.jsx(Tz,{handleRefresh:A}),_.jsx(rX,{refreshCount:y,customWallet:t,initProps:e}),o&&_.jsx(Vz,{transactionData:o,onClose:()=>{a(void 0)}}),_.jsx(r,{})]})})}function X0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=Zu(),n=Lr.useCurrentAccount(),{saveCurrentAccount:i}=Dn(),{mutate:s}=Lr.useConnectWallet();return se.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),se.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(nX,{initProps:e,customWallet:t})}function iX({initProps:e,customWallet:t}){const[r,n]=se.useState(!0);return _.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&_.jsx("div",{className:"swap-modal-box",children:_.jsx(X0,{initProps:e,customWallet:t})}),_.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function sX({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=se.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:zt("/images/img-logo@2x.png")})}),i&&_.jsx("div",{className:`widget-modal ${t} ${e}`,children:_.jsx(X0,{initProps:r,customWallet:n})})]})}function oX({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return _.jsxs(Ll,{appearance:"dark",children:[r==="Integrated"&&_.jsx(X0,{initProps:e,customWallet:t}),r==="Widget"&&_.jsx(sX,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&_.jsx(iX,{initProps:e,customWallet:t})]})}const aX=oX;exports.CetusSwap=aX;
|
|
114
|
+
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function QJ(e){e=ZJ(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=Yi);var s=e.onBlur;s===void 0&&(s=Yi);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=I3(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=cf(e),A=w.decimalSeparator,P=w.allowedDecimalSeparators,R=function(m){return Gv(m,e)},N=function(m,x){return XJ(m,x,e)},F=Ro(f)?l:f,L=h??JJ(F,u,t);Ro(f)?Ro(l)||(L=L||typeof l=="number"):L=L||typeof f=="number";var G=function(m){return P3(m)?m:(typeof m=="number"&&(m=R3(m)),L&&typeof a=="number"?qv(m,a,!!c):m)},q=D3(G(f),G(l),!!L,R,N,y),J=q[0],ne=J.numAsString,ae=J.formattedValue,ce=q[1],V=function(m){var x=m.target,M=m.key,E=x.selectionStart,O=x.selectionEnd,C=x.value;if(C===void 0&&(C=""),(M==="Backspace"||M==="Delete")&&O<u.length){m.preventDefault();return}if(E!==O){i(m);return}M==="Backspace"&&C[0]==="-"&&E===u.length+1&&r&&$s(x,1),a&&c&&(M==="Backspace"&&C[E-1]===A?($s(x,E-1),m.preventDefault()):M==="Delete"&&C[E]===A&&m.preventDefault()),P!=null&&P.includes(M)&&C[E]===A&&$s(x,E+1);var g=o===!0?",":o;M==="Backspace"&&C[E-1]===g&&$s(x,E-1),M==="Delete"&&C[E]===g&&$s(x,E+1),i(m)},$=function(m){var x=ne;if(x.match(/\d/g)||(x=""),n||(x=DJ(x)),c&&a&&(x=qv(x,a,c)),x!==ne){var M=Gv(x,e);ce({formattedValue:M,value:x,floatValue:parseFloat(x)},{event:m,source:fc.event})}s(m)},p=function(m){return m===A?!0:dc(m)},d=function(m){var x=m.currentValue,M=m.lastValue,E=m.formattedValue,O=m.currentValueIndex,C=m.formattedValueIndex,g=x[O],v=E[C],j=N3(M,x),ee=j.to,ie=function(ve){return N(ve).indexOf(".")+u.length};return f===0&&c&&a&&x[ee.start]===A&&ie(x)<O&&ie(E)>C?!1:O>=ee.start&&O<ee.end&&P&&P.includes(g)&&v===A?!0:g===v};return Object.assign(Object.assign({},b),{value:ae,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:ce,format:R,removeFormatting:N,getCaretBoundary:function(m){return YJ(m,e)},onKeyDown:V,onBlur:$})}function eX(e){var t=QJ(e);return se.createElement(GJ,Object.assign({},t))}function tX(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 A;const b=((A=y==null?void 0:y.target)==null?void 0:A.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(eX,{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 rX(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(zr,{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]})}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function Hv({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]=se.useState(!1),{currentAccount:b}=Dn(),w=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||"0").div(2),R=an(P.toString(),o==null?void 0:o.decimals,!0).toString();t&&Le(R).eq(t)||i(R)},A=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||0),R=Mr((o==null?void 0:o.coin_type)||"").full_address===Dh,N=.05;let F=P;R&&Le(P).gt(N)&&(F=F.sub(N)),!(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(tX,{inputAllowed:l,value:t,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>y(!0),onBlur:()=>y(!1)}),_.jsx(rX,{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:K4(r,2)}):_.jsx("div",{}),b&&_.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:A,children:"MAX"})]})]})]})]})}function nX({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Dn(),{getOwnerCoinBalances:s}=Qu(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:f,routerData:h,isOpenSecondary:y,setIsOpenSecondary:b}=hn(),{handleAmountChange:w,handleSelectToken:A,fromBalanceInfo:P,toBalanceInfo:R,fromAmountValue:N,toAmountValue:F,doSwapAction:L,reCalculateRouteData:G,refreshMarketPrice:q,scamsText:J}=jV(),{slippage:ne}=Xr(),{isCustomMode:ae,customWarnTokenList:ce}=bV(o==null?void 0:o.coin_type,a==null?void 0:a.coin_type),{amountLimit:V}=V8(ne,h),{formatSwapRouter:$}=vV(h),[p,d]=se.useState(!1),{btnText:m,btnDisabled:x}=kV(P==null?void 0:P.totalBalanceFormat),[M,E]=se.useState(!1),[O,C]=se.useState(!1),[g,v]=se.useState(!1);se.useEffect(()=>{y?e>=5&&j():e>=20&&j()},[e]);const j=()=>{G(),n&&s(),q()},ee=()=>({...h}),ie=async()=>{a&&A(a,!0)},ve=se.useMemo(()=>!(M||y),[M,y]);return _.jsxs("div",{className:"swap-trade-box",children:[_.jsxs("div",{className:"trade-form",style:{flexDirection:"column",display:"flex"},children:[_.jsx(Hv,{loading:!f&&l,balance:P,amountValue:N,handleTokenSelectClick:()=>{C(!0),E(!0)},onInputChange:pe=>{w(pe,!0)},amount:c,token:o}),_.jsx("div",{onClick:ie,className:"swap-icon",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{cursor:"pointer"},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:p?"rotate(90deg)":"none",width:p?"16px":"14px",height:p?"16px":"14px"},children:_.jsx("use",{xlinkHref:p?"#icon-swap":"#icon-trade"})})}),_.jsx(Hv,{marginTop:"-20px",loading:f&&l,balance:R,showHalf:!1,showMax:!1,amountValue:F,handleTokenSelectClick:()=>{C(!1),E(!0)},onInputChange:pe=>{w(pe,!1)},inputAllowed:!1,amount:u,token:a})]}),J&&_.jsx(NV,{scamsText:J}),_.jsxs("div",{className:"swap-bottom-block",style:{border:x?"0px solid #2a3238":"1px solid #2a3238"},children:[_.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:x||l,onClick:()=>{n?ae&&ce.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(G8,{})}):m}),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(L0,{baseToken:o,quoteToken:a,baseAmount:h.fromAmountUi||"",quoteAmount:h.toAmountUi||"",loading:l}),_.jsx(J8,{isLoading:l,routerData:h})]}),_.jsx(X8,{isLoading:l,amountLimit:V}),_.jsx(A3,{hasSubMenu:!0,formatSwapRouter:$,isLoading:l})]})]}),y&&_.jsx(YK,{data:ee(),toBack:()=>b(!1),onSubmitClick:async pe=>{try{await L(pe,r==null?void 0:r.partner)}finally{b(!1)}}}),M&&_.jsx(AJ,{currToken:O?o:a,backClick:()=>E(!1),onSelectToken:pe=>{A(pe,O),E(!1)}}),g&&ce.length>0&&_.jsx(IJ,{onClose:()=>{v(!1)},tokenList:ce,onSureClick:()=>{v(!1),b(!0)}})]})}function iX({initProps:e={},customWallet:t}){rV();const{ToastContainer:r}=aa(),{fetchRouterConfig:n}=Kz(),{getTokens:i}=ys(),{fetchTokenPrices:s}=Xl(),{transactionData:o,setTransactionData:a}=D0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=hn(),[y,b]=se.useState(0),w=se.useRef(y);tV(e),se.useEffect(()=>{i(),s([]),n()},[]),se.useEffect(()=>{w.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),Jz({interval:1e3,callback:()=>{w.current=w.current+1,c?w.current>=5&&A():w.current>=20&&A()}});const A=()=>{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(qz,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),_.jsx(Oz,{handleRefresh:A}),_.jsx(nX,{refreshCount:y,customWallet:t,initProps:e}),o&&_.jsx(Wz,{transactionData:o,onClose:()=>{a(void 0)}}),_.jsx(r,{})]})})}function Y0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=Qu(),n=Lr.useCurrentAccount(),{saveCurrentAccount:i}=Dn(),{mutate:s}=Lr.useConnectWallet();return se.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),se.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(iX,{initProps:e,customWallet:t})}function sX({initProps:e,customWallet:t}){const[r,n]=se.useState(!0);return _.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&_.jsx("div",{className:"swap-modal-box",children:_.jsx(Y0,{initProps:e,customWallet:t})}),_.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function oX({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=se.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:zt("/images/img-logo@2x.png")})}),i&&_.jsx("div",{className:`widget-modal ${t} ${e}`,children:_.jsx(Y0,{initProps:r,customWallet:n})})]})}function aX({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return _.jsxs(Fl,{appearance:"dark",children:[r==="Integrated"&&_.jsx(Y0,{initProps:e,customWallet:t}),r==="Widget"&&_.jsx(oX,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&_.jsx(sX,{initProps:e,customWallet:t})]})}const cX=aX;exports.CetusSwap=cX;
|