@edgex-web/components 1.0.0-beta.17 → 1.0.0-beta.19

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.
Files changed (39) hide show
  1. package/dist/{ccip-B0fbhL1s.mjs → ccip-CsGbJ1jk.mjs} +2 -2
  2. package/dist/{ccip-B0fbhL1s.mjs.map → ccip-CsGbJ1jk.mjs.map} +1 -1
  3. package/dist/components/Deposit/src/components/mpc/index.d.ts.map +1 -1
  4. package/dist/components/Withdraw/src/evm/WalletView.d.ts.map +1 -1
  5. package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -1
  6. package/dist/components/shared/components/selector/Chain.d.ts.map +1 -1
  7. package/dist/components/shared/components/selector/index.d.ts +2 -1
  8. package/dist/components/shared/components/selector/index.d.ts.map +1 -1
  9. package/dist/components/shared/components/selector/types/index.d.ts +3 -0
  10. package/dist/components/shared/components/selector/types/index.d.ts.map +1 -1
  11. package/dist/hooks/useTranslation.d.ts +8 -0
  12. package/dist/hooks/useTranslation.d.ts.map +1 -1
  13. package/dist/{index-Ba9w5g49.mjs → index-CRbiovGp.mjs} +6142 -6031
  14. package/dist/index-CRbiovGp.mjs.map +1 -0
  15. package/dist/index.esm.js +1 -1
  16. package/dist/index.umd.js +74 -74
  17. package/dist/index.umd.js.map +1 -1
  18. package/dist/locales/de-DE.d.ts +4 -0
  19. package/dist/locales/de-DE.d.ts.map +1 -1
  20. package/dist/locales/en-US.d.ts +4 -0
  21. package/dist/locales/en-US.d.ts.map +1 -1
  22. package/dist/locales/es-LA.d.ts +4 -0
  23. package/dist/locales/es-LA.d.ts.map +1 -1
  24. package/dist/locales/fr-FR.d.ts +4 -0
  25. package/dist/locales/fr-FR.d.ts.map +1 -1
  26. package/dist/locales/it-IT.d.ts +4 -0
  27. package/dist/locales/it-IT.d.ts.map +1 -1
  28. package/dist/locales/ja-JP.d.ts +4 -0
  29. package/dist/locales/ja-JP.d.ts.map +1 -1
  30. package/dist/locales/ru-RU.d.ts +4 -0
  31. package/dist/locales/ru-RU.d.ts.map +1 -1
  32. package/dist/locales/zh-CN.d.ts +4 -0
  33. package/dist/locales/zh-CN.d.ts.map +1 -1
  34. package/dist/locales/zh-TW.d.ts +4 -0
  35. package/dist/locales/zh-TW.d.ts.map +1 -1
  36. package/dist/style.css +1 -1
  37. package/dist/styles.css +1 -1
  38. package/package.json +1 -1
  39. package/dist/index-Ba9w5g49.mjs.map +0 -1
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(le,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],g):(le=typeof globalThis<"u"?globalThis:le||self,g(le.EdgeXComponents={},le.React,le.ReactDOM))})(this,function(le,g,Ke){"use strict";var MP=Object.defineProperty;var DP=(le,g,Ke)=>g in le?MP(le,g,{enumerable:!0,configurable:!0,writable:!0,value:Ke}):le[g]=Ke;var hs=(le,g,Ke)=>DP(le,typeof g!="symbol"?g+"":g,Ke);function Qc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=Qc(g),Qr=Qc(Ke);function eb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ji={exports:{}},eo={};/**
1
+ (function(le,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],g):(le=typeof globalThis<"u"?globalThis:le||self,g(le.EdgeXComponents={},le.React,le.ReactDOM))})(this,function(le,g,Ke){"use strict";var BP=Object.defineProperty;var FP=(le,g,Ke)=>g in le?BP(le,g,{enumerable:!0,configurable:!0,writable:!0,value:Ke}):le[g]=Ke;var ms=(le,g,Ke)=>FP(le,typeof g!="symbol"?g+"":g,Ke);function eu(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=eu(g),Qr=eu(Ke);function nb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zi={exports:{}},eo={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
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 eu;function tb(){if(eu)return eo;eu=1;var e=g,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,a,c){var u,f={},p=null,d=null;c!==void 0&&(p=""+c),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(d=a.ref);for(u in a)r.call(a,u)&&!s.hasOwnProperty(u)&&(f[u]=a[u]);if(l&&l.defaultProps)for(u in a=l.defaultProps,a)f[u]===void 0&&(f[u]=a[u]);return{$$typeof:t,type:l,key:p,ref:d,props:f,_owner:o.current}}return eo.Fragment=n,eo.jsx=i,eo.jsxs=i,eo}var to={};/**
9
+ */var tu;function rb(){if(tu)return eo;tu=1;var e=g,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,a,c){var u,d={},p=null,f=null;c!==void 0&&(p=""+c),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(f=a.ref);for(u in a)r.call(a,u)&&!s.hasOwnProperty(u)&&(d[u]=a[u]);if(l&&l.defaultProps)for(u in a=l.defaultProps,a)d[u]===void 0&&(d[u]=a[u]);return{$$typeof:t,type:l,key:p,ref:f,props:d,_owner:o.current}}return eo.Fragment=n,eo.jsx=i,eo.jsxs=i,eo}var to={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,109 +14,109 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var tu;function nb(){return tu||(tu=1,process.env.NODE_ENV!=="production"&&function(){var e=g,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),h=Symbol.iterator,b="@@iterator";function w(j){if(j===null||typeof j!="object")return null;var q=h&&j[h]||j[b];return typeof q=="function"?q:null}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(j){{for(var q=arguments.length,X=new Array(q>1?q-1:0),ie=1;ie<q;ie++)X[ie-1]=arguments[ie];E("error",j,X)}}function E(j,q,X){{var ie=T.ReactDebugCurrentFrame,ge=ie.getStackAddendum();ge!==""&&(q+="%s",X=X.concat([ge]));var Ee=X.map(function(de){return String(de)});Ee.unshift("Warning: "+q),Function.prototype.apply.call(console[j],console,Ee)}}var A=!1,k=!1,F=!1,L=!1,m=!1,v;v=Symbol.for("react.module.reference");function S(j){return!!(typeof j=="string"||typeof j=="function"||j===r||j===s||m||j===o||j===c||j===u||L||j===d||A||k||F||typeof j=="object"&&j!==null&&(j.$$typeof===p||j.$$typeof===f||j.$$typeof===i||j.$$typeof===l||j.$$typeof===a||j.$$typeof===v||j.getModuleId!==void 0))}function I(j,q,X){var ie=j.displayName;if(ie)return ie;var ge=q.displayName||q.name||"";return ge!==""?X+"("+ge+")":X}function $(j){return j.displayName||"Context"}function C(j){if(j==null)return null;if(typeof j.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof j=="function")return j.displayName||j.name||null;if(typeof j=="string")return j;switch(j){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof j=="object")switch(j.$$typeof){case l:var q=j;return $(q)+".Consumer";case i:var X=j;return $(X._context)+".Provider";case a:return I(j,j.render,"ForwardRef");case f:var ie=j.displayName||null;return ie!==null?ie:C(j.type)||"Memo";case p:{var ge=j,Ee=ge._payload,de=ge._init;try{return C(de(Ee))}catch{return null}}}return null}var D=Object.assign,y=0,O,M,P,B,R,z,W;function G(){}G.__reactDisabledLog=!0;function J(){{if(y===0){O=console.log,M=console.info,P=console.warn,B=console.error,R=console.group,z=console.groupCollapsed,W=console.groupEnd;var j={configurable:!0,enumerable:!0,value:G,writable:!0};Object.defineProperties(console,{info:j,log:j,warn:j,error:j,group:j,groupCollapsed:j,groupEnd:j})}y++}}function K(){{if(y--,y===0){var j={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},j,{value:O}),info:D({},j,{value:M}),warn:D({},j,{value:P}),error:D({},j,{value:B}),group:D({},j,{value:R}),groupCollapsed:D({},j,{value:z}),groupEnd:D({},j,{value:W})})}y<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var V=T.ReactCurrentDispatcher,te;function me(j,q,X){{if(te===void 0)try{throw Error()}catch(ge){var ie=ge.stack.trim().match(/\n( *(at )?)/);te=ie&&ie[1]||""}return`
18
- `+te+j}}var he=!1,ye;{var we=typeof WeakMap=="function"?WeakMap:Map;ye=new we}function oe(j,q){if(!j||he)return"";{var X=ye.get(j);if(X!==void 0)return X}var ie;he=!0;var ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ee;Ee=V.current,V.current=null,J();try{if(q){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ct){ie=ct}Reflect.construct(j,[],de)}else{try{de.call()}catch(ct){ie=ct}j.call(de.prototype)}}else{try{throw Error()}catch(ct){ie=ct}j()}}catch(ct){if(ct&&ie&&typeof ct.stack=="string"){for(var fe=ct.stack.split(`
17
+ */var nu;function ob(){return nu||(nu=1,process.env.NODE_ENV!=="production"&&function(){var e=g,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function x(R){if(R===null||typeof R!="object")return null;var K=h&&R[h]||R[m];return typeof K=="function"?K:null}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(R){{for(var K=arguments.length,J=new Array(K>1?K-1:0),ie=1;ie<K;ie++)J[ie-1]=arguments[ie];P("error",R,J)}}function P(R,K,J){{var ie=T.ReactDebugCurrentFrame,ge=ie.getStackAddendum();ge!==""&&(K+="%s",J=J.concat([ge]));var Ee=J.map(function(pe){return String(pe)});Ee.unshift("Warning: "+K),Function.prototype.apply.call(console[R],console,Ee)}}var A=!1,k=!1,B=!1,F=!1,b=!1,v;v=Symbol.for("react.module.reference");function E(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||b||R===o||R===c||R===u||F||R===f||A||k||B||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===d||R.$$typeof===i||R.$$typeof===l||R.$$typeof===a||R.$$typeof===v||R.getModuleId!==void 0))}function I(R,K,J){var ie=R.displayName;if(ie)return ie;var ge=K.displayName||K.name||"";return ge!==""?J+"("+ge+")":J}function $(R){return R.displayName||"Context"}function C(R){if(R==null)return null;if(typeof R.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case l:var K=R;return $(K)+".Consumer";case i:var J=R;return $(J._context)+".Provider";case a:return I(R,R.render,"ForwardRef");case d:var ie=R.displayName||null;return ie!==null?ie:C(R.type)||"Memo";case p:{var ge=R,Ee=ge._payload,pe=ge._init;try{return C(pe(Ee))}catch{return null}}}return null}var D=Object.assign,y=0,O,M,S,L,j,z,W;function _(){}_.__reactDisabledLog=!0;function Z(){{if(y===0){O=console.log,M=console.info,S=console.warn,L=console.error,j=console.group,z=console.groupCollapsed,W=console.groupEnd;var R={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}y++}}function q(){{if(y--,y===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},R,{value:O}),info:D({},R,{value:M}),warn:D({},R,{value:S}),error:D({},R,{value:L}),group:D({},R,{value:j}),groupCollapsed:D({},R,{value:z}),groupEnd:D({},R,{value:W})})}y<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=T.ReactCurrentDispatcher,ee;function fe(R,K,J){{if(ee===void 0)try{throw Error()}catch(ge){var ie=ge.stack.trim().match(/\n( *(at )?)/);ee=ie&&ie[1]||""}return`
18
+ `+ee+R}}var me=!1,ye;{var ve=typeof WeakMap=="function"?WeakMap:Map;ye=new ve}function oe(R,K){if(!R||me)return"";{var J=ye.get(R);if(J!==void 0)return J}var ie;me=!0;var ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ee;Ee=H.current,H.current=null,Z();try{if(K){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(ct){ie=ct}Reflect.construct(R,[],pe)}else{try{pe.call()}catch(ct){ie=ct}R.call(pe.prototype)}}else{try{throw Error()}catch(ct){ie=ct}R()}}catch(ct){if(ct&&ie&&typeof ct.stack=="string"){for(var de=ct.stack.split(`
19
19
  `),qe=ie.stack.split(`
20
- `),Ie=fe.length-1,De=qe.length-1;Ie>=1&&De>=0&&fe[Ie]!==qe[De];)De--;for(;Ie>=1&&De>=0;Ie--,De--)if(fe[Ie]!==qe[De]){if(Ie!==1||De!==1)do if(Ie--,De--,De<0||fe[Ie]!==qe[De]){var Ct=`
21
- `+fe[Ie].replace(" at new "," at ");return j.displayName&&Ct.includes("<anonymous>")&&(Ct=Ct.replace("<anonymous>",j.displayName)),typeof j=="function"&&ye.set(j,Ct),Ct}while(Ie>=1&&De>=0);break}}}finally{he=!1,V.current=Ee,K(),Error.prepareStackTrace=ge}var Jr=j?j.displayName||j.name:"",hr=Jr?me(Jr):"";return typeof j=="function"&&ye.set(j,hr),hr}function _(j,q,X){return oe(j,!1)}function Y(j){var q=j.prototype;return!!(q&&q.isReactComponent)}function Q(j,q,X){if(j==null)return"";if(typeof j=="function")return oe(j,Y(j));if(typeof j=="string")return me(j);switch(j){case c:return me("Suspense");case u:return me("SuspenseList")}if(typeof j=="object")switch(j.$$typeof){case a:return _(j.render);case f:return Q(j.type,q,X);case p:{var ie=j,ge=ie._payload,Ee=ie._init;try{return Q(Ee(ge),q,X)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Z={},se=T.ReactDebugCurrentFrame;function ue(j){if(j){var q=j._owner,X=Q(j.type,j._source,q?q.type:null);se.setExtraStackFrame(X)}else se.setExtraStackFrame(null)}function Se(j,q,X,ie,ge){{var Ee=Function.call.bind(ve);for(var de in j)if(Ee(j,de)){var fe=void 0;try{if(typeof j[de]!="function"){var qe=Error((ie||"React class")+": "+X+" type `"+de+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof j[de]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw qe.name="Invariant Violation",qe}fe=j[de](q,de,ie,X,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ie){fe=Ie}fe&&!(fe instanceof Error)&&(ue(ge),x("%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).",ie||"React class",X,de,typeof fe),ue(null)),fe instanceof Error&&!(fe.message in Z)&&(Z[fe.message]=!0,ue(ge),x("Failed %s type: %s",X,fe.message),ue(null))}}}var $e=Array.isArray;function xe(j){return $e(j)}function Ae(j){{var q=typeof Symbol=="function"&&Symbol.toStringTag,X=q&&j[Symbol.toStringTag]||j.constructor.name||"Object";return X}}function lt(j){try{return Ge(j),!1}catch{return!0}}function Ge(j){return""+j}function Vt(j){if(lt(j))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ae(j)),Ge(j)}var Vn=T.ReactCurrentOwner,Ht={key:!0,ref:!0,__self:!0,__source:!0},Vm,Hm;function mP(j){if(ve.call(j,"ref")){var q=Object.getOwnPropertyDescriptor(j,"ref").get;if(q&&q.isReactWarning)return!1}return j.ref!==void 0}function bP(j){if(ve.call(j,"key")){var q=Object.getOwnPropertyDescriptor(j,"key").get;if(q&&q.isReactWarning)return!1}return j.key!==void 0}function gP(j,q){typeof j.ref=="string"&&Vn.current}function yP(j,q){{var X=function(){Vm||(Vm=!0,x("%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)",q))};X.isReactWarning=!0,Object.defineProperty(j,"key",{get:X,configurable:!0})}}function wP(j,q){{var X=function(){Hm||(Hm=!0,x("%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)",q))};X.isReactWarning=!0,Object.defineProperty(j,"ref",{get:X,configurable:!0})}}var vP=function(j,q,X,ie,ge,Ee,de){var fe={$$typeof:t,type:j,key:q,ref:X,props:de,_owner:Ee};return fe._store={},Object.defineProperty(fe._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(fe,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ie}),Object.defineProperty(fe,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ge}),Object.freeze&&(Object.freeze(fe.props),Object.freeze(fe)),fe};function xP(j,q,X,ie,ge){{var Ee,de={},fe=null,qe=null;X!==void 0&&(Vt(X),fe=""+X),bP(q)&&(Vt(q.key),fe=""+q.key),mP(q)&&(qe=q.ref,gP(q,ge));for(Ee in q)ve.call(q,Ee)&&!Ht.hasOwnProperty(Ee)&&(de[Ee]=q[Ee]);if(j&&j.defaultProps){var Ie=j.defaultProps;for(Ee in Ie)de[Ee]===void 0&&(de[Ee]=Ie[Ee])}if(fe||qe){var De=typeof j=="function"?j.displayName||j.name||"Unknown":j;fe&&yP(de,De),qe&&wP(de,De)}return vP(j,fe,qe,ge,ie,Vn.current,de)}}var qc=T.ReactCurrentOwner,Gm=T.ReactDebugCurrentFrame;function Xr(j){if(j){var q=j._owner,X=Q(j.type,j._source,q?q.type:null);Gm.setExtraStackFrame(X)}else Gm.setExtraStackFrame(null)}var Kc;Kc=!1;function Zc(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function qm(){{if(qc.current){var j=C(qc.current.type);if(j)return`
20
+ `),Me=de.length-1,De=qe.length-1;Me>=1&&De>=0&&de[Me]!==qe[De];)De--;for(;Me>=1&&De>=0;Me--,De--)if(de[Me]!==qe[De]){if(Me!==1||De!==1)do if(Me--,De--,De<0||de[Me]!==qe[De]){var Ot=`
21
+ `+de[Me].replace(" at new "," at ");return R.displayName&&Ot.includes("<anonymous>")&&(Ot=Ot.replace("<anonymous>",R.displayName)),typeof R=="function"&&ye.set(R,Ot),Ot}while(Me>=1&&De>=0);break}}}finally{me=!1,H.current=Ee,q(),Error.prepareStackTrace=ge}var Jr=R?R.displayName||R.name:"",hr=Jr?fe(Jr):"";return typeof R=="function"&&ye.set(R,hr),hr}function V(R,K,J){return oe(R,!1)}function X(R){var K=R.prototype;return!!(K&&K.isReactComponent)}function Q(R,K,J){if(R==null)return"";if(typeof R=="function")return oe(R,X(R));if(typeof R=="string")return fe(R);switch(R){case c:return fe("Suspense");case u:return fe("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return V(R.render);case d:return Q(R.type,K,J);case p:{var ie=R,ge=ie._payload,Ee=ie._init;try{return Q(Ee(ge),K,J)}catch{}}}return""}var we=Object.prototype.hasOwnProperty,Y={},se=T.ReactDebugCurrentFrame;function ue(R){if(R){var K=R._owner,J=Q(R.type,R._source,K?K.type:null);se.setExtraStackFrame(J)}else se.setExtraStackFrame(null)}function Se(R,K,J,ie,ge){{var Ee=Function.call.bind(we);for(var pe in R)if(Ee(R,pe)){var de=void 0;try{if(typeof R[pe]!="function"){var qe=Error((ie||"React class")+": "+J+" type `"+pe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[pe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw qe.name="Invariant Violation",qe}de=R[pe](K,pe,ie,J,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Me){de=Me}de&&!(de instanceof Error)&&(ue(ge),w("%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).",ie||"React class",J,pe,typeof de),ue(null)),de instanceof Error&&!(de.message in Y)&&(Y[de.message]=!0,ue(ge),w("Failed %s type: %s",J,de.message),ue(null))}}}var Ie=Array.isArray;function xe(R){return Ie(R)}function Ae(R){{var K=typeof Symbol=="function"&&Symbol.toStringTag,J=K&&R[Symbol.toStringTag]||R.constructor.name||"Object";return J}}function lt(R){try{return Ge(R),!1}catch{return!0}}function Ge(R){return""+R}function Vt(R){if(lt(R))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ae(R)),Ge(R)}var Vn=T.ReactCurrentOwner,Ht={key:!0,ref:!0,__self:!0,__source:!0},Gm,qm;function vP(R){if(we.call(R,"ref")){var K=Object.getOwnPropertyDescriptor(R,"ref").get;if(K&&K.isReactWarning)return!1}return R.ref!==void 0}function wP(R){if(we.call(R,"key")){var K=Object.getOwnPropertyDescriptor(R,"key").get;if(K&&K.isReactWarning)return!1}return R.key!==void 0}function xP(R,K){typeof R.ref=="string"&&Vn.current}function EP(R,K){{var J=function(){Gm||(Gm=!0,w("%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)",K))};J.isReactWarning=!0,Object.defineProperty(R,"key",{get:J,configurable:!0})}}function SP(R,K){{var J=function(){qm||(qm=!0,w("%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)",K))};J.isReactWarning=!0,Object.defineProperty(R,"ref",{get:J,configurable:!0})}}var PP=function(R,K,J,ie,ge,Ee,pe){var de={$$typeof:t,type:R,key:K,ref:J,props:pe,_owner:Ee};return de._store={},Object.defineProperty(de._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(de,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ie}),Object.defineProperty(de,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ge}),Object.freeze&&(Object.freeze(de.props),Object.freeze(de)),de};function TP(R,K,J,ie,ge){{var Ee,pe={},de=null,qe=null;J!==void 0&&(Vt(J),de=""+J),wP(K)&&(Vt(K.key),de=""+K.key),vP(K)&&(qe=K.ref,xP(K,ge));for(Ee in K)we.call(K,Ee)&&!Ht.hasOwnProperty(Ee)&&(pe[Ee]=K[Ee]);if(R&&R.defaultProps){var Me=R.defaultProps;for(Ee in Me)pe[Ee]===void 0&&(pe[Ee]=Me[Ee])}if(de||qe){var De=typeof R=="function"?R.displayName||R.name||"Unknown":R;de&&EP(pe,De),qe&&SP(pe,De)}return PP(R,de,qe,ge,ie,Vn.current,pe)}}var Kc=T.ReactCurrentOwner,Km=T.ReactDebugCurrentFrame;function Xr(R){if(R){var K=R._owner,J=Q(R.type,R._source,K?K.type:null);Km.setExtraStackFrame(J)}else Km.setExtraStackFrame(null)}var Zc;Zc=!1;function Yc(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Zm(){{if(Kc.current){var R=C(Kc.current.type);if(R)return`
22
22
 
23
- Check the render method of \``+j+"`."}return""}}function EP(j){return""}var Km={};function SP(j){{var q=qm();if(!q){var X=typeof j=="string"?j:j.displayName||j.name;X&&(q=`
23
+ Check the render method of \``+R+"`."}return""}}function AP(R){return""}var Ym={};function NP(R){{var K=Zm();if(!K){var J=typeof R=="string"?R:R.displayName||R.name;J&&(K=`
24
24
 
25
- Check the top-level render call using <`+X+">.")}return q}}function Zm(j,q){{if(!j._store||j._store.validated||j.key!=null)return;j._store.validated=!0;var X=SP(q);if(Km[X])return;Km[X]=!0;var ie="";j&&j._owner&&j._owner!==qc.current&&(ie=" It was passed a child from "+C(j._owner.type)+"."),Xr(j),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',X,ie),Xr(null)}}function Ym(j,q){{if(typeof j!="object")return;if(xe(j))for(var X=0;X<j.length;X++){var ie=j[X];Zc(ie)&&Zm(ie,q)}else if(Zc(j))j._store&&(j._store.validated=!0);else if(j){var ge=w(j);if(typeof ge=="function"&&ge!==j.entries)for(var Ee=ge.call(j),de;!(de=Ee.next()).done;)Zc(de.value)&&Zm(de.value,q)}}}function PP(j){{var q=j.type;if(q==null||typeof q=="string")return;var X;if(typeof q=="function")X=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===f))X=q.propTypes;else return;if(X){var ie=C(q);Se(X,j.props,"prop",ie,j)}else if(q.PropTypes!==void 0&&!Kc){Kc=!0;var ge=C(q);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function TP(j){{for(var q=Object.keys(j.props),X=0;X<q.length;X++){var ie=q[X];if(ie!=="children"&&ie!=="key"){Xr(j),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ie),Xr(null);break}}j.ref!==null&&(Xr(j),x("Invalid attribute `ref` supplied to `React.Fragment`."),Xr(null))}}var Xm={};function Jm(j,q,X,ie,ge,Ee){{var de=S(j);if(!de){var fe="";(j===void 0||typeof j=="object"&&j!==null&&Object.keys(j).length===0)&&(fe+=" 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 qe=EP();qe?fe+=qe:fe+=qm();var Ie;j===null?Ie="null":xe(j)?Ie="array":j!==void 0&&j.$$typeof===t?(Ie="<"+(C(j.type)||"Unknown")+" />",fe=" Did you accidentally export a JSX literal instead of a component?"):Ie=typeof j,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ie,fe)}var De=xP(j,q,X,ge,Ee);if(De==null)return De;if(de){var Ct=q.children;if(Ct!==void 0)if(ie)if(xe(Ct)){for(var Jr=0;Jr<Ct.length;Jr++)Ym(Ct[Jr],j);Object.freeze&&Object.freeze(Ct)}else x("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 Ym(Ct,j)}if(ve.call(q,"key")){var hr=C(j),ct=Object.keys(q).filter(function(IP){return IP!=="key"}),Yc=ct.length>0?"{key: someKey, "+ct.join(": ..., ")+": ...}":"{key: someKey}";if(!Xm[hr+Yc]){var $P=ct.length>0?"{"+ct.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+J+">.")}return K}}function Xm(R,K){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var J=NP(K);if(Ym[J])return;Ym[J]=!0;var ie="";R&&R._owner&&R._owner!==Kc.current&&(ie=" It was passed a child from "+C(R._owner.type)+"."),Xr(R),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',J,ie),Xr(null)}}function Jm(R,K){{if(typeof R!="object")return;if(xe(R))for(var J=0;J<R.length;J++){var ie=R[J];Yc(ie)&&Xm(ie,K)}else if(Yc(R))R._store&&(R._store.validated=!0);else if(R){var ge=x(R);if(typeof ge=="function"&&ge!==R.entries)for(var Ee=ge.call(R),pe;!(pe=Ee.next()).done;)Yc(pe.value)&&Xm(pe.value,K)}}}function CP(R){{var K=R.type;if(K==null||typeof K=="string")return;var J;if(typeof K=="function")J=K.propTypes;else if(typeof K=="object"&&(K.$$typeof===a||K.$$typeof===d))J=K.propTypes;else return;if(J){var ie=C(K);Se(J,R.props,"prop",ie,R)}else if(K.PropTypes!==void 0&&!Zc){Zc=!0;var ge=C(K);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof K.getDefaultProps=="function"&&!K.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function OP(R){{for(var K=Object.keys(R.props),J=0;J<K.length;J++){var ie=K[J];if(ie!=="children"&&ie!=="key"){Xr(R),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ie),Xr(null);break}}R.ref!==null&&(Xr(R),w("Invalid attribute `ref` supplied to `React.Fragment`."),Xr(null))}}var Qm={};function eb(R,K,J,ie,ge,Ee){{var pe=E(R);if(!pe){var de="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(de+=" 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 qe=AP();qe?de+=qe:de+=Zm();var Me;R===null?Me="null":xe(R)?Me="array":R!==void 0&&R.$$typeof===t?(Me="<"+(C(R.type)||"Unknown")+" />",de=" Did you accidentally export a JSX literal instead of a component?"):Me=typeof R,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Me,de)}var De=TP(R,K,J,ge,Ee);if(De==null)return De;if(pe){var Ot=K.children;if(Ot!==void 0)if(ie)if(xe(Ot)){for(var Jr=0;Jr<Ot.length;Jr++)Jm(Ot[Jr],R);Object.freeze&&Object.freeze(Ot)}else w("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 Jm(Ot,R)}if(we.call(K,"key")){var hr=C(R),ct=Object.keys(K).filter(function(LP){return LP!=="key"}),Xc=ct.length>0?"{key: someKey, "+ct.join(": ..., ")+": ...}":"{key: someKey}";if(!Qm[hr+Xc]){var kP=ct.length>0?"{"+ct.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,Yc,hr,$P,hr),Xm[hr+Yc]=!0}}return j===r?TP(De):PP(De),De}}function AP(j,q,X){return Jm(j,q,X,!0)}function NP(j,q,X){return Jm(j,q,X,!1)}var OP=NP,CP=AP;to.Fragment=r,to.jsx=OP,to.jsxs=CP}()),to}process.env.NODE_ENV==="production"?ji.exports=tb():ji.exports=nb();var N=ji.exports;const rb={deposit:{title:"Einzahlen",chain:"Chain",asset:"Asset",amount:"Betrag",available:"Verfügbar",equity:"Eigenkapital",confirmDeposit:"Einzahlung bestätigen",switchNetwork:"Netzwerk wechseln",max:"Max.",fast:"Schnell",standard:"Standard",arrivalTime:"Ankunftszeit",ethCrossChainDepositInitiated:"ETH-Cross-Chain-Einzahlung initiiert. Voraussichtliche Ankunft in 2 bis 5 Minuten.",minDeposit:"Mindestbetrag der Einzahlung",minDepositParsed:"Min. {{amount}} {{token}} einzahlen",maxDeposit:"Maximaler Einzahlungsbetrag",depositTipFor25w:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Wenn deine Einzahlung 200.000 übersteigt, verwende bitte die Ethereum-Chain.",depositAllTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
30
+ <%s key={someKey} {...props} />`,Xc,hr,kP,hr),Qm[hr+Xc]=!0}}return R===r?OP(De):CP(De),De}}function $P(R,K,J){return eb(R,K,J,!0)}function IP(R,K,J){return eb(R,K,J,!1)}var MP=IP,DP=$P;to.Fragment=r,to.jsx=MP,to.jsxs=DP}()),to}process.env.NODE_ENV==="production"?zi.exports=rb():zi.exports=ob();var N=zi.exports;const sb={deposit:{title:"Einzahlen",chain:"Chain",asset:"Asset",amount:"Betrag",available:"Verfügbar",equity:"Eigenkapital",confirmDeposit:"Einzahlung bestätigen",switchNetwork:"Netzwerk wechseln",max:"Max.",fast:"Schnell",standard:"Standard",arrivalTime:"Ankunftszeit",ethCrossChainDepositInitiated:"ETH-Cross-Chain-Einzahlung initiiert. Voraussichtliche Ankunft in 2 bis 5 Minuten.",minDeposit:"Mindestbetrag der Einzahlung",minDepositParsed:"Min. {{amount}} {{token}} einzahlen",maxDeposit:"Maximaler Einzahlungsbetrag",depositTipFor25w:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Wenn deine Einzahlung 200.000 übersteigt, verwende bitte die Ethereum-Chain.",depositAllTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
31
31
  Wenn der Einzahlungsbetrag 200.000 übersteigt, kann es zu einer Verzögerung der Ankunftszeit kommen. Bitte hab etwas Geduld.`,maxDepositSplitTip:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Falls du mehr als 200.000 einzahlen musst, teile den Betrag bitte in mehrere Einzahlungen auf.",spotDepositNotSupportedTip:"Einzahlungen werden nicht unterstützt. Bitte zahle auf das Perpetual-Konto ein und überweise den Betrag anschließend.",crossChainDepositFeeTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
32
- Bei Chain-übergreifenden Einzahlungen musst du die Edge-Gas-Gebühr zahlen. Der gutgeschriebene Betrag wird etwas geringer sein als dein Einzahlungsbetrag.`,addressUpdatedNotice:"Hinweis: Deine Einzahlungsadresse wurde aktualisiert. Verwende die neue Adresse. Die alte Adresse funktioniert nur während der Übergangszeit und wird dann deaktiviert. Wenn sie an einem anderen Ort gespeichert wurde, aktualisiere sie umgehend.",enableSystemProWithToken:"{{token}} auf {{network}} aktivieren",enableTokenDesc:"Bei der ersten Einzahlung auf {{network}} musst du {{token}} aktivieren.",enableWithToken:"{{token}} aktivieren",arrivaltimeTooltip1:"Die Gelder kommen in etwa {{v}} Minuten an (nach Erreichen von {{v1}} Blockbestätigungen).",arrivaltimeTooltip2:"Die geschätzte Zeit wird auf der Grundlage historischer Daten berechnet und dient nur als Referenz. Eine Überlastung des Netzwerks kann zu längeren tatsächlichen Ankunftszeiten führen.",arrivalEstimated:"≈ {{v}} Minuten",feeRateTooltip:"Geschätzte Gebühr, tatsächliche Abzug maßgeblich.",availableDesc:"Der maximale Betrag, den du einzahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Einzahlungen vorgenommen werden.",noPrivateKeyWalletWarning:"Verwende für Einzahlungen keine schlüssellosen Wallets. Einzahlungen mit einer schlüssellosen Wallet können zu einem unwiderruflichen Verlust der Gelder führen.",layerZeroDepositTip:"Das System wird deine Einzahlung über LayerZero auf Basis der tatsächlichen Einzahlungsbedingungen abschließen.",layerZeroDepositTipExceedPool:"Da der Einzahlungsbetrag den Pool übersteigt, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositTipGte200k:"Da der Einzahlungsbetrag größer als oder gleich 200.000 USDT ist, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositButton:"Mit LayerZero einzahlen",defaultSpotNotice:"Standardeinzahlungen werden dem Spot-Konto gutgeschrieben.",defaultSpotToPerpNotice:"Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt. Standardeinzahlungen werden dem Spot-Konto gutgeschrieben. Überweise Gelder vom Spot-Konto auf das Futures-Konto, um das Futures-Konto zu finanzieren.",connectedWalletTitle:"Einzahlung von einer verbundenen Wallet",connectedWalletDesc:"Verwende MetaMask, WalletConnect oder einen anderen Anbieter, um Geld von deiner Krypto-Wallet einzuzahlen",externalWalletTitle:"Einzahlung von externem Konto",externalWalletDesc:"Überweise Gelder von Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets",or:"OR"},withdraw:{noticeDesc:"Nachdem Sie den Auszahlungsantrag gestellt haben, wird er auf Layer2 verarbeitet. Sobald die Mittel bereit sind (in der Regel innerhalb von 4 Stunden), erhalten Sie eine Benachrichtigung, um die Mittel in Ihre Wallet abzuheben.",crossChainTips:"Cross-Chain-Abhebungen erfordern eine L2-Verifizierung (mittels ZK-Proofs) und dauern in der Regel 5 Minuten bis 2 Stunden.",commonWithdraw:"FAQ zu Auszahlungen",withdraw:"Auszahlen",speed:"Geschwindigkeit",confirmWithdraw:"Auszahlung bestätigen",speedNote:"Bearbeitungszeiten:",speedNoteSpeed1:"Ca. 8 Minuten",speedNoteSpeed2:"Ca. 2-4 Stunden",speedNoteSpeed3:"Ca. 4 Stunden",receiverAddress:"Empfängeradresse",fee:"Gebühr",feeRate:"Gebührensatz",withdrawlAmount:"Auszahlungsbetrag",amountToReceive:"Zu erhaltender Betrag",minWithdraw:"Mindestauszahlungsbetrag",minWithdrawParsed:"Min. Auszahlung {{amount}} {{token}}",invalidReceiverAddress:"Die Adresse darf nicht leer sein.",availableDesc:"Der maximale Betrag, den du auszahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Auszahlungen vorgenommen werden.",feeCalculationTip:"Die Auszahlungsgebühren werden berechnet, indem der Auszahlungsbetrag mit dem Gebührensatz multipliziert wird. Der Mindestbetrag liegt bei 1 USDT/USDC. Der Gebührensatz kann auf Basis der tatsächlichen On-chain-Bedingungen angepasst werden.",largeWithdrawFeeTip:"Die Auszahlungsgebühr beträgt 0,015 % und wird direkt vom Auszahlungsbetrag abgezogen.",crossChainPoolBalance:"Guthaben des Cross-Chain-Pools",poolBalance:"Pool-Guthaben",poolBalanceInsufficientTip:"Da der Auszahlungsbetrag das Pool-Guthaben übersteigt, kann die Auszahlung nicht bearbeitet werden. Bitte wähle eine Option mit ausreichendem Pool-Guthaben.",connectedWalletTitle:"Auszahlung an verbundene Wallet",connectedWalletDesc:"Zahle Geld an deine verbundene Krypto-Wallet, MetaMask, WalletConnect oder einen anderen Anbieter aus",externalWalletTitle:"Auszahlung an externes Konto",externalWalletDesc:"Zahle Geld an Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets aus"},account:{title:"Konto",perp:"Perpetual-Konto","perpetual-v1":"Perpetuals-V1-Konto","perpetual-v2":"Perpetuals-V2-Konto",spot:"Spot-Konto"}},ob={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",fast:"Fast",standard:"Standard",arrivalTime:"Arrival Time",ethCrossChainDepositInitiated:"ETH cross-chain deposit initiated. Estimated arrival in 2–5 minutes.",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
32
+ Bei Chain-übergreifenden Einzahlungen musst du die Edge-Gas-Gebühr zahlen. Der gutgeschriebene Betrag wird etwas geringer sein als dein Einzahlungsbetrag.`,addressUpdatedNotice:"Hinweis: Deine Einzahlungsadresse wurde aktualisiert. Verwende die neue Adresse. Die alte Adresse funktioniert nur während der Übergangszeit und wird dann deaktiviert. Wenn sie an einem anderen Ort gespeichert wurde, aktualisiere sie umgehend.",enableSystemProWithToken:"{{token}} auf {{network}} aktivieren",enableTokenDesc:"Bei der ersten Einzahlung auf {{network}} musst du {{token}} aktivieren.",enableWithToken:"{{token}} aktivieren",arrivaltimeTooltip1:"Die Gelder kommen in etwa {{v}} Minuten an (nach Erreichen von {{v1}} Blockbestätigungen).",arrivaltimeTooltip2:"Die geschätzte Zeit wird auf der Grundlage historischer Daten berechnet und dient nur als Referenz. Eine Überlastung des Netzwerks kann zu längeren tatsächlichen Ankunftszeiten führen.",arrivalEstimated:"≈ {{v}} Minuten",feeRateTooltip:"Geschätzte Gebühr, tatsächliche Abzug maßgeblich.",availableDesc:"Der maximale Betrag, den du einzahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Einzahlungen vorgenommen werden.",noPrivateKeyWalletWarning:"Verwende für Einzahlungen keine schlüssellosen Wallets. Einzahlungen mit einer schlüssellosen Wallet können zu einem unwiderruflichen Verlust der Gelder führen.",layerZeroDepositTip:"Das System wird deine Einzahlung über LayerZero auf Basis der tatsächlichen Einzahlungsbedingungen abschließen.",layerZeroDepositTipExceedPool:"Da der Einzahlungsbetrag den Pool übersteigt, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositTipGte200k:"Da der Einzahlungsbetrag größer als oder gleich 200.000 USDT ist, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositButton:"Mit LayerZero einzahlen",defaultSpotNotice:"Standardeinzahlungen werden dem Spot-Konto gutgeschrieben.",defaultSpotToPerpNotice:"Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt. Standardeinzahlungen werden dem Spot-Konto gutgeschrieben. Überweise Gelder vom Spot-Konto auf das Futures-Konto, um das Futures-Konto zu finanzieren.",depositModeSwitchWarning:"Wechseln Sie den Einzahlungsmodus nicht nach Start oder während der Einzahlung, sonst ändert sich die Einzahlungsmethode.",connectedWalletTitle:"Einzahlung von einer verbundenen Wallet",connectedWalletDesc:"Verwende MetaMask, WalletConnect oder einen anderen Anbieter, um Geld von deiner Krypto-Wallet einzuzahlen",externalWalletTitle:"Einzahlung von externem Konto",externalWalletDesc:"Überweise Gelder von Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets",or:"OR"},withdraw:{noticeDesc:"Nachdem Sie den Auszahlungsantrag gestellt haben, wird er auf Layer2 verarbeitet. Sobald die Mittel bereit sind (in der Regel innerhalb von 4 Stunden), erhalten Sie eine Benachrichtigung, um die Mittel in Ihre Wallet abzuheben.",noticeDescWithClaim:"Nachdem Sie den Auszahlungsantrag gestellt haben, wird er auf Layer2 verarbeitet. Sobald die Mittel bereit sind (in der Regel innerhalb von 4 Stunden), erhalten Sie eine Benachrichtigung, um die Mittel in Ihre Wallet abzuheben. Sie müssen die Mittel beanspruchen und Ihre Auszahlungsadresse angeben, um den Vorgang abzuschließen.",externalWalletEthNoticeDesc:"Nachdem Sie den Auszahlungsantrag gestellt haben, wird er auf Layer2 verarbeitet. Sobald die Mittel bereit sind (in der Regel innerhalb von 4 Stunden), erhalten Sie eine Benachrichtigung, um die Mittel in Ihre Wallet abzuheben. Sie sind für alle Gas-Gebühren verantwortlich, die bei Auszahlungen anfallen.",crossChainTips:"Cross-Chain-Abhebungen erfordern eine L2-Verifizierung (mittels ZK-Proofs) und dauern in der Regel 5 Minuten bis 2 Stunden.",crossChainTipsWithGas:"Cross-Chain-Abhebungen erfordern eine L2-Verifizierung (mittels ZK-Proofs) und dauern in der Regel 5 Minuten bis 2 Stunden. Sie sind für alle Gas-Gebühren verantwortlich, die bei Auszahlungen anfallen.",commonWithdraw:"FAQ zu Auszahlungen",withdraw:"Auszahlen",speed:"Geschwindigkeit",confirmWithdraw:"Auszahlung bestätigen",speedNote:"Bearbeitungszeiten:",speedNoteSpeed1:"Ca. 8 Minuten",speedNoteSpeed2:"Ca. 2-4 Stunden",speedNoteSpeed3:"Ca. 4 Stunden",receiverAddress:"Empfängeradresse",fee:"Gebühr",feeRate:"Gebührensatz",withdrawlAmount:"Auszahlungsbetrag",amountToReceive:"Zu erhaltender Betrag",minWithdraw:"Mindestauszahlungsbetrag",minWithdrawParsed:"Min. Auszahlung {{amount}} {{token}}",invalidReceiverAddress:"Die Adresse darf nicht leer sein.",availableDesc:"Der maximale Betrag, den du auszahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Auszahlungen vorgenommen werden.",feeCalculationTip:"Die Auszahlungsgebühren werden berechnet, indem der Auszahlungsbetrag mit dem Gebührensatz multipliziert wird. Der Mindestbetrag liegt bei 1 USDT/USDC. Der Gebührensatz kann auf Basis der tatsächlichen On-chain-Bedingungen angepasst werden.",largeWithdrawFeeTip:"Die Auszahlungsgebühr beträgt 0,015 % und wird direkt vom Auszahlungsbetrag abgezogen.",crossChainPoolBalance:"Guthaben des Cross-Chain-Pools",poolBalance:"Pool-Guthaben",poolBalanceInsufficientTip:"Da der Auszahlungsbetrag das Pool-Guthaben übersteigt, kann die Auszahlung nicht bearbeitet werden. Bitte wähle eine Option mit ausreichendem Pool-Guthaben.",connectedWalletTitle:"Auszahlung an verbundene Wallet",connectedWalletDesc:"Zahle Geld an deine verbundene Krypto-Wallet, MetaMask, WalletConnect oder einen anderen Anbieter aus",externalWalletTitle:"Auszahlung an externes Konto",externalWalletDesc:"Zahle Geld an Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets aus"},account:{title:"Konto",perp:"Perpetual-Konto","perpetual-v1":"Perpetuals-V1-Konto","perpetual-v2":"Perpetuals-V2-Konto",spot:"Spot-Konto"}},ib={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",fast:"Fast",standard:"Standard",arrivalTime:"Arrival Time",ethCrossChainDepositInitiated:"ETH cross-chain deposit initiated. Estimated arrival in 2–5 minutes.",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
33
33
  If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,maxDepositSplitTip:"The maximum amount per deposit is 200,000. If you need to deposit more than 200,000, please split it into multiple deposits.",spotDepositNotSupportedTip:"Deposits aren't supported. Please deposit to perpetual account, then transfer.",crossChainDepositFeeTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
34
- Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Estimated fee, subject to actual deduction.",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Arbitrum, and other wallets",or:"OR"},withdraw:{noticeDesc:"After you initiate the withdrawal request, it will be processed on Layer2. Once the funds are ready (usually within 4 hours), you will receive a notification to withdraw the funds to your wallet.",crossChainTips:"Cross-chain withdrawals require L2 verification (via ZK proofs) and typically take 5 minutes to 2 hours.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",largeWithdrawFeeTip:"A withdrawal fee of 0.015% will be deducted from the withdrawal amount.",crossChainPoolBalance:"Cross-chain pool balance",poolBalance:"Pool balance",poolBalanceInsufficientTip:"The withdrawal amount exceeds the fund pool balance, and the withdrawal cannot be processed. Please select an option with a sufficient fund pool balance.",connectedWalletTitle:"Withdraw to connected wallet",connectedWalletDesc:"Withdraw funds to your connected crypto wallet, MetaMask, WalletConnect, or another provider",externalWalletTitle:"Withdraw to external account",externalWalletDesc:"Withdraw funds to Binance or other exchanges, chains like Arbitrum, and other wallets"},account:{title:"Account",perp:"Perpetual Account","perpetual-v1":"Perpetuals V1 Account","perpetual-v2":"Perpetuals V2 Account",spot:"Spot Account"}},sb={deposit:{title:"Depósito",chain:"Cadena",asset:"Activo",amount:"Monto",available:"Disponible",equity:"Capital",confirmDeposit:"Confirmar depósito",switchNetwork:"Cambiar de red",max:"Máx.",fast:"Rápido",standard:"Estándar",arrivalTime:"Hora de llegada",ethCrossChainDepositInitiated:"Se inició el depósito entre cadenas de ETH. Llegada estimada en 2 a 5 minutos.",minDeposit:"Monto mínimo de depósito",minDepositParsed:"Mín. de depósito: {{amount}} {{token}}",maxDeposit:"Monto máximo de depósito",depositTipFor25w:"El monto máximo por depósito es de 200,000. Si tu depósito supera los 200,000, usa la cadena Ethereum.",depositAllTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
34
+ Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Estimated fee, subject to actual deduction.",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account.",depositModeSwitchWarning:"Do not switch deposit mode during or after initiating a deposit, or your deposit method may change.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Arbitrum, and other wallets",or:"OR"},withdraw:{noticeDesc:"After you initiate the withdrawal request, it will be processed on Layer2. Once the funds are ready (usually within 4 hours), you will receive a notification to withdraw the funds to your wallet.",noticeDescWithClaim:"After you initiate the withdrawal request, it will be processed on Layer2. Once the funds are ready (usually within 4 hours), you will receive a notification to withdraw the funds to your wallet. You must claim the funds and enter your withdrawal address to complete the process.",externalWalletEthNoticeDesc:"After you initiate the withdrawal request, it will be processed on Layer2. Once the funds are ready (usually within 4 hours), you will receive a notification to withdraw the funds to your wallet. You are responsible for all gas fees incurred during withdrawals.",crossChainTips:"Cross-chain withdrawals require L2 verification (via ZK proofs) and typically take 5 minutes to 2 hours.",crossChainTipsWithGas:"Cross-chain withdrawals require L2 verification (via ZK proofs) and typically take 5 minutes to 2 hours. You are responsible for all gas fees incurred during withdrawals.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",largeWithdrawFeeTip:"A withdrawal fee of 0.015% will be deducted from the withdrawal amount.",crossChainPoolBalance:"Cross-chain pool balance",poolBalance:"Pool balance",poolBalanceInsufficientTip:"The withdrawal amount exceeds the fund pool balance, and the withdrawal cannot be processed. Please select an option with a sufficient fund pool balance.",connectedWalletTitle:"Withdraw to connected wallet",connectedWalletDesc:"Withdraw funds to your connected crypto wallet, MetaMask, WalletConnect, or another provider",externalWalletTitle:"Withdraw to external account",externalWalletDesc:"Withdraw funds to Binance or other exchanges, chains like Arbitrum, and other wallets"},account:{title:"Account",perp:"Perpetual Account","perpetual-v1":"Perpetuals V1 Account","perpetual-v2":"Perpetuals V2 Account",spot:"Spot Account"}},ab={deposit:{title:"Depósito",chain:"Cadena",asset:"Activo",amount:"Monto",available:"Disponible",equity:"Capital",confirmDeposit:"Confirmar depósito",switchNetwork:"Cambiar de red",max:"Máx.",fast:"Rápido",standard:"Estándar",arrivalTime:"Hora de llegada",ethCrossChainDepositInitiated:"Se inició el depósito entre cadenas de ETH. Llegada estimada en 2 a 5 minutos.",minDeposit:"Monto mínimo de depósito",minDepositParsed:"Mín. de depósito: {{amount}} {{token}}",maxDeposit:"Monto máximo de depósito",depositTipFor25w:"El monto máximo por depósito es de 200,000. Si tu depósito supera los 200,000, usa la cadena Ethereum.",depositAllTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
35
35
  Si el monto del depósito supera los 200,000, puede haber un retraso en la hora de llegada. Ten paciencia.`,maxDepositSplitTip:"El monto máximo por depósito es de 200,000. Si necesitas depositar más de 200,000, divídelo en varios depósitos.",spotDepositNotSupportedTip:"No se admiten depósitos. Deposita en la cuenta de perpetuos y luego haz la transferencia.",crossChainDepositFeeTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
36
- Los depósitos entre cadenas requieren el pago de la comisión de gas de Edge. El monto acreditado será ligeramente inferior al monto depositado.`,addressUpdatedNotice:"Aviso: Se actualizó tu dirección de depósito. Usa esta nueva dirección. La anterior solo funciona durante la transición y pronto se desactivará. Si la tienes guardada en otros dispositivos, actualízala lo antes posible.",enableSystemProWithToken:"Habilitar {{token}} en {{network}}",enableTokenDesc:"Debes habilitar {{token}} la primera vez que deposites en {{network}}.",enableWithToken:"Habilitar {{token}}",arrivaltimeTooltip1:"Los fondos se acreditarán en aproximadamente {{v}} minutos (tras obtener {{v1}} confirmaciones de bloque).",arrivaltimeTooltip2:"El tiempo estimado se calcula a partir de datos históricos y es solo de referencia. La congestión de la red puede ocasionar tiempos de acreditación más largos.",arrivalEstimated:"Aprox. {{v}} minutos",feeRateTooltip:"Tarifa estimada, deducción real prevalece.",availableDesc:"Lo máximo que puedes depositar. Si el saldo disponible es 0 o negativo, los depósitos no están permitidos.",noPrivateKeyWalletWarning:"No uses billeteras sin clave para realizar depósitos. Existe el riesgo de una pérdida irreversible de los fondos.",layerZeroDepositTip:"El sistema completará tu depósito a través de LayerZero según las condiciones de depósito reales.",layerZeroDepositTipExceedPool:"Dado que el importe del depósito supera el pool, tu depósito se completará a través de LayerZero.",layerZeroDepositTipGte200k:"El depósito es de 200,000 USDT o más. Se completará a través de LayerZero.",layerZeroDepositButton:"Depositar con LayerZero",defaultSpotNotice:"Los depósitos predeterminados van a la cuenta spot.",defaultSpotToPerpNotice:"Esta dirección solo admite depósitos en {{coin}} ({{v}}) Los depósitos predeterminados van a la cuenta spot. Para agregar fondos a la cuenta de futuros, transfiere desde la cuenta spot a la cuenta de futuros.",connectedWalletTitle:"Depósito desde una billetera conectada",connectedWalletDesc:"Usa MetaMask, WalletConnect u otro proveedor para depositar fondos desde tu billetera cripto.",externalWalletTitle:"Depósito desde una cuenta externa",externalWalletDesc:"Transfiere fondos desde Binance u otros exchanges, cadenas como Arbitrum y otras billeteras.",or:"OR"},withdraw:{noticeDesc:"Después de iniciar la solicitud de retiro, se procesará en Layer2. Una vez que los fondos estén listos (normalmente en 4 horas), recibirá una notificación para retirar los fondos a su billetera.",crossChainTips:"Los retiros cross-chain requieren verificación en L2 (mediante pruebas ZK) y normalmente tardan de 5 minutos a 2 horas.",commonWithdraw:"Preguntas frecuentes sobre los retiros",withdraw:"Retirar",speed:"Velocidad",confirmWithdraw:"Confirmar el retiro",speedNote:"Plazos de procesamiento:",speedNoteSpeed1:"Aprox. 8 minutos",speedNoteSpeed2:"Aprox. 2-4 horas",speedNoteSpeed3:"Aprox. 4 horas",receiverAddress:"Dirección del destinatario",fee:"Comisión",feeRate:"Tasa de comisión",withdrawlAmount:"Monto del retiro",amountToReceive:"Monto a recibir",minWithdraw:"Monto mínimo de retiro",minWithdrawParsed:"Min. de retiro: {{amount}} {{token}}",invalidReceiverAddress:"La dirección no puede estar vacía",availableDesc:"Lo máximo que puedes retirar. Si el saldo disponible es 0 o negativo, los retiros no están permitidos.",feeCalculationTip:"Las comisiones de retiro se calculan multiplicando el monto de retiro por la tasa de comisión, con un mínimo de 1 USDT/USDC. La tasa de la comisión puede modificarse en función de las condiciones reales de la cadena.",largeWithdrawFeeTip:"La comisión por retiro es del 0,015 % y se deducirá directamente del monto retirado.",crossChainPoolBalance:"Saldo del pool cross-chain",poolBalance:"Saldo del pool",poolBalanceInsufficientTip:"El monto a retirar excede el saldo del pool. El retiro no se puede procesar. Selecciona una opción con un saldo suficiente en el pool.",connectedWalletTitle:"Retiro a una billetera conectada",connectedWalletDesc:"Retira fondos a la billetera cripto que tengas conectada: MetaMask, WalletConnect u otro proveedor.",externalWalletTitle:"Retiro a una cuenta externa",externalWalletDesc:"Retira fondos a Binance u otros exchanges, cadenas como Arbitrum y otras billeteras."},account:{title:"Cuenta",perp:"Cuenta de perpetuos","perpetual-v1":"Cuenta de perpetuos V1","perpetual-v2":"Cuenta de perpetuos V2",spot:"Cuenta spot"}},ib={deposit:{title:"Dépôt",chain:"Blockchain",asset:"Actif",amount:"Montant",available:"Disponible",equity:"Actif net",confirmDeposit:"Confirmer le dépôt",switchNetwork:"Changer de réseau",max:"Max.",fast:"Rapide",standard:"Standard",arrivalTime:"Heure d’arrivée",ethCrossChainDepositInitiated:"Dépôt ETH inter-blockchains initié. Arrivée estimée dans 2 à 5 minutes.",minDeposit:"Montant minimum de dépôt",minDepositParsed:"Dépôt min. {{amount}} {{token}}",maxDeposit:"Montant maximum de dépôt",depositTipFor25w:"Le montant maximum par dépôt est de 200 000. Si votre dépôt dépasse 200 000, utilisez la blockchain Ethereum.",depositAllTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
36
+ Los depósitos entre cadenas requieren el pago de la comisión de gas de Edge. El monto acreditado será ligeramente inferior al monto depositado.`,addressUpdatedNotice:"Aviso: Se actualizó tu dirección de depósito. Usa esta nueva dirección. La anterior solo funciona durante la transición y pronto se desactivará. Si la tienes guardada en otros dispositivos, actualízala lo antes posible.",enableSystemProWithToken:"Habilitar {{token}} en {{network}}",enableTokenDesc:"Debes habilitar {{token}} la primera vez que deposites en {{network}}.",enableWithToken:"Habilitar {{token}}",arrivaltimeTooltip1:"Los fondos se acreditarán en aproximadamente {{v}} minutos (tras obtener {{v1}} confirmaciones de bloque).",arrivaltimeTooltip2:"El tiempo estimado se calcula a partir de datos históricos y es solo de referencia. La congestión de la red puede ocasionar tiempos de acreditación más largos.",arrivalEstimated:"Aprox. {{v}} minutos",feeRateTooltip:"Tarifa estimada, deducción real prevalece.",availableDesc:"Lo máximo que puedes depositar. Si el saldo disponible es 0 o negativo, los depósitos no están permitidos.",noPrivateKeyWalletWarning:"No uses billeteras sin clave para realizar depósitos. Existe el riesgo de una pérdida irreversible de los fondos.",layerZeroDepositTip:"El sistema completará tu depósito a través de LayerZero según las condiciones de depósito reales.",layerZeroDepositTipExceedPool:"Dado que el importe del depósito supera el pool, tu depósito se completará a través de LayerZero.",layerZeroDepositTipGte200k:"El depósito es de 200,000 USDT o más. Se completará a través de LayerZero.",layerZeroDepositButton:"Depositar con LayerZero",defaultSpotNotice:"Los depósitos predeterminados van a la cuenta spot.",defaultSpotToPerpNotice:"Esta dirección solo admite depósitos en {{coin}} ({{v}}) Los depósitos predeterminados van a la cuenta spot. Para agregar fondos a la cuenta de futuros, transfiere desde la cuenta spot a la cuenta de futuros.",depositModeSwitchWarning:"No cambie el modo de depósito tras iniciar o durante el depósito, o el método de depósito podría cambiar.",connectedWalletTitle:"Depósito desde una billetera conectada",connectedWalletDesc:"Usa MetaMask, WalletConnect u otro proveedor para depositar fondos desde tu billetera cripto.",externalWalletTitle:"Depósito desde una cuenta externa",externalWalletDesc:"Transfiere fondos desde Binance u otros exchanges, cadenas como Arbitrum y otras billeteras.",or:"OR"},withdraw:{noticeDesc:"Después de iniciar la solicitud de retiro, se procesará en Layer2. Una vez que los fondos estén listos (normalmente en 4 horas), recibirá una notificación para retirar los fondos a su billetera.",noticeDescWithClaim:"Después de iniciar la solicitud de retiro, se procesará en Layer2. Una vez que los fondos estén listos (normalmente en 4 horas), recibirá una notificación para retirar los fondos a su billetera. Debe reclamar los fondos e ingresar su dirección de retiro para completar el proceso.",externalWalletEthNoticeDesc:"Después de iniciar la solicitud de retiro, se procesará en Layer2. Una vez que los fondos estén listos (normalmente en 4 horas), recibirá una notificación para retirar los fondos a su billetera. Usted es responsable de todas las tarifas de Gas incurridas durante los retiros.",crossChainTips:"Los retiros cross-chain requieren verificación en L2 (mediante pruebas ZK) y normalmente tardan de 5 minutos a 2 horas.",crossChainTipsWithGas:"Los retiros cross-chain requieren verificación en L2 (mediante pruebas ZK) y normalmente tardan de 5 minutos a 2 horas. Usted es responsable de todas las tarifas de Gas incurridas durante los retiros.",commonWithdraw:"Preguntas frecuentes sobre los retiros",withdraw:"Retirar",speed:"Velocidad",confirmWithdraw:"Confirmar el retiro",speedNote:"Plazos de procesamiento:",speedNoteSpeed1:"Aprox. 8 minutos",speedNoteSpeed2:"Aprox. 2-4 horas",speedNoteSpeed3:"Aprox. 4 horas",receiverAddress:"Dirección del destinatario",fee:"Comisión",feeRate:"Tasa de comisión",withdrawlAmount:"Monto del retiro",amountToReceive:"Monto a recibir",minWithdraw:"Monto mínimo de retiro",minWithdrawParsed:"Min. de retiro: {{amount}} {{token}}",invalidReceiverAddress:"La dirección no puede estar vacía",availableDesc:"Lo máximo que puedes retirar. Si el saldo disponible es 0 o negativo, los retiros no están permitidos.",feeCalculationTip:"Las comisiones de retiro se calculan multiplicando el monto de retiro por la tasa de comisión, con un mínimo de 1 USDT/USDC. La tasa de la comisión puede modificarse en función de las condiciones reales de la cadena.",largeWithdrawFeeTip:"La comisión por retiro es del 0,015 % y se deducirá directamente del monto retirado.",crossChainPoolBalance:"Saldo del pool cross-chain",poolBalance:"Saldo del pool",poolBalanceInsufficientTip:"El monto a retirar excede el saldo del pool. El retiro no se puede procesar. Selecciona una opción con un saldo suficiente en el pool.",connectedWalletTitle:"Retiro a una billetera conectada",connectedWalletDesc:"Retira fondos a la billetera cripto que tengas conectada: MetaMask, WalletConnect u otro proveedor.",externalWalletTitle:"Retiro a una cuenta externa",externalWalletDesc:"Retira fondos a Binance u otros exchanges, cadenas como Arbitrum y otras billeteras."},account:{title:"Cuenta",perp:"Cuenta de perpetuos","perpetual-v1":"Cuenta de perpetuos V1","perpetual-v2":"Cuenta de perpetuos V2",spot:"Cuenta spot"}},lb={deposit:{title:"Dépôt",chain:"Blockchain",asset:"Actif",amount:"Montant",available:"Disponible",equity:"Actif net",confirmDeposit:"Confirmer le dépôt",switchNetwork:"Changer de réseau",max:"Max.",fast:"Rapide",standard:"Standard",arrivalTime:"Heure d’arrivée",ethCrossChainDepositInitiated:"Dépôt ETH inter-blockchains initié. Arrivée estimée dans 2 à 5 minutes.",minDeposit:"Montant minimum de dépôt",minDepositParsed:"Dépôt min. {{amount}} {{token}}",maxDeposit:"Montant maximum de dépôt",depositTipFor25w:"Le montant maximum par dépôt est de 200 000. Si votre dépôt dépasse 200 000, utilisez la blockchain Ethereum.",depositAllTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
37
37
  Si le montant du dépôt dépasse 200 000, l’heure d’arrivée peut être retardée. Merci de patienter.`,maxDepositSplitTip:"Le montant maximum par dépôt est de 200 000. Si vous devez déposer plus de 200 000, veuillez effectuer plusieurs dépôts.",spotDepositNotSupportedTip:"Les dépôts ne sont pas pris en charge. Veuillez effectuer le dépôt sur le compte perpétuel, puis transférer les fonds.",crossChainDepositFeeTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
38
- Les dépôts inter-blockchains nécessitent le paiement des frais de gas Edge. Le montant crédité sera légèrement inférieur au montant déposé.`,addressUpdatedNotice:"Avis : Votre adresse de dépôt a été mise à jour. Utilisez la nouvelle adresse. L’ancienne ne fonctionne que pendant la transition et sera désactivée. Si vous l’avez enregistrée ailleurs, modifiez-la sans tarder.",enableSystemProWithToken:"Activer {{token}} sur {{network}}",enableTokenDesc:"Vous devez activer {{token}} lors de votre premier dépôt sur {{network}}.",enableWithToken:"Activer {{token}}",arrivaltimeTooltip1:"Les fonds arriveront dans environ {{v}} minutes (après {{v1}} confirmations de bloc).",arrivaltimeTooltip2:"La durée estimée est calculée sur la base de données historiques et n’est donnée qu’à titre indicatif. L’encombrement du réseau peut rallonger l’heure d’arrivée réelle.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Frais estimés, déduction réelle fait foi.",availableDesc:"Montant maximal que vous pouvez déposer. Lorsque le solde disponible est nul ou négatif, aucun dépôt ne peut être effectué.",noPrivateKeyWalletWarning:"N’utilisez pas de wallets sans clé pour effectuer des dépôts. Un dépôt effectué depuis un wallet sans clé peut entraîner une perte irréversible des fonds.",layerZeroDepositTip:"Le système effectuera votre dépôt via LayerZero en fonction des conditions réelles du dépôt.",layerZeroDepositTipExceedPool:"Comme le montant du dépôt est supérieur au pool, votre dépôt sera effectué via LayerZero.",layerZeroDepositTipGte200k:"Comme le montant du dépôt est supérieur ou égal à 200 000 USDT, votre dépôt sera effectué via LayerZero.",layerZeroDepositButton:"Déposer via LayerZero",defaultSpotNotice:"Par défaut, les dépôts sont crédités sur le compte spot.",defaultSpotToPerpNotice:"Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse. Par défaut, les dépôts sont crédités sur le compte spot. Pour alimenter le compte futures, transférez des fonds du compte spot vers le compte futures.",connectedWalletTitle:"Dépôt depuis un wallet connecté",connectedWalletDesc:"Utilisez MetaMask, WalletConnect ou un autre fournisseur pour déposer des fonds depuis votre wallet crypto",externalWalletTitle:"Dépôt depuis un compte externe",externalWalletDesc:"Transférez des fonds depuis Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets",or:"OR"},withdraw:{noticeDesc:"Après avoir initié votre demande de retrait, elle sera traitée sur Layer2. Une fois les fonds prêts (généralement dans les 4 heures), vous recevrez une notification pour retirer les fonds vers votre portefeuille.",crossChainTips:"Les retraits cross-chain nécessitent une vérification sur L2 (via des preuves ZK) et prennent généralement de 5 minutes à 2 heures.",commonWithdraw:"FAQ sur les retraits",withdraw:"Retrait",speed:"Vitesse",confirmWithdraw:"Confirmer le retrait",speedNote:"Délais de traitement :",speedNoteSpeed1:"Env. 8 minutes",speedNoteSpeed2:"Env. 2 à 4 heures",speedNoteSpeed3:"Env. 4 heures",receiverAddress:"Adresse de réception",fee:"Frais",feeRate:"Taux de frais",withdrawlAmount:"Montant du retrait",amountToReceive:"Montant à recevoir",minWithdraw:"Montant minimum de retrait",minWithdrawParsed:"Retrait min. {{amount}} {{token}}",invalidReceiverAddress:"L’adresse ne peut pas être vide",availableDesc:"Montant maximal que vous pouvez retirer. Lorsque le solde disponible est nul ou négatif, aucun retrait ne peut être effectué.",feeCalculationTip:"Les frais de retrait sont calculés en multipliant le montant du retrait par le taux de frais, avec un minimum de 1 USDT/USDC. Le taux de frais peut être ajusté en fonction des conditions réelles on-chain.",largeWithdrawFeeTip:"Les frais de retrait s'élèvent à 0,015 % et seront déduits directement du montant retiré.",crossChainPoolBalance:"Solde du pool inter-blockchains",poolBalance:"Solde du pool",poolBalanceInsufficientTip:"Le montant du retrait dépasse le solde du pool de fonds ; le retrait ne peut pas être traité. Sélectionnez une option disposant d’un solde de pool de fonds suffisant.",connectedWalletTitle:"Retrait vers un wallet connecté",connectedWalletDesc:"Retirez des fonds vers votre wallet crypto connecté, MetaMask, WalletConnect ou un autre fournisseur",externalWalletTitle:"Retrait vers un compte externe",externalWalletDesc:"Retirez des fonds vers Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets"},account:{title:"Compte",perp:"Compte perpétuel","perpetual-v1":"Compte Perpétuels V1","perpetual-v2":"Compte Perpétuels V2",spot:"Compte spot"}},ab={deposit:{title:"Deposita",chain:"Blockchain",asset:"Asset",amount:"Importo",available:"Disponibile",equity:"Equity",confirmDeposit:"Conferma il deposito",switchNetwork:"Cambia rete",max:"Max",fast:"Rapido",standard:"Standard",arrivalTime:"Orario di arrivo",ethCrossChainDepositInitiated:"Deposito cross-chain di ETH avviato. Il deposito arriverà tra 2-5 minuti.",minDeposit:"Importo minimo del deposito",minDepositParsed:"Deposito min. {{amount}} {{token}}",maxDeposit:"Importo massimo del deposito",depositTipFor25w:"L'importo massimo per deposito è 200.000. Se il tuo deposito supera i 200.000, utilizza la catena Ethereum.",depositAllTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
38
+ Les dépôts inter-blockchains nécessitent le paiement des frais de gas Edge. Le montant crédité sera légèrement inférieur au montant déposé.`,addressUpdatedNotice:"Avis : Votre adresse de dépôt a été mise à jour. Utilisez la nouvelle adresse. L’ancienne ne fonctionne que pendant la transition et sera désactivée. Si vous l’avez enregistrée ailleurs, modifiez-la sans tarder.",enableSystemProWithToken:"Activer {{token}} sur {{network}}",enableTokenDesc:"Vous devez activer {{token}} lors de votre premier dépôt sur {{network}}.",enableWithToken:"Activer {{token}}",arrivaltimeTooltip1:"Les fonds arriveront dans environ {{v}} minutes (après {{v1}} confirmations de bloc).",arrivaltimeTooltip2:"La durée estimée est calculée sur la base de données historiques et n’est donnée qu’à titre indicatif. L’encombrement du réseau peut rallonger l’heure d’arrivée réelle.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Frais estimés, déduction réelle fait foi.",availableDesc:"Montant maximal que vous pouvez déposer. Lorsque le solde disponible est nul ou négatif, aucun dépôt ne peut être effectué.",noPrivateKeyWalletWarning:"N’utilisez pas de wallets sans clé pour effectuer des dépôts. Un dépôt effectué depuis un wallet sans clé peut entraîner une perte irréversible des fonds.",layerZeroDepositTip:"Le système effectuera votre dépôt via LayerZero en fonction des conditions réelles du dépôt.",layerZeroDepositTipExceedPool:"Comme le montant du dépôt est supérieur au pool, votre dépôt sera effectué via LayerZero.",layerZeroDepositTipGte200k:"Comme le montant du dépôt est supérieur ou égal à 200 000 USDT, votre dépôt sera effectué via LayerZero.",layerZeroDepositButton:"Déposer via LayerZero",defaultSpotNotice:"Par défaut, les dépôts sont crédités sur le compte spot.",defaultSpotToPerpNotice:"Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse. Par défaut, les dépôts sont crédités sur le compte spot. Pour alimenter le compte futures, transférez des fonds du compte spot vers le compte futures.",depositModeSwitchWarning:"Ne changez pas le mode de dépôt après initiation ou pendant le dépôt, sinon la méthode de dépôt changera.",connectedWalletTitle:"Dépôt depuis un wallet connecté",connectedWalletDesc:"Utilisez MetaMask, WalletConnect ou un autre fournisseur pour déposer des fonds depuis votre wallet crypto",externalWalletTitle:"Dépôt depuis un compte externe",externalWalletDesc:"Transférez des fonds depuis Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets",or:"OR"},withdraw:{noticeDesc:"Après avoir initié votre demande de retrait, elle sera traitée sur Layer2. Une fois les fonds prêts (généralement dans les 4 heures), vous recevrez une notification pour retirer les fonds vers votre portefeuille.",noticeDescWithClaim:"Après avoir initié votre demande de retrait, elle sera traitée sur Layer2. Une fois les fonds prêts (généralement dans les 4 heures), vous recevrez une notification pour retirer les fonds vers votre portefeuille. Vous devez réclamer les fonds et saisir votre adresse de retrait pour finaliser le processus.",externalWalletEthNoticeDesc:"Après avoir initié votre demande de retrait, elle sera traitée sur Layer2. Une fois les fonds prêts (généralement dans les 4 heures), vous recevrez une notification pour retirer les fonds vers votre portefeuille. Vous êtes responsable de tous les frais de Gas encourus lors des retraits.",crossChainTips:"Les retraits cross-chain nécessitent une vérification sur L2 (via des preuves ZK) et prennent généralement de 5 minutes à 2 heures.",crossChainTipsWithGas:"Les retraits cross-chain nécessitent une vérification sur L2 (via des preuves ZK) et prennent généralement de 5 minutes à 2 heures. Vous êtes responsable de tous les frais de Gas encourus lors des retraits.",commonWithdraw:"FAQ sur les retraits",withdraw:"Retrait",speed:"Vitesse",confirmWithdraw:"Confirmer le retrait",speedNote:"Délais de traitement :",speedNoteSpeed1:"Env. 8 minutes",speedNoteSpeed2:"Env. 2 à 4 heures",speedNoteSpeed3:"Env. 4 heures",receiverAddress:"Adresse de réception",fee:"Frais",feeRate:"Taux de frais",withdrawlAmount:"Montant du retrait",amountToReceive:"Montant à recevoir",minWithdraw:"Montant minimum de retrait",minWithdrawParsed:"Retrait min. {{amount}} {{token}}",invalidReceiverAddress:"L’adresse ne peut pas être vide",availableDesc:"Montant maximal que vous pouvez retirer. Lorsque le solde disponible est nul ou négatif, aucun retrait ne peut être effectué.",feeCalculationTip:"Les frais de retrait sont calculés en multipliant le montant du retrait par le taux de frais, avec un minimum de 1 USDT/USDC. Le taux de frais peut être ajusté en fonction des conditions réelles on-chain.",largeWithdrawFeeTip:"Les frais de retrait s'élèvent à 0,015 % et seront déduits directement du montant retiré.",crossChainPoolBalance:"Solde du pool inter-blockchains",poolBalance:"Solde du pool",poolBalanceInsufficientTip:"Le montant du retrait dépasse le solde du pool de fonds ; le retrait ne peut pas être traité. Sélectionnez une option disposant d’un solde de pool de fonds suffisant.",connectedWalletTitle:"Retrait vers un wallet connecté",connectedWalletDesc:"Retirez des fonds vers votre wallet crypto connecté, MetaMask, WalletConnect ou un autre fournisseur",externalWalletTitle:"Retrait vers un compte externe",externalWalletDesc:"Retirez des fonds vers Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets"},account:{title:"Compte",perp:"Compte perpétuel","perpetual-v1":"Compte Perpétuels V1","perpetual-v2":"Compte Perpétuels V2",spot:"Compte spot"}},cb={deposit:{title:"Deposita",chain:"Blockchain",asset:"Asset",amount:"Importo",available:"Disponibile",equity:"Equity",confirmDeposit:"Conferma il deposito",switchNetwork:"Cambia rete",max:"Max",fast:"Rapido",standard:"Standard",arrivalTime:"Orario di arrivo",ethCrossChainDepositInitiated:"Deposito cross-chain di ETH avviato. Il deposito arriverà tra 2-5 minuti.",minDeposit:"Importo minimo del deposito",minDepositParsed:"Deposito min. {{amount}} {{token}}",maxDeposit:"Importo massimo del deposito",depositTipFor25w:"L'importo massimo per deposito è 200.000. Se il tuo deposito supera i 200.000, utilizza la catena Ethereum.",depositAllTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
39
39
  Se l'importo del deposito supera i 200.000, l'orario di arrivo potrebbe subire ritardi. Sii paziente.`,maxDepositSplitTip:"L'importo massimo per deposito è 200.000. Se devi depositare più di 200.000, dividi l'importo in più depositi.",spotDepositNotSupportedTip:"I depositi non sono supportati. Prima deposita sul conto perpetuo, quindi effettua il trasferimento.",crossChainDepositFeeTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
40
- Per i depositi cross-chain è necessario pagare la gas fee Edge. L'importo accreditato sarà leggermente inferiore all'importo del deposito.`,addressUpdatedNotice:"Avviso: il tuo indirizzo di deposito è stato aggiornato. Utilizza il nuovo indirizzo. L'indirizzo precedente funzionerà solo durante la transizione, quindi verrà disattivato. Se l'hai salvato altrove, aggiornarlo il prima possibile.",enableSystemProWithToken:"Abilita {{token}} su {{network}}",enableTokenDesc:"Devi abilitare {{token}} la prima volta che depositi su {{network}}.",enableWithToken:"Abilita {{token}}",arrivaltimeTooltip1:"I fondi arriveranno entro circa {{v}} minuti (dopo{{v1}} conferme di blocco).",arrivaltimeTooltip2:"Il tempo stimato è calcolato in base ai dati storici ed solo per riferimento. Se la rete è congestionata, potrebbero esserci dei ritardi.",arrivalEstimated:"≈ {{v}} minuti",feeRateTooltip:"Commissione stimata, detrazione effettiva prevalente.",availableDesc:"L'importo massimo che puoi depositare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare depositi.",noPrivateKeyWalletWarning:"Non effettuare depositi con wallet senza chiavi. Se effettui un deposito tramite un wallet senza chiave rischi di perdere i tuoi fondi per sempre.",layerZeroDepositTip:"Il sistema completerà il tuo deposito tramite LayerZero in base alle condizioni effettive di deposito.",layerZeroDepositTipExceedPool:"Poiché l'importo del deposito supera il pool, il deposito sarà completato tramite LayerZero.",layerZeroDepositTipGte200k:"Poiché l'importo del deposito è maggiore o uguale a 200.000 USDT, il deposito verrà completato tramite LayerZero.",layerZeroDepositButton:"Deposita con LayerZero",defaultSpotNotice:"I depositi predefiniti vanno sul conto spot.",defaultSpotToPerpNotice:"I depositi a questo indirizzo supportano solo {{coin}} ({{v}}). I depositi predefiniti vanno sul conto spot. Per finanziare il conto futures, effettua un trasferimento dal conto spot al conto futures.",connectedWalletTitle:"Deposita dal wallet collegato",connectedWalletDesc:"Usa MetaMask, WalletConnect o un altro fornitore per depositare fondi dal tuo wallet crypto",externalWalletTitle:"Deposita da account esterno",externalWalletDesc:"Trasferisci fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet",or:"OR"},withdraw:{noticeDesc:"Dopo aver avviato la richiesta di prelievo, verrà elaborata su Layer2. Una volta che i fondi saranno pronti (di solito entro 4 ore), riceverai una notifica per prelevare i fondi nel tuo wallet.",crossChainTips:"I prelievi cross-chain richiedono la verifica su L2 (tramite prove ZK) e di solito richiedono da 5 minuti a 2 ore.",commonWithdraw:"Domande frequenti sui prelievi",withdraw:"Preleva",speed:"Velocità",confirmWithdraw:"Conferma prelievo",speedNote:"Tempi di elaborazione:",speedNoteSpeed1:"Circa 8 minuti",speedNoteSpeed2:"Circa 2-4 ore",speedNoteSpeed3:"Circa 4 ore",receiverAddress:"Indirizzo del destinatario",fee:"Commissione",feeRate:"Tariffa",withdrawlAmount:"Importo del prelievo",amountToReceive:"Importo da ricevere",minWithdraw:"Importo minimo di prelievo",minWithdrawParsed:"Prelievo min. {{amount}} {{token}}",invalidReceiverAddress:"L'indirizzo non può essere vuoto",availableDesc:"L'importo massimo che puoi prelevare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare prelievi.",feeCalculationTip:"Le commissioni di prelievo vengono calcolate moltiplicando l'importo del prelievo per il tasso di commissione, con un minimo di 1 USDT/USDC. La tariffa può essere modificata in base alle condizioni effettive on-chain.",largeWithdrawFeeTip:"La commissione di prelievo è pari allo 0,015 % e verrà dedotta direttamente dall'importo prelevato.",crossChainPoolBalance:"Equilibrio del pool cross-chain",poolBalance:"Equilibrio della piscina",poolBalanceInsufficientTip:"L'importo del prelievo supera il saldo del fondo e il prelievo non può essere elaborato. Selezionare un'opzione con un saldo di fondi sufficiente.",connectedWalletTitle:"Preleva sul wallet collegato",connectedWalletDesc:"Preleva fondi dal wallet crypto collegato, MetaMask, WalletConnect o un altro fornitore",externalWalletTitle:"Preleva sull'account esterno",externalWalletDesc:"Preleva fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet"},account:{title:"Account",perp:"Conto perpetuo","perpetual-v1":"Conto perpetuo V1","perpetual-v2":"Conto perpetuo V2",spot:"Conto Spot"}},lb={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",fast:"高速",standard:"標準",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
40
+ Per i depositi cross-chain è necessario pagare la gas fee Edge. L'importo accreditato sarà leggermente inferiore all'importo del deposito.`,addressUpdatedNotice:"Avviso: il tuo indirizzo di deposito è stato aggiornato. Utilizza il nuovo indirizzo. L'indirizzo precedente funzionerà solo durante la transizione, quindi verrà disattivato. Se l'hai salvato altrove, aggiornarlo il prima possibile.",enableSystemProWithToken:"Abilita {{token}} su {{network}}",enableTokenDesc:"Devi abilitare {{token}} la prima volta che depositi su {{network}}.",enableWithToken:"Abilita {{token}}",arrivaltimeTooltip1:"I fondi arriveranno entro circa {{v}} minuti (dopo{{v1}} conferme di blocco).",arrivaltimeTooltip2:"Il tempo stimato è calcolato in base ai dati storici ed solo per riferimento. Se la rete è congestionata, potrebbero esserci dei ritardi.",arrivalEstimated:"≈ {{v}} minuti",feeRateTooltip:"Commissione stimata, detrazione effettiva prevalente.",availableDesc:"L'importo massimo che puoi depositare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare depositi.",noPrivateKeyWalletWarning:"Non effettuare depositi con wallet senza chiavi. Se effettui un deposito tramite un wallet senza chiave rischi di perdere i tuoi fondi per sempre.",layerZeroDepositTip:"Il sistema completerà il tuo deposito tramite LayerZero in base alle condizioni effettive di deposito.",layerZeroDepositTipExceedPool:"Poiché l'importo del deposito supera il pool, il deposito sarà completato tramite LayerZero.",layerZeroDepositTipGte200k:"Poiché l'importo del deposito è maggiore o uguale a 200.000 USDT, il deposito verrà completato tramite LayerZero.",layerZeroDepositButton:"Deposita con LayerZero",defaultSpotNotice:"I depositi predefiniti vanno sul conto spot.",defaultSpotToPerpNotice:"I depositi a questo indirizzo supportano solo {{coin}} ({{v}}). I depositi predefiniti vanno sul conto spot. Per finanziare il conto futures, effettua un trasferimento dal conto spot al conto futures.",depositModeSwitchWarning:"Non cambiare la modalità di deposito dopo l'avvio o durante il deposito, altrimenti il metodo di deposito cambierà.",connectedWalletTitle:"Deposita dal wallet collegato",connectedWalletDesc:"Usa MetaMask, WalletConnect o un altro fornitore per depositare fondi dal tuo wallet crypto",externalWalletTitle:"Deposita da account esterno",externalWalletDesc:"Trasferisci fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet",or:"OR"},withdraw:{noticeDesc:"Dopo aver avviato la richiesta di prelievo, verrà elaborata su Layer2. Una volta che i fondi saranno pronti (di solito entro 4 ore), riceverai una notifica per prelevare i fondi nel tuo wallet.",noticeDescWithClaim:"Dopo aver avviato la richiesta di prelievo, verrà elaborata su Layer2. Una volta che i fondi saranno pronti (di solito entro 4 ore), riceverai una notifica per prelevare i fondi nel tuo wallet. Per completare il processo devi richiedere i fondi e inserire l'indirizzo di prelievo.",externalWalletEthNoticeDesc:"Dopo aver avviato la richiesta di prelievo, verrà elaborata su Layer2. Una volta che i fondi saranno pronti (di solito entro 4 ore), riceverai una notifica per prelevare i fondi nel tuo wallet. Sei responsabile di tutte le commissioni Gas sostenute durante i prelievi.",crossChainTips:"I prelievi cross-chain richiedono la verifica su L2 (tramite prove ZK) e di solito richiedono da 5 minuti a 2 ore.",crossChainTipsWithGas:"I prelievi cross-chain richiedono la verifica su L2 (tramite prove ZK) e di solito richiedono da 5 minuti a 2 ore. Sei responsabile di tutte le commissioni Gas sostenute durante i prelievi.",commonWithdraw:"Domande frequenti sui prelievi",withdraw:"Preleva",speed:"Velocità",confirmWithdraw:"Conferma prelievo",speedNote:"Tempi di elaborazione:",speedNoteSpeed1:"Circa 8 minuti",speedNoteSpeed2:"Circa 2-4 ore",speedNoteSpeed3:"Circa 4 ore",receiverAddress:"Indirizzo del destinatario",fee:"Commissione",feeRate:"Tariffa",withdrawlAmount:"Importo del prelievo",amountToReceive:"Importo da ricevere",minWithdraw:"Importo minimo di prelievo",minWithdrawParsed:"Prelievo min. {{amount}} {{token}}",invalidReceiverAddress:"L'indirizzo non può essere vuoto",availableDesc:"L'importo massimo che puoi prelevare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare prelievi.",feeCalculationTip:"Le commissioni di prelievo vengono calcolate moltiplicando l'importo del prelievo per il tasso di commissione, con un minimo di 1 USDT/USDC. La tariffa può essere modificata in base alle condizioni effettive on-chain.",largeWithdrawFeeTip:"La commissione di prelievo è pari allo 0,015 % e verrà dedotta direttamente dall'importo prelevato.",crossChainPoolBalance:"Equilibrio del pool cross-chain",poolBalance:"Equilibrio della piscina",poolBalanceInsufficientTip:"L'importo del prelievo supera il saldo del fondo e il prelievo non può essere elaborato. Selezionare un'opzione con un saldo di fondi sufficiente.",connectedWalletTitle:"Preleva sul wallet collegato",connectedWalletDesc:"Preleva fondi dal wallet crypto collegato, MetaMask, WalletConnect o un altro fornitore",externalWalletTitle:"Preleva sull'account esterno",externalWalletDesc:"Preleva fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet"},account:{title:"Account",perp:"Conto perpetuo","perpetual-v1":"Conto perpetuo V1","perpetual-v2":"Conto perpetuo V2",spot:"Conto Spot"}},ub={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",fast:"高速",standard:"標準",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
41
41
  入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,maxDepositSplitTip:"1回の入金上限は200,000です。200,000を超える金額を入金する場合は、複数回に分けて行ってください。",spotDepositNotSupportedTip:"入金非対応。先に契約アカウント入金後、振替。",crossChainDepositFeeTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
42
- クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",feeRateTooltip:"手数料の見積もり額で、実際の控除額を基準とします。",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。",connectedWalletTitle:"接続済みウォレットから入庫",connectedWalletDesc:"MetaMask、WalletConnect、またはその他のプロバイダーを使用し、暗号資産ウォレットから資産を入庫してください。",externalWalletTitle:"外部アカウントから入庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他ウォレットから資産を入庫する",or:"OR"},withdraw:{noticeDesc:"出金リクエストを開始すると、Layer2 で処理されます。資金の準備が完了すると(通常4時間以内)、通知が届き、資金をウォレットに出金できます。",crossChainTips:"クロスチェーン出金には L2 での検証(ZK 証明による)が必要で、通常 5 分から 2 時間かかります。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",largeWithdrawFeeTip:"出金手数料は0.015%で、出金額から直接差し引かれます。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。",connectedWalletTitle:"接続済みウォレットへ出庫",connectedWalletDesc:"接続済み暗号資産ウォレット、MetaMask、WalletConnect、またはその他のプロバイダーへ資産を出庫する",externalWalletTitle:"外部アカウントへ出庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他のウォレットへ資産を出庫する"},account:{title:"アカウント",perp:"パーペチュアルアカウント","perpetual-v1":"先物V1アカウント","perpetual-v2":"先物V2アカウント",spot:"スポットアカウント"}},cb={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",fast:"Быстрый",standard:"Стандартный",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
42
+ クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",feeRateTooltip:"手数料の見積もり額で、実際の控除額を基準とします。",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。",depositModeSwitchWarning:"入金開始後または入金中はチャージモードを切り替えないでください。入金方法が変わる可能性があります。",connectedWalletTitle:"接続済みウォレットから入庫",connectedWalletDesc:"MetaMask、WalletConnect、またはその他のプロバイダーを使用し、暗号資産ウォレットから資産を入庫してください。",externalWalletTitle:"外部アカウントから入庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他ウォレットから資産を入庫する",or:"OR"},withdraw:{noticeDesc:"出金リクエストを開始すると、Layer2 で処理されます。資金の準備が完了すると(通常4時間以内)、通知が届き、資金をウォレットに出金できます。",noticeDescWithClaim:"出金リクエストを開始すると、Layer2 で処理されます。資金の準備が完了すると(通常4時間以内)、通知が届き、資金をウォレットに出金できます。その後、資金を受け取る操作を行い、出金アドレスを入力することで、出金が完了します。",externalWalletEthNoticeDesc:"出金リクエストを開始すると、Layer2 で処理されます。資金の準備が完了すると(通常4時間以内)、通知が届き、資金をウォレットに出金できます。出金時に発生するすべてのGas費用はご自身で負担してください。",crossChainTips:"クロスチェーン出金には L2 での検証(ZK 証明による)が必要で、通常 5 分から 2 時間かかります。",crossChainTipsWithGas:"クロスチェーン出金には L2 での検証(ZK 証明による)が必要で、通常 5 分から 2 時間かかります。出金時に発生するすべてのGas費用はご自身で負担してください。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",largeWithdrawFeeTip:"出金手数料は0.015%で、出金額から直接差し引かれます。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。",connectedWalletTitle:"接続済みウォレットへ出庫",connectedWalletDesc:"接続済み暗号資産ウォレット、MetaMask、WalletConnect、またはその他のプロバイダーへ資産を出庫する",externalWalletTitle:"外部アカウントへ出庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他のウォレットへ資産を出庫する"},account:{title:"アカウント",perp:"パーペチュアルアカウント","perpetual-v1":"先物V1アカウント","perpetual-v2":"先物V2アカウント",spot:"スポットアカウント"}},db={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",fast:"Быстрый",standard:"Стандартный",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
43
43
  Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,maxDepositSplitTip:"Максимальная сумма одного пополнения — 200 000. Если вам нужно пополнить на сумму более 200 000, выполните несколько пополнений.",spotDepositNotSupportedTip:"Пополнение недоступно. Сначала контрактный счёт, затем перевод.",crossChainDepositFeeTip:`На этот адрес можно внести только {{coin}} ({{v}}).
44
44
  За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",feeRateTooltip:"Предварительная комиссия, фактическое списание в качестве окончательного.",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:`Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.
45
45
 
46
- Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный.",connectedWalletTitle:"Депозит с подключенного кошелька",connectedWalletDesc:"Используйте MetaMask, WalletConnect или другой сервис для внесения средств с криптокошелька",externalWalletTitle:"Депозит с внешнего аккаунта",externalWalletDesc:"Переводите средства с Binance или других бирж, блокчейнов, таких как Arbitrum, и других кошельков",or:"OR"},withdraw:{noticeDesc:"После инициации запроса на вывод средства будут обработаны на Layer2. Как только средства будут готовы (обычно в течение 4 часов), вы получите уведомление для вывода средств на свой кошелёк.",crossChainTips:"Кросс-чейн выводы требуют верификации на L2 (через ZK-доказательства) и обычно занимают от 5 минут до 2 часов.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",largeWithdrawFeeTip:"Комиссия за вывод составляет 0,015 % и будет вычтена непосредственно из суммы вывода.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств.",connectedWalletTitle:"Вывод на подключенный кошелек",connectedWalletDesc:"Выведите средства на подключенный криптокошелек: MetaMask, WalletConnect или другой",externalWalletTitle:"Вывод средств на внешний аккаунт",externalWalletDesc:"Выведите средства на Binance или другие биржи, блокчейны, такие как Arbitrum, и другие кошельки"},account:{title:"Аккаунт",perp:"Перпетуальный счет","perpetual-v1":"Перпетуальный счёт V1","perpetual-v2":"Перпетуальный счёт V2",spot:"Спотовый счет"}},ub={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
46
+ Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный.",depositModeSwitchWarning:"Не меняйте режим пополнения после начала или во время пополнения, иначе способ пополнения изменится.",connectedWalletTitle:"Депозит с подключенного кошелька",connectedWalletDesc:"Используйте MetaMask, WalletConnect или другой сервис для внесения средств с криптокошелька",externalWalletTitle:"Депозит с внешнего аккаунта",externalWalletDesc:"Переводите средства с Binance или других бирж, блокчейнов, таких как Arbitrum, и других кошельков",or:"OR"},withdraw:{noticeDesc:"После инициации запроса на вывод средства будут обработаны на Layer2. Как только средства будут готовы (обычно в течение 4 часов), вы получите уведомление для вывода средств на свой кошелёк.",noticeDescWithClaim:"После инициации запроса на вывод средства будут обработаны на Layer2. Как только средства будут готовы (обычно в течение 4 часов), вы получите уведомление для вывода средств на свой кошелёк. Вам необходимо будет подтвердить получение и указать адрес вывода для завершения операции.",externalWalletEthNoticeDesc:"После инициации запроса на вывод средства будут обработаны на Layer2. Как только средства будут готовы (обычно в течение 4 часов), вы получите уведомление для вывода средств на свой кошелёк. Вы несёте ответственность за все комиссии Gas, возникающие во время вывода средств.",crossChainTips:"Кросс-чейн выводы требуют верификации на L2 (через ZK-доказательства) и обычно занимают от 5 минут до 2 часов.",crossChainTipsWithGas:"Кросс-чейн выводы требуют верификации на L2 (через ZK-доказательства) и обычно занимают от 5 минут до 2 часов. Вы несёте ответственность за все комиссии Gas, возникающие во время вывода средств.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",largeWithdrawFeeTip:"Комиссия за вывод составляет 0,015 % и будет вычтена непосредственно из суммы вывода.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств.",connectedWalletTitle:"Вывод на подключенный кошелек",connectedWalletDesc:"Выведите средства на подключенный криптокошелек: MetaMask, WalletConnect или другой",externalWalletTitle:"Вывод средств на внешний аккаунт",externalWalletDesc:"Выведите средства на Binance или другие биржи, блокчейны, такие как Arbitrum, и другие кошельки"},account:{title:"Аккаунт",perp:"Перпетуальный счет","perpetual-v1":"Перпетуальный счёт V1","perpetual-v2":"Перпетуальный счёт V2",spot:"Спотовый счет"}},fb={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
47
47
  充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,maxDepositSplitTip:"单笔充值金额上限为200,000。若需要充值金额大于200,000,请分多笔进行操作。",spotDepositNotSupportedTip:"不支持充值,请先充入合约账户再划转。",crossChainDepositFeeTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
48
- 跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",feeRateTooltip:"预估手续费,以实际扣除为准。",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。",connectedWalletTitle:"从已连接钱包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他钱包进行充值",externalWalletTitle:"从外部钱包充值",externalWalletDesc:"从 Binance 或其他交易所、Arbitrum 等链或其他钱包转账",or:"或"},withdraw:{noticeDesc:"在您发起提现请求后,将在 Layer2 上进行处理。资金准备就绪后(通常在 4 小时内),您将收到通知,将资金提现至您的钱包。",crossChainTips:"跨链提现需要 L2 验证(通过 ZK 证明),通常需要 5 分钟至 2 小时。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",largeWithdrawFeeTip:"提现手续费为0.015%,将从提现金额中扣除。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。",connectedWalletTitle:"提现至已连接钱包",connectedWalletDesc:"将资金提现至您已连接的加密钱包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提现至外部账户",externalWalletDesc:"将资金提现至 Binance 或其他交易所、Arbitrum 等链及其他钱包"},account:{title:"账户",perp:"合约账户","perpetual-v1":"合约V1账户","perpetual-v2":"合约V2账户",spot:"现货账户"}},fb={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
48
+ 跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",feeRateTooltip:"预估手续费,以实际扣除为准。",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。",depositModeSwitchWarning:"当您发起充值后或正在充值中时请勿切换充值模式,以免导致您的充值方式发生变更",connectedWalletTitle:"从已连接钱包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他钱包进行充值",externalWalletTitle:"从外部钱包充值",externalWalletDesc:"从 Binance 或其他交易所、Arbitrum 等链或其他钱包转账",or:"或"},withdraw:{noticeDesc:"在您发起提现请求后,将在 Layer2 上进行处理。资金准备就绪后(通常在 4 小时内),您将收到通知,将资金提现至您的钱包。",noticeDescWithClaim:"在您发起提现请求后,将在 Layer2 上进行处理。资金准备就绪后(通常在 4 小时内),您将收到通知,将资金提现至您的钱包。您需进行领取操作并填入提现地址来完成提现。",externalWalletEthNoticeDesc:"在您发起提现请求后,将在 Layer2 上进行处理。资金准备就绪后(通常在 4 小时内),您将收到通知,将资金提现至您的钱包。您需自行承担提现过程中产生的所有 Gas 费用。",crossChainTips:"跨链提现需要 L2 验证(通过 ZK 证明),通常需要 5 分钟至 2 小时。",crossChainTipsWithGas:"跨链提现需要 L2 验证(通过 ZK 证明),通常需要 5 分钟至 2 小时。您需自行承担提现过程中产生的所有 Gas 费用。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",largeWithdrawFeeTip:"提现手续费为0.015%,将从提现金额中扣除。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。",connectedWalletTitle:"提现至已连接钱包",connectedWalletDesc:"将资金提现至您已连接的加密钱包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提现至外部账户",externalWalletDesc:"将资金提现至 Binance 或其他交易所、Arbitrum 等链及其他钱包"},account:{title:"账户",perp:"合约账户","perpetual-v1":"合约V1账户","perpetual-v2":"合约V2账户",spot:"现货账户"}},pb={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
49
49
  充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,maxDepositSplitTip:"單筆充值金額上限為 200,000。若需要充值金額大於 200,000,請分多筆進行操作。",spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
50
- 跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",feeRateTooltip:"預估手續費,以實際扣除為準。",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。",connectedWalletTitle:"從已連接錢包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他錢包進行充值",externalWalletTitle:"從外部錢包充值",externalWalletDesc:"從 Binance 或其他交易所、Arbitrum 等鏈或其他錢包轉帳",or:"或"},withdraw:{noticeDesc:"在您發起提領請求後,將於 Layer2 進行處理。資金準備就緒後(通常在 4 小時內),您將收到通知,將資金提領至您的錢包。",crossChainTips:"跨鏈提現需要 L2 驗證(透過 ZK 證明),通常需要 5 分鐘至 2 小時。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",largeWithdrawFeeTip:"提現手續費為0.015%,將從提現金額中扣除。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。",connectedWalletTitle:"提現至已連接錢包",connectedWalletDesc:"將資金提現至您已連接的加密錢包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提現至外部帳戶",externalWalletDesc:"將資金提現至 Binance 或其他交易所、Arbitrum 等鏈及其他錢包"},account:{title:"帳戶",perp:"合約帳戶","perpetual-v1":"合約V1賬戶","perpetual-v2":"合約V2賬戶",spot:"現貨帳戶"}},zi=["en-US","ja-JP","ru-RU","zh-CN","zh-TW","de-DE","es-LA","fr-FR","it-IT"],nu={"en-US":ob,"ja-JP":lb,"ru-RU":cb,"zh-CN":ub,"zh-TW":fb,"de-DE":rb,"es-LA":sb,"fr-FR":ib,"it-IT":ab},ms="en-US",db={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский","de-DE":"Deutsch","es-LA":"Español (Latinoamérica)","fr-FR":"Français","it-IT":"Italiano"},pb=e=>zi.includes(e)?nu[e]:nu[ms],hb=e=>zi.includes(e),ru=g.createContext(null),mb=({config:e,children:t})=>{const n=g.useMemo(()=>{const r=e.locale||ms,o=hb(r)?r:ms,s=pb(o);return{...e,currentLocale:o,translations:s}},[e]);return N.jsx(ru.Provider,{value:n,children:t})},ou=()=>{const e=g.useContext(ru);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var bb=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ui=Math.ceil,mt=Math.floor,Ze="[BigNumber Error] ",su=Ze+"Number primitive has more than 15 significant digits: ",$t=1e14,ae=14,Wi=9007199254740991,_i=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],An=1e7,Fe=1e9;function iu(e){var t,n,r,o=x.prototype={constructor:x,toString:null,valueOf:null},s=new x(1),i=20,l=4,a=-7,c=21,u=-1e7,f=1e7,p=!1,d=1,h=0,b={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},w="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function x(m,v){var S,I,$,C,D,y,O,M,P=this;if(!(P instanceof x))return new x(m,v);if(v==null){if(m&&m._isBigNumber===!0){P.s=m.s,!m.c||m.e>f?P.c=P.e=null:m.e<u?P.c=[P.e=0]:(P.e=m.e,P.c=m.c.slice());return}if((y=typeof m=="number")&&m*0==0){if(P.s=1/m<0?(m=-m,-1):1,m===~~m){for(C=0,D=m;D>=10;D/=10,C++);C>f?P.c=P.e=null:(P.e=C,P.c=[m]);return}M=String(m)}else{if(!bb.test(M=String(m)))return r(P,M,y);P.s=M.charCodeAt(0)==45?(M=M.slice(1),-1):1}(C=M.indexOf("."))>-1&&(M=M.replace(".","")),(D=M.search(/e/i))>0?(C<0&&(C=D),C+=+M.slice(D+1),M=M.substring(0,D)):C<0&&(C=M.length)}else{if(Pe(v,2,w.length,"Base"),v==10&&T)return P=new x(m),F(P,i+P.e+1,l);if(M=String(m),y=typeof m=="number"){if(m*0!=0)return r(P,M,y,v);if(P.s=1/m<0?(M=M.slice(1),-1):1,x.DEBUG&&M.replace(/^0\.0*|\./,"").length>15)throw Error(su+m)}else P.s=M.charCodeAt(0)===45?(M=M.slice(1),-1):1;for(S=w.slice(0,v),C=D=0,O=M.length;D<O;D++)if(S.indexOf(I=M.charAt(D))<0){if(I=="."){if(D>C){C=O;continue}}else if(!$&&(M==M.toUpperCase()&&(M=M.toLowerCase())||M==M.toLowerCase()&&(M=M.toUpperCase()))){$=!0,D=-1,C=0;continue}return r(P,String(m),y,v)}y=!1,M=n(M,v,10,P.s),(C=M.indexOf("."))>-1?M=M.replace(".",""):C=M.length}for(D=0;M.charCodeAt(D)===48;D++);for(O=M.length;M.charCodeAt(--O)===48;);if(M=M.slice(D,++O)){if(O-=D,y&&x.DEBUG&&O>15&&(m>Wi||m!==mt(m)))throw Error(su+P.s*m);if((C=C-D-1)>f)P.c=P.e=null;else if(C<u)P.c=[P.e=0];else{if(P.e=C,P.c=[],D=(C+1)%ae,C<0&&(D+=ae),D<O){for(D&&P.c.push(+M.slice(0,D)),O-=ae;D<O;)P.c.push(+M.slice(D,D+=ae));D=ae-(M=M.slice(D)).length}else D-=O;for(;D--;M+="0");P.c.push(+M)}}else P.c=[P.e=0]}x.clone=iu,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(m){var v,S;if(m!=null)if(typeof m=="object"){if(m.hasOwnProperty(v="DECIMAL_PLACES")&&(S=m[v],Pe(S,0,Fe,v),i=S),m.hasOwnProperty(v="ROUNDING_MODE")&&(S=m[v],Pe(S,0,8,v),l=S),m.hasOwnProperty(v="EXPONENTIAL_AT")&&(S=m[v],S&&S.pop?(Pe(S[0],-Fe,0,v),Pe(S[1],0,Fe,v),a=S[0],c=S[1]):(Pe(S,-Fe,Fe,v),a=-(c=S<0?-S:S))),m.hasOwnProperty(v="RANGE"))if(S=m[v],S&&S.pop)Pe(S[0],-Fe,-1,v),Pe(S[1],1,Fe,v),u=S[0],f=S[1];else if(Pe(S,-Fe,Fe,v),S)u=-(f=S<0?-S:S);else throw Error(Ze+v+" cannot be zero: "+S);if(m.hasOwnProperty(v="CRYPTO"))if(S=m[v],S===!!S)if(S)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=S;else throw p=!S,Error(Ze+"crypto unavailable");else p=S;else throw Error(Ze+v+" not true or false: "+S);if(m.hasOwnProperty(v="MODULO_MODE")&&(S=m[v],Pe(S,0,9,v),d=S),m.hasOwnProperty(v="POW_PRECISION")&&(S=m[v],Pe(S,0,Fe,v),h=S),m.hasOwnProperty(v="FORMAT"))if(S=m[v],typeof S=="object")b=S;else throw Error(Ze+v+" not an object: "+S);if(m.hasOwnProperty(v="ALPHABET"))if(S=m[v],typeof S=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(S))T=S.slice(0,10)=="0123456789",w=S;else throw Error(Ze+v+" invalid: "+S)}else throw Error(Ze+"Object expected: "+m);return{DECIMAL_PLACES:i,ROUNDING_MODE:l,EXPONENTIAL_AT:[a,c],RANGE:[u,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:b,ALPHABET:w}},x.isBigNumber=function(m){if(!m||m._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var v,S,I=m.c,$=m.e,C=m.s;e:if({}.toString.call(I)=="[object Array]"){if((C===1||C===-1)&&$>=-Fe&&$<=Fe&&$===mt($)){if(I[0]===0){if($===0&&I.length===1)return!0;break e}if(v=($+1)%ae,v<1&&(v+=ae),String(I[0]).length==v){for(v=0;v<I.length;v++)if(S=I[v],S<0||S>=$t||S!==mt(S))break e;if(S!==0)return!0}}}else if(I===null&&$===null&&(C===null||C===1||C===-1))return!0;throw Error(Ze+"Invalid BigNumber: "+m)},x.maximum=x.max=function(){return A(arguments,-1)},x.minimum=x.min=function(){return A(arguments,1)},x.random=function(){var m=9007199254740992,v=Math.random()*m&2097151?function(){return mt(Math.random()*m)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(S){var I,$,C,D,y,O=0,M=[],P=new x(s);if(S==null?S=i:Pe(S,0,Fe),D=Ui(S/ae),p)if(crypto.getRandomValues){for(I=crypto.getRandomValues(new Uint32Array(D*=2));O<D;)y=I[O]*131072+(I[O+1]>>>11),y>=9e15?($=crypto.getRandomValues(new Uint32Array(2)),I[O]=$[0],I[O+1]=$[1]):(M.push(y%1e14),O+=2);O=D/2}else if(crypto.randomBytes){for(I=crypto.randomBytes(D*=7);O<D;)y=(I[O]&31)*281474976710656+I[O+1]*1099511627776+I[O+2]*4294967296+I[O+3]*16777216+(I[O+4]<<16)+(I[O+5]<<8)+I[O+6],y>=9e15?crypto.randomBytes(7).copy(I,O):(M.push(y%1e14),O+=7);O=D/7}else throw p=!1,Error(Ze+"crypto unavailable");if(!p)for(;O<D;)y=v(),y<9e15&&(M[O++]=y%1e14);for(D=M[--O],S%=ae,D&&S&&(y=_i[ae-S],M[O]=mt(D/y)*y);M[O]===0;M.pop(),O--);if(O<0)M=[C=0];else{for(C=-1;M[0]===0;M.splice(0,1),C-=ae);for(O=1,y=M[0];y>=10;y/=10,O++);O<ae&&(C-=ae-O)}return P.e=C,P.c=M,P}}(),x.sum=function(){for(var m=1,v=arguments,S=new x(v[0]);m<v.length;)S=S.plus(v[m++]);return S},n=function(){var m="0123456789";function v(S,I,$,C){for(var D,y=[0],O,M=0,P=S.length;M<P;){for(O=y.length;O--;y[O]*=I);for(y[0]+=C.indexOf(S.charAt(M++)),D=0;D<y.length;D++)y[D]>$-1&&(y[D+1]==null&&(y[D+1]=0),y[D+1]+=y[D]/$|0,y[D]%=$)}return y.reverse()}return function(S,I,$,C,D){var y,O,M,P,B,R,z,W,G=S.indexOf("."),J=i,K=l;for(G>=0&&(P=h,h=0,S=S.replace(".",""),W=new x(I),R=W.pow(S.length-G),h=P,W.c=v(on(gt(R.c),R.e,"0"),10,$,m),W.e=W.c.length),z=v(S,I,$,D?(y=w,m):(y=m,w)),M=P=z.length;z[--P]==0;z.pop());if(!z[0])return y.charAt(0);if(G<0?--M:(R.c=z,R.e=M,R.s=C,R=t(R,W,J,K,$),z=R.c,B=R.r,M=R.e),O=M+J+1,G=z[O],P=$/2,B=B||O<0||z[O+1]!=null,B=K<4?(G!=null||B)&&(K==0||K==(R.s<0?3:2)):G>P||G==P&&(K==4||B||K==6&&z[O-1]&1||K==(R.s<0?8:7)),O<1||!z[0])S=B?on(y.charAt(1),-J,y.charAt(0)):y.charAt(0);else{if(z.length=O,B)for(--$;++z[--O]>$;)z[O]=0,O||(++M,z=[1].concat(z));for(P=z.length;!z[--P];);for(G=0,S="";G<=P;S+=y.charAt(z[G++]));S=on(S,M,y.charAt(0))}return S}}(),t=function(){function m(I,$,C){var D,y,O,M,P=0,B=I.length,R=$%An,z=$/An|0;for(I=I.slice();B--;)O=I[B]%An,M=I[B]/An|0,D=z*O+M*R,y=R*O+D%An*An+P,P=(y/C|0)+(D/An|0)+z*M,I[B]=y%C;return P&&(I=[P].concat(I)),I}function v(I,$,C,D){var y,O;if(C!=D)O=C>D?1:-1;else for(y=O=0;y<C;y++)if(I[y]!=$[y]){O=I[y]>$[y]?1:-1;break}return O}function S(I,$,C,D){for(var y=0;C--;)I[C]-=y,y=I[C]<$[C]?1:0,I[C]=y*D+I[C]-$[C];for(;!I[0]&&I.length>1;I.splice(0,1));}return function(I,$,C,D,y){var O,M,P,B,R,z,W,G,J,K,V,te,me,he,ye,we,oe,_=I.s==$.s?1:-1,Y=I.c,Q=$.c;if(!Y||!Y[0]||!Q||!Q[0])return new x(!I.s||!$.s||(Y?Q&&Y[0]==Q[0]:!Q)?NaN:Y&&Y[0]==0||!Q?_*0:_/0);for(G=new x(_),J=G.c=[],M=I.e-$.e,_=C+M+1,y||(y=$t,M=bt(I.e/ae)-bt($.e/ae),_=_/ae|0),P=0;Q[P]==(Y[P]||0);P++);if(Q[P]>(Y[P]||0)&&M--,_<0)J.push(1),B=!0;else{for(he=Y.length,we=Q.length,P=0,_+=2,R=mt(y/(Q[0]+1)),R>1&&(Q=m(Q,R,y),Y=m(Y,R,y),we=Q.length,he=Y.length),me=we,K=Y.slice(0,we),V=K.length;V<we;K[V++]=0);oe=Q.slice(),oe=[0].concat(oe),ye=Q[0],Q[1]>=y/2&&ye++;do{if(R=0,O=v(Q,K,we,V),O<0){if(te=K[0],we!=V&&(te=te*y+(K[1]||0)),R=mt(te/ye),R>1)for(R>=y&&(R=y-1),z=m(Q,R,y),W=z.length,V=K.length;v(z,K,W,V)==1;)R--,S(z,we<W?oe:Q,W,y),W=z.length,O=1;else R==0&&(O=R=1),z=Q.slice(),W=z.length;if(W<V&&(z=[0].concat(z)),S(K,z,V,y),V=K.length,O==-1)for(;v(Q,K,we,V)<1;)R++,S(K,we<V?oe:Q,V,y),V=K.length}else O===0&&(R++,K=[0]);J[P++]=R,K[0]?K[V++]=Y[me]||0:(K=[Y[me]],V=1)}while((me++<he||K[0]!=null)&&_--);B=K[0]!=null,J[0]||J.splice(0,1)}if(y==$t){for(P=1,_=J[0];_>=10;_/=10,P++);F(G,C+(G.e=P+M*ae-1)+1,D,B)}else G.e=M,G.r=+B;return G}}();function E(m,v,S,I){var $,C,D,y,O;if(S==null?S=l:Pe(S,0,8),!m.c)return m.toString();if($=m.c[0],D=m.e,v==null)O=gt(m.c),O=I==1||I==2&&(D<=a||D>=c)?gs(O,D):on(O,D,"0");else if(m=F(new x(m),v,S),C=m.e,O=gt(m.c),y=O.length,I==1||I==2&&(v<=C||C<=a)){for(;y<v;O+="0",y++);O=gs(O,C)}else if(v-=D+(I===2&&C>D),O=on(O,C,"0"),C+1>y){if(--v>0)for(O+=".";v--;O+="0");}else if(v+=C-y,v>0)for(C+1==y&&(O+=".");v--;O+="0");return m.s<0&&$?"-"+O:O}function A(m,v){for(var S,I,$=1,C=new x(m[0]);$<m.length;$++)I=new x(m[$]),(!I.s||(S=Hn(C,I))===v||S===0&&C.s===v)&&(C=I);return C}function k(m,v,S){for(var I=1,$=v.length;!v[--$];v.pop());for($=v[0];$>=10;$/=10,I++);return(S=I+S*ae-1)>f?m.c=m.e=null:S<u?m.c=[m.e=0]:(m.e=S,m.c=v),m}r=function(){var m=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,S=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,$=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(C,D,y,O){var M,P=y?D:D.replace($,"");if(I.test(P))C.s=isNaN(P)?null:P<0?-1:1;else{if(!y&&(P=P.replace(m,function(B,R,z){return M=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!O||O==M?R:B}),O&&(M=O,P=P.replace(v,"$1").replace(S,"0.$1")),D!=P))return new x(P,M);if(x.DEBUG)throw Error(Ze+"Not a"+(O?" base "+O:"")+" number: "+D);C.s=null}C.c=C.e=null}}();function F(m,v,S,I){var $,C,D,y,O,M,P,B=m.c,R=_i;if(B){e:{for($=1,y=B[0];y>=10;y/=10,$++);if(C=v-$,C<0)C+=ae,D=v,O=B[M=0],P=mt(O/R[$-D-1]%10);else if(M=Ui((C+1)/ae),M>=B.length)if(I){for(;B.length<=M;B.push(0));O=P=0,$=1,C%=ae,D=C-ae+1}else break e;else{for(O=y=B[M],$=1;y>=10;y/=10,$++);C%=ae,D=C-ae+$,P=D<0?0:mt(O/R[$-D-1]%10)}if(I=I||v<0||B[M+1]!=null||(D<0?O:O%R[$-D-1]),I=S<4?(P||I)&&(S==0||S==(m.s<0?3:2)):P>5||P==5&&(S==4||I||S==6&&(C>0?D>0?O/R[$-D]:0:B[M-1])%10&1||S==(m.s<0?8:7)),v<1||!B[0])return B.length=0,I?(v-=m.e+1,B[0]=R[(ae-v%ae)%ae],m.e=-v||0):B[0]=m.e=0,m;if(C==0?(B.length=M,y=1,M--):(B.length=M+1,y=R[ae-C],B[M]=D>0?mt(O/R[$-D]%R[D])*y:0),I)for(;;)if(M==0){for(C=1,D=B[0];D>=10;D/=10,C++);for(D=B[0]+=y,y=1;D>=10;D/=10,y++);C!=y&&(m.e++,B[0]==$t&&(B[0]=1));break}else{if(B[M]+=y,B[M]!=$t)break;B[M--]=0,y=1}for(C=B.length;B[--C]===0;B.pop());}m.e>f?m.c=m.e=null:m.e<u&&(m.c=[m.e=0])}return m}function L(m){var v,S=m.e;return S===null?m.toString():(v=gt(m.c),v=S<=a||S>=c?gs(v,S):on(v,S,"0"),m.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var m=new x(this);return m.s<0&&(m.s=1),m},o.comparedTo=function(m,v){return Hn(this,new x(m,v))},o.decimalPlaces=o.dp=function(m,v){var S,I,$,C=this;if(m!=null)return Pe(m,0,Fe),v==null?v=l:Pe(v,0,8),F(new x(C),m+C.e+1,v);if(!(S=C.c))return null;if(I=(($=S.length-1)-bt(this.e/ae))*ae,$=S[$])for(;$%10==0;$/=10,I--);return I<0&&(I=0),I},o.dividedBy=o.div=function(m,v){return t(this,new x(m,v),i,l)},o.dividedToIntegerBy=o.idiv=function(m,v){return t(this,new x(m,v),0,1)},o.exponentiatedBy=o.pow=function(m,v){var S,I,$,C,D,y,O,M,P,B=this;if(m=new x(m),m.c&&!m.isInteger())throw Error(Ze+"Exponent not an integer: "+L(m));if(v!=null&&(v=new x(v)),y=m.e>14,!B.c||!B.c[0]||B.c[0]==1&&!B.e&&B.c.length==1||!m.c||!m.c[0])return P=new x(Math.pow(+L(B),y?m.s*(2-bs(m)):+L(m))),v?P.mod(v):P;if(O=m.s<0,v){if(v.c?!v.c[0]:!v.s)return new x(NaN);I=!O&&B.isInteger()&&v.isInteger(),I&&(B=B.mod(v))}else{if(m.e>9&&(B.e>0||B.e<-1||(B.e==0?B.c[0]>1||y&&B.c[1]>=24e7:B.c[0]<8e13||y&&B.c[0]<=9999975e7)))return C=B.s<0&&bs(m)?-0:0,B.e>-1&&(C=1/C),new x(O?1/C:C);h&&(C=Ui(h/ae+2))}for(y?(S=new x(.5),O&&(m.s=1),M=bs(m)):($=Math.abs(+L(m)),M=$%2),P=new x(s);;){if(M){if(P=P.times(B),!P.c)break;C?P.c.length>C&&(P.c.length=C):I&&(P=P.mod(v))}if($){if($=mt($/2),$===0)break;M=$%2}else if(m=m.times(S),F(m,m.e+1,1),m.e>14)M=bs(m);else{if($=+L(m),$===0)break;M=$%2}B=B.times(B),C?B.c&&B.c.length>C&&(B.c.length=C):I&&(B=B.mod(v))}return I?P:(O&&(P=s.div(P)),v?P.mod(v):C?F(P,h,l,D):P)},o.integerValue=function(m){var v=new x(this);return m==null?m=l:Pe(m,0,8),F(v,v.e+1,m)},o.isEqualTo=o.eq=function(m,v){return Hn(this,new x(m,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(m,v){return Hn(this,new x(m,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(m,v){return(v=Hn(this,new x(m,v)))===1||v===0},o.isInteger=function(){return!!this.c&&bt(this.e/ae)>this.c.length-2},o.isLessThan=o.lt=function(m,v){return Hn(this,new x(m,v))<0},o.isLessThanOrEqualTo=o.lte=function(m,v){return(v=Hn(this,new x(m,v)))===-1||v===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(m,v){var S,I,$,C,D=this,y=D.s;if(m=new x(m,v),v=m.s,!y||!v)return new x(NaN);if(y!=v)return m.s=-v,D.plus(m);var O=D.e/ae,M=m.e/ae,P=D.c,B=m.c;if(!O||!M){if(!P||!B)return P?(m.s=-v,m):new x(B?D:NaN);if(!P[0]||!B[0])return B[0]?(m.s=-v,m):new x(P[0]?D:l==3?-0:0)}if(O=bt(O),M=bt(M),P=P.slice(),y=O-M){for((C=y<0)?(y=-y,$=P):(M=O,$=B),$.reverse(),v=y;v--;$.push(0));$.reverse()}else for(I=(C=(y=P.length)<(v=B.length))?y:v,y=v=0;v<I;v++)if(P[v]!=B[v]){C=P[v]<B[v];break}if(C&&($=P,P=B,B=$,m.s=-m.s),v=(I=B.length)-(S=P.length),v>0)for(;v--;P[S++]=0);for(v=$t-1;I>y;){if(P[--I]<B[I]){for(S=I;S&&!P[--S];P[S]=v);--P[S],P[I]+=$t}P[I]-=B[I]}for(;P[0]==0;P.splice(0,1),--M);return P[0]?k(m,P,M):(m.s=l==3?-1:1,m.c=[m.e=0],m)},o.modulo=o.mod=function(m,v){var S,I,$=this;return m=new x(m,v),!$.c||!m.s||m.c&&!m.c[0]?new x(NaN):!m.c||$.c&&!$.c[0]?new x($):(d==9?(I=m.s,m.s=1,S=t($,m,0,3),m.s=I,S.s*=I):S=t($,m,0,d),m=$.minus(S.times(m)),!m.c[0]&&d==1&&(m.s=$.s),m)},o.multipliedBy=o.times=function(m,v){var S,I,$,C,D,y,O,M,P,B,R,z,W,G,J,K=this,V=K.c,te=(m=new x(m,v)).c;if(!V||!te||!V[0]||!te[0])return!K.s||!m.s||V&&!V[0]&&!te||te&&!te[0]&&!V?m.c=m.e=m.s=null:(m.s*=K.s,!V||!te?m.c=m.e=null:(m.c=[0],m.e=0)),m;for(I=bt(K.e/ae)+bt(m.e/ae),m.s*=K.s,O=V.length,B=te.length,O<B&&(W=V,V=te,te=W,$=O,O=B,B=$),$=O+B,W=[];$--;W.push(0));for(G=$t,J=An,$=B;--$>=0;){for(S=0,R=te[$]%J,z=te[$]/J|0,D=O,C=$+D;C>$;)M=V[--D]%J,P=V[D]/J|0,y=z*M+P*R,M=R*M+y%J*J+W[C]+S,S=(M/G|0)+(y/J|0)+z*P,W[C--]=M%G;W[C]=S}return S?++I:W.splice(0,1),k(m,W,I)},o.negated=function(){var m=new x(this);return m.s=-m.s||null,m},o.plus=function(m,v){var S,I=this,$=I.s;if(m=new x(m,v),v=m.s,!$||!v)return new x(NaN);if($!=v)return m.s=-v,I.minus(m);var C=I.e/ae,D=m.e/ae,y=I.c,O=m.c;if(!C||!D){if(!y||!O)return new x($/0);if(!y[0]||!O[0])return O[0]?m:new x(y[0]?I:$*0)}if(C=bt(C),D=bt(D),y=y.slice(),$=C-D){for($>0?(D=C,S=O):($=-$,S=y),S.reverse();$--;S.push(0));S.reverse()}for($=y.length,v=O.length,$-v<0&&(S=O,O=y,y=S,v=$),$=0;v;)$=(y[--v]=y[v]+O[v]+$)/$t|0,y[v]=$t===y[v]?0:y[v]%$t;return $&&(y=[$].concat(y),++D),k(m,y,D)},o.precision=o.sd=function(m,v){var S,I,$,C=this;if(m!=null&&m!==!!m)return Pe(m,1,Fe),v==null?v=l:Pe(v,0,8),F(new x(C),m,v);if(!(S=C.c))return null;if($=S.length-1,I=$*ae+1,$=S[$]){for(;$%10==0;$/=10,I--);for($=S[0];$>=10;$/=10,I++);}return m&&C.e+1>I&&(I=C.e+1),I},o.shiftedBy=function(m){return Pe(m,-Wi,Wi),this.times("1e"+m)},o.squareRoot=o.sqrt=function(){var m,v,S,I,$,C=this,D=C.c,y=C.s,O=C.e,M=i+4,P=new x("0.5");if(y!==1||!D||!D[0])return new x(!y||y<0&&(!D||D[0])?NaN:D?C:1/0);if(y=Math.sqrt(+L(C)),y==0||y==1/0?(v=gt(D),(v.length+O)%2==0&&(v+="0"),y=Math.sqrt(+v),O=bt((O+1)/2)-(O<0||O%2),y==1/0?v="5e"+O:(v=y.toExponential(),v=v.slice(0,v.indexOf("e")+1)+O),S=new x(v)):S=new x(y+""),S.c[0]){for(O=S.e,y=O+M,y<3&&(y=0);;)if($=S,S=P.times($.plus(t(C,$,M,1))),gt($.c).slice(0,y)===(v=gt(S.c)).slice(0,y))if(S.e<O&&--y,v=v.slice(y-3,y+1),v=="9999"||!I&&v=="4999"){if(!I&&(F($,$.e+i+2,0),$.times($).eq(C))){S=$;break}M+=4,y+=4,I=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(F(S,S.e+i+2,1),m=!S.times(S).eq(C));break}}return F(S,S.e+i+1,l,m)},o.toExponential=function(m,v){return m!=null&&(Pe(m,0,Fe),m++),E(this,m,v,1)},o.toFixed=function(m,v){return m!=null&&(Pe(m,0,Fe),m=m+this.e+1),E(this,m,v)},o.toFormat=function(m,v,S){var I,$=this;if(S==null)m!=null&&v&&typeof v=="object"?(S=v,v=null):m&&typeof m=="object"?(S=m,m=v=null):S=b;else if(typeof S!="object")throw Error(Ze+"Argument not an object: "+S);if(I=$.toFixed(m,v),$.c){var C,D=I.split("."),y=+S.groupSize,O=+S.secondaryGroupSize,M=S.groupSeparator||"",P=D[0],B=D[1],R=$.s<0,z=R?P.slice(1):P,W=z.length;if(O&&(C=y,y=O,O=C,W-=C),y>0&&W>0){for(C=W%y||y,P=z.substr(0,C);C<W;C+=y)P+=M+z.substr(C,y);O>0&&(P+=M+z.slice(C)),R&&(P="-"+P)}I=B?P+(S.decimalSeparator||"")+((O=+S.fractionGroupSize)?B.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+(S.fractionGroupSeparator||"")):B):P}return(S.prefix||"")+I+(S.suffix||"")},o.toFraction=function(m){var v,S,I,$,C,D,y,O,M,P,B,R,z=this,W=z.c;if(m!=null&&(y=new x(m),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(Ze+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+L(y));if(!W)return new x(z);for(v=new x(s),M=S=new x(s),I=O=new x(s),R=gt(W),C=v.e=R.length-z.e-1,v.c[0]=_i[(D=C%ae)<0?ae+D:D],m=!m||y.comparedTo(v)>0?C>0?v:M:y,D=f,f=1/0,y=new x(R),O.c[0]=0;P=t(y,v,0,1),$=S.plus(P.times(I)),$.comparedTo(m)!=1;)S=I,I=$,M=O.plus(P.times($=M)),O=$,v=y.minus(P.times($=v)),y=$;return $=t(m.minus(S),I,0,1),O=O.plus($.times(M)),S=S.plus($.times(I)),O.s=M.s=z.s,C=C*2,B=t(M,I,C,l).minus(z).abs().comparedTo(t(O,S,C,l).minus(z).abs())<1?[M,I]:[O,S],f=D,B},o.toNumber=function(){return+L(this)},o.toPrecision=function(m,v){return m!=null&&Pe(m,1,Fe),E(this,m,v,2)},o.toString=function(m){var v,S=this,I=S.s,$=S.e;return $===null?I?(v="Infinity",I<0&&(v="-"+v)):v="NaN":(m==null?v=$<=a||$>=c?gs(gt(S.c),$):on(gt(S.c),$,"0"):m===10&&T?(S=F(new x(S),i+$+1,l),v=on(gt(S.c),S.e,"0")):(Pe(m,2,w.length,"Base"),v=n(on(gt(S.c),$,"0"),10,m,I,!0)),I<0&&S.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return L(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&x.set(e),x}function bt(e){var t=e|0;return e>0||e===t?t:t-1}function gt(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ae-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Hn(e,t){var n,r,o=e.c,s=t.c,i=e.s,l=t.s,a=e.e,c=t.e;if(!i||!l)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-l:i;if(i!=l)return i;if(n=i<0,r=a==c,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>c^n?1:-1;for(l=(a=o.length)<(c=s.length)?a:c,i=0;i<l;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==c?0:a>c^n?1:-1}function Pe(e,t,n,r){if(e<t||e>n||e!==mt(e))throw Error(Ze+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function bs(e){var t=e.c.length-1;return bt(e.e/ae)==t&&e.c[t]%2!=0}function gs(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function on(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var ke=iu();const gb=(e,t=6)=>{try{const n=new ke(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,ke.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const l=(s||"").padEnd(t,"0");return`${i}.${l}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},It=()=>{const{translations:e,currentLocale:t}=ou();return{t:(s,i)=>{try{const l=s.split(".");let a=e;for(const u of l)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let c=typeof a=="string"?a:s;return i&&typeof c=="string"&&Object.keys(i).forEach(u=>{const f=`{{${u}}}`;c=c.replace(new RegExp(f,"g"),String(i[u]))}),c}catch(l){return console.warn(`Translation error for key "${s}":`,l),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return{};return typeof l=="object"?l:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return!1;return typeof l=="string"}catch{return!1}}}},yb="1.2.3";let Ye=class Xc extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Xc?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Xc&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${yb}`].join(`
51
- `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function sn(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const au=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,lu=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,cu=/^\(.+?\).*?$/,uu=/^tuple(?<array>(\[(\d*)\])*)$/;function Vi(e){let t=e.type;if(uu.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o<n;o++){const s=e.components[o];t+=Vi(s),o<n-1&&(t+=", ")}const r=sn(uu,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,Vi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function mr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Vi(o),r!==n-1&&(t+=", ")}return t}function ys(e){var t;return e.type==="function"?`function ${e.name}(${mr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${mr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${mr(e.inputs)})`:e.type==="error"?`error ${e.name}(${mr(e.inputs)})`:e.type==="constructor"?`constructor(${mr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const fu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function wb(e){return fu.test(e)}function vb(e){return sn(fu,e)}const du=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function xb(e){return du.test(e)}function Eb(e){return sn(du,e)}const pu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Sb(e){return pu.test(e)}function Pb(e){return sn(pu,e)}const hu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function ws(e){return hu.test(e)}function Tb(e){return sn(hu,e)}const mu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Ab(e){return mu.test(e)}function Nb(e){return sn(mu,e)}const bu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Ob(e){return bu.test(e)}function Cb(e){return sn(bu,e)}const $b=/^receive\(\) external payable$/;function Ib(e){return $b.test(e)}const gu=new Set(["memory","indexed","storage","calldata"]),Mb=new Set(["indexed"]),Hi=new Set(["calldata","memory","storage"]);class Db extends Ye{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class kb extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Bb extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Lb extends Ye{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class Fb extends Ye{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Rb extends Ye{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class jb extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class zb extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Ub extends Ye{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class br extends Ye{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Wb extends Ye{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class _b extends Ye{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Vb extends Ye{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Hb extends Ye{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Gb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const Gi=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function qi(e,t={}){if(Sb(e))return qb(e,t);if(xb(e))return Kb(e,t);if(wb(e))return Zb(e,t);if(Ab(e))return Yb(e,t);if(Ob(e))return Xb(e);if(Ib(e))return{type:"receive",stateMutability:"payable"};throw new Wb({signature:e})}function qb(e,t={}){const n=Pb(e);if(!n)throw new br({signature:e,type:"function"});const r=ut(n.parameters),o=[],s=r.length;for(let l=0;l<s;l++)o.push(an(r[l],{modifiers:Hi,structs:t,type:"function"}));const i=[];if(n.returns){const l=ut(n.returns),a=l.length;for(let c=0;c<a;c++)i.push(an(l[c],{modifiers:Hi,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Kb(e,t={}){const n=Eb(e);if(!n)throw new br({signature:e,type:"event"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{modifiers:Mb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Zb(e,t={}){const n=vb(e);if(!n)throw new br({signature:e,type:"error"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Yb(e,t={}){const n=Nb(e);if(!n)throw new br({signature:e,type:"constructor"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Xb(e){const t=Cb(e);if(!t)throw new br({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Jb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Qb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,e1=/^u?int$/;function an(e,t){var f,p;const n=Gb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Gi.has(n))return Gi.get(n);const r=cu.test(e),o=sn(r?Qb:Jb,e);if(!o)throw new Fb({param:e});if(o.name&&n1(o.name))throw new Rb({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},l=(t==null?void 0:t.structs)??{};let a,c={};if(r){a="tuple";const d=ut(o.type),h=[],b=d.length;for(let w=0;w<b;w++)h.push(an(d[w],{structs:l}));c={components:h}}else if(o.type in l)a="tuple",c={components:l[o.type]};else if(e1.test(o.type))a=`${o.type}256`;else if(o.type==="address payable")a="address";else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!yu(a))throw new Bb({type:a});if(o.modifier){if(!((p=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&p.call(f,o.modifier)))throw new jb({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Hi.has(o.modifier)&&!r1(a,!!o.array))throw new zb({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...c};return Gi.set(n,u),u}function ut(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],l=e.slice(s+1);switch(i){case",":return r===0?ut(l,[...t,n.trim()]):ut(l,t,`${n}${i}`,r);case"(":return ut(l,t,`${n}${i}`,r+1);case")":return ut(l,t,`${n}${i}`,r-1);default:return ut(l,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Hb({current:n,depth:r});return t.push(n.trim()),t}function yu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||au.test(e)||lu.test(e)}const t1=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function n1(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||au.test(e)||lu.test(e)||t1.test(e)}function r1(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Ki(e){const t={},n=e.length;for(let i=0;i<n;i++){const l=e[i];if(!ws(l))continue;const a=Tb(l);if(!a)throw new br({signature:l,type:"struct"});const c=a.properties.split(";"),u=[],f=c.length;for(let p=0;p<f;p++){const h=c[p].trim();if(!h)continue;const b=an(h,{type:"struct"});u.push(b)}if(!u.length)throw new _b({signature:l});t[a.name]=u}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[l,a]=o[i];r[l]=wu(a,t)}return r}const o1=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function wu(e=[],t={},n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(cu.test(i.type))r.push(i);else{const a=sn(o1,i.type);if(!(a!=null&&a.type))throw new Ub({abiParameter:i});const{array:c,type:u}=a;if(u in t){if(n.has(u))throw new Vb({type:u});r.push({...i,type:`tuple${c??""}`,components:wu(t[u],t,new Set([...n,u]))})}else if(yu(u))r.push(i);else throw new kb({type:u})}}return r}function vu(e){const t=Ki(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];ws(s)||n.push(qi(s,t))}return n}function xu(e){let t;if(typeof e=="string")t=qi(e);else{const n=Ki(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!ws(s)){t=qi(s,n);break}}}if(!t)throw new Db({signature:e});return t}function Eu(e){const t=[];if(typeof e=="string"){const n=ut(e),r=n.length;for(let o=0;o<r;o++)t.push(an(n[o],{modifiers:gu}))}else{const n=Ki(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(ws(s))continue;const i=ut(s),l=i.length;for(let a=0;a<l;a++)t.push(an(i[a],{modifiers:gu,structs:n}))}}if(t.length===0)throw new Lb({params:e});return t}function ee(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function Mt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new y1(e.type);return`${e.name}(${vs(e.inputs,{includeName:t})})`}function vs(e,{includeName:t=!1}={}){return e?e.map(n=>s1(n,{includeName:t})).join(t?", ":","):""}function s1(e,{includeName:t}){return e.type.startsWith("tuple")?`(${vs(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Dt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Te(e){return Dt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Su="2.47.2";let no={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Su}`},H=class Jc extends Error{constructor(t,n={}){var l;const r=(()=>{var a;return n.cause instanceof Jc?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Jc&&n.cause.docsPath||n.docsPath,s=(l=no.getDocsUrl)==null?void 0:l.call(no,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...no.version?[`Version: ${no.version}`]:[]].join(`
52
- `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Su}walk(t){return Pu(this,t)}};function Pu(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Pu(e.cause,t):t?null:e}class i1 extends H{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
53
- `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Tu extends H{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
54
- `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Au extends H{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
55
- `),{metaMessages:[`Params: (${vs(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class ro extends H{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class a1 extends H{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
56
- `),{name:"AbiEncodingArrayLengthMismatchError"})}}class l1 extends H{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Te(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class c1 extends H{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
57
- `),{name:"AbiEncodingLengthMismatchError"})}}class u1 extends H{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
58
- `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Nu extends H{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
59
- `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Ou extends H{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
60
- `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class f1 extends H{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class d1 extends H{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
61
- `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Cu extends H{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
62
- `),{docsPath:n,name:"AbiEventNotFoundError"})}}class gr extends H{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
63
- `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class $u extends H{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
64
- `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class p1 extends H{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
65
- `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class h1 extends H{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Mt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Mt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let m1=class extends H{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class xs extends H{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
66
- `),{metaMessages:[`Params: (${vs(r,{includeName:!0})})`,`Data: ${n} (${o} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=n,this.params=r,this.size=o}}class Zi extends H{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Mt(t,{includeName:!0})}".`].join(`
67
- `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class b1 extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
68
- `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class g1 extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
69
- `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Iu=class extends H{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
70
- `),{name:"InvalidArrayError"})}};class y1 extends H{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
71
- `),{name:"InvalidDefinitionTypeError"})}}class w1 extends H{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Mu=class extends H{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Du=class extends H{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class ku extends H{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function yr(e,{dir:t,size:n=32}={}){return typeof e=="string"?Nn(e,{dir:t,size:n}):v1(e,{dir:t,size:n})}function Nn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Du({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function v1(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Du({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let o=0;o<n;o++){const s=t==="right";r[s?o:n-o-1]=e[s?o:e.length-o-1]}return r}let Yi=class extends H{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},x1=class extends H{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};class E1 extends H{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let S1=class extends H{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Gn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function kt(e,{size:t}){if(Te(e)>t)throw new S1({givenSize:Te(e),maxSize:t})}function Gt(e,t={}){const{signed:n}=t;t.size&&kt(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function P1(e,t={}){let n=e;if(t.size&&(kt(n,{size:t.size}),n=Gn(n)),Gn(n)==="0x00")return!1;if(Gn(n)==="0x01")return!0;throw new E1(n)}function ln(e,t={}){const n=Gt(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new Yi({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const T1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function On(e,t={}){return typeof e=="number"||typeof e=="bigint"?ne(e,t):typeof e=="string"?oo(e,t):typeof e=="boolean"?Bu(e,t):Be(e,t)}function Bu(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(kt(n,{size:t.size}),yr(n,{size:t.size})):n}function Be(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=T1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(kt(r,{size:t.size}),yr(r,{dir:"right",size:t.size})):r}function ne(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new Yi({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const l=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?yr(l,{size:r}):l}const A1=new TextEncoder;function oo(e,t={}){const n=A1.encode(e);return Be(n,t)}const N1=new TextEncoder;function wr(e,t={}){return typeof e=="number"||typeof e=="bigint"?C1(e,t):typeof e=="boolean"?O1(e,t):Dt(e)?qt(e,t):qn(e,t)}function O1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(kt(n,{size:t.size}),yr(n,{size:t.size})):n}const cn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Lu(e){if(e>=cn.zero&&e<=cn.nine)return e-cn.zero;if(e>=cn.A&&e<=cn.F)return e-(cn.A-10);if(e>=cn.a&&e<=cn.f)return e-(cn.a-10)}function qt(e,t={}){let n=e;t.size&&(kt(n,{size:t.size}),n=yr(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,l=0;i<o;i++){const a=Lu(r.charCodeAt(l++)),c=Lu(r.charCodeAt(l++));if(a===void 0||c===void 0)throw new H(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);s[i]=a*16+c}return s}function C1(e,t){const n=ne(e,t);return qt(n)}function qn(e,t={}){const n=N1.encode(e);return typeof t.size=="number"?(kt(n,{size:t.size}),yr(n,{dir:"right",size:t.size})):n}const Es=BigInt(2**32-1),Fu=BigInt(32);function $1(e,t=!1){return t?{h:Number(e&Es),l:Number(e>>Fu&Es)}:{h:Number(e>>Fu&Es)|0,l:Number(e&Es)|0}}function I1(e,t=!1){const n=e.length;let r=new Uint32Array(n),o=new Uint32Array(n);for(let s=0;s<n;s++){const{h:i,l}=$1(e[s],t);[r[s],o[s]]=[i,l]}return[r,o]}const M1=(e,t,n)=>e<<n|t>>>32-n,D1=(e,t,n)=>t<<n|e>>>32-n,k1=(e,t,n)=>t<<n-32|e>>>64-n,B1=(e,t,n)=>e<<n-32|t>>>64-n,vr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function L1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function so(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Kn(e,...t){if(!L1(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 F1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");so(e.outputLen),so(e.blockLen)}function xr(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 Ru(e,t){Kn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function R1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Er(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Xi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Kt(e,t){return e<<32-t|e>>>t}const j1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function z1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function U1(e){for(let t=0;t<e.length;t++)e[t]=z1(e[t]);return e}const ju=j1?e=>e:U1;function W1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ss(e){return typeof e=="string"&&(e=W1(e)),Kn(e),e}function _1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Kn(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class Ji{}function zu(e){const t=r=>e().update(Ss(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function V1(e=32){if(vr&&typeof vr.getRandomValues=="function")return vr.getRandomValues(new Uint8Array(e));if(vr&&typeof vr.randomBytes=="function")return Uint8Array.from(vr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const H1=BigInt(0),io=BigInt(1),G1=BigInt(2),q1=BigInt(7),K1=BigInt(256),Z1=BigInt(113),Uu=[],Wu=[],_u=[];for(let e=0,t=io,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Uu.push(2*(5*r+n)),Wu.push((e+1)*(e+2)/2%64);let o=H1;for(let s=0;s<7;s++)t=(t<<io^(t>>q1)*Z1)%K1,t&G1&&(o^=io<<(io<<BigInt(s))-io);_u.push(o)}const Vu=I1(_u,!0),Y1=Vu[0],X1=Vu[1],Hu=(e,t,n)=>n>32?k1(e,t,n):M1(e,t,n),Gu=(e,t,n)=>n>32?B1(e,t,n):D1(e,t,n);function J1(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const l=(i+8)%10,a=(i+2)%10,c=n[a],u=n[a+1],f=Hu(c,u,1)^n[l],p=Gu(c,u,1)^n[l+1];for(let d=0;d<50;d+=10)e[i+d]^=f,e[i+d+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const l=Wu[i],a=Hu(o,s,l),c=Gu(o,s,l),u=Uu[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=c}for(let i=0;i<50;i+=10){for(let l=0;l<10;l++)n[l]=e[i+l];for(let l=0;l<10;l++)e[i+l]^=~n[(l+2)%10]&n[(l+4)%10]}e[0]^=Y1[r],e[1]^=X1[r]}Er(n)}class Qi extends Ji{constructor(t,n,r,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,so(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=R1(this.state)}clone(){return this._cloneInto()}keccak(){ju(this.state32),J1(this.state32,this.rounds),ju(this.state32),this.posOut=0,this.pos=0}update(t){xr(this),t=Ss(t),Kn(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let l=0;l<i;l++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){xr(this,!1),Kn(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return so(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ru(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Er(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Qi(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const Q1=(e,t,n)=>zu(()=>new Qi(t,e,n)),qu=Q1(1,136,256/8);function ze(e,t){const n=t||"hex",r=qu(Dt(e,{strict:!1})?wr(e):e);return n==="bytes"?r:On(r)}const eg=e=>ze(wr(e));function tg(e){return eg(e)}function ng(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new H("Unable to normalize signature.");return o}const rg=e=>{const t=typeof e=="string"?e:ys(e);return ng(t)};function Ku(e){return tg(rg(e))}const Ps=Ku;let Cn=class extends H{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},Ts=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const ea=new Ts(8192);function As(e,t){if(ea.has(`${e}.${t}`))return ea.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=ze(qn(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return ea.set(`${e}.${t}`,s),s}function un(e,t){if(!yt(e,{strict:!1}))throw new Cn({address:e});return As(e,t)}const og=/^0x[a-fA-F0-9]{40}$/,ta=new Ts(8192);function yt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(ta.has(r))return ta.get(r);const o=og.test(e)?e.toLowerCase()===e?!0:n?As(e)===e:!0:!1;return ta.set(r,o),o}function Bt(e){return typeof e[0]=="string"?Sr(e):sg(e)}function sg(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function Sr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Zn(e,t,n,{strict:r}={}){return Dt(e,{strict:!1})?ig(e,t,n,{strict:r}):Xu(e,t,n,{strict:r})}function Zu(e,t){if(typeof t=="number"&&t>0&&t>Te(e)-1)throw new Mu({offset:t,position:"start",size:Te(e)})}function Yu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Te(e)!==n-t)throw new Mu({offset:n,position:"end",size:Te(e)})}function Xu(e,t,n,{strict:r}={}){Zu(e,t);const o=e.slice(t,n);return r&&Yu(o,t,n),o}function ig(e,t,n,{strict:r}={}){Zu(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Yu(o,t,n),o}const ag=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ju=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function $n(e,t){if(e.length!==t.length)throw new c1({expectedLength:e.length,givenLength:t.length});const n=lg({params:e,values:t}),r=ra(n);return r.length===0?"0x":r}function lg({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(na({param:e[r],value:t[r]}));return n}function na({param:e,value:t}){const n=oa(e.type);if(n){const[r,o]=n;return ug(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return mg(t,{param:e});if(e.type==="address")return cg(t);if(e.type==="bool")return dg(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=Ju.exec(e.type)??[];return pg(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return fg(t,{param:e});if(e.type==="string")return hg(t);throw new b1(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function ra(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=Te(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(ne(t+o,{size:32})),r.push(l),o+=Te(l)):n.push(l)}return Bt([...n,...r])}function cg(e){if(!yt(e))throw new Cn({address:e});return{dynamic:!1,encoded:Nn(e.toLowerCase())}}function ug(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Iu(e);if(!r&&e.length!==t)throw new a1({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const l=na({param:n,value:e[i]});l.dynamic&&(o=!0),s.push(l)}if(r||o){const i=ra(s);if(r){const l=ne(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Bt([l,i]):l}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Bt(s.map(({encoded:i})=>i))}}function fg(e,{param:t}){const[,n]=t.type.split("bytes"),r=Te(e);if(!n){let o=e;return r%32!==0&&(o=Nn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Bt([Nn(ne(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new l1({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Nn(e,{dir:"right"})}}function dg(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Nn(Bu(e))}}function pg(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new Yi({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:ne(e,{size:32,signed:t})}}function hg(e){const t=oo(e),n=Math.ceil(Te(t)/32),r=[];for(let o=0;o<n;o++)r.push(Nn(Zn(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Bt([Nn(ne(Te(t),{size:32})),...r])}}function mg(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,l=na({param:s,value:e[i]});r.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?ra(r):Bt(r.map(({encoded:o})=>o))}}function oa(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const ao=e=>Zn(Ku(e),0,4);function Yn(e){const{abi:t,args:n=[],name:r}=e,o=Dt(r,{strict:!1}),s=t.filter(l=>o?l.type==="function"?ao(l)===r:l.type==="event"?Ps(l)===r:!1:"name"in l&&l.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const l of s){if(!("inputs"in l))continue;if(!n||n.length===0){if(!l.inputs||l.inputs.length===0)return l;continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==n.length)continue;if(n.every((c,u)=>{const f="inputs"in l&&l.inputs[u];return f?sa(c,f):!1})){if(i&&"inputs"in i&&i.inputs){const c=Qu(l.inputs,i.inputs,n);if(c)throw new h1({abiItem:l,type:c[0]},{abiItem:i,type:c[1]})}i=l}}return i||s[0]}function sa(e,t){const n=typeof e,r=t.type;switch(r){case"address":return yt(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>n==="object"&&sa(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>sa(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Qu(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return Qu(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?yt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?yt(n[r],{strict:!1}):!1)return i}}const ef="/docs/contract/encodeEventTopics";function lo(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const c=Yn({abi:t,name:n});if(!c)throw new Cu(n,{docsPath:ef});o=c}if(o.type!=="event")throw new Cu(void 0,{docsPath:ef});const s=Mt(o),i=Ps(s);let l=[];if(r&&"inputs"in o){const c=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(c==null?void 0:c.map(f=>r[f.name]))??[]:[];u.length>0&&(l=(c==null?void 0:c.map((f,p)=>Array.isArray(u[p])?u[p].map((d,h)=>tf({param:f,value:u[p][h]})):typeof u[p]<"u"&&u[p]!==null?tf({param:f,value:u[p]}):null))??[])}return[i,...l]}function tf({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return ze(wr(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new w1(e.type);return $n([e],[t])}function Ns(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:l,transport:a})=>{l==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function nf(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:l,toBlock:a}=t,c=Ns(e,{method:"eth_newFilter"}),u=s?lo({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?ne(i):i,toBlock:typeof a=="bigint"?ne(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:c(f),strict:!!l,type:"event"}}function ft(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const rf="/docs/contract/encodeFunctionData";function bg(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Yn({abi:t,args:n,name:r});if(!s)throw new gr(r,{docsPath:rf});o=s}if(o.type!=="function")throw new gr(void 0,{docsPath:rf});return{abi:[o],functionName:ao(Mt(o))}}function wt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var l;return e.abi.length===1&&((l=e.functionName)!=null&&l.startsWith("0x"))?e:bg(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?$n(o.inputs,t??[]):void 0;return Sr([s,i??"0x"])}const gg={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},of={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},yg={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let sf=class extends H{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},af=class extends H{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},wg=class extends H{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const vg={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new wg({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new af({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new sf({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new sf({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function ia(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(vg);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function xg(e,t={}){typeof t.size<"u"&&kt(e,{size:t.size});const n=Be(e,t);return Gt(n,t)}function Eg(e,t={}){let n=e;if(typeof t.size<"u"&&(kt(n,{size:t.size}),n=Gn(n)),n.length>1||n[0]>1)throw new x1(n);return!!n[0]}function fn(e,t={}){typeof t.size<"u"&&kt(e,{size:t.size});const n=Be(e,t);return ln(n,t)}function Sg(e,t={}){let n=e;return typeof t.size<"u"&&(kt(n,{size:t.size}),n=Gn(n,{dir:"right"})),new TextDecoder().decode(n)}function co(e,t){const n=typeof t=="string"?qt(t):t,r=ia(n);if(Te(n)===0&&e.length>0)throw new ro;if(Te(t)&&Te(t)<32)throw new Au({data:typeof t=="string"?t:Be(t),params:e,size:Te(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const l=e[i];r.setPosition(o);const[a,c]=Pr(r,l,{staticPosition:0});o+=c,s.push(a)}return s}function Pr(e,t,{staticPosition:n}){const r=oa(t.type);if(r){const[o,s]=r;return Tg(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return Cg(e,t,{staticPosition:n});if(t.type==="address")return Pg(e);if(t.type==="bool")return Ag(e);if(t.type.startsWith("bytes"))return Ng(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Og(e,t);if(t.type==="string")return $g(e,{staticPosition:n});throw new g1(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const lf=32,aa=32;function Pg(e){const t=e.readBytes(32);return[As(Be(Xu(t,-20))),32]}function Tg(e,t,{length:n,staticPosition:r}){if(!n){const i=fn(e.readBytes(aa)),l=r+i,a=l+lf;e.setPosition(l);const c=fn(e.readBytes(lf)),u=uo(t);let f=0;const p=[];for(let d=0;d<c;++d){e.setPosition(a+(u?d*32:f));const[h,b]=Pr(e,t,{staticPosition:a});f+=b,p.push(h)}return e.setPosition(r+32),[p,32]}if(uo(t)){const i=fn(e.readBytes(aa)),l=r+i,a=[];for(let c=0;c<n;++c){e.setPosition(l+c*32);const[u]=Pr(e,t,{staticPosition:l});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[l,a]=Pr(e,t,{staticPosition:r+o});o+=a,s.push(l)}return[s,o]}function Ag(e){return[Eg(e.readBytes(32),{size:32}),32]}function Ng(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=fn(e.readBytes(32));e.setPosition(n+i);const l=fn(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[Be(a),32]}return[Be(e.readBytes(Number.parseInt(o,10),32)),32]}function Og(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?xg(o,{signed:n}):fn(o,{signed:n}),32]}function Cg(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(uo(t)){const i=fn(e.readBytes(aa)),l=n+i;for(let a=0;a<t.components.length;++a){const c=t.components[a];e.setPosition(l+s);const[u,f]=Pr(e,c,{staticPosition:l});s+=f,o[r?a:c==null?void 0:c.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const l=t.components[i],[a,c]=Pr(e,l,{staticPosition:n});o[r?i:l==null?void 0:l.name]=a,s+=c}return[o,s]}function $g(e,{staticPosition:t}){const n=fn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=fn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=Sg(Gn(s));return e.setPosition(t+32),[i,32]}function uo(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(uo);const n=oa(e.type);return!!(n&&uo({...e,type:n[1]}))}function cf(e){const{abi:t,data:n}=e,r=Zn(n,0,4);if(r==="0x")throw new ro;const s=[...t||[],of,yg].find(i=>i.type==="error"&&r===ao(Mt(i)));if(!s)throw new Ou(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?co(s.inputs,Zn(n,4)):void 0,errorName:s.name}}const Le=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function uf({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((o,s)=>`${r&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Le(t[s]):t[s]}`).join(", ")})`}const Ig={gwei:9,wei:18},Mg={ether:-9,wei:9};function la(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${s?`.${s}`:""}`}function ca(e,t="wei"){return la(e,Ig[t])}function Xe(e,t="wei"){return la(e,Mg[t])}class Dg extends H{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class kg extends H{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function ff(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
72
- `,"")}function Bg(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
50
+ 跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",feeRateTooltip:"預估手續費,以實際扣除為準。",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。",depositModeSwitchWarning:"當您發起充值後或正在充值中時請勿切換充值模式,以免導致您的充值方式發生變更",connectedWalletTitle:"從已連接錢包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他錢包進行充值",externalWalletTitle:"從外部錢包充值",externalWalletDesc:"從 Binance 或其他交易所、Arbitrum 等鏈或其他錢包轉帳",or:"或"},withdraw:{noticeDesc:"在您發起提領請求後,將於 Layer2 進行處理。資金準備就緒後(通常在 4 小時內),您將收到通知,將資金提領至您的錢包。",noticeDescWithClaim:"在您發起提領請求後,將於 Layer2 進行處理。資金準備就緒後(通常在 4 小時內),您將收到通知,將資金提領至您的錢包。您需進行領取操作並填寫提現地址,以完成整個提現流程。",externalWalletEthNoticeDesc:"在您發起提領請求後,將於 Layer2 進行處理。資金準備就緒後(通常在 4 小時內),您將收到通知,將資金提領至您的錢包。您需自行承擔提現過程中產生的所有 Gas 費用。",crossChainTips:"跨鏈提現需要 L2 驗證(透過 ZK 證明),通常需要 5 分鐘至 2 小時。",crossChainTipsWithGas:"跨鏈提現需要 L2 驗證(透過 ZK 證明),通常需要 5 分鐘至 2 小時。您需自行承擔提現過程中產生的所有 Gas 費用。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",largeWithdrawFeeTip:"提現手續費為0.015%,將從提現金額中扣除。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。",connectedWalletTitle:"提現至已連接錢包",connectedWalletDesc:"將資金提現至您已連接的加密錢包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提現至外部帳戶",externalWalletDesc:"將資金提現至 Binance 或其他交易所、Arbitrum 等鏈及其他錢包"},account:{title:"帳戶",perp:"合約帳戶","perpetual-v1":"合約V1賬戶","perpetual-v2":"合約V2賬戶",spot:"現貨帳戶"}},Ui=["en-US","ja-JP","ru-RU","zh-CN","zh-TW","de-DE","es-LA","fr-FR","it-IT"],ru={"en-US":ib,"ja-JP":ub,"ru-RU":db,"zh-CN":fb,"zh-TW":pb,"de-DE":sb,"es-LA":ab,"fr-FR":lb,"it-IT":cb},bs="en-US",hb={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский","de-DE":"Deutsch","es-LA":"Español (Latinoamérica)","fr-FR":"Français","it-IT":"Italiano"},mb=e=>Ui.includes(e)?ru[e]:ru[bs],bb=e=>Ui.includes(e),ou=g.createContext(null),gb=({config:e,children:t})=>{const n=g.useMemo(()=>{const r=e.locale||bs,o=bb(r)?r:bs,s=mb(o);return{...e,currentLocale:o,translations:s}},[e]);return N.jsx(ou.Provider,{value:n,children:t})},su=()=>{const e=g.useContext(ou);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var yb=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Wi=Math.ceil,mt=Math.floor,Ze="[BigNumber Error] ",iu=Ze+"Number primitive has more than 15 significant digits: ",$t=1e14,ae=14,_i=9007199254740991,Vi=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],An=1e7,Fe=1e9;function au(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},s=new w(1),i=20,l=4,a=-7,c=21,u=-1e7,d=1e7,p=!1,f=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function w(b,v){var E,I,$,C,D,y,O,M,S=this;if(!(S instanceof w))return new w(b,v);if(v==null){if(b&&b._isBigNumber===!0){S.s=b.s,!b.c||b.e>d?S.c=S.e=null:b.e<u?S.c=[S.e=0]:(S.e=b.e,S.c=b.c.slice());return}if((y=typeof b=="number")&&b*0==0){if(S.s=1/b<0?(b=-b,-1):1,b===~~b){for(C=0,D=b;D>=10;D/=10,C++);C>d?S.c=S.e=null:(S.e=C,S.c=[b]);return}M=String(b)}else{if(!yb.test(M=String(b)))return r(S,M,y);S.s=M.charCodeAt(0)==45?(M=M.slice(1),-1):1}(C=M.indexOf("."))>-1&&(M=M.replace(".","")),(D=M.search(/e/i))>0?(C<0&&(C=D),C+=+M.slice(D+1),M=M.substring(0,D)):C<0&&(C=M.length)}else{if(Pe(v,2,x.length,"Base"),v==10&&T)return S=new w(b),B(S,i+S.e+1,l);if(M=String(b),y=typeof b=="number"){if(b*0!=0)return r(S,M,y,v);if(S.s=1/b<0?(M=M.slice(1),-1):1,w.DEBUG&&M.replace(/^0\.0*|\./,"").length>15)throw Error(iu+b)}else S.s=M.charCodeAt(0)===45?(M=M.slice(1),-1):1;for(E=x.slice(0,v),C=D=0,O=M.length;D<O;D++)if(E.indexOf(I=M.charAt(D))<0){if(I=="."){if(D>C){C=O;continue}}else if(!$&&(M==M.toUpperCase()&&(M=M.toLowerCase())||M==M.toLowerCase()&&(M=M.toUpperCase()))){$=!0,D=-1,C=0;continue}return r(S,String(b),y,v)}y=!1,M=n(M,v,10,S.s),(C=M.indexOf("."))>-1?M=M.replace(".",""):C=M.length}for(D=0;M.charCodeAt(D)===48;D++);for(O=M.length;M.charCodeAt(--O)===48;);if(M=M.slice(D,++O)){if(O-=D,y&&w.DEBUG&&O>15&&(b>_i||b!==mt(b)))throw Error(iu+S.s*b);if((C=C-D-1)>d)S.c=S.e=null;else if(C<u)S.c=[S.e=0];else{if(S.e=C,S.c=[],D=(C+1)%ae,C<0&&(D+=ae),D<O){for(D&&S.c.push(+M.slice(0,D)),O-=ae;D<O;)S.c.push(+M.slice(D,D+=ae));D=ae-(M=M.slice(D)).length}else D-=O;for(;D--;M+="0");S.c.push(+M)}}else S.c=[S.e=0]}w.clone=au,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(b){var v,E;if(b!=null)if(typeof b=="object"){if(b.hasOwnProperty(v="DECIMAL_PLACES")&&(E=b[v],Pe(E,0,Fe,v),i=E),b.hasOwnProperty(v="ROUNDING_MODE")&&(E=b[v],Pe(E,0,8,v),l=E),b.hasOwnProperty(v="EXPONENTIAL_AT")&&(E=b[v],E&&E.pop?(Pe(E[0],-Fe,0,v),Pe(E[1],0,Fe,v),a=E[0],c=E[1]):(Pe(E,-Fe,Fe,v),a=-(c=E<0?-E:E))),b.hasOwnProperty(v="RANGE"))if(E=b[v],E&&E.pop)Pe(E[0],-Fe,-1,v),Pe(E[1],1,Fe,v),u=E[0],d=E[1];else if(Pe(E,-Fe,Fe,v),E)u=-(d=E<0?-E:E);else throw Error(Ze+v+" cannot be zero: "+E);if(b.hasOwnProperty(v="CRYPTO"))if(E=b[v],E===!!E)if(E)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=E;else throw p=!E,Error(Ze+"crypto unavailable");else p=E;else throw Error(Ze+v+" not true or false: "+E);if(b.hasOwnProperty(v="MODULO_MODE")&&(E=b[v],Pe(E,0,9,v),f=E),b.hasOwnProperty(v="POW_PRECISION")&&(E=b[v],Pe(E,0,Fe,v),h=E),b.hasOwnProperty(v="FORMAT"))if(E=b[v],typeof E=="object")m=E;else throw Error(Ze+v+" not an object: "+E);if(b.hasOwnProperty(v="ALPHABET"))if(E=b[v],typeof E=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(E))T=E.slice(0,10)=="0123456789",x=E;else throw Error(Ze+v+" invalid: "+E)}else throw Error(Ze+"Object expected: "+b);return{DECIMAL_PLACES:i,ROUNDING_MODE:l,EXPONENTIAL_AT:[a,c],RANGE:[u,d],CRYPTO:p,MODULO_MODE:f,POW_PRECISION:h,FORMAT:m,ALPHABET:x}},w.isBigNumber=function(b){if(!b||b._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var v,E,I=b.c,$=b.e,C=b.s;e:if({}.toString.call(I)=="[object Array]"){if((C===1||C===-1)&&$>=-Fe&&$<=Fe&&$===mt($)){if(I[0]===0){if($===0&&I.length===1)return!0;break e}if(v=($+1)%ae,v<1&&(v+=ae),String(I[0]).length==v){for(v=0;v<I.length;v++)if(E=I[v],E<0||E>=$t||E!==mt(E))break e;if(E!==0)return!0}}}else if(I===null&&$===null&&(C===null||C===1||C===-1))return!0;throw Error(Ze+"Invalid BigNumber: "+b)},w.maximum=w.max=function(){return A(arguments,-1)},w.minimum=w.min=function(){return A(arguments,1)},w.random=function(){var b=9007199254740992,v=Math.random()*b&2097151?function(){return mt(Math.random()*b)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(E){var I,$,C,D,y,O=0,M=[],S=new w(s);if(E==null?E=i:Pe(E,0,Fe),D=Wi(E/ae),p)if(crypto.getRandomValues){for(I=crypto.getRandomValues(new Uint32Array(D*=2));O<D;)y=I[O]*131072+(I[O+1]>>>11),y>=9e15?($=crypto.getRandomValues(new Uint32Array(2)),I[O]=$[0],I[O+1]=$[1]):(M.push(y%1e14),O+=2);O=D/2}else if(crypto.randomBytes){for(I=crypto.randomBytes(D*=7);O<D;)y=(I[O]&31)*281474976710656+I[O+1]*1099511627776+I[O+2]*4294967296+I[O+3]*16777216+(I[O+4]<<16)+(I[O+5]<<8)+I[O+6],y>=9e15?crypto.randomBytes(7).copy(I,O):(M.push(y%1e14),O+=7);O=D/7}else throw p=!1,Error(Ze+"crypto unavailable");if(!p)for(;O<D;)y=v(),y<9e15&&(M[O++]=y%1e14);for(D=M[--O],E%=ae,D&&E&&(y=Vi[ae-E],M[O]=mt(D/y)*y);M[O]===0;M.pop(),O--);if(O<0)M=[C=0];else{for(C=-1;M[0]===0;M.splice(0,1),C-=ae);for(O=1,y=M[0];y>=10;y/=10,O++);O<ae&&(C-=ae-O)}return S.e=C,S.c=M,S}}(),w.sum=function(){for(var b=1,v=arguments,E=new w(v[0]);b<v.length;)E=E.plus(v[b++]);return E},n=function(){var b="0123456789";function v(E,I,$,C){for(var D,y=[0],O,M=0,S=E.length;M<S;){for(O=y.length;O--;y[O]*=I);for(y[0]+=C.indexOf(E.charAt(M++)),D=0;D<y.length;D++)y[D]>$-1&&(y[D+1]==null&&(y[D+1]=0),y[D+1]+=y[D]/$|0,y[D]%=$)}return y.reverse()}return function(E,I,$,C,D){var y,O,M,S,L,j,z,W,_=E.indexOf("."),Z=i,q=l;for(_>=0&&(S=h,h=0,E=E.replace(".",""),W=new w(I),j=W.pow(E.length-_),h=S,W.c=v(on(gt(j.c),j.e,"0"),10,$,b),W.e=W.c.length),z=v(E,I,$,D?(y=x,b):(y=b,x)),M=S=z.length;z[--S]==0;z.pop());if(!z[0])return y.charAt(0);if(_<0?--M:(j.c=z,j.e=M,j.s=C,j=t(j,W,Z,q,$),z=j.c,L=j.r,M=j.e),O=M+Z+1,_=z[O],S=$/2,L=L||O<0||z[O+1]!=null,L=q<4?(_!=null||L)&&(q==0||q==(j.s<0?3:2)):_>S||_==S&&(q==4||L||q==6&&z[O-1]&1||q==(j.s<0?8:7)),O<1||!z[0])E=L?on(y.charAt(1),-Z,y.charAt(0)):y.charAt(0);else{if(z.length=O,L)for(--$;++z[--O]>$;)z[O]=0,O||(++M,z=[1].concat(z));for(S=z.length;!z[--S];);for(_=0,E="";_<=S;E+=y.charAt(z[_++]));E=on(E,M,y.charAt(0))}return E}}(),t=function(){function b(I,$,C){var D,y,O,M,S=0,L=I.length,j=$%An,z=$/An|0;for(I=I.slice();L--;)O=I[L]%An,M=I[L]/An|0,D=z*O+M*j,y=j*O+D%An*An+S,S=(y/C|0)+(D/An|0)+z*M,I[L]=y%C;return S&&(I=[S].concat(I)),I}function v(I,$,C,D){var y,O;if(C!=D)O=C>D?1:-1;else for(y=O=0;y<C;y++)if(I[y]!=$[y]){O=I[y]>$[y]?1:-1;break}return O}function E(I,$,C,D){for(var y=0;C--;)I[C]-=y,y=I[C]<$[C]?1:0,I[C]=y*D+I[C]-$[C];for(;!I[0]&&I.length>1;I.splice(0,1));}return function(I,$,C,D,y){var O,M,S,L,j,z,W,_,Z,q,H,ee,fe,me,ye,ve,oe,V=I.s==$.s?1:-1,X=I.c,Q=$.c;if(!X||!X[0]||!Q||!Q[0])return new w(!I.s||!$.s||(X?Q&&X[0]==Q[0]:!Q)?NaN:X&&X[0]==0||!Q?V*0:V/0);for(_=new w(V),Z=_.c=[],M=I.e-$.e,V=C+M+1,y||(y=$t,M=bt(I.e/ae)-bt($.e/ae),V=V/ae|0),S=0;Q[S]==(X[S]||0);S++);if(Q[S]>(X[S]||0)&&M--,V<0)Z.push(1),L=!0;else{for(me=X.length,ve=Q.length,S=0,V+=2,j=mt(y/(Q[0]+1)),j>1&&(Q=b(Q,j,y),X=b(X,j,y),ve=Q.length,me=X.length),fe=ve,q=X.slice(0,ve),H=q.length;H<ve;q[H++]=0);oe=Q.slice(),oe=[0].concat(oe),ye=Q[0],Q[1]>=y/2&&ye++;do{if(j=0,O=v(Q,q,ve,H),O<0){if(ee=q[0],ve!=H&&(ee=ee*y+(q[1]||0)),j=mt(ee/ye),j>1)for(j>=y&&(j=y-1),z=b(Q,j,y),W=z.length,H=q.length;v(z,q,W,H)==1;)j--,E(z,ve<W?oe:Q,W,y),W=z.length,O=1;else j==0&&(O=j=1),z=Q.slice(),W=z.length;if(W<H&&(z=[0].concat(z)),E(q,z,H,y),H=q.length,O==-1)for(;v(Q,q,ve,H)<1;)j++,E(q,ve<H?oe:Q,H,y),H=q.length}else O===0&&(j++,q=[0]);Z[S++]=j,q[0]?q[H++]=X[fe]||0:(q=[X[fe]],H=1)}while((fe++<me||q[0]!=null)&&V--);L=q[0]!=null,Z[0]||Z.splice(0,1)}if(y==$t){for(S=1,V=Z[0];V>=10;V/=10,S++);B(_,C+(_.e=S+M*ae-1)+1,D,L)}else _.e=M,_.r=+L;return _}}();function P(b,v,E,I){var $,C,D,y,O;if(E==null?E=l:Pe(E,0,8),!b.c)return b.toString();if($=b.c[0],D=b.e,v==null)O=gt(b.c),O=I==1||I==2&&(D<=a||D>=c)?ys(O,D):on(O,D,"0");else if(b=B(new w(b),v,E),C=b.e,O=gt(b.c),y=O.length,I==1||I==2&&(v<=C||C<=a)){for(;y<v;O+="0",y++);O=ys(O,C)}else if(v-=D+(I===2&&C>D),O=on(O,C,"0"),C+1>y){if(--v>0)for(O+=".";v--;O+="0");}else if(v+=C-y,v>0)for(C+1==y&&(O+=".");v--;O+="0");return b.s<0&&$?"-"+O:O}function A(b,v){for(var E,I,$=1,C=new w(b[0]);$<b.length;$++)I=new w(b[$]),(!I.s||(E=Hn(C,I))===v||E===0&&C.s===v)&&(C=I);return C}function k(b,v,E){for(var I=1,$=v.length;!v[--$];v.pop());for($=v[0];$>=10;$/=10,I++);return(E=I+E*ae-1)>d?b.c=b.e=null:E<u?b.c=[b.e=0]:(b.e=E,b.c=v),b}r=function(){var b=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,E=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,$=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(C,D,y,O){var M,S=y?D:D.replace($,"");if(I.test(S))C.s=isNaN(S)?null:S<0?-1:1;else{if(!y&&(S=S.replace(b,function(L,j,z){return M=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!O||O==M?j:L}),O&&(M=O,S=S.replace(v,"$1").replace(E,"0.$1")),D!=S))return new w(S,M);if(w.DEBUG)throw Error(Ze+"Not a"+(O?" base "+O:"")+" number: "+D);C.s=null}C.c=C.e=null}}();function B(b,v,E,I){var $,C,D,y,O,M,S,L=b.c,j=Vi;if(L){e:{for($=1,y=L[0];y>=10;y/=10,$++);if(C=v-$,C<0)C+=ae,D=v,O=L[M=0],S=mt(O/j[$-D-1]%10);else if(M=Wi((C+1)/ae),M>=L.length)if(I){for(;L.length<=M;L.push(0));O=S=0,$=1,C%=ae,D=C-ae+1}else break e;else{for(O=y=L[M],$=1;y>=10;y/=10,$++);C%=ae,D=C-ae+$,S=D<0?0:mt(O/j[$-D-1]%10)}if(I=I||v<0||L[M+1]!=null||(D<0?O:O%j[$-D-1]),I=E<4?(S||I)&&(E==0||E==(b.s<0?3:2)):S>5||S==5&&(E==4||I||E==6&&(C>0?D>0?O/j[$-D]:0:L[M-1])%10&1||E==(b.s<0?8:7)),v<1||!L[0])return L.length=0,I?(v-=b.e+1,L[0]=j[(ae-v%ae)%ae],b.e=-v||0):L[0]=b.e=0,b;if(C==0?(L.length=M,y=1,M--):(L.length=M+1,y=j[ae-C],L[M]=D>0?mt(O/j[$-D]%j[D])*y:0),I)for(;;)if(M==0){for(C=1,D=L[0];D>=10;D/=10,C++);for(D=L[0]+=y,y=1;D>=10;D/=10,y++);C!=y&&(b.e++,L[0]==$t&&(L[0]=1));break}else{if(L[M]+=y,L[M]!=$t)break;L[M--]=0,y=1}for(C=L.length;L[--C]===0;L.pop());}b.e>d?b.c=b.e=null:b.e<u&&(b.c=[b.e=0])}return b}function F(b){var v,E=b.e;return E===null?b.toString():(v=gt(b.c),v=E<=a||E>=c?ys(v,E):on(v,E,"0"),b.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var b=new w(this);return b.s<0&&(b.s=1),b},o.comparedTo=function(b,v){return Hn(this,new w(b,v))},o.decimalPlaces=o.dp=function(b,v){var E,I,$,C=this;if(b!=null)return Pe(b,0,Fe),v==null?v=l:Pe(v,0,8),B(new w(C),b+C.e+1,v);if(!(E=C.c))return null;if(I=(($=E.length-1)-bt(this.e/ae))*ae,$=E[$])for(;$%10==0;$/=10,I--);return I<0&&(I=0),I},o.dividedBy=o.div=function(b,v){return t(this,new w(b,v),i,l)},o.dividedToIntegerBy=o.idiv=function(b,v){return t(this,new w(b,v),0,1)},o.exponentiatedBy=o.pow=function(b,v){var E,I,$,C,D,y,O,M,S,L=this;if(b=new w(b),b.c&&!b.isInteger())throw Error(Ze+"Exponent not an integer: "+F(b));if(v!=null&&(v=new w(v)),y=b.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!b.c||!b.c[0])return S=new w(Math.pow(+F(L),y?b.s*(2-gs(b)):+F(b))),v?S.mod(v):S;if(O=b.s<0,v){if(v.c?!v.c[0]:!v.s)return new w(NaN);I=!O&&L.isInteger()&&v.isInteger(),I&&(L=L.mod(v))}else{if(b.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||y&&L.c[1]>=24e7:L.c[0]<8e13||y&&L.c[0]<=9999975e7)))return C=L.s<0&&gs(b)?-0:0,L.e>-1&&(C=1/C),new w(O?1/C:C);h&&(C=Wi(h/ae+2))}for(y?(E=new w(.5),O&&(b.s=1),M=gs(b)):($=Math.abs(+F(b)),M=$%2),S=new w(s);;){if(M){if(S=S.times(L),!S.c)break;C?S.c.length>C&&(S.c.length=C):I&&(S=S.mod(v))}if($){if($=mt($/2),$===0)break;M=$%2}else if(b=b.times(E),B(b,b.e+1,1),b.e>14)M=gs(b);else{if($=+F(b),$===0)break;M=$%2}L=L.times(L),C?L.c&&L.c.length>C&&(L.c.length=C):I&&(L=L.mod(v))}return I?S:(O&&(S=s.div(S)),v?S.mod(v):C?B(S,h,l,D):S)},o.integerValue=function(b){var v=new w(this);return b==null?b=l:Pe(b,0,8),B(v,v.e+1,b)},o.isEqualTo=o.eq=function(b,v){return Hn(this,new w(b,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(b,v){return Hn(this,new w(b,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(b,v){return(v=Hn(this,new w(b,v)))===1||v===0},o.isInteger=function(){return!!this.c&&bt(this.e/ae)>this.c.length-2},o.isLessThan=o.lt=function(b,v){return Hn(this,new w(b,v))<0},o.isLessThanOrEqualTo=o.lte=function(b,v){return(v=Hn(this,new w(b,v)))===-1||v===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(b,v){var E,I,$,C,D=this,y=D.s;if(b=new w(b,v),v=b.s,!y||!v)return new w(NaN);if(y!=v)return b.s=-v,D.plus(b);var O=D.e/ae,M=b.e/ae,S=D.c,L=b.c;if(!O||!M){if(!S||!L)return S?(b.s=-v,b):new w(L?D:NaN);if(!S[0]||!L[0])return L[0]?(b.s=-v,b):new w(S[0]?D:l==3?-0:0)}if(O=bt(O),M=bt(M),S=S.slice(),y=O-M){for((C=y<0)?(y=-y,$=S):(M=O,$=L),$.reverse(),v=y;v--;$.push(0));$.reverse()}else for(I=(C=(y=S.length)<(v=L.length))?y:v,y=v=0;v<I;v++)if(S[v]!=L[v]){C=S[v]<L[v];break}if(C&&($=S,S=L,L=$,b.s=-b.s),v=(I=L.length)-(E=S.length),v>0)for(;v--;S[E++]=0);for(v=$t-1;I>y;){if(S[--I]<L[I]){for(E=I;E&&!S[--E];S[E]=v);--S[E],S[I]+=$t}S[I]-=L[I]}for(;S[0]==0;S.splice(0,1),--M);return S[0]?k(b,S,M):(b.s=l==3?-1:1,b.c=[b.e=0],b)},o.modulo=o.mod=function(b,v){var E,I,$=this;return b=new w(b,v),!$.c||!b.s||b.c&&!b.c[0]?new w(NaN):!b.c||$.c&&!$.c[0]?new w($):(f==9?(I=b.s,b.s=1,E=t($,b,0,3),b.s=I,E.s*=I):E=t($,b,0,f),b=$.minus(E.times(b)),!b.c[0]&&f==1&&(b.s=$.s),b)},o.multipliedBy=o.times=function(b,v){var E,I,$,C,D,y,O,M,S,L,j,z,W,_,Z,q=this,H=q.c,ee=(b=new w(b,v)).c;if(!H||!ee||!H[0]||!ee[0])return!q.s||!b.s||H&&!H[0]&&!ee||ee&&!ee[0]&&!H?b.c=b.e=b.s=null:(b.s*=q.s,!H||!ee?b.c=b.e=null:(b.c=[0],b.e=0)),b;for(I=bt(q.e/ae)+bt(b.e/ae),b.s*=q.s,O=H.length,L=ee.length,O<L&&(W=H,H=ee,ee=W,$=O,O=L,L=$),$=O+L,W=[];$--;W.push(0));for(_=$t,Z=An,$=L;--$>=0;){for(E=0,j=ee[$]%Z,z=ee[$]/Z|0,D=O,C=$+D;C>$;)M=H[--D]%Z,S=H[D]/Z|0,y=z*M+S*j,M=j*M+y%Z*Z+W[C]+E,E=(M/_|0)+(y/Z|0)+z*S,W[C--]=M%_;W[C]=E}return E?++I:W.splice(0,1),k(b,W,I)},o.negated=function(){var b=new w(this);return b.s=-b.s||null,b},o.plus=function(b,v){var E,I=this,$=I.s;if(b=new w(b,v),v=b.s,!$||!v)return new w(NaN);if($!=v)return b.s=-v,I.minus(b);var C=I.e/ae,D=b.e/ae,y=I.c,O=b.c;if(!C||!D){if(!y||!O)return new w($/0);if(!y[0]||!O[0])return O[0]?b:new w(y[0]?I:$*0)}if(C=bt(C),D=bt(D),y=y.slice(),$=C-D){for($>0?(D=C,E=O):($=-$,E=y),E.reverse();$--;E.push(0));E.reverse()}for($=y.length,v=O.length,$-v<0&&(E=O,O=y,y=E,v=$),$=0;v;)$=(y[--v]=y[v]+O[v]+$)/$t|0,y[v]=$t===y[v]?0:y[v]%$t;return $&&(y=[$].concat(y),++D),k(b,y,D)},o.precision=o.sd=function(b,v){var E,I,$,C=this;if(b!=null&&b!==!!b)return Pe(b,1,Fe),v==null?v=l:Pe(v,0,8),B(new w(C),b,v);if(!(E=C.c))return null;if($=E.length-1,I=$*ae+1,$=E[$]){for(;$%10==0;$/=10,I--);for($=E[0];$>=10;$/=10,I++);}return b&&C.e+1>I&&(I=C.e+1),I},o.shiftedBy=function(b){return Pe(b,-_i,_i),this.times("1e"+b)},o.squareRoot=o.sqrt=function(){var b,v,E,I,$,C=this,D=C.c,y=C.s,O=C.e,M=i+4,S=new w("0.5");if(y!==1||!D||!D[0])return new w(!y||y<0&&(!D||D[0])?NaN:D?C:1/0);if(y=Math.sqrt(+F(C)),y==0||y==1/0?(v=gt(D),(v.length+O)%2==0&&(v+="0"),y=Math.sqrt(+v),O=bt((O+1)/2)-(O<0||O%2),y==1/0?v="5e"+O:(v=y.toExponential(),v=v.slice(0,v.indexOf("e")+1)+O),E=new w(v)):E=new w(y+""),E.c[0]){for(O=E.e,y=O+M,y<3&&(y=0);;)if($=E,E=S.times($.plus(t(C,$,M,1))),gt($.c).slice(0,y)===(v=gt(E.c)).slice(0,y))if(E.e<O&&--y,v=v.slice(y-3,y+1),v=="9999"||!I&&v=="4999"){if(!I&&(B($,$.e+i+2,0),$.times($).eq(C))){E=$;break}M+=4,y+=4,I=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(B(E,E.e+i+2,1),b=!E.times(E).eq(C));break}}return B(E,E.e+i+1,l,b)},o.toExponential=function(b,v){return b!=null&&(Pe(b,0,Fe),b++),P(this,b,v,1)},o.toFixed=function(b,v){return b!=null&&(Pe(b,0,Fe),b=b+this.e+1),P(this,b,v)},o.toFormat=function(b,v,E){var I,$=this;if(E==null)b!=null&&v&&typeof v=="object"?(E=v,v=null):b&&typeof b=="object"?(E=b,b=v=null):E=m;else if(typeof E!="object")throw Error(Ze+"Argument not an object: "+E);if(I=$.toFixed(b,v),$.c){var C,D=I.split("."),y=+E.groupSize,O=+E.secondaryGroupSize,M=E.groupSeparator||"",S=D[0],L=D[1],j=$.s<0,z=j?S.slice(1):S,W=z.length;if(O&&(C=y,y=O,O=C,W-=C),y>0&&W>0){for(C=W%y||y,S=z.substr(0,C);C<W;C+=y)S+=M+z.substr(C,y);O>0&&(S+=M+z.slice(C)),j&&(S="-"+S)}I=L?S+(E.decimalSeparator||"")+((O=+E.fractionGroupSize)?L.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+(E.fractionGroupSeparator||"")):L):S}return(E.prefix||"")+I+(E.suffix||"")},o.toFraction=function(b){var v,E,I,$,C,D,y,O,M,S,L,j,z=this,W=z.c;if(b!=null&&(y=new w(b),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(Ze+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+F(y));if(!W)return new w(z);for(v=new w(s),M=E=new w(s),I=O=new w(s),j=gt(W),C=v.e=j.length-z.e-1,v.c[0]=Vi[(D=C%ae)<0?ae+D:D],b=!b||y.comparedTo(v)>0?C>0?v:M:y,D=d,d=1/0,y=new w(j),O.c[0]=0;S=t(y,v,0,1),$=E.plus(S.times(I)),$.comparedTo(b)!=1;)E=I,I=$,M=O.plus(S.times($=M)),O=$,v=y.minus(S.times($=v)),y=$;return $=t(b.minus(E),I,0,1),O=O.plus($.times(M)),E=E.plus($.times(I)),O.s=M.s=z.s,C=C*2,L=t(M,I,C,l).minus(z).abs().comparedTo(t(O,E,C,l).minus(z).abs())<1?[M,I]:[O,E],d=D,L},o.toNumber=function(){return+F(this)},o.toPrecision=function(b,v){return b!=null&&Pe(b,1,Fe),P(this,b,v,2)},o.toString=function(b){var v,E=this,I=E.s,$=E.e;return $===null?I?(v="Infinity",I<0&&(v="-"+v)):v="NaN":(b==null?v=$<=a||$>=c?ys(gt(E.c),$):on(gt(E.c),$,"0"):b===10&&T?(E=B(new w(E),i+$+1,l),v=on(gt(E.c),E.e,"0")):(Pe(b,2,x.length,"Base"),v=n(on(gt(E.c),$,"0"),10,b,I,!0)),I<0&&E.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return F(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}function bt(e){var t=e|0;return e>0||e===t?t:t-1}function gt(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ae-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Hn(e,t){var n,r,o=e.c,s=t.c,i=e.s,l=t.s,a=e.e,c=t.e;if(!i||!l)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-l:i;if(i!=l)return i;if(n=i<0,r=a==c,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>c^n?1:-1;for(l=(a=o.length)<(c=s.length)?a:c,i=0;i<l;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==c?0:a>c^n?1:-1}function Pe(e,t,n,r){if(e<t||e>n||e!==mt(e))throw Error(Ze+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function gs(e){var t=e.c.length-1;return bt(e.e/ae)==t&&e.c[t]%2!=0}function ys(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function on(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var ke=au();const vb=(e,t=6)=>{try{const n=new ke(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,ke.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const l=(s||"").padEnd(t,"0");return`${i}.${l}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},It=()=>{const{translations:e,currentLocale:t}=su();return{t:(s,i)=>{try{const l=s.split(".");let a=e;for(const u of l)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let c=typeof a=="string"?a:s;return i&&typeof c=="string"&&Object.keys(i).forEach(u=>{const d=`{{${u}}}`;c=c.replace(new RegExp(d,"g"),String(i[u]))}),c}catch(l){return console.warn(`Translation error for key "${s}":`,l),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return{};return typeof l=="object"?l:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return!1;return typeof l=="string"}catch{return!1}}}},wb="1.2.3";let Ye=class Jc extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Jc?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Jc&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${wb}`].join(`
51
+ `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function sn(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const lu=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,cu=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,uu=/^\(.+?\).*?$/,du=/^tuple(?<array>(\[(\d*)\])*)$/;function Hi(e){let t=e.type;if(du.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o<n;o++){const s=e.components[o];t+=Hi(s),o<n-1&&(t+=", ")}const r=sn(du,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,Hi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function mr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Hi(o),r!==n-1&&(t+=", ")}return t}function vs(e){var t;return e.type==="function"?`function ${e.name}(${mr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${mr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${mr(e.inputs)})`:e.type==="error"?`error ${e.name}(${mr(e.inputs)})`:e.type==="constructor"?`constructor(${mr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const fu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function xb(e){return fu.test(e)}function Eb(e){return sn(fu,e)}const pu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Sb(e){return pu.test(e)}function Pb(e){return sn(pu,e)}const hu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Tb(e){return hu.test(e)}function Ab(e){return sn(hu,e)}const mu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function ws(e){return mu.test(e)}function Nb(e){return sn(mu,e)}const bu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Cb(e){return bu.test(e)}function Ob(e){return sn(bu,e)}const gu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function $b(e){return gu.test(e)}function Ib(e){return sn(gu,e)}const Mb=/^receive\(\) external payable$/;function Db(e){return Mb.test(e)}const yu=new Set(["memory","indexed","storage","calldata"]),kb=new Set(["indexed"]),Gi=new Set(["calldata","memory","storage"]);class Lb extends Ye{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Bb extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Fb extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Rb extends Ye{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class jb extends Ye{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class zb extends Ye{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Ub extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Wb extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class _b extends Ye{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class br extends Ye{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Vb extends Ye{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Hb extends Ye{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Gb extends Ye{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class qb extends Ye{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Kb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const qi=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Ki(e,t={}){if(Tb(e))return Zb(e,t);if(Sb(e))return Yb(e,t);if(xb(e))return Xb(e,t);if(Cb(e))return Jb(e,t);if($b(e))return Qb(e);if(Db(e))return{type:"receive",stateMutability:"payable"};throw new Vb({signature:e})}function Zb(e,t={}){const n=Ab(e);if(!n)throw new br({signature:e,type:"function"});const r=ut(n.parameters),o=[],s=r.length;for(let l=0;l<s;l++)o.push(an(r[l],{modifiers:Gi,structs:t,type:"function"}));const i=[];if(n.returns){const l=ut(n.returns),a=l.length;for(let c=0;c<a;c++)i.push(an(l[c],{modifiers:Gi,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Yb(e,t={}){const n=Pb(e);if(!n)throw new br({signature:e,type:"event"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{modifiers:kb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Xb(e,t={}){const n=Eb(e);if(!n)throw new br({signature:e,type:"error"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Jb(e,t={}){const n=Ob(e);if(!n)throw new br({signature:e,type:"constructor"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Qb(e){const t=Ib(e);if(!t)throw new br({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const eg=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,tg=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ng=/^u?int$/;function an(e,t){var d,p;const n=Kb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(qi.has(n))return qi.get(n);const r=uu.test(e),o=sn(r?tg:eg,e);if(!o)throw new jb({param:e});if(o.name&&og(o.name))throw new zb({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},l=(t==null?void 0:t.structs)??{};let a,c={};if(r){a="tuple";const f=ut(o.type),h=[],m=f.length;for(let x=0;x<m;x++)h.push(an(f[x],{structs:l}));c={components:h}}else if(o.type in l)a="tuple",c={components:l[o.type]};else if(ng.test(o.type))a=`${o.type}256`;else if(o.type==="address payable")a="address";else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!vu(a))throw new Fb({type:a});if(o.modifier){if(!((p=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&p.call(d,o.modifier)))throw new Ub({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Gi.has(o.modifier)&&!sg(a,!!o.array))throw new Wb({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...c};return qi.set(n,u),u}function ut(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],l=e.slice(s+1);switch(i){case",":return r===0?ut(l,[...t,n.trim()]):ut(l,t,`${n}${i}`,r);case"(":return ut(l,t,`${n}${i}`,r+1);case")":return ut(l,t,`${n}${i}`,r-1);default:return ut(l,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new qb({current:n,depth:r});return t.push(n.trim()),t}function vu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||lu.test(e)||cu.test(e)}const rg=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function og(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||lu.test(e)||cu.test(e)||rg.test(e)}function sg(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Zi(e){const t={},n=e.length;for(let i=0;i<n;i++){const l=e[i];if(!ws(l))continue;const a=Nb(l);if(!a)throw new br({signature:l,type:"struct"});const c=a.properties.split(";"),u=[],d=c.length;for(let p=0;p<d;p++){const h=c[p].trim();if(!h)continue;const m=an(h,{type:"struct"});u.push(m)}if(!u.length)throw new Hb({signature:l});t[a.name]=u}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[l,a]=o[i];r[l]=wu(a,t)}return r}const ig=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function wu(e=[],t={},n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(uu.test(i.type))r.push(i);else{const a=sn(ig,i.type);if(!(a!=null&&a.type))throw new _b({abiParameter:i});const{array:c,type:u}=a;if(u in t){if(n.has(u))throw new Gb({type:u});r.push({...i,type:`tuple${c??""}`,components:wu(t[u],t,new Set([...n,u]))})}else if(vu(u))r.push(i);else throw new Bb({type:u})}}return r}function xu(e){const t=Zi(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];ws(s)||n.push(Ki(s,t))}return n}function Eu(e){let t;if(typeof e=="string")t=Ki(e);else{const n=Zi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!ws(s)){t=Ki(s,n);break}}}if(!t)throw new Lb({signature:e});return t}function Su(e){const t=[];if(typeof e=="string"){const n=ut(e),r=n.length;for(let o=0;o<r;o++)t.push(an(n[o],{modifiers:yu}))}else{const n=Zi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(ws(s))continue;const i=ut(s),l=i.length;for(let a=0;a<l;a++)t.push(an(i[a],{modifiers:yu,structs:n}))}}if(t.length===0)throw new Rb({params:e});return t}function te(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function Mt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new wg(e.type);return`${e.name}(${xs(e.inputs,{includeName:t})})`}function xs(e,{includeName:t=!1}={}){return e?e.map(n=>ag(n,{includeName:t})).join(t?", ":","):""}function ag(e,{includeName:t}){return e.type.startsWith("tuple")?`(${xs(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Dt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Te(e){return Dt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Pu="2.47.2";let no={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Pu}`},G=class Qc extends Error{constructor(t,n={}){var l;const r=(()=>{var a;return n.cause instanceof Qc?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Qc&&n.cause.docsPath||n.docsPath,s=(l=no.getDocsUrl)==null?void 0:l.call(no,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...no.version?[`Version: ${no.version}`]:[]].join(`
52
+ `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Pu}walk(t){return Tu(this,t)}};function Tu(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Tu(e.cause,t):t?null:e}class lg extends G{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
53
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Au extends G{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
54
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Nu extends G{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
55
+ `),{metaMessages:[`Params: (${xs(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class ro extends G{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class cg extends G{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
56
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class ug extends G{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Te(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class dg extends G{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
57
+ `),{name:"AbiEncodingLengthMismatchError"})}}class fg extends G{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
58
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Cu extends G{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
59
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Ou extends G{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
60
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class pg extends G{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class hg extends G{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
61
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class $u extends G{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
62
+ `),{docsPath:n,name:"AbiEventNotFoundError"})}}class gr extends G{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
63
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Iu extends G{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
64
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class mg extends G{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
65
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class bg extends G{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Mt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Mt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let gg=class extends G{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Es extends G{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
66
+ `),{metaMessages:[`Params: (${xs(r,{includeName:!0})})`,`Data: ${n} (${o} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=n,this.params=r,this.size=o}}class Yi extends G{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Mt(t,{includeName:!0})}".`].join(`
67
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class yg extends G{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
68
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class vg extends G{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
69
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Mu=class extends G{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
70
+ `),{name:"InvalidArrayError"})}};class wg extends G{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
71
+ `),{name:"InvalidDefinitionTypeError"})}}class xg extends G{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Du=class extends G{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},ku=class extends G{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Lu extends G{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function yr(e,{dir:t,size:n=32}={}){return typeof e=="string"?Nn(e,{dir:t,size:n}):Eg(e,{dir:t,size:n})}function Nn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new ku({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Eg(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ku({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let o=0;o<n;o++){const s=t==="right";r[s?o:n-o-1]=e[s?o:e.length-o-1]}return r}let Xi=class extends G{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},Sg=class extends G{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};class Pg extends G{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Tg=class extends G{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Gn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function kt(e,{size:t}){if(Te(e)>t)throw new Tg({givenSize:Te(e),maxSize:t})}function Gt(e,t={}){const{signed:n}=t;t.size&&kt(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function Ag(e,t={}){let n=e;if(t.size&&(kt(n,{size:t.size}),n=Gn(n)),Gn(n)==="0x00")return!1;if(Gn(n)==="0x01")return!0;throw new Pg(n)}function ln(e,t={}){const n=Gt(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new Xi({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const Ng=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Cn(e,t={}){return typeof e=="number"||typeof e=="bigint"?ne(e,t):typeof e=="string"?oo(e,t):typeof e=="boolean"?Bu(e,t):Le(e,t)}function Bu(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(kt(n,{size:t.size}),yr(n,{size:t.size})):n}function Le(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ng[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(kt(r,{size:t.size}),yr(r,{dir:"right",size:t.size})):r}function ne(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new Xi({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const l=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?yr(l,{size:r}):l}const Cg=new TextEncoder;function oo(e,t={}){const n=Cg.encode(e);return Le(n,t)}const Og=new TextEncoder;function vr(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ig(e,t):typeof e=="boolean"?$g(e,t):Dt(e)?qt(e,t):qn(e,t)}function $g(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(kt(n,{size:t.size}),yr(n,{size:t.size})):n}const cn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Fu(e){if(e>=cn.zero&&e<=cn.nine)return e-cn.zero;if(e>=cn.A&&e<=cn.F)return e-(cn.A-10);if(e>=cn.a&&e<=cn.f)return e-(cn.a-10)}function qt(e,t={}){let n=e;t.size&&(kt(n,{size:t.size}),n=yr(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,l=0;i<o;i++){const a=Fu(r.charCodeAt(l++)),c=Fu(r.charCodeAt(l++));if(a===void 0||c===void 0)throw new G(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);s[i]=a*16+c}return s}function Ig(e,t){const n=ne(e,t);return qt(n)}function qn(e,t={}){const n=Og.encode(e);return typeof t.size=="number"?(kt(n,{size:t.size}),yr(n,{dir:"right",size:t.size})):n}const Ss=BigInt(2**32-1),Ru=BigInt(32);function Mg(e,t=!1){return t?{h:Number(e&Ss),l:Number(e>>Ru&Ss)}:{h:Number(e>>Ru&Ss)|0,l:Number(e&Ss)|0}}function Dg(e,t=!1){const n=e.length;let r=new Uint32Array(n),o=new Uint32Array(n);for(let s=0;s<n;s++){const{h:i,l}=Mg(e[s],t);[r[s],o[s]]=[i,l]}return[r,o]}const kg=(e,t,n)=>e<<n|t>>>32-n,Lg=(e,t,n)=>t<<n|e>>>32-n,Bg=(e,t,n)=>t<<n-32|e>>>64-n,Fg=(e,t,n)=>e<<n-32|t>>>64-n,wr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Rg(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function so(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Kn(e,...t){if(!Rg(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 jg(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");so(e.outputLen),so(e.blockLen)}function xr(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 ju(e,t){Kn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function zg(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Er(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ji(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Kt(e,t){return e<<32-t|e>>>t}const Ug=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Wg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function _g(e){for(let t=0;t<e.length;t++)e[t]=Wg(e[t]);return e}const zu=Ug?e=>e:_g;function Vg(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ps(e){return typeof e=="string"&&(e=Vg(e)),Kn(e),e}function Hg(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Kn(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class Qi{}function Uu(e){const t=r=>e().update(Ps(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Gg(e=32){if(wr&&typeof wr.getRandomValues=="function")return wr.getRandomValues(new Uint8Array(e));if(wr&&typeof wr.randomBytes=="function")return Uint8Array.from(wr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const qg=BigInt(0),io=BigInt(1),Kg=BigInt(2),Zg=BigInt(7),Yg=BigInt(256),Xg=BigInt(113),Wu=[],_u=[],Vu=[];for(let e=0,t=io,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Wu.push(2*(5*r+n)),_u.push((e+1)*(e+2)/2%64);let o=qg;for(let s=0;s<7;s++)t=(t<<io^(t>>Zg)*Xg)%Yg,t&Kg&&(o^=io<<(io<<BigInt(s))-io);Vu.push(o)}const Hu=Dg(Vu,!0),Jg=Hu[0],Qg=Hu[1],Gu=(e,t,n)=>n>32?Bg(e,t,n):kg(e,t,n),qu=(e,t,n)=>n>32?Fg(e,t,n):Lg(e,t,n);function e1(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const l=(i+8)%10,a=(i+2)%10,c=n[a],u=n[a+1],d=Gu(c,u,1)^n[l],p=qu(c,u,1)^n[l+1];for(let f=0;f<50;f+=10)e[i+f]^=d,e[i+f+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const l=_u[i],a=Gu(o,s,l),c=qu(o,s,l),u=Wu[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=c}for(let i=0;i<50;i+=10){for(let l=0;l<10;l++)n[l]=e[i+l];for(let l=0;l<10;l++)e[i+l]^=~n[(l+2)%10]&n[(l+4)%10]}e[0]^=Jg[r],e[1]^=Qg[r]}Er(n)}class ea extends Qi{constructor(t,n,r,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,so(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=zg(this.state)}clone(){return this._cloneInto()}keccak(){zu(this.state32),e1(this.state32,this.rounds),zu(this.state32),this.posOut=0,this.pos=0}update(t){xr(this),t=Ps(t),Kn(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let l=0;l<i;l++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){xr(this,!1),Kn(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return so(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ju(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Er(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new ea(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const t1=(e,t,n)=>Uu(()=>new ea(t,e,n)),Ku=t1(1,136,256/8);function ze(e,t){const n=t||"hex",r=Ku(Dt(e,{strict:!1})?vr(e):e);return n==="bytes"?r:Cn(r)}const n1=e=>ze(vr(e));function r1(e){return n1(e)}function o1(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new G("Unable to normalize signature.");return o}const s1=e=>{const t=typeof e=="string"?e:vs(e);return o1(t)};function Zu(e){return r1(s1(e))}const Ts=Zu;let On=class extends G{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},As=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const ta=new As(8192);function Ns(e,t){if(ta.has(`${e}.${t}`))return ta.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=ze(qn(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return ta.set(`${e}.${t}`,s),s}function un(e,t){if(!yt(e,{strict:!1}))throw new On({address:e});return Ns(e,t)}const i1=/^0x[a-fA-F0-9]{40}$/,na=new As(8192);function yt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(na.has(r))return na.get(r);const o=i1.test(e)?e.toLowerCase()===e?!0:n?Ns(e)===e:!0:!1;return na.set(r,o),o}function Lt(e){return typeof e[0]=="string"?Sr(e):a1(e)}function a1(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function Sr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Zn(e,t,n,{strict:r}={}){return Dt(e,{strict:!1})?l1(e,t,n,{strict:r}):Ju(e,t,n,{strict:r})}function Yu(e,t){if(typeof t=="number"&&t>0&&t>Te(e)-1)throw new Du({offset:t,position:"start",size:Te(e)})}function Xu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Te(e)!==n-t)throw new Du({offset:n,position:"end",size:Te(e)})}function Ju(e,t,n,{strict:r}={}){Yu(e,t);const o=e.slice(t,n);return r&&Xu(o,t,n),o}function l1(e,t,n,{strict:r}={}){Yu(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Xu(o,t,n),o}const c1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Qu=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function $n(e,t){if(e.length!==t.length)throw new dg({expectedLength:e.length,givenLength:t.length});const n=u1({params:e,values:t}),r=oa(n);return r.length===0?"0x":r}function u1({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(ra({param:e[r],value:t[r]}));return n}function ra({param:e,value:t}){const n=sa(e.type);if(n){const[r,o]=n;return f1(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return g1(t,{param:e});if(e.type==="address")return d1(t);if(e.type==="bool")return h1(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=Qu.exec(e.type)??[];return m1(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return p1(t,{param:e});if(e.type==="string")return b1(t);throw new yg(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function oa(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=Te(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(ne(t+o,{size:32})),r.push(l),o+=Te(l)):n.push(l)}return Lt([...n,...r])}function d1(e){if(!yt(e))throw new On({address:e});return{dynamic:!1,encoded:Nn(e.toLowerCase())}}function f1(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Mu(e);if(!r&&e.length!==t)throw new cg({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const l=ra({param:n,value:e[i]});l.dynamic&&(o=!0),s.push(l)}if(r||o){const i=oa(s);if(r){const l=ne(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Lt([l,i]):l}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Lt(s.map(({encoded:i})=>i))}}function p1(e,{param:t}){const[,n]=t.type.split("bytes"),r=Te(e);if(!n){let o=e;return r%32!==0&&(o=Nn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Lt([Nn(ne(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new ug({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Nn(e,{dir:"right"})}}function h1(e){if(typeof e!="boolean")throw new G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Nn(Bu(e))}}function m1(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new Xi({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:ne(e,{size:32,signed:t})}}function b1(e){const t=oo(e),n=Math.ceil(Te(t)/32),r=[];for(let o=0;o<n;o++)r.push(Nn(Zn(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Lt([Nn(ne(Te(t),{size:32})),...r])}}function g1(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,l=ra({param:s,value:e[i]});r.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?oa(r):Lt(r.map(({encoded:o})=>o))}}function sa(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const ao=e=>Zn(Zu(e),0,4);function Yn(e){const{abi:t,args:n=[],name:r}=e,o=Dt(r,{strict:!1}),s=t.filter(l=>o?l.type==="function"?ao(l)===r:l.type==="event"?Ts(l)===r:!1:"name"in l&&l.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const l of s){if(!("inputs"in l))continue;if(!n||n.length===0){if(!l.inputs||l.inputs.length===0)return l;continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==n.length)continue;if(n.every((c,u)=>{const d="inputs"in l&&l.inputs[u];return d?ia(c,d):!1})){if(i&&"inputs"in i&&i.inputs){const c=ed(l.inputs,i.inputs,n);if(c)throw new bg({abiItem:l,type:c[0]},{abiItem:i,type:c[1]})}i=l}}return i||s[0]}function ia(e,t){const n=typeof e,r=t.type;switch(r){case"address":return yt(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>n==="object"&&ia(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>ia(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function ed(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return ed(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?yt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?yt(n[r],{strict:!1}):!1)return i}}const td="/docs/contract/encodeEventTopics";function lo(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const c=Yn({abi:t,name:n});if(!c)throw new $u(n,{docsPath:td});o=c}if(o.type!=="event")throw new $u(void 0,{docsPath:td});const s=Mt(o),i=Ts(s);let l=[];if(r&&"inputs"in o){const c=(a=o.inputs)==null?void 0:a.filter(d=>"indexed"in d&&d.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(c==null?void 0:c.map(d=>r[d.name]))??[]:[];u.length>0&&(l=(c==null?void 0:c.map((d,p)=>Array.isArray(u[p])?u[p].map((f,h)=>nd({param:d,value:u[p][h]})):typeof u[p]<"u"&&u[p]!==null?nd({param:d,value:u[p]}):null))??[])}return[i,...l]}function nd({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return ze(vr(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new xg(e.type);return $n([e],[t])}function Cs(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:l,transport:a})=>{l==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function rd(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:l,toBlock:a}=t,c=Cs(e,{method:"eth_newFilter"}),u=s?lo({abi:r,args:o,eventName:s}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?ne(i):i,toBlock:typeof a=="bigint"?ne(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:d,request:c(d),strict:!!l,type:"event"}}function dt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const od="/docs/contract/encodeFunctionData";function y1(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Yn({abi:t,args:n,name:r});if(!s)throw new gr(r,{docsPath:od});o=s}if(o.type!=="function")throw new gr(void 0,{docsPath:od});return{abi:[o],functionName:ao(Mt(o))}}function vt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var l;return e.abi.length===1&&((l=e.functionName)!=null&&l.startsWith("0x"))?e:y1(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?$n(o.inputs,t??[]):void 0;return Sr([s,i??"0x"])}const v1={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},sd={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},w1={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let id=class extends G{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},ad=class extends G{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},x1=class extends G{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const E1={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new x1({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new ad({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new id({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new id({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function aa(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(E1);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function S1(e,t={}){typeof t.size<"u"&&kt(e,{size:t.size});const n=Le(e,t);return Gt(n,t)}function P1(e,t={}){let n=e;if(typeof t.size<"u"&&(kt(n,{size:t.size}),n=Gn(n)),n.length>1||n[0]>1)throw new Sg(n);return!!n[0]}function dn(e,t={}){typeof t.size<"u"&&kt(e,{size:t.size});const n=Le(e,t);return ln(n,t)}function T1(e,t={}){let n=e;return typeof t.size<"u"&&(kt(n,{size:t.size}),n=Gn(n,{dir:"right"})),new TextDecoder().decode(n)}function co(e,t){const n=typeof t=="string"?qt(t):t,r=aa(n);if(Te(n)===0&&e.length>0)throw new ro;if(Te(t)&&Te(t)<32)throw new Nu({data:typeof t=="string"?t:Le(t),params:e,size:Te(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const l=e[i];r.setPosition(o);const[a,c]=Pr(r,l,{staticPosition:0});o+=c,s.push(a)}return s}function Pr(e,t,{staticPosition:n}){const r=sa(t.type);if(r){const[o,s]=r;return N1(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return I1(e,t,{staticPosition:n});if(t.type==="address")return A1(e);if(t.type==="bool")return C1(e);if(t.type.startsWith("bytes"))return O1(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return $1(e,t);if(t.type==="string")return M1(e,{staticPosition:n});throw new vg(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const ld=32,la=32;function A1(e){const t=e.readBytes(32);return[Ns(Le(Ju(t,-20))),32]}function N1(e,t,{length:n,staticPosition:r}){if(!n){const i=dn(e.readBytes(la)),l=r+i,a=l+ld;e.setPosition(l);const c=dn(e.readBytes(ld)),u=uo(t);let d=0;const p=[];for(let f=0;f<c;++f){e.setPosition(a+(u?f*32:d));const[h,m]=Pr(e,t,{staticPosition:a});d+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(uo(t)){const i=dn(e.readBytes(la)),l=r+i,a=[];for(let c=0;c<n;++c){e.setPosition(l+c*32);const[u]=Pr(e,t,{staticPosition:l});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[l,a]=Pr(e,t,{staticPosition:r+o});o+=a,s.push(l)}return[s,o]}function C1(e){return[P1(e.readBytes(32),{size:32}),32]}function O1(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=dn(e.readBytes(32));e.setPosition(n+i);const l=dn(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[Le(a),32]}return[Le(e.readBytes(Number.parseInt(o,10),32)),32]}function $1(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?S1(o,{signed:n}):dn(o,{signed:n}),32]}function I1(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(uo(t)){const i=dn(e.readBytes(la)),l=n+i;for(let a=0;a<t.components.length;++a){const c=t.components[a];e.setPosition(l+s);const[u,d]=Pr(e,c,{staticPosition:l});s+=d,o[r?a:c==null?void 0:c.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const l=t.components[i],[a,c]=Pr(e,l,{staticPosition:n});o[r?i:l==null?void 0:l.name]=a,s+=c}return[o,s]}function M1(e,{staticPosition:t}){const n=dn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=dn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=T1(Gn(s));return e.setPosition(t+32),[i,32]}function uo(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(uo);const n=sa(e.type);return!!(n&&uo({...e,type:n[1]}))}function cd(e){const{abi:t,data:n}=e,r=Zn(n,0,4);if(r==="0x")throw new ro;const s=[...t||[],sd,w1].find(i=>i.type==="error"&&r===ao(Mt(i)));if(!s)throw new Ou(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?co(s.inputs,Zn(n,4)):void 0,errorName:s.name}}const Be=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function ud({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((o,s)=>`${r&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Be(t[s]):t[s]}`).join(", ")})`}const D1={gwei:9,wei:18},k1={ether:-9,wei:9};function ca(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${s?`.${s}`:""}`}function ua(e,t="wei"){return ca(e,D1[t])}function Xe(e,t="wei"){return ca(e,k1[t])}class L1 extends G{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class B1 extends G{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function dd(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
72
+ `,"")}function F1(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
73
73
  `;return r.nonce&&(o+=` nonce: ${r.nonce}
74
74
  `),r.balance&&(o+=` balance: ${r.balance}
75
75
  `),r.code&&(o+=` code: ${r.code}
76
76
  `),r.state&&(o+=` state:
77
- `,o+=ff(r.state)),r.stateDiff&&(o+=` stateDiff:
78
- `,o+=ff(r.stateDiff)),o},` State Override:
77
+ `,o+=dd(r.state)),r.stateDiff&&(o+=` stateDiff:
78
+ `,o+=dd(r.stateDiff)),o},` State Override:
79
79
  `).slice(0,-1)}function fo(e){const t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
80
- `)}class Lg extends H{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",fo(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class Fg extends H{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p}){var h;const d=fo({chain:o&&`${o==null?void 0:o.name} (id: ${o==null?void 0:o.id})`,from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${ca(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",d].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class df extends H{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}}class pf extends H{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class Rg extends H{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class jg extends H{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const zg=e=>e,po=e=>e;class hf extends H{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p,stateOverride:d}){var w;const h=n?ft(n):void 0;let b=fo({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${ca(p)} ${((w=o==null?void 0:o.nativeCurrency)==null?void 0:w.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});d&&(b+=`
81
- ${Bg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",b].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class mf extends H{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:l}){const a=Yn({abi:n,args:r,name:i}),c=a?uf({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?Mt(a,{includeName:!0}):void 0,f=fo({address:o&&zg(o),function:u,args:c&&c!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${c}`,sender:l});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=l}}class ua extends H{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,l,a;if(n&&n!=="0x")try{i=cf({abi:t,data:n});const{abiItem:u,errorName:f,args:p}=i;if(f==="Error")a=p[0];else if(f==="Panic"){const[d]=p;a=gg[d]}else{const d=u?Mt(u,{includeName:!0}):void 0,h=u&&p?uf({abiItem:u,args:p,includeFunctionName:!1,includeName:!1}):void 0;l=[d?`Error: ${d}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(u){s=u}else o&&(a=o);let c;s instanceof Ou&&(c=s.signature,l=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${c}.`]),super(a&&a!=="execution reverted"||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,a||c].join(`
82
- `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:l,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.raw=n,this.reason=a,this.signature=c}}class Ug extends H{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class Wg extends H{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Os extends H{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class Xn extends H{constructor({body:t,cause:n,details:r,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${po(i)}`,t&&`Request body: ${Le(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=o,this.status=s,this.url=i}}class fa extends H{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${po(r)}`,`Request body: ${Le(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class bf extends H{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${po(n)}`,`Request body: ${Le(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const _g=-1;class Je extends H{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof fa?t.code:n??_g}}class Qe extends Je{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class ho extends Je{constructor(t){super(t,{code:ho.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class mo extends Je{constructor(t){super(t,{code:mo.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class bo extends Je{constructor(t,{method:n}={}){super(t,{code:bo.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class go extends Je{constructor(t){super(t,{code:go.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
80
+ `)}class R1 extends G{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",fo(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class j1 extends G{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:d,value:p}){var h;const f=fo({chain:o&&`${o==null?void 0:o.name} (id: ${o==null?void 0:o.id})`,from:n==null?void 0:n.address,to:d,value:typeof p<"u"&&`${ua(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",f].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class fd extends G{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}}class pd extends G{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class z1 extends G{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class U1 extends G{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const W1=e=>e,po=e=>e;class hd extends G{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:d,value:p,stateOverride:f}){var x;const h=n?dt(n):void 0;let m=fo({from:h==null?void 0:h.address,to:d,value:typeof p<"u"&&`${ua(p)} ${((x=o==null?void 0:o.nativeCurrency)==null?void 0:x.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});f&&(m+=`
81
+ ${F1(f)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class md extends G{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:l}){const a=Yn({abi:n,args:r,name:i}),c=a?ud({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?Mt(a,{includeName:!0}):void 0,d=fo({address:o&&W1(o),function:u,args:c&&c!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${c}`,sender:l});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=l}}class da extends G{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,l,a;if(n&&n!=="0x")try{i=cd({abi:t,data:n});const{abiItem:u,errorName:d,args:p}=i;if(d==="Error")a=p[0];else if(d==="Panic"){const[f]=p;a=v1[f]}else{const f=u?Mt(u,{includeName:!0}):void 0,h=u&&p?ud({abiItem:u,args:p,includeFunctionName:!1,includeName:!1}):void 0;l=[f?`Error: ${f}`:"",h&&h!=="()"?` ${[...Array((d==null?void 0:d.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(u){s=u}else o&&(a=o);let c;s instanceof Ou&&(c=s.signature,l=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${c}.`]),super(a&&a!=="execution reverted"||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,a||c].join(`
82
+ `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:l,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.raw=n,this.reason=a,this.signature=c}}class _1 extends G{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class V1 extends G{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Os extends G{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class Xn extends G{constructor({body:t,cause:n,details:r,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${po(i)}`,t&&`Request body: ${Be(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=o,this.status=s,this.url=i}}class fa extends G{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${po(r)}`,`Request body: ${Be(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class bd extends G{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${po(n)}`,`Request body: ${Be(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const H1=-1;class Je extends G{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof fa?t.code:n??H1}}class Qe extends Je{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class ho extends Je{constructor(t){super(t,{code:ho.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class mo extends Je{constructor(t){super(t,{code:mo.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class bo extends Je{constructor(t,{method:n}={}){super(t,{code:bo.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class go extends Je{constructor(t){super(t,{code:go.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
83
83
  `)})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Jn extends Je{constructor(t){super(t,{code:Jn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Jn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class In extends Je{constructor(t){super(t,{code:In.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
84
- `)})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class yo extends Je{constructor(t){super(t,{code:yo.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class wo extends Je{constructor(t){super(t,{code:wo.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class vo extends Je{constructor(t){super(t,{code:vo.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Qn extends Je{constructor(t,{method:n}={}){super(t,{code:Qn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Qn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Tr extends Je{constructor(t){super(t,{code:Tr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Tr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class xo extends Je{constructor(t){super(t,{code:xo.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Ar extends Qe{constructor(t){super(t,{code:Ar.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Eo extends Qe{constructor(t){super(t,{code:Eo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class So extends Qe{constructor(t,{method:n}={}){super(t,{code:So.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(So,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Po extends Qe{constructor(t){super(t,{code:Po.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class To extends Qe{constructor(t){super(t,{code:To.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(To,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ao extends Qe{constructor(t){super(t,{code:Ao.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class No extends Qe{constructor(t){super(t,{code:No.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(No,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Oo extends Qe{constructor(t){super(t,{code:Oo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Co extends Qe{constructor(t){super(t,{code:Co.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class $o extends Qe{constructor(t){super(t,{code:$o.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty($o,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Io extends Qe{constructor(t){super(t,{code:Io.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Mo extends Qe{constructor(t){super(t,{code:Mo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Do extends Qe{constructor(t){super(t,{code:Do.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Do,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class ko extends Qe{constructor(t){super(t,{code:ko.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(ko,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class Vg extends Je{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Hg=3;function Nr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const l=e instanceof Os?e:e instanceof H?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:c,details:u,message:f,shortMessage:p}=l,d=e instanceof ro?new Ug({functionName:s}):[Hg,Jn.code].includes(a)&&(c||u||f||p)||a===In.code&&u==="execution reverted"&&c?new ua({abi:t,data:typeof c=="object"?c.data:c,functionName:s,message:l instanceof fa?u:p??f}):e;return new mf(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function Gg(e){const t=ze(`0x${e.substring(4)}`).substring(26);return As(`0x${t}`)}async function qg({hash:e,signature:t}){const n=Dt(e)?e:On(e),{secp256k1:r}=await Promise.resolve().then(()=>O6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:c,s:u,v:f,yParity:p}=t,d=Number(p??f),h=gf(d);return new r.Signature(Gt(c),Gt(u)).addRecoveryBit(h)}const i=Dt(t)?t:On(t);if(Te(i)!==65)throw new Error("invalid signature length");const l=ln(`0x${i.slice(130)}`),a=gf(l);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function gf(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function yf({hash:e,signature:t}){return Gg(await qg({hash:e,signature:t}))}function Kg(e,t="hex"){const n=wf(e),r=ia(new Uint8Array(n.length));return n.encode(r),t==="hex"?Be(r.bytes):r.bytes}function wf(e){return Array.isArray(e)?Zg(e.map(t=>wf(t))):Yg(e)}function Zg(e){const t=e.reduce((o,s)=>o+s.length,0),n=vf(t);return{length:t<=55?1+t:1+n+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+n),n===1?o.pushUint8(t):n===2?o.pushUint16(t):n===3?o.pushUint24(t):o.pushUint32(t));for(const{encode:s}of e)s(o)}}}function Yg(e){const t=typeof e=="string"?qt(e):e,n=vf(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(o){t.length===1&&t[0]<128?o.pushBytes(t):t.length<=55?(o.pushByte(128+t.length),o.pushBytes(t)):(o.pushByte(183+n),n===1?o.pushUint8(t.length):n===2?o.pushUint16(t.length):n===3?o.pushUint24(t.length):o.pushUint32(t.length),o.pushBytes(t))}}}function vf(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new H("Length is too large.")}function Xg(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=ze(Sr(["0x05",Kg([t?ne(t):"0x",o,n?ne(n):"0x"])]));return r==="bytes"?qt(s):s}async function xf(e){const{authorization:t,signature:n}=e;return yf({hash:Xg(t),signature:n??t})}class Jg extends H{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p}){var h;const d=fo({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${ca(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Or extends H{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(Or,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Or,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class Cs extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Cs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class da extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(da,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class pa extends H{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(pa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class ha extends H{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
85
- `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(ha,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class ma extends H{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(ma,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class ba extends H{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
86
- `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(ba,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class ga extends H{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(ga,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class ya extends H{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(ya,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class wa extends H{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(wa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class $s extends H{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Xe(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Xe(r)} gwei`:""}).`].join(`
87
- `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty($s,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Bo extends H{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Is(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof H?e.walk(o=>(o==null?void 0:o.code)===Or.code):e;return r instanceof H?new Or({cause:e,message:r.details}):Or.nodeMessage.test(n)?new Or({cause:e,message:e.details}):Cs.nodeMessage.test(n)?new Cs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):da.nodeMessage.test(n)?new da({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):pa.nodeMessage.test(n)?new pa({cause:e,nonce:t==null?void 0:t.nonce}):ha.nodeMessage.test(n)?new ha({cause:e,nonce:t==null?void 0:t.nonce}):ma.nodeMessage.test(n)?new ma({cause:e,nonce:t==null?void 0:t.nonce}):ba.nodeMessage.test(n)?new ba({cause:e}):ga.nodeMessage.test(n)?new ga({cause:e,gas:t==null?void 0:t.gas}):ya.nodeMessage.test(n)?new ya({cause:e,gas:t==null?void 0:t.gas}):wa.nodeMessage.test(n)?new wa({cause:e}):$s.nodeMessage.test(n)?new $s({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Bo({cause:e})}function Qg(e,{docsPath:t,...n}){const r=(()=>{const o=Is(e,n);return o instanceof Bo?e:o})();return new Jg(r,{docsPath:t,...n})}function Ms(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const l of i)l in e&&(n[l]=e[l]),s[l]&&typeof s[l]=="object"&&!Array.isArray(s[l])&&r(s[l])}const o=t(e||{});return r(o),n}const ey={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Lo(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=ty(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>Be(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=ne(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=ne(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=ne(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=ne(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=ne(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=ne(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=ey[e.type]),typeof e.value<"u"&&(n.value=ne(e.value)),n}function ty(e){return e.map(t=>({address:t.address,r:t.r?ne(BigInt(t.r)):t.r,s:t.s?ne(BigInt(t.s)):t.s,chainId:ne(t.chainId),nonce:ne(t.nonce),...typeof t.yParity<"u"?{yParity:ne(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:ne(t.v)}:{}}))}function Ef(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new ku({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new ku({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function ny(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=ne(t)),n!==void 0&&(i.nonce=ne(n)),r!==void 0&&(i.state=Ef(r)),o!==void 0){if(i.state)throw new kg;i.stateDiff=Ef(o)}return i}function va(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!yt(n,{strict:!1}))throw new Cn({address:n});if(t[n])throw new Dg({address:n});t[n]=ny(r)}return t}const Sf=2n**256n-1n;function Cr(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?ft(t):void 0;if(s&&!yt(s.address))throw new Cn({address:s.address});if(o&&!yt(o))throw new Cn({address:o});if(n&&n>Sf)throw new Cs({maxFeePerGas:n});if(r&&n&&r>n)throw new $s({maxFeePerGas:n,maxPriorityFeePerGas:r})}class Pf extends H{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class xa extends H{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class ry extends H{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Xe(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Tf extends H{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Af={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Ea(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?ln(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?ln(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Af[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=oy(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function oy(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function Nf(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:Ea(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Lt(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var c,u,f;const s=o??!1,i=n!==void 0?ne(n):void 0;let l=null;if(t?l=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):l=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!l)throw new Tf({blockHash:t,blockNumber:n});return(((f=(u=(c=e.chain)==null?void 0:c.formatters)==null?void 0:u.block)==null?void 0:f.format)||Nf)(l,"getBlock")}async function Sa(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function sy(e,t){return Of(e,t)}async function Of(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const l=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof l=="function"){const c=n||await ee(e,Lt,"getBlock")({}),u=await l({block:c,client:e,request:o});if(u===null)throw new Error;return u}if(typeof l<"u")return l;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Gt(a)}catch{const[l,a]=await Promise.all([n?Promise.resolve(n):ee(e,Lt,"getBlock")({}),ee(e,Sa,"getGasPrice")({})]);if(typeof l.baseFeePerGas!="bigint")throw new xa;const c=a-l.baseFeePerGas;return c<0n?0n:c}}async function iy(e,t){return Pa(e,t)}async function Pa(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,b;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((b=r==null?void 0:r.fees)==null?void 0:b.baseFeeMultiplier)??1.2})();if(i<1)throw new Pf;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),c=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await ee(e,Lt,"getBlock")({});if(typeof((d=r==null?void 0:r.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:c,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new xa;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Of(e,{block:u,chain:r,request:o}),b=c(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??b+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??c(await ee(e,Sa,"getGasPrice")({}))}}async function Cf(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?ne(r):n]},{dedupe:!!r});return ln(o)}function $f(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>qt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>Be(s))}function If(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>qt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>qt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const l=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(l,a)))}return n==="bytes"?s:s.map(i=>Be(i))}function ay(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),l=Number(n&s),a=r?4:0,c=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+c,l,r)}function ly(e,t,n){return e&t^~e&n}function cy(e,t,n){return e&t^e&n^t&n}class uy extends Ji{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=Xi(this.buffer)}update(t){xr(this),t=Ss(t),Kn(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const l=Math.min(o-this.pos,s-i);if(l===o){const a=Xi(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+l),this.pos),this.pos+=l,i+=l,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){xr(this),Ru(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,Er(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;ay(r,o-8,BigInt(this.length*8),s),this.process(r,0);const l=Xi(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)l.setUint32(4*f,u[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:l}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=l,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Mn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),fy=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Dn=new Uint32Array(64);class dy extends uy{constructor(t=32){super(64,t,8,!1),this.A=Mn[0]|0,this.B=Mn[1]|0,this.C=Mn[2]|0,this.D=Mn[3]|0,this.E=Mn[4]|0,this.F=Mn[5]|0,this.G=Mn[6]|0,this.H=Mn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:l,H:a}=this;return[t,n,r,o,s,i,l,a]}set(t,n,r,o,s,i,l,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=l|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)Dn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=Dn[f-15],d=Dn[f-2],h=Kt(p,7)^Kt(p,18)^p>>>3,b=Kt(d,17)^Kt(d,19)^d>>>10;Dn[f]=b+Dn[f-7]+h+Dn[f-16]|0}let{A:r,B:o,C:s,D:i,E:l,F:a,G:c,H:u}=this;for(let f=0;f<64;f++){const p=Kt(l,6)^Kt(l,11)^Kt(l,25),d=u+p+ly(l,a,c)+fy[f]+Dn[f]|0,b=(Kt(r,2)^Kt(r,13)^Kt(r,22))+cy(r,o,s)|0;u=c,c=a,a=l,l=i+d|0,i=s,s=o,o=r,r=d+b|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,l=l+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,o,s,i,l,a,c,u)}roundClean(){Er(Dn)}destroy(){this.set(0,0,0,0,0,0,0,0),Er(this.buffer)}}const Mf=zu(()=>new dy),py=Mf;function hy(e,t){return py(Dt(e,{strict:!1})?wr(e):e)}function my(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=hy(t);return o.set([n],0),r==="bytes"?o:Be(o)}function by(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(my({commitment:s,to:r,version:n}));return o}const Df=6,kf=32,Ta=4096,Bf=kf*Ta,Lf=Bf*Df-1-1*Ta*Df;class gy extends H{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class yy extends H{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function wy(e){const t=typeof e.data=="string"?qt(e.data):e.data,n=Te(t);if(!n)throw new yy;if(n>Lf)throw new gy({maxSize:Lf,size:n});const r=[];let o=!0,s=0;for(;o;){const i=ia(new Uint8Array(Bf));let l=0;for(;l<Ta;){const a=t.slice(s,s+(kf-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}l++,s+=31}r.push(i)}return r.map(i=>Be(i.bytes))}function vy(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??wy({data:t}),s=e.commitments??$f({blobs:o,kzg:n,to:r}),i=e.proofs??If({blobs:o,commitments:s,kzg:n,to:r}),l=[];for(let a=0;a<o.length;a++)l.push({blob:o[a],commitment:s[a],proof:i[a]});return l}function xy(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new Lg({transaction:e})}function Ey(e,{docsPath:t,...n}){const r=(()=>{const o=Is(e,n);return o instanceof Bo?e:o})();return new Fg(r,{docsPath:t,...n})}async function Aa(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return ln(t)}async function Ff(e,t){var m,v,S,I,$;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:l,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:h,nonceManager:b,to:w,type:T,value:x,...E}=t,A=await(async()=>{if(!n||!b||typeof h<"u")return h;const C=ft(n),D=s?s.id:await ee(e,Aa,"getChainId")({});return await b.consume({address:C.address,chainId:D,client:e})})();Cr(t);const k=(v=(m=s==null?void 0:s.formatters)==null?void 0:m.transactionRequest)==null?void 0:v.format,L=(k||Lo)({...Ms(E,{format:k}),account:n?ft(n):void 0,accessList:r,authorizationList:o,blobs:l,blobVersionedHashes:i,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:A,to:w,type:T,value:x},"fillTransaction");try{const C=await e.request({method:"eth_fillTransaction",params:[L]}),y=(((I=(S=s==null?void 0:s.formatters)==null?void 0:S.transaction)==null?void 0:I.format)||Ea)(C.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const O=await(async()=>{var R,z;if(typeof((R=s==null?void 0:s.fees)==null?void 0:R.baseFeeMultiplier)=="function"){const W=await ee(e,Lt,"getBlock")({});return s.fees.baseFeeMultiplier({block:W,client:e,request:t})}return((z=s==null?void 0:s.fees)==null?void 0:z.baseFeeMultiplier)??1.2})();if(O<1)throw new Pf;const P=10**((($=O.toString().split(".")[1])==null?void 0:$.length)??0),B=R=>R*BigInt(Math.ceil(O*P))/BigInt(P);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=B(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=B(y.gasPrice)),{raw:C.raw,transaction:{from:L.from,...y}}}catch(C){throw Ey(C,{...t,chain:e.chain})}}const Sy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Rf=new Map,Na=new Ts(128);async function jf(e,t){var A,k,F;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=Sy);const{account:r,chain:o=e.chain,nonceManager:s,parameters:i}=n,l=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function c(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await ee(e,Aa,"getChainId")({}),a))}const u=r&&ft(r);let f=n.nonce;if(i.includes("nonce")&&typeof f>"u"&&u&&s){const L=await c();f=await s.consume({address:u.address,chainId:L,client:e})}l!=null&&l.fn&&((A=l.runAt)!=null&&A.includes("beforeFillTransaction"))&&(n=await l.fn({...n,chain:o},{phase:"beforeFillTransaction"}),f??(f=n.nonce));const d=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||Na.get(e.uid)===!1||!["fees","gas"].some(m=>i.includes(m))?!1:!!(i.includes("chainId")&&typeof n.chainId!="number"||i.includes("nonce")&&typeof f!="number"||i.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof n.gas!="bigint"))?await ee(e,Ff,"fillTransaction")({...n,nonce:f}).then(L=>{const{chainId:m,from:v,gas:S,gasPrice:I,nonce:$,maxFeePerBlobGas:C,maxFeePerGas:D,maxPriorityFeePerGas:y,type:O,...M}=L.transaction;return Na.set(e.uid,!0),{...n,...v?{from:v}:{},...O&&!n.type?{type:O}:{},...typeof m<"u"?{chainId:m}:{},...typeof S<"u"?{gas:S}:{},...typeof I<"u"?{gasPrice:I}:{},...typeof $<"u"?{nonce:$}:{},...typeof C<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:C}:{},...typeof D<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:D}:{},...typeof y<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in M&&typeof M.nonceKey<"u"?{nonceKey:M.nonceKey}:{}}}).catch(L=>{var S;const m=L;return m.name!=="TransactionExecutionError"||((S=m.walk)==null?void 0:S.call(m,I=>{const $=I;return $.name==="MethodNotFoundRpcError"||$.name==="MethodNotSupportedRpcError"}))&&Na.set(e.uid,!1),n}):n;f??(f=d.nonce),n={...d,...u?{from:u==null?void 0:u.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:b,kzg:w,type:T}=n;l!=null&&l.fn&&((k=l.runAt)!=null&&k.includes("beforeFillParameters"))&&(n=await l.fn({...n,chain:o},{phase:"beforeFillParameters"}));let x;async function E(){return x||(x=await ee(e,Lt,"getBlock")({blockTag:"latest"}),x)}if(i.includes("nonce")&&typeof f>"u"&&u&&!s&&(n.nonce=await ee(e,Cf,"getTransactionCount")({address:u.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&w){const L=$f({blobs:h,kzg:w});if(i.includes("blobVersionedHashes")){const m=by({commitments:L,to:"hex"});n.blobVersionedHashes=m}if(i.includes("sidecars")){const m=If({blobs:h,commitments:L,kzg:w}),v=vy({blobs:h,commitments:L,proofs:m,to:"hex"});n.sidecars=v}}if(i.includes("chainId")&&(n.chainId=await c()),(i.includes("fees")||i.includes("type"))&&typeof T>"u")try{n.type=xy(n)}catch{let L=Rf.get(e.uid);if(typeof L>"u"){const m=await E();L=typeof(m==null?void 0:m.baseFeePerGas)=="bigint",Rf.set(e.uid,L)}n.type=L?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const L=await E(),{maxFeePerGas:m,maxPriorityFeePerGas:v}=await Pa(e,{block:L,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<v)throw new ry({maxPriorityFeePerGas:v});n.maxPriorityFeePerGas=v,n.maxFeePerGas=m}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new xa;if(typeof n.gasPrice>"u"){const L=await E(),{gasPrice:m}=await Pa(e,{block:L,chain:o,request:n,type:"legacy"});n.gasPrice=m}}return i.includes("gas")&&typeof b>"u"&&(n.gas=await ee(e,Oa,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),l!=null&&l.fn&&((F=l.runAt)!=null&&F.includes("afterFillParameters"))&&(n=await l.fn({...n,chain:o},{phase:"afterFillParameters"})),Cr(n),delete n.parameters,n}async function Oa(e,t){var i,l,a;const{account:n=e.account,prepare:r=!0}=t,o=n?ft(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const c=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await xf({authorization:t.authorizationList[0]}).catch(()=>{throw new H("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,blockNumber:h,blockTag:b,data:w,gas:T,gasPrice:x,maxFeePerBlobGas:E,maxFeePerGas:A,maxPriorityFeePerGas:k,nonce:F,value:L,stateOverride:m,...v}=r?await jf(e,{...t,parameters:s,to:c}):t;if(T&&t.gas!==T)return T;const I=(typeof h=="bigint"?ne(h):void 0)||b,$=va(m);Cr(t);const C=(a=(l=(i=e.chain)==null?void 0:i.formatters)==null?void 0:l.transactionRequest)==null?void 0:a.format,y=(C||Lo)({...Ms(v,{format:C}),account:o,accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,data:w,gasPrice:x,maxFeePerBlobGas:E,maxFeePerGas:A,maxPriorityFeePerGas:k,nonce:F,to:c,value:L},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:$?[y,I??e.experimental_blockTag??"latest",$]:I?[y,I]:[y]}))}catch(c){throw Qg(c,{...t,account:o,chain:e.chain})}}async function Py(e,t){var c;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(c=e.dataSuffix)==null?void 0:c.value,...l}=t,a=wt({abi:n,args:o,functionName:s});try{return await ee(e,Oa,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...l})}catch(u){const f=l.account?ft(l.account):void 0;throw Nr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:f==null?void 0:f.address})}}function Fo(e,t){if(!yt(e,{strict:!1}))throw new Cn({address:e});if(!yt(t,{strict:!1}))throw new Cn({address:t});return e.toLowerCase()===t.toLowerCase()}function Zt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const zf="/docs/contract/decodeEventLog";function Ds(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...l]=o;if(!i)throw new f1({docsPath:zf});const a=t.find(T=>T.type==="event"&&i===Ps(Mt(T)));if(!(a&&"name"in a)||a.type!=="event")throw new d1(i,{docsPath:zf});const{name:c,inputs:u}=a,f=u==null?void 0:u.some(T=>!("name"in T&&T.name)),p=f?[]:{},d=u.map((T,x)=>[T,x]).filter(([T])=>"indexed"in T&&T.indexed),h=[];for(let T=0;T<d.length;T++){const[x,E]=d[T],A=l[T];if(!A){if(s)throw new Zi({abiItem:a,param:x});h.push([x,E]);continue}p[f?E:x.name||E]=Ty({param:x,value:A})}const b=u.filter(T=>!("indexed"in T&&T.indexed)),w=s?b:[...h.map(([T])=>T),...b];if(w.length>0){if(n&&n!=="0x")try{const T=co(w,n);if(T){let x=0;if(!s)for(const[E,A]of h)p[f?A:E.name||A]=T[x++];if(f)for(let E=0;E<u.length;E++)p[E]===void 0&&x<T.length&&(p[E]=T[x++]);else for(let E=0;E<b.length;E++)p[b[E].name]=T[x++]}}catch(T){if(s)throw T instanceof Au||T instanceof af?new xs({abiItem:a,data:n,params:w,size:Te(n)}):T}else if(s)throw new xs({abiItem:a,data:"0x",params:w,size:0})}return{eventName:c,args:Object.values(p).length>0?p:void 0}}function Ty({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(co([e],t)||[])[0]}function Ca(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),i=t.filter(l=>l.type==="event").map(l=>({abi:l,selector:Ps(l)}));return r.map(l=>{var p;const a=typeof l.blockNumber=="string"?Zt(l):l,c=i.filter(d=>a.topics[0]===d.selector);if(c.length===0)return null;let u,f;for(const d of c)try{u=Ds({...a,abi:[d.abi],strict:!0}),f=d;break}catch{}if(!u&&!o){f=c[0];try{u=Ds({data:a.data,topics:a.topics,abi:[f.abi],strict:!1})}catch{const d=(p=f.abi.inputs)==null?void 0:p.some(h=>!("name"in h&&h.name));return{...a,args:d?[]:{},eventName:f.abi.name}}}return!u||!f||s&&!s.includes(u.eventName)||!Ay({args:u.args,inputs:f.abi.inputs,matchArgs:n})?null:{...u,...a}}).filter(Boolean)}function Ay(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,l){try{return s.type==="address"?Fo(i,l):s.type==="string"||s.type==="bytes"?ze(wr(i))===l:i===l}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const l=n[i];return l?(Array.isArray(s)?s:[s]).some(c=>o(l,c,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const l=n.find(c=>c.name===s);return l?(Array.isArray(i)?i:[i]).some(c=>o(l,c,t[s])):!1}):!1}async function $a(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:l,strict:a}={}){const c=a??!1,u=i??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(b=>lo({abi:[b],eventName:b.name,args:i?void 0:l}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?ne(r):r,toBlock:typeof o=="bigint"?ne(o):o}]});const d=p.map(h=>Zt(h));return u?Ca({abi:u,args:l,logs:d,strict:c}):d}async function Uf(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:l,toBlock:a,strict:c}=t,u=i?Yn({abi:n,name:i}):void 0,f=u?void 0:n.filter(p=>p.type==="event");return ee(e,$a,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:l,toBlock:a,strict:c})}const Ia="/docs/contract/decodeFunctionResult";function kn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const l=Yn({abi:t,args:n,name:r});if(!l)throw new gr(r,{docsPath:Ia});s=l}if(s.type!=="function")throw new gr(void 0,{docsPath:Ia});if(!s.outputs)throw new $u(s.name,{docsPath:Ia});const i=co(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ma=BigInt(0),Da=BigInt(1);function Ro(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ka(e){if(!Ro(e))throw new Error("Uint8Array expected")}function jo(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function ks(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Wf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Ma:BigInt("0x"+e)}const _f=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ny=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function zo(e){if(ka(e),_f)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Ny[e[n]];return t}const dn={_0:48,_9:57,A:65,F:70,a:97,f:102};function Vf(e){if(e>=dn._0&&e<=dn._9)return e-dn._0;if(e>=dn.A&&e<=dn.F)return e-(dn.A-10);if(e>=dn.a&&e<=dn.f)return e-(dn.a-10)}function Bs(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(_f)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const i=Vf(e.charCodeAt(s)),l=Vf(e.charCodeAt(s+1));if(i===void 0||l===void 0){const a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[o]=i*16+l}return r}function er(e){return Wf(zo(e))}function Hf(e){return ka(e),Wf(zo(Uint8Array.from(e).reverse()))}function Uo(e,t){return Bs(e.toString(16).padStart(t*2,"0"))}function Gf(e,t){return Uo(e,t).reverse()}function vt(e,t,n){let r;if(typeof t=="string")try{r=Bs(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Ro(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}function Ls(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];ka(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}const Ba=e=>typeof e=="bigint"&&Ma<=e;function La(e,t,n){return Ba(e)&&Ba(t)&&Ba(n)&&t<=e&&e<n}function $r(e,t,n,r){if(!La(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Oy(e){let t;for(t=0;e>Ma;e>>=Da,t+=1);return t}const Fs=e=>(Da<<BigInt(e))-Da,Fa=e=>new Uint8Array(e),qf=e=>Uint8Array.from(e);function Cy(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Fa(e),o=Fa(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},l=(...f)=>n(o,r,...f),a=(f=Fa(0))=>{o=l(qf([0]),f),r=l(),f.length!==0&&(o=l(qf([1]),f),r=l())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const p=[];for(;f<t;){r=l();const d=r.slice();p.push(d),f+=r.length}return Ls(...p)};return(f,p)=>{i(),a(f);let d;for(;!(d=p(c()));)a();return i(),d}}const $y={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ro(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Rs(e,t,n={}){const r=(o,s,i)=>{const l=$y[s];if(typeof l!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!l(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function Kf(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const Iy="0.1.1";function My(){return Iy}class re extends Error{static setStaticOptions(t){re.prototype.docsOrigin=t.docsOrigin,re.prototype.showVersion=t.showVersion,re.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var u;if(n.cause instanceof re){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),o=n.cause instanceof re&&n.cause.docsPath||n.docsPath,s=n.docsOrigin??re.prototype.docsOrigin,i=`${s}${o??""}`,l=!!(n.version??re.prototype.showVersion),a=n.version??re.prototype.version,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o||l?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0,l?`Version: ${a}`:void 0]:[]].filter(u=>typeof u=="string").join(`
88
- `);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=i,this.docsOrigin=s,this.docsPath=o,this.shortMessage=t,this.showVersion=l,this.version=a}walk(t){return Zf(this,t)}}Object.defineProperty(re,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${My()}`}}),re.setStaticOptions(re.defaultStaticOptions);function Zf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Zf(e.cause,t):t?null:e}function Wo(e,t){if(Ir(e)>t)throw new Zy({givenSize:Ir(e),maxSize:t})}const pn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Yf(e){if(e>=pn.zero&&e<=pn.nine)return e-pn.zero;if(e>=pn.A&&e<=pn.F)return e-(pn.A-10);if(e>=pn.a&&e<=pn.f)return e-(pn.a-10)}function Dy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Yy({size:e.length,targetSize:r,type:"Bytes"});const o=new Uint8Array(r);for(let s=0;s<r;s++){const i=n==="right";o[i?s:r-s-1]=e[i?s:e.length-s-1]}return o}function Xf(e,t={}){const{dir:n="left"}=t;let r=e,o=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)o++;return r=n==="left"?r.slice(o):r.slice(0,r.length-o),r}function js(e,t){if(dt(e)>t)throw new nw({givenSize:dt(e),maxSize:t})}function ky(e,t){if(typeof t=="number"&&t>0&&t>dt(e)-1)throw new ld({offset:t,position:"start",size:dt(e)})}function By(e,t,n){if(typeof t=="number"&&typeof n=="number"&&dt(e)!==n-t)throw new ld({offset:n,position:"end",size:dt(e)})}function Jf(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const o=e.replace("0x","");if(o.length>r*2)throw new rw({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Ly="#__bigint";function Qf(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+Ly:o,n)}const Fy=new TextDecoder,Ry=new TextEncoder;function jy(e){return e instanceof Uint8Array?e:typeof e=="string"?ed(e):zy(e)}function zy(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function ed(e,t={}){const{size:n}=t;let r=e;n&&(js(e,n),r=nr(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let l=0,a=0;l<s;l++){const c=Yf(o.charCodeAt(a++)),u=Yf(o.charCodeAt(a++));if(c===void 0||u===void 0)throw new re(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[l]=c<<4|u}return i}function Uy(e,t={}){const{size:n}=t,r=Ry.encode(e);return typeof n=="number"?(Wo(r,n),Wy(r,n)):r}function Wy(e,t){return Dy(e,{dir:"right",size:t})}function Ir(e){return e.length}function _y(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function Vy(e,t={}){const{size:n}=t;typeof n<"u"&&Wo(e,n);const r=Rt(e,t);return rd(r,t)}function Hy(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Wo(r,n),r=td(r)),r.length>1||r[0]>1)throw new Ky(r);return!!r[0]}function hn(e,t={}){const{size:n}=t;typeof n<"u"&&Wo(e,n);const r=Rt(e,t);return od(r,t)}function Gy(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Wo(r,n),r=qy(r)),Fy.decode(r)}function td(e){return Xf(e,{dir:"left"})}function qy(e){return Xf(e,{dir:"right"})}class Ky extends re{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let Zy=class extends re{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Yy=class extends re{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const Xy=new TextEncoder,Jy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Qy(e,t={}){const{strict:n=!1}=t;if(!e)throw new id(e);if(typeof e!="string")throw new id(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new ad(e);if(!e.startsWith("0x"))throw new ad(e)}function Ft(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function ew(e){return e instanceof Uint8Array?Rt(e):Array.isArray(e)?Rt(new Uint8Array(e)):e}function nd(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(js(n,t.size),tr(n,t.size)):n}function Rt(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Jy[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(js(r,t.size),nr(r,t.size)):r}function Ve(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const c=typeof e=="bigint"?"n":"";throw new sd({max:s?`${s}${c}`:void 0,min:`${i}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&o<0?BigInt.asUintN(r*8,BigInt(o)):o).toString(16)}`;return r?tr(a,r):a}function Ra(e,t={}){return Rt(Xy.encode(e),t)}function tr(e,t){return Jf(e,{dir:"left",size:t})}function nr(e,t){return Jf(e,{dir:"right",size:t})}function Yt(e,t,n,r={}){const{strict:o}=r;ky(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&By(s,t,n),s}function dt(e){return Math.ceil((e.length-2)/2)}function rd(e,t={}){const{signed:n}=t;t.size&&js(e,t.size);const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n)-1n,i=s>>1n;return r<=i?r:r-s-1n}function od(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:rd(e,t))}function tw(e,t={}){const{strict:n=!1}=t;try{return Qy(e,{strict:n}),!0}catch{return!1}}class sd extends re{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class id extends re{constructor(t){super(`Value \`${typeof t=="object"?Qf(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class ad extends re{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class nw extends re{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class ld extends re{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class rw extends re{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function ow(e){return{address:e.address,amount:Ve(e.amount),index:Ve(e.index),validatorIndex:Ve(e.validatorIndex)}}function cd(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Ve(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Ve(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Ve(e.gasLimit)},...typeof e.number=="bigint"&&{number:Ve(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Ve(e.prevRandao)},...typeof e.time=="bigint"&&{time:Ve(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(ow)}}}const Mr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],ja=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],ud=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],fd=[...ud,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],sw=[...ud,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],dd=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],pd=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],hd=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],md=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],Dr=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],iw="0x82ad56cb",bd="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",aw="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",lw="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",za="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class Ua extends H{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class gd extends H{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const Wa="/docs/contract/encodeDeployData";function _a(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new i1({docsPath:Wa});if(!("inputs"in o))throw new Tu({docsPath:Wa});if(!o.inputs||o.inputs.length===0)throw new Tu({docsPath:Wa});const s=$n(o.inputs,n);return Sr([r,s])}function kr({blockNumber:e,chain:t,contract:n}){var o;const r=(o=t==null?void 0:t.contracts)==null?void 0:o[n];if(!r)throw new Ua({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Ua({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function yd(e,{docsPath:t,...n}){const r=(()=>{const o=Is(e,n);return o instanceof Bo?e:o})();return new hf(r,{docsPath:t,...n})}function wd(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Va=new Map;function vd({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const u=a();i();const f=u.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<u.length;d++){const{resolve:h}=u[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<u.length;d++){const{reject:h}=u[d];h==null||h(p)}})},i=()=>Va.delete(t),l=()=>a().map(({args:u})=>u),a=()=>Va.get(t)||[],c=u=>Va.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:p,reject:d}=wd();return(n==null?void 0:n([...l(),u]))&&s(),a().length>0?(c({args:u,resolve:p,reject:d}),f):(c({args:u,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Br(e,t){var C,D,y,O;const{account:n=e.account,authorizationList:r,batch:o=!!((C=e.batch)!=null&&C.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:l,blobs:a,blockOverrides:c,code:u,data:f,factory:p,factoryData:d,gas:h,gasPrice:b,maxFeePerBlobGas:w,maxFeePerGas:T,maxPriorityFeePerGas:x,nonce:E,to:A,value:k,stateOverride:F,...L}=t,m=n?ft(n):void 0;if(u&&(p||d))throw new H("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&A)throw new H("Cannot provide both `code` & `to` as parameters.");const v=u&&f,S=p&&d&&A&&f,I=v||S,$=v?xd({code:u,data:f}):S?fw({data:f,factory:p,factoryData:d,to:A}):f;try{Cr(t);const P=(typeof s=="bigint"?ne(s):void 0)||i,B=c?cd(c):void 0,R=va(F),z=(O=(y=(D=e.chain)==null?void 0:D.formatters)==null?void 0:y.transactionRequest)==null?void 0:O.format,G=(z||Lo)({...Ms(L,{format:z}),accessList:l,account:m,authorizationList:r,blobs:a,data:$,gas:h,gasPrice:b,maxFeePerBlobGas:w,maxFeePerGas:T,maxPriorityFeePerGas:x,nonce:E,to:I?void 0:A,value:k},"call");if(o&&cw({request:G})&&!R&&!B)try{return await uw(e,{...G,blockNumber:s,blockTag:i})}catch(V){if(!(V instanceof gd)&&!(V instanceof Ua))throw V}const J=(()=>{const V=[G,P];return R&&B?[...V,R,B]:R?[...V,R]:B?[...V,{},B]:V})(),K=await e.request({method:"eth_call",params:J});return K==="0x"?{data:void 0}:{data:K}}catch(M){const P=dw(M),{offchainLookup:B,offchainLookupSignature:R}=await Promise.resolve().then(()=>fv);if(e.ccipRead!==!1&&(P==null?void 0:P.slice(0,10))===R&&A)return{data:await B(e,{data:P,to:A})};throw I&&(P==null?void 0:P.slice(0,10))==="0x101bb98d"?new Wg({factory:p}):yd(M,{...t,account:m,chain:e.chain})}}function cw({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(iw)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function uw(e,t){var b;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((b=e.batch)==null?void 0:b.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:l,to:a}=t,c=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return kr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new gd})(),f=(typeof s=="bigint"?ne(s):void 0)||i,{schedule:p}=vd({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(w){return w.reduce((x,{data:E})=>x+(E.length-2),0)>n*2},fn:async w=>{const T=w.map(A=>({allowFailure:!0,callData:A.data,target:A.to})),x=wt({abi:Mr,args:[T],functionName:"aggregate3"}),E=await e.request({method:"eth_call",params:[{...c===null?{data:xd({code:za,data:x})}:{to:c,data:x}},f]});return kn({abi:Mr,args:[T],functionName:"aggregate3",data:E||"0x"})}}),[{returnData:d,success:h}]=await p({data:l,to:a});if(!h)throw new Os({data:d});return d==="0x"?{data:void 0}:{data:d}}function xd(e){const{code:t,data:n}=e;return _a({abi:vu(["constructor(bytes, bytes)"]),bytecode:bd,args:[t,n]})}function fw(e){const{data:t,factory:n,factoryData:r,to:o}=e;return _a({abi:vu(["constructor(address, bytes, address, bytes)"]),bytecode:aw,args:[o,t,n,r]})}function dw(e){var n;if(!(e instanceof H))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function jt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,l=wt({abi:n,args:o,functionName:s});try{const{data:a}=await ee(e,Br,"call")({...i,data:l,to:r});return kn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw Nr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function pw(e,t){var u;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...l}=t,a=l.account?ft(l.account):e.account,c=wt({abi:n,args:o,functionName:s});try{const{data:f}=await ee(e,Br,"call")({batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...l,account:a}),p=kn({abi:n,args:o,functionName:s,data:f||"0x"}),d=n.filter(h=>"name"in h&&h.name===t.functionName);return{result:p,request:{abi:d,address:r,args:o,dataSuffix:i,functionName:s,...l,account:a}}}catch(f){throw Nr(f,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:a==null?void 0:a.address})}}const Ha=new Map,Ed=new Map;let hw=0;function Bn(e,t,n){const r=++hw,o=()=>Ha.get(e)||[],s=()=>{const u=o();Ha.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(p=>p.id===r))return;const f=Ed.get(e);if(u.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},l=o();if(Ha.set(e,[...l,{id:r,fns:t}]),l&&l.length>0)return i;const a={};for(const u in t)a[u]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const b of p)(h=(d=b.fns)[u])==null||h.call(d,...f)};const c=n(a);return typeof c=="function"&&Ed.set(e,c),i}async function Ga(e){return new Promise(t=>setTimeout(t,e))}function _o(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let l;t&&(l=await e({unpoll:s}));const a=await(n==null?void 0:n(l))??r;await Ga(a);const c=async()=>{o&&(await e({unpoll:s}),await Ga(r),c())};c()})(),s}const mw=new Map,bw=new Map;function gw(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,mw),r=t(e,bw);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function yw(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=gw(t),o=r.response.get();if(o&&n>0&&Date.now()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const ww=e=>`blockNumber.${e}`;async function Vo(e,{cacheTime:t=e.cacheTime}={}){const n=await yw(()=>e.request({method:"eth_blockNumber"}),{cacheKey:ww(e.uid),cacheTime:t});return BigInt(n)}async function zs(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Zt(s));return!("abi"in t)||!t.abi?o:Ca({abi:t.abi,logs:o,strict:n})}async function Us(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function vw(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:l,onError:a,onLogs:c,poll:u,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof u<"u"?u:typeof l=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const w=p??!1,T=Le(["watchContractEvent",r,o,s,e.uid,i,f,w,l]);return Bn(T,{onLogs:c,onError:a},x=>{let E;l!==void 0&&(E=l-1n);let A,k=!1;const F=_o(async()=>{var L;if(!k){try{A=await ee(e,nf,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:w,fromBlock:l})}catch{}k=!0;return}try{let m;if(A)m=await ee(e,zs,"getFilterChanges")({filter:A});else{const v=await ee(e,Vo,"getBlockNumber")({});E&&E<v?m=await ee(e,Uf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:E+1n,toBlock:v,strict:w}):m=[],E=v}if(m.length===0)return;if(s)x.onLogs(m);else for(const v of m)x.onLogs([v])}catch(m){A&&m instanceof In&&(k=!1),(L=x.onError)==null||L.call(x,m)}},{emitOnBegin:!0,interval:f});return async()=>{A&&await ee(e,Us,"uninstallFilter")({filter:A}),F()}})})():(()=>{const w=p??!1,T=Le(["watchContractEvent",r,o,s,e.uid,i,f,w]);let x=!0,E=()=>x=!1;return Bn(T,{onLogs:c,onError:a},A=>((async()=>{try{const k=(()=>{if(e.transport.type==="fallback"){const m=e.transport.transports.find(v=>v.config.type==="webSocket"||v.config.type==="ipc");return m?m.value:e.transport}return e.transport})(),F=i?lo({abi:n,eventName:i,args:o}):[],{unsubscribe:L}=await k.subscribe({params:["logs",{address:r,topics:F}],onData(m){var S;if(!x)return;const v=m.result;try{const{eventName:I,args:$}=Ds({abi:n,data:v.data,topics:v.topics,strict:p}),C=Zt(v,{args:$,eventName:I});A.onLogs([C])}catch(I){let $,C;if(I instanceof xs||I instanceof Zi){if(p)return;$=I.abiItem.name,C=(S=I.abiItem.inputs)==null?void 0:S.some(y=>!("name"in y&&y.name))}const D=Zt(v,{args:C?[]:{},eventName:$});A.onLogs([D])}},onError(m){var v;(v=A.onError)==null||v.call(A,m)}});E=L,x||E()}catch(k){a==null||a(k)}})(),()=>E()))})()}async function xw(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function qa(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:l=0}={})=>{const a=async({error:c})=>{const u=typeof t=="function"?t({count:l,error:c}):t;u&&await Ga(u),i({count:l+1})};try{const c=await e();o(c)}catch(c){if(l<n&&await r({count:l,error:c}))return a({error:c});s(c)}};i()})}const Ew={"0x0":"reverted","0x1":"success"};function Sd(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Zt(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?ln(e.transactionIndex):null,status:e.status?Ew[e.status]:null,type:e.type?Af[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Ka=256;let Ws=Ka,_s;function Pd(e=11){if(!_s||Ws+e>Ka*2){_s="",Ws=0;for(let t=0;t<Ka;t++)_s+=(256+Math.random()*256|0).toString(16).substring(1)}return _s.substring(Ws,Ws+++e)}function Sw(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:o,key:s="base",name:i="Base Client",type:l="base"}=e,a=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),c=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(c/2),500),4e3),f=e.pollingInterval??u,p=e.cacheTime??f,d=e.account?ft(e.account):void 0,{config:h,request:b,value:w}=e.transport({account:d,chain:n,pollingInterval:f}),T={...h,...w},x={account:d,batch:t,cacheTime:p,ccipRead:r,chain:n,dataSuffix:o,key:s,name:i,pollingInterval:f,request:b,transport:T,type:l,uid:Pd(),...a?{experimental_blockTag:a}:{}};function E(A){return k=>{const F=k(A);for(const m in x)delete F[m];const L={...A,...F};return Object.assign(L,{extend:E(L)})}}return Object.assign(x,{extend:E(x)})}function Za(e){var n,r,o,s,i,l;if(!(e instanceof H))return!1;const t=e.walk(a=>a instanceof ua);return t instanceof ua?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((l=t.data)==null?void 0:l.errorName)==="UnsupportedResolverProfile":!1}function Pw(e){const{abi:t,data:n}=e,r=Zn(n,0,4),o=t.find(s=>s.type==="function"&&r===ao(Mt(s)));if(!o)throw new p1(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?co(o.inputs,Zn(n,4)):void 0}}const Ya="/docs/contract/encodeErrorResult";function Td(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Yn({abi:t,args:r,name:n});if(!a)throw new Nu(n,{docsPath:Ya});o=a}if(o.type!=="error")throw new Nu(void 0,{docsPath:Ya});const s=Mt(o),i=ao(s);let l="0x";if(r&&r.length>0){if(!o.inputs)throw new u1(o.name,{docsPath:Ya});l=$n(o.inputs,r)}return Sr([i,l])}const Xa="/docs/contract/encodeFunctionResult";function Tw(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Yn({abi:t,name:n});if(!i)throw new gr(n,{docsPath:Xa});o=i}if(o.type!=="function")throw new gr(void 0,{docsPath:Xa});if(!o.outputs)throw new $u(o.name,{docsPath:Xa});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Iu(r)})();return $n(o.outputs,s)}const Ho="x-batch-gateway:true";async function Ad(e){const{data:t,ccipRequest:n}=e,{args:[r]}=Pw({abi:ja,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,l)=>{try{s[l]=i.urls.includes(Ho)?await Ad({data:i.data,ccipRequest:n}):await n(i),o[l]=!1}catch(a){o[l]=!0,s[l]=Aw(a)}})),Tw({abi:ja,functionName:"query",result:[o,s]})}function Aw(e){return e.name==="HttpRequestError"&&e.status?Td({abi:ja,errorName:"HttpError",args:[e.status,e.shortMessage]}):Td({abi:[of],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Nd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Dt(t)?t:null}function Ja(e){let t=new Uint8Array(32).fill(0);if(!e)return Be(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=Nd(n[r]),s=o?wr(o):ze(qn(n[r]),"bytes");t=ze(Bt([t,s]),"bytes")}return Be(t)}function Nw(e){return`[${e.slice(2)}]`}function Ow(e){const t=new Uint8Array(32).fill(0);return e?Nd(e)||ze(qn(e)):Be(t)}function Qa(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(qn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=qn(o[s]);i.byteLength>255&&(i=qn(Nw(Ow(o[s])))),n[r]=i.length,n.set(i,r+1),r+=i.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function Cw(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return kr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(p=>s.endsWith(p)))return null;const f=o!=null?[Ja(s),BigInt(o)]:[Ja(s)];try{const p=wt({abi:pd,functionName:"addr",args:f}),d={address:c,abi:fd,functionName:"resolveWithGateways",args:[On(Qa(s)),p,i??[Ho]],blockNumber:n,blockTag:r},b=await ee(e,jt,"readContract")(d);if(b[0]==="0x")return null;const w=kn({abi:pd,args:f,functionName:"addr",data:b[0]});return w==="0x"||Gn(w)==="0x00"?null:w}catch(p){if(l)throw p;if(Za(p))return null;throw p}}class $w extends H{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class Go extends H{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class el extends H{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class Iw extends H{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const Mw=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Dw=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,kw=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Bw=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Lw(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Od(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Cd({uri:e,gatewayUrls:t}){const n=kw.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Od(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Od(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(Mw),{protocol:i,subpath:l,target:a,subtarget:c=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||l==="ipns/",f=i==="ipfs:/"||l==="ipfs/"||Dw.test(e);if(e.startsWith("http")&&!u&&!f){let d=e;return t!=null&&t.arweave&&(d=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:d,isOnChain:!1,isEncoded:!1}}if((u||f)&&a)return{uri:`${r}/${u?"ipns":"ipfs"}/${a}${c}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${c||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(Bw,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new el({uri:e})}function $d(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new $w({data:e});return e.image||e.image_url||e.image_data}async function Fw({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await tl({gatewayUrls:e,uri:$d(n)})}catch{throw new el({uri:t})}}async function tl({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Cd({uri:t,gatewayUrls:e});if(r||await Lw(n))return n;throw new el({uri:t})}function Rw(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[l,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new Go({reason:"Only EIP-155 supported"});if(!i)throw new Go({reason:"Chain ID not found"});if(!a)throw new Go({reason:"Contract address not found"});if(!o)throw new Go({reason:"Token ID not found"});if(!l)throw new Go({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:l.toLowerCase(),contractAddress:a,tokenID:o}}async function jw(e,{nft:t}){if(t.namespace==="erc721")return jt(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return jt(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Iw({namespace:t.namespace})}async function zw(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Uw(e,{gatewayUrls:t,record:n}):tl({uri:n,gatewayUrls:t})}async function Uw(e,{gatewayUrls:t,record:n}){const r=Rw(n),o=await jw(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:l}=Cd({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const c=l?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(c);return tl({uri:$d(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Fw({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Id(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return kr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(f=>s.endsWith(f)))return null;try{const f={address:c,abi:fd,args:[On(Qa(s)),wt({abi:dd,functionName:"text",args:[Ja(s),o]}),i??[Ho]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},d=await ee(e,jt,"readContract")(f);if(d[0]==="0x")return null;const h=kn({abi:dd,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(l)throw f;if(Za(f))return null;throw f}}async function Ww(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:l}){const a=await ee(e,Id,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:l,gatewayUrls:s,strict:i});if(!a)return null;try{return await zw(e,{record:a,gatewayUrls:r})}catch{return null}}async function _w(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return kr({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const u={address:c,abi:sw,args:[n,s,i??[Ho]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=ee(e,jt,"readContract"),[p]=await f(u);return p||null}catch(u){if(l)throw u;if(Za(u))return null;throw u}}async function Vw(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return kr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),l=s==null?void 0:s.ensTlds;if(l&&!l.some(c=>o.endsWith(c)))throw new Error(`${o} is not a valid ENS TLD (${l==null?void 0:l.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await ee(e,jt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[On(Qa(o))],blockNumber:n,blockTag:r});return a}async function Md(e,t){var w,T,x;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,b=n?ft(n):void 0;try{Cr(t);const A=(typeof r=="bigint"?ne(r):void 0)||o,k=(x=(T=(w=e.chain)==null?void 0:w.formatters)==null?void 0:T.transactionRequest)==null?void 0:x.format,L=(k||Lo)({...Ms(h,{format:k}),account:b,blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d},"createAccessList"),m=await e.request({method:"eth_createAccessList",params:[L,A]});return{accessList:m.accessList,gasUsed:BigInt(m.gasUsed)}}catch(E){throw yd(E,{...t,account:b,chain:e.chain})}}async function Hw(e){const t=Ns(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Dd(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:l}={}){const a=o??(r?[r]:void 0),c=Ns(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(d=>lo({abi:[d],eventName:d.name,args:n}))],r&&(u=u[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?ne(s):s,toBlock:typeof l=="bigint"?ne(l):l,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:c(f),strict:!!i,toBlock:l,type:"event"}}async function kd(e){const t=Ns(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Gw(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var i,l,a;if((i=e.batch)!=null&&i.multicall&&((a=(l=e.chain)==null?void 0:l.contracts)!=null&&a.multicall3)){const c=e.chain.contracts.multicall3.address,u=wt({abi:Mr,functionName:"getEthBalance",args:[t]}),{data:f}=await ee(e,Br,"call")({to:c,data:u,blockNumber:n,blockTag:r});return kn({abi:Mr,functionName:"getEthBalance",args:[t],data:f||"0x"})}const o=typeof n=="bigint"?ne(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function qw(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Kw(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?ne(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),ln(s)}async function Vs(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?ne(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}async function Zw(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=await Vs(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(o&&Te(o)===23&&o.startsWith("0xef0100"))return un(Zn(o,3,23))}class Yw extends H{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function Xw(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,l,a,c,u,f]=await ee(e,jt,"readContract")({abi:Jw,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:l,chainId:Number(a),verifyingContract:c,salt:u},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Yw({address:n}):i}}const Jw=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function Qw(e){var t;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:(t=e.reward)==null?void 0:t.map(n=>n.map(r=>BigInt(r)))}}async function ev(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?ne(n):void 0,i=await e.request({method:"eth_feeHistory",params:[ne(t),s||r,o]},{dedupe:!!s});return Qw(i)}async function tv(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Zt(s));return t.abi?Ca({abi:t.abi,logs:o,strict:n}):o}async function nv({address:e,authorization:t,signature:n}){return Fo(un(e),await xf({authorization:t,signature:n}))}const Hs=new Ts(8192);function rv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Hs.get(n))return Hs.get(n);const r=e().finally(()=>Hs.delete(n));return Hs.set(n,r),r}function ov(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:l=3,uid:a}={...t,...r},{method:c}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(c))throw new Qn(new Error("method not supported"),{method:c});if(s!=null&&s.include&&!s.include.includes(c))throw new Qn(new Error("method not supported"),{method:c});const u=o?oo(`${a}.${Le(n)}`):void 0;return rv(()=>qa(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case ho.code:throw new ho(d);case mo.code:throw new mo(d);case bo.code:throw new bo(d,{method:n.method});case go.code:throw new go(d);case Jn.code:throw new Jn(d);case In.code:throw new In(d);case yo.code:throw new yo(d);case wo.code:throw new wo(d);case vo.code:throw new vo(d);case Qn.code:throw new Qn(d,{method:n.method});case Tr.code:throw new Tr(d);case xo.code:throw new xo(d);case Ar.code:throw new Ar(d);case Eo.code:throw new Eo(d);case So.code:throw new So(d);case Po.code:throw new Po(d);case To.code:throw new To(d);case Ao.code:throw new Ao(d);case No.code:throw new No(d);case Oo.code:throw new Oo(d);case Co.code:throw new Co(d);case $o.code:throw new $o(d);case Io.code:throw new Io(d);case Mo.code:throw new Mo(d);case Do.code:throw new Do(d);case 5e3:throw new Ar(d);case ko.code:throw new ko(d);default:throw p instanceof H?p:new Vg(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Xn){const b=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(b!=null&&b.match(/\d/))return Number.parseInt(b,10)*1e3}return~~(1<<p)*i},retryCount:l,shouldRetry:({error:p})=>sv(p)}),{enabled:o,id:u})}}function sv(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Tr.code||e.code===Jn.code:e instanceof Xn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class iv extends H{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var l;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(l=n.metaMessages)!=null&&l.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${po(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class av extends H{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${po(n)}`,`Response: ${Le(t)}`],name:"OffchainLookupResponseMalformedError"})}}class lv extends H{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const cv="0x556f1830",Bd={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function uv(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=cf({data:r,abi:[Bd]}),[i,l,a,c,u]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Ld;try{if(!Fo(o,i))throw new lv({sender:i,to:o});const d=l.includes(Ho)?await Ad({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:l}),{data:h}=await Br(e,{blockNumber:t,blockTag:n,data:Bt([c,$n([{type:"bytes"},{type:"bytes"}],[d,u])]),to:o});return h}catch(d){throw new iv({callbackSelector:c,cause:d,data:r,extraData:u,sender:i,urls:l})}}async function Ld({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],l=i.includes("{data}")?"GET":"POST",a=l==="POST"?{data:e,sender:t}:void 0,c=l==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:c,method:l});let f;if((o=u.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await u.json()).data:f=await u.text(),!u.ok){r=new Xn({body:a,details:f!=null&&f.error?Le(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!Dt(f)){r=new av({result:f,url:i});continue}return f}catch(u){r=new Xn({body:a,details:u.message,url:i})}}throw r}const fv=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Ld,offchainLookup:uv,offchainLookupAbiItem:Bd,offchainLookupSignature:cv},Symbol.toStringTag,{value:"Module"}));function dv(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return o=>{const s=typeof o=="function"?o(r):o,i={...r,...s};return Object.assign(i,{extend:n(i)})}}return Object.assign(t,{extend:n(t)})}function pv(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const l=new AbortController;n>0&&(i=setTimeout(()=>{r&&l.abort()},n)),o(await e({signal:(l==null?void 0:l.signal)||null}))}catch(l){(l==null?void 0:l.name)==="AbortError"&&s(t),s(l)}finally{clearTimeout(i)}})()})}function hv(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Fd=hv();function mv(e,t={}){const{url:n,headers:r}=bv(e);return{async request(o){var h;const{body:s,fetchFn:i=t.fetchFn??fetch,onRequest:l=t.onRequest,onResponse:a=t.onResponse,timeout:c=t.timeout??1e4}=o,u={...t.fetchOptions??{},...o.fetchOptions??{}},{headers:f,method:p,signal:d}=u;try{const b=await pv(async({signal:T})=>{const x={...u,body:Array.isArray(s)?Le(s.map(F=>({jsonrpc:"2.0",id:F.id??Fd.take(),...F}))):Le({jsonrpc:"2.0",id:s.id??Fd.take(),...s}),headers:{...r,"Content-Type":"application/json",...f},method:p||"POST",signal:d||(c>0?T:null)},E=new Request(n,x),A=await(l==null?void 0:l(E,x))??{...x,url:n};return await i(A.url??n,A)},{errorInstance:new bf({body:s,url:n}),timeout:c,signal:!0});a&&await a(b);let w;if((h=b.headers.get("Content-Type"))!=null&&h.startsWith("application/json"))w=await b.json();else{w=await b.text();try{w=JSON.parse(w||"{}")}catch(T){if(b.ok)throw T;w={error:w}}}if(!b.ok)throw new Xn({body:s,details:Le(w.error)||b.statusText,headers:b.headers,status:b.status,url:n});return w}catch(b){throw b instanceof Xn||b instanceof bf?b:new Xn({body:s,cause:b,url:n})}}}}function bv(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const gv=`Ethereum Signed Message:
89
- `;function yv(e){const t=typeof e=="string"?oo(e):typeof e.raw=="string"?e.raw:Be(e.raw),n=oo(`${gv}${Te(t)}`);return Bt([n,t])}function Rd(e,t){return ze(yv(e),t)}class wv extends H{constructor({domain:t}){super(`Invalid domain "${Le(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class vv extends H{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class xv extends H{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function Ev(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,l)=>{for(const a of i){const{name:c,type:u}=a,f=l[c],p=u.match(Ju);if(p&&(typeof f=="number"||typeof f=="bigint")){const[b,w,T]=p;ne(f,{signed:w==="int",size:Number.parseInt(T,10)/8})}if(u==="address"&&typeof f=="string"&&!yt(f))throw new Cn({address:f});const d=u.match(ag);if(d){const[b,w]=d;if(w&&Te(f)!==Number.parseInt(w,10))throw new m1({expectedSize:Number.parseInt(w,10),givenSize:Te(f)})}const h=o[u];h&&(Pv(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new wv({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new vv({primaryType:r,types:o})}function Sv({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function Pv(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new xv({type:e})}function Tv(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:Sv({domain:t}),...e.types};Ev({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(Av({domain:t,types:o})),r!=="EIP712Domain"&&s.push(jd({data:n,primaryType:r,types:o})),ze(Bt(s))}function Av({domain:e,types:t}){return jd({data:e,primaryType:"EIP712Domain",types:t})}function jd({data:e,primaryType:t,types:n}){const r=zd({data:e,primaryType:t,types:n});return ze(r)}function zd({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[Nv({primaryType:t,types:n})];for(const s of n[t]){const[i,l]=Wd({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(l)}return $n(r,o)}function Nv({primaryType:e,types:t}){const n=On(Ov({primaryType:e,types:t}));return ze(n)}function Ov({primaryType:e,types:t}){let n="";const r=Ud({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const s of o)n+=`${s}(${t[s].map(({name:i,type:l})=>`${l} ${i}`).join(",")})`;return n}function Ud({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),o=r==null?void 0:r[0];if(n.has(o)||t[o]===void 0)return n;n.add(o);for(const s of t[o])Ud({primaryType:s.type,types:t},n);return n}function Wd({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},ze(zd({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},ze(r)];if(n==="string")return[{type:"bytes32"},ze(On(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Wd({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},ze($n(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class Cv extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const nl={checksum:new Cv(8192)}.checksum;class _d extends Ji{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,F1(t);const r=Ss(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),Er(s)}update(t){return xr(this),this.iHash.update(t),this}digestInto(t){xr(this),Kn(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:l}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=l,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Vd=(e,t,n)=>new _d(e,t).update(n).digest();Vd.create=(e,t)=>new _d(e,t);function Hd(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=qu(jy(e));return n==="Bytes"?r:Rt(r)}const $v=/^0x[a-fA-F0-9]{40}$/;function Gs(e,t={}){const{strict:n=!0}=t;if(!$v.test(e))throw new qd({address:e,cause:new Iv});if(n){if(e.toLowerCase()===e)return;if(Gd(e)!==e)throw new qd({address:e,cause:new Mv})}}function Gd(e){if(nl.has(e))return nl.get(e);Gs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Hd(Uy(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const o=`0x${r.join("")}`;return nl.set(e,o),o}function rl(e,t={}){const{strict:n=!0}=t??{};try{return Gs(e,{strict:n}),!0}catch{return!1}}class qd extends re{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class Iv extends re{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class Mv extends re{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const Dv=/^(.*)\[([0-9]*)\]$/,kv=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Kd=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Zd=2n**256n-1n;function Lr(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=al(t.type);if(s){const[i,l]=s;return Lv(e,{...t,type:l},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return zv(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return Bv(e,{checksum:r});if(t.type==="bool")return Fv(e);if(t.type.startsWith("bytes"))return Rv(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return jv(e,t);if(t.type==="string")return Uv(e,{staticPosition:o});throw new ul(t.type)}const Yd=32,ol=32;function Bv(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Gd(s):s)(Rt(_y(r,-20))),32]}function Lv(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=hn(e.readBytes(ol)),c=s+a,u=c+Yd;e.setPosition(c);const f=hn(e.readBytes(Yd)),p=qo(t);let d=0;const h=[];for(let b=0;b<f;++b){e.setPosition(u+(p?b*32:d));const[w,T]=Lr(e,t,{checksumAddress:r,staticPosition:u});d+=T,h.push(w)}return e.setPosition(s+32),[h,32]}if(qo(t)){const a=hn(e.readBytes(ol)),c=s+a,u=[];for(let f=0;f<o;++f){e.setPosition(c+f*32);const[p]=Lr(e,t,{checksumAddress:r,staticPosition:c});u.push(p)}return e.setPosition(s+32),[u,32]}let i=0;const l=[];for(let a=0;a<o;++a){const[c,u]=Lr(e,t,{checksumAddress:r,staticPosition:s+i});i+=u,l.push(c)}return[l,i]}function Fv(e){return[Hy(e.readBytes(32),{size:32}),32]}function Rv(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=hn(e.readBytes(32));e.setPosition(n+i);const l=hn(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[Rt(a),32]}return[Rt(e.readBytes(Number.parseInt(o,10),32)),32]}function jv(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?Vy(o,{signed:n}):hn(o,{signed:n}),32]}function zv(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let l=0;if(qo(t)){const a=hn(e.readBytes(ol)),c=o+a;for(let u=0;u<t.components.length;++u){const f=t.components[u];e.setPosition(c+l);const[p,d]=Lr(e,f,{checksumAddress:r,staticPosition:c});l+=d,i[s?u:f==null?void 0:f.name]=p}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const c=t.components[a],[u,f]=Lr(e,c,{checksumAddress:r,staticPosition:o});i[s?a:c==null?void 0:c.name]=u,l+=f}return[i,l]}function Uv(e,{staticPosition:t}){const n=hn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=hn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=Gy(td(s));return e.setPosition(t+32),[i,32]}function Wv({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(sl({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function sl({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=al(r.type);if(o){const[s,i]=o;return Vv(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Zv(n,{checksumAddress:e,parameter:r});if(r.type==="address")return _v(n,{checksum:e});if(r.type==="bool")return Gv(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Kd.exec(r.type)??[];return qv(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Hv(n,{type:r.type});if(r.type==="string")return Kv(n);throw new ul(r.type)}function il(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=dt(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(Ve(t+o,{size:32})),r.push(l),o+=dt(l)):n.push(l)}return Ft(...n,...r)}function _v(e,t){const{checksum:n=!1}=t;return Gs(e,{strict:n}),{dynamic:!1,encoded:tr(e.toLowerCase())}}function Vv(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new o6(e);if(!s&&e.length!==r)throw new r6({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const l=[];for(let a=0;a<e.length;a++){const c=sl({checksumAddress:n,parameter:o,value:e[a]});c.dynamic&&(i=!0),l.push(c)}if(s||i){const a=il(l);if(s){const c=Ve(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?Ft(c,a):c}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Ft(...l.map(({encoded:a})=>a))}}function Hv(e,{type:t}){const[,n]=t.split("bytes"),r=dt(e);if(!n){let o=e;return r%32!==0&&(o=nr(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Ft(tr(Ve(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new Qd({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:nr(e)}}function Gv(e){if(typeof e!="boolean")throw new re(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:tr(nd(e))}}function qv(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new sd({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Ve(e,{size:32,signed:t})}}function Kv(e){const t=Ra(e),n=Math.ceil(dt(t)/32),r=[];for(let o=0;o<n;o++)r.push(nr(Yt(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Ft(nr(Ve(dt(t),{size:32})),...r)}}function Zv(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const l=r.components[i],a=Array.isArray(e)?i:l.name,c=sl({checksumAddress:n,parameter:l,value:e[a]});s.push(c),c.dynamic&&(o=!0)}return{dynamic:o,encoded:o?il(s):Ft(...s.map(({encoded:i})=>i))}}function al(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function qo(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(qo);const n=al(e.type);return!!(n&&qo({...e,type:n[1]}))}const Yv={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Qv({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Jv({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Xd({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Xd({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Xv(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Yv);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Xd extends re{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Jv extends re{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class Qv extends re{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function e6(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?ed(t):t,i=Xv(s);if(Ir(s)===0&&e.length>0)throw new n6;if(Ir(s)&&Ir(s)<32)throw new t6({data:typeof t=="string"?t:Rt(t),parameters:e,size:Ir(s)});let l=0;const a=r==="Array"?[]:{};for(let c=0;c<e.length;++c){const u=e[c];i.setPosition(l);const[f,p]=Lr(i,u,{checksumAddress:o,staticPosition:0});l+=p,r==="Array"?a.push(f):a[u.name??c]=f}return a}function ll(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new e0({expectedLength:e.length,givenLength:t.length});const o=Wv({checksumAddress:r,parameters:e,values:t}),s=il(o);return s.length===0?"0x":s}function cl(e,t){if(e.length!==t.length)throw new e0({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r];n.push(cl.encode(o,s))}return Ft(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Gs(a),tr(a.toLowerCase(),o?32:0)}if(n==="string")return Ra(r);if(n==="bytes")return r;if(n==="bool")return tr(nd(r),o?32:1);const s=n.match(Kd);if(s){const[a,c,u="256"]=s,f=Number.parseInt(u,10)/8;return Ve(r,{size:o?32:f,signed:c==="int"})}const i=n.match(kv);if(i){const[a,c]=i;if(Number.parseInt(c,10)!==(r.length-2)/2)throw new Qd({expectedSize:Number.parseInt(c,10),value:r});return nr(r,o?32:0)}const l=n.match(Dv);if(l&&Array.isArray(r)){const[a,c]=l,u=[];for(let f=0;f<r.length;f++)u.push(t(c,r[f],!0));return u.length===0?"0x":Ft(...u)}throw new ul(n)}e.encode=t})(cl||(cl={}));function Jd(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?Eu(e):e}class t6 extends re{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${mr(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class n6 extends re{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class r6 extends re{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class Qd extends re{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${dt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class e0 extends re{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
90
- `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class o6 extends re{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class ul extends re{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const et=BigInt(0),He=BigInt(1),rr=BigInt(2),s6=BigInt(3),t0=BigInt(4),n0=BigInt(5),r0=BigInt(8);function tt(e,t){const n=e%t;return n>=et?n:t+n}function xt(e,t,n){let r=e;for(;t-- >et;)r*=r,r%=n;return r}function fl(e,t){if(e===et)throw new Error("invert: expected non-zero number");if(t<=et)throw new Error("invert: expected positive modulus, got "+t);let n=tt(e,t),r=t,o=et,s=He;for(;n!==et;){const l=r/n,a=r%n,c=o-s*l;r=n,n=a,o=s,s=c}if(r!==He)throw new Error("invert: does not exist");return tt(o,t)}function o0(e,t){const n=(e.ORDER+He)/t0,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function i6(e,t){const n=(e.ORDER-n0)/r0,r=e.mul(t,rr),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,rr),o),l=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(l),t))throw new Error("Cannot find square root");return l}function a6(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-He,n=0;for(;t%rr===et;)t/=rr,n++;let r=rr;const o=dl(e);for(;i0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return o0;let s=o.pow(r,t);const i=(t+He)/rr;return function(a,c){if(a.is0(c))return c;if(i0(a,c)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),p=a.pow(c,t),d=a.pow(c,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,b=a.sqr(p);for(;!a.eql(b,a.ONE);)if(h++,b=a.sqr(b),h===u)throw new Error("Cannot find square root");const w=He<<BigInt(u-h-1),T=a.pow(f,w);u=h,f=a.sqr(T),p=a.mul(p,f),d=a.mul(d,T)}return d}}function l6(e){return e%t0===s6?o0:e%r0===n0?i6:a6(e)}const c6=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function u6(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=c6.reduce((r,o)=>(r[o]="function",r),t);return Rs(e,n)}function f6(e,t,n){if(n<et)throw new Error("invalid exponent, negatives unsupported");if(n===et)return e.ONE;if(n===He)return t;let r=e.ONE,o=t;for(;n>et;)n&He&&(r=e.mul(r,o)),o=e.sqr(o),n>>=He;return r}function s0(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,l,a)=>e.is0(l)?i:(r[a]=i,e.mul(i,l)),e.ONE),s=e.inv(o);return t.reduceRight((i,l,a)=>e.is0(l)?i:(r[a]=e.mul(i,r[a]),e.mul(i,l)),s),r}function i0(e,t){const n=(e.ORDER-He)/rr,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function a0(e,t){t!==void 0&&so(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function dl(e,t,n=!1,r={}){if(e<=et)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=a0(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const l=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:Fs(o),ZERO:et,ONE:He,create:a=>tt(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return et<=a&&a<e},is0:a=>a===et,isOdd:a=>(a&He)===He,neg:a=>tt(-a,e),eql:(a,c)=>a===c,sqr:a=>tt(a*a,e),add:(a,c)=>tt(a+c,e),sub:(a,c)=>tt(a-c,e),mul:(a,c)=>tt(a*c,e),pow:(a,c)=>f6(l,a,c),div:(a,c)=>tt(a*fl(c,e),e),sqrN:a=>a*a,addN:(a,c)=>a+c,subN:(a,c)=>a-c,mulN:(a,c)=>a*c,inv:a=>fl(a,e),sqrt:r.sqrt||(a=>(i||(i=l6(e)),i(l,a))),toBytes:a=>n?Gf(a,s):Uo(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Hf(a):er(a)},invertBatch:a=>s0(l,a),cmov:(a,c,u)=>u?c:a});return Object.freeze(l)}function l0(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function c0(e){const t=l0(e);return t+Math.ceil(t/2)}function d6(e,t,n=!1){const r=e.length,o=l0(t),s=c0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Hf(e):er(e),l=tt(i,t-He)+He;return n?Gf(l,o):Uo(l,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u0=BigInt(0),pl=BigInt(1);function hl(e,t){const n=t.negate();return e?n:t}function f0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function ml(e,t){f0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Fs(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function d0(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let l=Number(e&o),a=e>>i;l>r&&(l-=s,a+=pl);const c=t*r,u=c+Math.abs(l)-1,f=l===0,p=l<0,d=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:c}}function p6(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function h6(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const bl=new WeakMap,p0=new WeakMap;function gl(e){return p0.get(e)||1}function m6(e,t){return{constTimeNegate:hl,hasPrecomputes(n){return gl(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>u0;)r&pl&&(o=o.add(s)),s=s.double(),r>>=pl;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=ml(r,t),i=[];let l=n,a=l;for(let c=0;c<o;c++){a=l,i.push(a);for(let u=1;u<s;u++)a=a.add(l),i.push(a);l=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const l=ml(n,t);for(let a=0;a<l.windows;a++){const{nextN:c,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:h}=d0(o,a,l);o=c,f?i=i.add(hl(d,r[h])):s=s.add(hl(p,r[u]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=ml(n,t);for(let l=0;l<i.windows&&o!==u0;l++){const{nextN:a,offset:c,isZero:u,isNeg:f}=d0(o,l,i);if(o=a,!u){const p=r[c];s=s.add(f?p.negate():p)}}return s},getPrecomputes(n,r,o){let s=bl.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&bl.set(r,o(s))),s},wNAFCached(n,r,o){const s=gl(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=gl(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){f0(r,t),p0.set(n,r),bl.delete(n)}}}function b6(e,t,n,r){p6(n,e),h6(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,l=Oy(BigInt(o));let a=1;l>12?a=l-3:l>4?a=l-2:l>0&&(a=2);const c=Fs(a),u=new Array(Number(c)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){u.fill(i);for(let b=0;b<s;b++){const w=r[b],T=Number(w>>BigInt(d)&c);u[T]=u[T].add(n[b])}let h=i;for(let b=u.length-1,w=i;b>0;b--)w=w.add(u[b]),h=h.add(w);if(p=p.add(h),d!==0)for(let b=0;b<a;b++)p=p.double()}return p}function h0(e){return u6(e.Fp),Rs(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...a0(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function m0(e){e.lowS!==void 0&&jo("lowS",e.lowS),e.prehash!==void 0&&jo("prehash",e.prehash)}function g6(e){const t=h0(e);Rs(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}class y6 extends Error{constructor(t=""){super(t)}}const mn={Err:y6,_tlv:{encode:(e,t)=>{const{Err:n}=mn;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=ks(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?ks(o.length/2|128):"";return ks(e)+s+o+t},decode(e,t){const{Err:n}=mn;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const c=t.subarray(r,r+a);if(c.length!==a)throw new n("tlv.decode: length bytes not complete");if(c[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of c)i=i<<8|u;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const l=t.subarray(r,r+i);if(l.length!==i)throw new n("tlv.decode: wrong value length");return{v:l,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=mn;if(e<bn)throw new t("integer: negative integers are not allowed");let n=ks(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=mn;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return er(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=mn,o=vt("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:l,l:a}=r.decode(2,s),{v:c,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(l),s:n.decode(c)}},hexFromSig(e){const{_tlv:t,_int:n}=mn,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}};function yl(e,t){return zo(Uo(e,t))}const bn=BigInt(0),Re=BigInt(1);BigInt(2);const wl=BigInt(3),w6=BigInt(4);function v6(e){const t=g6(e),{Fp:n}=t,r=dl(t.n,t.nBitLength),o=t.toBytes||((E,A,k)=>{const F=A.toAffine();return Ls(Uint8Array.from([4]),n.toBytes(F.x),n.toBytes(F.y))}),s=t.fromBytes||(E=>{const A=E.subarray(1),k=n.fromBytes(A.subarray(0,n.BYTES)),F=n.fromBytes(A.subarray(n.BYTES,2*n.BYTES));return{x:k,y:F}});function i(E){const{a:A,b:k}=t,F=n.sqr(E),L=n.mul(F,E);return n.add(n.add(L,n.mul(E,A)),k)}function l(E,A){const k=n.sqr(A),F=i(E);return n.eql(k,F)}if(!l(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,wl),w6),c=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,c)))throw new Error("bad curve params: a or b");function u(E){return La(E,Re,t.n)}function f(E){const{allowedPrivateKeyLengths:A,nByteLength:k,wrapPrivateKey:F,n:L}=t;if(A&&typeof E!="bigint"){if(Ro(E)&&(E=zo(E)),typeof E!="string"||!A.includes(E.length))throw new Error("invalid private key");E=E.padStart(k*2,"0")}let m;try{m=typeof E=="bigint"?E:er(vt("private key",E,k))}catch{throw new Error("invalid private key, expected hex or "+k+" bytes, got "+typeof E)}return F&&(m=tt(m,L)),$r("private key",m,Re,L),m}function p(E){if(!(E instanceof b))throw new Error("ProjectivePoint expected")}const d=Kf((E,A)=>{const{px:k,py:F,pz:L}=E;if(n.eql(L,n.ONE))return{x:k,y:F};const m=E.is0();A==null&&(A=m?n.ONE:n.inv(L));const v=n.mul(k,A),S=n.mul(F,A),I=n.mul(L,A);if(m)return{x:n.ZERO,y:n.ZERO};if(!n.eql(I,n.ONE))throw new Error("invZ was invalid");return{x:v,y:S}}),h=Kf(E=>{if(E.is0()){if(t.allowInfinityPoint&&!n.is0(E.py))return;throw new Error("bad point: ZERO")}const{x:A,y:k}=E.toAffine();if(!n.isValid(A)||!n.isValid(k))throw new Error("bad point: x or y not FE");if(!l(A,k))throw new Error("bad point: equation left != right");if(!E.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class b{constructor(A,k,F){if(A==null||!n.isValid(A))throw new Error("x required");if(k==null||!n.isValid(k)||n.is0(k))throw new Error("y required");if(F==null||!n.isValid(F))throw new Error("z required");this.px=A,this.py=k,this.pz=F,Object.freeze(this)}static fromAffine(A){const{x:k,y:F}=A||{};if(!A||!n.isValid(k)||!n.isValid(F))throw new Error("invalid affine point");if(A instanceof b)throw new Error("projective point not allowed");const L=m=>n.eql(m,n.ZERO);return L(k)&&L(F)?b.ZERO:new b(k,F,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){const k=s0(n,A.map(F=>F.pz));return A.map((F,L)=>F.toAffine(k[L])).map(b.fromAffine)}static fromHex(A){const k=b.fromAffine(s(vt("pointHex",A)));return k.assertValidity(),k}static fromPrivateKey(A){return b.BASE.multiply(f(A))}static msm(A,k){return b6(b,r,A,k)}_setWindowSize(A){x.setWindowSize(this,A)}assertValidity(){h(this)}hasEvenY(){const{y:A}=this.toAffine();if(n.isOdd)return!n.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){p(A);const{px:k,py:F,pz:L}=this,{px:m,py:v,pz:S}=A,I=n.eql(n.mul(k,S),n.mul(m,L)),$=n.eql(n.mul(F,S),n.mul(v,L));return I&&$}negate(){return new b(this.px,n.neg(this.py),this.pz)}double(){const{a:A,b:k}=t,F=n.mul(k,wl),{px:L,py:m,pz:v}=this;let S=n.ZERO,I=n.ZERO,$=n.ZERO,C=n.mul(L,L),D=n.mul(m,m),y=n.mul(v,v),O=n.mul(L,m);return O=n.add(O,O),$=n.mul(L,v),$=n.add($,$),S=n.mul(A,$),I=n.mul(F,y),I=n.add(S,I),S=n.sub(D,I),I=n.add(D,I),I=n.mul(S,I),S=n.mul(O,S),$=n.mul(F,$),y=n.mul(A,y),O=n.sub(C,y),O=n.mul(A,O),O=n.add(O,$),$=n.add(C,C),C=n.add($,C),C=n.add(C,y),C=n.mul(C,O),I=n.add(I,C),y=n.mul(m,v),y=n.add(y,y),C=n.mul(y,O),S=n.sub(S,C),$=n.mul(y,D),$=n.add($,$),$=n.add($,$),new b(S,I,$)}add(A){p(A);const{px:k,py:F,pz:L}=this,{px:m,py:v,pz:S}=A;let I=n.ZERO,$=n.ZERO,C=n.ZERO;const D=t.a,y=n.mul(t.b,wl);let O=n.mul(k,m),M=n.mul(F,v),P=n.mul(L,S),B=n.add(k,F),R=n.add(m,v);B=n.mul(B,R),R=n.add(O,M),B=n.sub(B,R),R=n.add(k,L);let z=n.add(m,S);return R=n.mul(R,z),z=n.add(O,P),R=n.sub(R,z),z=n.add(F,L),I=n.add(v,S),z=n.mul(z,I),I=n.add(M,P),z=n.sub(z,I),C=n.mul(D,R),I=n.mul(y,P),C=n.add(I,C),I=n.sub(M,C),C=n.add(M,C),$=n.mul(I,C),M=n.add(O,O),M=n.add(M,O),P=n.mul(D,P),R=n.mul(y,R),M=n.add(M,P),P=n.sub(O,P),P=n.mul(D,P),R=n.add(R,P),O=n.mul(M,R),$=n.add($,O),O=n.mul(z,R),I=n.mul(B,I),I=n.sub(I,O),O=n.mul(B,M),C=n.mul(z,C),C=n.add(C,O),new b(I,$,C)}subtract(A){return this.add(A.negate())}is0(){return this.equals(b.ZERO)}wNAF(A){return x.wNAFCached(this,A,b.normalizeZ)}multiplyUnsafe(A){const{endo:k,n:F}=t;$r("scalar",A,bn,F);const L=b.ZERO;if(A===bn)return L;if(this.is0()||A===Re)return this;if(!k||x.hasPrecomputes(this))return x.wNAFCachedUnsafe(this,A,b.normalizeZ);let{k1neg:m,k1:v,k2neg:S,k2:I}=k.splitScalar(A),$=L,C=L,D=this;for(;v>bn||I>bn;)v&Re&&($=$.add(D)),I&Re&&(C=C.add(D)),D=D.double(),v>>=Re,I>>=Re;return m&&($=$.negate()),S&&(C=C.negate()),C=new b(n.mul(C.px,k.beta),C.py,C.pz),$.add(C)}multiply(A){const{endo:k,n:F}=t;$r("scalar",A,Re,F);let L,m;if(k){const{k1neg:v,k1:S,k2neg:I,k2:$}=k.splitScalar(A);let{p:C,f:D}=this.wNAF(S),{p:y,f:O}=this.wNAF($);C=x.constTimeNegate(v,C),y=x.constTimeNegate(I,y),y=new b(n.mul(y.px,k.beta),y.py,y.pz),L=C.add(y),m=D.add(O)}else{const{p:v,f:S}=this.wNAF(A);L=v,m=S}return b.normalizeZ([L,m])[0]}multiplyAndAddUnsafe(A,k,F){const L=b.BASE,m=(S,I)=>I===bn||I===Re||!S.equals(L)?S.multiplyUnsafe(I):S.multiply(I),v=m(this,k).add(m(A,F));return v.is0()?void 0:v}toAffine(A){return d(this,A)}isTorsionFree(){const{h:A,isTorsionFree:k}=t;if(A===Re)return!0;if(k)return k(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:A,clearCofactor:k}=t;return A===Re?this:k?k(b,this):this.multiplyUnsafe(t.h)}toRawBytes(A=!0){return jo("isCompressed",A),this.assertValidity(),o(b,this,A)}toHex(A=!0){return jo("isCompressed",A),zo(this.toRawBytes(A))}}b.BASE=new b(t.Gx,t.Gy,n.ONE),b.ZERO=new b(n.ZERO,n.ONE,n.ZERO);const{endo:w,nBitLength:T}=t,x=m6(b,w?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:b,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:u}}function x6(e){const t=h0(e);return Rs(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function E6(e){const t=x6(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,l=2*n.BYTES+1;function a(y){return tt(y,r)}function c(y){return fl(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:f,weierstrassEquation:p,isWithinCurveOrder:d}=v6({...t,toBytes(y,O,M){const P=O.toAffine(),B=n.toBytes(P.x),R=Ls;return jo("isCompressed",M),M?R(Uint8Array.from([O.hasEvenY()?2:3]),B):R(Uint8Array.from([4]),B,n.toBytes(P.y))},fromBytes(y){const O=y.length,M=y[0],P=y.subarray(1);if(O===i&&(M===2||M===3)){const B=er(P);if(!La(B,Re,n.ORDER))throw new Error("Point is not on curve");const R=p(B);let z;try{z=n.sqrt(R)}catch(J){const K=J instanceof Error?": "+J.message:"";throw new Error("Point is not on curve"+K)}const W=(z&Re)===Re;return(M&1)===1!==W&&(z=n.neg(z)),{x:B,y:z}}else if(O===l&&M===4){const B=n.fromBytes(P.subarray(0,n.BYTES)),R=n.fromBytes(P.subarray(n.BYTES,2*n.BYTES));return{x:B,y:R}}else{const B=i,R=l;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+R+", got "+O)}}});function h(y){const O=r>>Re;return y>O}function b(y){return h(y)?a(-y):y}const w=(y,O,M)=>er(y.slice(O,M));class T{constructor(O,M,P){$r("r",O,Re,r),$r("s",M,Re,r),this.r=O,this.s=M,P!=null&&(this.recovery=P),Object.freeze(this)}static fromCompact(O){const M=o;return O=vt("compactSignature",O,M*2),new T(w(O,0,M),w(O,M,2*M))}static fromDER(O){const{r:M,s:P}=mn.toSig(vt("DER",O));return new T(M,P)}assertValidity(){}addRecoveryBit(O){return new T(this.r,this.s,O)}recoverPublicKey(O){const{r:M,s:P,recovery:B}=this,R=L(vt("msgHash",O));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const z=B===2||B===3?M+t.n:M;if(z>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const W=B&1?"03":"02",G=u.fromHex(W+yl(z,n.BYTES)),J=c(z),K=a(-R*J),V=a(P*J),te=u.BASE.multiplyAndAddUnsafe(G,K,V);if(!te)throw new Error("point at infinify");return te.assertValidity(),te}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new T(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Bs(this.toDERHex())}toDERHex(){return mn.hexFromSig(this)}toCompactRawBytes(){return Bs(this.toCompactHex())}toCompactHex(){const O=o;return yl(this.r,O)+yl(this.s,O)}}const x={isValidPrivateKey(y){try{return f(y),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const y=c0(t.n);return d6(t.randomBytes(y),t.n)},precompute(y=8,O=u.BASE){return O._setWindowSize(y),O.multiply(BigInt(3)),O}};function E(y,O=!0){return u.fromPrivateKey(y).toRawBytes(O)}function A(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const M=vt("key",y).length,P=n.BYTES,B=P+1,R=2*P+1;if(!(t.allowedPrivateKeyLengths||o===B))return M===B||M===R}function k(y,O,M=!0){if(A(y)===!0)throw new Error("first arg must be private key");if(A(O)===!1)throw new Error("second arg must be public key");return u.fromHex(O).multiply(f(y)).toRawBytes(M)}const F=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const O=er(y),M=y.length*8-s;return M>0?O>>BigInt(M):O},L=t.bits2int_modN||function(y){return a(F(y))},m=Fs(s);function v(y){return $r("num < 2^"+s,y,bn,m),Uo(y,o)}function S(y,O,M=I){if(["recovered","canonical"].some(he=>he in M))throw new Error("sign() legacy options not supported");const{hash:P,randomBytes:B}=t;let{lowS:R,prehash:z,extraEntropy:W}=M;R==null&&(R=!0),y=vt("msgHash",y),m0(M),z&&(y=vt("prehashed msgHash",P(y)));const G=L(y),J=f(O),K=[v(J),v(G)];if(W!=null&&W!==!1){const he=W===!0?B(n.BYTES):W;K.push(vt("extraEntropy",he))}const V=Ls(...K),te=G;function me(he){const ye=F(he);if(!d(ye))return;const we=c(ye),oe=u.BASE.multiply(ye).toAffine(),_=a(oe.x);if(_===bn)return;const Y=a(we*a(te+_*J));if(Y===bn)return;let Q=(oe.x===_?0:2)|Number(oe.y&Re),ve=Y;return R&&h(Y)&&(ve=b(Y),Q^=1),new T(_,ve,Q)}return{seed:V,k2sig:me}}const I={lowS:t.lowS,prehash:!1},$={lowS:t.lowS,prehash:!1};function C(y,O,M=I){const{seed:P,k2sig:B}=S(y,O,M),R=t;return Cy(R.hash.outputLen,R.nByteLength,R.hmac)(P,B)}u.BASE._setWindowSize(8);function D(y,O,M,P=$){var Q;const B=y;O=vt("msgHash",O),M=vt("publicKey",M);const{lowS:R,prehash:z,format:W}=P;if(m0(P),"strict"in P)throw new Error("options.strict was renamed to lowS");if(W!==void 0&&W!=="compact"&&W!=="der")throw new Error("format must be compact or der");const G=typeof B=="string"||Ro(B),J=!G&&!W&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!G&&!J)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let K,V;try{if(J&&(K=new T(B.r,B.s)),G){try{W!=="compact"&&(K=T.fromDER(B))}catch(ve){if(!(ve instanceof mn.Err))throw ve}!K&&W!=="der"&&(K=T.fromCompact(B))}V=u.fromHex(M)}catch{return!1}if(!K||R&&K.hasHighS())return!1;z&&(O=t.hash(O));const{r:te,s:me}=K,he=L(O),ye=c(me),we=a(he*ye),oe=a(te*ye),_=(Q=u.BASE.multiplyAndAddUnsafe(V,we,oe))==null?void 0:Q.toAffine();return _?a(_.x)===te:!1}return{CURVE:t,getPublicKey:E,getSharedSecret:k,sign:C,verify:D,ProjectivePoint:u,Signature:T,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function S6(e){return{hash:e,hmac:(t,...n)=>Vd(e,t,_1(...n)),randomBytes:V1}}function P6(e,t){const n=r=>E6({...e,...S6(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const b0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),g0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),T6=BigInt(0),A6=BigInt(1),vl=BigInt(2),y0=(e,t)=>(e+t/vl)/t;function N6(e){const t=b0,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),l=BigInt(44),a=BigInt(88),c=e*e*e%t,u=c*c*e%t,f=xt(u,n,t)*u%t,p=xt(f,n,t)*u%t,d=xt(p,vl,t)*c%t,h=xt(d,o,t)*d%t,b=xt(h,s,t)*h%t,w=xt(b,l,t)*b%t,T=xt(w,a,t)*w%t,x=xt(T,l,t)*b%t,E=xt(x,n,t)*u%t,A=xt(E,i,t)*h%t,k=xt(A,r,t)*c%t,F=xt(k,vl,t);if(!xl.eql(xl.sqr(F),e))throw new Error("Cannot find square root");return F}const xl=dl(b0,void 0,void 0,{sqrt:N6}),w0=P6({a:T6,b:BigInt(7),Fp:xl,n:g0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=g0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-A6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),l=y0(s*e,t),a=y0(-r*e,t);let c=tt(e-l*n-a*o,t),u=tt(-l*r-a*s,t);const f=c>i,p=u>i;if(f&&(c=t-c),p&&(u=t-u),c>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:c,k2neg:p,k2:u}}}},Mf),O6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:w0},Symbol.toStringTag,{value:"Module"}));function v0(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Sl({signature:e});if(typeof e.s>"u")throw new Sl({signature:e});if(n&&typeof e.yParity>"u")throw new Sl({signature:e});if(e.r<0n||e.r>Zd)throw new B6({value:e.r});if(e.s<0n||e.s>Zd)throw new L6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new Pl({value:e.yParity})}function C6(e){return x0(Rt(e))}function x0(e){if(e.length!==130&&e.length!==132)throw new k6({signature:e});const t=BigInt(Yt(e,0,32)),n=BigInt(Yt(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return El(o)}catch{throw new Pl({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function $6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return I6(e)}function I6(e){const t=typeof e=="string"?x0(e):e instanceof Uint8Array?C6(e):typeof e.r=="string"?D6(e):e.v?M6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return v0(t),t}function M6(e){return{r:e.r,s:e.s,yParity:El(e.v)}}function D6(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=El(n)),typeof r!="number")throw new Pl({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function El(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new F6({value:e})}class k6 extends re{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${dt(ew(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Sl extends re{constructor({signature:t}){super(`Signature \`${Qf(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class B6 extends re{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class L6 extends re{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class Pl extends re{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class F6 extends re{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function R6(e,t={}){return typeof e.chainId=="string"?j6(e):{...e,...t.signature}}function j6(e){const{address:t,chainId:n,nonce:r}=e,o=$6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const z6="0x8010801080108010801080108010801080108010801080108010801080108010",U6=Jd("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function E0(e){if(typeof e=="string"){if(Yt(e,-32)!==z6)throw new V6(e)}else v0(e.authorization)}function W6(e){E0(e);const t=od(Yt(e,-64,-32)),n=Yt(e,-t-64,-64),r=Yt(e,0,-t-64),[o,s,i]=e6(U6,n);return{authorization:R6({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:r,...i&&i!=="0x"?{data:i,to:s}:{}}}function _6(e){try{return E0(e),!0}catch{return!1}}let V6=class extends re{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};class H6 extends H{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function G6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new H6({value:e});let[n,r="0"]=e.split(".");const o=n.startsWith("-");if(o&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),t===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>t){const[s,i,l]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${l}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function q6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function K6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?ln(e.nonce):void 0,storageProof:e.storageProof?q6(e.storageProof):void 0}}async function Z6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?ne(n):void 0,l=await e.request({method:"eth_getProof",params:[t,o,i||s]});return K6(l)}async function Y6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?ne(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Tl(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:l}){var p,d,h;const a=r||"latest",c=n!==void 0?ne(n):void 0;let u=null;if(o?u=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,ne(s)]},{dedupe:!0}):typeof s=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||a,ne(s)]},{dedupe:!!c}):i&&typeof l=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,ne(l)]},{dedupe:!0})),!u)throw new df({blockHash:t,blockNumber:n,blockTag:a,hash:o,index:s});return(((h=(d=(p=e.chain)==null?void 0:p.formatters)==null?void 0:d.transaction)==null?void 0:h.format)||Ea)(u,"getTransaction")}async function X6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([ee(e,Vo,"getBlockNumber")({}),t?ee(e,Tl,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function qs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new pf({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||Sd)(n,"getTransactionReceipt")}async function J6(e,t){var x;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:l,stateOverride:a}=t,c=t.contracts,{batchSize:u=t.batchSize??1024,deployless:f=t.deployless??!1}=typeof((x=e.batch)==null?void 0:x.multicall)=="object"?e.batch.multicall:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return kr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),d=[[]];let h=0,b=0;for(let E=0;E<c.length;E++){const{abi:A,address:k,args:F,functionName:L}=c[E];try{const m=wt({abi:A,args:F,functionName:L});b+=(m.length-2)/2,u>0&&b>u&&d[h].length>0&&(h++,b=(m.length-2)/2,d[h]=[]),d[h]=[...d[h],{allowFailure:!0,callData:m,target:k}]}catch(m){const v=Nr(m,{abi:A,address:k,args:F,docsPath:"/docs/contract/multicall",functionName:L,sender:n});if(!o)throw v;d[h]=[...d[h],{allowFailure:!0,callData:"0x",target:k}]}}const w=await Promise.allSettled(d.map(E=>ee(e,jt,"readContract")({...p===null?{code:za}:{address:p},abi:Mr,account:n,args:[E],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:l,functionName:"aggregate3",stateOverride:a}))),T=[];for(let E=0;E<w.length;E++){const A=w[E];if(A.status==="rejected"){if(!o)throw A.reason;for(let F=0;F<d[E].length;F++)T.push({status:"failure",error:A.reason,result:void 0});continue}const k=A.value;for(let F=0;F<k.length;F++){const{returnData:L,success:m}=k[F],{callData:v}=d[E][F],{abi:S,address:I,functionName:$,args:C}=c[T.length];try{if(v==="0x")throw new ro;if(!m)throw new Os({data:L});const D=kn({abi:S,args:C,data:L,functionName:$});T.push(o?{result:D,status:"success"}:D)}catch(D){const y=Nr(D,{abi:S,address:I,args:C,docsPath:"/docs/contract/multicall",functionName:$});if(!o)throw y;T.push({error:y,result:void 0,status:"failure"})}}}if(T.length!==c.length)throw new H("multicall results mismatch");return T}async function Al(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:l}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?cd(p.blockOverrides):void 0,h=p.calls.map(w=>{const T=w,x=T.account?ft(T.account):void 0,E=T.abi?wt(T):T.data,A={...T,account:x,data:T.dataSuffix?Bt([E||"0x",T.dataSuffix]):E,from:T.from??(x==null?void 0:x.address)};return Cr(A),Lo(A)}),b=p.stateOverrides?va(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:b})}const u=(typeof n=="bigint"?ne(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:l},u]})).map((p,d)=>({...Nf(p),calls:p.calls.map((h,b)=>{var S,I;const{abi:w,args:T,functionName:x,to:E}=o[d].calls[b],A=((S=h.error)==null?void 0:S.data)??h.returnData,k=BigInt(h.gasUsed),F=(I=h.logs)==null?void 0:I.map($=>Zt($)),L=h.status==="0x1"?"success":"failure",m=w&&L==="success"&&A!=="0x"?kn({abi:w,data:A,functionName:x}):null,v=(()=>{if(L==="success")return;let $;if(A==="0x"?$=new ro:A&&($=new Os({data:A})),!!$)return Nr($,{abi:w??[],address:E??"0x",args:T,functionName:x??"<unknown>"})})();return{data:A,gasUsed:k,logs:F,status:L,...L==="success"?{result:m}:{error:v}}})}))}catch(a){const c=a,u=Is(c,{});throw u instanceof Bo?c:u}}function Nl(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function","error",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new re("Unable to normalize signature.");return o}function Ol(e,t){const n=typeof e,r=t.type;switch(r){case"address":return rl(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>Ol(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>Ol(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function S0(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return S0(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?rl(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?rl(n[r],{strict:!1}):!1)return i}}function P0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?xu(e):e;return{...r,...n?{hash:Fr(r)}:{}}}function Ks(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=tw(t,{strict:!1}),i=e.filter(c=>s?c.type==="function"||c.type==="error"?T0(c)===Yt(t,0,4):c.type==="event"?Fr(c)===t:!1:"name"in c&&c.name===t);if(i.length===0)throw new Zs({name:t});if(i.length===1)return{...i[0],...o?{hash:Fr(i[0])}:{}};let l;for(const c of i){if(!("inputs"in c))continue;if(!r||r.length===0){if(!c.inputs||c.inputs.length===0)return{...c,...o?{hash:Fr(c)}:{}};continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in c&&c.inputs[p];return d?Ol(f,d):!1})){if(l&&"inputs"in l&&l.inputs){const f=S0(c.inputs,l.inputs,r);if(f)throw new e5({abiItem:c,type:f[0]},{abiItem:l,type:f[1]})}l=c}}const a=(()=>{if(l)return l;const[c,...u]=i;return{...c,overloads:u}})();if(!a)throw new Zs({name:t});return{...a,...o?{hash:Fr(a)}:{}}}function T0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Ks(n,r)}return e[0]})();return Yt(Fr(t),0,4)}function Q6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return Ks(r,o)}return e[0]})(),n=typeof t=="string"?t:ys(t);return Nl(n)}function Fr(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Ks(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Hd(Ra(Q6(t)))}class e5 extends re{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Nl(ys(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Nl(ys(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class Zs extends re{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function t5(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,l]=e;return[r5(i),l]}return e})(),{bytecode:r,args:o}=n;return Ft(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?ll(t.inputs,o):"0x")}function n5(e){return P0(e)}function r5(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new Zs({name:"constructor"});return t}function o5(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[c,u,f]=e;return[A0(c,u,{args:f}),f]}const[l,a]=e;return[l,a]})(),{overloads:r}=t,o=r?A0([t,...r],t.name,{args:n}):t,s=s5(o),i=n.length>0?ll(o.inputs,n):void 0;return i?Ft(s,i):s}function Rr(e,t={}){return P0(e,t)}function A0(e,t,n){const r=Ks(e,t,n);if(r.type!=="function")throw new Zs({name:t,type:"function"});return r}function s5(e){return T0(e)}const i5="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",zt="0x0000000000000000000000000000000000000000",a5="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function l5(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:l,validation:a}=t,c=t.account?ft(t.account):void 0;if(i&&!c)throw new H("`account` is required when `traceAssetChanges` is true");const u=c?t5(n5("constructor(bytes, bytes)"),{bytecode:bd,args:[a5,o5(Rr("function getBalance(address)"),[c.address])]}):void 0,f=i?await Promise.all(t.calls.map(async P=>{if(!P.data&&!P.abi)return;const{accessList:B}=await Md(e,{account:c.address,...P,data:P.abi?wt(P):P.data});return B.map(({address:R,storageKeys:z})=>z.length>0?R:null)})).then(P=>P.flat().filter(Boolean)):[],p=await Al(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((P,B)=>({abi:[Rr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:P,from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]}]:[],{calls:[...o,{to:zt}].map(P=>({...P,from:c==null?void 0:c.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((P,B)=>({abi:[Rr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:P,from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]},{calls:f.map((P,B)=>({to:P,abi:[Rr("function decimals() returns (uint256)")],functionName:"decimals",from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]},{calls:f.map((P,B)=>({to:P,abi:[Rr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]},{calls:f.map((P,B)=>({to:P,abi:[Rr("function symbol() returns (string)")],functionName:"symbol",from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]}]:[]],traceTransfers:l,validation:a}),d=i?p[2]:p[0],[h,b,,w,T,x,E,A]=i?p:[],{calls:k,...F}=d,L=k.slice(0,-1)??[],m=(h==null?void 0:h.calls)??[],v=(b==null?void 0:b.calls)??[],S=[...m,...v].map(P=>P.status==="success"?Gt(P.data):null),I=(w==null?void 0:w.calls)??[],$=(T==null?void 0:T.calls)??[],C=[...I,...$].map(P=>P.status==="success"?Gt(P.data):null),D=((x==null?void 0:x.calls)??[]).map(P=>P.status==="success"?P.result:null),y=((A==null?void 0:A.calls)??[]).map(P=>P.status==="success"?P.result:null),O=((E==null?void 0:E.calls)??[]).map(P=>P.status==="success"?P.result:null),M=[];for(const[P,B]of C.entries()){const R=S[P];if(typeof B!="bigint"||typeof R!="bigint")continue;const z=D[P-1],W=y[P-1],G=O[P-1],J=P===0?{address:i5,decimals:18,symbol:"ETH"}:{address:f[P-1],decimals:G||z?Number(z??1):void 0,symbol:W??void 0};M.some(K=>K.token.address===J.address)||M.push({token:J,value:{pre:R,post:B,diff:B-R}})}return{assetChanges:M,block:F,results:L}}const N0="0x6492649264926492649264926492649264926492649264926492649264926492";function c5(e){if(Yt(e,-32)!==N0)throw new d5(e)}function u5(e){const{data:t,signature:n,to:r}=e;return Ft(ll(Jd("address, bytes, bytes"),[r,t,n]),N0)}function f5(e){try{return c5(e),!0}catch{return!1}}class d5 extends re{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function p5({r:e,s:t,to:n="hex",v:r,yParity:o}){const s=(()=>{if(o===0||o===1)return o;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new w0.Signature(Gt(e),Gt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:qt(i)}async function Ys(e,t){var a,c,u,f;const{address:n,chain:r=e.chain,hash:o,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??((c=(a=r==null?void 0:r.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:c.address),multicallAddress:i=t.multicallAddress??((f=(u=r==null?void 0:r.contracts)==null?void 0:u.multicall3)==null?void 0:f.address)}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const l=(()=>{const p=t.signature;return Dt(p)?p:typeof p=="object"&&"r"in p&&"s"in p?p5(p):Be(p)})();try{return _6(l)?await h5(e,{...t,multicallAddress:i,signature:l}):await m5(e,{...t,verifierAddress:s,signature:l})}catch(p){try{if(Fo(un(n),await yf({hash:o,signature:l})))return!0}catch{}if(p instanceof or)return!1;throw p}}async function h5(e,t){var w;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:l,data:a,signature:c,to:u}=W6(t.signature);if(await Vs(e,{address:n,blockNumber:r,blockTag:o})===Sr(["0xef0100",l.address]))return await b5(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:c});const p={address:l.address,chainId:Number(l.chainId),nonce:Number(l.nonce),r:ne(l.r,{size:32}),s:ne(l.s,{size:32}),yParity:l.yParity};if(!await nv({address:n,authorization:p}))throw new or;const h=await ee(e,jt,"readContract")({...i?{address:i}:{code:za},authorizationList:[p],abi:Mr,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:u??n,callData:a}]:[],{allowFailure:!0,target:n,callData:wt({abi:hd,functionName:"isValidSignature",args:[s,c]})}]]}),b=(w=h[h.length-1])==null?void 0:w.returnData;if(b!=null&&b.startsWith("0x1626ba7e"))return!0;throw new or}async function m5(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:l,...a}=t,c=await(async()=>!r&&!o||f5(i)?i:u5({data:o,signature:i,to:r}))(),u=l?{to:l,data:wt({abi:md,functionName:"isValidSig",args:[n,s,c]}),...a}:{data:_a({abi:md,args:[n,s,c],bytecode:lw}),...a},{data:f}=await ee(e,Br,"call")(u).catch(p=>{throw p instanceof hf?new or:p});if(P1(f??"0x0"))return!0;throw new or}async function b5(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await ee(e,jt,"readContract")({address:n,abi:hd,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof mf?new or:a})).startsWith("0x1626ba7e"))return!0;throw new or}class or extends Error{}async function g5(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const l=Rd(n);return ee(e,Ys,"verifyHash")({address:t,factory:r,factoryData:o,hash:l,signature:s,...i})}async function y5(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:l,types:a,domain:c,...u}=t,f=Tv({message:i,primaryType:l,types:a,domain:c});return ee(e,Ys,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function O0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const l=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return l?(()=>{const f=Le(["watchBlockNumber",e.uid,t,n,i]);return Bn(f,{onBlockNumber:r,onError:o},p=>_o(async()=>{var d;try{const h=await ee(e,Vo,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let b=a+1n;b<h;b++)p.onBlockNumber(b,a),a=b}(a===void 0||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Le(["watchBlockNumber",e.uid,t,n]);return Bn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const b=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),{unsubscribe:w}=await b.subscribe({params:["newHeads"],onData(T){var E;if(!d)return;const x=Gt((E=T.result)==null?void 0:E.number);p.onBlockNumber(x,a),a=x},onError(T){var x;(x=p.onError)==null||x.call(p,T)}});h=w,d||h()}catch(b){o==null||o(b)}})(),()=>h()})})()}async function w5(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:l=({count:k})=>~~(1<<k)*200,timeout:a=18e4}=t,c=Le(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var k;return t.pollingInterval?t.pollingInterval:(k=e.chain)!=null&&k.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,b,w;const{promise:T,resolve:x,reject:E}=wd(),A=a?setTimeout(()=>{w==null||w(),b==null||b(),E(new jg({hash:o}))},a):void 0;return b=Bn(c,{onReplaced:s,resolve:x,reject:E},async k=>{if(d=await ee(e,qs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(A),k.resolve(d),b==null||b();return}w=ee(e,O0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(F){const L=v=>{clearTimeout(A),w==null||w(),v(),b==null||b()};let m=F;if(!h)try{if(d){if(r>1&&(!d.blockNumber||m-d.blockNumber+1n<r))return;L(()=>k.resolve(d));return}if(n&&!f&&(h=!0,await qa(async()=>{f=await ee(e,Tl,"getTransaction")({hash:o}),f.blockNumber&&(m=f.blockNumber)},{delay:l,retryCount:i}),h=!1),d=await ee(e,qs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||m-d.blockNumber+1n<r))return;L(()=>k.resolve(d))}catch(v){if(v instanceof df||v instanceof pf){if(!f){h=!1;return}try{p=f,h=!0;const S=await qa(()=>ee(e,Lt,"getBlock")({blockNumber:m,includeTransactions:!0}),{delay:l,retryCount:i,shouldRetry:({error:C})=>C instanceof Tf});h=!1;const I=S.transactions.find(({from:C,nonce:D})=>C===p.from&&D===p.nonce);if(!I||(d=await ee(e,qs,"getTransactionReceipt")({hash:I.hash}),r>1&&(!d.blockNumber||m-d.blockNumber+1n<r)))return;let $="replaced";I.to===p.to&&I.value===p.value&&I.input===p.input?$="repriced":I.from===I.to&&I.value===0n&&($="cancelled"),L(()=>{var C;(C=k.onReplaced)==null||C.call(k,{reason:$,replacedTransaction:p,transaction:I,transactionReceipt:d}),k.resolve(d)})}catch(S){L(()=>k.reject(S))}}else L(()=>k.reject(v))}}})}),T}function v5(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:l,pollingInterval:a=e.pollingInterval}){const c=typeof l<"u"?l:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),u=i??!1;let f;return c?(()=>{const h=Le(["watchBlocks",e.uid,t,n,r,u,a]);return Bn(h,{onBlock:o,onError:s},b=>_o(async()=>{var w;try{const T=await ee(e,Lt,"getBlock")({blockTag:t,includeTransactions:u});if(T.number!==null&&(f==null?void 0:f.number)!=null){if(T.number===f.number)return;if(T.number-f.number>1&&n)for(let x=(f==null?void 0:f.number)+1n;x<T.number;x++){const E=await ee(e,Lt,"getBlock")({blockNumber:x,includeTransactions:u});b.onBlock(E,f),f=E}}((f==null?void 0:f.number)==null||t==="pending"&&(T==null?void 0:T.number)==null||T.number!==null&&T.number>f.number)&&(b.onBlock(T,f),f=T)}catch(T){(w=b.onError)==null||w.call(b,T)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,b=!0,w=()=>h=!1;return(async()=>{try{r&&ee(e,Lt,"getBlock")({blockTag:t,includeTransactions:u}).then(E=>{h&&b&&(o(E,void 0),b=!1)}).catch(s);const T=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(A=>A.config.type==="webSocket"||A.config.type==="ipc");return E?E.value:e.transport}return e.transport})(),{unsubscribe:x}=await T.subscribe({params:["newHeads"],async onData(E){var k;if(!h)return;const A=await ee(e,Lt,"getBlock")({blockNumber:(k=E.result)==null?void 0:k.number,includeTransactions:u}).catch(()=>{});h&&(o(A,f),b=!1,f=A)},onError(E){s==null||s(E)}});w=x,h||w()}catch(T){s==null||s(T)}})(),()=>w()})()}function x5(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:l,onLogs:a,poll:c,pollingInterval:u=e.pollingInterval,strict:f}){const p=typeof c<"u"?c:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),d=f??!1;return p?(()=>{const w=Le(["watchEvent",t,n,r,e.uid,o,u,i]);return Bn(w,{onLogs:a,onError:l},T=>{let x;i!==void 0&&(x=i-1n);let E,A=!1;const k=_o(async()=>{var F;if(!A){try{E=await ee(e,Dd,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}A=!0;return}try{let L;if(E)L=await ee(e,zs,"getFilterChanges")({filter:E});else{const m=await ee(e,Vo,"getBlockNumber")({});x&&x!==m?L=await ee(e,$a,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:x+1n,toBlock:m}):L=[],x=m}if(L.length===0)return;if(r)T.onLogs(L);else for(const m of L)T.onLogs([m])}catch(L){E&&L instanceof In&&(A=!1),(F=T.onError)==null||F.call(T,L)}},{emitOnBegin:!0,interval:u});return async()=>{E&&await ee(e,Us,"uninstallFilter")({filter:E}),k()}})})():(()=>{let w=!0,T=()=>w=!1;return(async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(L=>L.config.type==="webSocket"||L.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),E=s??(o?[o]:void 0);let A=[];E&&(A=[E.flatMap(L=>lo({abi:[L],eventName:L.name,args:n}))],o&&(A=A[0]));const{unsubscribe:k}=await x.subscribe({params:["logs",{address:t,topics:A}],onData(F){var m;if(!w)return;const L=F.result;try{const{eventName:v,args:S}=Ds({abi:E??[],data:L.data,topics:L.topics,strict:d}),I=Zt(L,{args:S,eventName:v});a([I])}catch(v){let S,I;if(v instanceof xs||v instanceof Zi){if(f)return;S=v.abiItem.name,I=(m=v.abiItem.inputs)==null?void 0:m.some(C=>!("name"in C&&C.name))}const $=Zt(L,{args:I?[]:{},eventName:S});a([$])}},onError(F){l==null||l(F)}});T=k,w||T()}catch(x){l==null||l(x)}})(),()=>T()})()}function E5(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const c=Le(["watchPendingTransactions",e.uid,t,s]);return Bn(c,{onTransactions:r,onError:n},u=>{let f;const p=_o(async()=>{var d;try{if(!f)try{f=await ee(e,kd,"createPendingTransactionFilter")({});return}catch(b){throw p(),b}const h=await ee(e,zs,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const b of h)u.onTransactions([b])}catch(h){(d=u.onError)==null||d.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await ee(e,Us,"uninstallFilter")({filter:f}),p()}})})():(()=>{let c=!0,u=()=>c=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!c)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});u=f,c||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function S5(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(P5))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:l,requestId:a,...c}=((p=e.match(T5))==null?void 0:p.groups)??{},u=(d=e.split("Resources:")[1])==null?void 0:d.split(`
91
- - `).slice(1);return{...r,...c,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...l?{notBefore:new Date(l)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const P5=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,T5=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function A5(e){const{address:t,domain:n,message:r,nonce:o,scheme:s,time:i=new Date}=e;if(n&&r.domain!==n||o&&r.nonce!==o||s&&r.scheme!==s||r.expirationTime&&i>=r.expirationTime||r.notBefore&&i<r.notBefore)return!1;try{if(!r.address||!yt(r.address,{strict:!1})||t&&!Fo(r.address,t))return!1}catch{return!1}return!0}async function N5(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:l,time:a=new Date,...c}=t,u=S5(o);if(!u.address||!A5({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const p=Rd(o);return Ys(e,{address:u.address,hash:p,signature:l,...c})}async function O5(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var l,a,c;const o=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),i=(((c=(a=(l=e.chain)==null?void 0:l.formatters)==null?void 0:a.transactionReceipt)==null?void 0:c.format)||Sd)(o);if(i.status==="reverted"&&n)throw new Rg({receipt:i});return i}function C5(e){return{call:t=>Br(e,t),createAccessList:t=>Md(e,t),createBlockFilter:()=>Hw(e),createContractEventFilter:t=>nf(e,t),createEventFilter:t=>Dd(e,t),createPendingTransactionFilter:()=>kd(e),estimateContractGas:t=>Py(e,t),estimateGas:t=>Oa(e,t),getBalance:t=>Gw(e,t),getBlobBaseFee:()=>qw(e),getBlock:t=>Lt(e,t),getBlockNumber:t=>Vo(e,t),getBlockTransactionCount:t=>Kw(e,t),getBytecode:t=>Vs(e,t),getChainId:()=>Aa(e),getCode:t=>Vs(e,t),getContractEvents:t=>Uf(e,t),getDelegation:t=>Zw(e,t),getEip712Domain:t=>Xw(e,t),getEnsAddress:t=>Cw(e,t),getEnsAvatar:t=>Ww(e,t),getEnsName:t=>_w(e,t),getEnsResolver:t=>Vw(e,t),getEnsText:t=>Id(e,t),getFeeHistory:t=>ev(e,t),estimateFeesPerGas:t=>iy(e,t),getFilterChanges:t=>zs(e,t),getFilterLogs:t=>tv(e,t),getGasPrice:()=>Sa(e),getLogs:t=>$a(e,t),getProof:t=>Z6(e,t),estimateMaxPriorityFeePerGas:t=>sy(e,t),fillTransaction:t=>Ff(e,t),getStorageAt:t=>Y6(e,t),getTransaction:t=>Tl(e,t),getTransactionConfirmations:t=>X6(e,t),getTransactionCount:t=>Cf(e,t),getTransactionReceipt:t=>qs(e,t),multicall:t=>J6(e,t),prepareTransactionRequest:t=>jf(e,t),readContract:t=>jt(e,t),sendRawTransaction:t=>xw(e,t),sendRawTransactionSync:t=>O5(e,t),simulate:t=>Al(e,t),simulateBlocks:t=>Al(e,t),simulateCalls:t=>l5(e,t),simulateContract:t=>pw(e,t),verifyHash:t=>Ys(e,t),verifyMessage:t=>g5(e,t),verifySiweMessage:t=>N5(e,t),verifyTypedData:t=>y5(e,t),uninstallFilter:t=>Us(e,t),waitForTransactionReceipt:t=>w5(e,t),watchBlocks:t=>v5(e,t),watchBlockNumber:t=>O0(e,t),watchContractEvent:t=>vw(e,t),watchEvent:t=>x5(e,t),watchPendingTransactions:t=>E5(e,t)}}function $5(e){const{key:t="public",name:n="Public Client"}=e;return Sw({...e,key:t,name:n,type:"publicClient"}).extend(C5)}function I5({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:l},a){const c=Pd();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:l},request:ov(r,{methods:t,retryCount:o,retryDelay:s,uid:c}),value:a}}class M5 extends H{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function D5(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:s="http",methods:i,name:l="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:c,retryDelay:u,raw:f}=t;return({chain:p,retryCount:d,timeout:h})=>{const{batchSize:b=1e3,wait:w=0}=typeof n=="object"?n:{},T=t.retryCount??d,x=h??t.timeout??1e4,E=e||(p==null?void 0:p.rpcUrls.default.http[0]);if(!E)throw new M5;const A=mv(E,{fetchFn:r,fetchOptions:o,onRequest:a,onResponse:c,timeout:x});return I5({key:s,methods:i,name:l,async request({method:k,params:F}){const L={method:k,params:F},{schedule:m}=vd({id:E,wait:w,shouldSplitBatch($){return $.length>b},fn:$=>A.request({body:$}),sort:($,C)=>$.id-C.id}),v=async $=>n?m($):[await A.request({body:$})],[{error:S,result:I}]=await v(L);if(f)return{error:S,result:I};if(S)throw new fa({body:L,error:S,url:E});return I},retryCount:T,retryDelay:u,timeout:x,type:"http"},{fetchOptions:o,url:E})}}const k5=dv({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}});function B5({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,l]=g.useState(null),[a,c]=g.useState(o);return g.useEffect(()=>{let u,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:Dr,functionName:"balanceOf",args:[n]});l(d),c(la(d,r))}catch{c(o)}};p();try{u=e.watchContractEvent({address:t,abi:Dr,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:Dr,eventName:"Transfer",args:{from:n},onLogs:()=>{p()},poll:!0,pollingInterval:s})}catch{}return()=>{u==null||u(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const L5=()=>({openDeposit:g.useCallback(t=>{},[])}),F5=()=>({openWithdraw:g.useCallback(t=>{},[])}),gn="MPC",Xs="EVM";var Me=(e=>(e.SPOT="spot",e.PERPETUAL="perpetual",e.PERPETUALV2="perpetual_v2",e))(Me||{});const R5="spot",j5="perpetual";/**
84
+ `)})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class yo extends Je{constructor(t){super(t,{code:yo.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class vo extends Je{constructor(t){super(t,{code:vo.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class wo extends Je{constructor(t){super(t,{code:wo.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Qn extends Je{constructor(t,{method:n}={}){super(t,{code:Qn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Qn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Tr extends Je{constructor(t){super(t,{code:Tr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Tr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class xo extends Je{constructor(t){super(t,{code:xo.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Ar extends Qe{constructor(t){super(t,{code:Ar.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Eo extends Qe{constructor(t){super(t,{code:Eo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class So extends Qe{constructor(t,{method:n}={}){super(t,{code:So.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(So,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Po extends Qe{constructor(t){super(t,{code:Po.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class To extends Qe{constructor(t){super(t,{code:To.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(To,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ao extends Qe{constructor(t){super(t,{code:Ao.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class No extends Qe{constructor(t){super(t,{code:No.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(No,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Co extends Qe{constructor(t){super(t,{code:Co.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Oo extends Qe{constructor(t){super(t,{code:Oo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class $o extends Qe{constructor(t){super(t,{code:$o.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty($o,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Io extends Qe{constructor(t){super(t,{code:Io.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Mo extends Qe{constructor(t){super(t,{code:Mo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Do extends Qe{constructor(t){super(t,{code:Do.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Do,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class ko extends Qe{constructor(t){super(t,{code:ko.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(ko,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class G1 extends Je{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const q1=3;function Nr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const l=e instanceof Os?e:e instanceof G?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:c,details:u,message:d,shortMessage:p}=l,f=e instanceof ro?new _1({functionName:s}):[q1,Jn.code].includes(a)&&(c||u||d||p)||a===In.code&&u==="execution reverted"&&c?new da({abi:t,data:typeof c=="object"?c.data:c,functionName:s,message:l instanceof fa?u:p??d}):e;return new md(f,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function K1(e){const t=ze(`0x${e.substring(4)}`).substring(26);return Ns(`0x${t}`)}async function Z1({hash:e,signature:t}){const n=Dt(e)?e:Cn(e),{secp256k1:r}=await Promise.resolve().then(()=>$6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:c,s:u,v:d,yParity:p}=t,f=Number(p??d),h=gd(f);return new r.Signature(Gt(c),Gt(u)).addRecoveryBit(h)}const i=Dt(t)?t:Cn(t);if(Te(i)!==65)throw new Error("invalid signature length");const l=ln(`0x${i.slice(130)}`),a=gd(l);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function gd(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function yd({hash:e,signature:t}){return K1(await Z1({hash:e,signature:t}))}function Y1(e,t="hex"){const n=vd(e),r=aa(new Uint8Array(n.length));return n.encode(r),t==="hex"?Le(r.bytes):r.bytes}function vd(e){return Array.isArray(e)?X1(e.map(t=>vd(t))):J1(e)}function X1(e){const t=e.reduce((o,s)=>o+s.length,0),n=wd(t);return{length:t<=55?1+t:1+n+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+n),n===1?o.pushUint8(t):n===2?o.pushUint16(t):n===3?o.pushUint24(t):o.pushUint32(t));for(const{encode:s}of e)s(o)}}}function J1(e){const t=typeof e=="string"?qt(e):e,n=wd(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(o){t.length===1&&t[0]<128?o.pushBytes(t):t.length<=55?(o.pushByte(128+t.length),o.pushBytes(t)):(o.pushByte(183+n),n===1?o.pushUint8(t.length):n===2?o.pushUint16(t.length):n===3?o.pushUint24(t.length):o.pushUint32(t.length),o.pushBytes(t))}}}function wd(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new G("Length is too large.")}function Q1(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=ze(Sr(["0x05",Y1([t?ne(t):"0x",o,n?ne(n):"0x"])]));return r==="bytes"?qt(s):s}async function xd(e){const{authorization:t,signature:n}=e;return yd({hash:Q1(t),signature:n??t})}class ey extends G{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:d,value:p}){var h;const f=fo({from:n==null?void 0:n.address,to:d,value:typeof p<"u"&&`${ua(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",f].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Cr extends G{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(Cr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Cr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class $s extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty($s,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class pa extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(pa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class ha extends G{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(ha,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class ma extends G{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
85
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(ma,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class ba extends G{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(ba,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class ga extends G{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
86
+ `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(ga,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class ya extends G{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(ya,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class va extends G{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(va,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class wa extends G{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(wa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Is extends G{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Xe(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Xe(r)} gwei`:""}).`].join(`
87
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Is,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Lo extends G{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Ms(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof G?e.walk(o=>(o==null?void 0:o.code)===Cr.code):e;return r instanceof G?new Cr({cause:e,message:r.details}):Cr.nodeMessage.test(n)?new Cr({cause:e,message:e.details}):$s.nodeMessage.test(n)?new $s({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):pa.nodeMessage.test(n)?new pa({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):ha.nodeMessage.test(n)?new ha({cause:e,nonce:t==null?void 0:t.nonce}):ma.nodeMessage.test(n)?new ma({cause:e,nonce:t==null?void 0:t.nonce}):ba.nodeMessage.test(n)?new ba({cause:e,nonce:t==null?void 0:t.nonce}):ga.nodeMessage.test(n)?new ga({cause:e}):ya.nodeMessage.test(n)?new ya({cause:e,gas:t==null?void 0:t.gas}):va.nodeMessage.test(n)?new va({cause:e,gas:t==null?void 0:t.gas}):wa.nodeMessage.test(n)?new wa({cause:e}):Is.nodeMessage.test(n)?new Is({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Lo({cause:e})}function ty(e,{docsPath:t,...n}){const r=(()=>{const o=Ms(e,n);return o instanceof Lo?e:o})();return new ey(r,{docsPath:t,...n})}function Ds(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const l of i)l in e&&(n[l]=e[l]),s[l]&&typeof s[l]=="object"&&!Array.isArray(s[l])&&r(s[l])}const o=t(e||{});return r(o),n}const ny={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Bo(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=ry(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>Le(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=ne(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=ne(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=ne(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=ne(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=ne(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=ne(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=ny[e.type]),typeof e.value<"u"&&(n.value=ne(e.value)),n}function ry(e){return e.map(t=>({address:t.address,r:t.r?ne(BigInt(t.r)):t.r,s:t.s?ne(BigInt(t.s)):t.s,chainId:ne(t.chainId),nonce:ne(t.nonce),...typeof t.yParity<"u"?{yParity:ne(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:ne(t.v)}:{}}))}function Ed(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Lu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Lu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function oy(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=ne(t)),n!==void 0&&(i.nonce=ne(n)),r!==void 0&&(i.state=Ed(r)),o!==void 0){if(i.state)throw new B1;i.stateDiff=Ed(o)}return i}function xa(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!yt(n,{strict:!1}))throw new On({address:n});if(t[n])throw new L1({address:n});t[n]=oy(r)}return t}const Sd=2n**256n-1n;function Or(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?dt(t):void 0;if(s&&!yt(s.address))throw new On({address:s.address});if(o&&!yt(o))throw new On({address:o});if(n&&n>Sd)throw new $s({maxFeePerGas:n});if(r&&n&&r>n)throw new Is({maxFeePerGas:n,maxPriorityFeePerGas:r})}class Pd extends G{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ea extends G{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class sy extends G{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Xe(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Td extends G{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Ad={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Sa(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?ln(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?ln(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Ad[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=iy(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function iy(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function Nd(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:Sa(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Bt(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var c,u,d;const s=o??!1,i=n!==void 0?ne(n):void 0;let l=null;if(t?l=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):l=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!l)throw new Td({blockHash:t,blockNumber:n});return(((d=(u=(c=e.chain)==null?void 0:c.formatters)==null?void 0:u.block)==null?void 0:d.format)||Nd)(l,"getBlock")}async function Pa(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function ay(e,t){return Cd(e,t)}async function Cd(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const l=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof l=="function"){const c=n||await te(e,Bt,"getBlock")({}),u=await l({block:c,client:e,request:o});if(u===null)throw new Error;return u}if(typeof l<"u")return l;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Gt(a)}catch{const[l,a]=await Promise.all([n?Promise.resolve(n):te(e,Bt,"getBlock")({}),te(e,Pa,"getGasPrice")({})]);if(typeof l.baseFeePerGas!="bigint")throw new Ea;const c=a-l.baseFeePerGas;return c<0n?0n:c}}async function ly(e,t){return Ta(e,t)}async function Ta(e,t){var p,f;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new Pd;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),c=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await te(e,Bt,"getBlock")({});if(typeof((f=r==null?void 0:r.fees)==null?void 0:f.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:c,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new Ea;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Cd(e,{block:u,chain:r,request:o}),m=c(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??c(await te(e,Pa,"getGasPrice")({}))}}async function Od(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?ne(r):n]},{dedupe:!!r});return ln(o)}function $d(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>qt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>Le(s))}function Id(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>qt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>qt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const l=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(l,a)))}return n==="bytes"?s:s.map(i=>Le(i))}function cy(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),l=Number(n&s),a=r?4:0,c=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+c,l,r)}function uy(e,t,n){return e&t^~e&n}function dy(e,t,n){return e&t^e&n^t&n}class fy extends Qi{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=Ji(this.buffer)}update(t){xr(this),t=Ps(t),Kn(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const l=Math.min(o-this.pos,s-i);if(l===o){const a=Ji(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+l),this.pos),this.pos+=l,i+=l,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){xr(this),ju(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,Er(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let d=i;d<o;d++)n[d]=0;cy(r,o-8,BigInt(this.length*8),s),this.process(r,0);const l=Ji(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<c;d++)l.setUint32(4*d,u[d],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:l}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=l,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Mn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),py=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Dn=new Uint32Array(64);class hy extends fy{constructor(t=32){super(64,t,8,!1),this.A=Mn[0]|0,this.B=Mn[1]|0,this.C=Mn[2]|0,this.D=Mn[3]|0,this.E=Mn[4]|0,this.F=Mn[5]|0,this.G=Mn[6]|0,this.H=Mn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:l,H:a}=this;return[t,n,r,o,s,i,l,a]}set(t,n,r,o,s,i,l,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=l|0,this.H=a|0}process(t,n){for(let d=0;d<16;d++,n+=4)Dn[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const p=Dn[d-15],f=Dn[d-2],h=Kt(p,7)^Kt(p,18)^p>>>3,m=Kt(f,17)^Kt(f,19)^f>>>10;Dn[d]=m+Dn[d-7]+h+Dn[d-16]|0}let{A:r,B:o,C:s,D:i,E:l,F:a,G:c,H:u}=this;for(let d=0;d<64;d++){const p=Kt(l,6)^Kt(l,11)^Kt(l,25),f=u+p+uy(l,a,c)+py[d]+Dn[d]|0,m=(Kt(r,2)^Kt(r,13)^Kt(r,22))+dy(r,o,s)|0;u=c,c=a,a=l,l=i+f|0,i=s,s=o,o=r,r=f+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,l=l+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,o,s,i,l,a,c,u)}roundClean(){Er(Dn)}destroy(){this.set(0,0,0,0,0,0,0,0),Er(this.buffer)}}const Md=Uu(()=>new hy),my=Md;function by(e,t){return my(Dt(e,{strict:!1})?vr(e):e)}function gy(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=by(t);return o.set([n],0),r==="bytes"?o:Le(o)}function yy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(gy({commitment:s,to:r,version:n}));return o}const Dd=6,kd=32,Aa=4096,Ld=kd*Aa,Bd=Ld*Dd-1-1*Aa*Dd;class vy extends G{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class wy extends G{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function xy(e){const t=typeof e.data=="string"?qt(e.data):e.data,n=Te(t);if(!n)throw new wy;if(n>Bd)throw new vy({maxSize:Bd,size:n});const r=[];let o=!0,s=0;for(;o;){const i=aa(new Uint8Array(Ld));let l=0;for(;l<Aa;){const a=t.slice(s,s+(kd-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}l++,s+=31}r.push(i)}return r.map(i=>Le(i.bytes))}function Ey(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??xy({data:t}),s=e.commitments??$d({blobs:o,kzg:n,to:r}),i=e.proofs??Id({blobs:o,commitments:s,kzg:n,to:r}),l=[];for(let a=0;a<o.length;a++)l.push({blob:o[a],commitment:s[a],proof:i[a]});return l}function Sy(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new R1({transaction:e})}function Py(e,{docsPath:t,...n}){const r=(()=>{const o=Ms(e,n);return o instanceof Lo?e:o})();return new j1(r,{docsPath:t,...n})}async function Na(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return ln(t)}async function Fd(e,t){var b,v,E,I,$;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:l,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:h,nonceManager:m,to:x,type:T,value:w,...P}=t,A=await(async()=>{if(!n||!m||typeof h<"u")return h;const C=dt(n),D=s?s.id:await te(e,Na,"getChainId")({});return await m.consume({address:C.address,chainId:D,client:e})})();Or(t);const k=(v=(b=s==null?void 0:s.formatters)==null?void 0:b.transactionRequest)==null?void 0:v.format,F=(k||Bo)({...Ds(P,{format:k}),account:n?dt(n):void 0,accessList:r,authorizationList:o,blobs:l,blobVersionedHashes:i,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:A,to:x,type:T,value:w},"fillTransaction");try{const C=await e.request({method:"eth_fillTransaction",params:[F]}),y=(((I=(E=s==null?void 0:s.formatters)==null?void 0:E.transaction)==null?void 0:I.format)||Sa)(C.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const O=await(async()=>{var j,z;if(typeof((j=s==null?void 0:s.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const W=await te(e,Bt,"getBlock")({});return s.fees.baseFeeMultiplier({block:W,client:e,request:t})}return((z=s==null?void 0:s.fees)==null?void 0:z.baseFeeMultiplier)??1.2})();if(O<1)throw new Pd;const S=10**((($=O.toString().split(".")[1])==null?void 0:$.length)??0),L=j=>j*BigInt(Math.ceil(O*S))/BigInt(S);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=L(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=L(y.gasPrice)),{raw:C.raw,transaction:{from:F.from,...y}}}catch(C){throw Py(C,{...t,chain:e.chain})}}const Ty=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Rd=new Map,Ca=new As(128);async function jd(e,t){var A,k,B;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=Ty);const{account:r,chain:o=e.chain,nonceManager:s,parameters:i}=n,l=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function c(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await te(e,Na,"getChainId")({}),a))}const u=r&&dt(r);let d=n.nonce;if(i.includes("nonce")&&typeof d>"u"&&u&&s){const F=await c();d=await s.consume({address:u.address,chainId:F,client:e})}l!=null&&l.fn&&((A=l.runAt)!=null&&A.includes("beforeFillTransaction"))&&(n=await l.fn({...n,chain:o},{phase:"beforeFillTransaction"}),d??(d=n.nonce));const f=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||Ca.get(e.uid)===!1||!["fees","gas"].some(b=>i.includes(b))?!1:!!(i.includes("chainId")&&typeof n.chainId!="number"||i.includes("nonce")&&typeof d!="number"||i.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof n.gas!="bigint"))?await te(e,Fd,"fillTransaction")({...n,nonce:d}).then(F=>{const{chainId:b,from:v,gas:E,gasPrice:I,nonce:$,maxFeePerBlobGas:C,maxFeePerGas:D,maxPriorityFeePerGas:y,type:O,...M}=F.transaction;return Ca.set(e.uid,!0),{...n,...v?{from:v}:{},...O&&!n.type?{type:O}:{},...typeof b<"u"?{chainId:b}:{},...typeof E<"u"?{gas:E}:{},...typeof I<"u"?{gasPrice:I}:{},...typeof $<"u"?{nonce:$}:{},...typeof C<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:C}:{},...typeof D<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:D}:{},...typeof y<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in M&&typeof M.nonceKey<"u"?{nonceKey:M.nonceKey}:{}}}).catch(F=>{var E;const b=F;return b.name!=="TransactionExecutionError"||((E=b.walk)==null?void 0:E.call(b,I=>{const $=I;return $.name==="MethodNotFoundRpcError"||$.name==="MethodNotSupportedRpcError"}))&&Ca.set(e.uid,!1),n}):n;d??(d=f.nonce),n={...f,...u?{from:u==null?void 0:u.address}:{},...d?{nonce:d}:{}};const{blobs:h,gas:m,kzg:x,type:T}=n;l!=null&&l.fn&&((k=l.runAt)!=null&&k.includes("beforeFillParameters"))&&(n=await l.fn({...n,chain:o},{phase:"beforeFillParameters"}));let w;async function P(){return w||(w=await te(e,Bt,"getBlock")({blockTag:"latest"}),w)}if(i.includes("nonce")&&typeof d>"u"&&u&&!s&&(n.nonce=await te(e,Od,"getTransactionCount")({address:u.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&x){const F=$d({blobs:h,kzg:x});if(i.includes("blobVersionedHashes")){const b=yy({commitments:F,to:"hex"});n.blobVersionedHashes=b}if(i.includes("sidecars")){const b=Id({blobs:h,commitments:F,kzg:x}),v=Ey({blobs:h,commitments:F,proofs:b,to:"hex"});n.sidecars=v}}if(i.includes("chainId")&&(n.chainId=await c()),(i.includes("fees")||i.includes("type"))&&typeof T>"u")try{n.type=Sy(n)}catch{let F=Rd.get(e.uid);if(typeof F>"u"){const b=await P();F=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",Rd.set(e.uid,F)}n.type=F?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const F=await P(),{maxFeePerGas:b,maxPriorityFeePerGas:v}=await Ta(e,{block:F,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<v)throw new sy({maxPriorityFeePerGas:v});n.maxPriorityFeePerGas=v,n.maxFeePerGas=b}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new Ea;if(typeof n.gasPrice>"u"){const F=await P(),{gasPrice:b}=await Ta(e,{block:F,chain:o,request:n,type:"legacy"});n.gasPrice=b}}return i.includes("gas")&&typeof m>"u"&&(n.gas=await te(e,Oa,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),l!=null&&l.fn&&((B=l.runAt)!=null&&B.includes("afterFillParameters"))&&(n=await l.fn({...n,chain:o},{phase:"afterFillParameters"})),Or(n),delete n.parameters,n}async function Oa(e,t){var i,l,a;const{account:n=e.account,prepare:r=!0}=t,o=n?dt(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const c=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await xd({authorization:t.authorizationList[0]}).catch(()=>{throw new G("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:d,blobs:p,blobVersionedHashes:f,blockNumber:h,blockTag:m,data:x,gas:T,gasPrice:w,maxFeePerBlobGas:P,maxFeePerGas:A,maxPriorityFeePerGas:k,nonce:B,value:F,stateOverride:b,...v}=r?await jd(e,{...t,parameters:s,to:c}):t;if(T&&t.gas!==T)return T;const I=(typeof h=="bigint"?ne(h):void 0)||m,$=xa(b);Or(t);const C=(a=(l=(i=e.chain)==null?void 0:i.formatters)==null?void 0:l.transactionRequest)==null?void 0:a.format,y=(C||Bo)({...Ds(v,{format:C}),account:o,accessList:u,authorizationList:d,blobs:p,blobVersionedHashes:f,data:x,gasPrice:w,maxFeePerBlobGas:P,maxFeePerGas:A,maxPriorityFeePerGas:k,nonce:B,to:c,value:F},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:$?[y,I??e.experimental_blockTag??"latest",$]:I?[y,I]:[y]}))}catch(c){throw ty(c,{...t,account:o,chain:e.chain})}}async function Ay(e,t){var c;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(c=e.dataSuffix)==null?void 0:c.value,...l}=t,a=vt({abi:n,args:o,functionName:s});try{return await te(e,Oa,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...l})}catch(u){const d=l.account?dt(l.account):void 0;throw Nr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:d==null?void 0:d.address})}}function Fo(e,t){if(!yt(e,{strict:!1}))throw new On({address:e});if(!yt(t,{strict:!1}))throw new On({address:t});return e.toLowerCase()===t.toLowerCase()}function Zt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const zd="/docs/contract/decodeEventLog";function ks(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...l]=o;if(!i)throw new pg({docsPath:zd});const a=t.find(T=>T.type==="event"&&i===Ts(Mt(T)));if(!(a&&"name"in a)||a.type!=="event")throw new hg(i,{docsPath:zd});const{name:c,inputs:u}=a,d=u==null?void 0:u.some(T=>!("name"in T&&T.name)),p=d?[]:{},f=u.map((T,w)=>[T,w]).filter(([T])=>"indexed"in T&&T.indexed),h=[];for(let T=0;T<f.length;T++){const[w,P]=f[T],A=l[T];if(!A){if(s)throw new Yi({abiItem:a,param:w});h.push([w,P]);continue}p[d?P:w.name||P]=Ny({param:w,value:A})}const m=u.filter(T=>!("indexed"in T&&T.indexed)),x=s?m:[...h.map(([T])=>T),...m];if(x.length>0){if(n&&n!=="0x")try{const T=co(x,n);if(T){let w=0;if(!s)for(const[P,A]of h)p[d?A:P.name||A]=T[w++];if(d)for(let P=0;P<u.length;P++)p[P]===void 0&&w<T.length&&(p[P]=T[w++]);else for(let P=0;P<m.length;P++)p[m[P].name]=T[w++]}}catch(T){if(s)throw T instanceof Nu||T instanceof ad?new Es({abiItem:a,data:n,params:x,size:Te(n)}):T}else if(s)throw new Es({abiItem:a,data:"0x",params:x,size:0})}return{eventName:c,args:Object.values(p).length>0?p:void 0}}function Ny({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(co([e],t)||[])[0]}function $a(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),i=t.filter(l=>l.type==="event").map(l=>({abi:l,selector:Ts(l)}));return r.map(l=>{var p;const a=typeof l.blockNumber=="string"?Zt(l):l,c=i.filter(f=>a.topics[0]===f.selector);if(c.length===0)return null;let u,d;for(const f of c)try{u=ks({...a,abi:[f.abi],strict:!0}),d=f;break}catch{}if(!u&&!o){d=c[0];try{u=ks({data:a.data,topics:a.topics,abi:[d.abi],strict:!1})}catch{const f=(p=d.abi.inputs)==null?void 0:p.some(h=>!("name"in h&&h.name));return{...a,args:f?[]:{},eventName:d.abi.name}}}return!u||!d||s&&!s.includes(u.eventName)||!Cy({args:u.args,inputs:d.abi.inputs,matchArgs:n})?null:{...u,...a}}).filter(Boolean)}function Cy(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,l){try{return s.type==="address"?Fo(i,l):s.type==="string"||s.type==="bytes"?ze(vr(i))===l:i===l}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const l=n[i];return l?(Array.isArray(s)?s:[s]).some(c=>o(l,c,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const l=n.find(c=>c.name===s);return l?(Array.isArray(i)?i:[i]).some(c=>o(l,c,t[s])):!1}):!1}async function Ia(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:l,strict:a}={}){const c=a??!1,u=i??(s?[s]:void 0);let d=[];u&&(d=[u.flatMap(m=>lo({abi:[m],eventName:m.name,args:i?void 0:l}))],s&&(d=d[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof r=="bigint"?ne(r):r,toBlock:typeof o=="bigint"?ne(o):o}]});const f=p.map(h=>Zt(h));return u?$a({abi:u,args:l,logs:f,strict:c}):f}async function Ud(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:l,toBlock:a,strict:c}=t,u=i?Yn({abi:n,name:i}):void 0,d=u?void 0:n.filter(p=>p.type==="event");return te(e,Ia,"getLogs")({address:r,args:o,blockHash:s,event:u,events:d,fromBlock:l,toBlock:a,strict:c})}const Ma="/docs/contract/decodeFunctionResult";function kn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const l=Yn({abi:t,args:n,name:r});if(!l)throw new gr(r,{docsPath:Ma});s=l}if(s.type!=="function")throw new gr(void 0,{docsPath:Ma});if(!s.outputs)throw new Iu(s.name,{docsPath:Ma});const i=co(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Da=BigInt(0),ka=BigInt(1);function Ro(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function La(e){if(!Ro(e))throw new Error("Uint8Array expected")}function jo(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function Ls(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Wd(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Da:BigInt("0x"+e)}const _d=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Oy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function zo(e){if(La(e),_d)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Oy[e[n]];return t}const fn={_0:48,_9:57,A:65,F:70,a:97,f:102};function Vd(e){if(e>=fn._0&&e<=fn._9)return e-fn._0;if(e>=fn.A&&e<=fn.F)return e-(fn.A-10);if(e>=fn.a&&e<=fn.f)return e-(fn.a-10)}function Bs(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(_d)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const i=Vd(e.charCodeAt(s)),l=Vd(e.charCodeAt(s+1));if(i===void 0||l===void 0){const a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[o]=i*16+l}return r}function er(e){return Wd(zo(e))}function Hd(e){return La(e),Wd(zo(Uint8Array.from(e).reverse()))}function Uo(e,t){return Bs(e.toString(16).padStart(t*2,"0"))}function Gd(e,t){return Uo(e,t).reverse()}function wt(e,t,n){let r;if(typeof t=="string")try{r=Bs(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Ro(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}function Fs(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];La(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}const Ba=e=>typeof e=="bigint"&&Da<=e;function Fa(e,t,n){return Ba(e)&&Ba(t)&&Ba(n)&&t<=e&&e<n}function $r(e,t,n,r){if(!Fa(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function $y(e){let t;for(t=0;e>Da;e>>=ka,t+=1);return t}const Rs=e=>(ka<<BigInt(e))-ka,Ra=e=>new Uint8Array(e),qd=e=>Uint8Array.from(e);function Iy(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Ra(e),o=Ra(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},l=(...d)=>n(o,r,...d),a=(d=Ra(0))=>{o=l(qd([0]),d),r=l(),d.length!==0&&(o=l(qd([1]),d),r=l())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const p=[];for(;d<t;){r=l();const f=r.slice();p.push(f),d+=r.length}return Fs(...p)};return(d,p)=>{i(),a(d);let f;for(;!(f=p(c()));)a();return i(),f}}const My={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ro(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function js(e,t,n={}){const r=(o,s,i)=>{const l=My[s];if(typeof l!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!l(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function Kd(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const Dy="0.1.1";function ky(){return Dy}class re extends Error{static setStaticOptions(t){re.prototype.docsOrigin=t.docsOrigin,re.prototype.showVersion=t.showVersion,re.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var u;if(n.cause instanceof re){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),o=n.cause instanceof re&&n.cause.docsPath||n.docsPath,s=n.docsOrigin??re.prototype.docsOrigin,i=`${s}${o??""}`,l=!!(n.version??re.prototype.showVersion),a=n.version??re.prototype.version,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o||l?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0,l?`Version: ${a}`:void 0]:[]].filter(u=>typeof u=="string").join(`
88
+ `);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=i,this.docsOrigin=s,this.docsPath=o,this.shortMessage=t,this.showVersion=l,this.version=a}walk(t){return Zd(this,t)}}Object.defineProperty(re,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${ky()}`}}),re.setStaticOptions(re.defaultStaticOptions);function Zd(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Zd(e.cause,t):t?null:e}function Wo(e,t){if(Ir(e)>t)throw new Xy({givenSize:Ir(e),maxSize:t})}const pn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Yd(e){if(e>=pn.zero&&e<=pn.nine)return e-pn.zero;if(e>=pn.A&&e<=pn.F)return e-(pn.A-10);if(e>=pn.a&&e<=pn.f)return e-(pn.a-10)}function Ly(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Jy({size:e.length,targetSize:r,type:"Bytes"});const o=new Uint8Array(r);for(let s=0;s<r;s++){const i=n==="right";o[i?s:r-s-1]=e[i?s:e.length-s-1]}return o}function Xd(e,t={}){const{dir:n="left"}=t;let r=e,o=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)o++;return r=n==="left"?r.slice(o):r.slice(0,r.length-o),r}function zs(e,t){if(ft(e)>t)throw new ov({givenSize:ft(e),maxSize:t})}function By(e,t){if(typeof t=="number"&&t>0&&t>ft(e)-1)throw new cf({offset:t,position:"start",size:ft(e)})}function Fy(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ft(e)!==n-t)throw new cf({offset:n,position:"end",size:ft(e)})}function Jd(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const o=e.replace("0x","");if(o.length>r*2)throw new sv({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Ry="#__bigint";function Qd(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+Ry:o,n)}const jy=new TextDecoder,zy=new TextEncoder;function Uy(e){return e instanceof Uint8Array?e:typeof e=="string"?ef(e):Wy(e)}function Wy(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function ef(e,t={}){const{size:n}=t;let r=e;n&&(zs(e,n),r=nr(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let l=0,a=0;l<s;l++){const c=Yd(o.charCodeAt(a++)),u=Yd(o.charCodeAt(a++));if(c===void 0||u===void 0)throw new re(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[l]=c<<4|u}return i}function _y(e,t={}){const{size:n}=t,r=zy.encode(e);return typeof n=="number"?(Wo(r,n),Vy(r,n)):r}function Vy(e,t){return Ly(e,{dir:"right",size:t})}function Ir(e){return e.length}function Hy(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function Gy(e,t={}){const{size:n}=t;typeof n<"u"&&Wo(e,n);const r=Rt(e,t);return rf(r,t)}function qy(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Wo(r,n),r=tf(r)),r.length>1||r[0]>1)throw new Yy(r);return!!r[0]}function hn(e,t={}){const{size:n}=t;typeof n<"u"&&Wo(e,n);const r=Rt(e,t);return of(r,t)}function Ky(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Wo(r,n),r=Zy(r)),jy.decode(r)}function tf(e){return Xd(e,{dir:"left"})}function Zy(e){return Xd(e,{dir:"right"})}class Yy extends re{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let Xy=class extends re{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Jy=class extends re{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const Qy=new TextEncoder,ev=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tv(e,t={}){const{strict:n=!1}=t;if(!e)throw new af(e);if(typeof e!="string")throw new af(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new lf(e);if(!e.startsWith("0x"))throw new lf(e)}function Ft(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function nv(e){return e instanceof Uint8Array?Rt(e):Array.isArray(e)?Rt(new Uint8Array(e)):e}function nf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(zs(n,t.size),tr(n,t.size)):n}function Rt(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=ev[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(zs(r,t.size),nr(r,t.size)):r}function Ve(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const c=typeof e=="bigint"?"n":"";throw new sf({max:s?`${s}${c}`:void 0,min:`${i}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&o<0?BigInt.asUintN(r*8,BigInt(o)):o).toString(16)}`;return r?tr(a,r):a}function ja(e,t={}){return Rt(Qy.encode(e),t)}function tr(e,t){return Jd(e,{dir:"left",size:t})}function nr(e,t){return Jd(e,{dir:"right",size:t})}function Yt(e,t,n,r={}){const{strict:o}=r;By(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&Fy(s,t,n),s}function ft(e){return Math.ceil((e.length-2)/2)}function rf(e,t={}){const{signed:n}=t;t.size&&zs(e,t.size);const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n)-1n,i=s>>1n;return r<=i?r:r-s-1n}function of(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:rf(e,t))}function rv(e,t={}){const{strict:n=!1}=t;try{return tv(e,{strict:n}),!0}catch{return!1}}class sf extends re{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class af extends re{constructor(t){super(`Value \`${typeof t=="object"?Qd(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class lf extends re{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class ov extends re{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class cf extends re{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class sv extends re{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function iv(e){return{address:e.address,amount:Ve(e.amount),index:Ve(e.index),validatorIndex:Ve(e.validatorIndex)}}function uf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Ve(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Ve(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Ve(e.gasLimit)},...typeof e.number=="bigint"&&{number:Ve(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Ve(e.prevRandao)},...typeof e.time=="bigint"&&{time:Ve(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(iv)}}}const Mr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],za=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],df=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],ff=[...df,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],av=[...df,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],pf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],hf=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],mf=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],bf=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],Dr=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],lv="0x82ad56cb",gf="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",cv="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",uv="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Ua="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class Wa extends G{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class yf extends G{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const _a="/docs/contract/encodeDeployData";function Va(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new lg({docsPath:_a});if(!("inputs"in o))throw new Au({docsPath:_a});if(!o.inputs||o.inputs.length===0)throw new Au({docsPath:_a});const s=$n(o.inputs,n);return Sr([r,s])}function kr({blockNumber:e,chain:t,contract:n}){var o;const r=(o=t==null?void 0:t.contracts)==null?void 0:o[n];if(!r)throw new Wa({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Wa({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function vf(e,{docsPath:t,...n}){const r=(()=>{const o=Ms(e,n);return o instanceof Lo?e:o})();return new hd(r,{docsPath:t,...n})}function wf(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Ha=new Map;function xf({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const u=a();i();const d=u.map(({args:p})=>p);d.length!==0&&e(d).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let f=0;f<u.length;f++){const{resolve:h}=u[f];h==null||h([p[f],p])}}).catch(p=>{for(let f=0;f<u.length;f++){const{reject:h}=u[f];h==null||h(p)}})},i=()=>Ha.delete(t),l=()=>a().map(({args:u})=>u),a=()=>Ha.get(t)||[],c=u=>Ha.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:d,resolve:p,reject:f}=wf();return(n==null?void 0:n([...l(),u]))&&s(),a().length>0?(c({args:u,resolve:p,reject:f}),d):(c({args:u,resolve:p,reject:f}),setTimeout(s,r),d)}}}async function Lr(e,t){var C,D,y,O;const{account:n=e.account,authorizationList:r,batch:o=!!((C=e.batch)!=null&&C.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:l,blobs:a,blockOverrides:c,code:u,data:d,factory:p,factoryData:f,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:T,maxPriorityFeePerGas:w,nonce:P,to:A,value:k,stateOverride:B,...F}=t,b=n?dt(n):void 0;if(u&&(p||f))throw new G("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&A)throw new G("Cannot provide both `code` & `to` as parameters.");const v=u&&d,E=p&&f&&A&&d,I=v||E,$=v?Ef({code:u,data:d}):E?pv({data:d,factory:p,factoryData:f,to:A}):d;try{Or(t);const S=(typeof s=="bigint"?ne(s):void 0)||i,L=c?uf(c):void 0,j=xa(B),z=(O=(y=(D=e.chain)==null?void 0:D.formatters)==null?void 0:y.transactionRequest)==null?void 0:O.format,_=(z||Bo)({...Ds(F,{format:z}),accessList:l,account:b,authorizationList:r,blobs:a,data:$,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:T,maxPriorityFeePerGas:w,nonce:P,to:I?void 0:A,value:k},"call");if(o&&dv({request:_})&&!j&&!L)try{return await fv(e,{..._,blockNumber:s,blockTag:i})}catch(H){if(!(H instanceof yf)&&!(H instanceof Wa))throw H}const Z=(()=>{const H=[_,S];return j&&L?[...H,j,L]:j?[...H,j]:L?[...H,{},L]:H})(),q=await e.request({method:"eth_call",params:Z});return q==="0x"?{data:void 0}:{data:q}}catch(M){const S=hv(M),{offchainLookup:L,offchainLookupSignature:j}=await Promise.resolve().then(()=>pw);if(e.ccipRead!==!1&&(S==null?void 0:S.slice(0,10))===j&&A)return{data:await L(e,{data:S,to:A})};throw I&&(S==null?void 0:S.slice(0,10))==="0x101bb98d"?new V1({factory:p}):vf(M,{...t,account:b,chain:e.chain})}}function dv({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(lv)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function fv(e,t){var m;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:l,to:a}=t,c=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return kr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new yf})(),d=(typeof s=="bigint"?ne(s):void 0)||i,{schedule:p}=xf({id:`${e.uid}.${d}`,wait:o,shouldSplitBatch(x){return x.reduce((w,{data:P})=>w+(P.length-2),0)>n*2},fn:async x=>{const T=x.map(A=>({allowFailure:!0,callData:A.data,target:A.to})),w=vt({abi:Mr,args:[T],functionName:"aggregate3"}),P=await e.request({method:"eth_call",params:[{...c===null?{data:Ef({code:Ua,data:w})}:{to:c,data:w}},d]});return kn({abi:Mr,args:[T],functionName:"aggregate3",data:P||"0x"})}}),[{returnData:f,success:h}]=await p({data:l,to:a});if(!h)throw new Os({data:f});return f==="0x"?{data:void 0}:{data:f}}function Ef(e){const{code:t,data:n}=e;return Va({abi:xu(["constructor(bytes, bytes)"]),bytecode:gf,args:[t,n]})}function pv(e){const{data:t,factory:n,factoryData:r,to:o}=e;return Va({abi:xu(["constructor(address, bytes, address, bytes)"]),bytecode:cv,args:[o,t,n,r]})}function hv(e){var n;if(!(e instanceof G))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function jt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,l=vt({abi:n,args:o,functionName:s});try{const{data:a}=await te(e,Lr,"call")({...i,data:l,to:r});return kn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw Nr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function mv(e,t){var u;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...l}=t,a=l.account?dt(l.account):e.account,c=vt({abi:n,args:o,functionName:s});try{const{data:d}=await te(e,Lr,"call")({batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...l,account:a}),p=kn({abi:n,args:o,functionName:s,data:d||"0x"}),f=n.filter(h=>"name"in h&&h.name===t.functionName);return{result:p,request:{abi:f,address:r,args:o,dataSuffix:i,functionName:s,...l,account:a}}}catch(d){throw Nr(d,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:a==null?void 0:a.address})}}const Ga=new Map,Sf=new Map;let bv=0;function Ln(e,t,n){const r=++bv,o=()=>Ga.get(e)||[],s=()=>{const u=o();Ga.set(e,u.filter(d=>d.id!==r))},i=()=>{const u=o();if(!u.some(p=>p.id===r))return;const d=Sf.get(e);if(u.length===1&&d){const p=d();p instanceof Promise&&p.catch(()=>{})}s()},l=o();if(Ga.set(e,[...l,{id:r,fns:t}]),l&&l.length>0)return i;const a={};for(const u in t)a[u]=(...d)=>{var f,h;const p=o();if(p.length!==0)for(const m of p)(h=(f=m.fns)[u])==null||h.call(f,...d)};const c=n(a);return typeof c=="function"&&Sf.set(e,c),i}async function qa(e){return new Promise(t=>setTimeout(t,e))}function _o(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let l;t&&(l=await e({unpoll:s}));const a=await(n==null?void 0:n(l))??r;await qa(a);const c=async()=>{o&&(await e({unpoll:s}),await qa(r),c())};c()})(),s}const gv=new Map,yv=new Map;function vv(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,gv),r=t(e,yv);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function wv(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=vv(t),o=r.response.get();if(o&&n>0&&Date.now()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const xv=e=>`blockNumber.${e}`;async function Vo(e,{cacheTime:t=e.cacheTime}={}){const n=await wv(()=>e.request({method:"eth_blockNumber"}),{cacheKey:xv(e.uid),cacheTime:t});return BigInt(n)}async function Us(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Zt(s));return!("abi"in t)||!t.abi?o:$a({abi:t.abi,logs:o,strict:n})}async function Ws(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function Ev(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:l,onError:a,onLogs:c,poll:u,pollingInterval:d=e.pollingInterval,strict:p}=t;return(typeof u<"u"?u:typeof l=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const x=p??!1,T=Be(["watchContractEvent",r,o,s,e.uid,i,d,x,l]);return Ln(T,{onLogs:c,onError:a},w=>{let P;l!==void 0&&(P=l-1n);let A,k=!1;const B=_o(async()=>{var F;if(!k){try{A=await te(e,rd,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:x,fromBlock:l})}catch{}k=!0;return}try{let b;if(A)b=await te(e,Us,"getFilterChanges")({filter:A});else{const v=await te(e,Vo,"getBlockNumber")({});P&&P<v?b=await te(e,Ud,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:P+1n,toBlock:v,strict:x}):b=[],P=v}if(b.length===0)return;if(s)w.onLogs(b);else for(const v of b)w.onLogs([v])}catch(b){A&&b instanceof In&&(k=!1),(F=w.onError)==null||F.call(w,b)}},{emitOnBegin:!0,interval:d});return async()=>{A&&await te(e,Ws,"uninstallFilter")({filter:A}),B()}})})():(()=>{const x=p??!1,T=Be(["watchContractEvent",r,o,s,e.uid,i,d,x]);let w=!0,P=()=>w=!1;return Ln(T,{onLogs:c,onError:a},A=>((async()=>{try{const k=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(v=>v.config.type==="webSocket"||v.config.type==="ipc");return b?b.value:e.transport}return e.transport})(),B=i?lo({abi:n,eventName:i,args:o}):[],{unsubscribe:F}=await k.subscribe({params:["logs",{address:r,topics:B}],onData(b){var E;if(!w)return;const v=b.result;try{const{eventName:I,args:$}=ks({abi:n,data:v.data,topics:v.topics,strict:p}),C=Zt(v,{args:$,eventName:I});A.onLogs([C])}catch(I){let $,C;if(I instanceof Es||I instanceof Yi){if(p)return;$=I.abiItem.name,C=(E=I.abiItem.inputs)==null?void 0:E.some(y=>!("name"in y&&y.name))}const D=Zt(v,{args:C?[]:{},eventName:$});A.onLogs([D])}},onError(b){var v;(v=A.onError)==null||v.call(A,b)}});P=F,w||P()}catch(k){a==null||a(k)}})(),()=>P()))})()}async function Sv(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Ka(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:l=0}={})=>{const a=async({error:c})=>{const u=typeof t=="function"?t({count:l,error:c}):t;u&&await qa(u),i({count:l+1})};try{const c=await e();o(c)}catch(c){if(l<n&&await r({count:l,error:c}))return a({error:c});s(c)}};i()})}const Pv={"0x0":"reverted","0x1":"success"};function Pf(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Zt(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?ln(e.transactionIndex):null,status:e.status?Pv[e.status]:null,type:e.type?Ad[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Za=256;let _s=Za,Vs;function Tf(e=11){if(!Vs||_s+e>Za*2){Vs="",_s=0;for(let t=0;t<Za;t++)Vs+=(256+Math.random()*256|0).toString(16).substring(1)}return Vs.substring(_s,_s+++e)}function Tv(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:o,key:s="base",name:i="Base Client",type:l="base"}=e,a=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),c=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(c/2),500),4e3),d=e.pollingInterval??u,p=e.cacheTime??d,f=e.account?dt(e.account):void 0,{config:h,request:m,value:x}=e.transport({account:f,chain:n,pollingInterval:d}),T={...h,...x},w={account:f,batch:t,cacheTime:p,ccipRead:r,chain:n,dataSuffix:o,key:s,name:i,pollingInterval:d,request:m,transport:T,type:l,uid:Tf(),...a?{experimental_blockTag:a}:{}};function P(A){return k=>{const B=k(A);for(const b in w)delete B[b];const F={...A,...B};return Object.assign(F,{extend:P(F)})}}return Object.assign(w,{extend:P(w)})}function Ya(e){var n,r,o,s,i,l;if(!(e instanceof G))return!1;const t=e.walk(a=>a instanceof da);return t instanceof da?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((l=t.data)==null?void 0:l.errorName)==="UnsupportedResolverProfile":!1}function Av(e){const{abi:t,data:n}=e,r=Zn(n,0,4),o=t.find(s=>s.type==="function"&&r===ao(Mt(s)));if(!o)throw new mg(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?co(o.inputs,Zn(n,4)):void 0}}const Xa="/docs/contract/encodeErrorResult";function Af(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Yn({abi:t,args:r,name:n});if(!a)throw new Cu(n,{docsPath:Xa});o=a}if(o.type!=="error")throw new Cu(void 0,{docsPath:Xa});const s=Mt(o),i=ao(s);let l="0x";if(r&&r.length>0){if(!o.inputs)throw new fg(o.name,{docsPath:Xa});l=$n(o.inputs,r)}return Sr([i,l])}const Ja="/docs/contract/encodeFunctionResult";function Nv(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Yn({abi:t,name:n});if(!i)throw new gr(n,{docsPath:Ja});o=i}if(o.type!=="function")throw new gr(void 0,{docsPath:Ja});if(!o.outputs)throw new Iu(o.name,{docsPath:Ja});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Mu(r)})();return $n(o.outputs,s)}const Ho="x-batch-gateway:true";async function Nf(e){const{data:t,ccipRequest:n}=e,{args:[r]}=Av({abi:za,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,l)=>{try{s[l]=i.urls.includes(Ho)?await Nf({data:i.data,ccipRequest:n}):await n(i),o[l]=!1}catch(a){o[l]=!0,s[l]=Cv(a)}})),Nv({abi:za,functionName:"query",result:[o,s]})}function Cv(e){return e.name==="HttpRequestError"&&e.status?Af({abi:za,errorName:"HttpError",args:[e.status,e.shortMessage]}):Af({abi:[sd],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Cf(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Dt(t)?t:null}function Qa(e){let t=new Uint8Array(32).fill(0);if(!e)return Le(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=Cf(n[r]),s=o?vr(o):ze(qn(n[r]),"bytes");t=ze(Lt([t,s]),"bytes")}return Le(t)}function Ov(e){return`[${e.slice(2)}]`}function $v(e){const t=new Uint8Array(32).fill(0);return e?Cf(e)||ze(qn(e)):Le(t)}function el(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(qn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=qn(o[s]);i.byteLength>255&&(i=qn(Ov($v(o[s])))),n[r]=i.length,n.set(i,r+1),r+=i.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function Iv(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return kr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(p=>s.endsWith(p)))return null;const d=o!=null?[Qa(s),BigInt(o)]:[Qa(s)];try{const p=vt({abi:hf,functionName:"addr",args:d}),f={address:c,abi:ff,functionName:"resolveWithGateways",args:[Cn(el(s)),p,i??[Ho]],blockNumber:n,blockTag:r},m=await te(e,jt,"readContract")(f);if(m[0]==="0x")return null;const x=kn({abi:hf,args:d,functionName:"addr",data:m[0]});return x==="0x"||Gn(x)==="0x00"?null:x}catch(p){if(l)throw p;if(Ya(p))return null;throw p}}class Mv extends G{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class Go extends G{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class tl extends G{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class Dv extends G{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const kv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Lv=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,Bv=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Fv=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Rv(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Of(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function $f({uri:e,gatewayUrls:t}){const n=Bv.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Of(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Of(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(kv),{protocol:i,subpath:l,target:a,subtarget:c=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||l==="ipns/",d=i==="ipfs:/"||l==="ipfs/"||Lv.test(e);if(e.startsWith("http")&&!u&&!d){let f=e;return t!=null&&t.arweave&&(f=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:f,isOnChain:!1,isEncoded:!1}}if((u||d)&&a)return{uri:`${r}/${u?"ipns":"ipfs"}/${a}${c}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${c||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(Fv,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new tl({uri:e})}function If(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Mv({data:e});return e.image||e.image_url||e.image_data}async function jv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await nl({gatewayUrls:e,uri:If(n)})}catch{throw new tl({uri:t})}}async function nl({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=$f({uri:t,gatewayUrls:e});if(r||await Rv(n))return n;throw new tl({uri:t})}function zv(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[l,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new Go({reason:"Only EIP-155 supported"});if(!i)throw new Go({reason:"Chain ID not found"});if(!a)throw new Go({reason:"Contract address not found"});if(!o)throw new Go({reason:"Token ID not found"});if(!l)throw new Go({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:l.toLowerCase(),contractAddress:a,tokenID:o}}async function Uv(e,{nft:t}){if(t.namespace==="erc721")return jt(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return jt(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Dv({namespace:t.namespace})}async function Wv(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?_v(e,{gatewayUrls:t,record:n}):nl({uri:n,gatewayUrls:t})}async function _v(e,{gatewayUrls:t,record:n}){const r=zv(n),o=await Uv(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:l}=$f({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const c=l?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(c);return nl({uri:If(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),jv({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Mf(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return kr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(d=>s.endsWith(d)))return null;try{const d={address:c,abi:ff,args:[Cn(el(s)),vt({abi:pf,functionName:"text",args:[Qa(s),o]}),i??[Ho]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},f=await te(e,jt,"readContract")(d);if(f[0]==="0x")return null;const h=kn({abi:pf,functionName:"text",data:f[0]});return h===""?null:h}catch(d){if(l)throw d;if(Ya(d))return null;throw d}}async function Vv(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:l}){const a=await te(e,Mf,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:l,gatewayUrls:s,strict:i});if(!a)return null;try{return await Wv(e,{record:a,gatewayUrls:r})}catch{return null}}async function Hv(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return kr({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const u={address:c,abi:av,args:[n,s,i??[Ho]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},d=te(e,jt,"readContract"),[p]=await d(u);return p||null}catch(u){if(l)throw u;if(Ya(u))return null;throw u}}async function Gv(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return kr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),l=s==null?void 0:s.ensTlds;if(l&&!l.some(c=>o.endsWith(c)))throw new Error(`${o} is not a valid ENS TLD (${l==null?void 0:l.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await te(e,jt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Cn(el(o))],blockNumber:n,blockTag:r});return a}async function Df(e,t){var x,T,w;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:d,to:p,value:f,...h}=t,m=n?dt(n):void 0;try{Or(t);const A=(typeof r=="bigint"?ne(r):void 0)||o,k=(w=(T=(x=e.chain)==null?void 0:x.formatters)==null?void 0:T.transactionRequest)==null?void 0:w.format,F=(k||Bo)({...Ds(h,{format:k}),account:m,blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:d,to:p,value:f},"createAccessList"),b=await e.request({method:"eth_createAccessList",params:[F,A]});return{accessList:b.accessList,gasUsed:BigInt(b.gasUsed)}}catch(P){throw vf(P,{...t,account:m,chain:e.chain})}}async function qv(e){const t=Cs(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function kf(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:l}={}){const a=o??(r?[r]:void 0),c=Cs(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(f=>lo({abi:[f],eventName:f.name,args:n}))],r&&(u=u[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?ne(s):s,toBlock:typeof l=="bigint"?ne(l):l,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:d,request:c(d),strict:!!i,toBlock:l,type:"event"}}async function Lf(e){const t=Cs(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Kv(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var i,l,a;if((i=e.batch)!=null&&i.multicall&&((a=(l=e.chain)==null?void 0:l.contracts)!=null&&a.multicall3)){const c=e.chain.contracts.multicall3.address,u=vt({abi:Mr,functionName:"getEthBalance",args:[t]}),{data:d}=await te(e,Lr,"call")({to:c,data:u,blockNumber:n,blockTag:r});return kn({abi:Mr,functionName:"getEthBalance",args:[t],data:d||"0x"})}const o=typeof n=="bigint"?ne(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Zv(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Yv(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?ne(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),ln(s)}async function Hs(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?ne(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}async function Xv(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=await Hs(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(o&&Te(o)===23&&o.startsWith("0xef0100"))return un(Zn(o,3,23))}class Jv extends G{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function Qv(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,l,a,c,u,d]=await te(e,jt,"readContract")({abi:ew,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:l,chainId:Number(a),verifyingContract:c,salt:u},extensions:d,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Jv({address:n}):i}}const ew=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function tw(e){var t;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:(t=e.reward)==null?void 0:t.map(n=>n.map(r=>BigInt(r)))}}async function nw(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?ne(n):void 0,i=await e.request({method:"eth_feeHistory",params:[ne(t),s||r,o]},{dedupe:!!s});return tw(i)}async function rw(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Zt(s));return t.abi?$a({abi:t.abi,logs:o,strict:n}):o}async function ow({address:e,authorization:t,signature:n}){return Fo(un(e),await xd({authorization:t,signature:n}))}const Gs=new As(8192);function sw(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Gs.get(n))return Gs.get(n);const r=e().finally(()=>Gs.delete(n));return Gs.set(n,r),r}function iw(e,t={}){return async(n,r={})=>{var d;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:l=3,uid:a}={...t,...r},{method:c}=n;if((d=s==null?void 0:s.exclude)!=null&&d.includes(c))throw new Qn(new Error("method not supported"),{method:c});if(s!=null&&s.include&&!s.include.includes(c))throw new Qn(new Error("method not supported"),{method:c});const u=o?oo(`${a}.${Be(n)}`):void 0;return sw(()=>Ka(async()=>{try{return await e(n)}catch(p){const f=p;switch(f.code){case ho.code:throw new ho(f);case mo.code:throw new mo(f);case bo.code:throw new bo(f,{method:n.method});case go.code:throw new go(f);case Jn.code:throw new Jn(f);case In.code:throw new In(f);case yo.code:throw new yo(f);case vo.code:throw new vo(f);case wo.code:throw new wo(f);case Qn.code:throw new Qn(f,{method:n.method});case Tr.code:throw new Tr(f);case xo.code:throw new xo(f);case Ar.code:throw new Ar(f);case Eo.code:throw new Eo(f);case So.code:throw new So(f);case Po.code:throw new Po(f);case To.code:throw new To(f);case Ao.code:throw new Ao(f);case No.code:throw new No(f);case Co.code:throw new Co(f);case Oo.code:throw new Oo(f);case $o.code:throw new $o(f);case Io.code:throw new Io(f);case Mo.code:throw new Mo(f);case Do.code:throw new Do(f);case 5e3:throw new Ar(f);case ko.code:throw new ko(f);default:throw p instanceof G?p:new G1(f)}}},{delay:({count:p,error:f})=>{var h;if(f&&f instanceof Xn){const m=(h=f==null?void 0:f.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m,10)*1e3}return~~(1<<p)*i},retryCount:l,shouldRetry:({error:p})=>aw(p)}),{enabled:o,id:u})}}function aw(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Tr.code||e.code===Jn.code:e instanceof Xn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class lw extends G{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var l;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(l=n.metaMessages)!=null&&l.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${po(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class cw extends G{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${po(n)}`,`Response: ${Be(t)}`],name:"OffchainLookupResponseMalformedError"})}}class uw extends G{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const dw="0x556f1830",Bf={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function fw(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=cd({data:r,abi:[Bf]}),[i,l,a,c,u]=s,{ccipRead:d}=e,p=d&&typeof(d==null?void 0:d.request)=="function"?d.request:Ff;try{if(!Fo(o,i))throw new uw({sender:i,to:o});const f=l.includes(Ho)?await Nf({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:l}),{data:h}=await Lr(e,{blockNumber:t,blockTag:n,data:Lt([c,$n([{type:"bytes"},{type:"bytes"}],[f,u])]),to:o});return h}catch(f){throw new lw({callbackSelector:c,cause:f,data:r,extraData:u,sender:i,urls:l})}}async function Ff({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],l=i.includes("{data}")?"GET":"POST",a=l==="POST"?{data:e,sender:t}:void 0,c=l==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:c,method:l});let d;if((o=u.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?d=(await u.json()).data:d=await u.text(),!u.ok){r=new Xn({body:a,details:d!=null&&d.error?Be(d.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!Dt(d)){r=new cw({result:d,url:i});continue}return d}catch(u){r=new Xn({body:a,details:u.message,url:i})}}throw r}const pw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Ff,offchainLookup:fw,offchainLookupAbiItem:Bf,offchainLookupSignature:dw},Symbol.toStringTag,{value:"Module"}));function hw(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return o=>{const s=typeof o=="function"?o(r):o,i={...r,...s};return Object.assign(i,{extend:n(i)})}}return Object.assign(t,{extend:n(t)})}function mw(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const l=new AbortController;n>0&&(i=setTimeout(()=>{r&&l.abort()},n)),o(await e({signal:(l==null?void 0:l.signal)||null}))}catch(l){(l==null?void 0:l.name)==="AbortError"&&s(t),s(l)}finally{clearTimeout(i)}})()})}function bw(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Rf=bw();function gw(e,t={}){const{url:n,headers:r}=yw(e);return{async request(o){var h;const{body:s,fetchFn:i=t.fetchFn??fetch,onRequest:l=t.onRequest,onResponse:a=t.onResponse,timeout:c=t.timeout??1e4}=o,u={...t.fetchOptions??{},...o.fetchOptions??{}},{headers:d,method:p,signal:f}=u;try{const m=await mw(async({signal:T})=>{const w={...u,body:Array.isArray(s)?Be(s.map(B=>({jsonrpc:"2.0",id:B.id??Rf.take(),...B}))):Be({jsonrpc:"2.0",id:s.id??Rf.take(),...s}),headers:{...r,"Content-Type":"application/json",...d},method:p||"POST",signal:f||(c>0?T:null)},P=new Request(n,w),A=await(l==null?void 0:l(P,w))??{...w,url:n};return await i(A.url??n,A)},{errorInstance:new bd({body:s,url:n}),timeout:c,signal:!0});a&&await a(m);let x;if((h=m.headers.get("Content-Type"))!=null&&h.startsWith("application/json"))x=await m.json();else{x=await m.text();try{x=JSON.parse(x||"{}")}catch(T){if(m.ok)throw T;x={error:x}}}if(!m.ok)throw new Xn({body:s,details:Be(x.error)||m.statusText,headers:m.headers,status:m.status,url:n});return x}catch(m){throw m instanceof Xn||m instanceof bd?m:new Xn({body:s,cause:m,url:n})}}}}function yw(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const vw=`Ethereum Signed Message:
89
+ `;function ww(e){const t=typeof e=="string"?oo(e):typeof e.raw=="string"?e.raw:Le(e.raw),n=oo(`${vw}${Te(t)}`);return Lt([n,t])}function jf(e,t){return ze(ww(e),t)}class xw extends G{constructor({domain:t}){super(`Invalid domain "${Be(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class Ew extends G{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class Sw extends G{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function Pw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,l)=>{for(const a of i){const{name:c,type:u}=a,d=l[c],p=u.match(Qu);if(p&&(typeof d=="number"||typeof d=="bigint")){const[m,x,T]=p;ne(d,{signed:x==="int",size:Number.parseInt(T,10)/8})}if(u==="address"&&typeof d=="string"&&!yt(d))throw new On({address:d});const f=u.match(c1);if(f){const[m,x]=f;if(x&&Te(d)!==Number.parseInt(x,10))throw new gg({expectedSize:Number.parseInt(x,10),givenSize:Te(d)})}const h=o[u];h&&(Aw(u),s(h,d))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new xw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new Ew({primaryType:r,types:o})}function Tw({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function Aw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new Sw({type:e})}function Nw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:Tw({domain:t}),...e.types};Pw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(Cw({domain:t,types:o})),r!=="EIP712Domain"&&s.push(zf({data:n,primaryType:r,types:o})),ze(Lt(s))}function Cw({domain:e,types:t}){return zf({data:e,primaryType:"EIP712Domain",types:t})}function zf({data:e,primaryType:t,types:n}){const r=Uf({data:e,primaryType:t,types:n});return ze(r)}function Uf({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[Ow({primaryType:t,types:n})];for(const s of n[t]){const[i,l]=_f({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(l)}return $n(r,o)}function Ow({primaryType:e,types:t}){const n=Cn($w({primaryType:e,types:t}));return ze(n)}function $w({primaryType:e,types:t}){let n="";const r=Wf({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const s of o)n+=`${s}(${t[s].map(({name:i,type:l})=>`${l} ${i}`).join(",")})`;return n}function Wf({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),o=r==null?void 0:r[0];if(n.has(o)||t[o]===void 0)return n;n.add(o);for(const s of t[o])Wf({primaryType:s.type,types:t},n);return n}function _f({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},ze(Uf({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},ze(r)];if(n==="string")return[{type:"bytes32"},ze(Cn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>_f({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},ze($n(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class Iw extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const rl={checksum:new Iw(8192)}.checksum;class Vf extends Qi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,jg(t);const r=Ps(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),Er(s)}update(t){return xr(this),this.iHash.update(t),this}digestInto(t){xr(this),Kn(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:l}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=l,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Hf=(e,t,n)=>new Vf(e,t).update(n).digest();Hf.create=(e,t)=>new Vf(e,t);function Gf(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Ku(Uy(e));return n==="Bytes"?r:Rt(r)}const Mw=/^0x[a-fA-F0-9]{40}$/;function qs(e,t={}){const{strict:n=!0}=t;if(!Mw.test(e))throw new Kf({address:e,cause:new Dw});if(n){if(e.toLowerCase()===e)return;if(qf(e)!==e)throw new Kf({address:e,cause:new kw})}}function qf(e){if(rl.has(e))return rl.get(e);qs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Gf(_y(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const o=`0x${r.join("")}`;return rl.set(e,o),o}function ol(e,t={}){const{strict:n=!0}=t??{};try{return qs(e,{strict:n}),!0}catch{return!1}}class Kf extends re{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class Dw extends re{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class kw extends re{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const Lw=/^(.*)\[([0-9]*)\]$/,Bw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Zf=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Yf=2n**256n-1n;function Br(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=ll(t.type);if(s){const[i,l]=s;return Rw(e,{...t,type:l},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return Ww(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return Fw(e,{checksum:r});if(t.type==="bool")return jw(e);if(t.type.startsWith("bytes"))return zw(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Uw(e,t);if(t.type==="string")return _w(e,{staticPosition:o});throw new dl(t.type)}const Xf=32,sl=32;function Fw(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?qf(s):s)(Rt(Hy(r,-20))),32]}function Rw(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=hn(e.readBytes(sl)),c=s+a,u=c+Xf;e.setPosition(c);const d=hn(e.readBytes(Xf)),p=qo(t);let f=0;const h=[];for(let m=0;m<d;++m){e.setPosition(u+(p?m*32:f));const[x,T]=Br(e,t,{checksumAddress:r,staticPosition:u});f+=T,h.push(x)}return e.setPosition(s+32),[h,32]}if(qo(t)){const a=hn(e.readBytes(sl)),c=s+a,u=[];for(let d=0;d<o;++d){e.setPosition(c+d*32);const[p]=Br(e,t,{checksumAddress:r,staticPosition:c});u.push(p)}return e.setPosition(s+32),[u,32]}let i=0;const l=[];for(let a=0;a<o;++a){const[c,u]=Br(e,t,{checksumAddress:r,staticPosition:s+i});i+=u,l.push(c)}return[l,i]}function jw(e){return[qy(e.readBytes(32),{size:32}),32]}function zw(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=hn(e.readBytes(32));e.setPosition(n+i);const l=hn(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[Rt(a),32]}return[Rt(e.readBytes(Number.parseInt(o,10),32)),32]}function Uw(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?Gy(o,{signed:n}):hn(o,{signed:n}),32]}function Ww(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let l=0;if(qo(t)){const a=hn(e.readBytes(sl)),c=o+a;for(let u=0;u<t.components.length;++u){const d=t.components[u];e.setPosition(c+l);const[p,f]=Br(e,d,{checksumAddress:r,staticPosition:c});l+=f,i[s?u:d==null?void 0:d.name]=p}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const c=t.components[a],[u,d]=Br(e,c,{checksumAddress:r,staticPosition:o});i[s?a:c==null?void 0:c.name]=u,l+=d}return[i,l]}function _w(e,{staticPosition:t}){const n=hn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=hn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=Ky(tf(s));return e.setPosition(t+32),[i,32]}function Vw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(il({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function il({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=ll(r.type);if(o){const[s,i]=o;return Gw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Xw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Hw(n,{checksum:e});if(r.type==="bool")return Kw(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Zf.exec(r.type)??[];return Zw(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return qw(n,{type:r.type});if(r.type==="string")return Yw(n);throw new dl(r.type)}function al(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=ft(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(Ve(t+o,{size:32})),r.push(l),o+=ft(l)):n.push(l)}return Ft(...n,...r)}function Hw(e,t){const{checksum:n=!1}=t;return qs(e,{strict:n}),{dynamic:!1,encoded:tr(e.toLowerCase())}}function Gw(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new i6(e);if(!s&&e.length!==r)throw new s6({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const l=[];for(let a=0;a<e.length;a++){const c=il({checksumAddress:n,parameter:o,value:e[a]});c.dynamic&&(i=!0),l.push(c)}if(s||i){const a=al(l);if(s){const c=Ve(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?Ft(c,a):c}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Ft(...l.map(({encoded:a})=>a))}}function qw(e,{type:t}){const[,n]=t.split("bytes"),r=ft(e);if(!n){let o=e;return r%32!==0&&(o=nr(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Ft(tr(Ve(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new e0({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:nr(e)}}function Kw(e){if(typeof e!="boolean")throw new re(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:tr(nf(e))}}function Zw(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new sf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Ve(e,{size:32,signed:t})}}function Yw(e){const t=ja(e),n=Math.ceil(ft(t)/32),r=[];for(let o=0;o<n;o++)r.push(nr(Yt(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Ft(nr(Ve(ft(t),{size:32})),...r)}}function Xw(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const l=r.components[i],a=Array.isArray(e)?i:l.name,c=il({checksumAddress:n,parameter:l,value:e[a]});s.push(c),c.dynamic&&(o=!0)}return{dynamic:o,encoded:o?al(s):Ft(...s.map(({encoded:i})=>i))}}function ll(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function qo(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(qo);const n=ll(e.type);return!!(n&&qo({...e,type:n[1]}))}const Jw={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new t6({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new e6({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Jf({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Jf({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Qw(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Jw);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Jf extends re{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class e6 extends re{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class t6 extends re{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function n6(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?ef(t):t,i=Qw(s);if(Ir(s)===0&&e.length>0)throw new o6;if(Ir(s)&&Ir(s)<32)throw new r6({data:typeof t=="string"?t:Rt(t),parameters:e,size:Ir(s)});let l=0;const a=r==="Array"?[]:{};for(let c=0;c<e.length;++c){const u=e[c];i.setPosition(l);const[d,p]=Br(i,u,{checksumAddress:o,staticPosition:0});l+=p,r==="Array"?a.push(d):a[u.name??c]=d}return a}function cl(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new t0({expectedLength:e.length,givenLength:t.length});const o=Vw({checksumAddress:r,parameters:e,values:t}),s=al(o);return s.length===0?"0x":s}function ul(e,t){if(e.length!==t.length)throw new t0({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r];n.push(ul.encode(o,s))}return Ft(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return qs(a),tr(a.toLowerCase(),o?32:0)}if(n==="string")return ja(r);if(n==="bytes")return r;if(n==="bool")return tr(nf(r),o?32:1);const s=n.match(Zf);if(s){const[a,c,u="256"]=s,d=Number.parseInt(u,10)/8;return Ve(r,{size:o?32:d,signed:c==="int"})}const i=n.match(Bw);if(i){const[a,c]=i;if(Number.parseInt(c,10)!==(r.length-2)/2)throw new e0({expectedSize:Number.parseInt(c,10),value:r});return nr(r,o?32:0)}const l=n.match(Lw);if(l&&Array.isArray(r)){const[a,c]=l,u=[];for(let d=0;d<r.length;d++)u.push(t(c,r[d],!0));return u.length===0?"0x":Ft(...u)}throw new dl(n)}e.encode=t})(ul||(ul={}));function Qf(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?Su(e):e}class r6 extends re{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${mr(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class o6 extends re{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class s6 extends re{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class e0 extends re{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ft(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class t0 extends re{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
90
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class i6 extends re{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class dl extends re{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const et=BigInt(0),He=BigInt(1),rr=BigInt(2),a6=BigInt(3),n0=BigInt(4),r0=BigInt(5),o0=BigInt(8);function tt(e,t){const n=e%t;return n>=et?n:t+n}function xt(e,t,n){let r=e;for(;t-- >et;)r*=r,r%=n;return r}function fl(e,t){if(e===et)throw new Error("invert: expected non-zero number");if(t<=et)throw new Error("invert: expected positive modulus, got "+t);let n=tt(e,t),r=t,o=et,s=He;for(;n!==et;){const l=r/n,a=r%n,c=o-s*l;r=n,n=a,o=s,s=c}if(r!==He)throw new Error("invert: does not exist");return tt(o,t)}function s0(e,t){const n=(e.ORDER+He)/n0,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function l6(e,t){const n=(e.ORDER-r0)/o0,r=e.mul(t,rr),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,rr),o),l=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(l),t))throw new Error("Cannot find square root");return l}function c6(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-He,n=0;for(;t%rr===et;)t/=rr,n++;let r=rr;const o=pl(e);for(;a0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return s0;let s=o.pow(r,t);const i=(t+He)/rr;return function(a,c){if(a.is0(c))return c;if(a0(a,c)!==1)throw new Error("Cannot find square root");let u=n,d=a.mul(a.ONE,s),p=a.pow(c,t),f=a.pow(c,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===u)throw new Error("Cannot find square root");const x=He<<BigInt(u-h-1),T=a.pow(d,x);u=h,d=a.sqr(T),p=a.mul(p,d),f=a.mul(f,T)}return f}}function u6(e){return e%n0===a6?s0:e%o0===r0?l6:c6(e)}const d6=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function f6(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=d6.reduce((r,o)=>(r[o]="function",r),t);return js(e,n)}function p6(e,t,n){if(n<et)throw new Error("invalid exponent, negatives unsupported");if(n===et)return e.ONE;if(n===He)return t;let r=e.ONE,o=t;for(;n>et;)n&He&&(r=e.mul(r,o)),o=e.sqr(o),n>>=He;return r}function i0(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,l,a)=>e.is0(l)?i:(r[a]=i,e.mul(i,l)),e.ONE),s=e.inv(o);return t.reduceRight((i,l,a)=>e.is0(l)?i:(r[a]=e.mul(i,r[a]),e.mul(i,l)),s),r}function a0(e,t){const n=(e.ORDER-He)/rr,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function l0(e,t){t!==void 0&&so(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function pl(e,t,n=!1,r={}){if(e<=et)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=l0(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const l=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:Rs(o),ZERO:et,ONE:He,create:a=>tt(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return et<=a&&a<e},is0:a=>a===et,isOdd:a=>(a&He)===He,neg:a=>tt(-a,e),eql:(a,c)=>a===c,sqr:a=>tt(a*a,e),add:(a,c)=>tt(a+c,e),sub:(a,c)=>tt(a-c,e),mul:(a,c)=>tt(a*c,e),pow:(a,c)=>p6(l,a,c),div:(a,c)=>tt(a*fl(c,e),e),sqrN:a=>a*a,addN:(a,c)=>a+c,subN:(a,c)=>a-c,mulN:(a,c)=>a*c,inv:a=>fl(a,e),sqrt:r.sqrt||(a=>(i||(i=u6(e)),i(l,a))),toBytes:a=>n?Gd(a,s):Uo(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Hd(a):er(a)},invertBatch:a=>i0(l,a),cmov:(a,c,u)=>u?c:a});return Object.freeze(l)}function c0(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function u0(e){const t=c0(e);return t+Math.ceil(t/2)}function h6(e,t,n=!1){const r=e.length,o=c0(t),s=u0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Hd(e):er(e),l=tt(i,t-He)+He;return n?Gd(l,o):Uo(l,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const d0=BigInt(0),hl=BigInt(1);function ml(e,t){const n=t.negate();return e?n:t}function f0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function bl(e,t){f0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Rs(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function p0(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let l=Number(e&o),a=e>>i;l>r&&(l-=s,a+=hl);const c=t*r,u=c+Math.abs(l)-1,d=l===0,p=l<0,f=t%2!==0;return{nextN:a,offset:u,isZero:d,isNeg:p,isNegF:f,offsetF:c}}function m6(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function b6(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const gl=new WeakMap,h0=new WeakMap;function yl(e){return h0.get(e)||1}function g6(e,t){return{constTimeNegate:ml,hasPrecomputes(n){return yl(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>d0;)r&hl&&(o=o.add(s)),s=s.double(),r>>=hl;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=bl(r,t),i=[];let l=n,a=l;for(let c=0;c<o;c++){a=l,i.push(a);for(let u=1;u<s;u++)a=a.add(l),i.push(a);l=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const l=bl(n,t);for(let a=0;a<l.windows;a++){const{nextN:c,offset:u,isZero:d,isNeg:p,isNegF:f,offsetF:h}=p0(o,a,l);o=c,d?i=i.add(ml(f,r[h])):s=s.add(ml(p,r[u]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=bl(n,t);for(let l=0;l<i.windows&&o!==d0;l++){const{nextN:a,offset:c,isZero:u,isNeg:d}=p0(o,l,i);if(o=a,!u){const p=r[c];s=s.add(d?p.negate():p)}}return s},getPrecomputes(n,r,o){let s=gl.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&gl.set(r,o(s))),s},wNAFCached(n,r,o){const s=yl(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=yl(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){f0(r,t),h0.set(n,r),gl.delete(n)}}}function y6(e,t,n,r){m6(n,e),b6(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,l=$y(BigInt(o));let a=1;l>12?a=l-3:l>4?a=l-2:l>0&&(a=2);const c=Rs(a),u=new Array(Number(c)+1).fill(i),d=Math.floor((t.BITS-1)/a)*a;let p=i;for(let f=d;f>=0;f-=a){u.fill(i);for(let m=0;m<s;m++){const x=r[m],T=Number(x>>BigInt(f)&c);u[T]=u[T].add(n[m])}let h=i;for(let m=u.length-1,x=i;m>0;m--)x=x.add(u[m]),h=h.add(x);if(p=p.add(h),f!==0)for(let m=0;m<a;m++)p=p.double()}return p}function m0(e){return f6(e.Fp),js(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...l0(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function b0(e){e.lowS!==void 0&&jo("lowS",e.lowS),e.prehash!==void 0&&jo("prehash",e.prehash)}function v6(e){const t=m0(e);js(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}class w6 extends Error{constructor(t=""){super(t)}}const mn={Err:w6,_tlv:{encode:(e,t)=>{const{Err:n}=mn;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=Ls(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Ls(o.length/2|128):"";return Ls(e)+s+o+t},decode(e,t){const{Err:n}=mn;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const c=t.subarray(r,r+a);if(c.length!==a)throw new n("tlv.decode: length bytes not complete");if(c[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of c)i=i<<8|u;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const l=t.subarray(r,r+i);if(l.length!==i)throw new n("tlv.decode: wrong value length");return{v:l,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=mn;if(e<bn)throw new t("integer: negative integers are not allowed");let n=Ls(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=mn;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return er(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=mn,o=wt("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:l,l:a}=r.decode(2,s),{v:c,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(l),s:n.decode(c)}},hexFromSig(e){const{_tlv:t,_int:n}=mn,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}};function vl(e,t){return zo(Uo(e,t))}const bn=BigInt(0),Re=BigInt(1);BigInt(2);const wl=BigInt(3),x6=BigInt(4);function E6(e){const t=v6(e),{Fp:n}=t,r=pl(t.n,t.nBitLength),o=t.toBytes||((P,A,k)=>{const B=A.toAffine();return Fs(Uint8Array.from([4]),n.toBytes(B.x),n.toBytes(B.y))}),s=t.fromBytes||(P=>{const A=P.subarray(1),k=n.fromBytes(A.subarray(0,n.BYTES)),B=n.fromBytes(A.subarray(n.BYTES,2*n.BYTES));return{x:k,y:B}});function i(P){const{a:A,b:k}=t,B=n.sqr(P),F=n.mul(B,P);return n.add(n.add(F,n.mul(P,A)),k)}function l(P,A){const k=n.sqr(A),B=i(P);return n.eql(k,B)}if(!l(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,wl),x6),c=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,c)))throw new Error("bad curve params: a or b");function u(P){return Fa(P,Re,t.n)}function d(P){const{allowedPrivateKeyLengths:A,nByteLength:k,wrapPrivateKey:B,n:F}=t;if(A&&typeof P!="bigint"){if(Ro(P)&&(P=zo(P)),typeof P!="string"||!A.includes(P.length))throw new Error("invalid private key");P=P.padStart(k*2,"0")}let b;try{b=typeof P=="bigint"?P:er(wt("private key",P,k))}catch{throw new Error("invalid private key, expected hex or "+k+" bytes, got "+typeof P)}return B&&(b=tt(b,F)),$r("private key",b,Re,F),b}function p(P){if(!(P instanceof m))throw new Error("ProjectivePoint expected")}const f=Kd((P,A)=>{const{px:k,py:B,pz:F}=P;if(n.eql(F,n.ONE))return{x:k,y:B};const b=P.is0();A==null&&(A=b?n.ONE:n.inv(F));const v=n.mul(k,A),E=n.mul(B,A),I=n.mul(F,A);if(b)return{x:n.ZERO,y:n.ZERO};if(!n.eql(I,n.ONE))throw new Error("invZ was invalid");return{x:v,y:E}}),h=Kd(P=>{if(P.is0()){if(t.allowInfinityPoint&&!n.is0(P.py))return;throw new Error("bad point: ZERO")}const{x:A,y:k}=P.toAffine();if(!n.isValid(A)||!n.isValid(k))throw new Error("bad point: x or y not FE");if(!l(A,k))throw new Error("bad point: equation left != right");if(!P.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class m{constructor(A,k,B){if(A==null||!n.isValid(A))throw new Error("x required");if(k==null||!n.isValid(k)||n.is0(k))throw new Error("y required");if(B==null||!n.isValid(B))throw new Error("z required");this.px=A,this.py=k,this.pz=B,Object.freeze(this)}static fromAffine(A){const{x:k,y:B}=A||{};if(!A||!n.isValid(k)||!n.isValid(B))throw new Error("invalid affine point");if(A instanceof m)throw new Error("projective point not allowed");const F=b=>n.eql(b,n.ZERO);return F(k)&&F(B)?m.ZERO:new m(k,B,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){const k=i0(n,A.map(B=>B.pz));return A.map((B,F)=>B.toAffine(k[F])).map(m.fromAffine)}static fromHex(A){const k=m.fromAffine(s(wt("pointHex",A)));return k.assertValidity(),k}static fromPrivateKey(A){return m.BASE.multiply(d(A))}static msm(A,k){return y6(m,r,A,k)}_setWindowSize(A){w.setWindowSize(this,A)}assertValidity(){h(this)}hasEvenY(){const{y:A}=this.toAffine();if(n.isOdd)return!n.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){p(A);const{px:k,py:B,pz:F}=this,{px:b,py:v,pz:E}=A,I=n.eql(n.mul(k,E),n.mul(b,F)),$=n.eql(n.mul(B,E),n.mul(v,F));return I&&$}negate(){return new m(this.px,n.neg(this.py),this.pz)}double(){const{a:A,b:k}=t,B=n.mul(k,wl),{px:F,py:b,pz:v}=this;let E=n.ZERO,I=n.ZERO,$=n.ZERO,C=n.mul(F,F),D=n.mul(b,b),y=n.mul(v,v),O=n.mul(F,b);return O=n.add(O,O),$=n.mul(F,v),$=n.add($,$),E=n.mul(A,$),I=n.mul(B,y),I=n.add(E,I),E=n.sub(D,I),I=n.add(D,I),I=n.mul(E,I),E=n.mul(O,E),$=n.mul(B,$),y=n.mul(A,y),O=n.sub(C,y),O=n.mul(A,O),O=n.add(O,$),$=n.add(C,C),C=n.add($,C),C=n.add(C,y),C=n.mul(C,O),I=n.add(I,C),y=n.mul(b,v),y=n.add(y,y),C=n.mul(y,O),E=n.sub(E,C),$=n.mul(y,D),$=n.add($,$),$=n.add($,$),new m(E,I,$)}add(A){p(A);const{px:k,py:B,pz:F}=this,{px:b,py:v,pz:E}=A;let I=n.ZERO,$=n.ZERO,C=n.ZERO;const D=t.a,y=n.mul(t.b,wl);let O=n.mul(k,b),M=n.mul(B,v),S=n.mul(F,E),L=n.add(k,B),j=n.add(b,v);L=n.mul(L,j),j=n.add(O,M),L=n.sub(L,j),j=n.add(k,F);let z=n.add(b,E);return j=n.mul(j,z),z=n.add(O,S),j=n.sub(j,z),z=n.add(B,F),I=n.add(v,E),z=n.mul(z,I),I=n.add(M,S),z=n.sub(z,I),C=n.mul(D,j),I=n.mul(y,S),C=n.add(I,C),I=n.sub(M,C),C=n.add(M,C),$=n.mul(I,C),M=n.add(O,O),M=n.add(M,O),S=n.mul(D,S),j=n.mul(y,j),M=n.add(M,S),S=n.sub(O,S),S=n.mul(D,S),j=n.add(j,S),O=n.mul(M,j),$=n.add($,O),O=n.mul(z,j),I=n.mul(L,I),I=n.sub(I,O),O=n.mul(L,M),C=n.mul(z,C),C=n.add(C,O),new m(I,$,C)}subtract(A){return this.add(A.negate())}is0(){return this.equals(m.ZERO)}wNAF(A){return w.wNAFCached(this,A,m.normalizeZ)}multiplyUnsafe(A){const{endo:k,n:B}=t;$r("scalar",A,bn,B);const F=m.ZERO;if(A===bn)return F;if(this.is0()||A===Re)return this;if(!k||w.hasPrecomputes(this))return w.wNAFCachedUnsafe(this,A,m.normalizeZ);let{k1neg:b,k1:v,k2neg:E,k2:I}=k.splitScalar(A),$=F,C=F,D=this;for(;v>bn||I>bn;)v&Re&&($=$.add(D)),I&Re&&(C=C.add(D)),D=D.double(),v>>=Re,I>>=Re;return b&&($=$.negate()),E&&(C=C.negate()),C=new m(n.mul(C.px,k.beta),C.py,C.pz),$.add(C)}multiply(A){const{endo:k,n:B}=t;$r("scalar",A,Re,B);let F,b;if(k){const{k1neg:v,k1:E,k2neg:I,k2:$}=k.splitScalar(A);let{p:C,f:D}=this.wNAF(E),{p:y,f:O}=this.wNAF($);C=w.constTimeNegate(v,C),y=w.constTimeNegate(I,y),y=new m(n.mul(y.px,k.beta),y.py,y.pz),F=C.add(y),b=D.add(O)}else{const{p:v,f:E}=this.wNAF(A);F=v,b=E}return m.normalizeZ([F,b])[0]}multiplyAndAddUnsafe(A,k,B){const F=m.BASE,b=(E,I)=>I===bn||I===Re||!E.equals(F)?E.multiplyUnsafe(I):E.multiply(I),v=b(this,k).add(b(A,B));return v.is0()?void 0:v}toAffine(A){return f(this,A)}isTorsionFree(){const{h:A,isTorsionFree:k}=t;if(A===Re)return!0;if(k)return k(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:A,clearCofactor:k}=t;return A===Re?this:k?k(m,this):this.multiplyUnsafe(t.h)}toRawBytes(A=!0){return jo("isCompressed",A),this.assertValidity(),o(m,this,A)}toHex(A=!0){return jo("isCompressed",A),zo(this.toRawBytes(A))}}m.BASE=new m(t.Gx,t.Gy,n.ONE),m.ZERO=new m(n.ZERO,n.ONE,n.ZERO);const{endo:x,nBitLength:T}=t,w=g6(m,x?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:m,normPrivateKeyToScalar:d,weierstrassEquation:i,isWithinCurveOrder:u}}function S6(e){const t=m0(e);return js(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function P6(e){const t=S6(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,l=2*n.BYTES+1;function a(y){return tt(y,r)}function c(y){return fl(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:p,isWithinCurveOrder:f}=E6({...t,toBytes(y,O,M){const S=O.toAffine(),L=n.toBytes(S.x),j=Fs;return jo("isCompressed",M),M?j(Uint8Array.from([O.hasEvenY()?2:3]),L):j(Uint8Array.from([4]),L,n.toBytes(S.y))},fromBytes(y){const O=y.length,M=y[0],S=y.subarray(1);if(O===i&&(M===2||M===3)){const L=er(S);if(!Fa(L,Re,n.ORDER))throw new Error("Point is not on curve");const j=p(L);let z;try{z=n.sqrt(j)}catch(Z){const q=Z instanceof Error?": "+Z.message:"";throw new Error("Point is not on curve"+q)}const W=(z&Re)===Re;return(M&1)===1!==W&&(z=n.neg(z)),{x:L,y:z}}else if(O===l&&M===4){const L=n.fromBytes(S.subarray(0,n.BYTES)),j=n.fromBytes(S.subarray(n.BYTES,2*n.BYTES));return{x:L,y:j}}else{const L=i,j=l;throw new Error("invalid Point, expected length of "+L+", or uncompressed "+j+", got "+O)}}});function h(y){const O=r>>Re;return y>O}function m(y){return h(y)?a(-y):y}const x=(y,O,M)=>er(y.slice(O,M));class T{constructor(O,M,S){$r("r",O,Re,r),$r("s",M,Re,r),this.r=O,this.s=M,S!=null&&(this.recovery=S),Object.freeze(this)}static fromCompact(O){const M=o;return O=wt("compactSignature",O,M*2),new T(x(O,0,M),x(O,M,2*M))}static fromDER(O){const{r:M,s:S}=mn.toSig(wt("DER",O));return new T(M,S)}assertValidity(){}addRecoveryBit(O){return new T(this.r,this.s,O)}recoverPublicKey(O){const{r:M,s:S,recovery:L}=this,j=F(wt("msgHash",O));if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");const z=L===2||L===3?M+t.n:M;if(z>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const W=L&1?"03":"02",_=u.fromHex(W+vl(z,n.BYTES)),Z=c(z),q=a(-j*Z),H=a(S*Z),ee=u.BASE.multiplyAndAddUnsafe(_,q,H);if(!ee)throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new T(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Bs(this.toDERHex())}toDERHex(){return mn.hexFromSig(this)}toCompactRawBytes(){return Bs(this.toCompactHex())}toCompactHex(){const O=o;return vl(this.r,O)+vl(this.s,O)}}const w={isValidPrivateKey(y){try{return d(y),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const y=u0(t.n);return h6(t.randomBytes(y),t.n)},precompute(y=8,O=u.BASE){return O._setWindowSize(y),O.multiply(BigInt(3)),O}};function P(y,O=!0){return u.fromPrivateKey(y).toRawBytes(O)}function A(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const M=wt("key",y).length,S=n.BYTES,L=S+1,j=2*S+1;if(!(t.allowedPrivateKeyLengths||o===L))return M===L||M===j}function k(y,O,M=!0){if(A(y)===!0)throw new Error("first arg must be private key");if(A(O)===!1)throw new Error("second arg must be public key");return u.fromHex(O).multiply(d(y)).toRawBytes(M)}const B=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const O=er(y),M=y.length*8-s;return M>0?O>>BigInt(M):O},F=t.bits2int_modN||function(y){return a(B(y))},b=Rs(s);function v(y){return $r("num < 2^"+s,y,bn,b),Uo(y,o)}function E(y,O,M=I){if(["recovered","canonical"].some(me=>me in M))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:L}=t;let{lowS:j,prehash:z,extraEntropy:W}=M;j==null&&(j=!0),y=wt("msgHash",y),b0(M),z&&(y=wt("prehashed msgHash",S(y)));const _=F(y),Z=d(O),q=[v(Z),v(_)];if(W!=null&&W!==!1){const me=W===!0?L(n.BYTES):W;q.push(wt("extraEntropy",me))}const H=Fs(...q),ee=_;function fe(me){const ye=B(me);if(!f(ye))return;const ve=c(ye),oe=u.BASE.multiply(ye).toAffine(),V=a(oe.x);if(V===bn)return;const X=a(ve*a(ee+V*Z));if(X===bn)return;let Q=(oe.x===V?0:2)|Number(oe.y&Re),we=X;return j&&h(X)&&(we=m(X),Q^=1),new T(V,we,Q)}return{seed:H,k2sig:fe}}const I={lowS:t.lowS,prehash:!1},$={lowS:t.lowS,prehash:!1};function C(y,O,M=I){const{seed:S,k2sig:L}=E(y,O,M),j=t;return Iy(j.hash.outputLen,j.nByteLength,j.hmac)(S,L)}u.BASE._setWindowSize(8);function D(y,O,M,S=$){var Q;const L=y;O=wt("msgHash",O),M=wt("publicKey",M);const{lowS:j,prehash:z,format:W}=S;if(b0(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(W!==void 0&&W!=="compact"&&W!=="der")throw new Error("format must be compact or der");const _=typeof L=="string"||Ro(L),Z=!_&&!W&&typeof L=="object"&&L!==null&&typeof L.r=="bigint"&&typeof L.s=="bigint";if(!_&&!Z)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let q,H;try{if(Z&&(q=new T(L.r,L.s)),_){try{W!=="compact"&&(q=T.fromDER(L))}catch(we){if(!(we instanceof mn.Err))throw we}!q&&W!=="der"&&(q=T.fromCompact(L))}H=u.fromHex(M)}catch{return!1}if(!q||j&&q.hasHighS())return!1;z&&(O=t.hash(O));const{r:ee,s:fe}=q,me=F(O),ye=c(fe),ve=a(me*ye),oe=a(ee*ye),V=(Q=u.BASE.multiplyAndAddUnsafe(H,ve,oe))==null?void 0:Q.toAffine();return V?a(V.x)===ee:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:k,sign:C,verify:D,ProjectivePoint:u,Signature:T,utils:w}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function T6(e){return{hash:e,hmac:(t,...n)=>Hf(e,t,Hg(...n)),randomBytes:Gg}}function A6(e,t){const n=r=>P6({...e,...T6(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const g0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),y0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),N6=BigInt(0),C6=BigInt(1),xl=BigInt(2),v0=(e,t)=>(e+t/xl)/t;function O6(e){const t=g0,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),l=BigInt(44),a=BigInt(88),c=e*e*e%t,u=c*c*e%t,d=xt(u,n,t)*u%t,p=xt(d,n,t)*u%t,f=xt(p,xl,t)*c%t,h=xt(f,o,t)*f%t,m=xt(h,s,t)*h%t,x=xt(m,l,t)*m%t,T=xt(x,a,t)*x%t,w=xt(T,l,t)*m%t,P=xt(w,n,t)*u%t,A=xt(P,i,t)*h%t,k=xt(A,r,t)*c%t,B=xt(k,xl,t);if(!El.eql(El.sqr(B),e))throw new Error("Cannot find square root");return B}const El=pl(g0,void 0,void 0,{sqrt:O6}),w0=A6({a:N6,b:BigInt(7),Fp:El,n:y0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=y0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-C6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),l=v0(s*e,t),a=v0(-r*e,t);let c=tt(e-l*n-a*o,t),u=tt(-l*r-a*s,t);const d=c>i,p=u>i;if(d&&(c=t-c),p&&(u=t-u),c>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:c,k2neg:p,k2:u}}}},Md),$6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:w0},Symbol.toStringTag,{value:"Module"}));function x0(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Pl({signature:e});if(typeof e.s>"u")throw new Pl({signature:e});if(n&&typeof e.yParity>"u")throw new Pl({signature:e});if(e.r<0n||e.r>Yf)throw new F6({value:e.r});if(e.s<0n||e.s>Yf)throw new R6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new Tl({value:e.yParity})}function I6(e){return E0(Rt(e))}function E0(e){if(e.length!==130&&e.length!==132)throw new B6({signature:e});const t=BigInt(Yt(e,0,32)),n=BigInt(Yt(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return Sl(o)}catch{throw new Tl({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function M6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return D6(e)}function D6(e){const t=typeof e=="string"?E0(e):e instanceof Uint8Array?I6(e):typeof e.r=="string"?L6(e):e.v?k6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return x0(t),t}function k6(e){return{r:e.r,s:e.s,yParity:Sl(e.v)}}function L6(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=Sl(n)),typeof r!="number")throw new Tl({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function Sl(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new j6({value:e})}class B6 extends re{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${ft(nv(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Pl extends re{constructor({signature:t}){super(`Signature \`${Qd(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class F6 extends re{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class R6 extends re{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class Tl extends re{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class j6 extends re{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function z6(e,t={}){return typeof e.chainId=="string"?U6(e):{...e,...t.signature}}function U6(e){const{address:t,chainId:n,nonce:r}=e,o=M6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const W6="0x8010801080108010801080108010801080108010801080108010801080108010",_6=Qf("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function S0(e){if(typeof e=="string"){if(Yt(e,-32)!==W6)throw new G6(e)}else x0(e.authorization)}function V6(e){S0(e);const t=of(Yt(e,-64,-32)),n=Yt(e,-t-64,-64),r=Yt(e,0,-t-64),[o,s,i]=n6(_6,n);return{authorization:z6({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:r,...i&&i!=="0x"?{data:i,to:s}:{}}}function H6(e){try{return S0(e),!0}catch{return!1}}let G6=class extends re{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};class q6 extends G{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function K6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new q6({value:e});let[n,r="0"]=e.split(".");const o=n.startsWith("-");if(o&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),t===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>t){const[s,i,l]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${l}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function Z6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function Y6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?ln(e.nonce):void 0,storageProof:e.storageProof?Z6(e.storageProof):void 0}}async function X6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?ne(n):void 0,l=await e.request({method:"eth_getProof",params:[t,o,i||s]});return Y6(l)}async function J6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?ne(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Al(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:l}){var p,f,h;const a=r||"latest",c=n!==void 0?ne(n):void 0;let u=null;if(o?u=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,ne(s)]},{dedupe:!0}):typeof s=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||a,ne(s)]},{dedupe:!!c}):i&&typeof l=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,ne(l)]},{dedupe:!0})),!u)throw new fd({blockHash:t,blockNumber:n,blockTag:a,hash:o,index:s});return(((h=(f=(p=e.chain)==null?void 0:p.formatters)==null?void 0:f.transaction)==null?void 0:h.format)||Sa)(u,"getTransaction")}async function Q6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([te(e,Vo,"getBlockNumber")({}),t?te(e,Al,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function Ks(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new pd({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||Pf)(n,"getTransactionReceipt")}async function ex(e,t){var w;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:l,stateOverride:a}=t,c=t.contracts,{batchSize:u=t.batchSize??1024,deployless:d=t.deployless??!1}=typeof((w=e.batch)==null?void 0:w.multicall)=="object"?e.batch.multicall:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(d)return null;if(e.chain)return kr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),f=[[]];let h=0,m=0;for(let P=0;P<c.length;P++){const{abi:A,address:k,args:B,functionName:F}=c[P];try{const b=vt({abi:A,args:B,functionName:F});m+=(b.length-2)/2,u>0&&m>u&&f[h].length>0&&(h++,m=(b.length-2)/2,f[h]=[]),f[h]=[...f[h],{allowFailure:!0,callData:b,target:k}]}catch(b){const v=Nr(b,{abi:A,address:k,args:B,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!o)throw v;f[h]=[...f[h],{allowFailure:!0,callData:"0x",target:k}]}}const x=await Promise.allSettled(f.map(P=>te(e,jt,"readContract")({...p===null?{code:Ua}:{address:p},abi:Mr,account:n,args:[P],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:l,functionName:"aggregate3",stateOverride:a}))),T=[];for(let P=0;P<x.length;P++){const A=x[P];if(A.status==="rejected"){if(!o)throw A.reason;for(let B=0;B<f[P].length;B++)T.push({status:"failure",error:A.reason,result:void 0});continue}const k=A.value;for(let B=0;B<k.length;B++){const{returnData:F,success:b}=k[B],{callData:v}=f[P][B],{abi:E,address:I,functionName:$,args:C}=c[T.length];try{if(v==="0x")throw new ro;if(!b)throw new Os({data:F});const D=kn({abi:E,args:C,data:F,functionName:$});T.push(o?{result:D,status:"success"}:D)}catch(D){const y=Nr(D,{abi:E,address:I,args:C,docsPath:"/docs/contract/multicall",functionName:$});if(!o)throw y;T.push({error:y,result:void 0,status:"failure"})}}}if(T.length!==c.length)throw new G("multicall results mismatch");return T}async function Nl(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:l}=t;try{const a=[];for(const p of o){const f=p.blockOverrides?uf(p.blockOverrides):void 0,h=p.calls.map(x=>{const T=x,w=T.account?dt(T.account):void 0,P=T.abi?vt(T):T.data,A={...T,account:w,data:T.dataSuffix?Lt([P||"0x",T.dataSuffix]):P,from:T.from??(w==null?void 0:w.address)};return Or(A),Bo(A)}),m=p.stateOverrides?xa(p.stateOverrides):void 0;a.push({blockOverrides:f,calls:h,stateOverrides:m})}const u=(typeof n=="bigint"?ne(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:l},u]})).map((p,f)=>({...Nd(p),calls:p.calls.map((h,m)=>{var E,I;const{abi:x,args:T,functionName:w,to:P}=o[f].calls[m],A=((E=h.error)==null?void 0:E.data)??h.returnData,k=BigInt(h.gasUsed),B=(I=h.logs)==null?void 0:I.map($=>Zt($)),F=h.status==="0x1"?"success":"failure",b=x&&F==="success"&&A!=="0x"?kn({abi:x,data:A,functionName:w}):null,v=(()=>{if(F==="success")return;let $;if(A==="0x"?$=new ro:A&&($=new Os({data:A})),!!$)return Nr($,{abi:x??[],address:P??"0x",args:T,functionName:w??"<unknown>"})})();return{data:A,gasUsed:k,logs:B,status:F,...F==="success"?{result:b}:{error:v}}})}))}catch(a){const c=a,u=Ms(c,{});throw u instanceof Lo?c:u}}function Cl(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function","error",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new re("Unable to normalize signature.");return o}function Ol(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ol(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>Ol(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>Ol(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function P0(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return P0(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ol(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ol(n[r],{strict:!1}):!1)return i}}function T0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Eu(e):e;return{...r,...n?{hash:Fr(r)}:{}}}function Zs(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=rv(t,{strict:!1}),i=e.filter(c=>s?c.type==="function"||c.type==="error"?A0(c)===Yt(t,0,4):c.type==="event"?Fr(c)===t:!1:"name"in c&&c.name===t);if(i.length===0)throw new Ys({name:t});if(i.length===1)return{...i[0],...o?{hash:Fr(i[0])}:{}};let l;for(const c of i){if(!("inputs"in c))continue;if(!r||r.length===0){if(!c.inputs||c.inputs.length===0)return{...c,...o?{hash:Fr(c)}:{}};continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==r.length)continue;if(r.every((d,p)=>{const f="inputs"in c&&c.inputs[p];return f?Ol(d,f):!1})){if(l&&"inputs"in l&&l.inputs){const d=P0(c.inputs,l.inputs,r);if(d)throw new nx({abiItem:c,type:d[0]},{abiItem:l,type:d[1]})}l=c}}const a=(()=>{if(l)return l;const[c,...u]=i;return{...c,overloads:u}})();if(!a)throw new Ys({name:t});return{...a,...o?{hash:Fr(a)}:{}}}function A0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Zs(n,r)}return e[0]})();return Yt(Fr(t),0,4)}function tx(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return Zs(r,o)}return e[0]})(),n=typeof t=="string"?t:vs(t);return Cl(n)}function Fr(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Zs(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Gf(ja(tx(t)))}class nx extends re{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Cl(vs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Cl(vs(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class Ys extends re{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function rx(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,l]=e;return[sx(i),l]}return e})(),{bytecode:r,args:o}=n;return Ft(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?cl(t.inputs,o):"0x")}function ox(e){return T0(e)}function sx(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new Ys({name:"constructor"});return t}function ix(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[c,u,d]=e;return[N0(c,u,{args:d}),d]}const[l,a]=e;return[l,a]})(),{overloads:r}=t,o=r?N0([t,...r],t.name,{args:n}):t,s=ax(o),i=n.length>0?cl(o.inputs,n):void 0;return i?Ft(s,i):s}function Rr(e,t={}){return T0(e,t)}function N0(e,t,n){const r=Zs(e,t,n);if(r.type!=="function")throw new Ys({name:t,type:"function"});return r}function ax(e){return A0(e)}const lx="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",zt="0x0000000000000000000000000000000000000000",cx="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function ux(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:l,validation:a}=t,c=t.account?dt(t.account):void 0;if(i&&!c)throw new G("`account` is required when `traceAssetChanges` is true");const u=c?rx(ox("constructor(bytes, bytes)"),{bytecode:gf,args:[cx,ix(Rr("function getBalance(address)"),[c.address])]}):void 0,d=i?await Promise.all(t.calls.map(async S=>{if(!S.data&&!S.abi)return;const{accessList:L}=await Df(e,{account:c.address,...S,data:S.abi?vt(S):S.data});return L.map(({address:j,storageKeys:z})=>z.length>0?j:null)})).then(S=>S.flat().filter(Boolean)):[],p=await Nl(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:d.map((S,L)=>({abi:[Rr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:S,from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]}]:[],{calls:[...o,{to:zt}].map(S=>({...S,from:c==null?void 0:c.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:d.map((S,L)=>({abi:[Rr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:S,from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]},{calls:d.map((S,L)=>({to:S,abi:[Rr("function decimals() returns (uint256)")],functionName:"decimals",from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]},{calls:d.map((S,L)=>({to:S,abi:[Rr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]},{calls:d.map((S,L)=>({to:S,abi:[Rr("function symbol() returns (string)")],functionName:"symbol",from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]}]:[]],traceTransfers:l,validation:a}),f=i?p[2]:p[0],[h,m,,x,T,w,P,A]=i?p:[],{calls:k,...B}=f,F=k.slice(0,-1)??[],b=(h==null?void 0:h.calls)??[],v=(m==null?void 0:m.calls)??[],E=[...b,...v].map(S=>S.status==="success"?Gt(S.data):null),I=(x==null?void 0:x.calls)??[],$=(T==null?void 0:T.calls)??[],C=[...I,...$].map(S=>S.status==="success"?Gt(S.data):null),D=((w==null?void 0:w.calls)??[]).map(S=>S.status==="success"?S.result:null),y=((A==null?void 0:A.calls)??[]).map(S=>S.status==="success"?S.result:null),O=((P==null?void 0:P.calls)??[]).map(S=>S.status==="success"?S.result:null),M=[];for(const[S,L]of C.entries()){const j=E[S];if(typeof L!="bigint"||typeof j!="bigint")continue;const z=D[S-1],W=y[S-1],_=O[S-1],Z=S===0?{address:lx,decimals:18,symbol:"ETH"}:{address:d[S-1],decimals:_||z?Number(z??1):void 0,symbol:W??void 0};M.some(q=>q.token.address===Z.address)||M.push({token:Z,value:{pre:j,post:L,diff:L-j}})}return{assetChanges:M,block:B,results:F}}const C0="0x6492649264926492649264926492649264926492649264926492649264926492";function dx(e){if(Yt(e,-32)!==C0)throw new hx(e)}function fx(e){const{data:t,signature:n,to:r}=e;return Ft(cl(Qf("address, bytes, bytes"),[r,t,n]),C0)}function px(e){try{return dx(e),!0}catch{return!1}}class hx extends re{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function mx({r:e,s:t,to:n="hex",v:r,yParity:o}){const s=(()=>{if(o===0||o===1)return o;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new w0.Signature(Gt(e),Gt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:qt(i)}async function Xs(e,t){var a,c,u,d;const{address:n,chain:r=e.chain,hash:o,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??((c=(a=r==null?void 0:r.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:c.address),multicallAddress:i=t.multicallAddress??((d=(u=r==null?void 0:r.contracts)==null?void 0:u.multicall3)==null?void 0:d.address)}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const l=(()=>{const p=t.signature;return Dt(p)?p:typeof p=="object"&&"r"in p&&"s"in p?mx(p):Le(p)})();try{return H6(l)?await bx(e,{...t,multicallAddress:i,signature:l}):await gx(e,{...t,verifierAddress:s,signature:l})}catch(p){try{if(Fo(un(n),await yd({hash:o,signature:l})))return!0}catch{}if(p instanceof or)return!1;throw p}}async function bx(e,t){var x;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:l,data:a,signature:c,to:u}=V6(t.signature);if(await Hs(e,{address:n,blockNumber:r,blockTag:o})===Sr(["0xef0100",l.address]))return await yx(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:c});const p={address:l.address,chainId:Number(l.chainId),nonce:Number(l.nonce),r:ne(l.r,{size:32}),s:ne(l.s,{size:32}),yParity:l.yParity};if(!await ow({address:n,authorization:p}))throw new or;const h=await te(e,jt,"readContract")({...i?{address:i}:{code:Ua},authorizationList:[p],abi:Mr,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:u??n,callData:a}]:[],{allowFailure:!0,target:n,callData:vt({abi:mf,functionName:"isValidSignature",args:[s,c]})}]]}),m=(x=h[h.length-1])==null?void 0:x.returnData;if(m!=null&&m.startsWith("0x1626ba7e"))return!0;throw new or}async function gx(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:l,...a}=t,c=await(async()=>!r&&!o||px(i)?i:fx({data:o,signature:i,to:r}))(),u=l?{to:l,data:vt({abi:bf,functionName:"isValidSig",args:[n,s,c]}),...a}:{data:Va({abi:bf,args:[n,s,c],bytecode:uv}),...a},{data:d}=await te(e,Lr,"call")(u).catch(p=>{throw p instanceof hd?new or:p});if(Ag(d??"0x0"))return!0;throw new or}async function yx(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await te(e,jt,"readContract")({address:n,abi:mf,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof md?new or:a})).startsWith("0x1626ba7e"))return!0;throw new or}class or extends Error{}async function vx(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const l=jf(n);return te(e,Xs,"verifyHash")({address:t,factory:r,factoryData:o,hash:l,signature:s,...i})}async function wx(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:l,types:a,domain:c,...u}=t,d=Nw({message:i,primaryType:l,types:a,domain:c});return te(e,Xs,"verifyHash")({address:n,factory:r,factoryData:o,hash:d,signature:s,...u})}function O0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const l=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return l?(()=>{const d=Be(["watchBlockNumber",e.uid,t,n,i]);return Ln(d,{onBlockNumber:r,onError:o},p=>_o(async()=>{var f;try{const h=await te(e,Vo,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(a===void 0||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(f=p.onError)==null||f.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const d=Be(["watchBlockNumber",e.uid,t,n]);return Ln(d,{onBlockNumber:r,onError:o},p=>{let f=!0,h=()=>f=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),{unsubscribe:x}=await m.subscribe({params:["newHeads"],onData(T){var P;if(!f)return;const w=Gt((P=T.result)==null?void 0:P.number);p.onBlockNumber(w,a),a=w},onError(T){var w;(w=p.onError)==null||w.call(p,T)}});h=x,f||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function xx(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:l=({count:k})=>~~(1<<k)*200,timeout:a=18e4}=t,c=Be(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var k;return t.pollingInterval?t.pollingInterval:(k=e.chain)!=null&&k.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let d,p,f,h=!1,m,x;const{promise:T,resolve:w,reject:P}=wf(),A=a?setTimeout(()=>{x==null||x(),m==null||m(),P(new U1({hash:o}))},a):void 0;return m=Ln(c,{onReplaced:s,resolve:w,reject:P},async k=>{if(f=await te(e,Ks,"getTransactionReceipt")({hash:o}).catch(()=>{}),f&&r<=1){clearTimeout(A),k.resolve(f),m==null||m();return}x=te(e,O0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(B){const F=v=>{clearTimeout(A),x==null||x(),v(),m==null||m()};let b=B;if(!h)try{if(f){if(r>1&&(!f.blockNumber||b-f.blockNumber+1n<r))return;F(()=>k.resolve(f));return}if(n&&!d&&(h=!0,await Ka(async()=>{d=await te(e,Al,"getTransaction")({hash:o}),d.blockNumber&&(b=d.blockNumber)},{delay:l,retryCount:i}),h=!1),f=await te(e,Ks,"getTransactionReceipt")({hash:o}),r>1&&(!f.blockNumber||b-f.blockNumber+1n<r))return;F(()=>k.resolve(f))}catch(v){if(v instanceof fd||v instanceof pd){if(!d){h=!1;return}try{p=d,h=!0;const E=await Ka(()=>te(e,Bt,"getBlock")({blockNumber:b,includeTransactions:!0}),{delay:l,retryCount:i,shouldRetry:({error:C})=>C instanceof Td});h=!1;const I=E.transactions.find(({from:C,nonce:D})=>C===p.from&&D===p.nonce);if(!I||(f=await te(e,Ks,"getTransactionReceipt")({hash:I.hash}),r>1&&(!f.blockNumber||b-f.blockNumber+1n<r)))return;let $="replaced";I.to===p.to&&I.value===p.value&&I.input===p.input?$="repriced":I.from===I.to&&I.value===0n&&($="cancelled"),F(()=>{var C;(C=k.onReplaced)==null||C.call(k,{reason:$,replacedTransaction:p,transaction:I,transactionReceipt:f}),k.resolve(f)})}catch(E){F(()=>k.reject(E))}}else F(()=>k.reject(v))}}})}),T}function Ex(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:l,pollingInterval:a=e.pollingInterval}){const c=typeof l<"u"?l:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),u=i??!1;let d;return c?(()=>{const h=Be(["watchBlocks",e.uid,t,n,r,u,a]);return Ln(h,{onBlock:o,onError:s},m=>_o(async()=>{var x;try{const T=await te(e,Bt,"getBlock")({blockTag:t,includeTransactions:u});if(T.number!==null&&(d==null?void 0:d.number)!=null){if(T.number===d.number)return;if(T.number-d.number>1&&n)for(let w=(d==null?void 0:d.number)+1n;w<T.number;w++){const P=await te(e,Bt,"getBlock")({blockNumber:w,includeTransactions:u});m.onBlock(P,d),d=P}}((d==null?void 0:d.number)==null||t==="pending"&&(T==null?void 0:T.number)==null||T.number!==null&&T.number>d.number)&&(m.onBlock(T,d),d=T)}catch(T){(x=m.onError)==null||x.call(m,T)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,x=()=>h=!1;return(async()=>{try{r&&te(e,Bt,"getBlock")({blockTag:t,includeTransactions:u}).then(P=>{h&&m&&(o(P,void 0),m=!1)}).catch(s);const T=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(A=>A.config.type==="webSocket"||A.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:w}=await T.subscribe({params:["newHeads"],async onData(P){var k;if(!h)return;const A=await te(e,Bt,"getBlock")({blockNumber:(k=P.result)==null?void 0:k.number,includeTransactions:u}).catch(()=>{});h&&(o(A,d),m=!1,d=A)},onError(P){s==null||s(P)}});x=w,h||x()}catch(T){s==null||s(T)}})(),()=>x()})()}function Sx(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:l,onLogs:a,poll:c,pollingInterval:u=e.pollingInterval,strict:d}){const p=typeof c<"u"?c:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),f=d??!1;return p?(()=>{const x=Be(["watchEvent",t,n,r,e.uid,o,u,i]);return Ln(x,{onLogs:a,onError:l},T=>{let w;i!==void 0&&(w=i-1n);let P,A=!1;const k=_o(async()=>{var B;if(!A){try{P=await te(e,kf,"createEventFilter")({address:t,args:n,event:o,events:s,strict:f,fromBlock:i})}catch{}A=!0;return}try{let F;if(P)F=await te(e,Us,"getFilterChanges")({filter:P});else{const b=await te(e,Vo,"getBlockNumber")({});w&&w!==b?F=await te(e,Ia,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:w+1n,toBlock:b}):F=[],w=b}if(F.length===0)return;if(r)T.onLogs(F);else for(const b of F)T.onLogs([b])}catch(F){P&&F instanceof In&&(A=!1),(B=T.onError)==null||B.call(T,F)}},{emitOnBegin:!0,interval:u});return async()=>{P&&await te(e,Ws,"uninstallFilter")({filter:P}),k()}})})():(()=>{let x=!0,T=()=>x=!1;return(async()=>{try{const w=(()=>{if(e.transport.type==="fallback"){const B=e.transport.transports.find(F=>F.config.type==="webSocket"||F.config.type==="ipc");return B?B.value:e.transport}return e.transport})(),P=s??(o?[o]:void 0);let A=[];P&&(A=[P.flatMap(F=>lo({abi:[F],eventName:F.name,args:n}))],o&&(A=A[0]));const{unsubscribe:k}=await w.subscribe({params:["logs",{address:t,topics:A}],onData(B){var b;if(!x)return;const F=B.result;try{const{eventName:v,args:E}=ks({abi:P??[],data:F.data,topics:F.topics,strict:f}),I=Zt(F,{args:E,eventName:v});a([I])}catch(v){let E,I;if(v instanceof Es||v instanceof Yi){if(d)return;E=v.abiItem.name,I=(b=v.abiItem.inputs)==null?void 0:b.some(C=>!("name"in C&&C.name))}const $=Zt(F,{args:I?[]:{},eventName:E});a([$])}},onError(B){l==null||l(B)}});T=k,x||T()}catch(w){l==null||l(w)}})(),()=>T()})()}function Px(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const c=Be(["watchPendingTransactions",e.uid,t,s]);return Ln(c,{onTransactions:r,onError:n},u=>{let d;const p=_o(async()=>{var f;try{if(!d)try{d=await te(e,Lf,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await te(e,Us,"getFilterChanges")({filter:d});if(h.length===0)return;if(t)u.onTransactions(h);else for(const m of h)u.onTransactions([m])}catch(h){(f=u.onError)==null||f.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{d&&await te(e,Ws,"uninstallFilter")({filter:d}),p()}})})():(()=>{let c=!0,u=()=>c=!1;return(async()=>{try{const{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!c)return;const f=p.result;r([f])},onError(p){n==null||n(p)}});u=d,c||u()}catch(d){n==null||n(d)}})(),()=>u()})()}function Tx(e){var d,p,f;const{scheme:t,statement:n,...r}=((d=e.match(Ax))==null?void 0:d.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:l,requestId:a,...c}=((p=e.match(Nx))==null?void 0:p.groups)??{},u=(f=e.split("Resources:")[1])==null?void 0:f.split(`
91
+ - `).slice(1);return{...r,...c,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...l?{notBefore:new Date(l)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const Ax=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,Nx=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function Cx(e){const{address:t,domain:n,message:r,nonce:o,scheme:s,time:i=new Date}=e;if(n&&r.domain!==n||o&&r.nonce!==o||s&&r.scheme!==s||r.expirationTime&&i>=r.expirationTime||r.notBefore&&i<r.notBefore)return!1;try{if(!r.address||!yt(r.address,{strict:!1})||t&&!Fo(r.address,t))return!1}catch{return!1}return!0}async function Ox(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:l,time:a=new Date,...c}=t,u=Tx(o);if(!u.address||!Cx({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const p=jf(o);return Xs(e,{address:u.address,hash:p,signature:l,...c})}async function $x(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var l,a,c;const o=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),i=(((c=(a=(l=e.chain)==null?void 0:l.formatters)==null?void 0:a.transactionReceipt)==null?void 0:c.format)||Pf)(o);if(i.status==="reverted"&&n)throw new z1({receipt:i});return i}function Ix(e){return{call:t=>Lr(e,t),createAccessList:t=>Df(e,t),createBlockFilter:()=>qv(e),createContractEventFilter:t=>rd(e,t),createEventFilter:t=>kf(e,t),createPendingTransactionFilter:()=>Lf(e),estimateContractGas:t=>Ay(e,t),estimateGas:t=>Oa(e,t),getBalance:t=>Kv(e,t),getBlobBaseFee:()=>Zv(e),getBlock:t=>Bt(e,t),getBlockNumber:t=>Vo(e,t),getBlockTransactionCount:t=>Yv(e,t),getBytecode:t=>Hs(e,t),getChainId:()=>Na(e),getCode:t=>Hs(e,t),getContractEvents:t=>Ud(e,t),getDelegation:t=>Xv(e,t),getEip712Domain:t=>Qv(e,t),getEnsAddress:t=>Iv(e,t),getEnsAvatar:t=>Vv(e,t),getEnsName:t=>Hv(e,t),getEnsResolver:t=>Gv(e,t),getEnsText:t=>Mf(e,t),getFeeHistory:t=>nw(e,t),estimateFeesPerGas:t=>ly(e,t),getFilterChanges:t=>Us(e,t),getFilterLogs:t=>rw(e,t),getGasPrice:()=>Pa(e),getLogs:t=>Ia(e,t),getProof:t=>X6(e,t),estimateMaxPriorityFeePerGas:t=>ay(e,t),fillTransaction:t=>Fd(e,t),getStorageAt:t=>J6(e,t),getTransaction:t=>Al(e,t),getTransactionConfirmations:t=>Q6(e,t),getTransactionCount:t=>Od(e,t),getTransactionReceipt:t=>Ks(e,t),multicall:t=>ex(e,t),prepareTransactionRequest:t=>jd(e,t),readContract:t=>jt(e,t),sendRawTransaction:t=>Sv(e,t),sendRawTransactionSync:t=>$x(e,t),simulate:t=>Nl(e,t),simulateBlocks:t=>Nl(e,t),simulateCalls:t=>ux(e,t),simulateContract:t=>mv(e,t),verifyHash:t=>Xs(e,t),verifyMessage:t=>vx(e,t),verifySiweMessage:t=>Ox(e,t),verifyTypedData:t=>wx(e,t),uninstallFilter:t=>Ws(e,t),waitForTransactionReceipt:t=>xx(e,t),watchBlocks:t=>Ex(e,t),watchBlockNumber:t=>O0(e,t),watchContractEvent:t=>Ev(e,t),watchEvent:t=>Sx(e,t),watchPendingTransactions:t=>Px(e,t)}}function Mx(e){const{key:t="public",name:n="Public Client"}=e;return Tv({...e,key:t,name:n,type:"publicClient"}).extend(Ix)}function Dx({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:l},a){const c=Tf();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:l},request:iw(r,{methods:t,retryCount:o,retryDelay:s,uid:c}),value:a}}class kx extends G{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function Lx(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:s="http",methods:i,name:l="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:c,retryDelay:u,raw:d}=t;return({chain:p,retryCount:f,timeout:h})=>{const{batchSize:m=1e3,wait:x=0}=typeof n=="object"?n:{},T=t.retryCount??f,w=h??t.timeout??1e4,P=e||(p==null?void 0:p.rpcUrls.default.http[0]);if(!P)throw new kx;const A=gw(P,{fetchFn:r,fetchOptions:o,onRequest:a,onResponse:c,timeout:w});return Dx({key:s,methods:i,name:l,async request({method:k,params:B}){const F={method:k,params:B},{schedule:b}=xf({id:P,wait:x,shouldSplitBatch($){return $.length>m},fn:$=>A.request({body:$}),sort:($,C)=>$.id-C.id}),v=async $=>n?b($):[await A.request({body:$})],[{error:E,result:I}]=await v(F);if(d)return{error:E,result:I};if(E)throw new fa({body:F,error:E,url:P});return I},retryCount:T,retryDelay:u,timeout:w,type:"http"},{fetchOptions:o,url:P})}}const Bx=hw({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}});function Fx({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,l]=g.useState(null),[a,c]=g.useState(o);return g.useEffect(()=>{let u,d;const p=async()=>{try{const f=await e.readContract({address:t,abi:Dr,functionName:"balanceOf",args:[n]});l(f),c(ca(f,r))}catch{c(o)}};p();try{u=e.watchContractEvent({address:t,abi:Dr,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),d=e.watchContractEvent({address:t,abi:Dr,eventName:"Transfer",args:{from:n},onLogs:()=>{p()},poll:!0,pollingInterval:s})}catch{}return()=>{u==null||u(),d==null||d()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const Rx=()=>({openDeposit:g.useCallback(t=>{},[])}),jx=()=>({openWithdraw:g.useCallback(t=>{},[])}),gn="MPC",Js="EVM";var Ne=(e=>(e.SPOT="spot",e.PERPETUAL="perpetual",e.PERPETUALV2="perpetual_v2",e))(Ne||{});const zx="spot",Ux="perpetual";/**
92
92
  * @license lucide-react v0.540.0 - ISC
93
93
  *
94
94
  * This source code is licensed under the ISC license.
95
95
  * See the LICENSE file in the root directory of this source tree.
96
- */const z5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U5=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),C0=e=>{const t=U5(e);return t.charAt(0).toUpperCase()+t.slice(1)},$0=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),W5=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
96
+ */const Wx=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_x=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),$0=e=>{const t=_x(e);return t.charAt(0).toUpperCase()+t.slice(1)},I0=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Vx=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
97
97
  * @license lucide-react v0.540.0 - ISC
98
98
  *
99
99
  * This source code is licensed under the ISC license.
100
100
  * See the LICENSE file in the root directory of this source tree.
101
- */var _5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
101
+ */var Hx={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
102
102
  * @license lucide-react v0.540.0 - ISC
103
103
  *
104
104
  * This source code is licensed under the ISC license.
105
105
  * See the LICENSE file in the root directory of this source tree.
106
- */const V5=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},a)=>g.createElement("svg",{ref:a,..._5,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$0("lucide",o),...!s&&!W5(l)&&{"aria-hidden":"true"},...l},[...i.map(([c,u])=>g.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
106
+ */const Gx=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},a)=>g.createElement("svg",{ref:a,...Hx,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:I0("lucide",o),...!s&&!Vx(l)&&{"aria-hidden":"true"},...l},[...i.map(([c,u])=>g.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
107
107
  * @license lucide-react v0.540.0 - ISC
108
108
  *
109
109
  * This source code is licensed under the ISC license.
110
110
  * See the LICENSE file in the root directory of this source tree.
111
- */const H5=(e,t)=>{const n=g.forwardRef(({className:r,...o},s)=>g.createElement(V5,{ref:s,iconNode:t,className:$0(`lucide-${z5(C0(e))}`,`lucide-${e}`,r),...o}));return n.displayName=C0(e),n};/**
111
+ */const qx=(e,t)=>{const n=g.forwardRef(({className:r,...o},s)=>g.createElement(Gx,{ref:s,iconNode:t,className:I0(`lucide-${Wx($0(e))}`,`lucide-${e}`,r),...o}));return n.displayName=$0(e),n};/**
112
112
  * @license lucide-react v0.540.0 - ISC
113
113
  *
114
114
  * This source code is licensed under the ISC license.
115
115
  * See the LICENSE file in the root directory of this source tree.
116
- */const I0=H5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),G5=typeof document<"u"?g.useLayoutEffect:()=>{},Ln=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},sr=e=>e&&"window"in e&&e.window===e?e:Ln(e).defaultView||window;function q5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function K5(e){return q5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Z5=!1;function Cl(){return Z5}function Fn(e,t){if(!Cl())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:K5(n)?n=n.host:n=n.parentNode}return!1}const jr=(e=document)=>{var t;if(!Cl())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function Ue(e){if(Cl()&&e.target instanceof Element&&e.target.shadowRoot){var t,n;if("composedPath"in e)return(t=e.composedPath()[0])!==null&&t!==void 0?t:null;if("composedPath"in e.nativeEvent)return(n=e.nativeEvent.composedPath()[0])!==null&&n!==void 0?n:null}return e.target}function Y5(e){if(X5())e.focus({preventScroll:!0});else{let t=J5(e);e.focus(),Q5(t)}}let Js=null;function X5(){if(Js==null){Js=!1;try{document.createElement("div").focus({get preventScroll(){return Js=!0,!0}})}catch{}}return Js}function J5(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function Q5(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function Qs(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function $l(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function yn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ko=yn(function(){return $l(/^Mac/i)}),ex=yn(function(){return $l(/^iPhone/i)}),M0=yn(function(){return $l(/^iPad/i)||Ko()&&navigator.maxTouchPoints>1}),tx=yn(function(){return ex()||M0()});yn(function(){return Ko()||tx()});const nx=yn(function(){return Qs(/AppleWebKit/i)&&!rx()}),rx=yn(function(){return Qs(/Chrome/i)}),ox=yn(function(){return Qs(/Android/i)}),sx=yn(function(){return Qs(/Firefox/i)});function Zo(e,t,n=!0){var r,o;let{metaKey:s,ctrlKey:i,altKey:l,shiftKey:a}=t;sx()&&(!((o=window.event)===null||o===void 0||(r=o.type)===null||r===void 0)&&r.startsWith("key"))&&e.target==="_blank"&&(Ko()?s=!0:i=!0);let c=nx()&&Ko()&&!M0()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:i,altKey:l,shiftKey:a}):new MouseEvent("click",{metaKey:s,ctrlKey:i,altKey:l,shiftKey:a,detail:1,bubbles:!0,cancelable:!0});Zo.isOpening=n,Y5(e),e.dispatchEvent(c),Zo.isOpening=!1}Zo.isOpening=!1;function D0(){let e=g.useRef(new Map),t=g.useCallback((o,s,i,l)=>{let a=l!=null&&l.once?(...c)=>{e.current.delete(i),i(...c)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:l}),o.addEventListener(s,a,l)},[]),n=g.useCallback((o,s,i,l)=>{var a;let c=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,c,l),e.current.delete(i)},[]),r=g.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return g.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function ix(e){return e.pointerType===""&&e.isTrusted?!0:ox()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function k0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function ax(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function B0(e){let t=g.useRef({isFocused:!1,observer:null});return G5(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),g.useCallback(n=>{let r=Ue(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r,s=i=>{if(t.current.isFocused=!1,o.disabled){let l=k0(i);e==null||e(l)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let l=o===jr()?null:jr();o.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[e])}let lx=!1,Yo=null;const Il=new Set;let Xo=new Map,ir=!1,Ml=!1;const cx={Tab:!0,Escape:!0};function Dl(e,t){for(let n of Il)n(e,t)}function ux(e){return!(e.metaKey||!Ko()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ei(e){ir=!0,!Zo.isOpening&&ux(e)&&(Yo="keyboard",Dl("keyboard",e))}function Et(e){Yo="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(ir=!0,Dl("pointer",e))}function L0(e){!Zo.isOpening&&ix(e)&&(ir=!0,Yo="virtual")}function F0(e){Ue(e)===window||Ue(e)===document||lx||!e.isTrusted||(!ir&&!Ml&&(Yo="virtual",Dl("virtual",e)),ir=!1,Ml=!1)}function R0(){ir=!1,Ml=!0}function kl(e){if(typeof window>"u"||typeof document>"u"||Xo.get(sr(e)))return;const t=sr(e),n=Ln(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){ir=!0,r.apply(this,arguments)},n.addEventListener("keydown",ei,!0),n.addEventListener("keyup",ei,!0),n.addEventListener("click",L0,!0),t.addEventListener("focus",F0,!0),t.addEventListener("blur",R0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Et,!0),n.addEventListener("pointermove",Et,!0),n.addEventListener("pointerup",Et,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Et,!0),n.addEventListener("mousemove",Et,!0),n.addEventListener("mouseup",Et,!0)),t.addEventListener("beforeunload",()=>{j0(e)},{once:!0}),Xo.set(t,{focus:r})}const j0=(e,t)=>{const n=sr(e),r=Ln(e);t&&r.removeEventListener("DOMContentLoaded",t),Xo.has(n)&&(n.HTMLElement.prototype.focus=Xo.get(n).focus,r.removeEventListener("keydown",ei,!0),r.removeEventListener("keyup",ei,!0),r.removeEventListener("click",L0,!0),n.removeEventListener("focus",F0,!0),n.removeEventListener("blur",R0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Et,!0),r.removeEventListener("pointermove",Et,!0),r.removeEventListener("pointerup",Et,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Et,!0),r.removeEventListener("mousemove",Et,!0),r.removeEventListener("mouseup",Et,!0)),Xo.delete(n))};function fx(e){const t=Ln(e);let n;return t.readyState!=="loading"?kl(e):(n=()=>{kl(e)},t.addEventListener("DOMContentLoaded",n)),()=>j0(e,n)}typeof document<"u"&&fx();function Bl(){return Yo!=="pointer"}const dx=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function px(e,t,n){let r=Ln(n?Ue(n):void 0),o=n?Ue(n):void 0;const s=typeof window<"u"?sr(o).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?sr(o).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?sr(o).HTMLElement:HTMLElement,a=typeof window<"u"?sr(o).KeyboardEvent:KeyboardEvent;let c=jr(r);return e=e||c instanceof s&&!dx.has(c.type)||c instanceof i||c instanceof l&&c.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!cx[n.key])}function hx(e,t,n){kl(),g.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let r=(o,s)=>{px(!!(n!=null&&n.isTextInput),o,s)&&e(Bl())};return Il.add(r),()=>{Il.delete(r)}},t)}function mx(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=g.useCallback(a=>{if(Ue(a)===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=B0(s),l=g.useCallback(a=>{let c=Ue(a);const u=Ln(c),f=u?jr(u):jr();c===a.currentTarget&&c===f&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?l:void 0,onBlur:!t&&(r||o)?s:void 0}}}function bx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=g.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:l}=D0(),a=g.useCallback(f=>{Fn(f.currentTarget,Ue(f))&&s.current.isFocusWithin&&!Fn(f.currentTarget,f.relatedTarget)&&(s.current.isFocusWithin=!1,l(),n&&n(f),o&&o(!1))},[n,o,s,l]),c=B0(a),u=g.useCallback(f=>{if(!Fn(f.currentTarget,Ue(f)))return;let p=Ue(f);const d=Ln(p),h=jr(d);if(!s.current.isFocusWithin&&h===p){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,c(f);let b=f.currentTarget;i(d,"focus",w=>{let T=Ue(w);if(s.current.isFocusWithin&&!Fn(b,T)){let x=new d.defaultView.FocusEvent("blur",{relatedTarget:T});ax(x,b);let E=k0(x);a(E)}},{capture:!0})}},[r,o,c,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let ti=!1,ni=0;function Ll(){ti=!0,setTimeout(()=>{ti=!1},50)}function z0(e){e.pointerType==="touch"&&Ll()}function gx(){if(!(typeof document>"u"))return ni===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",z0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Ll)),ni++,()=>{ni--,!(ni>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",z0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Ll))}}function yx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=g.useState(!1),l=g.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;g.useEffect(gx,[]);let{addGlobalListener:a,removeAllGlobalListeners:c}=D0(),{hoverProps:u,triggerHoverEnd:f}=g.useMemo(()=>{let p=(b,w)=>{if(l.pointerType=w,o||w==="touch"||l.isHovered||!Fn(b.currentTarget,Ue(b)))return;l.isHovered=!0;let T=b.currentTarget;l.target=T,a(Ln(Ue(b)),"pointerover",x=>{l.isHovered&&l.target&&!Fn(l.target,Ue(x))&&d(x,x.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:T,pointerType:w}),n&&n(!0),i(!0)},d=(b,w)=>{let T=l.target;l.pointerType="",l.target=null,!(w==="touch"||!l.isHovered||!T)&&(l.isHovered=!1,c(),r&&r({type:"hoverend",target:T,pointerType:w}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=b=>{ti&&b.pointerType==="mouse"||p(b,b.pointerType)},h.onPointerLeave=b=>{!o&&Fn(b.currentTarget,Ue(b))&&d(b,b.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{l.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=b=>{!l.ignoreEmulatedMouseEvents&&!ti&&p(b,"mouse"),l.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=b=>{!o&&Fn(b.currentTarget,Ue(b))&&d(b,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,l,a,c]);return g.useEffect(()=>{o&&f({currentTarget:l.target},l.pointerType)},[o]),{hoverProps:u,isHovered:s}}function wx(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=g.useRef({isFocused:!1,isFocusVisible:t||Bl()}),[s,i]=g.useState(!1),[l,a]=g.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=g.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=g.useCallback(d=>{o.current.isFocused=d,o.current.isFocusVisible=Bl(),i(d),c()},[c]);hx(d=>{o.current.isFocusVisible=d,c()},[n,s],{enabled:s,isTextInput:n});let{focusProps:f}=mx({isDisabled:r,onFocusChange:u}),{focusWithinProps:p}=bx({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:l,focusProps:r?p:f}}var vx=Object.defineProperty,xx=(e,t,n)=>t in e?vx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fl=(e,t,n)=>(xx(e,typeof t!="symbol"?t+"":t,n),n);let Ex=class{constructor(){Fl(this,"current",this.detect()),Fl(this,"handoffState","pending"),Fl(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Xt=new Ex;function ri(e){var t;return Xt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function oi(e){var t,n;return Xt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function U0(e){var t,n;return(n=(t=oi(e))==null?void 0:t.activeElement)!=null?n:null}function Sx(e){return U0(e)===e}function W0(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function pt(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return W0(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=pt();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function ar(){let[e]=g.useState(pt);return g.useEffect(()=>()=>e.dispose(),[e]),e}let Ce=(e,t)=>{Xt.isServer?g.useEffect(e,t):g.useLayoutEffect(e,t)};function lr(e){let t=g.useRef(e);return Ce(()=>{t.current=e},[e]),t}let pe=function(e){let t=lr(e);return g.useCallback((...n)=>t.current(...n),[t])};function Px(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Tx(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ax({disabled:e=!1}={}){let t=g.useRef(null),[n,r]=g.useState(!1),o=ar(),s=pe(()=>{t.current=null,r(!1),o.dispose()}),i=pe(l=>{if(o.dispose(),t.current===null){t.current=l.currentTarget,r(!0);{let a=ri(l.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",c=>{if(t.current){let u=Px(c);r(Tx(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}function Rn(e){return g.useMemo(()=>e,Object.values(e))}let Nx=g.createContext(void 0);function Rl(){return g.useContext(Nx)}function jl(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function St(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,St),r}var si=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(si||{}),jn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(jn||{});function ht(){let e=Cx();return g.useCallback(t=>Ox({mergeRefs:e,...t}),[e])}function Ox({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:l}){l=l??$x;let a=_0(t,e);if(s)return ii(a,n,r,i,l);let c=o??0;if(c&2){let{static:u=!1,...f}=a;if(u)return ii(f,n,r,i,l)}if(c&1){let{unmount:u=!0,...f}=a;return St(u?0:1,{0(){return null},1(){return ii({...f,hidden:!0,style:{display:"none"}},n,r,i,l)}})}return ii(a,n,r,i,l)}function ii(e,t={},n,r,o){let{as:s=n,children:i,refName:l="ref",...a}=zl(e,["unmount","static"]),c=e.ref!==void 0?{[l]:e.ref}:{},u=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let p=!1,d=[];for(let[h,b]of Object.entries(t))typeof b=="boolean"&&(p=!0),b===!0&&d.push(h.replace(/([A-Z])/g,w=>`-${w.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(Jo(s)&&(Object.keys(zn(a)).length>0||Object.keys(zn(f)).length>0))if(!g.isValidElement(u)||Array.isArray(u)&&u.length>1||Mx(u)){if(Object.keys(zn(a)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(zn(a)).concat(Object.keys(zn(f))).map(p=>` - ${p}`).join(`
116
+ */const M0=qx("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Kx=typeof document<"u"?g.useLayoutEffect:()=>{},Bn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},sr=e=>e&&"window"in e&&e.window===e?e:Bn(e).defaultView||window;function Zx(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Yx(e){return Zx(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Xx=!1;function $l(){return Xx}function Fn(e,t){if(!$l())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:Yx(n)?n=n.host:n=n.parentNode}return!1}const jr=(e=document)=>{var t;if(!$l())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function Ue(e){if($l()&&e.target instanceof Element&&e.target.shadowRoot){var t,n;if("composedPath"in e)return(t=e.composedPath()[0])!==null&&t!==void 0?t:null;if("composedPath"in e.nativeEvent)return(n=e.nativeEvent.composedPath()[0])!==null&&n!==void 0?n:null}return e.target}function Jx(e){if(Qx())e.focus({preventScroll:!0});else{let t=e5(e);e.focus(),t5(t)}}let Qs=null;function Qx(){if(Qs==null){Qs=!1;try{document.createElement("div").focus({get preventScroll(){return Qs=!0,!0}})}catch{}}return Qs}function e5(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function t5(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function ei(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function Il(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function yn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ko=yn(function(){return Il(/^Mac/i)}),n5=yn(function(){return Il(/^iPhone/i)}),D0=yn(function(){return Il(/^iPad/i)||Ko()&&navigator.maxTouchPoints>1}),r5=yn(function(){return n5()||D0()});yn(function(){return Ko()||r5()});const o5=yn(function(){return ei(/AppleWebKit/i)&&!s5()}),s5=yn(function(){return ei(/Chrome/i)}),i5=yn(function(){return ei(/Android/i)}),a5=yn(function(){return ei(/Firefox/i)});function Zo(e,t,n=!0){var r,o;let{metaKey:s,ctrlKey:i,altKey:l,shiftKey:a}=t;a5()&&(!((o=window.event)===null||o===void 0||(r=o.type)===null||r===void 0)&&r.startsWith("key"))&&e.target==="_blank"&&(Ko()?s=!0:i=!0);let c=o5()&&Ko()&&!D0()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:i,altKey:l,shiftKey:a}):new MouseEvent("click",{metaKey:s,ctrlKey:i,altKey:l,shiftKey:a,detail:1,bubbles:!0,cancelable:!0});Zo.isOpening=n,Jx(e),e.dispatchEvent(c),Zo.isOpening=!1}Zo.isOpening=!1;function k0(){let e=g.useRef(new Map),t=g.useCallback((o,s,i,l)=>{let a=l!=null&&l.once?(...c)=>{e.current.delete(i),i(...c)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:l}),o.addEventListener(s,a,l)},[]),n=g.useCallback((o,s,i,l)=>{var a;let c=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,c,l),e.current.delete(i)},[]),r=g.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return g.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function l5(e){return e.pointerType===""&&e.isTrusted?!0:i5()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function L0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function c5(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function B0(e){let t=g.useRef({isFocused:!1,observer:null});return Kx(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),g.useCallback(n=>{let r=Ue(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r,s=i=>{if(t.current.isFocused=!1,o.disabled){let l=L0(i);e==null||e(l)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let l=o===jr()?null:jr();o.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[e])}let u5=!1,Yo=null;const Ml=new Set;let Xo=new Map,ir=!1,Dl=!1;const d5={Tab:!0,Escape:!0};function kl(e,t){for(let n of Ml)n(e,t)}function f5(e){return!(e.metaKey||!Ko()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ti(e){ir=!0,!Zo.isOpening&&f5(e)&&(Yo="keyboard",kl("keyboard",e))}function Et(e){Yo="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(ir=!0,kl("pointer",e))}function F0(e){!Zo.isOpening&&l5(e)&&(ir=!0,Yo="virtual")}function R0(e){Ue(e)===window||Ue(e)===document||u5||!e.isTrusted||(!ir&&!Dl&&(Yo="virtual",kl("virtual",e)),ir=!1,Dl=!1)}function j0(){ir=!1,Dl=!0}function Ll(e){if(typeof window>"u"||typeof document>"u"||Xo.get(sr(e)))return;const t=sr(e),n=Bn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){ir=!0,r.apply(this,arguments)},n.addEventListener("keydown",ti,!0),n.addEventListener("keyup",ti,!0),n.addEventListener("click",F0,!0),t.addEventListener("focus",R0,!0),t.addEventListener("blur",j0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Et,!0),n.addEventListener("pointermove",Et,!0),n.addEventListener("pointerup",Et,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Et,!0),n.addEventListener("mousemove",Et,!0),n.addEventListener("mouseup",Et,!0)),t.addEventListener("beforeunload",()=>{z0(e)},{once:!0}),Xo.set(t,{focus:r})}const z0=(e,t)=>{const n=sr(e),r=Bn(e);t&&r.removeEventListener("DOMContentLoaded",t),Xo.has(n)&&(n.HTMLElement.prototype.focus=Xo.get(n).focus,r.removeEventListener("keydown",ti,!0),r.removeEventListener("keyup",ti,!0),r.removeEventListener("click",F0,!0),n.removeEventListener("focus",R0,!0),n.removeEventListener("blur",j0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Et,!0),r.removeEventListener("pointermove",Et,!0),r.removeEventListener("pointerup",Et,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Et,!0),r.removeEventListener("mousemove",Et,!0),r.removeEventListener("mouseup",Et,!0)),Xo.delete(n))};function p5(e){const t=Bn(e);let n;return t.readyState!=="loading"?Ll(e):(n=()=>{Ll(e)},t.addEventListener("DOMContentLoaded",n)),()=>z0(e,n)}typeof document<"u"&&p5();function Bl(){return Yo!=="pointer"}const h5=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function m5(e,t,n){let r=Bn(n?Ue(n):void 0),o=n?Ue(n):void 0;const s=typeof window<"u"?sr(o).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?sr(o).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?sr(o).HTMLElement:HTMLElement,a=typeof window<"u"?sr(o).KeyboardEvent:KeyboardEvent;let c=jr(r);return e=e||c instanceof s&&!h5.has(c.type)||c instanceof i||c instanceof l&&c.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!d5[n.key])}function b5(e,t,n){Ll(),g.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let r=(o,s)=>{m5(!!(n!=null&&n.isTextInput),o,s)&&e(Bl())};return Ml.add(r),()=>{Ml.delete(r)}},t)}function g5(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=g.useCallback(a=>{if(Ue(a)===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=B0(s),l=g.useCallback(a=>{let c=Ue(a);const u=Bn(c),d=u?jr(u):jr();c===a.currentTarget&&c===d&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?l:void 0,onBlur:!t&&(r||o)?s:void 0}}}function y5(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=g.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:l}=k0(),a=g.useCallback(d=>{Fn(d.currentTarget,Ue(d))&&s.current.isFocusWithin&&!Fn(d.currentTarget,d.relatedTarget)&&(s.current.isFocusWithin=!1,l(),n&&n(d),o&&o(!1))},[n,o,s,l]),c=B0(a),u=g.useCallback(d=>{if(!Fn(d.currentTarget,Ue(d)))return;let p=Ue(d);const f=Bn(p),h=jr(f);if(!s.current.isFocusWithin&&h===p){r&&r(d),o&&o(!0),s.current.isFocusWithin=!0,c(d);let m=d.currentTarget;i(f,"focus",x=>{let T=Ue(x);if(s.current.isFocusWithin&&!Fn(m,T)){let w=new f.defaultView.FocusEvent("blur",{relatedTarget:T});c5(w,m);let P=L0(w);a(P)}},{capture:!0})}},[r,o,c,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let ni=!1,ri=0;function Fl(){ni=!0,setTimeout(()=>{ni=!1},50)}function U0(e){e.pointerType==="touch"&&Fl()}function v5(){if(!(typeof document>"u"))return ri===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",U0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Fl)),ri++,()=>{ri--,!(ri>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",U0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Fl))}}function w5(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=g.useState(!1),l=g.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;g.useEffect(v5,[]);let{addGlobalListener:a,removeAllGlobalListeners:c}=k0(),{hoverProps:u,triggerHoverEnd:d}=g.useMemo(()=>{let p=(m,x)=>{if(l.pointerType=x,o||x==="touch"||l.isHovered||!Fn(m.currentTarget,Ue(m)))return;l.isHovered=!0;let T=m.currentTarget;l.target=T,a(Bn(Ue(m)),"pointerover",w=>{l.isHovered&&l.target&&!Fn(l.target,Ue(w))&&f(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:T,pointerType:x}),n&&n(!0),i(!0)},f=(m,x)=>{let T=l.target;l.pointerType="",l.target=null,!(x==="touch"||!l.isHovered||!T)&&(l.isHovered=!1,c(),r&&r({type:"hoverend",target:T,pointerType:x}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{ni&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&Fn(m.currentTarget,Ue(m))&&f(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{l.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!l.ignoreEmulatedMouseEvents&&!ni&&p(m,"mouse"),l.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&Fn(m.currentTarget,Ue(m))&&f(m,"mouse")}),{hoverProps:h,triggerHoverEnd:f}},[t,n,r,o,l,a,c]);return g.useEffect(()=>{o&&d({currentTarget:l.target},l.pointerType)},[o]),{hoverProps:u,isHovered:s}}function x5(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=g.useRef({isFocused:!1,isFocusVisible:t||Bl()}),[s,i]=g.useState(!1),[l,a]=g.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=g.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=g.useCallback(f=>{o.current.isFocused=f,o.current.isFocusVisible=Bl(),i(f),c()},[c]);b5(f=>{o.current.isFocusVisible=f,c()},[n,s],{enabled:s,isTextInput:n});let{focusProps:d}=g5({isDisabled:r,onFocusChange:u}),{focusWithinProps:p}=y5({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:l,focusProps:r?p:d}}var E5=Object.defineProperty,S5=(e,t,n)=>t in e?E5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rl=(e,t,n)=>(S5(e,typeof t!="symbol"?t+"":t,n),n);let P5=class{constructor(){Rl(this,"current",this.detect()),Rl(this,"handoffState","pending"),Rl(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Xt=new P5;function oi(e){var t;return Xt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function si(e){var t,n;return Xt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function W0(e){var t,n;return(n=(t=si(e))==null?void 0:t.activeElement)!=null?n:null}function T5(e){return W0(e)===e}function _0(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function pt(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return _0(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=pt();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function ar(){let[e]=g.useState(pt);return g.useEffect(()=>()=>e.dispose(),[e]),e}let $e=(e,t)=>{Xt.isServer?g.useEffect(e,t):g.useLayoutEffect(e,t)};function lr(e){let t=g.useRef(e);return $e(()=>{t.current=e},[e]),t}let he=function(e){let t=lr(e);return g.useCallback((...n)=>t.current(...n),[t])};function A5(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function N5(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function C5({disabled:e=!1}={}){let t=g.useRef(null),[n,r]=g.useState(!1),o=ar(),s=he(()=>{t.current=null,r(!1),o.dispose()}),i=he(l=>{if(o.dispose(),t.current===null){t.current=l.currentTarget,r(!0);{let a=oi(l.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",c=>{if(t.current){let u=A5(c);r(N5(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}function Rn(e){return g.useMemo(()=>e,Object.values(e))}let O5=g.createContext(void 0);function jl(){return g.useContext(O5)}function zl(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function St(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,St),r}var ii=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(ii||{}),jn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(jn||{});function ht(){let e=I5();return g.useCallback(t=>$5({mergeRefs:e,...t}),[e])}function $5({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:l}){l=l??M5;let a=V0(t,e);if(s)return ai(a,n,r,i,l);let c=o??0;if(c&2){let{static:u=!1,...d}=a;if(u)return ai(d,n,r,i,l)}if(c&1){let{unmount:u=!0,...d}=a;return St(u?0:1,{0(){return null},1(){return ai({...d,hidden:!0,style:{display:"none"}},n,r,i,l)}})}return ai(a,n,r,i,l)}function ai(e,t={},n,r,o){let{as:s=n,children:i,refName:l="ref",...a}=Ul(e,["unmount","static"]),c=e.ref!==void 0?{[l]:e.ref}:{},u=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let d={};if(t){let p=!1,f=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&f.push(h.replace(/([A-Z])/g,x=>`-${x.toLowerCase()}`));if(p){d["data-headlessui-state"]=f.join(" ");for(let h of f)d[`data-${h}`]=""}}if(Jo(s)&&(Object.keys(zn(a)).length>0||Object.keys(zn(d)).length>0))if(!g.isValidElement(u)||Array.isArray(u)&&u.length>1||k5(u)){if(Object.keys(zn(a)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(zn(a)).concat(Object.keys(zn(d))).map(p=>` - ${p}`).join(`
117
117
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>` - ${p}`).join(`
118
118
  `)].join(`
119
- `))}else{let p=u.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...T)=>jl(d(...T),a.className):jl(d,a.className),b=h?{className:h}:{},w=_0(u.props,zn(zl(a,["ref"])));for(let T in f)T in w&&delete f[T];return g.cloneElement(u,Object.assign({},w,f,c,{ref:o(Ix(u),c.ref)},b))}return g.createElement(s,Object.assign({},zl(a,["ref"]),!Jo(s)&&c,!Jo(s)&&f),u)}function Cx(){let e=g.useRef([]),t=g.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function $x(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function _0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let i=n[r];for(let l of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;l(o,...s)}}});return t}function V0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let i of s)i==null||i(...o)}});return t}function nt(e){var t;return Object.assign(g.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function zn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function zl(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Ix(e){return g.version.split(".")[0]>="19"?e.props.ref:e.ref}function Jo(e){return e===g.Fragment||e===Symbol.for("react.fragment")}function Mx(e){return Jo(e.type)}function Dx(e,t,n){let[r,o]=g.useState(n),s=e!==void 0,i=g.useRef(s),l=g.useRef(!1),a=g.useRef(!1);return s&&!i.current&&!l.current?(l.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,pe(c=>(s||Ke.flushSync(()=>o(c)),t==null?void 0:t(c)))]}function kx(e){let[t]=g.useState(e);return t}function H0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))q0(n,G0(t,r),o);return n}function G0(e,t){return e?e+"["+t+"]":t}function q0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())q0(e,G0(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):Lx(n)&&!g.isValidElement(n)&&H0(n,t,e)}function Bx(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}function Lx(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let Fx="span";var Ul=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Ul||{});function Rx(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return ht()({ourProps:s,theirProps:o,slot:{},defaultTag:Fx,name:"Hidden"})}let K0=nt(Rx),jx=g.createContext(null);function zx({children:e}){let t=g.useContext(jx);if(!t)return g.createElement(g.Fragment,null,e);let{target:n}=t;return n?Ke.createPortal(g.createElement(g.Fragment,null,e),n):null}function Ux({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=g.useState(null),l=ar();return g.useEffect(()=>{if(r&&s)return l.addEventListener(s,"reset",r)},[s,t,r]),g.createElement(zx,null,g.createElement(Wx,{setForm:i,formId:t}),H0(e).map(([a,c])=>g.createElement(K0,{features:Ul.Hidden,...zn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:c,...o})})))}function Wx({setForm:e,formId:t}){return g.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:g.createElement(K0,{features:Ul.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let _x=g.createContext(void 0);function Z0(){return g.useContext(_x)}function Y0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function ai(e){return Y0(e)&&"tagName"in e}function wn(e){return ai(e)&&"accessKey"in e}function zr(e){return ai(e)&&"tabIndex"in e}function Vx(e){return ai(e)&&"style"in e}function Hx(e){return wn(e)&&e.nodeName==="IFRAME"}function X0(e){return wn(e)&&e.nodeName==="INPUT"}function J0(e){return wn(e)&&e.nodeName==="LABEL"}function Gx(e){return wn(e)&&e.nodeName==="FIELDSET"}function Q0(e){return wn(e)&&e.nodeName==="LEGEND"}function qx(e){return ai(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function ep(e){let t=e.parentElement,n=null;for(;t&&!Gx(t);)Q0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Kx(n)?!1:r}function Kx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Q0(t))return!1;t=t.previousElementSibling}return!0}let tp=Symbol();function Zx(e,t=!0){return Object.assign(e,{[tp]:t})}function Pt(...e){let t=g.useRef(e);g.useEffect(()=>{t.current=e},[e]);let n=pe(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[tp]))?void 0:n}let Wl=g.createContext(null);Wl.displayName="DescriptionContext";function np(){let e=g.useContext(Wl);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,np),t}return e}function Yx(){var e,t;return(t=(e=g.useContext(Wl))==null?void 0:e.value)!=null?t:void 0}let Xx="p";function Jx(e,t){let n=g.useId(),r=Rl(),{id:o=`headlessui-description-${n}`,...s}=e,i=np(),l=Pt(t);Ce(()=>i.register(o),[o,i.register]);let a=Rn({...i.slot,disabled:r||!1}),c={ref:l,...i.props,id:o};return ht()({ourProps:c,theirProps:s,slot:a,defaultTag:Xx,name:i.name||"Description"})}let Qx=nt(Jx);Object.assign(Qx,{});var je=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(je||{});let li=g.createContext(null);li.displayName="LabelContext";function rp(){let e=g.useContext(li);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,rp),t}return e}function op(e){var t,n,r;let o=(n=(t=g.useContext(li))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function e2({inherit:e=!1}={}){let t=op(),[n,r]=g.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,g.useMemo(()=>function(s){let i=pe(a=>(r(c=>[...c,a]),()=>r(c=>{let u=c.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),l=g.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return g.createElement(li.Provider,{value:l},s.children)},[r])]}let t2="label";function n2(e,t){var n;let r=g.useId(),o=rp(),s=Z0(),i=Rl(),{id:l=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:c=!1,...u}=e,f=Pt(t);Ce(()=>o.register(l),[l,o.register]);let p=pe(b=>{let w=b.currentTarget;if(!(b.target!==b.currentTarget&&qx(b.target))&&(J0(w)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),J0(w))){let T=document.getElementById(w.htmlFor);if(T){let x=T.getAttribute("disabled");if(x==="true"||x==="")return;let E=T.getAttribute("aria-disabled");if(E==="true"||E==="")return;(X0(T)&&(T.type==="file"||T.type==="radio"||T.type==="checkbox")||T.role==="radio"||T.role==="checkbox"||T.role==="switch")&&T.click(),T.focus({preventScroll:!0})}}}),d=Rn({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:l,htmlFor:a,onClick:p};return c&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in u&&delete u.onClick),ht()({ourProps:h,theirProps:u,slot:d,defaultTag:a?t2:"div",name:o.name||"Label"})}let r2=nt(n2),o2=Object.assign(r2,{});function s2(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function i2(e=s2){return g.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function sp(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function a2(e,t,n=!1){let[r,o]=g.useState(()=>sp(t));return Ce(()=>{if(!t||!e)return;let s=pt();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(l=>{let a=sp(t);return a.width===l.width&&a.height===l.height?l:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var ip=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(ip||{});function l2(e){let t=g.useRef(null),n=pe(o=>{t.current=o.pointerType,!ep(o.currentTarget)&&o.pointerType==="mouse"&&o.button===ip.Left&&(o.preventDefault(),e(o))}),r=pe(o=>{t.current!=="mouse"&&(ep(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let ap=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var c2=Object.defineProperty,u2=(e,t,n)=>t in e?c2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,f2=(e,t,n)=>(u2(e,t+"",n),n),lp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Tt=(e,t,n)=>(lp(e,t,"read from private field"),n?n.call(e):t.get(e)),_l=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},cp=(e,t,n,r)=>(lp(e,t,"write to private field"),t.set(e,n),n),Jt,Qo,es;let up=class{constructor(t){_l(this,Jt,{}),_l(this,Qo,new ap(()=>new Set)),_l(this,es,new Set),f2(this,"disposables",pt()),cp(this,Jt,t),Xt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Tt(this,Jt)}subscribe(t,n){if(Xt.isServer)return()=>{};let r={selector:t,callback:n,current:t(Tt(this,Jt))};return Tt(this,es).add(r),this.disposables.add(()=>{Tt(this,es).delete(r)})}on(t,n){return Xt.isServer?()=>{}:(Tt(this,Qo).get(t).add(n),this.disposables.add(()=>{Tt(this,Qo).get(t).delete(n)}))}send(t){let n=this.reduce(Tt(this,Jt),t);if(n!==Tt(this,Jt)){cp(this,Jt,n);for(let r of Tt(this,es)){let o=r.selector(Tt(this,Jt));fp(r.current,o)||(r.current=o,r.callback(o))}for(let r of Tt(this,Qo).get(t.type))r(Tt(this,Jt),t)}}};Jt=new WeakMap,Qo=new WeakMap,es=new WeakMap;function fp(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Vl(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Vl(e.entries(),t.entries()):dp(e)&&dp(t)?Vl(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Vl(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function dp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Hl(e){let[t,n]=e(),r=pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var d2=Object.defineProperty,p2=(e,t,n)=>t in e?d2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pp=(e,t,n)=>(p2(e,typeof t!="symbol"?t+"":t,n),n),hp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(hp||{});let h2={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let s=e.stack.slice();return s.splice(o,1),s.push(n),r=s,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},m2=class Qm extends up{constructor(){super(...arguments),pp(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),pp(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Qm({stack:[]})}reduce(t,n){return St(n.type,h2,t,n)}};const Gl=new ap(()=>m2.new());var ql={exports:{}},Kl={};/**
119
+ `))}else{let p=u.props,f=p==null?void 0:p.className,h=typeof f=="function"?(...T)=>zl(f(...T),a.className):zl(f,a.className),m=h?{className:h}:{},x=V0(u.props,zn(Ul(a,["ref"])));for(let T in d)T in x&&delete d[T];return g.cloneElement(u,Object.assign({},x,d,c,{ref:o(D5(u),c.ref)},m))}return g.createElement(s,Object.assign({},Ul(a,["ref"]),!Jo(s)&&c,!Jo(s)&&d),u)}function I5(){let e=g.useRef([]),t=g.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function M5(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function V0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let i=n[r];for(let l of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;l(o,...s)}}});return t}function H0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let i of s)i==null||i(...o)}});return t}function nt(e){var t;return Object.assign(g.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function zn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Ul(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function D5(e){return g.version.split(".")[0]>="19"?e.props.ref:e.ref}function Jo(e){return e===g.Fragment||e===Symbol.for("react.fragment")}function k5(e){return Jo(e.type)}function L5(e,t,n){let[r,o]=g.useState(n),s=e!==void 0,i=g.useRef(s),l=g.useRef(!1),a=g.useRef(!1);return s&&!i.current&&!l.current?(l.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,he(c=>(s||Ke.flushSync(()=>o(c)),t==null?void 0:t(c)))]}function B5(e){let[t]=g.useState(e);return t}function G0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))K0(n,q0(t,r),o);return n}function q0(e,t){return e?e+"["+t+"]":t}function K0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())K0(e,q0(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):R5(n)&&!g.isValidElement(n)&&G0(n,t,e)}function F5(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}function R5(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let j5="span";var Wl=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Wl||{});function z5(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return ht()({ourProps:s,theirProps:o,slot:{},defaultTag:j5,name:"Hidden"})}let Z0=nt(z5),U5=g.createContext(null);function W5({children:e}){let t=g.useContext(U5);if(!t)return g.createElement(g.Fragment,null,e);let{target:n}=t;return n?Ke.createPortal(g.createElement(g.Fragment,null,e),n):null}function _5({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=g.useState(null),l=ar();return g.useEffect(()=>{if(r&&s)return l.addEventListener(s,"reset",r)},[s,t,r]),g.createElement(W5,null,g.createElement(V5,{setForm:i,formId:t}),G0(e).map(([a,c])=>g.createElement(Z0,{features:Wl.Hidden,...zn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:c,...o})})))}function V5({setForm:e,formId:t}){return g.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:g.createElement(Z0,{features:Wl.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let H5=g.createContext(void 0);function Y0(){return g.useContext(H5)}function X0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function li(e){return X0(e)&&"tagName"in e}function vn(e){return li(e)&&"accessKey"in e}function zr(e){return li(e)&&"tabIndex"in e}function G5(e){return li(e)&&"style"in e}function q5(e){return vn(e)&&e.nodeName==="IFRAME"}function J0(e){return vn(e)&&e.nodeName==="INPUT"}function Q0(e){return vn(e)&&e.nodeName==="LABEL"}function K5(e){return vn(e)&&e.nodeName==="FIELDSET"}function ep(e){return vn(e)&&e.nodeName==="LEGEND"}function Z5(e){return li(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function tp(e){let t=e.parentElement,n=null;for(;t&&!K5(t);)ep(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Y5(n)?!1:r}function Y5(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(ep(t))return!1;t=t.previousElementSibling}return!0}let np=Symbol();function X5(e,t=!0){return Object.assign(e,{[np]:t})}function Pt(...e){let t=g.useRef(e);g.useEffect(()=>{t.current=e},[e]);let n=he(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[np]))?void 0:n}let _l=g.createContext(null);_l.displayName="DescriptionContext";function rp(){let e=g.useContext(_l);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,rp),t}return e}function J5(){var e,t;return(t=(e=g.useContext(_l))==null?void 0:e.value)!=null?t:void 0}let Q5="p";function e2(e,t){let n=g.useId(),r=jl(),{id:o=`headlessui-description-${n}`,...s}=e,i=rp(),l=Pt(t);$e(()=>i.register(o),[o,i.register]);let a=Rn({...i.slot,disabled:r||!1}),c={ref:l,...i.props,id:o};return ht()({ourProps:c,theirProps:s,slot:a,defaultTag:Q5,name:i.name||"Description"})}let t2=nt(e2);Object.assign(t2,{});var je=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(je||{});let ci=g.createContext(null);ci.displayName="LabelContext";function op(){let e=g.useContext(ci);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,op),t}return e}function sp(e){var t,n,r;let o=(n=(t=g.useContext(ci))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function n2({inherit:e=!1}={}){let t=sp(),[n,r]=g.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,g.useMemo(()=>function(s){let i=he(a=>(r(c=>[...c,a]),()=>r(c=>{let u=c.slice(),d=u.indexOf(a);return d!==-1&&u.splice(d,1),u}))),l=g.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return g.createElement(ci.Provider,{value:l},s.children)},[r])]}let r2="label";function o2(e,t){var n;let r=g.useId(),o=op(),s=Y0(),i=jl(),{id:l=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:c=!1,...u}=e,d=Pt(t);$e(()=>o.register(l),[l,o.register]);let p=he(m=>{let x=m.currentTarget;if(!(m.target!==m.currentTarget&&Z5(m.target))&&(Q0(x)&&m.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(m),Q0(x))){let T=document.getElementById(x.htmlFor);if(T){let w=T.getAttribute("disabled");if(w==="true"||w==="")return;let P=T.getAttribute("aria-disabled");if(P==="true"||P==="")return;(J0(T)&&(T.type==="file"||T.type==="radio"||T.type==="checkbox")||T.role==="radio"||T.role==="checkbox"||T.role==="switch")&&T.click(),T.focus({preventScroll:!0})}}}),f=Rn({...o.slot,disabled:i||!1}),h={ref:d,...o.props,id:l,htmlFor:a,onClick:p};return c&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in u&&delete u.onClick),ht()({ourProps:h,theirProps:u,slot:f,defaultTag:a?r2:"div",name:o.name||"Label"})}let s2=nt(o2),i2=Object.assign(s2,{});function a2(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function l2(e=a2){return g.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function ip(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function c2(e,t,n=!1){let[r,o]=g.useState(()=>ip(t));return $e(()=>{if(!t||!e)return;let s=pt();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(l=>{let a=ip(t);return a.width===l.width&&a.height===l.height?l:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var ap=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(ap||{});function u2(e){let t=g.useRef(null),n=he(o=>{t.current=o.pointerType,!tp(o.currentTarget)&&o.pointerType==="mouse"&&o.button===ap.Left&&(o.preventDefault(),e(o))}),r=he(o=>{t.current!=="mouse"&&(tp(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let lp=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var d2=Object.defineProperty,f2=(e,t,n)=>t in e?d2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p2=(e,t,n)=>(f2(e,t+"",n),n),cp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Tt=(e,t,n)=>(cp(e,t,"read from private field"),n?n.call(e):t.get(e)),Vl=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},up=(e,t,n,r)=>(cp(e,t,"write to private field"),t.set(e,n),n),Jt,Qo,es;let dp=class{constructor(t){Vl(this,Jt,{}),Vl(this,Qo,new lp(()=>new Set)),Vl(this,es,new Set),p2(this,"disposables",pt()),up(this,Jt,t),Xt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Tt(this,Jt)}subscribe(t,n){if(Xt.isServer)return()=>{};let r={selector:t,callback:n,current:t(Tt(this,Jt))};return Tt(this,es).add(r),this.disposables.add(()=>{Tt(this,es).delete(r)})}on(t,n){return Xt.isServer?()=>{}:(Tt(this,Qo).get(t).add(n),this.disposables.add(()=>{Tt(this,Qo).get(t).delete(n)}))}send(t){let n=this.reduce(Tt(this,Jt),t);if(n!==Tt(this,Jt)){up(this,Jt,n);for(let r of Tt(this,es)){let o=r.selector(Tt(this,Jt));fp(r.current,o)||(r.current=o,r.callback(o))}for(let r of Tt(this,Qo).get(t.type))r(Tt(this,Jt),t)}}};Jt=new WeakMap,Qo=new WeakMap,es=new WeakMap;function fp(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Hl(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Hl(e.entries(),t.entries()):pp(e)&&pp(t)?Hl(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Hl(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function pp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Gl(e){let[t,n]=e(),r=pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var h2=Object.defineProperty,m2=(e,t,n)=>t in e?h2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hp=(e,t,n)=>(m2(e,typeof t!="symbol"?t+"":t,n),n),mp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(mp||{});let b2={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let s=e.stack.slice();return s.splice(o,1),s.push(n),r=s,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},g2=class tb extends dp{constructor(){super(...arguments),hp(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),hp(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new tb({stack:[]})}reduce(t,n){return St(n.type,b2,t,n)}};const ql=new lp(()=>g2.new());var Kl={exports:{}},Zl={};/**
120
120
  * @license React
121
121
  * use-sync-external-store-with-selector.production.js
122
122
  *
@@ -124,7 +124,7 @@ ${Bg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
124
124
  *
125
125
  * This source code is licensed under the MIT license found in the
126
126
  * LICENSE file in the root directory of this source tree.
127
- */var mp;function b2(){if(mp)return Kl;mp=1;var e=g;function t(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,l=e.useDebugValue;return Kl.useSyncExternalStoreWithSelector=function(a,c,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function w(k){if(!T){if(T=!0,x=k,k=f(k),p!==void 0&&h.hasValue){var F=h.value;if(p(F,k))return E=F}return E=k}if(F=E,n(x,k))return F;var L=f(k);return p!==void 0&&p(F,L)?(x=k,F):(x=k,E=L)}var T=!1,x,E,A=u===void 0?null:u;return[function(){return w(c())},A===null?void 0:function(){return w(A())}]},[c,u,f,p]);var b=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),l(b),b},Kl}var Zl={};/**
127
+ */var bp;function y2(){if(bp)return Zl;bp=1;var e=g;function t(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,l=e.useDebugValue;return Zl.useSyncExternalStoreWithSelector=function(a,c,u,d,p){var f=o(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=i(function(){function x(k){if(!T){if(T=!0,w=k,k=d(k),p!==void 0&&h.hasValue){var B=h.value;if(p(B,k))return P=B}return P=k}if(B=P,n(w,k))return B;var F=d(k);return p!==void 0&&p(B,F)?(w=k,B):(w=k,P=F)}var T=!1,w,P,A=u===void 0?null:u;return[function(){return x(c())},A===null?void 0:function(){return x(A())}]},[c,u,d,p]);var m=r(a,f[0],f[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),l(m),m},Zl}var Yl={};/**
128
128
  * @license React
129
129
  * use-sync-external-store-with-selector.development.js
130
130
  *
@@ -132,49 +132,49 @@ ${Bg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
132
132
  *
133
133
  * This source code is licensed under the MIT license found in the
134
134
  * LICENSE file in the root directory of this source tree.
135
- */var bp;function g2(){return bp||(bp=1,process.env.NODE_ENV!=="production"&&function(){function e(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=g,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,l=t.useDebugValue;Zl.useSyncExternalStoreWithSelector=function(a,c,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function w(k){if(!T){if(T=!0,x=k,k=f(k),p!==void 0&&h.hasValue){var F=h.value;if(p(F,k))return E=F}return E=k}if(F=E,n(x,k))return F;var L=f(k);return p!==void 0&&p(F,L)?(x=k,F):(x=k,E=L)}var T=!1,x,E,A=u===void 0?null:u;return[function(){return w(c())},A===null?void 0:function(){return w(A())}]},[c,u,f,p]);var b=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),l(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Zl}process.env.NODE_ENV==="production"?ql.exports=b2():ql.exports=g2();var y2=ql.exports;function rt(e,t,n=fp){return y2.useSyncExternalStoreWithSelector(pe(r=>e.subscribe(w2,r)),pe(()=>e.state),pe(()=>e.state),pe(t),n)}function w2(e){return e}function gp(e,t){let n=g.useId(),r=Gl.get(t),[o,s]=rt(r,g.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Ce(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Yl=new Map,ts=new Map;function yp(e){var t;let n=(t=ts.get(e))!=null?t:0;return ts.set(e,n+1),n!==0?()=>wp(e):(Yl.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>wp(e))}function wp(e){var t;let n=(t=ts.get(e))!=null?t:1;if(n===1?ts.delete(e):ts.set(e,n-1),n!==1)return;let r=Yl.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Yl.delete(e))}function v2(e,{allowed:t,disallowed:n}={}){let r=gp(e,"inert-others");Ce(()=>{var o,s;if(!r)return;let i=pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(yp(a));let l=(s=t==null?void 0:t())!=null?s:[];for(let a of l){if(!a)continue;let c=ri(a);if(!c)continue;let u=a.parentElement;for(;u&&u!==c.body;){for(let f of u.children)l.some(p=>f.contains(p))||i.add(yp(f));u=u.parentElement}}return i.dispose},[r,t,n])}function x2(e,t,n){let r=lr(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});g.useEffect(()=>{if(!e)return;let o=t===null?null:wn(t)?t:t.current;if(!o)return;let s=pt();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let Xl=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),E2=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Jl=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(Jl||{}),S2=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(S2||{}),P2=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(P2||{});function vp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Xl)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function T2(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(E2)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ql=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ql||{});function xp(e,t=0){var n;return e===((n=ri(e))==null?void 0:n.body)?!1:St(t,{0(){return e.matches(Xl)},1(){let r=e;for(;r!==null;){if(r.matches(Xl))return!0;r=r.parentElement}return!1}})}var A2=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(A2||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let N2=["textarea","input"].join(",");function O2(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,N2))!=null?n:!1}function Ep(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let i=o.compareDocumentPosition(s);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function C2(e,t,n=e===null?document.body:oi(e)){return $2(vp(n),t,{relativeTo:e})}function $2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?oi(e[0]):document:oi(e),i=Array.isArray(e)?n?Ep(e):e:t&64?T2(e):vp(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??(s==null?void 0:s.activeElement);let l=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},u=0,f=i.length,p;do{if(u>=f||u+f<=0)return 0;let d=a+u;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(c),u+=l}while(p!==U0(p));return t&6&&O2(p)&&p.select(),2}function Sp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function I2(){return/Android/gi.test(window.navigator.userAgent)}function Pp(){return Sp()||I2()}function Ur(e,t,n,r){let o=lr(n);g.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function M2(e,t,n,r){let o=lr(n);g.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Tp=30;function D2(e,t,n){let r=lr(n),o=g.useCallback(function(l,a){if(l.defaultPrevented)return;let c=a(l);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let u=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of u)if(f!==null&&(f.contains(c)||l.composed&&l.composedPath().includes(f)))return;return!xp(c,Ql.Loose)&&c.tabIndex!==-1&&l.preventDefault(),r.current(l,c)},[r,t]),s=g.useRef(null);Ur(e,"pointerdown",l=>{var a,c;Pp()||(s.current=((c=(a=l.composedPath)==null?void 0:a.call(l))==null?void 0:c[0])||l.target)},!0),Ur(e,"pointerup",l=>{if(Pp()||!s.current)return;let a=s.current;return s.current=null,o(l,()=>a)},!0);let i=g.useRef({x:0,y:0});Ur(e,"touchstart",l=>{i.current.x=l.touches[0].clientX,i.current.y=l.touches[0].clientY},!0),Ur(e,"touchend",l=>{let a={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Tp||Math.abs(a.y-i.current.y)>=Tp))return o(l,()=>zr(l.target)?l.target:null)},!0),M2(e,"blur",l=>o(l,()=>Hx(window.document.activeElement)?window.document.activeElement:null),!0)}function ec(...e){return g.useMemo(()=>ri(...e),[...e])}var k2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(k2||{});const ci={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},B2=200,Ap=5;function L2(e,{trigger:t,action:n,close:r,select:o}){let s=g.useRef(null),i=g.useRef(null),l=g.useRef(null);Ur(e&&t!==null,"pointerdown",a=>{Y0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,l.current=a.y,s.current=a.timeStamp)}),Ur(e&&t!==null,"pointerup",a=>{var c,u;let f=s.current;if(f===null||(s.current=null,!zr(a.target))||Math.abs(a.x-((c=i.current)!=null?c:a.x))<Ap&&Math.abs(a.y-((u=l.current)!=null?u:a.y))<Ap)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>B2&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function F2(e,t){return g.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function R2(e){return g.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function j2(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(l=>l()))}}}function z2(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function U2(){return Sp()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let l=pt();l.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>l.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",l=>{if(zr(l.target))try{let a=l.target.closest("a");if(!a)return;let{hash:c}=new URL(a.href),u=e.querySelector(c);zr(u)&&!r(u)&&(i=u)}catch{}},!0),t.group(l=>{t.addEventListener(e,"touchstart",a=>{if(l.dispose(),zr(a.target)&&Vx(a.target))if(r(a.target)){let c=a.target;for(;c.parentElement&&r(c.parentElement);)c=c.parentElement;l.style(c,"overscrollBehavior","contain")}else l.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",l=>{if(zr(l.target)){if(X0(l.target))return;if(r(l.target)){let a=l.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),t.add(()=>{var l;let a=(l=window.scrollY)!=null?l:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function W2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Np(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let cr=j2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:pt(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=Np(r.meta),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=Np(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[U2(),z2(),W2()];n.forEach(({before:r})=>r==null?void 0:r(t)),n.forEach(({after:r})=>r==null?void 0:r(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});cr.subscribe(()=>{let e=cr.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&cr.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&cr.dispatch("TEARDOWN",n)}});function _2(e,t,n=()=>({containers:[]})){let r=R2(cr),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Ce(()=>{if(!(!t||!e))return cr.dispatch("PUSH",t,n),()=>cr.dispatch("POP",t,n)},[e,t]),s}function V2(e,t,n=()=>[document.body]){let r=gp(e,"scroll-lock");_2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Op(e){return[e.screenX,e.screenY]}function H2(){let e=g.useRef([-1,-1]);return{wasMoved(t){let n=Op(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Op(t)}}}function G2(e=0){let[t,n]=g.useState(e),r=g.useCallback(a=>n(a),[]),o=g.useCallback(a=>n(c=>c|a),[]),s=g.useCallback(a=>(t&a)===a,[t]),i=g.useCallback(a=>n(c=>c&~a),[]),l=g.useCallback(a=>n(c=>c^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:l}}var Cp,$p;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Cp=process==null?void 0:process.env)==null?void 0:Cp.NODE_ENV)==="test"&&typeof(($p=Element==null?void 0:Element.prototype)==null?void 0:$p.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
136
- `)),[]});var q2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(q2||{});function Ip(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Mp(e,t,n,r){let[o,s]=g.useState(n),{hasFlag:i,addFlag:l,removeFlag:a}=G2(e&&o?3:0),c=g.useRef(!1),u=g.useRef(!1),f=ar();return Ce(()=>{var p;if(e){if(n&&s(!0),!t){n&&l(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),K2(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(l(3),a(4)):(l(4),a(2)))},run(){u.current?n?(a(3),l(4)):(a(4),l(3)):n?a(1):l(1)},done(){var d;u.current&&X2(t)||(c.current=!1,a(7),n||s(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,f]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function K2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=pt();return Y2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(Z2(e,r))})}),s.dispose}function Z2(e,t){var n,r;let o=pt();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(l=>l instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(l=>l.finished)).then(()=>{s||t()}),o.dispose)}function Y2(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function X2(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function ui(){return typeof window<"u"}function Wr(e){return tc(e)?(e.nodeName||"").toLowerCase():"#document"}function ot(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qt(e){var t;return(t=(tc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function tc(e){return ui()?e instanceof Node||e instanceof ot(e).Node:!1}function be(e){return ui()?e instanceof Element||e instanceof ot(e).Element:!1}function st(e){return ui()?e instanceof HTMLElement||e instanceof ot(e).HTMLElement:!1}function nc(e){return!ui()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ot(e).ShadowRoot}function ns(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=At(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function J2(e){return/^(table|td|th)$/.test(Wr(e))}function fi(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Q2=/transform|translate|scale|rotate|perspective|filter/,eE=/paint|layout|strict|content/,ur=e=>!!e&&e!=="none";let rc;function oc(e){const t=be(e)?At(e):e;return ur(t.transform)||ur(t.translate)||ur(t.scale)||ur(t.rotate)||ur(t.perspective)||!di()&&(ur(t.backdropFilter)||ur(t.filter))||Q2.test(t.willChange||"")||eE.test(t.contain||"")}function tE(e){let t=xn(e);for(;st(t)&&!vn(t);){if(oc(t))return t;if(fi(t))return null;t=xn(t)}return null}function di(){return rc==null&&(rc=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),rc}function vn(e){return/^(html|body|#document)$/.test(Wr(e))}function At(e){return ot(e).getComputedStyle(e)}function pi(e){return be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xn(e){if(Wr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||nc(e)&&e.host||Qt(e);return nc(t)?t.host:t}function Dp(e){const t=xn(e);return vn(t)?e.ownerDocument?e.ownerDocument.body:e.body:st(t)&&ns(t)?t:Dp(t)}function Un(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Dp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=ot(o);if(s){const l=sc(i);return t.concat(i,i.visualViewport||[],ns(o)?o:[],l&&n?Un(l):[])}else return t.concat(o,Un(o,[],n))}function sc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nE(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const En=Math.min,We=Math.max,rs=Math.round,hi=Math.floor,en=e=>({x:e,y:e}),rE={left:"right",right:"left",bottom:"top",top:"bottom"};function ic(e,t,n){return We(e,En(t,n))}function fr(e,t){return typeof e=="function"?e(t):e}function Wn(e){return e.split("-")[0]}function _r(e){return e.split("-")[1]}function kp(e){return e==="x"?"y":"x"}function ac(e){return e==="y"?"height":"width"}function Sn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function lc(e){return kp(Sn(e))}function oE(e,t,n){n===void 0&&(n=!1);const r=_r(e),o=lc(e),s=ac(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=mi(i)),[i,mi(i)]}function sE(e){const t=mi(e);return[cc(e),t,cc(t)]}function cc(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bp=["left","right"],Lp=["right","left"],iE=["top","bottom"],aE=["bottom","top"];function lE(e,t,n){switch(e){case"top":case"bottom":return n?t?Lp:Bp:t?Bp:Lp;case"left":case"right":return t?iE:aE;default:return[]}}function cE(e,t,n,r){const o=_r(e);let s=lE(Wn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(cc)))),s}function mi(e){const t=Wn(e);return rE[t]+e.slice(t.length)}function uE(e){return{top:0,right:0,bottom:0,left:0,...e}}function Fp(e){return typeof e!="number"?uE(e):{top:e,right:e,bottom:e,left:e}}function bi(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
135
+ */var gp;function v2(){return gp||(gp=1,process.env.NODE_ENV!=="production"&&function(){function e(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=g,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,l=t.useDebugValue;Yl.useSyncExternalStoreWithSelector=function(a,c,u,d,p){var f=o(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=i(function(){function x(k){if(!T){if(T=!0,w=k,k=d(k),p!==void 0&&h.hasValue){var B=h.value;if(p(B,k))return P=B}return P=k}if(B=P,n(w,k))return B;var F=d(k);return p!==void 0&&p(B,F)?(w=k,B):(w=k,P=F)}var T=!1,w,P,A=u===void 0?null:u;return[function(){return x(c())},A===null?void 0:function(){return x(A())}]},[c,u,d,p]);var m=r(a,f[0],f[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),l(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Yl}process.env.NODE_ENV==="production"?Kl.exports=y2():Kl.exports=v2();var w2=Kl.exports;function rt(e,t,n=fp){return w2.useSyncExternalStoreWithSelector(he(r=>e.subscribe(x2,r)),he(()=>e.state),he(()=>e.state),he(t),n)}function x2(e){return e}function yp(e,t){let n=g.useId(),r=ql.get(t),[o,s]=rt(r,g.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return $e(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Xl=new Map,ts=new Map;function vp(e){var t;let n=(t=ts.get(e))!=null?t:0;return ts.set(e,n+1),n!==0?()=>wp(e):(Xl.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>wp(e))}function wp(e){var t;let n=(t=ts.get(e))!=null?t:1;if(n===1?ts.delete(e):ts.set(e,n-1),n!==1)return;let r=Xl.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Xl.delete(e))}function E2(e,{allowed:t,disallowed:n}={}){let r=yp(e,"inert-others");$e(()=>{var o,s;if(!r)return;let i=pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(vp(a));let l=(s=t==null?void 0:t())!=null?s:[];for(let a of l){if(!a)continue;let c=oi(a);if(!c)continue;let u=a.parentElement;for(;u&&u!==c.body;){for(let d of u.children)l.some(p=>d.contains(p))||i.add(vp(d));u=u.parentElement}}return i.dispose},[r,t,n])}function S2(e,t,n){let r=lr(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});g.useEffect(()=>{if(!e)return;let o=t===null?null:vn(t)?t:t.current;if(!o)return;let s=pt();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let Jl=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),P2=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Ql=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(Ql||{}),T2=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(T2||{}),A2=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(A2||{});function xp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Jl)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function N2(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(P2)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var ec=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(ec||{});function Ep(e,t=0){var n;return e===((n=oi(e))==null?void 0:n.body)?!1:St(t,{0(){return e.matches(Jl)},1(){let r=e;for(;r!==null;){if(r.matches(Jl))return!0;r=r.parentElement}return!1}})}var C2=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(C2||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let O2=["textarea","input"].join(",");function $2(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,O2))!=null?n:!1}function Sp(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let i=o.compareDocumentPosition(s);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function I2(e,t,n=e===null?document.body:si(e)){return M2(xp(n),t,{relativeTo:e})}function M2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?si(e[0]):document:si(e),i=Array.isArray(e)?n?Sp(e):e:t&64?N2(e):xp(e);o.length>0&&i.length>1&&(i=i.filter(f=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===f:h===f))),r=r??(s==null?void 0:s.activeElement);let l=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},u=0,d=i.length,p;do{if(u>=d||u+d<=0)return 0;let f=a+u;if(t&16)f=(f+d)%d;else{if(f<0)return 3;if(f>=d)return 1}p=i[f],p==null||p.focus(c),u+=l}while(p!==W0(p));return t&6&&$2(p)&&p.select(),2}function Pp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function D2(){return/Android/gi.test(window.navigator.userAgent)}function Tp(){return Pp()||D2()}function Ur(e,t,n,r){let o=lr(n);g.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function k2(e,t,n,r){let o=lr(n);g.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Ap=30;function L2(e,t,n){let r=lr(n),o=g.useCallback(function(l,a){if(l.defaultPrevented)return;let c=a(l);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let u=function d(p){return typeof p=="function"?d(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let d of u)if(d!==null&&(d.contains(c)||l.composed&&l.composedPath().includes(d)))return;return!Ep(c,ec.Loose)&&c.tabIndex!==-1&&l.preventDefault(),r.current(l,c)},[r,t]),s=g.useRef(null);Ur(e,"pointerdown",l=>{var a,c;Tp()||(s.current=((c=(a=l.composedPath)==null?void 0:a.call(l))==null?void 0:c[0])||l.target)},!0),Ur(e,"pointerup",l=>{if(Tp()||!s.current)return;let a=s.current;return s.current=null,o(l,()=>a)},!0);let i=g.useRef({x:0,y:0});Ur(e,"touchstart",l=>{i.current.x=l.touches[0].clientX,i.current.y=l.touches[0].clientY},!0),Ur(e,"touchend",l=>{let a={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Ap||Math.abs(a.y-i.current.y)>=Ap))return o(l,()=>zr(l.target)?l.target:null)},!0),k2(e,"blur",l=>o(l,()=>q5(window.document.activeElement)?window.document.activeElement:null),!0)}function tc(...e){return g.useMemo(()=>oi(...e),[...e])}var B2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(B2||{});const ui={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},F2=200,Np=5;function R2(e,{trigger:t,action:n,close:r,select:o}){let s=g.useRef(null),i=g.useRef(null),l=g.useRef(null);Ur(e&&t!==null,"pointerdown",a=>{X0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,l.current=a.y,s.current=a.timeStamp)}),Ur(e&&t!==null,"pointerup",a=>{var c,u;let d=s.current;if(d===null||(s.current=null,!zr(a.target))||Math.abs(a.x-((c=i.current)!=null?c:a.x))<Np&&Math.abs(a.y-((u=l.current)!=null?u:a.y))<Np)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-d>F2&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function j2(e,t){return g.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function z2(e){return g.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function U2(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(l=>l()))}}}function W2(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function _2(){return Pp()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let l=pt();l.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>l.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",l=>{if(zr(l.target))try{let a=l.target.closest("a");if(!a)return;let{hash:c}=new URL(a.href),u=e.querySelector(c);zr(u)&&!r(u)&&(i=u)}catch{}},!0),t.group(l=>{t.addEventListener(e,"touchstart",a=>{if(l.dispose(),zr(a.target)&&G5(a.target))if(r(a.target)){let c=a.target;for(;c.parentElement&&r(c.parentElement);)c=c.parentElement;l.style(c,"overscrollBehavior","contain")}else l.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",l=>{if(zr(l.target)){if(J0(l.target))return;if(r(l.target)){let a=l.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),t.add(()=>{var l;let a=(l=window.scrollY)!=null?l:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function V2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Cp(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let cr=U2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:pt(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=Cp(r.meta),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=Cp(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[_2(),W2(),V2()];n.forEach(({before:r})=>r==null?void 0:r(t)),n.forEach(({after:r})=>r==null?void 0:r(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});cr.subscribe(()=>{let e=cr.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&cr.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&cr.dispatch("TEARDOWN",n)}});function H2(e,t,n=()=>({containers:[]})){let r=z2(cr),o=t?r.get(t):void 0,s=o?o.count>0:!1;return $e(()=>{if(!(!t||!e))return cr.dispatch("PUSH",t,n),()=>cr.dispatch("POP",t,n)},[e,t]),s}function G2(e,t,n=()=>[document.body]){let r=yp(e,"scroll-lock");H2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Op(e){return[e.screenX,e.screenY]}function q2(){let e=g.useRef([-1,-1]);return{wasMoved(t){let n=Op(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Op(t)}}}function K2(e=0){let[t,n]=g.useState(e),r=g.useCallback(a=>n(a),[]),o=g.useCallback(a=>n(c=>c|a),[]),s=g.useCallback(a=>(t&a)===a,[t]),i=g.useCallback(a=>n(c=>c&~a),[]),l=g.useCallback(a=>n(c=>c^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:l}}var $p,Ip;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&(($p=process==null?void 0:process.env)==null?void 0:$p.NODE_ENV)==="test"&&typeof((Ip=Element==null?void 0:Element.prototype)==null?void 0:Ip.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
136
+ `)),[]});var Z2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Z2||{});function Mp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Dp(e,t,n,r){let[o,s]=g.useState(n),{hasFlag:i,addFlag:l,removeFlag:a}=K2(e&&o?3:0),c=g.useRef(!1),u=g.useRef(!1),d=ar();return $e(()=>{var p;if(e){if(n&&s(!0),!t){n&&l(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),Y2(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(l(3),a(4)):(l(4),a(2)))},run(){u.current?n?(a(3),l(4)):(a(4),l(3)):n?a(1):l(1)},done(){var f;u.current&&Q2(t)||(c.current=!1,a(7),n||s(!1),(f=r==null?void 0:r.end)==null||f.call(r,n))}})}},[e,n,t,d]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Y2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=pt();return J2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(X2(e,r))})}),s.dispose}function X2(e,t){var n,r;let o=pt();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(l=>l instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(l=>l.finished)).then(()=>{s||t()}),o.dispose)}function J2(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function Q2(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function di(){return typeof window<"u"}function Wr(e){return nc(e)?(e.nodeName||"").toLowerCase():"#document"}function ot(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qt(e){var t;return(t=(nc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function nc(e){return di()?e instanceof Node||e instanceof ot(e).Node:!1}function be(e){return di()?e instanceof Element||e instanceof ot(e).Element:!1}function st(e){return di()?e instanceof HTMLElement||e instanceof ot(e).HTMLElement:!1}function rc(e){return!di()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ot(e).ShadowRoot}function ns(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=At(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function eE(e){return/^(table|td|th)$/.test(Wr(e))}function fi(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const tE=/transform|translate|scale|rotate|perspective|filter/,nE=/paint|layout|strict|content/,ur=e=>!!e&&e!=="none";let oc;function sc(e){const t=be(e)?At(e):e;return ur(t.transform)||ur(t.translate)||ur(t.scale)||ur(t.rotate)||ur(t.perspective)||!pi()&&(ur(t.backdropFilter)||ur(t.filter))||tE.test(t.willChange||"")||nE.test(t.contain||"")}function rE(e){let t=xn(e);for(;st(t)&&!wn(t);){if(sc(t))return t;if(fi(t))return null;t=xn(t)}return null}function pi(){return oc==null&&(oc=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),oc}function wn(e){return/^(html|body|#document)$/.test(Wr(e))}function At(e){return ot(e).getComputedStyle(e)}function hi(e){return be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xn(e){if(Wr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||rc(e)&&e.host||Qt(e);return rc(t)?t.host:t}function kp(e){const t=xn(e);return wn(t)?e.ownerDocument?e.ownerDocument.body:e.body:st(t)&&ns(t)?t:kp(t)}function Un(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=kp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=ot(o);if(s){const l=ic(i);return t.concat(i,i.visualViewport||[],ns(o)?o:[],l&&n?Un(l):[])}else return t.concat(o,Un(o,[],n))}function ic(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oE(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const En=Math.min,We=Math.max,rs=Math.round,mi=Math.floor,en=e=>({x:e,y:e}),sE={left:"right",right:"left",bottom:"top",top:"bottom"};function ac(e,t,n){return We(e,En(t,n))}function dr(e,t){return typeof e=="function"?e(t):e}function Wn(e){return e.split("-")[0]}function _r(e){return e.split("-")[1]}function Lp(e){return e==="x"?"y":"x"}function lc(e){return e==="y"?"height":"width"}function Sn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function cc(e){return Lp(Sn(e))}function iE(e,t,n){n===void 0&&(n=!1);const r=_r(e),o=cc(e),s=lc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=bi(i)),[i,bi(i)]}function aE(e){const t=bi(e);return[uc(e),t,uc(t)]}function uc(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bp=["left","right"],Fp=["right","left"],lE=["top","bottom"],cE=["bottom","top"];function uE(e,t,n){switch(e){case"top":case"bottom":return n?t?Fp:Bp:t?Bp:Fp;case"left":case"right":return t?lE:cE;default:return[]}}function dE(e,t,n,r){const o=_r(e);let s=uE(Wn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(uc)))),s}function bi(e){const t=Wn(e);return sE[t]+e.slice(t.length)}function fE(e){return{top:0,right:0,bottom:0,left:0,...e}}function Rp(e){return typeof e!="number"?fE(e):{top:e,right:e,bottom:e,left:e}}function gi(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
137
137
  * tabbable 6.4.0
138
138
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
139
- */var fE=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],uc=fE.join(","),Rp=typeof Element>"u",os=Rp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,gi=!Rp&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},yi=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):yi(t.parentNode));return i},dE=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},pE=function(t,n,r){if(yi(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(uc));return n&&os.call(t,uc)&&o.unshift(t),o=o.filter(r),o},fc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!yi(i,!1))if(i.tagName==="SLOT"){var l=i.assignedElements(),a=l.length?l:i.children,c=fc(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=os.call(i,uc);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!yi(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=fc(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},jp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},zp=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||dE(t))&&!jp(t)?0:t.tabIndex},hE=function(t,n){var r=zp(t);return r<0&&n&&!jp(t)?0:r},mE=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Up=function(t){return t.tagName==="INPUT"},bE=function(t){return Up(t)&&t.type==="hidden"},gE=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},yE=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},wE=function(t){if(!t.name)return!0;var n=t.form||gi(t),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=yE(o,t.form);return!s||s===t},vE=function(t){return Up(t)&&t.type==="radio"},xE=function(t){return vE(t)&&!wE(t)},EE=function(t){var n,r=t&&gi(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,l,a;for(s=!!((i=o)!==null&&i!==void 0&&(l=i.ownerDocument)!==null&&l!==void 0&&l.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var c,u,f;r=gi(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Wp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},SE=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=os.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(os.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var c=t.parentElement,u=gi(t);if(c&&!c.shadowRoot&&o(c)===!0)return Wp(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=a}if(EE(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Wp(t);return!1},PE=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return os.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},TE=function(t,n){return!(n.disabled||bE(n)||SE(n,t)||gE(n)||PE(n))},_p=function(t,n){return!(xE(n)||zp(n)<0||!TE(t,n))},AE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Vp=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,l=i?o.scopeParent:o,a=hE(l,i),c=i?Vp(o.candidates):l;a===0?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:c})}),r.sort(mE).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Hp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=fc([t],n.includeContainer,{filter:_p.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:AE}):r=pE(t,n.includeContainer,_p.bind(null,n)),Vp(r)};function Gp(e,t,n){let{reference:r,floating:o}=e;const s=Sn(t),i=lc(t),l=ac(i),a=Wn(t),c=s==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[l]/2-o[l]/2;let d;switch(a){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(_r(t)){case"start":d[i]-=p*(n&&c?-1:1);break;case"end":d[i]+=p*(n&&c?-1:1);break}return d}async function qp(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=fr(t,e),h=Fp(d),w=l[p?f==="floating"?"reference":"floating":f],T=bi(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),A=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},k=bi(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:E,strategy:a}):x);return{top:(T.top-k.top+h.top)/A.y,bottom:(k.bottom-T.bottom+h.bottom)/A.y,left:(T.left-k.left+h.left)/A.x,right:(k.right-T.right+h.right)/A.x}}const NE=50,OE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:qp},a=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Gp(c,r,a),p=r,d=0;const h={};for(let b=0;b<s.length;b++){const w=s[b];if(!w)continue;const{name:T,fn:x}=w,{x:E,y:A,data:k,reset:F}=await x({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:c,platform:l,elements:{reference:e,floating:t}});u=E??u,f=A??f,h[T]={...h[T],...k},F&&d<NE&&(d++,typeof F=="object"&&(F.placement&&(p=F.placement),F.rects&&(c=F.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):F.rects),{x:u,y:f}=Gp(c,p,a)),b=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:h}},CE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:a}=t,{element:c,padding:u=0}=fr(e,t)||{};if(c==null)return{};const f=Fp(u),p={x:n,y:r},d=lc(o),h=ac(d),b=await i.getDimensions(c),w=d==="y",T=w?"top":"left",x=w?"bottom":"right",E=w?"clientHeight":"clientWidth",A=s.reference[h]+s.reference[d]-p[d]-s.floating[h],k=p[d]-s.reference[d],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let L=F?F[E]:0;(!L||!await(i.isElement==null?void 0:i.isElement(F)))&&(L=l.floating[E]||s.floating[h]);const m=A/2-k/2,v=L/2-b[h]/2-1,S=En(f[T],v),I=En(f[x],v),$=S,C=L-b[h]-I,D=L/2-b[h]/2+m,y=ic($,D,C),O=!a.arrow&&_r(o)!=null&&D!==y&&s.reference[h]/2-(D<$?S:I)-b[h]/2<0,M=O?D<$?D-$:D-C:0;return{[d]:p[d]+M,data:{[d]:y,centerOffset:D-y-M,...O&&{alignmentOffset:M}},reset:O}}}),$E=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:b=!0,...w}=fr(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const T=Wn(o),x=Sn(l),E=Wn(l)===l,A=await(a.isRTL==null?void 0:a.isRTL(c.floating)),k=p||(E||!b?[mi(l)]:sE(l)),F=h!=="none";!p&&F&&k.push(...cE(l,b,h,A));const L=[l,...k],m=await a.detectOverflow(t,w),v=[];let S=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&v.push(m[T]),f){const D=oE(o,i,A);v.push(m[D[0]],m[D[1]])}if(S=[...S,{placement:o,overflows:v}],!v.every(D=>D<=0)){var I,$;const D=(((I=s.flip)==null?void 0:I.index)||0)+1,y=L[D];if(y&&(!(f==="alignment"?x!==Sn(y):!1)||S.every(P=>Sn(P.placement)===x?P.overflows[0]>0:!0)))return{data:{index:D,overflows:S},reset:{placement:y}};let O=($=S.filter(M=>M.overflows[0]<=0).sort((M,P)=>M.overflows[1]-P.overflows[1])[0])==null?void 0:$.placement;if(!O)switch(d){case"bestFit":{var C;const M=(C=S.filter(P=>{if(F){const B=Sn(P.placement);return B===x||B==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(B=>B>0).reduce((B,R)=>B+R,0)]).sort((P,B)=>P[1]-B[1])[0])==null?void 0:C[0];M&&(O=M);break}case"initialPlacement":O=l;break}if(o!==O)return{reset:{placement:O}}}return{}}}},IE=new Set(["left","top"]);async function ME(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Wn(n),l=_r(n),a=Sn(n)==="y",c=IE.has(i)?-1:1,u=s&&a?-1:1,f=fr(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof h=="number"&&(d=l==="end"?h*-1:h),a?{x:d*u,y:p*c}:{x:p*c,y:d*u}}const DE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,a=await ME(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},kE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:T=>{let{x,y:E}=T;return{x,y:E}}},...c}=fr(e,t),u={x:n,y:r},f=await s.detectOverflow(t,c),p=Sn(Wn(o)),d=kp(p);let h=u[d],b=u[p];if(i){const T=d==="y"?"top":"left",x=d==="y"?"bottom":"right",E=h+f[T],A=h-f[x];h=ic(E,h,A)}if(l){const T=p==="y"?"top":"left",x=p==="y"?"bottom":"right",E=b+f[T],A=b-f[x];b=ic(E,b,A)}const w=a.fn({...t,[d]:h,[p]:b});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[d]:i,[p]:l}}}}}},BE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:a=()=>{},...c}=fr(e,t),u=await i.detectOverflow(t,c),f=Wn(o),p=_r(o),d=Sn(o)==="y",{width:h,height:b}=s.floating;let w,T;f==="top"||f==="bottom"?(w=f,T=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(T=f,w=p==="end"?"top":"bottom");const x=b-u.top-u.bottom,E=h-u.left-u.right,A=En(b-u[w],x),k=En(h-u[T],E),F=!t.middlewareData.shift;let L=A,m=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(m=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=x),F&&!p){const S=We(u.left,0),I=We(u.right,0),$=We(u.top,0),C=We(u.bottom,0);d?m=h-2*(S!==0||I!==0?S+I:We(u.left,u.right)):L=b-2*($!==0||C!==0?$+C:We(u.top,u.bottom))}await a({...t,availableWidth:m,availableHeight:L});const v=await i.getDimensions(l.floating);return h!==v.width||b!==v.height?{reset:{rects:!0}}:{}}}};function Kp(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=st(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=rs(n)!==s||rs(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function dc(e){return be(e)?e:e.contextElement}function Vr(e){const t=dc(e);if(!st(t))return en(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Kp(t);let i=(s?rs(n.width):n.width)/r,l=(s?rs(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const LE=en(0);function Zp(e){const t=ot(e);return!di()||!t.visualViewport?LE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function FE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ot(e)?!1:t}function dr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=dc(e);let i=en(1);t&&(r?be(r)&&(i=Vr(r)):i=Vr(e));const l=FE(s,n,r)?Zp(s):en(0);let a=(o.left+l.x)/i.x,c=(o.top+l.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const p=ot(s),d=r&&be(r)?ot(r):r;let h=p,b=sc(h);for(;b&&r&&d!==h;){const w=Vr(b),T=b.getBoundingClientRect(),x=At(b),E=T.left+(b.clientLeft+parseFloat(x.paddingLeft))*w.x,A=T.top+(b.clientTop+parseFloat(x.paddingTop))*w.y;a*=w.x,c*=w.y,u*=w.x,f*=w.y,a+=E,c+=A,h=ot(b),b=sc(h)}}return bi({width:u,height:f,x:a,y:c})}function wi(e,t){const n=pi(e).scrollLeft;return t?t.left+n:dr(Qt(e)).left+n}function Yp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-wi(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function RE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Qt(r),l=t?fi(t.floating):!1;if(r===i||l&&s)return n;let a={scrollLeft:0,scrollTop:0},c=en(1);const u=en(0),f=st(r);if((f||!f&&!s)&&((Wr(r)!=="body"||ns(i))&&(a=pi(r)),f)){const d=dr(r);c=Vr(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=i&&!f&&!s?Yp(i,a):en(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-a.scrollTop*c.y+u.y+p.y}}function jE(e){return Array.from(e.getClientRects())}function zE(e){const t=Qt(e),n=pi(e),r=e.ownerDocument.body,o=We(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=We(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+wi(e);const l=-n.scrollTop;return At(r).direction==="rtl"&&(i+=We(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Xp=25;function UE(e,t){const n=ot(e),r=Qt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,a=0;if(o){s=o.width,i=o.height;const u=di();(!u||u&&t==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=wi(r);if(c<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),d=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Xp&&(s-=h)}else c<=Xp&&(s+=c);return{width:s,height:i,x:l,y:a}}function WE(e,t){const n=dr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=st(e)?Vr(e):en(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,a=o*s.x,c=r*s.y;return{width:i,height:l,x:a,y:c}}function Jp(e,t,n){let r;if(t==="viewport")r=UE(e,n);else if(t==="document")r=zE(Qt(e));else if(be(t))r=WE(t,n);else{const o=Zp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return bi(r)}function Qp(e,t){const n=xn(e);return n===t||!be(n)||vn(n)?!1:At(n).position==="fixed"||Qp(n,t)}function _E(e,t){const n=t.get(e);if(n)return n;let r=Un(e,[],!1).filter(l=>be(l)&&Wr(l)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?xn(e):e;for(;be(i)&&!vn(i);){const l=At(i),a=oc(i);!a&&l.position==="fixed"&&(o=null),(s?!a&&!o:!a&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||ns(i)&&!a&&Qp(e,i))?r=r.filter(u=>u!==i):o=l,i=xn(i)}return t.set(e,r),r}function VE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?fi(t)?[]:_E(t,this._c):[].concat(n),r],l=Jp(t,i[0],o);let a=l.top,c=l.right,u=l.bottom,f=l.left;for(let p=1;p<i.length;p++){const d=Jp(t,i[p],o);a=We(d.top,a),c=En(d.right,c),u=En(d.bottom,u),f=We(d.left,f)}return{width:c-f,height:u-a,x:f,y:a}}function HE(e){const{width:t,height:n}=Kp(e);return{width:t,height:n}}function GE(e,t,n){const r=st(t),o=Qt(t),s=n==="fixed",i=dr(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=en(0);function c(){a.x=wi(o)}if(r||!r&&!s)if((Wr(t)!=="body"||ns(o))&&(l=pi(t)),r){const d=dr(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?Yp(o,l):en(0),f=i.left+l.scrollLeft-a.x-u.x,p=i.top+l.scrollTop-a.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function pc(e){return At(e).position==="static"}function eh(e,t){if(!st(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qt(e)===n&&(n=n.ownerDocument.body),n}function th(e,t){const n=ot(e);if(fi(e))return n;if(!st(e)){let o=xn(e);for(;o&&!vn(o);){if(be(o)&&!pc(o))return o;o=xn(o)}return n}let r=eh(e,t);for(;r&&J2(r)&&pc(r);)r=eh(r,t);return r&&vn(r)&&pc(r)&&!oc(r)?n:r||tE(e)||n}const qE=async function(e){const t=this.getOffsetParent||th,n=this.getDimensions,r=await n(e.floating);return{reference:GE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function KE(e){return At(e).direction==="rtl"}const ZE={convertOffsetParentRelativeRectToViewportRelativeRect:RE,getDocumentElement:Qt,getClippingRect:VE,getOffsetParent:th,getElementRects:qE,getClientRects:jE,getDimensions:HE,getScale:Vr,isElement:be,isRTL:KE};function nh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function YE(e,t){let n=null,r;const o=Qt(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const c=e.getBoundingClientRect(),{left:u,top:f,width:p,height:d}=c;if(l||t(),!p||!d)return;const h=hi(f),b=hi(o.clientWidth-(u+p)),w=hi(o.clientHeight-(f+d)),T=hi(u),E={rootMargin:-h+"px "+-b+"px "+-w+"px "+-T+"px",threshold:We(0,En(1,a))||1};let A=!0;function k(F){const L=F[0].intersectionRatio;if(L!==a){if(!A)return i();L?i(!1,L):r=setTimeout(()=>{i(!1,1e-7)},1e3)}L===1&&!nh(c,e.getBoundingClientRect())&&i(),A=!1}try{n=new IntersectionObserver(k,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,E)}n.observe(e)}return i(!0),s}function rh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=dc(e),u=o||s?[...c?Un(c):[],...t?Un(t):[]]:[];u.forEach(T=>{o&&T.addEventListener("scroll",n,{passive:!0}),s&&T.addEventListener("resize",n)});const f=c&&l?YE(c,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(T=>{let[x]=T;x&&x.target===c&&d&&t&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var E;(E=d)==null||E.observe(t)})),n()}),c&&!a&&d.observe(c),t&&d.observe(t));let h,b=a?dr(e):null;a&&w();function w(){const T=dr(e);b&&!nh(b,T)&&n(),b=T,h=requestAnimationFrame(w)}return n(),()=>{var T;u.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(T=d)==null||T.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const hc=qp,XE=DE,JE=kE,QE=$E,e8=BE,oh=CE,t8=(e,t,n)=>{const r=new Map,o={platform:ZE,...n},s={...o.platform,_c:r};return OE(e,t,{...o,platform:s})};var n8=typeof document<"u",r8=function(){},vi=n8?g.useLayoutEffect:r8;function xi(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 n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!xi(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!xi(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function sh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ih(e,t){const n=sh(e);return Math.round(t*n)/n}function mc(e){const t=U.useRef(e);return vi(()=>{t.current=e}),t}function ah(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:a,open:c}=e,[u,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=U.useState(r);xi(p,r)||d(r);const[h,b]=U.useState(null),[w,T]=U.useState(null),x=U.useCallback(P=>{P!==F.current&&(F.current=P,b(P))},[]),E=U.useCallback(P=>{P!==L.current&&(L.current=P,T(P))},[]),A=s||h,k=i||w,F=U.useRef(null),L=U.useRef(null),m=U.useRef(u),v=a!=null,S=mc(a),I=mc(o),$=mc(c),C=U.useCallback(()=>{if(!F.current||!L.current)return;const P={placement:t,strategy:n,middleware:p};I.current&&(P.platform=I.current),t8(F.current,L.current,P).then(B=>{const R={...B,isPositioned:$.current!==!1};D.current&&!xi(m.current,R)&&(m.current=R,Qr.flushSync(()=>{f(R)}))})},[p,t,n,I,$]);vi(()=>{c===!1&&m.current.isPositioned&&(m.current.isPositioned=!1,f(P=>({...P,isPositioned:!1})))},[c]);const D=U.useRef(!1);vi(()=>(D.current=!0,()=>{D.current=!1}),[]),vi(()=>{if(A&&(F.current=A),k&&(L.current=k),A&&k){if(S.current)return S.current(A,k,C);C()}},[A,k,C,S,v]);const y=U.useMemo(()=>({reference:F,floating:L,setReference:x,setFloating:E}),[x,E]),O=U.useMemo(()=>({reference:A,floating:k}),[A,k]),M=U.useMemo(()=>{const P={position:n,left:0,top:0};if(!O.floating)return P;const B=ih(O.floating,u.x),R=ih(O.floating,u.y);return l?{...P,transform:"translate("+B+"px, "+R+"px)",...sh(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:R}},[n,l,O.floating,u.x,u.y]);return U.useMemo(()=>({...u,update:C,refs:y,elements:O,floatingStyles:M}),[u,C,y,O,M])}const o8=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?oh({element:r.current,padding:o}).fn(n):{}:r?oh({element:r,padding:o}).fn(n):{}}}},bc=(e,t)=>{const n=XE(e);return{name:n.name,fn:n.fn,options:[e,t]}},lh=(e,t)=>{const n=JE(e);return{name:n.name,fn:n.fn,options:[e,t]}},ch=(e,t)=>{const n=QE(e);return{name:n.name,fn:n.fn,options:[e,t]}},s8=(e,t)=>{const n=e8(e);return{name:n.name,fn:n.fn,options:[e,t]}},i8=(e,t)=>{const n=o8(e);return{name:n.name,fn:n.fn,options:[e,t]}},uh={...U},a8=uh.useInsertionEffect||(e=>e());function fh(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return a8(()=>{t.current=e}),U.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var gc=typeof document<"u"?g.useLayoutEffect:g.useEffect;let dh=!1,l8=0;const ph=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+l8++;function c8(){const[e,t]=U.useState(()=>dh?ph():void 0);return gc(()=>{e==null&&t(ph())},[]),U.useEffect(()=>{dh=!0},[]),e}const u8=uh.useId||c8;let ss;process.env.NODE_ENV!=="production"&&(ss=new Set);function f8(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=ss)!=null&&e.has(o))){var s;(s=ss)==null||s.add(o),console.warn(o)}}function d8(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=ss)!=null&&e.has(o))){var s;(s=ss)==null||s.add(o),console.error(o)}}function p8(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const h8=U.createContext(null),m8=U.createContext(null),b8=()=>{var e;return((e=U.useContext(h8))==null?void 0:e.id)||null},g8=()=>U.useContext(m8),y8="data-floating-ui-focusable";function w8(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=u8(),s=U.useRef({}),[i]=U.useState(()=>p8()),l=b8()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!be(d)&&d8("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=fh((d,h,b)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:b,nested:l}),n==null||n(d,h,b)}),f=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function v8(e){e===void 0&&(e={});const{nodeId:t}=e,n=w8({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=g8();gc(()=>{u&&(f.current=u)},[u]);const d=ah({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(E=>{const A=be(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),contextElement:E}:E;a(A),d.refs.setReference(A)},[d.refs]),b=U.useCallback(E=>{(be(E)||E===null)&&(f.current=E,i(E)),(be(d.refs.reference.current)||d.refs.reference.current===null||E!==null&&!be(E))&&d.refs.setReference(E)},[d.refs]),w=U.useMemo(()=>({...d.refs,setReference:b,setPositionReference:h,domReference:f}),[d.refs,b,h]),T=U.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=U.useMemo(()=>({...d,...r,refs:w,elements:T,nodeId:t}),[d,w,T,t,r]);return gc(()=>{r.dataRef.current.floatingContext=x;const E=p==null?void 0:p.nodesRef.current.find(A=>A.id===t);E&&(E.context=x)}),U.useMemo(()=>({...d,context:x,refs:w,elements:T}),[d,w,T,x])}const hh="active",mh="selected";function yc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[hh]:i,[mh]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[y8]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[hh,mh].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),i[c]=function(){for(var p,d=arguments.length,h=new Array(d),b=0;b<d;b++)h[b]=arguments[b];return(p=r.get(c))==null?void 0:p.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[c]=u}),i),{})}}function x8(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>yc(l,e,"reference"),t),s=U.useCallback(l=>yc(l,e,"floating"),n),i=U.useCallback(l=>yc(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function bh(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const E8=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:l=4,referenceOverflowThreshold:a=0,scrollRef:c,...u}=fr(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(c==null?void 0:c.current)||p,b=p.clientTop||h.clientTop,w=p.clientTop!==0,T=h.clientTop!==0,x=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||f8('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const E={...t,...await bc(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},A=await hc(bh(E,h.scrollHeight+b+p.clientTop),u),k=await hc(E,{...u,elementContext:"reference"}),F=We(0,A.top),L=E.y+F,S=(h.scrollHeight>h.clientHeight?I=>I:rs)(We(0,h.scrollHeight+(w&&x||T?b*2:0)-F-We(0,A.bottom)));if(h.style.maxHeight=S+"px",h.scrollTop=F,o){const I=h.offsetHeight<d.offsetHeight*En(l,n.current.length)-1||k.top>=-a||k.bottom>=-a;Qr.flushSync(()=>o(I))}return r&&(r.current=await hc(bh({...E,y:L},h.offsetHeight+b+p.clientTop),u)),{y:L}}});function S8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:l}=t,a=fh(l),c=U.useRef(!1),u=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function d(b){if(b.ctrlKey||!h||s.current==null)return;const w=b.deltaY,T=s.current.top>=-.5,x=s.current.bottom>=-.5,E=h.scrollHeight-h.clientHeight,A=w<0?-1:1,k=w<0?"max":"min";h.scrollHeight<=h.clientHeight||(!T&&w>0||!x&&w<0?(b.preventDefault(),Qr.flushSync(()=>{a(F=>F+Math[k](w,E*A))})):/firefox/i.test(nE())&&(h.scrollTop+=w))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{u.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=U.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!c.current)){if(u.current!==null){const h=d.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Qr.flushSync(()=>a(b=>b+h))}requestAnimationFrame(()=>{u.current=d.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:p}:{},[o,p])}let Hr=g.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Hr.displayName="FloatingContext";let wc=g.createContext(null);wc.displayName="PlacementContext";function P8(e){return g.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function T8(){return g.useContext(Hr).setReference}function A8(){return g.useContext(Hr).getReferenceProps}function N8(){let{getFloatingProps:e,slot:t}=g.useContext(Hr);return g.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function O8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=g.useContext(wc),n=g.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Ce(()=>{t==null||t(n??null)},[t,n]);let r=g.useContext(Hr);return g.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let gh=4;function C8({children:e,enabled:t=!0}){let[n,r]=g.useState(null),[o,s]=g.useState(0),i=g.useRef(null),[l,a]=g.useState(null);$8(l);let c=t&&n!==null&&l!==null,{to:u="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=I8(n,l),[b,w="center"]=u.split(" ");Ce(()=>{c&&s(0)},[c]);let{refs:T,floatingStyles:x,context:E}=v8({open:c,placement:b==="selection"?w==="center"?"bottom":`bottom-${w}`:w==="center"?`${b}`:`${b}-${w}`,strategy:"absolute",transform:!1,middleware:[bc({mainAxis:b==="selection"?0:f,crossAxis:p}),lh({padding:d}),b!=="selection"&&ch({padding:d}),b==="selection"&&h?E8({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:gh,referenceOverflowThreshold:d,onFallbackChange(I){var $,C;if(!I)return;let D=E.elements.floating;if(!D)return;let y=parseFloat(getComputedStyle(D).scrollPaddingBottom)||0,O=Math.min(gh,D.childElementCount),M=0,P=0;for(let B of(C=($=E.elements.floating)==null?void 0:$.childNodes)!=null?C:[])if(wn(B)){let R=B.offsetTop,z=R+B.clientHeight+y,W=D.scrollTop,G=W+D.clientHeight;if(R>=W&&z<=G)O--;else{P=Math.max(0,Math.min(z,G)-Math.max(R,W)),M=B.clientHeight;break}}O>=1&&s(B=>{let R=M*O-P+y;return B>=R?B:R})}}):null,s8({padding:d,apply({availableWidth:I,availableHeight:$,elements:C}){Object.assign(C.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${$}px)`})}})].filter(Boolean),whileElementsMounted:rh}),[A=b,k=w]=E.placement.split("-");b==="selection"&&(A="selection");let F=g.useMemo(()=>({anchor:[A,k].filter(Boolean).join(" ")}),[A,k]),L=S8(E,{overflowRef:i,onChange:s}),{getReferenceProps:m,getFloatingProps:v}=x8([L]),S=pe(I=>{a(I),T.setFloating(I)});return U.createElement(wc.Provider,{value:r},U.createElement(Hr.Provider,{value:{setFloating:S,setReference:T.setReference,styles:x,getReferenceProps:m,getFloatingProps:v,slot:F}},e))}function $8(e){Ce(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function I8(e,t){var n,r,o;let s=vc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=vc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),l=vc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:l}}function vc(e,t,n=void 0){let r=ar(),o=pe((a,c)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!c)return[n,null];let u=wh(a,c);return[u,f=>{let p=yh(a);{let d=p.map(h=>window.getComputedStyle(c).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let b=!1;for(let[T,x]of p.entries()){let E=window.getComputedStyle(c).getPropertyValue(x);if(d[T]!==E){d[T]=E,b=!0;break}}if(!b)return;let w=wh(a,c);u!==w&&(f(w),u=w)})}return r.dispose}]}return[n,null]}),s=g.useMemo(()=>o(e,t)[0],[e,t]),[i=s,l]=g.useState();return Ce(()=>{let[a,c]=o(e,t);if(l(a),!!c)return c(l)},[e,t]),i}function yh(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...yh(o)]:[r]}return[]}function wh(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function M8({children:e,freeze:t},n){let r=vh(t,e);return g.isValidElement(r)?g.cloneElement(r,{ref:n}):g.createElement(g.Fragment,null,r)}g.forwardRef(M8);function vh(e,t){let[n,r]=g.useState(t);return!e&&n!==t&&r(t),e?n:t}let xc=g.createContext(null);xc.displayName="OpenClosedContext";var Ut=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ut||{});function Ec(){return g.useContext(xc)}function xh({value:e,children:t}){return g.createElement(xc.Provider,{value:e},t)}function D8(e){throw new Error("Unexpected object: "+e)}var Ne=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Ne||{});function Ei(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:D8(e)}}function Eh(e){let t=pe(e),n=g.useRef(!1);g.useEffect(()=>(n.current=!1,()=>{n.current=!0,W0(()=>{n.current&&t()})}),[t])}let k8=g.createContext(!1);function B8(){return g.useContext(k8)}function L8(e){let t=B8(),n=g.useContext(Ph),[r,o]=g.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Xt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let l=e.createElement("div");return l.setAttribute("id","headlessui-portal-root"),e.body.appendChild(l)});return g.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),g.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Sh=g.Fragment,F8=nt(function(e,t){let{ownerDocument:n=null,...r}=e,o=g.useRef(null),s=Pt(Zx(p=>{o.current=p}),t),i=ec(o.current),l=n??i,a=L8(l),c=g.useContext(U8),u=ar(),f=ht();return Eh(()=>{var p;a&&a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a))}),a?Ke.createPortal(g.createElement("div",{"data-headlessui-portal":"",ref:p=>{u.dispose(),c&&p&&u.add(c.register(p))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Sh,name:"Portal"})),a):null});function R8(e,t){let n=Pt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=ht();return r?g.createElement(F8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Sh,name:"Portal"})}let j8=g.Fragment,Ph=g.createContext(null);function z8(e,t){let{target:n,...r}=e,o={ref:Pt(t)},s=ht();return g.createElement(Ph.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:j8,name:"Popover.Group"}))}let U8=g.createContext(null),W8=nt(R8),_8=nt(z8),V8=Object.assign(W8,{Group:_8});const Si={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function Th(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function H8(e,t,n){let r=pt();if(t.kind==="Tracked"){let o=function(){s!==Th(e)&&(r.dispose(),n())},{position:s}=t,i=new ResizeObserver(o);i.observe(e),r.add(()=>i.disconnect()),r.addEventListener(window,"scroll",o,{passive:!0}),r.addEventListener(window,"resize",o)}return()=>r.dispose()}function G8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function Ah(){let e=G8(),[t,n]=U.useState(Xt.isHandoffComplete);return t&&Xt.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>Xt.handoff(),[]),e?!1:t}function q8(){let e=g.useRef(!1);return Ce(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Nh(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!Jo((t=e.as)!=null?t:Ch)||g.Children.count(e.children)===1}let Pi=g.createContext(null);Pi.displayName="TransitionContext";var K8=(e=>(e.Visible="visible",e.Hidden="hidden",e))(K8||{});function Z8(){let e=g.useContext(Pi);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Y8(){let e=g.useContext(Ti);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Ti=g.createContext(null);Ti.displayName="NestingContext";function Ai(e){return"children"in e?Ai(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Oh(e,t){let n=lr(e),r=g.useRef([]),o=q8(),s=ar(),i=pe((d,h=jn.Hidden)=>{let b=r.current.findIndex(({el:w})=>w===d);b!==-1&&(St(h,{[jn.Unmount](){r.current.splice(b,1)},[jn.Hidden](){r.current[b].state="hidden"}}),s.microTask(()=>{var w;!Ai(r)&&o.current&&((w=n.current)==null||w.call(n))}))}),l=pe(d=>{let h=r.current.find(({el:b})=>b===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,jn.Unmount)}),a=g.useRef([]),c=g.useRef(Promise.resolve()),u=g.useRef({enter:[],leave:[]}),f=pe((d,h,b)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([w])=>w!==d)),t==null||t.chains.current[h].push([d,new Promise(w=>{a.current.push(w)})]),t==null||t.chains.current[h].push([d,new Promise(w=>{Promise.all(u.current[h].map(([T,x])=>x)).then(()=>w())})]),h==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(h)):b(h)}),p=pe((d,h,b)=>{Promise.all(u.current[h].splice(0).map(([w,T])=>T)).then(()=>{var w;(w=a.current.shift())==null||w()}).then(()=>b(h))});return g.useMemo(()=>({children:r,register:l,unregister:i,onStart:f,onStop:p,wait:c,chains:u}),[l,i,r,f,p,u,c])}let Ch=g.Fragment,$h=si.RenderStrategy;function X8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:l,afterLeave:a,enter:c,enterFrom:u,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:b,...w}=e,[T,x]=g.useState(null),E=g.useRef(null),A=Nh(e),k=Pt(...A?[E,t,x]:t===null?[]:[t]),F=(n=w.unmount)==null||n?jn.Unmount:jn.Hidden,{show:L,appear:m,initial:v}=Z8(),[S,I]=g.useState(L?"visible":"hidden"),$=Y8(),{register:C,unregister:D}=$;Ce(()=>C(E),[C,E]),Ce(()=>{if(F===jn.Hidden&&E.current){if(L&&S!=="visible"){I("visible");return}return St(S,{hidden:()=>D(E),visible:()=>C(E)})}},[S,E,C,D,L,F]);let y=Ah();Ce(()=>{if(A&&y&&S==="visible"&&E.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[E,S,y,A]);let O=v&&!m,M=m&&L&&v,P=g.useRef(!1),B=Oh(()=>{P.current||(I("hidden"),D(E))},$),R=pe(te=>{P.current=!0;let me=te?"enter":"leave";B.onStart(E,me,he=>{he==="enter"?s==null||s():he==="leave"&&(l==null||l())})}),z=pe(te=>{let me=te?"enter":"leave";P.current=!1,B.onStop(E,me,he=>{he==="enter"?i==null||i():he==="leave"&&(a==null||a())}),me==="leave"&&!Ai(B)&&(I("hidden"),D(E))});g.useEffect(()=>{A&&o||(R(L),z(L))},[L,A,o]);let W=!(!o||!A||!y||O),[,G]=Mp(W,T,L,{start:R,end:z}),J=zn({ref:k,className:((r=jl(w.className,M&&c,M&&u,G.enter&&c,G.enter&&G.closed&&u,G.enter&&!G.closed&&f,G.leave&&d,G.leave&&!G.closed&&h,G.leave&&G.closed&&b,!G.transition&&L&&p))==null?void 0:r.trim())||void 0,...Ip(G)}),K=0;S==="visible"&&(K|=Ut.Open),S==="hidden"&&(K|=Ut.Closed),L&&S==="hidden"&&(K|=Ut.Opening),!L&&S==="visible"&&(K|=Ut.Closing);let V=ht();return g.createElement(Ti.Provider,{value:B},g.createElement(xh,{value:K},V({ourProps:J,theirProps:w,defaultTag:Ch,features:$h,visible:S==="visible",name:"Transition.Child"})))}function J8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=g.useRef(null),l=Nh(e),a=Pt(...l?[i,t]:t===null?[]:[t]);Ah();let c=Ec();if(n===void 0&&c!==null&&(n=(c&Ut.Open)===Ut.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=g.useState(n?"visible":"hidden"),p=Oh(()=>{n||f("hidden")}),[d,h]=g.useState(!0),b=g.useRef([n]);Ce(()=>{d!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),h(!1))},[b,n]);let w=g.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);Ce(()=>{n?f("visible"):!Ai(p)&&i.current!==null&&f("hidden")},[n,p]);let T={unmount:o},x=pe(()=>{var k;d&&h(!1),(k=e.beforeEnter)==null||k.call(e)}),E=pe(()=>{var k;d&&h(!1),(k=e.beforeLeave)==null||k.call(e)}),A=ht();return g.createElement(Ti.Provider,{value:p},g.createElement(Pi.Provider,{value:w},A({ourProps:{...T,as:g.Fragment,children:g.createElement(Ih,{ref:a,...T,...s,beforeEnter:x,beforeLeave:E})},theirProps:{},defaultTag:g.Fragment,features:$h,visible:u==="visible",name:"Transition"})))}function Q8(e,t){let n=g.useContext(Pi)!==null,r=Ec()!==null;return g.createElement(g.Fragment,null,!n&&r?g.createElement(Sc,{ref:t,...e}):g.createElement(Ih,{ref:t,...e}))}let Sc=nt(J8),Ih=nt(X8),e3=nt(Q8),Pc=Object.assign(Sc,{Child:e3,Root:Sc}),Mh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Dh(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!wn(o))return r;let s=!1;for(let l of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))l.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Mh.test(i)&&(i=i.replace(Mh,"")),i}function t3(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let i=s.getAttribute("aria-label");return typeof i=="string"?i.trim():Dh(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Dh(e).trim()}function n3(e){let t=g.useRef(""),n=g.useRef("");return pe(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=t3(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var r3=Object.defineProperty,o3=(e,t,n)=>t in e?r3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kh=(e,t,n)=>(o3(e,typeof t!="symbol"?t+"":t,n),n),_e=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(_e||{}),_n=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(_n||{}),Ni=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ni||{}),Bh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.SelectOption=5]="SelectOption",e[e.RegisterOptions=6]="RegisterOptions",e[e.UnregisterOptions=7]="UnregisterOptions",e[e.SetButtonElement=8]="SetButtonElement",e[e.SetOptionsElement=9]="SetOptionsElement",e[e.SortOptions=10]="SortOptions",e[e.MarkButtonAsMoved=11]="MarkButtonAsMoved",e))(Bh||{});function Lh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Ep(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let s3={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?Si.Tracked(Th(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:Ne.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:t}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,frozenValue:!1,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1,buttonPositionState:Si.Idle}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let l={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===Ne.Nothing)return{...l,activeOptionIndex:null};if(t.focus===Ne.Specific)return{...l,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===Ne.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=Ei(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...l,activeOptionIndex:p}}}}else if(t.focus===Ne.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=Ei(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...l,activeOptionIndex:p}}}}let a=Lh(e),c=Ei(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...l,...a,activeOptionIndex:c}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var l;return!i.dataRef.current.disabled&&((l=i.dataRef.current.textValue)==null?void 0:l.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5(e){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==Ne.Nothing&&(r=Ei(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:Ne.Nothing},pendingShouldSort:!0}},7:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},8:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},9:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},10:e=>e.pendingShouldSort?{...e,...Lh(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:Si.Moved}}};class Tc extends up{constructor(t){super(t),kh(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return St(s,{0:()=>r==null?void 0:r(n),1:()=>{let l=i.slice(),a=l.findIndex(c=>o(c,n));return a===-1?l.push(n):l.splice(a,1),r==null?void 0:r(l)}})},registerOption:Hl(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:6,options:n.splice(0)}))]}),unregisterOption:Hl(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Hl(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{var n;if(this.state.activeOptionIndex!==null){let{dataRef:r}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(r.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(n=this.state.buttonElement)==null||n.focus({preventScroll:!0}))},selectOption:n=>{this.send({type:5,value:n})},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:8,element:n})},setOptionsElement:n=>{this.send({type:9,element:n})}}),kh(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,r=Gl.get(null);this.disposables.add(r.on(hp.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}this.disposables.group(n=>{this.on(1,r=>{r.buttonElement&&(n.dispose(),n.add(H8(r.buttonElement,r.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(n,r)=>{var o;this.actions.onChange(r.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(o=this.state.buttonElement)==null||o.focus({preventScroll:!0}))})}static new({id:t,__demoMode:n=!1}){return new Tc({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:Ne.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:Si.Idle})}reduce(t,n){return St(n.type,s3,t,n)}}const Fh=g.createContext(null);function Ac(e){let t=g.useContext(Fh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Rh),n}return t}function Rh({id:e,__demoMode:t=!1}){let n=g.useMemo(()=>Tc.new({id:e,__demoMode:t}),[]);return Eh(()=>n.dispose()),n}let Oi=g.createContext(null);Oi.displayName="ListboxDataContext";function is(e){let t=g.useContext(Oi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,is),n}return t}let i3=g.Fragment;function a3(e,t){let n=g.useId(),r=Rl(),{value:o,defaultValue:s,form:i,name:l,onChange:a,by:c,invalid:u=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...b}=e;const w=p?"horizontal":"vertical";let T=Pt(t),x=kx(s),[E=d?[]:void 0,A]=Dx(o,a,x),k=Rh({id:n,__demoMode:h}),F=g.useRef({static:!1,hold:!1}),L=g.useRef(new Map),m=i2(c),v=g.useCallback(W=>St(S.mode,{[_n.Multi]:()=>E.some(G=>m(G,W)),[_n.Single]:()=>m(E,W)}),[E]),S=Rn({value:E,disabled:f,invalid:u,mode:d?_n.Multi:_n.Single,orientation:w,onChange:A,compare:m,isSelected:v,optionsPropsRef:F,listRef:L});Ce(()=>{k.state.dataRef.current=S},[S]);let I=rt(k,W=>W.listboxState),$=Gl.get(null),C=rt($,g.useCallback(W=>$.selectors.isTop(W,n),[$,n])),[D,y]=rt(k,W=>[W.buttonElement,W.optionsElement]);D2(C,[D,y],(W,G)=>{k.send({type:Bh.CloseListbox}),xp(G,Ql.Loose)||(W.preventDefault(),D==null||D.focus())});let O=Rn({open:I===_e.Open,disabled:f,invalid:u,value:E}),[M,P]=e2({inherit:!0}),B={ref:T},R=g.useCallback(()=>{if(x!==void 0)return A==null?void 0:A(x)},[A,x]),z=ht();return g.createElement(P,{value:M,props:{htmlFor:D==null?void 0:D.id},slot:{open:I===_e.Open,disabled:f}},g.createElement(C8,null,g.createElement(Fh.Provider,{value:k},g.createElement(Oi.Provider,{value:S},g.createElement(xh,{value:St(I,{[_e.Open]:Ut.Open,[_e.Closed]:Ut.Closed})},l!=null&&E!=null&&g.createElement(Ux,{disabled:f,data:{[l]:E},form:i,onReset:R}),z({ourProps:B,theirProps:b,slot:O,defaultTag:i3,name:"Listbox"}))))))}let l3="button";function c3(e,t){let n=g.useId(),r=Z0(),o=is("Listbox.Button"),s=Ac("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:l=o.disabled||!1,autoFocus:a=!1,...c}=e,u=Pt(t,T8(),s.actions.setButtonElement),f=A8(),[p,d,h]=rt(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),b=p===_e.Open;L2(b,{trigger:d,action:g.useCallback(y=>{if(d!=null&&d.contains(y.target))return ci.Ignore;let O=y.target.closest('[role="option"]:not([data-disabled])');return wn(O)?ci.Select(O):h!=null&&h.contains(y.target)?ci.Ignore:ci.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let w=pe(y=>{switch(y.key){case je.Enter:Bx(y.currentTarget);break;case je.Space:case je.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?Ne.Nothing:Ne.First});break;case je.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?Ne.Nothing:Ne.Last});break}}),T=pe(y=>{switch(y.key){case je.Space:y.preventDefault();break}}),x=l2(y=>{var O;s.state.listboxState===_e.Open?(Ke.flushSync(()=>s.actions.closeListbox()),(O=s.state.buttonElement)==null||O.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:Ne.Nothing}))}),E=pe(y=>y.preventDefault()),A=op([i]),k=Yx(),{isFocusVisible:F,focusProps:L}=wx({autoFocus:a}),{isHovered:m,hoverProps:v}=yx({isDisabled:l}),{pressed:S,pressProps:I}=Ax({disabled:l}),$=Rn({open:p===_e.Open,active:S||p===_e.Open,disabled:l,invalid:o.invalid,value:o.value,hover:m,focus:F,autofocus:a}),C=rt(s,y=>y.listboxState===_e.Open),D=V0(f(),{ref:u,id:i,type:F2(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":C,"aria-labelledby":A,"aria-describedby":k,disabled:l||void 0,autoFocus:a,onKeyDown:w,onKeyUp:T,onKeyPress:E},x,L,v,I);return ht()({ourProps:D,theirProps:c,slot:$,defaultTag:l3,name:"Listbox.Button"})}let jh=g.createContext(!1),u3="div",f3=si.RenderStrategy|si.Static;function d3(e,t){let n=g.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:l=!1,...a}=e,c=P8(o),[u,f]=g.useState(null);c&&(s=!0);let p=is("Listbox.Options"),d=Ac("Listbox.Options"),[h,b,w,T]=rt(d,V=>[V.listboxState,V.buttonElement,V.optionsElement,V.__demoMode]),x=ec(b),E=ec(w),A=Ec(),[k,F]=Mp(l,u,A!==null?(A&Ut.Open)===Ut.Open:h===_e.Open);x2(k,b,d.actions.closeListbox);let L=T?!1:i&&h===_e.Open;V2(L,E);let m=T?!1:i&&h===_e.Open;v2(m,{allowed:g.useCallback(()=>[b,w],[b,w])});let v=rt(d,d.selectors.didButtonMove)?!1:k,S=rt(d,d.selectors.hasFrozenValue)&&!e.static,I=vh(S,p.value),$=g.useCallback(V=>p.compare(I,V),[p.compare,I]),C=rt(d,V=>{var te;if(c==null||!((te=c==null?void 0:c.to)!=null&&te.includes("selection")))return null;let me=V.options.findIndex(he=>$(he.dataRef.current.value));return me===-1&&(me=0),me}),D=(()=>{if(c==null)return;if(C===null)return{...c,inner:void 0};let V=Array.from(p.listRef.current.values());return{...c,inner:{listRef:{current:V},index:C}}})(),[y,O]=O8(D),M=N8(),P=Pt(t,c?y:null,d.actions.setOptionsElement,f),B=ar();g.useEffect(()=>{let V=w;V&&h===_e.Open&&(Sx(V)||V==null||V.focus({preventScroll:!0}))},[h,w]);let R=pe(V=>{var te;switch(B.dispose(),V.key){case je.Space:if(d.state.searchQuery!=="")return V.preventDefault(),V.stopPropagation(),d.actions.search(V.key);case je.Enter:V.preventDefault(),V.stopPropagation(),d.actions.selectActiveOption();break;case St(p.orientation,{vertical:je.ArrowDown,horizontal:je.ArrowRight}):return V.preventDefault(),V.stopPropagation(),d.actions.goToOption({focus:Ne.Next});case St(p.orientation,{vertical:je.ArrowUp,horizontal:je.ArrowLeft}):return V.preventDefault(),V.stopPropagation(),d.actions.goToOption({focus:Ne.Previous});case je.Home:case je.PageUp:return V.preventDefault(),V.stopPropagation(),d.actions.goToOption({focus:Ne.First});case je.End:case je.PageDown:return V.preventDefault(),V.stopPropagation(),d.actions.goToOption({focus:Ne.Last});case je.Escape:V.preventDefault(),V.stopPropagation(),Ke.flushSync(()=>d.actions.closeListbox()),(te=d.state.buttonElement)==null||te.focus({preventScroll:!0});return;case je.Tab:V.preventDefault(),V.stopPropagation(),Ke.flushSync(()=>d.actions.closeListbox()),C2(d.state.buttonElement,V.shiftKey?Jl.Previous:Jl.Next);break;default:V.key.length===1&&(d.actions.search(V.key),B.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=rt(d,V=>{var te;return(te=V.buttonElement)==null?void 0:te.id}),W=Rn({open:h===_e.Open}),G=V0(c?M():{},{id:r,ref:P,"aria-activedescendant":rt(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===_n.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:R,role:"listbox",tabIndex:h===_e.Open?0:void 0,style:{...a.style,...O,"--button-width":a2(k,b,!0).width},...Ip(F)}),J=ht(),K=g.useMemo(()=>p.mode===_n.Multi?p:{...p,isSelected:$},[p,$]);return g.createElement(V8,{enabled:s?e.static||k:!1,ownerDocument:x},g.createElement(Oi.Provider,{value:K},J({ourProps:G,theirProps:a,slot:W,defaultTag:u3,features:f3,visible:v,name:"Listbox.Options"})))}let p3="div";function h3(e,t){let n=g.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,l=g.useContext(jh)===!0,a=is("Listbox.Option"),c=Ac("Listbox.Option"),u=rt(c,S=>c.selectors.isActive(S,r)),f=a.isSelected(s),p=g.useRef(null),d=n3(p),h=lr({disabled:o,value:s,domRef:p,get textValue(){return d()}}),b=Pt(t,p,S=>{S?a.listRef.current.set(r,S):a.listRef.current.delete(r)}),w=rt(c,S=>c.selectors.shouldScrollIntoView(S,r));Ce(()=>{if(w)return pt().requestAnimationFrame(()=>{var S,I;(I=(S=p.current)==null?void 0:S.scrollIntoView)==null||I.call(S,{block:"nearest"})})},[w,p]),Ce(()=>{if(!l)return c.actions.registerOption(r,h),()=>c.actions.unregisterOption(r)},[h,r,l]);let T=pe(S=>{if(o)return S.preventDefault();c.actions.selectOption(s)}),x=pe(()=>{if(o)return c.actions.goToOption({focus:Ne.Nothing});c.actions.goToOption({focus:Ne.Specific,id:r})}),E=H2(),A=pe(S=>E.update(S)),k=pe(S=>{E.wasMoved(S)&&(o||u&&c.state.activationTrigger===Ni.Pointer||c.actions.goToOption({focus:Ne.Specific,id:r},Ni.Pointer))}),F=pe(S=>{E.wasMoved(S)&&(o||u&&c.state.activationTrigger===Ni.Pointer&&c.actions.goToOption({focus:Ne.Nothing}))}),L=Rn({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&l}),m=l?{}:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:T,onFocus:x,onPointerEnter:A,onMouseEnter:A,onPointerMove:k,onMouseMove:k,onPointerLeave:F,onMouseLeave:F},v=ht();return!f&&l?null:v({ourProps:m,theirProps:i,slot:L,defaultTag:p3,name:"Listbox.Option"})}let m3=g.Fragment;function b3(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Pt(t)},i=is("ListboxSelectedOption"),l=Rn({}),a=i.value===void 0||i.value===null||i.mode===_n.Multi&&Array.isArray(i.value)&&i.value.length===0,c=ht();return g.createElement(jh.Provider,{value:!0},c({ourProps:s,theirProps:{...o,children:g.createElement(g.Fragment,null,r&&a?r:n)},slot:l,defaultTag:m3,name:"ListboxSelectedOption"}))}let g3=nt(a3),y3=nt(c3),w3=o2,v3=nt(d3),x3=nt(h3),E3=nt(b3),Nt=Object.assign(g3,{Button:y3,Label:w3,Options:v3,Option:x3,SelectedOption:E3});const S3=()=>N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_active)",children:N.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_active",children:N.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),P3=()=>N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_inactive)",children:N.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_inactive",children:N.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),as=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return N.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>N.jsx("div",{className:"flex items-center justify-center",children:o>t-e?N.jsx(S3,{}):N.jsx(P3,{})},o))})};class Wt{}hs(Wt,"FAST",3),hs(Wt,"Medium",2),hs(Wt,"SLOW",1),hs(Wt,"NONE",0);const T3=Object.values({MAINNET:1,SEPOLIA:11155111}),Pn=e=>{const t=typeof e=="string"?parseInt(e,10):e;return T3.includes(t)},A3={USDT:!0},zh=(e,t)=>{const n=typeof e=="string"?parseInt(e,10):e;return n===1||n===11155111?!1:(n===42161||n===421614)&&t?t.toUpperCase()==="ETH"?!1:!A3[t.toUpperCase()]:!0},N3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc",accountType:i})=>{const{t:l}=It(),a=c=>i===Me.PERPETUAL&&Pn(c);return N.jsx("div",{className:`relative ${o}`,children:N.jsx(Nt,{value:t,onChange:n,disabled:r,children:({open:c})=>N.jsxs(N.Fragment,{children:[N.jsxs(Nt.Button,{className:`
139
+ */var pE=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],dc=pE.join(","),jp=typeof Element>"u",os=jp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,yi=!jp&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},vi=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):vi(t.parentNode));return i},hE=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},mE=function(t,n,r){if(vi(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(dc));return n&&os.call(t,dc)&&o.unshift(t),o=o.filter(r),o},fc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!vi(i,!1))if(i.tagName==="SLOT"){var l=i.assignedElements(),a=l.length?l:i.children,c=fc(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=os.call(i,dc);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!vi(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&p){var f=fc(d===!0?i.children:d.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else s.unshift.apply(s,i.children)}}return o},zp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Up=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||hE(t))&&!zp(t)?0:t.tabIndex},bE=function(t,n){var r=Up(t);return r<0&&n&&!zp(t)?0:r},gE=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Wp=function(t){return t.tagName==="INPUT"},yE=function(t){return Wp(t)&&t.type==="hidden"},vE=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},wE=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},xE=function(t){if(!t.name)return!0;var n=t.form||yi(t),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=wE(o,t.form);return!s||s===t},EE=function(t){return Wp(t)&&t.type==="radio"},SE=function(t){return EE(t)&&!xE(t)},PE=function(t){var n,r=t&&yi(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,l,a;for(s=!!((i=o)!==null&&i!==void 0&&(l=i.ownerDocument)!==null&&l!==void 0&&l.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var c,u,d;r=yi(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return s},_p=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},TE=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=os.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(os.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var c=t.parentElement,u=yi(t);if(c&&!c.shadowRoot&&o(c)===!0)return _p(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=a}if(PE(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return _p(t);return!1},AE=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return os.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},NE=function(t,n){return!(n.disabled||yE(n)||TE(n,t)||vE(n)||AE(n))},Vp=function(t,n){return!(SE(n)||Up(n)<0||!NE(t,n))},CE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Hp=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,l=i?o.scopeParent:o,a=bE(l,i),c=i?Hp(o.candidates):l;a===0?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:c})}),r.sort(gE).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Gp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=fc([t],n.includeContainer,{filter:Vp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:CE}):r=mE(t,n.includeContainer,Vp.bind(null,n)),Hp(r)};function qp(e,t,n){let{reference:r,floating:o}=e;const s=Sn(t),i=cc(t),l=lc(i),a=Wn(t),c=s==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[l]/2-o[l]/2;let f;switch(a){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(_r(t)){case"start":f[i]-=p*(n&&c?-1:1);break;case"end":f[i]+=p*(n&&c?-1:1);break}return f}async function Kp(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=dr(t,e),h=Rp(f),x=l[p?d==="floating"?"reference":"floating":d],T=gi(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),w=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),A=await(s.isElement==null?void 0:s.isElement(P))?await(s.getScale==null?void 0:s.getScale(P))||{x:1,y:1}:{x:1,y:1},k=gi(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:P,strategy:a}):w);return{top:(T.top-k.top+h.top)/A.y,bottom:(k.bottom-T.bottom+h.bottom)/A.y,left:(T.left-k.left+h.left)/A.x,right:(k.right-T.right+h.right)/A.x}}const OE=50,$E=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:Kp},a=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=qp(c,r,a),p=r,f=0;const h={};for(let m=0;m<s.length;m++){const x=s[m];if(!x)continue;const{name:T,fn:w}=x,{x:P,y:A,data:k,reset:B}=await w({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:c,platform:l,elements:{reference:e,floating:t}});u=P??u,d=A??d,h[T]={...h[T],...k},B&&f<OE&&(f++,typeof B=="object"&&(B.placement&&(p=B.placement),B.rects&&(c=B.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):B.rects),{x:u,y:d}=qp(c,p,a)),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:h}},IE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:a}=t,{element:c,padding:u=0}=dr(e,t)||{};if(c==null)return{};const d=Rp(u),p={x:n,y:r},f=cc(o),h=lc(f),m=await i.getDimensions(c),x=f==="y",T=x?"top":"left",w=x?"bottom":"right",P=x?"clientHeight":"clientWidth",A=s.reference[h]+s.reference[f]-p[f]-s.floating[h],k=p[f]-s.reference[f],B=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let F=B?B[P]:0;(!F||!await(i.isElement==null?void 0:i.isElement(B)))&&(F=l.floating[P]||s.floating[h]);const b=A/2-k/2,v=F/2-m[h]/2-1,E=En(d[T],v),I=En(d[w],v),$=E,C=F-m[h]-I,D=F/2-m[h]/2+b,y=ac($,D,C),O=!a.arrow&&_r(o)!=null&&D!==y&&s.reference[h]/2-(D<$?E:I)-m[h]/2<0,M=O?D<$?D-$:D-C:0;return{[f]:p[f]+M,data:{[f]:y,centerOffset:D-y-M,...O&&{alignmentOffset:M}},reset:O}}}),ME=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...x}=dr(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const T=Wn(o),w=Sn(l),P=Wn(l)===l,A=await(a.isRTL==null?void 0:a.isRTL(c.floating)),k=p||(P||!m?[bi(l)]:aE(l)),B=h!=="none";!p&&B&&k.push(...dE(l,m,h,A));const F=[l,...k],b=await a.detectOverflow(t,x),v=[];let E=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&v.push(b[T]),d){const D=iE(o,i,A);v.push(b[D[0]],b[D[1]])}if(E=[...E,{placement:o,overflows:v}],!v.every(D=>D<=0)){var I,$;const D=(((I=s.flip)==null?void 0:I.index)||0)+1,y=F[D];if(y&&(!(d==="alignment"?w!==Sn(y):!1)||E.every(S=>Sn(S.placement)===w?S.overflows[0]>0:!0)))return{data:{index:D,overflows:E},reset:{placement:y}};let O=($=E.filter(M=>M.overflows[0]<=0).sort((M,S)=>M.overflows[1]-S.overflows[1])[0])==null?void 0:$.placement;if(!O)switch(f){case"bestFit":{var C;const M=(C=E.filter(S=>{if(B){const L=Sn(S.placement);return L===w||L==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(L=>L>0).reduce((L,j)=>L+j,0)]).sort((S,L)=>S[1]-L[1])[0])==null?void 0:C[0];M&&(O=M);break}case"initialPlacement":O=l;break}if(o!==O)return{reset:{placement:O}}}return{}}}},DE=new Set(["left","top"]);async function kE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Wn(n),l=_r(n),a=Sn(n)==="y",c=DE.has(i)?-1:1,u=s&&a?-1:1,d=dr(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof h=="number"&&(f=l==="end"?h*-1:h),a?{x:f*u,y:p*c}:{x:p*c,y:f*u}}const LE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,a=await kE(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},BE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:T=>{let{x:w,y:P}=T;return{x:w,y:P}}},...c}=dr(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),p=Sn(Wn(o)),f=Lp(p);let h=u[f],m=u[p];if(i){const T=f==="y"?"top":"left",w=f==="y"?"bottom":"right",P=h+d[T],A=h-d[w];h=ac(P,h,A)}if(l){const T=p==="y"?"top":"left",w=p==="y"?"bottom":"right",P=m+d[T],A=m-d[w];m=ac(P,m,A)}const x=a.fn({...t,[f]:h,[p]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[f]:i,[p]:l}}}}}},FE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:a=()=>{},...c}=dr(e,t),u=await i.detectOverflow(t,c),d=Wn(o),p=_r(o),f=Sn(o)==="y",{width:h,height:m}=s.floating;let x,T;d==="top"||d==="bottom"?(x=d,T=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(T=d,x=p==="end"?"top":"bottom");const w=m-u.top-u.bottom,P=h-u.left-u.right,A=En(m-u[x],w),k=En(h-u[T],P),B=!t.middlewareData.shift;let F=A,b=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(b=P),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=w),B&&!p){const E=We(u.left,0),I=We(u.right,0),$=We(u.top,0),C=We(u.bottom,0);f?b=h-2*(E!==0||I!==0?E+I:We(u.left,u.right)):F=m-2*($!==0||C!==0?$+C:We(u.top,u.bottom))}await a({...t,availableWidth:b,availableHeight:F});const v=await i.getDimensions(l.floating);return h!==v.width||m!==v.height?{reset:{rects:!0}}:{}}}};function Zp(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=st(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=rs(n)!==s||rs(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function pc(e){return be(e)?e:e.contextElement}function Vr(e){const t=pc(e);if(!st(t))return en(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Zp(t);let i=(s?rs(n.width):n.width)/r,l=(s?rs(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const RE=en(0);function Yp(e){const t=ot(e);return!pi()||!t.visualViewport?RE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ot(e)?!1:t}function fr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=pc(e);let i=en(1);t&&(r?be(r)&&(i=Vr(r)):i=Vr(e));const l=jE(s,n,r)?Yp(s):en(0);let a=(o.left+l.x)/i.x,c=(o.top+l.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(s){const p=ot(s),f=r&&be(r)?ot(r):r;let h=p,m=ic(h);for(;m&&r&&f!==h;){const x=Vr(m),T=m.getBoundingClientRect(),w=At(m),P=T.left+(m.clientLeft+parseFloat(w.paddingLeft))*x.x,A=T.top+(m.clientTop+parseFloat(w.paddingTop))*x.y;a*=x.x,c*=x.y,u*=x.x,d*=x.y,a+=P,c+=A,h=ot(m),m=ic(h)}}return gi({width:u,height:d,x:a,y:c})}function wi(e,t){const n=hi(e).scrollLeft;return t?t.left+n:fr(Qt(e)).left+n}function Xp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-wi(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function zE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Qt(r),l=t?fi(t.floating):!1;if(r===i||l&&s)return n;let a={scrollLeft:0,scrollTop:0},c=en(1);const u=en(0),d=st(r);if((d||!d&&!s)&&((Wr(r)!=="body"||ns(i))&&(a=hi(r)),d)){const f=fr(r);c=Vr(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const p=i&&!d&&!s?Xp(i,a):en(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-a.scrollTop*c.y+u.y+p.y}}function UE(e){return Array.from(e.getClientRects())}function WE(e){const t=Qt(e),n=hi(e),r=e.ownerDocument.body,o=We(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=We(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+wi(e);const l=-n.scrollTop;return At(r).direction==="rtl"&&(i+=We(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Jp=25;function _E(e,t){const n=ot(e),r=Qt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,a=0;if(o){s=o.width,i=o.height;const u=pi();(!u||u&&t==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=wi(r);if(c<=0){const u=r.ownerDocument,d=u.body,p=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-d.clientWidth-f);h<=Jp&&(s-=h)}else c<=Jp&&(s+=c);return{width:s,height:i,x:l,y:a}}function VE(e,t){const n=fr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=st(e)?Vr(e):en(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,a=o*s.x,c=r*s.y;return{width:i,height:l,x:a,y:c}}function Qp(e,t,n){let r;if(t==="viewport")r=_E(e,n);else if(t==="document")r=WE(Qt(e));else if(be(t))r=VE(t,n);else{const o=Yp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return gi(r)}function eh(e,t){const n=xn(e);return n===t||!be(n)||wn(n)?!1:At(n).position==="fixed"||eh(n,t)}function HE(e,t){const n=t.get(e);if(n)return n;let r=Un(e,[],!1).filter(l=>be(l)&&Wr(l)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?xn(e):e;for(;be(i)&&!wn(i);){const l=At(i),a=sc(i);!a&&l.position==="fixed"&&(o=null),(s?!a&&!o:!a&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||ns(i)&&!a&&eh(e,i))?r=r.filter(u=>u!==i):o=l,i=xn(i)}return t.set(e,r),r}function GE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?fi(t)?[]:HE(t,this._c):[].concat(n),r],l=Qp(t,i[0],o);let a=l.top,c=l.right,u=l.bottom,d=l.left;for(let p=1;p<i.length;p++){const f=Qp(t,i[p],o);a=We(f.top,a),c=En(f.right,c),u=En(f.bottom,u),d=We(f.left,d)}return{width:c-d,height:u-a,x:d,y:a}}function qE(e){const{width:t,height:n}=Zp(e);return{width:t,height:n}}function KE(e,t,n){const r=st(t),o=Qt(t),s=n==="fixed",i=fr(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=en(0);function c(){a.x=wi(o)}if(r||!r&&!s)if((Wr(t)!=="body"||ns(o))&&(l=hi(t)),r){const f=fr(t,!0,s,t);a.x=f.x+t.clientLeft,a.y=f.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?Xp(o,l):en(0),d=i.left+l.scrollLeft-a.x-u.x,p=i.top+l.scrollTop-a.y-u.y;return{x:d,y:p,width:i.width,height:i.height}}function hc(e){return At(e).position==="static"}function th(e,t){if(!st(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qt(e)===n&&(n=n.ownerDocument.body),n}function nh(e,t){const n=ot(e);if(fi(e))return n;if(!st(e)){let o=xn(e);for(;o&&!wn(o);){if(be(o)&&!hc(o))return o;o=xn(o)}return n}let r=th(e,t);for(;r&&eE(r)&&hc(r);)r=th(r,t);return r&&wn(r)&&hc(r)&&!sc(r)?n:r||rE(e)||n}const ZE=async function(e){const t=this.getOffsetParent||nh,n=this.getDimensions,r=await n(e.floating);return{reference:KE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function YE(e){return At(e).direction==="rtl"}const XE={convertOffsetParentRelativeRectToViewportRelativeRect:zE,getDocumentElement:Qt,getClippingRect:GE,getOffsetParent:nh,getElementRects:ZE,getClientRects:UE,getDimensions:qE,getScale:Vr,isElement:be,isRTL:YE};function rh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function JE(e,t){let n=null,r;const o=Qt(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:f}=c;if(l||t(),!p||!f)return;const h=mi(d),m=mi(o.clientWidth-(u+p)),x=mi(o.clientHeight-(d+f)),T=mi(u),P={rootMargin:-h+"px "+-m+"px "+-x+"px "+-T+"px",threshold:We(0,En(1,a))||1};let A=!0;function k(B){const F=B[0].intersectionRatio;if(F!==a){if(!A)return i();F?i(!1,F):r=setTimeout(()=>{i(!1,1e-7)},1e3)}F===1&&!rh(c,e.getBoundingClientRect())&&i(),A=!1}try{n=new IntersectionObserver(k,{...P,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,P)}n.observe(e)}return i(!0),s}function oh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=pc(e),u=o||s?[...c?Un(c):[],...t?Un(t):[]]:[];u.forEach(T=>{o&&T.addEventListener("scroll",n,{passive:!0}),s&&T.addEventListener("resize",n)});const d=c&&l?JE(c,n):null;let p=-1,f=null;i&&(f=new ResizeObserver(T=>{let[w]=T;w&&w.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var P;(P=f)==null||P.observe(t)})),n()}),c&&!a&&f.observe(c),t&&f.observe(t));let h,m=a?fr(e):null;a&&x();function x(){const T=fr(e);m&&!rh(m,T)&&n(),m=T,h=requestAnimationFrame(x)}return n(),()=>{var T;u.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),d==null||d(),(T=f)==null||T.disconnect(),f=null,a&&cancelAnimationFrame(h)}}const mc=Kp,QE=LE,e8=BE,t8=ME,n8=FE,sh=IE,r8=(e,t,n)=>{const r=new Map,o={platform:XE,...n},s={...o.platform,_c:r};return $E(e,t,{...o,platform:s})};var o8=typeof document<"u",s8=function(){},xi=o8?g.useLayoutEffect:s8;function Ei(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 n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ei(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ei(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function ih(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ah(e,t){const n=ih(e);return Math.round(t*n)/n}function bc(e){const t=U.useRef(e);return xi(()=>{t.current=e}),t}function lh(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:a,open:c}=e,[u,d]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=U.useState(r);Ei(p,r)||f(r);const[h,m]=U.useState(null),[x,T]=U.useState(null),w=U.useCallback(S=>{S!==B.current&&(B.current=S,m(S))},[]),P=U.useCallback(S=>{S!==F.current&&(F.current=S,T(S))},[]),A=s||h,k=i||x,B=U.useRef(null),F=U.useRef(null),b=U.useRef(u),v=a!=null,E=bc(a),I=bc(o),$=bc(c),C=U.useCallback(()=>{if(!B.current||!F.current)return;const S={placement:t,strategy:n,middleware:p};I.current&&(S.platform=I.current),r8(B.current,F.current,S).then(L=>{const j={...L,isPositioned:$.current!==!1};D.current&&!Ei(b.current,j)&&(b.current=j,Qr.flushSync(()=>{d(j)}))})},[p,t,n,I,$]);xi(()=>{c===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,d(S=>({...S,isPositioned:!1})))},[c]);const D=U.useRef(!1);xi(()=>(D.current=!0,()=>{D.current=!1}),[]),xi(()=>{if(A&&(B.current=A),k&&(F.current=k),A&&k){if(E.current)return E.current(A,k,C);C()}},[A,k,C,E,v]);const y=U.useMemo(()=>({reference:B,floating:F,setReference:w,setFloating:P}),[w,P]),O=U.useMemo(()=>({reference:A,floating:k}),[A,k]),M=U.useMemo(()=>{const S={position:n,left:0,top:0};if(!O.floating)return S;const L=ah(O.floating,u.x),j=ah(O.floating,u.y);return l?{...S,transform:"translate("+L+"px, "+j+"px)",...ih(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:j}},[n,l,O.floating,u.x,u.y]);return U.useMemo(()=>({...u,update:C,refs:y,elements:O,floatingStyles:M}),[u,C,y,O,M])}const i8=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?sh({element:r.current,padding:o}).fn(n):{}:r?sh({element:r,padding:o}).fn(n):{}}}},gc=(e,t)=>{const n=QE(e);return{name:n.name,fn:n.fn,options:[e,t]}},ch=(e,t)=>{const n=e8(e);return{name:n.name,fn:n.fn,options:[e,t]}},uh=(e,t)=>{const n=t8(e);return{name:n.name,fn:n.fn,options:[e,t]}},a8=(e,t)=>{const n=n8(e);return{name:n.name,fn:n.fn,options:[e,t]}},l8=(e,t)=>{const n=i8(e);return{name:n.name,fn:n.fn,options:[e,t]}},dh={...U},c8=dh.useInsertionEffect||(e=>e());function fh(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return c8(()=>{t.current=e}),U.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var yc=typeof document<"u"?g.useLayoutEffect:g.useEffect;let ph=!1,u8=0;const hh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+u8++;function d8(){const[e,t]=U.useState(()=>ph?hh():void 0);return yc(()=>{e==null&&t(hh())},[]),U.useEffect(()=>{ph=!0},[]),e}const f8=dh.useId||d8;let ss;process.env.NODE_ENV!=="production"&&(ss=new Set);function p8(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=ss)!=null&&e.has(o))){var s;(s=ss)==null||s.add(o),console.warn(o)}}function h8(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=ss)!=null&&e.has(o))){var s;(s=ss)==null||s.add(o),console.error(o)}}function m8(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const b8=U.createContext(null),g8=U.createContext(null),y8=()=>{var e;return((e=U.useContext(b8))==null?void 0:e.id)||null},v8=()=>U.useContext(g8),w8="data-floating-ui-focusable";function x8(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=f8(),s=U.useRef({}),[i]=U.useState(()=>m8()),l=y8()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!be(f)&&h8("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=fh((f,h,m)=>{s.current.openEvent=f?h:void 0,i.emit("openchange",{open:f,event:h,reason:m,nested:l}),n==null||n(f,h,m)}),d=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:d}),[t,u,p,i,o,d])}function E8(e){e===void 0&&(e={});const{nodeId:t}=e,n=x8({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,d=U.useRef(null),p=v8();yc(()=>{u&&(d.current=u)},[u]);const f=lh({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(P=>{const A=be(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;a(A),f.refs.setReference(A)},[f.refs]),m=U.useCallback(P=>{(be(P)||P===null)&&(d.current=P,i(P)),(be(f.refs.reference.current)||f.refs.reference.current===null||P!==null&&!be(P))&&f.refs.setReference(P)},[f.refs]),x=U.useMemo(()=>({...f.refs,setReference:m,setPositionReference:h,domReference:d}),[f.refs,m,h]),T=U.useMemo(()=>({...f.elements,domReference:u}),[f.elements,u]),w=U.useMemo(()=>({...f,...r,refs:x,elements:T,nodeId:t}),[f,x,T,t,r]);return yc(()=>{r.dataRef.current.floatingContext=w;const P=p==null?void 0:p.nodesRef.current.find(A=>A.id===t);P&&(P.context=w)}),U.useMemo(()=>({...f,context:w,refs:x,elements:T}),[f,x,T,w])}const mh="active",bh="selected";function vc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[mh]:i,[bh]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[w8]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[mh,bh].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),i[c]=function(){for(var p,f=arguments.length,h=new Array(f),m=0;m<f;m++)h[m]=arguments[m];return(p=r.get(c))==null?void 0:p.map(x=>x(...h)).find(x=>x!==void 0)}}}else i[c]=u}),i),{})}}function S8(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>vc(l,e,"reference"),t),s=U.useCallback(l=>vc(l,e,"floating"),n),i=U.useCallback(l=>vc(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function gh(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const P8=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:l=4,referenceOverflowThreshold:a=0,scrollRef:c,...u}=dr(e,t),{rects:d,elements:{floating:p}}=t,f=n.current[i],h=(c==null?void 0:c.current)||p,m=p.clientTop||h.clientTop,x=p.clientTop!==0,T=h.clientTop!==0,w=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||p8('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const P={...t,...await gc(-f.offsetTop-p.clientTop-d.reference.height/2-f.offsetHeight/2-s).fn(t)},A=await mc(gh(P,h.scrollHeight+m+p.clientTop),u),k=await mc(P,{...u,elementContext:"reference"}),B=We(0,A.top),F=P.y+B,E=(h.scrollHeight>h.clientHeight?I=>I:rs)(We(0,h.scrollHeight+(x&&w||T?m*2:0)-B-We(0,A.bottom)));if(h.style.maxHeight=E+"px",h.scrollTop=B,o){const I=h.offsetHeight<f.offsetHeight*En(l,n.current.length)-1||k.top>=-a||k.bottom>=-a;Qr.flushSync(()=>o(I))}return r&&(r.current=await mc(gh({...P,y:F},h.offsetHeight+m+p.clientTop),u)),{y:F}}});function T8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:l}=t,a=fh(l),c=U.useRef(!1),u=U.useRef(null),d=U.useRef(null);U.useEffect(()=>{if(!o)return;function f(m){if(m.ctrlKey||!h||s.current==null)return;const x=m.deltaY,T=s.current.top>=-.5,w=s.current.bottom>=-.5,P=h.scrollHeight-h.clientHeight,A=x<0?-1:1,k=x<0?"max":"min";h.scrollHeight<=h.clientHeight||(!T&&x>0||!w&&x<0?(m.preventDefault(),Qr.flushSync(()=>{a(B=>B+Math[k](x,P*A))})):/firefox/i.test(oE())&&(h.scrollTop+=x))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",f),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(d.current={...s.current})}),()=>{u.current=null,d.current=null,h.removeEventListener("wheel",f)}},[o,n,r.floating,s,i,a]);const p=U.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const f=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!f||!c.current)){if(u.current!==null){const h=f.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Qr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{u.current=f.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:p}:{},[o,p])}let Hr=g.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Hr.displayName="FloatingContext";let wc=g.createContext(null);wc.displayName="PlacementContext";function A8(e){return g.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function N8(){return g.useContext(Hr).setReference}function C8(){return g.useContext(Hr).getReferenceProps}function O8(){let{getFloatingProps:e,slot:t}=g.useContext(Hr);return g.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function $8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=g.useContext(wc),n=g.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);$e(()=>{t==null||t(n??null)},[t,n]);let r=g.useContext(Hr);return g.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let yh=4;function I8({children:e,enabled:t=!0}){let[n,r]=g.useState(null),[o,s]=g.useState(0),i=g.useRef(null),[l,a]=g.useState(null);M8(l);let c=t&&n!==null&&l!==null,{to:u="bottom",gap:d=0,offset:p=0,padding:f=0,inner:h}=D8(n,l),[m,x="center"]=u.split(" ");$e(()=>{c&&s(0)},[c]);let{refs:T,floatingStyles:w,context:P}=E8({open:c,placement:m==="selection"?x==="center"?"bottom":`bottom-${x}`:x==="center"?`${m}`:`${m}-${x}`,strategy:"absolute",transform:!1,middleware:[gc({mainAxis:m==="selection"?0:d,crossAxis:p}),ch({padding:f}),m!=="selection"&&uh({padding:f}),m==="selection"&&h?P8({...h,padding:f,overflowRef:i,offset:o,minItemsVisible:yh,referenceOverflowThreshold:f,onFallbackChange(I){var $,C;if(!I)return;let D=P.elements.floating;if(!D)return;let y=parseFloat(getComputedStyle(D).scrollPaddingBottom)||0,O=Math.min(yh,D.childElementCount),M=0,S=0;for(let L of(C=($=P.elements.floating)==null?void 0:$.childNodes)!=null?C:[])if(vn(L)){let j=L.offsetTop,z=j+L.clientHeight+y,W=D.scrollTop,_=W+D.clientHeight;if(j>=W&&z<=_)O--;else{S=Math.max(0,Math.min(z,_)-Math.max(j,W)),M=L.clientHeight;break}}O>=1&&s(L=>{let j=M*O-S+y;return L>=j?L:j})}}):null,a8({padding:f,apply({availableWidth:I,availableHeight:$,elements:C}){Object.assign(C.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${$}px)`})}})].filter(Boolean),whileElementsMounted:oh}),[A=m,k=x]=P.placement.split("-");m==="selection"&&(A="selection");let B=g.useMemo(()=>({anchor:[A,k].filter(Boolean).join(" ")}),[A,k]),F=T8(P,{overflowRef:i,onChange:s}),{getReferenceProps:b,getFloatingProps:v}=S8([F]),E=he(I=>{a(I),T.setFloating(I)});return U.createElement(wc.Provider,{value:r},U.createElement(Hr.Provider,{value:{setFloating:E,setReference:T.setReference,styles:w,getReferenceProps:b,getFloatingProps:v,slot:B}},e))}function M8(e){$e(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function D8(e,t){var n,r,o;let s=xc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=xc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),l=xc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:l}}function xc(e,t,n=void 0){let r=ar(),o=he((a,c)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!c)return[n,null];let u=wh(a,c);return[u,d=>{let p=vh(a);{let f=p.map(h=>window.getComputedStyle(c).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[T,w]of p.entries()){let P=window.getComputedStyle(c).getPropertyValue(w);if(f[T]!==P){f[T]=P,m=!0;break}}if(!m)return;let x=wh(a,c);u!==x&&(d(x),u=x)})}return r.dispose}]}return[n,null]}),s=g.useMemo(()=>o(e,t)[0],[e,t]),[i=s,l]=g.useState();return $e(()=>{let[a,c]=o(e,t);if(l(a),!!c)return c(l)},[e,t]),i}function vh(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...vh(o)]:[r]}return[]}function wh(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function k8({children:e,freeze:t},n){let r=xh(t,e);return g.isValidElement(r)?g.cloneElement(r,{ref:n}):g.createElement(g.Fragment,null,r)}g.forwardRef(k8);function xh(e,t){let[n,r]=g.useState(t);return!e&&n!==t&&r(t),e?n:t}let Ec=g.createContext(null);Ec.displayName="OpenClosedContext";var Ut=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ut||{});function Sc(){return g.useContext(Ec)}function Eh({value:e,children:t}){return g.createElement(Ec.Provider,{value:e},t)}function L8(e){throw new Error("Unexpected object: "+e)}var Ce=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Ce||{});function Si(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:L8(e)}}function Sh(e){let t=he(e),n=g.useRef(!1);g.useEffect(()=>(n.current=!1,()=>{n.current=!0,_0(()=>{n.current&&t()})}),[t])}let B8=g.createContext(!1);function F8(){return g.useContext(B8)}function R8(e){let t=F8(),n=g.useContext(Th),[r,o]=g.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Xt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let l=e.createElement("div");return l.setAttribute("id","headlessui-portal-root"),e.body.appendChild(l)});return g.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),g.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Ph=g.Fragment,j8=nt(function(e,t){let{ownerDocument:n=null,...r}=e,o=g.useRef(null),s=Pt(X5(p=>{o.current=p}),t),i=tc(o.current),l=n??i,a=R8(l),c=g.useContext(_8),u=ar(),d=ht();return Sh(()=>{var p;a&&a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a))}),a?Ke.createPortal(g.createElement("div",{"data-headlessui-portal":"",ref:p=>{u.dispose(),c&&p&&u.add(c.register(p))}},d({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Ph,name:"Portal"})),a):null});function z8(e,t){let n=Pt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=ht();return r?g.createElement(j8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Ph,name:"Portal"})}let U8=g.Fragment,Th=g.createContext(null);function W8(e,t){let{target:n,...r}=e,o={ref:Pt(t)},s=ht();return g.createElement(Th.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:U8,name:"Popover.Group"}))}let _8=g.createContext(null),V8=nt(z8),H8=nt(W8),G8=Object.assign(V8,{Group:H8});const Pi={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function Ah(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function q8(e,t,n){let r=pt();if(t.kind==="Tracked"){let o=function(){s!==Ah(e)&&(r.dispose(),n())},{position:s}=t,i=new ResizeObserver(o);i.observe(e),r.add(()=>i.disconnect()),r.addEventListener(window,"scroll",o,{passive:!0}),r.addEventListener(window,"resize",o)}return()=>r.dispose()}function K8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function Nh(){let e=K8(),[t,n]=U.useState(Xt.isHandoffComplete);return t&&Xt.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>Xt.handoff(),[]),e?!1:t}function Z8(){let e=g.useRef(!1);return $e(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ch(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!Jo((t=e.as)!=null?t:$h)||g.Children.count(e.children)===1}let Ti=g.createContext(null);Ti.displayName="TransitionContext";var Y8=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Y8||{});function X8(){let e=g.useContext(Ti);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function J8(){let e=g.useContext(Ai);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Ai=g.createContext(null);Ai.displayName="NestingContext";function Ni(e){return"children"in e?Ni(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Oh(e,t){let n=lr(e),r=g.useRef([]),o=Z8(),s=ar(),i=he((f,h=jn.Hidden)=>{let m=r.current.findIndex(({el:x})=>x===f);m!==-1&&(St(h,{[jn.Unmount](){r.current.splice(m,1)},[jn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var x;!Ni(r)&&o.current&&((x=n.current)==null||x.call(n))}))}),l=he(f=>{let h=r.current.find(({el:m})=>m===f);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:f,state:"visible"}),()=>i(f,jn.Unmount)}),a=g.useRef([]),c=g.useRef(Promise.resolve()),u=g.useRef({enter:[],leave:[]}),d=he((f,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([x])=>x!==f)),t==null||t.chains.current[h].push([f,new Promise(x=>{a.current.push(x)})]),t==null||t.chains.current[h].push([f,new Promise(x=>{Promise.all(u.current[h].map(([T,w])=>w)).then(()=>x())})]),h==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=he((f,h,m)=>{Promise.all(u.current[h].splice(0).map(([x,T])=>T)).then(()=>{var x;(x=a.current.shift())==null||x()}).then(()=>m(h))});return g.useMemo(()=>({children:r,register:l,unregister:i,onStart:d,onStop:p,wait:c,chains:u}),[l,i,r,d,p,u,c])}let $h=g.Fragment,Ih=ii.RenderStrategy;function Q8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:l,afterLeave:a,enter:c,enterFrom:u,enterTo:d,entered:p,leave:f,leaveFrom:h,leaveTo:m,...x}=e,[T,w]=g.useState(null),P=g.useRef(null),A=Ch(e),k=Pt(...A?[P,t,w]:t===null?[]:[t]),B=(n=x.unmount)==null||n?jn.Unmount:jn.Hidden,{show:F,appear:b,initial:v}=X8(),[E,I]=g.useState(F?"visible":"hidden"),$=J8(),{register:C,unregister:D}=$;$e(()=>C(P),[C,P]),$e(()=>{if(B===jn.Hidden&&P.current){if(F&&E!=="visible"){I("visible");return}return St(E,{hidden:()=>D(P),visible:()=>C(P)})}},[E,P,C,D,F,B]);let y=Nh();$e(()=>{if(A&&y&&E==="visible"&&P.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[P,E,y,A]);let O=v&&!b,M=b&&F&&v,S=g.useRef(!1),L=Oh(()=>{S.current||(I("hidden"),D(P))},$),j=he(ee=>{S.current=!0;let fe=ee?"enter":"leave";L.onStart(P,fe,me=>{me==="enter"?s==null||s():me==="leave"&&(l==null||l())})}),z=he(ee=>{let fe=ee?"enter":"leave";S.current=!1,L.onStop(P,fe,me=>{me==="enter"?i==null||i():me==="leave"&&(a==null||a())}),fe==="leave"&&!Ni(L)&&(I("hidden"),D(P))});g.useEffect(()=>{A&&o||(j(F),z(F))},[F,A,o]);let W=!(!o||!A||!y||O),[,_]=Dp(W,T,F,{start:j,end:z}),Z=zn({ref:k,className:((r=zl(x.className,M&&c,M&&u,_.enter&&c,_.enter&&_.closed&&u,_.enter&&!_.closed&&d,_.leave&&f,_.leave&&!_.closed&&h,_.leave&&_.closed&&m,!_.transition&&F&&p))==null?void 0:r.trim())||void 0,...Mp(_)}),q=0;E==="visible"&&(q|=Ut.Open),E==="hidden"&&(q|=Ut.Closed),F&&E==="hidden"&&(q|=Ut.Opening),!F&&E==="visible"&&(q|=Ut.Closing);let H=ht();return g.createElement(Ai.Provider,{value:L},g.createElement(Eh,{value:q},H({ourProps:Z,theirProps:x,defaultTag:$h,features:Ih,visible:E==="visible",name:"Transition.Child"})))}function eS(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=g.useRef(null),l=Ch(e),a=Pt(...l?[i,t]:t===null?[]:[t]);Nh();let c=Sc();if(n===void 0&&c!==null&&(n=(c&Ut.Open)===Ut.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,d]=g.useState(n?"visible":"hidden"),p=Oh(()=>{n||d("hidden")}),[f,h]=g.useState(!0),m=g.useRef([n]);$e(()=>{f!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let x=g.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);$e(()=>{n?d("visible"):!Ni(p)&&i.current!==null&&d("hidden")},[n,p]);let T={unmount:o},w=he(()=>{var k;f&&h(!1),(k=e.beforeEnter)==null||k.call(e)}),P=he(()=>{var k;f&&h(!1),(k=e.beforeLeave)==null||k.call(e)}),A=ht();return g.createElement(Ai.Provider,{value:p},g.createElement(Ti.Provider,{value:x},A({ourProps:{...T,as:g.Fragment,children:g.createElement(Mh,{ref:a,...T,...s,beforeEnter:w,beforeLeave:P})},theirProps:{},defaultTag:g.Fragment,features:Ih,visible:u==="visible",name:"Transition"})))}function tS(e,t){let n=g.useContext(Ti)!==null,r=Sc()!==null;return g.createElement(g.Fragment,null,!n&&r?g.createElement(Pc,{ref:t,...e}):g.createElement(Mh,{ref:t,...e}))}let Pc=nt(eS),Mh=nt(Q8),nS=nt(tS),Tc=Object.assign(Pc,{Child:nS,Root:Pc}),Dh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function kh(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!vn(o))return r;let s=!1;for(let l of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))l.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Dh.test(i)&&(i=i.replace(Dh,"")),i}function rS(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let i=s.getAttribute("aria-label");return typeof i=="string"?i.trim():kh(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return kh(e).trim()}function oS(e){let t=g.useRef(""),n=g.useRef("");return he(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=rS(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var sS=Object.defineProperty,iS=(e,t,n)=>t in e?sS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lh=(e,t,n)=>(iS(e,typeof t!="symbol"?t+"":t,n),n),_e=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(_e||{}),_n=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(_n||{}),Ci=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ci||{}),Bh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.SelectOption=5]="SelectOption",e[e.RegisterOptions=6]="RegisterOptions",e[e.UnregisterOptions=7]="UnregisterOptions",e[e.SetButtonElement=8]="SetButtonElement",e[e.SetOptionsElement=9]="SetOptionsElement",e[e.SortOptions=10]="SortOptions",e[e.MarkButtonAsMoved=11]="MarkButtonAsMoved",e))(Bh||{});function Fh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Sp(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let aS={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?Pi.Tracked(Ah(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:Ce.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:t}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,frozenValue:!1,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1,buttonPositionState:Pi.Idle}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let l={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===Ce.Nothing)return{...l,activeOptionIndex:null};if(t.focus===Ce.Specific)return{...l,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===Ce.Previous){let u=e.activeOptionIndex;if(u!==null){let d=e.options[u].dataRef.current.domRef,p=Si(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(p!==null){let f=e.options[p].dataRef.current.domRef;if(((r=d.current)==null?void 0:r.previousElementSibling)===f.current||((o=f.current)==null?void 0:o.previousElementSibling)===null)return{...l,activeOptionIndex:p}}}}else if(t.focus===Ce.Next){let u=e.activeOptionIndex;if(u!==null){let d=e.options[u].dataRef.current.domRef,p=Si(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(p!==null){let f=e.options[p].dataRef.current.domRef;if(((s=d.current)==null?void 0:s.nextElementSibling)===f.current||((i=f.current)==null?void 0:i.nextElementSibling)===null)return{...l,activeOptionIndex:p}}}}let a=Fh(e),c=Si(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...l,...a,activeOptionIndex:c}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var l;return!i.dataRef.current.disabled&&((l=i.dataRef.current.textValue)==null?void 0:l.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5(e){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==Ce.Nothing&&(r=Si(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:Ce.Nothing},pendingShouldSort:!0}},7:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},8:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},9:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},10:e=>e.pendingShouldSort?{...e,...Fh(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:Pi.Moved}}};class Ac extends dp{constructor(t){super(t),Lh(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return St(s,{0:()=>r==null?void 0:r(n),1:()=>{let l=i.slice(),a=l.findIndex(c=>o(c,n));return a===-1?l.push(n):l.splice(a,1),r==null?void 0:r(l)}})},registerOption:Gl(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:6,options:n.splice(0)}))]}),unregisterOption:Gl(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Gl(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{var n;if(this.state.activeOptionIndex!==null){let{dataRef:r}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(r.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(n=this.state.buttonElement)==null||n.focus({preventScroll:!0}))},selectOption:n=>{this.send({type:5,value:n})},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:8,element:n})},setOptionsElement:n=>{this.send({type:9,element:n})}}),Lh(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,r=ql.get(null);this.disposables.add(r.on(mp.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}this.disposables.group(n=>{this.on(1,r=>{r.buttonElement&&(n.dispose(),n.add(q8(r.buttonElement,r.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(n,r)=>{var o;this.actions.onChange(r.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(o=this.state.buttonElement)==null||o.focus({preventScroll:!0}))})}static new({id:t,__demoMode:n=!1}){return new Ac({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:Ce.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:Pi.Idle})}reduce(t,n){return St(n.type,aS,t,n)}}const Rh=g.createContext(null);function Nc(e){let t=g.useContext(Rh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,jh),n}return t}function jh({id:e,__demoMode:t=!1}){let n=g.useMemo(()=>Ac.new({id:e,__demoMode:t}),[]);return Sh(()=>n.dispose()),n}let Oi=g.createContext(null);Oi.displayName="ListboxDataContext";function is(e){let t=g.useContext(Oi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,is),n}return t}let lS=g.Fragment;function cS(e,t){let n=g.useId(),r=jl(),{value:o,defaultValue:s,form:i,name:l,onChange:a,by:c,invalid:u=!1,disabled:d=r||!1,horizontal:p=!1,multiple:f=!1,__demoMode:h=!1,...m}=e;const x=p?"horizontal":"vertical";let T=Pt(t),w=B5(s),[P=f?[]:void 0,A]=L5(o,a,w),k=jh({id:n,__demoMode:h}),B=g.useRef({static:!1,hold:!1}),F=g.useRef(new Map),b=l2(c),v=g.useCallback(W=>St(E.mode,{[_n.Multi]:()=>P.some(_=>b(_,W)),[_n.Single]:()=>b(P,W)}),[P]),E=Rn({value:P,disabled:d,invalid:u,mode:f?_n.Multi:_n.Single,orientation:x,onChange:A,compare:b,isSelected:v,optionsPropsRef:B,listRef:F});$e(()=>{k.state.dataRef.current=E},[E]);let I=rt(k,W=>W.listboxState),$=ql.get(null),C=rt($,g.useCallback(W=>$.selectors.isTop(W,n),[$,n])),[D,y]=rt(k,W=>[W.buttonElement,W.optionsElement]);L2(C,[D,y],(W,_)=>{k.send({type:Bh.CloseListbox}),Ep(_,ec.Loose)||(W.preventDefault(),D==null||D.focus())});let O=Rn({open:I===_e.Open,disabled:d,invalid:u,value:P}),[M,S]=n2({inherit:!0}),L={ref:T},j=g.useCallback(()=>{if(w!==void 0)return A==null?void 0:A(w)},[A,w]),z=ht();return g.createElement(S,{value:M,props:{htmlFor:D==null?void 0:D.id},slot:{open:I===_e.Open,disabled:d}},g.createElement(I8,null,g.createElement(Rh.Provider,{value:k},g.createElement(Oi.Provider,{value:E},g.createElement(Eh,{value:St(I,{[_e.Open]:Ut.Open,[_e.Closed]:Ut.Closed})},l!=null&&P!=null&&g.createElement(_5,{disabled:d,data:{[l]:P},form:i,onReset:j}),z({ourProps:L,theirProps:m,slot:O,defaultTag:lS,name:"Listbox"}))))))}let uS="button";function dS(e,t){let n=g.useId(),r=Y0(),o=is("Listbox.Button"),s=Nc("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:l=o.disabled||!1,autoFocus:a=!1,...c}=e,u=Pt(t,N8(),s.actions.setButtonElement),d=C8(),[p,f,h]=rt(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),m=p===_e.Open;R2(m,{trigger:f,action:g.useCallback(y=>{if(f!=null&&f.contains(y.target))return ui.Ignore;let O=y.target.closest('[role="option"]:not([data-disabled])');return vn(O)?ui.Select(O):h!=null&&h.contains(y.target)?ui.Ignore:ui.Close},[f,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let x=he(y=>{switch(y.key){case je.Enter:F5(y.currentTarget);break;case je.Space:case je.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?Ce.Nothing:Ce.First});break;case je.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?Ce.Nothing:Ce.Last});break}}),T=he(y=>{switch(y.key){case je.Space:y.preventDefault();break}}),w=u2(y=>{var O;s.state.listboxState===_e.Open?(Ke.flushSync(()=>s.actions.closeListbox()),(O=s.state.buttonElement)==null||O.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:Ce.Nothing}))}),P=he(y=>y.preventDefault()),A=sp([i]),k=J5(),{isFocusVisible:B,focusProps:F}=x5({autoFocus:a}),{isHovered:b,hoverProps:v}=w5({isDisabled:l}),{pressed:E,pressProps:I}=C5({disabled:l}),$=Rn({open:p===_e.Open,active:E||p===_e.Open,disabled:l,invalid:o.invalid,value:o.value,hover:b,focus:B,autofocus:a}),C=rt(s,y=>y.listboxState===_e.Open),D=H0(d(),{ref:u,id:i,type:j2(e,f),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":C,"aria-labelledby":A,"aria-describedby":k,disabled:l||void 0,autoFocus:a,onKeyDown:x,onKeyUp:T,onKeyPress:P},w,F,v,I);return ht()({ourProps:D,theirProps:c,slot:$,defaultTag:uS,name:"Listbox.Button"})}let zh=g.createContext(!1),fS="div",pS=ii.RenderStrategy|ii.Static;function hS(e,t){let n=g.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:l=!1,...a}=e,c=A8(o),[u,d]=g.useState(null);c&&(s=!0);let p=is("Listbox.Options"),f=Nc("Listbox.Options"),[h,m,x,T]=rt(f,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),w=tc(m),P=tc(x),A=Sc(),[k,B]=Dp(l,u,A!==null?(A&Ut.Open)===Ut.Open:h===_e.Open);S2(k,m,f.actions.closeListbox);let F=T?!1:i&&h===_e.Open;G2(F,P);let b=T?!1:i&&h===_e.Open;E2(b,{allowed:g.useCallback(()=>[m,x],[m,x])});let v=rt(f,f.selectors.didButtonMove)?!1:k,E=rt(f,f.selectors.hasFrozenValue)&&!e.static,I=xh(E,p.value),$=g.useCallback(H=>p.compare(I,H),[p.compare,I]),C=rt(f,H=>{var ee;if(c==null||!((ee=c==null?void 0:c.to)!=null&&ee.includes("selection")))return null;let fe=H.options.findIndex(me=>$(me.dataRef.current.value));return fe===-1&&(fe=0),fe}),D=(()=>{if(c==null)return;if(C===null)return{...c,inner:void 0};let H=Array.from(p.listRef.current.values());return{...c,inner:{listRef:{current:H},index:C}}})(),[y,O]=$8(D),M=O8(),S=Pt(t,c?y:null,f.actions.setOptionsElement,d),L=ar();g.useEffect(()=>{let H=x;H&&h===_e.Open&&(T5(H)||H==null||H.focus({preventScroll:!0}))},[h,x]);let j=he(H=>{var ee;switch(L.dispose(),H.key){case je.Space:if(f.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),f.actions.search(H.key);case je.Enter:H.preventDefault(),H.stopPropagation(),f.actions.selectActiveOption();break;case St(p.orientation,{vertical:je.ArrowDown,horizontal:je.ArrowRight}):return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:Ce.Next});case St(p.orientation,{vertical:je.ArrowUp,horizontal:je.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:Ce.Previous});case je.Home:case je.PageUp:return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:Ce.First});case je.End:case je.PageDown:return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:Ce.Last});case je.Escape:H.preventDefault(),H.stopPropagation(),Ke.flushSync(()=>f.actions.closeListbox()),(ee=f.state.buttonElement)==null||ee.focus({preventScroll:!0});return;case je.Tab:H.preventDefault(),H.stopPropagation(),Ke.flushSync(()=>f.actions.closeListbox()),I2(f.state.buttonElement,H.shiftKey?Ql.Previous:Ql.Next);break;default:H.key.length===1&&(f.actions.search(H.key),L.setTimeout(()=>f.actions.clearSearch(),350));break}}),z=rt(f,H=>{var ee;return(ee=H.buttonElement)==null?void 0:ee.id}),W=Rn({open:h===_e.Open}),_=H0(c?M():{},{id:r,ref:S,"aria-activedescendant":rt(f,f.selectors.activeDescendantId),"aria-multiselectable":p.mode===_n.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:j,role:"listbox",tabIndex:h===_e.Open?0:void 0,style:{...a.style,...O,"--button-width":c2(k,m,!0).width},...Mp(B)}),Z=ht(),q=g.useMemo(()=>p.mode===_n.Multi?p:{...p,isSelected:$},[p,$]);return g.createElement(G8,{enabled:s?e.static||k:!1,ownerDocument:w},g.createElement(Oi.Provider,{value:q},Z({ourProps:_,theirProps:a,slot:W,defaultTag:fS,features:pS,visible:v,name:"Listbox.Options"})))}let mS="div";function bS(e,t){let n=g.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,l=g.useContext(zh)===!0,a=is("Listbox.Option"),c=Nc("Listbox.Option"),u=rt(c,E=>c.selectors.isActive(E,r)),d=a.isSelected(s),p=g.useRef(null),f=oS(p),h=lr({disabled:o,value:s,domRef:p,get textValue(){return f()}}),m=Pt(t,p,E=>{E?a.listRef.current.set(r,E):a.listRef.current.delete(r)}),x=rt(c,E=>c.selectors.shouldScrollIntoView(E,r));$e(()=>{if(x)return pt().requestAnimationFrame(()=>{var E,I;(I=(E=p.current)==null?void 0:E.scrollIntoView)==null||I.call(E,{block:"nearest"})})},[x,p]),$e(()=>{if(!l)return c.actions.registerOption(r,h),()=>c.actions.unregisterOption(r)},[h,r,l]);let T=he(E=>{if(o)return E.preventDefault();c.actions.selectOption(s)}),w=he(()=>{if(o)return c.actions.goToOption({focus:Ce.Nothing});c.actions.goToOption({focus:Ce.Specific,id:r})}),P=q2(),A=he(E=>P.update(E)),k=he(E=>{P.wasMoved(E)&&(o||u&&c.state.activationTrigger===Ci.Pointer||c.actions.goToOption({focus:Ce.Specific,id:r},Ci.Pointer))}),B=he(E=>{P.wasMoved(E)&&(o||u&&c.state.activationTrigger===Ci.Pointer&&c.actions.goToOption({focus:Ce.Nothing}))}),F=Rn({active:u,focus:u,selected:d,disabled:o,selectedOption:d&&l}),b=l?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:T,onFocus:w,onPointerEnter:A,onMouseEnter:A,onPointerMove:k,onMouseMove:k,onPointerLeave:B,onMouseLeave:B},v=ht();return!d&&l?null:v({ourProps:b,theirProps:i,slot:F,defaultTag:mS,name:"Listbox.Option"})}let gS=g.Fragment;function yS(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Pt(t)},i=is("ListboxSelectedOption"),l=Rn({}),a=i.value===void 0||i.value===null||i.mode===_n.Multi&&Array.isArray(i.value)&&i.value.length===0,c=ht();return g.createElement(zh.Provider,{value:!0},c({ourProps:s,theirProps:{...o,children:g.createElement(g.Fragment,null,r&&a?r:n)},slot:l,defaultTag:gS,name:"ListboxSelectedOption"}))}let vS=nt(cS),wS=nt(dS),xS=i2,ES=nt(hS),SS=nt(bS),PS=nt(yS),Nt=Object.assign(vS,{Button:wS,Label:xS,Options:ES,Option:SS,SelectedOption:PS});const TS=()=>N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_active)",children:N.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_active",children:N.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),AS=()=>N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_inactive)",children:N.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_inactive",children:N.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),as=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return N.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>N.jsx("div",{className:"flex items-center justify-center",children:o>t-e?N.jsx(TS,{}):N.jsx(AS,{})},o))})};class Wt{}ms(Wt,"FAST",3),ms(Wt,"Medium",2),ms(Wt,"SLOW",1),ms(Wt,"NONE",0);const NS=Object.values({MAINNET:1,SEPOLIA:11155111}),Pn=e=>{const t=typeof e=="string"?parseInt(e,10):e;return NS.includes(t)},CS={USDT:!0},Uh=(e,t)=>{const n=typeof e=="string"?parseInt(e,10):e;return n===1||n===11155111?!1:(n===42161||n===421614)&&t?t.toUpperCase()==="ETH"?!1:!CS[t.toUpperCase()]:!0},OS=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc",accountType:i,showChainSpeed:l=!0})=>{const{t:a}=It(),c=u=>i===Ne.PERPETUAL&&Pn(u);return N.jsx("div",{className:`relative ${o}`,children:N.jsx(Nt,{value:t,onChange:n,disabled:r,children:({open:u})=>N.jsxs(N.Fragment,{children:[N.jsxs(Nt.Button,{className:`
140
140
  relative w-full h-9 text-text-primary bg-fill-input-primary
141
141
  items-center justify-between flex px-3 rounded-lg
142
142
  focus:outline-hidden
143
143
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
144
- ${c?"ring-1 ring-white":""}
145
- `,children:[N.jsx("span",{className:"text-sm leading-[18px] font-medium",children:l("deposit.chain")}),N.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?N.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):N.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:N.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),N.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),N.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${c?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:N.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_12919_27745",children:N.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),N.jsx(Pc,{as:g.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:N.jsx(Nt.Options,{className:`
144
+ ${u?"ring-1 ring-white":""}
145
+ `,children:[N.jsx("span",{className:"text-sm leading-[18px] font-medium",children:a("deposit.chain")}),N.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?N.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):N.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:N.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),N.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),N.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${u?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:N.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_12919_27745",children:N.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),N.jsx(Tc,{as:g.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:N.jsx(Nt.Options,{className:`
146
146
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
147
147
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
148
148
  focus:outline-hidden
149
- `,children:e.filter(u=>u[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(u=>N.jsx(Nt.Option,{value:u,className:({active:f,selected:p})=>`relative cursor-pointer select-none py-3 px-3 ${p?"bg-fill-btn-secondary":f?"bg-fill-input-secondary":""}`,children:({selected:f,active:p})=>N.jsx(N.Fragment,{children:N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsxs("div",{className:"flex items-center space-x-3",children:[u.chainIconUrl?N.jsx("img",{src:u.chainIconUrl,alt:u.chain,className:"w-5 h-5 rounded-full"}):N.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:N.jsx("span",{className:"text-xs text-white font-bold",children:u.chain.charAt(0)})}),N.jsx("div",{className:"flex flex-col",children:N.jsx("span",{className:`text-sm font-medium ${f||p?"text-text-primary":"text-text-tertiary"}`,children:u.chain})})]}),N.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:N.jsx(as,{className:"w-full justify-between",selectedLevel:a(u.chainId)?Wt.SLOW:Wt.FAST,maxLevel:3})})]})})},u.chainId))})})]})})})},O3=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s,accountType:i})=>{const{t:l}=It(),a=c=>c.token||c.symbol;return N.jsx("div",{className:`relative ${o}`,children:N.jsx(Nt,{value:t,onChange:n,disabled:r,children:({open:c})=>N.jsxs(N.Fragment,{children:[N.jsxs(Nt.Button,{className:`
149
+ `,children:e.filter(d=>d[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(d=>N.jsx(Nt.Option,{value:d,className:({active:p,selected:f})=>`relative cursor-pointer select-none py-3 px-3 ${f?"bg-fill-btn-secondary":p?"bg-fill-input-secondary":""}`,children:({selected:p,active:f})=>N.jsx(N.Fragment,{children:N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsxs("div",{className:"flex items-center space-x-3",children:[d.chainIconUrl?N.jsx("img",{src:d.chainIconUrl,alt:d.chain,className:"w-5 h-5 rounded-full"}):N.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:N.jsx("span",{className:"text-xs text-white font-bold",children:d.chain.charAt(0)})}),N.jsx("div",{className:"flex flex-col",children:N.jsx("span",{className:`text-sm font-medium ${p||f?"text-text-primary":"text-text-tertiary"}`,children:d.chain})})]}),l&&N.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:N.jsx(as,{className:"w-full justify-between",selectedLevel:c(d.chainId)?Wt.SLOW:Wt.FAST,maxLevel:3})})]})})},d.chainId))})})]})})})},$S=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s,accountType:i})=>{const{t:l}=It(),a=c=>c.token||c.symbol;return N.jsx("div",{className:`relative ${o}`,children:N.jsx(Nt,{value:t,onChange:n,disabled:r,children:({open:c})=>N.jsxs(N.Fragment,{children:[N.jsxs(Nt.Button,{className:`
150
150
  relative w-full h-9 text-text-primary bg-fill-input-primary
151
151
  items-center justify-between flex px-3 rounded-lg
152
152
  focus:outline-hidden
153
153
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
154
154
  ${c?"ring-1 ring-white":""}
155
- `,children:[N.jsx("span",{className:"text-sm leading-[18px] font-medium",children:l("deposit.asset")}),N.jsxs("div",{className:"flex items-center space-x-2",children:[N.jsx("img",{src:t.iconUrl,alt:a(t),className:"w-4 h-4 rounded-full"}),N.jsx("span",{className:"text-sm text-white ml-1",children:a(t)}),N.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${c?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:N.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_asset_selector",children:N.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),N.jsx(Pc,{as:g.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:N.jsx(Nt.Options,{className:`
155
+ `,children:[N.jsx("span",{className:"text-sm leading-[18px] font-medium",children:l("deposit.asset")}),N.jsxs("div",{className:"flex items-center space-x-2",children:[N.jsx("img",{src:t.iconUrl,alt:a(t),className:"w-4 h-4 rounded-full"}),N.jsx("span",{className:"text-sm text-white ml-1",children:a(t)}),N.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${c?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:N.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_asset_selector",children:N.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),N.jsx(Tc,{as:g.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:N.jsx(Nt.Options,{className:`
156
156
  absolute z-50 mt-1 w-full max-h-[230px] overflow-y-auto rounded-lg
157
157
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
158
158
  focus:outline-hidden
159
- `,children:e.map(u=>N.jsx(Nt.Option,{value:u,className:({active:f,selected:p})=>`relative cursor-pointer select-none py-3 px-3 ${p?"bg-fill-btn-secondary":f?"bg-fill-input-secondary":""}`,children:({selected:f,active:p})=>N.jsxs("div",{className:"flex items-center space-x-3",children:[N.jsx("img",{src:u.iconUrl,alt:a(u),className:"w-5 h-5 rounded-full"}),N.jsxs("div",{className:"flex flex-col",children:[N.jsx("span",{className:`text-sm font-medium ${f||p?"text-text-primary":"text-text-tertiary"}`,children:a(u)}),s===gn&&i==="perpetual"&&u.token==="USDC"&&N.jsx("p",{className:"mt-2 text-xs text-text-tertiary whitespace-pre-line",children:l("deposit.defaultSpotNotice")})]})]})},a(u)))})})]})})})},Uh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=gn,txType:i="deposit",accountType:l})=>{const a=g.useCallback(w=>i==="withdraw"?s===gn?w.allowAaWithdraw!==!1:w.allowWithdraw!==!1:s===gn?w.allowAaDeposit!==!1:w.allowDeposit!==!1,[i,s]),c=g.useMemo(()=>{const w=new Set,T=[];for(const x of t)if(a(x))for(const E of x.tokenList||[]){const A=E.symbol||E.token;!A||!(i!=="withdraw"||E.withdrawEnable===!0&&E.pullOff!==!0)||w.has(A)||(w.add(A),T.push({token:A,symbol:A,iconUrl:E.iconUrl,decimals:E.decimals,tokenAddress:E.tokenAddress}))}return T},[t,a,i]),u=w=>{n(w.chainId)},f=w=>{const T=w.symbol||w.token;o(T);const x=[];for(const E of t){if(!a(E))continue;(E.tokenList||[]).some(k=>(k.symbol||k.token)===T)&&x.push(E.chainId)}!x.includes(e.chainId)&&x[0]!==void 0&&n(x[0])},p=g.useMemo(()=>{var x,E;const w=r||((x=c[0])==null?void 0:x.symbol)||((E=c[0])==null?void 0:E.token);if(!w)return[];const T=[];for(const A of t){if(!a(A))continue;const k=(A.tokenList||[]).find(F=>(F.symbol||F.token)===w?i==="withdraw"?F.withdrawEnable===!0&&F.pullOff!==!0:!0:!1);k&&T.push({...A,tokenList:[{token:k.token,symbol:k.symbol,iconUrl:k.iconUrl,decimals:k.decimals,tokenAddress:k.tokenAddress}]})}return T},[t,r,c,a,i]),d=g.useMemo(()=>p.find(w=>w.chainId===e.chainId)||p[0],[p,e.chainId]),h=g.useMemo(()=>c,[c]),b=g.useMemo(()=>{if(h.length!==0)return h.find(w=>w.token===r||w.symbol===r)||h[0]},[h,r]);return g.useEffect(()=>{if(h.length===0)return;if(!h.some(T=>(T.symbol||T.token)===r)){const T=h[0];o(T.symbol||T.token)}},[h,r,o]),g.useEffect(()=>{if(p.length===0)return;p.some(T=>T.chainId===e.chainId)||n(p[0].chainId)},[p,e.chainId,n]),N.jsxs("div",{className:"space-y-4",children:[h.length>0&&b&&N.jsx(O3,{tokens:h,selectedToken:b,onTokenChange:f,walletType:s,accountType:l}),N.jsx(N3,{chains:p,selectedChain:d,onChainChange:w=>{const T=t.find(x=>x.chainId===w.chainId);T&&u(T)},walletType:s,accountType:l,className:"w-full"})]})},C3=({options:e})=>N.jsx(N.Fragment,{children:e.map(t=>N.jsx(Nt.Option,{value:t.value,className:({active:n,selected:r})=>`relative cursor-pointer select-none py-3 px-3 ${r?"bg-fill-btn-secondary":n?"bg-fill-input-secondary":""}`,children:({selected:n,active:r})=>N.jsx("div",{className:"flex items-center justify-between",children:N.jsx("div",{className:"flex items-center space-x-3",children:N.jsx("div",{className:"flex flex-col",children:N.jsx("span",{className:`text-sm font-medium ${n||r?"text-text-primary":"text-text-tertiary"}`,children:t.label})})})})},t.value))}),Wh=({selectedAccount:e,onAccountChange:t,options:n,disabled:r=!1,className:o=""})=>{var d;const{t:s}=It(),i=g.useMemo(()=>[{value:"spot",label:s("account.spot")},{value:"perpetual",label:s("account.perp")}],[s]),l=n&&n.length>0?n:i,a=((d=l.find(h=>h.value===(e??"spot")))==null?void 0:d.label)||"",[c,u]=g.useState(e??"spot"),f=e??c,p=h=>{t==null||t(h),e||u(h)};return N.jsx("div",{className:`relative mb-4 ${o}`,children:N.jsx(Nt,{value:f,onChange:p,disabled:r,children:({open:h})=>N.jsxs(N.Fragment,{children:[N.jsxs(Nt.Button,{className:`
159
+ `,children:e.map(u=>N.jsx(Nt.Option,{value:u,className:({active:d,selected:p})=>`relative cursor-pointer select-none py-3 px-3 ${p?"bg-fill-btn-secondary":d?"bg-fill-input-secondary":""}`,children:({selected:d,active:p})=>N.jsxs("div",{className:"flex items-center space-x-3",children:[N.jsx("img",{src:u.iconUrl,alt:a(u),className:"w-5 h-5 rounded-full"}),N.jsxs("div",{className:"flex flex-col",children:[N.jsx("span",{className:`text-sm font-medium ${d||p?"text-text-primary":"text-text-tertiary"}`,children:a(u)}),s===gn&&i==="perpetual"&&u.token==="USDC"&&N.jsx("p",{className:"mt-2 text-xs text-text-tertiary whitespace-pre-line",children:l("deposit.defaultSpotNotice")})]})]})},a(u)))})})]})})})},IS=e=>e.map((t,n)=>({asset:t,index:n})).sort((t,n)=>{const r=t.asset.coinId,o=n.asset.coinId;if(r&&o){const s=r.localeCompare(o,void 0,{numeric:!0});if(s!==0)return s}return t.index-n.index}).map(({asset:t})=>t),Wh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=gn,txType:i="deposit",accountType:l,showChainSpeed:a=!0})=>{const c=g.useCallback(T=>i==="withdraw"?s===gn?T.allowAaWithdraw!==!1:T.allowWithdraw!==!1:s===gn?T.allowAaDeposit!==!1:T.allowDeposit!==!1,[i,s]),u=g.useMemo(()=>{const T=new Set,w=[];for(const P of t)if(c(P))for(const A of P.tokenList||[]){const k=A.symbol||A.token;!k||!(i!=="withdraw"||A.withdrawEnable===!0&&A.pullOff!==!0)||T.has(k)||(T.add(k),w.push({token:k,symbol:k,iconUrl:A.iconUrl,decimals:A.decimals,tokenAddress:A.tokenAddress,coinId:A.coinId}))}return IS(w)},[t,c,i]),d=T=>{n(T.chainId)},p=T=>{const w=T.symbol||T.token;o(w);const P=[];for(const A of t){if(!c(A))continue;(A.tokenList||[]).some(B=>(B.symbol||B.token)===w)&&P.push(A.chainId)}!P.includes(e.chainId)&&P[0]!==void 0&&n(P[0])},f=g.useMemo(()=>{var P,A;const T=r||((P=u[0])==null?void 0:P.symbol)||((A=u[0])==null?void 0:A.token);if(!T)return[];const w=[];for(const k of t){if(!c(k))continue;const B=(k.tokenList||[]).find(F=>(F.symbol||F.token)===T?i==="withdraw"?F.withdrawEnable===!0&&F.pullOff!==!0:!0:!1);B&&w.push({...k,tokenList:[{token:B.token,symbol:B.symbol,iconUrl:B.iconUrl,decimals:B.decimals,tokenAddress:B.tokenAddress}]})}return w},[t,r,u,c,i]),h=g.useMemo(()=>f.find(T=>T.chainId===e.chainId)||f[0],[f,e.chainId]),m=g.useMemo(()=>u,[u]),x=g.useMemo(()=>{if(m.length!==0)return m.find(T=>T.token===r||T.symbol===r)||m[0]},[m,r]);return g.useEffect(()=>{if(m.length===0)return;if(!m.some(w=>(w.symbol||w.token)===r)){const w=m[0];o(w.symbol||w.token)}},[m,r,o]),g.useEffect(()=>{if(f.length===0)return;f.some(w=>w.chainId===e.chainId)||n(f[0].chainId)},[f,e.chainId,n]),N.jsxs("div",{className:"space-y-4",children:[m.length>0&&x&&N.jsx($S,{tokens:m,selectedToken:x,onTokenChange:p,walletType:s,accountType:l}),N.jsx(OS,{chains:f,selectedChain:h,onChainChange:T=>{const w=t.find(P=>P.chainId===T.chainId);w&&d(w)},walletType:s,accountType:l,showChainSpeed:a,className:"w-full"})]})},MS=({options:e})=>N.jsx(N.Fragment,{children:e.map(t=>N.jsx(Nt.Option,{value:t.value,className:({active:n,selected:r})=>`relative cursor-pointer select-none py-3 px-3 ${r?"bg-fill-btn-secondary":n?"bg-fill-input-secondary":""}`,children:({selected:n,active:r})=>N.jsx("div",{className:"flex items-center justify-between",children:N.jsx("div",{className:"flex items-center space-x-3",children:N.jsx("div",{className:"flex flex-col",children:N.jsx("span",{className:`text-sm font-medium ${n||r?"text-text-primary":"text-text-tertiary"}`,children:t.label})})})})},t.value))}),_h=({selectedAccount:e,onAccountChange:t,options:n,disabled:r=!1,className:o=""})=>{var f;const{t:s}=It(),i=g.useMemo(()=>[{value:"spot",label:s("account.spot")},{value:"perpetual",label:s("account.perp")}],[s]),l=n&&n.length>0?n:i,a=((f=l.find(h=>h.value===(e??"spot")))==null?void 0:f.label)||"",[c,u]=g.useState(e??"spot"),d=e??c,p=h=>{t==null||t(h),e||u(h)};return N.jsx("div",{className:`relative mb-4 ${o}`,children:N.jsx(Nt,{value:d,onChange:p,disabled:r,children:({open:h})=>N.jsxs(N.Fragment,{children:[N.jsxs(Nt.Button,{className:`
160
160
  relative w-full h-9 text-text-primary bg-fill-input-primary
161
161
  items-center justify-between flex px-3 rounded-lg
162
162
  focus:outline-hidden
163
163
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
164
164
  ${h?"ring-1 ring-white":""}
165
- `,children:[N.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("account.title")}),N.jsxs("div",{className:"flex items-center space-x-2",children:[N.jsx("span",{className:"text-sm text-white ml-1",children:a}),N.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${h?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:N.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_asset_selector",children:N.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),N.jsx(Pc,{as:g.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:N.jsx(Nt.Options,{className:`
165
+ `,children:[N.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("account.title")}),N.jsxs("div",{className:"flex items-center space-x-2",children:[N.jsx("span",{className:"text-sm text-white ml-1",children:a}),N.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${h?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:N.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_asset_selector",children:N.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),N.jsx(Tc,{as:g.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:N.jsx(Nt.Options,{className:`
166
166
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
167
167
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
168
168
  focus:outline-hidden
169
- `,children:N.jsx(C3,{options:l})})})]})})})};var Ci={},$3=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));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||n.forEach(function(o){e.addRange(o)}),t&&t.focus()}},I3=$3,_h={"text/plain":"Text","text/html":"Url",default:"Text"},M3="Copy to clipboard: #{key}, Enter";function D3(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function k3(e,t){var n,r,o,s,i,l,a=!1;t||(t={}),n=t.debug||!1;try{o=I3(),s=document.createRange(),i=document.getSelection(),l=document.createElement("span"),l.textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=_h[t.format]||_h.default;window.clipboardData.setData(f,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(l),s.selectNodeContents(l),i.addRange(s);var c=document.execCommand("copy");if(!c)throw new Error("copy command was unsuccessful");a=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(f){n&&console.error("unable to copy using clipboardData: ",f),n&&console.error("falling back to prompt"),r=D3("message"in t?t.message:M3),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),l&&document.body.removeChild(l),o()}return a}var B3=k3;Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.CopyToClipboard=void 0;var L3=Vh(B3),$i=Vh(g),F3=["text","onCopy","options","children"];function Vh(e){return e&&e.__esModule?e:{default:e}}function Gr(e){"@babel/helpers - typeof";return Gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gr(e)}function Hh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Gh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Hh(Object(n),!0).forEach(function(r){Oc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function R3(e,t){if(e==null)return{};var n,r,o=j3(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function j3(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function z3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U3(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Kh(r.key),r)}}function W3(e,t,n){return t&&U3(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _3(e,t,n){return t=Ii(t),V3(e,qh()?Reflect.construct(t,n||[],Ii(e).constructor):t.apply(e,n))}function V3(e,t){if(t&&(Gr(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return H3(e)}function H3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qh(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qh=function(){return!!e})()}function Ii(e){return Ii=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ii(e)}function G3(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Nc(e,t)}function Nc(e,t){return Nc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Nc(e,t)}function Oc(e,t,n){return(t=Kh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kh(e){var t=q3(e,"string");return Gr(t)=="symbol"?t:t+""}function q3(e,t){if(Gr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var K3=Ci.CopyToClipboard=function(e){function t(){var n;z3(this,t);for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=_3(this,t,[].concat(o)),Oc(n,"onClick",function(i){var l=n.props,a=l.text,c=l.onCopy,u=l.children,f=l.options,p=$i.default.Children.only(u),d=(0,L3.default)(a,f);c&&c(a,d),p!=null&&p.props&&typeof p.props.onClick=="function"&&p.props.onClick(i)}),n}return G3(t,e),W3(t,[{key:"render",value:function(){var r=this.props;r.text,r.onCopy,r.options;var o=r.children,s=R3(r,F3),i=$i.default.Children.only(o);return $i.default.cloneElement(i,Gh(Gh({},s),{},{onClick:this.onClick}))}}])}($i.default.PureComponent);Oc(K3,"defaultProps",{onCopy:void 0,options:void 0});var Z3=Ci,Cc=Z3.CopyToClipboard;Cc.CopyToClipboard=Cc;var Y3=Cc;const X3=eb(Y3);var J3=Object.defineProperty,Mi=Object.getOwnPropertySymbols,Zh=Object.prototype.hasOwnProperty,Yh=Object.prototype.propertyIsEnumerable,Xh=(e,t,n)=>t in e?J3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$c=(e,t)=>{for(var n in t||(t={}))Zh.call(t,n)&&Xh(e,n,t[n]);if(Mi)for(var n of Mi(t))Yh.call(t,n)&&Xh(e,n,t[n]);return e},Ic=(e,t)=>{var n={};for(var r in e)Zh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mi)for(var r of Mi(e))t.indexOf(r)<0&&Yh.call(e,r)&&(n[r]=e[r]);return n};/**
169
+ `,children:N.jsx(MS,{options:l})})})]})})})};var $i={},DS=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));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||n.forEach(function(o){e.addRange(o)}),t&&t.focus()}},kS=DS,Vh={"text/plain":"Text","text/html":"Url",default:"Text"},LS="Copy to clipboard: #{key}, Enter";function BS(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function FS(e,t){var n,r,o,s,i,l,a=!1;t||(t={}),n=t.debug||!1;try{o=kS(),s=document.createRange(),i=document.getSelection(),l=document.createElement("span"),l.textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=Vh[t.format]||Vh.default;window.clipboardData.setData(d,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(l),s.selectNodeContents(l),i.addRange(s);var c=document.execCommand("copy");if(!c)throw new Error("copy command was unsuccessful");a=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(d){n&&console.error("unable to copy using clipboardData: ",d),n&&console.error("falling back to prompt"),r=BS("message"in t?t.message:LS),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),l&&document.body.removeChild(l),o()}return a}var RS=FS;Object.defineProperty($i,"__esModule",{value:!0}),$i.CopyToClipboard=void 0;var jS=Hh(RS),Ii=Hh(g),zS=["text","onCopy","options","children"];function Hh(e){return e&&e.__esModule?e:{default:e}}function Gr(e){"@babel/helpers - typeof";return Gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gr(e)}function Gh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function qh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gh(Object(n),!0).forEach(function(r){Oc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function US(e,t){if(e==null)return{};var n,r,o=WS(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function WS(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function _S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VS(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Zh(r.key),r)}}function HS(e,t,n){return t&&VS(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function GS(e,t,n){return t=Mi(t),qS(e,Kh()?Reflect.construct(t,n||[],Mi(e).constructor):t.apply(e,n))}function qS(e,t){if(t&&(Gr(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return KS(e)}function KS(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kh(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kh=function(){return!!e})()}function Mi(e){return Mi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mi(e)}function ZS(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Cc(e,t)}function Cc(e,t){return Cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Cc(e,t)}function Oc(e,t,n){return(t=Zh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zh(e){var t=YS(e,"string");return Gr(t)=="symbol"?t:t+""}function YS(e,t){if(Gr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var XS=$i.CopyToClipboard=function(e){function t(){var n;_S(this,t);for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=GS(this,t,[].concat(o)),Oc(n,"onClick",function(i){var l=n.props,a=l.text,c=l.onCopy,u=l.children,d=l.options,p=Ii.default.Children.only(u),f=(0,jS.default)(a,d);c&&c(a,f),p!=null&&p.props&&typeof p.props.onClick=="function"&&p.props.onClick(i)}),n}return ZS(t,e),HS(t,[{key:"render",value:function(){var r=this.props;r.text,r.onCopy,r.options;var o=r.children,s=US(r,zS),i=Ii.default.Children.only(o);return Ii.default.cloneElement(i,qh(qh({},s),{},{onClick:this.onClick}))}}])}(Ii.default.PureComponent);Oc(XS,"defaultProps",{onCopy:void 0,options:void 0});var JS=$i,$c=JS.CopyToClipboard;$c.CopyToClipboard=$c;var QS=$c;const e3=nb(QS);var t3=Object.defineProperty,Di=Object.getOwnPropertySymbols,Yh=Object.prototype.hasOwnProperty,Xh=Object.prototype.propertyIsEnumerable,Jh=(e,t,n)=>t in e?t3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ic=(e,t)=>{for(var n in t||(t={}))Yh.call(t,n)&&Jh(e,n,t[n]);if(Di)for(var n of Di(t))Xh.call(t,n)&&Jh(e,n,t[n]);return e},Mc=(e,t)=>{var n={};for(var r in e)Yh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Di)for(var r of Di(e))t.indexOf(r)<0&&Xh.call(e,r)&&(n[r]=e[r]);return n};/**
170
170
  * @license QR Code generator library (TypeScript)
171
171
  * Copyright (c) Project Nayuki.
172
172
  * SPDX-License-Identifier: MIT
173
- */var pr;(e=>{const t=class ce{constructor(a,c,u,f){if(this.version=a,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],a<ce.MIN_VERSION||a>ce.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(u);if(this.drawCodewords(d),f==-1){let h=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);const w=this.getPenaltyScore();w<h&&(f=b,h=w),this.applyMask(b)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,c){const u=e.QrSegment.makeSegments(a);return ce.encodeSegments(u,c)}static encodeBinary(a,c){const u=e.QrSegment.makeBytes(a);return ce.encodeSegments([u],c)}static encodeSegments(a,c,u=1,f=40,p=-1,d=!0){if(!(ce.MIN_VERSION<=u&&u<=f&&f<=ce.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,b;for(h=u;;h++){const E=ce.getNumDataCodewords(h,c)*8,A=i.getTotalBits(a,h);if(A<=E){b=A;break}if(h>=f)throw new RangeError("Data too long")}for(const E of[ce.Ecc.MEDIUM,ce.Ecc.QUARTILE,ce.Ecc.HIGH])d&&b<=ce.getNumDataCodewords(h,E)*8&&(c=E);let w=[];for(const E of a){n(E.mode.modeBits,4,w),n(E.numChars,E.mode.numCharCountBits(h),w);for(const A of E.getData())w.push(A)}o(w.length==b);const T=ce.getNumDataCodewords(h,c)*8;o(w.length<=T),n(0,Math.min(4,T-w.length),w),n(0,(8-w.length%8)%8,w),o(w.length%8==0);for(let E=236;w.length<T;E^=253)n(E,8,w);let x=[];for(;x.length*8<w.length;)x.push(0);return w.forEach((E,A)=>x[A>>>3]|=E<<7-(A&7)),new ce(h,c,x,p)}getModule(a,c){return 0<=a&&a<this.size&&0<=c&&c<this.size&&this.modules[c][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),c=a.length;for(let u=0;u<c;u++)for(let f=0;f<c;f++)u==0&&f==0||u==0&&f==c-1||u==c-1&&f==0||this.drawAlignmentPattern(a[u],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const c=this.errorCorrectionLevel.formatBits<<3|a;let u=c;for(let p=0;p<10;p++)u=u<<1^(u>>>9)*1335;const f=(c<<10|u)^21522;o(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(f,p));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const c=this.version<<12|a;o(c>>>18==0);for(let u=0;u<18;u++){const f=r(c,u),p=this.size-11+u%3,d=Math.floor(u/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,c){for(let u=-4;u<=4;u++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(u)),d=a+f,h=c+u;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=4)}}drawAlignmentPattern(a,c){for(let u=-2;u<=2;u++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,c+u,Math.max(Math.abs(f),Math.abs(u))!=1)}setFunctionModule(a,c,u){this.modules[c][a]=u,this.isFunction[c][a]=!0}addEccAndInterleave(a){const c=this.version,u=this.errorCorrectionLevel;if(a.length!=ce.getNumDataCodewords(c,u))throw new RangeError("Invalid argument");const f=ce.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][c],p=ce.ECC_CODEWORDS_PER_BLOCK[u.ordinal][c],d=Math.floor(ce.getNumRawDataModules(c)/8),h=f-d%f,b=Math.floor(d/f);let w=[];const T=ce.reedSolomonComputeDivisor(p);for(let E=0,A=0;E<f;E++){let k=a.slice(A,A+b-p+(E<h?0:1));A+=k.length;const F=ce.reedSolomonComputeRemainder(k,T);E<h&&k.push(0),w.push(k.concat(F))}let x=[];for(let E=0;E<w[0].length;E++)w.forEach((A,k)=>{(E!=b-p||k>=h)&&x.push(A[E])});return o(x.length==d),x}drawCodewords(a){if(a.length!=Math.floor(ce.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let f=0;f<this.size;f++)for(let p=0;p<2;p++){const d=u-p,b=(u+1&2)==0?this.size-1-f:f;!this.isFunction[b][d]&&c<a.length*8&&(this.modules[b][d]=r(a[c>>>3],7-(c&7)),c++)}}o(c==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let u=0;u<this.size;u++){let f;switch(a){case 0:f=(u+c)%2==0;break;case 1:f=c%2==0;break;case 2:f=u%3==0;break;case 3:f=(u+c)%3==0;break;case 4:f=(Math.floor(u/3)+Math.floor(c/2))%2==0;break;case 5:f=u*c%2+u*c%3==0;break;case 6:f=(u*c%2+u*c%3)%2==0;break;case 7:f=((u+c)%2+u*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][u]&&f&&(this.modules[c][u]=!this.modules[c][u])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[p][w]==d?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),d||(a+=this.finderPenaltyCountPatterns(b)*ce.PENALTY_N3),d=this.modules[p][w],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,b)*ce.PENALTY_N3}for(let p=0;p<this.size;p++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][p]==d?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),d||(a+=this.finderPenaltyCountPatterns(b)*ce.PENALTY_N3),d=this.modules[w][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,b)*ce.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let d=0;d<this.size-1;d++){const h=this.modules[p][d];h==this.modules[p][d+1]&&h==this.modules[p+1][d]&&h==this.modules[p+1][d+1]&&(a+=ce.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((d,h)=>d+(h?1:0),c);const u=this.size*this.size,f=Math.ceil(Math.abs(c*20-u*10)/u)-1;return o(0<=f&&f<=9),a+=f*ce.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let u=[6];for(let f=this.size-7;u.length<a;f-=c)u.splice(1,0,f);return u}}static getNumRawDataModules(a){if(a<ce.MIN_VERSION||a>ce.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*a+128)*a+64;if(a>=2){const u=Math.floor(a/7)+2;c-=(25*u-10)*u-55,a>=7&&(c-=36)}return o(208<=c&&c<=29648),c}static getNumDataCodewords(a,c){return Math.floor(ce.getNumRawDataModules(a)/8)-ce.ECC_CODEWORDS_PER_BLOCK[c.ordinal][a]*ce.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let c=[];for(let f=0;f<a-1;f++)c.push(0);c.push(1);let u=1;for(let f=0;f<a;f++){for(let p=0;p<c.length;p++)c[p]=ce.reedSolomonMultiply(c[p],u),p+1<c.length&&(c[p]^=c[p+1]);u=ce.reedSolomonMultiply(u,2)}return c}static reedSolomonComputeRemainder(a,c){let u=c.map(f=>0);for(const f of a){const p=f^u.shift();u.push(0),c.forEach((d,h)=>u[h]^=ce.reedSolomonMultiply(d,p))}return u}static reedSolomonMultiply(a,c){if(a>>>8||c>>>8)throw new RangeError("Byte out of range");let u=0;for(let f=7;f>=0;f--)u=u<<1^(u>>>7)*285,u^=(c>>>f&1)*a;return o(u>>>8==0),u}finderPenaltyCountPatterns(a){const c=a[1];o(c<=this.size*3);const u=c>0&&a[2]==c&&a[3]==c*3&&a[4]==c&&a[5]==c;return(u&&a[0]>=c*4&&a[6]>=c?1:0)+(u&&a[6]>=c*4&&a[0]>=c?1:0)}finderPenaltyTerminateAndCount(a,c,u){return a&&(this.finderPenaltyAddHistory(c,u),c=0),c+=this.size,this.finderPenaltyAddHistory(c,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(a,c){c[0]==0&&(a+=this.size),c.pop(),c.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(l,a,c){if(a<0||a>31||l>>>a)throw new RangeError("Value out of range");for(let u=a-1;u>=0;u--)c.push(l>>>u&1)}function r(l,a){return(l>>>a&1)!=0}function o(l){if(!l)throw new Error("Assertion error")}const s=class Oe{constructor(a,c,u){if(this.mode=a,this.numChars=c,this.bitData=u,c<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(a){let c=[];for(const u of a)n(u,8,c);return new Oe(Oe.Mode.BYTE,a.length,c)}static makeNumeric(a){if(!Oe.isNumeric(a))throw new RangeError("String contains non-numeric characters");let c=[];for(let u=0;u<a.length;){const f=Math.min(a.length-u,3);n(parseInt(a.substring(u,u+f),10),f*3+1,c),u+=f}return new Oe(Oe.Mode.NUMERIC,a.length,c)}static makeAlphanumeric(a){if(!Oe.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],u;for(u=0;u+2<=a.length;u+=2){let f=Oe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u))*45;f+=Oe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u+1)),n(f,11,c)}return u<a.length&&n(Oe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u)),6,c),new Oe(Oe.Mode.ALPHANUMERIC,a.length,c)}static makeSegments(a){return a==""?[]:Oe.isNumeric(a)?[Oe.makeNumeric(a)]:Oe.isAlphanumeric(a)?[Oe.makeAlphanumeric(a)]:[Oe.makeBytes(Oe.toUtf8ByteArray(a))]}static makeEci(a){let c=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,c);else if(a<16384)n(2,2,c),n(a,14,c);else if(a<1e6)n(6,3,c),n(a,21,c);else throw new RangeError("ECI assignment value out of range");return new Oe(Oe.Mode.ECI,0,c)}static isNumeric(a){return Oe.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Oe.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,c){let u=0;for(const f of a){const p=f.mode.numCharCountBits(c);if(f.numChars>=1<<p)return 1/0;u+=4+p+f.bitData.length}return u}static toUtf8ByteArray(a){a=encodeURI(a);let c=[];for(let u=0;u<a.length;u++)a.charAt(u)!="%"?c.push(a.charCodeAt(u)):(c.push(parseInt(a.substring(u+1,u+3),16)),u+=2);return c}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(pr||(pr={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(pr||(pr={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(pr||(pr={}));var qr=pr;/**
173
+ */var pr;(e=>{const t=class ce{constructor(a,c,u,d){if(this.version=a,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],a<ce.MIN_VERSION||a>ce.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(u);if(this.drawCodewords(f),d==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const x=this.getPenaltyScore();x<h&&(d=m,h=x),this.applyMask(m)}}o(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(a,c){const u=e.QrSegment.makeSegments(a);return ce.encodeSegments(u,c)}static encodeBinary(a,c){const u=e.QrSegment.makeBytes(a);return ce.encodeSegments([u],c)}static encodeSegments(a,c,u=1,d=40,p=-1,f=!0){if(!(ce.MIN_VERSION<=u&&u<=d&&d<=ce.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=u;;h++){const P=ce.getNumDataCodewords(h,c)*8,A=i.getTotalBits(a,h);if(A<=P){m=A;break}if(h>=d)throw new RangeError("Data too long")}for(const P of[ce.Ecc.MEDIUM,ce.Ecc.QUARTILE,ce.Ecc.HIGH])f&&m<=ce.getNumDataCodewords(h,P)*8&&(c=P);let x=[];for(const P of a){n(P.mode.modeBits,4,x),n(P.numChars,P.mode.numCharCountBits(h),x);for(const A of P.getData())x.push(A)}o(x.length==m);const T=ce.getNumDataCodewords(h,c)*8;o(x.length<=T),n(0,Math.min(4,T-x.length),x),n(0,(8-x.length%8)%8,x),o(x.length%8==0);for(let P=236;x.length<T;P^=253)n(P,8,x);let w=[];for(;w.length*8<x.length;)w.push(0);return x.forEach((P,A)=>w[A>>>3]|=P<<7-(A&7)),new ce(h,c,w,p)}getModule(a,c){return 0<=a&&a<this.size&&0<=c&&c<this.size&&this.modules[c][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),c=a.length;for(let u=0;u<c;u++)for(let d=0;d<c;d++)u==0&&d==0||u==0&&d==c-1||u==c-1&&d==0||this.drawAlignmentPattern(a[u],a[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const c=this.errorCorrectionLevel.formatBits<<3|a;let u=c;for(let p=0;p<10;p++)u=u<<1^(u>>>9)*1335;const d=(c<<10|u)^21522;o(d>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(d,p));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(d,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(d,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(d,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const c=this.version<<12|a;o(c>>>18==0);for(let u=0;u<18;u++){const d=r(c,u),p=this.size-11+u%3,f=Math.floor(u/3);this.setFunctionModule(p,f,d),this.setFunctionModule(f,p,d)}}drawFinderPattern(a,c){for(let u=-4;u<=4;u++)for(let d=-4;d<=4;d++){const p=Math.max(Math.abs(d),Math.abs(u)),f=a+d,h=c+u;0<=f&&f<this.size&&0<=h&&h<this.size&&this.setFunctionModule(f,h,p!=2&&p!=4)}}drawAlignmentPattern(a,c){for(let u=-2;u<=2;u++)for(let d=-2;d<=2;d++)this.setFunctionModule(a+d,c+u,Math.max(Math.abs(d),Math.abs(u))!=1)}setFunctionModule(a,c,u){this.modules[c][a]=u,this.isFunction[c][a]=!0}addEccAndInterleave(a){const c=this.version,u=this.errorCorrectionLevel;if(a.length!=ce.getNumDataCodewords(c,u))throw new RangeError("Invalid argument");const d=ce.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][c],p=ce.ECC_CODEWORDS_PER_BLOCK[u.ordinal][c],f=Math.floor(ce.getNumRawDataModules(c)/8),h=d-f%d,m=Math.floor(f/d);let x=[];const T=ce.reedSolomonComputeDivisor(p);for(let P=0,A=0;P<d;P++){let k=a.slice(A,A+m-p+(P<h?0:1));A+=k.length;const B=ce.reedSolomonComputeRemainder(k,T);P<h&&k.push(0),x.push(k.concat(B))}let w=[];for(let P=0;P<x[0].length;P++)x.forEach((A,k)=>{(P!=m-p||k>=h)&&w.push(A[P])});return o(w.length==f),w}drawCodewords(a){if(a.length!=Math.floor(ce.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let d=0;d<this.size;d++)for(let p=0;p<2;p++){const f=u-p,m=(u+1&2)==0?this.size-1-d:d;!this.isFunction[m][f]&&c<a.length*8&&(this.modules[m][f]=r(a[c>>>3],7-(c&7)),c++)}}o(c==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let u=0;u<this.size;u++){let d;switch(a){case 0:d=(u+c)%2==0;break;case 1:d=c%2==0;break;case 2:d=u%3==0;break;case 3:d=(u+c)%3==0;break;case 4:d=(Math.floor(u/3)+Math.floor(c/2))%2==0;break;case 5:d=u*c%2+u*c%3==0;break;case 6:d=(u*c%2+u*c%3)%2==0;break;case 7:d=((u+c)%2+u*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][u]&&d&&(this.modules[c][u]=!this.modules[c][u])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let f=!1,h=0,m=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[p][x]==f?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),f||(a+=this.finderPenaltyCountPatterns(m)*ce.PENALTY_N3),f=this.modules[p][x],h=1);a+=this.finderPenaltyTerminateAndCount(f,h,m)*ce.PENALTY_N3}for(let p=0;p<this.size;p++){let f=!1,h=0,m=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[x][p]==f?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),f||(a+=this.finderPenaltyCountPatterns(m)*ce.PENALTY_N3),f=this.modules[x][p],h=1);a+=this.finderPenaltyTerminateAndCount(f,h,m)*ce.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let f=0;f<this.size-1;f++){const h=this.modules[p][f];h==this.modules[p][f+1]&&h==this.modules[p+1][f]&&h==this.modules[p+1][f+1]&&(a+=ce.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((f,h)=>f+(h?1:0),c);const u=this.size*this.size,d=Math.ceil(Math.abs(c*20-u*10)/u)-1;return o(0<=d&&d<=9),a+=d*ce.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let u=[6];for(let d=this.size-7;u.length<a;d-=c)u.splice(1,0,d);return u}}static getNumRawDataModules(a){if(a<ce.MIN_VERSION||a>ce.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*a+128)*a+64;if(a>=2){const u=Math.floor(a/7)+2;c-=(25*u-10)*u-55,a>=7&&(c-=36)}return o(208<=c&&c<=29648),c}static getNumDataCodewords(a,c){return Math.floor(ce.getNumRawDataModules(a)/8)-ce.ECC_CODEWORDS_PER_BLOCK[c.ordinal][a]*ce.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let c=[];for(let d=0;d<a-1;d++)c.push(0);c.push(1);let u=1;for(let d=0;d<a;d++){for(let p=0;p<c.length;p++)c[p]=ce.reedSolomonMultiply(c[p],u),p+1<c.length&&(c[p]^=c[p+1]);u=ce.reedSolomonMultiply(u,2)}return c}static reedSolomonComputeRemainder(a,c){let u=c.map(d=>0);for(const d of a){const p=d^u.shift();u.push(0),c.forEach((f,h)=>u[h]^=ce.reedSolomonMultiply(f,p))}return u}static reedSolomonMultiply(a,c){if(a>>>8||c>>>8)throw new RangeError("Byte out of range");let u=0;for(let d=7;d>=0;d--)u=u<<1^(u>>>7)*285,u^=(c>>>d&1)*a;return o(u>>>8==0),u}finderPenaltyCountPatterns(a){const c=a[1];o(c<=this.size*3);const u=c>0&&a[2]==c&&a[3]==c*3&&a[4]==c&&a[5]==c;return(u&&a[0]>=c*4&&a[6]>=c?1:0)+(u&&a[6]>=c*4&&a[0]>=c?1:0)}finderPenaltyTerminateAndCount(a,c,u){return a&&(this.finderPenaltyAddHistory(c,u),c=0),c+=this.size,this.finderPenaltyAddHistory(c,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(a,c){c[0]==0&&(a+=this.size),c.pop(),c.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(l,a,c){if(a<0||a>31||l>>>a)throw new RangeError("Value out of range");for(let u=a-1;u>=0;u--)c.push(l>>>u&1)}function r(l,a){return(l>>>a&1)!=0}function o(l){if(!l)throw new Error("Assertion error")}const s=class Oe{constructor(a,c,u){if(this.mode=a,this.numChars=c,this.bitData=u,c<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(a){let c=[];for(const u of a)n(u,8,c);return new Oe(Oe.Mode.BYTE,a.length,c)}static makeNumeric(a){if(!Oe.isNumeric(a))throw new RangeError("String contains non-numeric characters");let c=[];for(let u=0;u<a.length;){const d=Math.min(a.length-u,3);n(parseInt(a.substring(u,u+d),10),d*3+1,c),u+=d}return new Oe(Oe.Mode.NUMERIC,a.length,c)}static makeAlphanumeric(a){if(!Oe.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],u;for(u=0;u+2<=a.length;u+=2){let d=Oe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u))*45;d+=Oe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u+1)),n(d,11,c)}return u<a.length&&n(Oe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u)),6,c),new Oe(Oe.Mode.ALPHANUMERIC,a.length,c)}static makeSegments(a){return a==""?[]:Oe.isNumeric(a)?[Oe.makeNumeric(a)]:Oe.isAlphanumeric(a)?[Oe.makeAlphanumeric(a)]:[Oe.makeBytes(Oe.toUtf8ByteArray(a))]}static makeEci(a){let c=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,c);else if(a<16384)n(2,2,c),n(a,14,c);else if(a<1e6)n(6,3,c),n(a,21,c);else throw new RangeError("ECI assignment value out of range");return new Oe(Oe.Mode.ECI,0,c)}static isNumeric(a){return Oe.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Oe.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,c){let u=0;for(const d of a){const p=d.mode.numCharCountBits(c);if(d.numChars>=1<<p)return 1/0;u+=4+p+d.bitData.length}return u}static toUtf8ByteArray(a){a=encodeURI(a);let c=[];for(let u=0;u<a.length;u++)a.charAt(u)!="%"?c.push(a.charCodeAt(u)):(c.push(parseInt(a.substring(u+1,u+3),16)),u+=2);return c}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(pr||(pr={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(pr||(pr={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(pr||(pr={}));var qr=pr;/**
174
174
  * @license qrcode.react
175
175
  * Copyright (c) Paul O'Shannessy
176
176
  * SPDX-License-Identifier: ISC
177
- */var Q3={L:qr.QrCode.Ecc.LOW,M:qr.QrCode.Ecc.MEDIUM,Q:qr.QrCode.Ecc.QUARTILE,H:qr.QrCode.Ecc.HIGH},Jh=128,Qh="L",em="#FFFFFF",tm="#000000",nm=!1,rm=1,eS=4,tS=0,nS=.1;function om(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,l){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${l-s}v1H${s+t}z`),s=null;return}if(l===r.length-1){if(!i)return;s===null?n.push(`M${l+t},${o+t} h1v1H${l+t}z`):n.push(`M${s+t},${o+t} h${l+1-s}v1H${s+t}z`);return}i&&s===null&&(s=l)})}),n.join("")}function sm(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,s)=>s<t.x||s>=t.x+t.w?o:!1))}function rS(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*nS),i=o/t,l=(r.width||s)*i,a=(r.height||s)*i,c=r.x==null?e.length/2-l/2:r.x*i,u=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(c),b=Math.floor(u),w=Math.ceil(l+c-h),T=Math.ceil(a+u-b);p={x:h,y:b,w,h:T}}const d=r.crossOrigin;return{x:c,y:u,h:a,w:l,excavation:p,opacity:f,crossOrigin:d}}function oS(e,t){return t!=null?Math.max(Math.floor(t),0):e?eS:tS}function im({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:l}){let a=g.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((b,w)=>(b.push(...qr.QrSegment.makeSegments(w)),b),[]);return qr.QrCode.encodeSegments(h,Q3[t],n,void 0,void 0,l)},[e,t,n,l]);const{cells:c,margin:u,numCells:f,calculatedImageSettings:p}=g.useMemo(()=>{let d=a.getModules();const h=oS(r,o),b=d.length+h*2,w=rS(d,i,h,s);return{cells:d,margin:h,numCells:b,calculatedImageSettings:w}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:c,numCells:f,calculatedImageSettings:p}}var sS=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),iS=g.forwardRef(function(t,n){const r=t,{value:o,size:s=Jh,level:i=Qh,bgColor:l=em,fgColor:a=tm,includeMargin:c=nm,minVersion:u=rm,boostLevel:f,marginSize:p,imageSettings:d}=r,b=Ic(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=b,T=Ic(b,["style"]),x=d==null?void 0:d.src,E=g.useRef(null),A=g.useRef(null),k=g.useCallback(D=>{E.current=D,typeof n=="function"?n(D):n&&(n.current=D)},[n]),[F,L]=g.useState(!1),{margin:m,cells:v,numCells:S,calculatedImageSettings:I}=im({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:c,marginSize:p,imageSettings:d,size:s});g.useEffect(()=>{if(E.current!=null){const D=E.current,y=D.getContext("2d");if(!y)return;let O=v;const M=A.current,P=I!=null&&M!==null&&M.complete&&M.naturalHeight!==0&&M.naturalWidth!==0;P&&I.excavation!=null&&(O=sm(v,I.excavation));const B=window.devicePixelRatio||1;D.height=D.width=s*B;const R=s/S*B;y.scale(R,R),y.fillStyle=l,y.fillRect(0,0,S,S),y.fillStyle=a,sS?y.fill(new Path2D(om(O,m))):v.forEach(function(z,W){z.forEach(function(G,J){G&&y.fillRect(J+m,W+m,1,1)})}),I&&(y.globalAlpha=I.opacity),P&&y.drawImage(M,I.x+m,I.y+m,I.w,I.h)}}),g.useEffect(()=>{L(!1)},[x]);const $=$c({height:s,width:s},w);let C=null;return x!=null&&(C=g.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{L(!0)},ref:A,crossOrigin:I==null?void 0:I.crossOrigin})),g.createElement(g.Fragment,null,g.createElement("canvas",$c({style:$,height:s,width:s,ref:k,role:"img"},T)),C)});iS.displayName="QRCodeCanvas";var am=g.forwardRef(function(t,n){const r=t,{value:o,size:s=Jh,level:i=Qh,bgColor:l=em,fgColor:a=tm,includeMargin:c=nm,minVersion:u=rm,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,b=Ic(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:T,numCells:x,calculatedImageSettings:E}=im({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:c,marginSize:d,imageSettings:h,size:s});let A=T,k=null;h!=null&&E!=null&&(E.excavation!=null&&(A=sm(T,E.excavation)),k=g.createElement("image",{href:h.src,height:E.h,width:E.w,x:E.x+w,y:E.y+w,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));const F=om(A,w);return g.createElement("svg",$c({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},b),!!p&&g.createElement("title",null,p),g.createElement("path",{fill:l,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),g.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),k)});am.displayName="QRCodeSVG";function aS(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function lS(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function lm(){return/apple/i.test(navigator.vendor)}function cS(){return aS().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function uS(){return lS().includes("jsdom/")}const cm="data-floating-ui-focusable",fS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Mc(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Kr(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&nc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Zr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Dc(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function dS(e){return e.matches("html,body")}function tn(e){return(e==null?void 0:e.ownerDocument)||document}function um(e){return st(e)&&e.matches(fS)}function pS(e){if(!e||uS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function hS(e){return e?e.hasAttribute(cm)?e:e.querySelector("["+cm+"]")||e:null}function Di(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...Di(e,o.id,n)])}function mS(e){return"nativeEvent"in e}function ls(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var bS=typeof document<"u",gS=function(){},nn=bS?g.useLayoutEffect:gS;const yS={...U};function ki(e){const t=U.useRef(e);return nn(()=>{t.current=e}),t}const wS=yS.useInsertionEffect||(e=>e());function rn(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return wS(()=>{t.current=e}),U.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const fm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function dm(e,t){const n=Hp(e,fm()),r=n.length;if(r===0)return;const o=Mc(tn(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function vS(e){return dm(tn(e).body,1)||e}function xS(e){return dm(tn(e).body,-1)||e}function kc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Kr(n,r)}function ES(e){Hp(e,fm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function pm(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const SS="data-floating-ui-focusable",hm="active",mm="selected",PS={...U};let bm=!1,TS=0;const gm=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+TS++;function AS(){const[e,t]=U.useState(()=>bm?gm():void 0);return nn(()=>{e==null&&t(gm())},[]),U.useEffect(()=>{bm=!0},[]),e}const Bc=PS.useId||AS;let Lc;process.env.NODE_ENV!=="production"&&(Lc=new Set);function NS(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Lc)!=null&&e.has(o))){var s;(s=Lc)==null||s.add(o),console.error(o)}}function OS(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const CS=U.createContext(null),$S=U.createContext(null),Fc=()=>{var e;return((e=U.useContext(CS))==null?void 0:e.id)||null},Rc=()=>U.useContext($S);function cs(e){return"data-floating-ui-"+e}function Ot(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const ym=cs("safe-polygon");function jc(e,t,n){if(n&&!ls(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function zc(e){return typeof e=="function"?e():e}function IS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:f=0,move:p=!0}=t,d=Rc(),h=Fc(),b=ki(c),w=ki(a),T=ki(n),x=ki(f),E=U.useRef(),A=U.useRef(-1),k=U.useRef(),F=U.useRef(-1),L=U.useRef(!0),m=U.useRef(!1),v=U.useRef(()=>{}),S=U.useRef(!1),I=rn(()=>{var M;const P=(M=o.current.openEvent)==null?void 0:M.type;return(P==null?void 0:P.includes("mouse"))&&P!=="mousedown"});U.useEffect(()=>{if(!l)return;function M(P){let{open:B}=P;B||(Ot(A),Ot(F),L.current=!0,S.current=!1)}return s.on("openchange",M),()=>{s.off("openchange",M)}},[l,s]),U.useEffect(()=>{if(!l||!b.current||!n)return;function M(B){I()&&r(!1,B,"hover")}const P=tn(i.floating).documentElement;return P.addEventListener("mouseleave",M),()=>{P.removeEventListener("mouseleave",M)}},[i.floating,n,r,l,b,I]);const $=U.useCallback(function(M,P,B){P===void 0&&(P=!0),B===void 0&&(B="hover");const R=jc(w.current,"close",E.current);R&&!k.current?(Ot(A),A.current=window.setTimeout(()=>r(!1,M,B),R)):P&&(Ot(A),r(!1,M,B))},[w,r]),C=rn(()=>{v.current(),k.current=void 0}),D=rn(()=>{if(m.current){const M=tn(i.floating).body;M.style.pointerEvents="",M.removeAttribute(ym),m.current=!1}}),y=rn(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!l)return;function M(W){if(Ot(A),L.current=!1,u&&!ls(E.current)||zc(x.current)>0&&!jc(w.current,"open"))return;const G=jc(w.current,"open",E.current);G?A.current=window.setTimeout(()=>{T.current||r(!0,W,"hover")},G):n||r(!0,W,"hover")}function P(W){if(y()){D();return}v.current();const G=tn(i.floating);if(Ot(F),S.current=!1,b.current&&o.current.floatingContext){n||Ot(A),k.current=b.current({...o.current.floatingContext,tree:d,x:W.clientX,y:W.clientY,onClose(){D(),C(),y()||$(W,!0,"safe-polygon")}});const K=k.current;G.addEventListener("mousemove",K),v.current=()=>{G.removeEventListener("mousemove",K)};return}(E.current==="touch"?!Kr(i.floating,W.relatedTarget):!0)&&$(W)}function B(W){y()||o.current.floatingContext&&(b.current==null||b.current({...o.current.floatingContext,tree:d,x:W.clientX,y:W.clientY,onClose(){D(),C(),y()||$(W)}})(W))}function R(){Ot(A)}function z(W){y()||$(W,!1)}if(be(i.domReference)){const W=i.domReference,G=i.floating;return n&&W.addEventListener("mouseleave",B),p&&W.addEventListener("mousemove",M,{once:!0}),W.addEventListener("mouseenter",M),W.addEventListener("mouseleave",P),G&&(G.addEventListener("mouseleave",B),G.addEventListener("mouseenter",R),G.addEventListener("mouseleave",z)),()=>{n&&W.removeEventListener("mouseleave",B),p&&W.removeEventListener("mousemove",M),W.removeEventListener("mouseenter",M),W.removeEventListener("mouseleave",P),G&&(G.removeEventListener("mouseleave",B),G.removeEventListener("mouseenter",R),G.removeEventListener("mouseleave",z))}}},[i,l,e,u,p,$,C,D,r,n,T,d,w,b,o,y,x]),nn(()=>{var M;if(l&&n&&(M=b.current)!=null&&(M=M.__options)!=null&&M.blockPointerEvents&&I()){m.current=!0;const B=i.floating;if(be(i.domReference)&&B){var P;const R=tn(i.floating).body;R.setAttribute(ym,"");const z=i.domReference,W=d==null||(P=d.nodesRef.current.find(G=>G.id===h))==null||(P=P.context)==null?void 0:P.elements.floating;return W&&(W.style.pointerEvents=""),R.style.pointerEvents="none",z.style.pointerEvents="auto",B.style.pointerEvents="auto",()=>{R.style.pointerEvents="",z.style.pointerEvents="",B.style.pointerEvents=""}}}},[l,n,h,i,d,b,I]),nn(()=>{n||(E.current=void 0,S.current=!1,C(),D())},[n,C,D]),U.useEffect(()=>()=>{C(),Ot(A),Ot(F),D()},[l,i.domReference,C,D]);const O=U.useMemo(()=>{function M(P){E.current=P.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(P){const{nativeEvent:B}=P;function R(){!L.current&&!T.current&&r(!0,B,"hover")}u&&!ls(E.current)||n||zc(x.current)===0||S.current&&P.movementX**2+P.movementY**2<2||(Ot(F),E.current==="touch"?R():(S.current=!0,F.current=window.setTimeout(R,zc(x.current))))}}},[u,r,n,T,x]);return U.useMemo(()=>l?{reference:O}:{},[l,O])}const MS={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},wm=U.forwardRef(function(t,n){const[r,o]=U.useState();nn(()=>{lm()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[cs("focus-guard")]:"",style:MS};return N.jsx("span",{...t,...s})}),DS={clipPath:"inset(50%)",position:"fixed",top:0,left:0},vm=U.createContext(null),xm=cs("portal");function kS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Bc(),o=LS(),[s,i]=U.useState(null),l=U.useRef(null);return nn(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{l.current=null})},[s]),nn(()=>{if(!r||l.current)return;const a=t?document.getElementById(t):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(xm,""),a.appendChild(c),l.current=c,i(c)},[t,r]),nn(()=>{if(n===null||!r||l.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!tc(a)&&(a=a.current),a=a||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(xm,""),a=c||a,a.appendChild(u),l.current=u,i(u)},[t,n,r,o]),s}function BS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=kS({id:n,root:r}),[i,l]=U.useState(null),a=U.useRef(null),c=U.useRef(null),u=U.useRef(null),f=U.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||p)return;function b(w){s&&kc(w)&&(w.type==="focusin"?pm:ES)(s)}return s.addEventListener("focusin",b,!0),s.addEventListener("focusout",b,!0),()=>{s.removeEventListener("focusin",b,!0),s.removeEventListener("focusout",b,!0)}},[s,o,p]),U.useEffect(()=>{s&&(d||pm(s))},[d,s]),N.jsxs(vm.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:l}),[o,s]),children:[h&&s&&N.jsx(wm,{"data-type":"outside",ref:a,onFocus:b=>{if(kc(b,s)){var w;(w=u.current)==null||w.focus()}else{const T=i?i.domReference:null,x=xS(T);x==null||x.focus()}}}),h&&s&&N.jsx("span",{"aria-owns":s.id,style:DS}),s&&Qr.createPortal(t,s),h&&s&&N.jsx(wm,{"data-type":"outside",ref:c,onFocus:b=>{if(kc(b,s)){var w;(w=f.current)==null||w.focus()}else{const T=i?i.domReference:null,x=vS(T);x==null||x.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,b.nativeEvent,"focus-out"))}}})]})}const LS=()=>U.useContext(vm);function Em(e){return st(e.target)&&e.target.tagName==="BUTTON"}function FS(e){return st(e.target)&&e.target.tagName==="A"}function Sm(e){return um(e)}function RS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:l="click",toggle:a=!0,ignoreMouse:c=!1,keyboardHandlers:u=!0,stickIfOpen:f=!0}=t,p=U.useRef(),d=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(b){p.current=b.pointerType},onMouseDown(b){const w=p.current;b.button===0&&l!=="click"&&(ls(w,!0)&&c||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,b.nativeEvent,"click"):(b.preventDefault(),r(!0,b.nativeEvent,"click"))))},onClick(b){const w=p.current;if(l==="mousedown"&&p.current){p.current=void 0;return}ls(w,!0)&&c||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,b.nativeEvent,"click"):r(!0,b.nativeEvent,"click"))},onKeyDown(b){p.current=void 0,!(b.defaultPrevented||!u||Em(b))&&(b.key===" "&&!Sm(s)&&(b.preventDefault(),d.current=!0),!FS(b)&&b.key==="Enter"&&r(!(n&&a),b.nativeEvent,"click"))},onKeyUp(b){b.defaultPrevented||!u||Em(b)||Sm(s)||b.key===" "&&d.current&&(d.current=!1,r(!(n&&a),b.nativeEvent,"click"))}}),[o,s,l,c,u,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const jS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},zS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Pm=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function US(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,b=Rc(),w=rn(typeof a=="function"?a:()=>!1),T=typeof a=="function"?w:a,x=U.useRef(!1),{escapeKey:E,outsidePress:A}=Pm(d),{escapeKey:k,outsidePress:F}=Pm(h),L=U.useRef(!1),m=rn(D=>{var y;if(!n||!i||!l||D.key!=="Escape"||L.current)return;const O=(y=s.current.floatingContext)==null?void 0:y.nodeId,M=b?Di(b.nodesRef.current,O):[];if(!E&&(D.stopPropagation(),M.length>0)){let P=!0;if(M.forEach(B=>{var R;if((R=B.context)!=null&&R.open&&!B.context.dataRef.current.__escapeKeyBubbles){P=!1;return}}),!P)return}r(!1,mS(D)?D.nativeEvent:D,"escape-key")}),v=rn(D=>{var y;const O=()=>{var M;m(D),(M=Zr(D))==null||M.removeEventListener("keydown",O)};(y=Zr(D))==null||y.addEventListener("keydown",O)}),S=rn(D=>{var y;const O=s.current.insideReactTree;s.current.insideReactTree=!1;const M=x.current;if(x.current=!1,c==="click"&&M||O||typeof T=="function"&&!T(D))return;const P=Zr(D),B="["+cs("inert")+"]",R=tn(o.floating).querySelectorAll(B);let z=be(P)?P:null;for(;z&&!vn(z);){const K=xn(z);if(vn(K)||!be(K))break;z=K}if(R.length&&be(P)&&!dS(P)&&!Kr(P,o.floating)&&Array.from(R).every(K=>!Kr(z,K)))return;if(st(P)&&C){const K=vn(P),V=At(P),te=/auto|scroll/,me=K||te.test(V.overflowX),he=K||te.test(V.overflowY),ye=me&&P.clientWidth>0&&P.scrollWidth>P.clientWidth,we=he&&P.clientHeight>0&&P.scrollHeight>P.clientHeight,oe=V.direction==="rtl",_=we&&(oe?D.offsetX<=P.offsetWidth-P.clientWidth:D.offsetX>P.clientWidth),Y=ye&&D.offsetY>P.clientHeight;if(_||Y)return}const W=(y=s.current.floatingContext)==null?void 0:y.nodeId,G=b&&Di(b.nodesRef.current,W).some(K=>{var V;return Dc(D,(V=K.context)==null?void 0:V.elements.floating)});if(Dc(D,o.floating)||Dc(D,o.domReference)||G)return;const J=b?Di(b.nodesRef.current,W):[];if(J.length>0){let K=!0;if(J.forEach(V=>{var te;if((te=V.context)!=null&&te.open&&!V.context.dataRef.current.__outsidePressBubbles){K=!1;return}}),!K)return}r(!1,D,"outside-press")}),I=rn(D=>{var y;const O=()=>{var M;S(D),(M=Zr(D))==null||M.removeEventListener(c,O)};(y=Zr(D))==null||y.addEventListener(c,O)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=E,s.current.__outsidePressBubbles=A;let D=-1;function y(R){r(!1,R,"ancestor-scroll")}function O(){window.clearTimeout(D),L.current=!0}function M(){D=window.setTimeout(()=>{L.current=!1},di()?5:0)}const P=tn(o.floating);l&&(P.addEventListener("keydown",k?v:m,k),P.addEventListener("compositionstart",O),P.addEventListener("compositionend",M)),T&&P.addEventListener(c,F?I:S,F);let B=[];return p&&(be(o.domReference)&&(B=Un(o.domReference)),be(o.floating)&&(B=B.concat(Un(o.floating))),!be(o.reference)&&o.reference&&o.reference.contextElement&&(B=B.concat(Un(o.reference.contextElement)))),B=B.filter(R=>{var z;return R!==((z=P.defaultView)==null?void 0:z.visualViewport)}),B.forEach(R=>{R.addEventListener("scroll",y,{passive:!0})}),()=>{l&&(P.removeEventListener("keydown",k?v:m,k),P.removeEventListener("compositionstart",O),P.removeEventListener("compositionend",M)),T&&P.removeEventListener(c,F?I:S,F),B.forEach(R=>{R.removeEventListener("scroll",y)}),window.clearTimeout(D)}},[s,o,l,T,c,n,r,p,i,E,A,m,k,v,S,F,I]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,T,c]);const $=U.useMemo(()=>({onKeyDown:m,...u&&{[jS[f]]:D=>{r(!1,D.nativeEvent,"reference-press")},...f!=="click"&&{onClick(D){r(!1,D.nativeEvent,"reference-press")}}}}),[m,r,u,f]),C=U.useMemo(()=>{function D(y){y.button===0&&(x.current=!0)}return{onKeyDown:m,onMouseDown:D,onMouseUp:D,[zS[c]]:()=>{s.current.insideReactTree=!0}}},[m,c,s]);return U.useMemo(()=>i?{reference:$,floating:C}:{},[i,$,C])}function WS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Bc(),s=U.useRef({}),[i]=U.useState(()=>OS()),l=Fc()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!be(d)&&NS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=rn((d,h,b)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:b,nested:l}),n==null||n(d,h,b)}),f=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function _S(e){e===void 0&&(e={});const{nodeId:t}=e,n=WS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=Rc();nn(()=>{u&&(f.current=u)},[u]);const d=ah({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(E=>{const A=be(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;a(A),d.refs.setReference(A)},[d.refs]),b=U.useCallback(E=>{(be(E)||E===null)&&(f.current=E,i(E)),(be(d.refs.reference.current)||d.refs.reference.current===null||E!==null&&!be(E))&&d.refs.setReference(E)},[d.refs]),w=U.useMemo(()=>({...d.refs,setReference:b,setPositionReference:h,domReference:f}),[d.refs,b,h]),T=U.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=U.useMemo(()=>({...d,...r,refs:w,elements:T,nodeId:t}),[d,w,T,t,r]);return nn(()=>{r.dataRef.current.floatingContext=x;const E=p==null?void 0:p.nodesRef.current.find(A=>A.id===t);E&&(E.context=x)}),U.useMemo(()=>({...d,context:x,refs:w,elements:T}),[d,w,T,x])}function Uc(){return cS()&&lm()}function VS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:l=!0,visibleOnly:a=!0}=t,c=U.useRef(!1),u=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!l)return;const d=ot(i.domReference);function h(){!n&&st(i.domReference)&&i.domReference===Mc(tn(i.domReference))&&(c.current=!0)}function b(){f.current=!0}function w(){f.current=!1}return d.addEventListener("blur",h),Uc()&&(d.addEventListener("keydown",b,!0),d.addEventListener("pointerdown",w,!0)),()=>{d.removeEventListener("blur",h),Uc()&&(d.removeEventListener("keydown",b,!0),d.removeEventListener("pointerdown",w,!0))}},[i.domReference,n,l]),U.useEffect(()=>{if(!l)return;function d(h){let{reason:b}=h;(b==="reference-press"||b==="escape-key")&&(c.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,l]),U.useEffect(()=>()=>{Ot(u)},[]);const p=U.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(d){if(c.current)return;const h=Zr(d.nativeEvent);if(a&&be(h)){if(Uc()&&!d.relatedTarget){if(!f.current&&!um(h))return}else if(!pS(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){c.current=!1;const h=d.relatedTarget,b=d.nativeEvent,w=be(h)&&h.hasAttribute(cs("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var T;const x=Mc(i.domReference?i.domReference.ownerDocument:document);!h&&x===i.domReference||Kr((T=s.current.floatingContext)==null?void 0:T.refs.floating.current,x)||Kr(i.domReference,x)||w||r(!1,b,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>l?{reference:p}:{},[l,p])}function Wc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[hm]:i,[mm]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[SS]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[hm,mm].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),i[c]=function(){for(var p,d=arguments.length,h=new Array(d),b=0;b<d;b++)h[b]=arguments[b];return(p=r.get(c))==null?void 0:p.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[c]=u}),i),{})}}function HS(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>Wc(l,e,"reference"),t),s=U.useCallback(l=>Wc(l,e,"floating"),n),i=U.useCallback(l=>Wc(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const GS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function qS(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:l=!0,role:a="dialog"}=t,c=Bc(),u=((n=s.domReference)==null?void 0:n.id)||c,f=U.useMemo(()=>{var x;return((x=hS(s.floating))==null?void 0:x.id)||i},[s.floating,i]),p=(r=GS.get(a))!=null?r:a,h=Fc()!=null,b=U.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,u,a]),w=U.useMemo(()=>{const x={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?x:{...x,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,a]),T=U.useCallback(x=>{let{active:E,selected:A}=x;const k={role:"option",...E&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...k,"aria-selected":A}}return{}},[f,a]);return U.useMemo(()=>l?{reference:b,floating:w,item:T}:{},[l,b,w,T])}const Tm=g.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return N.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});Tm.displayName="TooltipArrow";const Tn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:l="max-w-xs",trigger:a=["hover","focus"]})=>{const[c,u]=g.useState(!1),f=g.useRef(null),{refs:p,floatingStyles:d,context:h}=_S({open:c&&!i,onOpenChange:u,placement:n,whileElementsMounted:rh,middleware:[bc(o?12:8),ch({fallbackAxisSideDirection:"start",padding:8}),lh({padding:8}),...o?[i8({element:f})]:[]]}),b=IS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),w=VS(h,{enabled:a.includes("focus")}),T=RS(h,{enabled:a.includes("click")}),x=US(h),E=qS(h,{role:"tooltip"}),{getReferenceProps:A,getFloatingProps:k}=HS([b,w,T,x,E]);return i?N.jsx(N.Fragment,{children:e}):N.jsxs(N.Fragment,{children:[N.jsx("div",{ref:p.setReference,...A(),style:{cursor:"help"},children:e}),c&&N.jsx(BS,{children:N.jsx("div",{className:"edgex-components",children:N.jsxs("div",{ref:p.setFloating,...k(),style:{...d,zIndex:101},className:`
177
+ */var n3={L:qr.QrCode.Ecc.LOW,M:qr.QrCode.Ecc.MEDIUM,Q:qr.QrCode.Ecc.QUARTILE,H:qr.QrCode.Ecc.HIGH},Qh=128,em="L",tm="#FFFFFF",nm="#000000",rm=!1,om=1,r3=4,o3=0,s3=.1;function sm(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,l){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${l-s}v1H${s+t}z`),s=null;return}if(l===r.length-1){if(!i)return;s===null?n.push(`M${l+t},${o+t} h1v1H${l+t}z`):n.push(`M${s+t},${o+t} h${l+1-s}v1H${s+t}z`);return}i&&s===null&&(s=l)})}),n.join("")}function im(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,s)=>s<t.x||s>=t.x+t.w?o:!1))}function i3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*s3),i=o/t,l=(r.width||s)*i,a=(r.height||s)*i,c=r.x==null?e.length/2-l/2:r.x*i,u=r.y==null?e.length/2-a/2:r.y*i,d=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(c),m=Math.floor(u),x=Math.ceil(l+c-h),T=Math.ceil(a+u-m);p={x:h,y:m,w:x,h:T}}const f=r.crossOrigin;return{x:c,y:u,h:a,w:l,excavation:p,opacity:d,crossOrigin:f}}function a3(e,t){return t!=null?Math.max(Math.floor(t),0):e?r3:o3}function am({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:l}){let a=g.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,x)=>(m.push(...qr.QrSegment.makeSegments(x)),m),[]);return qr.QrCode.encodeSegments(h,n3[t],n,void 0,void 0,l)},[e,t,n,l]);const{cells:c,margin:u,numCells:d,calculatedImageSettings:p}=g.useMemo(()=>{let f=a.getModules();const h=a3(r,o),m=f.length+h*2,x=i3(f,i,h,s);return{cells:f,margin:h,numCells:m,calculatedImageSettings:x}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:c,numCells:d,calculatedImageSettings:p}}var l3=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),c3=g.forwardRef(function(t,n){const r=t,{value:o,size:s=Qh,level:i=em,bgColor:l=tm,fgColor:a=nm,includeMargin:c=rm,minVersion:u=om,boostLevel:d,marginSize:p,imageSettings:f}=r,m=Mc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=m,T=Mc(m,["style"]),w=f==null?void 0:f.src,P=g.useRef(null),A=g.useRef(null),k=g.useCallback(D=>{P.current=D,typeof n=="function"?n(D):n&&(n.current=D)},[n]),[B,F]=g.useState(!1),{margin:b,cells:v,numCells:E,calculatedImageSettings:I}=am({value:o,level:i,minVersion:u,boostLevel:d,includeMargin:c,marginSize:p,imageSettings:f,size:s});g.useEffect(()=>{if(P.current!=null){const D=P.current,y=D.getContext("2d");if(!y)return;let O=v;const M=A.current,S=I!=null&&M!==null&&M.complete&&M.naturalHeight!==0&&M.naturalWidth!==0;S&&I.excavation!=null&&(O=im(v,I.excavation));const L=window.devicePixelRatio||1;D.height=D.width=s*L;const j=s/E*L;y.scale(j,j),y.fillStyle=l,y.fillRect(0,0,E,E),y.fillStyle=a,l3?y.fill(new Path2D(sm(O,b))):v.forEach(function(z,W){z.forEach(function(_,Z){_&&y.fillRect(Z+b,W+b,1,1)})}),I&&(y.globalAlpha=I.opacity),S&&y.drawImage(M,I.x+b,I.y+b,I.w,I.h)}}),g.useEffect(()=>{F(!1)},[w]);const $=Ic({height:s,width:s},x);let C=null;return w!=null&&(C=g.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{F(!0)},ref:A,crossOrigin:I==null?void 0:I.crossOrigin})),g.createElement(g.Fragment,null,g.createElement("canvas",Ic({style:$,height:s,width:s,ref:k,role:"img"},T)),C)});c3.displayName="QRCodeCanvas";var lm=g.forwardRef(function(t,n){const r=t,{value:o,size:s=Qh,level:i=em,bgColor:l=tm,fgColor:a=nm,includeMargin:c=rm,minVersion:u=om,boostLevel:d,title:p,marginSize:f,imageSettings:h}=r,m=Mc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:x,cells:T,numCells:w,calculatedImageSettings:P}=am({value:o,level:i,minVersion:u,boostLevel:d,includeMargin:c,marginSize:f,imageSettings:h,size:s});let A=T,k=null;h!=null&&P!=null&&(P.excavation!=null&&(A=im(T,P.excavation)),k=g.createElement("image",{href:h.src,height:P.h,width:P.w,x:P.x+x,y:P.y+x,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const B=sm(A,x);return g.createElement("svg",Ic({height:s,width:s,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},m),!!p&&g.createElement("title",null,p),g.createElement("path",{fill:l,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),g.createElement("path",{fill:a,d:B,shapeRendering:"crispEdges"}),k)});lm.displayName="QRCodeSVG";function u3(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function d3(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function cm(){return/apple/i.test(navigator.vendor)}function f3(){return u3().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function p3(){return d3().includes("jsdom/")}const um="data-floating-ui-focusable",h3="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Dc(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Kr(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&rc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Zr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function kc(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function m3(e){return e.matches("html,body")}function tn(e){return(e==null?void 0:e.ownerDocument)||document}function dm(e){return st(e)&&e.matches(h3)}function b3(e){if(!e||p3())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function g3(e){return e?e.hasAttribute(um)?e:e.querySelector("["+um+"]")||e:null}function ki(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...ki(e,o.id,n)])}function y3(e){return"nativeEvent"in e}function ls(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var v3=typeof document<"u",w3=function(){},nn=v3?g.useLayoutEffect:w3;const x3={...U};function Li(e){const t=U.useRef(e);return nn(()=>{t.current=e}),t}const E3=x3.useInsertionEffect||(e=>e());function rn(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return E3(()=>{t.current=e}),U.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const fm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function pm(e,t){const n=Gp(e,fm()),r=n.length;if(r===0)return;const o=Dc(tn(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function S3(e){return pm(tn(e).body,1)||e}function P3(e){return pm(tn(e).body,-1)||e}function Lc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Kr(n,r)}function T3(e){Gp(e,fm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function hm(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const A3="data-floating-ui-focusable",mm="active",bm="selected",N3={...U};let gm=!1,C3=0;const ym=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+C3++;function O3(){const[e,t]=U.useState(()=>gm?ym():void 0);return nn(()=>{e==null&&t(ym())},[]),U.useEffect(()=>{gm=!0},[]),e}const Bc=N3.useId||O3;let Fc;process.env.NODE_ENV!=="production"&&(Fc=new Set);function $3(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Fc)!=null&&e.has(o))){var s;(s=Fc)==null||s.add(o),console.error(o)}}function I3(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const M3=U.createContext(null),D3=U.createContext(null),Rc=()=>{var e;return((e=U.useContext(M3))==null?void 0:e.id)||null},jc=()=>U.useContext(D3);function cs(e){return"data-floating-ui-"+e}function Ct(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const vm=cs("safe-polygon");function zc(e,t,n){if(n&&!ls(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function Uc(e){return typeof e=="function"?e():e}function k3(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:p=!0}=t,f=jc(),h=Rc(),m=Li(c),x=Li(a),T=Li(n),w=Li(d),P=U.useRef(),A=U.useRef(-1),k=U.useRef(),B=U.useRef(-1),F=U.useRef(!0),b=U.useRef(!1),v=U.useRef(()=>{}),E=U.useRef(!1),I=rn(()=>{var M;const S=(M=o.current.openEvent)==null?void 0:M.type;return(S==null?void 0:S.includes("mouse"))&&S!=="mousedown"});U.useEffect(()=>{if(!l)return;function M(S){let{open:L}=S;L||(Ct(A),Ct(B),F.current=!0,E.current=!1)}return s.on("openchange",M),()=>{s.off("openchange",M)}},[l,s]),U.useEffect(()=>{if(!l||!m.current||!n)return;function M(L){I()&&r(!1,L,"hover")}const S=tn(i.floating).documentElement;return S.addEventListener("mouseleave",M),()=>{S.removeEventListener("mouseleave",M)}},[i.floating,n,r,l,m,I]);const $=U.useCallback(function(M,S,L){S===void 0&&(S=!0),L===void 0&&(L="hover");const j=zc(x.current,"close",P.current);j&&!k.current?(Ct(A),A.current=window.setTimeout(()=>r(!1,M,L),j)):S&&(Ct(A),r(!1,M,L))},[x,r]),C=rn(()=>{v.current(),k.current=void 0}),D=rn(()=>{if(b.current){const M=tn(i.floating).body;M.style.pointerEvents="",M.removeAttribute(vm),b.current=!1}}),y=rn(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!l)return;function M(W){if(Ct(A),F.current=!1,u&&!ls(P.current)||Uc(w.current)>0&&!zc(x.current,"open"))return;const _=zc(x.current,"open",P.current);_?A.current=window.setTimeout(()=>{T.current||r(!0,W,"hover")},_):n||r(!0,W,"hover")}function S(W){if(y()){D();return}v.current();const _=tn(i.floating);if(Ct(B),E.current=!1,m.current&&o.current.floatingContext){n||Ct(A),k.current=m.current({...o.current.floatingContext,tree:f,x:W.clientX,y:W.clientY,onClose(){D(),C(),y()||$(W,!0,"safe-polygon")}});const q=k.current;_.addEventListener("mousemove",q),v.current=()=>{_.removeEventListener("mousemove",q)};return}(P.current==="touch"?!Kr(i.floating,W.relatedTarget):!0)&&$(W)}function L(W){y()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:f,x:W.clientX,y:W.clientY,onClose(){D(),C(),y()||$(W)}})(W))}function j(){Ct(A)}function z(W){y()||$(W,!1)}if(be(i.domReference)){const W=i.domReference,_=i.floating;return n&&W.addEventListener("mouseleave",L),p&&W.addEventListener("mousemove",M,{once:!0}),W.addEventListener("mouseenter",M),W.addEventListener("mouseleave",S),_&&(_.addEventListener("mouseleave",L),_.addEventListener("mouseenter",j),_.addEventListener("mouseleave",z)),()=>{n&&W.removeEventListener("mouseleave",L),p&&W.removeEventListener("mousemove",M),W.removeEventListener("mouseenter",M),W.removeEventListener("mouseleave",S),_&&(_.removeEventListener("mouseleave",L),_.removeEventListener("mouseenter",j),_.removeEventListener("mouseleave",z))}}},[i,l,e,u,p,$,C,D,r,n,T,f,x,m,o,y,w]),nn(()=>{var M;if(l&&n&&(M=m.current)!=null&&(M=M.__options)!=null&&M.blockPointerEvents&&I()){b.current=!0;const L=i.floating;if(be(i.domReference)&&L){var S;const j=tn(i.floating).body;j.setAttribute(vm,"");const z=i.domReference,W=f==null||(S=f.nodesRef.current.find(_=>_.id===h))==null||(S=S.context)==null?void 0:S.elements.floating;return W&&(W.style.pointerEvents=""),j.style.pointerEvents="none",z.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{j.style.pointerEvents="",z.style.pointerEvents="",L.style.pointerEvents=""}}}},[l,n,h,i,f,m,I]),nn(()=>{n||(P.current=void 0,E.current=!1,C(),D())},[n,C,D]),U.useEffect(()=>()=>{C(),Ct(A),Ct(B),D()},[l,i.domReference,C,D]);const O=U.useMemo(()=>{function M(S){P.current=S.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(S){const{nativeEvent:L}=S;function j(){!F.current&&!T.current&&r(!0,L,"hover")}u&&!ls(P.current)||n||Uc(w.current)===0||E.current&&S.movementX**2+S.movementY**2<2||(Ct(B),P.current==="touch"?j():(E.current=!0,B.current=window.setTimeout(j,Uc(w.current))))}}},[u,r,n,T,w]);return U.useMemo(()=>l?{reference:O}:{},[l,O])}const L3={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},wm=U.forwardRef(function(t,n){const[r,o]=U.useState();nn(()=>{cm()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[cs("focus-guard")]:"",style:L3};return N.jsx("span",{...t,...s})}),B3={clipPath:"inset(50%)",position:"fixed",top:0,left:0},xm=U.createContext(null),Em=cs("portal");function F3(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Bc(),o=j3(),[s,i]=U.useState(null),l=U.useRef(null);return nn(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{l.current=null})},[s]),nn(()=>{if(!r||l.current)return;const a=t?document.getElementById(t):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(Em,""),a.appendChild(c),l.current=c,i(c)},[t,r]),nn(()=>{if(n===null||!r||l.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!nc(a)&&(a=a.current),a=a||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(Em,""),a=c||a,a.appendChild(u),l.current=u,i(u)},[t,n,r,o]),s}function R3(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=F3({id:n,root:r}),[i,l]=U.useState(null),a=U.useRef(null),c=U.useRef(null),u=U.useRef(null),d=U.useRef(null),p=i==null?void 0:i.modal,f=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||p)return;function m(x){s&&Lc(x)&&(x.type==="focusin"?hm:T3)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),U.useEffect(()=>{s&&(f||hm(s))},[f,s]),N.jsxs(xm.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:s,setFocusManagerState:l}),[o,s]),children:[h&&s&&N.jsx(wm,{"data-type":"outside",ref:a,onFocus:m=>{if(Lc(m,s)){var x;(x=u.current)==null||x.focus()}else{const T=i?i.domReference:null,w=P3(T);w==null||w.focus()}}}),h&&s&&N.jsx("span",{"aria-owns":s.id,style:B3}),s&&Qr.createPortal(t,s),h&&s&&N.jsx(wm,{"data-type":"outside",ref:c,onFocus:m=>{if(Lc(m,s)){var x;(x=d.current)==null||x.focus()}else{const T=i?i.domReference:null,w=S3(T);w==null||w.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const j3=()=>U.useContext(xm);function Sm(e){return st(e.target)&&e.target.tagName==="BUTTON"}function z3(e){return st(e.target)&&e.target.tagName==="A"}function Pm(e){return dm(e)}function U3(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:l="click",toggle:a=!0,ignoreMouse:c=!1,keyboardHandlers:u=!0,stickIfOpen:d=!0}=t,p=U.useRef(),f=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const x=p.current;m.button===0&&l!=="click"&&(ls(x,!0)&&c||(n&&a&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const x=p.current;if(l==="mousedown"&&p.current){p.current=void 0;return}ls(x,!0)&&c||(n&&a&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!u||Sm(m))&&(m.key===" "&&!Pm(s)&&(m.preventDefault(),f.current=!0),!z3(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!u||Sm(m)||Pm(s)||m.key===" "&&f.current&&(f.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,l,c,u,r,n,d,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const W3={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},_3={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Tm=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function V3(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:h}=t,m=jc(),x=rn(typeof a=="function"?a:()=>!1),T=typeof a=="function"?x:a,w=U.useRef(!1),{escapeKey:P,outsidePress:A}=Tm(f),{escapeKey:k,outsidePress:B}=Tm(h),F=U.useRef(!1),b=rn(D=>{var y;if(!n||!i||!l||D.key!=="Escape"||F.current)return;const O=(y=s.current.floatingContext)==null?void 0:y.nodeId,M=m?ki(m.nodesRef.current,O):[];if(!P&&(D.stopPropagation(),M.length>0)){let S=!0;if(M.forEach(L=>{var j;if((j=L.context)!=null&&j.open&&!L.context.dataRef.current.__escapeKeyBubbles){S=!1;return}}),!S)return}r(!1,y3(D)?D.nativeEvent:D,"escape-key")}),v=rn(D=>{var y;const O=()=>{var M;b(D),(M=Zr(D))==null||M.removeEventListener("keydown",O)};(y=Zr(D))==null||y.addEventListener("keydown",O)}),E=rn(D=>{var y;const O=s.current.insideReactTree;s.current.insideReactTree=!1;const M=w.current;if(w.current=!1,c==="click"&&M||O||typeof T=="function"&&!T(D))return;const S=Zr(D),L="["+cs("inert")+"]",j=tn(o.floating).querySelectorAll(L);let z=be(S)?S:null;for(;z&&!wn(z);){const q=xn(z);if(wn(q)||!be(q))break;z=q}if(j.length&&be(S)&&!m3(S)&&!Kr(S,o.floating)&&Array.from(j).every(q=>!Kr(z,q)))return;if(st(S)&&C){const q=wn(S),H=At(S),ee=/auto|scroll/,fe=q||ee.test(H.overflowX),me=q||ee.test(H.overflowY),ye=fe&&S.clientWidth>0&&S.scrollWidth>S.clientWidth,ve=me&&S.clientHeight>0&&S.scrollHeight>S.clientHeight,oe=H.direction==="rtl",V=ve&&(oe?D.offsetX<=S.offsetWidth-S.clientWidth:D.offsetX>S.clientWidth),X=ye&&D.offsetY>S.clientHeight;if(V||X)return}const W=(y=s.current.floatingContext)==null?void 0:y.nodeId,_=m&&ki(m.nodesRef.current,W).some(q=>{var H;return kc(D,(H=q.context)==null?void 0:H.elements.floating)});if(kc(D,o.floating)||kc(D,o.domReference)||_)return;const Z=m?ki(m.nodesRef.current,W):[];if(Z.length>0){let q=!0;if(Z.forEach(H=>{var ee;if((ee=H.context)!=null&&ee.open&&!H.context.dataRef.current.__outsidePressBubbles){q=!1;return}}),!q)return}r(!1,D,"outside-press")}),I=rn(D=>{var y;const O=()=>{var M;E(D),(M=Zr(D))==null||M.removeEventListener(c,O)};(y=Zr(D))==null||y.addEventListener(c,O)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=P,s.current.__outsidePressBubbles=A;let D=-1;function y(j){r(!1,j,"ancestor-scroll")}function O(){window.clearTimeout(D),F.current=!0}function M(){D=window.setTimeout(()=>{F.current=!1},pi()?5:0)}const S=tn(o.floating);l&&(S.addEventListener("keydown",k?v:b,k),S.addEventListener("compositionstart",O),S.addEventListener("compositionend",M)),T&&S.addEventListener(c,B?I:E,B);let L=[];return p&&(be(o.domReference)&&(L=Un(o.domReference)),be(o.floating)&&(L=L.concat(Un(o.floating))),!be(o.reference)&&o.reference&&o.reference.contextElement&&(L=L.concat(Un(o.reference.contextElement)))),L=L.filter(j=>{var z;return j!==((z=S.defaultView)==null?void 0:z.visualViewport)}),L.forEach(j=>{j.addEventListener("scroll",y,{passive:!0})}),()=>{l&&(S.removeEventListener("keydown",k?v:b,k),S.removeEventListener("compositionstart",O),S.removeEventListener("compositionend",M)),T&&S.removeEventListener(c,B?I:E,B),L.forEach(j=>{j.removeEventListener("scroll",y)}),window.clearTimeout(D)}},[s,o,l,T,c,n,r,p,i,P,A,b,k,v,E,B,I]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,T,c]);const $=U.useMemo(()=>({onKeyDown:b,...u&&{[W3[d]]:D=>{r(!1,D.nativeEvent,"reference-press")},...d!=="click"&&{onClick(D){r(!1,D.nativeEvent,"reference-press")}}}}),[b,r,u,d]),C=U.useMemo(()=>{function D(y){y.button===0&&(w.current=!0)}return{onKeyDown:b,onMouseDown:D,onMouseUp:D,[_3[c]]:()=>{s.current.insideReactTree=!0}}},[b,c,s]);return U.useMemo(()=>i?{reference:$,floating:C}:{},[i,$,C])}function H3(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Bc(),s=U.useRef({}),[i]=U.useState(()=>I3()),l=Rc()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!be(f)&&$3("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=rn((f,h,m)=>{s.current.openEvent=f?h:void 0,i.emit("openchange",{open:f,event:h,reason:m,nested:l}),n==null||n(f,h,m)}),d=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:d}),[t,u,p,i,o,d])}function G3(e){e===void 0&&(e={});const{nodeId:t}=e,n=H3({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,d=U.useRef(null),p=jc();nn(()=>{u&&(d.current=u)},[u]);const f=lh({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(P=>{const A=be(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;a(A),f.refs.setReference(A)},[f.refs]),m=U.useCallback(P=>{(be(P)||P===null)&&(d.current=P,i(P)),(be(f.refs.reference.current)||f.refs.reference.current===null||P!==null&&!be(P))&&f.refs.setReference(P)},[f.refs]),x=U.useMemo(()=>({...f.refs,setReference:m,setPositionReference:h,domReference:d}),[f.refs,m,h]),T=U.useMemo(()=>({...f.elements,domReference:u}),[f.elements,u]),w=U.useMemo(()=>({...f,...r,refs:x,elements:T,nodeId:t}),[f,x,T,t,r]);return nn(()=>{r.dataRef.current.floatingContext=w;const P=p==null?void 0:p.nodesRef.current.find(A=>A.id===t);P&&(P.context=w)}),U.useMemo(()=>({...f,context:w,refs:x,elements:T}),[f,x,T,w])}function Wc(){return f3()&&cm()}function q3(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:l=!0,visibleOnly:a=!0}=t,c=U.useRef(!1),u=U.useRef(-1),d=U.useRef(!0);U.useEffect(()=>{if(!l)return;const f=ot(i.domReference);function h(){!n&&st(i.domReference)&&i.domReference===Dc(tn(i.domReference))&&(c.current=!0)}function m(){d.current=!0}function x(){d.current=!1}return f.addEventListener("blur",h),Wc()&&(f.addEventListener("keydown",m,!0),f.addEventListener("pointerdown",x,!0)),()=>{f.removeEventListener("blur",h),Wc()&&(f.removeEventListener("keydown",m,!0),f.removeEventListener("pointerdown",x,!0))}},[i.domReference,n,l]),U.useEffect(()=>{if(!l)return;function f(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(c.current=!0)}return o.on("openchange",f),()=>{o.off("openchange",f)}},[o,l]),U.useEffect(()=>()=>{Ct(u)},[]);const p=U.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(f){if(c.current)return;const h=Zr(f.nativeEvent);if(a&&be(h)){if(Wc()&&!f.relatedTarget){if(!d.current&&!dm(h))return}else if(!b3(h))return}r(!0,f.nativeEvent,"focus")},onBlur(f){c.current=!1;const h=f.relatedTarget,m=f.nativeEvent,x=be(h)&&h.hasAttribute(cs("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var T;const w=Dc(i.domReference?i.domReference.ownerDocument:document);!h&&w===i.domReference||Kr((T=s.current.floatingContext)==null?void 0:T.refs.floating.current,w)||Kr(i.domReference,w)||x||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>l?{reference:p}:{},[l,p])}function _c(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[mm]:i,[bm]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[A3]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[mm,bm].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),i[c]=function(){for(var p,f=arguments.length,h=new Array(f),m=0;m<f;m++)h[m]=arguments[m];return(p=r.get(c))==null?void 0:p.map(x=>x(...h)).find(x=>x!==void 0)}}}else i[c]=u}),i),{})}}function K3(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>_c(l,e,"reference"),t),s=U.useCallback(l=>_c(l,e,"floating"),n),i=U.useCallback(l=>_c(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const Z3=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Y3(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:l=!0,role:a="dialog"}=t,c=Bc(),u=((n=s.domReference)==null?void 0:n.id)||c,d=U.useMemo(()=>{var w;return((w=g3(s.floating))==null?void 0:w.id)||i},[s.floating,i]),p=(r=Z3.get(a))!=null?r:a,h=Rc()!=null,m=U.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?d:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,d,h,o,u,a]),x=U.useMemo(()=>{const w={id:d,...p&&{role:p}};return p==="tooltip"||a==="label"?w:{...w,...p==="menu"&&{"aria-labelledby":u}}},[p,d,u,a]),T=U.useCallback(w=>{let{active:P,selected:A}=w;const k={role:"option",...P&&{id:d+"-fui-option"}};switch(a){case"select":case"combobox":return{...k,"aria-selected":A}}return{}},[d,a]);return U.useMemo(()=>l?{reference:m,floating:x,item:T}:{},[l,m,x,T])}const Am=g.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return N.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});Am.displayName="TooltipArrow";const Tn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:l="max-w-xs",trigger:a=["hover","focus"]})=>{const[c,u]=g.useState(!1),d=g.useRef(null),{refs:p,floatingStyles:f,context:h}=G3({open:c&&!i,onOpenChange:u,placement:n,whileElementsMounted:oh,middleware:[gc(o?12:8),uh({fallbackAxisSideDirection:"start",padding:8}),ch({padding:8}),...o?[l8({element:d})]:[]]}),m=k3(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),x=q3(h,{enabled:a.includes("focus")}),T=U3(h,{enabled:a.includes("click")}),w=V3(h),P=Y3(h,{role:"tooltip"}),{getReferenceProps:A,getFloatingProps:k}=K3([m,x,T,w,P]);return i?N.jsx(N.Fragment,{children:e}):N.jsxs(N.Fragment,{children:[N.jsx("div",{ref:p.setReference,...A(),style:{cursor:"help"},children:e}),c&&N.jsx(R3,{children:N.jsx("div",{className:"edgex-components",children:N.jsxs("div",{ref:p.setFloating,...k(),style:{...f,zIndex:101},className:`
178
178
  z-101 px-3 py-2 cursor-help
179
179
  bg-fill-page-secondary
180
180
  text-text-primary text-sm font-medium
@@ -182,6 +182,6 @@ ${Bg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
182
182
  relative
183
183
  ${l}
184
184
  ${s}
185
- `,children:[t,o&&N.jsx(Tm,{ref:f,placement:h.placement||n})]})})})]})},Yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",_c="DEPOSIT_MODE_FAST",Am="DEPOSIT_MODE_NORMAL",KS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,accountId:o,accountKey:s,onDeposit:i,onCopy:l,getUserBizConfig:a,saveUserBizConfig:c,onClose:u})=>{const{t:f}=It(),p=r===R5,d=!p,h=(t||"").toUpperCase(),b=g.useMemo(()=>{const R=Number(e==null?void 0:e.chainId),z=String((e==null?void 0:e.chain)||"").trim().toUpperCase();return R===33431||R===3343||z==="EDGE"},[e==null?void 0:e.chainId,e==null?void 0:e.chain]),w=g.useMemo(()=>{const R=Number((e==null?void 0:e.cctpResolvedMaxFee)??0);return Number.isFinite(R)?h==="USDC"&&!b&&R!==0:!1},[h,b,e==null?void 0:e.cctpResolvedMaxFee]),T=!(r===j5&&h==="USDC"),x=g.useMemo(()=>{if(!e)return!1;const R=Number(e.chainId);return!Number.isNaN(R)&&(R===42161||R===421614)},[e]),E=p,A=g.useMemo(()=>{var R;return(R=e==null?void 0:e.tokenList)==null?void 0:R.find(z=>z.token===t||z.symbol===t)},[e,t]),k=g.useMemo(()=>{const R=(t||"").toUpperCase();if(!E&&R==="USDC")return f("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const G=f(E?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return E&&(!x||R==="USDC")?String(G).split(`
186
- `)[0]:G},[f,t,e==null?void 0:e.chain,E,x]),F=(A==null?void 0:A.minDepositSize)||"10",L=g.useMemo(()=>{const R=A==null?void 0:A.depositFeeRate;if(R==null)return"";const z=String(R).trim();return z?`${z}%`:""},[A==null?void 0:A.depositFeeRate]),[m,v]=g.useState("fast"),[S,I]=g.useState(""),[$,C]=g.useState(!1),D=g.useRef(!1),y=g.useMemo(()=>!!L&&m!=="standard",[L,m]),O=g.useMemo(()=>{const R=Number((e==null?void 0:e.blockTime)??0),z=Number((e==null?void 0:e.txConfirm)??0);if(!Number.isFinite(R)||!Number.isFinite(z))return 0;const W=R*z/60;return Math.trunc(W*100)/100},[e==null?void 0:e.blockTime,e==null?void 0:e.txConfirm]),P=w&&$&&m==="standard"?20:O;g.useEffect(()=>{if(D.current)return;D.current=!0;let R=!1;return C(!1),a?((async()=>{try{const W=await a();if(R)return;const G=W==null?void 0:W.depositMode;if(!(G===_c||G===Am)){C(!1);return}v(G===_c?"fast":"standard"),I((W==null?void 0:W.destinationPreference)||""),C(!0)}catch(W){console.error("[MPCDeposit] getUserBizConfig failed:",W),C(!1)}})(),()=>{R=!0}):()=>{R=!0}},[a]);const B=g.useCallback(async R=>{if(v(R),!c)return;const z=S||r||"";try{await c({depositMode:R==="fast"?_c:Am,destinationPreference:z})}catch(W){console.error("[MPCDeposit] saveUserBizConfig failed:",W)}},[c,S,r]);return N.jsxs(N.Fragment,{children:[w&&$&&N.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 mt-4 mb-3",children:N.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[N.jsx("button",{type:"button",onClick:()=>{B("fast")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${m==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),N.jsx("button",{type:"button",onClick:()=>{B("standard")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${m==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),N.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&N.jsx("div",{className:"bg-white rounded-lg",children:N.jsx(am,{value:n,size:80,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&N.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[N.jsx("span",{className:"flex-1 text-text-primary text-xs font-medium break-all mr-3",children:n}),N.jsx(X3,{onCopy:()=>{l&&l(n)},text:n,children:N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[N.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),N.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),N.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[N.jsxs("div",{className:"flex items-start",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1",children:N.jsx("p",{className:"text-xs text-functional-orange-1",children:k})})]}),d&&N.jsxs(N.Fragment,{children:[N.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),N.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:f("deposit.addressUpdatedNotice")})]})]}),N.jsxs("div",{className:"text-sm",children:[T&&N.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[N.jsx("span",{className:"text-text-tertiary",children:f("deposit.arrivalTime")}),N.jsx(Tn,{content:N.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:N.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})}),placement:"top",children:N.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed",children:f("deposit.arrivalEstimated",{v:P})})})]}),y&&N.jsxs("div",{className:`flex justify-between items-center h-[18px] ${T?"mt-1":"mt-4"}`,children:[N.jsx("span",{className:"text-text-tertiary",children:f("withdraw.feeRate")}),N.jsx(Tn,{content:f("deposit.feeRateTooltip"),placement:"top",children:N.jsx("span",{className:"text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:L})})]}),N.jsxs("div",{className:`flex justify-between items-center h-[18px] ${T||y?"mt-1":"mt-4"}`,children:[N.jsx("span",{className:"text-text-tertiary",children:f("deposit.minDeposit")}),N.jsxs("span",{className:"text-text-primary font-medium text-right",children:[F," ",t]})]}),d&&h!=="USDC"&&N.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[N.jsx("span",{className:"text-text-tertiary",children:f("deposit.maxDeposit")}),N.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]})]})},us=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return N.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},ZS=(e,t)=>Number(e)>Number(t),_t=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},fs=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return fs(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:_t(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},YS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=_t(Math.max(0,s).toString());return N.jsxs("span",{className:"flex items-center gap-1",children:[_t(e),N.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${_t(e)} ${n}`},XS=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},JS=(e,t,n)=>{if(!zh(e,n))return!1;try{const r=new ke(t||"0"),o=new ke("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},QS=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&zh(e,n))try{const i=new ke(o),l=new ke("200000");i.gt(l)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new ke(o||"0");return i.isNaN()?o:i.decimalPlaces(6,ke.ROUND_DOWN).toString()}catch{return o}},Nm={accountChains:[],defaultChainId:1,defaultAccountType:"",balances:{}};let it=null;const Om=g.forwardRef((e,t)=>{const[n,r]=g.useState(!1),[o,s]=g.useState(!1),[i,l]=g.useState(Nm),a=g.useCallback(h=>{l(h),r(!0)},[]),c=g.useCallback(h=>{l(b=>({...b,...h}))},[]),u=g.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=g.useCallback(h=>{s(h)},[]),p=g.useCallback(()=>n,[n]),d=g.useCallback(()=>o,[o]);return g.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,c,f,p,d]),g.useEffect(()=>(it={openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:f,isOpen:p,isLoading:d},()=>{it=null}),[a,u,c,f,p,d]),n?N.jsx(Fm,{isOpen:n,isLoading:o,onClose:u,accountChains:i.accountChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,getUserBizConfig:i.getUserBizConfig,saveUserBizConfig:i.saveUserBizConfig,onChainChange:h=>{var b;return(b=i.onChainChange)==null?void 0:b.call(i,h)},onTokenChange:h=>{var b;return(b=i.onTokenChange)==null?void 0:b.call(i,h)}}):null});Om.displayName="DepositManager";const Cm=e=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.openDeposit(e||Nm)},$m=()=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.closeDeposit()},Im=e=>{it&&it.updateDepositOptions(e)},Bi=e=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.setDepositLoading(e)},eP=()=>it?it.isOpen():!1,Mm=()=>it?it.isLoading():!1,tP=()=>({openDeposit:Cm,closeDeposit:$m,updateDepositOptions:Im,setDepositLoading:Bi,isOpen:eP,isLoading:Mm}),nP=e=>{const{t}=It(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:l,minDeposit:a=10}=e;return g.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const c=parseFloat(r||"0"),u=a,f=XS(r,s||"0",o);return!r||c===0||!o?{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:c<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,l,a,t])};function rP(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:l,usePublicClient:a,useSwitchChain:c}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=(o==null?void 0:o.approveSpender)||(o==null?void 0:o.contractAddress),d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=c(),{writeContractAsync:b}=l(),w=a(),T=i({address:u,abi:Dr,functionName:"allowance",args:[un(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),x=T!=null&&T.isSuccess?T.data:void 0,E=g.useMemo(()=>{if(d)return!0;if(!T.isSuccess||x===void 0||x===0n)return!1;try{const k=G6(String(Number(s||"0")||0),Number(f));return x>=k}catch{return!1}},[d,T.isSuccess,x,s,f]),A=g.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!b||!w||!u||!p)return;const F=un(u),L=un(p);if((x||0n)>0n){const S=await b({abi:Dr,address:F,functionName:"approve",args:[L,0n]});await w.waitForTransactionReceipt({hash:S})}const v=await b({abi:Dr,address:F,functionName:"approve",args:[L,Sf]});await w.waitForTransactionReceipt({hash:v}),T!=null&&T.refetch&&await T.refetch()}catch(k){console.error("[useApprove] onApprove failed:",k)}},[r,n,u,p,x,T,b,w,h]);return{approve:E,onApprove:A}}const oP=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return g.useEffect(()=>{o(un(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},sP=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var x;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=g.useMemo(()=>{const E="0x0000000000000000000000000000000000000000",A="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(k=>{const F=k.tokenAddress;if(!F)return!1;const L=F.toLowerCase();return!(F===E||L===A)})},[r]),[l,a]=g.useState({}),c=g.useCallback((E,A)=>{a(k=>({...k,[E]:A}))},[]),u=(x=o==null?void 0:o.useBalance)==null?void 0:x.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=g.useState(0),d=g.useMemo(()=>i.map(E=>g.createElement(oP,{key:`${E.tokenAddress}-${f}`,token:E,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:c})),[i,e,s,n,o,c,f]),h=g.useMemo(()=>{const E=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},A=i.map(F=>{const L=l[un(F.tokenAddress)],m=L==null?void 0:L.balance,v=m==null?void 0:m.data;return{address:un(F.tokenAddress),value:(v==null?void 0:v.value)||BigInt(0),formatted:(v==null?void 0:v.formatted)||"0",decimals:(v==null?void 0:v.decimals)||F.decimals}}).filter(F=>F.address),k=A.reduce((F,L)=>({...F,[L.address]:{balance:L}}),{});return{balanceList:A,baseTokenBalance:E,combinedData:k}},[u,l,i]),b=g.useCallback(async()=>h,[h]),w=g.useMemo(()=>{const E=(u==null?void 0:u.isLoading)||!1,A=Object.values(l).some(k=>{var F;return(F=k.balance)==null?void 0:F.isLoading});return E||A},[u==null?void 0:u.isLoading,l]),T=g.useCallback(()=>p(E=>E+1),[]);return{multicallRun:b,multicallRefresh:T,multicallResult:h,validErcTokens:i,isLoading:w,queryComponents:d}},Dm=6,iP=(e,t=Dm)=>{const n=Number(e);return!Number.isFinite(n)||n<0?t:Math.floor(n)},aP=e=>{if(e==null||e==="")return null;try{const t=new ke(e);return!t.isFinite()||t.isNaN()||t.lte(0)?null:t.decimalPlaces()??0}catch{return null}},Li=(e,t)=>{if(!e)return e;const n=Math.max(0,Math.floor(t));if(e===".")return n===0?"0":"0.";if((e.match(/\./g)||[]).length!==1)return e;const[o,s=""]=e.split(".");return n===0?o:s.length<=n?e:`${o}.${s.slice(0,n)}`},lP=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,accountId:o,accountKey:s,platformBalance:i,isLoading:l,wagmiHooks:a,onChainChange:c,onDeposit:u})=>{const{t:f}=It(),p=a.useAccount(),d=t.tokenList.find(_=>_.token===n||_.symbol===n),h=t.chainId,b=g.useMemo(()=>{if(!((n||"").toUpperCase()==="USDC"))return!1;const Y=Number((t==null?void 0:t.cctpResolvedMaxFee)??0);return Number.isFinite(Y)?Y!==0:!1},[t==null?void 0:t.cctpResolvedMaxFee,n]),[w,T]=g.useState(""),[x,E]=g.useState(()=>b?"fast":"standard");g.useEffect(()=>{T("")},[n,t.chainId]),g.useEffect(()=>{E(b?"fast":"standard")},[t.chainId,b]);const{multicallResult:A,queryComponents:k}=sP({account:e,chainId:t.chainId,contractAddress:(d==null?void 0:d.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:a}),F=g.useMemo(()=>{var Y;if(!d)return"0";if(!d.tokenAddress||d.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return A.baseTokenBalance.formatted;const _=A.combinedData[d.tokenAddress];return((Y=_==null?void 0:_.balance)==null?void 0:Y.formatted)||"0"},[d,A]),L="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",m="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",v=g.useMemo(()=>{var _,Y;return $5({chain:k5,transport:D5(t.rpcUrl||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_42161)||((Y=window==null?void 0:window.ENV)==null?void 0:Y.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),S="1000000000000",{formatted:I}=B5({client:v,tokenAddress:L,holder:m,decimals:6,fallbackFormatted:S,pollingInterval:12e3}),[$,C]=g.useState(!1),{approve:D,onApprove:y}=rP({account:e,accountChainId:p.chainId,targetChainId:+t.chainId,tokenInfo:d,amount:w,wagmiHooks:a}),O=g.useCallback(async()=>{if(!$)try{C(!0),await y()}catch(_){console.error("Approve failed:",_)}finally{C(!1)}},[$,y]),M=g.useMemo(()=>+p.chainId!=+t.chainId,[p.chainId,t.chainId]),P=g.useCallback(async()=>{c&&c(h)},[c,h]);g.useEffect(()=>{M&&P()},[M,P]);const{showLayerZeroTip:B,layerZeroTipKey:R}=g.useMemo(()=>{const _=+t.chainId==42161||+t.chainId==421614,Y=(n==null?void 0:n.toUpperCase())==="USDT",Q=new ke(w||"0"),ve=new ke("200000");let Z=!1,se;if(_&&Y&&w)if(Q.gte(ve))Z=!0,se="deposit.layerZeroDepositTipGte200k";else{const ue=I;if(typeof ue=="string"&&ue.length>0){const $e=new ke(ue);!$e.isNaN()&&Q.gte($e)&&(Z=!0,se="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:Z,layerZeroTipKey:se}},[t.chainId,n,w,I]),z=g.useCallback(()=>QS(+t.chainId,F||"0",n,r),[F,t==null?void 0:t.chainId,n,r]),W=g.useMemo(()=>{const _=iP(d==null?void 0:d.decimals,Dm),Y=aP((d==null?void 0:d.stepSize)??(d==null?void 0:d.stepsize));return Y===null?_:Math.min(_,Y)},[d==null?void 0:d.decimals,d==null?void 0:d.stepSize,d==null?void 0:d.stepsize]),G=g.useMemo(()=>r!=="spot"&&JS(+t.chainId,w,n),[r,t==null?void 0:t.chainId,w,n]),J=g.useMemo(()=>"deposit.maxDepositSplitTip",[]),K=g.useMemo(()=>{const _=Number((t==null?void 0:t.blockTime)??0),Y=Number((t==null?void 0:t.txConfirm)??0);if(!Number.isFinite(_)||!Number.isFinite(Y))return 0;const Q=_*Y/60;return Math.trunc(Q*100)/100},[t==null?void 0:t.blockTime,t==null?void 0:t.txConfirm]),te=b&&x==="standard"?20:K,me=g.useMemo(()=>{const _=d==null?void 0:d.depositFeeRate;if(_==null)return"";const Y=String(_).trim();return Y?`${Y}%`:""},[d==null?void 0:d.depositFeeRate]),he=b&&x==="fast"&&!!me,ye=nP({isNetworkMismatch:M,depositAmount:w,approved:D,currentTokenBalance:F,selectedToken:n,showLayerZeroTip:B,minDeposit:d!=null&&d.minDepositSize?parseFloat(d.minDepositSize):10}),we=_=>{const Y=_.target.value,Q=Li(Y,W),ve=z(),Z=fs(Q,ve);if(Z.isValid){const se=Li(Z.formattedValue,W);T(se),Z.errorType}else return Z.errorType==="exceed_balance",void 0},oe=g.useCallback(async()=>{Bi(!0);try{u&&u({amount:w,chainId:h,tokenAddress:(d==null?void 0:d.tokenAddress)||"",tokenSymbol:n,depositSpeed:x,accountType:r,accountId:o,key:s})}catch(_){console.error("Deposit error:",_),Bi(!1)}},[u,w,h,d==null?void 0:d.tokenAddress,x,r,o,s,n]);return N.jsxs(N.Fragment,{children:[k,b&&N.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 my-4",children:N.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[N.jsx("button",{type:"button",onClick:()=>E("fast"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),N.jsx("button",{type:"button",onClick:()=>E("standard"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),N.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[N.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[N.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:w,onChange:we,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),N.jsx("button",{onClick:()=>{const _=z(),Y=Li(_,W),Q=fs(Y,_);T(Li(Q.formattedValue,W))},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),N.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx(Tn,{content:f("deposit.availableDesc"),children:N.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),N.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:YS(F||"0",w,n)})]})]}),!D&&ZS(w||"0",0)&&N.jsxs("div",{className:"flex justify-center flex-col items-center",children:[N.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:f("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),N.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:f("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),N.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:O,disabled:$,children:$?N.jsx(us,{size:"xs",inline:!0}):f("deposit.enableWithToken",{token:n})})]}),B&&N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(R||"deposit.layerZeroDepositTip")})]}),N.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"})]}),G&&N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(J)})]}),G&&N.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:!(G||B)&&N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:f("deposit.noPrivateKeyWalletWarning")})]}),N.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[N.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[N.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.arrivalTime")}),N.jsx(Tn,{content:N.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:N.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})}),placement:"top",children:N.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:te})})})]}),he&&N.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[N.jsx("span",{className:"text-sm text-text-tertiary",children:f("withdraw.feeRate")}),N.jsx(Tn,{content:f("deposit.feeRateTooltip"),placement:"top",children:N.jsx("span",{className:"text-sm text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:me})})]}),N.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[N.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.equity")}),N.jsx("span",{className:"text-sm text-text-primary font-medium",children:w?N.jsxs("span",{className:"flex items-center gap-1",children:[_t(i),N.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),_t((parseFloat(i)+parseFloat(w)).toString())," ",n]}):`${_t(i)} ${n}`})]})]}),N.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${ye.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:oe,disabled:ye.disabled||l,children:[(l||M)&&N.jsx(us,{size:"xs"}),ye.text]})]})},km=e=>e.toLocaleUpperCase()===gn?gn:Xs,ds=e=>km(e.wallet)===gn,Vc=e=>km(e.wallet)===Xs,Fi=e=>e?e==="perp"?Me.PERPETUAL:e==="perp-v2"||e==="perp_v2"?Me.PERPETUALV2:e:"",Bm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBMSURBVHgBvVt7kBTHef/17N77fRwSiNeBBAGBpVNJERKyoqOSuByiVLAScOKqJKAYJU4F8XCVY8d/cLiSkKSS4pDtKJKRdFhxYoNskTKS4jixFguEICAdiDtAvJb3cRzcg7u9vX1M5/t6puexO7u3Byd+VDOzPT3dPd/39ffqPoFbhJSymS5NVJ6yr7V2YfRRidrlMJWIECKC28Bnv5dslqZskjCeEhA0nvSPJ0SU5hQ1IA/DQGTPqqIIbgMLvjzcbAjxoBRoFlLSeKJWqjEFDY0++p6oCRmFFO2Aufvo1rIIbgFiLI3pA/mD11BZC/fjC0WUSoTKRp58IS80vyZrEylzjTDlLYxHYwgZKUqHNka+Uth4TWtlbWowvkZArjWlqBEikz4SNsmkdZXqB7WDaVrfV1SEje3/WhZFgSiIATbhN8Ai/HigDXkYwYRPJkwaT47PeAJt+RjBhE8PDm+QEGvpW/VLkglMUFeuFja13HvBtHHu1SOp3nktHMa3CmHEqAygDlniWzB2iR8NUVhMaPNWPv5yeo0hZcv4j0cqSsiN7z8XbvPWLlgVXwMz3UJk9I4nLekWmqD6t9WTUEzw1vme8zNqc84wzI0ff6+yLe+s8j2kwTdj/KQ+F1rpA9fxzRMvpTePm9TnhGjd+2chNd78Z2ObiVZrbYJaT4Ur4TYhhbMoPM8z7h3dZD+RVhU1MURrx9bydTlnE1Rpq5w3qTTjDqB/BO2//f10H825GXcAMiXb+z8c6SPiNXuIK7XOt+oE/WbVI2wmKBpLr9632nrbeVWVh7RSthfL5OL2trq+zLmEc8zxXSpN8cEBlFZW49OEGR/A2rcqmiBxxzDQmWgiowlbcO2RpUfStd6XnnpNfOsdVk26NfVFxDcVE/z92CsIsimOMAv04sy5hDIrbLWzlO9f+OJnkDwVwcRygVD9NIhwCcYDTPTBfa/jo3//W/z1OzGcLnsYdwqxaBLJ3rS6l9Z/mpD21ZJk3d4yspZIewjrFW/nfVtdaXXkukxWXePEpm/W9rT/3c+88/GpIBpsBV1e4/uO997B97+5QtUvnGpg4bQQyh9ejvJHlqFk1uO4FcTP7MPQwR2Id/wXdh/vxc/Ll+Hk45txpzByLYXBUwm49HFhMUPYasiRcjw6NyTmTQ9hLpUpDRa5bsYkjp03ceB4Cv93Ig29iiz1IzNtgcMEezWsO9FW0+q0cCYgZSMs1cNXbN/0PA698yOnq+oSgWfmh+lKy6ZuGioeXoayR5YjXDcV+cDSfvO9rRjcs9W6HwHeoolfMqbi6G+8gXjlNNwJmCMS/R1xpONewrvCyuLrld4vfLZI/OXSYiK6kbffSz0mvrMzgTf3JLXb6qwatz/nN3fdNyLMmVHbHngZwJK/Qv/esGQ22AZ4wUxYOM3AvInupKrvmYaiHJYkkSIDe/mC8/tYt4k950yMpCROLmpF96zluBVMrhK4bwJQWWz9HiSh7hoETvbkNiQ3T41gpDul7r06Ah5isYROmWBg06oylnyMBcyIP/77GC5eM7M8J3jcVNt4t57YVqM8Ix09NNLlrG49PNiPliVzcg7WNNnArzVaE2TiV1UEtxuIEROStPTpuw9cTOPwFWX5MEJSf3DpfowFVcUCyz4DLF9goDKHKeq6CXx4ReK1gxJXBl0KsPT3HBzSXjy0+pH2b9t7B6ua764pH1Xqc4GZ8BdbhnD8vDLejoekepd+25IwZB2vAj3SBm9HZZU1qJuUWzW0EyHbPkxhgNRJMuX6xV6kTYv4rHLe7Eg5xGecf+CrGAuWLxDY8YcGnn04N/EZk6qAJXOo7Ze4rauKh84n7ElK+5+tr/mhJBeGChP9dojP4Hf/ZU0FpkxwAzW+Sm1grHtlW8IpgwNc6NGaMzub9dCivIMNkFT9x5Ekjl0jlZLMfp5KWSrnh0dS6In5OTRwV2FGnKX+208beH5RfsIHgZm16XOGUlMjfZbqMSU0BRQbTJc6eP0bFbdFfA3uY9Oqcrtf6bsSo4XFCF4Npgo4Q3ZWMyv67O26gE8OvJt3MJbyMzekYsCcu/yT/8UnJn55Nq3aeDFw9yJcnrcKheDlpSHMv9sfKw7Sitp5XOLf2iVeOiDxzicS/3tGKjswoUz4GDWjVmCyMPHT90YCl6ntXuKZJ0uoFGO8MJVsJHlKov2UYryt87zRmVJFpfUPfH03m89m3AbYMM8OkJxG+viPuwSpIP+H999dmPSz5FZm0OTVQxI7jppKrWXio8sSL7xvSb5X/XScTtr6QCpt73go/M+0wtbnnynFeGPF50vQ9rO4urd4bzqT0oyn/x9kBjwY1EEhEbDlmobUNRMNFLz9Hj37cUfax4Sh+vkoBCzRq3elSQWFFCO+8XNTEXk0vHqI2l0R2PSbhvKMfvBBUqkaSwyl4/loLJwbyqt6/uqlIew/lrTesvjlfOzC+8P4h+cqA9/jPtmT2n+MV4H2sixPSKtB+rGYGdAY1AEb4nyYUmPg6TkGSsJOBtCXrmUwY5gJuyhY6RmyKuMVuY0763wmtvZgrty0mMB1J6+P3l6DGbXyJ2nFxP4B046CYPufAto956pH54aRDx8cS7BrCX/+3yZiZ36BWDi3CB90JlVbw9BRsnQibrp7ICcD7pm9QK0CbyxQWiQw9y6Be8lXnlLhl/ogBjCYCV+iYS4RA05fN7E/BwOUwf0dQ3kyq39qEsFdJgRhcqXVnsHtM5mg30vF0q7Ho77fjbbI/8H9M/IzwJFWx4UUlPuR0h/xBmPKRJ2qtvJFbqCm7rnzOv6CwLw7u6GfW/k1NNYbaL4vhBWPhvH1Xw/jdxeEMK0q/9hmgGDwO/xuqjhYtTExdXDF97Mn5B5DE5+ZxYXvuS4I6ZQJ1wtxvFHnd1XFaHR00wzS9SOd3/kwpSEEK2nnJPWk9Y7lDdFNTV6/6/EnFxHhQ8QAgxhhTXSQXErTDPhQT13QvPidwVjwhDMNbj4meImvMRoT7FnZc/O4h1JitCysJqAmupVW0JnS0WEzzJNZdQRBZVSZAX25XjbP78uqS5E9unot6ZSe6ylVEil3Qqm0dOq9bUdIJ1eaA1l9aoPb5VE3QUwIIr5GEBNmk9BUl7HKMLUfDouY0OaY9Hsa+cDvmaZmmss33U8+DMTs5eYpWgB4FdBtX14GpI7syKqrrRGorXLF9XSsjKRfIiTcxSQovuO6IzddD6Ga3qmnBVeB/sCxtMHNxYQg4nNbb3svE5j4fF9V7joJbnGlufNcEgVAuhJsFqyCOqNJn+qzm0tbHkAki7IFakeAIZZ9FyG7O7I6ZUPLTAiFi/DPp6bg7ct1+Js5ZzBLxOFkV6jN8eFqbDxzL5bc04uv3ncJFWUGeQJp3JfsxNWSYEOsmcCupya0ZgIHYJnE57YMb3vNBKXWKChjI3uBknBCZCbhLFvVGU0hHxbOK4Klsz3a2u5o4bxRPKjOhMNoT2paOHvKJqKskzgKzkrKp49sR2LX+sCOudNYnKS5jIKiZAjRvmLMqRlBSbGdbEsIXIoVYWJFGlVFaQzFQigrNYkBEj8pfRYvVm5APkyu8hM1E5r42tPJ1/6Vt2P41rabTiDmfIN95Zq9327A1LvGlv0cDRe703hi9TXAE/x5DY7tNW5ktrYHdRCkfjS4r9ISi9hM4AUNw1ltZtUm1DNGcbFFfMa96U6MhiB1pJFJ/NHaT58cdlSFzgFJjzvE95vfGMR4o5X6tG2v7UVJrxOlYJiIGPaJtSw7cHMIuNHvLxevmjh1LqVKF3E4aa9eZogmMCPkESZuc7k75bzXcHEvKgIMcSaCiBpE/NHav3w8RFupwklHuEbQTkXQdXskhn0dCYwXLtL3/uhdysUr1WVaW2vuzpieQzT6xuSIVmxbMjspvjc7Z1NeaqgOkrT5k0pbTBq28zJFYQ8D7F75GbfhZcjvsCtaVhrCb/W9gkLgJWo+4o/Wvmp6GVy6+11KvRrWf7dXqY3bBfexvOWGuueATRtvNZrUDFGRSITr9IYMB2O93o5GaP+256VlWQOkyN283ptCVSXtEZdZlB6umoqNb0fV/oDGPy2difJBazcsNky2YjCNhvowrQ6BIaMaz878GIWCdTy7qkFJuELamzTn87+46iRytAoQvpMjQs5vDIlXvlZP9iCMWwEb+y//Y6/siCZFwLkiexVYgV26yJjV9cPJUcOaiGAV5FsFvPEuSrOj1jAt54qKEEm5QLp+DmKPrcfBCcvw36clPrjolhMz/kg94zY8m4oKQxGfwSpoSX9hq4DBUlwo8YPaGzTn6hkV/kgW7j37+VKmBREOv7+hR6mQseL9oyNYRu92RBPK39KpB+m4Qa4Kov+3MfH5zrsnzKvgLDypid7t6xE7tN03EDOFmTMw6QkMl04EGRHsOfARtrz6A1+7P/2DZ/D55kUqE1k6fBU1V/epVSXjlv7nVbB6xl51vRPgVXDhl90wkzpkzzg5Iv0nGr64uALrlldh2iirgaV+665BbH2LDbl7CiIYSvrPmcWhxVkMsGfhc0ljB7ejd8d6RXC2CXz1Hkm5cOIIus8ew9Bw3I4yXVRVVqqIo+6eWZj1wK869cyEkdP7kKDrmzfmYduE/C7peKL/3BBuHB9w4gAb3vBApxOdnP1j95fIRQtKxPyZxaguh2rC0TMT/v2jcTLeI94TENAqx3vEUfWo9ZBhrOj68dRtevAsblFDPrOi9ivN4QHVwijNLaV917pw4tB7iMf8rlxpeSV+5ZEnUdswKee7fEzlOx9VYvvHo8T044jrx/vRFx2y9qjc7K0vV09fLC0CSmQfUXfgDYQ9u15SCH+44R5XlGi9snO675yoyNHzuxjDThkTP5MBlTX1CBcVts23eldhmy3jhcv7exDvtdxOLbkW9AlnJ0wLUCnek9LSlnT3eGOOtvSfPHxl54yHMqaS93AuM6EJdwB9cUSeft2shfpLlE8fZsKMnP6fy7RpKvRuoC267uFcr+rQGzBe2GLuBLlutKvfsy5WUxEpRfoL0Z0zs+KtwHQ0e0VUmFtb8OljS12ZWLz3udBDtFY/9fF4jH2rixd3/2fjQxDmC4A3X595isHNnsE5xKv1u5S+WELdet+z+jSEuaVr5/TFQcRn5N0PICawUV4J648pxhs8oXX2GAp7/rxoLdnylfzHFBh/0HjmOh5DV1zdOXMt6X7r+7wuqvSnj634zQngpOW2qsyozu/LrHaUziQXcN0VGiPfpAQKgH1yroXKn2B8wJLeYscfWXjsRdkYMpItJB/jMh5Lfbgk3BJZGTzepKVnG4mmGyg1sUK19xxVtKNW4VcvfrWUqaIMIbeUGUZLLqn3zQ1jgIcRTyHHXnIe6GCvNRfhM+EyIkTjqbHHNJ4wifCl4dZchM8EMyKdxgZaFc1Ez0b4AgVtI6zUjtc7Us8M9BMbtpQbRmshhNcYEwO8sA90cWFD1mgX75+pcuFM626+3vafqb6YbCaF2Qw2nEI02sLgGY/sFmQ7xaC7hSna93zl9v5MteHpk80U9z9FdqKJyNtIdG8kdtRa+wqil3R3vwlB34WINFOHe3bNjuAW8P/4M203oLS1YgAAAABJRU5ErkJggg==",Lm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0WSURBVHgB1ZsNcFTVFYDPe7thd7NZsonIT6CwQWvAnwTaRNuxQoJ2SqpViW3RiiMgVq2dgcy0dnRqkwz9Ga0dNjOt2BYVi2hpVaSFBmyRRWBajUoIWIlYWERAhWE3xoT87O7rOfftDW/fu+9vEzrTb+bN7rvvvnd2z7n3nHN/ngR5kvh7US2AMkvKKHMBpFkgQRgUPAgJkvg9jtfjkj+yTy6cGgvVbI3BCFAUpRY/ZuExN/sZzh5EEo949tiHR0ySpBiMhG+ivAzQ/5qL/8UoT8rKU1CeDDF4IT95kpvKiY3hsFw0uFxRpBXDynZO3Ddlaaz/g3UtJfXJuJMbUOkkYzkeKwDcy8MjhkcLGiPu6I6bUZ48AnkSyiuAFvijQ3ng0ABM8YVDTYr6w0aEHJgG8piStcGrdpsqJqv4JhgFeVnWgpUhVMWPnjwJ5Tk0hK0Bul8JLFdAbs6jxdsR945vaCmavW6tthCVTy2wGWD05YFqhLU5pbegPOX8yYOXdPJ0WBqge1twlTJ6rVCIJ1AWDc051EjfUfmrwIG8gVQG9hw6DfHTvew8Mi4INeWlEPJ7wQFRNAKTBw3O5I2QKBqh0eyi0ADkcqTg0EZsGbXwP8AfaezwXbKSAmmtVT1SfOexbtj/YZJ910LKr5g4Fg1RAnac+RQ6LljKEoVaq3qzIviDLgeoiqjfw0G1PH4KozDafuc7GGQOAHTEwRoJOiANdfCylDReEpDcFtwLaqbhCsmLiVAq6fY2KPryP8ETusKyTtfJHmiPJ6Cnf4idH/l3J+zZvJF9r7luPlR84Sr2nQxRHSmFGZNCps+a/QNU2hFzWYvrAO7Eo/YycET8E/Q1f8JAs8OiEgXoF6U6Y7GOfN2O7J8GwZo2SJ15Dc6+c6/j+/wVj4Bv2v2m108kz0L7kQT7ZOeHD0H79q34+X5OvXGTJsP8O5ZBqKSUnZMhbpo92eCWGp9Cn7BFLIsUvmoJtrxyyAsyxJJfY694x7SKwR3lGCDxSnCxpMDT4BKufDkwlZ0PHn/WkRHGlC2CwOVPCK/19KdQ8Weg66Me9TxxBt7c3gYH33rD8pkVX7wSaq6tHzZExcTQcHygFkoKErH8BtTOEhgVmrE3tGwwvdyIRojyk2EDJNr8EUn2UCeKgAv0yufYGcHsPr2fH+g/C517YrB/90723SnV6JYqr64Fnz/AzicXj4Plvy9mrVRP07dRaQthVLEwQhIHeOU8Hnh46UN3+igjqAUXmCmRPXhsJV6fCqlTm4X3+mc8At7Sa3LKyM9v6TwJx870QTqjQNdbr8OWp5+AY+8dhHQqBW4gF/V+59vgCwTQPU2Bx/9WBAeO+gz1zofyCRY/JDVQ6/BjuR/ebdkGkO0B2dZ/BFxgpXwtop5A94bm5P6yTXtP2Pr5fPGPmwntvl8ayiPjMZivhvNK3U9MYkIGSqgXsAglezxNigKOMVO+kurGTKg4p2zM5EXsU2sE38UP5tShlk/KZ35+28twcN8+GE3eT39NWL6jBRxBKSdlTZR+EpEL1UDN01Irnv6+mnUle3UXZJboNDMDKC7yfTPlZ85+AL1v1oO35BpDYNUbwVsyJ+f6p9nUsuvt102VPzYUhBu/fh1UXFIOkydNgOMnP4aHV0Zh0cKbWJmW9Rv+AgffOzx83uurNDyPUk3qAVaQ0lo3q1mTQYHZZ5ALs3oOXVuBAb7ZGA/YiN+baGOzmhFwgJ3yM2ePwiAehJkRBk+ut3VbemZ8fjo8+fgvIBQ61+Ta1+xnhrhv2Xdyyjdt+YeqfB+WDfSi8q+AQY9RQ6Q4KyhY1zWBMGhzKKsi90I9ycoIy68XGiBMM64ydoVacEim/yikMc/PKdMonzN4Av3+AWMGlE7sZj3ELdFHf5yj5BMnP4HVa56De5fdllNOrF7zPGQq5kC6uoGdkwH0kPuwUhi1djvlc7ihkn3mdchVCQd1ON0tYxSuAhf0oRsZwsDK7hcon6M3An2nMk+oEtxALbxsUq62Hl65Cm66/jp2aCGjnPgsA5maBshUzgelbCacLZhueKbdCJfSRyfK51Dd1r9a16EpDQPo+mXMgyJWNzK3U93GPjlkhP7//NygfHI7voseGj7nRuDKV5/n3P1wF6OFXEzXocOGct4r0qh8JXQhK0vPuwcGC43D2rk2BlgbA9ewOGHRC2guyYAEVV4r/6/1+fTZ217P3BAxgAbQQsqnkS2HX+eKH35m4TRwCvl9LaqSn4fbMfDqe8Wj0d+h3y9k7odDhhj0jKWunkO40Fwm+XRRwLWD7nnmVXXiTkRC/Myw12yeXx9wRUbg6JXvz/YCvZEKsI4+TTVD5HpWr1nPBi6iXvHqzn+pv/PEu5BB18PJDBnnG638vxvXo2eF60kcCMumlyTn5QrGAidlTtc/zVzPpi3bDb2ip6dXDbzl1TgDdyHIu9fB/xPe7AK6oReQbycfz/w/tn6rgNufbenc/2t9vhYqoykIu15gpmQKuvpe8eyGTWrgvXYRZHpOg3fTT8Hz5ouYBd3CrssFiqEXWLkYu7GBFU0LzQM8nynVkSQXRJNCQjfEjRC47Ak2iNIqnxQ5GH982B1xI5ChtMovyLqmoWyZMpS0NIDY9TwndD3DgReDLQu8eKQr68HTuZXFAirzCAywL24+5cwXXvKJAzTgMosvMVGhBHF0QVIHWMCNYMh2pt6vxghNdkRG0Cu/EOvSwQ2R7tlvKqts4gShkqmVU84vDLyoZG3gzVD+PyYInld/y879xWmDHKsVLFI+KdItNCq2Cu47DwgKM3BUxnXYneACbcDlgVlrBA5XPocbIXVml+mzH1i2wFC29HsPwry5XzLk/Dzwput1y62YCaWwR0gYjIsP74LABcZZVIsFEwaNXN24IqprN7IWysSlShkU6x6QUx9dh34eR2QEvfKHy0u/gn66U/jsmkiJYfWKDaxwzueBFd/NKecxgf2mfVsNz6IBmIJBuS/2Bwj4PzNcp4m1mKhFZqFeYDe9wKE6dnXJ/wsNIENMLqn/LMYCsQNotlN1R7kZjtYIZsqnGNCHwTmV2MWeoyUUKIDq8tKcMu7fRTGBBV40DJPd9RpLPfWk6u4BamJFRzawQKznmRhYQgrd+1jWrwtmPamMgi7VsTMUrRcLiNNuuux6QFGzJCtN4BDaXMWzIy1kGNFEG1c+h7Ilv2bELOIudD1khLaNT+aUU9n8BUtzyijYpr71M3UCTvs70TgUCz6asRJO9cw2yNj7K5MRqg42HR0/N0bgcztOpqPpnvL7BBdo89aL0hJ1HOD3RsEF5wKzsSfo0SufGDz6G7CC/Hv72/vhhyvuNlxjgVeH1HMKU8+XDOUsE0J3VCW3gQhaoHcCVzgFWjpuvtKZ8gmzNWi2cw7ICyEldcmkokit4AIzI2gRKZ8gFzRgYgQ+3UBBl4KvFu2IV4+MqafeFY31pKHu9ruh4Y6FMK+q23AP+eVG96NXx5DrMQm+a/m2xXMjYZ+32Wks4FgZwUz5HJqm0McCgvz9oltvNKSj2sBrhkypJ64B+CQFrirug9smJWFmqQf/moz+WhG22uhmyx0MeUPKbxY/N85bPzG8KP/IM/39P7ptzIAkw3xwASmRFt4Lxn8DpAJ1gGWnfEZmAAcFA+Ad91XDpcrLZxjm+fe89wns7zoCp08eN32kNNgHM6d/Dm6sCMK0wBB4JXVbyvVVZXDR+AD4CwC2CXI+aqUUDIVTxnlgoXyiEf58biu7YXomsbUoKklsg6wreGBOJ16zV74Gu41ZBG1PeWqXumeA1o13vLAejusW7CdPvxiqr62HMvwkysIBtk2RPrWQy4mKN2o4SimtsN2YpUArbJRyNr2Jtya+EtyRz75QMoJorsgOMpx+i4oe2qBFO+T41sSut96A9u1qcL36hgYov1Rd+aKxxLyZ4w2K12K6UyGLk7VeLTSuaN1iuzWxA7Oe2cZiAYkd4bA0NLQj+2bIeWfMhAWxQNU6mo+yldf5YRI6j306bAgO+fnKzxXDFVPC7LsVp7ohNv4u9kaPpTyaL6LshxZwaJqBG4SnpTSnxAZ1NiNrti80DQscb87l5OuO3CD5p7QWz+1i3RKnRSgdtpXHty3y7enk52kgZ6f4LK2SlHUDC1CeBOf1/4ncjhbbKfpEW3CxpL49EoFRRCooSRZMvLWl8NLHcsYgaITFAKMvD9T3yOgFjdwxT8P5lafdByrC2StKbf4IyJ5mrHwnjBDawg5yUWsm+XFzyYKkMO1FI0RAfUtmxPKy0BinGZUvTrNvRnkSUBo+OvKo1dNbNy9Ltmm900UqhsYQ9KZixM29UkE4mRnoboV+b9RM8Xo0hnAtD9QWSIqPmipezzlD5C8vA1Eniue4MoAWtqFLhlp0T1Vo7Qhb3M99TTUp+yZ0pPs/3um94JqOUXpNlQ7aRhPJHtrXVOmgLJ+m1ztG6TXVWtq5wGQpAnmU2SgoT8bPPF9T/S+t/b7McgGVIAAAAABJRU5ErkJggg==",Fm=({isOpen:e,isLoading:t=!1,onClose:n,accountChains:r,defaultChainId:o,defaultSymbol:s,defaultAccountType:i,balances:l,wagmiHooks:a,onDeposit:c,onCopy:u,getUserBizConfig:f,saveUserBizConfig:p,onChainChange:d,onTokenChange:h})=>{const{t:b}=It(),w=g.useMemo(()=>r.map(_=>({..._,key:Fi(_.key)})),[r]),T=g.useMemo(()=>Fi(i),[i]),x=g.useMemo(()=>w.some(_=>_.key===Me.PERPETUALV2),[w]),E=g.useMemo(()=>{var Y;if(!w||w.length===0)return T;const _=w.find(Q=>Q.key===T);return(_==null?void 0:_.key)||((Y=w[0])==null?void 0:Y.key)||T},[w,T]),[A,k]=g.useState(E),F=g.useCallback(_=>{var Y;return((Y=w.find(Q=>Q.key===_))==null?void 0:Y.chains)||[]},[w]),L=F(E),m=()=>{var ue;if(!L||L.length===0)return{chainId:o||1,token:""};const _=o||((ue=L[0])==null?void 0:ue.chainId),Y=L.find(Se=>Se.chainId===_)||L[0],Q=(Y==null?void 0:Y.tokenList)||[],ve=(s||"").toUpperCase();if(ve&&Q.length>0){const Se=Q.find($e=>($e.token||$e.symbol||"").toUpperCase()===ve);if(Se)return{chainId:Y.chainId,token:Se.token||Se.symbol||""}}if(ve)for(const Se of L){const xe=((Se==null?void 0:Se.tokenList)||[]).find(Ae=>(Ae.token||Ae.symbol||"").toUpperCase()===ve);if(xe)return{chainId:Se.chainId,token:xe.token||xe.symbol||""}}const Z=Q.length>0?Y:L.find(Se=>(Se.tokenList||[]).length>0)||Y,se=((Z==null?void 0:Z.tokenList)||[])[0];return{chainId:(Z==null?void 0:Z.chainId)||Y.chainId||1,token:(se==null?void 0:se.token)||(se==null?void 0:se.symbol)||""}},[{chainId:v,token:S}]=g.useState(()=>m()),[I,$]=g.useState(v),C=g.useMemo(()=>w.find(_=>_.key===A)||w[0],[w,A]),D=g.useMemo(()=>(C==null?void 0:C.chains)||[],[C]),y=g.useMemo(()=>{var Z,se;if(!C||!Vc(C.account)||!(A===Me.SPOT||A===Me.PERPETUALV2))return!1;const Q=!!((Z=C.walletOptions)!=null&&Z.evm),ve=!!((se=C.walletOptions)!=null&&se.mpc);return Q&&ve},[C,A]),O=g.useCallback(()=>{var _,Y;return(_=C==null?void 0:C.walletOptions)!=null&&_.evm?"evm":(Y=C==null?void 0:C.walletOptions)!=null&&Y.mpc||C!=null&&C.account&&ds(C.account)?"mpc":"evm"},[C]),[M,P]=g.useState(()=>y?null:O()),B=g.useRef(A),R=g.useRef(y);g.useEffect(()=>{const _=B.current!==A,Y=!R.current&&y;if(B.current=A,R.current=y,y){(_||Y)&&P(null);return}P(O())},[A,y,O]);const z=g.useMemo(()=>{if(!C)return;if(!y)return C.account;if(!M)return;const _=C.walletOptions;return M==="mpc"?(_==null?void 0:_.mpc)||C.account:(_==null?void 0:_.evm)||C.account},[C,M,y]),W=g.useMemo(()=>z&&ds(z)?gn:Xs,[z]),G=D.find(_=>_.chainId===I)||D[0],[J,K]=g.useState(S),V=g.useCallback(_=>{$(_),d==null||d(_)},[d]),te=g.useCallback(_=>{K(_),h==null||h(_)},[h]),me=g.useMemo(()=>{const _=(J||"").toLowerCase();if(!_)return"0";const Y=(l==null?void 0:l[A])||(A===Me.PERPETUAL?l==null?void 0:l.perp:void 0),Q=Y==null?void 0:Y[_];return typeof Q=="string"&&Q.length>0?Q:"0"},[l,A,J]),[he,ye]=g.useState(!1),we=_=>{_.target===_.currentTarget?ye(!0):ye(!1)},oe=_=>{he&&_.target===_.currentTarget&&n(),ye(!1)};return e?Ke.createPortal(N.jsx("div",{className:"edgex-components",children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:we,onMouseUp:oe,"aria-hidden":"true",children:N.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-2 border-solid border-line-divider-secondary",onClick:_=>{_.stopPropagation()},children:[N.jsxs("div",{className:"flex items-center justify-between mb-4",children:[N.jsx("h2",{className:"text-lg font-semibold text-white",children:b("deposit.title")}),N.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:N.jsx(I0,{className:"h-4 w-4"})})]}),N.jsx(Wh,{selectedAccount:A,options:w.map(_=>({value:_.key,label:_.key===Me.SPOT?b("account.spot"):_.key===Me.PERPETUAL?b(x?"account.perpetual-v1":"account.perp"):_.key===Me.PERPETUALV2?b("account.perpetual-v2"):_.key})),onAccountChange:_=>{var xe,Ae;const Y=_||A;k(Y);const Q=F(Y);if(!Q||Q.length===0)return;const ve=Q.find(lt=>lt.chainId===I),Z=ve?ve.chainId:Q[0].chainId;$(Z),d==null||d(Z);const se=Q.find(lt=>lt.chainId===Z),ue=(se==null?void 0:se.tokenList)||[],$e=ue.some(lt=>(lt.symbol||lt.token)===J)?J:((xe=ue[0])==null?void 0:xe.symbol)||((Ae=ue[0])==null?void 0:Ae.token)||"";$e&&(K($e),h==null||h($e))},className:"w-full"}),N.jsx(Uh,{currentActiveChain:G,chainList:D,onChainChange:V,curSelectToken:J,onTokenChange:te,walletType:W,accountType:A}),y&&!M&&N.jsxs("div",{className:"mb-4",children:[N.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),N.jsx("button",{type:"button",onClick:()=>P("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:b("deposit.connectedWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:Bm,className:"w-12 h-5"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:b("deposit.connectedWalletDesc")})]})}),N.jsxs("div",{className:"flex items-center my-2",children:[N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),N.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:b("deposit.or")}),N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),N.jsx("button",{type:"button",onClick:()=>P("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:b("deposit.externalWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:Lm,className:"w-12 h-5"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:b("deposit.externalWalletDesc")})]})})]}),(!y||M)&&N.jsxs(N.Fragment,{children:[z&&ds(z)&&N.jsx(KS,{address:z.smartWalletAddress,currentActiveChain:G,selectedToken:J,accountType:A,accountId:z.accountId,accountKey:C==null?void 0:C.key,onDeposit:c,onCopy:u,getUserBizConfig:f,saveUserBizConfig:p,onClose:n}),z&&Vc(z)&&N.jsx(lP,{address:z.ethAddress,currentActiveChain:G,selectedToken:J,accountType:A,accountId:z.accountId,accountKey:C==null?void 0:C.key,platformBalance:me,isLoading:t,wagmiHooks:a,onChainChange:V,onDeposit:c,onClose:n})]})]})})})}),document.body):null},Hc=6,cP=(e,t=Hc)=>{const n=Number(e);return!Number.isFinite(n)||n<0?t:Math.floor(n)},uP=e=>{if(e==null||e==="")return null;try{const t=new ke(e);return!t.isFinite()||t.isNaN()||t.lte(0)?null:t.decimalPlaces()??0}catch{return null}},ps=(e,t)=>{if(!e)return e;const n=Math.max(0,Math.floor(t));if(e===".")return n===0?"0":"0.";if((e.match(/\./g)||[]).length!==1)return e;const[o,s=""]=e.split(".");return n===0?o:s.length<=n?e:`${o}.${s.slice(0,n)}`},fP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",decimals:i=Hc,walletType:l="evm",receiverAddress:a="",accountType:c="perpetual",onWithdrawAmountChange:u,onReceiverAddressChange:f,onAmountChanged:p,showPoolBalanceInsufficientTip:d=!1})=>{const{t:h}=It(),b=g.useMemo(()=>{const O=cP((n==null?void 0:n.decimals)??i,Hc),M=uP((n==null?void 0:n.stepSize)??(n==null?void 0:n.stepsize));return M===null?O:Math.min(O,M)},[i,n==null?void 0:n.decimals,n==null?void 0:n.stepSize,n==null?void 0:n.stepsize]),w=g.useMemo(()=>{if(c==="spot"||!Pn(r==null?void 0:r.chainId)){const O=new ke(e||"0").minus(s||"0");if(O.isNegative()||O.isZero())return"0";const M=Math.min(O.decimalPlaces()??0,18);return O.decimalPlaces(M,ke.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,c]),T=g.useMemo(()=>o||"0",[o]),x=g.useMemo(()=>{const O=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new ke(O||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),E=g.useMemo(()=>x==="0",[x]),A=g.useMemo(()=>(t||"").toUpperCase()==="USDC",[t]),k=g.useMemo(()=>{const O=Number(r==null?void 0:r.chainId),M=String((r==null?void 0:r.chain)||"").trim().toUpperCase();return O===33431||O===3343||M==="EDGE"},[r==null?void 0:r.chainId,r==null?void 0:r.chain]),F=g.useMemo(()=>{const O=(t||"").toUpperCase();return O==="USDT"||O==="USDC"},[t]),L=g.useMemo(()=>A&&E,[A,E]),m=g.useMemo(()=>!k&&L,[k,L]),v=g.useMemo(()=>L,[L]),S=g.useMemo(()=>!L,[L]),I=g.useMemo(()=>m,[m]),$=g.useMemo(()=>c===Me.PERPETUAL&&Pn(r==null?void 0:r.chainId),[c,r==null?void 0:r.chainId]),C=O=>{const M=O.target.value,P=ps(M,b),R=fs(P,T||"0");if(R.isValid){const z=ps(R.formattedValue,b);u(z),R.errorType}else return R.errorType==="exceed_balance",void 0;p==null||p(ps(R.formattedValue,b))},D=()=>{const O=T||"0",M=ps(O,b),P=fs(M,O),B=ps(P.formattedValue,b);u(B),p==null||p(B)},y=()=>{const O=parseFloat(o||"0"),M=parseFloat(e||"0");if(M>0){const P=O-M,B=_t(Math.max(0,P).toString());return N.jsxs("span",{className:"flex items-center gap-1",children:[_t(o||"0"),N.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),B," ",t]})}return`${_t(o||"0")} ${t}`};return N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[N.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[N.jsx("input",{type:"text",placeholder:h("deposit.amount"),value:e,onChange:C,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),N.jsx("button",{onClick:D,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:h("deposit.max")})]}),N.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx(Tn,{content:h("withdraw.availableDesc"),children:N.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:h("deposit.available")})}),N.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:y()})]})]}),l==="mpc"&&(c==="spot"||!Pn(r==null?void 0:r.chainId))?N.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:N.jsx("input",{type:"text",placeholder:h("withdraw.receiverAddress"),value:a,onChange:O=>f==null?void 0:f(O.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"})}):null,c===Me.PERPETUAL&&N.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Pn(r==null?void 0:r.chainId)?N.jsxs(N.Fragment,{children:[N.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:h("withdraw.noticeDesc")}),N.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:h("withdraw.commonWithdraw")})]}):N.jsxs(N.Fragment,{children:[N.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:h("withdraw.crossChainTips")}),N.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:h("withdraw.commonWithdraw")})]})}),d&&N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:h("withdraw.poolBalanceInsufficientTip")})]}),I&&N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:h("withdraw.largeWithdrawFeeTip")})]}),N.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[N.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[N.jsx(Tn,{content:N.jsxs("div",{children:[N.jsx("div",{children:h("withdraw.speedNote")}),N.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[N.jsx(as,{selectedLevel:Wt.FAST,maxLevel:3}),N.jsx("span",{children:h("withdraw.speedNoteSpeed1")})]}),N.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[N.jsx(as,{selectedLevel:Wt.Medium,maxLevel:3}),N.jsx("span",{children:h("withdraw.speedNoteSpeed2")})]}),N.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[N.jsx(as,{selectedLevel:Wt.SLOW,maxLevel:3}),N.jsx("span",{children:h("withdraw.speedNoteSpeed3")})]})]}),children:N.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:h("withdraw.speed")})}),N.jsx("div",{className:"flex items-center",children:N.jsx(as,{selectedLevel:$?Wt.SLOW:Wt.FAST,maxLevel:3})})]}),(c==="spot"||!Pn(r==null?void 0:r.chainId))&&!v&&N.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[E||!F?N.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:E?h("withdraw.fee"):`${h("withdraw.fee")}/${h("withdraw.feeRate")}`}):N.jsx(Tn,{className:"w-[320px] font-normal flex items-center justify-center",content:N.jsx("span",{className:"flex items-center justify-center text-center",children:h("withdraw.feeCalculationTip")}),children:N.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${h("withdraw.fee")}/${h("withdraw.feeRate")}`})}),N.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!E&&` / ${x}%`]})]}),S&&N.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[N.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:h(Pn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),N.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[_t(w)," ",t]})]})]})]})};let at=null;const Gc={accountChains:[],defaultAccountType:""},Rm=g.forwardRef((e,t)=>{const[n,r]=g.useState(!1),[o,s]=g.useState(!1),[i,l]=g.useState(Gc),a=g.useCallback(h=>{l(h||Gc),r(!0)},[]),c=g.useCallback(h=>{l(b=>({...b,...h}))},[]),u=g.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=g.useCallback(h=>{s(h)},[]),p=g.useCallback(()=>n,[n]),d=g.useCallback(()=>o,[o]);return g.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,c,f,p,d]),g.useEffect(()=>(at={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{at=null}),[a,u,c,f,p,d]),n?N.jsx(_m,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},accountChains:i.accountChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});Rm.displayName="WithdrawManager";const jm=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.openWithdraw(e||Gc)},zm=()=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.closeWithdraw()},Um=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.updateWithdrawOptions(e)},Ri=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.setWithdrawLoading(e)},dP=()=>at?at.isOpen():!1,Wm=()=>at?at.isLoading():!1,pP=()=>({openWithdraw:jm,closeWithdraw:zm,updateWithdrawOptions:Um,setWithdrawLoading:Ri,isOpen:dP,isLoading:Wm}),hP=({accountChains:e,defaultChainId:t,defaultSymbol:n,defaultAmount:r="",defaultAccountType:o,currentEquity:s,platformBalance:i="0",balances:l,fee:a="0.00",isLoading:c=!1,onWithdraw:u,onClose:f,onChainChange:p,onTokenChange:d,onAmountChanged:h,onAccountChange:b})=>{var ve;const{t:w}=It(),T=g.useMemo(()=>e.map(Z=>({...Z,key:Fi(Z.key)})),[e]),x=g.useMemo(()=>Fi(o),[o]),E=g.useMemo(()=>T.some(Z=>Z.key===Me.PERPETUALV2),[T]),A=g.useMemo(()=>{var se;if(!T||T.length===0)return x;const Z=T.find(ue=>ue.key===x);return(Z==null?void 0:Z.key)||((se=T[0])==null?void 0:se.key)||x},[T,x]),[k,F]=g.useState(A),L=g.useCallback(Z=>{var se;return((se=T.find(ue=>ue.key===Z))==null?void 0:se.chains)||[]},[T]),m=g.useMemo(()=>T.find(Z=>Z.key===k)||T[0],[T,k]),v=g.useMemo(()=>(m==null?void 0:m.chains)||[],[m]),S=g.useMemo(()=>{var $e,xe;if(!m||!Vc(m.account)||!(k===Me.SPOT||k===Me.PERPETUALV2))return!1;const ue=!!(($e=m.walletOptions)!=null&&$e.evm),Se=!!((xe=m.walletOptions)!=null&&xe.mpc);return ue&&Se},[m,k]),I=g.useCallback(()=>{var Z,se;return(Z=m==null?void 0:m.walletOptions)!=null&&Z.evm?"evm":(se=m==null?void 0:m.walletOptions)!=null&&se.mpc||m!=null&&m.account&&ds(m.account)?"mpc":"evm"},[m]),[$,C]=g.useState(()=>S?null:I());g.useEffect(()=>{C(S?null:I())},[k,S,I]);const D=g.useMemo(()=>{if(!m)return;if(!S)return m.account;if(!$)return;const Z=m.walletOptions;return $==="mpc"?(Z==null?void 0:Z.mpc)||m.account:(Z==null?void 0:Z.evm)||m.account},[m,S,$]),y=g.useMemo(()=>D&&ds(D)?"mpc":"evm",[D]),O=y==="mpc"?gn:Xs,M=g.useMemo(()=>{if(!v||v.length===0)return{chainId:1,tokenSymbol:""};const Z=xe=>{const Ae=xe||[];if(!Ae.length)return"";const Ge="USDC".toUpperCase(),Vn=Ae.find(Ht=>(Ht.token||Ht.symbol||"").toUpperCase()===Ge)||Ae[0];return Vn.token||Vn.symbol||""};if(n){const xe=n==null?void 0:n.toUpperCase();for(const Ae of v){const lt=Ae.tokenList||[];let Ge;if(xe&&(Ge=lt.find(Vt=>(Vt.token||Vt.symbol||"").toUpperCase()===xe)),Ge){const Vt=Ge.token||Ge.symbol||n||"";return{chainId:Ae.chainId,tokenSymbol:Vt}}}}if(t){const xe=v.find(Ge=>Ge.chainId===t)||v[0],Ae=xe.tokenList||[],lt=Z(Ae);return{chainId:xe.chainId,tokenSymbol:lt}}const se="USDC",ue=xe=>Array.isArray(xe.tokenList)&&xe.tokenList.some(Ae=>(Ae.token||Ae.symbol||"").toUpperCase()===se),Se=v.find(ue)||v[0];if(!Se)return{chainId:1,tokenSymbol:""};const $e=Z(Se.tokenList);return{chainId:Se.chainId,tokenSymbol:$e}},[v,t,n]),[P,B]=g.useState(()=>M.chainId),[R,z]=g.useState(()=>M.tokenSymbol),[W,G]=g.useState(r),[J,K]=g.useState(""),V=g.useCallback(Z=>{B(Z),p==null||p(Z)},[p]),te=g.useCallback(Z=>{z(Z),d==null||d(Z)},[d]),me=g.useRef(!0),he=g.useRef(R),ye=g.useRef(P);g.useEffect(()=>{if(me.current){me.current=!1,he.current=R,ye.current=P;return}(he.current!==R||ye.current!==P)&&(G(""),he.current=R,ye.current=P)},[R,P]);const we=v&&v.length>0?v.find(Z=>Z.chainId===P)||v[0]:null,oe=(ve=we==null?void 0:we.tokenList)==null?void 0:ve.find(Z=>Z.token===R),_=g.useMemo(()=>{const Z=new ke(W||"0"),se=new ke(a||"0"),ue=Pn(P);return oe!=null&&oe.minWithdrawSize&&Z.lt(oe.minWithdrawSize)?{text:w("withdraw.minWithdrawParsed",{amount:oe.minWithdrawSize,token:oe.symbol||oe.token}),disabled:!0}:!W||Z.isZero()||!ue&&Z.isLessThan(se)?{text:w("withdraw.confirmWithdraw"),disabled:!0}:y==="mpc"&&(!ue||k==="spot")&&!J.trim()?{text:w("withdraw.invalidReceiverAddress"),disabled:!0}:{text:w("withdraw.confirmWithdraw"),disabled:!1}},[w,P,W,y,J,a,k,oe]),Y=g.useMemo(()=>{const Z=(R||"").toLowerCase();if(!Z)return i||"0";const se=(l==null?void 0:l[k])||(k===Me.PERPETUAL?l==null?void 0:l.perp:void 0),ue=se==null?void 0:se[Z];return typeof ue=="string"&&ue.length>0?ue:i||"0"},[l,k,R,i]),Q=g.useCallback(async()=>{Ri(!0);try{if(u){const se={amount:new ke(W||"0").toString(),chainId:P,tokenAddress:(oe==null?void 0:oe.tokenAddress)||"",coinId:(oe==null?void 0:oe.coinId)||"",tokenSymbol:R,accountType:k,selectedToken:oe};y==="mpc"&&(!Pn(P)||k==="spot")&&(se.receiverAddress=J),u(se)}}catch{Ri(!1)}},[u,k,oe,W,P,R,y,J]);return!v||v.length===0?N.jsx("div",{className:"text-center py-8",children:N.jsx("p",{className:"text-gray-400",children:"No chains available"})}):we?N.jsxs(N.Fragment,{children:[N.jsx(Wh,{selectedAccount:k,options:T.map(Z=>({value:Z.key,label:Z.key===Me.SPOT?w("account.spot"):Z.key===Me.PERPETUAL?w(E?"account.perpetual-v1":"account.perp"):Z.key===Me.PERPETUALV2?w("account.perpetual-v2"):Z.key})),onAccountChange:Z=>{var Vt,Vn;const se=Z||k;F(se),b==null||b(se);const ue=L(se);if(!ue||ue.length===0)return;const Se=ue.find(Ht=>Ht.chainId===P),$e=Se?Se.chainId:ue[0].chainId;B($e),p==null||p($e);const xe=ue.find(Ht=>Ht.chainId===$e),Ae=(xe==null?void 0:xe.tokenList)||[],Ge=Ae.some(Ht=>(Ht.symbol||Ht.token)===R)?R:((Vt=Ae[0])==null?void 0:Vt.symbol)||((Vn=Ae[0])==null?void 0:Vn.token)||"";Ge&&(z(Ge),d==null||d(Ge))},className:"w-full"}),N.jsx(Uh,{currentActiveChain:we,chainList:v,onChainChange:V,curSelectToken:R,onTokenChange:te,walletType:O,accountType:k,txType:"withdraw"}),S&&!$&&N.jsxs("div",{className:"mb-4",children:[N.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),N.jsx("button",{type:"button",onClick:()=>C("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:w("withdraw.connectedWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:Bm,className:"w-12 h-5",alt:"EVM"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:w("withdraw.connectedWalletDesc")})]})}),N.jsxs("div",{className:"flex items-center my-2",children:[N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),N.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:w("deposit.or")}),N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),N.jsx("button",{type:"button",onClick:()=>C("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:w("withdraw.externalWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:Lm,className:"w-12 h-5",alt:"MPC"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:w("withdraw.externalWalletDesc")})]})})]}),(!S||$)&&N.jsxs(N.Fragment,{children:[N.jsx(fP,{withdrawAmount:W,curSelectToken:R,tokenInfo:oe,curSelectTokenData:{balance:oe==null?void 0:oe.balance,allowance:oe==null?void 0:oe.allowance},currentActiveChain:we,currentEquity:s||0,decimals:(oe==null?void 0:oe.decimals)??6,platformBalance:Y,fee:a,walletType:y,accountType:k,receiverAddress:J,onWithdrawAmountChange:G,onReceiverAddressChange:K,onAmountChanged:h}),N.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${_.disabled||c?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Q,disabled:_.disabled||c,children:[c&&N.jsx(us,{size:"xs"}),_.text]})]})]}):N.jsx("div",{className:"text-center py-8",children:N.jsx("p",{className:"text-gray-400",children:"Loading..."})})},_m=({isOpen:e,isLoading:t=!1,defaultAccountType:n,onClose:r,config:o,accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a="",currentEquity:c=5e3,platformBalance:u="0",balances:f,fee:p,wagmiHooks:d,onWithdraw:h,onChainChange:b,onTokenChange:w,onAmountChanged:T,onAccountChange:x})=>{const{t:E}=It(),[A,k]=g.useState(!1),F=m=>{m.target===m.currentTarget?k(!0):k(!1)},L=m=>{A&&m.target===m.currentTarget&&r(),k(!1)};return e?Ke.createPortal(N.jsx("div",{className:"edgex-components",children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:F,onMouseUp:L,"aria-hidden":"true",children:N.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:m=>{m.stopPropagation()},children:[N.jsxs("div",{className:"flex items-center justify-between mb-4",children:[N.jsx("h2",{className:"text-lg font-semibold text-white",children:E("withdraw.withdraw")}),N.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:N.jsx(I0,{className:"h-4 w-4"})})]}),N.jsx(hP,{accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a,defaultAccountType:n,currentEquity:c,platformBalance:u,balances:f,fee:p,isLoading:t,wagmiHooks:d,onWithdraw:h,onClose:r,onChainChange:b,onTokenChange:w,onAmountChanged:T,onAccountChange:x})]})})})}),document.body):null};le.ChromeLoader=us,le.ComponentProvider=mb,le.DEFAULT_LOCALE=ms,le.Deposit=Fm,le.DepositManager=Om,le.LOCALE_NAMES=db,le.LoadingSpinner=us,le.SUPPORTED_LOCALES=zi,le.Tooltip=Tn,le.Withdraw=_m,le.WithdrawManager=Rm,le.closeDeposit=$m,le.closeWithdraw=zm,le.formatThousands=gb,le.isDepositLoading=Mm,le.isWithdrawLoading=Wm,le.openDeposit=Cm,le.openWithdraw=jm,le.setDepositLoading=Bi,le.setWithdrawLoading=Ri,le.updateDepositOptions=Im,le.updateWithdrawOptions=Um,le.useComponentConfig=ou,le.useDeposit=L5,le.useDepositManager=tP,le.useTranslation=It,le.useWithdraw=F5,le.useWithdrawManager=pP,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
185
+ `,children:[t,o&&N.jsx(Am,{ref:d,placement:h.placement||n})]})})})]})},Yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",Vc="DEPOSIT_MODE_FAST",Nm="DEPOSIT_MODE_NORMAL",X3=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,accountId:o,accountKey:s,onDeposit:i,onCopy:l,getUserBizConfig:a,saveUserBizConfig:c,onClose:u})=>{const{t:d}=It(),p=r===zx,f=!p,h=(t||"").toUpperCase(),m=g.useMemo(()=>{const z=Number(e==null?void 0:e.chainId),W=String((e==null?void 0:e.chain)||"").trim().toUpperCase();return z===33431||z===3343||W==="EDGE"},[e==null?void 0:e.chainId,e==null?void 0:e.chain]),x=g.useMemo(()=>{const z=Number((e==null?void 0:e.cctpResolvedMaxFee)??0);return Number.isFinite(z)?h==="USDC"&&!m&&z!==0:!1},[h,m,e==null?void 0:e.cctpResolvedMaxFee]),T=!(r===Ux&&h==="USDC"),w=g.useMemo(()=>{if(!e)return!1;const z=Number(e.chainId);return!Number.isNaN(z)&&(z===42161||z===421614)},[e]),P=p,A=g.useMemo(()=>{var z;return(z=e==null?void 0:e.tokenList)==null?void 0:z.find(W=>W.token===t||W.symbol===t)},[e,t]),k=g.useMemo(()=>{const z=(t||"").toUpperCase();if(!P&&z==="USDC")return d("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const Z=d(P?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return P&&(!w||z==="USDC")?String(Z).split(`
186
+ `)[0]:Z},[d,t,e==null?void 0:e.chain,P,w]),B=(A==null?void 0:A.minDepositSize)||"10",F=g.useMemo(()=>{const z=A==null?void 0:A.depositFeeRate;if(z==null)return"";const W=String(z).trim();return W?`${W}%`:""},[A==null?void 0:A.depositFeeRate]),[b,v]=g.useState("fast"),[E,I]=g.useState(""),[$,C]=g.useState(!1),D=g.useRef(!1),y=x&&$,O=g.useMemo(()=>!!F&&b!=="standard",[F,b]),M=g.useMemo(()=>{const z=Number((e==null?void 0:e.blockTime)??0),W=Number((e==null?void 0:e.txConfirm)??0);if(!Number.isFinite(z)||!Number.isFinite(W))return 0;const _=z*W/60;return Math.trunc(_*100)/100},[e==null?void 0:e.blockTime,e==null?void 0:e.txConfirm]),L=x&&$&&b==="standard"?20:M;g.useEffect(()=>{if(D.current)return;D.current=!0;let z=!1;return C(!1),a?((async()=>{try{const _=await a();if(z)return;const Z=_==null?void 0:_.depositMode;if(!(Z===Vc||Z===Nm)){C(!1);return}v(Z===Vc?"fast":"standard"),I((_==null?void 0:_.destinationPreference)||""),C(!0)}catch(_){console.error("[MPCDeposit] getUserBizConfig failed:",_),C(!1)}})(),()=>{z=!0}):()=>{z=!0}},[a]);const j=g.useCallback(async z=>{if(v(z),!c)return;const W=E||r||"";try{await c({depositMode:z==="fast"?Vc:Nm,destinationPreference:W})}catch(_){console.error("[MPCDeposit] saveUserBizConfig failed:",_)}},[c,E,r]);return N.jsxs(N.Fragment,{children:[y&&N.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 mt-4 mb-3",children:N.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[N.jsx("button",{type:"button",onClick:()=>{j("fast")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${b==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:d("deposit.fast")}),N.jsx("button",{type:"button",onClick:()=>{j("standard")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${b==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:d("deposit.standard")})]})}),N.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&N.jsx("div",{className:"bg-white rounded-lg",children:N.jsx(lm,{value:n,size:80,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&N.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[N.jsx("span",{className:"flex-1 text-text-primary text-xs font-medium break-all mr-3",children:n}),N.jsx(e3,{onCopy:()=>{l&&l(n)},text:n,children:N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[N.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),N.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),N.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[N.jsxs("div",{className:"flex items-start",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1",children:N.jsx("p",{className:"text-xs text-functional-orange-1",children:k})})]}),y&&N.jsxs(N.Fragment,{children:[N.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),N.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:d("deposit.depositModeSwitchWarning")})]})]}),N.jsxs("div",{className:"text-sm",children:[T&&N.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[N.jsx("span",{className:"text-text-tertiary",children:d("deposit.arrivalTime")}),N.jsx(Tn,{content:N.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:N.jsx("p",{children:d("deposit.arrivaltimeTooltip2")})}),placement:"top",children:N.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed",children:d("deposit.arrivalEstimated",{v:L})})})]}),O&&N.jsxs("div",{className:`flex justify-between items-center h-[18px] ${T?"mt-1":"mt-4"}`,children:[N.jsx("span",{className:"text-text-tertiary",children:d("withdraw.feeRate")}),N.jsx(Tn,{content:d("deposit.feeRateTooltip"),placement:"top",children:N.jsx("span",{className:"text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:F})})]}),N.jsxs("div",{className:`flex justify-between items-center h-[18px] ${T||O?"mt-1":"mt-4"}`,children:[N.jsx("span",{className:"text-text-tertiary",children:d("deposit.minDeposit")}),N.jsxs("span",{className:"text-text-primary font-medium text-right",children:[B," ",t]})]}),f&&h!=="USDC"&&N.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[N.jsx("span",{className:"text-text-tertiary",children:d("deposit.maxDeposit")}),N.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]})]})},us=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return N.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},J3=(e,t)=>Number(e)>Number(t),_t=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},ds=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return ds(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:_t(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},Q3=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=_t(Math.max(0,s).toString());return N.jsxs("span",{className:"flex items-center gap-1",children:[_t(e),N.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${_t(e)} ${n}`},eP=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},tP=(e,t,n)=>{if(!Uh(e,n))return!1;try{const r=new ke(t||"0"),o=new ke("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},nP=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&Uh(e,n))try{const i=new ke(o),l=new ke("200000");i.gt(l)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new ke(o||"0");return i.isNaN()?o:i.decimalPlaces(6,ke.ROUND_DOWN).toString()}catch{return o}},Cm={accountChains:[],defaultChainId:1,defaultAccountType:"",balances:{}};let it=null;const Om=g.forwardRef((e,t)=>{const[n,r]=g.useState(!1),[o,s]=g.useState(!1),[i,l]=g.useState(Cm),a=g.useCallback(h=>{l(h),r(!0)},[]),c=g.useCallback(h=>{l(m=>({...m,...h}))},[]),u=g.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),d=g.useCallback(h=>{s(h)},[]),p=g.useCallback(()=>n,[n]),f=g.useCallback(()=>o,[o]);return g.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:d,isOpen:p,isLoading:f}),[a,u,c,d,p,f]),g.useEffect(()=>(it={openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:d,isOpen:p,isLoading:f},()=>{it=null}),[a,u,c,d,p,f]),n?N.jsx(Rm,{isOpen:n,isLoading:o,onClose:u,accountChains:i.accountChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,getUserBizConfig:i.getUserBizConfig,saveUserBizConfig:i.saveUserBizConfig,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});Om.displayName="DepositManager";const $m=e=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.openDeposit(e||Cm)},Im=()=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.closeDeposit()},Mm=e=>{it&&it.updateDepositOptions(e)},Bi=e=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.setDepositLoading(e)},rP=()=>it?it.isOpen():!1,Dm=()=>it?it.isLoading():!1,oP=()=>({openDeposit:$m,closeDeposit:Im,updateDepositOptions:Mm,setDepositLoading:Bi,isOpen:rP,isLoading:Dm}),sP=e=>{const{t}=It(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:l,minDeposit:a=10}=e;return g.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const c=parseFloat(r||"0"),u=a,d=eP(r,s||"0",o);return!r||c===0||!o?{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:c<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!d,isNetworkSwitch:!1}},[n,r,o,s,i,l,a,t])};function iP(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:l,usePublicClient:a,useSwitchChain:c}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,d=(o==null?void 0:o.decimals)??18,p=(o==null?void 0:o.approveSpender)||(o==null?void 0:o.contractAddress),f=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=c(),{writeContractAsync:m}=l(),x=a(),T=i({address:u,abi:Dr,functionName:"allowance",args:[un(t||""),p],chainId:r,query:{enabled:!!(!f&&t&&r&&u&&p)}}),w=T!=null&&T.isSuccess?T.data:void 0,P=g.useMemo(()=>{if(f)return!0;if(!T.isSuccess||w===void 0||w===0n)return!1;try{const k=K6(String(Number(s||"0")||0),Number(d));return w>=k}catch{return!1}},[f,T.isSuccess,w,s,d]),A=g.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!x||!u||!p)return;const B=un(u),F=un(p);if((w||0n)>0n){const E=await m({abi:Dr,address:B,functionName:"approve",args:[F,0n]});await x.waitForTransactionReceipt({hash:E})}const v=await m({abi:Dr,address:B,functionName:"approve",args:[F,Sd]});await x.waitForTransactionReceipt({hash:v}),T!=null&&T.refetch&&await T.refetch()}catch(k){console.error("[useApprove] onApprove failed:",k)}},[r,n,u,p,w,T,m,x,h]);return{approve:P,onApprove:A}}const aP=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return g.useEffect(()=>{o(un(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},lP=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var w;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=g.useMemo(()=>{const P="0x0000000000000000000000000000000000000000",A="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(k=>{const B=k.tokenAddress;if(!B)return!1;const F=B.toLowerCase();return!(B===P||F===A)})},[r]),[l,a]=g.useState({}),c=g.useCallback((P,A)=>{a(k=>({...k,[P]:A}))},[]),u=(w=o==null?void 0:o.useBalance)==null?void 0:w.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[d,p]=g.useState(0),f=g.useMemo(()=>i.map(P=>g.createElement(aP,{key:`${P.tokenAddress}-${d}`,token:P,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:c})),[i,e,s,n,o,c,d]),h=g.useMemo(()=>{const P=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},A=i.map(B=>{const F=l[un(B.tokenAddress)],b=F==null?void 0:F.balance,v=b==null?void 0:b.data;return{address:un(B.tokenAddress),value:(v==null?void 0:v.value)||BigInt(0),formatted:(v==null?void 0:v.formatted)||"0",decimals:(v==null?void 0:v.decimals)||B.decimals}}).filter(B=>B.address),k=A.reduce((B,F)=>({...B,[F.address]:{balance:F}}),{});return{balanceList:A,baseTokenBalance:P,combinedData:k}},[u,l,i]),m=g.useCallback(async()=>h,[h]),x=g.useMemo(()=>{const P=(u==null?void 0:u.isLoading)||!1,A=Object.values(l).some(k=>{var B;return(B=k.balance)==null?void 0:B.isLoading});return P||A},[u==null?void 0:u.isLoading,l]),T=g.useCallback(()=>p(P=>P+1),[]);return{multicallRun:m,multicallRefresh:T,multicallResult:h,validErcTokens:i,isLoading:x,queryComponents:f}},km=6,cP=(e,t=km)=>{const n=Number(e);return!Number.isFinite(n)||n<0?t:Math.floor(n)},uP=e=>{if(e==null||e==="")return null;try{const t=new ke(e);return!t.isFinite()||t.isNaN()||t.lte(0)?null:t.decimalPlaces()??0}catch{return null}},Fi=(e,t)=>{if(!e)return e;const n=Math.max(0,Math.floor(t));if(e===".")return n===0?"0":"0.";if((e.match(/\./g)||[]).length!==1)return e;const[o,s=""]=e.split(".");return n===0?o:s.length<=n?e:`${o}.${s.slice(0,n)}`},dP=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,accountId:o,accountKey:s,platformBalance:i,isLoading:l,wagmiHooks:a,onChainChange:c,onDeposit:u})=>{const{t:d}=It(),p=a.useAccount(),f=t.tokenList.find(V=>V.token===n||V.symbol===n),h=t.chainId,m=g.useMemo(()=>{if(!((n||"").toUpperCase()==="USDC"))return!1;const X=Number((t==null?void 0:t.cctpResolvedMaxFee)??0);return Number.isFinite(X)?X!==0:!1},[t==null?void 0:t.cctpResolvedMaxFee,n]),[x,T]=g.useState(""),[w,P]=g.useState(()=>m?"fast":"standard");g.useEffect(()=>{T("")},[n,t.chainId]),g.useEffect(()=>{P(m?"fast":"standard")},[t.chainId,m]);const{multicallResult:A,queryComponents:k}=lP({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:a}),B=g.useMemo(()=>{var X;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return A.baseTokenBalance.formatted;const V=A.combinedData[f.tokenAddress];return((X=V==null?void 0:V.balance)==null?void 0:X.formatted)||"0"},[f,A]),F="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",b="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",v=g.useMemo(()=>{var V,X;return Mx({chain:Bx,transport:Lx(t.rpcUrl||((V=window==null?void 0:window.ENV)==null?void 0:V.CHAIN_RPC_URL_42161)||((X=window==null?void 0:window.ENV)==null?void 0:X.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),E="1000000000000",{formatted:I}=Fx({client:v,tokenAddress:F,holder:b,decimals:6,fallbackFormatted:E,pollingInterval:12e3}),[$,C]=g.useState(!1),{approve:D,onApprove:y}=iP({account:e,accountChainId:p.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:x,wagmiHooks:a}),O=g.useCallback(async()=>{if(!$)try{C(!0),await y()}catch(V){console.error("Approve failed:",V)}finally{C(!1)}},[$,y]),M=g.useMemo(()=>+p.chainId!=+t.chainId,[p.chainId,t.chainId]),S=g.useCallback(async()=>{c&&c(h)},[c,h]);g.useEffect(()=>{M&&S()},[M,S]);const{showLayerZeroTip:L,layerZeroTipKey:j}=g.useMemo(()=>{const V=+t.chainId==42161||+t.chainId==421614,X=(n==null?void 0:n.toUpperCase())==="USDT",Q=new ke(x||"0"),we=new ke("200000");let Y=!1,se;if(V&&X&&x)if(Q.gte(we))Y=!0,se="deposit.layerZeroDepositTipGte200k";else{const ue=I;if(typeof ue=="string"&&ue.length>0){const Ie=new ke(ue);!Ie.isNaN()&&Q.gte(Ie)&&(Y=!0,se="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:Y,layerZeroTipKey:se}},[t.chainId,n,x,I]),z=g.useCallback(()=>nP(+t.chainId,B||"0",n,r),[B,t==null?void 0:t.chainId,n,r]),W=g.useMemo(()=>{const V=cP(f==null?void 0:f.decimals,km),X=uP((f==null?void 0:f.stepSize)??(f==null?void 0:f.stepsize));return X===null?V:Math.min(V,X)},[f==null?void 0:f.decimals,f==null?void 0:f.stepSize,f==null?void 0:f.stepsize]),_=g.useMemo(()=>r!=="spot"&&tP(+t.chainId,x,n),[r,t==null?void 0:t.chainId,x,n]),Z=g.useMemo(()=>"deposit.maxDepositSplitTip",[]),q=g.useMemo(()=>{const V=Number((t==null?void 0:t.blockTime)??0),X=Number((t==null?void 0:t.txConfirm)??0);if(!Number.isFinite(V)||!Number.isFinite(X))return 0;const Q=V*X/60;return Math.trunc(Q*100)/100},[t==null?void 0:t.blockTime,t==null?void 0:t.txConfirm]),ee=m&&w==="standard"?20:q,fe=g.useMemo(()=>{const V=f==null?void 0:f.depositFeeRate;if(V==null)return"";const X=String(V).trim();return X?`${X}%`:""},[f==null?void 0:f.depositFeeRate]),me=m&&w==="fast"&&!!fe,ye=sP({isNetworkMismatch:M,depositAmount:x,approved:D,currentTokenBalance:B,selectedToken:n,showLayerZeroTip:L,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),ve=V=>{const X=V.target.value,Q=Fi(X,W),we=z(),Y=ds(Q,we);if(Y.isValid){const se=Fi(Y.formattedValue,W);T(se),Y.errorType}else return Y.errorType==="exceed_balance",void 0},oe=g.useCallback(async()=>{Bi(!0);try{u&&u({amount:x,chainId:h,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,depositSpeed:w,accountType:r,accountId:o,key:s})}catch(V){console.error("Deposit error:",V),Bi(!1)}},[u,x,h,f==null?void 0:f.tokenAddress,w,r,o,s,n]);return N.jsxs(N.Fragment,{children:[k,m&&N.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 my-4",children:N.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[N.jsx("button",{type:"button",onClick:()=>P("fast"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${w==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:d("deposit.fast")}),N.jsx("button",{type:"button",onClick:()=>P("standard"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${w==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:d("deposit.standard")})]})}),N.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[N.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[N.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:x,onChange:ve,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),N.jsx("button",{onClick:()=>{const V=z(),X=Fi(V,W),Q=ds(X,V);T(Fi(Q.formattedValue,W))},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),N.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx(Tn,{content:d("deposit.availableDesc"),children:N.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),N.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:Q3(B||"0",x,n)})]})]}),!D&&J3(x||"0",0)&&N.jsxs("div",{className:"flex justify-center flex-col items-center",children:[N.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:d("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),N.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:d("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),N.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:O,disabled:$,children:$?N.jsx(us,{size:"xs",inline:!0}):d("deposit.enableWithToken",{token:n})})]}),L&&N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d(j||"deposit.layerZeroDepositTip")})]}),N.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"})]}),_&&N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d(Z)})]}),_&&N.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:!(_||L)&&N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:d("deposit.noPrivateKeyWalletWarning")})]}),N.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[N.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[N.jsx("span",{className:"text-sm text-text-tertiary",children:d("deposit.arrivalTime")}),N.jsx(Tn,{content:N.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:N.jsx("p",{children:d("deposit.arrivaltimeTooltip2")})}),placement:"top",children:N.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:d("deposit.arrivalEstimated",{v:ee})})})]}),me&&N.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[N.jsx("span",{className:"text-sm text-text-tertiary",children:d("withdraw.feeRate")}),N.jsx(Tn,{content:d("deposit.feeRateTooltip"),placement:"top",children:N.jsx("span",{className:"text-sm text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:fe})})]}),N.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[N.jsx("span",{className:"text-sm text-text-tertiary",children:d("deposit.equity")}),N.jsx("span",{className:"text-sm text-text-primary font-medium",children:x?N.jsxs("span",{className:"flex items-center gap-1",children:[_t(i),N.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),_t((parseFloat(i)+parseFloat(x)).toString())," ",n]}):`${_t(i)} ${n}`})]})]}),N.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${ye.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:oe,disabled:ye.disabled||l,children:[(l||M)&&N.jsx(us,{size:"xs"}),ye.text]})]})},Lm=e=>e.toLocaleUpperCase()===gn?gn:Js,fs=e=>Lm(e.wallet)===gn,Hc=e=>Lm(e.wallet)===Js,Ri=e=>e?e==="perp"?Ne.PERPETUAL:e==="perp-v2"||e==="perp_v2"?Ne.PERPETUALV2:e:"",Bm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBMSURBVHgBvVt7kBTHef/17N77fRwSiNeBBAGBpVNJERKyoqOSuByiVLAScOKqJKAYJU4F8XCVY8d/cLiSkKSS4pDtKJKRdFhxYoNskTKS4jixFguEICAdiDtAvJb3cRzcg7u9vX1M5/t6puexO7u3Byd+VDOzPT3dPd/39ffqPoFbhJSymS5NVJ6yr7V2YfRRidrlMJWIECKC28Bnv5dslqZskjCeEhA0nvSPJ0SU5hQ1IA/DQGTPqqIIbgMLvjzcbAjxoBRoFlLSeKJWqjEFDY0++p6oCRmFFO2Aufvo1rIIbgFiLI3pA/mD11BZC/fjC0WUSoTKRp58IS80vyZrEylzjTDlLYxHYwgZKUqHNka+Uth4TWtlbWowvkZArjWlqBEikz4SNsmkdZXqB7WDaVrfV1SEje3/WhZFgSiIATbhN8Ai/HigDXkYwYRPJkwaT47PeAJt+RjBhE8PDm+QEGvpW/VLkglMUFeuFja13HvBtHHu1SOp3nktHMa3CmHEqAygDlniWzB2iR8NUVhMaPNWPv5yeo0hZcv4j0cqSsiN7z8XbvPWLlgVXwMz3UJk9I4nLekWmqD6t9WTUEzw1vme8zNqc84wzI0ff6+yLe+s8j2kwTdj/KQ+F1rpA9fxzRMvpTePm9TnhGjd+2chNd78Z2ObiVZrbYJaT4Ur4TYhhbMoPM8z7h3dZD+RVhU1MURrx9bydTlnE1Rpq5w3qTTjDqB/BO2//f10H825GXcAMiXb+z8c6SPiNXuIK7XOt+oE/WbVI2wmKBpLr9632nrbeVWVh7RSthfL5OL2trq+zLmEc8zxXSpN8cEBlFZW49OEGR/A2rcqmiBxxzDQmWgiowlbcO2RpUfStd6XnnpNfOsdVk26NfVFxDcVE/z92CsIsimOMAv04sy5hDIrbLWzlO9f+OJnkDwVwcRygVD9NIhwCcYDTPTBfa/jo3//W/z1OzGcLnsYdwqxaBLJ3rS6l9Z/mpD21ZJk3d4yspZIewjrFW/nfVtdaXXkukxWXePEpm/W9rT/3c+88/GpIBpsBV1e4/uO997B97+5QtUvnGpg4bQQyh9ejvJHlqFk1uO4FcTP7MPQwR2Id/wXdh/vxc/Ll+Hk45txpzByLYXBUwm49HFhMUPYasiRcjw6NyTmTQ9hLpUpDRa5bsYkjp03ceB4Cv93Ig29iiz1IzNtgcMEezWsO9FW0+q0cCYgZSMs1cNXbN/0PA698yOnq+oSgWfmh+lKy6ZuGioeXoayR5YjXDcV+cDSfvO9rRjcs9W6HwHeoolfMqbi6G+8gXjlNNwJmCMS/R1xpONewrvCyuLrld4vfLZI/OXSYiK6kbffSz0mvrMzgTf3JLXb6qwatz/nN3fdNyLMmVHbHngZwJK/Qv/esGQ22AZ4wUxYOM3AvInupKrvmYaiHJYkkSIDe/mC8/tYt4k950yMpCROLmpF96zluBVMrhK4bwJQWWz9HiSh7hoETvbkNiQ3T41gpDul7r06Ah5isYROmWBg06oylnyMBcyIP/77GC5eM7M8J3jcVNt4t57YVqM8Ix09NNLlrG49PNiPliVzcg7WNNnArzVaE2TiV1UEtxuIEROStPTpuw9cTOPwFWX5MEJSf3DpfowFVcUCyz4DLF9goDKHKeq6CXx4ReK1gxJXBl0KsPT3HBzSXjy0+pH2b9t7B6ua764pH1Xqc4GZ8BdbhnD8vDLejoekepd+25IwZB2vAj3SBm9HZZU1qJuUWzW0EyHbPkxhgNRJMuX6xV6kTYv4rHLe7Eg5xGecf+CrGAuWLxDY8YcGnn04N/EZk6qAJXOo7Ze4rauKh84n7ElK+5+tr/mhJBeGChP9dojP4Hf/ZU0FpkxwAzW+Sm1grHtlW8IpgwNc6NGaMzub9dCivIMNkFT9x5Ekjl0jlZLMfp5KWSrnh0dS6In5OTRwV2FGnKX+208beH5RfsIHgZm16XOGUlMjfZbqMSU0BRQbTJc6eP0bFbdFfA3uY9Oqcrtf6bsSo4XFCF4Npgo4Q3ZWMyv67O26gE8OvJt3MJbyMzekYsCcu/yT/8UnJn55Nq3aeDFw9yJcnrcKheDlpSHMv9sfKw7Sitp5XOLf2iVeOiDxzicS/3tGKjswoUz4GDWjVmCyMPHT90YCl6ntXuKZJ0uoFGO8MJVsJHlKov2UYryt87zRmVJFpfUPfH03m89m3AbYMM8OkJxG+viPuwSpIP+H999dmPSz5FZm0OTVQxI7jppKrWXio8sSL7xvSb5X/XScTtr6QCpt73go/M+0wtbnnynFeGPF50vQ9rO4urd4bzqT0oyn/x9kBjwY1EEhEbDlmobUNRMNFLz9Hj37cUfax4Sh+vkoBCzRq3elSQWFFCO+8XNTEXk0vHqI2l0R2PSbhvKMfvBBUqkaSwyl4/loLJwbyqt6/uqlIew/lrTesvjlfOzC+8P4h+cqA9/jPtmT2n+MV4H2sixPSKtB+rGYGdAY1AEb4nyYUmPg6TkGSsJOBtCXrmUwY5gJuyhY6RmyKuMVuY0763wmtvZgrty0mMB1J6+P3l6DGbXyJ2nFxP4B046CYPufAto956pH54aRDx8cS7BrCX/+3yZiZ36BWDi3CB90JlVbw9BRsnQibrp7ICcD7pm9QK0CbyxQWiQw9y6Be8lXnlLhl/ogBjCYCV+iYS4RA05fN7E/BwOUwf0dQ3kyq39qEsFdJgRhcqXVnsHtM5mg30vF0q7Ho77fjbbI/8H9M/IzwJFWx4UUlPuR0h/xBmPKRJ2qtvJFbqCm7rnzOv6CwLw7u6GfW/k1NNYbaL4vhBWPhvH1Xw/jdxeEMK0q/9hmgGDwO/xuqjhYtTExdXDF97Mn5B5DE5+ZxYXvuS4I6ZQJ1wtxvFHnd1XFaHR00wzS9SOd3/kwpSEEK2nnJPWk9Y7lDdFNTV6/6/EnFxHhQ8QAgxhhTXSQXErTDPhQT13QvPidwVjwhDMNbj4meImvMRoT7FnZc/O4h1JitCysJqAmupVW0JnS0WEzzJNZdQRBZVSZAX25XjbP78uqS5E9unot6ZSe6ylVEil3Qqm0dOq9bUdIJ1eaA1l9aoPb5VE3QUwIIr5GEBNmk9BUl7HKMLUfDouY0OaY9Hsa+cDvmaZmmss33U8+DMTs5eYpWgB4FdBtX14GpI7syKqrrRGorXLF9XSsjKRfIiTcxSQovuO6IzddD6Ga3qmnBVeB/sCxtMHNxYQg4nNbb3svE5j4fF9V7joJbnGlufNcEgVAuhJsFqyCOqNJn+qzm0tbHkAki7IFakeAIZZ9FyG7O7I6ZUPLTAiFi/DPp6bg7ct1+Js5ZzBLxOFkV6jN8eFqbDxzL5bc04uv3ncJFWUGeQJp3JfsxNWSYEOsmcCupya0ZgIHYJnE57YMb3vNBKXWKChjI3uBknBCZCbhLFvVGU0hHxbOK4Klsz3a2u5o4bxRPKjOhMNoT2paOHvKJqKskzgKzkrKp49sR2LX+sCOudNYnKS5jIKiZAjRvmLMqRlBSbGdbEsIXIoVYWJFGlVFaQzFQigrNYkBEj8pfRYvVm5APkyu8hM1E5r42tPJ1/6Vt2P41rabTiDmfIN95Zq9327A1LvGlv0cDRe703hi9TXAE/x5DY7tNW5ktrYHdRCkfjS4r9ISi9hM4AUNw1ltZtUm1DNGcbFFfMa96U6MhiB1pJFJ/NHaT58cdlSFzgFJjzvE95vfGMR4o5X6tG2v7UVJrxOlYJiIGPaJtSw7cHMIuNHvLxevmjh1LqVKF3E4aa9eZogmMCPkESZuc7k75bzXcHEvKgIMcSaCiBpE/NHav3w8RFupwklHuEbQTkXQdXskhn0dCYwXLtL3/uhdysUr1WVaW2vuzpieQzT6xuSIVmxbMjspvjc7Z1NeaqgOkrT5k0pbTBq28zJFYQ8D7F75GbfhZcjvsCtaVhrCb/W9gkLgJWo+4o/Wvmp6GVy6+11KvRrWf7dXqY3bBfexvOWGuueATRtvNZrUDFGRSITr9IYMB2O93o5GaP+256VlWQOkyN283ptCVSXtEZdZlB6umoqNb0fV/oDGPy2difJBazcsNky2YjCNhvowrQ6BIaMaz878GIWCdTy7qkFJuELamzTn87+46iRytAoQvpMjQs5vDIlXvlZP9iCMWwEb+y//Y6/siCZFwLkiexVYgV26yJjV9cPJUcOaiGAV5FsFvPEuSrOj1jAt54qKEEm5QLp+DmKPrcfBCcvw36clPrjolhMz/kg94zY8m4oKQxGfwSpoSX9hq4DBUlwo8YPaGzTn6hkV/kgW7j37+VKmBREOv7+hR6mQseL9oyNYRu92RBPK39KpB+m4Qa4Kov+3MfH5zrsnzKvgLDypid7t6xE7tN03EDOFmTMw6QkMl04EGRHsOfARtrz6A1+7P/2DZ/D55kUqE1k6fBU1V/epVSXjlv7nVbB6xl51vRPgVXDhl90wkzpkzzg5Iv0nGr64uALrlldh2iirgaV+665BbH2LDbl7CiIYSvrPmcWhxVkMsGfhc0ljB7ejd8d6RXC2CXz1Hkm5cOIIus8ew9Bw3I4yXVRVVqqIo+6eWZj1wK869cyEkdP7kKDrmzfmYduE/C7peKL/3BBuHB9w4gAb3vBApxOdnP1j95fIRQtKxPyZxaguh2rC0TMT/v2jcTLeI94TENAqx3vEUfWo9ZBhrOj68dRtevAsblFDPrOi9ivN4QHVwijNLaV917pw4tB7iMf8rlxpeSV+5ZEnUdswKee7fEzlOx9VYvvHo8T044jrx/vRFx2y9qjc7K0vV09fLC0CSmQfUXfgDYQ9u15SCH+44R5XlGi9snO675yoyNHzuxjDThkTP5MBlTX1CBcVts23eldhmy3jhcv7exDvtdxOLbkW9AlnJ0wLUCnek9LSlnT3eGOOtvSfPHxl54yHMqaS93AuM6EJdwB9cUSeft2shfpLlE8fZsKMnP6fy7RpKvRuoC267uFcr+rQGzBe2GLuBLlutKvfsy5WUxEpRfoL0Z0zs+KtwHQ0e0VUmFtb8OljS12ZWLz3udBDtFY/9fF4jH2rixd3/2fjQxDmC4A3X595isHNnsE5xKv1u5S+WELdet+z+jSEuaVr5/TFQcRn5N0PICawUV4J648pxhs8oXX2GAp7/rxoLdnylfzHFBh/0HjmOh5DV1zdOXMt6X7r+7wuqvSnj634zQngpOW2qsyozu/LrHaUziQXcN0VGiPfpAQKgH1yroXKn2B8wJLeYscfWXjsRdkYMpItJB/jMh5Lfbgk3BJZGTzepKVnG4mmGyg1sUK19xxVtKNW4VcvfrWUqaIMIbeUGUZLLqn3zQ1jgIcRTyHHXnIe6GCvNRfhM+EyIkTjqbHHNJ4wifCl4dZchM8EMyKdxgZaFc1Ez0b4AgVtI6zUjtc7Us8M9BMbtpQbRmshhNcYEwO8sA90cWFD1mgX75+pcuFM626+3vafqb6YbCaF2Qw2nEI02sLgGY/sFmQ7xaC7hSna93zl9v5MteHpk80U9z9FdqKJyNtIdG8kdtRa+wqil3R3vwlB34WINFOHe3bNjuAW8P/4M203oLS1YgAAAABJRU5ErkJggg==",Fm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0WSURBVHgB1ZsNcFTVFYDPe7thd7NZsonIT6CwQWvAnwTaRNuxQoJ2SqpViW3RiiMgVq2dgcy0dnRqkwz9Ga0dNjOt2BYVi2hpVaSFBmyRRWBajUoIWIlYWERAhWE3xoT87O7rOfftDW/fu+9vEzrTb+bN7rvvvnd2z7n3nHN/ngR5kvh7US2AMkvKKHMBpFkgQRgUPAgJkvg9jtfjkj+yTy6cGgvVbI3BCFAUpRY/ZuExN/sZzh5EEo949tiHR0ySpBiMhG+ivAzQ/5qL/8UoT8rKU1CeDDF4IT95kpvKiY3hsFw0uFxRpBXDynZO3Ddlaaz/g3UtJfXJuJMbUOkkYzkeKwDcy8MjhkcLGiPu6I6bUZ48AnkSyiuAFvijQ3ng0ABM8YVDTYr6w0aEHJgG8piStcGrdpsqJqv4JhgFeVnWgpUhVMWPnjwJ5Tk0hK0Bul8JLFdAbs6jxdsR945vaCmavW6tthCVTy2wGWD05YFqhLU5pbegPOX8yYOXdPJ0WBqge1twlTJ6rVCIJ1AWDc051EjfUfmrwIG8gVQG9hw6DfHTvew8Mi4INeWlEPJ7wQFRNAKTBw3O5I2QKBqh0eyi0ADkcqTg0EZsGbXwP8AfaezwXbKSAmmtVT1SfOexbtj/YZJ910LKr5g4Fg1RAnac+RQ6LljKEoVaq3qzIviDLgeoiqjfw0G1PH4KozDafuc7GGQOAHTEwRoJOiANdfCylDReEpDcFtwLaqbhCsmLiVAq6fY2KPryP8ETusKyTtfJHmiPJ6Cnf4idH/l3J+zZvJF9r7luPlR84Sr2nQxRHSmFGZNCps+a/QNU2hFzWYvrAO7Eo/YycET8E/Q1f8JAs8OiEgXoF6U6Y7GOfN2O7J8GwZo2SJ15Dc6+c6/j+/wVj4Bv2v2m108kz0L7kQT7ZOeHD0H79q34+X5OvXGTJsP8O5ZBqKSUnZMhbpo92eCWGp9Cn7BFLIsUvmoJtrxyyAsyxJJfY694x7SKwR3lGCDxSnCxpMDT4BKufDkwlZ0PHn/WkRHGlC2CwOVPCK/19KdQ8Weg66Me9TxxBt7c3gYH33rD8pkVX7wSaq6tHzZExcTQcHygFkoKErH8BtTOEhgVmrE3tGwwvdyIRojyk2EDJNr8EUn2UCeKgAv0yufYGcHsPr2fH+g/C517YrB/90723SnV6JYqr64Fnz/AzicXj4Plvy9mrVRP07dRaQthVLEwQhIHeOU8Hnh46UN3+igjqAUXmCmRPXhsJV6fCqlTm4X3+mc8At7Sa3LKyM9v6TwJx870QTqjQNdbr8OWp5+AY+8dhHQqBW4gF/V+59vgCwTQPU2Bx/9WBAeO+gz1zofyCRY/JDVQ6/BjuR/ebdkGkO0B2dZ/BFxgpXwtop5A94bm5P6yTXtP2Pr5fPGPmwntvl8ayiPjMZivhvNK3U9MYkIGSqgXsAglezxNigKOMVO+kurGTKg4p2zM5EXsU2sE38UP5tShlk/KZ35+28twcN8+GE3eT39NWL6jBRxBKSdlTZR+EpEL1UDN01Irnv6+mnUle3UXZJboNDMDKC7yfTPlZ85+AL1v1oO35BpDYNUbwVsyJ+f6p9nUsuvt102VPzYUhBu/fh1UXFIOkydNgOMnP4aHV0Zh0cKbWJmW9Rv+AgffOzx83uurNDyPUk3qAVaQ0lo3q1mTQYHZZ5ALs3oOXVuBAb7ZGA/YiN+baGOzmhFwgJ3yM2ePwiAehJkRBk+ut3VbemZ8fjo8+fgvIBQ61+Ta1+xnhrhv2Xdyyjdt+YeqfB+WDfSi8q+AQY9RQ6Q4KyhY1zWBMGhzKKsi90I9ycoIy68XGiBMM64ydoVacEim/yikMc/PKdMonzN4Av3+AWMGlE7sZj3ELdFHf5yj5BMnP4HVa56De5fdllNOrF7zPGQq5kC6uoGdkwH0kPuwUhi1djvlc7ihkn3mdchVCQd1ON0tYxSuAhf0oRsZwsDK7hcon6M3An2nMk+oEtxALbxsUq62Hl65Cm66/jp2aCGjnPgsA5maBshUzgelbCacLZhueKbdCJfSRyfK51Dd1r9a16EpDQPo+mXMgyJWNzK3U93GPjlkhP7//NygfHI7voseGj7nRuDKV5/n3P1wF6OFXEzXocOGct4r0qh8JXQhK0vPuwcGC43D2rk2BlgbA9ewOGHRC2guyYAEVV4r/6/1+fTZ217P3BAxgAbQQsqnkS2HX+eKH35m4TRwCvl9LaqSn4fbMfDqe8Wj0d+h3y9k7odDhhj0jKWunkO40Fwm+XRRwLWD7nnmVXXiTkRC/Myw12yeXx9wRUbg6JXvz/YCvZEKsI4+TTVD5HpWr1nPBi6iXvHqzn+pv/PEu5BB18PJDBnnG638vxvXo2eF60kcCMumlyTn5QrGAidlTtc/zVzPpi3bDb2ip6dXDbzl1TgDdyHIu9fB/xPe7AK6oReQbycfz/w/tn6rgNufbenc/2t9vhYqoykIu15gpmQKuvpe8eyGTWrgvXYRZHpOg3fTT8Hz5ouYBd3CrssFiqEXWLkYu7GBFU0LzQM8nynVkSQXRJNCQjfEjRC47Ak2iNIqnxQ5GH982B1xI5ChtMovyLqmoWyZMpS0NIDY9TwndD3DgReDLQu8eKQr68HTuZXFAirzCAywL24+5cwXXvKJAzTgMosvMVGhBHF0QVIHWMCNYMh2pt6vxghNdkRG0Cu/EOvSwQ2R7tlvKqts4gShkqmVU84vDLyoZG3gzVD+PyYInld/y879xWmDHKsVLFI+KdItNCq2Cu47DwgKM3BUxnXYneACbcDlgVlrBA5XPocbIXVml+mzH1i2wFC29HsPwry5XzLk/Dzwput1y62YCaWwR0gYjIsP74LABcZZVIsFEwaNXN24IqprN7IWysSlShkU6x6QUx9dh34eR2QEvfKHy0u/gn66U/jsmkiJYfWKDaxwzueBFd/NKecxgf2mfVsNz6IBmIJBuS/2Bwj4PzNcp4m1mKhFZqFeYDe9wKE6dnXJ/wsNIENMLqn/LMYCsQNotlN1R7kZjtYIZsqnGNCHwTmV2MWeoyUUKIDq8tKcMu7fRTGBBV40DJPd9RpLPfWk6u4BamJFRzawQKznmRhYQgrd+1jWrwtmPamMgi7VsTMUrRcLiNNuuux6QFGzJCtN4BDaXMWzIy1kGNFEG1c+h7Ilv2bELOIudD1khLaNT+aUU9n8BUtzyijYpr71M3UCTvs70TgUCz6asRJO9cw2yNj7K5MRqg42HR0/N0bgcztOpqPpnvL7BBdo89aL0hJ1HOD3RsEF5wKzsSfo0SufGDz6G7CC/Hv72/vhhyvuNlxjgVeH1HMKU8+XDOUsE0J3VCW3gQhaoHcCVzgFWjpuvtKZ8gmzNWi2cw7ICyEldcmkokit4AIzI2gRKZ8gFzRgYgQ+3UBBl4KvFu2IV4+MqafeFY31pKHu9ruh4Y6FMK+q23AP+eVG96NXx5DrMQm+a/m2xXMjYZ+32Wks4FgZwUz5HJqm0McCgvz9oltvNKSj2sBrhkypJ64B+CQFrirug9smJWFmqQf/moz+WhG22uhmyx0MeUPKbxY/N85bPzG8KP/IM/39P7ptzIAkw3xwASmRFt4Lxn8DpAJ1gGWnfEZmAAcFA+Ad91XDpcrLZxjm+fe89wns7zoCp08eN32kNNgHM6d/Dm6sCMK0wBB4JXVbyvVVZXDR+AD4CwC2CXI+aqUUDIVTxnlgoXyiEf58biu7YXomsbUoKklsg6wreGBOJ16zV74Gu41ZBG1PeWqXumeA1o13vLAejusW7CdPvxiqr62HMvwkysIBtk2RPrWQy4mKN2o4SimtsN2YpUArbJRyNr2Jtya+EtyRz75QMoJorsgOMpx+i4oe2qBFO+T41sSut96A9u1qcL36hgYov1Rd+aKxxLyZ4w2K12K6UyGLk7VeLTSuaN1iuzWxA7Oe2cZiAYkd4bA0NLQj+2bIeWfMhAWxQNU6mo+yldf5YRI6j306bAgO+fnKzxXDFVPC7LsVp7ohNv4u9kaPpTyaL6LshxZwaJqBG4SnpTSnxAZ1NiNrti80DQscb87l5OuO3CD5p7QWz+1i3RKnRSgdtpXHty3y7enk52kgZ6f4LK2SlHUDC1CeBOf1/4ncjhbbKfpEW3CxpL49EoFRRCooSRZMvLWl8NLHcsYgaITFAKMvD9T3yOgFjdwxT8P5lafdByrC2StKbf4IyJ5mrHwnjBDawg5yUWsm+XFzyYKkMO1FI0RAfUtmxPKy0BinGZUvTrNvRnkSUBo+OvKo1dNbNy9Ltmm900UqhsYQ9KZixM29UkE4mRnoboV+b9RM8Xo0hnAtD9QWSIqPmipezzlD5C8vA1Eniue4MoAWtqFLhlp0T1Vo7Qhb3M99TTUp+yZ0pPs/3um94JqOUXpNlQ7aRhPJHtrXVOmgLJ+m1ztG6TXVWtq5wGQpAnmU2SgoT8bPPF9T/S+t/b7McgGVIAAAAABJRU5ErkJggg==",Rm=({isOpen:e,isLoading:t=!1,onClose:n,accountChains:r,defaultChainId:o,defaultSymbol:s,defaultAccountType:i,balances:l,wagmiHooks:a,onDeposit:c,onCopy:u,getUserBizConfig:d,saveUserBizConfig:p,onChainChange:f,onTokenChange:h})=>{const{t:m}=It(),x=g.useMemo(()=>r.map(V=>({...V,key:Ri(V.key)})),[r]),T=g.useMemo(()=>Ri(i),[i]),w=g.useMemo(()=>x.some(V=>V.key===Ne.PERPETUALV2),[x]),P=g.useMemo(()=>{var X;if(!x||x.length===0)return T;const V=x.find(Q=>Q.key===T);return(V==null?void 0:V.key)||((X=x[0])==null?void 0:X.key)||T},[x,T]),[A,k]=g.useState(P),B=g.useCallback(V=>{var X;return((X=x.find(Q=>Q.key===V))==null?void 0:X.chains)||[]},[x]),F=B(P),b=()=>{var ue;if(!F||F.length===0)return{chainId:o||1,token:""};const V=o||((ue=F[0])==null?void 0:ue.chainId),X=F.find(Se=>Se.chainId===V)||F[0],Q=(X==null?void 0:X.tokenList)||[],we=(s||"").toUpperCase();if(we&&Q.length>0){const Se=Q.find(Ie=>(Ie.token||Ie.symbol||"").toUpperCase()===we);if(Se)return{chainId:X.chainId,token:Se.token||Se.symbol||""}}if(we)for(const Se of F){const xe=((Se==null?void 0:Se.tokenList)||[]).find(Ae=>(Ae.token||Ae.symbol||"").toUpperCase()===we);if(xe)return{chainId:Se.chainId,token:xe.token||xe.symbol||""}}const Y=Q.length>0?X:F.find(Se=>(Se.tokenList||[]).length>0)||X,se=((Y==null?void 0:Y.tokenList)||[])[0];return{chainId:(Y==null?void 0:Y.chainId)||X.chainId||1,token:(se==null?void 0:se.token)||(se==null?void 0:se.symbol)||""}},[{chainId:v,token:E}]=g.useState(()=>b()),[I,$]=g.useState(v),C=g.useMemo(()=>x.find(V=>V.key===A)||x[0],[x,A]),D=g.useMemo(()=>(C==null?void 0:C.chains)||[],[C]),y=g.useMemo(()=>{var Y,se;if(!C||!Hc(C.account)||!(A===Ne.SPOT||A===Ne.PERPETUALV2))return!1;const Q=!!((Y=C.walletOptions)!=null&&Y.evm),we=!!((se=C.walletOptions)!=null&&se.mpc);return Q&&we},[C,A]),O=g.useCallback(()=>{var V,X;return(V=C==null?void 0:C.walletOptions)!=null&&V.evm?"evm":(X=C==null?void 0:C.walletOptions)!=null&&X.mpc||C!=null&&C.account&&fs(C.account)?"mpc":"evm"},[C]),[M,S]=g.useState(()=>y?null:O()),L=g.useRef(A),j=g.useRef(y);g.useEffect(()=>{const V=L.current!==A,X=!j.current&&y;if(L.current=A,j.current=y,y){(V||X)&&S(null);return}S(O())},[A,y,O]);const z=g.useMemo(()=>{if(!C)return;if(!y)return C.account;if(!M)return;const V=C.walletOptions;return M==="mpc"?(V==null?void 0:V.mpc)||C.account:(V==null?void 0:V.evm)||C.account},[C,M,y]),W=g.useMemo(()=>z&&fs(z)?gn:Js,[z]),_=D.find(V=>V.chainId===I)||D[0],[Z,q]=g.useState(E),H=g.useCallback(V=>{$(V),f==null||f(V)},[f]),ee=g.useCallback(V=>{q(V),h==null||h(V)},[h]),fe=g.useMemo(()=>{const V=(Z||"").toLowerCase();if(!V)return"0";const X=(l==null?void 0:l[A])||(A===Ne.PERPETUAL?l==null?void 0:l.perp:void 0),Q=X==null?void 0:X[V];return typeof Q=="string"&&Q.length>0?Q:"0"},[l,A,Z]),[me,ye]=g.useState(!1),ve=V=>{V.target===V.currentTarget?ye(!0):ye(!1)},oe=V=>{me&&V.target===V.currentTarget&&n(),ye(!1)};return e?Ke.createPortal(N.jsx("div",{className:"edgex-components",children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:ve,onMouseUp:oe,"aria-hidden":"true",children:N.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-2 border-solid border-line-divider-secondary",onClick:V=>{V.stopPropagation()},children:[N.jsxs("div",{className:"flex items-center justify-between mb-4",children:[N.jsx("h2",{className:"text-lg font-semibold text-white",children:m("deposit.title")}),N.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:N.jsx(M0,{className:"h-4 w-4"})})]}),N.jsx(_h,{selectedAccount:A,options:x.map(V=>({value:V.key,label:V.key===Ne.SPOT?m("account.spot"):V.key===Ne.PERPETUAL?m(w?"account.perpetual-v1":"account.perp"):V.key===Ne.PERPETUALV2?m("account.perpetual-v2"):V.key})),onAccountChange:V=>{var xe,Ae;const X=V||A;k(X);const Q=B(X);if(!Q||Q.length===0)return;const we=Q.find(lt=>lt.chainId===I),Y=we?we.chainId:Q[0].chainId;$(Y),f==null||f(Y);const se=Q.find(lt=>lt.chainId===Y),ue=(se==null?void 0:se.tokenList)||[],Ie=ue.some(lt=>(lt.symbol||lt.token)===Z)?Z:((xe=ue[0])==null?void 0:xe.symbol)||((Ae=ue[0])==null?void 0:Ae.token)||"";Ie&&(q(Ie),h==null||h(Ie))},className:"w-full"}),N.jsx(Wh,{currentActiveChain:_,chainList:D,onChainChange:H,curSelectToken:Z,onTokenChange:ee,walletType:W,accountType:A}),y&&!M&&N.jsxs("div",{className:"mb-4",children:[N.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),N.jsx("button",{type:"button",onClick:()=>S("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:m("deposit.connectedWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:Bm,className:"w-12 h-5"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:m("deposit.connectedWalletDesc")})]})}),N.jsxs("div",{className:"flex items-center my-2",children:[N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),N.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:m("deposit.or")}),N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),N.jsx("button",{type:"button",onClick:()=>S("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:m("deposit.externalWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:Fm,className:"w-12 h-5"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:m("deposit.externalWalletDesc")})]})})]}),(!y||M)&&N.jsxs(N.Fragment,{children:[z&&fs(z)&&N.jsx(X3,{address:z.smartWalletAddress,currentActiveChain:_,selectedToken:Z,accountType:A,accountId:z.accountId,accountKey:C==null?void 0:C.key,onDeposit:c,onCopy:u,getUserBizConfig:d,saveUserBizConfig:p,onClose:n}),z&&Hc(z)&&N.jsx(dP,{address:z.ethAddress,currentActiveChain:_,selectedToken:Z,accountType:A,accountId:z.accountId,accountKey:C==null?void 0:C.key,platformBalance:fe,isLoading:t,wagmiHooks:a,onChainChange:H,onDeposit:c,onClose:n})]})]})})})}),document.body):null},Gc=6,ps=6,jm="#22FD73",fP=(e,t=Gc)=>{const n=Number(e);return!Number.isFinite(n)||n<0?t:Math.floor(n)},pP=e=>{if(e==null||e==="")return null;try{const t=new ke(e);return!t.isFinite()||t.isNaN()||t.lte(0)?null:t.decimalPlaces()??0}catch{return null}},hs=(e,t)=>{if(!e)return e;const n=Math.max(0,Math.floor(t));if(e===".")return n===0?"0":"0.";if((e.match(/\./g)||[]).length!==1)return e;const[o,s=""]=e.split(".");return n===0?o:s.length<=n?e:`${o}.${s.slice(0,n)}`},hP=e=>e?e.length<=ps*2?{start:e,middle:"",end:""}:{start:e.slice(0,ps),middle:e.slice(ps,-ps),end:e.slice(-ps)}:{start:"",middle:"",end:""},mP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",decimals:i=Gc,walletType:l="evm",receiverAddress:a="",accountType:c="perpetual",onWithdrawAmountChange:u,onReceiverAddressChange:d,onAmountChanged:p,showPoolBalanceInsufficientTip:f=!1})=>{const{t:h}=It(),m=g.useRef(null),[x,T]=g.useState(0),w=g.useMemo(()=>{const _=fP((n==null?void 0:n.decimals)??i,Gc),Z=pP((n==null?void 0:n.stepSize)??(n==null?void 0:n.stepsize));return Z===null?_:Math.min(_,Z)},[i,n==null?void 0:n.decimals,n==null?void 0:n.stepSize,n==null?void 0:n.stepsize]),P=g.useMemo(()=>{if(c==="spot"||!Pn(r==null?void 0:r.chainId)){const _=new ke(e||"0").minus(s||"0");if(_.isNegative()||_.isZero())return"0";const Z=Math.min(_.decimalPlaces()??0,18);return _.decimalPlaces(Z,ke.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,c]),A=g.useMemo(()=>o||"0",[o]),k=g.useMemo(()=>{const _=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new ke(_||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),B=g.useMemo(()=>k==="0",[k]),F=g.useMemo(()=>(t||"").toUpperCase()==="USDC",[t]),b=g.useMemo(()=>{const _=Number(r==null?void 0:r.chainId),Z=String((r==null?void 0:r.chain)||"").trim().toUpperCase();return _===33431||_===3343||Z==="EDGE"},[r==null?void 0:r.chainId,r==null?void 0:r.chain]),v=g.useMemo(()=>{const _=(t||"").toUpperCase();return _==="USDT"||_==="USDC"},[t]),E=g.useMemo(()=>F&&B,[F,B]),I=g.useMemo(()=>!b&&E,[b,E]),$=g.useMemo(()=>E,[E]),C=g.useMemo(()=>!E,[E]),D=g.useMemo(()=>I,[I]),y=g.useMemo(()=>c===Ne.PERPETUAL&&Pn(r==null?void 0:r.chainId),[c,r==null?void 0:r.chainId]),O=c===Ne.SPOT,M=g.useMemo(()=>Pn(r==null?void 0:r.chainId)?l==="mpc"?"withdraw.noticeDescWithClaim":"withdraw.externalWalletEthNoticeDesc":"withdraw.crossChainTipsWithGas",[r==null?void 0:r.chainId,l]),S=g.useMemo(()=>hP(a),[a]),L=()=>{var _;T(((_=m.current)==null?void 0:_.scrollLeft)??0)};g.useEffect(()=>{L()},[a]);const j=_=>{const Z=_.target.value,q=hs(Z,w),ee=ds(q,A||"0");if(ee.isValid){const fe=hs(ee.formattedValue,w);u(fe),ee.errorType}else return ee.errorType==="exceed_balance",void 0;p==null||p(hs(ee.formattedValue,w))},z=()=>{const _=A||"0",Z=hs(_,w),q=ds(Z,_),H=hs(q.formattedValue,w);u(H),p==null||p(H)},W=()=>{const _=parseFloat(o||"0"),Z=parseFloat(e||"0");if(Z>0){const q=_-Z,H=_t(Math.max(0,q).toString());return N.jsxs("span",{className:"flex items-center gap-1",children:[_t(o||"0"),N.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),H," ",t]})}return`${_t(o||"0")} ${t}`};return N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[N.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[N.jsx("input",{type:"text",placeholder:h("deposit.amount"),value:e,onChange:j,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),N.jsx("button",{onClick:z,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:h("deposit.max")})]}),N.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx(Tn,{content:h("withdraw.availableDesc"),children:N.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:h("deposit.available")})}),N.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:W()})]})]}),l==="mpc"&&(c==="spot"||!Pn(r==null?void 0:r.chainId))?N.jsxs("div",{className:"relative bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3 overflow-hidden",children:[a?N.jsx("div",{"aria-hidden":"true",className:"absolute inset-y-0 left-3 right-3 flex items-center pointer-events-none overflow-hidden",children:N.jsxs("div",{className:"inline-flex whitespace-pre text-[12px] font-medium",style:{transform:`translateX(-${x}px)`},children:[N.jsx("span",{className:"font-medium",style:{color:jm},children:S.start}),S.middle?N.jsx("span",{className:"text-text-primary font-medium",children:S.middle}):null,S.end?N.jsx("span",{className:"font-medium",style:{color:jm},children:S.end}):null]})}):null,N.jsx("input",{ref:m,type:"text",placeholder:h("withdraw.receiverAddress"),value:a,onChange:_=>{d==null||d(_.target.value),L()},onScroll:L,onClick:L,onKeyUp:L,onSelect:L,className:`relative z-10 flex-1 bg-transparent text-[12px] font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full ${a?"text-transparent":"text-text-primary"}`,style:a?{caretColor:"var(--color-text-primary, #f9f9f9)"}:void 0})]}):null,c===Ne.PERPETUAL&&N.jsxs("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:[N.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:h(M)}),N.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:h("withdraw.commonWithdraw")})]}),f&&N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:h("withdraw.poolBalanceInsufficientTip")})]}),D&&N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:h("withdraw.largeWithdrawFeeTip")})]}),N.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[N.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[O?N.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:h("withdraw.speed")}):N.jsx(Tn,{content:N.jsxs("div",{children:[N.jsx("div",{children:h("withdraw.speedNote")}),N.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[N.jsx(as,{selectedLevel:Wt.FAST,maxLevel:3}),N.jsx("span",{children:h("withdraw.speedNoteSpeed1")})]}),N.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[N.jsx(as,{selectedLevel:Wt.Medium,maxLevel:3}),N.jsx("span",{children:h("withdraw.speedNoteSpeed2")})]}),N.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[N.jsx(as,{selectedLevel:Wt.SLOW,maxLevel:3}),N.jsx("span",{children:h("withdraw.speedNoteSpeed3")})]})]}),children:N.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:h("withdraw.speed")})}),N.jsx("div",{className:"flex items-center",children:O?N.jsx("span",{className:"text-text-primary text-sm leading-4 font-medium",children:h("deposit.arrivalEstimated",{v:"5"})}):N.jsx(as,{selectedLevel:y?Wt.SLOW:Wt.FAST,maxLevel:3})})]}),(c==="spot"||!Pn(r==null?void 0:r.chainId))&&!$&&N.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[B||!v?N.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:B?h("withdraw.fee"):`${h("withdraw.fee")}/${h("withdraw.feeRate")}`}):N.jsx(Tn,{className:"w-[320px] font-normal flex items-center justify-center",content:N.jsx("span",{className:"flex items-center justify-center text-center",children:h("withdraw.feeCalculationTip")}),children:N.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${h("withdraw.fee")}/${h("withdraw.feeRate")}`})}),N.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!B&&` / ${k}%`]})]}),C&&N.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[N.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:h(Pn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),N.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[_t(P)," ",t]})]})]})]})};let at=null;const qc={accountChains:[],defaultAccountType:""},zm=g.forwardRef((e,t)=>{const[n,r]=g.useState(!1),[o,s]=g.useState(!1),[i,l]=g.useState(qc),a=g.useCallback(h=>{l(h||qc),r(!0)},[]),c=g.useCallback(h=>{l(m=>({...m,...h}))},[]),u=g.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),d=g.useCallback(h=>{s(h)},[]),p=g.useCallback(()=>n,[n]),f=g.useCallback(()=>o,[o]);return g.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:d,isOpen:p,isLoading:f}),[a,u,c,d,p,f]),g.useEffect(()=>(at={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:d,isOpen:p,isLoading:f},()=>{at=null}),[a,u,c,d,p,f]),n?N.jsx(Hm,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},accountChains:i.accountChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});zm.displayName="WithdrawManager";const Um=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.openWithdraw(e||qc)},Wm=()=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.closeWithdraw()},_m=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.updateWithdrawOptions(e)},ji=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.setWithdrawLoading(e)},bP=()=>at?at.isOpen():!1,Vm=()=>at?at.isLoading():!1,gP=()=>({openWithdraw:Um,closeWithdraw:Wm,updateWithdrawOptions:_m,setWithdrawLoading:ji,isOpen:bP,isLoading:Vm}),yP=({accountChains:e,defaultChainId:t,defaultSymbol:n,defaultAmount:r="",defaultAccountType:o,currentEquity:s,platformBalance:i="0",balances:l,fee:a="0.00",isLoading:c=!1,onWithdraw:u,onClose:d,onChainChange:p,onTokenChange:f,onAmountChanged:h,onAccountChange:m})=>{var we;const{t:x}=It(),T=g.useMemo(()=>e.map(Y=>({...Y,key:Ri(Y.key)})),[e]),w=g.useMemo(()=>Ri(o),[o]),P=g.useMemo(()=>T.some(Y=>Y.key===Ne.PERPETUALV2),[T]),A=g.useMemo(()=>{var se;if(!T||T.length===0)return w;const Y=T.find(ue=>ue.key===w);return(Y==null?void 0:Y.key)||((se=T[0])==null?void 0:se.key)||w},[T,w]),[k,B]=g.useState(A),F=g.useCallback(Y=>{var se;return((se=T.find(ue=>ue.key===Y))==null?void 0:se.chains)||[]},[T]),b=g.useMemo(()=>T.find(Y=>Y.key===k)||T[0],[T,k]),v=g.useMemo(()=>(b==null?void 0:b.chains)||[],[b]),E=g.useMemo(()=>{var Ie,xe;if(!b||!Hc(b.account)||!(k===Ne.SPOT||k===Ne.PERPETUALV2))return!1;const ue=!!((Ie=b.walletOptions)!=null&&Ie.evm),Se=!!((xe=b.walletOptions)!=null&&xe.mpc);return ue&&Se},[b,k]),I=g.useCallback(()=>{var Y,se;return(Y=b==null?void 0:b.walletOptions)!=null&&Y.evm?"evm":(se=b==null?void 0:b.walletOptions)!=null&&se.mpc||b!=null&&b.account&&fs(b.account)?"mpc":"evm"},[b]),[$,C]=g.useState(()=>E?null:I());g.useEffect(()=>{C(E?null:I())},[k,E,I]);const D=g.useMemo(()=>{if(!b)return;if(!E)return b.account;if(!$)return;const Y=b.walletOptions;return $==="mpc"?(Y==null?void 0:Y.mpc)||b.account:(Y==null?void 0:Y.evm)||b.account},[b,E,$]),y=g.useMemo(()=>D&&fs(D)?"mpc":"evm",[D]),O=y==="mpc"?gn:Js,M=g.useMemo(()=>{if(!v||v.length===0)return{chainId:1,tokenSymbol:""};const Y=xe=>{const Ae=xe||[];if(!Ae.length)return"";const Ge="USDC".toUpperCase(),Vn=Ae.find(Ht=>(Ht.token||Ht.symbol||"").toUpperCase()===Ge)||Ae[0];return Vn.token||Vn.symbol||""};if(n){const xe=n==null?void 0:n.toUpperCase();for(const Ae of v){const lt=Ae.tokenList||[];let Ge;if(xe&&(Ge=lt.find(Vt=>(Vt.token||Vt.symbol||"").toUpperCase()===xe)),Ge){const Vt=Ge.token||Ge.symbol||n||"";return{chainId:Ae.chainId,tokenSymbol:Vt}}}}if(t){const xe=v.find(Ge=>Ge.chainId===t)||v[0],Ae=xe.tokenList||[],lt=Y(Ae);return{chainId:xe.chainId,tokenSymbol:lt}}const se="USDC",ue=xe=>Array.isArray(xe.tokenList)&&xe.tokenList.some(Ae=>(Ae.token||Ae.symbol||"").toUpperCase()===se),Se=v.find(ue)||v[0];if(!Se)return{chainId:1,tokenSymbol:""};const Ie=Y(Se.tokenList);return{chainId:Se.chainId,tokenSymbol:Ie}},[v,t,n]),[S,L]=g.useState(()=>M.chainId),[j,z]=g.useState(()=>M.tokenSymbol),[W,_]=g.useState(r),[Z,q]=g.useState(""),H=g.useCallback(Y=>{L(Y),p==null||p(Y)},[p]),ee=g.useCallback(Y=>{z(Y),f==null||f(Y)},[f]),fe=g.useRef(!0),me=g.useRef(j),ye=g.useRef(S);g.useEffect(()=>{if(fe.current){fe.current=!1,me.current=j,ye.current=S;return}(me.current!==j||ye.current!==S)&&(_(""),me.current=j,ye.current=S)},[j,S]);const ve=v&&v.length>0?v.find(Y=>Y.chainId===S)||v[0]:null,oe=(we=ve==null?void 0:ve.tokenList)==null?void 0:we.find(Y=>Y.token===j),V=g.useMemo(()=>{const Y=new ke(W||"0"),se=new ke(a||"0"),ue=Pn(S);return oe!=null&&oe.minWithdrawSize&&Y.lt(oe.minWithdrawSize)?{text:x("withdraw.minWithdrawParsed",{amount:oe.minWithdrawSize,token:oe.symbol||oe.token}),disabled:!0}:!W||Y.isZero()||!ue&&Y.isLessThan(se)?{text:x("withdraw.confirmWithdraw"),disabled:!0}:y==="mpc"&&(!ue||k==="spot")&&!Z.trim()?{text:x("withdraw.invalidReceiverAddress"),disabled:!0}:{text:x("withdraw.confirmWithdraw"),disabled:!1}},[x,S,W,y,Z,a,k,oe]),X=g.useMemo(()=>{const Y=(j||"").toLowerCase();if(!Y)return i||"0";const se=(l==null?void 0:l[k])||(k===Ne.PERPETUAL?l==null?void 0:l.perp:void 0),ue=se==null?void 0:se[Y];return typeof ue=="string"&&ue.length>0?ue:i||"0"},[l,k,j,i]),Q=g.useCallback(async()=>{ji(!0);try{if(u){const se={amount:new ke(W||"0").toString(),chainId:S,tokenAddress:(oe==null?void 0:oe.tokenAddress)||"",coinId:(oe==null?void 0:oe.coinId)||"",tokenSymbol:j,accountType:k,selectedToken:oe};y==="mpc"&&(!Pn(S)||k==="spot")&&(se.receiverAddress=Z),u(se)}}catch{ji(!1)}},[u,k,oe,W,S,j,y,Z]);return!v||v.length===0?N.jsx("div",{className:"text-center py-8",children:N.jsx("p",{className:"text-gray-400",children:"No chains available"})}):ve?N.jsxs(N.Fragment,{children:[N.jsx(_h,{selectedAccount:k,options:T.map(Y=>({value:Y.key,label:Y.key===Ne.SPOT?x("account.spot"):Y.key===Ne.PERPETUAL?x(P?"account.perpetual-v1":"account.perp"):Y.key===Ne.PERPETUALV2?x("account.perpetual-v2"):Y.key})),onAccountChange:Y=>{var Vt,Vn;const se=Y||k;B(se),m==null||m(se);const ue=F(se);if(!ue||ue.length===0)return;const Se=ue.find(Ht=>Ht.chainId===S),Ie=Se?Se.chainId:ue[0].chainId;L(Ie),p==null||p(Ie);const xe=ue.find(Ht=>Ht.chainId===Ie),Ae=(xe==null?void 0:xe.tokenList)||[],Ge=Ae.some(Ht=>(Ht.symbol||Ht.token)===j)?j:((Vt=Ae[0])==null?void 0:Vt.symbol)||((Vn=Ae[0])==null?void 0:Vn.token)||"";Ge&&(z(Ge),f==null||f(Ge))},className:"w-full"}),N.jsx(Wh,{currentActiveChain:ve,chainList:v,onChainChange:H,curSelectToken:j,onTokenChange:ee,walletType:O,accountType:k,showChainSpeed:k!==Ne.SPOT,txType:"withdraw"}),E&&!$&&N.jsxs("div",{className:"mb-4",children:[N.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),N.jsx("button",{type:"button",onClick:()=>C("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:x("withdraw.connectedWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:Bm,className:"w-12 h-5",alt:"EVM"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:x("withdraw.connectedWalletDesc")})]})}),N.jsxs("div",{className:"flex items-center my-2",children:[N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),N.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:x("deposit.or")}),N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),N.jsx("button",{type:"button",onClick:()=>C("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:x("withdraw.externalWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:Fm,className:"w-12 h-5",alt:"MPC"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:x("withdraw.externalWalletDesc")})]})})]}),(!E||$)&&N.jsxs(N.Fragment,{children:[N.jsx(mP,{withdrawAmount:W,curSelectToken:j,tokenInfo:oe,curSelectTokenData:{balance:oe==null?void 0:oe.balance,allowance:oe==null?void 0:oe.allowance},currentActiveChain:ve,currentEquity:s||0,decimals:(oe==null?void 0:oe.decimals)??6,platformBalance:X,fee:a,walletType:y,accountType:k,receiverAddress:Z,onWithdrawAmountChange:_,onReceiverAddressChange:q,onAmountChanged:h}),N.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${V.disabled||c?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Q,disabled:V.disabled||c,children:[c&&N.jsx(us,{size:"xs"}),V.text]})]})]}):N.jsx("div",{className:"text-center py-8",children:N.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Hm=({isOpen:e,isLoading:t=!1,defaultAccountType:n,onClose:r,config:o,accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a="",currentEquity:c=5e3,platformBalance:u="0",balances:d,fee:p,wagmiHooks:f,onWithdraw:h,onChainChange:m,onTokenChange:x,onAmountChanged:T,onAccountChange:w})=>{const{t:P}=It(),[A,k]=g.useState(!1),B=b=>{b.target===b.currentTarget?k(!0):k(!1)},F=b=>{A&&b.target===b.currentTarget&&r(),k(!1)};return e?Ke.createPortal(N.jsx("div",{className:"edgex-components",children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:B,onMouseUp:F,"aria-hidden":"true",children:N.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:b=>{b.stopPropagation()},children:[N.jsxs("div",{className:"flex items-center justify-between mb-4",children:[N.jsx("h2",{className:"text-lg font-semibold text-white",children:P("withdraw.withdraw")}),N.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:N.jsx(M0,{className:"h-4 w-4"})})]}),N.jsx(yP,{accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a,defaultAccountType:n,currentEquity:c,platformBalance:u,balances:d,fee:p,isLoading:t,wagmiHooks:f,onWithdraw:h,onClose:r,onChainChange:m,onTokenChange:x,onAmountChanged:T,onAccountChange:w})]})})})}),document.body):null};le.ChromeLoader=us,le.ComponentProvider=gb,le.DEFAULT_LOCALE=bs,le.Deposit=Rm,le.DepositManager=Om,le.LOCALE_NAMES=hb,le.LoadingSpinner=us,le.SUPPORTED_LOCALES=Ui,le.Tooltip=Tn,le.Withdraw=Hm,le.WithdrawManager=zm,le.closeDeposit=Im,le.closeWithdraw=Wm,le.formatThousands=vb,le.isDepositLoading=Dm,le.isWithdrawLoading=Vm,le.openDeposit=$m,le.openWithdraw=Um,le.setDepositLoading=Bi,le.setWithdrawLoading=ji,le.updateDepositOptions=Mm,le.updateWithdrawOptions=_m,le.useComponentConfig=su,le.useDeposit=Rx,le.useDepositManager=oP,le.useTranslation=It,le.useWithdraw=jx,le.useWithdrawManager=gP,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
187
187
  //# sourceMappingURL=index.umd.js.map