@edgex-web/components 0.1.0-beta.41 → 0.1.0-beta.43

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 (35) hide show
  1. package/dist/{ccip-BA6oBn1O.mjs → ccip-BsU2IAdX.mjs} +2 -2
  2. package/dist/{ccip-BA6oBn1O.mjs.map → ccip-BsU2IAdX.mjs.map} +1 -1
  3. package/dist/components/Deposit/types/index.d.ts +3 -0
  4. package/dist/components/Deposit/types/index.d.ts.map +1 -1
  5. package/dist/components/Withdraw/src/constants.d.ts +1 -1
  6. package/dist/components/Withdraw/src/evm/WalletView.d.ts +2 -0
  7. package/dist/components/Withdraw/src/evm/WalletView.d.ts.map +1 -1
  8. package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -1
  9. package/dist/components/shared/components/selector/Chain.d.ts.map +1 -1
  10. package/dist/components/shared/components/selector/index.d.ts.map +1 -1
  11. package/dist/components/shared/components/selector/types/index.d.ts +2 -0
  12. package/dist/components/shared/components/selector/types/index.d.ts.map +1 -1
  13. package/dist/hooks/index.d.ts +1 -0
  14. package/dist/hooks/index.d.ts.map +1 -1
  15. package/dist/hooks/usePoolBalance.d.ts +19 -0
  16. package/dist/hooks/usePoolBalance.d.ts.map +1 -0
  17. package/dist/hooks/useTranslation.d.ts +8 -0
  18. package/dist/hooks/useTranslation.d.ts.map +1 -1
  19. package/dist/{index-BYcXlDcy.mjs → index-4RV1Whpr.mjs} +17326 -17102
  20. package/dist/index-4RV1Whpr.mjs.map +1 -0
  21. package/dist/index.esm.js +1 -1
  22. package/dist/index.umd.js +73 -73
  23. package/dist/index.umd.js.map +1 -1
  24. package/dist/locales/en-US.d.ts +4 -0
  25. package/dist/locales/en-US.d.ts.map +1 -1
  26. package/dist/locales/ja-JP.d.ts +4 -0
  27. package/dist/locales/ja-JP.d.ts.map +1 -1
  28. package/dist/locales/ru-RU.d.ts +4 -0
  29. package/dist/locales/ru-RU.d.ts.map +1 -1
  30. package/dist/locales/zh-CN.d.ts +4 -0
  31. package/dist/locales/zh-CN.d.ts.map +1 -1
  32. package/dist/locales/zh-TW.d.ts +4 -0
  33. package/dist/locales/zh-TW.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/index-BYcXlDcy.mjs.map +0 -1
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(re,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],E):(re=typeof globalThis<"u"?globalThis:re||self,E(re.EdgeXComponents={},re.React,re.ReactDOM))})(this,function(re,E,Ne){"use strict";var j$=Object.defineProperty;var _$=(re,E,Ne)=>E in re?j$(re,E,{enumerable:!0,configurable:!0,writable:!0,value:Ne}):re[E]=Ne;var Io=(re,E,Ne)=>_$(re,typeof E!="symbol"?E+"":E,Ne);function ou(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=ou(E),Pr=ou(Ne);function X0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Js={exports:{}},Ar={};/**
1
+ (function(ae,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],x):(ae=typeof globalThis<"u"?globalThis:ae||self,x(ae.EdgeXComponents={},ae.React,ae.ReactDOM))})(this,function(ae,x,Me){"use strict";var ZP=Object.defineProperty;var KP=(ae,x,Me)=>x in ae?ZP(ae,x,{enumerable:!0,configurable:!0,writable:!0,value:Me}):ae[x]=Me;var ko=(ae,x,Me)=>KP(ae,typeof x!="symbol"?x+"":x,Me);function lu(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=lu(x),Tr=lu(Me);function om(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ni={exports:{}},Cr={};/**
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 su;function Q0(){if(su)return Ar;su=1;var e=E,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(c,a,u){var l,f={},d=null,p=null;u!==void 0&&(d=""+u),a.key!==void 0&&(d=""+a.key),a.ref!==void 0&&(p=a.ref);for(l in a)r.call(a,l)&&!s.hasOwnProperty(l)&&(f[l]=a[l]);if(c&&c.defaultProps)for(l in a=c.defaultProps,a)f[l]===void 0&&(f[l]=a[l]);return{$$typeof:t,type:c,key:d,ref:p,props:f,_owner:o.current}}return Ar.Fragment=n,Ar.jsx=i,Ar.jsxs=i,Ar}var Tr={};/**
9
+ */var fu;function sm(){if(fu)return Cr;fu=1;var e=x,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(c,a,u){var l,f={},d=null,p=null;u!==void 0&&(d=""+u),a.key!==void 0&&(d=""+a.key),a.ref!==void 0&&(p=a.ref);for(l in a)r.call(a,l)&&!s.hasOwnProperty(l)&&(f[l]=a[l]);if(c&&c.defaultProps)for(l in a=c.defaultProps,a)f[l]===void 0&&(f[l]=a[l]);return{$$typeof:t,type:c,key:d,ref:p,props:f,_owner:o.current}}return Cr.Fragment=n,Cr.jsx=i,Cr.jsxs=i,Cr}var Or={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,53 +14,95 @@
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 iu;function J0(){return iu||(iu=1,process.env.NODE_ENV!=="production"&&function(){var e=E,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"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function w(B){if(B===null||typeof B!="object")return null;var G=h&&B[h]||B[m];return typeof G=="function"?G:null}var O=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(B){{for(var G=arguments.length,Y=new Array(G>1?G-1:0),ee=1;ee<G;ee++)Y[ee-1]=arguments[ee];A("error",B,Y)}}function A(B,G,Y){{var ee=O.ReactDebugCurrentFrame,le=ee.getStackAddendum();le!==""&&(G+="%s",Y=Y.concat([le]));var de=Y.map(function(ae){return String(ae)});de.unshift("Warning: "+G),Function.prototype.apply.call(console[B],console,de)}}var M=!1,R=!1,D=!1,j=!1,g=!1,v;v=Symbol.for("react.module.reference");function P(B){return!!(typeof B=="string"||typeof B=="function"||B===r||B===s||g||B===o||B===u||B===l||j||B===p||M||R||D||typeof B=="object"&&B!==null&&(B.$$typeof===d||B.$$typeof===f||B.$$typeof===i||B.$$typeof===c||B.$$typeof===a||B.$$typeof===v||B.getModuleId!==void 0))}function N(B,G,Y){var ee=B.displayName;if(ee)return ee;var le=G.displayName||G.name||"";return le!==""?Y+"("+le+")":Y}function I(B){return B.displayName||"Context"}function $(B){if(B==null)return null;if(typeof B.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof B=="function")return B.displayName||B.name||null;if(typeof B=="string")return B;switch(B){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof B=="object")switch(B.$$typeof){case c:var G=B;return I(G)+".Consumer";case i:var Y=B;return I(Y._context)+".Provider";case a:return N(B,B.render,"ForwardRef");case f:var ee=B.displayName||null;return ee!==null?ee:$(B.type)||"Memo";case d:{var le=B,de=le._payload,ae=le._init;try{return $(ae(de))}catch{return null}}}return null}var S=Object.assign,x=0,T,C,y,k,F,_,z;function H(){}H.__reactDisabledLog=!0;function K(){{if(x===0){T=console.log,C=console.info,y=console.warn,k=console.error,F=console.group,_=console.groupCollapsed,z=console.groupEnd;var B={configurable:!0,enumerable:!0,value:H,writable:!0};Object.defineProperties(console,{info:B,log:B,warn:B,error:B,group:B,groupCollapsed:B,groupEnd:B})}x++}}function W(){{if(x--,x===0){var B={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},B,{value:T}),info:S({},B,{value:C}),warn:S({},B,{value:y}),error:S({},B,{value:k}),group:S({},B,{value:F}),groupCollapsed:S({},B,{value:_}),groupEnd:S({},B,{value:z})})}x<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Z=O.ReactCurrentDispatcher,q;function Q(B,G,Y){{if(q===void 0)try{throw Error()}catch(le){var ee=le.stack.trim().match(/\n( *(at )?)/);q=ee&&ee[1]||""}return`
18
- `+q+B}}var te=!1,ue;{var Se=typeof WeakMap=="function"?WeakMap:Map;ue=new Se}function Ke(B,G){if(!B||te)return"";{var Y=ue.get(B);if(Y!==void 0)return Y}var ee;te=!0;var le=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var de;de=Z.current,Z.current=null,K();try{if(G){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(Ve){ee=Ve}Reflect.construct(B,[],ae)}else{try{ae.call()}catch(Ve){ee=Ve}B.call(ae.prototype)}}else{try{throw Error()}catch(Ve){ee=Ve}B()}}catch(Ve){if(Ve&&ee&&typeof Ve.stack=="string"){for(var se=Ve.stack.split(`
19
- `),Re=ee.stack.split(`
20
- `),we=se.length-1,ve=Re.length-1;we>=1&&ve>=0&&se[we]!==Re[ve];)ve--;for(;we>=1&&ve>=0;we--,ve--)if(se[we]!==Re[ve]){if(we!==1||ve!==1)do if(we--,ve--,ve<0||se[we]!==Re[ve]){var ut=`
21
- `+se[we].replace(" at new "," at ");return B.displayName&&ut.includes("<anonymous>")&&(ut=ut.replace("<anonymous>",B.displayName)),typeof B=="function"&&ue.set(B,ut),ut}while(we>=1&&ve>=0);break}}}finally{te=!1,Z.current=de,W(),Error.prepareStackTrace=le}var $r=B?B.displayName||B.name:"",Hn=$r?Q($r):"";return typeof B=="function"&&ue.set(B,Hn),Hn}function $e(B,G,Y){return Ke(B,!1)}function Pe(B){var G=B.prototype;return!!(G&&G.isReactComponent)}function fe(B,G,Y){if(B==null)return"";if(typeof B=="function")return Ke(B,Pe(B));if(typeof B=="string")return Q(B);switch(B){case u:return Q("Suspense");case l:return Q("SuspenseList")}if(typeof B=="object")switch(B.$$typeof){case a:return $e(B.render);case f:return fe(B.type,G,Y);case d:{var ee=B,le=ee._payload,de=ee._init;try{return fe(de(le),G,Y)}catch{}}}return""}var Co=Object.prototype.hasOwnProperty,R0={},F0=O.ReactDebugCurrentFrame;function Qs(B){if(B){var G=B._owner,Y=fe(B.type,B._source,G?G.type:null);F0.setExtraStackFrame(Y)}else F0.setExtraStackFrame(null)}function b$(B,G,Y,ee,le){{var de=Function.call.bind(Co);for(var ae in B)if(de(B,ae)){var se=void 0;try{if(typeof B[ae]!="function"){var Re=Error((ee||"React class")+": "+Y+" type `"+ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof B[ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Re.name="Invariant Violation",Re}se=B[ae](G,ae,ee,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(we){se=we}se&&!(se instanceof Error)&&(Qs(le),b("%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).",ee||"React class",Y,ae,typeof se),Qs(null)),se instanceof Error&&!(se.message in R0)&&(R0[se.message]=!0,Qs(le),b("Failed %s type: %s",Y,se.message),Qs(null))}}}var y$=Array.isArray;function Xc(B){return y$(B)}function w$(B){{var G=typeof Symbol=="function"&&Symbol.toStringTag,Y=G&&B[Symbol.toStringTag]||B.constructor.name||"Object";return Y}}function v$(B){try{return D0(B),!1}catch{return!0}}function D0(B){return""+B}function j0(B){if(v$(B))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",w$(B)),D0(B)}var _0=O.ReactCurrentOwner,x$={key:!0,ref:!0,__self:!0,__source:!0},U0,z0;function E$(B){if(Co.call(B,"ref")){var G=Object.getOwnPropertyDescriptor(B,"ref").get;if(G&&G.isReactWarning)return!1}return B.ref!==void 0}function S$(B){if(Co.call(B,"key")){var G=Object.getOwnPropertyDescriptor(B,"key").get;if(G&&G.isReactWarning)return!1}return B.key!==void 0}function $$(B,G){typeof B.ref=="string"&&_0.current}function P$(B,G){{var Y=function(){U0||(U0=!0,b("%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)",G))};Y.isReactWarning=!0,Object.defineProperty(B,"key",{get:Y,configurable:!0})}}function A$(B,G){{var Y=function(){z0||(z0=!0,b("%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)",G))};Y.isReactWarning=!0,Object.defineProperty(B,"ref",{get:Y,configurable:!0})}}var T$=function(B,G,Y,ee,le,de,ae){var se={$$typeof:t,type:B,key:G,ref:Y,props:ae,_owner:de};return se._store={},Object.defineProperty(se._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(se,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ee}),Object.defineProperty(se,"_source",{configurable:!1,enumerable:!1,writable:!1,value:le}),Object.freeze&&(Object.freeze(se.props),Object.freeze(se)),se};function O$(B,G,Y,ee,le){{var de,ae={},se=null,Re=null;Y!==void 0&&(j0(Y),se=""+Y),S$(G)&&(j0(G.key),se=""+G.key),E$(G)&&(Re=G.ref,$$(G,le));for(de in G)Co.call(G,de)&&!x$.hasOwnProperty(de)&&(ae[de]=G[de]);if(B&&B.defaultProps){var we=B.defaultProps;for(de in we)ae[de]===void 0&&(ae[de]=we[de])}if(se||Re){var ve=typeof B=="function"?B.displayName||B.name||"Unknown":B;se&&P$(ae,ve),Re&&A$(ae,ve)}return T$(B,se,Re,le,ee,_0.current,ae)}}var Qc=O.ReactCurrentOwner,H0=O.ReactDebugCurrentFrame;function Sr(B){if(B){var G=B._owner,Y=fe(B.type,B._source,G?G.type:null);H0.setExtraStackFrame(Y)}else H0.setExtraStackFrame(null)}var Jc;Jc=!1;function eu(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function W0(){{if(Qc.current){var B=$(Qc.current.type);if(B)return`
17
+ */var du;function im(){return du||(du=1,process.env.NODE_ENV!=="production"&&function(){var e=x,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"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function v(R){if(R===null||typeof R!="object")return null;var G=h&&R[h]||R[m];return typeof G=="function"?G:null}var $=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(R){{for(var G=arguments.length,Y=new Array(G>1?G-1:0),oe=1;oe<G;oe++)Y[oe-1]=arguments[oe];T("error",R,Y)}}function T(R,G,Y){{var oe=$.ReactDebugCurrentFrame,me=oe.getStackAddendum();me!==""&&(G+="%s",Y=Y.concat([me]));var ge=Y.map(function(de){return String(de)});ge.unshift("Warning: "+G),Function.prototype.apply.call(console[R],console,ge)}}var B=!1,L=!1,_=!1,F=!1,g=!1,w;w=Symbol.for("react.module.reference");function A(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||g||R===o||R===u||R===l||F||R===p||B||L||_||typeof R=="object"&&R!==null&&(R.$$typeof===d||R.$$typeof===f||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===w||R.getModuleId!==void 0))}function I(R,G,Y){var oe=R.displayName;if(oe)return oe;var me=G.displayName||G.name||"";return me!==""?Y+"("+me+")":Y}function N(R){return R.displayName||"Context"}function P(R){if(R==null)return null;if(typeof R.tag=="number"&&y("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 u:return"Suspense";case l:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var G=R;return N(G)+".Consumer";case i:var Y=R;return N(Y._context)+".Provider";case a:return I(R,R.render,"ForwardRef");case f:var oe=R.displayName||null;return oe!==null?oe:P(R.type)||"Memo";case d:{var me=R,ge=me._payload,de=me._init;try{return P(de(ge))}catch{return null}}}return null}var S=Object.assign,E=0,C,O,b,k,D,j,z;function W(){}W.__reactDisabledLog=!0;function K(){{if(E===0){C=console.log,O=console.info,b=console.warn,k=console.error,D=console.group,j=console.groupCollapsed,z=console.groupEnd;var R={configurable:!0,enumerable:!0,value:W,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}E++}}function H(){{if(E--,E===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},R,{value:C}),info:S({},R,{value:O}),warn:S({},R,{value:b}),error:S({},R,{value:k}),group:S({},R,{value:D}),groupCollapsed:S({},R,{value:j}),groupEnd:S({},R,{value:z})})}E<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Z=$.ReactCurrentDispatcher,q;function J(R,G,Y){{if(q===void 0)try{throw Error()}catch(me){var oe=me.stack.trim().match(/\n( *(at )?)/);q=oe&&oe[1]||""}return`
18
+ `+q+R}}var te=!1,pe;{var Ee=typeof WeakMap=="function"?WeakMap:Map;pe=new Ee}function X(R,G){if(!R||te)return"";{var Y=pe.get(R);if(Y!==void 0)return Y}var oe;te=!0;var me=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=Z.current,Z.current=null,K();try{if(G){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(Ze){oe=Ze}Reflect.construct(R,[],de)}else{try{de.call()}catch(Ze){oe=Ze}R.call(de.prototype)}}else{try{throw Error()}catch(Ze){oe=Ze}R()}}catch(Ze){if(Ze&&oe&&typeof Ze.stack=="string"){for(var le=Ze.stack.split(`
19
+ `),Fe=oe.stack.split(`
20
+ `),Pe=le.length-1,Ae=Fe.length-1;Pe>=1&&Ae>=0&&le[Pe]!==Fe[Ae];)Ae--;for(;Pe>=1&&Ae>=0;Pe--,Ae--)if(le[Pe]!==Fe[Ae]){if(Pe!==1||Ae!==1)do if(Pe--,Ae--,Ae<0||le[Pe]!==Fe[Ae]){var ft=`
21
+ `+le[Pe].replace(" at new "," at ");return R.displayName&&ft.includes("<anonymous>")&&(ft=ft.replace("<anonymous>",R.displayName)),typeof R=="function"&&pe.set(R,ft),ft}while(Pe>=1&&Ae>=0);break}}}finally{te=!1,Z.current=ge,H(),Error.prepareStackTrace=me}var $r=R?R.displayName||R.name:"",Gn=$r?J($r):"";return typeof R=="function"&&pe.set(R,Gn),Gn}function Q(R,G,Y){return X(R,!1)}function se(R){var G=R.prototype;return!!(G&&G.isReactComponent)}function re(R,G,Y){if(R==null)return"";if(typeof R=="function")return X(R,se(R));if(typeof R=="string")return J(R);switch(R){case u:return J("Suspense");case l:return J("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return Q(R.render);case f:return re(R.type,G,Y);case d:{var oe=R,me=oe._payload,ge=oe._init;try{return re(ge(me),G,Y)}catch{}}}return""}var ue=Object.prototype.hasOwnProperty,ei={},vn=$.ReactDebugCurrentFrame;function ti(R){if(R){var G=R._owner,Y=re(R.type,R._source,G?G.type:null);vn.setExtraStackFrame(Y)}else vn.setExtraStackFrame(null)}function $P(R,G,Y,oe,me){{var ge=Function.call.bind(ue);for(var de in R)if(ge(R,de)){var le=void 0;try{if(typeof R[de]!="function"){var Fe=Error((oe||"React class")+": "+Y+" type `"+de+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[de]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Fe.name="Invariant Violation",Fe}le=R[de](G,de,oe,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Pe){le=Pe}le&&!(le instanceof Error)&&(ti(me),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",oe||"React class",Y,de,typeof le),ti(null)),le instanceof Error&&!(le.message in ei)&&(ei[le.message]=!0,ti(me),y("Failed %s type: %s",Y,le.message),ti(null))}}}var TP=Array.isArray;function ru(R){return TP(R)}function CP(R){{var G=typeof Symbol=="function"&&Symbol.toStringTag,Y=G&&R[Symbol.toStringTag]||R.constructor.name||"Object";return Y}}function OP(R){try{return V0(R),!1}catch{return!0}}function V0(R){return""+R}function G0(R){if(OP(R))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",CP(R)),V0(R)}var q0=$.ReactCurrentOwner,IP={key:!0,ref:!0,__self:!0,__source:!0},Z0,K0;function NP(R){if(ue.call(R,"ref")){var G=Object.getOwnPropertyDescriptor(R,"ref").get;if(G&&G.isReactWarning)return!1}return R.ref!==void 0}function kP(R){if(ue.call(R,"key")){var G=Object.getOwnPropertyDescriptor(R,"key").get;if(G&&G.isReactWarning)return!1}return R.key!==void 0}function BP(R,G){typeof R.ref=="string"&&q0.current}function MP(R,G){{var Y=function(){Z0||(Z0=!0,y("%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)",G))};Y.isReactWarning=!0,Object.defineProperty(R,"key",{get:Y,configurable:!0})}}function LP(R,G){{var Y=function(){K0||(K0=!0,y("%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)",G))};Y.isReactWarning=!0,Object.defineProperty(R,"ref",{get:Y,configurable:!0})}}var RP=function(R,G,Y,oe,me,ge,de){var le={$$typeof:t,type:R,key:G,ref:Y,props:de,_owner:ge};return le._store={},Object.defineProperty(le._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(le,"_self",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.defineProperty(le,"_source",{configurable:!1,enumerable:!1,writable:!1,value:me}),Object.freeze&&(Object.freeze(le.props),Object.freeze(le)),le};function DP(R,G,Y,oe,me){{var ge,de={},le=null,Fe=null;Y!==void 0&&(G0(Y),le=""+Y),kP(G)&&(G0(G.key),le=""+G.key),NP(G)&&(Fe=G.ref,BP(G,me));for(ge in G)ue.call(G,ge)&&!IP.hasOwnProperty(ge)&&(de[ge]=G[ge]);if(R&&R.defaultProps){var Pe=R.defaultProps;for(ge in Pe)de[ge]===void 0&&(de[ge]=Pe[ge])}if(le||Fe){var Ae=typeof R=="function"?R.displayName||R.name||"Unknown":R;le&&MP(de,Ae),Fe&&LP(de,Ae)}return RP(R,le,Fe,me,oe,q0.current,de)}}var ou=$.ReactCurrentOwner,Y0=$.ReactDebugCurrentFrame;function Ar(R){if(R){var G=R._owner,Y=re(R.type,R._source,G?G.type:null);Y0.setExtraStackFrame(Y)}else Y0.setExtraStackFrame(null)}var su;su=!1;function iu(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function X0(){{if(ou.current){var R=P(ou.current.type);if(R)return`
22
22
 
23
- Check the render method of \``+B+"`."}return""}}function C$(B){return""}var V0={};function I$(B){{var G=W0();if(!G){var Y=typeof B=="string"?B:B.displayName||B.name;Y&&(G=`
23
+ Check the render method of \``+R+"`."}return""}}function FP(R){return""}var Q0={};function jP(R){{var G=X0();if(!G){var Y=typeof R=="string"?R:R.displayName||R.name;Y&&(G=`
24
24
 
25
- Check the top-level render call using <`+Y+">.")}return G}}function G0(B,G){{if(!B._store||B._store.validated||B.key!=null)return;B._store.validated=!0;var Y=I$(G);if(V0[Y])return;V0[Y]=!0;var ee="";B&&B._owner&&B._owner!==Qc.current&&(ee=" It was passed a child from "+$(B._owner.type)+"."),Sr(B),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,ee),Sr(null)}}function q0(B,G){{if(typeof B!="object")return;if(Xc(B))for(var Y=0;Y<B.length;Y++){var ee=B[Y];eu(ee)&&G0(ee,G)}else if(eu(B))B._store&&(B._store.validated=!0);else if(B){var le=w(B);if(typeof le=="function"&&le!==B.entries)for(var de=le.call(B),ae;!(ae=de.next()).done;)eu(ae.value)&&G0(ae.value,G)}}}function N$(B){{var G=B.type;if(G==null||typeof G=="string")return;var Y;if(typeof G=="function")Y=G.propTypes;else if(typeof G=="object"&&(G.$$typeof===a||G.$$typeof===f))Y=G.propTypes;else return;if(Y){var ee=$(G);b$(Y,B.props,"prop",ee,B)}else if(G.PropTypes!==void 0&&!Jc){Jc=!0;var le=$(G);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",le||"Unknown")}typeof G.getDefaultProps=="function"&&!G.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function k$(B){{for(var G=Object.keys(B.props),Y=0;Y<G.length;Y++){var ee=G[Y];if(ee!=="children"&&ee!=="key"){Sr(B),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ee),Sr(null);break}}B.ref!==null&&(Sr(B),b("Invalid attribute `ref` supplied to `React.Fragment`."),Sr(null))}}var Z0={};function K0(B,G,Y,ee,le,de){{var ae=P(B);if(!ae){var se="";(B===void 0||typeof B=="object"&&B!==null&&Object.keys(B).length===0)&&(se+=" 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 Re=C$();Re?se+=Re:se+=W0();var we;B===null?we="null":Xc(B)?we="array":B!==void 0&&B.$$typeof===t?(we="<"+($(B.type)||"Unknown")+" />",se=" Did you accidentally export a JSX literal instead of a component?"):we=typeof B,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",we,se)}var ve=O$(B,G,Y,le,de);if(ve==null)return ve;if(ae){var ut=G.children;if(ut!==void 0)if(ee)if(Xc(ut)){for(var $r=0;$r<ut.length;$r++)q0(ut[$r],B);Object.freeze&&Object.freeze(ut)}else b("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 q0(ut,B)}if(Co.call(G,"key")){var Hn=$(B),Ve=Object.keys(G).filter(function(D$){return D$!=="key"}),tu=Ve.length>0?"{key: someKey, "+Ve.join(": ..., ")+": ...}":"{key: someKey}";if(!Z0[Hn+tu]){var F$=Ve.length>0?"{"+Ve.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+Y+">.")}return G}}function J0(R,G){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var Y=jP(G);if(Q0[Y])return;Q0[Y]=!0;var oe="";R&&R._owner&&R._owner!==ou.current&&(oe=" It was passed a child from "+P(R._owner.type)+"."),Ar(R),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,oe),Ar(null)}}function em(R,G){{if(typeof R!="object")return;if(ru(R))for(var Y=0;Y<R.length;Y++){var oe=R[Y];iu(oe)&&J0(oe,G)}else if(iu(R))R._store&&(R._store.validated=!0);else if(R){var me=v(R);if(typeof me=="function"&&me!==R.entries)for(var ge=me.call(R),de;!(de=ge.next()).done;)iu(de.value)&&J0(de.value,G)}}}function _P(R){{var G=R.type;if(G==null||typeof G=="string")return;var Y;if(typeof G=="function")Y=G.propTypes;else if(typeof G=="object"&&(G.$$typeof===a||G.$$typeof===f))Y=G.propTypes;else return;if(Y){var oe=P(G);$P(Y,R.props,"prop",oe,R)}else if(G.PropTypes!==void 0&&!su){su=!0;var me=P(G);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",me||"Unknown")}typeof G.getDefaultProps=="function"&&!G.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function UP(R){{for(var G=Object.keys(R.props),Y=0;Y<G.length;Y++){var oe=G[Y];if(oe!=="children"&&oe!=="key"){Ar(R),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",oe),Ar(null);break}}R.ref!==null&&(Ar(R),y("Invalid attribute `ref` supplied to `React.Fragment`."),Ar(null))}}var tm={};function nm(R,G,Y,oe,me,ge){{var de=A(R);if(!de){var le="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(le+=" 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 Fe=FP();Fe?le+=Fe:le+=X0();var Pe;R===null?Pe="null":ru(R)?Pe="array":R!==void 0&&R.$$typeof===t?(Pe="<"+(P(R.type)||"Unknown")+" />",le=" Did you accidentally export a JSX literal instead of a component?"):Pe=typeof R,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Pe,le)}var Ae=DP(R,G,Y,me,ge);if(Ae==null)return Ae;if(de){var ft=G.children;if(ft!==void 0)if(oe)if(ru(ft)){for(var $r=0;$r<ft.length;$r++)em(ft[$r],R);Object.freeze&&Object.freeze(ft)}else y("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 em(ft,R)}if(ue.call(G,"key")){var Gn=P(R),Ze=Object.keys(G).filter(function(qP){return qP!=="key"}),au=Ze.length>0?"{key: someKey, "+Ze.join(": ..., ")+": ...}":"{key: someKey}";if(!tm[Gn+au]){var GP=Ze.length>0?"{"+Ze.join(": ..., ")+": ...}":"{}";y(`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} />`,tu,Hn,F$,Hn),Z0[Hn+tu]=!0}}return B===r?k$(ve):N$(ve),ve}}function M$(B,G,Y){return K0(B,G,Y,!0)}function L$(B,G,Y){return K0(B,G,Y,!1)}var B$=L$,R$=M$;Tr.Fragment=r,Tr.jsx=B$,Tr.jsxs=R$}()),Tr}process.env.NODE_ENV==="production"?Js.exports=Q0():Js.exports=J0();var L=Js.exports;const em={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
- 充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"暂不支持无私钥钱包充值。若您是无私钥钱包,请勿进行充值。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不合法",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。"}},tm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",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
- If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,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",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Deposits from wallets without private keys are not supported at the moment. If you are using such a wallet, please do not make a deposit.",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"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",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",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Invalid receiver address",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made."}},nm={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
33
- 入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"現在、秘密鍵のないウォレットからの入金はサポートされていません。該当ウォレットをご利用の場合は、入金しないでください。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"無効な受け取りアドレス",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。"}},rm={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
34
- Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:"В настоящее время пополнение кошельков без приватных ключей не поддерживается. Если у вас такой кошелёк, пожалуйста, не выполняйте пополнение.",layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Неверный адрес получателя",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен."}},om={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
35
- 充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"暫不支援無私鑰錢包充值。若您使用的是無私鑰錢包,請勿進行充值。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不合法",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。"}},ei=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],au={"en-US":tm,"ja-JP":nm,"ru-RU":rm,"zh-CN":em,"zh-TW":om},No="en-US",sm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},im=e=>ei.includes(e)?au[e]:au[No],am=e=>ei.includes(e),cu=E.createContext(null),cm=({config:e,children:t})=>{const n=E.useMemo(()=>{const r=e.locale||No,o=am(r)?r:No,s=im(o);return{...e,currentLocale:o,translations:s}},[e]);return L.jsx(cu.Provider,{value:n,children:t})},uu=()=>{const e=E.useContext(cu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var um=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ti=Math.ceil,Ye=Math.floor,Fe="[BigNumber Error] ",lu=Fe+"Number primitive has more than 15 significant digits: ",lt=1e14,ne=14,ni=9007199254740991,ri=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],an=1e7,Ae=1e9;function fu(e){var t,n,r,o=b.prototype={constructor:b,toString:null,valueOf:null},s=new b(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,d=!1,p=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},w="0123456789abcdefghijklmnopqrstuvwxyz",O=!0;function b(g,v){var P,N,I,$,S,x,T,C,y=this;if(!(y instanceof b))return new b(g,v);if(v==null){if(g&&g._isBigNumber===!0){y.s=g.s,!g.c||g.e>f?y.c=y.e=null:g.e<l?y.c=[y.e=0]:(y.e=g.e,y.c=g.c.slice());return}if((x=typeof g=="number")&&g*0==0){if(y.s=1/g<0?(g=-g,-1):1,g===~~g){for($=0,S=g;S>=10;S/=10,$++);$>f?y.c=y.e=null:(y.e=$,y.c=[g]);return}C=String(g)}else{if(!um.test(C=String(g)))return r(y,C,x);y.s=C.charCodeAt(0)==45?(C=C.slice(1),-1):1}($=C.indexOf("."))>-1&&(C=C.replace(".","")),(S=C.search(/e/i))>0?($<0&&($=S),$+=+C.slice(S+1),C=C.substring(0,S)):$<0&&($=C.length)}else{if(me(v,2,w.length,"Base"),v==10&&O)return y=new b(g),D(y,i+y.e+1,c);if(C=String(g),x=typeof g=="number"){if(g*0!=0)return r(y,C,x,v);if(y.s=1/g<0?(C=C.slice(1),-1):1,b.DEBUG&&C.replace(/^0\.0*|\./,"").length>15)throw Error(lu+g)}else y.s=C.charCodeAt(0)===45?(C=C.slice(1),-1):1;for(P=w.slice(0,v),$=S=0,T=C.length;S<T;S++)if(P.indexOf(N=C.charAt(S))<0){if(N=="."){if(S>$){$=T;continue}}else if(!I&&(C==C.toUpperCase()&&(C=C.toLowerCase())||C==C.toLowerCase()&&(C=C.toUpperCase()))){I=!0,S=-1,$=0;continue}return r(y,String(g),x,v)}x=!1,C=n(C,v,10,y.s),($=C.indexOf("."))>-1?C=C.replace(".",""):$=C.length}for(S=0;C.charCodeAt(S)===48;S++);for(T=C.length;C.charCodeAt(--T)===48;);if(C=C.slice(S,++T)){if(T-=S,x&&b.DEBUG&&T>15&&(g>ni||g!==Ye(g)))throw Error(lu+y.s*g);if(($=$-S-1)>f)y.c=y.e=null;else if($<l)y.c=[y.e=0];else{if(y.e=$,y.c=[],S=($+1)%ne,$<0&&(S+=ne),S<T){for(S&&y.c.push(+C.slice(0,S)),T-=ne;S<T;)y.c.push(+C.slice(S,S+=ne));S=ne-(C=C.slice(S)).length}else S-=T;for(;S--;C+="0");y.c.push(+C)}}else y.c=[y.e=0]}b.clone=fu,b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.EUCLID=9,b.config=b.set=function(g){var v,P;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(v="DECIMAL_PLACES")&&(P=g[v],me(P,0,Ae,v),i=P),g.hasOwnProperty(v="ROUNDING_MODE")&&(P=g[v],me(P,0,8,v),c=P),g.hasOwnProperty(v="EXPONENTIAL_AT")&&(P=g[v],P&&P.pop?(me(P[0],-Ae,0,v),me(P[1],0,Ae,v),a=P[0],u=P[1]):(me(P,-Ae,Ae,v),a=-(u=P<0?-P:P))),g.hasOwnProperty(v="RANGE"))if(P=g[v],P&&P.pop)me(P[0],-Ae,-1,v),me(P[1],1,Ae,v),l=P[0],f=P[1];else if(me(P,-Ae,Ae,v),P)l=-(f=P<0?-P:P);else throw Error(Fe+v+" cannot be zero: "+P);if(g.hasOwnProperty(v="CRYPTO"))if(P=g[v],P===!!P)if(P)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))d=P;else throw d=!P,Error(Fe+"crypto unavailable");else d=P;else throw Error(Fe+v+" not true or false: "+P);if(g.hasOwnProperty(v="MODULO_MODE")&&(P=g[v],me(P,0,9,v),p=P),g.hasOwnProperty(v="POW_PRECISION")&&(P=g[v],me(P,0,Ae,v),h=P),g.hasOwnProperty(v="FORMAT"))if(P=g[v],typeof P=="object")m=P;else throw Error(Fe+v+" not an object: "+P);if(g.hasOwnProperty(v="ALPHABET"))if(P=g[v],typeof P=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(P))O=P.slice(0,10)=="0123456789",w=P;else throw Error(Fe+v+" invalid: "+P)}else throw Error(Fe+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,f],CRYPTO:d,MODULO_MODE:p,POW_PRECISION:h,FORMAT:m,ALPHABET:w}},b.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!b.DEBUG)return!0;var v,P,N=g.c,I=g.e,$=g.s;e:if({}.toString.call(N)=="[object Array]"){if(($===1||$===-1)&&I>=-Ae&&I<=Ae&&I===Ye(I)){if(N[0]===0){if(I===0&&N.length===1)return!0;break e}if(v=(I+1)%ne,v<1&&(v+=ne),String(N[0]).length==v){for(v=0;v<N.length;v++)if(P=N[v],P<0||P>=lt||P!==Ye(P))break e;if(P!==0)return!0}}}else if(N===null&&I===null&&($===null||$===1||$===-1))return!0;throw Error(Fe+"Invalid BigNumber: "+g)},b.maximum=b.max=function(){return M(arguments,-1)},b.minimum=b.min=function(){return M(arguments,1)},b.random=function(){var g=9007199254740992,v=Math.random()*g&2097151?function(){return Ye(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(P){var N,I,$,S,x,T=0,C=[],y=new b(s);if(P==null?P=i:me(P,0,Ae),S=ti(P/ne),d)if(crypto.getRandomValues){for(N=crypto.getRandomValues(new Uint32Array(S*=2));T<S;)x=N[T]*131072+(N[T+1]>>>11),x>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),N[T]=I[0],N[T+1]=I[1]):(C.push(x%1e14),T+=2);T=S/2}else if(crypto.randomBytes){for(N=crypto.randomBytes(S*=7);T<S;)x=(N[T]&31)*281474976710656+N[T+1]*1099511627776+N[T+2]*4294967296+N[T+3]*16777216+(N[T+4]<<16)+(N[T+5]<<8)+N[T+6],x>=9e15?crypto.randomBytes(7).copy(N,T):(C.push(x%1e14),T+=7);T=S/7}else throw d=!1,Error(Fe+"crypto unavailable");if(!d)for(;T<S;)x=v(),x<9e15&&(C[T++]=x%1e14);for(S=C[--T],P%=ne,S&&P&&(x=ri[ne-P],C[T]=Ye(S/x)*x);C[T]===0;C.pop(),T--);if(T<0)C=[$=0];else{for($=-1;C[0]===0;C.splice(0,1),$-=ne);for(T=1,x=C[0];x>=10;x/=10,T++);T<ne&&($-=ne-T)}return y.e=$,y.c=C,y}}(),b.sum=function(){for(var g=1,v=arguments,P=new b(v[0]);g<v.length;)P=P.plus(v[g++]);return P},n=function(){var g="0123456789";function v(P,N,I,$){for(var S,x=[0],T,C=0,y=P.length;C<y;){for(T=x.length;T--;x[T]*=N);for(x[0]+=$.indexOf(P.charAt(C++)),S=0;S<x.length;S++)x[S]>I-1&&(x[S+1]==null&&(x[S+1]=0),x[S+1]+=x[S]/I|0,x[S]%=I)}return x.reverse()}return function(P,N,I,$,S){var x,T,C,y,k,F,_,z,H=P.indexOf("."),K=i,W=c;for(H>=0&&(y=h,h=0,P=P.replace(".",""),z=new b(N),F=z.pow(P.length-H),h=y,z.c=v(jt(Qe(F.c),F.e,"0"),10,I,g),z.e=z.c.length),_=v(P,N,I,S?(x=w,g):(x=g,w)),C=y=_.length;_[--y]==0;_.pop());if(!_[0])return x.charAt(0);if(H<0?--C:(F.c=_,F.e=C,F.s=$,F=t(F,z,K,W,I),_=F.c,k=F.r,C=F.e),T=C+K+1,H=_[T],y=I/2,k=k||T<0||_[T+1]!=null,k=W<4?(H!=null||k)&&(W==0||W==(F.s<0?3:2)):H>y||H==y&&(W==4||k||W==6&&_[T-1]&1||W==(F.s<0?8:7)),T<1||!_[0])P=k?jt(x.charAt(1),-K,x.charAt(0)):x.charAt(0);else{if(_.length=T,k)for(--I;++_[--T]>I;)_[T]=0,T||(++C,_=[1].concat(_));for(y=_.length;!_[--y];);for(H=0,P="";H<=y;P+=x.charAt(_[H++]));P=jt(P,C,x.charAt(0))}return P}}(),t=function(){function g(N,I,$){var S,x,T,C,y=0,k=N.length,F=I%an,_=I/an|0;for(N=N.slice();k--;)T=N[k]%an,C=N[k]/an|0,S=_*T+C*F,x=F*T+S%an*an+y,y=(x/$|0)+(S/an|0)+_*C,N[k]=x%$;return y&&(N=[y].concat(N)),N}function v(N,I,$,S){var x,T;if($!=S)T=$>S?1:-1;else for(x=T=0;x<$;x++)if(N[x]!=I[x]){T=N[x]>I[x]?1:-1;break}return T}function P(N,I,$,S){for(var x=0;$--;)N[$]-=x,x=N[$]<I[$]?1:0,N[$]=x*S+N[$]-I[$];for(;!N[0]&&N.length>1;N.splice(0,1));}return function(N,I,$,S,x){var T,C,y,k,F,_,z,H,K,W,Z,q,Q,te,ue,Se,Ke,$e=N.s==I.s?1:-1,Pe=N.c,fe=I.c;if(!Pe||!Pe[0]||!fe||!fe[0])return new b(!N.s||!I.s||(Pe?fe&&Pe[0]==fe[0]:!fe)?NaN:Pe&&Pe[0]==0||!fe?$e*0:$e/0);for(H=new b($e),K=H.c=[],C=N.e-I.e,$e=$+C+1,x||(x=lt,C=Xe(N.e/ne)-Xe(I.e/ne),$e=$e/ne|0),y=0;fe[y]==(Pe[y]||0);y++);if(fe[y]>(Pe[y]||0)&&C--,$e<0)K.push(1),k=!0;else{for(te=Pe.length,Se=fe.length,y=0,$e+=2,F=Ye(x/(fe[0]+1)),F>1&&(fe=g(fe,F,x),Pe=g(Pe,F,x),Se=fe.length,te=Pe.length),Q=Se,W=Pe.slice(0,Se),Z=W.length;Z<Se;W[Z++]=0);Ke=fe.slice(),Ke=[0].concat(Ke),ue=fe[0],fe[1]>=x/2&&ue++;do{if(F=0,T=v(fe,W,Se,Z),T<0){if(q=W[0],Se!=Z&&(q=q*x+(W[1]||0)),F=Ye(q/ue),F>1)for(F>=x&&(F=x-1),_=g(fe,F,x),z=_.length,Z=W.length;v(_,W,z,Z)==1;)F--,P(_,Se<z?Ke:fe,z,x),z=_.length,T=1;else F==0&&(T=F=1),_=fe.slice(),z=_.length;if(z<Z&&(_=[0].concat(_)),P(W,_,Z,x),Z=W.length,T==-1)for(;v(fe,W,Se,Z)<1;)F++,P(W,Se<Z?Ke:fe,Z,x),Z=W.length}else T===0&&(F++,W=[0]);K[y++]=F,W[0]?W[Z++]=Pe[Q]||0:(W=[Pe[Q]],Z=1)}while((Q++<te||W[0]!=null)&&$e--);k=W[0]!=null,K[0]||K.splice(0,1)}if(x==lt){for(y=1,$e=K[0];$e>=10;$e/=10,y++);D(H,$+(H.e=y+C*ne-1)+1,S,k)}else H.e=C,H.r=+k;return H}}();function A(g,v,P,N){var I,$,S,x,T;if(P==null?P=c:me(P,0,8),!g.c)return g.toString();if(I=g.c[0],S=g.e,v==null)T=Qe(g.c),T=N==1||N==2&&(S<=a||S>=u)?Mo(T,S):jt(T,S,"0");else if(g=D(new b(g),v,P),$=g.e,T=Qe(g.c),x=T.length,N==1||N==2&&(v<=$||$<=a)){for(;x<v;T+="0",x++);T=Mo(T,$)}else if(v-=S+(N===2&&$>S),T=jt(T,$,"0"),$+1>x){if(--v>0)for(T+=".";v--;T+="0");}else if(v+=$-x,v>0)for($+1==x&&(T+=".");v--;T+="0");return g.s<0&&I?"-"+T:T}function M(g,v){for(var P,N,I=1,$=new b(g[0]);I<g.length;I++)N=new b(g[I]),(!N.s||(P=wn($,N))===v||P===0&&$.s===v)&&($=N);return $}function R(g,v,P){for(var N=1,I=v.length;!v[--I];v.pop());for(I=v[0];I>=10;I/=10,N++);return(P=N+P*ne-1)>f?g.c=g.e=null:P<l?g.c=[g.e=0]:(g.e=P,g.c=v),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,P=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,S,x,T){var C,y=x?S:S.replace(I,"");if(N.test(y))$.s=isNaN(y)?null:y<0?-1:1;else{if(!x&&(y=y.replace(g,function(k,F,_){return C=(_=_.toLowerCase())=="x"?16:_=="b"?2:8,!T||T==C?F:k}),T&&(C=T,y=y.replace(v,"$1").replace(P,"0.$1")),S!=y))return new b(y,C);if(b.DEBUG)throw Error(Fe+"Not a"+(T?" base "+T:"")+" number: "+S);$.s=null}$.c=$.e=null}}();function D(g,v,P,N){var I,$,S,x,T,C,y,k=g.c,F=ri;if(k){e:{for(I=1,x=k[0];x>=10;x/=10,I++);if($=v-I,$<0)$+=ne,S=v,T=k[C=0],y=Ye(T/F[I-S-1]%10);else if(C=ti(($+1)/ne),C>=k.length)if(N){for(;k.length<=C;k.push(0));T=y=0,I=1,$%=ne,S=$-ne+1}else break e;else{for(T=x=k[C],I=1;x>=10;x/=10,I++);$%=ne,S=$-ne+I,y=S<0?0:Ye(T/F[I-S-1]%10)}if(N=N||v<0||k[C+1]!=null||(S<0?T:T%F[I-S-1]),N=P<4?(y||N)&&(P==0||P==(g.s<0?3:2)):y>5||y==5&&(P==4||N||P==6&&($>0?S>0?T/F[I-S]:0:k[C-1])%10&1||P==(g.s<0?8:7)),v<1||!k[0])return k.length=0,N?(v-=g.e+1,k[0]=F[(ne-v%ne)%ne],g.e=-v||0):k[0]=g.e=0,g;if($==0?(k.length=C,x=1,C--):(k.length=C+1,x=F[ne-$],k[C]=S>0?Ye(T/F[I-S]%F[S])*x:0),N)for(;;)if(C==0){for($=1,S=k[0];S>=10;S/=10,$++);for(S=k[0]+=x,x=1;S>=10;S/=10,x++);$!=x&&(g.e++,k[0]==lt&&(k[0]=1));break}else{if(k[C]+=x,k[C]!=lt)break;k[C--]=0,x=1}for($=k.length;k[--$]===0;k.pop());}g.e>f?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function j(g){var v,P=g.e;return P===null?g.toString():(v=Qe(g.c),v=P<=a||P>=u?Mo(v,P):jt(v,P,"0"),g.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var g=new b(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,v){return wn(this,new b(g,v))},o.decimalPlaces=o.dp=function(g,v){var P,N,I,$=this;if(g!=null)return me(g,0,Ae),v==null?v=c:me(v,0,8),D(new b($),g+$.e+1,v);if(!(P=$.c))return null;if(N=((I=P.length-1)-Xe(this.e/ne))*ne,I=P[I])for(;I%10==0;I/=10,N--);return N<0&&(N=0),N},o.dividedBy=o.div=function(g,v){return t(this,new b(g,v),i,c)},o.dividedToIntegerBy=o.idiv=function(g,v){return t(this,new b(g,v),0,1)},o.exponentiatedBy=o.pow=function(g,v){var P,N,I,$,S,x,T,C,y,k=this;if(g=new b(g),g.c&&!g.isInteger())throw Error(Fe+"Exponent not an integer: "+j(g));if(v!=null&&(v=new b(v)),x=g.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!g.c||!g.c[0])return y=new b(Math.pow(+j(k),x?g.s*(2-ko(g)):+j(g))),v?y.mod(v):y;if(T=g.s<0,v){if(v.c?!v.c[0]:!v.s)return new b(NaN);N=!T&&k.isInteger()&&v.isInteger(),N&&(k=k.mod(v))}else{if(g.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||x&&k.c[1]>=24e7:k.c[0]<8e13||x&&k.c[0]<=9999975e7)))return $=k.s<0&&ko(g)?-0:0,k.e>-1&&($=1/$),new b(T?1/$:$);h&&($=ti(h/ne+2))}for(x?(P=new b(.5),T&&(g.s=1),C=ko(g)):(I=Math.abs(+j(g)),C=I%2),y=new b(s);;){if(C){if(y=y.times(k),!y.c)break;$?y.c.length>$&&(y.c.length=$):N&&(y=y.mod(v))}if(I){if(I=Ye(I/2),I===0)break;C=I%2}else if(g=g.times(P),D(g,g.e+1,1),g.e>14)C=ko(g);else{if(I=+j(g),I===0)break;C=I%2}k=k.times(k),$?k.c&&k.c.length>$&&(k.c.length=$):N&&(k=k.mod(v))}return N?y:(T&&(y=s.div(y)),v?y.mod(v):$?D(y,h,c,S):y)},o.integerValue=function(g){var v=new b(this);return g==null?g=c:me(g,0,8),D(v,v.e+1,g)},o.isEqualTo=o.eq=function(g,v){return wn(this,new b(g,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,v){return wn(this,new b(g,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,v){return(v=wn(this,new b(g,v)))===1||v===0},o.isInteger=function(){return!!this.c&&Xe(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(g,v){return wn(this,new b(g,v))<0},o.isLessThanOrEqualTo=o.lte=function(g,v){return(v=wn(this,new b(g,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(g,v){var P,N,I,$,S=this,x=S.s;if(g=new b(g,v),v=g.s,!x||!v)return new b(NaN);if(x!=v)return g.s=-v,S.plus(g);var T=S.e/ne,C=g.e/ne,y=S.c,k=g.c;if(!T||!C){if(!y||!k)return y?(g.s=-v,g):new b(k?S:NaN);if(!y[0]||!k[0])return k[0]?(g.s=-v,g):new b(y[0]?S:c==3?-0:0)}if(T=Xe(T),C=Xe(C),y=y.slice(),x=T-C){for(($=x<0)?(x=-x,I=y):(C=T,I=k),I.reverse(),v=x;v--;I.push(0));I.reverse()}else for(N=($=(x=y.length)<(v=k.length))?x:v,x=v=0;v<N;v++)if(y[v]!=k[v]){$=y[v]<k[v];break}if($&&(I=y,y=k,k=I,g.s=-g.s),v=(N=k.length)-(P=y.length),v>0)for(;v--;y[P++]=0);for(v=lt-1;N>x;){if(y[--N]<k[N]){for(P=N;P&&!y[--P];y[P]=v);--y[P],y[N]+=lt}y[N]-=k[N]}for(;y[0]==0;y.splice(0,1),--C);return y[0]?R(g,y,C):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,v){var P,N,I=this;return g=new b(g,v),!I.c||!g.s||g.c&&!g.c[0]?new b(NaN):!g.c||I.c&&!I.c[0]?new b(I):(p==9?(N=g.s,g.s=1,P=t(I,g,0,3),g.s=N,P.s*=N):P=t(I,g,0,p),g=I.minus(P.times(g)),!g.c[0]&&p==1&&(g.s=I.s),g)},o.multipliedBy=o.times=function(g,v){var P,N,I,$,S,x,T,C,y,k,F,_,z,H,K,W=this,Z=W.c,q=(g=new b(g,v)).c;if(!Z||!q||!Z[0]||!q[0])return!W.s||!g.s||Z&&!Z[0]&&!q||q&&!q[0]&&!Z?g.c=g.e=g.s=null:(g.s*=W.s,!Z||!q?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(N=Xe(W.e/ne)+Xe(g.e/ne),g.s*=W.s,T=Z.length,k=q.length,T<k&&(z=Z,Z=q,q=z,I=T,T=k,k=I),I=T+k,z=[];I--;z.push(0));for(H=lt,K=an,I=k;--I>=0;){for(P=0,F=q[I]%K,_=q[I]/K|0,S=T,$=I+S;$>I;)C=Z[--S]%K,y=Z[S]/K|0,x=_*C+y*F,C=F*C+x%K*K+z[$]+P,P=(C/H|0)+(x/K|0)+_*y,z[$--]=C%H;z[$]=P}return P?++N:z.splice(0,1),R(g,z,N)},o.negated=function(){var g=new b(this);return g.s=-g.s||null,g},o.plus=function(g,v){var P,N=this,I=N.s;if(g=new b(g,v),v=g.s,!I||!v)return new b(NaN);if(I!=v)return g.s=-v,N.minus(g);var $=N.e/ne,S=g.e/ne,x=N.c,T=g.c;if(!$||!S){if(!x||!T)return new b(I/0);if(!x[0]||!T[0])return T[0]?g:new b(x[0]?N:I*0)}if($=Xe($),S=Xe(S),x=x.slice(),I=$-S){for(I>0?(S=$,P=T):(I=-I,P=x),P.reverse();I--;P.push(0));P.reverse()}for(I=x.length,v=T.length,I-v<0&&(P=T,T=x,x=P,v=I),I=0;v;)I=(x[--v]=x[v]+T[v]+I)/lt|0,x[v]=lt===x[v]?0:x[v]%lt;return I&&(x=[I].concat(x),++S),R(g,x,S)},o.precision=o.sd=function(g,v){var P,N,I,$=this;if(g!=null&&g!==!!g)return me(g,1,Ae),v==null?v=c:me(v,0,8),D(new b($),g,v);if(!(P=$.c))return null;if(I=P.length-1,N=I*ne+1,I=P[I]){for(;I%10==0;I/=10,N--);for(I=P[0];I>=10;I/=10,N++);}return g&&$.e+1>N&&(N=$.e+1),N},o.shiftedBy=function(g){return me(g,-ni,ni),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,v,P,N,I,$=this,S=$.c,x=$.s,T=$.e,C=i+4,y=new b("0.5");if(x!==1||!S||!S[0])return new b(!x||x<0&&(!S||S[0])?NaN:S?$:1/0);if(x=Math.sqrt(+j($)),x==0||x==1/0?(v=Qe(S),(v.length+T)%2==0&&(v+="0"),x=Math.sqrt(+v),T=Xe((T+1)/2)-(T<0||T%2),x==1/0?v="5e"+T:(v=x.toExponential(),v=v.slice(0,v.indexOf("e")+1)+T),P=new b(v)):P=new b(x+""),P.c[0]){for(T=P.e,x=T+C,x<3&&(x=0);;)if(I=P,P=y.times(I.plus(t($,I,C,1))),Qe(I.c).slice(0,x)===(v=Qe(P.c)).slice(0,x))if(P.e<T&&--x,v=v.slice(x-3,x+1),v=="9999"||!N&&v=="4999"){if(!N&&(D(I,I.e+i+2,0),I.times(I).eq($))){P=I;break}C+=4,x+=4,N=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(D(P,P.e+i+2,1),g=!P.times(P).eq($));break}}return D(P,P.e+i+1,c,g)},o.toExponential=function(g,v){return g!=null&&(me(g,0,Ae),g++),A(this,g,v,1)},o.toFixed=function(g,v){return g!=null&&(me(g,0,Ae),g=g+this.e+1),A(this,g,v)},o.toFormat=function(g,v,P){var N,I=this;if(P==null)g!=null&&v&&typeof v=="object"?(P=v,v=null):g&&typeof g=="object"?(P=g,g=v=null):P=m;else if(typeof P!="object")throw Error(Fe+"Argument not an object: "+P);if(N=I.toFixed(g,v),I.c){var $,S=N.split("."),x=+P.groupSize,T=+P.secondaryGroupSize,C=P.groupSeparator||"",y=S[0],k=S[1],F=I.s<0,_=F?y.slice(1):y,z=_.length;if(T&&($=x,x=T,T=$,z-=$),x>0&&z>0){for($=z%x||x,y=_.substr(0,$);$<z;$+=x)y+=C+_.substr($,x);T>0&&(y+=C+_.slice($)),F&&(y="-"+y)}N=k?y+(P.decimalSeparator||"")+((T=+P.fractionGroupSize)?k.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(P.fractionGroupSeparator||"")):k):y}return(P.prefix||"")+N+(P.suffix||"")},o.toFraction=function(g){var v,P,N,I,$,S,x,T,C,y,k,F,_=this,z=_.c;if(g!=null&&(x=new b(g),!x.isInteger()&&(x.c||x.s!==1)||x.lt(s)))throw Error(Fe+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+j(x));if(!z)return new b(_);for(v=new b(s),C=P=new b(s),N=T=new b(s),F=Qe(z),$=v.e=F.length-_.e-1,v.c[0]=ri[(S=$%ne)<0?ne+S:S],g=!g||x.comparedTo(v)>0?$>0?v:C:x,S=f,f=1/0,x=new b(F),T.c[0]=0;y=t(x,v,0,1),I=P.plus(y.times(N)),I.comparedTo(g)!=1;)P=N,N=I,C=T.plus(y.times(I=C)),T=I,v=x.minus(y.times(I=v)),x=I;return I=t(g.minus(P),N,0,1),T=T.plus(I.times(C)),P=P.plus(I.times(N)),T.s=C.s=_.s,$=$*2,k=t(C,N,$,c).minus(_).abs().comparedTo(t(T,P,$,c).minus(_).abs())<1?[C,N]:[T,P],f=S,k},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,v){return g!=null&&me(g,1,Ae),A(this,g,v,2)},o.toString=function(g){var v,P=this,N=P.s,I=P.e;return I===null?N?(v="Infinity",N<0&&(v="-"+v)):v="NaN":(g==null?v=I<=a||I>=u?Mo(Qe(P.c),I):jt(Qe(P.c),I,"0"):g===10&&O?(P=D(new b(P),i+I+1,c),v=jt(Qe(P.c),P.e,"0")):(me(g,2,w.length,"Base"),v=n(jt(Qe(P.c),I,"0"),10,g,N,!0)),N<0&&P.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return j(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&b.set(e),b}function Xe(e){var t=e|0;return e>0||e===t?t:t-1}function Qe(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ne-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function wn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,u=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==u,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>u^n?1:-1;for(c=(a=o.length)<(u=s.length)?a:u,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==u?0:a>u^n?1:-1}function me(e,t,n,r){if(e<t||e>n||e!==Ye(e))throw Error(Fe+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function ko(e){var t=e.c.length-1;return Xe(e.e/ne)==t&&e.c[t]%2!=0}function Mo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function jt(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=fu();const lm=(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 c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},_t=()=>{const{translations:e,currentLocale:t}=uu();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const l of c)if(a&&typeof a=="object"&&l in a)a=a[l];else return s;let u=typeof a=="string"?a:s;return i&&typeof u=="string"&&Object.keys(i).forEach(l=>{const f=`{{${l}}}`;u=u.replace(new RegExp(f,"g"),String(i[l]))}),u}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},fm=()=>({openDeposit:E.useCallback(t=>{},[])}),dm=()=>({openWithdraw:E.useCallback(t=>{},[])}),vn="MPC",oi="EVM";/**
30
+ <%s key={someKey} {...props} />`,au,Gn,GP,Gn),tm[Gn+au]=!0}}return R===r?UP(Ae):_P(Ae),Ae}}function zP(R,G,Y){return nm(R,G,Y,!0)}function HP(R,G,Y){return nm(R,G,Y,!1)}var WP=HP,VP=zP;Or.Fragment=r,Or.jsx=WP,Or.jsxs=VP}()),Or}process.env.NODE_ENV==="production"?ni.exports=sm():ni.exports=im();var M=ni.exports;const am={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
+ 充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不合法",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。"}},cm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",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
+ If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,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",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"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",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",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Invalid receiver address",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.",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."}},um={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
33
+ 入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"無効な受け取りアドレス",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"}},lm={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
34
+ Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:"Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.",layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Неверный адрес получателя",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."}},fm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
35
+ 充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不合法",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"}},ri=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],pu={"en-US":cm,"ja-JP":um,"ru-RU":lm,"zh-CN":am,"zh-TW":fm},Bo="en-US",dm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},pm=e=>ri.includes(e)?pu[e]:pu[Bo],hm=e=>ri.includes(e),hu=x.createContext(null),mm=({config:e,children:t})=>{const n=x.useMemo(()=>{const r=e.locale||Bo,o=hm(r)?r:Bo,s=pm(o);return{...e,currentLocale:o,translations:s}},[e]);return M.jsx(hu.Provider,{value:n,children:t})},mu=()=>{const e=x.useContext(hu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var gm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,oi=Math.ceil,Qe=Math.floor,je="[BigNumber Error] ",gu=je+"Number primitive has more than 15 significant digits: ",dt=1e14,ie=14,si=9007199254740991,ii=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],cn=1e7,Oe=1e9;function bu(e){var t,n,r,o=y.prototype={constructor:y,toString:null,valueOf:null},s=new y(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,d=!1,p=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},v="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function y(g,w){var A,I,N,P,S,E,C,O,b=this;if(!(b instanceof y))return new y(g,w);if(w==null){if(g&&g._isBigNumber===!0){b.s=g.s,!g.c||g.e>f?b.c=b.e=null:g.e<l?b.c=[b.e=0]:(b.e=g.e,b.c=g.c.slice());return}if((E=typeof g=="number")&&g*0==0){if(b.s=1/g<0?(g=-g,-1):1,g===~~g){for(P=0,S=g;S>=10;S/=10,P++);P>f?b.c=b.e=null:(b.e=P,b.c=[g]);return}O=String(g)}else{if(!gm.test(O=String(g)))return r(b,O,E);b.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(P=O.indexOf("."))>-1&&(O=O.replace(".","")),(S=O.search(/e/i))>0?(P<0&&(P=S),P+=+O.slice(S+1),O=O.substring(0,S)):P<0&&(P=O.length)}else{if(we(w,2,v.length,"Base"),w==10&&$)return b=new y(g),_(b,i+b.e+1,c);if(O=String(g),E=typeof g=="number"){if(g*0!=0)return r(b,O,E,w);if(b.s=1/g<0?(O=O.slice(1),-1):1,y.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(gu+g)}else b.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(A=v.slice(0,w),P=S=0,C=O.length;S<C;S++)if(A.indexOf(I=O.charAt(S))<0){if(I=="."){if(S>P){P=C;continue}}else if(!N&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){N=!0,S=-1,P=0;continue}return r(b,String(g),E,w)}E=!1,O=n(O,w,10,b.s),(P=O.indexOf("."))>-1?O=O.replace(".",""):P=O.length}for(S=0;O.charCodeAt(S)===48;S++);for(C=O.length;O.charCodeAt(--C)===48;);if(O=O.slice(S,++C)){if(C-=S,E&&y.DEBUG&&C>15&&(g>si||g!==Qe(g)))throw Error(gu+b.s*g);if((P=P-S-1)>f)b.c=b.e=null;else if(P<l)b.c=[b.e=0];else{if(b.e=P,b.c=[],S=(P+1)%ie,P<0&&(S+=ie),S<C){for(S&&b.c.push(+O.slice(0,S)),C-=ie;S<C;)b.c.push(+O.slice(S,S+=ie));S=ie-(O=O.slice(S)).length}else S-=C;for(;S--;O+="0");b.c.push(+O)}}else b.c=[b.e=0]}y.clone=bu,y.ROUND_UP=0,y.ROUND_DOWN=1,y.ROUND_CEIL=2,y.ROUND_FLOOR=3,y.ROUND_HALF_UP=4,y.ROUND_HALF_DOWN=5,y.ROUND_HALF_EVEN=6,y.ROUND_HALF_CEIL=7,y.ROUND_HALF_FLOOR=8,y.EUCLID=9,y.config=y.set=function(g){var w,A;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(w="DECIMAL_PLACES")&&(A=g[w],we(A,0,Oe,w),i=A),g.hasOwnProperty(w="ROUNDING_MODE")&&(A=g[w],we(A,0,8,w),c=A),g.hasOwnProperty(w="EXPONENTIAL_AT")&&(A=g[w],A&&A.pop?(we(A[0],-Oe,0,w),we(A[1],0,Oe,w),a=A[0],u=A[1]):(we(A,-Oe,Oe,w),a=-(u=A<0?-A:A))),g.hasOwnProperty(w="RANGE"))if(A=g[w],A&&A.pop)we(A[0],-Oe,-1,w),we(A[1],1,Oe,w),l=A[0],f=A[1];else if(we(A,-Oe,Oe,w),A)l=-(f=A<0?-A:A);else throw Error(je+w+" cannot be zero: "+A);if(g.hasOwnProperty(w="CRYPTO"))if(A=g[w],A===!!A)if(A)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))d=A;else throw d=!A,Error(je+"crypto unavailable");else d=A;else throw Error(je+w+" not true or false: "+A);if(g.hasOwnProperty(w="MODULO_MODE")&&(A=g[w],we(A,0,9,w),p=A),g.hasOwnProperty(w="POW_PRECISION")&&(A=g[w],we(A,0,Oe,w),h=A),g.hasOwnProperty(w="FORMAT"))if(A=g[w],typeof A=="object")m=A;else throw Error(je+w+" not an object: "+A);if(g.hasOwnProperty(w="ALPHABET"))if(A=g[w],typeof A=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(A))$=A.slice(0,10)=="0123456789",v=A;else throw Error(je+w+" invalid: "+A)}else throw Error(je+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,f],CRYPTO:d,MODULO_MODE:p,POW_PRECISION:h,FORMAT:m,ALPHABET:v}},y.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!y.DEBUG)return!0;var w,A,I=g.c,N=g.e,P=g.s;e:if({}.toString.call(I)=="[object Array]"){if((P===1||P===-1)&&N>=-Oe&&N<=Oe&&N===Qe(N)){if(I[0]===0){if(N===0&&I.length===1)return!0;break e}if(w=(N+1)%ie,w<1&&(w+=ie),String(I[0]).length==w){for(w=0;w<I.length;w++)if(A=I[w],A<0||A>=dt||A!==Qe(A))break e;if(A!==0)return!0}}}else if(I===null&&N===null&&(P===null||P===1||P===-1))return!0;throw Error(je+"Invalid BigNumber: "+g)},y.maximum=y.max=function(){return B(arguments,-1)},y.minimum=y.min=function(){return B(arguments,1)},y.random=function(){var g=9007199254740992,w=Math.random()*g&2097151?function(){return Qe(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var I,N,P,S,E,C=0,O=[],b=new y(s);if(A==null?A=i:we(A,0,Oe),S=oi(A/ie),d)if(crypto.getRandomValues){for(I=crypto.getRandomValues(new Uint32Array(S*=2));C<S;)E=I[C]*131072+(I[C+1]>>>11),E>=9e15?(N=crypto.getRandomValues(new Uint32Array(2)),I[C]=N[0],I[C+1]=N[1]):(O.push(E%1e14),C+=2);C=S/2}else if(crypto.randomBytes){for(I=crypto.randomBytes(S*=7);C<S;)E=(I[C]&31)*281474976710656+I[C+1]*1099511627776+I[C+2]*4294967296+I[C+3]*16777216+(I[C+4]<<16)+(I[C+5]<<8)+I[C+6],E>=9e15?crypto.randomBytes(7).copy(I,C):(O.push(E%1e14),C+=7);C=S/7}else throw d=!1,Error(je+"crypto unavailable");if(!d)for(;C<S;)E=w(),E<9e15&&(O[C++]=E%1e14);for(S=O[--C],A%=ie,S&&A&&(E=ii[ie-A],O[C]=Qe(S/E)*E);O[C]===0;O.pop(),C--);if(C<0)O=[P=0];else{for(P=-1;O[0]===0;O.splice(0,1),P-=ie);for(C=1,E=O[0];E>=10;E/=10,C++);C<ie&&(P-=ie-C)}return b.e=P,b.c=O,b}}(),y.sum=function(){for(var g=1,w=arguments,A=new y(w[0]);g<w.length;)A=A.plus(w[g++]);return A},n=function(){var g="0123456789";function w(A,I,N,P){for(var S,E=[0],C,O=0,b=A.length;O<b;){for(C=E.length;C--;E[C]*=I);for(E[0]+=P.indexOf(A.charAt(O++)),S=0;S<E.length;S++)E[S]>N-1&&(E[S+1]==null&&(E[S+1]=0),E[S+1]+=E[S]/N|0,E[S]%=N)}return E.reverse()}return function(A,I,N,P,S){var E,C,O,b,k,D,j,z,W=A.indexOf("."),K=i,H=c;for(W>=0&&(b=h,h=0,A=A.replace(".",""),z=new y(I),D=z.pow(A.length-W),h=b,z.c=w(_t(et(D.c),D.e,"0"),10,N,g),z.e=z.c.length),j=w(A,I,N,S?(E=v,g):(E=g,v)),O=b=j.length;j[--b]==0;j.pop());if(!j[0])return E.charAt(0);if(W<0?--O:(D.c=j,D.e=O,D.s=P,D=t(D,z,K,H,N),j=D.c,k=D.r,O=D.e),C=O+K+1,W=j[C],b=N/2,k=k||C<0||j[C+1]!=null,k=H<4?(W!=null||k)&&(H==0||H==(D.s<0?3:2)):W>b||W==b&&(H==4||k||H==6&&j[C-1]&1||H==(D.s<0?8:7)),C<1||!j[0])A=k?_t(E.charAt(1),-K,E.charAt(0)):E.charAt(0);else{if(j.length=C,k)for(--N;++j[--C]>N;)j[C]=0,C||(++O,j=[1].concat(j));for(b=j.length;!j[--b];);for(W=0,A="";W<=b;A+=E.charAt(j[W++]));A=_t(A,O,E.charAt(0))}return A}}(),t=function(){function g(I,N,P){var S,E,C,O,b=0,k=I.length,D=N%cn,j=N/cn|0;for(I=I.slice();k--;)C=I[k]%cn,O=I[k]/cn|0,S=j*C+O*D,E=D*C+S%cn*cn+b,b=(E/P|0)+(S/cn|0)+j*O,I[k]=E%P;return b&&(I=[b].concat(I)),I}function w(I,N,P,S){var E,C;if(P!=S)C=P>S?1:-1;else for(E=C=0;E<P;E++)if(I[E]!=N[E]){C=I[E]>N[E]?1:-1;break}return C}function A(I,N,P,S){for(var E=0;P--;)I[P]-=E,E=I[P]<N[P]?1:0,I[P]=E*S+I[P]-N[P];for(;!I[0]&&I.length>1;I.splice(0,1));}return function(I,N,P,S,E){var C,O,b,k,D,j,z,W,K,H,Z,q,J,te,pe,Ee,X,Q=I.s==N.s?1:-1,se=I.c,re=N.c;if(!se||!se[0]||!re||!re[0])return new y(!I.s||!N.s||(se?re&&se[0]==re[0]:!re)?NaN:se&&se[0]==0||!re?Q*0:Q/0);for(W=new y(Q),K=W.c=[],O=I.e-N.e,Q=P+O+1,E||(E=dt,O=Je(I.e/ie)-Je(N.e/ie),Q=Q/ie|0),b=0;re[b]==(se[b]||0);b++);if(re[b]>(se[b]||0)&&O--,Q<0)K.push(1),k=!0;else{for(te=se.length,Ee=re.length,b=0,Q+=2,D=Qe(E/(re[0]+1)),D>1&&(re=g(re,D,E),se=g(se,D,E),Ee=re.length,te=se.length),J=Ee,H=se.slice(0,Ee),Z=H.length;Z<Ee;H[Z++]=0);X=re.slice(),X=[0].concat(X),pe=re[0],re[1]>=E/2&&pe++;do{if(D=0,C=w(re,H,Ee,Z),C<0){if(q=H[0],Ee!=Z&&(q=q*E+(H[1]||0)),D=Qe(q/pe),D>1)for(D>=E&&(D=E-1),j=g(re,D,E),z=j.length,Z=H.length;w(j,H,z,Z)==1;)D--,A(j,Ee<z?X:re,z,E),z=j.length,C=1;else D==0&&(C=D=1),j=re.slice(),z=j.length;if(z<Z&&(j=[0].concat(j)),A(H,j,Z,E),Z=H.length,C==-1)for(;w(re,H,Ee,Z)<1;)D++,A(H,Ee<Z?X:re,Z,E),Z=H.length}else C===0&&(D++,H=[0]);K[b++]=D,H[0]?H[Z++]=se[J]||0:(H=[se[J]],Z=1)}while((J++<te||H[0]!=null)&&Q--);k=H[0]!=null,K[0]||K.splice(0,1)}if(E==dt){for(b=1,Q=K[0];Q>=10;Q/=10,b++);_(W,P+(W.e=b+O*ie-1)+1,S,k)}else W.e=O,W.r=+k;return W}}();function T(g,w,A,I){var N,P,S,E,C;if(A==null?A=c:we(A,0,8),!g.c)return g.toString();if(N=g.c[0],S=g.e,w==null)C=et(g.c),C=I==1||I==2&&(S<=a||S>=u)?Lo(C,S):_t(C,S,"0");else if(g=_(new y(g),w,A),P=g.e,C=et(g.c),E=C.length,I==1||I==2&&(w<=P||P<=a)){for(;E<w;C+="0",E++);C=Lo(C,P)}else if(w-=S+(I===2&&P>S),C=_t(C,P,"0"),P+1>E){if(--w>0)for(C+=".";w--;C+="0");}else if(w+=P-E,w>0)for(P+1==E&&(C+=".");w--;C+="0");return g.s<0&&N?"-"+C:C}function B(g,w){for(var A,I,N=1,P=new y(g[0]);N<g.length;N++)I=new y(g[N]),(!I.s||(A=xn(P,I))===w||A===0&&P.s===w)&&(P=I);return P}function L(g,w,A){for(var I=1,N=w.length;!w[--N];w.pop());for(N=w[0];N>=10;N/=10,I++);return(A=I+A*ie-1)>f?g.c=g.e=null:A<l?g.c=[g.e=0]:(g.e=A,g.c=w),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,A=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(P,S,E,C){var O,b=E?S:S.replace(N,"");if(I.test(b))P.s=isNaN(b)?null:b<0?-1:1;else{if(!E&&(b=b.replace(g,function(k,D,j){return O=(j=j.toLowerCase())=="x"?16:j=="b"?2:8,!C||C==O?D:k}),C&&(O=C,b=b.replace(w,"$1").replace(A,"0.$1")),S!=b))return new y(b,O);if(y.DEBUG)throw Error(je+"Not a"+(C?" base "+C:"")+" number: "+S);P.s=null}P.c=P.e=null}}();function _(g,w,A,I){var N,P,S,E,C,O,b,k=g.c,D=ii;if(k){e:{for(N=1,E=k[0];E>=10;E/=10,N++);if(P=w-N,P<0)P+=ie,S=w,C=k[O=0],b=Qe(C/D[N-S-1]%10);else if(O=oi((P+1)/ie),O>=k.length)if(I){for(;k.length<=O;k.push(0));C=b=0,N=1,P%=ie,S=P-ie+1}else break e;else{for(C=E=k[O],N=1;E>=10;E/=10,N++);P%=ie,S=P-ie+N,b=S<0?0:Qe(C/D[N-S-1]%10)}if(I=I||w<0||k[O+1]!=null||(S<0?C:C%D[N-S-1]),I=A<4?(b||I)&&(A==0||A==(g.s<0?3:2)):b>5||b==5&&(A==4||I||A==6&&(P>0?S>0?C/D[N-S]:0:k[O-1])%10&1||A==(g.s<0?8:7)),w<1||!k[0])return k.length=0,I?(w-=g.e+1,k[0]=D[(ie-w%ie)%ie],g.e=-w||0):k[0]=g.e=0,g;if(P==0?(k.length=O,E=1,O--):(k.length=O+1,E=D[ie-P],k[O]=S>0?Qe(C/D[N-S]%D[S])*E:0),I)for(;;)if(O==0){for(P=1,S=k[0];S>=10;S/=10,P++);for(S=k[0]+=E,E=1;S>=10;S/=10,E++);P!=E&&(g.e++,k[0]==dt&&(k[0]=1));break}else{if(k[O]+=E,k[O]!=dt)break;k[O--]=0,E=1}for(P=k.length;k[--P]===0;k.pop());}g.e>f?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function F(g){var w,A=g.e;return A===null?g.toString():(w=et(g.c),w=A<=a||A>=u?Lo(w,A):_t(w,A,"0"),g.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var g=new y(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,w){return xn(this,new y(g,w))},o.decimalPlaces=o.dp=function(g,w){var A,I,N,P=this;if(g!=null)return we(g,0,Oe),w==null?w=c:we(w,0,8),_(new y(P),g+P.e+1,w);if(!(A=P.c))return null;if(I=((N=A.length-1)-Je(this.e/ie))*ie,N=A[N])for(;N%10==0;N/=10,I--);return I<0&&(I=0),I},o.dividedBy=o.div=function(g,w){return t(this,new y(g,w),i,c)},o.dividedToIntegerBy=o.idiv=function(g,w){return t(this,new y(g,w),0,1)},o.exponentiatedBy=o.pow=function(g,w){var A,I,N,P,S,E,C,O,b,k=this;if(g=new y(g),g.c&&!g.isInteger())throw Error(je+"Exponent not an integer: "+F(g));if(w!=null&&(w=new y(w)),E=g.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!g.c||!g.c[0])return b=new y(Math.pow(+F(k),E?g.s*(2-Mo(g)):+F(g))),w?b.mod(w):b;if(C=g.s<0,w){if(w.c?!w.c[0]:!w.s)return new y(NaN);I=!C&&k.isInteger()&&w.isInteger(),I&&(k=k.mod(w))}else{if(g.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||E&&k.c[1]>=24e7:k.c[0]<8e13||E&&k.c[0]<=9999975e7)))return P=k.s<0&&Mo(g)?-0:0,k.e>-1&&(P=1/P),new y(C?1/P:P);h&&(P=oi(h/ie+2))}for(E?(A=new y(.5),C&&(g.s=1),O=Mo(g)):(N=Math.abs(+F(g)),O=N%2),b=new y(s);;){if(O){if(b=b.times(k),!b.c)break;P?b.c.length>P&&(b.c.length=P):I&&(b=b.mod(w))}if(N){if(N=Qe(N/2),N===0)break;O=N%2}else if(g=g.times(A),_(g,g.e+1,1),g.e>14)O=Mo(g);else{if(N=+F(g),N===0)break;O=N%2}k=k.times(k),P?k.c&&k.c.length>P&&(k.c.length=P):I&&(k=k.mod(w))}return I?b:(C&&(b=s.div(b)),w?b.mod(w):P?_(b,h,c,S):b)},o.integerValue=function(g){var w=new y(this);return g==null?g=c:we(g,0,8),_(w,w.e+1,g)},o.isEqualTo=o.eq=function(g,w){return xn(this,new y(g,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,w){return xn(this,new y(g,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,w){return(w=xn(this,new y(g,w)))===1||w===0},o.isInteger=function(){return!!this.c&&Je(this.e/ie)>this.c.length-2},o.isLessThan=o.lt=function(g,w){return xn(this,new y(g,w))<0},o.isLessThanOrEqualTo=o.lte=function(g,w){return(w=xn(this,new y(g,w)))===-1||w===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(g,w){var A,I,N,P,S=this,E=S.s;if(g=new y(g,w),w=g.s,!E||!w)return new y(NaN);if(E!=w)return g.s=-w,S.plus(g);var C=S.e/ie,O=g.e/ie,b=S.c,k=g.c;if(!C||!O){if(!b||!k)return b?(g.s=-w,g):new y(k?S:NaN);if(!b[0]||!k[0])return k[0]?(g.s=-w,g):new y(b[0]?S:c==3?-0:0)}if(C=Je(C),O=Je(O),b=b.slice(),E=C-O){for((P=E<0)?(E=-E,N=b):(O=C,N=k),N.reverse(),w=E;w--;N.push(0));N.reverse()}else for(I=(P=(E=b.length)<(w=k.length))?E:w,E=w=0;w<I;w++)if(b[w]!=k[w]){P=b[w]<k[w];break}if(P&&(N=b,b=k,k=N,g.s=-g.s),w=(I=k.length)-(A=b.length),w>0)for(;w--;b[A++]=0);for(w=dt-1;I>E;){if(b[--I]<k[I]){for(A=I;A&&!b[--A];b[A]=w);--b[A],b[I]+=dt}b[I]-=k[I]}for(;b[0]==0;b.splice(0,1),--O);return b[0]?L(g,b,O):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,w){var A,I,N=this;return g=new y(g,w),!N.c||!g.s||g.c&&!g.c[0]?new y(NaN):!g.c||N.c&&!N.c[0]?new y(N):(p==9?(I=g.s,g.s=1,A=t(N,g,0,3),g.s=I,A.s*=I):A=t(N,g,0,p),g=N.minus(A.times(g)),!g.c[0]&&p==1&&(g.s=N.s),g)},o.multipliedBy=o.times=function(g,w){var A,I,N,P,S,E,C,O,b,k,D,j,z,W,K,H=this,Z=H.c,q=(g=new y(g,w)).c;if(!Z||!q||!Z[0]||!q[0])return!H.s||!g.s||Z&&!Z[0]&&!q||q&&!q[0]&&!Z?g.c=g.e=g.s=null:(g.s*=H.s,!Z||!q?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(I=Je(H.e/ie)+Je(g.e/ie),g.s*=H.s,C=Z.length,k=q.length,C<k&&(z=Z,Z=q,q=z,N=C,C=k,k=N),N=C+k,z=[];N--;z.push(0));for(W=dt,K=cn,N=k;--N>=0;){for(A=0,D=q[N]%K,j=q[N]/K|0,S=C,P=N+S;P>N;)O=Z[--S]%K,b=Z[S]/K|0,E=j*O+b*D,O=D*O+E%K*K+z[P]+A,A=(O/W|0)+(E/K|0)+j*b,z[P--]=O%W;z[P]=A}return A?++I:z.splice(0,1),L(g,z,I)},o.negated=function(){var g=new y(this);return g.s=-g.s||null,g},o.plus=function(g,w){var A,I=this,N=I.s;if(g=new y(g,w),w=g.s,!N||!w)return new y(NaN);if(N!=w)return g.s=-w,I.minus(g);var P=I.e/ie,S=g.e/ie,E=I.c,C=g.c;if(!P||!S){if(!E||!C)return new y(N/0);if(!E[0]||!C[0])return C[0]?g:new y(E[0]?I:N*0)}if(P=Je(P),S=Je(S),E=E.slice(),N=P-S){for(N>0?(S=P,A=C):(N=-N,A=E),A.reverse();N--;A.push(0));A.reverse()}for(N=E.length,w=C.length,N-w<0&&(A=C,C=E,E=A,w=N),N=0;w;)N=(E[--w]=E[w]+C[w]+N)/dt|0,E[w]=dt===E[w]?0:E[w]%dt;return N&&(E=[N].concat(E),++S),L(g,E,S)},o.precision=o.sd=function(g,w){var A,I,N,P=this;if(g!=null&&g!==!!g)return we(g,1,Oe),w==null?w=c:we(w,0,8),_(new y(P),g,w);if(!(A=P.c))return null;if(N=A.length-1,I=N*ie+1,N=A[N]){for(;N%10==0;N/=10,I--);for(N=A[0];N>=10;N/=10,I++);}return g&&P.e+1>I&&(I=P.e+1),I},o.shiftedBy=function(g){return we(g,-si,si),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,w,A,I,N,P=this,S=P.c,E=P.s,C=P.e,O=i+4,b=new y("0.5");if(E!==1||!S||!S[0])return new y(!E||E<0&&(!S||S[0])?NaN:S?P:1/0);if(E=Math.sqrt(+F(P)),E==0||E==1/0?(w=et(S),(w.length+C)%2==0&&(w+="0"),E=Math.sqrt(+w),C=Je((C+1)/2)-(C<0||C%2),E==1/0?w="5e"+C:(w=E.toExponential(),w=w.slice(0,w.indexOf("e")+1)+C),A=new y(w)):A=new y(E+""),A.c[0]){for(C=A.e,E=C+O,E<3&&(E=0);;)if(N=A,A=b.times(N.plus(t(P,N,O,1))),et(N.c).slice(0,E)===(w=et(A.c)).slice(0,E))if(A.e<C&&--E,w=w.slice(E-3,E+1),w=="9999"||!I&&w=="4999"){if(!I&&(_(N,N.e+i+2,0),N.times(N).eq(P))){A=N;break}O+=4,E+=4,I=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(_(A,A.e+i+2,1),g=!A.times(A).eq(P));break}}return _(A,A.e+i+1,c,g)},o.toExponential=function(g,w){return g!=null&&(we(g,0,Oe),g++),T(this,g,w,1)},o.toFixed=function(g,w){return g!=null&&(we(g,0,Oe),g=g+this.e+1),T(this,g,w)},o.toFormat=function(g,w,A){var I,N=this;if(A==null)g!=null&&w&&typeof w=="object"?(A=w,w=null):g&&typeof g=="object"?(A=g,g=w=null):A=m;else if(typeof A!="object")throw Error(je+"Argument not an object: "+A);if(I=N.toFixed(g,w),N.c){var P,S=I.split("."),E=+A.groupSize,C=+A.secondaryGroupSize,O=A.groupSeparator||"",b=S[0],k=S[1],D=N.s<0,j=D?b.slice(1):b,z=j.length;if(C&&(P=E,E=C,C=P,z-=P),E>0&&z>0){for(P=z%E||E,b=j.substr(0,P);P<z;P+=E)b+=O+j.substr(P,E);C>0&&(b+=O+j.slice(P)),D&&(b="-"+b)}I=k?b+(A.decimalSeparator||"")+((C=+A.fractionGroupSize)?k.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):k):b}return(A.prefix||"")+I+(A.suffix||"")},o.toFraction=function(g){var w,A,I,N,P,S,E,C,O,b,k,D,j=this,z=j.c;if(g!=null&&(E=new y(g),!E.isInteger()&&(E.c||E.s!==1)||E.lt(s)))throw Error(je+"Argument "+(E.isInteger()?"out of range: ":"not an integer: ")+F(E));if(!z)return new y(j);for(w=new y(s),O=A=new y(s),I=C=new y(s),D=et(z),P=w.e=D.length-j.e-1,w.c[0]=ii[(S=P%ie)<0?ie+S:S],g=!g||E.comparedTo(w)>0?P>0?w:O:E,S=f,f=1/0,E=new y(D),C.c[0]=0;b=t(E,w,0,1),N=A.plus(b.times(I)),N.comparedTo(g)!=1;)A=I,I=N,O=C.plus(b.times(N=O)),C=N,w=E.minus(b.times(N=w)),E=N;return N=t(g.minus(A),I,0,1),C=C.plus(N.times(O)),A=A.plus(N.times(I)),C.s=O.s=j.s,P=P*2,k=t(O,I,P,c).minus(j).abs().comparedTo(t(C,A,P,c).minus(j).abs())<1?[O,I]:[C,A],f=S,k},o.toNumber=function(){return+F(this)},o.toPrecision=function(g,w){return g!=null&&we(g,1,Oe),T(this,g,w,2)},o.toString=function(g){var w,A=this,I=A.s,N=A.e;return N===null?I?(w="Infinity",I<0&&(w="-"+w)):w="NaN":(g==null?w=N<=a||N>=u?Lo(et(A.c),N):_t(et(A.c),N,"0"):g===10&&$?(A=_(new y(A),i+N+1,c),w=_t(et(A.c),A.e,"0")):(we(g,2,v.length,"Base"),w=n(_t(et(A.c),N,"0"),10,g,I,!0)),I<0&&A.c[0]&&(w="-"+w)),w},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&&y.set(e),y}function Je(e){var t=e|0;return e>0||e===t?t:t-1}function et(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ie-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function xn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,u=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==u,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>u^n?1:-1;for(c=(a=o.length)<(u=s.length)?a:u,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==u?0:a>u^n?1:-1}function we(e,t,n,r){if(e<t||e>n||e!==Qe(e))throw Error(je+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Mo(e){var t=e.c.length-1;return Je(e.e/ie)==t&&e.c[t]%2!=0}function Lo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _t(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 $e=bu();const bm=(e,t=6)=>{try{const n=new $e(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,$e.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},Ut=()=>{const{translations:e,currentLocale:t}=mu();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const l of c)if(a&&typeof a=="object"&&l in a)a=a[l];else return s;let u=typeof a=="string"?a:s;return i&&typeof u=="string"&&Object.keys(i).forEach(l=>{const f=`{{${l}}}`;u=u.replace(new RegExp(f,"g"),String(i[l]))}),u}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},ym="1.0.8";let Ke=class cu extends Error{constructor(t,n={}){var i;const r=n.cause instanceof cu?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof cu&&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@${ym}`].join(`
36
+ `);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 zt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const yu=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,wu=/^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)?$/,vu=/^\(.+?\).*?$/,xu=/^tuple(?<array>(\[(\d*)\])*)$/;function ai(e){let t=e.type;if(xu.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+=ai(s),o<n-1&&(t+=", ")}const r=zt(xu,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,ai({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Ir(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=ai(o),r!==n-1&&(t+=", ")}return t}function Ro(e){var t;return e.type==="function"?`function ${e.name}(${Ir(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Ir(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Ir(e.inputs)})`:e.type==="error"?`error ${e.name}(${Ir(e.inputs)})`:e.type==="constructor"?`constructor(${Ir(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Eu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function wm(e){return Eu.test(e)}function vm(e){return zt(Eu,e)}const Su=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function xm(e){return Su.test(e)}function Em(e){return zt(Su,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 Sm(e){return Pu.test(e)}function Pm(e){return zt(Pu,e)}const Au=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function ci(e){return Au.test(e)}function Am(e){return zt(Au,e)}const $u=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function $m(e){return $u.test(e)}function Tm(e){return zt($u,e)}const Tu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Cm(e){return Tu.test(e)}function Om(e){return zt(Tu,e)}const Im=/^receive\(\) external payable$/;function Nm(e){return Im.test(e)}const km=new Set(["indexed"]),ui=new Set(["calldata","memory","storage"]);class Bm extends Ke{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 Mm extends Ke{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 Lm extends Ke{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 Rm extends Ke{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Dm extends Ke{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 Fm extends Ke{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 jm extends Ke{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 _m extends Ke{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 qn extends Ke{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Um extends Ke{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class zm extends Ke{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 Hm extends Ke{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 Wm extends Ke{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 Vm(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}const li=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 fi(e,t={}){if(Sm(e))return Gm(e,t);if(xm(e))return qm(e,t);if(wm(e))return Zm(e,t);if($m(e))return Km(e,t);if(Cm(e))return Ym(e);if(Nm(e))return{type:"receive",stateMutability:"payable"};throw new Um({signature:e})}function Gm(e,t={}){const n=Pm(e);if(!n)throw new qn({signature:e,type:"function"});const r=pt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(En(r[c],{modifiers:ui,structs:t,type:"function"}));const i=[];if(n.returns){const c=pt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(En(c[u],{modifiers:ui,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function qm(e,t={}){const n=Em(e);if(!n)throw new qn({signature:e,type:"event"});const r=pt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(En(r[i],{modifiers:km,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Zm(e,t={}){const n=vm(e);if(!n)throw new qn({signature:e,type:"error"});const r=pt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(En(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Km(e,t={}){const n=Tm(e);if(!n)throw new qn({signature:e,type:"constructor"});const r=pt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(En(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Ym(e){const t=Om(e);if(!t)throw new qn({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Xm=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Qm=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Jm=/^u?int$/;function En(e,t){var f,d;const n=Vm(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(li.has(n))return li.get(n);const r=vu.test(e),o=zt(r?Qm:Xm,e);if(!o)throw new Rm({param:e});if(o.name&&tg(o.name))throw new Dm({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,u={};if(r){a="tuple";const p=pt(o.type),h=[],m=p.length;for(let v=0;v<m;v++)h.push(En(p[v],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(Jm.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!Cu(a))throw new Lm({type:a});if(o.modifier){if(!((d=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&d.call(f,o.modifier)))throw new Fm({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(ui.has(o.modifier)&&!ng(a,!!o.array))throw new jm({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return li.set(n,l),l}function pt(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?pt(c,[...t,n.trim()]):pt(c,t,`${n}${i}`,r);case"(":return pt(c,t,`${n}${i}`,r+1);case")":return pt(c,t,`${n}${i}`,r-1);default:return pt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Wm({current:n,depth:r});return t.push(n.trim()),t}function Cu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||yu.test(e)||wu.test(e)}const eg=/^(?: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 tg(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||yu.test(e)||wu.test(e)||eg.test(e)}function ng(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Ou(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!ci(c))continue;const a=Am(c);if(!a)throw new qn({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],f=u.length;for(let d=0;d<f;d++){const h=u[d].trim();if(!h)continue;const m=En(h,{type:"struct"});l.push(m)}if(!l.length)throw new zm({signature:c});t[a.name]=l}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=Iu(a,t)}return r}const rg=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Iu(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(vu.test(i.type))r.push(i);else{const a=zt(rg,i.type);if(!(a!=null&&a.type))throw new _m({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Hm({type:l});r.push({...i,type:`tuple${u??""}`,components:Iu(t[l]??[],t,new Set([...n,l]))})}else if(Cu(l))r.push(i);else throw new Mm({type:l})}}return r}function Nu(e){const t=Ou(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];ci(s)||n.push(fi(s,t))}return n}function ku(e){let t;if(typeof e=="string")t=fi(e);else{const n=Ou(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!ci(s)){t=fi(s,n);break}}}if(!t)throw new Bm({signature:e});return t}function ne(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 ht(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new gg(e.type);return`${e.name}(${Do(e.inputs,{includeName:t})})`}function Do(e,{includeName:t=!1}={}){return e?e.map(n=>og(n,{includeName:t})).join(t?", ":","):""}function og(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Do(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function mt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function xe(e){return mt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Bu="2.34.0";let Nr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Bu}`},V=class uu extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof uu?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof uu&&n.cause.docsPath||n.docsPath,s=(c=Nr.getDocsUrl)==null?void 0:c.call(Nr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Nr.version?[`Version: ${Nr.version}`]:[]].join(`
37
+ `);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=Bu}walk(t){return Mu(this,t)}};function Mu(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Mu(e.cause,t):t?null:e}class sg extends V{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(`
38
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Lu extends V{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(`
39
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Ru extends V{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
40
+ `),{metaMessages:[`Params: (${Do(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 kr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class ig extends V{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
41
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class ag extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${xe(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class cg extends V{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
42
+ `),{name:"AbiEncodingLengthMismatchError"})}}class ug extends V{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(`
43
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Du extends V{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(`
44
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Fu extends V{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://openchain.xyz/signatures?query=${t}.`].join(`
45
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class lg extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class ju extends V{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://openchain.xyz/signatures?query=${t}.`].join(`
46
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class _u extends V{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(`
47
+ `),{docsPath:n,name:"AbiEventNotFoundError"})}}class Zn extends V{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(`
48
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Uu extends V{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(`
49
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class fg extends V{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://openchain.xyz/signatures?query=${t}.`].join(`
50
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class dg extends V{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${ht(t.abiItem)}\`, and`,`\`${n.type}\` in \`${ht(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let pg=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Br extends V{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
51
+ `),{metaMessages:[`Params: (${Do(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 Fo extends V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${ht(t,{includeName:!0})}".`].join(`
52
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class hg extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
53
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class mg extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
54
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let zu=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
55
+ `),{name:"InvalidArrayError"})}};class gg extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
56
+ `),{name:"InvalidDefinitionTypeError"})}}class bg extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Hu=class extends V{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Wu=class extends V{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 Vu extends V{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 Kn(e,{dir:t,size:n=32}={}){return typeof e=="string"?un(e,{dir:t,size:n}):yg(e,{dir:t,size:n})}function un(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Wu({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function yg(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Wu({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 Gu=class extends V{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"})}};class wg extends V{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 vg extends V{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let xg=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Sn(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 gt(e,{size:t}){if(xe(e)>t)throw new xg({givenSize:xe(e),maxSize:t})}function $t(e,t={}){const{signed:n}=t;t.size&&gt(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 Eg(e,t={}){let n=e;if(t.size&&(gt(n,{size:t.size}),n=Sn(n)),Sn(n)==="0x00")return!1;if(Sn(n)==="0x01")return!0;throw new vg(n)}function Ht(e,t={}){return Number($t(e,t))}const Sg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Wt(e,t={}){return typeof e=="number"||typeof e=="bigint"?ee(e,t):typeof e=="string"?Mr(e,t):typeof e=="boolean"?qu(e,t):Te(e,t)}function qu(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(gt(n,{size:t.size}),Kn(n,{size:t.size})):n}function Te(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Sg[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(gt(r,{size:t.size}),Kn(r,{dir:"right",size:t.size})):r}function ee(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 Gu({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Kn(c,{size:r}):c}const Pg=new TextEncoder;function Mr(e,t={}){const n=Pg.encode(e);return Te(n,t)}const Ag=new TextEncoder;function Yn(e,t={}){return typeof e=="number"||typeof e=="bigint"?Tg(e,t):typeof e=="boolean"?$g(e,t):mt(e)?bt(e,t):Pn(e,t)}function $g(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(gt(n,{size:t.size}),Kn(n,{size:t.size})):n}const Vt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Zu(e){if(e>=Vt.zero&&e<=Vt.nine)return e-Vt.zero;if(e>=Vt.A&&e<=Vt.F)return e-(Vt.A-10);if(e>=Vt.a&&e<=Vt.f)return e-(Vt.a-10)}function bt(e,t={}){let n=e;t.size&&(gt(n,{size:t.size}),n=Kn(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,c=0;i<o;i++){const a=Zu(r.charCodeAt(c++)),u=Zu(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new V(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function Tg(e,t){const n=ee(e,t);return bt(n)}function Pn(e,t={}){const n=Ag.encode(e);return typeof t.size=="number"?(gt(n,{size:t.size}),Kn(n,{dir:"right",size:t.size})):n}const jo=BigInt(2**32-1),Ku=BigInt(32);function Cg(e,t=!1){return t?{h:Number(e&jo),l:Number(e>>Ku&jo)}:{h:Number(e>>Ku&jo)|0,l:Number(e&jo)|0}}function Og(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:c}=Cg(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Ig=(e,t,n)=>e<<n|t>>>32-n,Ng=(e,t,n)=>t<<n|e>>>32-n,kg=(e,t,n)=>t<<n-32|e>>>64-n,Bg=(e,t,n)=>e<<n-32|t>>>64-n,Xn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function _o(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Lr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Gt(e,...t){if(!_o(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 Yu(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Lr(e.outputLen),Lr(e.blockLen)}function Qn(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 Xu(e,t){Gt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Mg(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Jn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function di(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Tt(e,t){return e<<32-t|e>>>t}const Lg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Rg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Dg(e){for(let t=0;t<e.length;t++)e[t]=Rg(e[t]);return e}const Qu=Lg?e=>e:Dg,Ju=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Fg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function er(e){if(Gt(e),Ju)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Fg[e[n]];return t}const qt={_0:48,_9:57,A:65,F:70,a:97,f:102};function el(e){if(e>=qt._0&&e<=qt._9)return e-qt._0;if(e>=qt.A&&e<=qt.F)return e-(qt.A-10);if(e>=qt.a&&e<=qt.f)return e-(qt.a-10)}function Uo(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Ju)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=el(e.charCodeAt(s)),c=el(e.charCodeAt(s+1));if(i===void 0||c===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+c}return r}function jg(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function zo(e){return typeof e=="string"&&(e=jg(e)),Gt(e),e}function ln(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Gt(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 pi{}function tl(e){const t=r=>e().update(zo(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function nl(e=32){if(Xn&&typeof Xn.getRandomValues=="function")return Xn.getRandomValues(new Uint8Array(e));if(Xn&&typeof Xn.randomBytes=="function")return Uint8Array.from(Xn.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const _g=BigInt(0),Rr=BigInt(1),Ug=BigInt(2),zg=BigInt(7),Hg=BigInt(256),Wg=BigInt(113),rl=[],ol=[],sl=[];for(let e=0,t=Rr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],rl.push(2*(5*r+n)),ol.push((e+1)*(e+2)/2%64);let o=_g;for(let s=0;s<7;s++)t=(t<<Rr^(t>>zg)*Wg)%Hg,t&Ug&&(o^=Rr<<(Rr<<BigInt(s))-Rr);sl.push(o)}const il=Og(sl,!0),Vg=il[0],Gg=il[1],al=(e,t,n)=>n>32?kg(e,t,n):Ig(e,t,n),cl=(e,t,n)=>n>32?Bg(e,t,n):Ng(e,t,n);function qg(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 c=(i+8)%10,a=(i+2)%10,u=n[a],l=n[a+1],f=al(u,l,1)^n[c],d=cl(u,l,1)^n[c+1];for(let p=0;p<50;p+=10)e[i+p]^=f,e[i+p+1]^=d}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=ol[i],a=al(o,s,c),u=cl(o,s,c),l=rl[i];o=e[l],s=e[l+1],e[l]=a,e[l+1]=u}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Vg[r],e[1]^=Gg[r]}Jn(n)}class hi extends pi{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,Lr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Mg(this.state)}clone(){return this._cloneInto()}keccak(){Qu(this.state32),qg(this.state32,this.rounds),Qu(this.state32),this.posOut=0,this.pos=0}update(t){Qn(this),t=zo(t),Gt(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 c=0;c<i;c++)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){Qn(this,!1),Gt(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 Lr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Xu(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,Jn(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new hi(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 Zg=(e,t,n)=>tl(()=>new hi(t,e,n)),ul=Zg(1,136,256/8);function ke(e,t){const n=t||"hex",r=ul(mt(e,{strict:!1})?Yn(e):e);return n==="bytes"?r:Wt(r)}const Kg=e=>ke(Yn(e));function Yg(e){return Kg(e)}function Xg(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new V("Unable to normalize signature.");return o}const Qg=e=>{const t=typeof e=="string"?e:Ro(e);return Xg(t)};function ll(e){return Yg(Qg(e))}const Ho=ll;let fn=class extends V{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"})}},mi=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 gi=new mi(8192);function Wo(e,t){if(gi.has(`${e}.${t}`))return gi.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=ke(Pn(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 gi.set(`${e}.${t}`,s),s}function An(e,t){if(!tt(e,{strict:!1}))throw new fn({address:e});return Wo(e,t)}const Jg=/^0x[a-fA-F0-9]{40}$/,bi=new mi(8192);function tt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(bi.has(r))return bi.get(r);const o=Jg.test(e)?e.toLowerCase()===e?!0:n?Wo(e)===e:!0:!1;return bi.set(r,o),o}function yt(e){return typeof e[0]=="string"?tr(e):eb(e)}function eb(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 tr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function nr(e,t,n,{strict:r}={}){return mt(e,{strict:!1})?hl(e,t,n,{strict:r}):pl(e,t,n,{strict:r})}function fl(e,t){if(typeof t=="number"&&t>0&&t>xe(e)-1)throw new Hu({offset:t,position:"start",size:xe(e)})}function dl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&xe(e)!==n-t)throw new Hu({offset:n,position:"end",size:xe(e)})}function pl(e,t,n,{strict:r}={}){fl(e,t);const o=e.slice(t,n);return r&&dl(o,t,n),o}function hl(e,t,n,{strict:r}={}){fl(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&dl(o,t,n),o}const tb=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ml=/^(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 Zt(e,t){if(e.length!==t.length)throw new cg({expectedLength:e.length,givenLength:t.length});const n=nb({params:e,values:t}),r=wi(n);return r.length===0?"0x":r}function nb({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(yi({param:e[r],value:t[r]}));return n}function yi({param:e,value:t}){const n=vi(e.type);if(n){const[r,o]=n;return ob(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return ub(t,{param:e});if(e.type==="address")return rb(t);if(e.type==="bool")return ib(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=ml.exec(e.type)??[];return ab(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return sb(t,{param:e});if(e.type==="string")return cb(t);throw new hg(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function wi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=xe(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(ee(t+o,{size:32})),r.push(c),o+=xe(c)):n.push(c)}return yt([...n,...r])}function rb(e){if(!tt(e))throw new fn({address:e});return{dynamic:!1,encoded:un(e.toLowerCase())}}function ob(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new zu(e);if(!r&&e.length!==t)throw new ig({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=yi({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=wi(s);if(r){const c=ee(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?yt([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:yt(s.map(({encoded:i})=>i))}}function sb(e,{param:t}){const[,n]=t.type.split("bytes"),r=xe(e);if(!n){let o=e;return r%32!==0&&(o=un(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:yt([un(ee(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new ag({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:un(e,{dir:"right"})}}function ib(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:un(qu(e))}}function ab(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 Gu({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:ee(e,{size:32,signed:t})}}function cb(e){const t=Mr(e),n=Math.ceil(xe(t)/32),r=[];for(let o=0;o<n;o++)r.push(un(nr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:yt([un(ee(xe(t),{size:32})),...r])}}function ub(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,c=yi({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?wi(r):yt(r.map(({encoded:o})=>o))}}function vi(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Dr=e=>nr(ll(e),0,4);function $n(e){const{abi:t,args:n=[],name:r}=e,o=mt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Dr(c)===r:c.type==="event"?Ho(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((u,l)=>{const f="inputs"in c&&c.inputs[l];return f?xi(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=gl(c.inputs,i.inputs,n);if(u)throw new dg({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function xi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return tt(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)=>xi(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=>xi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function gl(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 gl(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")?tt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?tt(n[r],{strict:!1}):!1)return i}}const bl="/docs/contract/encodeEventTopics";function Fr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=$n({abi:t,name:n});if(!u)throw new _u(n,{docsPath:bl});o=u}if(o.type!=="event")throw new _u(void 0,{docsPath:bl});const s=ht(o),i=Ho(s);let c=[];if(r&&"inputs"in o){const u=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(f=>r[f.name]))??[]:[];l.length>0&&(c=(u==null?void 0:u.map((f,d)=>Array.isArray(l[d])?l[d].map((p,h)=>yl({param:f,value:l[d][h]})):typeof l[d]<"u"&&l[d]!==null?yl({param:f,value:l[d]}):null))??[])}return[i,...c]}function yl({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return ke(Yn(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new bg(e.type);return Zt([e],[t])}function Vo(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:c,transport:a})=>{c==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function wl(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=Vo(e,{method:"eth_newFilter"}),l=s?Fr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?ee(i):i,toBlock:typeof a=="bigint"?ee(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function wt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const vl="/docs/contract/encodeFunctionData";function lb(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=$n({abi:t,args:n,name:r});if(!s)throw new Zn(r,{docsPath:vl});o=s}if(o.type!=="function")throw new Zn(void 0,{docsPath:vl});return{abi:[o],functionName:Dr(ht(o))}}function Ct(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:lb(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Zt(o.inputs,t??[]):void 0;return tr([s,i??"0x"])}const xl={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."},El={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},fb={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Sl extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class Pl extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class db extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const pb={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 db({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Pl({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Sl({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 Sl({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 Ei(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(pb);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function hb(e,t={}){typeof t.size<"u"&&gt(e,{size:t.size});const n=Te(e,t);return $t(n,t)}function mb(e,t={}){let n=e;if(typeof t.size<"u"&&(gt(n,{size:t.size}),n=Sn(n)),n.length>1||n[0]>1)throw new wg(n);return!!n[0]}function Kt(e,t={}){typeof t.size<"u"&&gt(e,{size:t.size});const n=Te(e,t);return Ht(n,t)}function gb(e,t={}){let n=e;return typeof t.size<"u"&&(gt(n,{size:t.size}),n=Sn(n,{dir:"right"})),new TextDecoder().decode(n)}function jr(e,t){const n=typeof t=="string"?bt(t):t,r=Ei(n);if(xe(n)===0&&e.length>0)throw new kr;if(xe(t)&&xe(t)<32)throw new Ru({data:typeof t=="string"?t:Te(t),params:e,size:xe(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=rr(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function rr(e,t,{staticPosition:n}){const r=vi(t.type);if(r){const[o,s]=r;return yb(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return Eb(e,t,{staticPosition:n});if(t.type==="address")return bb(e);if(t.type==="bool")return wb(e);if(t.type.startsWith("bytes"))return vb(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return xb(e,t);if(t.type==="string")return Sb(e,{staticPosition:n});throw new mg(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Al=32,Si=32;function bb(e){const t=e.readBytes(32);return[Wo(Te(pl(t,-20))),32]}function yb(e,t,{length:n,staticPosition:r}){if(!n){const i=Kt(e.readBytes(Si)),c=r+i,a=c+Al;e.setPosition(c);const u=Kt(e.readBytes(Al)),l=_r(t);let f=0;const d=[];for(let p=0;p<u;++p){e.setPosition(a+(l?p*32:f));const[h,m]=rr(e,t,{staticPosition:a});f+=m,d.push(h)}return e.setPosition(r+32),[d,32]}if(_r(t)){const i=Kt(e.readBytes(Si)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=rr(e,t,{staticPosition:c});a.push(l)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=rr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function wb(e){return[mb(e.readBytes(32),{size:32}),32]}function vb(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Kt(e.readBytes(32));e.setPosition(n+i);const c=Kt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Te(a),32]}return[Te(e.readBytes(Number.parseInt(o),32)),32]}function xb(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?hb(o,{signed:n}):Kt(o,{signed:n}),32]}function Eb(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(_r(t)){const i=Kt(e.readBytes(Si)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=rr(e,u,{staticPosition:c});s+=f,o[r?a:u==null?void 0:u.name]=l}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,u]=rr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function Sb(e,{staticPosition:t}){const n=Kt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Kt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=gb(Sn(s));return e.setPosition(t+32),[i,32]}function _r(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(_r);const n=vi(e.type);return!!(n&&_r({...e,type:n[1]}))}function $l(e){const{abi:t,data:n}=e,r=nr(n,0,4);if(r==="0x")throw new kr;const s=[...t||[],El,fb].find(i=>i.type==="error"&&r===Dr(ht(i)));if(!s)throw new Fu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?jr(s.inputs,nr(n,4)):void 0,errorName:s.name}}const Ce=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Tl({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"?Ce(t[s]):t[s]}`).join(", ")})`}const Pb={gwei:9,wei:18},Ab={ether:-9,wei:9};function Pi(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 Cl(e,t="wei"){return Pi(e,Pb[t])}function vt(e,t="wei"){return Pi(e,Ab[t])}class $b extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Tb extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Ol(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
57
+ `,"")}function Cb(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
58
+ `;return r.nonce&&(o+=` nonce: ${r.nonce}
59
+ `),r.balance&&(o+=` balance: ${r.balance}
60
+ `),r.code&&(o+=` code: ${r.code}
61
+ `),r.state&&(o+=` state:
62
+ `,o+=Ol(r.state)),r.stateDiff&&(o+=` stateDiff:
63
+ `,o+=Ol(r.stateDiff)),o},` State Override:
64
+ `).slice(0,-1)}function Go(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(`
65
+ `)}class Ob extends V{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
66
+ `),{name:"FeeConflictError"})}}class Ib extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Go(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 Il extends V{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 Nl extends V{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 Nb extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const kb=e=>e,Ur=e=>e;class kl extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:d,stateOverride:p}){var v;const h=n?wt(n):void 0;let m=Go({from:h==null?void 0:h.address,to:f,value:typeof d<"u"&&`${Cl(d)} ${((v=o==null?void 0:o.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${vt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${vt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${vt(u)} gwei`,nonce:l});p&&(m+=`
67
+ ${Cb(p)}`),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 Bb extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=$n({abi:n,args:r,name:i}),u=a?Tl({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?ht(a,{includeName:!0}):void 0,f=Go({address:o&&kb(o),function:l,args:u&&u!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${u}`,sender:c});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=c}}class Ai extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=$l({abi:t,data:n});const{abiItem:l,errorName:f,args:d}=i;if(f==="Error")a=d[0];else if(f==="Panic"){const[p]=d;a=xl[p]}else{const p=l?ht(l,{includeName:!0}):void 0,h=l&&d?Tl({abiItem:l,args:d,includeFunctionName:!1,includeName:!1}):void 0;c=[p?`Error: ${p}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(l){s=l}else o&&(a=o);let u;s instanceof Fu&&(u=s.signature,c=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(a&&a!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,a||u].join(`
68
+ `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:c,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=u}}class Mb extends V{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 Lb extends V{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 qo extends V{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 Tn extends V{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: ${Ur(i)}`,t&&`Request body: ${Ce(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 $i extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Ur(r)}`,`Request body: ${Ce(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}),this.code=n.code,this.data=n.data}}class Bl extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Ur(n)}`,`Request body: ${Ce(t)}`],name:"TimeoutError"})}}const Rb=-1;class _e extends V{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 $i?t.code:n??Rb}}class Ye extends _e{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class zr extends _e{constructor(t){super(t,{code:zr.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Hr extends _e{constructor(t){super(t,{code:Hr.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Hr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Wr extends _e{constructor(t,{method:n}={}){super(t,{code:Wr.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Wr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Vr extends _e{constructor(t){super(t,{code:Vr.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
69
+ `)})}}Object.defineProperty(Vr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Cn extends _e{constructor(t){super(t,{code:Cn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Cn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class On extends _e{constructor(t){super(t,{code:On.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
70
+ `)})}}Object.defineProperty(On,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Gr extends _e{constructor(t){super(t,{code:Gr.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class qr extends _e{constructor(t){super(t,{code:qr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Zr extends _e{constructor(t){super(t,{code:Zr.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class In extends _e{constructor(t,{method:n}={}){super(t,{code:In.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class or extends _e{constructor(t){super(t,{code:or.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(or,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Kr extends _e{constructor(t){super(t,{code:Kr.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Kr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class sr extends Ye{constructor(t){super(t,{code:sr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(sr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Yr extends Ye{constructor(t){super(t,{code:Yr.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Yr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Xr extends Ye{constructor(t,{method:n}={}){super(t,{code:Xr.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(Xr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Qr extends Ye{constructor(t){super(t,{code:Qr.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Jr extends Ye{constructor(t){super(t,{code:Jr.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class eo extends Ye{constructor(t){super(t,{code:eo.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class to extends Ye{constructor(t){super(t,{code:to.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class no extends Ye{constructor(t){super(t,{code:no.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class ro extends Ye{constructor(t){super(t,{code:ro.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class oo extends Ye{constructor(t){super(t,{code:oo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class so extends Ye{constructor(t){super(t,{code:so.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class io extends Ye{constructor(t){super(t,{code:io.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class ao extends Ye{constructor(t){super(t,{code:ao.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Db extends _e{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Fb=3;function ir(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof qo?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:d}=c,p=e instanceof kr?new Mb({functionName:s}):[Fb,Cn.code].includes(a)&&(u||l||f||d)?new Ai({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof $i?l:d??f}):e;return new Bb(p,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function jb(e){const t=ke(`0x${e.substring(4)}`).substring(26);return Wo(`0x${t}`)}async function _b({hash:e,signature:t}){const n=mt(e)?e:Wt(e),{secp256k1:r}=await Promise.resolve().then(()=>Ov);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:f,yParity:d}=t,p=Number(d??f),h=Ml(p);return new r.Signature($t(u),$t(l)).addRecoveryBit(h)}const i=mt(t)?t:Wt(t);if(xe(i)!==65)throw new Error("invalid signature length");const c=Ht(`0x${i.slice(130)}`),a=Ml(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Ml(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 Ll({hash:e,signature:t}){return jb(await _b({hash:e,signature:t}))}function Ub(e,t="hex"){const n=Rl(e),r=Ei(new Uint8Array(n.length));return n.encode(r),t==="hex"?Te(r.bytes):r.bytes}function Rl(e){return Array.isArray(e)?zb(e.map(t=>Rl(t))):Hb(e)}function zb(e){const t=e.reduce((o,s)=>o+s.length,0),n=Dl(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 Hb(e){const t=typeof e=="string"?bt(e):e,n=Dl(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 Dl(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 V("Length is too large.")}function Wb(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=ke(tr(["0x05",Ub([t?ee(t):"0x",o,n?ee(n):"0x"])]));return r==="bytes"?bt(s):s}async function Vb(e){const{authorization:t,signature:n}=e;return Ll({hash:Wb(t),signature:n??t})}class Gb extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:d}){var h;const p=Go({from:n==null?void 0:n.address,to:f,value:typeof d<"u"&&`${Cl(d)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${vt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${vt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${vt(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",p].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class ar extends V{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(ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(ar,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Zo extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${vt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Zo,"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 Ti extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${vt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Ti,"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 Ci extends V{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(Ci,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Oi extends V{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(`
71
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Oi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Ii extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Ii,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ni extends V{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
72
+ `),{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(Ni,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class ki extends V{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(ki,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Bi extends V{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(Bi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Mi extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Mi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Ko extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${vt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${vt(r)} gwei`:""}).`].join(`
73
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Ko,"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 Yo extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Li(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===ar.code):e;return r instanceof V?new ar({cause:e,message:r.details}):ar.nodeMessage.test(n)?new ar({cause:e,message:e.details}):Zo.nodeMessage.test(n)?new Zo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ti.nodeMessage.test(n)?new Ti({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ci.nodeMessage.test(n)?new Ci({cause:e,nonce:t==null?void 0:t.nonce}):Oi.nodeMessage.test(n)?new Oi({cause:e,nonce:t==null?void 0:t.nonce}):Ii.nodeMessage.test(n)?new Ii({cause:e,nonce:t==null?void 0:t.nonce}):Ni.nodeMessage.test(n)?new Ni({cause:e}):ki.nodeMessage.test(n)?new ki({cause:e,gas:t==null?void 0:t.gas}):Bi.nodeMessage.test(n)?new Bi({cause:e,gas:t==null?void 0:t.gas}):Mi.nodeMessage.test(n)?new Mi({cause:e}):Ko.nodeMessage.test(n)?new Ko({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Yo({cause:e})}function qb(e,{docsPath:t,...n}){const r=(()=>{const o=Li(e,n);return o instanceof Yo?e:o})();return new Gb(r,{docsPath:t,...n})}function Ri(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const c of i)c in e&&(n[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&r(s[c])}const o=t(e||{});return r(o),n}const Zb={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Xo(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=Kb(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>Te(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=ee(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=ee(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=ee(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=ee(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=ee(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=ee(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=Zb[e.type]),typeof e.value<"u"&&(t.value=ee(e.value)),t}function Kb(e){return e.map(t=>({address:t.address,r:t.r?ee(BigInt(t.r)):t.r,s:t.s?ee(BigInt(t.s)):t.s,chainId:ee(t.chainId),nonce:ee(t.nonce),...typeof t.yParity<"u"?{yParity:ee(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:ee(t.v)}:{}}))}function Fl(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Vu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Vu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Yb(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=ee(t)),n!==void 0&&(i.nonce=ee(n)),r!==void 0&&(i.state=Fl(r)),o!==void 0){if(i.state)throw new Tb;i.stateDiff=Fl(o)}return i}function Di(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!tt(n,{strict:!1}))throw new fn({address:n});if(t[n])throw new $b({address:n});t[n]=Yb(r)}return t}const jl=2n**256n-1n;function co(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?wt(t):void 0;if(i&&!tt(i.address))throw new fn({address:i.address});if(s&&!tt(s))throw new fn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new Ob;if(r&&r>jl)throw new Zo({maxFeePerGas:r});if(o&&r&&o>r)throw new Ko({maxFeePerGas:r,maxPriorityFeePerGas:o})}class Xb extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Fi extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Qb extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${vt(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class _l extends V{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 Ul={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function zl(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Ht(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?Ht(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Ul[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&&(t.authorizationList=Jb(e.authorizationList)),t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof t.v=="bigint"){if(t.v===0n||t.v===27n)return 0;if(t.v===1n||t.v===28n)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),t.type==="legacy"&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),t.type==="eip2930"&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t.type==="eip1559"&&delete t.maxFeePerBlobGas,t}function Jb(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 Hl(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:zl(n));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:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Ot(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var u,l,f;const s=o??!1,i=n!==void 0?ee(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new _l({blockHash:t,blockNumber:n});return(((f=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:f.format)||Hl)(c)}async function ji(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function ey(e,t){return Wl(e,t)}async function Wl(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((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 c=="function"){const u=n||await ne(e,Ot,"getBlock")({}),l=await c({block:u,client:e,request:o});if(l===null)throw new Error;return l}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return $t(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):ne(e,Ot,"getBlock")({}),ne(e,ji,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new Fi;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function ty(e,t){return _i(e,t)}async function _i(e,t){var d,p;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 Xb;const a=10**(((d=i.toString().split(".")[1])==null?void 0:d.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await ne(e,Ot,"getBlock")({});if(typeof((p=r==null?void 0:r.fees)==null?void 0:p.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new Fi;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Wl(e,{block:l,chain:r,request:o}),m=u(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??u(await ne(e,ji,"getGasPrice")({}))}}async function Vl(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?ee(r):n]},{dedupe:!!r});return Ht(o)}function Gl(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=>bt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>Te(s))}function ql(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=>bt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>bt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>Te(i))}function ny(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),c=Number(n&s),a=r?4:0,u=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+u,c,r)}function ry(e,t,n){return e&t^~e&n}function oy(e,t,n){return e&t^e&n^t&n}class sy extends pi{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=di(this.buffer)}update(t){Qn(this),t=zo(t),Gt(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=di(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Qn(this),Xu(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,Jn(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;ny(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=di(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)c.setUint32(4*f,l[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:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const dn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),iy=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]),pn=new Uint32Array(64);class ay extends sy{constructor(t=32){super(64,t,8,!1),this.A=dn[0]|0,this.B=dn[1]|0,this.C=dn[2]|0,this.D=dn[3]|0,this.E=dn[4]|0,this.F=dn[5]|0,this.G=dn[6]|0,this.H=dn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,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=c|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)pn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const d=pn[f-15],p=pn[f-2],h=Tt(d,7)^Tt(d,18)^d>>>3,m=Tt(p,17)^Tt(p,19)^p>>>10;pn[f]=m+pn[f-7]+h+pn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:u,H:l}=this;for(let f=0;f<64;f++){const d=Tt(c,6)^Tt(c,11)^Tt(c,25),p=l+d+ry(c,a,u)+iy[f]+pn[f]|0,m=(Tt(r,2)^Tt(r,13)^Tt(r,22))+oy(r,o,s)|0;l=u,u=a,a=c,c=i+p|0,i=s,s=o,o=r,r=p+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,o,s,i,c,a,u,l)}roundClean(){Jn(pn)}destroy(){this.set(0,0,0,0,0,0,0,0),Jn(this.buffer)}}const Zl=tl(()=>new ay),cy=Zl;function uy(e,t){return cy(mt(e,{strict:!1})?Yn(e):e)}function ly(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=uy(t);return o.set([n],0),r==="bytes"?o:Te(o)}function fy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(ly({commitment:s,to:r,version:n}));return o}const Kl=6,Yl=32,Ui=4096,Xl=Yl*Ui,Ql=Xl*Kl-1-1*Ui*Kl;class dy extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class py extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function hy(e){const t=typeof e.data=="string"?bt(e.data):e.data,n=xe(t);if(!n)throw new py;if(n>Ql)throw new dy({maxSize:Ql,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Ei(new Uint8Array(Xl));let c=0;for(;c<Ui;){const a=t.slice(s,s+(Yl-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}c++,s+=31}r.push(i)}return r.map(i=>Te(i.bytes))}function my(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??hy({data:t}),s=e.commitments??Gl({blobs:o,kzg:n,to:r}),i=e.proofs??ql({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function gy(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 Ib({transaction:e})}async function Jl(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Ht(t)}const by=["blobVersionedHashes","chainId","fees","gas","nonce","type"],ef=new Map;async function tf(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=by,type:l}=t,f=n&&wt(n),d={...t,...f?{from:f==null?void 0:f.address}:{}};let p;async function h(){return p||(p=await ne(e,Ot,"getBlock")({blockTag:"latest"}),p)}let m;async function v(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await ne(e,Jl,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&f)if(a){const $=await v();d.nonce=await a.consume({address:f.address,chainId:$,client:e})}else d.nonce=await ne(e,Vl,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const $=Gl({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const y=fy({commitments:$,to:"hex"});d.blobVersionedHashes=y}if(u.includes("sidecars")){const y=ql({blobs:r,commitments:$,kzg:i}),T=my({blobs:r,commitments:$,proofs:y,to:"hex"});d.sidecars=T}}if(u.includes("chainId")&&(d.chainId=await v()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{d.type=gy(d)}catch{let $=ef.get(e.uid);if(typeof $>"u"){const y=await h();$=typeof(y==null?void 0:y.baseFeePerGas)=="bigint",ef.set(e.uid,$)}d.type=$?"eip1559":"legacy"}if(u.includes("fees"))if(d.type!=="legacy"&&d.type!=="eip2930"){if(typeof d.maxFeePerGas>"u"||typeof d.maxPriorityFeePerGas>"u"){const $=await h(),{maxFeePerGas:y,maxPriorityFeePerGas:T}=await _i(e,{block:$,chain:o,request:d});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<T)throw new Qb({maxPriorityFeePerGas:T});d.maxPriorityFeePerGas=T,d.maxFeePerGas=y}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new Fi;if(typeof t.gasPrice>"u"){const $=await h(),{gasPrice:y}=await _i(e,{block:$,chain:o,request:d,type:"legacy"});d.gasPrice=y}}return u.includes("gas")&&typeof s>"u"&&(d.gas=await ne(e,zi,"estimateGas")({...d,account:f&&{address:f.address,type:"json-rpc"}})),co(d),delete d.parameters,d}async function nf(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?ee(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function zi(e,t){var o,s,i;const{account:n=e.account}=t,r=n?wt(n):void 0;try{let S=function(C){const{block:O,request:b,rpcStateOverride:k}=C;return e.request({method:"eth_estimateGas",params:k?[b,O??e.experimental_blockTag??"latest",k]:O?[b,O]:[b]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:f,blockTag:d,data:p,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:$,maxPriorityFeePerGas:y,nonce:T,value:B,stateOverride:L,..._}=await tf(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?ee(f):void 0)||d,w=Di(L),A=await(async()=>{if(_.to)return _.to;if(a&&a.length>0)return await Vb({authorization:a[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})();co(t);const I=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,P=(I||Xo)({...Ri(_,{format:I}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:p,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:$,maxPriorityFeePerGas:y,nonce:T,to:A,value:B});let E=BigInt(await S({block:g,request:P,rpcStateOverride:w}));if(a){const C=await nf(e,{address:P.from}),O=await Promise.all(a.map(async b=>{const{address:k}=b,D=await S({block:g,request:{authorizationList:void 0,data:p,from:r==null?void 0:r.address,to:k,value:ee(C)},rpcStateOverride:w}).catch(()=>100000n);return 2n*BigInt(D)}));E+=O.reduce((b,k)=>b+k,0n)}return E}catch(c){throw qb(c,{...t,account:r,chain:e.chain})}}async function yy(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Ct({abi:n,args:o,functionName:s});try{return await ne(e,zi,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?wt(c.account):void 0;throw ir(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function Qo(e,t){if(!tt(e,{strict:!1}))throw new fn({address:e});if(!tt(t,{strict:!1}))throw new fn({address:t});return e.toLowerCase()===t.toLowerCase()}const rf="/docs/contract/decodeEventLog";function Hi(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new lg({docsPath:rf});const a=t.find(m=>m.type==="event"&&i===Ho(ht(m)));if(!(a&&"name"in a)||a.type!=="event")throw new ju(i,{docsPath:rf});const{name:u,inputs:l}=a,f=l==null?void 0:l.some(m=>!("name"in m&&m.name)),d=f?[]:{},p=l.map((m,v)=>[m,v]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<p.length;m++){const[v,$]=p[m],y=c[m];if(!y)throw new Fo({abiItem:a,param:v});d[f?$:v.name||$]=wy({param:v,value:y})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=jr(h,n);if(m)if(f)for(let v=0;v<l.length;v++)d[v]=d[v]??m.shift();else for(let v=0;v<h.length;v++)d[h[v].name]=m[v]}catch(m){if(s)throw m instanceof Ru||m instanceof Pl?new Br({abiItem:a,data:n,params:h,size:xe(n)}):m}else if(s)throw new Br({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(d).length>0?d:void 0}}function wy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(jr([e],t)||[])[0]}function Wi(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]})();return r.map(i=>{var c;try{const a=t.find(l=>l.type==="event"&&i.topics[0]===Ho(l));if(!a)return null;const u=Hi({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!vy({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof ju)return null;if(a instanceof Br||a instanceof Fo){if(o)return null;u=a.abiItem.name,l=(c=a.abiItem.inputs)==null?void 0:c.some(f=>!("name"in f&&f.name))}return{...i,args:l?[]:{},eventName:u}}}).filter(Boolean)}function vy(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?Qo(i,c):s.type==="string"||s.type==="bytes"?ke(Yn(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(u=>o(c,u,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 c=n.find(u=>u.name===s);return c?(Array.isArray(i)?i:[i]).some(u=>o(c,u,t[s])):!1}):!1}function Yt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,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}:{}}}async function Vi(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const u=a??!1,l=i??(s?[s]:void 0);let f=[];l&&(f=[l.flatMap(m=>Fr({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let d;n?d=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):d=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?ee(r):r,toBlock:typeof o=="bigint"?ee(o):o}]});const p=d.map(h=>Yt(h));return l?Wi({abi:l,args:c,logs:p,strict:u}):p}async function of(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?$n({abi:n,name:i}):void 0,f=l?void 0:n.filter(d=>d.type==="event");return ne(e,Vi,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const Gi="/docs/contract/decodeFunctionResult";function Nn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=$n({abi:t,args:n,name:r});if(!c)throw new Zn(r,{docsPath:Gi});s=c}if(s.type!=="function")throw new Zn(void 0,{docsPath:Gi});if(!s.outputs)throw new Uu(s.name,{docsPath:Gi});const i=jr(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 qi=BigInt(0),Zi=BigInt(1);function Jo(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function kn(e,t,n=""){const r=_o(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",a=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return e}function es(e){const t=e.toString(16);return t.length&1?"0"+t:t}function sf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?qi:BigInt("0x"+e)}function ts(e){return sf(er(e))}function af(e){return Gt(e),sf(er(Uint8Array.from(e).reverse()))}function Ki(e,t){return Uo(e.toString(16).padStart(t*2,"0"))}function cf(e,t){return Ki(e,t).reverse()}function Ue(e,t,n){let r;if(typeof t=="string")try{r=Uo(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(_o(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const Yi=e=>typeof e=="bigint"&&qi<=e;function xy(e,t,n){return Yi(e)&&Yi(t)&&Yi(n)&&t<=e&&e<n}function Ey(e,t,n,r){if(!xy(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function uf(e){let t;for(t=0;e>qi;e>>=Zi,t+=1);return t}const uo=e=>(Zi<<BigInt(e))-Zi;function Sy(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");const r=p=>new Uint8Array(p),o=p=>Uint8Array.of(p);let s=r(e),i=r(e),c=0;const a=()=>{s.fill(1),i.fill(0),c=0},u=(...p)=>n(i,s,...p),l=(p=r(0))=>{i=u(o(0),p),s=u(),p.length!==0&&(i=u(o(1),p),s=u())},f=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const h=[];for(;p<t;){s=u();const m=s.slice();h.push(m),p+=s.length}return ln(...h)};return(p,h)=>{a(),l(p);let m;for(;!(m=h(f()));)l();return a(),m}}function Xi(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,i){const c=e[o];if(i&&c===void 0)return;const a=typeof c;if(a!==s||c===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${a}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}function lf(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 Py="0.1.1";function Ay(){return Py}class be extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof be){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:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof be&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
74
+ `);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,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Ay()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return ff(this,t)}}function ff(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?ff(e.cause,t):t?null:e}const $y="#__bigint";function Ty(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+$y:o,n)}function Cy(e,t){if(hf(e)>t)throw new Fy({givenSize:hf(e),maxSize:t})}const Xt={zero:48,nine:57,A:65,F:70,a:97,f:102};function df(e){if(e>=Xt.zero&&e<=Xt.nine)return e-Xt.zero;if(e>=Xt.A&&e<=Xt.F)return e-(Xt.A-10);if(e>=Xt.a&&e<=Xt.f)return e-(Xt.a-10)}function Oy(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 Qi(e,t){if(nt(e)>t)throw new Wy({givenSize:nt(e),maxSize:t})}function Iy(e,t){if(typeof t=="number"&&t>0&&t>nt(e)-1)throw new vf({offset:t,position:"start",size:nt(e)})}function Ny(e,t,n){if(typeof t=="number"&&typeof n=="number"&&nt(e)!==n-t)throw new vf({offset:n,position:"end",size:nt(e)})}function pf(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 Vy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const ky=new TextEncoder;function By(e){return e instanceof Uint8Array?e:typeof e=="string"?Ly(e):My(e)}function My(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Ly(e,t={}){const{size:n}=t;let r=e;n&&(Qi(e,n),r=Mn(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const u=df(o.charCodeAt(a++)),l=df(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new be(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=u*16+l}return i}function Ry(e,t={}){const{size:n}=t,r=ky.encode(e);return typeof n=="number"?(Cy(r,n),Dy(r,n)):r}function Dy(e,t){return Oy(e,{dir:"right",size:t})}function hf(e){return e.length}let Fy=class extends be{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 be{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 _y=new TextEncoder,Uy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function zy(e,t={}){const{strict:n=!1}=t;if(!e)throw new yf(e);if(typeof e!="string")throw new yf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new wf(e);if(!e.startsWith("0x"))throw new wf(e)}function It(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function mf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Qi(n,t.size),Bn(n,t.size)):n}function gf(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Uy[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Qi(r,t.size),Mn(r,t.size)):r}function Le(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 u=typeof e=="bigint"?"n":"";throw new bf({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${e}${u}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Bn(a,r):a}function Ji(e,t={}){return gf(_y.encode(e),t)}function Bn(e,t){return pf(e,{dir:"left",size:t})}function Mn(e,t){return pf(e,{dir:"right",size:t})}function ea(e,t,n,r={}){const{strict:o}=r;Iy(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&Ny(s,t,n),s}function nt(e){return Math.ceil((e.length-2)/2)}function Hy(e,t={}){const{strict:n=!1}=t;try{return zy(e,{strict:n}),!0}catch{return!1}}class bf extends be{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 yf extends be{constructor(t){super(`Value \`${typeof t=="object"?Ty(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 wf extends be{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 Wy extends be{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 vf extends be{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 Vy extends be{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 Gy(e){return{address:e.address,amount:Le(e.amount),index:Le(e.index),validatorIndex:Le(e.validatorIndex)}}function xf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Le(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Le(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Le(e.gasLimit)},...typeof e.number=="bigint"&&{number:Le(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Le(e.prevRandao)},...typeof e.time=="bigint"&&{time:Le(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Gy)}}}const ta=[{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"}],na=[{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"}]}],Ef=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],Sf=[...Ef,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],qy=[...Ef,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Pf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Af=[{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"}]}],$f=[{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"}],cr=[{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"}]}],Zy="0x82ad56cb",Tf="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Ky="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Yy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class ra extends V{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 Cf extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const oa="/docs/contract/encodeDeployData";function sa(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 sg({docsPath:oa});if(!("inputs"in o))throw new Lu({docsPath:oa});if(!o.inputs||o.inputs.length===0)throw new Lu({docsPath:oa});const s=Zt(o.inputs,n);return tr([r,s])}function ur({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 ra({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ra({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function Of(e,{docsPath:t,...n}){const r=(()=>{const o=Li(e,n);return o instanceof Yo?e:o})();return new kl(r,{docsPath:t,...n})}function If(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const ia=new Map;function Nf({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const f=l.map(({args:d})=>d);f.length!==0&&e(f).then(d=>{o&&Array.isArray(d)&&d.sort(o);for(let p=0;p<l.length;p++){const{resolve:h}=l[p];h==null||h([d[p],d])}}).catch(d=>{for(let p=0;p<l.length;p++){const{reject:h}=l[p];h==null||h(d)}})},i=()=>ia.delete(t),c=()=>a().map(({args:l})=>l),a=()=>ia.get(t)||[],u=l=>ia.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:d,reject:p}=If();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:d,reject:p}),f):(u({args:l,resolve:d,reject:p}),setTimeout(s,r),f)}}}async function lo(e,t){var P,S,E,C;const{account:n=e.account,authorizationList:r,batch:o=!!((P=e.batch)!=null&&P.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:u,code:l,data:f,factory:d,factoryData:p,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:$,maxPriorityFeePerGas:y,nonce:T,to:B,value:L,stateOverride:_,...F}=t,g=n?wt(n):void 0;if(l&&(d||p))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&B)throw new V("Cannot provide both `code` & `to` as parameters.");const w=l&&f,A=d&&p&&B&&f,I=w||A,N=w?Jy({code:l,data:f}):A?e1({data:f,factory:d,factoryData:p,to:B}):f;try{co(t);const b=(typeof s=="bigint"?ee(s):void 0)||i,k=u?xf(u):void 0,D=Di(_),j=(C=(E=(S=e.chain)==null?void 0:S.formatters)==null?void 0:E.transactionRequest)==null?void 0:C.format,W=(j||Xo)({...Ri(F,{format:j}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:N,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:$,maxPriorityFeePerGas:y,nonce:T,to:I?void 0:B,value:L});if(o&&Xy({request:W})&&!D&&!k)try{return await Qy(e,{...W,blockNumber:s,blockTag:i})}catch(Z){if(!(Z instanceof Cf)&&!(Z instanceof ra))throw Z}const K=(()=>{const Z=[W,b];return D&&k?[...Z,D,k]:D?[...Z,D]:k?[...Z,{},k]:Z})(),H=await e.request({method:"eth_call",params:K});return H==="0x"?{data:void 0}:{data:H}}catch(O){const b=t1(O),{offchainLookup:k,offchainLookupSignature:D}=await Promise.resolve().then(()=>rw);if(e.ccipRead!==!1&&(b==null?void 0:b.slice(0,10))===D&&B)return{data:await k(e,{data:b,to:B})};throw I&&(b==null?void 0:b.slice(0,10))==="0x101bb98d"?new Lb({factory:d}):Of(O,{...t,account:g,chain:e.chain})}}function Xy({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Zy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Qy(e,t){var m;const{batchSize:n=1024,wait:r=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:i,multicallAddress:c,to:a}=t;let u=c;if(!u){if(!e.chain)throw new Cf;u=ur({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?ee(o):void 0)||s,{schedule:d}=Nf({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(v){return v.reduce((y,{data:T})=>y+(T.length-2),0)>n*2},fn:async v=>{const $=v.map(B=>({allowFailure:!0,callData:B.data,target:B.to})),y=Ct({abi:ta,args:[$],functionName:"aggregate3"}),T=await e.request({method:"eth_call",params:[{data:y,to:u},f]});return Nn({abi:ta,args:[$],functionName:"aggregate3",data:T||"0x"})}}),[{returnData:p,success:h}]=await d({data:i,to:a});if(!h)throw new qo({data:p});return p==="0x"?{data:void 0}:{data:p}}function Jy(e){const{code:t,data:n}=e;return sa({abi:Nu(["constructor(bytes, bytes)"]),bytecode:Tf,args:[t,n]})}function e1(e){const{data:t,factory:n,factoryData:r,to:o}=e;return sa({abi:Nu(["constructor(address, bytes, address, bytes)"]),bytecode:Ky,args:[o,t,n,r]})}function t1(e){var n;if(!(e instanceof V))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 Qt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Ct({abi:n,args:o,functionName:s});try{const{data:a}=await ne(e,lo,"call")({...i,data:c,to:r});return Nn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw ir(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function n1(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?wt(c.account):e.account,u=Ct({abi:n,args:o,functionName:i});try{const{data:l}=await ne(e,lo,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Nn({abi:n,args:o,functionName:i,data:l||"0x"}),d=n.filter(p=>"name"in p&&p.name===t.functionName);return{result:f,request:{abi:d,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(l){throw ir(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const aa=new Map,kf=new Map;let r1=0;function hn(e,t,n){const r=++r1,o=()=>aa.get(e)||[],s=()=>{const l=o();aa.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(d=>d.id===r))return;const f=kf.get(e);if(l.length===1&&f){const d=f();d instanceof Promise&&d.catch(()=>{})}s()},c=o();if(aa.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...f)=>{var p,h;const d=o();if(d.length!==0)for(const m of d)(h=(p=m.fns)[l])==null||h.call(p,...f)};const u=n(a);return typeof u=="function"&&kf.set(e,u),i}async function ca(e){return new Promise(t=>setTimeout(t,e))}function fo(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await ca(a);const u=async()=>{o&&(await e({unpoll:s}),await ca(r),u())};u()})(),s}const o1=new Map,s1=new Map;function i1(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,o1),r=t(e,s1);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function a1(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=i1(t),o=r.response.get();if(o&&n>0&&new Date().getTime()-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 c1=e=>`blockNumber.${e}`;async function po(e,{cacheTime:t=e.cacheTime}={}){const n=await a1(()=>e.request({method:"eth_blockNumber"}),{cacheKey:c1(e.uid),cacheTime:t});return BigInt(n)}async function ns(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=>Yt(s));return!("abi"in t)||!t.abi?o:Wi({abi:t.abi,logs:o,strict:n})}async function rs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function u1(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:u,poll:l,pollingInterval:f=e.pollingInterval,strict:d}=t;return(typeof l<"u"?l:typeof c=="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 v=d??!1,$=Ce(["watchContractEvent",r,o,s,e.uid,i,f,v,c]);return hn($,{onLogs:u,onError:a},y=>{let T;c!==void 0&&(T=c-1n);let B,L=!1;const _=fo(async()=>{var F;if(!L){try{B=await ne(e,wl,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:v,fromBlock:c})}catch{}L=!0;return}try{let g;if(B)g=await ne(e,ns,"getFilterChanges")({filter:B});else{const w=await ne(e,po,"getBlockNumber")({});T&&T<w?g=await ne(e,of,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:T+1n,toBlock:w,strict:v}):g=[],T=w}if(g.length===0)return;if(s)y.onLogs(g);else for(const w of g)y.onLogs([w])}catch(g){B&&g instanceof On&&(L=!1),(F=y.onError)==null||F.call(y,g)}},{emitOnBegin:!0,interval:f});return async()=>{B&&await ne(e,rs,"uninstallFilter")({filter:B}),_()}})})():(()=>{const v=d??!1,$=Ce(["watchContractEvent",r,o,s,e.uid,i,f,v]);let y=!0,T=()=>y=!1;return hn($,{onLogs:u,onError:a},B=>((async()=>{try{const L=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),_=i?Fr({abi:n,eventName:i,args:o}):[],{unsubscribe:F}=await L.subscribe({params:["logs",{address:r,topics:_}],onData(g){var A;if(!y)return;const w=g.result;try{const{eventName:I,args:N}=Hi({abi:n,data:w.data,topics:w.topics,strict:d}),P=Yt(w,{args:N,eventName:I});B.onLogs([P])}catch(I){let N,P;if(I instanceof Br||I instanceof Fo){if(d)return;N=I.abiItem.name,P=(A=I.abiItem.inputs)==null?void 0:A.some(E=>!("name"in E&&E.name))}const S=Yt(w,{args:P?[]:{},eventName:N});B.onLogs([S])}},onError(g){var w;(w=B.onError)==null||w.call(B,g)}});T=F,y||T()}catch(L){a==null||a(L)}})(),()=>T()))})()}async function l1(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function ua(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:u})=>{const l=typeof t=="function"?t({count:c,error:u}):t;l&&await ca(l),i({count:c+1})};try{const u=await e();o(u)}catch(u){if(c<n&&await r({count:c,error:u}))return a({error:u});s(u)}};i()})}const f1={"0x0":"reverted","0x1":"success"};function d1(e){const t={...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(n=>Yt(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Ht(e.transactionIndex):null,status:e.status?f1[e.status]:null,type:e.type?Ul[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const la=256;let os=la,ss;function Bf(e=11){if(!ss||os+e>la*2){ss="",os=0;for(let t=0;t<la;t++)ss+=(256+Math.random()*256|0).toString(16).substring(1)}return ss.substring(os,os+++e)}function p1(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(a/2),500),4e3),l=e.pollingInterval??u,f=e.cacheTime??l,d=e.account?wt(e.account):void 0,{config:p,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),v={...p,...m},$={account:d,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:v,type:i,uid:Bf(),...c?{experimental_blockTag:c}:{}};function y(T){return B=>{const L=B(T);for(const F in $)delete L[F];const _={...T,...L};return Object.assign(_,{extend:y(_)})}}return Object.assign($,{extend:y($)})}const is=new mi(8192);function h1(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(is.get(n))return is.get(n);const r=e().finally(()=>is.delete(n));return is.set(n,r),r}function m1(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:u}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(u))throw new In(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new In(new Error("method not supported"),{method:u});const l=o?Mr(`${a}.${Ce(n)}`):void 0;return h1(()=>ua(async()=>{try{return await e(n)}catch(d){const p=d;switch(p.code){case zr.code:throw new zr(p);case Hr.code:throw new Hr(p);case Wr.code:throw new Wr(p,{method:n.method});case Vr.code:throw new Vr(p);case Cn.code:throw new Cn(p);case On.code:throw new On(p);case Gr.code:throw new Gr(p);case qr.code:throw new qr(p);case Zr.code:throw new Zr(p);case In.code:throw new In(p,{method:n.method});case or.code:throw new or(p);case Kr.code:throw new Kr(p);case sr.code:throw new sr(p);case Yr.code:throw new Yr(p);case Xr.code:throw new Xr(p);case Qr.code:throw new Qr(p);case Jr.code:throw new Jr(p);case eo.code:throw new eo(p);case to.code:throw new to(p);case no.code:throw new no(p);case ro.code:throw new ro(p);case oo.code:throw new oo(p);case so.code:throw new so(p);case io.code:throw new io(p);case ao.code:throw new ao(p);case 5e3:throw new sr(p);default:throw d instanceof V?d:new Db(p)}}},{delay:({count:d,error:p})=>{var h;if(p&&p instanceof Tn){const m=(h=p==null?void 0:p.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m)*1e3}return~~(1<<d)*i},retryCount:c,shouldRetry:({error:d})=>g1(d)}),{enabled:o,id:l})}}function g1(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===or.code||e.code===Cn.code:e instanceof Tn&&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}function b1({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=Bf();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:m1(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class y1 extends V{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 w1(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const c=new AbortController;n>0&&(i=setTimeout(()=>{r&&c.abort()},n)),o(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&s(t),s(c)}finally{clearTimeout(i)}})()})}function v1(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Mf=v1();function x1(e,t={}){return{async request(n){var f;const{body:r,onRequest:o=t.onRequest,onResponse:s=t.onResponse,timeout:i=t.timeout??1e4}=n,c={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:a,method:u,signal:l}=c;try{const d=await w1(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Ce(r.map(T=>({jsonrpc:"2.0",id:T.id??Mf.take(),...T}))):Ce({jsonrpc:"2.0",id:r.id??Mf.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},v=new Request(e,m),$=await(o==null?void 0:o(v,m))??{...m,url:e};return await fetch($.url??e,$)},{errorInstance:new Bl({body:r,url:e}),timeout:i,signal:!0});s&&await s(d);let p;if((f=d.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))p=await d.json();else{p=await d.text();try{p=JSON.parse(p||"{}")}catch(h){if(d.ok)throw h;p={error:p}}}if(!d.ok)throw new Tn({body:r,details:Ce(p.error)||d.statusText,headers:d.headers,status:d.status,url:e});return p}catch(d){throw d instanceof Tn||d instanceof Bl?d:new Tn({body:r,cause:d,url:e})}}}}function fa(e,t={}){const{batch:n,fetchOptions:r,key:o="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:a,retryDelay:u,raw:l}=t;return({chain:f,retryCount:d,timeout:p})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},v=t.retryCount??d,$=p??t.timeout??1e4,y=e||(f==null?void 0:f.rpcUrls.default.http[0]);if(!y)throw new y1;const T=x1(y,{fetchOptions:r,onRequest:c,onResponse:a,timeout:$});return b1({key:o,methods:s,name:i,async request({method:B,params:L}){const _={method:B,params:L},{schedule:F}=Nf({id:y,wait:m,shouldSplitBatch(I){return I.length>h},fn:I=>T.request({body:I}),sort:(I,N)=>I.id-N.id}),g=async I=>n?F(I):[await T.request({body:I})],[{error:w,result:A}]=await g(_);if(l)return{error:w,result:A};if(w)throw new $i({body:_,error:w,url:y});return A},retryCount:v,retryDelay:u,timeout:$,type:"http"},{fetchOptions:r,url:y})}}function da(e,t){var r,o,s,i,c,a;if(!(e instanceof V))return!1;const n=e.walk(u=>u instanceof Ai);return n instanceof Ai?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((o=n.data)==null?void 0:o.errorName)==="ResolverWildcardNotSupported"||((s=n.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=n.data)==null?void 0:i.errorName)==="ResolverError"||((c=n.data)==null?void 0:c.errorName)==="HttpError"||(a=n.reason)!=null&&a.includes("Wildcard on non-extended resolvers is not supported")||t==="reverse"&&n.reason===xl[50]):!1}function E1(e){const{abi:t,data:n}=e,r=nr(n,0,4),o=t.find(s=>s.type==="function"&&r===Dr(ht(s)));if(!o)throw new fg(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?jr(o.inputs,nr(n,4)):void 0}}const pa="/docs/contract/encodeErrorResult";function Lf(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=$n({abi:t,args:r,name:n});if(!a)throw new Du(n,{docsPath:pa});o=a}if(o.type!=="error")throw new Du(void 0,{docsPath:pa});const s=ht(o),i=Dr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new ug(o.name,{docsPath:pa});c=Zt(o.inputs,r)}return tr([i,c])}const ha="/docs/contract/encodeFunctionResult";function S1(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=$n({abi:t,name:n});if(!i)throw new Zn(n,{docsPath:ha});o=i}if(o.type!=="function")throw new Zn(void 0,{docsPath:ha});if(!o.outputs)throw new Uu(o.name,{docsPath:ha});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new zu(r)})();return Zt(o.outputs,s)}const as="x-batch-gateway:true";async function Rf(e){const{data:t,ccipRequest:n}=e,{args:[r]}=E1({abi:na,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(as)?await Rf({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=P1(a)}})),S1({abi:na,functionName:"query",result:[o,s]})}function P1(e){return e.name==="HttpRequestError"&&e.status?Lf({abi:na,errorName:"HttpError",args:[e.status,e.shortMessage]}):Lf({abi:[El],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Df(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return mt(t)?t:null}function cs(e){let t=new Uint8Array(32).fill(0);if(!e)return Te(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=Df(n[r]),s=o?Yn(o):ke(Pn(n[r]),"bytes");t=ke(yt([t,s]),"bytes")}return Te(t)}function A1(e){return`[${e.slice(2)}]`}function $1(e){const t=new Uint8Array(32).fill(0);return e?Df(e)||ke(Pn(e)):Te(t)}function us(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Pn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Pn(o[s]);i.byteLength>255&&(i=Pn(A1($1(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 T1(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return ur({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f=Ct({abi:Af,functionName:"addr",...o!=null?{args:[cs(s),BigInt(o)]}:{args:[cs(s)]}}),d={address:u,abi:Sf,functionName:"resolve",args:[Wt(us(s)),f,i??[as]],blockNumber:n,blockTag:r},h=await ne(e,Qt,"readContract")(d);if(h[0]==="0x")return null;const m=Nn({abi:Af,args:o!=null?[cs(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||Sn(m)==="0x00"?null:m}catch(f){if(c)throw f;if(da(f,"resolve"))return null;throw f}}class C1 extends V{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 ho extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class ma extends V{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 O1 extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const I1=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,N1=/^(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>\/.*)?$/,k1=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,B1=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function M1(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"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Ff(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function jf({uri:e,gatewayUrls:t}){const n=k1.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Ff(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Ff(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(I1),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||N1.test(e);if(e.startsWith("http")&&!l&&!f){let p=e;return t!=null&&t.arweave&&(p=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:p,isOnChain:!1,isEncoded:!1}}if((l||f)&&a)return{uri:`${r}/${l?"ipns":"ipfs"}/${a}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${u||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(B1,"");if(d.startsWith("<svg")&&(d=`data:image/svg+xml;base64,${btoa(d)}`),d.startsWith("data:")||d.startsWith("{"))return{uri:d,isOnChain:!0,isEncoded:!1};throw new ma({uri:e})}function _f(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new C1({data:e});return e.image||e.image_url||e.image_data}async function L1({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await ga({gatewayUrls:e,uri:_f(n)})}catch{throw new ma({uri:t})}}async function ga({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=jf({uri:t,gatewayUrls:e});if(r||await M1(n))return n;throw new ma({uri:t})}function R1(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(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new ho({reason:"Only EIP-155 supported"});if(!i)throw new ho({reason:"Chain ID not found"});if(!a)throw new ho({reason:"Contract address not found"});if(!o)throw new ho({reason:"Token ID not found"});if(!c)throw new ho({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function D1(e,{nft:t}){if(t.namespace==="erc721")return Qt(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 Qt(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 O1({namespace:t.namespace})}async function F1(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?j1(e,{gatewayUrls:t,record:n}):ga({uri:n,gatewayUrls:t})}async function j1(e,{gatewayUrls:t,record:n}){const r=R1(n),o=await D1(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=jf({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=c?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return ga({uri:_f(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),L1({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Uf(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return ur({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f={address:u,abi:Sf,functionName:"resolve",args:[Wt(us(s)),Ct({abi:Pf,functionName:"text",args:[cs(s),o]}),i??[as]],blockNumber:n,blockTag:r},p=await ne(e,Qt,"readContract")(f);if(p[0]==="0x")return null;const h=Nn({abi:Pf,functionName:"text",data:p[0]});return h===""?null:h}catch(f){if(c)throw f;if(da(f,"resolve"))return null;throw f}}async function _1(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await ne(e,Uf,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await F1(e,{record:a,gatewayUrls:r})}catch{return null}}async function U1(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:s,universalResolverAddress:i}){let c=i;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=ur({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:qy,functionName:"reverse",args:[Wt(us(a))],blockNumber:n,blockTag:r},l=ne(e,Qt,"readContract"),[f,d]=o?await l({...u,args:[...u.args,o]}):await l(u);return t.toLowerCase()!==d.toLowerCase()?null:f}catch(u){if(s)throw u;if(da(u,"reverse"))return null;throw u}}async function z1(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 ur({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await ne(e,Qt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Wt(us(o))],blockNumber:n,blockTag:r});return a}async function zf(e,t){var v,$,y;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:d,value:p,...h}=t,m=n?wt(n):void 0;try{co(t);const B=(typeof r=="bigint"?ee(r):void 0)||o,L=(y=($=(v=e.chain)==null?void 0:v.formatters)==null?void 0:$.transactionRequest)==null?void 0:y.format,F=(L||Xo)({...Ri(h,{format:L}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:d,value:p}),g=await e.request({method:"eth_createAccessList",params:[F,B]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch(T){throw Of(T,{...t,account:m,chain:e.chain})}}async function H1(e){const t=Vo(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Hf(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=Vo(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(p=>Fr({abi:[p],eventName:p.name,args:n}))],r&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?ee(s):s,toBlock:typeof c=="bigint"?ee(c):c,...l.length?{topics:l}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:u(f),strict:!!i,toBlock:c,type:"event"}}async function Wf(e){const t=Vo(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function W1(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function V1(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?ee(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}),Ht(s)}async function Vf(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?ee(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class G1 extends V{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 q1(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await ne(e,Qt,"readContract")({abi:Z1,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:u,salt:l},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new G1({address:n}):i}}const Z1=[{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 K1(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 Y1(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?ee(n):void 0,i=await e.request({method:"eth_feeHistory",params:[ee(t),s||r,o]},{dedupe:!!s});return K1(i)}async function X1(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Yt(s));return t.abi?Wi({abi:t.abi,logs:o,strict:n}):o}class Q1 extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${Ur(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class J1 extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Ur(n)}`,`Response: ${Ce(t)}`],name:"OffchainLookupResponseMalformedError"})}}class ew extends V{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 tw="0x556f1830",Gf={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 nw(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=$l({data:r,abi:[Gf]}),[i,c,a,u,l]=s,{ccipRead:f}=e,d=f&&typeof(f==null?void 0:f.request)=="function"?f.request:qf;try{if(!Qo(o,i))throw new ew({sender:i,to:o});const p=c.includes(as)?await Rf({data:a,ccipRequest:d}):await d({data:a,sender:i,urls:c}),{data:h}=await lo(e,{blockNumber:t,blockTag:n,data:yt([u,Zt([{type:"bytes"},{type:"bytes"}],[p,l])]),to:o});return h}catch(p){throw new Q1({callbackSelector:u,cause:p,data:r,extraData:l,sender:i,urls:c})}}async function qf({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],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,u=c==="POST"?{"Content-Type":"application/json"}:{};try{const l=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:u,method:c});let f;if((o=l.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await l.json()).data:f=await l.text(),!l.ok){r=new Tn({body:a,details:f!=null&&f.error?Ce(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!mt(f)){r=new J1({result:f,url:i});continue}return f}catch(l){r=new Tn({body:a,details:l.message,url:i})}}throw r}const rw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:qf,offchainLookup:nw,offchainLookupAbiItem:Gf,offchainLookupSignature:tw},Symbol.toStringTag,{value:"Module"}));function Zf(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class ow extends V{constructor({domain:t}){super(`Invalid domain "${Ce(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class sw extends V{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 iw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function aw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:dw({domain:t}),...e.types};fw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(cw({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Kf({data:n,primaryType:r,types:o})),ke(yt(s))}function cw({domain:e,types:t}){return Kf({data:e,primaryType:"EIP712Domain",types:t})}function Kf({data:e,primaryType:t,types:n}){const r=Yf({data:e,primaryType:t,types:n});return ke(r)}function Yf({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[uw({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Qf({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Zt(r,o)}function uw({primaryType:e,types:t}){const n=Wt(lw({primaryType:e,types:t}));return ke(n)}function lw({primaryType:e,types:t}){let n="";const r=Xf({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:c})=>`${c} ${i}`).join(",")})`;return n}function Xf({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])Xf({primaryType:s.type,types:t},n);return n}function Qf({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},ke(Yf({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},ke(r)];if(n==="string")return[{type:"bytes32"},ke(Wt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Qf({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},ke(Zt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function fw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:u,type:l}=a,f=c[u],d=l.match(ml);if(d&&(typeof f=="number"||typeof f=="bigint")){const[m,v,$]=d;ee(f,{signed:v==="int",size:Number.parseInt($)/8})}if(l==="address"&&typeof f=="string"&&!tt(f))throw new fn({address:f});const p=l.match(tb);if(p){const[m,v]=p;if(v&&xe(f)!==Number.parseInt(v))throw new pg({expectedSize:Number.parseInt(v),givenSize:xe(f)})}const h=o[l];h&&(pw(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new ow({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new sw({primaryType:r,types:o})}function dw({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 pw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new iw({type:e})}const hw=`Ethereum Signed Message:
75
+ `;function mw(e){const t=typeof e=="string"?Mr(e):typeof e.raw=="string"?e.raw:Te(e.raw),n=Mr(`${hw}${xe(t)}`);return yt([n,t])}function Jf(e,t){return ke(mw(e),t)}const ed="0x6492649264926492649264926492649264926492649264926492649264926492";function gw(e){return hl(e,-32)===ed}function bw(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=tr([Zt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),ed]);return o==="hex"?s:bt(s)}class yw extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function ww(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new yw({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,c]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${c}`);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 vw(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function xw(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Ht(e.nonce):void 0,storageProof:e.storageProof?vw(e.storageProof):void 0}}async function Ew(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?ee(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return xw(c)}async function Sw(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?ee(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function ba(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,f,d;const i=r||"latest",c=n!==void 0?ee(n):void 0;let a=null;if(o?a=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?a=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,ee(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,ee(s)]},{dedupe:!!c}),!a)throw new Il({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((d=(f=(l=e.chain)==null?void 0:l.formatters)==null?void 0:f.transaction)==null?void 0:d.format)||zl)(a)}async function Pw(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([ne(e,po,"getBlockNumber")({}),t?ne(e,ba,"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 ls(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Nl({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||d1)(n)}async function Aw(e,t){var $;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof(($=e.batch)==null?void 0:$.multicall)=="object"&&e.batch.multicall.batchSize||1024);let f=c;if(!f){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");f=ur({blockNumber:s,chain:e.chain,contract:"multicall3"})}const d=[[]];let p=0,h=0;for(let y=0;y<u.length;y++){const{abi:T,address:B,args:L,functionName:_}=u[y];try{const F=Ct({abi:T,args:L,functionName:_});h+=(F.length-2)/2,l>0&&h>l&&d[p].length>0&&(p++,h=(F.length-2)/2,d[p]=[]),d[p]=[...d[p],{allowFailure:!0,callData:F,target:B}]}catch(F){const g=ir(F,{abi:T,address:B,args:L,docsPath:"/docs/contract/multicall",functionName:_,sender:n});if(!r)throw g;d[p]=[...d[p],{allowFailure:!0,callData:"0x",target:B}]}}const m=await Promise.allSettled(d.map(y=>ne(e,Qt,"readContract")({abi:ta,account:n,address:f,args:[y],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),v=[];for(let y=0;y<m.length;y++){const T=m[y];if(T.status==="rejected"){if(!r)throw T.reason;for(let L=0;L<d[y].length;L++)v.push({status:"failure",error:T.reason,result:void 0});continue}const B=T.value;for(let L=0;L<B.length;L++){const{returnData:_,success:F}=B[L],{callData:g}=d[y][L],{abi:w,address:A,functionName:I,args:N}=u[v.length];try{if(g==="0x")throw new kr;if(!F)throw new qo({data:_});const P=Nn({abi:w,args:N,data:_,functionName:I});v.push(r?{result:P,status:"success"}:P)}catch(P){const S=ir(P,{abi:w,address:A,args:N,docsPath:"/docs/contract/multicall",functionName:I});if(!r)throw S;v.push({error:S,result:void 0,status:"failure"})}}}if(v.length!==u.length)throw new V("multicall results mismatch");return v}async function ya(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const d of o){const p=d.blockOverrides?xf(d.blockOverrides):void 0,h=d.calls.map(v=>{const $=v,y=$.account?wt($.account):void 0,T=$.abi?Ct($):$.data,B={...$,data:$.dataSuffix?yt([T||"0x",$.dataSuffix]):T,from:$.from??(y==null?void 0:y.address)};return co(B),Xo(B)}),m=d.stateOverrides?Di(d.stateOverrides):void 0;a.push({blockOverrides:p,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?ee(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((d,p)=>({...Hl(d),calls:d.calls.map((h,m)=>{var A,I;const{abi:v,args:$,functionName:y,to:T}=o[p].calls[m],B=((A=h.error)==null?void 0:A.data)??h.returnData,L=BigInt(h.gasUsed),_=(I=h.logs)==null?void 0:I.map(N=>Yt(N)),F=h.status==="0x1"?"success":"failure",g=v&&F==="success"&&B!=="0x"?Nn({abi:v,data:B,functionName:y}):null,w=(()=>{var P;if(F==="success")return;let N;if(((P=h.error)==null?void 0:P.data)==="0x"?N=new kr:h.error&&(N=new qo(h.error)),!!N)return ir(N,{abi:v??[],address:T??"0x",args:$,functionName:y??"<unknown>"})})();return{data:B,gasUsed:L,logs:_,status:F,...F==="success"?{result:g}:{error:w}}})}))}catch(a){const u=a,l=Li(u,{});throw l instanceof Yo?u:l}}function td(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=ul(By(e));return n==="Bytes"?r:gf(r)}class $w 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 wa={checksum:new $w(8192)}.checksum,Tw=/^0x[a-fA-F0-9]{40}$/;function fs(e,t={}){const{strict:n=!0}=t;if(!Tw.test(e))throw new nd({address:e,cause:new Ow});if(n){if(e.toLowerCase()===e)return;if(Cw(e)!==e)throw new nd({address:e,cause:new Iw})}}function Cw(e){if(wa.has(e))return wa.get(e);fs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=td(Ry(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 wa.set(e,o),o}function va(e,t={}){const{strict:n=!0}=t??{};try{return fs(e,{strict:n}),!0}catch{return!1}}class nd extends be{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 Ow extends be{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 Iw extends be{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function xa(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new be("Unable to normalize signature.");return o}function Ea(e,t){const n=typeof e,r=t.type;switch(r){case"address":return va(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)=>Ea(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=>Ea(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function rd(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 rd(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")?va(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?va(n[r],{strict:!1}):!1)return i}}function od(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?ku(e):e;return{...r,...n?{hash:lr(r)}:{}}}function Nw(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Hy(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?sd(u)===ea(t,0,4):u.type==="event"?lr(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new Sa({name:t});if(i.length===1)return{...i[0],...o?{hash:lr(i[0])}:{}};let c;for(const u of i){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:lr(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,d)=>{const p="inputs"in u&&u.inputs[d];return p?Ea(f,p):!1})){if(c&&"inputs"in c&&c.inputs){const f=rd(u.inputs,c.inputs,r);if(f)throw new Bw({abiItem:u,type:f[0]},{abiItem:c,type:f[1]})}c=u}}const a=(()=>{if(c)return c;const[u,...l]=i;return{...u,overloads:l}})();if(!a)throw new Sa({name:t});return{...a,...o?{hash:lr(a)}:{}}}function sd(e){return ea(lr(e),0,4)}function kw(e){const t=typeof e=="string"?e:Ro(e);return xa(t)}function lr(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:td(Ji(kw(e)))}class Bw extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${xa(Ro(t.abiItem))}\`, and`,`\`${n.type}\` in \`${xa(Ro(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 Sa extends be{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"})}}const Mw=/^(.*)\[([0-9]*)\]$/,Lw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,id=/^(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 Rw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Pa({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Pa({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Ww(r.type);if(o){const[s,i]=o;return Fw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Hw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Dw(n,{checksum:e});if(r.type==="bool")return _w(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=id.exec(r.type)??[];return Uw(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return jw(n,{type:r.type});if(r.type==="string")return zw(n);throw new ld(r.type)}function Aa(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=nt(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Le(t+o,{size:32})),r.push(c),o+=nt(c)):n.push(c)}return It(...n,...r)}function Dw(e,t){const{checksum:n=!1}=t;return fs(e,{strict:n}),{dynamic:!1,encoded:Bn(e.toLowerCase())}}function Fw(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new Gw(e);if(!s&&e.length!==r)throw new Vw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=Pa({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=Aa(c);if(s){const u=Le(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?It(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:It(...c.map(({encoded:a})=>a))}}function jw(e,{type:t}){const[,n]=t.split("bytes"),r=nt(e);if(!n){let o=e;return r%32!==0&&(o=Mn(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:It(Bn(Le(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new cd({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Mn(e)}}function _w(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Bn(mf(e))}}function Uw(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 bf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Le(e,{size:32,signed:t})}}function zw(e){const t=Ji(e),n=Math.ceil(nt(t)/32),r=[];for(let o=0;o<n;o++)r.push(Mn(ea(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:It(Mn(Le(nt(t),{size:32})),...r)}}function Hw(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,u=Pa({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Aa(s):It(...s.map(({encoded:i})=>i))}}function Ww(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function ad(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new ud({expectedLength:e.length,givenLength:t.length});const o=Rw({checksumAddress:r,parameters:e,values:t}),s=Aa(o);return s.length===0?"0x":s}function $a(e,t){if(e.length!==t.length)throw new ud({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($a.encode(o,s))}return It(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return fs(a),Bn(a.toLowerCase(),o?32:0)}if(n==="string")return Ji(r);if(n==="bytes")return r;if(n==="bool")return Bn(mf(r),o?32:1);const s=n.match(id);if(s){const[a,u,l="256"]=s,f=Number.parseInt(l)/8;return Le(r,{size:o?32:f,signed:u==="int"})}const i=n.match(Lw);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new cd({expectedSize:Number.parseInt(u),value:r});return Mn(r,o?32:0)}const c=n.match(Mw);if(c&&Array.isArray(r)){const[a,u]=c,l=[];for(let f=0;f<r.length;f++)l.push(t(u,r[f],!0));return l.length===0?"0x":It(...l)}throw new ld(n)}e.encode=t})($a||($a={}));class Vw extends be{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 cd extends be{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${nt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class ud extends be{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
76
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Gw extends be{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class ld extends be{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function qw(e,t){var o;const{bytecode:n,args:r}=t;return It(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?ad(e.inputs,r):"0x")}function Zw(e){return od(e)}function Kw(e,...t){const{overloads:n}=e,r=n?Yw([e,...n],e.name,{args:t[0]}):e,o=Xw(r),s=t.length>0?ad(r.inputs,t[0]):void 0;return s?It(o,s):o}function fr(e,t={}){return od(e,t)}function Yw(e,t,n){const r=Nw(e,t,n);if(r.type!=="function")throw new Sa({name:t,type:"function"});return r}function Xw(e){return sd(e)}const Qw="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Nt="0x0000000000000000000000000000000000000000",Jw="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function ev(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?wt(t.account):void 0;if(i&&!u)throw new V("`account` is required when `traceAssetChanges` is true");const l=u?qw(Zw("constructor(bytes, bytes)"),{bytecode:Tf,args:[Jw,Kw(fr("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async b=>{if(!b.data&&!b.abi)return;const{accessList:k}=await zf(e,{account:u.address,...b,data:b.abi?Ct(b):b.data});return k.map(({address:D,storageKeys:j})=>j.length>0?D:null)})).then(b=>b.flat().filter(Boolean)):[],d=await ya(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((b,k)=>({abi:[fr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:Nt,nonce:k})),stateOverrides:[{address:Nt,nonce:0}]}]:[],{calls:[...o,{}].map(b=>({...b,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((b,k)=>({abi:[fr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:Nt,nonce:k})),stateOverrides:[{address:Nt,nonce:0}]},{calls:f.map((b,k)=>({to:b,abi:[fr("function decimals() returns (uint256)")],functionName:"decimals",from:Nt,nonce:k})),stateOverrides:[{address:Nt,nonce:0}]},{calls:f.map((b,k)=>({to:b,abi:[fr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Nt,nonce:k})),stateOverrides:[{address:Nt,nonce:0}]},{calls:f.map((b,k)=>({to:b,abi:[fr("function symbol() returns (string)")],functionName:"symbol",from:Nt,nonce:k})),stateOverrides:[{address:Nt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),p=i?d[2]:d[0],[h,m,,v,$,y,T,B]=i?d:[],{calls:L,..._}=p,F=L.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],w=(m==null?void 0:m.calls)??[],A=[...g,...w].map(b=>b.status==="success"?$t(b.data):null),I=(v==null?void 0:v.calls)??[],N=($==null?void 0:$.calls)??[],P=[...I,...N].map(b=>b.status==="success"?$t(b.data):null),S=((y==null?void 0:y.calls)??[]).map(b=>b.status==="success"?b.result:null),E=((B==null?void 0:B.calls)??[]).map(b=>b.status==="success"?b.result:null),C=((T==null?void 0:T.calls)??[]).map(b=>b.status==="success"?b.result:null),O=[];for(const[b,k]of P.entries()){const D=A[b];if(typeof k!="bigint"||typeof D!="bigint")continue;const j=S[b-1],z=E[b-1],W=C[b-1],K=b===0?{address:Qw,decimals:18,symbol:"ETH"}:{address:f[b-1],decimals:W||j?Number(j??1):void 0,symbol:z??void 0};O.some(H=>H.token.address===K.address)||O.push({token:K,value:{pre:D,post:k,diff:k-D}})}return{assetChanges:O,block:_,results:F}}class fd extends pi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Yu(t);const r=zo(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),Jn(s)}update(t){return Qn(this),this.iHash.update(t),this}digestInto(t){Qn(this),Gt(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:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,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 dd=(e,t,n)=>new fd(e,t).update(n).digest();dd.create=(e,t)=>new fd(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ze=BigInt(0),Re=BigInt(1),Ln=BigInt(2),pd=BigInt(3),hd=BigInt(4),md=BigInt(5),tv=BigInt(7),gd=BigInt(8),nv=BigInt(9),bd=BigInt(16);function xt(e,t){const n=e%t;return n>=ze?n:t+n}function rt(e,t,n){let r=e;for(;t-- >ze;)r*=r,r%=n;return r}function yd(e,t){if(e===ze)throw new Error("invert: expected non-zero number");if(t<=ze)throw new Error("invert: expected positive modulus, got "+t);let n=xt(e,t),r=t,o=ze,s=Re;for(;n!==ze;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Re)throw new Error("invert: does not exist");return xt(o,t)}function Ta(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function wd(e,t){const n=(e.ORDER+Re)/hd,r=e.pow(t,n);return Ta(e,r,t),r}function rv(e,t){const n=(e.ORDER-md)/gd,r=e.mul(t,Ln),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Ln),o),c=e.mul(s,e.sub(i,e.ONE));return Ta(e,c,t),c}function ov(e){const t=mo(e),n=vd(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+tv)/bd;return(c,a)=>{let u=c.pow(a,i),l=c.mul(u,r);const f=c.mul(u,o),d=c.mul(u,s),p=c.eql(c.sqr(l),a),h=c.eql(c.sqr(f),a);u=c.cmov(u,l,p),l=c.cmov(d,f,h);const m=c.eql(c.sqr(l),a),v=c.cmov(u,l,m);return Ta(c,v,a),v}}function vd(e){if(e<pd)throw new Error("sqrt is not defined for small field");let t=e-Re,n=0;for(;t%Ln===ze;)t/=Ln,n++;let r=Ln;const o=mo(e);for(;Ed(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return wd;let s=o.pow(r,t);const i=(t+Re)/Ln;return function(a,u){if(a.is0(u))return u;if(Ed(a,u)!==1)throw new Error("Cannot find square root");let l=n,f=a.mul(a.ONE,s),d=a.pow(u,t),p=a.pow(u,i);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let h=1,m=a.sqr(d);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===l)throw new Error("Cannot find square root");const v=Re<<BigInt(l-h-1),$=a.pow(f,v);l=h,f=a.sqr($),d=a.mul(d,f),p=a.mul(p,$)}return p}}function sv(e){return e%hd===pd?wd:e%gd===md?rv:e%bd===nv?ov(e):vd(e)}const iv=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function av(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=iv.reduce((r,o)=>(r[o]="function",r),t);return Xi(e,n),e}function cv(e,t,n){if(n<ze)throw new Error("invalid exponent, negatives unsupported");if(n===ze)return e.ONE;if(n===Re)return t;let r=e.ONE,o=t;for(;n>ze;)n&Re&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Re;return r}function xd(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,a)=>e.is0(c)?i:(r[a]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,a)=>e.is0(c)?i:(r[a]=e.mul(i,r[a]),e.mul(i,c)),s),r}function Ed(e,t){const n=(e.ORDER-Re)/Ln,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 Sd(e,t){t!==void 0&&Lr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function mo(e,t,n=!1,r={}){if(e<=ze)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,i=!1,c;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const d=t;d.BITS&&(o=d.BITS),d.sqrt&&(s=d.sqrt),typeof d.isLE=="boolean"&&(n=d.isLE),typeof d.modFromBytes=="boolean"&&(i=d.modFromBytes),c=d.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:u}=Sd(e,o);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const f=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:u,MASK:uo(a),ZERO:ze,ONE:Re,allowedLengths:c,create:d=>xt(d,e),isValid:d=>{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return ze<=d&&d<e},is0:d=>d===ze,isValidNot0:d=>!f.is0(d)&&f.isValid(d),isOdd:d=>(d&Re)===Re,neg:d=>xt(-d,e),eql:(d,p)=>d===p,sqr:d=>xt(d*d,e),add:(d,p)=>xt(d+p,e),sub:(d,p)=>xt(d-p,e),mul:(d,p)=>xt(d*p,e),pow:(d,p)=>cv(f,d,p),div:(d,p)=>xt(d*yd(p,e),e),sqrN:d=>d*d,addN:(d,p)=>d+p,subN:(d,p)=>d-p,mulN:(d,p)=>d*p,inv:d=>yd(d,e),sqrt:s||(d=>(l||(l=sv(e)),l(f,d))),toBytes:d=>n?cf(d,u):Ki(d,u),fromBytes:(d,p=!0)=>{if(c){if(!c.includes(d.length)||d.length>u)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+d.length);const m=new Uint8Array(u);m.set(d,n?0:m.length-d.length),d=m}if(d.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+d.length);let h=n?af(d):ts(d);if(i&&(h=xt(h,e)),!p&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:d=>xd(f,d),cmov:(d,p,h)=>h?p:d});return Object.freeze(f)}function Pd(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 Ad(e){const t=Pd(e);return t+Math.ceil(t/2)}function uv(e,t,n=!1){const r=e.length,o=Pd(t),s=Ad(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?af(e):ts(e),c=xt(i,t-Re)+Re;return n?cf(c,o):Ki(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const dr=BigInt(0),Rn=BigInt(1);function ds(e,t){const n=t.negate();return e?n:t}function Ca(e,t){const n=xd(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function $d(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Oa(e,t){$d(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=uo(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Td(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=Rn);const u=t*r,l=u+Math.abs(c)-1,f=c===0,d=c<0,p=t%2!==0;return{nextN:a,offset:l,isZero:f,isNeg:d,isNegF:p,offsetF:u}}function lv(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 fv(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 Ia=new WeakMap,Cd=new WeakMap;function Na(e){return Cd.get(e)||1}function Od(e){if(e!==dr)throw new Error("invalid wNAF")}class dv{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>dr;)n&Rn&&(r=r.add(o)),o=o.double(),n>>=Rn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Oa(n,this.bits),s=[];let i=t,c=i;for(let a=0;a<r;a++){c=i,s.push(c);for(let u=1;u<o;u++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE;const i=Oa(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:f,isNegF:d,offsetF:p}=Td(r,c,i);r=a,l?s=s.add(ds(d,n[p])):o=o.add(ds(f,n[u]))}return Od(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Oa(t,this.bits);for(let i=0;i<s.windows&&r!==dr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=Td(r,i,s);if(r=c,!u){const f=n[a];o=o.add(l?f.negate():f)}}return Od(r),o}getPrecomputes(t,n,r){let o=Ia.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Ia.set(n,o))),o}cached(t,n,r){const o=Na(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Na(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){$d(n,this.bits),Cd.set(t,n),Ia.delete(t)}hasCache(t){return Na(t)!==1}}function pv(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>dr||r>dr;)n&Rn&&(s=s.add(o)),r&Rn&&(i=i.add(o)),o=o.double(),n>>=Rn,r>>=Rn;return{p1:s,p2:i}}function hv(e,t,n,r){lv(n,e),fv(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,c=uf(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=uo(a),l=new Array(Number(u)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let d=i;for(let p=f;p>=0;p-=a){l.fill(i);for(let m=0;m<s;m++){const v=r[m],$=Number(v>>BigInt(p)&u);l[$]=l[$].add(n[m])}let h=i;for(let m=l.length-1,v=i;m>0;m--)v=v.add(l[m]),h=h.add(v);if(d=d.add(h),p!==0)for(let m=0;m<a;m++)d=d.double()}return d}function Id(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return av(t),t}else return mo(e,{isLE:n})}function mv(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const a of["p","n","h"]){const u=t[a];if(!(typeof u=="bigint"&&u>dr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=Id(t.p,n.Fp,r),s=Id(t.n,n.Fn,r),c=["Gx","Gy","a","b"];for(const a of c)if(!o.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Nd=(e,t)=>(e+(e>=0?t:-t)/kd)/t;function gv(e,t,n){const[[r,o],[s,i]]=t,c=Nd(i*e,n),a=Nd(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const f=u<en,d=l<en;f&&(u=-u),d&&(l=-l);const p=uo(Math.ceil(uf(n)/2))+pr;if(u<en||u>=p||l<en||l>=p)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:d,k2:l}}function ka(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Ba(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Jo(n.lowS,"lowS"),Jo(n.prehash,"prehash"),n.format!==void 0&&ka(n.format),n}class bv extends Error{constructor(t=""){super(t)}}const Jt={Err:bv,_tlv:{encode:(e,t)=>{const{Err:n}=Jt;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=es(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?es(o.length/2|128):"";return es(e)+s+o+t},decode(e,t){const{Err:n}=Jt;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 u=t.subarray(r,r+a);if(u.length!==a)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const l of u)i=i<<8|l;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=Jt;if(e<en)throw new t("integer: negative integers are not allowed");let n=es(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}=Jt;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 ts(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Jt,o=Ue("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:u,l}=r.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=Jt,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},en=BigInt(0),pr=BigInt(1),kd=BigInt(2),ps=BigInt(3),yv=BigInt(4);function hr(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=Ue("private key",t);try{r=e.fromBytes(o)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function wv(e,t={}){const n=mv("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;Xi(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:a}=t;if(a&&(!r.is0(s.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=Md(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(N,P,S){const{x:E,y:C}=P.toAffine(),O=r.toBytes(E);if(Jo(S,"isCompressed"),S){l();const b=!r.isOdd(C);return ln(Bd(b),O)}else return ln(Uint8Array.of(4),O,r.toBytes(C))}function d(N){kn(N,void 0,"Point");const{publicKey:P,publicKeyUncompressed:S}=u,E=N.length,C=N[0],O=N.subarray(1);if(E===P&&(C===2||C===3)){const b=r.fromBytes(O);if(!r.isValid(b))throw new Error("bad point: is not on curve, wrong x");const k=m(b);let D;try{D=r.sqrt(k)}catch(W){const K=W instanceof Error?": "+W.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}l();const j=r.isOdd(D);return(C&1)===1!==j&&(D=r.neg(D)),{x:b,y:D}}else if(E===S&&C===4){const b=r.BYTES,k=r.fromBytes(O.subarray(0,b)),D=r.fromBytes(O.subarray(b,b*2));if(!v(k,D))throw new Error("bad point: is not on curve");return{x:k,y:D}}else throw new Error(`bad point: got length ${E}, expected compressed=${P} or uncompressed=${S}`)}const p=t.toBytes||f,h=t.fromBytes||d;function m(N){const P=r.sqr(N),S=r.mul(P,N);return r.add(r.add(S,r.mul(N,s.a)),s.b)}function v(N,P){const S=r.sqr(P),E=m(N);return r.eql(S,E)}if(!v(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const $=r.mul(r.pow(s.a,ps),yv),y=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add($,y)))throw new Error("bad curve params: a or b");function T(N,P,S=!1){if(!r.isValid(P)||S&&r.is0(P))throw new Error(`bad point coordinate ${N}`);return P}function B(N){if(!(N instanceof w))throw new Error("ProjectivePoint expected")}function L(N){if(!a||!a.basises)throw new Error("no endo");return gv(N,a.basises,o.ORDER)}const _=lf((N,P)=>{const{X:S,Y:E,Z:C}=N;if(r.eql(C,r.ONE))return{x:S,y:E};const O=N.is0();P==null&&(P=O?r.ONE:r.inv(C));const b=r.mul(S,P),k=r.mul(E,P),D=r.mul(C,P);if(O)return{x:r.ZERO,y:r.ZERO};if(!r.eql(D,r.ONE))throw new Error("invZ was invalid");return{x:b,y:k}}),F=lf(N=>{if(N.is0()){if(t.allowInfinityPoint&&!r.is0(N.Y))return;throw new Error("bad point: ZERO")}const{x:P,y:S}=N.toAffine();if(!r.isValid(P)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!v(P,S))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function g(N,P,S,E,C){return S=new w(r.mul(S.X,N),S.Y,S.Z),P=ds(E,P),S=ds(C,S),P.add(S)}class w{constructor(P,S,E){this.X=T("x",P),this.Y=T("y",S,!0),this.Z=T("z",E),Object.freeze(this)}static CURVE(){return s}static fromAffine(P){const{x:S,y:E}=P||{};if(!P||!r.isValid(S)||!r.isValid(E))throw new Error("invalid affine point");if(P instanceof w)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(E)?w.ZERO:new w(S,E,r.ONE)}static fromBytes(P){const S=w.fromAffine(h(kn(P,void 0,"point")));return S.assertValidity(),S}static fromHex(P){return w.fromBytes(Ue("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,S=!0){return I.createCache(this,P),S||this.multiply(ps),this}assertValidity(){F(this)}hasEvenY(){const{y:P}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(P)}equals(P){B(P);const{X:S,Y:E,Z:C}=this,{X:O,Y:b,Z:k}=P,D=r.eql(r.mul(S,k),r.mul(O,C)),j=r.eql(r.mul(E,k),r.mul(b,C));return D&&j}negate(){return new w(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:S}=s,E=r.mul(S,ps),{X:C,Y:O,Z:b}=this;let k=r.ZERO,D=r.ZERO,j=r.ZERO,z=r.mul(C,C),W=r.mul(O,O),K=r.mul(b,b),H=r.mul(C,O);return H=r.add(H,H),j=r.mul(C,b),j=r.add(j,j),k=r.mul(P,j),D=r.mul(E,K),D=r.add(k,D),k=r.sub(W,D),D=r.add(W,D),D=r.mul(k,D),k=r.mul(H,k),j=r.mul(E,j),K=r.mul(P,K),H=r.sub(z,K),H=r.mul(P,H),H=r.add(H,j),j=r.add(z,z),z=r.add(j,z),z=r.add(z,K),z=r.mul(z,H),D=r.add(D,z),K=r.mul(O,b),K=r.add(K,K),z=r.mul(K,H),k=r.sub(k,z),j=r.mul(K,W),j=r.add(j,j),j=r.add(j,j),new w(k,D,j)}add(P){B(P);const{X:S,Y:E,Z:C}=this,{X:O,Y:b,Z:k}=P;let D=r.ZERO,j=r.ZERO,z=r.ZERO;const W=s.a,K=r.mul(s.b,ps);let H=r.mul(S,O),Z=r.mul(E,b),q=r.mul(C,k),J=r.add(S,E),te=r.add(O,b);J=r.mul(J,te),te=r.add(H,Z),J=r.sub(J,te),te=r.add(S,C);let pe=r.add(O,k);return te=r.mul(te,pe),pe=r.add(H,q),te=r.sub(te,pe),pe=r.add(E,C),D=r.add(b,k),pe=r.mul(pe,D),D=r.add(Z,q),pe=r.sub(pe,D),z=r.mul(W,te),D=r.mul(K,q),z=r.add(D,z),D=r.sub(Z,z),z=r.add(Z,z),j=r.mul(D,z),Z=r.add(H,H),Z=r.add(Z,H),q=r.mul(W,q),te=r.mul(K,te),Z=r.add(Z,q),q=r.sub(H,q),q=r.mul(W,q),te=r.add(te,q),H=r.mul(Z,te),j=r.add(j,H),H=r.mul(pe,te),D=r.mul(J,D),D=r.sub(D,H),H=r.mul(J,Z),z=r.mul(pe,z),z=r.add(z,H),new w(D,j,z)}subtract(P){return this.add(P.negate())}is0(){return this.equals(w.ZERO)}multiply(P){const{endo:S}=t;if(!o.isValidNot0(P))throw new Error("invalid scalar: out of range");let E,C;const O=b=>I.cached(this,b,k=>Ca(w,k));if(S){const{k1neg:b,k1:k,k2neg:D,k2:j}=L(P),{p:z,f:W}=O(k),{p:K,f:H}=O(j);C=W.add(H),E=g(S.beta,z,K,b,D)}else{const{p:b,f:k}=O(P);E=b,C=k}return Ca(w,[E,C])[0]}multiplyUnsafe(P){const{endo:S}=t,E=this;if(!o.isValid(P))throw new Error("invalid scalar: out of range");if(P===en||E.is0())return w.ZERO;if(P===pr)return E;if(I.hasCache(this))return this.multiply(P);if(S){const{k1neg:C,k1:O,k2neg:b,k2:k}=L(P),{p1:D,p2:j}=pv(w,E,O,k);return g(S.beta,D,j,C,b)}else return I.unsafe(E,P)}multiplyAndAddUnsafe(P,S,E){const C=this.multiplyUnsafe(S).add(P.multiplyUnsafe(E));return C.is0()?void 0:C}toAffine(P){return _(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return i===pr?!0:P?P(w,this):I.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:P}=t;return i===pr?this:P?P(w,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(P=!0){return Jo(P,"isCompressed"),this.assertValidity(),p(w,this,P)}toHex(P=!0){return er(this.toBytes(P))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(P=!0){return this.toBytes(P)}_setWindowSize(P){this.precompute(P)}static normalizeZ(P){return Ca(w,P)}static msm(P,S){return hv(w,o,P,S)}static fromPrivateKey(P){return w.BASE.multiply(hr(o,P))}}w.BASE=new w(s.Gx,s.Gy,r.ONE),w.ZERO=new w(r.ZERO,r.ONE,r.ZERO),w.Fp=r,w.Fn=o;const A=o.BITS,I=new dv(w,t.endo?Math.ceil(A/2):A);return w.BASE.precompute(8),w}function Bd(e){return Uint8Array.of(e?2:3)}function Md(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function vv(e,t={}){const{Fn:n}=e,r=t.randomBytes||nl,o=Object.assign(Md(e.Fp,n),{seed:Ad(n.ORDER)});function s(p){try{return!!hr(n,p)}catch{return!1}}function i(p,h){const{publicKey:m,publicKeyUncompressed:v}=o;try{const $=p.length;return h===!0&&$!==m||h===!1&&$!==v?!1:!!e.fromBytes(p)}catch{return!1}}function c(p=r(o.seed)){return uv(kn(p,o.seed,"seed"),n.ORDER)}function a(p,h=!0){return e.BASE.multiply(hr(n,p)).toBytes(h)}function u(p){const h=c(p);return{secretKey:h,publicKey:a(h)}}function l(p){if(typeof p=="bigint")return!1;if(p instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:v}=o;if(n.allowedLengths||h===m)return;const $=Ue("key",p).length;return $===m||$===v}function f(p,h,m=!0){if(l(p)===!0)throw new Error("first arg must be private key");if(l(h)===!1)throw new Error("second arg must be public key");const v=hr(n,p);return e.fromHex(h).multiply(v).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:f,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:p=>hr(n,p),precompute(p=8,h=e.BASE){return h.precompute(p,!1)}},lengths:o})}function xv(e,t,n={}){Yu(t),Xi(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||nl,o=n.hmac||((S,...E)=>dd(t,S,ln(...E))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:f,utils:d,lengths:p}=vv(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function v(S){const E=c>>pr;return S>E}function $(S,E){if(!i.isValidNot0(E))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return E}function y(S,E){ka(E);const C=p.signature,O=E==="compact"?C:E==="recovered"?C+1:void 0;return kn(S,O,`${E} signature`)}class T{constructor(E,C,O){this.r=$("r",E),this.s=$("s",C),O!=null&&(this.recovery=O),Object.freeze(this)}static fromBytes(E,C=m){y(E,C);let O;if(C==="der"){const{r:j,s:z}=Jt.toSig(kn(E));return new T(j,z)}C==="recovered"&&(O=E[0],C="compact",E=E.subarray(1));const b=i.BYTES,k=E.subarray(0,b),D=E.subarray(b,b*2);return new T(i.fromBytes(k),i.fromBytes(D),O)}static fromHex(E,C){return this.fromBytes(Uo(E),C)}addRecoveryBit(E){return new T(this.r,this.s,E)}recoverPublicKey(E){const C=s.ORDER,{r:O,s:b,recovery:k}=this;if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");if(c*kd<C&&k>1)throw new Error("recovery id is ambiguous for h>1 curve");const j=k===2||k===3?O+c:O;if(!s.isValid(j))throw new Error("recovery id 2 or 3 invalid");const z=s.toBytes(j),W=e.fromBytes(ln(Bd((k&1)===0),z)),K=i.inv(j),H=L(Ue("msgHash",E)),Z=i.create(-H*K),q=i.create(b*K),J=e.BASE.multiplyUnsafe(Z).add(W.multiplyUnsafe(q));if(J.is0())throw new Error("point at infinify");return J.assertValidity(),J}hasHighS(){return v(this.s)}toBytes(E=m){if(ka(E),E==="der")return Uo(Jt.hexFromSig(this));const C=i.toBytes(this.r),O=i.toBytes(this.s);if(E==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return ln(Uint8Array.of(this.recovery),C,O)}return ln(C,O)}toHex(E){return er(this.toBytes(E))}assertValidity(){}static fromCompact(E){return T.fromBytes(Ue("sig",E),"compact")}static fromDER(E){return T.fromBytes(Ue("sig",E),"der")}normalizeS(){return this.hasHighS()?new T(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return er(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return er(this.toBytes("compact"))}}const B=n.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");const C=ts(E),O=E.length*8-a;return O>0?C>>BigInt(O):C},L=n.bits2int_modN||function(E){return i.create(B(E))},_=uo(a);function F(S){return Ey("num < 2^"+a,S,en,_),i.toBytes(S)}function g(S,E){return kn(S,void 0,"message"),E?kn(t(S),void 0,"prehashed message"):S}function w(S,E,C){if(["recovered","canonical"].some(Z=>Z in C))throw new Error("sign() legacy options not supported");const{lowS:O,prehash:b,extraEntropy:k}=Ba(C,h);S=g(S,b);const D=L(S),j=hr(i,E),z=[F(j),F(D)];if(k!=null&&k!==!1){const Z=k===!0?r(p.secretKey):k;z.push(Ue("extraEntropy",Z))}const W=ln(...z),K=D;function H(Z){const q=B(Z);if(!i.isValidNot0(q))return;const J=i.inv(q),te=e.BASE.multiply(q).toAffine(),pe=i.create(te.x);if(pe===en)return;const Ee=i.create(J*i.create(K+pe*j));if(Ee===en)return;let X=(te.x===pe?0:2)|Number(te.y&pr),Q=Ee;return O&&v(Ee)&&(Q=i.neg(Ee),X^=1),new T(pe,Q,X)}return{seed:W,k2sig:H}}function A(S,E,C={}){S=Ue("message",S);const{seed:O,k2sig:b}=w(S,E,C);return Sy(t.outputLen,i.BYTES,o)(O,b)}function I(S){let E;const C=typeof S=="string"||_o(S),O=!C&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!C&&!O)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(O)E=new T(S.r,S.s);else if(C){try{E=T.fromBytes(Ue("sig",S),"der")}catch(b){if(!(b instanceof Jt.Err))throw b}if(!E)try{E=T.fromBytes(Ue("sig",S),"compact")}catch{return!1}}return E||!1}function N(S,E,C,O={}){const{lowS:b,prehash:k,format:D}=Ba(O,h);if(C=Ue("publicKey",C),E=g(Ue("message",E),k),"strict"in O)throw new Error("options.strict was renamed to lowS");const j=D===void 0?I(S):T.fromBytes(Ue("sig",S),D);if(j===!1)return!1;try{const z=e.fromBytes(C);if(b&&j.hasHighS())return!1;const{r:W,s:K}=j,H=L(E),Z=i.inv(K),q=i.create(H*Z),J=i.create(W*Z),te=e.BASE.multiplyUnsafe(q).add(z.multiplyUnsafe(J));return te.is0()?!1:i.create(te.x)===W}catch{return!1}}function P(S,E,C={}){const{prehash:O}=Ba(C,h);return E=g(E,O),T.fromBytes(S,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:f,utils:d,lengths:p,Point:e,sign:A,verify:N,recoverPublicKey:P,Signature:T,hash:t})}function Ev(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const o=mo(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:o,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function Sv(e){const{CURVE:t,curveOpts:n}=Ev(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function Pv(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,Sd(n.Fn.ORDER,n.Fn.BITS))})}function Av(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=Sv(e),s=wv(t,n),i=xv(s,r,o);return Pv(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $v(e,t){const n=r=>Av({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ma={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Tv={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Ld=BigInt(2);function Cv(e){const t=Ma.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=rt(l,n,t)*l%t,d=rt(f,n,t)*l%t,p=rt(d,Ld,t)*u%t,h=rt(p,o,t)*p%t,m=rt(h,s,t)*h%t,v=rt(m,c,t)*m%t,$=rt(v,a,t)*v%t,y=rt($,c,t)*m%t,T=rt(y,n,t)*l%t,B=rt(T,i,t)*h%t,L=rt(B,r,t)*u%t,_=rt(L,Ld,t);if(!La.eql(La.sqr(_),e))throw new Error("Cannot find square root");return _}const La=mo(Ma.p,{sqrt:Cv}),Rd=$v({...Ma,Fp:La,lowS:!0,endo:Tv},Zl),Ov=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Rd},Symbol.toStringTag,{value:"Module"}));function Iv({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 Rd.Signature($t(e),$t(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:bt(i)}async function Ra(e,t){var f,d,p;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(p=(d=(f=e.chain)==null?void 0:f.contracts)==null?void 0:d.universalSignatureVerifier)==null?void 0:p.address,...a}=t,u=mt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?Iv(i):Te(i),l=await(async()=>!r&&!o||gw(u)?u:bw({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Ct({abi:$f,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:sa({abi:$f,args:[n,s,l],bytecode:Yy}),...a},{data:m}=await ne(e,lo,"call")(h);return Eg(m??"0x0")}catch(h){try{if(Qo(An(n),await Ll({hash:s,signature:i})))return!0}catch{}if(h instanceof kl)return!1;throw h}}async function Nv(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Jf(n);return Ra(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function kv(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=aw({message:i,primaryType:c,types:a,domain:u});return Ra(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function Dd(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=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 c?(()=>{const f=Ce(["watchBlockNumber",e.uid,t,n,i]);return hn(f,{onBlockNumber:r,onError:o},d=>fo(async()=>{var p;try{const h=await ne(e,po,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)d.onBlockNumber(m,a),a=m}(!a||h>a)&&(d.onBlockNumber(h,a),a=h)}catch(h){(p=d.onError)==null||p.call(d,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Ce(["watchBlockNumber",e.uid,t,n]);return hn(f,{onBlockNumber:r,onError:o},d=>{let p=!0,h=()=>p=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const $=e.transport.transports.find(y=>y.config.type==="webSocket"||y.config.type==="ipc");return $?$.value:e.transport}return e.transport})(),{unsubscribe:v}=await m.subscribe({params:["newHeads"],onData($){var T;if(!p)return;const y=$t((T=$.result)==null?void 0:T.number);d.onBlockNumber(y,a),a=y},onError($){var y;(y=d.onError)==null||y.call(d,$)}});h=v,p||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function Bv(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:L})=>~~(1<<L)*200,timeout:a=18e4}=t,u=Ce(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var L;return t.pollingInterval?t.pollingInterval:(L=e.chain)!=null&&L.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,d,p,h=!1,m,v;const{promise:$,resolve:y,reject:T}=If(),B=a?setTimeout(()=>{v(),m(),T(new Nb({hash:o}))},a):void 0;return m=hn(u,{onReplaced:s,resolve:y,reject:T},async L=>{if(p=await ne(e,ls,"getTransactionReceipt")({hash:o}).catch(()=>{}),p&&r<=1){clearTimeout(B),L.resolve(p),m();return}v=ne(e,Dd,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(_){const F=w=>{clearTimeout(B),v(),w(),m()};let g=_;if(!h)try{if(p){if(r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;F(()=>L.resolve(p));return}if(n&&!f&&(h=!0,await ua(async()=>{f=await ne(e,ba,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),p=await ne(e,ls,"getTransactionReceipt")({hash:o}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;F(()=>L.resolve(p))}catch(w){if(w instanceof Il||w instanceof Nl){if(!f){h=!1;return}try{d=f,h=!0;const A=await ua(()=>ne(e,Ot,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:P})=>P instanceof _l});h=!1;const I=A.transactions.find(({from:P,nonce:S})=>P===d.from&&S===d.nonce);if(!I||(p=await ne(e,ls,"getTransactionReceipt")({hash:I.hash}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r)))return;let N="replaced";I.to===d.to&&I.value===d.value&&I.input===d.input?N="repriced":I.from===I.to&&I.value===0n&&(N="cancelled"),F(()=>{var P;(P=L.onReplaced)==null||P.call(L,{reason:N,replacedTransaction:d,transaction:I,transactionReceipt:p}),L.resolve(p)})}catch(A){F(()=>L.reject(A))}}else F(()=>L.reject(w))}}})}),$}function Mv(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const u=typeof c<"u"?c:!(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")),l=i??!1;let f;return u?(()=>{const h=Ce(["watchBlocks",e.uid,t,n,r,l,a]);return hn(h,{onBlock:o,onError:s},m=>fo(async()=>{var v;try{const $=await ne(e,Ot,"getBlock")({blockTag:t,includeTransactions:l});if($.number!==null&&(f==null?void 0:f.number)!=null){if($.number===f.number)return;if($.number-f.number>1&&n)for(let y=(f==null?void 0:f.number)+1n;y<$.number;y++){const T=await ne(e,Ot,"getBlock")({blockNumber:y,includeTransactions:l});m.onBlock(T,f),f=T}}((f==null?void 0:f.number)==null||t==="pending"&&($==null?void 0:$.number)==null||$.number!==null&&$.number>f.number)&&(m.onBlock($,f),f=$)}catch($){(v=m.onError)==null||v.call(m,$)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,v=()=>h=!1;return(async()=>{try{r&&ne(e,Ot,"getBlock")({blockTag:t,includeTransactions:l}).then(T=>{h&&m&&(o(T,void 0),m=!1)}).catch(s);const $=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(B=>B.config.type==="webSocket"||B.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),{unsubscribe:y}=await $.subscribe({params:["newHeads"],async onData(T){var L;if(!h)return;const B=await ne(e,Ot,"getBlock")({blockNumber:(L=T.result)==null?void 0:L.number,includeTransactions:l}).catch(()=>{});h&&(o(B,f),m=!1,f=B)},onError(T){s==null||s(T)}});v=y,h||v()}catch($){s==null||s($)}})(),()=>v()})()}function Lv(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:u,pollingInterval:l=e.pollingInterval,strict:f}){const d=typeof u<"u"?u: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")),p=f??!1;return d?(()=>{const v=Ce(["watchEvent",t,n,r,e.uid,o,l,i]);return hn(v,{onLogs:a,onError:c},$=>{let y;i!==void 0&&(y=i-1n);let T,B=!1;const L=fo(async()=>{var _;if(!B){try{T=await ne(e,Hf,"createEventFilter")({address:t,args:n,event:o,events:s,strict:p,fromBlock:i})}catch{}B=!0;return}try{let F;if(T)F=await ne(e,ns,"getFilterChanges")({filter:T});else{const g=await ne(e,po,"getBlockNumber")({});y&&y!==g?F=await ne(e,Vi,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:y+1n,toBlock:g}):F=[],y=g}if(F.length===0)return;if(r)$.onLogs(F);else for(const g of F)$.onLogs([g])}catch(F){T&&F instanceof On&&(B=!1),(_=$.onError)==null||_.call($,F)}},{emitOnBegin:!0,interval:l});return async()=>{T&&await ne(e,rs,"uninstallFilter")({filter:T}),L()}})})():(()=>{let v=!0,$=()=>v=!1;return(async()=>{try{const y=(()=>{if(e.transport.type==="fallback"){const _=e.transport.transports.find(F=>F.config.type==="webSocket"||F.config.type==="ipc");return _?_.value:e.transport}return e.transport})(),T=s??(o?[o]:void 0);let B=[];T&&(B=[T.flatMap(F=>Fr({abi:[F],eventName:F.name,args:n}))],o&&(B=B[0]));const{unsubscribe:L}=await y.subscribe({params:["logs",{address:t,topics:B}],onData(_){var g;if(!v)return;const F=_.result;try{const{eventName:w,args:A}=Hi({abi:T??[],data:F.data,topics:F.topics,strict:p}),I=Yt(F,{args:A,eventName:w});a([I])}catch(w){let A,I;if(w instanceof Br||w instanceof Fo){if(f)return;A=w.abiItem.name,I=(g=w.abiItem.inputs)==null?void 0:g.some(P=>!("name"in P&&P.name))}const N=Yt(F,{args:I?[]:{},eventName:A});a([N])}},onError(_){c==null||c(_)}});$=L,v||$()}catch(y){c==null||c(y)}})(),()=>$()})()}function Rv(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 u=Ce(["watchPendingTransactions",e.uid,t,s]);return hn(u,{onTransactions:r,onError:n},l=>{let f;const d=fo(async()=>{var p;try{if(!f)try{f=await ne(e,Wf,"createPendingTransactionFilter")({});return}catch(m){throw d(),m}const h=await ne(e,ns,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)l.onTransactions(h);else for(const m of h)l.onTransactions([m])}catch(h){(p=l.onError)==null||p.call(l,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await ne(e,rs,"uninstallFilter")({filter:f}),d()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(d){if(!u)return;const p=d.result;r([p])},onError(d){n==null||n(d)}});l=f,u||l()}catch(f){n==null||n(f)}})(),()=>l()})()}function Dv(e){var f,d,p;const{scheme:t,statement:n,...r}=((f=e.match(Fv))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((d=e.match(jv))==null?void 0:d.groups)??{},l=(p=e.split("Resources:")[1])==null?void 0:p.split(`
77
+ - `).slice(1);return{...r,...u,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const Fv=/^(?:(?<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)?/,jv=/(?: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 _v(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||!tt(r.address,{strict:!1})||t&&!Qo(r.address,t))return!1}catch{return!1}return!0}async function Uv(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=Dv(o);if(!l.address||!_v({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const d=Jf(o);return Ra(e,{address:l.address,hash:d,signature:c,...u})}function zv(e){return{call:t=>lo(e,t),createAccessList:t=>zf(e,t),createBlockFilter:()=>H1(e),createContractEventFilter:t=>wl(e,t),createEventFilter:t=>Hf(e,t),createPendingTransactionFilter:()=>Wf(e),estimateContractGas:t=>yy(e,t),estimateGas:t=>zi(e,t),getBalance:t=>nf(e,t),getBlobBaseFee:()=>W1(e),getBlock:t=>Ot(e,t),getBlockNumber:t=>po(e,t),getBlockTransactionCount:t=>V1(e,t),getBytecode:t=>Vf(e,t),getChainId:()=>Jl(e),getCode:t=>Vf(e,t),getContractEvents:t=>of(e,t),getEip712Domain:t=>q1(e,t),getEnsAddress:t=>T1(e,t),getEnsAvatar:t=>_1(e,t),getEnsName:t=>U1(e,t),getEnsResolver:t=>z1(e,t),getEnsText:t=>Uf(e,t),getFeeHistory:t=>Y1(e,t),estimateFeesPerGas:t=>ty(e,t),getFilterChanges:t=>ns(e,t),getFilterLogs:t=>X1(e,t),getGasPrice:()=>ji(e),getLogs:t=>Vi(e,t),getProof:t=>Ew(e,t),estimateMaxPriorityFeePerGas:t=>ey(e,t),getStorageAt:t=>Sw(e,t),getTransaction:t=>ba(e,t),getTransactionConfirmations:t=>Pw(e,t),getTransactionCount:t=>Vl(e,t),getTransactionReceipt:t=>ls(e,t),multicall:t=>Aw(e,t),prepareTransactionRequest:t=>tf(e,t),readContract:t=>Qt(e,t),sendRawTransaction:t=>l1(e,t),simulate:t=>ya(e,t),simulateBlocks:t=>ya(e,t),simulateCalls:t=>ev(e,t),simulateContract:t=>n1(e,t),verifyMessage:t=>Nv(e,t),verifySiweMessage:t=>Uv(e,t),verifyTypedData:t=>kv(e,t),uninstallFilter:t=>rs(e,t),waitForTransactionReceipt:t=>Bv(e,t),watchBlocks:t=>Mv(e,t),watchBlockNumber:t=>Dd(e,t),watchContractEvent:t=>u1(e,t),watchEvent:t=>Lv(e,t),watchPendingTransactions:t=>Rv(e,t)}}function Da(e){const{key:t="public",name:n="Public Client"}=e;return p1({...e,key:t,name:n,type:"publicClient"}).extend(zv)}const Fa=Zf({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}}}),Fd=Zf({id:56,name:"BNB Smart Chain",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://56.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}});function hs({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=x.useState(null),[a,u]=x.useState(o);return x.useEffect(()=>{let l,f;const d=async()=>{try{const p=await e.readContract({address:t,abi:cr,functionName:"balanceOf",args:[n]});c(p),u(Pi(p,r))}catch{u(o)}};d();try{l=e.watchContractEvent({address:t,abi:cr,eventName:"Transfer",args:{to:n},onLogs:()=>{d()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:cr,eventName:"Transfer",args:{from:n},onLogs:()=>{d()},poll:!0,pollingInterval:s})}catch{}return()=>{l==null||l(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const Hv="0x55d398326f99059fF775485246999027B3197955",Wv="0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",Vv="0xaf88d065e77c8cC2239327C5EDb3A432268e5831",Gv="0x0520b0a951658db92b8a2dd9f146bb8223638740",qv="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",Zv="0x81144d6E7084928830f9694a201E8c1ce6eD0cb2";function jd(e,t,n=[]){if(e&&typeof e=="string")return e;if(t&&typeof t=="string")return t;if(n&&n.length>0)return n[0]}function Kv(e={}){const{bscRpcUrl:t,arbitrumRpcUrl:n,pollingInterval:r=12e3}=e,o=x.useMemo(()=>{var u,l,f;return Da({chain:Fd,transport:fa(jd(t,typeof window<"u"?(u=window==null?void 0:window.ENV)==null?void 0:u.CHAIN_RPC_URL_56:void 0,((f=(l=Fd.rpcUrls)==null?void 0:l.default)==null?void 0:f.http)||[]))})},[t]),s=x.useMemo(()=>{var u,l,f;return Da({chain:Fa,transport:fa(jd(n,typeof window<"u"?(u=window==null?void 0:window.ENV)==null?void 0:u.CHAIN_RPC_URL_42161:void 0,((f=(l=Fa.rpcUrls)==null?void 0:l.default)==null?void 0:f.http)||[]))})},[n]),{formatted:i="0"}=hs({client:o,tokenAddress:Hv,holder:Gv,decimals:6,fallbackFormatted:"0",pollingInterval:r}),{formatted:c="0"}=hs({client:s,tokenAddress:Wv,holder:qv,decimals:6,fallbackFormatted:"0",pollingInterval:r}),{formatted:a="0"}=hs({client:s,tokenAddress:Vv,holder:Zv,decimals:6,fallbackFormatted:"0",pollingInterval:r});return{BNB_USDT_BALANCE:i,ARB_USDT_BALANCE:c,ARB_USDC_BALANCE:a}}const Yv=()=>({openDeposit:x.useCallback(t=>{},[])}),Xv=()=>({openWithdraw:x.useCallback(t=>{},[])}),Dn="MPC",ja="EVM";/**
36
78
  * @license lucide-react v0.540.0 - ISC
37
79
  *
38
80
  * This source code is licensed under the ISC license.
39
81
  * See the LICENSE file in the root directory of this source tree.
40
- */const pm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hm=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),du=e=>{const t=hm(e);return t.charAt(0).toUpperCase()+t.slice(1)},pu=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),mm=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
82
+ */const Qv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Jv=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),_d=e=>{const t=Jv(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ud=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ex=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
41
83
  * @license lucide-react v0.540.0 - ISC
42
84
  *
43
85
  * This source code is licensed under the ISC license.
44
86
  * See the LICENSE file in the root directory of this source tree.
45
- */var gm={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"};/**
87
+ */var tx={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"};/**
46
88
  * @license lucide-react v0.540.0 - ISC
47
89
  *
48
90
  * This source code is licensed under the ISC license.
49
91
  * See the LICENSE file in the root directory of this source tree.
50
- */const bm=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>E.createElement("svg",{ref:a,...gm,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:pu("lucide",o),...!s&&!mm(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,l])=>E.createElement(u,l)),...Array.isArray(s)?s:[s]]));/**
92
+ */const nx=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>x.createElement("svg",{ref:a,...tx,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ud("lucide",o),...!s&&!ex(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,l])=>x.createElement(u,l)),...Array.isArray(s)?s:[s]]));/**
51
93
  * @license lucide-react v0.540.0 - ISC
52
94
  *
53
95
  * This source code is licensed under the ISC license.
54
96
  * See the LICENSE file in the root directory of this source tree.
55
- */const ym=(e,t)=>{const n=E.forwardRef(({className:r,...o},s)=>E.createElement(bm,{ref:s,iconNode:t,className:pu(`lucide-${pm(du(e))}`,`lucide-${e}`,r),...o}));return n.displayName=du(e),n};/**
97
+ */const rx=(e,t)=>{const n=x.forwardRef(({className:r,...o},s)=>x.createElement(nx,{ref:s,iconNode:t,className:Ud(`lucide-${Qv(_d(e))}`,`lucide-${e}`,r),...o}));return n.displayName=_d(e),n};/**
56
98
  * @license lucide-react v0.540.0 - ISC
57
99
  *
58
100
  * This source code is licensed under the ISC license.
59
101
  * See the LICENSE file in the root directory of this source tree.
60
- */const hu=ym("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),wm=({tokens:e,selectedToken:t,onTokenChange:n})=>L.jsx("div",{className:"bg-fill-input-primary flex rounded-lg p-1",children:e.map(r=>L.jsxs("button",{className:`flex-1 font-medium rounded-md flex items-center justify-center text-sm h-[30px] ${t.token===r.token?"bg-fill-btn-primary text-text-black-static":"text-text-primary"}`,onClick:()=>n(r),children:[L.jsx("img",{src:r.iconUrl,alt:r.token,className:"w-4 h-4 rounded-full"}),L.jsx("span",{className:"ml-1",children:r.token||r.symbol})]},r.token))}),mu=typeof document<"u"?E.useLayoutEffect:()=>{};var si;const vm=(si=E.useInsertionEffect)!==null&&si!==void 0?si:mu;function xm(e){const t=E.useRef(null);return vm(()=>{t.current=e},[e]),E.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const cn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},xn=e=>e&&"window"in e&&e.window===e?e:cn(e).defaultView||window;function Em(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Sm(e){return Em(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let $m=!1;function ii(){return $m}function gu(e,t){if(!ii())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:Sm(n)?n=n.host:n=n.parentNode}return!1}const ai=(e=document)=>{var t;if(!ii())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 bu(e){return ii()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Lo(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 ci(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 Ut(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ui=Ut(function(){return ci(/^Mac/i)}),Pm=Ut(function(){return ci(/^iPhone/i)}),Am=Ut(function(){return ci(/^iPad/i)||ui()&&navigator.maxTouchPoints>1}),Tm=Ut(function(){return Pm()||Am()});Ut(function(){return ui()||Tm()}),Ut(function(){return Lo(/AppleWebKit/i)&&!Om()});const Om=Ut(function(){return Lo(/Chrome/i)}),Cm=Ut(function(){return Lo(/Android/i)});Ut(function(){return Lo(/Firefox/i)});function yu(){let e=E.useRef(new Map),t=E.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...u)=>{e.current.delete(i),i(...u)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=E.useCallback((o,s,i,c)=>{var a;let u=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,u,c),e.current.delete(i)},[]),r=E.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return E.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Im(e){return e.mozInputSource===0&&e.isTrusted?!0:Cm()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function wu(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Nm(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function vu(e){let t=E.useRef({isFocused:!1,observer:null});mu(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=xm(r=>{e==null||e(r)});return E.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=wu(i);n(c)}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 c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let km=!1,Or=null,li=new Set,Cr=new Map,En=!1,fi=!1;const Mm={Tab:!0,Escape:!0};function di(e,t){for(let n of li)n(e,t)}function Lm(e){return!(e.metaKey||!ui()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Bo(e){En=!0,Lm(e)&&(Or="keyboard",di("keyboard",e))}function Je(e){Or="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(En=!0,di("pointer",e))}function xu(e){Im(e)&&(En=!0,Or="virtual")}function Eu(e){e.target===window||e.target===document||km||!e.isTrusted||(!En&&!fi&&(Or="virtual",di("virtual",e)),En=!1,fi=!1)}function Su(){En=!1,fi=!0}function pi(e){if(typeof window>"u"||typeof document>"u"||Cr.get(xn(e)))return;const t=xn(e),n=cn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){En=!0,r.apply(this,arguments)},n.addEventListener("keydown",Bo,!0),n.addEventListener("keyup",Bo,!0),n.addEventListener("click",xu,!0),t.addEventListener("focus",Eu,!0),t.addEventListener("blur",Su,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Je,!0),n.addEventListener("pointermove",Je,!0),n.addEventListener("pointerup",Je,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Je,!0),n.addEventListener("mousemove",Je,!0),n.addEventListener("mouseup",Je,!0)),t.addEventListener("beforeunload",()=>{$u(e)},{once:!0}),Cr.set(t,{focus:r})}const $u=(e,t)=>{const n=xn(e),r=cn(e);t&&r.removeEventListener("DOMContentLoaded",t),Cr.has(n)&&(n.HTMLElement.prototype.focus=Cr.get(n).focus,r.removeEventListener("keydown",Bo,!0),r.removeEventListener("keyup",Bo,!0),r.removeEventListener("click",xu,!0),n.removeEventListener("focus",Eu,!0),n.removeEventListener("blur",Su,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Je,!0),r.removeEventListener("pointermove",Je,!0),r.removeEventListener("pointerup",Je,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Je,!0),r.removeEventListener("mousemove",Je,!0),r.removeEventListener("mouseup",Je,!0)),Cr.delete(n))};function Bm(e){const t=cn(e);let n;return t.readyState!=="loading"?pi(e):(n=()=>{pi(e)},t.addEventListener("DOMContentLoaded",n)),()=>$u(e,n)}typeof document<"u"&&Bm();function Pu(){return Or!=="pointer"}const Rm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Fm(e,t,n){let r=cn(n==null?void 0:n.target);const o=typeof window<"u"?xn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?xn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?xn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?xn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Rm.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!Mm[n.key])}function Dm(e,t,n){pi(),E.useEffect(()=>{let r=(o,s)=>{Fm(!!(n!=null&&n.isTextInput),o,s)&&e(Pu())};return li.add(r),()=>{li.delete(r)}},t)}function jm(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=E.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=vu(s),c=E.useCallback(a=>{const u=cn(a.target),l=u?ai(u):ai();a.target===a.currentTarget&&l===bu(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function _m(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=E.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=yu(),a=E.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),u=vu(a),l=E.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const d=cn(f.target),p=ai(d);if(!s.current.isFocusWithin&&p===bu(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,u(f);let h=f.currentTarget;i(d,"focus",m=>{if(s.current.isFocusWithin&&!gu(h,m.target)){let w=new d.defaultView.FocusEvent("blur",{relatedTarget:m.target});Nm(w,h);let O=wu(w);a(O)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let Ro=!1,Fo=0;function hi(){Ro=!0,setTimeout(()=>{Ro=!1},50)}function Au(e){e.pointerType==="touch"&&hi()}function Um(){if(!(typeof document>"u"))return Fo===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Au):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",hi)),Fo++,()=>{Fo--,!(Fo>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Au):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",hi))}}function zm(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=E.useState(!1),c=E.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;E.useEffect(Um,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=yu(),{hoverProps:l,triggerHoverEnd:f}=E.useMemo(()=>{let d=(m,w)=>{if(c.pointerType=w,o||w==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let O=m.currentTarget;c.target=O,a(cn(m.target),"pointerover",b=>{c.isHovered&&c.target&&!gu(c.target,b.target)&&p(b,b.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:O,pointerType:w}),n&&n(!0),i(!0)},p=(m,w)=>{let O=c.target;c.pointerType="",c.target=null,!(w==="touch"||!c.isHovered||!O)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:O,pointerType:w}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Ro&&m.pointerType==="mouse"||d(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&p(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!Ro&&d(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&p(m,"mouse")}),{hoverProps:h,triggerHoverEnd:p}},[t,n,r,o,c,a,u]);return E.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function Hm(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=E.useRef({isFocused:!1,isFocusVisible:t||Pu()}),[s,i]=E.useState(!1),[c,a]=E.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=E.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=E.useCallback(p=>{o.current.isFocused=p,i(p),u()},[u]);Dm(p=>{o.current.isFocusVisible=p,u()},[],{isTextInput:n});let{focusProps:f}=jm({isDisabled:r,onFocusChange:l}),{focusWithinProps:d}=_m({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?d:f}}var Wm=Object.defineProperty,Vm=(e,t,n)=>t in e?Wm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mi=(e,t,n)=>(Vm(e,typeof t!="symbol"?t+"":t,n),n);let Gm=class{constructor(){mi(this,"current",this.detect()),mi(this,"handoffState","pending"),mi(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"}},$t=new Gm;function Ir(e){var t,n;return $t.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function Tu(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ft(){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 Tu(()=>{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=ft();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 Wn(){let[e]=E.useState(ft);return E.useEffect(()=>()=>e.dispose(),[e]),e}let pe=(e,t)=>{$t.isServer?E.useEffect(e,t):E.useLayoutEffect(e,t)};function Sn(e){let t=E.useRef(e);return pe(()=>{t.current=e},[e]),t}let ie=function(e){let t=Sn(e);return E.useCallback((...n)=>t.current(...n),[t])};function qm(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 Zm(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Km({disabled:e=!1}={}){let t=E.useRef(null),[n,r]=E.useState(!1),o=Wn(),s=ie(()=>{t.current=null,r(!1),o.dispose()}),i=ie(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=Ir(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=qm(u);r(Zm(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Ym=E.createContext(void 0);function gi(){return E.useContext(Ym)}function bi(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function et(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,et),r}var Do=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Do||{}),un=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(un||{});function Ge(){let e=Qm();return E.useCallback(t=>Xm({mergeRefs:e,...t}),[e])}function Xm({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??Jm;let a=Ou(t,e);if(s)return jo(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return jo(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return et(l?0:1,{0(){return null},1(){return jo({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return jo(a,n,r,i,c)}function jo(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=yi(e,["unmount","static"]),u=e.ref!==void 0?{[c]:e.ref}:{},l=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 d=!1,p=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(d=!0),m===!0&&p.push(h.replace(/([A-Z])/g,w=>`-${w.toLowerCase()}`));if(d){f["data-headlessui-state"]=p.join(" ");for(let h of p)f[`data-${h}`]=""}}if(s===E.Fragment&&(Object.keys(ln(a)).length>0||Object.keys(ln(f)).length>0))if(!E.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(ln(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(ln(a)).concat(Object.keys(ln(f))).map(d=>` - ${d}`).join(`
102
+ */const zd=rx("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ox=({tokens:e,selectedToken:t,onTokenChange:n})=>M.jsx("div",{className:"bg-fill-input-primary flex rounded-lg p-1",children:e.map(r=>M.jsxs("button",{className:`flex-1 font-medium rounded-md flex items-center justify-center text-sm h-[30px] ${t.token===r.token?"bg-fill-btn-primary text-text-black-static":"text-text-primary"}`,onClick:()=>n(r),children:[M.jsx("img",{src:r.iconUrl,alt:r.token,className:"w-4 h-4 rounded-full"}),M.jsx("span",{className:"ml-1",children:r.token||r.symbol})]},r.token))}),Hd=typeof document<"u"?x.useLayoutEffect:()=>{};var _a;const sx=(_a=x.useInsertionEffect)!==null&&_a!==void 0?_a:Hd;function ix(e){const t=x.useRef(null);return sx(()=>{t.current=e},[e]),x.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const mn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Fn=e=>e&&"window"in e&&e.window===e?e:mn(e).defaultView||window;function ax(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function cx(e){return ax(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let ux=!1;function Ua(){return ux}function Wd(e,t){if(!Ua())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:cx(n)?n=n.host:n=n.parentNode}return!1}const za=(e=document)=>{var t;if(!Ua())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 Vd(e){return Ua()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function ms(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 Ha(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 tn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Wa=tn(function(){return Ha(/^Mac/i)}),lx=tn(function(){return Ha(/^iPhone/i)}),fx=tn(function(){return Ha(/^iPad/i)||Wa()&&navigator.maxTouchPoints>1}),dx=tn(function(){return lx()||fx()});tn(function(){return Wa()||dx()}),tn(function(){return ms(/AppleWebKit/i)&&!px()});const px=tn(function(){return ms(/Chrome/i)}),hx=tn(function(){return ms(/Android/i)});tn(function(){return ms(/Firefox/i)});function Gd(){let e=x.useRef(new Map),t=x.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...u)=>{e.current.delete(i),i(...u)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=x.useCallback((o,s,i,c)=>{var a;let u=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,u,c),e.current.delete(i)},[]),r=x.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return x.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function mx(e){return e.mozInputSource===0&&e.isTrusted?!0:hx()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function qd(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function gx(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Zd(e){let t=x.useRef({isFocused:!1,observer:null});Hd(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=ix(r=>{e==null||e(r)});return x.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=qd(i);n(c)}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 c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let bx=!1,go=null,Va=new Set,bo=new Map,jn=!1,Ga=!1;const yx={Tab:!0,Escape:!0};function qa(e,t){for(let n of Va)n(e,t)}function wx(e){return!(e.metaKey||!Wa()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function gs(e){jn=!0,wx(e)&&(go="keyboard",qa("keyboard",e))}function ot(e){go="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(jn=!0,qa("pointer",e))}function Kd(e){mx(e)&&(jn=!0,go="virtual")}function Yd(e){e.target===window||e.target===document||bx||!e.isTrusted||(!jn&&!Ga&&(go="virtual",qa("virtual",e)),jn=!1,Ga=!1)}function Xd(){jn=!1,Ga=!0}function Za(e){if(typeof window>"u"||typeof document>"u"||bo.get(Fn(e)))return;const t=Fn(e),n=mn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){jn=!0,r.apply(this,arguments)},n.addEventListener("keydown",gs,!0),n.addEventListener("keyup",gs,!0),n.addEventListener("click",Kd,!0),t.addEventListener("focus",Yd,!0),t.addEventListener("blur",Xd,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",ot,!0),n.addEventListener("pointermove",ot,!0),n.addEventListener("pointerup",ot,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",ot,!0),n.addEventListener("mousemove",ot,!0),n.addEventListener("mouseup",ot,!0)),t.addEventListener("beforeunload",()=>{Qd(e)},{once:!0}),bo.set(t,{focus:r})}const Qd=(e,t)=>{const n=Fn(e),r=mn(e);t&&r.removeEventListener("DOMContentLoaded",t),bo.has(n)&&(n.HTMLElement.prototype.focus=bo.get(n).focus,r.removeEventListener("keydown",gs,!0),r.removeEventListener("keyup",gs,!0),r.removeEventListener("click",Kd,!0),n.removeEventListener("focus",Yd,!0),n.removeEventListener("blur",Xd,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",ot,!0),r.removeEventListener("pointermove",ot,!0),r.removeEventListener("pointerup",ot,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",ot,!0),r.removeEventListener("mousemove",ot,!0),r.removeEventListener("mouseup",ot,!0)),bo.delete(n))};function vx(e){const t=mn(e);let n;return t.readyState!=="loading"?Za(e):(n=()=>{Za(e)},t.addEventListener("DOMContentLoaded",n)),()=>Qd(e,n)}typeof document<"u"&&vx();function Jd(){return go!=="pointer"}const xx=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ex(e,t,n){let r=mn(n==null?void 0:n.target);const o=typeof window<"u"?Fn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Fn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?Fn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?Fn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!xx.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!yx[n.key])}function Sx(e,t,n){Za(),x.useEffect(()=>{let r=(o,s)=>{Ex(!!(n!=null&&n.isTextInput),o,s)&&e(Jd())};return Va.add(r),()=>{Va.delete(r)}},t)}function Px(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=x.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=Zd(s),c=x.useCallback(a=>{const u=mn(a.target),l=u?za(u):za();a.target===a.currentTarget&&l===Vd(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function Ax(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=x.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=Gd(),a=x.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),u=Zd(a),l=x.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const d=mn(f.target),p=za(d);if(!s.current.isFocusWithin&&p===Vd(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,u(f);let h=f.currentTarget;i(d,"focus",m=>{if(s.current.isFocusWithin&&!Wd(h,m.target)){let v=new d.defaultView.FocusEvent("blur",{relatedTarget:m.target});gx(v,h);let $=qd(v);a($)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let bs=!1,ys=0;function Ka(){bs=!0,setTimeout(()=>{bs=!1},50)}function ep(e){e.pointerType==="touch"&&Ka()}function $x(){if(!(typeof document>"u"))return ys===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",ep):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Ka)),ys++,()=>{ys--,!(ys>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",ep):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Ka))}}function Tx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=x.useState(!1),c=x.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;x.useEffect($x,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=Gd(),{hoverProps:l,triggerHoverEnd:f}=x.useMemo(()=>{let d=(m,v)=>{if(c.pointerType=v,o||v==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let $=m.currentTarget;c.target=$,a(mn(m.target),"pointerover",y=>{c.isHovered&&c.target&&!Wd(c.target,y.target)&&p(y,y.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:$,pointerType:v}),n&&n(!0),i(!0)},p=(m,v)=>{let $=c.target;c.pointerType="",c.target=null,!(v==="touch"||!c.isHovered||!$)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:$,pointerType:v}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{bs&&m.pointerType==="mouse"||d(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&p(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!bs&&d(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&p(m,"mouse")}),{hoverProps:h,triggerHoverEnd:p}},[t,n,r,o,c,a,u]);return x.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function Cx(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=x.useRef({isFocused:!1,isFocusVisible:t||Jd()}),[s,i]=x.useState(!1),[c,a]=x.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=x.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=x.useCallback(p=>{o.current.isFocused=p,i(p),u()},[u]);Sx(p=>{o.current.isFocusVisible=p,u()},[],{isTextInput:n});let{focusProps:f}=Px({isDisabled:r,onFocusChange:l}),{focusWithinProps:d}=Ax({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?d:f}}var Ox=Object.defineProperty,Ix=(e,t,n)=>t in e?Ox(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ya=(e,t,n)=>(Ix(e,typeof t!="symbol"?t+"":t,n),n);let Nx=class{constructor(){Ya(this,"current",this.detect()),Ya(this,"handoffState","pending"),Ya(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"}},kt=new Nx;function yo(e){var t,n;return kt.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function tp(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Et(){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 tp(()=>{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=Et();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 mr(){let[e]=x.useState(Et);return x.useEffect(()=>()=>e.dispose(),[e]),e}let ye=(e,t)=>{kt.isServer?x.useEffect(e,t):x.useLayoutEffect(e,t)};function _n(e){let t=x.useRef(e);return ye(()=>{t.current=e},[e]),t}let fe=function(e){let t=_n(e);return x.useCallback((...n)=>t.current(...n),[t])};function kx(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 Bx(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Mx({disabled:e=!1}={}){let t=x.useRef(null),[n,r]=x.useState(!1),o=mr(),s=fe(()=>{t.current=null,r(!1),o.dispose()}),i=fe(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=yo(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=kx(u);r(Bx(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Lx=x.createContext(void 0);function Xa(){return x.useContext(Lx)}function Qa(...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 ws=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(ws||{}),gn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(gn||{});function Xe(){let e=Dx();return x.useCallback(t=>Rx({mergeRefs:e,...t}),[e])}function Rx({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??Fx;let a=np(t,e);if(s)return vs(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return vs(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return st(l?0:1,{0(){return null},1(){return vs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return vs(a,n,r,i,c)}function vs(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=Ja(e,["unmount","static"]),u=e.ref!==void 0?{[c]:e.ref}:{},l=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 d=!1,p=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(d=!0),m===!0&&p.push(h.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(d){f["data-headlessui-state"]=p.join(" ");for(let h of p)f[`data-${h}`]=""}}if(s===x.Fragment&&(Object.keys(bn(a)).length>0||Object.keys(bn(f)).length>0))if(!x.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(bn(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(bn(a)).concat(Object.keys(bn(f))).map(d=>` - ${d}`).join(`
61
103
  `),"","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(d=>` - ${d}`).join(`
62
104
  `)].join(`
63
- `))}else{let d=l.props,p=d==null?void 0:d.className,h=typeof p=="function"?(...O)=>bi(p(...O),a.className):bi(p,a.className),m=h?{className:h}:{},w=Ou(l.props,ln(yi(a,["ref"])));for(let O in f)O in w&&delete f[O];return E.cloneElement(l,Object.assign({},w,f,u,{ref:o(eg(l),u.ref)},m))}return E.createElement(s,Object.assign({},yi(a,["ref"]),s!==E.Fragment&&u,s!==E.Fragment&&f),l)}function Qm(){let e=E.useRef([]),t=E.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 Jm(...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 Ou(...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 c of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;c(o,...s)}}});return t}function Cu(...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 De(e){var t;return Object.assign(E.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ln(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function yi(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function eg(e){return E.version.split(".")[0]>="19"?e.props.ref:e.ref}function tg(e,t,n){let[r,o]=E.useState(n),s=e!==void 0,i=E.useRef(s),c=E.useRef(!1),a=E.useRef(!1);return s&&!i.current&&!c.current?(c.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,ie(u=>(s||o(u),t==null?void 0:t(u)))]}function ng(e){let[t]=E.useState(e);return t}function Iu(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))ku(n,Nu(t,r),o);return n}function Nu(e,t){return e?e+"["+t+"]":t}function ku(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())ku(e,Nu(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,""]):Iu(n,t,e)}function rg(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)}}let og="span";var wi=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(wi||{});function sg(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 Ge()({ourProps:s,theirProps:o,slot:{},defaultTag:og,name:"Hidden"})}let Mu=De(sg),ig=E.createContext(null);function ag({children:e}){let t=E.useContext(ig);if(!t)return E.createElement(E.Fragment,null,e);let{target:n}=t;return n?Ne.createPortal(E.createElement(E.Fragment,null,e),n):null}function cg({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=E.useState(null),c=Wn();return E.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),E.createElement(ag,null,E.createElement(ug,{setForm:i,formId:t}),Iu(e).map(([a,u])=>E.createElement(Mu,{features:wi.Hidden,...ln({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function ug({setForm:e,formId:t}){return E.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:E.createElement(Mu,{features:wi.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let lg=E.createContext(void 0);function Lu(){return E.useContext(lg)}function vi(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function _o(e){return vi(e)&&"tagName"in e}function zt(e){return _o(e)&&"accessKey"in e}function Vn(e){return _o(e)&&"tabIndex"in e}function fg(e){return _o(e)&&"style"in e}function dg(e){return zt(e)&&e.nodeName==="IFRAME"}function Bu(e){return zt(e)&&e.nodeName==="INPUT"}function Ru(e){return zt(e)&&e.nodeName==="LABEL"}function pg(e){return zt(e)&&e.nodeName==="FIELDSET"}function Fu(e){return zt(e)&&e.nodeName==="LEGEND"}function hg(e){return _o(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function mg(e){let t=e.parentElement,n=null;for(;t&&!pg(t);)Fu(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&gg(n)?!1:r}function gg(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Fu(t))return!1;t=t.previousElementSibling}return!0}let Du=Symbol();function bg(e,t=!0){return Object.assign(e,{[Du]:t})}function tt(...e){let t=E.useRef(e);E.useEffect(()=>{t.current=e},[e]);let n=ie(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[Du]))?void 0:n}let xi=E.createContext(null);xi.displayName="DescriptionContext";function ju(){let e=E.useContext(xi);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,ju),t}return e}function yg(){var e,t;return(t=(e=E.useContext(xi))==null?void 0:e.value)!=null?t:void 0}let wg="p";function vg(e,t){let n=E.useId(),r=gi(),{id:o=`headlessui-description-${n}`,...s}=e,i=ju(),c=tt(t);pe(()=>i.register(o),[o,i.register]);let a=r||!1,u=E.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),l={ref:c,...i.props,id:o};return Ge()({ourProps:l,theirProps:s,slot:u,defaultTag:wg,name:i.name||"Description"})}let xg=De(vg);Object.assign(xg,{});var Te=(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))(Te||{});let Uo=E.createContext(null);Uo.displayName="LabelContext";function _u(){let e=E.useContext(Uo);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,_u),t}return e}function Uu(e){var t,n,r;let o=(n=(t=E.useContext(Uo))==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 Eg({inherit:e=!1}={}){let t=Uu(),[n,r]=E.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,E.useMemo(()=>function(s){let i=ie(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=E.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 E.createElement(Uo.Provider,{value:c},s.children)},[r])]}let Sg="label";function $g(e,t){var n;let r=E.useId(),o=_u(),s=Lu(),i=gi(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=tt(t);pe(()=>o.register(c),[c,o.register]);let d=ie(w=>{let O=w.currentTarget;if(!(w.target!==w.currentTarget&&hg(w.target))&&(Ru(O)&&w.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(w),Ru(O))){let b=document.getElementById(O.htmlFor);if(b){let A=b.getAttribute("disabled");if(A==="true"||A==="")return;let M=b.getAttribute("aria-disabled");if(M==="true"||M==="")return;(Bu(b)&&(b.type==="file"||b.type==="radio"||b.type==="checkbox")||b.role==="radio"||b.role==="checkbox"||b.role==="switch")&&b.click(),b.focus({preventScroll:!0})}}}),p=i||!1,h=E.useMemo(()=>({...o.slot,disabled:p}),[o.slot,p]),m={ref:f,...o.props,id:c,htmlFor:a,onClick:d};return u&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in l&&delete l.onClick),Ge()({ourProps:m,theirProps:l,slot:h,defaultTag:a?Sg:"div",name:o.name||"Label"})}let Pg=De($g),Ag=Object.assign(Pg,{});function Tg(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 Og(e=Tg){return E.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 Cg(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ig(e,t=!1){let[n,r]=E.useReducer(()=>({}),{}),o=E.useMemo(()=>Cg(e),[e,n]);return pe(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let zu=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 Ng=Object.defineProperty,kg=(e,t,n)=>t in e?Ng(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mg=(e,t,n)=>(kg(e,t+"",n),n),Hu=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},nt=(e,t,n)=>(Hu(e,t,"read from private field"),n?n.call(e):t.get(e)),Ei=(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)},Wu=(e,t,n,r)=>(Hu(e,t,"write to private field"),t.set(e,n),n),Pt,Nr,kr;let Vu=class{constructor(t){Ei(this,Pt,{}),Ei(this,Nr,new zu(()=>new Set)),Ei(this,kr,new Set),Mg(this,"disposables",ft()),Wu(this,Pt,t),$t.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return nt(this,Pt)}subscribe(t,n){if($t.isServer)return()=>{};let r={selector:t,callback:n,current:t(nt(this,Pt))};return nt(this,kr).add(r),this.disposables.add(()=>{nt(this,kr).delete(r)})}on(t,n){return $t.isServer?()=>{}:(nt(this,Nr).get(t).add(n),this.disposables.add(()=>{nt(this,Nr).get(t).delete(n)}))}send(t){let n=this.reduce(nt(this,Pt),t);if(n!==nt(this,Pt)){Wu(this,Pt,n);for(let r of nt(this,kr)){let o=r.selector(nt(this,Pt));Gu(r.current,o)||(r.current=o,r.callback(o))}for(let r of nt(this,Nr).get(t.type))r(nt(this,Pt),t)}}};Pt=new WeakMap,Nr=new WeakMap,kr=new WeakMap;function Gu(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:Si(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Si(e.entries(),t.entries()):qu(e)&&qu(t)?Si(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Si(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 qu(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function $i(e){let[t,n]=e(),r=ft();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Lg=Object.defineProperty,Bg=(e,t,n)=>t in e?Lg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zu=(e,t,n)=>(Bg(e,typeof t!="symbol"?t+"":t,n),n),Ku=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Ku||{});let Rg={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}}},Fg=class Y0 extends Vu{constructor(){super(...arguments),Zu(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Zu(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Y0({stack:[]})}reduce(t,n){return et(n.type,Rg,t,n)}};const Pi=new zu(()=>Fg.new());var Ai={exports:{}},Ti={};/**
105
+ `))}else{let d=l.props,p=d==null?void 0:d.className,h=typeof p=="function"?(...$)=>Qa(p(...$),a.className):Qa(p,a.className),m=h?{className:h}:{},v=np(l.props,bn(Ja(a,["ref"])));for(let $ in f)$ in v&&delete f[$];return x.cloneElement(l,Object.assign({},v,f,u,{ref:o(jx(l),u.ref)},m))}return x.createElement(s,Object.assign({},Ja(a,["ref"]),s!==x.Fragment&&u,s!==x.Fragment&&f),l)}function Dx(){let e=x.useRef([]),t=x.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 Fx(...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 np(...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 c of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;c(o,...s)}}});return t}function rp(...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 He(e){var t;return Object.assign(x.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function bn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Ja(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function jx(e){return x.version.split(".")[0]>="19"?e.props.ref:e.ref}function _x(e,t,n){let[r,o]=x.useState(n),s=e!==void 0,i=x.useRef(s),c=x.useRef(!1),a=x.useRef(!1);return s&&!i.current&&!c.current?(c.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,fe(u=>(s||o(u),t==null?void 0:t(u)))]}function Ux(e){let[t]=x.useState(e);return t}function op(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))ip(n,sp(t,r),o);return n}function sp(e,t){return e?e+"["+t+"]":t}function ip(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())ip(e,sp(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,""]):op(n,t,e)}function zx(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)}}let Hx="span";var ec=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(ec||{});function Wx(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 Xe()({ourProps:s,theirProps:o,slot:{},defaultTag:Hx,name:"Hidden"})}let ap=He(Wx),Vx=x.createContext(null);function Gx({children:e}){let t=x.useContext(Vx);if(!t)return x.createElement(x.Fragment,null,e);let{target:n}=t;return n?Me.createPortal(x.createElement(x.Fragment,null,e),n):null}function qx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=x.useState(null),c=mr();return x.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),x.createElement(Gx,null,x.createElement(Zx,{setForm:i,formId:t}),op(e).map(([a,u])=>x.createElement(ap,{features:ec.Hidden,...bn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function Zx({setForm:e,formId:t}){return x.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:x.createElement(ap,{features:ec.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Kx=x.createContext(void 0);function cp(){return x.useContext(Kx)}function tc(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function xs(e){return tc(e)&&"tagName"in e}function nn(e){return xs(e)&&"accessKey"in e}function gr(e){return xs(e)&&"tabIndex"in e}function Yx(e){return xs(e)&&"style"in e}function Xx(e){return nn(e)&&e.nodeName==="IFRAME"}function up(e){return nn(e)&&e.nodeName==="INPUT"}function lp(e){return nn(e)&&e.nodeName==="LABEL"}function Qx(e){return nn(e)&&e.nodeName==="FIELDSET"}function fp(e){return nn(e)&&e.nodeName==="LEGEND"}function Jx(e){return xs(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function eE(e){let t=e.parentElement,n=null;for(;t&&!Qx(t);)fp(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&tE(n)?!1:r}function tE(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(fp(t))return!1;t=t.previousElementSibling}return!0}let dp=Symbol();function nE(e,t=!0){return Object.assign(e,{[dp]:t})}function it(...e){let t=x.useRef(e);x.useEffect(()=>{t.current=e},[e]);let n=fe(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[dp]))?void 0:n}let nc=x.createContext(null);nc.displayName="DescriptionContext";function pp(){let e=x.useContext(nc);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,pp),t}return e}function rE(){var e,t;return(t=(e=x.useContext(nc))==null?void 0:e.value)!=null?t:void 0}let oE="p";function sE(e,t){let n=x.useId(),r=Xa(),{id:o=`headlessui-description-${n}`,...s}=e,i=pp(),c=it(t);ye(()=>i.register(o),[o,i.register]);let a=r||!1,u=x.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),l={ref:c,...i.props,id:o};return Xe()({ourProps:l,theirProps:s,slot:u,defaultTag:oE,name:i.name||"Description"})}let iE=He(sE);Object.assign(iE,{});var Ie=(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))(Ie||{});let Es=x.createContext(null);Es.displayName="LabelContext";function hp(){let e=x.useContext(Es);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,hp),t}return e}function mp(e){var t,n,r;let o=(n=(t=x.useContext(Es))==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 aE({inherit:e=!1}={}){let t=mp(),[n,r]=x.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,x.useMemo(()=>function(s){let i=fe(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=x.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 x.createElement(Es.Provider,{value:c},s.children)},[r])]}let cE="label";function uE(e,t){var n;let r=x.useId(),o=hp(),s=cp(),i=Xa(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=it(t);ye(()=>o.register(c),[c,o.register]);let d=fe(v=>{let $=v.currentTarget;if(!(v.target!==v.currentTarget&&Jx(v.target))&&(lp($)&&v.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(v),lp($))){let y=document.getElementById($.htmlFor);if(y){let T=y.getAttribute("disabled");if(T==="true"||T==="")return;let B=y.getAttribute("aria-disabled");if(B==="true"||B==="")return;(up(y)&&(y.type==="file"||y.type==="radio"||y.type==="checkbox")||y.role==="radio"||y.role==="checkbox"||y.role==="switch")&&y.click(),y.focus({preventScroll:!0})}}}),p=i||!1,h=x.useMemo(()=>({...o.slot,disabled:p}),[o.slot,p]),m={ref:f,...o.props,id:c,htmlFor:a,onClick:d};return u&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in l&&delete l.onClick),Xe()({ourProps:m,theirProps:l,slot:h,defaultTag:a?cE:"div",name:o.name||"Label"})}let lE=He(uE),fE=Object.assign(lE,{});function dE(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 pE(e=dE){return x.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 hE(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function mE(e,t=!1){let[n,r]=x.useReducer(()=>({}),{}),o=x.useMemo(()=>hE(e),[e,n]);return ye(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let gp=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 gE=Object.defineProperty,bE=(e,t,n)=>t in e?gE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yE=(e,t,n)=>(bE(e,t+"",n),n),bp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},at=(e,t,n)=>(bp(e,t,"read from private field"),n?n.call(e):t.get(e)),rc=(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)},yp=(e,t,n,r)=>(bp(e,t,"write to private field"),t.set(e,n),n),Bt,wo,vo;let wp=class{constructor(t){rc(this,Bt,{}),rc(this,wo,new gp(()=>new Set)),rc(this,vo,new Set),yE(this,"disposables",Et()),yp(this,Bt,t),kt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return at(this,Bt)}subscribe(t,n){if(kt.isServer)return()=>{};let r={selector:t,callback:n,current:t(at(this,Bt))};return at(this,vo).add(r),this.disposables.add(()=>{at(this,vo).delete(r)})}on(t,n){return kt.isServer?()=>{}:(at(this,wo).get(t).add(n),this.disposables.add(()=>{at(this,wo).get(t).delete(n)}))}send(t){let n=this.reduce(at(this,Bt),t);if(n!==at(this,Bt)){yp(this,Bt,n);for(let r of at(this,vo)){let o=r.selector(at(this,Bt));vp(r.current,o)||(r.current=o,r.callback(o))}for(let r of at(this,wo).get(t.type))r(at(this,Bt),t)}}};Bt=new WeakMap,wo=new WeakMap,vo=new WeakMap;function vp(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:oc(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:oc(e.entries(),t.entries()):xp(e)&&xp(t)?oc(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function oc(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 xp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function sc(e){let[t,n]=e(),r=Et();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var wE=Object.defineProperty,vE=(e,t,n)=>t in e?wE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ep=(e,t,n)=>(vE(e,typeof t!="symbol"?t+"":t,n),n),Sp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Sp||{});let xE={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}}},EE=class rm extends wp{constructor(){super(...arguments),Ep(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Ep(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new rm({stack:[]})}reduce(t,n){return st(n.type,xE,t,n)}};const ic=new gp(()=>EE.new());var ac={exports:{}},cc={};/**
64
106
  * @license React
65
107
  * use-sync-external-store-with-selector.production.js
66
108
  *
@@ -68,7 +110,7 @@ React keys must be passed directly to JSX without using spread:
68
110
  *
69
111
  * This source code is licensed under the MIT license found in the
70
112
  * LICENSE file in the root directory of this source tree.
71
- */var Yu;function Dg(){if(Yu)return Ti;Yu=1;var e=E;function t(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;return Ti.useSyncExternalStoreWithSelector=function(a,u,l,f,d){var p=o(null);if(p.current===null){var h={hasValue:!1,value:null};p.current=h}else h=p.current;p=i(function(){function w(R){if(!O){if(O=!0,b=R,R=f(R),d!==void 0&&h.hasValue){var D=h.value;if(d(D,R))return A=D}return A=R}if(D=A,n(b,R))return D;var j=f(R);return d!==void 0&&d(D,j)?(b=R,D):(b=R,A=j)}var O=!1,b,A,M=l===void 0?null:l;return[function(){return w(u())},M===null?void 0:function(){return w(M())}]},[u,l,f,d]);var m=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},Ti}var Oi={};/**
113
+ */var Pp;function SE(){if(Pp)return cc;Pp=1;var e=x;function t(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;return cc.useSyncExternalStoreWithSelector=function(a,u,l,f,d){var p=o(null);if(p.current===null){var h={hasValue:!1,value:null};p.current=h}else h=p.current;p=i(function(){function v(L){if(!$){if($=!0,y=L,L=f(L),d!==void 0&&h.hasValue){var _=h.value;if(d(_,L))return T=_}return T=L}if(_=T,n(y,L))return _;var F=f(L);return d!==void 0&&d(_,F)?(y=L,_):(y=L,T=F)}var $=!1,y,T,B=l===void 0?null:l;return[function(){return v(u())},B===null?void 0:function(){return v(B())}]},[u,l,f,d]);var m=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},cc}var uc={};/**
72
114
  * @license React
73
115
  * use-sync-external-store-with-selector.development.js
74
116
  *
@@ -76,29 +118,29 @@ React keys must be passed directly to JSX without using spread:
76
118
  *
77
119
  * This source code is licensed under the MIT license found in the
78
120
  * LICENSE file in the root directory of this source tree.
79
- */var Xu;function jg(){return Xu||(Xu=1,process.env.NODE_ENV!=="production"&&function(){function e(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=E,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Oi.useSyncExternalStoreWithSelector=function(a,u,l,f,d){var p=o(null);if(p.current===null){var h={hasValue:!1,value:null};p.current=h}else h=p.current;p=i(function(){function w(R){if(!O){if(O=!0,b=R,R=f(R),d!==void 0&&h.hasValue){var D=h.value;if(d(D,R))return A=D}return A=R}if(D=A,n(b,R))return D;var j=f(R);return d!==void 0&&d(D,j)?(b=R,D):(b=R,A=j)}var O=!1,b,A,M=l===void 0?null:l;return[function(){return w(u())},M===null?void 0:function(){return w(M())}]},[u,l,f,d]);var m=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Oi}process.env.NODE_ENV==="production"?Ai.exports=Dg():Ai.exports=jg();var _g=Ai.exports;function rt(e,t,n=Gu){return _g.useSyncExternalStoreWithSelector(ie(r=>e.subscribe(Ug,r)),ie(()=>e.state),ie(()=>e.state),ie(t),n)}function Ug(e){return e}function Qu(e,t){let n=E.useId(),r=Pi.get(t),[o,s]=rt(r,E.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return pe(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Ci=new Map,Mr=new Map;function Ju(e){var t;let n=(t=Mr.get(e))!=null?t:0;return Mr.set(e,n+1),n!==0?()=>el(e):(Ci.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>el(e))}function el(e){var t;let n=(t=Mr.get(e))!=null?t:1;if(n===1?Mr.delete(e):Mr.set(e,n-1),n!==1)return;let r=Ci.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Ci.delete(e))}function zg(e,{allowed:t,disallowed:n}={}){let r=Qu(e,"inert-others");pe(()=>{var o,s;if(!r)return;let i=ft();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(Ju(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=Ir(a);if(!u)continue;let l=a.parentElement;for(;l&&l!==u.body;){for(let f of l.children)c.some(d=>f.contains(d))||i.add(Ju(f));l=l.parentElement}}return i.dispose},[r,t,n])}function Hg(e,t,n){let r=Sn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});E.useEffect(()=>{if(!e)return;let o=t===null?null:zt(t)?t:t.current;if(!o)return;let s=ft();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 Ii=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),Wg=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Ni=(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))(Ni||{}),Vg=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Vg||{}),Gg=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Gg||{});function tl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ii)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function qg(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Wg)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var ki=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(ki||{});function nl(e,t=0){var n;return e===((n=Ir(e))==null?void 0:n.body)?!1:et(t,{0(){return e.matches(Ii)},1(){let r=e;for(;r!==null;){if(r.matches(Ii))return!0;r=r.parentElement}return!1}})}var Zg=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Zg||{});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 Kg=["textarea","input"].join(",");function Yg(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Kg))!=null?n:!1}function rl(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 Xg(e,t){return Qg(tl(),t,{relativeTo:e})}function Qg(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?rl(e):e:t&64?qg(e):tl(e);o.length>0&&i.length>1&&(i=i.filter(p=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===p:h===p))),r=r??s.activeElement;let c=(()=>{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")})(),u=t&32?{preventScroll:!0}:{},l=0,f=i.length,d;do{if(l>=f||l+f<=0)return 0;let p=a+l;if(t&16)p=(p+f)%f;else{if(p<0)return 3;if(p>=f)return 1}d=i[p],d==null||d.focus(u),l+=c}while(d!==s.activeElement);return t&6&&Yg(d)&&d.select(),2}function ol(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Jg(){return/Android/gi.test(window.navigator.userAgent)}function sl(){return ol()||Jg()}function Gn(e,t,n,r){let o=Sn(n);E.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 eb(e,t,n,r){let o=Sn(n);E.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 il=30;function tb(e,t,n){let r=Sn(n),o=E.useCallback(function(c,a){if(c.defaultPrevented)return;let u=a(c);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let l=function f(d){return typeof d=="function"?f(d()):Array.isArray(d)||d instanceof Set?d:[d]}(t);for(let f of l)if(f!==null&&(f.contains(u)||c.composed&&c.composedPath().includes(f)))return;return!nl(u,ki.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=E.useRef(null);Gn(e,"pointerdown",c=>{var a,u;sl()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),Gn(e,"pointerup",c=>{if(sl()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=E.useRef({x:0,y:0});Gn(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),Gn(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=il||Math.abs(a.y-i.current.y)>=il))return o(c,()=>Vn(c.target)?c.target:null)},!0),eb(e,"blur",c=>o(c,()=>dg(window.document.activeElement)?window.document.activeElement:null),!0)}function Mi(...e){return E.useMemo(()=>Ir(...e),[...e])}var nb=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(nb||{});const zo={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},rb=200,al=5;function ob(e,{trigger:t,action:n,close:r,select:o}){let s=E.useRef(null),i=E.useRef(null),c=E.useRef(null);Gn(e&&t!==null,"pointerdown",a=>{vi(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),Gn(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!Vn(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<al&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<al)return;let d=n(a);switch(d.kind){case 0:return;case 1:{a.timeStamp-f>rb&&(o(d.target),r());break}case 2:{r();break}}},{capture:!0})}function sb(e,t){return E.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 ib(e){return E.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function ab(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(c=>c()))}}}function cb(){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 ub(){return ol()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=ft();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",c=>{if(Vn(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);Vn(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(Vn(c.target)&&fg(c.target))if(r(c.target)){let a=c.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(Vn(c.target)){if(Bu(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function lb(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function fb(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let $n=ab(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:ft(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:fb(n)},o=[ub(),cb(),lb()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});$n.subscribe(()=>{let e=$n.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)&&$n.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&$n.dispatch("TEARDOWN",n)}});function db(e,t,n=()=>({containers:[]})){let r=ib($n),o=t?r.get(t):void 0,s=o?o.count>0:!1;return pe(()=>{if(!(!t||!e))return $n.dispatch("PUSH",t,n),()=>$n.dispatch("POP",t,n)},[e,t]),s}function pb(e,t,n=()=>[document.body]){let r=Qu(e,"scroll-lock");db(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function cl(e){return[e.screenX,e.screenY]}function hb(){let e=E.useRef([-1,-1]);return{wasMoved(t){let n=cl(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=cl(t)}}}function mb(e=0){let[t,n]=E.useState(e),r=E.useCallback(a=>n(a),[t]),o=E.useCallback(a=>n(u=>u|a),[t]),s=E.useCallback(a=>(t&a)===a,[t]),i=E.useCallback(a=>n(u=>u&~a),[n]),c=E.useCallback(a=>n(u=>u^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var ul,ll;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((ul=process==null?void 0:process.env)==null?void 0:ul.NODE_ENV)==="test"&&typeof((ll=Element==null?void 0:Element.prototype)==null?void 0:ll.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(`
80
- `)),[]});var gb=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(gb||{});function fl(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function dl(e,t,n,r){let[o,s]=E.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=mb(e&&o?3:0),u=E.useRef(!1),l=E.useRef(!1),f=Wn();return pe(()=>{var d;if(e){if(n&&s(!0),!t){n&&c(3);return}return(d=r==null?void 0:r.start)==null||d.call(r,n),bb(t,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){l.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var p;l.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(u.current=!1,a(7),n||s(!1),(p=r==null?void 0:r.end)==null||p.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 bb(e,{prepare:t,run:n,done:r,inFlight:o}){let s=ft();return wb(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(yb(e,r))})}),s.dispose}function yb(e,t){var n,r;let o=ft();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(c=>c instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(c=>c.finished)).then(()=>{s||t()}),o.dispose)}function wb(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 Ho(){return typeof window<"u"}function qn(e){return Li(e)?(e.nodeName||"").toLowerCase():"#document"}function je(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function At(e){var t;return(t=(Li(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Li(e){return Ho()?e instanceof Node||e instanceof je(e).Node:!1}function ce(e){return Ho()?e instanceof Element||e instanceof je(e).Element:!1}function Me(e){return Ho()?e instanceof HTMLElement||e instanceof je(e).HTMLElement:!1}function Bi(e){return!Ho()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof je(e).ShadowRoot}const vb=new Set(["inline","contents"]);function Lr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!vb.has(o)}const xb=new Set(["table","td","th"]);function Eb(e){return xb.has(qn(e))}const Sb=[":popover-open",":modal"];function Wo(e){return Sb.some(t=>{try{return e.matches(t)}catch{return!1}})}const $b=["transform","translate","scale","rotate","perspective"],Pb=["transform","translate","scale","rotate","perspective","filter"],Ab=["paint","layout","strict","content"];function Ri(e){const t=Vo(),n=ce(e)?ot(e):e;return $b.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Pb.some(r=>(n.willChange||"").includes(r))||Ab.some(r=>(n.contain||"").includes(r))}function Tb(e){let t=Wt(e);for(;Me(t)&&!Ht(t);){if(Ri(t))return t;if(Wo(t))return null;t=Wt(t)}return null}function Vo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ob=new Set(["html","body","#document"]);function Ht(e){return Ob.has(qn(e))}function ot(e){return je(e).getComputedStyle(e)}function Go(e){return ce(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wt(e){if(qn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Bi(e)&&e.host||At(e);return Bi(t)?t.host:t}function pl(e){const t=Wt(e);return Ht(t)?e.ownerDocument?e.ownerDocument.body:e.body:Me(t)&&Lr(t)?t:pl(t)}function fn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=pl(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=je(o);if(s){const c=Fi(i);return t.concat(i,i.visualViewport||[],Lr(o)?o:[],c&&n?fn(c):[])}return t.concat(o,fn(o,[],n))}function Fi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Cb(){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 Vt=Math.min,Ie=Math.max,Br=Math.round,qo=Math.floor,Tt=e=>({x:e,y:e}),Ib={left:"right",right:"left",bottom:"top",top:"bottom"},Nb={start:"end",end:"start"};function Di(e,t,n){return Ie(e,Vt(t,n))}function Pn(e,t){return typeof e=="function"?e(t):e}function dn(e){return e.split("-")[0]}function Zn(e){return e.split("-")[1]}function hl(e){return e==="x"?"y":"x"}function ji(e){return e==="y"?"height":"width"}const kb=new Set(["top","bottom"]);function Gt(e){return kb.has(dn(e))?"y":"x"}function _i(e){return hl(Gt(e))}function Mb(e,t,n){n===void 0&&(n=!1);const r=Zn(e),o=_i(e),s=ji(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Zo(i)),[i,Zo(i)]}function Lb(e){const t=Zo(e);return[Ui(e),t,Ui(t)]}function Ui(e){return e.replace(/start|end/g,t=>Nb[t])}const ml=["left","right"],gl=["right","left"],Bb=["top","bottom"],Rb=["bottom","top"];function Fb(e,t,n){switch(e){case"top":case"bottom":return n?t?gl:ml:t?ml:gl;case"left":case"right":return t?Bb:Rb;default:return[]}}function Db(e,t,n,r){const o=Zn(e);let s=Fb(dn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ui)))),s}function Zo(e){return e.replace(/left|right|bottom|top/g,t=>Ib[t])}function jb(e){return{top:0,right:0,bottom:0,left:0,...e}}function bl(e){return typeof e!="number"?jb(e):{top:e,right:e,bottom:e,left:e}}function Ko(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}}/*!
121
+ */var Ap;function PE(){return Ap||(Ap=1,process.env.NODE_ENV!=="production"&&function(){function e(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=x,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;uc.useSyncExternalStoreWithSelector=function(a,u,l,f,d){var p=o(null);if(p.current===null){var h={hasValue:!1,value:null};p.current=h}else h=p.current;p=i(function(){function v(L){if(!$){if($=!0,y=L,L=f(L),d!==void 0&&h.hasValue){var _=h.value;if(d(_,L))return T=_}return T=L}if(_=T,n(y,L))return _;var F=f(L);return d!==void 0&&d(_,F)?(y=L,_):(y=L,T=F)}var $=!1,y,T,B=l===void 0?null:l;return[function(){return v(u())},B===null?void 0:function(){return v(B())}]},[u,l,f,d]);var m=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),uc}process.env.NODE_ENV==="production"?ac.exports=SE():ac.exports=PE();var AE=ac.exports;function ct(e,t,n=vp){return AE.useSyncExternalStoreWithSelector(fe(r=>e.subscribe($E,r)),fe(()=>e.state),fe(()=>e.state),fe(t),n)}function $E(e){return e}function $p(e,t){let n=x.useId(),r=ic.get(t),[o,s]=ct(r,x.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return ye(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let lc=new Map,xo=new Map;function Tp(e){var t;let n=(t=xo.get(e))!=null?t:0;return xo.set(e,n+1),n!==0?()=>Cp(e):(lc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Cp(e))}function Cp(e){var t;let n=(t=xo.get(e))!=null?t:1;if(n===1?xo.delete(e):xo.set(e,n-1),n!==1)return;let r=lc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,lc.delete(e))}function TE(e,{allowed:t,disallowed:n}={}){let r=$p(e,"inert-others");ye(()=>{var o,s;if(!r)return;let i=Et();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(Tp(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=yo(a);if(!u)continue;let l=a.parentElement;for(;l&&l!==u.body;){for(let f of l.children)c.some(d=>f.contains(d))||i.add(Tp(f));l=l.parentElement}}return i.dispose},[r,t,n])}function CE(e,t,n){let r=_n(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});x.useEffect(()=>{if(!e)return;let o=t===null?null:nn(t)?t:t.current;if(!o)return;let s=Et();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 fc=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),OE=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var dc=(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))(dc||{}),IE=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(IE||{}),NE=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(NE||{});function Op(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(fc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function kE(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(OE)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var pc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(pc||{});function Ip(e,t=0){var n;return e===((n=yo(e))==null?void 0:n.body)?!1:st(t,{0(){return e.matches(fc)},1(){let r=e;for(;r!==null;){if(r.matches(fc))return!0;r=r.parentElement}return!1}})}var BE=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(BE||{});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 ME=["textarea","input"].join(",");function LE(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,ME))!=null?n:!1}function Np(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 RE(e,t){return DE(Op(),t,{relativeTo:e})}function DE(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?Np(e):e:t&64?kE(e):Op(e);o.length>0&&i.length>1&&(i=i.filter(p=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===p:h===p))),r=r??s.activeElement;let c=(()=>{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")})(),u=t&32?{preventScroll:!0}:{},l=0,f=i.length,d;do{if(l>=f||l+f<=0)return 0;let p=a+l;if(t&16)p=(p+f)%f;else{if(p<0)return 3;if(p>=f)return 1}d=i[p],d==null||d.focus(u),l+=c}while(d!==s.activeElement);return t&6&&LE(d)&&d.select(),2}function kp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function FE(){return/Android/gi.test(window.navigator.userAgent)}function Bp(){return kp()||FE()}function br(e,t,n,r){let o=_n(n);x.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 jE(e,t,n,r){let o=_n(n);x.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 Mp=30;function _E(e,t,n){let r=_n(n),o=x.useCallback(function(c,a){if(c.defaultPrevented)return;let u=a(c);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let l=function f(d){return typeof d=="function"?f(d()):Array.isArray(d)||d instanceof Set?d:[d]}(t);for(let f of l)if(f!==null&&(f.contains(u)||c.composed&&c.composedPath().includes(f)))return;return!Ip(u,pc.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=x.useRef(null);br(e,"pointerdown",c=>{var a,u;Bp()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),br(e,"pointerup",c=>{if(Bp()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=x.useRef({x:0,y:0});br(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),br(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Mp||Math.abs(a.y-i.current.y)>=Mp))return o(c,()=>gr(c.target)?c.target:null)},!0),jE(e,"blur",c=>o(c,()=>Xx(window.document.activeElement)?window.document.activeElement:null),!0)}function hc(...e){return x.useMemo(()=>yo(...e),[...e])}var UE=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(UE||{});const Ss={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},zE=200,Lp=5;function HE(e,{trigger:t,action:n,close:r,select:o}){let s=x.useRef(null),i=x.useRef(null),c=x.useRef(null);br(e&&t!==null,"pointerdown",a=>{tc(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),br(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!gr(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<Lp&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<Lp)return;let d=n(a);switch(d.kind){case 0:return;case 1:{a.timeStamp-f>zE&&(o(d.target),r());break}case 2:{r();break}}},{capture:!0})}function WE(e,t){return x.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 VE(e){return x.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function GE(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(c=>c()))}}}function qE(){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 ZE(){return kp()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=Et();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",c=>{if(gr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);gr(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(gr(c.target)&&Yx(c.target))if(r(c.target)){let a=c.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(gr(c.target)){if(up(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function KE(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function YE(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Un=GE(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Et(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:YE(n)},o=[ZE(),qE(),KE()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Un.subscribe(()=>{let e=Un.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)&&Un.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Un.dispatch("TEARDOWN",n)}});function XE(e,t,n=()=>({containers:[]})){let r=VE(Un),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ye(()=>{if(!(!t||!e))return Un.dispatch("PUSH",t,n),()=>Un.dispatch("POP",t,n)},[e,t]),s}function QE(e,t,n=()=>[document.body]){let r=$p(e,"scroll-lock");XE(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Rp(e){return[e.screenX,e.screenY]}function JE(){let e=x.useRef([-1,-1]);return{wasMoved(t){let n=Rp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Rp(t)}}}function e2(e=0){let[t,n]=x.useState(e),r=x.useCallback(a=>n(a),[t]),o=x.useCallback(a=>n(u=>u|a),[t]),s=x.useCallback(a=>(t&a)===a,[t]),i=x.useCallback(a=>n(u=>u&~a),[n]),c=x.useCallback(a=>n(u=>u^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var Dp,Fp;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Dp=process==null?void 0:process.env)==null?void 0:Dp.NODE_ENV)==="test"&&typeof((Fp=Element==null?void 0:Element.prototype)==null?void 0:Fp.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(`
122
+ `)),[]});var t2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(t2||{});function jp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function _p(e,t,n,r){let[o,s]=x.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=e2(e&&o?3:0),u=x.useRef(!1),l=x.useRef(!1),f=mr();return ye(()=>{var d;if(e){if(n&&s(!0),!t){n&&c(3);return}return(d=r==null?void 0:r.start)==null||d.call(r,n),n2(t,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){l.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var p;l.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(u.current=!1,a(7),n||s(!1),(p=r==null?void 0:r.end)==null||p.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 n2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Et();return o2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(r2(e,r))})}),s.dispose}function r2(e,t){var n,r;let o=Et();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(c=>c instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(c=>c.finished)).then(()=>{s||t()}),o.dispose)}function o2(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 Ps(){return typeof window<"u"}function yr(e){return mc(e)?(e.nodeName||"").toLowerCase():"#document"}function We(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mt(e){var t;return(t=(mc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mc(e){return Ps()?e instanceof Node||e instanceof We(e).Node:!1}function he(e){return Ps()?e instanceof Element||e instanceof We(e).Element:!1}function De(e){return Ps()?e instanceof HTMLElement||e instanceof We(e).HTMLElement:!1}function gc(e){return!Ps()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof We(e).ShadowRoot}const s2=new Set(["inline","contents"]);function Eo(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ut(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!s2.has(o)}const i2=new Set(["table","td","th"]);function a2(e){return i2.has(yr(e))}const c2=[":popover-open",":modal"];function As(e){return c2.some(t=>{try{return e.matches(t)}catch{return!1}})}const u2=["transform","translate","scale","rotate","perspective"],l2=["transform","translate","scale","rotate","perspective","filter"],f2=["paint","layout","strict","content"];function bc(e){const t=$s(),n=he(e)?ut(e):e;return u2.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||l2.some(r=>(n.willChange||"").includes(r))||f2.some(r=>(n.contain||"").includes(r))}function d2(e){let t=on(e);for(;De(t)&&!rn(t);){if(bc(t))return t;if(As(t))return null;t=on(t)}return null}function $s(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const p2=new Set(["html","body","#document"]);function rn(e){return p2.has(yr(e))}function ut(e){return We(e).getComputedStyle(e)}function Ts(e){return he(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function on(e){if(yr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gc(e)&&e.host||Mt(e);return gc(t)?t.host:t}function Up(e){const t=on(e);return rn(t)?e.ownerDocument?e.ownerDocument.body:e.body:De(t)&&Eo(t)?t:Up(t)}function yn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Up(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=We(o);if(s){const c=yc(i);return t.concat(i,i.visualViewport||[],Eo(o)?o:[],c&&n?yn(c):[])}return t.concat(o,yn(o,[],n))}function yc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function h2(){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 sn=Math.min,Be=Math.max,So=Math.round,Cs=Math.floor,Lt=e=>({x:e,y:e}),m2={left:"right",right:"left",bottom:"top",top:"bottom"},g2={start:"end",end:"start"};function wc(e,t,n){return Be(e,sn(t,n))}function zn(e,t){return typeof e=="function"?e(t):e}function wn(e){return e.split("-")[0]}function wr(e){return e.split("-")[1]}function zp(e){return e==="x"?"y":"x"}function vc(e){return e==="y"?"height":"width"}const b2=new Set(["top","bottom"]);function an(e){return b2.has(wn(e))?"y":"x"}function xc(e){return zp(an(e))}function y2(e,t,n){n===void 0&&(n=!1);const r=wr(e),o=xc(e),s=vc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Os(i)),[i,Os(i)]}function w2(e){const t=Os(e);return[Ec(e),t,Ec(t)]}function Ec(e){return e.replace(/start|end/g,t=>g2[t])}const Hp=["left","right"],Wp=["right","left"],v2=["top","bottom"],x2=["bottom","top"];function E2(e,t,n){switch(e){case"top":case"bottom":return n?t?Wp:Hp:t?Hp:Wp;case"left":case"right":return t?v2:x2;default:return[]}}function S2(e,t,n,r){const o=wr(e);let s=E2(wn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ec)))),s}function Os(e){return e.replace(/left|right|bottom|top/g,t=>m2[t])}function P2(e){return{top:0,right:0,bottom:0,left:0,...e}}function Vp(e){return typeof e!="number"?P2(e):{top:e,right:e,bottom:e,left:e}}function Is(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}}/*!
81
123
  * tabbable 6.2.0
82
124
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
83
- */var _b=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],zi=_b.join(","),yl=typeof Element>"u",Rr=yl?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Yo=!yl&&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},Xo=function e(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&&e(t.parentNode);return i},Ub=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},zb=function(t,n,r){if(Xo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(zi));return n&&Rr.call(t,zi)&&o.unshift(t),o=o.filter(r),o},Hb=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Xo(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,u=e(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{var l=Rr.call(i,zi);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),d=!Xo(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&d){var p=e(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:i,candidates:p})}else s.unshift.apply(s,i.children)}}return o},wl=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},vl=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Ub(t))&&!wl(t)?0:t.tabIndex},Wb=function(t,n){var r=vl(t);return r<0&&n&&!wl(t)?0:r},Vb=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},xl=function(t){return t.tagName==="INPUT"},Gb=function(t){return xl(t)&&t.type==="hidden"},qb=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Zb=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Kb=function(t){if(!t.name)return!0;var n=t.form||Yo(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},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=Zb(o,t.form);return!s||s===t},Yb=function(t){return xl(t)&&t.type==="radio"},Xb=function(t){return Yb(t)&&!Kb(t)},Qb=function(t){var n,r=t&&Yo(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var u,l,f;r=Yo(o),o=(u=r)===null||u===void 0?void 0:u.host,s=!!((l=o)!==null&&l!==void 0&&(f=l.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},El=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},Jb=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=Rr.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(Rr.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var a=t.parentElement,u=Yo(t);if(a&&!a.shadowRoot&&o(a)===!0)return El(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(Qb(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return El(t);return!1},ey=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 Rr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},ty=function(t,n){return!(n.disabled||Xo(n)||Gb(n)||Jb(n,t)||qb(n)||ey(n))},Sl=function(t,n){return!(Xb(n)||vl(n)<0||!ty(t,n))},ny=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},ry=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=Wb(c,i),u=i?e(o.candidates):c;a===0?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:u})}),r.sort(Vb).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},$l=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Hb([t],n.includeContainer,{filter:Sl.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ny}):r=zb(t,n.includeContainer,Sl.bind(null,n)),ry(r)};function Pl(e,t,n){let{reference:r,floating:o}=e;const s=Gt(t),i=_i(t),c=ji(i),a=dn(t),u=s==="y",l=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:l,y:r.y-o.height};break;case"bottom":p={x:l,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Zn(t)){case"start":p[i]-=d*(n&&u?-1:1);break;case"end":p[i]+=d*(n&&u?-1:1);break}return p}const oy=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:f}=Pl(u,r,a),d=r,p={},h=0;for(let m=0;m<c.length;m++){const{name:w,fn:O}=c[m],{x:b,y:A,data:M,reset:R}=await O({x:l,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:u,platform:i,elements:{reference:e,floating:t}});l=b??l,f=A??f,p={...p,[w]:{...p[w],...M}},R&&h<=50&&(h++,typeof R=="object"&&(R.placement&&(d=R.placement),R.rects&&(u=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):R.rects),{x:l,y:f}=Pl(u,d,a)),m=-1)}return{x:l,y:f,placement:d,strategy:o,middlewareData:p}};async function Qo(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=Pn(t,e),h=bl(p),w=c[d?f==="floating"?"reference":"floating":f],O=Ko(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(c.floating)),boundary:u,rootBoundary:l,strategy:a})),b=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),M=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},R=Ko(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:A,strategy:a}):b);return{top:(O.top-R.top+h.top)/M.y,bottom:(R.bottom-O.bottom+h.bottom)/M.y,left:(O.left-R.left+h.left)/M.x,right:(R.right-O.right+h.right)/M.x}}const sy=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:u,padding:l=0}=Pn(e,t)||{};if(u==null)return{};const f=bl(l),d={x:n,y:r},p=_i(o),h=ji(p),m=await i.getDimensions(u),w=p==="y",O=w?"top":"left",b=w?"bottom":"right",A=w?"clientHeight":"clientWidth",M=s.reference[h]+s.reference[p]-d[p]-s.floating[h],R=d[p]-s.reference[p],D=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=D?D[A]:0;(!j||!await(i.isElement==null?void 0:i.isElement(D)))&&(j=c.floating[A]||s.floating[h]);const g=M/2-R/2,v=j/2-m[h]/2-1,P=Vt(f[O],v),N=Vt(f[b],v),I=P,$=j-m[h]-N,S=j/2-m[h]/2+g,x=Di(I,S,$),T=!a.arrow&&Zn(o)!=null&&S!==x&&s.reference[h]/2-(S<I?P:N)-m[h]/2<0,C=T?S<I?S-I:S-$:0;return{[p]:d[p]+C,data:{[p]:x,centerOffset:S-x-C,...T&&{alignmentOffset:C}},reset:T}}}),iy=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:c,platform:a,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...w}=Pn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const O=dn(o),b=Gt(c),A=dn(c)===c,M=await(a.isRTL==null?void 0:a.isRTL(u.floating)),R=d||(A||!m?[Zo(c)]:Lb(c)),D=h!=="none";!d&&D&&R.push(...Db(c,m,h,M));const j=[c,...R],g=await Qo(t,w),v=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&v.push(g[O]),f){const S=Mb(o,i,M);v.push(g[S[0]],g[S[1]])}if(P=[...P,{placement:o,overflows:v}],!v.every(S=>S<=0)){var N,I;const S=(((N=s.flip)==null?void 0:N.index)||0)+1,x=j[S];if(x&&(!(f==="alignment"?b!==Gt(x):!1)||P.every(y=>Gt(y.placement)===b?y.overflows[0]>0:!0)))return{data:{index:S,overflows:P},reset:{placement:x}};let T=(I=P.filter(C=>C.overflows[0]<=0).sort((C,y)=>C.overflows[1]-y.overflows[1])[0])==null?void 0:I.placement;if(!T)switch(p){case"bestFit":{var $;const C=($=P.filter(y=>{if(D){const k=Gt(y.placement);return k===b||k==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(k=>k>0).reduce((k,F)=>k+F,0)]).sort((y,k)=>y[1]-k[1])[0])==null?void 0:$[0];C&&(T=C);break}case"initialPlacement":T=c;break}if(o!==T)return{reset:{placement:T}}}return{}}}},ay=new Set(["left","top"]);async function cy(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=dn(n),c=Zn(n),a=Gt(n)==="y",u=ay.has(i)?-1:1,l=s&&a?-1:1,f=Pn(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(p=c==="end"?h*-1:h),a?{x:p*l,y:d*u}:{x:d*u,y:p*l}}const uy=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:c}=t,a=await cy(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},ly=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:O,y:b}=w;return{x:O,y:b}}},...a}=Pn(e,t),u={x:n,y:r},l=await Qo(t,a),f=Gt(dn(o)),d=hl(f);let p=u[d],h=u[f];if(s){const w=d==="y"?"top":"left",O=d==="y"?"bottom":"right",b=p+l[w],A=p-l[O];p=Di(b,p,A)}if(i){const w=f==="y"?"top":"left",O=f==="y"?"bottom":"right",b=h+l[w],A=h-l[O];h=Di(b,h,A)}const m=c.fn({...t,[d]:p,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:s,[f]:i}}}}}},fy=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:c}=t,{apply:a=()=>{},...u}=Pn(e,t),l=await Qo(t,u),f=dn(o),d=Zn(o),p=Gt(o)==="y",{width:h,height:m}=s.floating;let w,O;f==="top"||f==="bottom"?(w=f,O=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(O=f,w=d==="end"?"top":"bottom");const b=m-l.top-l.bottom,A=h-l.left-l.right,M=Vt(m-l[w],b),R=Vt(h-l[O],A),D=!t.middlewareData.shift;let j=M,g=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=A),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=b),D&&!d){const P=Ie(l.left,0),N=Ie(l.right,0),I=Ie(l.top,0),$=Ie(l.bottom,0);p?g=h-2*(P!==0||N!==0?P+N:Ie(l.left,l.right)):j=m-2*(I!==0||$!==0?I+$:Ie(l.top,l.bottom))}await a({...t,availableWidth:g,availableHeight:j});const v=await i.getDimensions(c.floating);return h!==v.width||m!==v.height?{reset:{rects:!0}}:{}}}};function Al(e){const t=ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Me(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Br(n)!==s||Br(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Hi(e){return ce(e)?e:e.contextElement}function Kn(e){const t=Hi(e);if(!Me(t))return Tt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Al(t);let i=(s?Br(n.width):n.width)/r,c=(s?Br(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const dy=Tt(0);function Tl(e){const t=je(e);return!Vo()||!t.visualViewport?dy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function py(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==je(e)?!1:t}function An(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Hi(e);let i=Tt(1);t&&(r?ce(r)&&(i=Kn(r)):i=Kn(e));const c=py(s,n,r)?Tl(s):Tt(0);let a=(o.left+c.x)/i.x,u=(o.top+c.y)/i.y,l=o.width/i.x,f=o.height/i.y;if(s){const d=je(s),p=r&&ce(r)?je(r):r;let h=d,m=Fi(h);for(;m&&r&&p!==h;){const w=Kn(m),O=m.getBoundingClientRect(),b=ot(m),A=O.left+(m.clientLeft+parseFloat(b.paddingLeft))*w.x,M=O.top+(m.clientTop+parseFloat(b.paddingTop))*w.y;a*=w.x,u*=w.y,l*=w.x,f*=w.y,a+=A,u+=M,h=je(m),m=Fi(h)}}return Ko({width:l,height:f,x:a,y:u})}function Jo(e,t){const n=Go(e).scrollLeft;return t?t.left+n:An(At(e)).left+n}function Ol(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function hy(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=At(r),c=t?Wo(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Tt(1);const l=Tt(0),f=Me(r);if((f||!f&&!s)&&((qn(r)!=="body"||Lr(i))&&(a=Go(r)),Me(r))){const p=An(r);u=Kn(r),l.x=p.x+r.clientLeft,l.y=p.y+r.clientTop}const d=i&&!f&&!s?Ol(i,a):Tt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+d.x,y:n.y*u.y-a.scrollTop*u.y+l.y+d.y}}function my(e){return Array.from(e.getClientRects())}function gy(e){const t=At(e),n=Go(e),r=e.ownerDocument.body,o=Ie(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ie(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Jo(e);const c=-n.scrollTop;return ot(r).direction==="rtl"&&(i+=Ie(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Cl=25;function by(e,t){const n=je(e),r=At(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const l=Vo();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Jo(r);if(u<=0){const l=r.ownerDocument,f=l.body,d=getComputedStyle(f),p=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-p);h<=Cl&&(s-=h)}else u<=Cl&&(s+=u);return{width:s,height:i,x:c,y:a}}const yy=new Set(["absolute","fixed"]);function wy(e,t){const n=An(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Me(e)?Kn(e):Tt(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,u=r*s.y;return{width:i,height:c,x:a,y:u}}function Il(e,t,n){let r;if(t==="viewport")r=by(e,n);else if(t==="document")r=gy(At(e));else if(ce(t))r=wy(t,n);else{const o=Tl(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ko(r)}function Nl(e,t){const n=Wt(e);return n===t||!ce(n)||Ht(n)?!1:ot(n).position==="fixed"||Nl(n,t)}function vy(e,t){const n=t.get(e);if(n)return n;let r=fn(e,[],!1).filter(c=>ce(c)&&qn(c)!=="body"),o=null;const s=ot(e).position==="fixed";let i=s?Wt(e):e;for(;ce(i)&&!Ht(i);){const c=ot(i),a=Ri(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&yy.has(o.position)||Lr(i)&&!a&&Nl(e,i))?r=r.filter(l=>l!==i):o=c,i=Wt(i)}return t.set(e,r),r}function xy(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Wo(t)?[]:vy(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=Il(t,l,o);return u.top=Ie(f.top,u.top),u.right=Vt(f.right,u.right),u.bottom=Vt(f.bottom,u.bottom),u.left=Ie(f.left,u.left),u},Il(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ey(e){const{width:t,height:n}=Al(e);return{width:t,height:n}}function Sy(e,t,n){const r=Me(t),o=At(t),s=n==="fixed",i=An(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Tt(0);function u(){a.x=Jo(o)}if(r||!r&&!s)if((qn(t)!=="body"||Lr(o))&&(c=Go(t)),r){const p=An(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?Ol(o,c):Tt(0),f=i.left+c.scrollLeft-a.x-l.x,d=i.top+c.scrollTop-a.y-l.y;return{x:f,y:d,width:i.width,height:i.height}}function Wi(e){return ot(e).position==="static"}function kl(e,t){if(!Me(e)||ot(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return At(e)===n&&(n=n.ownerDocument.body),n}function Ml(e,t){const n=je(e);if(Wo(e))return n;if(!Me(e)){let o=Wt(e);for(;o&&!Ht(o);){if(ce(o)&&!Wi(o))return o;o=Wt(o)}return n}let r=kl(e,t);for(;r&&Eb(r)&&Wi(r);)r=kl(r,t);return r&&Ht(r)&&Wi(r)&&!Ri(r)?n:r||Tb(e)||n}const $y=async function(e){const t=this.getOffsetParent||Ml,n=this.getDimensions,r=await n(e.floating);return{reference:Sy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Py(e){return ot(e).direction==="rtl"}const Ay={convertOffsetParentRelativeRectToViewportRelativeRect:hy,getDocumentElement:At,getClippingRect:xy,getOffsetParent:Ml,getElementRects:$y,getClientRects:my,getDimensions:Ey,getScale:Kn,isElement:ce,isRTL:Py};function Ll(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ty(e,t){let n=null,r;const o=At(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=e.getBoundingClientRect(),{left:l,top:f,width:d,height:p}=u;if(c||t(),!d||!p)return;const h=qo(f),m=qo(o.clientWidth-(l+d)),w=qo(o.clientHeight-(f+p)),O=qo(l),A={rootMargin:-h+"px "+-m+"px "+-w+"px "+-O+"px",threshold:Ie(0,Vt(1,a))||1};let M=!0;function R(D){const j=D[0].intersectionRatio;if(j!==a){if(!M)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!Ll(u,e.getBoundingClientRect())&&i(),M=!1}try{n=new IntersectionObserver(R,{...A,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,A)}n.observe(e)}return i(!0),s}function Bl(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Hi(e),l=o||s?[...u?fn(u):[],...fn(t)]:[];l.forEach(O=>{o&&O.addEventListener("scroll",n,{passive:!0}),s&&O.addEventListener("resize",n)});const f=u&&c?Ty(u,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(O=>{let[b]=O;b&&b.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=p)==null||A.observe(t)})),n()}),u&&!a&&p.observe(u),p.observe(t));let h,m=a?An(e):null;a&&w();function w(){const O=An(e);m&&!Ll(m,O)&&n(),m=O,h=requestAnimationFrame(w)}return n(),()=>{var O;l.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),f==null||f(),(O=p)==null||O.disconnect(),p=null,a&&cancelAnimationFrame(h)}}const Vi=Qo,Oy=uy,Cy=ly,Iy=iy,Ny=fy,Rl=sy,ky=(e,t,n)=>{const r=new Map,o={platform:Ay,...n},s={...o.platform,_c:r};return oy(e,t,{...o,platform:s})};var My=typeof document<"u",Ly=function(){},es=My?E.useLayoutEffect:Ly;function ts(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(!ts(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)&&!ts(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Fl(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dl(e,t){const n=Fl(e);return Math.round(t*n)/n}function Gi(e){const t=U.useRef(e);return es(()=>{t.current=e}),t}function jl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:u}=e,[l,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=U.useState(r);ts(d,r)||p(r);const[h,m]=U.useState(null),[w,O]=U.useState(null),b=U.useCallback(y=>{y!==D.current&&(D.current=y,m(y))},[]),A=U.useCallback(y=>{y!==j.current&&(j.current=y,O(y))},[]),M=s||h,R=i||w,D=U.useRef(null),j=U.useRef(null),g=U.useRef(l),v=a!=null,P=Gi(a),N=Gi(o),I=Gi(u),$=U.useCallback(()=>{if(!D.current||!j.current)return;const y={placement:t,strategy:n,middleware:d};N.current&&(y.platform=N.current),ky(D.current,j.current,y).then(k=>{const F={...k,isPositioned:I.current!==!1};S.current&&!ts(g.current,F)&&(g.current=F,Pr.flushSync(()=>{f(F)}))})},[d,t,n,N,I]);es(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(y=>({...y,isPositioned:!1})))},[u]);const S=U.useRef(!1);es(()=>(S.current=!0,()=>{S.current=!1}),[]),es(()=>{if(M&&(D.current=M),R&&(j.current=R),M&&R){if(P.current)return P.current(M,R,$);$()}},[M,R,$,P,v]);const x=U.useMemo(()=>({reference:D,floating:j,setReference:b,setFloating:A}),[b,A]),T=U.useMemo(()=>({reference:M,floating:R}),[M,R]),C=U.useMemo(()=>{const y={position:n,left:0,top:0};if(!T.floating)return y;const k=Dl(T.floating,l.x),F=Dl(T.floating,l.y);return c?{...y,transform:"translate("+k+"px, "+F+"px)",...Fl(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:F}},[n,c,T.floating,l.x,l.y]);return U.useMemo(()=>({...l,update:$,refs:x,elements:T,floatingStyles:C}),[l,$,x,T,C])}const By=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?Rl({element:r.current,padding:o}).fn(n):{}:r?Rl({element:r,padding:o}).fn(n):{}}}},qi=(e,t)=>({...Oy(e),options:[e,t]}),_l=(e,t)=>({...Cy(e),options:[e,t]}),Ul=(e,t)=>({...Iy(e),options:[e,t]}),Ry=(e,t)=>({...Ny(e),options:[e,t]}),Fy=(e,t)=>({...By(e),options:[e,t]}),zl={...U},Dy=zl.useInsertionEffect||(e=>e());function Hl(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Dy(()=>{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 Zi=typeof document<"u"?E.useLayoutEffect:E.useEffect;let Wl=!1,jy=0;const Vl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+jy++;function _y(){const[e,t]=U.useState(()=>Wl?Vl():void 0);return Zi(()=>{e==null&&t(Vl())},[]),U.useEffect(()=>{Wl=!0},[]),e}const Uy=zl.useId||_y;let Fr;process.env.NODE_ENV!=="production"&&(Fr=new Set);function zy(){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=Fr)!=null&&e.has(o))){var s;(s=Fr)==null||s.add(o),console.warn(o)}}function Hy(){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=Fr)!=null&&e.has(o))){var s;(s=Fr)==null||s.add(o),console.error(o)}}function Wy(){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 Vy=U.createContext(null),Gy=U.createContext(null),qy=()=>{var e;return((e=U.useContext(Vy))==null?void 0:e.id)||null},Zy=()=>U.useContext(Gy),Ky="data-floating-ui-focusable";function Yy(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Uy(),s=U.useRef({}),[i]=U.useState(()=>Wy()),c=qy()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!ce(p)&&Hy("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=U.useState(r.reference),l=Hl((p,h,m)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:m,nested:c}),n==null||n(p,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),d=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:l,elements:d,events:i,floatingId:o,refs:f}),[t,l,d,i,o,f])}function Xy(e){e===void 0&&(e={});const{nodeId:t}=e,n=Yy({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),d=Zy();Zi(()=>{l&&(f.current=l)},[l]);const p=jl({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(A=>{const M=ce(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),contextElement:A}:A;a(M),p.refs.setReference(M)},[p.refs]),m=U.useCallback(A=>{(ce(A)||A===null)&&(f.current=A,i(A)),(ce(p.refs.reference.current)||p.refs.reference.current===null||A!==null&&!ce(A))&&p.refs.setReference(A)},[p.refs]),w=U.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:f}),[p.refs,m,h]),O=U.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),b=U.useMemo(()=>({...p,...r,refs:w,elements:O,nodeId:t}),[p,w,O,t,r]);return Zi(()=>{r.dataRef.current.floatingContext=b;const A=d==null?void 0:d.nodesRef.current.find(M=>M.id===t);A&&(A.context=b)}),U.useMemo(()=>({...p,context:b,refs:w,elements:O}),[p,w,O,b])}const Gl="active",ql="selected";function Ki(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Gl]:i,[ql]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Ky]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[Gl,ql].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var d,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(d=r.get(u))==null?void 0:d.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function Qy(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=U.useCallback(c=>Ki(c,e,"reference"),t),s=U.useCallback(c=>Ki(c,e,"floating"),n),i=U.useCallback(c=>Ki(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Zl(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Jy=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:u,...l}=Pn(e,t),{rects:f,elements:{floating:d}}=t,p=n.current[i],h=(u==null?void 0:u.current)||d,m=d.clientTop||h.clientTop,w=d.clientTop!==0,O=h.clientTop!==0,b=d===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||zy('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const A={...t,...await qi(-p.offsetTop-d.clientTop-f.reference.height/2-p.offsetHeight/2-s).fn(t)},M=await Vi(Zl(A,h.scrollHeight+m+d.clientTop),l),R=await Vi(A,{...l,elementContext:"reference"}),D=Ie(0,M.top),j=A.y+D,P=(h.scrollHeight>h.clientHeight?N=>N:Br)(Ie(0,h.scrollHeight+(w&&b||O?m*2:0)-D-Ie(0,M.bottom)));if(h.style.maxHeight=P+"px",h.scrollTop=D,o){const N=h.offsetHeight<p.offsetHeight*Vt(c,n.current.length)-1||R.top>=-a||R.bottom>=-a;Pr.flushSync(()=>o(N))}return r&&(r.current=await Vi(Zl({...A,y:j},h.offsetHeight+m+d.clientTop),l)),{y:j}}});function e1(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Hl(c),u=U.useRef(!1),l=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function p(m){if(m.ctrlKey||!h||s.current==null)return;const w=m.deltaY,O=s.current.top>=-.5,b=s.current.bottom>=-.5,A=h.scrollHeight-h.clientHeight,M=w<0?-1:1,R=w<0?"max":"min";h.scrollHeight<=h.clientHeight||(!O&&w>0||!b&&w<0?(m.preventDefault(),Pr.flushSync(()=>{a(D=>D+Math[R](w,A*M))})):/firefox/i.test(Cb())&&(h.scrollTop+=w))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",p),requestAnimationFrame(()=>{l.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{l.current=null,f.current=null,h.removeEventListener("wheel",p)}},[o,n,r.floating,s,i,a]);const d=U.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const p=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!p||!u.current)){if(l.current!==null){const h=p.scrollTop-l.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Pr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=p.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:d}:{},[o,d])}let Yn=E.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Yn.displayName="FloatingContext";let Yi=E.createContext(null);Yi.displayName="PlacementContext";function t1(e){return E.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function n1(){return E.useContext(Yn).setReference}function r1(){return E.useContext(Yn).getReferenceProps}function o1(){let{getFloatingProps:e,slot:t}=E.useContext(Yn);return E.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function s1(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=E.useContext(Yi),n=E.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);pe(()=>{t==null||t(n??null)},[t,n]);let r=E.useContext(Yn);return E.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Kl=4;function i1({children:e,enabled:t=!0}){let[n,r]=E.useState(null),[o,s]=E.useState(0),i=E.useRef(null),[c,a]=E.useState(null);a1(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:d=0,padding:p=0,inner:h}=c1(n,c),[m,w="center"]=l.split(" ");pe(()=>{u&&s(0)},[u]);let{refs:O,floatingStyles:b,context:A}=Xy({open:u,placement:m==="selection"?w==="center"?"bottom":`bottom-${w}`:w==="center"?`${m}`:`${m}-${w}`,strategy:"absolute",transform:!1,middleware:[qi({mainAxis:m==="selection"?0:f,crossAxis:d}),_l({padding:p}),m!=="selection"&&Ul({padding:p}),m==="selection"&&h?Jy({...h,padding:p,overflowRef:i,offset:o,minItemsVisible:Kl,referenceOverflowThreshold:p,onFallbackChange(N){var I,$;if(!N)return;let S=A.elements.floating;if(!S)return;let x=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,T=Math.min(Kl,S.childElementCount),C=0,y=0;for(let k of($=(I=A.elements.floating)==null?void 0:I.childNodes)!=null?$:[])if(zt(k)){let F=k.offsetTop,_=F+k.clientHeight+x,z=S.scrollTop,H=z+S.clientHeight;if(F>=z&&_<=H)T--;else{y=Math.max(0,Math.min(_,H)-Math.max(F,z)),C=k.clientHeight;break}}T>=1&&s(k=>{let F=C*T-y+x;return k>=F?k:F})}}):null,Ry({padding:p,apply({availableWidth:N,availableHeight:I,elements:$}){Object.assign($.floating.style,{overflow:"auto",maxWidth:`${N}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${I}px)`})}})].filter(Boolean),whileElementsMounted:Bl}),[M=m,R=w]=A.placement.split("-");m==="selection"&&(M="selection");let D=E.useMemo(()=>({anchor:[M,R].filter(Boolean).join(" ")}),[M,R]),j=e1(A,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:v}=Qy([j]),P=ie(N=>{a(N),O.setFloating(N)});return U.createElement(Yi.Provider,{value:r},U.createElement(Yn.Provider,{value:{setFloating:P,setReference:O.setReference,styles:b,getReferenceProps:g,getFloatingProps:v,slot:D}},e))}function a1(e){pe(()=>{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 c1(e,t){var n,r,o;let s=Xi((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Xi((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Xi((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Xi(e,t,n=void 0){let r=Wn(),o=ie((a,u)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!u)return[n,null];let l=Xl(a,u);return[l,f=>{let d=Yl(a);{let p=d.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[O,b]of d.entries()){let A=window.getComputedStyle(u).getPropertyValue(b);if(p[O]!==A){p[O]=A,m=!0;break}}if(!m)return;let w=Xl(a,u);l!==w&&(f(w),l=w)})}return r.dispose}]}return[n,null]}),s=E.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=E.useState();return pe(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function Yl(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,...Yl(o)]:[r]}return[]}function Xl(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 u1(e,t){let[n,r]=E.useState(t);return!e&&n!==t&&r(t),e?n:t}let Qi=E.createContext(null);Qi.displayName="OpenClosedContext";var dt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(dt||{});function Ji(){return E.useContext(Qi)}function Ql({value:e,children:t}){return E.createElement(Qi.Provider,{value:e},t)}function l1(e){throw new Error("Unexpected object: "+e)}var ge=(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))(ge||{});function ns(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:l1(e)}}var Jl=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Jl||{});function ef(e){let t=ie(e),n=E.useRef(!1);E.useEffect(()=>(n.current=!1,()=>{n.current=!0,Tu(()=>{n.current&&t()})}),[t])}function f1(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function ea(){let e=f1(),[t,n]=U.useState($t.isHandoffComplete);return t&&$t.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>$t.handoff(),[]),e?!1:t}let d1=E.createContext(!1);function p1(){return E.useContext(d1)}function h1(e){let t=p1(),n=E.useContext(nf),[r,o]=E.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if($t.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return E.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),E.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let tf=E.Fragment,m1=De(function(e,t){let{ownerDocument:n=null,...r}=e,o=E.useRef(null),s=tt(bg(p=>{o.current=p}),t),i=Mi(o),c=n??i,a=h1(c),[u]=E.useState(()=>{var p;return $t.isServer?null:(p=c==null?void 0:c.createElement("div"))!=null?p:null}),l=E.useContext(w1),f=ea();pe(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),pe(()=>{if(u&&l)return l.register(u)},[l,u]),ef(()=>{var p;!a||!u||(vi(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a)))});let d=Ge();return f?!a||!u?null:Ne.createPortal(d({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:tf,name:"Portal"}),u):null});function g1(e,t){let n=tt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ge();return r?E.createElement(m1,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:tf,name:"Portal"})}let b1=E.Fragment,nf=E.createContext(null);function y1(e,t){let{target:n,...r}=e,o={ref:tt(t)},s=Ge();return E.createElement(nf.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:b1,name:"Popover.Group"}))}let w1=E.createContext(null),v1=De(g1),x1=De(y1),E1=Object.assign(v1,{Group:x1});function S1(){let e=E.useRef(!1);return pe(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function rf(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:sf)!==E.Fragment||E.Children.count(e.children)===1}let rs=E.createContext(null);rs.displayName="TransitionContext";var $1=(e=>(e.Visible="visible",e.Hidden="hidden",e))($1||{});function P1(){let e=E.useContext(rs);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function A1(){let e=E.useContext(os);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let os=E.createContext(null);os.displayName="NestingContext";function ss(e){return"children"in e?ss(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function of(e,t){let n=Sn(e),r=E.useRef([]),o=S1(),s=Wn(),i=ie((p,h=un.Hidden)=>{let m=r.current.findIndex(({el:w})=>w===p);m!==-1&&(et(h,{[un.Unmount](){r.current.splice(m,1)},[un.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var w;!ss(r)&&o.current&&((w=n.current)==null||w.call(n))}))}),c=ie(p=>{let h=r.current.find(({el:m})=>m===p);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:p,state:"visible"}),()=>i(p,un.Unmount)}),a=E.useRef([]),u=E.useRef(Promise.resolve()),l=E.useRef({enter:[],leave:[]}),f=ie((p,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([w])=>w!==p)),t==null||t.chains.current[h].push([p,new Promise(w=>{a.current.push(w)})]),t==null||t.chains.current[h].push([p,new Promise(w=>{Promise.all(l.current[h].map(([O,b])=>b)).then(()=>w())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),d=ie((p,h,m)=>{Promise.all(l.current[h].splice(0).map(([w,O])=>O)).then(()=>{var w;(w=a.current.shift())==null||w()}).then(()=>m(h))});return E.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:d,wait:u,chains:l}),[c,i,r,f,d,l,u])}let sf=E.Fragment,af=Do.RenderStrategy;function T1(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:f,entered:d,leave:p,leaveFrom:h,leaveTo:m,...w}=e,[O,b]=E.useState(null),A=E.useRef(null),M=rf(e),R=tt(...M?[A,t,b]:t===null?[]:[t]),D=(n=w.unmount)==null||n?un.Unmount:un.Hidden,{show:j,appear:g,initial:v}=P1(),[P,N]=E.useState(j?"visible":"hidden"),I=A1(),{register:$,unregister:S}=I;pe(()=>$(A),[$,A]),pe(()=>{if(D===un.Hidden&&A.current){if(j&&P!=="visible"){N("visible");return}return et(P,{hidden:()=>S(A),visible:()=>$(A)})}},[P,A,$,S,j,D]);let x=ea();pe(()=>{if(M&&x&&P==="visible"&&A.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[A,P,x,M]);let T=v&&!g,C=g&&j&&v,y=E.useRef(!1),k=of(()=>{y.current||(N("hidden"),S(A))},I),F=ie(q=>{y.current=!0;let Q=q?"enter":"leave";k.onStart(A,Q,te=>{te==="enter"?s==null||s():te==="leave"&&(c==null||c())})}),_=ie(q=>{let Q=q?"enter":"leave";y.current=!1,k.onStop(A,Q,te=>{te==="enter"?i==null||i():te==="leave"&&(a==null||a())}),Q==="leave"&&!ss(k)&&(N("hidden"),S(A))});E.useEffect(()=>{M&&o||(F(j),_(j))},[j,M,o]);let z=!(!o||!M||!x||T),[,H]=dl(z,O,j,{start:F,end:_}),K=ln({ref:R,className:((r=bi(w.className,C&&u,C&&l,H.enter&&u,H.enter&&H.closed&&l,H.enter&&!H.closed&&f,H.leave&&p,H.leave&&!H.closed&&h,H.leave&&H.closed&&m,!H.transition&&j&&d))==null?void 0:r.trim())||void 0,...fl(H)}),W=0;P==="visible"&&(W|=dt.Open),P==="hidden"&&(W|=dt.Closed),j&&P==="hidden"&&(W|=dt.Opening),!j&&P==="visible"&&(W|=dt.Closing);let Z=Ge();return E.createElement(os.Provider,{value:k},E.createElement(Ql,{value:W},Z({ourProps:K,theirProps:w,defaultTag:sf,features:af,visible:P==="visible",name:"Transition.Child"})))}function O1(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=E.useRef(null),c=rf(e),a=tt(...c?[i,t]:t===null?[]:[t]);ea();let u=Ji();if(n===void 0&&u!==null&&(n=(u&dt.Open)===dt.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=E.useState(n?"visible":"hidden"),d=of(()=>{n||f("hidden")}),[p,h]=E.useState(!0),m=E.useRef([n]);pe(()=>{p!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let w=E.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);pe(()=>{n?f("visible"):!ss(d)&&i.current!==null&&f("hidden")},[n,d]);let O={unmount:o},b=ie(()=>{var R;p&&h(!1),(R=e.beforeEnter)==null||R.call(e)}),A=ie(()=>{var R;p&&h(!1),(R=e.beforeLeave)==null||R.call(e)}),M=Ge();return E.createElement(os.Provider,{value:d},E.createElement(rs.Provider,{value:w},M({ourProps:{...O,as:E.Fragment,children:E.createElement(cf,{ref:a,...O,...s,beforeEnter:b,beforeLeave:A})},theirProps:{},defaultTag:E.Fragment,features:af,visible:l==="visible",name:"Transition"})))}function C1(e,t){let n=E.useContext(rs)!==null,r=Ji()!==null;return E.createElement(E.Fragment,null,!n&&r?E.createElement(ta,{ref:t,...e}):E.createElement(cf,{ref:t,...e}))}let ta=De(O1),cf=De(T1),I1=De(C1),N1=Object.assign(ta,{Child:I1,Root:ta});function k1(e,t){let n=E.useRef({left:0,top:0});if(pe(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let uf=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function lf(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!zt(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return uf.test(i)&&(i=i.replace(uf,"")),i}function M1(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():lf(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return lf(e).trim()}function L1(e){let t=E.useRef(""),n=E.useRef("");return ie(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=M1(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var B1=Object.defineProperty,R1=(e,t,n)=>t in e?B1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ff=(e,t,n)=>(R1(e,typeof t!="symbol"?t+"":t,n),n),Oe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Oe||{}),Ot=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ot||{}),is=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(is||{}),df=(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.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(df||{});function pf(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=rl(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 F1={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ge.Nothing},listboxState:1,__demoMode:!1}},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,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ge.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ge.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===ge.Previous){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,d=ns(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(d!==null){let p=e.options[d].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===p.current||((o=p.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:d}}}}else if(t.focus===ge.Next){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,d=ns(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(d!==null){let p=e.options[d].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===p.current||((i=p.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:d}}}}let a=pf(e),u=ns(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});return{...c,...a,activeOptionIndex:u}},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 c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.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,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ge.Nothing&&(r=ns(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:ge.Nothing},pendingShouldSort:!0}},6:(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}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...pf(e),pendingShouldSort:!1}:e};class na extends Vu{constructor(t){super(t),ff(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return et(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(u=>o(u,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:$i(()=>{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:5,options:n.splice(0)}))]}),unregisterOption:$i(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:$i(()=>{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:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ge.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),ff(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},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=Pi.get(null);this.disposables.add(r.on(Ku.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))}}static new({id:t,__demoMode:n=!1}){return new na({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ge.Nothing},__demoMode:n})}reduce(t,n){return et(n.type,F1,t,n)}}const hf=E.createContext(null);function ra(e){let t=E.useContext(hf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,mf),n}return t}function mf({id:e,__demoMode:t=!1}){let n=E.useMemo(()=>na.new({id:e,__demoMode:t}),[]);return ef(()=>n.dispose()),n}let as=E.createContext(null);as.displayName="ListboxDataContext";function Dr(e){let t=E.useContext(as);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Dr),n}return t}let D1=E.Fragment;function j1(e,t){let n=E.useId(),r=gi(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:f=r||!1,horizontal:d=!1,multiple:p=!1,__demoMode:h=!1,...m}=e;const w=d?"horizontal":"vertical";let O=tt(t),b=ng(s),[A=p?[]:void 0,M]=tg(o,a,b),R=mf({id:n,__demoMode:h}),D=E.useRef({static:!1,hold:!1}),j=E.useRef(new Map),g=Og(u),v=E.useCallback(z=>et(P.mode,{[Ot.Multi]:()=>A.some(H=>g(H,z)),[Ot.Single]:()=>g(A,z)}),[A]),P=E.useMemo(()=>({value:A,disabled:f,invalid:l,mode:p?Ot.Multi:Ot.Single,orientation:w,onChange:M,compare:g,isSelected:v,optionsPropsRef:D,listRef:j}),[A,f,l,p,w,M,g,v,D,j]);pe(()=>{R.state.dataRef.current=P},[P]);let N=rt(R,z=>z.listboxState),I=Pi.get(null),$=rt(I,E.useCallback(z=>I.selectors.isTop(z,n),[I,n])),[S,x]=rt(R,z=>[z.buttonElement,z.optionsElement]);tb($,[S,x],(z,H)=>{R.send({type:df.CloseListbox}),nl(H,ki.Loose)||(z.preventDefault(),S==null||S.focus())});let T=E.useMemo(()=>({open:N===Oe.Open,disabled:f,invalid:l,value:A}),[N,f,l,A]),[C,y]=Eg({inherit:!0}),k={ref:O},F=E.useCallback(()=>{if(b!==void 0)return M==null?void 0:M(b)},[M,b]),_=Ge();return E.createElement(y,{value:C,props:{htmlFor:S==null?void 0:S.id},slot:{open:N===Oe.Open,disabled:f}},E.createElement(i1,null,E.createElement(hf.Provider,{value:R},E.createElement(as.Provider,{value:P},E.createElement(Ql,{value:et(N,{[Oe.Open]:dt.Open,[Oe.Closed]:dt.Closed})},c!=null&&A!=null&&E.createElement(cg,{disabled:f,data:{[c]:A},form:i,onReset:F}),_({ourProps:k,theirProps:m,slot:T,defaultTag:D1,name:"Listbox"}))))))}let _1="button";function U1(e,t){let n=E.useId(),r=Lu(),o=Dr("Listbox.Button"),s=ra("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=tt(t,n1(),s.actions.setButtonElement),f=r1(),[d,p,h]=rt(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),m=d===Oe.Open;ob(m,{trigger:p,action:E.useCallback(y=>{if(p!=null&&p.contains(y.target))return zo.Ignore;let k=y.target.closest('[role="option"]:not([data-disabled])');return zt(k)?zo.Select(k):h!=null&&h.contains(y.target)?zo.Ignore:zo.Close},[p,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let w=ie(y=>{switch(y.key){case Te.Enter:rg(y.currentTarget);break;case Te.Space:case Te.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?ge.Nothing:ge.First});break;case Te.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?ge.Nothing:ge.Last});break}}),O=ie(y=>{switch(y.key){case Te.Space:y.preventDefault();break}}),b=ie(y=>{var k;if(y.button===Jl.Left){if(mg(y.currentTarget))return y.preventDefault();s.state.listboxState===Oe.Open?(Ne.flushSync(()=>s.actions.closeListbox()),(k=s.state.buttonElement)==null||k.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:ge.Nothing}))}}),A=E.useRef(null),M=ie(y=>{A.current=y.pointerType,y.pointerType==="mouse"&&b(y)}),R=ie(y=>{A.current!=="mouse"&&b(y)}),D=ie(y=>y.preventDefault()),j=Uu([i]),g=yg(),{isFocusVisible:v,focusProps:P}=Hm({autoFocus:a}),{isHovered:N,hoverProps:I}=zm({isDisabled:c}),{pressed:$,pressProps:S}=Km({disabled:c}),x=E.useMemo(()=>({open:d===Oe.Open,active:$||d===Oe.Open,disabled:c,invalid:o.invalid,value:o.value,hover:N,focus:v,autofocus:a}),[d,o.value,c,N,v,$,o.invalid,a]),T=rt(s,y=>y.listboxState===Oe.Open),C=Cu(f(),{ref:l,id:i,type:sb(e,p),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":T,"aria-labelledby":j,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:w,onKeyUp:O,onKeyPress:D,onPointerDown:M,onClick:R},P,I,S);return Ge()({ourProps:C,theirProps:u,slot:x,defaultTag:_1,name:"Listbox.Button"})}let gf=E.createContext(!1),z1="div",H1=Do.RenderStrategy|Do.Static;function W1(e,t){let n=E.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=t1(o),[l,f]=E.useState(null);u&&(s=!0);let d=Dr("Listbox.Options"),p=ra("Listbox.Options"),[h,m,w,O]=rt(p,q=>[q.listboxState,q.buttonElement,q.optionsElement,q.__demoMode]),b=Mi(m),A=Mi(w),M=Ji(),[R,D]=dl(c,l,M!==null?(M&dt.Open)===dt.Open:h===Oe.Open);Hg(R,m,p.actions.closeListbox);let j=O?!1:i&&h===Oe.Open;pb(j,A);let g=O?!1:i&&h===Oe.Open;zg(g,{allowed:E.useCallback(()=>[m,w],[m,w])});let v=h!==Oe.Open,P=k1(v,m)?!1:R,N=R&&h===Oe.Closed,I=u1(N,d.value),$=ie(q=>d.compare(I,q)),S=rt(p,q=>{var Q;if(u==null||!((Q=u==null?void 0:u.to)!=null&&Q.includes("selection")))return null;let te=q.options.findIndex(ue=>$(ue.dataRef.current.value));return te===-1&&(te=0),te}),x=(()=>{if(u==null)return;if(S===null)return{...u,inner:void 0};let q=Array.from(d.listRef.current.values());return{...u,inner:{listRef:{current:q},index:S}}})(),[T,C]=s1(x),y=o1(),k=tt(t,u?T:null,p.actions.setOptionsElement,f),F=Wn();E.useEffect(()=>{var q;let Q=w;Q&&h===Oe.Open&&Q!==((q=Ir(Q))==null?void 0:q.activeElement)&&(Q==null||Q.focus({preventScroll:!0}))},[h,w]);let _=ie(q=>{var Q,te;switch(F.dispose(),q.key){case Te.Space:if(p.state.searchQuery!=="")return q.preventDefault(),q.stopPropagation(),p.actions.search(q.key);case Te.Enter:if(q.preventDefault(),q.stopPropagation(),p.state.activeOptionIndex!==null){let{dataRef:ue}=p.state.options[p.state.activeOptionIndex];p.actions.onChange(ue.current.value)}d.mode===Ot.Single&&(Ne.flushSync(()=>p.actions.closeListbox()),(Q=p.state.buttonElement)==null||Q.focus({preventScroll:!0}));break;case et(d.orientation,{vertical:Te.ArrowDown,horizontal:Te.ArrowRight}):return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ge.Next});case et(d.orientation,{vertical:Te.ArrowUp,horizontal:Te.ArrowLeft}):return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ge.Previous});case Te.Home:case Te.PageUp:return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ge.First});case Te.End:case Te.PageDown:return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ge.Last});case Te.Escape:q.preventDefault(),q.stopPropagation(),Ne.flushSync(()=>p.actions.closeListbox()),(te=p.state.buttonElement)==null||te.focus({preventScroll:!0});return;case Te.Tab:q.preventDefault(),q.stopPropagation(),Ne.flushSync(()=>p.actions.closeListbox()),Xg(p.state.buttonElement,q.shiftKey?Ni.Previous:Ni.Next);break;default:q.key.length===1&&(p.actions.search(q.key),F.setTimeout(()=>p.actions.clearSearch(),350));break}}),z=rt(p,q=>{var Q;return(Q=q.buttonElement)==null?void 0:Q.id}),H=E.useMemo(()=>({open:h===Oe.Open}),[h]),K=Cu(u?y():{},{id:r,ref:k,"aria-activedescendant":rt(p,p.selectors.activeDescendantId),"aria-multiselectable":d.mode===Ot.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":d.orientation,onKeyDown:_,role:"listbox",tabIndex:h===Oe.Open?0:void 0,style:{...a.style,...C,"--button-width":Ig(m,!0).width},...fl(D)}),W=Ge(),Z=E.useMemo(()=>d.mode===Ot.Multi?d:{...d,isSelected:$},[d,$]);return E.createElement(E1,{enabled:s?e.static||R:!1,ownerDocument:b},E.createElement(as.Provider,{value:Z},W({ourProps:K,theirProps:a,slot:H,defaultTag:z1,features:H1,visible:P,name:"Listbox.Options"})))}let V1="div";function G1(e,t){let n=E.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=E.useContext(gf)===!0,a=Dr("Listbox.Option"),u=ra("Listbox.Option"),l=rt(u,P=>u.selectors.isActive(P,r)),f=a.isSelected(s),d=E.useRef(null),p=L1(d),h=Sn({disabled:o,value:s,domRef:d,get textValue(){return p()}}),m=tt(t,d,P=>{P?a.listRef.current.set(r,P):a.listRef.current.delete(r)}),w=rt(u,P=>u.selectors.shouldScrollIntoView(P,r));pe(()=>{if(w)return ft().requestAnimationFrame(()=>{var P,N;(N=(P=d.current)==null?void 0:P.scrollIntoView)==null||N.call(P,{block:"nearest"})})},[w,d]),pe(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let O=ie(P=>{var N;if(o)return P.preventDefault();u.actions.onChange(s),a.mode===Ot.Single&&(Ne.flushSync(()=>u.actions.closeListbox()),(N=u.state.buttonElement)==null||N.focus({preventScroll:!0}))}),b=ie(()=>{if(o)return u.actions.goToOption({focus:ge.Nothing});u.actions.goToOption({focus:ge.Specific,id:r})}),A=hb(),M=ie(P=>A.update(P)),R=ie(P=>{A.wasMoved(P)&&(o||l&&u.state.activationTrigger===is.Pointer||u.actions.goToOption({focus:ge.Specific,id:r},is.Pointer))}),D=ie(P=>{A.wasMoved(P)&&(o||l&&u.state.activationTrigger===is.Pointer&&u.actions.goToOption({focus:ge.Nothing}))}),j=E.useMemo(()=>({active:l,focus:l,selected:f,disabled:o,selectedOption:f&&c}),[l,f,o,c]),g=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:O,onFocus:b,onPointerEnter:M,onMouseEnter:M,onPointerMove:R,onMouseMove:R,onPointerLeave:D,onMouseLeave:D},v=Ge();return!f&&c?null:v({ourProps:g,theirProps:i,slot:j,defaultTag:V1,name:"Listbox.Option"})}let q1=E.Fragment;function Z1(e,t){let{options:n,placeholder:r,...o}=e,s={ref:tt(t)},i=Dr("ListboxSelectedOption"),c=E.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Ot.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Ge();return E.createElement(gf.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:E.createElement(E.Fragment,null,r&&a?r:n)},slot:c,defaultTag:q1,name:"ListboxSelectedOption"}))}let K1=De(j1),Y1=De(U1),X1=Ag,Q1=De(W1),J1=De(G1),ew=De(Z1),cs=Object.assign(K1,{Button:Y1,Label:X1,Options:Q1,Option:J1,SelectedOption:ew});const tw=()=>L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[L.jsx("g",{clipPath:"url(#clip0_active)",children:L.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"})}),L.jsx("defs",{children:L.jsx("clipPath",{id:"clip0_active",children:L.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),nw=()=>L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[L.jsx("g",{clipPath:"url(#clip0_inactive)",children:L.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"})}),L.jsx("defs",{children:L.jsx("clipPath",{id:"clip0_inactive",children:L.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),jr=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return L.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>L.jsx("div",{className:"flex items-center justify-center",children:o>t-e?L.jsx(tw,{}):L.jsx(nw,{})},o))})};class pt{}Io(pt,"FAST",3),Io(pt,"Medium",2),Io(pt,"SLOW",1),Io(pt,"NONE",0);const rw=Object.values({MAINNET:1,SEPOLIA:11155111}),Ct=e=>{const t=typeof e=="string"?parseInt(e,10):e;return rw.includes(t)},ow={USDT:!0},bf=(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:!ow[t.toUpperCase()]:!0},sw=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=_t();return L.jsx("div",{className:`relative ${o}`,children:L.jsx(cs,{value:t,onChange:n,disabled:r,children:({open:c})=>L.jsxs(L.Fragment,{children:[L.jsxs(cs.Button,{className:`
125
+ */var A2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Sc=A2.join(","),Gp=typeof Element>"u",Po=Gp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ns=!Gp&&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},ks=function e(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&&e(t.parentNode);return i},$2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},T2=function(t,n,r){if(ks(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Sc));return n&&Po.call(t,Sc)&&o.unshift(t),o=o.filter(r),o},C2=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!ks(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,u=e(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{var l=Po.call(i,Sc);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),d=!ks(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&d){var p=e(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:i,candidates:p})}else s.unshift.apply(s,i.children)}}return o},qp=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)||$2(t))&&!qp(t)?0:t.tabIndex},O2=function(t,n){var r=Zp(t);return r<0&&n&&!qp(t)?0:r},I2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Kp=function(t){return t.tagName==="INPUT"},N2=function(t){return Kp(t)&&t.type==="hidden"},k2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},B2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},M2=function(t){if(!t.name)return!0;var n=t.form||Ns(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},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=B2(o,t.form);return!s||s===t},L2=function(t){return Kp(t)&&t.type==="radio"},R2=function(t){return L2(t)&&!M2(t)},D2=function(t){var n,r=t&&Ns(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var u,l,f;r=Ns(o),o=(u=r)===null||u===void 0?void 0:u.host,s=!!((l=o)!==null&&l!==void 0&&(f=l.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Yp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},F2=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=Po.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(Po.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var a=t.parentElement,u=Ns(t);if(a&&!a.shadowRoot&&o(a)===!0)return Yp(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(D2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Yp(t);return!1},j2=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 Po.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},_2=function(t,n){return!(n.disabled||ks(n)||N2(n)||F2(n,t)||k2(n)||j2(n))},Xp=function(t,n){return!(R2(n)||Zp(n)<0||!_2(t,n))},U2=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},z2=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=O2(c,i),u=i?e(o.candidates):c;a===0?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:u})}),r.sort(I2).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Qp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=C2([t],n.includeContainer,{filter:Xp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:U2}):r=T2(t,n.includeContainer,Xp.bind(null,n)),z2(r)};function Jp(e,t,n){let{reference:r,floating:o}=e;const s=an(t),i=xc(t),c=vc(i),a=wn(t),u=s==="y",l=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:l,y:r.y-o.height};break;case"bottom":p={x:l,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(wr(t)){case"start":p[i]-=d*(n&&u?-1:1);break;case"end":p[i]+=d*(n&&u?-1:1);break}return p}const H2=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:f}=Jp(u,r,a),d=r,p={},h=0;for(let m=0;m<c.length;m++){const{name:v,fn:$}=c[m],{x:y,y:T,data:B,reset:L}=await $({x:l,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:u,platform:i,elements:{reference:e,floating:t}});l=y??l,f=T??f,p={...p,[v]:{...p[v],...B}},L&&h<=50&&(h++,typeof L=="object"&&(L.placement&&(d=L.placement),L.rects&&(u=L.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:l,y:f}=Jp(u,d,a)),m=-1)}return{x:l,y:f,placement:d,strategy:o,middlewareData:p}};async function Bs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=zn(t,e),h=Vp(p),v=c[d?f==="floating"?"reference":"floating":f],$=Is(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:l,strategy:a})),y=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),B=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},L=Is(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:T,strategy:a}):y);return{top:($.top-L.top+h.top)/B.y,bottom:(L.bottom-$.bottom+h.bottom)/B.y,left:($.left-L.left+h.left)/B.x,right:(L.right-$.right+h.right)/B.x}}const W2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:u,padding:l=0}=zn(e,t)||{};if(u==null)return{};const f=Vp(l),d={x:n,y:r},p=xc(o),h=vc(p),m=await i.getDimensions(u),v=p==="y",$=v?"top":"left",y=v?"bottom":"right",T=v?"clientHeight":"clientWidth",B=s.reference[h]+s.reference[p]-d[p]-s.floating[h],L=d[p]-s.reference[p],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let F=_?_[T]:0;(!F||!await(i.isElement==null?void 0:i.isElement(_)))&&(F=c.floating[T]||s.floating[h]);const g=B/2-L/2,w=F/2-m[h]/2-1,A=sn(f[$],w),I=sn(f[y],w),N=A,P=F-m[h]-I,S=F/2-m[h]/2+g,E=wc(N,S,P),C=!a.arrow&&wr(o)!=null&&S!==E&&s.reference[h]/2-(S<N?A:I)-m[h]/2<0,O=C?S<N?S-N:S-P:0;return{[p]:d[p]+O,data:{[p]:E,centerOffset:S-E-O,...C&&{alignmentOffset:O}},reset:C}}}),V2=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:c,platform:a,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...v}=zn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const $=wn(o),y=an(c),T=wn(c)===c,B=await(a.isRTL==null?void 0:a.isRTL(u.floating)),L=d||(T||!m?[Os(c)]:w2(c)),_=h!=="none";!d&&_&&L.push(...S2(c,m,h,B));const F=[c,...L],g=await Bs(t,v),w=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&w.push(g[$]),f){const S=y2(o,i,B);w.push(g[S[0]],g[S[1]])}if(A=[...A,{placement:o,overflows:w}],!w.every(S=>S<=0)){var I,N;const S=(((I=s.flip)==null?void 0:I.index)||0)+1,E=F[S];if(E&&(!(f==="alignment"?y!==an(E):!1)||A.every(b=>an(b.placement)===y?b.overflows[0]>0:!0)))return{data:{index:S,overflows:A},reset:{placement:E}};let C=(N=A.filter(O=>O.overflows[0]<=0).sort((O,b)=>O.overflows[1]-b.overflows[1])[0])==null?void 0:N.placement;if(!C)switch(p){case"bestFit":{var P;const O=(P=A.filter(b=>{if(_){const k=an(b.placement);return k===y||k==="y"}return!0}).map(b=>[b.placement,b.overflows.filter(k=>k>0).reduce((k,D)=>k+D,0)]).sort((b,k)=>b[1]-k[1])[0])==null?void 0:P[0];O&&(C=O);break}case"initialPlacement":C=c;break}if(o!==C)return{reset:{placement:C}}}return{}}}},G2=new Set(["left","top"]);async function q2(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=wn(n),c=wr(n),a=an(n)==="y",u=G2.has(i)?-1:1,l=s&&a?-1:1,f=zn(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(p=c==="end"?h*-1:h),a?{x:p*l,y:d*u}:{x:d*u,y:p*l}}const Z2=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:c}=t,a=await q2(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},K2=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:v=>{let{x:$,y}=v;return{x:$,y}}},...a}=zn(e,t),u={x:n,y:r},l=await Bs(t,a),f=an(wn(o)),d=zp(f);let p=u[d],h=u[f];if(s){const v=d==="y"?"top":"left",$=d==="y"?"bottom":"right",y=p+l[v],T=p-l[$];p=wc(y,p,T)}if(i){const v=f==="y"?"top":"left",$=f==="y"?"bottom":"right",y=h+l[v],T=h-l[$];h=wc(y,h,T)}const m=c.fn({...t,[d]:p,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:s,[f]:i}}}}}},Y2=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:c}=t,{apply:a=()=>{},...u}=zn(e,t),l=await Bs(t,u),f=wn(o),d=wr(o),p=an(o)==="y",{width:h,height:m}=s.floating;let v,$;f==="top"||f==="bottom"?(v=f,$=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):($=f,v=d==="end"?"top":"bottom");const y=m-l.top-l.bottom,T=h-l.left-l.right,B=sn(m-l[v],y),L=sn(h-l[$],T),_=!t.middlewareData.shift;let F=B,g=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=y),_&&!d){const A=Be(l.left,0),I=Be(l.right,0),N=Be(l.top,0),P=Be(l.bottom,0);p?g=h-2*(A!==0||I!==0?A+I:Be(l.left,l.right)):F=m-2*(N!==0||P!==0?N+P:Be(l.top,l.bottom))}await a({...t,availableWidth:g,availableHeight:F});const w=await i.getDimensions(c.floating);return h!==w.width||m!==w.height?{reset:{rects:!0}}:{}}}};function eh(e){const t=ut(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=De(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=So(n)!==s||So(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Pc(e){return he(e)?e:e.contextElement}function vr(e){const t=Pc(e);if(!De(t))return Lt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=eh(t);let i=(s?So(n.width):n.width)/r,c=(s?So(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const X2=Lt(0);function th(e){const t=We(e);return!$s()||!t.visualViewport?X2:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Q2(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==We(e)?!1:t}function Hn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Pc(e);let i=Lt(1);t&&(r?he(r)&&(i=vr(r)):i=vr(e));const c=Q2(s,n,r)?th(s):Lt(0);let a=(o.left+c.x)/i.x,u=(o.top+c.y)/i.y,l=o.width/i.x,f=o.height/i.y;if(s){const d=We(s),p=r&&he(r)?We(r):r;let h=d,m=yc(h);for(;m&&r&&p!==h;){const v=vr(m),$=m.getBoundingClientRect(),y=ut(m),T=$.left+(m.clientLeft+parseFloat(y.paddingLeft))*v.x,B=$.top+(m.clientTop+parseFloat(y.paddingTop))*v.y;a*=v.x,u*=v.y,l*=v.x,f*=v.y,a+=T,u+=B,h=We(m),m=yc(h)}}return Is({width:l,height:f,x:a,y:u})}function Ms(e,t){const n=Ts(e).scrollLeft;return t?t.left+n:Hn(Mt(e)).left+n}function nh(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ms(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function J2(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Mt(r),c=t?As(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Lt(1);const l=Lt(0),f=De(r);if((f||!f&&!s)&&((yr(r)!=="body"||Eo(i))&&(a=Ts(r)),De(r))){const p=Hn(r);u=vr(r),l.x=p.x+r.clientLeft,l.y=p.y+r.clientTop}const d=i&&!f&&!s?nh(i,a):Lt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+d.x,y:n.y*u.y-a.scrollTop*u.y+l.y+d.y}}function e6(e){return Array.from(e.getClientRects())}function t6(e){const t=Mt(e),n=Ts(e),r=e.ownerDocument.body,o=Be(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Be(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ms(e);const c=-n.scrollTop;return ut(r).direction==="rtl"&&(i+=Be(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const rh=25;function n6(e,t){const n=We(e),r=Mt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const l=$s();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Ms(r);if(u<=0){const l=r.ownerDocument,f=l.body,d=getComputedStyle(f),p=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-p);h<=rh&&(s-=h)}else u<=rh&&(s+=u);return{width:s,height:i,x:c,y:a}}const r6=new Set(["absolute","fixed"]);function o6(e,t){const n=Hn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=De(e)?vr(e):Lt(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,u=r*s.y;return{width:i,height:c,x:a,y:u}}function oh(e,t,n){let r;if(t==="viewport")r=n6(e,n);else if(t==="document")r=t6(Mt(e));else if(he(t))r=o6(t,n);else{const o=th(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Is(r)}function sh(e,t){const n=on(e);return n===t||!he(n)||rn(n)?!1:ut(n).position==="fixed"||sh(n,t)}function s6(e,t){const n=t.get(e);if(n)return n;let r=yn(e,[],!1).filter(c=>he(c)&&yr(c)!=="body"),o=null;const s=ut(e).position==="fixed";let i=s?on(e):e;for(;he(i)&&!rn(i);){const c=ut(i),a=bc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&r6.has(o.position)||Eo(i)&&!a&&sh(e,i))?r=r.filter(l=>l!==i):o=c,i=on(i)}return t.set(e,r),r}function i6(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?As(t)?[]:s6(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=oh(t,l,o);return u.top=Be(f.top,u.top),u.right=sn(f.right,u.right),u.bottom=sn(f.bottom,u.bottom),u.left=Be(f.left,u.left),u},oh(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function a6(e){const{width:t,height:n}=eh(e);return{width:t,height:n}}function c6(e,t,n){const r=De(t),o=Mt(t),s=n==="fixed",i=Hn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Lt(0);function u(){a.x=Ms(o)}if(r||!r&&!s)if((yr(t)!=="body"||Eo(o))&&(c=Ts(t)),r){const p=Hn(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?nh(o,c):Lt(0),f=i.left+c.scrollLeft-a.x-l.x,d=i.top+c.scrollTop-a.y-l.y;return{x:f,y:d,width:i.width,height:i.height}}function Ac(e){return ut(e).position==="static"}function ih(e,t){if(!De(e)||ut(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Mt(e)===n&&(n=n.ownerDocument.body),n}function ah(e,t){const n=We(e);if(As(e))return n;if(!De(e)){let o=on(e);for(;o&&!rn(o);){if(he(o)&&!Ac(o))return o;o=on(o)}return n}let r=ih(e,t);for(;r&&a2(r)&&Ac(r);)r=ih(r,t);return r&&rn(r)&&Ac(r)&&!bc(r)?n:r||d2(e)||n}const u6=async function(e){const t=this.getOffsetParent||ah,n=this.getDimensions,r=await n(e.floating);return{reference:c6(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function l6(e){return ut(e).direction==="rtl"}const f6={convertOffsetParentRelativeRectToViewportRelativeRect:J2,getDocumentElement:Mt,getClippingRect:i6,getOffsetParent:ah,getElementRects:u6,getClientRects:e6,getDimensions:a6,getScale:vr,isElement:he,isRTL:l6};function ch(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function d6(e,t){let n=null,r;const o=Mt(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=e.getBoundingClientRect(),{left:l,top:f,width:d,height:p}=u;if(c||t(),!d||!p)return;const h=Cs(f),m=Cs(o.clientWidth-(l+d)),v=Cs(o.clientHeight-(f+p)),$=Cs(l),T={rootMargin:-h+"px "+-m+"px "+-v+"px "+-$+"px",threshold:Be(0,sn(1,a))||1};let B=!0;function L(_){const F=_[0].intersectionRatio;if(F!==a){if(!B)return i();F?i(!1,F):r=setTimeout(()=>{i(!1,1e-7)},1e3)}F===1&&!ch(u,e.getBoundingClientRect())&&i(),B=!1}try{n=new IntersectionObserver(L,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(L,T)}n.observe(e)}return i(!0),s}function uh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Pc(e),l=o||s?[...u?yn(u):[],...yn(t)]:[];l.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),s&&$.addEventListener("resize",n)});const f=u&&c?d6(u,n):null;let d=-1,p=null;i&&(p=new ResizeObserver($=>{let[y]=$;y&&y.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var T;(T=p)==null||T.observe(t)})),n()}),u&&!a&&p.observe(u),p.observe(t));let h,m=a?Hn(e):null;a&&v();function v(){const $=Hn(e);m&&!ch(m,$)&&n(),m=$,h=requestAnimationFrame(v)}return n(),()=>{var $;l.forEach(y=>{o&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),f==null||f(),($=p)==null||$.disconnect(),p=null,a&&cancelAnimationFrame(h)}}const $c=Bs,p6=Z2,h6=K2,m6=V2,g6=Y2,lh=W2,b6=(e,t,n)=>{const r=new Map,o={platform:f6,...n},s={...o.platform,_c:r};return H2(e,t,{...o,platform:s})};var y6=typeof document<"u",w6=function(){},Ls=y6?x.useLayoutEffect:w6;function Rs(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(!Rs(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)&&!Rs(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function fh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function dh(e,t){const n=fh(e);return Math.round(t*n)/n}function Tc(e){const t=U.useRef(e);return Ls(()=>{t.current=e}),t}function ph(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:u}=e,[l,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=U.useState(r);Rs(d,r)||p(r);const[h,m]=U.useState(null),[v,$]=U.useState(null),y=U.useCallback(b=>{b!==_.current&&(_.current=b,m(b))},[]),T=U.useCallback(b=>{b!==F.current&&(F.current=b,$(b))},[]),B=s||h,L=i||v,_=U.useRef(null),F=U.useRef(null),g=U.useRef(l),w=a!=null,A=Tc(a),I=Tc(o),N=Tc(u),P=U.useCallback(()=>{if(!_.current||!F.current)return;const b={placement:t,strategy:n,middleware:d};I.current&&(b.platform=I.current),b6(_.current,F.current,b).then(k=>{const D={...k,isPositioned:N.current!==!1};S.current&&!Rs(g.current,D)&&(g.current=D,Tr.flushSync(()=>{f(D)}))})},[d,t,n,I,N]);Ls(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(b=>({...b,isPositioned:!1})))},[u]);const S=U.useRef(!1);Ls(()=>(S.current=!0,()=>{S.current=!1}),[]),Ls(()=>{if(B&&(_.current=B),L&&(F.current=L),B&&L){if(A.current)return A.current(B,L,P);P()}},[B,L,P,A,w]);const E=U.useMemo(()=>({reference:_,floating:F,setReference:y,setFloating:T}),[y,T]),C=U.useMemo(()=>({reference:B,floating:L}),[B,L]),O=U.useMemo(()=>{const b={position:n,left:0,top:0};if(!C.floating)return b;const k=dh(C.floating,l.x),D=dh(C.floating,l.y);return c?{...b,transform:"translate("+k+"px, "+D+"px)",...fh(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:D}},[n,c,C.floating,l.x,l.y]);return U.useMemo(()=>({...l,update:P,refs:E,elements:C,floatingStyles:O}),[l,P,E,C,O])}const v6=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?lh({element:r.current,padding:o}).fn(n):{}:r?lh({element:r,padding:o}).fn(n):{}}}},Cc=(e,t)=>({...p6(e),options:[e,t]}),hh=(e,t)=>({...h6(e),options:[e,t]}),mh=(e,t)=>({...m6(e),options:[e,t]}),x6=(e,t)=>({...g6(e),options:[e,t]}),E6=(e,t)=>({...v6(e),options:[e,t]}),gh={...U},S6=gh.useInsertionEffect||(e=>e());function bh(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return S6(()=>{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 Oc=typeof document<"u"?x.useLayoutEffect:x.useEffect;let yh=!1,P6=0;const wh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+P6++;function A6(){const[e,t]=U.useState(()=>yh?wh():void 0);return Oc(()=>{e==null&&t(wh())},[]),U.useEffect(()=>{yh=!0},[]),e}const $6=gh.useId||A6;let Ao;process.env.NODE_ENV!=="production"&&(Ao=new Set);function T6(){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=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.warn(o)}}function C6(){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=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.error(o)}}function O6(){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 I6=U.createContext(null),N6=U.createContext(null),k6=()=>{var e;return((e=U.useContext(I6))==null?void 0:e.id)||null},B6=()=>U.useContext(N6),M6="data-floating-ui-focusable";function L6(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=$6(),s=U.useRef({}),[i]=U.useState(()=>O6()),c=k6()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!he(p)&&C6("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=U.useState(r.reference),l=bh((p,h,m)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:m,nested:c}),n==null||n(p,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),d=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:l,elements:d,events:i,floatingId:o,refs:f}),[t,l,d,i,o,f])}function R6(e){e===void 0&&(e={});const{nodeId:t}=e,n=L6({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),d=B6();Oc(()=>{l&&(f.current=l)},[l]);const p=ph({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(T=>{const B=he(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;a(B),p.refs.setReference(B)},[p.refs]),m=U.useCallback(T=>{(he(T)||T===null)&&(f.current=T,i(T)),(he(p.refs.reference.current)||p.refs.reference.current===null||T!==null&&!he(T))&&p.refs.setReference(T)},[p.refs]),v=U.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:f}),[p.refs,m,h]),$=U.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),y=U.useMemo(()=>({...p,...r,refs:v,elements:$,nodeId:t}),[p,v,$,t,r]);return Oc(()=>{r.dataRef.current.floatingContext=y;const T=d==null?void 0:d.nodesRef.current.find(B=>B.id===t);T&&(T.context=y)}),U.useMemo(()=>({...p,context:y,refs:v,elements:$}),[p,v,$,y])}const vh="active",xh="selected";function Ic(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[vh]:i,[xh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[M6]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[vh,xh].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var d,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(d=r.get(u))==null?void 0:d.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function D6(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=U.useCallback(c=>Ic(c,e,"reference"),t),s=U.useCallback(c=>Ic(c,e,"floating"),n),i=U.useCallback(c=>Ic(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Eh(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const F6=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:u,...l}=zn(e,t),{rects:f,elements:{floating:d}}=t,p=n.current[i],h=(u==null?void 0:u.current)||d,m=d.clientTop||h.clientTop,v=d.clientTop!==0,$=h.clientTop!==0,y=d===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||T6('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const T={...t,...await Cc(-p.offsetTop-d.clientTop-f.reference.height/2-p.offsetHeight/2-s).fn(t)},B=await $c(Eh(T,h.scrollHeight+m+d.clientTop),l),L=await $c(T,{...l,elementContext:"reference"}),_=Be(0,B.top),F=T.y+_,A=(h.scrollHeight>h.clientHeight?I=>I:So)(Be(0,h.scrollHeight+(v&&y||$?m*2:0)-_-Be(0,B.bottom)));if(h.style.maxHeight=A+"px",h.scrollTop=_,o){const I=h.offsetHeight<p.offsetHeight*sn(c,n.current.length)-1||L.top>=-a||L.bottom>=-a;Tr.flushSync(()=>o(I))}return r&&(r.current=await $c(Eh({...T,y:F},h.offsetHeight+m+d.clientTop),l)),{y:F}}});function j6(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=bh(c),u=U.useRef(!1),l=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function p(m){if(m.ctrlKey||!h||s.current==null)return;const v=m.deltaY,$=s.current.top>=-.5,y=s.current.bottom>=-.5,T=h.scrollHeight-h.clientHeight,B=v<0?-1:1,L=v<0?"max":"min";h.scrollHeight<=h.clientHeight||(!$&&v>0||!y&&v<0?(m.preventDefault(),Tr.flushSync(()=>{a(_=>_+Math[L](v,T*B))})):/firefox/i.test(h2())&&(h.scrollTop+=v))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",p),requestAnimationFrame(()=>{l.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{l.current=null,f.current=null,h.removeEventListener("wheel",p)}},[o,n,r.floating,s,i,a]);const d=U.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const p=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!p||!u.current)){if(l.current!==null){const h=p.scrollTop-l.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Tr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=p.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:d}:{},[o,d])}let xr=x.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});xr.displayName="FloatingContext";let Nc=x.createContext(null);Nc.displayName="PlacementContext";function _6(e){return x.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function U6(){return x.useContext(xr).setReference}function z6(){return x.useContext(xr).getReferenceProps}function H6(){let{getFloatingProps:e,slot:t}=x.useContext(xr);return x.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function W6(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=x.useContext(Nc),n=x.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);ye(()=>{t==null||t(n??null)},[t,n]);let r=x.useContext(xr);return x.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Sh=4;function V6({children:e,enabled:t=!0}){let[n,r]=x.useState(null),[o,s]=x.useState(0),i=x.useRef(null),[c,a]=x.useState(null);G6(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:d=0,padding:p=0,inner:h}=q6(n,c),[m,v="center"]=l.split(" ");ye(()=>{u&&s(0)},[u]);let{refs:$,floatingStyles:y,context:T}=R6({open:u,placement:m==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${m}`:`${m}-${v}`,strategy:"absolute",transform:!1,middleware:[Cc({mainAxis:m==="selection"?0:f,crossAxis:d}),hh({padding:p}),m!=="selection"&&mh({padding:p}),m==="selection"&&h?F6({...h,padding:p,overflowRef:i,offset:o,minItemsVisible:Sh,referenceOverflowThreshold:p,onFallbackChange(I){var N,P;if(!I)return;let S=T.elements.floating;if(!S)return;let E=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,C=Math.min(Sh,S.childElementCount),O=0,b=0;for(let k of(P=(N=T.elements.floating)==null?void 0:N.childNodes)!=null?P:[])if(nn(k)){let D=k.offsetTop,j=D+k.clientHeight+E,z=S.scrollTop,W=z+S.clientHeight;if(D>=z&&j<=W)C--;else{b=Math.max(0,Math.min(j,W)-Math.max(D,z)),O=k.clientHeight;break}}C>=1&&s(k=>{let D=O*C-b+E;return k>=D?k:D})}}):null,x6({padding:p,apply({availableWidth:I,availableHeight:N,elements:P}){Object.assign(P.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${N}px)`})}})].filter(Boolean),whileElementsMounted:uh}),[B=m,L=v]=T.placement.split("-");m==="selection"&&(B="selection");let _=x.useMemo(()=>({anchor:[B,L].filter(Boolean).join(" ")}),[B,L]),F=j6(T,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:w}=D6([F]),A=fe(I=>{a(I),$.setFloating(I)});return U.createElement(Nc.Provider,{value:r},U.createElement(xr.Provider,{value:{setFloating:A,setReference:$.setReference,styles:y,getReferenceProps:g,getFloatingProps:w,slot:_}},e))}function G6(e){ye(()=>{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 q6(e,t){var n,r,o;let s=kc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=kc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=kc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function kc(e,t,n=void 0){let r=mr(),o=fe((a,u)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!u)return[n,null];let l=Ah(a,u);return[l,f=>{let d=Ph(a);{let p=d.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[$,y]of d.entries()){let T=window.getComputedStyle(u).getPropertyValue(y);if(p[$]!==T){p[$]=T,m=!0;break}}if(!m)return;let v=Ah(a,u);l!==v&&(f(v),l=v)})}return r.dispose}]}return[n,null]}),s=x.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=x.useState();return ye(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function Ph(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,...Ph(o)]:[r]}return[]}function Ah(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 Z6(e,t){let[n,r]=x.useState(t);return!e&&n!==t&&r(t),e?n:t}let Bc=x.createContext(null);Bc.displayName="OpenClosedContext";var St=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(St||{});function Mc(){return x.useContext(Bc)}function $h({value:e,children:t}){return x.createElement(Bc.Provider,{value:e},t)}function K6(e){throw new Error("Unexpected object: "+e)}var ve=(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))(ve||{});function Ds(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:K6(e)}}var Th=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Th||{});function Ch(e){let t=fe(e),n=x.useRef(!1);x.useEffect(()=>(n.current=!1,()=>{n.current=!0,tp(()=>{n.current&&t()})}),[t])}function Y6(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function Lc(){let e=Y6(),[t,n]=U.useState(kt.isHandoffComplete);return t&&kt.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>kt.handoff(),[]),e?!1:t}let X6=x.createContext(!1);function Q6(){return x.useContext(X6)}function J6(e){let t=Q6(),n=x.useContext(Ih),[r,o]=x.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(kt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return x.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),x.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Oh=x.Fragment,e5=He(function(e,t){let{ownerDocument:n=null,...r}=e,o=x.useRef(null),s=it(nE(p=>{o.current=p}),t),i=hc(o),c=n??i,a=J6(c),[u]=x.useState(()=>{var p;return kt.isServer?null:(p=c==null?void 0:c.createElement("div"))!=null?p:null}),l=x.useContext(o5),f=Lc();ye(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),ye(()=>{if(u&&l)return l.register(u)},[l,u]),Ch(()=>{var p;!a||!u||(tc(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a)))});let d=Xe();return f?!a||!u?null:Me.createPortal(d({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Oh,name:"Portal"}),u):null});function t5(e,t){let n=it(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Xe();return r?x.createElement(e5,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Oh,name:"Portal"})}let n5=x.Fragment,Ih=x.createContext(null);function r5(e,t){let{target:n,...r}=e,o={ref:it(t)},s=Xe();return x.createElement(Ih.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:n5,name:"Popover.Group"}))}let o5=x.createContext(null),s5=He(t5),i5=He(r5),a5=Object.assign(s5,{Group:i5});function c5(){let e=x.useRef(!1);return ye(()=>(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)||((t=e.as)!=null?t:Bh)!==x.Fragment||x.Children.count(e.children)===1}let Fs=x.createContext(null);Fs.displayName="TransitionContext";var u5=(e=>(e.Visible="visible",e.Hidden="hidden",e))(u5||{});function l5(){let e=x.useContext(Fs);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function f5(){let e=x.useContext(js);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let js=x.createContext(null);js.displayName="NestingContext";function _s(e){return"children"in e?_s(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function kh(e,t){let n=_n(e),r=x.useRef([]),o=c5(),s=mr(),i=fe((p,h=gn.Hidden)=>{let m=r.current.findIndex(({el:v})=>v===p);m!==-1&&(st(h,{[gn.Unmount](){r.current.splice(m,1)},[gn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var v;!_s(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),c=fe(p=>{let h=r.current.find(({el:m})=>m===p);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:p,state:"visible"}),()=>i(p,gn.Unmount)}),a=x.useRef([]),u=x.useRef(Promise.resolve()),l=x.useRef({enter:[],leave:[]}),f=fe((p,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([v])=>v!==p)),t==null||t.chains.current[h].push([p,new Promise(v=>{a.current.push(v)})]),t==null||t.chains.current[h].push([p,new Promise(v=>{Promise.all(l.current[h].map(([$,y])=>y)).then(()=>v())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),d=fe((p,h,m)=>{Promise.all(l.current[h].splice(0).map(([v,$])=>$)).then(()=>{var v;(v=a.current.shift())==null||v()}).then(()=>m(h))});return x.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:d,wait:u,chains:l}),[c,i,r,f,d,l,u])}let Bh=x.Fragment,Mh=ws.RenderStrategy;function d5(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:f,entered:d,leave:p,leaveFrom:h,leaveTo:m,...v}=e,[$,y]=x.useState(null),T=x.useRef(null),B=Nh(e),L=it(...B?[T,t,y]:t===null?[]:[t]),_=(n=v.unmount)==null||n?gn.Unmount:gn.Hidden,{show:F,appear:g,initial:w}=l5(),[A,I]=x.useState(F?"visible":"hidden"),N=f5(),{register:P,unregister:S}=N;ye(()=>P(T),[P,T]),ye(()=>{if(_===gn.Hidden&&T.current){if(F&&A!=="visible"){I("visible");return}return st(A,{hidden:()=>S(T),visible:()=>P(T)})}},[A,T,P,S,F,_]);let E=Lc();ye(()=>{if(B&&E&&A==="visible"&&T.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[T,A,E,B]);let C=w&&!g,O=g&&F&&w,b=x.useRef(!1),k=kh(()=>{b.current||(I("hidden"),S(T))},N),D=fe(q=>{b.current=!0;let J=q?"enter":"leave";k.onStart(T,J,te=>{te==="enter"?s==null||s():te==="leave"&&(c==null||c())})}),j=fe(q=>{let J=q?"enter":"leave";b.current=!1,k.onStop(T,J,te=>{te==="enter"?i==null||i():te==="leave"&&(a==null||a())}),J==="leave"&&!_s(k)&&(I("hidden"),S(T))});x.useEffect(()=>{B&&o||(D(F),j(F))},[F,B,o]);let z=!(!o||!B||!E||C),[,W]=_p(z,$,F,{start:D,end:j}),K=bn({ref:L,className:((r=Qa(v.className,O&&u,O&&l,W.enter&&u,W.enter&&W.closed&&l,W.enter&&!W.closed&&f,W.leave&&p,W.leave&&!W.closed&&h,W.leave&&W.closed&&m,!W.transition&&F&&d))==null?void 0:r.trim())||void 0,...jp(W)}),H=0;A==="visible"&&(H|=St.Open),A==="hidden"&&(H|=St.Closed),F&&A==="hidden"&&(H|=St.Opening),!F&&A==="visible"&&(H|=St.Closing);let Z=Xe();return x.createElement(js.Provider,{value:k},x.createElement($h,{value:H},Z({ourProps:K,theirProps:v,defaultTag:Bh,features:Mh,visible:A==="visible",name:"Transition.Child"})))}function p5(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=x.useRef(null),c=Nh(e),a=it(...c?[i,t]:t===null?[]:[t]);Lc();let u=Mc();if(n===void 0&&u!==null&&(n=(u&St.Open)===St.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=x.useState(n?"visible":"hidden"),d=kh(()=>{n||f("hidden")}),[p,h]=x.useState(!0),m=x.useRef([n]);ye(()=>{p!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let v=x.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);ye(()=>{n?f("visible"):!_s(d)&&i.current!==null&&f("hidden")},[n,d]);let $={unmount:o},y=fe(()=>{var L;p&&h(!1),(L=e.beforeEnter)==null||L.call(e)}),T=fe(()=>{var L;p&&h(!1),(L=e.beforeLeave)==null||L.call(e)}),B=Xe();return x.createElement(js.Provider,{value:d},x.createElement(Fs.Provider,{value:v},B({ourProps:{...$,as:x.Fragment,children:x.createElement(Lh,{ref:a,...$,...s,beforeEnter:y,beforeLeave:T})},theirProps:{},defaultTag:x.Fragment,features:Mh,visible:l==="visible",name:"Transition"})))}function h5(e,t){let n=x.useContext(Fs)!==null,r=Mc()!==null;return x.createElement(x.Fragment,null,!n&&r?x.createElement(Rc,{ref:t,...e}):x.createElement(Lh,{ref:t,...e}))}let Rc=He(p5),Lh=He(d5),m5=He(h5),g5=Object.assign(Rc,{Child:m5,Root:Rc});function b5(e,t){let n=x.useRef({left:0,top:0});if(ye(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Rh=/([\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(!nn(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Rh.test(i)&&(i=i.replace(Rh,"")),i}function y5(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 w5(e){let t=x.useRef(""),n=x.useRef("");return fe(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=y5(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var v5=Object.defineProperty,x5=(e,t,n)=>t in e?v5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fh=(e,t,n)=>(x5(e,typeof t!="symbol"?t+"":t,n),n),Ne=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ne||{}),Rt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Rt||{}),Us=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Us||{}),jh=(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.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(jh||{});function _h(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Np(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 E5={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ve.Nothing},listboxState:1,__demoMode:!1}},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,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ve.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ve.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===ve.Previous){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,d=Ds(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(d!==null){let p=e.options[d].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===p.current||((o=p.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:d}}}}else if(t.focus===ve.Next){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,d=Ds(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(d!==null){let p=e.options[d].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===p.current||((i=p.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:d}}}}let a=_h(e),u=Ds(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});return{...c,...a,activeOptionIndex:u}},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 c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.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,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ve.Nothing&&(r=Ds(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:ve.Nothing},pendingShouldSort:!0}},6:(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}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,..._h(e),pendingShouldSort:!1}:e};class Dc extends wp{constructor(t){super(t),Fh(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 c=i.slice(),a=c.findIndex(u=>o(u,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:sc(()=>{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:5,options:n.splice(0)}))]}),unregisterOption:sc(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:sc(()=>{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:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ve.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),Fh(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},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=ic.get(null);this.disposables.add(r.on(Sp.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))}}static new({id:t,__demoMode:n=!1}){return new Dc({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ve.Nothing},__demoMode:n})}reduce(t,n){return st(n.type,E5,t,n)}}const Uh=x.createContext(null);function Fc(e){let t=x.useContext(Uh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,zh),n}return t}function zh({id:e,__demoMode:t=!1}){let n=x.useMemo(()=>Dc.new({id:e,__demoMode:t}),[]);return Ch(()=>n.dispose()),n}let zs=x.createContext(null);zs.displayName="ListboxDataContext";function $o(e){let t=x.useContext(zs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,$o),n}return t}let S5=x.Fragment;function P5(e,t){let n=x.useId(),r=Xa(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:f=r||!1,horizontal:d=!1,multiple:p=!1,__demoMode:h=!1,...m}=e;const v=d?"horizontal":"vertical";let $=it(t),y=Ux(s),[T=p?[]:void 0,B]=_x(o,a,y),L=zh({id:n,__demoMode:h}),_=x.useRef({static:!1,hold:!1}),F=x.useRef(new Map),g=pE(u),w=x.useCallback(z=>st(A.mode,{[Rt.Multi]:()=>T.some(W=>g(W,z)),[Rt.Single]:()=>g(T,z)}),[T]),A=x.useMemo(()=>({value:T,disabled:f,invalid:l,mode:p?Rt.Multi:Rt.Single,orientation:v,onChange:B,compare:g,isSelected:w,optionsPropsRef:_,listRef:F}),[T,f,l,p,v,B,g,w,_,F]);ye(()=>{L.state.dataRef.current=A},[A]);let I=ct(L,z=>z.listboxState),N=ic.get(null),P=ct(N,x.useCallback(z=>N.selectors.isTop(z,n),[N,n])),[S,E]=ct(L,z=>[z.buttonElement,z.optionsElement]);_E(P,[S,E],(z,W)=>{L.send({type:jh.CloseListbox}),Ip(W,pc.Loose)||(z.preventDefault(),S==null||S.focus())});let C=x.useMemo(()=>({open:I===Ne.Open,disabled:f,invalid:l,value:T}),[I,f,l,T]),[O,b]=aE({inherit:!0}),k={ref:$},D=x.useCallback(()=>{if(y!==void 0)return B==null?void 0:B(y)},[B,y]),j=Xe();return x.createElement(b,{value:O,props:{htmlFor:S==null?void 0:S.id},slot:{open:I===Ne.Open,disabled:f}},x.createElement(V6,null,x.createElement(Uh.Provider,{value:L},x.createElement(zs.Provider,{value:A},x.createElement($h,{value:st(I,{[Ne.Open]:St.Open,[Ne.Closed]:St.Closed})},c!=null&&T!=null&&x.createElement(qx,{disabled:f,data:{[c]:T},form:i,onReset:D}),j({ourProps:k,theirProps:m,slot:C,defaultTag:S5,name:"Listbox"}))))))}let A5="button";function $5(e,t){let n=x.useId(),r=cp(),o=$o("Listbox.Button"),s=Fc("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=it(t,U6(),s.actions.setButtonElement),f=z6(),[d,p,h]=ct(s,b=>[b.listboxState,b.buttonElement,b.optionsElement]),m=d===Ne.Open;HE(m,{trigger:p,action:x.useCallback(b=>{if(p!=null&&p.contains(b.target))return Ss.Ignore;let k=b.target.closest('[role="option"]:not([data-disabled])');return nn(k)?Ss.Select(k):h!=null&&h.contains(b.target)?Ss.Ignore:Ss.Close},[p,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let v=fe(b=>{switch(b.key){case Ie.Enter:zx(b.currentTarget);break;case Ie.Space:case Ie.ArrowDown:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ie.ArrowUp:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),$=fe(b=>{switch(b.key){case Ie.Space:b.preventDefault();break}}),y=fe(b=>{var k;if(b.button===Th.Left){if(eE(b.currentTarget))return b.preventDefault();s.state.listboxState===Ne.Open?(Me.flushSync(()=>s.actions.closeListbox()),(k=s.state.buttonElement)==null||k.focus({preventScroll:!0})):(b.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),T=x.useRef(null),B=fe(b=>{T.current=b.pointerType,b.pointerType==="mouse"&&y(b)}),L=fe(b=>{T.current!=="mouse"&&y(b)}),_=fe(b=>b.preventDefault()),F=mp([i]),g=rE(),{isFocusVisible:w,focusProps:A}=Cx({autoFocus:a}),{isHovered:I,hoverProps:N}=Tx({isDisabled:c}),{pressed:P,pressProps:S}=Mx({disabled:c}),E=x.useMemo(()=>({open:d===Ne.Open,active:P||d===Ne.Open,disabled:c,invalid:o.invalid,value:o.value,hover:I,focus:w,autofocus:a}),[d,o.value,c,I,w,P,o.invalid,a]),C=ct(s,b=>b.listboxState===Ne.Open),O=rp(f(),{ref:l,id:i,type:WE(e,p),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":C,"aria-labelledby":F,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:v,onKeyUp:$,onKeyPress:_,onPointerDown:B,onClick:L},A,N,S);return Xe()({ourProps:O,theirProps:u,slot:E,defaultTag:A5,name:"Listbox.Button"})}let Hh=x.createContext(!1),T5="div",C5=ws.RenderStrategy|ws.Static;function O5(e,t){let n=x.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=_6(o),[l,f]=x.useState(null);u&&(s=!0);let d=$o("Listbox.Options"),p=Fc("Listbox.Options"),[h,m,v,$]=ct(p,q=>[q.listboxState,q.buttonElement,q.optionsElement,q.__demoMode]),y=hc(m),T=hc(v),B=Mc(),[L,_]=_p(c,l,B!==null?(B&St.Open)===St.Open:h===Ne.Open);CE(L,m,p.actions.closeListbox);let F=$?!1:i&&h===Ne.Open;QE(F,T);let g=$?!1:i&&h===Ne.Open;TE(g,{allowed:x.useCallback(()=>[m,v],[m,v])});let w=h!==Ne.Open,A=b5(w,m)?!1:L,I=L&&h===Ne.Closed,N=Z6(I,d.value),P=fe(q=>d.compare(N,q)),S=ct(p,q=>{var J;if(u==null||!((J=u==null?void 0:u.to)!=null&&J.includes("selection")))return null;let te=q.options.findIndex(pe=>P(pe.dataRef.current.value));return te===-1&&(te=0),te}),E=(()=>{if(u==null)return;if(S===null)return{...u,inner:void 0};let q=Array.from(d.listRef.current.values());return{...u,inner:{listRef:{current:q},index:S}}})(),[C,O]=W6(E),b=H6(),k=it(t,u?C:null,p.actions.setOptionsElement,f),D=mr();x.useEffect(()=>{var q;let J=v;J&&h===Ne.Open&&J!==((q=yo(J))==null?void 0:q.activeElement)&&(J==null||J.focus({preventScroll:!0}))},[h,v]);let j=fe(q=>{var J,te;switch(D.dispose(),q.key){case Ie.Space:if(p.state.searchQuery!=="")return q.preventDefault(),q.stopPropagation(),p.actions.search(q.key);case Ie.Enter:if(q.preventDefault(),q.stopPropagation(),p.state.activeOptionIndex!==null){let{dataRef:pe}=p.state.options[p.state.activeOptionIndex];p.actions.onChange(pe.current.value)}d.mode===Rt.Single&&(Me.flushSync(()=>p.actions.closeListbox()),(J=p.state.buttonElement)==null||J.focus({preventScroll:!0}));break;case st(d.orientation,{vertical:Ie.ArrowDown,horizontal:Ie.ArrowRight}):return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ve.Next});case st(d.orientation,{vertical:Ie.ArrowUp,horizontal:Ie.ArrowLeft}):return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ve.Previous});case Ie.Home:case Ie.PageUp:return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ve.First});case Ie.End:case Ie.PageDown:return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ve.Last});case Ie.Escape:q.preventDefault(),q.stopPropagation(),Me.flushSync(()=>p.actions.closeListbox()),(te=p.state.buttonElement)==null||te.focus({preventScroll:!0});return;case Ie.Tab:q.preventDefault(),q.stopPropagation(),Me.flushSync(()=>p.actions.closeListbox()),RE(p.state.buttonElement,q.shiftKey?dc.Previous:dc.Next);break;default:q.key.length===1&&(p.actions.search(q.key),D.setTimeout(()=>p.actions.clearSearch(),350));break}}),z=ct(p,q=>{var J;return(J=q.buttonElement)==null?void 0:J.id}),W=x.useMemo(()=>({open:h===Ne.Open}),[h]),K=rp(u?b():{},{id:r,ref:k,"aria-activedescendant":ct(p,p.selectors.activeDescendantId),"aria-multiselectable":d.mode===Rt.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":d.orientation,onKeyDown:j,role:"listbox",tabIndex:h===Ne.Open?0:void 0,style:{...a.style,...O,"--button-width":mE(m,!0).width},...jp(_)}),H=Xe(),Z=x.useMemo(()=>d.mode===Rt.Multi?d:{...d,isSelected:P},[d,P]);return x.createElement(a5,{enabled:s?e.static||L:!1,ownerDocument:y},x.createElement(zs.Provider,{value:Z},H({ourProps:K,theirProps:a,slot:W,defaultTag:T5,features:C5,visible:A,name:"Listbox.Options"})))}let I5="div";function N5(e,t){let n=x.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=x.useContext(Hh)===!0,a=$o("Listbox.Option"),u=Fc("Listbox.Option"),l=ct(u,A=>u.selectors.isActive(A,r)),f=a.isSelected(s),d=x.useRef(null),p=w5(d),h=_n({disabled:o,value:s,domRef:d,get textValue(){return p()}}),m=it(t,d,A=>{A?a.listRef.current.set(r,A):a.listRef.current.delete(r)}),v=ct(u,A=>u.selectors.shouldScrollIntoView(A,r));ye(()=>{if(v)return Et().requestAnimationFrame(()=>{var A,I;(I=(A=d.current)==null?void 0:A.scrollIntoView)==null||I.call(A,{block:"nearest"})})},[v,d]),ye(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let $=fe(A=>{var I;if(o)return A.preventDefault();u.actions.onChange(s),a.mode===Rt.Single&&(Me.flushSync(()=>u.actions.closeListbox()),(I=u.state.buttonElement)==null||I.focus({preventScroll:!0}))}),y=fe(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),T=JE(),B=fe(A=>T.update(A)),L=fe(A=>{T.wasMoved(A)&&(o||l&&u.state.activationTrigger===Us.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},Us.Pointer))}),_=fe(A=>{T.wasMoved(A)&&(o||l&&u.state.activationTrigger===Us.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),F=x.useMemo(()=>({active:l,focus:l,selected:f,disabled:o,selectedOption:f&&c}),[l,f,o,c]),g=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:$,onFocus:y,onPointerEnter:B,onMouseEnter:B,onPointerMove:L,onMouseMove:L,onPointerLeave:_,onMouseLeave:_},w=Xe();return!f&&c?null:w({ourProps:g,theirProps:i,slot:F,defaultTag:I5,name:"Listbox.Option"})}let k5=x.Fragment;function B5(e,t){let{options:n,placeholder:r,...o}=e,s={ref:it(t)},i=$o("ListboxSelectedOption"),c=x.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Rt.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Xe();return x.createElement(Hh.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:x.createElement(x.Fragment,null,r&&a?r:n)},slot:c,defaultTag:k5,name:"ListboxSelectedOption"}))}let M5=He(P5),L5=He($5),R5=fE,D5=He(O5),F5=He(N5),j5=He(B5),Hs=Object.assign(M5,{Button:L5,Label:R5,Options:D5,Option:F5,SelectedOption:j5});const _5=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_active)",children:M.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"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_active",children:M.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),U5=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_inactive)",children:M.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"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_inactive",children:M.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),To=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return M.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>M.jsx("div",{className:"flex items-center justify-center",children:o>t-e?M.jsx(_5,{}):M.jsx(U5,{})},o))})};class Pt{}ko(Pt,"FAST",3),ko(Pt,"Medium",2),ko(Pt,"SLOW",1),ko(Pt,"NONE",0);const z5=Object.values({MAINNET:1,SEPOLIA:11155111}),Ve=e=>{const t=typeof e=="string"?parseInt(e,10):e;return z5.includes(t)},H5={USDT:!0},Wh=(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:!H5[t.toUpperCase()]:!0},W5=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,chainPoolBalances:o,className:s="",walletType:i="mpc"})=>{const{t:c}=Ut();return M.jsx("div",{className:`relative ${s}`,children:M.jsx(Hs,{value:t,onChange:n,disabled:r,children:({open:a})=>M.jsxs(M.Fragment,{children:[M.jsxs(Hs.Button,{className:`
84
126
  relative w-full h-9 text-text-primary bg-fill-input-primary
85
127
  items-center justify-between flex px-3 rounded-lg
86
128
  focus:outline-none
87
129
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
88
- ${c?"ring-1 ring-white":""}
89
- `,children:[L.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),L.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?L.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):L.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:L.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),L.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),L.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:[L.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:L.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"})}),L.jsx("defs",{children:L.jsx("clipPath",{id:"clip0_12919_27745",children:L.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),L.jsx(N1,{as:E.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:L.jsx(cs.Options,{className:`
130
+ ${a?"ring-1 ring-white":""}
131
+ `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:c("deposit.chain")}),M.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?M.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${a?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.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"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(g5,{as:x.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:M.jsx(Hs.Options,{className:`
90
132
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
91
133
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
92
134
  focus:outline-none
93
- `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>L.jsx(cs.Option,{value:a,className:({active:u,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":u?"bg-fill-input-secondary":""}`,children:({selected:u,active:l})=>L.jsxs("div",{className:"flex items-center justify-between",children:[L.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?L.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):L.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:L.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),L.jsx("div",{className:"flex flex-col",children:L.jsx("span",{className:`text-sm font-medium ${u||l?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),L.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:L.jsx(jr,{className:"w-full justify-between",selectedLevel:Ct(a.chainId)?pt.SLOW:pt.FAST,maxLevel:3})})]})},a.chainId))})})]})})})},yf=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=vn,txType:i="deposit"})=>{const c=E.useCallback(m=>i==="withdraw"?s===vn?m.allowAaWithdraw!==!1:m.allowWithdraw!==!1:s===vn?m.allowAaDeposit!==!1:m.allowDeposit!==!1,[i,s]),a=E.useMemo(()=>{const m=new Set,w=[];for(const O of t)if(c(O))for(const b of O.tokenList||[]){const A=b.symbol||b.token;!A||!(i!=="withdraw"||b.withdrawEnable===!0&&b.pullOff===!1)||m.has(A)||(m.add(A),w.push({token:A,symbol:A,iconUrl:b.iconUrl,decimals:b.decimals,tokenAddress:b.tokenAddress}))}return w},[t,c,i]),u=m=>{n(m.chainId)},l=m=>{const w=m.symbol||m.token;o(w);const O=[];for(const b of t){if(!c(b))continue;(b.tokenList||[]).some(M=>(M.symbol||M.token)===w)&&O.push(b.chainId)}!O.includes(e.chainId)&&O[0]!==void 0&&n(O[0])},f=E.useMemo(()=>{var O,b;const m=r||((O=a[0])==null?void 0:O.symbol)||((b=a[0])==null?void 0:b.token);if(!m)return[];const w=[];for(const A of t){if(!c(A))continue;const M=(A.tokenList||[]).find(R=>(R.symbol||R.token)===m?i==="withdraw"?R.withdrawEnable===!0&&R.pullOff===!1:!0:!1);M&&w.push({...A,tokenList:[{token:M.token,symbol:M.symbol,iconUrl:M.iconUrl,decimals:M.decimals,tokenAddress:M.tokenAddress}]})}return w},[t,r,a,c,i]),d=E.useMemo(()=>f.find(m=>m.chainId===e.chainId)||f[0],[f,e.chainId]),p=E.useMemo(()=>a,[a]),h=E.useMemo(()=>{if(p.length!==0)return p.find(m=>m.token===r||m.symbol===r)||p[0]},[p,r]);return E.useEffect(()=>{if(p.length===0)return;if(!p.some(w=>(w.symbol||w.token)===r)){const w=p[0];o(w.symbol||w.token)}},[p,r,o]),E.useEffect(()=>{if(f.length===0)return;f.some(w=>w.chainId===e.chainId)||n(f[0].chainId)},[f,e.chainId,n]),L.jsxs("div",{className:"space-y-4",children:[p.length>0&&h&&L.jsx(wm,{tokens:p,selectedToken:h,onTokenChange:l}),L.jsx(sw,{chains:f,selectedChain:d,onChainChange:m=>{const w=t.find(O=>O.chainId===m.chainId);w&&u(w)},walletType:s,className:"w-full"})]})};var us={},iw=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()}},aw=iw,wf={"text/plain":"Text","text/html":"Url",default:"Text"},cw="Copy to clipboard: #{key}, Enter";function uw(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function lw(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=aw(),s=document.createRange(),i=document.getSelection(),c=document.createElement("span"),c.textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=wf[t.format]||wf.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");a=!0}catch(l){n&&console.error("unable to copy using execCommand: ",l),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=uw("message"in t?t.message:cw),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var fw=lw;function oa(e){"@babel/helpers - typeof";return oa=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},oa(e)}Object.defineProperty(us,"__esModule",{value:!0}),us.CopyToClipboard=void 0;var ls=vf(E),dw=vf(fw),pw=["text","onCopy","options","children"];function vf(e){return e&&e.__esModule?e:{default:e}}function xf(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 Ef(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xf(Object(n),!0).forEach(function(r){ia(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xf(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hw(e,t){if(e==null)return{};var n=mw(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mw(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function gw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bw(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,r.key,r)}}function yw(e,t,n){return t&&bw(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ww(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&&sa(e,t)}function sa(e,t){return sa=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},sa(e,t)}function vw(e){var t=Ew();return function(){var r=fs(e),o;if(t){var s=fs(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return xw(this,o)}}function xw(e,t){if(t&&(oa(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Sf(e)}function Sf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ew(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function fs(e){return fs=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},fs(e)}function ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $f=function(e){ww(n,e);var t=vw(n);function n(){var r;gw(this,n);for(var o=arguments.length,s=new Array(o),i=0;i<o;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),ia(Sf(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,f=a.children,d=a.options,p=ls.default.Children.only(f),h=(0,dw.default)(u,d);l&&l(u,h),p&&p.props&&typeof p.props.onClick=="function"&&p.props.onClick(c)}),r}return yw(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=hw(o,pw),c=ls.default.Children.only(s);return ls.default.cloneElement(c,Ef(Ef({},i),{},{onClick:this.onClick}))}}]),n}(ls.default.PureComponent);us.CopyToClipboard=$f,ia($f,"defaultProps",{onCopy:void 0,options:void 0});var Sw=us,aa=Sw.CopyToClipboard;aa.CopyToClipboard=aa;var $w=aa;const Pw=X0($w);var Aw=Object.defineProperty,ds=Object.getOwnPropertySymbols,Pf=Object.prototype.hasOwnProperty,Af=Object.prototype.propertyIsEnumerable,Tf=(e,t,n)=>t in e?Aw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ca=(e,t)=>{for(var n in t||(t={}))Pf.call(t,n)&&Tf(e,n,t[n]);if(ds)for(var n of ds(t))Af.call(t,n)&&Tf(e,n,t[n]);return e},ua=(e,t)=>{var n={};for(var r in e)Pf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ds)for(var r of ds(e))t.indexOf(r)<0&&Af.call(e,r)&&(n[r]=e[r]);return n};/**
135
+ `,children:e.filter(u=>u[i==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(u=>M.jsx(Hs.Option,{value:u,className:({active:l,selected:f})=>`relative cursor-pointer select-none py-3 px-3 ${f?"bg-fill-btn-secondary":l?"bg-fill-input-secondary":""}`,children:({selected:l,active:f})=>M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[u.chainIconUrl?M.jsx("img",{src:u.chainIconUrl,alt:u.chain,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:u.chain.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${l||f?"text-text-primary":"text-text-tertiary"}`,children:u.chain})})]}),M.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:M.jsx(To,{className:"w-full justify-between",selectedLevel:Ve(u.chainId)?Pt.SLOW:Pt.FAST,maxLevel:3})})]}),o&&Object.keys(o).length>0&&M.jsxs("div",{className:"flex items-center justify-between pl-8 mt-2",children:[M.jsx("div",{className:"text-text-secondary text-xs",children:Ve(u.chainId)?c("withdraw.poolBalance"):c("withdraw.crossChainPoolBalance")}),M.jsxs("div",{className:"text-xs text-text-primary",children:[o[+u.chainId]," USD"]})]})]})},u.chainId))})})]})})})},Vh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,chainPoolBalances:s,walletType:i=Dn,txType:c="deposit"})=>{const a=x.useCallback(v=>c==="withdraw"?i===Dn?v.allowAaWithdraw!==!1:v.allowWithdraw!==!1:i===Dn?v.allowAaDeposit!==!1:v.allowDeposit!==!1,[c,i]),u=x.useMemo(()=>{const v=new Set,$=[];for(const y of t)if(a(y))for(const T of y.tokenList||[]){const B=T.symbol||T.token;!B||!(c!=="withdraw"||T.withdrawEnable===!0&&T.pullOff===!1)||v.has(B)||(v.add(B),$.push({token:B,symbol:B,iconUrl:T.iconUrl,decimals:T.decimals,tokenAddress:T.tokenAddress}))}return $},[t,a,c]),l=v=>{n(v.chainId)},f=v=>{const $=v.symbol||v.token;o($);const y=[];for(const T of t){if(!a(T))continue;(T.tokenList||[]).some(L=>(L.symbol||L.token)===$)&&y.push(T.chainId)}!y.includes(e.chainId)&&y[0]!==void 0&&n(y[0])},d=x.useMemo(()=>{var y,T;const v=r||((y=u[0])==null?void 0:y.symbol)||((T=u[0])==null?void 0:T.token);if(!v)return[];const $=[];for(const B of t){if(!a(B))continue;const L=(B.tokenList||[]).find(_=>(_.symbol||_.token)===v?c==="withdraw"?_.withdrawEnable===!0&&_.pullOff===!1:!0:!1);L&&$.push({...B,tokenList:[{token:L.token,symbol:L.symbol,iconUrl:L.iconUrl,decimals:L.decimals,tokenAddress:L.tokenAddress}]})}return $},[t,r,u,a,c]),p=x.useMemo(()=>d.find(v=>v.chainId===e.chainId)||d[0],[d,e.chainId]),h=x.useMemo(()=>u,[u]),m=x.useMemo(()=>{if(h.length!==0)return h.find(v=>v.token===r||v.symbol===r)||h[0]},[h,r]);return x.useEffect(()=>{if(h.length===0)return;if(!h.some($=>($.symbol||$.token)===r)){const $=h[0];o($.symbol||$.token)}},[h,r,o]),x.useEffect(()=>{if(d.length===0)return;d.some($=>$.chainId===e.chainId)||n(d[0].chainId)},[d,e.chainId,n]),M.jsxs("div",{className:"space-y-4",children:[h.length>0&&m&&M.jsx(ox,{tokens:h,selectedToken:m,onTokenChange:f}),M.jsx(W5,{chains:d,selectedChain:p,chainPoolBalances:s,onChainChange:v=>{const $=t.find(y=>y.chainId===v.chainId);$&&l($)},walletType:i,className:"w-full"})]})};var Ws={},V5=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()}},G5=V5,Gh={"text/plain":"Text","text/html":"Url",default:"Text"},q5="Copy to clipboard: #{key}, Enter";function Z5(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function K5(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=G5(),s=document.createRange(),i=document.getSelection(),c=document.createElement("span"),c.textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=Gh[t.format]||Gh.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");a=!0}catch(l){n&&console.error("unable to copy using execCommand: ",l),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=Z5("message"in t?t.message:q5),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var Y5=K5;function jc(e){"@babel/helpers - typeof";return jc=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},jc(e)}Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.CopyToClipboard=void 0;var Vs=qh(x),X5=qh(Y5),Q5=["text","onCopy","options","children"];function qh(e){return e&&e.__esModule?e:{default:e}}function Zh(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 Kh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zh(Object(n),!0).forEach(function(r){Uc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function J5(e,t){if(e==null)return{};var n=eS(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function eS(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function tS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nS(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,r.key,r)}}function rS(e,t,n){return t&&nS(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function oS(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&&_c(e,t)}function _c(e,t){return _c=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},_c(e,t)}function sS(e){var t=aS();return function(){var r=Gs(e),o;if(t){var s=Gs(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return iS(this,o)}}function iS(e,t){if(t&&(jc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Yh(e)}function Yh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function aS(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Gs(e){return Gs=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Gs(e)}function Uc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xh=function(e){oS(n,e);var t=sS(n);function n(){var r;tS(this,n);for(var o=arguments.length,s=new Array(o),i=0;i<o;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),Uc(Yh(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,f=a.children,d=a.options,p=Vs.default.Children.only(f),h=(0,X5.default)(u,d);l&&l(u,h),p&&p.props&&typeof p.props.onClick=="function"&&p.props.onClick(c)}),r}return rS(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=J5(o,Q5),c=Vs.default.Children.only(s);return Vs.default.cloneElement(c,Kh(Kh({},i),{},{onClick:this.onClick}))}}]),n}(Vs.default.PureComponent);Ws.CopyToClipboard=Xh,Uc(Xh,"defaultProps",{onCopy:void 0,options:void 0});var cS=Ws,zc=cS.CopyToClipboard;zc.CopyToClipboard=zc;var uS=zc;const lS=om(uS);var fS=Object.defineProperty,qs=Object.getOwnPropertySymbols,Qh=Object.prototype.hasOwnProperty,Jh=Object.prototype.propertyIsEnumerable,e0=(e,t,n)=>t in e?fS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hc=(e,t)=>{for(var n in t||(t={}))Qh.call(t,n)&&e0(e,n,t[n]);if(qs)for(var n of qs(t))Jh.call(t,n)&&e0(e,n,t[n]);return e},Wc=(e,t)=>{var n={};for(var r in e)Qh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qs)for(var r of qs(e))t.indexOf(r)<0&&Jh.call(e,r)&&(n[r]=e[r]);return n};/**
94
136
  * @license QR Code generator library (TypeScript)
95
137
  * Copyright (c) Project Nayuki.
96
138
  * SPDX-License-Identifier: MIT
97
- */var Tn;(e=>{const t=class oe{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<oe.MIN_VERSION||a>oe.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 d=[];for(let h=0;h<this.size;h++)d.push(!1);for(let h=0;h<this.size;h++)this.modules.push(d.slice()),this.isFunction.push(d.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(l);if(this.drawCodewords(p),f==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const w=this.getPenaltyScore();w<h&&(f=m,h=w),this.applyMask(m)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,u){const l=e.QrSegment.makeSegments(a);return oe.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return oe.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,d=-1,p=!0){if(!(oe.MIN_VERSION<=l&&l<=f&&f<=oe.MAX_VERSION)||d<-1||d>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const A=oe.getNumDataCodewords(h,u)*8,M=i.getTotalBits(a,h);if(M<=A){m=M;break}if(h>=f)throw new RangeError("Data too long")}for(const A of[oe.Ecc.MEDIUM,oe.Ecc.QUARTILE,oe.Ecc.HIGH])p&&m<=oe.getNumDataCodewords(h,A)*8&&(u=A);let w=[];for(const A of a){n(A.mode.modeBits,4,w),n(A.numChars,A.mode.numCharCountBits(h),w);for(const M of A.getData())w.push(M)}o(w.length==m);const O=oe.getNumDataCodewords(h,u)*8;o(w.length<=O),n(0,Math.min(4,O-w.length),w),n(0,(8-w.length%8)%8,w),o(w.length%8==0);for(let A=236;w.length<O;A^=253)n(A,8,w);let b=[];for(;b.length*8<w.length;)b.push(0);return w.forEach((A,M)=>b[M>>>3]|=A<<7-(M&7)),new oe(h,u,b,d)}getModule(a,u){return 0<=a&&a<this.size&&0<=u&&u<this.size&&this.modules[u][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),u=a.length;for(let l=0;l<u;l++)for(let f=0;f<u;f++)l==0&&f==0||l==0&&f==u-1||l==u-1&&f==0||this.drawAlignmentPattern(a[l],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let l=u;for(let d=0;d<10;d++)l=l<<1^(l>>>9)*1335;const f=(u<<10|l)^21522;o(f>>>15==0);for(let d=0;d<=5;d++)this.setFunctionModule(8,d,r(f,d));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let d=9;d<15;d++)this.setFunctionModule(14-d,8,r(f,d));for(let d=0;d<8;d++)this.setFunctionModule(this.size-1-d,8,r(f,d));for(let d=8;d<15;d++)this.setFunctionModule(8,this.size-15+d,r(f,d));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let l=0;l<12;l++)a=a<<1^(a>>>11)*7973;const u=this.version<<12|a;o(u>>>18==0);for(let l=0;l<18;l++){const f=r(u,l),d=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(d,p,f),this.setFunctionModule(p,d,f)}}drawFinderPattern(a,u){for(let l=-4;l<=4;l++)for(let f=-4;f<=4;f++){const d=Math.max(Math.abs(f),Math.abs(l)),p=a+f,h=u+l;0<=p&&p<this.size&&0<=h&&h<this.size&&this.setFunctionModule(p,h,d!=2&&d!=4)}}drawAlignmentPattern(a,u){for(let l=-2;l<=2;l++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,u+l,Math.max(Math.abs(f),Math.abs(l))!=1)}setFunctionModule(a,u,l){this.modules[u][a]=l,this.isFunction[u][a]=!0}addEccAndInterleave(a){const u=this.version,l=this.errorCorrectionLevel;if(a.length!=oe.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=oe.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],d=oe.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],p=Math.floor(oe.getNumRawDataModules(u)/8),h=f-p%f,m=Math.floor(p/f);let w=[];const O=oe.reedSolomonComputeDivisor(d);for(let A=0,M=0;A<f;A++){let R=a.slice(M,M+m-d+(A<h?0:1));M+=R.length;const D=oe.reedSolomonComputeRemainder(R,O);A<h&&R.push(0),w.push(R.concat(D))}let b=[];for(let A=0;A<w[0].length;A++)w.forEach((M,R)=>{(A!=m-d||R>=h)&&b.push(M[A])});return o(b.length==p),b}drawCodewords(a){if(a.length!=Math.floor(oe.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let f=0;f<this.size;f++)for(let d=0;d<2;d++){const p=l-d,m=(l+1&2)==0?this.size-1-f:f;!this.isFunction[m][p]&&u<a.length*8&&(this.modules[m][p]=r(a[u>>>3],7-(u&7)),u++)}}o(u==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let l=0;l<this.size;l++){let f;switch(a){case 0:f=(l+u)%2==0;break;case 1:f=u%2==0;break;case 2:f=l%3==0;break;case 3:f=(l+u)%3==0;break;case 4:f=(Math.floor(l/3)+Math.floor(u/2))%2==0;break;case 5:f=l*u%2+l*u%3==0;break;case 6:f=(l*u%2+l*u%3)%2==0;break;case 7:f=((l+u)%2+l*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][l]&&f&&(this.modules[u][l]=!this.modules[u][l])}}getPenaltyScore(){let a=0;for(let d=0;d<this.size;d++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[d][w]==p?(h++,h==5?a+=oe.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*oe.PENALTY_N3),p=this.modules[d][w],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*oe.PENALTY_N3}for(let d=0;d<this.size;d++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][d]==p?(h++,h==5?a+=oe.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*oe.PENALTY_N3),p=this.modules[w][d],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*oe.PENALTY_N3}for(let d=0;d<this.size-1;d++)for(let p=0;p<this.size-1;p++){const h=this.modules[d][p];h==this.modules[d][p+1]&&h==this.modules[d+1][p]&&h==this.modules[d+1][p+1]&&(a+=oe.PENALTY_N2)}let u=0;for(const d of this.modules)u=d.reduce((p,h)=>p+(h?1:0),u);const l=this.size*this.size,f=Math.ceil(Math.abs(u*20-l*10)/l)-1;return o(0<=f&&f<=9),a+=f*oe.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let l=[6];for(let f=this.size-7;l.length<a;f-=u)l.splice(1,0,f);return l}}static getNumRawDataModules(a){if(a<oe.MIN_VERSION||a>oe.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*a+128)*a+64;if(a>=2){const l=Math.floor(a/7)+2;u-=(25*l-10)*l-55,a>=7&&(u-=36)}return o(208<=u&&u<=29648),u}static getNumDataCodewords(a,u){return Math.floor(oe.getNumRawDataModules(a)/8)-oe.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*oe.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let u=[];for(let f=0;f<a-1;f++)u.push(0);u.push(1);let l=1;for(let f=0;f<a;f++){for(let d=0;d<u.length;d++)u[d]=oe.reedSolomonMultiply(u[d],l),d+1<u.length&&(u[d]^=u[d+1]);l=oe.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(a,u){let l=u.map(f=>0);for(const f of a){const d=f^l.shift();l.push(0),u.forEach((p,h)=>l[h]^=oe.reedSolomonMultiply(p,d))}return l}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let f=7;f>=0;f--)l=l<<1^(l>>>7)*285,l^=(u>>>f&1)*a;return o(l>>>8==0),l}finderPenaltyCountPatterns(a){const u=a[1];o(u<=this.size*3);const l=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(l&&a[0]>=u*4&&a[6]>=u?1:0)+(l&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,l){return a&&(this.finderPenaltyAddHistory(u,l),u=0),u+=this.size,this.finderPenaltyAddHistory(u,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.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(c,a,u){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let l=a-1;l>=0;l--)u.push(c>>>l&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class ye{constructor(a,u,l){if(this.mode=a,this.numChars=u,this.bitData=l,u<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(a){let u=[];for(const l of a)n(l,8,u);return new ye(ye.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!ye.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<a.length;){const f=Math.min(a.length-l,3);n(parseInt(a.substring(l,l+f),10),f*3+1,u),l+=f}return new ye(ye.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!ye.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],l;for(l=0;l+2<=a.length;l+=2){let f=ye.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;f+=ye.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(f,11,u)}return l<a.length&&n(ye.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new ye(ye.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:ye.isNumeric(a)?[ye.makeNumeric(a)]:ye.isAlphanumeric(a)?[ye.makeAlphanumeric(a)]:[ye.makeBytes(ye.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,u);else if(a<16384)n(2,2,u),n(a,14,u);else if(a<1e6)n(6,3,u),n(a,21,u);else throw new RangeError("ECI assignment value out of range");return new ye(ye.Mode.ECI,0,u)}static isNumeric(a){return ye.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return ye.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const f of a){const d=f.mode.numCharCountBits(u);if(f.numChars>=1<<d)return 1/0;l+=4+d+f.bitData.length}return l}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let l=0;l<a.length;l++)a.charAt(l)!="%"?u.push(a.charCodeAt(l)):(u.push(parseInt(a.substring(l+1,l+3),16)),l+=2);return u}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(Tn||(Tn={})),(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={}))})(Tn||(Tn={})),(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={}))})(Tn||(Tn={}));var Xn=Tn;/**
139
+ */var Wn;(e=>{const t=class ce{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,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 d=[];for(let h=0;h<this.size;h++)d.push(!1);for(let h=0;h<this.size;h++)this.modules.push(d.slice()),this.isFunction.push(d.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(l);if(this.drawCodewords(p),f==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const v=this.getPenaltyScore();v<h&&(f=m,h=v),this.applyMask(m)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,u){const l=e.QrSegment.makeSegments(a);return ce.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return ce.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,d=-1,p=!0){if(!(ce.MIN_VERSION<=l&&l<=f&&f<=ce.MAX_VERSION)||d<-1||d>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const T=ce.getNumDataCodewords(h,u)*8,B=i.getTotalBits(a,h);if(B<=T){m=B;break}if(h>=f)throw new RangeError("Data too long")}for(const T of[ce.Ecc.MEDIUM,ce.Ecc.QUARTILE,ce.Ecc.HIGH])p&&m<=ce.getNumDataCodewords(h,T)*8&&(u=T);let v=[];for(const T of a){n(T.mode.modeBits,4,v),n(T.numChars,T.mode.numCharCountBits(h),v);for(const B of T.getData())v.push(B)}o(v.length==m);const $=ce.getNumDataCodewords(h,u)*8;o(v.length<=$),n(0,Math.min(4,$-v.length),v),n(0,(8-v.length%8)%8,v),o(v.length%8==0);for(let T=236;v.length<$;T^=253)n(T,8,v);let y=[];for(;y.length*8<v.length;)y.push(0);return v.forEach((T,B)=>y[B>>>3]|=T<<7-(B&7)),new ce(h,u,y,d)}getModule(a,u){return 0<=a&&a<this.size&&0<=u&&u<this.size&&this.modules[u][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),u=a.length;for(let l=0;l<u;l++)for(let f=0;f<u;f++)l==0&&f==0||l==0&&f==u-1||l==u-1&&f==0||this.drawAlignmentPattern(a[l],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let l=u;for(let d=0;d<10;d++)l=l<<1^(l>>>9)*1335;const f=(u<<10|l)^21522;o(f>>>15==0);for(let d=0;d<=5;d++)this.setFunctionModule(8,d,r(f,d));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let d=9;d<15;d++)this.setFunctionModule(14-d,8,r(f,d));for(let d=0;d<8;d++)this.setFunctionModule(this.size-1-d,8,r(f,d));for(let d=8;d<15;d++)this.setFunctionModule(8,this.size-15+d,r(f,d));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let l=0;l<12;l++)a=a<<1^(a>>>11)*7973;const u=this.version<<12|a;o(u>>>18==0);for(let l=0;l<18;l++){const f=r(u,l),d=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(d,p,f),this.setFunctionModule(p,d,f)}}drawFinderPattern(a,u){for(let l=-4;l<=4;l++)for(let f=-4;f<=4;f++){const d=Math.max(Math.abs(f),Math.abs(l)),p=a+f,h=u+l;0<=p&&p<this.size&&0<=h&&h<this.size&&this.setFunctionModule(p,h,d!=2&&d!=4)}}drawAlignmentPattern(a,u){for(let l=-2;l<=2;l++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,u+l,Math.max(Math.abs(f),Math.abs(l))!=1)}setFunctionModule(a,u,l){this.modules[u][a]=l,this.isFunction[u][a]=!0}addEccAndInterleave(a){const u=this.version,l=this.errorCorrectionLevel;if(a.length!=ce.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=ce.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],d=ce.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],p=Math.floor(ce.getNumRawDataModules(u)/8),h=f-p%f,m=Math.floor(p/f);let v=[];const $=ce.reedSolomonComputeDivisor(d);for(let T=0,B=0;T<f;T++){let L=a.slice(B,B+m-d+(T<h?0:1));B+=L.length;const _=ce.reedSolomonComputeRemainder(L,$);T<h&&L.push(0),v.push(L.concat(_))}let y=[];for(let T=0;T<v[0].length;T++)v.forEach((B,L)=>{(T!=m-d||L>=h)&&y.push(B[T])});return o(y.length==p),y}drawCodewords(a){if(a.length!=Math.floor(ce.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let f=0;f<this.size;f++)for(let d=0;d<2;d++){const p=l-d,m=(l+1&2)==0?this.size-1-f:f;!this.isFunction[m][p]&&u<a.length*8&&(this.modules[m][p]=r(a[u>>>3],7-(u&7)),u++)}}o(u==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let l=0;l<this.size;l++){let f;switch(a){case 0:f=(l+u)%2==0;break;case 1:f=u%2==0;break;case 2:f=l%3==0;break;case 3:f=(l+u)%3==0;break;case 4:f=(Math.floor(l/3)+Math.floor(u/2))%2==0;break;case 5:f=l*u%2+l*u%3==0;break;case 6:f=(l*u%2+l*u%3)%2==0;break;case 7:f=((l+u)%2+l*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][l]&&f&&(this.modules[u][l]=!this.modules[u][l])}}getPenaltyScore(){let a=0;for(let d=0;d<this.size;d++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[d][v]==p?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*ce.PENALTY_N3),p=this.modules[d][v],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*ce.PENALTY_N3}for(let d=0;d<this.size;d++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[v][d]==p?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*ce.PENALTY_N3),p=this.modules[v][d],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*ce.PENALTY_N3}for(let d=0;d<this.size-1;d++)for(let p=0;p<this.size-1;p++){const h=this.modules[d][p];h==this.modules[d][p+1]&&h==this.modules[d+1][p]&&h==this.modules[d+1][p+1]&&(a+=ce.PENALTY_N2)}let u=0;for(const d of this.modules)u=d.reduce((p,h)=>p+(h?1:0),u);const l=this.size*this.size,f=Math.ceil(Math.abs(u*20-l*10)/l)-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,u=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let l=[6];for(let f=this.size-7;l.length<a;f-=u)l.splice(1,0,f);return l}}static getNumRawDataModules(a){if(a<ce.MIN_VERSION||a>ce.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*a+128)*a+64;if(a>=2){const l=Math.floor(a/7)+2;u-=(25*l-10)*l-55,a>=7&&(u-=36)}return o(208<=u&&u<=29648),u}static getNumDataCodewords(a,u){return Math.floor(ce.getNumRawDataModules(a)/8)-ce.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*ce.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let u=[];for(let f=0;f<a-1;f++)u.push(0);u.push(1);let l=1;for(let f=0;f<a;f++){for(let d=0;d<u.length;d++)u[d]=ce.reedSolomonMultiply(u[d],l),d+1<u.length&&(u[d]^=u[d+1]);l=ce.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(a,u){let l=u.map(f=>0);for(const f of a){const d=f^l.shift();l.push(0),u.forEach((p,h)=>l[h]^=ce.reedSolomonMultiply(p,d))}return l}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let f=7;f>=0;f--)l=l<<1^(l>>>7)*285,l^=(u>>>f&1)*a;return o(l>>>8==0),l}finderPenaltyCountPatterns(a){const u=a[1];o(u<=this.size*3);const l=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(l&&a[0]>=u*4&&a[6]>=u?1:0)+(l&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,l){return a&&(this.finderPenaltyAddHistory(u,l),u=0),u+=this.size,this.finderPenaltyAddHistory(u,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.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(c,a,u){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let l=a-1;l>=0;l--)u.push(c>>>l&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class Se{constructor(a,u,l){if(this.mode=a,this.numChars=u,this.bitData=l,u<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(a){let u=[];for(const l of a)n(l,8,u);return new Se(Se.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!Se.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<a.length;){const f=Math.min(a.length-l,3);n(parseInt(a.substring(l,l+f),10),f*3+1,u),l+=f}return new Se(Se.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!Se.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],l;for(l=0;l+2<=a.length;l+=2){let f=Se.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;f+=Se.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(f,11,u)}return l<a.length&&n(Se.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new Se(Se.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:Se.isNumeric(a)?[Se.makeNumeric(a)]:Se.isAlphanumeric(a)?[Se.makeAlphanumeric(a)]:[Se.makeBytes(Se.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,u);else if(a<16384)n(2,2,u),n(a,14,u);else if(a<1e6)n(6,3,u),n(a,21,u);else throw new RangeError("ECI assignment value out of range");return new Se(Se.Mode.ECI,0,u)}static isNumeric(a){return Se.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Se.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const f of a){const d=f.mode.numCharCountBits(u);if(f.numChars>=1<<d)return 1/0;l+=4+d+f.bitData.length}return l}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let l=0;l<a.length;l++)a.charAt(l)!="%"?u.push(a.charCodeAt(l)):(u.push(parseInt(a.substring(l+1,l+3),16)),l+=2);return u}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(Wn||(Wn={})),(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={}))})(Wn||(Wn={})),(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={}))})(Wn||(Wn={}));var Er=Wn;/**
98
140
  * @license qrcode.react
99
141
  * Copyright (c) Paul O'Shannessy
100
142
  * SPDX-License-Identifier: ISC
101
- */var Tw={L:Xn.QrCode.Ecc.LOW,M:Xn.QrCode.Ecc.MEDIUM,Q:Xn.QrCode.Ecc.QUARTILE,H:Xn.QrCode.Ecc.HIGH},Of=128,Cf="L",If="#FFFFFF",Nf="#000000",kf=!1,Mf=1,Ow=4,Cw=0,Iw=.1;function Lf(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,c){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===r.length-1){if(!i)return;s===null?n.push(`M${c+t},${o+t} h1v1H${c+t}z`):n.push(`M${s+t},${o+t} h${c+1-s}v1H${s+t}z`);return}i&&s===null&&(s=c)})}),n.join("")}function Bf(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 Nw(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*Iw),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,u=r.x==null?e.length/2-c/2:r.x*i,l=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let d=null;if(r.excavate){let h=Math.floor(u),m=Math.floor(l),w=Math.ceil(c+u-h),O=Math.ceil(a+l-m);d={x:h,y:m,w,h:O}}const p=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:d,opacity:f,crossOrigin:p}}function kw(e,t){return t!=null?Math.max(Math.floor(t),0):e?Ow:Cw}function Rf({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=E.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,w)=>(m.push(...Xn.QrSegment.makeSegments(w)),m),[]);return Xn.QrCode.encodeSegments(h,Tw[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:d}=E.useMemo(()=>{let p=a.getModules();const h=kw(r,o),m=p.length+h*2,w=Nw(p,i,h,s);return{cells:p,margin:h,numCells:m,calculatedImageSettings:w}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:d}}var Mw=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Lw=E.forwardRef(function(t,n){const r=t,{value:o,size:s=Of,level:i=Cf,bgColor:c=If,fgColor:a=Nf,includeMargin:u=kf,minVersion:l=Mf,boostLevel:f,marginSize:d,imageSettings:p}=r,m=ua(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=m,O=ua(m,["style"]),b=p==null?void 0:p.src,A=E.useRef(null),M=E.useRef(null),R=E.useCallback(S=>{A.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[D,j]=E.useState(!1),{margin:g,cells:v,numCells:P,calculatedImageSettings:N}=Rf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:p,size:s});E.useEffect(()=>{if(A.current!=null){const S=A.current,x=S.getContext("2d");if(!x)return;let T=v;const C=M.current,y=N!=null&&C!==null&&C.complete&&C.naturalHeight!==0&&C.naturalWidth!==0;y&&N.excavation!=null&&(T=Bf(v,N.excavation));const k=window.devicePixelRatio||1;S.height=S.width=s*k;const F=s/P*k;x.scale(F,F),x.fillStyle=c,x.fillRect(0,0,P,P),x.fillStyle=a,Mw?x.fill(new Path2D(Lf(T,g))):v.forEach(function(_,z){_.forEach(function(H,K){H&&x.fillRect(K+g,z+g,1,1)})}),N&&(x.globalAlpha=N.opacity),y&&x.drawImage(C,N.x+g,N.y+g,N.w,N.h)}}),E.useEffect(()=>{j(!1)},[b]);const I=ca({height:s,width:s},w);let $=null;return b!=null&&($=E.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{j(!0)},ref:M,crossOrigin:N==null?void 0:N.crossOrigin})),E.createElement(E.Fragment,null,E.createElement("canvas",ca({style:I,height:s,width:s,ref:R,role:"img"},O)),$)});Lw.displayName="QRCodeCanvas";var Ff=E.forwardRef(function(t,n){const r=t,{value:o,size:s=Of,level:i=Cf,bgColor:c=If,fgColor:a=Nf,includeMargin:u=kf,minVersion:l=Mf,boostLevel:f,title:d,marginSize:p,imageSettings:h}=r,m=ua(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:O,numCells:b,calculatedImageSettings:A}=Rf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:h,size:s});let M=O,R=null;h!=null&&A!=null&&(A.excavation!=null&&(M=Bf(O,A.excavation)),R=E.createElement("image",{href:h.src,height:A.h,width:A.w,x:A.x+w,y:A.y+w,preserveAspectRatio:"none",opacity:A.opacity,crossOrigin:A.crossOrigin}));const D=Lf(M,w);return E.createElement("svg",ca({height:s,width:s,viewBox:`0 0 ${b} ${b}`,ref:n,role:"img"},m),!!d&&E.createElement("title",null,d),E.createElement("path",{fill:c,d:`M0,0 h${b}v${b}H0z`,shapeRendering:"crispEdges"}),E.createElement("path",{fill:a,d:D,shapeRendering:"crispEdges"}),R)});Ff.displayName="QRCodeSVG";function Bw(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Rw(){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 Df(){return/apple/i.test(navigator.vendor)}function Fw(){return Bw().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function Dw(){return Rw().includes("jsdom/")}const jf="data-floating-ui-focusable",jw="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function la(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 Qn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Bi(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Jn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function fa(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 _w(e){return e.matches("html,body")}function It(e){return(e==null?void 0:e.ownerDocument)||document}function _f(e){return Me(e)&&e.matches(jw)}function Uw(e){if(!e||Dw())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function zw(e){return e?e.hasAttribute(jf)?e:e.querySelector("["+jf+"]")||e:null}function ps(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,...ps(e,o.id,n)])}function Hw(e){return"nativeEvent"in e}function _r(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var Ww=typeof document<"u",Vw=function(){},Nt=Ww?E.useLayoutEffect:Vw;const Gw={...U};function hs(e){const t=U.useRef(e);return Nt(()=>{t.current=e}),t}const qw=Gw.useInsertionEffect||(e=>e());function kt(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return qw(()=>{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 Uf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function zf(e,t){const n=$l(e,Uf()),r=n.length;if(r===0)return;const o=la(It(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Zw(e){return zf(It(e).body,1)||e}function Kw(e){return zf(It(e).body,-1)||e}function da(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Qn(n,r)}function Yw(e){$l(e,Uf()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Hf(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 Xw="data-floating-ui-focusable",Wf="active",Vf="selected",Qw={...U};let Gf=!1,Jw=0;const qf=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Jw++;function ev(){const[e,t]=U.useState(()=>Gf?qf():void 0);return Nt(()=>{e==null&&t(qf())},[]),U.useEffect(()=>{Gf=!0},[]),e}const pa=Qw.useId||ev;let ha;process.env.NODE_ENV!=="production"&&(ha=new Set);function tv(){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=ha)!=null&&e.has(o))){var s;(s=ha)==null||s.add(o),console.error(o)}}function nv(){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 rv=U.createContext(null),ov=U.createContext(null),ma=()=>{var e;return((e=U.useContext(rv))==null?void 0:e.id)||null},ga=()=>U.useContext(ov);function Ur(e){return"data-floating-ui-"+e}function st(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Zf=Ur("safe-polygon");function ba(e,t,n){if(n&&!_r(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 ya(e){return typeof e=="function"?e():e}function sv(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:u=null,mouseOnly:l=!1,restMs:f=0,move:d=!0}=t,p=ga(),h=ma(),m=hs(u),w=hs(a),O=hs(n),b=hs(f),A=U.useRef(),M=U.useRef(-1),R=U.useRef(),D=U.useRef(-1),j=U.useRef(!0),g=U.useRef(!1),v=U.useRef(()=>{}),P=U.useRef(!1),N=kt(()=>{var C;const y=(C=o.current.openEvent)==null?void 0:C.type;return(y==null?void 0:y.includes("mouse"))&&y!=="mousedown"});U.useEffect(()=>{if(!c)return;function C(y){let{open:k}=y;k||(st(M),st(D),j.current=!0,P.current=!1)}return s.on("openchange",C),()=>{s.off("openchange",C)}},[c,s]),U.useEffect(()=>{if(!c||!m.current||!n)return;function C(k){N()&&r(!1,k,"hover")}const y=It(i.floating).documentElement;return y.addEventListener("mouseleave",C),()=>{y.removeEventListener("mouseleave",C)}},[i.floating,n,r,c,m,N]);const I=U.useCallback(function(C,y,k){y===void 0&&(y=!0),k===void 0&&(k="hover");const F=ba(w.current,"close",A.current);F&&!R.current?(st(M),M.current=window.setTimeout(()=>r(!1,C,k),F)):y&&(st(M),r(!1,C,k))},[w,r]),$=kt(()=>{v.current(),R.current=void 0}),S=kt(()=>{if(g.current){const C=It(i.floating).body;C.style.pointerEvents="",C.removeAttribute(Zf),g.current=!1}}),x=kt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!c)return;function C(z){if(st(M),j.current=!1,l&&!_r(A.current)||ya(b.current)>0&&!ba(w.current,"open"))return;const H=ba(w.current,"open",A.current);H?M.current=window.setTimeout(()=>{O.current||r(!0,z,"hover")},H):n||r(!0,z,"hover")}function y(z){if(x()){S();return}v.current();const H=It(i.floating);if(st(D),P.current=!1,m.current&&o.current.floatingContext){n||st(M),R.current=m.current({...o.current.floatingContext,tree:p,x:z.clientX,y:z.clientY,onClose(){S(),$(),x()||I(z,!0,"safe-polygon")}});const W=R.current;H.addEventListener("mousemove",W),v.current=()=>{H.removeEventListener("mousemove",W)};return}(A.current==="touch"?!Qn(i.floating,z.relatedTarget):!0)&&I(z)}function k(z){x()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:p,x:z.clientX,y:z.clientY,onClose(){S(),$(),x()||I(z)}})(z))}function F(){st(M)}function _(z){x()||I(z,!1)}if(ce(i.domReference)){const z=i.domReference,H=i.floating;return n&&z.addEventListener("mouseleave",k),d&&z.addEventListener("mousemove",C,{once:!0}),z.addEventListener("mouseenter",C),z.addEventListener("mouseleave",y),H&&(H.addEventListener("mouseleave",k),H.addEventListener("mouseenter",F),H.addEventListener("mouseleave",_)),()=>{n&&z.removeEventListener("mouseleave",k),d&&z.removeEventListener("mousemove",C),z.removeEventListener("mouseenter",C),z.removeEventListener("mouseleave",y),H&&(H.removeEventListener("mouseleave",k),H.removeEventListener("mouseenter",F),H.removeEventListener("mouseleave",_))}}},[i,c,e,l,d,I,$,S,r,n,O,p,w,m,o,x,b]),Nt(()=>{var C;if(c&&n&&(C=m.current)!=null&&(C=C.__options)!=null&&C.blockPointerEvents&&N()){g.current=!0;const k=i.floating;if(ce(i.domReference)&&k){var y;const F=It(i.floating).body;F.setAttribute(Zf,"");const _=i.domReference,z=p==null||(y=p.nodesRef.current.find(H=>H.id===h))==null||(y=y.context)==null?void 0:y.elements.floating;return z&&(z.style.pointerEvents=""),F.style.pointerEvents="none",_.style.pointerEvents="auto",k.style.pointerEvents="auto",()=>{F.style.pointerEvents="",_.style.pointerEvents="",k.style.pointerEvents=""}}}},[c,n,h,i,p,m,N]),Nt(()=>{n||(A.current=void 0,P.current=!1,$(),S())},[n,$,S]),U.useEffect(()=>()=>{$(),st(M),st(D),S()},[c,i.domReference,$,S]);const T=U.useMemo(()=>{function C(y){A.current=y.pointerType}return{onPointerDown:C,onPointerEnter:C,onMouseMove(y){const{nativeEvent:k}=y;function F(){!j.current&&!O.current&&r(!0,k,"hover")}l&&!_r(A.current)||n||ya(b.current)===0||P.current&&y.movementX**2+y.movementY**2<2||(st(D),A.current==="touch"?F():(P.current=!0,D.current=window.setTimeout(F,ya(b.current))))}}},[l,r,n,O,b]);return U.useMemo(()=>c?{reference:T}:{},[c,T])}const Kf={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},Yf=U.forwardRef(function(t,n){const[r,o]=U.useState();Nt(()=>{Df()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ur("focus-guard")]:"",style:Kf};return L.jsx("span",{...t,...s})}),Xf=U.createContext(null),Qf=Ur("portal");function iv(e){e===void 0&&(e={});const{id:t,root:n}=e,r=pa(),o=cv(),[s,i]=U.useState(null),c=U.useRef(null);return Nt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Nt(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const u=document.createElement("div");u.id=r,u.setAttribute(Qf,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Nt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Li(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const l=document.createElement("div");l.id=r,l.setAttribute(Qf,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function av(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=iv({id:n,root:r}),[i,c]=U.useState(null),a=U.useRef(null),u=U.useRef(null),l=U.useRef(null),f=U.useRef(null),d=i==null?void 0:i.modal,p=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||d)return;function m(w){s&&da(w)&&(w.type==="focusin"?Hf:Yw)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,d]),U.useEffect(()=>{s&&(p||Hf(s))},[p,s]),L.jsxs(Xf.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&L.jsx(Yf,{"data-type":"outside",ref:a,onFocus:m=>{if(da(m,s)){var w;(w=l.current)==null||w.focus()}else{const O=i?i.domReference:null,b=Kw(O);b==null||b.focus()}}}),h&&s&&L.jsx("span",{"aria-owns":s.id,style:Kf}),s&&Pr.createPortal(t,s),h&&s&&L.jsx(Yf,{"data-type":"outside",ref:u,onFocus:m=>{if(da(m,s)){var w;(w=f.current)==null||w.focus()}else{const O=i?i.domReference:null,b=Zw(O);b==null||b.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const cv=()=>U.useContext(Xf);function Jf(e){return Me(e.target)&&e.target.tagName==="BUTTON"}function uv(e){return Me(e.target)&&e.target.tagName==="A"}function ed(e){return _f(e)}function lv(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:u=!1,keyboardHandlers:l=!0,stickIfOpen:f=!0}=t,d=U.useRef(),p=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(m){d.current=m.pointerType},onMouseDown(m){const w=d.current;m.button===0&&c!=="click"&&(_r(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const w=d.current;if(c==="mousedown"&&d.current){d.current=void 0;return}_r(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){d.current=void 0,!(m.defaultPrevented||!l||Jf(m))&&(m.key===" "&&!ed(s)&&(m.preventDefault(),p.current=!0),!uv(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||Jf(m)||ed(s)||m.key===" "&&p.current&&(p.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const fv={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dv={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},td=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 pv(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:l=!1,referencePressEvent:f="pointerdown",ancestorScroll:d=!1,bubbles:p,capture:h}=t,m=ga(),w=kt(typeof a=="function"?a:()=>!1),O=typeof a=="function"?w:a,b=U.useRef(!1),{escapeKey:A,outsidePress:M}=td(p),{escapeKey:R,outsidePress:D}=td(h),j=U.useRef(!1),g=kt(S=>{var x;if(!n||!i||!c||S.key!=="Escape"||j.current)return;const T=(x=s.current.floatingContext)==null?void 0:x.nodeId,C=m?ps(m.nodesRef.current,T):[];if(!A&&(S.stopPropagation(),C.length>0)){let y=!0;if(C.forEach(k=>{var F;if((F=k.context)!=null&&F.open&&!k.context.dataRef.current.__escapeKeyBubbles){y=!1;return}}),!y)return}r(!1,Hw(S)?S.nativeEvent:S,"escape-key")}),v=kt(S=>{var x;const T=()=>{var C;g(S),(C=Jn(S))==null||C.removeEventListener("keydown",T)};(x=Jn(S))==null||x.addEventListener("keydown",T)}),P=kt(S=>{var x;const T=s.current.insideReactTree;s.current.insideReactTree=!1;const C=b.current;if(b.current=!1,u==="click"&&C||T||typeof O=="function"&&!O(S))return;const y=Jn(S),k="["+Ur("inert")+"]",F=It(o.floating).querySelectorAll(k);let _=ce(y)?y:null;for(;_&&!Ht(_);){const W=Wt(_);if(Ht(W)||!ce(W))break;_=W}if(F.length&&ce(y)&&!_w(y)&&!Qn(y,o.floating)&&Array.from(F).every(W=>!Qn(_,W)))return;if(Me(y)&&$){const W=Ht(y),Z=ot(y),q=/auto|scroll/,Q=W||q.test(Z.overflowX),te=W||q.test(Z.overflowY),ue=Q&&y.clientWidth>0&&y.scrollWidth>y.clientWidth,Se=te&&y.clientHeight>0&&y.scrollHeight>y.clientHeight,Ke=Z.direction==="rtl",$e=Se&&(Ke?S.offsetX<=y.offsetWidth-y.clientWidth:S.offsetX>y.clientWidth),Pe=ue&&S.offsetY>y.clientHeight;if($e||Pe)return}const z=(x=s.current.floatingContext)==null?void 0:x.nodeId,H=m&&ps(m.nodesRef.current,z).some(W=>{var Z;return fa(S,(Z=W.context)==null?void 0:Z.elements.floating)});if(fa(S,o.floating)||fa(S,o.domReference)||H)return;const K=m?ps(m.nodesRef.current,z):[];if(K.length>0){let W=!0;if(K.forEach(Z=>{var q;if((q=Z.context)!=null&&q.open&&!Z.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}r(!1,S,"outside-press")}),N=kt(S=>{var x;const T=()=>{var C;P(S),(C=Jn(S))==null||C.removeEventListener(u,T)};(x=Jn(S))==null||x.addEventListener(u,T)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=A,s.current.__outsidePressBubbles=M;let S=-1;function x(F){r(!1,F,"ancestor-scroll")}function T(){window.clearTimeout(S),j.current=!0}function C(){S=window.setTimeout(()=>{j.current=!1},Vo()?5:0)}const y=It(o.floating);c&&(y.addEventListener("keydown",R?v:g,R),y.addEventListener("compositionstart",T),y.addEventListener("compositionend",C)),O&&y.addEventListener(u,D?N:P,D);let k=[];return d&&(ce(o.domReference)&&(k=fn(o.domReference)),ce(o.floating)&&(k=k.concat(fn(o.floating))),!ce(o.reference)&&o.reference&&o.reference.contextElement&&(k=k.concat(fn(o.reference.contextElement)))),k=k.filter(F=>{var _;return F!==((_=y.defaultView)==null?void 0:_.visualViewport)}),k.forEach(F=>{F.addEventListener("scroll",x,{passive:!0})}),()=>{c&&(y.removeEventListener("keydown",R?v:g,R),y.removeEventListener("compositionstart",T),y.removeEventListener("compositionend",C)),O&&y.removeEventListener(u,D?N:P,D),k.forEach(F=>{F.removeEventListener("scroll",x)}),window.clearTimeout(S)}},[s,o,c,O,u,n,r,d,i,A,M,g,R,v,P,D,N]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,O,u]);const I=U.useMemo(()=>({onKeyDown:g,...l&&{[fv[f]]:S=>{r(!1,S.nativeEvent,"reference-press")},...f!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,l,f]),$=U.useMemo(()=>({onKeyDown:g,onMouseDown(){b.current=!0},onMouseUp(){b.current=!0},[dv[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return U.useMemo(()=>i?{reference:I,floating:$}:{},[i,I,$])}function hv(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=pa(),s=U.useRef({}),[i]=U.useState(()=>nv()),c=ma()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!ce(p)&&tv("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=U.useState(r.reference),l=kt((p,h,m)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:m,nested:c}),n==null||n(p,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),d=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:l,elements:d,events:i,floatingId:o,refs:f}),[t,l,d,i,o,f])}function mv(e){e===void 0&&(e={});const{nodeId:t}=e,n=hv({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),d=ga();Nt(()=>{l&&(f.current=l)},[l]);const p=jl({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(A=>{const M=ce(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),getClientRects:()=>A.getClientRects(),contextElement:A}:A;a(M),p.refs.setReference(M)},[p.refs]),m=U.useCallback(A=>{(ce(A)||A===null)&&(f.current=A,i(A)),(ce(p.refs.reference.current)||p.refs.reference.current===null||A!==null&&!ce(A))&&p.refs.setReference(A)},[p.refs]),w=U.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:f}),[p.refs,m,h]),O=U.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),b=U.useMemo(()=>({...p,...r,refs:w,elements:O,nodeId:t}),[p,w,O,t,r]);return Nt(()=>{r.dataRef.current.floatingContext=b;const A=d==null?void 0:d.nodesRef.current.find(M=>M.id===t);A&&(A.context=b)}),U.useMemo(()=>({...p,context:b,refs:w,elements:O}),[p,w,O,b])}function wa(){return Fw()&&Df()}function gv(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,u=U.useRef(!1),l=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!c)return;const p=je(i.domReference);function h(){!n&&Me(i.domReference)&&i.domReference===la(It(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function w(){f.current=!1}return p.addEventListener("blur",h),wa()&&(p.addEventListener("keydown",m,!0),p.addEventListener("pointerdown",w,!0)),()=>{p.removeEventListener("blur",h),wa()&&(p.removeEventListener("keydown",m,!0),p.removeEventListener("pointerdown",w,!0))}},[i.domReference,n,c]),U.useEffect(()=>{if(!c)return;function p(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(u.current=!0)}return o.on("openchange",p),()=>{o.off("openchange",p)}},[o,c]),U.useEffect(()=>()=>{st(l)},[]);const d=U.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(p){if(u.current)return;const h=Jn(p.nativeEvent);if(a&&ce(h)){if(wa()&&!p.relatedTarget){if(!f.current&&!_f(h))return}else if(!Uw(h))return}r(!0,p.nativeEvent,"focus")},onBlur(p){u.current=!1;const h=p.relatedTarget,m=p.nativeEvent,w=ce(h)&&h.hasAttribute(Ur("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var O;const b=la(i.domReference?i.domReference.ownerDocument:document);!h&&b===i.domReference||Qn((O=s.current.floatingContext)==null?void 0:O.refs.floating.current,b)||Qn(i.domReference,b)||w||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>c?{reference:d}:{},[c,d])}function va(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Wf]:i,[Vf]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Xw]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[Wf,Vf].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var d,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(d=r.get(u))==null?void 0:d.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function bv(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=U.useCallback(c=>va(c,e,"reference"),t),s=U.useCallback(c=>va(c,e,"floating"),n),i=U.useCallback(c=>va(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const yv=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function wv(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,u=pa(),l=((n=s.domReference)==null?void 0:n.id)||u,f=U.useMemo(()=>{var b;return((b=zw(s.floating))==null?void 0:b.id)||i},[s.floating,i]),d=(r=yv.get(a))!=null?r:a,h=ma()!=null,m=U.useMemo(()=>d==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":d==="alertdialog"?"dialog":d,"aria-controls":o?f:void 0,...d==="listbox"&&{role:"combobox"},...d==="menu"&&{id:l},...d==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,f,h,o,l,a]),w=U.useMemo(()=>{const b={id:f,...d&&{role:d}};return d==="tooltip"||a==="label"?b:{...b,...d==="menu"&&{"aria-labelledby":l}}},[d,f,l,a]),O=U.useCallback(b=>{let{active:A,selected:M}=b;const R={role:"option",...A&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...R,"aria-selected":M}}return{}},[f,a]);return U.useMemo(()=>c?{reference:m,floating:w,item:O}:{},[c,m,w,O])}const nd=E.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 L.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});nd.displayName="TooltipArrow";const er=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[u,l]=E.useState(!1),f=E.useRef(null),{refs:d,floatingStyles:p,context:h}=mv({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:Bl,middleware:[qi(o?12:8),Ul({fallbackAxisSideDirection:"start",padding:8}),_l({padding:8}),...o?[Fy({element:f})]:[]]}),m=sv(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),w=gv(h,{enabled:a.includes("focus")}),O=lv(h,{enabled:a.includes("click")}),b=pv(h),A=wv(h,{role:"tooltip"}),{getReferenceProps:M,getFloatingProps:R}=bv([m,w,O,b,A]);return i?L.jsx(L.Fragment,{children:e}):L.jsxs(L.Fragment,{children:[L.jsx("div",{ref:d.setReference,...M(),children:e}),u&&L.jsx(av,{children:L.jsxs("div",{ref:d.setFloating,...R(),style:p,className:`
143
+ */var dS={L:Er.QrCode.Ecc.LOW,M:Er.QrCode.Ecc.MEDIUM,Q:Er.QrCode.Ecc.QUARTILE,H:Er.QrCode.Ecc.HIGH},t0=128,n0="L",r0="#FFFFFF",o0="#000000",s0=!1,i0=1,pS=4,hS=0,mS=.1;function a0(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,c){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===r.length-1){if(!i)return;s===null?n.push(`M${c+t},${o+t} h1v1H${c+t}z`):n.push(`M${s+t},${o+t} h${c+1-s}v1H${s+t}z`);return}i&&s===null&&(s=c)})}),n.join("")}function c0(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 gS(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*mS),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,u=r.x==null?e.length/2-c/2:r.x*i,l=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let d=null;if(r.excavate){let h=Math.floor(u),m=Math.floor(l),v=Math.ceil(c+u-h),$=Math.ceil(a+l-m);d={x:h,y:m,w:v,h:$}}const p=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:d,opacity:f,crossOrigin:p}}function bS(e,t){return t!=null?Math.max(Math.floor(t),0):e?pS:hS}function u0({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=x.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,v)=>(m.push(...Er.QrSegment.makeSegments(v)),m),[]);return Er.QrCode.encodeSegments(h,dS[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:d}=x.useMemo(()=>{let p=a.getModules();const h=bS(r,o),m=p.length+h*2,v=gS(p,i,h,s);return{cells:p,margin:h,numCells:m,calculatedImageSettings:v}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:d}}var yS=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),wS=x.forwardRef(function(t,n){const r=t,{value:o,size:s=t0,level:i=n0,bgColor:c=r0,fgColor:a=o0,includeMargin:u=s0,minVersion:l=i0,boostLevel:f,marginSize:d,imageSettings:p}=r,m=Wc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=m,$=Wc(m,["style"]),y=p==null?void 0:p.src,T=x.useRef(null),B=x.useRef(null),L=x.useCallback(S=>{T.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[_,F]=x.useState(!1),{margin:g,cells:w,numCells:A,calculatedImageSettings:I}=u0({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:p,size:s});x.useEffect(()=>{if(T.current!=null){const S=T.current,E=S.getContext("2d");if(!E)return;let C=w;const O=B.current,b=I!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;b&&I.excavation!=null&&(C=c0(w,I.excavation));const k=window.devicePixelRatio||1;S.height=S.width=s*k;const D=s/A*k;E.scale(D,D),E.fillStyle=c,E.fillRect(0,0,A,A),E.fillStyle=a,yS?E.fill(new Path2D(a0(C,g))):w.forEach(function(j,z){j.forEach(function(W,K){W&&E.fillRect(K+g,z+g,1,1)})}),I&&(E.globalAlpha=I.opacity),b&&E.drawImage(O,I.x+g,I.y+g,I.w,I.h)}}),x.useEffect(()=>{F(!1)},[y]);const N=Hc({height:s,width:s},v);let P=null;return y!=null&&(P=x.createElement("img",{src:y,key:y,style:{display:"none"},onLoad:()=>{F(!0)},ref:B,crossOrigin:I==null?void 0:I.crossOrigin})),x.createElement(x.Fragment,null,x.createElement("canvas",Hc({style:N,height:s,width:s,ref:L,role:"img"},$)),P)});wS.displayName="QRCodeCanvas";var l0=x.forwardRef(function(t,n){const r=t,{value:o,size:s=t0,level:i=n0,bgColor:c=r0,fgColor:a=o0,includeMargin:u=s0,minVersion:l=i0,boostLevel:f,title:d,marginSize:p,imageSettings:h}=r,m=Wc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:$,numCells:y,calculatedImageSettings:T}=u0({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:h,size:s});let B=$,L=null;h!=null&&T!=null&&(T.excavation!=null&&(B=c0($,T.excavation)),L=x.createElement("image",{href:h.src,height:T.h,width:T.w,x:T.x+v,y:T.y+v,preserveAspectRatio:"none",opacity:T.opacity,crossOrigin:T.crossOrigin}));const _=a0(B,v);return x.createElement("svg",Hc({height:s,width:s,viewBox:`0 0 ${y} ${y}`,ref:n,role:"img"},m),!!d&&x.createElement("title",null,d),x.createElement("path",{fill:c,d:`M0,0 h${y}v${y}H0z`,shapeRendering:"crispEdges"}),x.createElement("path",{fill:a,d:_,shapeRendering:"crispEdges"}),L)});l0.displayName="QRCodeSVG";function vS(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function xS(){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 f0(){return/apple/i.test(navigator.vendor)}function ES(){return vS().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function SS(){return xS().includes("jsdom/")}const d0="data-floating-ui-focusable",PS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Vc(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 Sr(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&gc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Pr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Gc(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 AS(e){return e.matches("html,body")}function Dt(e){return(e==null?void 0:e.ownerDocument)||document}function p0(e){return De(e)&&e.matches(PS)}function $S(e){if(!e||SS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function TS(e){return e?e.hasAttribute(d0)?e:e.querySelector("["+d0+"]")||e:null}function Zs(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,...Zs(e,o.id,n)])}function CS(e){return"nativeEvent"in e}function Co(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var OS=typeof document<"u",IS=function(){},Ft=OS?x.useLayoutEffect:IS;const NS={...U};function Ks(e){const t=U.useRef(e);return Ft(()=>{t.current=e}),t}const kS=NS.useInsertionEffect||(e=>e());function jt(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return kS(()=>{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 h0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function m0(e,t){const n=Qp(e,h0()),r=n.length;if(r===0)return;const o=Vc(Dt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function BS(e){return m0(Dt(e).body,1)||e}function MS(e){return m0(Dt(e).body,-1)||e}function qc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Sr(n,r)}function LS(e){Qp(e,h0()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function g0(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 RS="data-floating-ui-focusable",b0="active",y0="selected",DS={...U};let w0=!1,FS=0;const v0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+FS++;function jS(){const[e,t]=U.useState(()=>w0?v0():void 0);return Ft(()=>{e==null&&t(v0())},[]),U.useEffect(()=>{w0=!0},[]),e}const Zc=DS.useId||jS;let Kc;process.env.NODE_ENV!=="production"&&(Kc=new Set);function _S(){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=Kc)!=null&&e.has(o))){var s;(s=Kc)==null||s.add(o),console.error(o)}}function US(){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 zS=U.createContext(null),HS=U.createContext(null),Yc=()=>{var e;return((e=U.useContext(zS))==null?void 0:e.id)||null},Xc=()=>U.useContext(HS);function Oo(e){return"data-floating-ui-"+e}function lt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const x0=Oo("safe-polygon");function Qc(e,t,n){if(n&&!Co(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 Jc(e){return typeof e=="function"?e():e}function WS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:u=null,mouseOnly:l=!1,restMs:f=0,move:d=!0}=t,p=Xc(),h=Yc(),m=Ks(u),v=Ks(a),$=Ks(n),y=Ks(f),T=U.useRef(),B=U.useRef(-1),L=U.useRef(),_=U.useRef(-1),F=U.useRef(!0),g=U.useRef(!1),w=U.useRef(()=>{}),A=U.useRef(!1),I=jt(()=>{var O;const b=(O=o.current.openEvent)==null?void 0:O.type;return(b==null?void 0:b.includes("mouse"))&&b!=="mousedown"});U.useEffect(()=>{if(!c)return;function O(b){let{open:k}=b;k||(lt(B),lt(_),F.current=!0,A.current=!1)}return s.on("openchange",O),()=>{s.off("openchange",O)}},[c,s]),U.useEffect(()=>{if(!c||!m.current||!n)return;function O(k){I()&&r(!1,k,"hover")}const b=Dt(i.floating).documentElement;return b.addEventListener("mouseleave",O),()=>{b.removeEventListener("mouseleave",O)}},[i.floating,n,r,c,m,I]);const N=U.useCallback(function(O,b,k){b===void 0&&(b=!0),k===void 0&&(k="hover");const D=Qc(v.current,"close",T.current);D&&!L.current?(lt(B),B.current=window.setTimeout(()=>r(!1,O,k),D)):b&&(lt(B),r(!1,O,k))},[v,r]),P=jt(()=>{w.current(),L.current=void 0}),S=jt(()=>{if(g.current){const O=Dt(i.floating).body;O.style.pointerEvents="",O.removeAttribute(x0),g.current=!1}}),E=jt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!c)return;function O(z){if(lt(B),F.current=!1,l&&!Co(T.current)||Jc(y.current)>0&&!Qc(v.current,"open"))return;const W=Qc(v.current,"open",T.current);W?B.current=window.setTimeout(()=>{$.current||r(!0,z,"hover")},W):n||r(!0,z,"hover")}function b(z){if(E()){S();return}w.current();const W=Dt(i.floating);if(lt(_),A.current=!1,m.current&&o.current.floatingContext){n||lt(B),L.current=m.current({...o.current.floatingContext,tree:p,x:z.clientX,y:z.clientY,onClose(){S(),P(),E()||N(z,!0,"safe-polygon")}});const H=L.current;W.addEventListener("mousemove",H),w.current=()=>{W.removeEventListener("mousemove",H)};return}(T.current==="touch"?!Sr(i.floating,z.relatedTarget):!0)&&N(z)}function k(z){E()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:p,x:z.clientX,y:z.clientY,onClose(){S(),P(),E()||N(z)}})(z))}function D(){lt(B)}function j(z){E()||N(z,!1)}if(he(i.domReference)){const z=i.domReference,W=i.floating;return n&&z.addEventListener("mouseleave",k),d&&z.addEventListener("mousemove",O,{once:!0}),z.addEventListener("mouseenter",O),z.addEventListener("mouseleave",b),W&&(W.addEventListener("mouseleave",k),W.addEventListener("mouseenter",D),W.addEventListener("mouseleave",j)),()=>{n&&z.removeEventListener("mouseleave",k),d&&z.removeEventListener("mousemove",O),z.removeEventListener("mouseenter",O),z.removeEventListener("mouseleave",b),W&&(W.removeEventListener("mouseleave",k),W.removeEventListener("mouseenter",D),W.removeEventListener("mouseleave",j))}}},[i,c,e,l,d,N,P,S,r,n,$,p,v,m,o,E,y]),Ft(()=>{var O;if(c&&n&&(O=m.current)!=null&&(O=O.__options)!=null&&O.blockPointerEvents&&I()){g.current=!0;const k=i.floating;if(he(i.domReference)&&k){var b;const D=Dt(i.floating).body;D.setAttribute(x0,"");const j=i.domReference,z=p==null||(b=p.nodesRef.current.find(W=>W.id===h))==null||(b=b.context)==null?void 0:b.elements.floating;return z&&(z.style.pointerEvents=""),D.style.pointerEvents="none",j.style.pointerEvents="auto",k.style.pointerEvents="auto",()=>{D.style.pointerEvents="",j.style.pointerEvents="",k.style.pointerEvents=""}}}},[c,n,h,i,p,m,I]),Ft(()=>{n||(T.current=void 0,A.current=!1,P(),S())},[n,P,S]),U.useEffect(()=>()=>{P(),lt(B),lt(_),S()},[c,i.domReference,P,S]);const C=U.useMemo(()=>{function O(b){T.current=b.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(b){const{nativeEvent:k}=b;function D(){!F.current&&!$.current&&r(!0,k,"hover")}l&&!Co(T.current)||n||Jc(y.current)===0||A.current&&b.movementX**2+b.movementY**2<2||(lt(_),T.current==="touch"?D():(A.current=!0,_.current=window.setTimeout(D,Jc(y.current))))}}},[l,r,n,$,y]);return U.useMemo(()=>c?{reference:C}:{},[c,C])}const E0={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},S0=U.forwardRef(function(t,n){const[r,o]=U.useState();Ft(()=>{f0()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Oo("focus-guard")]:"",style:E0};return M.jsx("span",{...t,...s})}),P0=U.createContext(null),A0=Oo("portal");function VS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Zc(),o=qS(),[s,i]=U.useState(null),c=U.useRef(null);return Ft(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Ft(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const u=document.createElement("div");u.id=r,u.setAttribute(A0,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Ft(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!mc(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const l=document.createElement("div");l.id=r,l.setAttribute(A0,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function GS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=VS({id:n,root:r}),[i,c]=U.useState(null),a=U.useRef(null),u=U.useRef(null),l=U.useRef(null),f=U.useRef(null),d=i==null?void 0:i.modal,p=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||d)return;function m(v){s&&qc(v)&&(v.type==="focusin"?g0:LS)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,d]),U.useEffect(()=>{s&&(p||g0(s))},[p,s]),M.jsxs(P0.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&M.jsx(S0,{"data-type":"outside",ref:a,onFocus:m=>{if(qc(m,s)){var v;(v=l.current)==null||v.focus()}else{const $=i?i.domReference:null,y=MS($);y==null||y.focus()}}}),h&&s&&M.jsx("span",{"aria-owns":s.id,style:E0}),s&&Tr.createPortal(t,s),h&&s&&M.jsx(S0,{"data-type":"outside",ref:u,onFocus:m=>{if(qc(m,s)){var v;(v=f.current)==null||v.focus()}else{const $=i?i.domReference:null,y=BS($);y==null||y.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const qS=()=>U.useContext(P0);function $0(e){return De(e.target)&&e.target.tagName==="BUTTON"}function ZS(e){return De(e.target)&&e.target.tagName==="A"}function T0(e){return p0(e)}function KS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:u=!1,keyboardHandlers:l=!0,stickIfOpen:f=!0}=t,d=U.useRef(),p=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(m){d.current=m.pointerType},onMouseDown(m){const v=d.current;m.button===0&&c!=="click"&&(Co(v,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const v=d.current;if(c==="mousedown"&&d.current){d.current=void 0;return}Co(v,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){d.current=void 0,!(m.defaultPrevented||!l||$0(m))&&(m.key===" "&&!T0(s)&&(m.preventDefault(),p.current=!0),!ZS(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||$0(m)||T0(s)||m.key===" "&&p.current&&(p.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const YS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},XS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},C0=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 QS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:l=!1,referencePressEvent:f="pointerdown",ancestorScroll:d=!1,bubbles:p,capture:h}=t,m=Xc(),v=jt(typeof a=="function"?a:()=>!1),$=typeof a=="function"?v:a,y=U.useRef(!1),{escapeKey:T,outsidePress:B}=C0(p),{escapeKey:L,outsidePress:_}=C0(h),F=U.useRef(!1),g=jt(S=>{var E;if(!n||!i||!c||S.key!=="Escape"||F.current)return;const C=(E=s.current.floatingContext)==null?void 0:E.nodeId,O=m?Zs(m.nodesRef.current,C):[];if(!T&&(S.stopPropagation(),O.length>0)){let b=!0;if(O.forEach(k=>{var D;if((D=k.context)!=null&&D.open&&!k.context.dataRef.current.__escapeKeyBubbles){b=!1;return}}),!b)return}r(!1,CS(S)?S.nativeEvent:S,"escape-key")}),w=jt(S=>{var E;const C=()=>{var O;g(S),(O=Pr(S))==null||O.removeEventListener("keydown",C)};(E=Pr(S))==null||E.addEventListener("keydown",C)}),A=jt(S=>{var E;const C=s.current.insideReactTree;s.current.insideReactTree=!1;const O=y.current;if(y.current=!1,u==="click"&&O||C||typeof $=="function"&&!$(S))return;const b=Pr(S),k="["+Oo("inert")+"]",D=Dt(o.floating).querySelectorAll(k);let j=he(b)?b:null;for(;j&&!rn(j);){const H=on(j);if(rn(H)||!he(H))break;j=H}if(D.length&&he(b)&&!AS(b)&&!Sr(b,o.floating)&&Array.from(D).every(H=>!Sr(j,H)))return;if(De(b)&&P){const H=rn(b),Z=ut(b),q=/auto|scroll/,J=H||q.test(Z.overflowX),te=H||q.test(Z.overflowY),pe=J&&b.clientWidth>0&&b.scrollWidth>b.clientWidth,Ee=te&&b.clientHeight>0&&b.scrollHeight>b.clientHeight,X=Z.direction==="rtl",Q=Ee&&(X?S.offsetX<=b.offsetWidth-b.clientWidth:S.offsetX>b.clientWidth),se=pe&&S.offsetY>b.clientHeight;if(Q||se)return}const z=(E=s.current.floatingContext)==null?void 0:E.nodeId,W=m&&Zs(m.nodesRef.current,z).some(H=>{var Z;return Gc(S,(Z=H.context)==null?void 0:Z.elements.floating)});if(Gc(S,o.floating)||Gc(S,o.domReference)||W)return;const K=m?Zs(m.nodesRef.current,z):[];if(K.length>0){let H=!0;if(K.forEach(Z=>{var q;if((q=Z.context)!=null&&q.open&&!Z.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}r(!1,S,"outside-press")}),I=jt(S=>{var E;const C=()=>{var O;A(S),(O=Pr(S))==null||O.removeEventListener(u,C)};(E=Pr(S))==null||E.addEventListener(u,C)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=B;let S=-1;function E(D){r(!1,D,"ancestor-scroll")}function C(){window.clearTimeout(S),F.current=!0}function O(){S=window.setTimeout(()=>{F.current=!1},$s()?5:0)}const b=Dt(o.floating);c&&(b.addEventListener("keydown",L?w:g,L),b.addEventListener("compositionstart",C),b.addEventListener("compositionend",O)),$&&b.addEventListener(u,_?I:A,_);let k=[];return d&&(he(o.domReference)&&(k=yn(o.domReference)),he(o.floating)&&(k=k.concat(yn(o.floating))),!he(o.reference)&&o.reference&&o.reference.contextElement&&(k=k.concat(yn(o.reference.contextElement)))),k=k.filter(D=>{var j;return D!==((j=b.defaultView)==null?void 0:j.visualViewport)}),k.forEach(D=>{D.addEventListener("scroll",E,{passive:!0})}),()=>{c&&(b.removeEventListener("keydown",L?w:g,L),b.removeEventListener("compositionstart",C),b.removeEventListener("compositionend",O)),$&&b.removeEventListener(u,_?I:A,_),k.forEach(D=>{D.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,o,c,$,u,n,r,d,i,T,B,g,L,w,A,_,I]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,$,u]);const N=U.useMemo(()=>({onKeyDown:g,...l&&{[YS[f]]:S=>{r(!1,S.nativeEvent,"reference-press")},...f!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,l,f]),P=U.useMemo(()=>({onKeyDown:g,onMouseDown(){y.current=!0},onMouseUp(){y.current=!0},[XS[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return U.useMemo(()=>i?{reference:N,floating:P}:{},[i,N,P])}function JS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Zc(),s=U.useRef({}),[i]=U.useState(()=>US()),c=Yc()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!he(p)&&_S("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=U.useState(r.reference),l=jt((p,h,m)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:m,nested:c}),n==null||n(p,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),d=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:l,elements:d,events:i,floatingId:o,refs:f}),[t,l,d,i,o,f])}function eP(e){e===void 0&&(e={});const{nodeId:t}=e,n=JS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),d=Xc();Ft(()=>{l&&(f.current=l)},[l]);const p=ph({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(T=>{const B=he(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;a(B),p.refs.setReference(B)},[p.refs]),m=U.useCallback(T=>{(he(T)||T===null)&&(f.current=T,i(T)),(he(p.refs.reference.current)||p.refs.reference.current===null||T!==null&&!he(T))&&p.refs.setReference(T)},[p.refs]),v=U.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:f}),[p.refs,m,h]),$=U.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),y=U.useMemo(()=>({...p,...r,refs:v,elements:$,nodeId:t}),[p,v,$,t,r]);return Ft(()=>{r.dataRef.current.floatingContext=y;const T=d==null?void 0:d.nodesRef.current.find(B=>B.id===t);T&&(T.context=y)}),U.useMemo(()=>({...p,context:y,refs:v,elements:$}),[p,v,$,y])}function eu(){return ES()&&f0()}function tP(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,u=U.useRef(!1),l=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!c)return;const p=We(i.domReference);function h(){!n&&De(i.domReference)&&i.domReference===Vc(Dt(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function v(){f.current=!1}return p.addEventListener("blur",h),eu()&&(p.addEventListener("keydown",m,!0),p.addEventListener("pointerdown",v,!0)),()=>{p.removeEventListener("blur",h),eu()&&(p.removeEventListener("keydown",m,!0),p.removeEventListener("pointerdown",v,!0))}},[i.domReference,n,c]),U.useEffect(()=>{if(!c)return;function p(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(u.current=!0)}return o.on("openchange",p),()=>{o.off("openchange",p)}},[o,c]),U.useEffect(()=>()=>{lt(l)},[]);const d=U.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(p){if(u.current)return;const h=Pr(p.nativeEvent);if(a&&he(h)){if(eu()&&!p.relatedTarget){if(!f.current&&!p0(h))return}else if(!$S(h))return}r(!0,p.nativeEvent,"focus")},onBlur(p){u.current=!1;const h=p.relatedTarget,m=p.nativeEvent,v=he(h)&&h.hasAttribute(Oo("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var $;const y=Vc(i.domReference?i.domReference.ownerDocument:document);!h&&y===i.domReference||Sr(($=s.current.floatingContext)==null?void 0:$.refs.floating.current,y)||Sr(i.domReference,y)||v||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>c?{reference:d}:{},[c,d])}function tu(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[b0]:i,[y0]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[RS]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[b0,y0].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var d,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(d=r.get(u))==null?void 0:d.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function nP(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=U.useCallback(c=>tu(c,e,"reference"),t),s=U.useCallback(c=>tu(c,e,"floating"),n),i=U.useCallback(c=>tu(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const rP=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function oP(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,u=Zc(),l=((n=s.domReference)==null?void 0:n.id)||u,f=U.useMemo(()=>{var y;return((y=TS(s.floating))==null?void 0:y.id)||i},[s.floating,i]),d=(r=rP.get(a))!=null?r:a,h=Yc()!=null,m=U.useMemo(()=>d==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":d==="alertdialog"?"dialog":d,"aria-controls":o?f:void 0,...d==="listbox"&&{role:"combobox"},...d==="menu"&&{id:l},...d==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,f,h,o,l,a]),v=U.useMemo(()=>{const y={id:f,...d&&{role:d}};return d==="tooltip"||a==="label"?y:{...y,...d==="menu"&&{"aria-labelledby":l}}},[d,f,l,a]),$=U.useCallback(y=>{let{active:T,selected:B}=y;const L={role:"option",...T&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...L,"aria-selected":B}}return{}},[f,a]);return U.useMemo(()=>c?{reference:m,floating:v,item:$}:{},[c,m,v,$])}const O0=x.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 M.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});O0.displayName="TooltipArrow";const Vn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[u,l]=x.useState(!1),f=x.useRef(null),{refs:d,floatingStyles:p,context:h}=eP({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:uh,middleware:[Cc(o?12:8),mh({fallbackAxisSideDirection:"start",padding:8}),hh({padding:8}),...o?[E6({element:f})]:[]]}),m=WS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),v=tP(h,{enabled:a.includes("focus")}),$=KS(h,{enabled:a.includes("click")}),y=QS(h),T=oP(h,{role:"tooltip"}),{getReferenceProps:B,getFloatingProps:L}=nP([m,v,$,y,T]);return i?M.jsx(M.Fragment,{children:e}):M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:d.setReference,...B(),children:e}),u&&M.jsx(GS,{children:M.jsxs("div",{ref:d.setFloating,...L(),style:p,className:`
102
144
  z-50 px-3 py-2
103
145
  bg-fill-page-secondary
104
146
  text-text-primary text-sm font-medium
@@ -106,47 +148,5 @@ React keys must be passed directly to JSX without using spread:
106
148
  relative
107
149
  ${c}
108
150
  ${s}
109
- `,children:[t,o&&L.jsx(nd,{ref:f,placement:h.placement||n})]})})]})},ms="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=",vv=(e,t)=>Number(e)>Number(t),ht=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"},xa=(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 xa(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:ht(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},gs={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},xv=[gs.ETHEREUM,gs.SEPOLIA,gs.ARBITRUM,gs.ARBITRUM_SEPOLIA],Ev=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!xv.includes(t)}return!0},Sv=({currentActiveChain:e,selectedToken:t,address:n,onDeposit:r,onCopy:o,onClose:s})=>{const{t:i}=_t(),c=E.useMemo(()=>Ev(e||{}),[e]);return L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&L.jsx("div",{className:"bg-white rounded-lg",children:L.jsx(Ff,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&L.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[L.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),L.jsx(Pw,{onCopy:()=>{o&&o(n)},text:n,children:L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[L.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),L.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")]}),L.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[L.jsxs("div",{className:"flex items-start",children:[L.jsx("div",{className:"w-5",children:L.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),L.jsx("div",{className:"flex-1",children:L.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),c&&L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),L.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),L.jsxs("div",{className:"text-sm",children:[L.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[L.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),L.jsx(er,{content:L.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[L.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),L.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:L.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:i("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),L.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[L.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),L.jsxs("span",{className:"text-text-primary font-medium text-right",children:["10 ",t]})]}),L.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[L.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),L.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),L.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{r&&r({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),s()},children:i("deposit.title")})]})},$v="1.0.8";let qe=class nu extends Error{constructor(t,n={}){var i;const r=n.cause instanceof nu?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof nu&&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@${$v}`].join(`
110
- `);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 qt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const rd=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,od=/^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)?$/,sd=/^\(.+?\).*?$/,id=/^tuple(?<array>(\[(\d*)\])*)$/;function Ea(e){let t=e.type;if(id.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+=Ea(s),o<n-1&&(t+=", ")}const r=qt(id,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Ea({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function zr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Ea(o),r!==n-1&&(t+=", ")}return t}function bs(e){var t;return e.type==="function"?`function ${e.name}(${zr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${zr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${zr(e.inputs)})`:e.type==="error"?`error ${e.name}(${zr(e.inputs)})`:e.type==="constructor"?`constructor(${zr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const ad=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Pv(e){return ad.test(e)}function Av(e){return qt(ad,e)}const cd=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Tv(e){return cd.test(e)}function Ov(e){return qt(cd,e)}const ud=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Cv(e){return ud.test(e)}function Iv(e){return qt(ud,e)}const ld=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Sa(e){return ld.test(e)}function Nv(e){return qt(ld,e)}const fd=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function kv(e){return fd.test(e)}function Mv(e){return qt(fd,e)}const dd=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Lv(e){return dd.test(e)}function Bv(e){return qt(dd,e)}const Rv=/^receive\(\) external payable$/;function Fv(e){return Rv.test(e)}const Dv=new Set(["indexed"]),$a=new Set(["calldata","memory","storage"]);class jv extends qe{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 _v extends qe{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 Uv extends qe{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 zv extends qe{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Hv extends qe{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 Wv extends qe{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 Vv extends qe{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 Gv extends qe{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 tr extends qe{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class qv extends qe{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Zv extends qe{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 Kv extends qe{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 Yv extends qe{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 Xv(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}const Pa=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 Aa(e,t={}){if(Cv(e))return Qv(e,t);if(Tv(e))return Jv(e,t);if(Pv(e))return ex(e,t);if(kv(e))return tx(e,t);if(Lv(e))return nx(e);if(Fv(e))return{type:"receive",stateMutability:"payable"};throw new qv({signature:e})}function Qv(e,t={}){const n=Iv(e);if(!n)throw new tr({signature:e,type:"function"});const r=mt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(On(r[c],{modifiers:$a,structs:t,type:"function"}));const i=[];if(n.returns){const c=mt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(On(c[u],{modifiers:$a,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Jv(e,t={}){const n=Ov(e);if(!n)throw new tr({signature:e,type:"event"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(On(r[i],{modifiers:Dv,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function ex(e,t={}){const n=Av(e);if(!n)throw new tr({signature:e,type:"error"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(On(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function tx(e,t={}){const n=Mv(e);if(!n)throw new tr({signature:e,type:"constructor"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(On(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function nx(e){const t=Bv(e);if(!t)throw new tr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const rx=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ox=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,sx=/^u?int$/;function On(e,t){var f,d;const n=Xv(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Pa.has(n))return Pa.get(n);const r=sd.test(e),o=qt(r?ox:rx,e);if(!o)throw new zv({param:e});if(o.name&&ax(o.name))throw new Hv({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,u={};if(r){a="tuple";const p=mt(o.type),h=[],m=p.length;for(let w=0;w<m;w++)h.push(On(p[w],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(sx.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!pd(a))throw new Uv({type:a});if(o.modifier){if(!((d=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&d.call(f,o.modifier)))throw new Wv({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if($a.has(o.modifier)&&!cx(a,!!o.array))throw new Vv({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return Pa.set(n,l),l}function mt(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?mt(c,[...t,n.trim()]):mt(c,t,`${n}${i}`,r);case"(":return mt(c,t,`${n}${i}`,r+1);case")":return mt(c,t,`${n}${i}`,r-1);default:return mt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Yv({current:n,depth:r});return t.push(n.trim()),t}function pd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||rd.test(e)||od.test(e)}const ix=/^(?: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 ax(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||rd.test(e)||od.test(e)||ix.test(e)}function cx(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function hd(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!Sa(c))continue;const a=Nv(c);if(!a)throw new tr({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],f=u.length;for(let d=0;d<f;d++){const h=u[d].trim();if(!h)continue;const m=On(h,{type:"struct"});l.push(m)}if(!l.length)throw new Zv({signature:c});t[a.name]=l}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=md(a,t)}return r}const ux=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function md(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(sd.test(i.type))r.push(i);else{const a=qt(ux,i.type);if(!(a!=null&&a.type))throw new Gv({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Kv({type:l});r.push({...i,type:`tuple${u??""}`,components:md(t[l]??[],t,new Set([...n,l]))})}else if(pd(l))r.push(i);else throw new _v({type:l})}}return r}function gd(e){const t=hd(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];Sa(s)||n.push(Aa(s,t))}return n}function bd(e){let t;if(typeof e=="string")t=Aa(e);else{const n=hd(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!Sa(s)){t=Aa(s,n);break}}}if(!t)throw new jv({signature:e});return t}function J(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 gt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Ex(e.type);return`${e.name}(${ys(e.inputs,{includeName:t})})`}function ys(e,{includeName:t=!1}={}){return e?e.map(n=>lx(n,{includeName:t})).join(t?", ":","):""}function lx(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ys(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function bt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function be(e){return bt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const yd="2.34.0";let Hr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${yd}`},V=class ru extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof ru?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof ru&&n.cause.docsPath||n.docsPath,s=(c=Hr.getDocsUrl)==null?void 0:c.call(Hr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Hr.version?[`Version: ${Hr.version}`]:[]].join(`
111
- `);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=yd}walk(t){return wd(this,t)}};function wd(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?wd(e.cause,t):t?null:e}class fx extends V{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(`
112
- `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class vd extends V{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(`
113
- `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class xd extends V{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
114
- `),{metaMessages:[`Params: (${ys(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 Wr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class dx extends V{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
115
- `),{name:"AbiEncodingArrayLengthMismatchError"})}}class px extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${be(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class hx extends V{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
116
- `),{name:"AbiEncodingLengthMismatchError"})}}class mx extends V{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(`
117
- `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Ed extends V{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(`
118
- `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Sd extends V{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://openchain.xyz/signatures?query=${t}.`].join(`
119
- `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class gx extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class $d extends V{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://openchain.xyz/signatures?query=${t}.`].join(`
120
- `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Pd extends V{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(`
121
- `),{docsPath:n,name:"AbiEventNotFoundError"})}}class nr extends V{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(`
122
- `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Ad extends V{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(`
123
- `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class bx extends V{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://openchain.xyz/signatures?query=${t}.`].join(`
124
- `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class yx extends V{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${gt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${gt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let wx=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Vr extends V{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
125
- `),{metaMessages:[`Params: (${ys(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 ws extends V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${gt(t,{includeName:!0})}".`].join(`
126
- `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class vx extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
127
- `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class xx extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
128
- `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Td=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
129
- `),{name:"InvalidArrayError"})}};class Ex extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
130
- `),{name:"InvalidDefinitionTypeError"})}}class Sx extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Od=class extends V{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Cd=class extends V{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 Id extends V{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 rr(e,{dir:t,size:n=32}={}){return typeof e=="string"?pn(e,{dir:t,size:n}):$x(e,{dir:t,size:n})}function pn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Cd({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function $x(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Cd({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 Nd=class extends V{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"})}};class Px extends V{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 Ax extends V{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Tx=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Cn(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 yt(e,{size:t}){if(be(e)>t)throw new Tx({givenSize:be(e),maxSize:t})}function Mt(e,t={}){const{signed:n}=t;t.size&&yt(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 Ox(e,t={}){let n=e;if(t.size&&(yt(n,{size:t.size}),n=Cn(n)),Cn(n)==="0x00")return!1;if(Cn(n)==="0x01")return!0;throw new Ax(n)}function Zt(e,t={}){return Number(Mt(e,t))}const Cx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Kt(e,t={}){return typeof e=="number"||typeof e=="bigint"?X(e,t):typeof e=="string"?Gr(e,t):typeof e=="boolean"?kd(e,t):xe(e,t)}function kd(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(yt(n,{size:t.size}),rr(n,{size:t.size})):n}function xe(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Cx[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(yt(r,{size:t.size}),rr(r,{dir:"right",size:t.size})):r}function X(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 Nd({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?rr(c,{size:r}):c}const Ix=new TextEncoder;function Gr(e,t={}){const n=Ix.encode(e);return xe(n,t)}const Nx=new TextEncoder;function or(e,t={}){return typeof e=="number"||typeof e=="bigint"?Mx(e,t):typeof e=="boolean"?kx(e,t):bt(e)?wt(e,t):In(e,t)}function kx(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(yt(n,{size:t.size}),rr(n,{size:t.size})):n}const Yt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Md(e){if(e>=Yt.zero&&e<=Yt.nine)return e-Yt.zero;if(e>=Yt.A&&e<=Yt.F)return e-(Yt.A-10);if(e>=Yt.a&&e<=Yt.f)return e-(Yt.a-10)}function wt(e,t={}){let n=e;t.size&&(yt(n,{size:t.size}),n=rr(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,c=0;i<o;i++){const a=Md(r.charCodeAt(c++)),u=Md(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new V(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function Mx(e,t){const n=X(e,t);return wt(n)}function In(e,t={}){const n=Nx.encode(e);return typeof t.size=="number"?(yt(n,{size:t.size}),rr(n,{dir:"right",size:t.size})):n}const vs=BigInt(2**32-1),Ld=BigInt(32);function Lx(e,t=!1){return t?{h:Number(e&vs),l:Number(e>>Ld&vs)}:{h:Number(e>>Ld&vs)|0,l:Number(e&vs)|0}}function Bx(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:c}=Lx(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Rx=(e,t,n)=>e<<n|t>>>32-n,Fx=(e,t,n)=>t<<n|e>>>32-n,Dx=(e,t,n)=>t<<n-32|e>>>64-n,jx=(e,t,n)=>e<<n-32|t>>>64-n,sr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function xs(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Xt(e,...t){if(!xs(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 Bd(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");qr(e.outputLen),qr(e.blockLen)}function ir(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 Rd(e,t){Xt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function _x(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ar(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ta(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Lt(e,t){return e<<32-t|e>>>t}const Ux=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function zx(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Hx(e){for(let t=0;t<e.length;t++)e[t]=zx(e[t]);return e}const Fd=Ux?e=>e:Hx,Dd=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Wx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function cr(e){if(Xt(e),Dd)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Wx[e[n]];return t}const Qt={_0:48,_9:57,A:65,F:70,a:97,f:102};function jd(e){if(e>=Qt._0&&e<=Qt._9)return e-Qt._0;if(e>=Qt.A&&e<=Qt.F)return e-(Qt.A-10);if(e>=Qt.a&&e<=Qt.f)return e-(Qt.a-10)}function Es(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Dd)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=jd(e.charCodeAt(s)),c=jd(e.charCodeAt(s+1));if(i===void 0||c===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+c}return r}function Vx(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=Vx(e)),Xt(e),e}function hn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Xt(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 Oa{}function _d(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 Ud(e=32){if(sr&&typeof sr.getRandomValues=="function")return sr.getRandomValues(new Uint8Array(e));if(sr&&typeof sr.randomBytes=="function")return Uint8Array.from(sr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Gx=BigInt(0),Zr=BigInt(1),qx=BigInt(2),Zx=BigInt(7),Kx=BigInt(256),Yx=BigInt(113),zd=[],Hd=[],Wd=[];for(let e=0,t=Zr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],zd.push(2*(5*r+n)),Hd.push((e+1)*(e+2)/2%64);let o=Gx;for(let s=0;s<7;s++)t=(t<<Zr^(t>>Zx)*Yx)%Kx,t&qx&&(o^=Zr<<(Zr<<BigInt(s))-Zr);Wd.push(o)}const Vd=Bx(Wd,!0),Xx=Vd[0],Qx=Vd[1],Gd=(e,t,n)=>n>32?Dx(e,t,n):Rx(e,t,n),qd=(e,t,n)=>n>32?jx(e,t,n):Fx(e,t,n);function Jx(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 c=(i+8)%10,a=(i+2)%10,u=n[a],l=n[a+1],f=Gd(u,l,1)^n[c],d=qd(u,l,1)^n[c+1];for(let p=0;p<50;p+=10)e[i+p]^=f,e[i+p+1]^=d}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=Hd[i],a=Gd(o,s,c),u=qd(o,s,c),l=zd[i];o=e[l],s=e[l+1],e[l]=a,e[l+1]=u}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Xx[r],e[1]^=Qx[r]}ar(n)}class Ca extends Oa{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,qr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=_x(this.state)}clone(){return this._cloneInto()}keccak(){Fd(this.state32),Jx(this.state32,this.rounds),Fd(this.state32),this.posOut=0,this.pos=0}update(t){ir(this),t=Ss(t),Xt(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 c=0;c<i;c++)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){ir(this,!1),Xt(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 qr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Rd(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,ar(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Ca(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 eE=(e,t,n)=>_d(()=>new Ca(t,e,n)),Zd=eE(1,136,256/8);function Ce(e,t){const n=t||"hex",r=Zd(bt(e,{strict:!1})?or(e):e);return n==="bytes"?r:Kt(r)}const tE=e=>Ce(or(e));function nE(e){return tE(e)}function rE(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new V("Unable to normalize signature.");return o}const oE=e=>{const t=typeof e=="string"?e:bs(e);return rE(t)};function Kd(e){return nE(oE(e))}const $s=Kd;let mn=class extends V{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"})}},Ia=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 Na=new Ia(8192);function Ps(e,t){if(Na.has(`${e}.${t}`))return Na.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ce(In(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 Na.set(`${e}.${t}`,s),s}function Nn(e,t){if(!it(e,{strict:!1}))throw new mn({address:e});return Ps(e,t)}const sE=/^0x[a-fA-F0-9]{40}$/,ka=new Ia(8192);function it(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(ka.has(r))return ka.get(r);const o=sE.test(e)?e.toLowerCase()===e?!0:n?Ps(e)===e:!0:!1;return ka.set(r,o),o}function vt(e){return typeof e[0]=="string"?ur(e):iE(e)}function iE(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 ur(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function lr(e,t,n,{strict:r}={}){return bt(e,{strict:!1})?Jd(e,t,n,{strict:r}):Qd(e,t,n,{strict:r})}function Yd(e,t){if(typeof t=="number"&&t>0&&t>be(e)-1)throw new Od({offset:t,position:"start",size:be(e)})}function Xd(e,t,n){if(typeof t=="number"&&typeof n=="number"&&be(e)!==n-t)throw new Od({offset:n,position:"end",size:be(e)})}function Qd(e,t,n,{strict:r}={}){Yd(e,t);const o=e.slice(t,n);return r&&Xd(o,t,n),o}function Jd(e,t,n,{strict:r}={}){Yd(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Xd(o,t,n),o}const aE=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ep=/^(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 Jt(e,t){if(e.length!==t.length)throw new hx({expectedLength:e.length,givenLength:t.length});const n=cE({params:e,values:t}),r=La(n);return r.length===0?"0x":r}function cE({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Ma({param:e[r],value:t[r]}));return n}function Ma({param:e,value:t}){const n=Ba(e.type);if(n){const[r,o]=n;return lE(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return mE(t,{param:e});if(e.type==="address")return uE(t);if(e.type==="bool")return dE(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=ep.exec(e.type)??[];return pE(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return fE(t,{param:e});if(e.type==="string")return hE(t);throw new vx(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function La(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=be(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(X(t+o,{size:32})),r.push(c),o+=be(c)):n.push(c)}return vt([...n,...r])}function uE(e){if(!it(e))throw new mn({address:e});return{dynamic:!1,encoded:pn(e.toLowerCase())}}function lE(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Td(e);if(!r&&e.length!==t)throw new dx({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=Ma({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=La(s);if(r){const c=X(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?vt([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:vt(s.map(({encoded:i})=>i))}}function fE(e,{param:t}){const[,n]=t.type.split("bytes"),r=be(e);if(!n){let o=e;return r%32!==0&&(o=pn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:vt([pn(X(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new px({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:pn(e,{dir:"right"})}}function dE(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:pn(kd(e))}}function pE(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 Nd({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:X(e,{size:32,signed:t})}}function hE(e){const t=Gr(e),n=Math.ceil(be(t)/32),r=[];for(let o=0;o<n;o++)r.push(pn(lr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:vt([pn(X(be(t),{size:32})),...r])}}function mE(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,c=Ma({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?La(r):vt(r.map(({encoded:o})=>o))}}function Ba(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Kr=e=>lr(Kd(e),0,4);function kn(e){const{abi:t,args:n=[],name:r}=e,o=bt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Kr(c)===r:c.type==="event"?$s(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((u,l)=>{const f="inputs"in c&&c.inputs[l];return f?Ra(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=tp(c.inputs,i.inputs,n);if(u)throw new yx({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Ra(e,t){const n=typeof e,r=t.type;switch(r){case"address":return it(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)=>Ra(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=>Ra(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function tp(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 tp(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")?it(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?it(n[r],{strict:!1}):!1)return i}}const np="/docs/contract/encodeEventTopics";function Yr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=kn({abi:t,name:n});if(!u)throw new Pd(n,{docsPath:np});o=u}if(o.type!=="event")throw new Pd(void 0,{docsPath:np});const s=gt(o),i=$s(s);let c=[];if(r&&"inputs"in o){const u=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(f=>r[f.name]))??[]:[];l.length>0&&(c=(u==null?void 0:u.map((f,d)=>Array.isArray(l[d])?l[d].map((p,h)=>rp({param:f,value:l[d][h]})):typeof l[d]<"u"&&l[d]!==null?rp({param:f,value:l[d]}):null))??[])}return[i,...c]}function rp({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ce(or(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Sx(e.type);return Jt([e],[t])}function As(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:c,transport:a})=>{c==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function op(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=As(e,{method:"eth_newFilter"}),l=s?Yr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?X(i):i,toBlock:typeof a=="bigint"?X(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function xt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const sp="/docs/contract/encodeFunctionData";function gE(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=kn({abi:t,args:n,name:r});if(!s)throw new nr(r,{docsPath:sp});o=s}if(o.type!=="function")throw new nr(void 0,{docsPath:sp});return{abi:[o],functionName:Kr(gt(o))}}function Bt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:gE(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Jt(o.inputs,t??[]):void 0;return ur([s,i??"0x"])}const ip={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."},ap={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},bE={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class cp extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class up extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class yE extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const wE={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 yE({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new up({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new cp({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 cp({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 Fa(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(wE);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function vE(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=xe(e,t);return Mt(n,t)}function xE(e,t={}){let n=e;if(typeof t.size<"u"&&(yt(n,{size:t.size}),n=Cn(n)),n.length>1||n[0]>1)throw new Px(n);return!!n[0]}function en(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=xe(e,t);return Zt(n,t)}function EE(e,t={}){let n=e;return typeof t.size<"u"&&(yt(n,{size:t.size}),n=Cn(n,{dir:"right"})),new TextDecoder().decode(n)}function Xr(e,t){const n=typeof t=="string"?wt(t):t,r=Fa(n);if(be(n)===0&&e.length>0)throw new Wr;if(be(t)&&be(t)<32)throw new xd({data:typeof t=="string"?t:xe(t),params:e,size:be(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=fr(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function fr(e,t,{staticPosition:n}){const r=Ba(t.type);if(r){const[o,s]=r;return $E(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return OE(e,t,{staticPosition:n});if(t.type==="address")return SE(e);if(t.type==="bool")return PE(e);if(t.type.startsWith("bytes"))return AE(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return TE(e,t);if(t.type==="string")return CE(e,{staticPosition:n});throw new xx(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const lp=32,Da=32;function SE(e){const t=e.readBytes(32);return[Ps(xe(Qd(t,-20))),32]}function $E(e,t,{length:n,staticPosition:r}){if(!n){const i=en(e.readBytes(Da)),c=r+i,a=c+lp;e.setPosition(c);const u=en(e.readBytes(lp)),l=Qr(t);let f=0;const d=[];for(let p=0;p<u;++p){e.setPosition(a+(l?p*32:f));const[h,m]=fr(e,t,{staticPosition:a});f+=m,d.push(h)}return e.setPosition(r+32),[d,32]}if(Qr(t)){const i=en(e.readBytes(Da)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=fr(e,t,{staticPosition:c});a.push(l)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=fr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function PE(e){return[xE(e.readBytes(32),{size:32}),32]}function AE(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=en(e.readBytes(32));e.setPosition(n+i);const c=en(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[xe(a),32]}return[xe(e.readBytes(Number.parseInt(o),32)),32]}function TE(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?vE(o,{signed:n}):en(o,{signed:n}),32]}function OE(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Qr(t)){const i=en(e.readBytes(Da)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=fr(e,u,{staticPosition:c});s+=f,o[r?a:u==null?void 0:u.name]=l}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,u]=fr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function CE(e,{staticPosition:t}){const n=en(e.readBytes(32)),r=t+n;e.setPosition(r);const o=en(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=EE(Cn(s));return e.setPosition(t+32),[i,32]}function Qr(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(Qr);const n=Ba(e.type);return!!(n&&Qr({...e,type:n[1]}))}function fp(e){const{abi:t,data:n}=e,r=lr(n,0,4);if(r==="0x")throw new Wr;const s=[...t||[],ap,bE].find(i=>i.type==="error"&&r===Kr(gt(i)));if(!s)throw new Sd(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Xr(s.inputs,lr(n,4)):void 0,errorName:s.name}}const Ee=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function dp({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"?Ee(t[s]):t[s]}`).join(", ")})`}const IE={gwei:9,wei:18},NE={ether:-9,wei:9};function ja(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 pp(e,t="wei"){return ja(e,IE[t])}function Et(e,t="wei"){return ja(e,NE[t])}class kE extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class ME extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function hp(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
131
- `,"")}function LE(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
132
- `;return r.nonce&&(o+=` nonce: ${r.nonce}
133
- `),r.balance&&(o+=` balance: ${r.balance}
134
- `),r.code&&(o+=` code: ${r.code}
135
- `),r.state&&(o+=` state:
136
- `,o+=hp(r.state)),r.stateDiff&&(o+=` stateDiff:
137
- `,o+=hp(r.stateDiff)),o},` State Override:
138
- `).slice(0,-1)}function Ts(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(`
139
- `)}class BE extends V{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
140
- `),{name:"FeeConflictError"})}}class RE extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Ts(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 mp extends V{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 gp extends V{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 FE extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const DE=e=>e,Jr=e=>e;class bp extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:d,stateOverride:p}){var w;const h=n?xt(n):void 0;let m=Ts({from:h==null?void 0:h.address,to:f,value:typeof d<"u"&&`${pp(d)} ${((w=o==null?void 0:o.nativeCurrency)==null?void 0:w.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Et(u)} gwei`,nonce:l});p&&(m+=`
141
- ${LE(p)}`),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 jE extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=kn({abi:n,args:r,name:i}),u=a?dp({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?gt(a,{includeName:!0}):void 0,f=Ts({address:o&&DE(o),function:l,args:u&&u!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${u}`,sender:c});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=c}}class _a extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=fp({abi:t,data:n});const{abiItem:l,errorName:f,args:d}=i;if(f==="Error")a=d[0];else if(f==="Panic"){const[p]=d;a=ip[p]}else{const p=l?gt(l,{includeName:!0}):void 0,h=l&&d?dp({abiItem:l,args:d,includeFunctionName:!1,includeName:!1}):void 0;c=[p?`Error: ${p}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(l){s=l}else o&&(a=o);let u;s instanceof Sd&&(u=s.signature,c=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(a&&a!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,a||u].join(`
142
- `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:c,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=u}}class _E extends V{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 UE extends V{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 V{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 Mn extends V{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: ${Jr(i)}`,t&&`Request body: ${Ee(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 Ua extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Jr(r)}`,`Request body: ${Ee(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}),this.code=n.code,this.data=n.data}}class yp extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Jr(n)}`,`Request body: ${Ee(t)}`],name:"TimeoutError"})}}const zE=-1;class _e extends V{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 Ua?t.code:n??zE}}class Ze extends _e{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class eo extends _e{constructor(t){super(t,{code:eo.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class to extends _e{constructor(t){super(t,{code:to.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class no extends _e{constructor(t,{method:n}={}){super(t,{code:no.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ro extends _e{constructor(t){super(t,{code:ro.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
143
- `)})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ln extends _e{constructor(t){super(t,{code:Ln.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Bn extends _e{constructor(t){super(t,{code:Bn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
144
- `)})}}Object.defineProperty(Bn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class oo extends _e{constructor(t){super(t,{code:oo.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class so extends _e{constructor(t){super(t,{code:so.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class io extends _e{constructor(t){super(t,{code:io.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Rn extends _e{constructor(t,{method:n}={}){super(t,{code:Rn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class dr extends _e{constructor(t){super(t,{code:dr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class ao extends _e{constructor(t){super(t,{code:ao.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class pr extends Ze{constructor(t){super(t,{code:pr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(pr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class co extends Ze{constructor(t){super(t,{code:co.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class uo extends Ze{constructor(t,{method:n}={}){super(t,{code:uo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class lo extends Ze{constructor(t){super(t,{code:lo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class fo extends Ze{constructor(t){super(t,{code:fo.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class po extends Ze{constructor(t){super(t,{code:po.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ho extends Ze{constructor(t){super(t,{code:ho.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class mo extends Ze{constructor(t){super(t,{code:mo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class go extends Ze{constructor(t){super(t,{code:go.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class bo extends Ze{constructor(t){super(t,{code:bo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class yo extends Ze{constructor(t){super(t,{code:yo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class wo extends Ze{constructor(t){super(t,{code:wo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class vo extends Ze{constructor(t){super(t,{code:vo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class HE extends _e{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const WE=3;function hr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Os?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:d}=c,p=e instanceof Wr?new _E({functionName:s}):[WE,Ln.code].includes(a)&&(u||l||f||d)?new _a({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof Ua?l:d??f}):e;return new jE(p,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function VE(e){const t=Ce(`0x${e.substring(4)}`).substring(26);return Ps(`0x${t}`)}async function GE({hash:e,signature:t}){const n=bt(e)?e:Kt(e),{secp256k1:r}=await Promise.resolve().then(()=>FS);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:f,yParity:d}=t,p=Number(d??f),h=wp(p);return new r.Signature(Mt(u),Mt(l)).addRecoveryBit(h)}const i=bt(t)?t:Kt(t);if(be(i)!==65)throw new Error("invalid signature length");const c=Zt(`0x${i.slice(130)}`),a=wp(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function wp(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 vp({hash:e,signature:t}){return VE(await GE({hash:e,signature:t}))}function qE(e,t="hex"){const n=xp(e),r=Fa(new Uint8Array(n.length));return n.encode(r),t==="hex"?xe(r.bytes):r.bytes}function xp(e){return Array.isArray(e)?ZE(e.map(t=>xp(t))):KE(e)}function ZE(e){const t=e.reduce((o,s)=>o+s.length,0),n=Ep(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 KE(e){const t=typeof e=="string"?wt(e):e,n=Ep(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 Ep(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 V("Length is too large.")}function YE(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ce(ur(["0x05",qE([t?X(t):"0x",o,n?X(n):"0x"])]));return r==="bytes"?wt(s):s}async function XE(e){const{authorization:t,signature:n}=e;return vp({hash:YE(t),signature:n??t})}class QE extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:d}){var h;const p=Ts({from:n==null?void 0:n.address,to:f,value:typeof d<"u"&&`${pp(d)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Et(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",p].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class mr extends V{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(mr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(mr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Cs extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(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 za extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(za,"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 V{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 Wa extends V{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(`
145
- `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Wa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Va extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Va,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ga extends V{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
146
- `),{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 qa extends V{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(qa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Za extends V{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(Za,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Ka extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Ka,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Is extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Et(r)} gwei`:""}).`].join(`
147
- `),{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 Ns extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Ya(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===mr.code):e;return r instanceof V?new mr({cause:e,message:r.details}):mr.nodeMessage.test(n)?new mr({cause:e,message:e.details}):Cs.nodeMessage.test(n)?new Cs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):za.nodeMessage.test(n)?new za({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ha.nodeMessage.test(n)?new Ha({cause:e,nonce:t==null?void 0:t.nonce}):Wa.nodeMessage.test(n)?new Wa({cause:e,nonce:t==null?void 0:t.nonce}):Va.nodeMessage.test(n)?new Va({cause:e,nonce:t==null?void 0:t.nonce}):Ga.nodeMessage.test(n)?new Ga({cause:e}):qa.nodeMessage.test(n)?new qa({cause:e,gas:t==null?void 0:t.gas}):Za.nodeMessage.test(n)?new Za({cause:e,gas:t==null?void 0:t.gas}):Ka.nodeMessage.test(n)?new Ka({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 Ns({cause:e})}function JE(e,{docsPath:t,...n}){const r=(()=>{const o=Ya(e,n);return o instanceof Ns?e:o})();return new QE(r,{docsPath:t,...n})}function Xa(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const c of i)c in e&&(n[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&r(s[c])}const o=t(e||{});return r(o),n}const e2={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function ks(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=t2(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>xe(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=X(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=X(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=X(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=X(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=X(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=X(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=e2[e.type]),typeof e.value<"u"&&(t.value=X(e.value)),t}function t2(e){return e.map(t=>({address:t.address,r:t.r?X(BigInt(t.r)):t.r,s:t.s?X(BigInt(t.s)):t.s,chainId:X(t.chainId),nonce:X(t.nonce),...typeof t.yParity<"u"?{yParity:X(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:X(t.v)}:{}}))}function Sp(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Id({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Id({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function n2(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=X(t)),n!==void 0&&(i.nonce=X(n)),r!==void 0&&(i.state=Sp(r)),o!==void 0){if(i.state)throw new ME;i.stateDiff=Sp(o)}return i}function Qa(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!it(n,{strict:!1}))throw new mn({address:n});if(t[n])throw new kE({address:n});t[n]=n2(r)}return t}const $p=2n**256n-1n;function xo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?xt(t):void 0;if(i&&!it(i.address))throw new mn({address:i.address});if(s&&!it(s))throw new mn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new BE;if(r&&r>$p)throw new Cs({maxFeePerGas:r});if(o&&r&&o>r)throw new Is({maxFeePerGas:r,maxPriorityFeePerGas:o})}class r2 extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ja extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class o2 extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Et(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Pp extends V{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 Ap={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Tp(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Zt(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?Zt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Ap[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&&(t.authorizationList=s2(e.authorizationList)),t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof t.v=="bigint"){if(t.v===0n||t.v===27n)return 0;if(t.v===1n||t.v===28n)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),t.type==="legacy"&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),t.type==="eip2930"&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t.type==="eip1559"&&delete t.maxFeePerBlobGas,t}function s2(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 Op(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Tp(n));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:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Rt(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var u,l,f;const s=o??!1,i=n!==void 0?X(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new Pp({blockHash:t,blockNumber:n});return(((f=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:f.format)||Op)(c)}async function ec(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function i2(e,t){return Cp(e,t)}async function Cp(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((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 c=="function"){const u=n||await J(e,Rt,"getBlock")({}),l=await c({block:u,client:e,request:o});if(l===null)throw new Error;return l}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Mt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):J(e,Rt,"getBlock")({}),J(e,ec,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new Ja;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function a2(e,t){return tc(e,t)}async function tc(e,t){var d,p;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 r2;const a=10**(((d=i.toString().split(".")[1])==null?void 0:d.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await J(e,Rt,"getBlock")({});if(typeof((p=r==null?void 0:r.fees)==null?void 0:p.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new Ja;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Cp(e,{block:l,chain:r,request:o}),m=u(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??u(await J(e,ec,"getGasPrice")({}))}}async function Ip(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?X(r):n]},{dedupe:!!r});return Zt(o)}function Np(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=>wt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>xe(s))}function kp(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=>wt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>wt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>xe(i))}function c2(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),c=Number(n&s),a=r?4:0,u=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+u,c,r)}function u2(e,t,n){return e&t^~e&n}function l2(e,t,n){return e&t^e&n^t&n}class f2 extends Oa{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=Ta(this.buffer)}update(t){ir(this),t=Ss(t),Xt(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=Ta(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ir(this),Rd(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,ar(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;c2(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Ta(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)c.setUint32(4*f,l[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:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const gn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),d2=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]),bn=new Uint32Array(64);class p2 extends f2{constructor(t=32){super(64,t,8,!1),this.A=gn[0]|0,this.B=gn[1]|0,this.C=gn[2]|0,this.D=gn[3]|0,this.E=gn[4]|0,this.F=gn[5]|0,this.G=gn[6]|0,this.H=gn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,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=c|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)bn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const d=bn[f-15],p=bn[f-2],h=Lt(d,7)^Lt(d,18)^d>>>3,m=Lt(p,17)^Lt(p,19)^p>>>10;bn[f]=m+bn[f-7]+h+bn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:u,H:l}=this;for(let f=0;f<64;f++){const d=Lt(c,6)^Lt(c,11)^Lt(c,25),p=l+d+u2(c,a,u)+d2[f]+bn[f]|0,m=(Lt(r,2)^Lt(r,13)^Lt(r,22))+l2(r,o,s)|0;l=u,u=a,a=c,c=i+p|0,i=s,s=o,o=r,r=p+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,o,s,i,c,a,u,l)}roundClean(){ar(bn)}destroy(){this.set(0,0,0,0,0,0,0,0),ar(this.buffer)}}const Mp=_d(()=>new p2),h2=Mp;function m2(e,t){return h2(bt(e,{strict:!1})?or(e):e)}function g2(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=m2(t);return o.set([n],0),r==="bytes"?o:xe(o)}function b2(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(g2({commitment:s,to:r,version:n}));return o}const Lp=6,Bp=32,nc=4096,Rp=Bp*nc,Fp=Rp*Lp-1-1*nc*Lp;class y2 extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class w2 extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function v2(e){const t=typeof e.data=="string"?wt(e.data):e.data,n=be(t);if(!n)throw new w2;if(n>Fp)throw new y2({maxSize:Fp,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Fa(new Uint8Array(Rp));let c=0;for(;c<nc;){const a=t.slice(s,s+(Bp-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}c++,s+=31}r.push(i)}return r.map(i=>xe(i.bytes))}function x2(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??v2({data:t}),s=e.commitments??Np({blobs:o,kzg:n,to:r}),i=e.proofs??kp({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function E2(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 RE({transaction:e})}async function Dp(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Zt(t)}const S2=["blobVersionedHashes","chainId","fees","gas","nonce","type"],jp=new Map;async function _p(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=S2,type:l}=t,f=n&&xt(n),d={...t,...f?{from:f==null?void 0:f.address}:{}};let p;async function h(){return p||(p=await J(e,Rt,"getBlock")({blockTag:"latest"}),p)}let m;async function w(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await J(e,Dp,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&f)if(a){const O=await w();d.nonce=await a.consume({address:f.address,chainId:O,client:e})}else d.nonce=await J(e,Ip,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const O=Np({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const b=b2({commitments:O,to:"hex"});d.blobVersionedHashes=b}if(u.includes("sidecars")){const b=kp({blobs:r,commitments:O,kzg:i}),A=x2({blobs:r,commitments:O,proofs:b,to:"hex"});d.sidecars=A}}if(u.includes("chainId")&&(d.chainId=await w()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{d.type=E2(d)}catch{let O=jp.get(e.uid);if(typeof O>"u"){const b=await h();O=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",jp.set(e.uid,O)}d.type=O?"eip1559":"legacy"}if(u.includes("fees"))if(d.type!=="legacy"&&d.type!=="eip2930"){if(typeof d.maxFeePerGas>"u"||typeof d.maxPriorityFeePerGas>"u"){const O=await h(),{maxFeePerGas:b,maxPriorityFeePerGas:A}=await tc(e,{block:O,chain:o,request:d});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<A)throw new o2({maxPriorityFeePerGas:A});d.maxPriorityFeePerGas=A,d.maxFeePerGas=b}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new Ja;if(typeof t.gasPrice>"u"){const O=await h(),{gasPrice:b}=await tc(e,{block:O,chain:o,request:d,type:"legacy"});d.gasPrice=b}}return u.includes("gas")&&typeof s>"u"&&(d.gas=await J(e,rc,"estimateGas")({...d,account:f&&{address:f.address,type:"json-rpc"}})),xo(d),delete d.parameters,d}async function Up(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?X(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function rc(e,t){var o,s,i;const{account:n=e.account}=t,r=n?xt(n):void 0;try{let S=function(T){const{block:C,request:y,rpcStateOverride:k}=T;return e.request({method:"eth_estimateGas",params:k?[y,C??e.experimental_blockTag??"latest",k]:C?[y,C]:[y]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:f,blockTag:d,data:p,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:O,maxPriorityFeePerGas:b,nonce:A,value:M,stateOverride:R,...D}=await _p(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?X(f):void 0)||d,v=Qa(R),P=await(async()=>{if(D.to)return D.to;if(a&&a.length>0)return await XE({authorization:a[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})();xo(t);const N=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,$=(N||ks)({...Xa(D,{format:N}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:p,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:O,maxPriorityFeePerGas:b,nonce:A,to:P,value:M});let x=BigInt(await S({block:g,request:$,rpcStateOverride:v}));if(a){const T=await Up(e,{address:$.from}),C=await Promise.all(a.map(async y=>{const{address:k}=y,F=await S({block:g,request:{authorizationList:void 0,data:p,from:r==null?void 0:r.address,to:k,value:X(T)},rpcStateOverride:v}).catch(()=>100000n);return 2n*BigInt(F)}));x+=C.reduce((y,k)=>y+k,0n)}return x}catch(c){throw JE(c,{...t,account:r,chain:e.chain})}}async function $2(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Bt({abi:n,args:o,functionName:s});try{return await J(e,rc,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?xt(c.account):void 0;throw hr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function Ms(e,t){if(!it(e,{strict:!1}))throw new mn({address:e});if(!it(t,{strict:!1}))throw new mn({address:t});return e.toLowerCase()===t.toLowerCase()}const zp="/docs/contract/decodeEventLog";function oc(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new gx({docsPath:zp});const a=t.find(m=>m.type==="event"&&i===$s(gt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new $d(i,{docsPath:zp});const{name:u,inputs:l}=a,f=l==null?void 0:l.some(m=>!("name"in m&&m.name)),d=f?[]:{},p=l.map((m,w)=>[m,w]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<p.length;m++){const[w,O]=p[m],b=c[m];if(!b)throw new ws({abiItem:a,param:w});d[f?O:w.name||O]=P2({param:w,value:b})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Xr(h,n);if(m)if(f)for(let w=0;w<l.length;w++)d[w]=d[w]??m.shift();else for(let w=0;w<h.length;w++)d[h[w].name]=m[w]}catch(m){if(s)throw m instanceof xd||m instanceof up?new Vr({abiItem:a,data:n,params:h,size:be(n)}):m}else if(s)throw new Vr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(d).length>0?d:void 0}}function P2({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Xr([e],t)||[])[0]}function sc(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]})();return r.map(i=>{var c;try{const a=t.find(l=>l.type==="event"&&i.topics[0]===$s(l));if(!a)return null;const u=oc({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!A2({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof $d)return null;if(a instanceof Vr||a instanceof ws){if(o)return null;u=a.abiItem.name,l=(c=a.abiItem.inputs)==null?void 0:c.some(f=>!("name"in f&&f.name))}return{...i,args:l?[]:{},eventName:u}}}).filter(Boolean)}function A2(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?Ms(i,c):s.type==="string"||s.type==="bytes"?Ce(or(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(u=>o(c,u,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 c=n.find(u=>u.name===s);return c?(Array.isArray(i)?i:[i]).some(u=>o(c,u,t[s])):!1}):!1}function tn(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,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}:{}}}async function ic(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const u=a??!1,l=i??(s?[s]:void 0);let f=[];l&&(f=[l.flatMap(m=>Yr({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let d;n?d=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):d=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?X(r):r,toBlock:typeof o=="bigint"?X(o):o}]});const p=d.map(h=>tn(h));return l?sc({abi:l,args:c,logs:p,strict:u}):p}async function Hp(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?kn({abi:n,name:i}):void 0,f=l?void 0:n.filter(d=>d.type==="event");return J(e,ic,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const ac="/docs/contract/decodeFunctionResult";function Fn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=kn({abi:t,args:n,name:r});if(!c)throw new nr(r,{docsPath:ac});s=c}if(s.type!=="function")throw new nr(void 0,{docsPath:ac});if(!s.outputs)throw new Ad(s.name,{docsPath:ac});const i=Xr(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 cc=BigInt(0),uc=BigInt(1);function Ls(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function Dn(e,t,n=""){const r=xs(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",a=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return e}function Bs(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Wp(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?cc:BigInt("0x"+e)}function Rs(e){return Wp(cr(e))}function Vp(e){return Xt(e),Wp(cr(Uint8Array.from(e).reverse()))}function lc(e,t){return Es(e.toString(16).padStart(t*2,"0"))}function Gp(e,t){return lc(e,t).reverse()}function Ue(e,t,n){let r;if(typeof t=="string")try{r=Es(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(xs(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const fc=e=>typeof e=="bigint"&&cc<=e;function T2(e,t,n){return fc(e)&&fc(t)&&fc(n)&&t<=e&&e<n}function O2(e,t,n,r){if(!T2(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function qp(e){let t;for(t=0;e>cc;e>>=uc,t+=1);return t}const Eo=e=>(uc<<BigInt(e))-uc;function C2(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");const r=p=>new Uint8Array(p),o=p=>Uint8Array.of(p);let s=r(e),i=r(e),c=0;const a=()=>{s.fill(1),i.fill(0),c=0},u=(...p)=>n(i,s,...p),l=(p=r(0))=>{i=u(o(0),p),s=u(),p.length!==0&&(i=u(o(1),p),s=u())},f=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const h=[];for(;p<t;){s=u();const m=s.slice();h.push(m),p+=s.length}return hn(...h)};return(p,h)=>{a(),l(p);let m;for(;!(m=h(f()));)l();return a(),m}}function dc(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,i){const c=e[o];if(i&&c===void 0)return;const a=typeof c;if(a!==s||c===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${a}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}function Zp(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 I2="0.1.1";function N2(){return I2}class he extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof he){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:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof he&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
148
- `);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,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${N2()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return Kp(this,t)}}function Kp(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Kp(e.cause,t):t?null:e}const k2="#__bigint";function M2(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+k2:o,n)}function L2(e,t){if(Qp(e)>t)throw new W2({givenSize:Qp(e),maxSize:t})}const nn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Yp(e){if(e>=nn.zero&&e<=nn.nine)return e-nn.zero;if(e>=nn.A&&e<=nn.F)return e-(nn.A-10);if(e>=nn.a&&e<=nn.f)return e-(nn.a-10)}function B2(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new V2({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 pc(e,t){if(at(e)>t)throw new Y2({givenSize:at(e),maxSize:t})}function R2(e,t){if(typeof t=="number"&&t>0&&t>at(e)-1)throw new oh({offset:t,position:"start",size:at(e)})}function F2(e,t,n){if(typeof t=="number"&&typeof n=="number"&&at(e)!==n-t)throw new oh({offset:n,position:"end",size:at(e)})}function Xp(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 X2({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const D2=new TextEncoder;function j2(e){return e instanceof Uint8Array?e:typeof e=="string"?U2(e):_2(e)}function _2(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function U2(e,t={}){const{size:n}=t;let r=e;n&&(pc(e,n),r=_n(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const u=Yp(o.charCodeAt(a++)),l=Yp(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new he(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=u*16+l}return i}function z2(e,t={}){const{size:n}=t,r=D2.encode(e);return typeof n=="number"?(L2(r,n),H2(r,n)):r}function H2(e,t){return B2(e,{dir:"right",size:t})}function Qp(e){return e.length}let W2=class extends he{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"})}},V2=class extends he{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 G2=new TextEncoder,q2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Z2(e,t={}){const{strict:n=!1}=t;if(!e)throw new nh(e);if(typeof e!="string")throw new nh(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new rh(e);if(!e.startsWith("0x"))throw new rh(e)}function Ft(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Jp(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(pc(n,t.size),jn(n,t.size)):n}function eh(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=q2[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(pc(r,t.size),_n(r,t.size)):r}function Le(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 u=typeof e=="bigint"?"n":"";throw new th({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${e}${u}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?jn(a,r):a}function hc(e,t={}){return eh(G2.encode(e),t)}function jn(e,t){return Xp(e,{dir:"left",size:t})}function _n(e,t){return Xp(e,{dir:"right",size:t})}function mc(e,t,n,r={}){const{strict:o}=r;R2(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&F2(s,t,n),s}function at(e){return Math.ceil((e.length-2)/2)}function K2(e,t={}){const{strict:n=!1}=t;try{return Z2(e,{strict:n}),!0}catch{return!1}}class th extends he{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 nh extends he{constructor(t){super(`Value \`${typeof t=="object"?M2(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 rh extends he{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 Y2 extends he{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 oh extends he{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 X2 extends he{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 Q2(e){return{address:e.address,amount:Le(e.amount),index:Le(e.index),validatorIndex:Le(e.validatorIndex)}}function sh(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Le(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Le(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Le(e.gasLimit)},...typeof e.number=="bigint"&&{number:Le(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Le(e.prevRandao)},...typeof e.time=="bigint"&&{time:Le(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Q2)}}}const gc=[{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"}],bc=[{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"}]}],ih=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],ah=[...ih,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],J2=[...ih,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],ch=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],uh=[{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"}]}],lh=[{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"}],gr=[{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"}]}],e6="0x82ad56cb",fh="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",t6="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",n6="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class yc extends V{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 dh extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const wc="/docs/contract/encodeDeployData";function vc(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 fx({docsPath:wc});if(!("inputs"in o))throw new vd({docsPath:wc});if(!o.inputs||o.inputs.length===0)throw new vd({docsPath:wc});const s=Jt(o.inputs,n);return ur([r,s])}function br({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 yc({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new yc({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function ph(e,{docsPath:t,...n}){const r=(()=>{const o=Ya(e,n);return o instanceof Ns?e:o})();return new bp(r,{docsPath:t,...n})}function hh(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const xc=new Map;function mh({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const f=l.map(({args:d})=>d);f.length!==0&&e(f).then(d=>{o&&Array.isArray(d)&&d.sort(o);for(let p=0;p<l.length;p++){const{resolve:h}=l[p];h==null||h([d[p],d])}}).catch(d=>{for(let p=0;p<l.length;p++){const{reject:h}=l[p];h==null||h(d)}})},i=()=>xc.delete(t),c=()=>a().map(({args:l})=>l),a=()=>xc.get(t)||[],u=l=>xc.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:d,reject:p}=hh();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:d,reject:p}),f):(u({args:l,resolve:d,reject:p}),setTimeout(s,r),f)}}}async function So(e,t){var $,S,x,T;const{account:n=e.account,authorizationList:r,batch:o=!!(($=e.batch)!=null&&$.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:u,code:l,data:f,factory:d,factoryData:p,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:O,maxPriorityFeePerGas:b,nonce:A,to:M,value:R,stateOverride:D,...j}=t,g=n?xt(n):void 0;if(l&&(d||p))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&M)throw new V("Cannot provide both `code` & `to` as parameters.");const v=l&&f,P=d&&p&&M&&f,N=v||P,I=v?s6({code:l,data:f}):P?i6({data:f,factory:d,factoryData:p,to:M}):f;try{xo(t);const y=(typeof s=="bigint"?X(s):void 0)||i,k=u?sh(u):void 0,F=Qa(D),_=(T=(x=(S=e.chain)==null?void 0:S.formatters)==null?void 0:x.transactionRequest)==null?void 0:T.format,H=(_||ks)({...Xa(j,{format:_}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:I,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:O,maxPriorityFeePerGas:b,nonce:A,to:N?void 0:M,value:R});if(o&&r6({request:H})&&!F&&!k)try{return await o6(e,{...H,blockNumber:s,blockTag:i})}catch(Z){if(!(Z instanceof dh)&&!(Z instanceof yc))throw Z}const K=(()=>{const Z=[H,y];return F&&k?[...Z,F,k]:F?[...Z,F]:k?[...Z,{},k]:Z})(),W=await e.request({method:"eth_call",params:K});return W==="0x"?{data:void 0}:{data:W}}catch(C){const y=a6(C),{offchainLookup:k,offchainLookupSignature:F}=await Promise.resolve().then(()=>l5);if(e.ccipRead!==!1&&(y==null?void 0:y.slice(0,10))===F&&M)return{data:await k(e,{data:y,to:M})};throw N&&(y==null?void 0:y.slice(0,10))==="0x101bb98d"?new UE({factory:d}):ph(C,{...t,account:g,chain:e.chain})}}function r6({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(e6)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function o6(e,t){var m;const{batchSize:n=1024,wait:r=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:i,multicallAddress:c,to:a}=t;let u=c;if(!u){if(!e.chain)throw new dh;u=br({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?X(o):void 0)||s,{schedule:d}=mh({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(w){return w.reduce((b,{data:A})=>b+(A.length-2),0)>n*2},fn:async w=>{const O=w.map(M=>({allowFailure:!0,callData:M.data,target:M.to})),b=Bt({abi:gc,args:[O],functionName:"aggregate3"}),A=await e.request({method:"eth_call",params:[{data:b,to:u},f]});return Fn({abi:gc,args:[O],functionName:"aggregate3",data:A||"0x"})}}),[{returnData:p,success:h}]=await d({data:i,to:a});if(!h)throw new Os({data:p});return p==="0x"?{data:void 0}:{data:p}}function s6(e){const{code:t,data:n}=e;return vc({abi:gd(["constructor(bytes, bytes)"]),bytecode:fh,args:[t,n]})}function i6(e){const{data:t,factory:n,factoryData:r,to:o}=e;return vc({abi:gd(["constructor(address, bytes, address, bytes)"]),bytecode:t6,args:[o,t,n,r]})}function a6(e){var n;if(!(e instanceof V))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 rn(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Bt({abi:n,args:o,functionName:s});try{const{data:a}=await J(e,So,"call")({...i,data:c,to:r});return Fn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw hr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function c6(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?xt(c.account):e.account,u=Bt({abi:n,args:o,functionName:i});try{const{data:l}=await J(e,So,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Fn({abi:n,args:o,functionName:i,data:l||"0x"}),d=n.filter(p=>"name"in p&&p.name===t.functionName);return{result:f,request:{abi:d,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(l){throw hr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const Ec=new Map,gh=new Map;let u6=0;function yn(e,t,n){const r=++u6,o=()=>Ec.get(e)||[],s=()=>{const l=o();Ec.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(d=>d.id===r))return;const f=gh.get(e);if(l.length===1&&f){const d=f();d instanceof Promise&&d.catch(()=>{})}s()},c=o();if(Ec.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...f)=>{var p,h;const d=o();if(d.length!==0)for(const m of d)(h=(p=m.fns)[l])==null||h.call(p,...f)};const u=n(a);return typeof u=="function"&&gh.set(e,u),i}async function Sc(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 c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await Sc(a);const u=async()=>{o&&(await e({unpoll:s}),await Sc(r),u())};u()})(),s}const l6=new Map,f6=new Map;function d6(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,l6),r=t(e,f6);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function p6(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=d6(t),o=r.response.get();if(o&&n>0&&new Date().getTime()-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 h6=e=>`blockNumber.${e}`;async function Po(e,{cacheTime:t=e.cacheTime}={}){const n=await p6(()=>e.request({method:"eth_blockNumber"}),{cacheKey:h6(e.uid),cacheTime:t});return BigInt(n)}async function Fs(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=>tn(s));return!("abi"in t)||!t.abi?o:sc({abi:t.abi,logs:o,strict:n})}async function Ds(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function m6(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:u,poll:l,pollingInterval:f=e.pollingInterval,strict:d}=t;return(typeof l<"u"?l:typeof c=="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=d??!1,O=Ee(["watchContractEvent",r,o,s,e.uid,i,f,w,c]);return yn(O,{onLogs:u,onError:a},b=>{let A;c!==void 0&&(A=c-1n);let M,R=!1;const D=$o(async()=>{var j;if(!R){try{M=await J(e,op,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:w,fromBlock:c})}catch{}R=!0;return}try{let g;if(M)g=await J(e,Fs,"getFilterChanges")({filter:M});else{const v=await J(e,Po,"getBlockNumber")({});A&&A<v?g=await J(e,Hp,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:A+1n,toBlock:v,strict:w}):g=[],A=v}if(g.length===0)return;if(s)b.onLogs(g);else for(const v of g)b.onLogs([v])}catch(g){M&&g instanceof Bn&&(R=!1),(j=b.onError)==null||j.call(b,g)}},{emitOnBegin:!0,interval:f});return async()=>{M&&await J(e,Ds,"uninstallFilter")({filter:M}),D()}})})():(()=>{const w=d??!1,O=Ee(["watchContractEvent",r,o,s,e.uid,i,f,w]);let b=!0,A=()=>b=!1;return yn(O,{onLogs:u,onError:a},M=>((async()=>{try{const R=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(v=>v.config.type==="webSocket"||v.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),D=i?Yr({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await R.subscribe({params:["logs",{address:r,topics:D}],onData(g){var P;if(!b)return;const v=g.result;try{const{eventName:N,args:I}=oc({abi:n,data:v.data,topics:v.topics,strict:d}),$=tn(v,{args:I,eventName:N});M.onLogs([$])}catch(N){let I,$;if(N instanceof Vr||N instanceof ws){if(d)return;I=N.abiItem.name,$=(P=N.abiItem.inputs)==null?void 0:P.some(x=>!("name"in x&&x.name))}const S=tn(v,{args:$?[]:{},eventName:I});M.onLogs([S])}},onError(g){var v;(v=M.onError)==null||v.call(M,g)}});A=j,b||A()}catch(R){a==null||a(R)}})(),()=>A()))})()}async function g6(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function $c(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:u})=>{const l=typeof t=="function"?t({count:c,error:u}):t;l&&await Sc(l),i({count:c+1})};try{const u=await e();o(u)}catch(u){if(c<n&&await r({count:c,error:u}))return a({error:u});s(u)}};i()})}const b6={"0x0":"reverted","0x1":"success"};function y6(e){const t={...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(n=>tn(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Zt(e.transactionIndex):null,status:e.status?b6[e.status]:null,type:e.type?Ap[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const Pc=256;let js=Pc,_s;function bh(e=11){if(!_s||js+e>Pc*2){_s="",js=0;for(let t=0;t<Pc;t++)_s+=(256+Math.random()*256|0).toString(16).substring(1)}return _s.substring(js,js+++e)}function w6(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(a/2),500),4e3),l=e.pollingInterval??u,f=e.cacheTime??l,d=e.account?xt(e.account):void 0,{config:p,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),w={...p,...m},O={account:d,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:w,type:i,uid:bh(),...c?{experimental_blockTag:c}:{}};function b(A){return M=>{const R=M(A);for(const j in O)delete R[j];const D={...A,...R};return Object.assign(D,{extend:b(D)})}}return Object.assign(O,{extend:b(O)})}const Us=new Ia(8192);function v6(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Us.get(n))return Us.get(n);const r=e().finally(()=>Us.delete(n));return Us.set(n,r),r}function x6(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:u}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(u))throw new Rn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Rn(new Error("method not supported"),{method:u});const l=o?Gr(`${a}.${Ee(n)}`):void 0;return v6(()=>$c(async()=>{try{return await e(n)}catch(d){const p=d;switch(p.code){case eo.code:throw new eo(p);case to.code:throw new to(p);case no.code:throw new no(p,{method:n.method});case ro.code:throw new ro(p);case Ln.code:throw new Ln(p);case Bn.code:throw new Bn(p);case oo.code:throw new oo(p);case so.code:throw new so(p);case io.code:throw new io(p);case Rn.code:throw new Rn(p,{method:n.method});case dr.code:throw new dr(p);case ao.code:throw new ao(p);case pr.code:throw new pr(p);case co.code:throw new co(p);case uo.code:throw new uo(p);case lo.code:throw new lo(p);case fo.code:throw new fo(p);case po.code:throw new po(p);case ho.code:throw new ho(p);case mo.code:throw new mo(p);case go.code:throw new go(p);case bo.code:throw new bo(p);case yo.code:throw new yo(p);case wo.code:throw new wo(p);case vo.code:throw new vo(p);case 5e3:throw new pr(p);default:throw d instanceof V?d:new HE(p)}}},{delay:({count:d,error:p})=>{var h;if(p&&p instanceof Mn){const m=(h=p==null?void 0:p.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m)*1e3}return~~(1<<d)*i},retryCount:c,shouldRetry:({error:d})=>E6(d)}),{enabled:o,id:l})}}function E6(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===dr.code||e.code===Ln.code:e instanceof Mn&&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}function S6({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=bh();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:x6(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class $6 extends V{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 P6(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const c=new AbortController;n>0&&(i=setTimeout(()=>{r&&c.abort()},n)),o(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&s(t),s(c)}finally{clearTimeout(i)}})()})}function A6(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const yh=A6();function T6(e,t={}){return{async request(n){var f;const{body:r,onRequest:o=t.onRequest,onResponse:s=t.onResponse,timeout:i=t.timeout??1e4}=n,c={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:a,method:u,signal:l}=c;try{const d=await P6(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Ee(r.map(A=>({jsonrpc:"2.0",id:A.id??yh.take(),...A}))):Ee({jsonrpc:"2.0",id:r.id??yh.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},w=new Request(e,m),O=await(o==null?void 0:o(w,m))??{...m,url:e};return await fetch(O.url??e,O)},{errorInstance:new yp({body:r,url:e}),timeout:i,signal:!0});s&&await s(d);let p;if((f=d.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))p=await d.json();else{p=await d.text();try{p=JSON.parse(p||"{}")}catch(h){if(d.ok)throw h;p={error:p}}}if(!d.ok)throw new Mn({body:r,details:Ee(p.error)||d.statusText,headers:d.headers,status:d.status,url:e});return p}catch(d){throw d instanceof Mn||d instanceof yp?d:new Mn({body:r,cause:d,url:e})}}}}function O6(e,t={}){const{batch:n,fetchOptions:r,key:o="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:a,retryDelay:u,raw:l}=t;return({chain:f,retryCount:d,timeout:p})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},w=t.retryCount??d,O=p??t.timeout??1e4,b=e||(f==null?void 0:f.rpcUrls.default.http[0]);if(!b)throw new $6;const A=T6(b,{fetchOptions:r,onRequest:c,onResponse:a,timeout:O});return S6({key:o,methods:s,name:i,async request({method:M,params:R}){const D={method:M,params:R},{schedule:j}=mh({id:b,wait:m,shouldSplitBatch(N){return N.length>h},fn:N=>A.request({body:N}),sort:(N,I)=>N.id-I.id}),g=async N=>n?j(N):[await A.request({body:N})],[{error:v,result:P}]=await g(D);if(l)return{error:v,result:P};if(v)throw new Ua({body:D,error:v,url:b});return P},retryCount:w,retryDelay:u,timeout:O,type:"http"},{fetchOptions:r,url:b})}}function Ac(e,t){var r,o,s,i,c,a;if(!(e instanceof V))return!1;const n=e.walk(u=>u instanceof _a);return n instanceof _a?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((o=n.data)==null?void 0:o.errorName)==="ResolverWildcardNotSupported"||((s=n.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=n.data)==null?void 0:i.errorName)==="ResolverError"||((c=n.data)==null?void 0:c.errorName)==="HttpError"||(a=n.reason)!=null&&a.includes("Wildcard on non-extended resolvers is not supported")||t==="reverse"&&n.reason===ip[50]):!1}function C6(e){const{abi:t,data:n}=e,r=lr(n,0,4),o=t.find(s=>s.type==="function"&&r===Kr(gt(s)));if(!o)throw new bx(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Xr(o.inputs,lr(n,4)):void 0}}const Tc="/docs/contract/encodeErrorResult";function wh(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=kn({abi:t,args:r,name:n});if(!a)throw new Ed(n,{docsPath:Tc});o=a}if(o.type!=="error")throw new Ed(void 0,{docsPath:Tc});const s=gt(o),i=Kr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new mx(o.name,{docsPath:Tc});c=Jt(o.inputs,r)}return ur([i,c])}const Oc="/docs/contract/encodeFunctionResult";function I6(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=kn({abi:t,name:n});if(!i)throw new nr(n,{docsPath:Oc});o=i}if(o.type!=="function")throw new nr(void 0,{docsPath:Oc});if(!o.outputs)throw new Ad(o.name,{docsPath:Oc});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Td(r)})();return Jt(o.outputs,s)}const zs="x-batch-gateway:true";async function vh(e){const{data:t,ccipRequest:n}=e,{args:[r]}=C6({abi:bc,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(zs)?await vh({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=N6(a)}})),I6({abi:bc,functionName:"query",result:[o,s]})}function N6(e){return e.name==="HttpRequestError"&&e.status?wh({abi:bc,errorName:"HttpError",args:[e.status,e.shortMessage]}):wh({abi:[ap],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function xh(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return bt(t)?t:null}function Hs(e){let t=new Uint8Array(32).fill(0);if(!e)return xe(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=xh(n[r]),s=o?or(o):Ce(In(n[r]),"bytes");t=Ce(vt([t,s]),"bytes")}return xe(t)}function k6(e){return`[${e.slice(2)}]`}function M6(e){const t=new Uint8Array(32).fill(0);return e?xh(e)||Ce(In(e)):xe(t)}function Ws(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(In(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=In(o[s]);i.byteLength>255&&(i=In(k6(M6(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 L6(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return br({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f=Bt({abi:uh,functionName:"addr",...o!=null?{args:[Hs(s),BigInt(o)]}:{args:[Hs(s)]}}),d={address:u,abi:ah,functionName:"resolve",args:[Kt(Ws(s)),f,i??[zs]],blockNumber:n,blockTag:r},h=await J(e,rn,"readContract")(d);if(h[0]==="0x")return null;const m=Fn({abi:uh,args:o!=null?[Hs(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||Cn(m)==="0x00"?null:m}catch(f){if(c)throw f;if(Ac(f,"resolve"))return null;throw f}}class B6 extends V{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 Ao extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Cc extends V{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 R6 extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const F6=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,D6=/^(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>\/.*)?$/,j6=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,_6=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function U6(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"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Eh(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Sh({uri:e,gatewayUrls:t}){const n=j6.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Eh(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Eh(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(F6),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||D6.test(e);if(e.startsWith("http")&&!l&&!f){let p=e;return t!=null&&t.arweave&&(p=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:p,isOnChain:!1,isEncoded:!1}}if((l||f)&&a)return{uri:`${r}/${l?"ipns":"ipfs"}/${a}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${u||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(_6,"");if(d.startsWith("<svg")&&(d=`data:image/svg+xml;base64,${btoa(d)}`),d.startsWith("data:")||d.startsWith("{"))return{uri:d,isOnChain:!0,isEncoded:!1};throw new Cc({uri:e})}function $h(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new B6({data:e});return e.image||e.image_url||e.image_data}async function z6({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Ic({gatewayUrls:e,uri:$h(n)})}catch{throw new Cc({uri:t})}}async function Ic({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Sh({uri:t,gatewayUrls:e});if(r||await U6(n))return n;throw new Cc({uri:t})}function H6(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(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new Ao({reason:"Only EIP-155 supported"});if(!i)throw new Ao({reason:"Chain ID not found"});if(!a)throw new Ao({reason:"Contract address not found"});if(!o)throw new Ao({reason:"Token ID not found"});if(!c)throw new Ao({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function W6(e,{nft:t}){if(t.namespace==="erc721")return rn(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 rn(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 R6({namespace:t.namespace})}async function V6(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?G6(e,{gatewayUrls:t,record:n}):Ic({uri:n,gatewayUrls:t})}async function G6(e,{gatewayUrls:t,record:n}){const r=H6(n),o=await W6(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Sh({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=c?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return Ic({uri:$h(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),z6({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Ph(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return br({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f={address:u,abi:ah,functionName:"resolve",args:[Kt(Ws(s)),Bt({abi:ch,functionName:"text",args:[Hs(s),o]}),i??[zs]],blockNumber:n,blockTag:r},p=await J(e,rn,"readContract")(f);if(p[0]==="0x")return null;const h=Fn({abi:ch,functionName:"text",data:p[0]});return h===""?null:h}catch(f){if(c)throw f;if(Ac(f,"resolve"))return null;throw f}}async function q6(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await J(e,Ph,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await V6(e,{record:a,gatewayUrls:r})}catch{return null}}async function Z6(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:s,universalResolverAddress:i}){let c=i;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=br({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:J2,functionName:"reverse",args:[Kt(Ws(a))],blockNumber:n,blockTag:r},l=J(e,rn,"readContract"),[f,d]=o?await l({...u,args:[...u.args,o]}):await l(u);return t.toLowerCase()!==d.toLowerCase()?null:f}catch(u){if(s)throw u;if(Ac(u,"reverse"))return null;throw u}}async function K6(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 br({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await J(e,rn,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Kt(Ws(o))],blockNumber:n,blockTag:r});return a}async function Ah(e,t){var w,O,b;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:d,value:p,...h}=t,m=n?xt(n):void 0;try{xo(t);const M=(typeof r=="bigint"?X(r):void 0)||o,R=(b=(O=(w=e.chain)==null?void 0:w.formatters)==null?void 0:O.transactionRequest)==null?void 0:b.format,j=(R||ks)({...Xa(h,{format:R}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:d,value:p}),g=await e.request({method:"eth_createAccessList",params:[j,M]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch(A){throw ph(A,{...t,account:m,chain:e.chain})}}async function Y6(e){const t=As(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Th(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=As(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(p=>Yr({abi:[p],eventName:p.name,args:n}))],r&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?X(s):s,toBlock:typeof c=="bigint"?X(c):c,...l.length?{topics:l}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:u(f),strict:!!i,toBlock:c,type:"event"}}async function Oh(e){const t=As(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function X6(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Q6(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?X(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}),Zt(s)}async function Ch(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?X(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class J6 extends V{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 e5(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await J(e,rn,"readContract")({abi:t5,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:u,salt:l},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new J6({address:n}):i}}const t5=[{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 n5(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 r5(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?X(n):void 0,i=await e.request({method:"eth_feeHistory",params:[X(t),s||r,o]},{dedupe:!!s});return n5(i)}async function o5(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>tn(s));return t.abi?sc({abi:t.abi,logs:o,strict:n}):o}class s5 extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${Jr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class i5 extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Jr(n)}`,`Response: ${Ee(t)}`],name:"OffchainLookupResponseMalformedError"})}}class a5 extends V{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 c5="0x556f1830",Ih={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 u5(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=fp({data:r,abi:[Ih]}),[i,c,a,u,l]=s,{ccipRead:f}=e,d=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Nh;try{if(!Ms(o,i))throw new a5({sender:i,to:o});const p=c.includes(zs)?await vh({data:a,ccipRequest:d}):await d({data:a,sender:i,urls:c}),{data:h}=await So(e,{blockNumber:t,blockTag:n,data:vt([u,Jt([{type:"bytes"},{type:"bytes"}],[p,l])]),to:o});return h}catch(p){throw new s5({callbackSelector:u,cause:p,data:r,extraData:l,sender:i,urls:c})}}async function Nh({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],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,u=c==="POST"?{"Content-Type":"application/json"}:{};try{const l=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:u,method:c});let f;if((o=l.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await l.json()).data:f=await l.text(),!l.ok){r=new Mn({body:a,details:f!=null&&f.error?Ee(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!bt(f)){r=new i5({result:f,url:i});continue}return f}catch(l){r=new Mn({body:a,details:l.message,url:i})}}throw r}const l5=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Nh,offchainLookup:u5,offchainLookupAbiItem:Ih,offchainLookupSignature:c5},Symbol.toStringTag,{value:"Module"}));function f5(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class d5 extends V{constructor({domain:t}){super(`Invalid domain "${Ee(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class p5 extends V{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 h5 extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function m5(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:v5({domain:t}),...e.types};w5({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(g5({domain:t,types:o})),r!=="EIP712Domain"&&s.push(kh({data:n,primaryType:r,types:o})),Ce(vt(s))}function g5({domain:e,types:t}){return kh({data:e,primaryType:"EIP712Domain",types:t})}function kh({data:e,primaryType:t,types:n}){const r=Mh({data:e,primaryType:t,types:n});return Ce(r)}function Mh({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[b5({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Bh({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Jt(r,o)}function b5({primaryType:e,types:t}){const n=Kt(y5({primaryType:e,types:t}));return Ce(n)}function y5({primaryType:e,types:t}){let n="";const r=Lh({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:c})=>`${c} ${i}`).join(",")})`;return n}function Lh({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])Lh({primaryType:s.type,types:t},n);return n}function Bh({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ce(Mh({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Ce(r)];if(n==="string")return[{type:"bytes32"},Ce(Kt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Bh({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ce(Jt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function w5(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:u,type:l}=a,f=c[u],d=l.match(ep);if(d&&(typeof f=="number"||typeof f=="bigint")){const[m,w,O]=d;X(f,{signed:w==="int",size:Number.parseInt(O)/8})}if(l==="address"&&typeof f=="string"&&!it(f))throw new mn({address:f});const p=l.match(aE);if(p){const[m,w]=p;if(w&&be(f)!==Number.parseInt(w))throw new wx({expectedSize:Number.parseInt(w),givenSize:be(f)})}const h=o[l];h&&(x5(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new d5({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new p5({primaryType:r,types:o})}function v5({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 x5(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new h5({type:e})}const E5=`Ethereum Signed Message:
149
- `;function S5(e){const t=typeof e=="string"?Gr(e):typeof e.raw=="string"?e.raw:xe(e.raw),n=Gr(`${E5}${be(t)}`);return vt([n,t])}function Rh(e,t){return Ce(S5(e),t)}const Fh="0x6492649264926492649264926492649264926492649264926492649264926492";function $5(e){return Jd(e,-32)===Fh}function P5(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=ur([Jt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),Fh]);return o==="hex"?s:wt(s)}class A5 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function T5(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new A5({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,c]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${c}`);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 O5(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function C5(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Zt(e.nonce):void 0,storageProof:e.storageProof?O5(e.storageProof):void 0}}async function I5(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?X(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return C5(c)}async function N5(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?X(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Nc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,f,d;const i=r||"latest",c=n!==void 0?X(n):void 0;let a=null;if(o?a=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?a=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,X(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,X(s)]},{dedupe:!!c}),!a)throw new mp({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((d=(f=(l=e.chain)==null?void 0:l.formatters)==null?void 0:f.transaction)==null?void 0:d.format)||Tp)(a)}async function k5(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([J(e,Po,"getBlockNumber")({}),t?J(e,Nc,"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 Vs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new gp({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||y6)(n)}async function M5(e,t){var O;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof((O=e.batch)==null?void 0:O.multicall)=="object"&&e.batch.multicall.batchSize||1024);let f=c;if(!f){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");f=br({blockNumber:s,chain:e.chain,contract:"multicall3"})}const d=[[]];let p=0,h=0;for(let b=0;b<u.length;b++){const{abi:A,address:M,args:R,functionName:D}=u[b];try{const j=Bt({abi:A,args:R,functionName:D});h+=(j.length-2)/2,l>0&&h>l&&d[p].length>0&&(p++,h=(j.length-2)/2,d[p]=[]),d[p]=[...d[p],{allowFailure:!0,callData:j,target:M}]}catch(j){const g=hr(j,{abi:A,address:M,args:R,docsPath:"/docs/contract/multicall",functionName:D,sender:n});if(!r)throw g;d[p]=[...d[p],{allowFailure:!0,callData:"0x",target:M}]}}const m=await Promise.allSettled(d.map(b=>J(e,rn,"readContract")({abi:gc,account:n,address:f,args:[b],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),w=[];for(let b=0;b<m.length;b++){const A=m[b];if(A.status==="rejected"){if(!r)throw A.reason;for(let R=0;R<d[b].length;R++)w.push({status:"failure",error:A.reason,result:void 0});continue}const M=A.value;for(let R=0;R<M.length;R++){const{returnData:D,success:j}=M[R],{callData:g}=d[b][R],{abi:v,address:P,functionName:N,args:I}=u[w.length];try{if(g==="0x")throw new Wr;if(!j)throw new Os({data:D});const $=Fn({abi:v,args:I,data:D,functionName:N});w.push(r?{result:$,status:"success"}:$)}catch($){const S=hr($,{abi:v,address:P,args:I,docsPath:"/docs/contract/multicall",functionName:N});if(!r)throw S;w.push({error:S,result:void 0,status:"failure"})}}}if(w.length!==u.length)throw new V("multicall results mismatch");return w}async function kc(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const d of o){const p=d.blockOverrides?sh(d.blockOverrides):void 0,h=d.calls.map(w=>{const O=w,b=O.account?xt(O.account):void 0,A=O.abi?Bt(O):O.data,M={...O,data:O.dataSuffix?vt([A||"0x",O.dataSuffix]):A,from:O.from??(b==null?void 0:b.address)};return xo(M),ks(M)}),m=d.stateOverrides?Qa(d.stateOverrides):void 0;a.push({blockOverrides:p,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?X(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((d,p)=>({...Op(d),calls:d.calls.map((h,m)=>{var P,N;const{abi:w,args:O,functionName:b,to:A}=o[p].calls[m],M=((P=h.error)==null?void 0:P.data)??h.returnData,R=BigInt(h.gasUsed),D=(N=h.logs)==null?void 0:N.map(I=>tn(I)),j=h.status==="0x1"?"success":"failure",g=w&&j==="success"&&M!=="0x"?Fn({abi:w,data:M,functionName:b}):null,v=(()=>{var $;if(j==="success")return;let I;if((($=h.error)==null?void 0:$.data)==="0x"?I=new Wr:h.error&&(I=new Os(h.error)),!!I)return hr(I,{abi:w??[],address:A??"0x",args:O,functionName:b??"<unknown>"})})();return{data:M,gasUsed:R,logs:D,status:j,...j==="success"?{result:g}:{error:v}}})}))}catch(a){const u=a,l=Ya(u,{});throw l instanceof Ns?u:l}}function Dh(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Zd(j2(e));return n==="Bytes"?r:eh(r)}class L5 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 Mc={checksum:new L5(8192)}.checksum,B5=/^0x[a-fA-F0-9]{40}$/;function Gs(e,t={}){const{strict:n=!0}=t;if(!B5.test(e))throw new jh({address:e,cause:new F5});if(n){if(e.toLowerCase()===e)return;if(R5(e)!==e)throw new jh({address:e,cause:new D5})}}function R5(e){if(Mc.has(e))return Mc.get(e);Gs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Dh(z2(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 Mc.set(e,o),o}function Lc(e,t={}){const{strict:n=!0}=t??{};try{return Gs(e,{strict:n}),!0}catch{return!1}}class jh extends he{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 F5 extends he{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 D5 extends he{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function Bc(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new he("Unable to normalize signature.");return o}function Rc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Lc(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)=>Rc(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=>Rc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function _h(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 _h(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")?Lc(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Lc(n[r],{strict:!1}):!1)return i}}function Uh(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?bd(e):e;return{...r,...n?{hash:yr(r)}:{}}}function j5(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=K2(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?zh(u)===mc(t,0,4):u.type==="event"?yr(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new Fc({name:t});if(i.length===1)return{...i[0],...o?{hash:yr(i[0])}:{}};let c;for(const u of i){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:yr(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,d)=>{const p="inputs"in u&&u.inputs[d];return p?Rc(f,p):!1})){if(c&&"inputs"in c&&c.inputs){const f=_h(u.inputs,c.inputs,r);if(f)throw new U5({abiItem:u,type:f[0]},{abiItem:c,type:f[1]})}c=u}}const a=(()=>{if(c)return c;const[u,...l]=i;return{...u,overloads:l}})();if(!a)throw new Fc({name:t});return{...a,...o?{hash:yr(a)}:{}}}function zh(e){return mc(yr(e),0,4)}function _5(e){const t=typeof e=="string"?e:bs(e);return Bc(t)}function yr(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:Dh(hc(_5(e)))}class U5 extends he{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Bc(bs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Bc(bs(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 Fc extends he{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"})}}const z5=/^(.*)\[([0-9]*)\]$/,H5=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Hh=/^(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 W5({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Dc({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Dc({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Q5(r.type);if(o){const[s,i]=o;return G5(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return X5(n,{checksumAddress:e,parameter:r});if(r.type==="address")return V5(n,{checksum:e});if(r.type==="bool")return Z5(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Hh.exec(r.type)??[];return K5(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return q5(n,{type:r.type});if(r.type==="string")return Y5(n);throw new qh(r.type)}function jc(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=at(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Le(t+o,{size:32})),r.push(c),o+=at(c)):n.push(c)}return Ft(...n,...r)}function V5(e,t){const{checksum:n=!1}=t;return Gs(e,{strict:n}),{dynamic:!1,encoded:jn(e.toLowerCase())}}function G5(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new eS(e);if(!s&&e.length!==r)throw new J5({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=Dc({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=jc(c);if(s){const u=Le(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Ft(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Ft(...c.map(({encoded:a})=>a))}}function q5(e,{type:t}){const[,n]=t.split("bytes"),r=at(e);if(!n){let o=e;return r%32!==0&&(o=_n(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Ft(jn(Le(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new Vh({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:_n(e)}}function Z5(e){if(typeof e!="boolean")throw new he(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:jn(Jp(e))}}function K5(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 th({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Le(e,{size:32,signed:t})}}function Y5(e){const t=hc(e),n=Math.ceil(at(t)/32),r=[];for(let o=0;o<n;o++)r.push(_n(mc(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Ft(_n(Le(at(t),{size:32})),...r)}}function X5(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,u=Dc({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?jc(s):Ft(...s.map(({encoded:i})=>i))}}function Q5(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Wh(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Gh({expectedLength:e.length,givenLength:t.length});const o=W5({checksumAddress:r,parameters:e,values:t}),s=jc(o);return s.length===0?"0x":s}function _c(e,t){if(e.length!==t.length)throw new Gh({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(_c.encode(o,s))}return Ft(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Gs(a),jn(a.toLowerCase(),o?32:0)}if(n==="string")return hc(r);if(n==="bytes")return r;if(n==="bool")return jn(Jp(r),o?32:1);const s=n.match(Hh);if(s){const[a,u,l="256"]=s,f=Number.parseInt(l)/8;return Le(r,{size:o?32:f,signed:u==="int"})}const i=n.match(H5);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new Vh({expectedSize:Number.parseInt(u),value:r});return _n(r,o?32:0)}const c=n.match(z5);if(c&&Array.isArray(r)){const[a,u]=c,l=[];for(let f=0;f<r.length;f++)l.push(t(u,r[f],!0));return l.length===0?"0x":Ft(...l)}throw new qh(n)}e.encode=t})(_c||(_c={}));class J5 extends he{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 Vh extends he{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${at(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Gh extends he{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
150
- `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class eS extends he{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class qh extends he{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function tS(e,t){var o;const{bytecode:n,args:r}=t;return Ft(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?Wh(e.inputs,r):"0x")}function nS(e){return Uh(e)}function rS(e,...t){const{overloads:n}=e,r=n?oS([e,...n],e.name,{args:t[0]}):e,o=sS(r),s=t.length>0?Wh(r.inputs,t[0]):void 0;return s?Ft(o,s):o}function wr(e,t={}){return Uh(e,t)}function oS(e,t,n){const r=j5(e,t,n);if(r.type!=="function")throw new Fc({name:t,type:"function"});return r}function sS(e){return zh(e)}const iS="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Dt="0x0000000000000000000000000000000000000000",aS="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function cS(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?xt(t.account):void 0;if(i&&!u)throw new V("`account` is required when `traceAssetChanges` is true");const l=u?tS(nS("constructor(bytes, bytes)"),{bytecode:fh,args:[aS,rS(wr("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async y=>{if(!y.data&&!y.abi)return;const{accessList:k}=await Ah(e,{account:u.address,...y,data:y.abi?Bt(y):y.data});return k.map(({address:F,storageKeys:_})=>_.length>0?F:null)})).then(y=>y.flat().filter(Boolean)):[],d=await kc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((y,k)=>({abi:[wr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:Dt,nonce:k})),stateOverrides:[{address:Dt,nonce:0}]}]:[],{calls:[...o,{}].map(y=>({...y,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((y,k)=>({abi:[wr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:Dt,nonce:k})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((y,k)=>({to:y,abi:[wr("function decimals() returns (uint256)")],functionName:"decimals",from:Dt,nonce:k})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((y,k)=>({to:y,abi:[wr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Dt,nonce:k})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((y,k)=>({to:y,abi:[wr("function symbol() returns (string)")],functionName:"symbol",from:Dt,nonce:k})),stateOverrides:[{address:Dt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),p=i?d[2]:d[0],[h,m,,w,O,b,A,M]=i?d:[],{calls:R,...D}=p,j=R.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],v=(m==null?void 0:m.calls)??[],P=[...g,...v].map(y=>y.status==="success"?Mt(y.data):null),N=(w==null?void 0:w.calls)??[],I=(O==null?void 0:O.calls)??[],$=[...N,...I].map(y=>y.status==="success"?Mt(y.data):null),S=((b==null?void 0:b.calls)??[]).map(y=>y.status==="success"?y.result:null),x=((M==null?void 0:M.calls)??[]).map(y=>y.status==="success"?y.result:null),T=((A==null?void 0:A.calls)??[]).map(y=>y.status==="success"?y.result:null),C=[];for(const[y,k]of $.entries()){const F=P[y];if(typeof k!="bigint"||typeof F!="bigint")continue;const _=S[y-1],z=x[y-1],H=T[y-1],K=y===0?{address:iS,decimals:18,symbol:"ETH"}:{address:f[y-1],decimals:H||_?Number(_??1):void 0,symbol:z??void 0};C.some(W=>W.token.address===K.address)||C.push({token:K,value:{pre:F,post:k,diff:k-F}})}return{assetChanges:C,block:D,results:j}}class Zh extends Oa{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Bd(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),ar(s)}update(t){return ir(this),this.iHash.update(t),this}digestInto(t){ir(this),Xt(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:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,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 Kh=(e,t,n)=>new Zh(e,t).update(n).digest();Kh.create=(e,t)=>new Zh(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ze=BigInt(0),Be=BigInt(1),Un=BigInt(2),Yh=BigInt(3),Xh=BigInt(4),Qh=BigInt(5),uS=BigInt(7),Jh=BigInt(8),lS=BigInt(9),e0=BigInt(16);function St(e,t){const n=e%t;return n>=ze?n:t+n}function ct(e,t,n){let r=e;for(;t-- >ze;)r*=r,r%=n;return r}function t0(e,t){if(e===ze)throw new Error("invert: expected non-zero number");if(t<=ze)throw new Error("invert: expected positive modulus, got "+t);let n=St(e,t),r=t,o=ze,s=Be;for(;n!==ze;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Be)throw new Error("invert: does not exist");return St(o,t)}function Uc(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function n0(e,t){const n=(e.ORDER+Be)/Xh,r=e.pow(t,n);return Uc(e,r,t),r}function fS(e,t){const n=(e.ORDER-Qh)/Jh,r=e.mul(t,Un),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Un),o),c=e.mul(s,e.sub(i,e.ONE));return Uc(e,c,t),c}function dS(e){const t=To(e),n=r0(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+uS)/e0;return(c,a)=>{let u=c.pow(a,i),l=c.mul(u,r);const f=c.mul(u,o),d=c.mul(u,s),p=c.eql(c.sqr(l),a),h=c.eql(c.sqr(f),a);u=c.cmov(u,l,p),l=c.cmov(d,f,h);const m=c.eql(c.sqr(l),a),w=c.cmov(u,l,m);return Uc(c,w,a),w}}function r0(e){if(e<Yh)throw new Error("sqrt is not defined for small field");let t=e-Be,n=0;for(;t%Un===ze;)t/=Un,n++;let r=Un;const o=To(e);for(;s0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return n0;let s=o.pow(r,t);const i=(t+Be)/Un;return function(a,u){if(a.is0(u))return u;if(s0(a,u)!==1)throw new Error("Cannot find square root");let l=n,f=a.mul(a.ONE,s),d=a.pow(u,t),p=a.pow(u,i);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let h=1,m=a.sqr(d);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===l)throw new Error("Cannot find square root");const w=Be<<BigInt(l-h-1),O=a.pow(f,w);l=h,f=a.sqr(O),d=a.mul(d,f),p=a.mul(p,O)}return p}}function pS(e){return e%Xh===Yh?n0:e%Jh===Qh?fS:e%e0===lS?dS(e):r0(e)}const hS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function mS(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=hS.reduce((r,o)=>(r[o]="function",r),t);return dc(e,n),e}function gS(e,t,n){if(n<ze)throw new Error("invalid exponent, negatives unsupported");if(n===ze)return e.ONE;if(n===Be)return t;let r=e.ONE,o=t;for(;n>ze;)n&Be&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Be;return r}function o0(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,a)=>e.is0(c)?i:(r[a]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,a)=>e.is0(c)?i:(r[a]=e.mul(i,r[a]),e.mul(i,c)),s),r}function s0(e,t){const n=(e.ORDER-Be)/Un,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 i0(e,t){t!==void 0&&qr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function To(e,t,n=!1,r={}){if(e<=ze)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,i=!1,c;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const d=t;d.BITS&&(o=d.BITS),d.sqrt&&(s=d.sqrt),typeof d.isLE=="boolean"&&(n=d.isLE),typeof d.modFromBytes=="boolean"&&(i=d.modFromBytes),c=d.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:u}=i0(e,o);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const f=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:u,MASK:Eo(a),ZERO:ze,ONE:Be,allowedLengths:c,create:d=>St(d,e),isValid:d=>{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return ze<=d&&d<e},is0:d=>d===ze,isValidNot0:d=>!f.is0(d)&&f.isValid(d),isOdd:d=>(d&Be)===Be,neg:d=>St(-d,e),eql:(d,p)=>d===p,sqr:d=>St(d*d,e),add:(d,p)=>St(d+p,e),sub:(d,p)=>St(d-p,e),mul:(d,p)=>St(d*p,e),pow:(d,p)=>gS(f,d,p),div:(d,p)=>St(d*t0(p,e),e),sqrN:d=>d*d,addN:(d,p)=>d+p,subN:(d,p)=>d-p,mulN:(d,p)=>d*p,inv:d=>t0(d,e),sqrt:s||(d=>(l||(l=pS(e)),l(f,d))),toBytes:d=>n?Gp(d,u):lc(d,u),fromBytes:(d,p=!0)=>{if(c){if(!c.includes(d.length)||d.length>u)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+d.length);const m=new Uint8Array(u);m.set(d,n?0:m.length-d.length),d=m}if(d.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+d.length);let h=n?Vp(d):Rs(d);if(i&&(h=St(h,e)),!p&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:d=>o0(f,d),cmov:(d,p,h)=>h?p:d});return Object.freeze(f)}function a0(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=a0(e);return t+Math.ceil(t/2)}function bS(e,t,n=!1){const r=e.length,o=a0(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?Vp(e):Rs(e),c=St(i,t-Be)+Be;return n?Gp(c,o):lc(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vr=BigInt(0),zn=BigInt(1);function qs(e,t){const n=t.negate();return e?n:t}function zc(e,t){const n=o0(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function u0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Hc(e,t){u0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Eo(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function l0(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=zn);const u=t*r,l=u+Math.abs(c)-1,f=c===0,d=c<0,p=t%2!==0;return{nextN:a,offset:l,isZero:f,isNeg:d,isNegF:p,offsetF:u}}function yS(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 wS(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 Wc=new WeakMap,f0=new WeakMap;function Vc(e){return f0.get(e)||1}function d0(e){if(e!==vr)throw new Error("invalid wNAF")}class vS{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>vr;)n&zn&&(r=r.add(o)),o=o.double(),n>>=zn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Hc(n,this.bits),s=[];let i=t,c=i;for(let a=0;a<r;a++){c=i,s.push(c);for(let u=1;u<o;u++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE;const i=Hc(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:f,isNegF:d,offsetF:p}=l0(r,c,i);r=a,l?s=s.add(qs(d,n[p])):o=o.add(qs(f,n[u]))}return d0(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Hc(t,this.bits);for(let i=0;i<s.windows&&r!==vr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=l0(r,i,s);if(r=c,!u){const f=n[a];o=o.add(l?f.negate():f)}}return d0(r),o}getPrecomputes(t,n,r){let o=Wc.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Wc.set(n,o))),o}cached(t,n,r){const o=Vc(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Vc(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){u0(n,this.bits),f0.set(t,n),Wc.delete(t)}hasCache(t){return Vc(t)!==1}}function xS(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>vr||r>vr;)n&zn&&(s=s.add(o)),r&zn&&(i=i.add(o)),o=o.double(),n>>=zn,r>>=zn;return{p1:s,p2:i}}function ES(e,t,n,r){yS(n,e),wS(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,c=qp(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=Eo(a),l=new Array(Number(u)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let d=i;for(let p=f;p>=0;p-=a){l.fill(i);for(let m=0;m<s;m++){const w=r[m],O=Number(w>>BigInt(p)&u);l[O]=l[O].add(n[m])}let h=i;for(let m=l.length-1,w=i;m>0;m--)w=w.add(l[m]),h=h.add(w);if(d=d.add(h),p!==0)for(let m=0;m<a;m++)d=d.double()}return d}function p0(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return mS(t),t}else return To(e,{isLE:n})}function SS(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const a of["p","n","h"]){const u=t[a];if(!(typeof u=="bigint"&&u>vr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=p0(t.p,n.Fp,r),s=p0(t.n,n.Fn,r),c=["Gx","Gy","a","b"];for(const a of c)if(!o.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const h0=(e,t)=>(e+(e>=0?t:-t)/m0)/t;function $S(e,t,n){const[[r,o],[s,i]]=t,c=h0(i*e,n),a=h0(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const f=u<sn,d=l<sn;f&&(u=-u),d&&(l=-l);const p=Eo(Math.ceil(qp(n)/2))+xr;if(u<sn||u>=p||l<sn||l>=p)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:d,k2:l}}function Gc(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function qc(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Ls(n.lowS,"lowS"),Ls(n.prehash,"prehash"),n.format!==void 0&&Gc(n.format),n}class PS extends Error{constructor(t=""){super(t)}}const on={Err:PS,_tlv:{encode:(e,t)=>{const{Err:n}=on;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=Bs(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Bs(o.length/2|128):"";return Bs(e)+s+o+t},decode(e,t){const{Err:n}=on;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 u=t.subarray(r,r+a);if(u.length!==a)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const l of u)i=i<<8|l;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=on;if(e<sn)throw new t("integer: negative integers are not allowed");let n=Bs(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}=on;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 Rs(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=on,o=Ue("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:u,l}=r.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=on,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},sn=BigInt(0),xr=BigInt(1),m0=BigInt(2),Zs=BigInt(3),AS=BigInt(4);function Er(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=Ue("private key",t);try{r=e.fromBytes(o)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function TS(e,t={}){const n=SS("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;dc(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:a}=t;if(a&&(!r.is0(s.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=b0(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(I,$,S){const{x,y:T}=$.toAffine(),C=r.toBytes(x);if(Ls(S,"isCompressed"),S){l();const y=!r.isOdd(T);return hn(g0(y),C)}else return hn(Uint8Array.of(4),C,r.toBytes(T))}function d(I){Dn(I,void 0,"Point");const{publicKey:$,publicKeyUncompressed:S}=u,x=I.length,T=I[0],C=I.subarray(1);if(x===$&&(T===2||T===3)){const y=r.fromBytes(C);if(!r.isValid(y))throw new Error("bad point: is not on curve, wrong x");const k=m(y);let F;try{F=r.sqrt(k)}catch(H){const K=H instanceof Error?": "+H.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}l();const _=r.isOdd(F);return(T&1)===1!==_&&(F=r.neg(F)),{x:y,y:F}}else if(x===S&&T===4){const y=r.BYTES,k=r.fromBytes(C.subarray(0,y)),F=r.fromBytes(C.subarray(y,y*2));if(!w(k,F))throw new Error("bad point: is not on curve");return{x:k,y:F}}else throw new Error(`bad point: got length ${x}, expected compressed=${$} or uncompressed=${S}`)}const p=t.toBytes||f,h=t.fromBytes||d;function m(I){const $=r.sqr(I),S=r.mul($,I);return r.add(r.add(S,r.mul(I,s.a)),s.b)}function w(I,$){const S=r.sqr($),x=m(I);return r.eql(S,x)}if(!w(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const O=r.mul(r.pow(s.a,Zs),AS),b=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(O,b)))throw new Error("bad curve params: a or b");function A(I,$,S=!1){if(!r.isValid($)||S&&r.is0($))throw new Error(`bad point coordinate ${I}`);return $}function M(I){if(!(I instanceof v))throw new Error("ProjectivePoint expected")}function R(I){if(!a||!a.basises)throw new Error("no endo");return $S(I,a.basises,o.ORDER)}const D=Zp((I,$)=>{const{X:S,Y:x,Z:T}=I;if(r.eql(T,r.ONE))return{x:S,y:x};const C=I.is0();$==null&&($=C?r.ONE:r.inv(T));const y=r.mul(S,$),k=r.mul(x,$),F=r.mul(T,$);if(C)return{x:r.ZERO,y:r.ZERO};if(!r.eql(F,r.ONE))throw new Error("invZ was invalid");return{x:y,y:k}}),j=Zp(I=>{if(I.is0()){if(t.allowInfinityPoint&&!r.is0(I.Y))return;throw new Error("bad point: ZERO")}const{x:$,y:S}=I.toAffine();if(!r.isValid($)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!w($,S))throw new Error("bad point: equation left != right");if(!I.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function g(I,$,S,x,T){return S=new v(r.mul(S.X,I),S.Y,S.Z),$=qs(x,$),S=qs(T,S),$.add(S)}class v{constructor($,S,x){this.X=A("x",$),this.Y=A("y",S,!0),this.Z=A("z",x),Object.freeze(this)}static CURVE(){return s}static fromAffine($){const{x:S,y:x}=$||{};if(!$||!r.isValid(S)||!r.isValid(x))throw new Error("invalid affine point");if($ instanceof v)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(x)?v.ZERO:new v(S,x,r.ONE)}static fromBytes($){const S=v.fromAffine(h(Dn($,void 0,"point")));return S.assertValidity(),S}static fromHex($){return v.fromBytes(Ue("pointHex",$))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute($=8,S=!0){return N.createCache(this,$),S||this.multiply(Zs),this}assertValidity(){j(this)}hasEvenY(){const{y:$}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd($)}equals($){M($);const{X:S,Y:x,Z:T}=this,{X:C,Y:y,Z:k}=$,F=r.eql(r.mul(S,k),r.mul(C,T)),_=r.eql(r.mul(x,k),r.mul(y,T));return F&&_}negate(){return new v(this.X,r.neg(this.Y),this.Z)}double(){const{a:$,b:S}=s,x=r.mul(S,Zs),{X:T,Y:C,Z:y}=this;let k=r.ZERO,F=r.ZERO,_=r.ZERO,z=r.mul(T,T),H=r.mul(C,C),K=r.mul(y,y),W=r.mul(T,C);return W=r.add(W,W),_=r.mul(T,y),_=r.add(_,_),k=r.mul($,_),F=r.mul(x,K),F=r.add(k,F),k=r.sub(H,F),F=r.add(H,F),F=r.mul(k,F),k=r.mul(W,k),_=r.mul(x,_),K=r.mul($,K),W=r.sub(z,K),W=r.mul($,W),W=r.add(W,_),_=r.add(z,z),z=r.add(_,z),z=r.add(z,K),z=r.mul(z,W),F=r.add(F,z),K=r.mul(C,y),K=r.add(K,K),z=r.mul(K,W),k=r.sub(k,z),_=r.mul(K,H),_=r.add(_,_),_=r.add(_,_),new v(k,F,_)}add($){M($);const{X:S,Y:x,Z:T}=this,{X:C,Y:y,Z:k}=$;let F=r.ZERO,_=r.ZERO,z=r.ZERO;const H=s.a,K=r.mul(s.b,Zs);let W=r.mul(S,C),Z=r.mul(x,y),q=r.mul(T,k),Q=r.add(S,x),te=r.add(C,y);Q=r.mul(Q,te),te=r.add(W,Z),Q=r.sub(Q,te),te=r.add(S,T);let ue=r.add(C,k);return te=r.mul(te,ue),ue=r.add(W,q),te=r.sub(te,ue),ue=r.add(x,T),F=r.add(y,k),ue=r.mul(ue,F),F=r.add(Z,q),ue=r.sub(ue,F),z=r.mul(H,te),F=r.mul(K,q),z=r.add(F,z),F=r.sub(Z,z),z=r.add(Z,z),_=r.mul(F,z),Z=r.add(W,W),Z=r.add(Z,W),q=r.mul(H,q),te=r.mul(K,te),Z=r.add(Z,q),q=r.sub(W,q),q=r.mul(H,q),te=r.add(te,q),W=r.mul(Z,te),_=r.add(_,W),W=r.mul(ue,te),F=r.mul(Q,F),F=r.sub(F,W),W=r.mul(Q,Z),z=r.mul(ue,z),z=r.add(z,W),new v(F,_,z)}subtract($){return this.add($.negate())}is0(){return this.equals(v.ZERO)}multiply($){const{endo:S}=t;if(!o.isValidNot0($))throw new Error("invalid scalar: out of range");let x,T;const C=y=>N.cached(this,y,k=>zc(v,k));if(S){const{k1neg:y,k1:k,k2neg:F,k2:_}=R($),{p:z,f:H}=C(k),{p:K,f:W}=C(_);T=H.add(W),x=g(S.beta,z,K,y,F)}else{const{p:y,f:k}=C($);x=y,T=k}return zc(v,[x,T])[0]}multiplyUnsafe($){const{endo:S}=t,x=this;if(!o.isValid($))throw new Error("invalid scalar: out of range");if($===sn||x.is0())return v.ZERO;if($===xr)return x;if(N.hasCache(this))return this.multiply($);if(S){const{k1neg:T,k1:C,k2neg:y,k2:k}=R($),{p1:F,p2:_}=xS(v,x,C,k);return g(S.beta,F,_,T,y)}else return N.unsafe(x,$)}multiplyAndAddUnsafe($,S,x){const T=this.multiplyUnsafe(S).add($.multiplyUnsafe(x));return T.is0()?void 0:T}toAffine($){return D(this,$)}isTorsionFree(){const{isTorsionFree:$}=t;return i===xr?!0:$?$(v,this):N.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:$}=t;return i===xr?this:$?$(v,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes($=!0){return Ls($,"isCompressed"),this.assertValidity(),p(v,this,$)}toHex($=!0){return cr(this.toBytes($))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes($=!0){return this.toBytes($)}_setWindowSize($){this.precompute($)}static normalizeZ($){return zc(v,$)}static msm($,S){return ES(v,o,$,S)}static fromPrivateKey($){return v.BASE.multiply(Er(o,$))}}v.BASE=new v(s.Gx,s.Gy,r.ONE),v.ZERO=new v(r.ZERO,r.ONE,r.ZERO),v.Fp=r,v.Fn=o;const P=o.BITS,N=new vS(v,t.endo?Math.ceil(P/2):P);return v.BASE.precompute(8),v}function g0(e){return Uint8Array.of(e?2:3)}function b0(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function OS(e,t={}){const{Fn:n}=e,r=t.randomBytes||Ud,o=Object.assign(b0(e.Fp,n),{seed:c0(n.ORDER)});function s(p){try{return!!Er(n,p)}catch{return!1}}function i(p,h){const{publicKey:m,publicKeyUncompressed:w}=o;try{const O=p.length;return h===!0&&O!==m||h===!1&&O!==w?!1:!!e.fromBytes(p)}catch{return!1}}function c(p=r(o.seed)){return bS(Dn(p,o.seed,"seed"),n.ORDER)}function a(p,h=!0){return e.BASE.multiply(Er(n,p)).toBytes(h)}function u(p){const h=c(p);return{secretKey:h,publicKey:a(h)}}function l(p){if(typeof p=="bigint")return!1;if(p instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:w}=o;if(n.allowedLengths||h===m)return;const O=Ue("key",p).length;return O===m||O===w}function f(p,h,m=!0){if(l(p)===!0)throw new Error("first arg must be private key");if(l(h)===!1)throw new Error("second arg must be public key");const w=Er(n,p);return e.fromHex(h).multiply(w).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:f,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:p=>Er(n,p),precompute(p=8,h=e.BASE){return h.precompute(p,!1)}},lengths:o})}function CS(e,t,n={}){Bd(t),dc(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Ud,o=n.hmac||((S,...x)=>Kh(t,S,hn(...x))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:f,utils:d,lengths:p}=OS(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function w(S){const x=c>>xr;return S>x}function O(S,x){if(!i.isValidNot0(x))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return x}function b(S,x){Gc(x);const T=p.signature,C=x==="compact"?T:x==="recovered"?T+1:void 0;return Dn(S,C,`${x} signature`)}class A{constructor(x,T,C){this.r=O("r",x),this.s=O("s",T),C!=null&&(this.recovery=C),Object.freeze(this)}static fromBytes(x,T=m){b(x,T);let C;if(T==="der"){const{r:_,s:z}=on.toSig(Dn(x));return new A(_,z)}T==="recovered"&&(C=x[0],T="compact",x=x.subarray(1));const y=i.BYTES,k=x.subarray(0,y),F=x.subarray(y,y*2);return new A(i.fromBytes(k),i.fromBytes(F),C)}static fromHex(x,T){return this.fromBytes(Es(x),T)}addRecoveryBit(x){return new A(this.r,this.s,x)}recoverPublicKey(x){const T=s.ORDER,{r:C,s:y,recovery:k}=this;if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");if(c*m0<T&&k>1)throw new Error("recovery id is ambiguous for h>1 curve");const _=k===2||k===3?C+c:C;if(!s.isValid(_))throw new Error("recovery id 2 or 3 invalid");const z=s.toBytes(_),H=e.fromBytes(hn(g0((k&1)===0),z)),K=i.inv(_),W=R(Ue("msgHash",x)),Z=i.create(-W*K),q=i.create(y*K),Q=e.BASE.multiplyUnsafe(Z).add(H.multiplyUnsafe(q));if(Q.is0())throw new Error("point at infinify");return Q.assertValidity(),Q}hasHighS(){return w(this.s)}toBytes(x=m){if(Gc(x),x==="der")return Es(on.hexFromSig(this));const T=i.toBytes(this.r),C=i.toBytes(this.s);if(x==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return hn(Uint8Array.of(this.recovery),T,C)}return hn(T,C)}toHex(x){return cr(this.toBytes(x))}assertValidity(){}static fromCompact(x){return A.fromBytes(Ue("sig",x),"compact")}static fromDER(x){return A.fromBytes(Ue("sig",x),"der")}normalizeS(){return this.hasHighS()?new A(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return cr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return cr(this.toBytes("compact"))}}const M=n.bits2int||function(x){if(x.length>8192)throw new Error("input is too large");const T=Rs(x),C=x.length*8-a;return C>0?T>>BigInt(C):T},R=n.bits2int_modN||function(x){return i.create(M(x))},D=Eo(a);function j(S){return O2("num < 2^"+a,S,sn,D),i.toBytes(S)}function g(S,x){return Dn(S,void 0,"message"),x?Dn(t(S),void 0,"prehashed message"):S}function v(S,x,T){if(["recovered","canonical"].some(Z=>Z in T))throw new Error("sign() legacy options not supported");const{lowS:C,prehash:y,extraEntropy:k}=qc(T,h);S=g(S,y);const F=R(S),_=Er(i,x),z=[j(_),j(F)];if(k!=null&&k!==!1){const Z=k===!0?r(p.secretKey):k;z.push(Ue("extraEntropy",Z))}const H=hn(...z),K=F;function W(Z){const q=M(Z);if(!i.isValidNot0(q))return;const Q=i.inv(q),te=e.BASE.multiply(q).toAffine(),ue=i.create(te.x);if(ue===sn)return;const Se=i.create(Q*i.create(K+ue*_));if(Se===sn)return;let Ke=(te.x===ue?0:2)|Number(te.y&xr),$e=Se;return C&&w(Se)&&($e=i.neg(Se),Ke^=1),new A(ue,$e,Ke)}return{seed:H,k2sig:W}}function P(S,x,T={}){S=Ue("message",S);const{seed:C,k2sig:y}=v(S,x,T);return C2(t.outputLen,i.BYTES,o)(C,y)}function N(S){let x;const T=typeof S=="string"||xs(S),C=!T&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!T&&!C)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(C)x=new A(S.r,S.s);else if(T){try{x=A.fromBytes(Ue("sig",S),"der")}catch(y){if(!(y instanceof on.Err))throw y}if(!x)try{x=A.fromBytes(Ue("sig",S),"compact")}catch{return!1}}return x||!1}function I(S,x,T,C={}){const{lowS:y,prehash:k,format:F}=qc(C,h);if(T=Ue("publicKey",T),x=g(Ue("message",x),k),"strict"in C)throw new Error("options.strict was renamed to lowS");const _=F===void 0?N(S):A.fromBytes(Ue("sig",S),F);if(_===!1)return!1;try{const z=e.fromBytes(T);if(y&&_.hasHighS())return!1;const{r:H,s:K}=_,W=R(x),Z=i.inv(K),q=i.create(W*Z),Q=i.create(H*Z),te=e.BASE.multiplyUnsafe(q).add(z.multiplyUnsafe(Q));return te.is0()?!1:i.create(te.x)===H}catch{return!1}}function $(S,x,T={}){const{prehash:C}=qc(T,h);return x=g(x,C),A.fromBytes(S,"recovered").recoverPublicKey(x).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:f,utils:d,lengths:p,Point:e,sign:P,verify:I,recoverPublicKey:$,Signature:A,hash:t})}function IS(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const o=To(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:o,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function NS(e){const{CURVE:t,curveOpts:n}=IS(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function kS(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,i0(n.Fn.ORDER,n.Fn.BITS))})}function MS(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=NS(e),s=TS(t,n),i=CS(s,r,o);return kS(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function LS(e,t){const n=r=>MS({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Zc={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},BS={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},y0=BigInt(2);function RS(e){const t=Zc.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=ct(l,n,t)*l%t,d=ct(f,n,t)*l%t,p=ct(d,y0,t)*u%t,h=ct(p,o,t)*p%t,m=ct(h,s,t)*h%t,w=ct(m,c,t)*m%t,O=ct(w,a,t)*w%t,b=ct(O,c,t)*m%t,A=ct(b,n,t)*l%t,M=ct(A,i,t)*h%t,R=ct(M,r,t)*u%t,D=ct(R,y0,t);if(!Kc.eql(Kc.sqr(D),e))throw new Error("Cannot find square root");return D}const Kc=To(Zc.p,{sqrt:RS}),w0=LS({...Zc,Fp:Kc,lowS:!0,endo:BS},Mp),FS=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:w0},Symbol.toStringTag,{value:"Module"}));function DS({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(Mt(e),Mt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:wt(i)}async function Yc(e,t){var f,d,p;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(p=(d=(f=e.chain)==null?void 0:f.contracts)==null?void 0:d.universalSignatureVerifier)==null?void 0:p.address,...a}=t,u=bt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?DS(i):xe(i),l=await(async()=>!r&&!o||$5(u)?u:P5({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Bt({abi:lh,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:vc({abi:lh,args:[n,s,l],bytecode:n6}),...a},{data:m}=await J(e,So,"call")(h);return Ox(m??"0x0")}catch(h){try{if(Ms(Nn(n),await vp({hash:s,signature:i})))return!0}catch{}if(h instanceof bp)return!1;throw h}}async function jS(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Rh(n);return Yc(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function _S(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=m5({message:i,primaryType:c,types:a,domain:u});return Yc(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function v0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=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 c?(()=>{const f=Ee(["watchBlockNumber",e.uid,t,n,i]);return yn(f,{onBlockNumber:r,onError:o},d=>$o(async()=>{var p;try{const h=await J(e,Po,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)d.onBlockNumber(m,a),a=m}(!a||h>a)&&(d.onBlockNumber(h,a),a=h)}catch(h){(p=d.onError)==null||p.call(d,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Ee(["watchBlockNumber",e.uid,t,n]);return yn(f,{onBlockNumber:r,onError:o},d=>{let p=!0,h=()=>p=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const O=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return O?O.value:e.transport}return e.transport})(),{unsubscribe:w}=await m.subscribe({params:["newHeads"],onData(O){var A;if(!p)return;const b=Mt((A=O.result)==null?void 0:A.number);d.onBlockNumber(b,a),a=b},onError(O){var b;(b=d.onError)==null||b.call(d,O)}});h=w,p||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function US(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:R})=>~~(1<<R)*200,timeout:a=18e4}=t,u=Ee(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var R;return t.pollingInterval?t.pollingInterval:(R=e.chain)!=null&&R.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,d,p,h=!1,m,w;const{promise:O,resolve:b,reject:A}=hh(),M=a?setTimeout(()=>{w(),m(),A(new FE({hash:o}))},a):void 0;return m=yn(u,{onReplaced:s,resolve:b,reject:A},async R=>{if(p=await J(e,Vs,"getTransactionReceipt")({hash:o}).catch(()=>{}),p&&r<=1){clearTimeout(M),R.resolve(p),m();return}w=J(e,v0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(D){const j=v=>{clearTimeout(M),w(),v(),m()};let g=D;if(!h)try{if(p){if(r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;j(()=>R.resolve(p));return}if(n&&!f&&(h=!0,await $c(async()=>{f=await J(e,Nc,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),p=await J(e,Vs,"getTransactionReceipt")({hash:o}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;j(()=>R.resolve(p))}catch(v){if(v instanceof mp||v instanceof gp){if(!f){h=!1;return}try{d=f,h=!0;const P=await $c(()=>J(e,Rt,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:$})=>$ instanceof Pp});h=!1;const N=P.transactions.find(({from:$,nonce:S})=>$===d.from&&S===d.nonce);if(!N||(p=await J(e,Vs,"getTransactionReceipt")({hash:N.hash}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r)))return;let I="replaced";N.to===d.to&&N.value===d.value&&N.input===d.input?I="repriced":N.from===N.to&&N.value===0n&&(I="cancelled"),j(()=>{var $;($=R.onReplaced)==null||$.call(R,{reason:I,replacedTransaction:d,transaction:N,transactionReceipt:p}),R.resolve(p)})}catch(P){j(()=>R.reject(P))}}else j(()=>R.reject(v))}}})}),O}function zS(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const u=typeof c<"u"?c:!(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")),l=i??!1;let f;return u?(()=>{const h=Ee(["watchBlocks",e.uid,t,n,r,l,a]);return yn(h,{onBlock:o,onError:s},m=>$o(async()=>{var w;try{const O=await J(e,Rt,"getBlock")({blockTag:t,includeTransactions:l});if(O.number!==null&&(f==null?void 0:f.number)!=null){if(O.number===f.number)return;if(O.number-f.number>1&&n)for(let b=(f==null?void 0:f.number)+1n;b<O.number;b++){const A=await J(e,Rt,"getBlock")({blockNumber:b,includeTransactions:l});m.onBlock(A,f),f=A}}((f==null?void 0:f.number)==null||t==="pending"&&(O==null?void 0:O.number)==null||O.number!==null&&O.number>f.number)&&(m.onBlock(O,f),f=O)}catch(O){(w=m.onError)==null||w.call(m,O)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,w=()=>h=!1;return(async()=>{try{r&&J(e,Rt,"getBlock")({blockTag:t,includeTransactions:l}).then(A=>{h&&m&&(o(A,void 0),m=!1)}).catch(s);const O=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(M=>M.config.type==="webSocket"||M.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),{unsubscribe:b}=await O.subscribe({params:["newHeads"],async onData(A){var R;if(!h)return;const M=await J(e,Rt,"getBlock")({blockNumber:(R=A.result)==null?void 0:R.number,includeTransactions:l}).catch(()=>{});h&&(o(M,f),m=!1,f=M)},onError(A){s==null||s(A)}});w=b,h||w()}catch(O){s==null||s(O)}})(),()=>w()})()}function HS(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:u,pollingInterval:l=e.pollingInterval,strict:f}){const d=typeof u<"u"?u: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")),p=f??!1;return d?(()=>{const w=Ee(["watchEvent",t,n,r,e.uid,o,l,i]);return yn(w,{onLogs:a,onError:c},O=>{let b;i!==void 0&&(b=i-1n);let A,M=!1;const R=$o(async()=>{var D;if(!M){try{A=await J(e,Th,"createEventFilter")({address:t,args:n,event:o,events:s,strict:p,fromBlock:i})}catch{}M=!0;return}try{let j;if(A)j=await J(e,Fs,"getFilterChanges")({filter:A});else{const g=await J(e,Po,"getBlockNumber")({});b&&b!==g?j=await J(e,ic,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:b+1n,toBlock:g}):j=[],b=g}if(j.length===0)return;if(r)O.onLogs(j);else for(const g of j)O.onLogs([g])}catch(j){A&&j instanceof Bn&&(M=!1),(D=O.onError)==null||D.call(O,j)}},{emitOnBegin:!0,interval:l});return async()=>{A&&await J(e,Ds,"uninstallFilter")({filter:A}),R()}})})():(()=>{let w=!0,O=()=>w=!1;return(async()=>{try{const b=(()=>{if(e.transport.type==="fallback"){const D=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return D?D.value:e.transport}return e.transport})(),A=s??(o?[o]:void 0);let M=[];A&&(M=[A.flatMap(j=>Yr({abi:[j],eventName:j.name,args:n}))],o&&(M=M[0]));const{unsubscribe:R}=await b.subscribe({params:["logs",{address:t,topics:M}],onData(D){var g;if(!w)return;const j=D.result;try{const{eventName:v,args:P}=oc({abi:A??[],data:j.data,topics:j.topics,strict:p}),N=tn(j,{args:P,eventName:v});a([N])}catch(v){let P,N;if(v instanceof Vr||v instanceof ws){if(f)return;P=v.abiItem.name,N=(g=v.abiItem.inputs)==null?void 0:g.some($=>!("name"in $&&$.name))}const I=tn(j,{args:N?[]:{},eventName:P});a([I])}},onError(D){c==null||c(D)}});O=R,w||O()}catch(b){c==null||c(b)}})(),()=>O()})()}function WS(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 u=Ee(["watchPendingTransactions",e.uid,t,s]);return yn(u,{onTransactions:r,onError:n},l=>{let f;const d=$o(async()=>{var p;try{if(!f)try{f=await J(e,Oh,"createPendingTransactionFilter")({});return}catch(m){throw d(),m}const h=await J(e,Fs,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)l.onTransactions(h);else for(const m of h)l.onTransactions([m])}catch(h){(p=l.onError)==null||p.call(l,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await J(e,Ds,"uninstallFilter")({filter:f}),d()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(d){if(!u)return;const p=d.result;r([p])},onError(d){n==null||n(d)}});l=f,u||l()}catch(f){n==null||n(f)}})(),()=>l()})()}function VS(e){var f,d,p;const{scheme:t,statement:n,...r}=((f=e.match(GS))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((d=e.match(qS))==null?void 0:d.groups)??{},l=(p=e.split("Resources:")[1])==null?void 0:p.split(`
151
- - `).slice(1);return{...r,...u,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const GS=/^(?:(?<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)?/,qS=/(?: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 ZS(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||!it(r.address,{strict:!1})||t&&!Ms(r.address,t))return!1}catch{return!1}return!0}async function KS(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=VS(o);if(!l.address||!ZS({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const d=Rh(o);return Yc(e,{address:l.address,hash:d,signature:c,...u})}function YS(e){return{call:t=>So(e,t),createAccessList:t=>Ah(e,t),createBlockFilter:()=>Y6(e),createContractEventFilter:t=>op(e,t),createEventFilter:t=>Th(e,t),createPendingTransactionFilter:()=>Oh(e),estimateContractGas:t=>$2(e,t),estimateGas:t=>rc(e,t),getBalance:t=>Up(e,t),getBlobBaseFee:()=>X6(e),getBlock:t=>Rt(e,t),getBlockNumber:t=>Po(e,t),getBlockTransactionCount:t=>Q6(e,t),getBytecode:t=>Ch(e,t),getChainId:()=>Dp(e),getCode:t=>Ch(e,t),getContractEvents:t=>Hp(e,t),getEip712Domain:t=>e5(e,t),getEnsAddress:t=>L6(e,t),getEnsAvatar:t=>q6(e,t),getEnsName:t=>Z6(e,t),getEnsResolver:t=>K6(e,t),getEnsText:t=>Ph(e,t),getFeeHistory:t=>r5(e,t),estimateFeesPerGas:t=>a2(e,t),getFilterChanges:t=>Fs(e,t),getFilterLogs:t=>o5(e,t),getGasPrice:()=>ec(e),getLogs:t=>ic(e,t),getProof:t=>I5(e,t),estimateMaxPriorityFeePerGas:t=>i2(e,t),getStorageAt:t=>N5(e,t),getTransaction:t=>Nc(e,t),getTransactionConfirmations:t=>k5(e,t),getTransactionCount:t=>Ip(e,t),getTransactionReceipt:t=>Vs(e,t),multicall:t=>M5(e,t),prepareTransactionRequest:t=>_p(e,t),readContract:t=>rn(e,t),sendRawTransaction:t=>g6(e,t),simulate:t=>kc(e,t),simulateBlocks:t=>kc(e,t),simulateCalls:t=>cS(e,t),simulateContract:t=>c6(e,t),verifyMessage:t=>jS(e,t),verifySiweMessage:t=>KS(e,t),verifyTypedData:t=>_S(e,t),uninstallFilter:t=>Ds(e,t),waitForTransactionReceipt:t=>US(e,t),watchBlocks:t=>zS(e,t),watchBlockNumber:t=>v0(e,t),watchContractEvent:t=>m6(e,t),watchEvent:t=>HS(e,t),watchPendingTransactions:t=>WS(e,t)}}function XS(e){const{key:t="public",name:n="Public Client"}=e;return w6({...e,key:t,name:n,type:"publicClient"}).extend(YS)}const QS=f5({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}}}),Oo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return L.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},JS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=ht(Math.max(0,s).toString());return L.jsxs("span",{className:"flex items-center gap-1",children:[ht(e),L.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${ht(e)} ${n}`},e$=(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)},t$=(e,t,n)=>{if(!bf(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}},n$=(e,t,n)=>{let r=t||"0";if(bf(e,n))try{const o=new ke(r),s=new ke("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}return r},x0={chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,platformBalance:"0"};let He=null;const E0=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState(x0),a=E.useCallback(h=>{c(h),r(!0)},[]),u=E.useCallback(h=>{c(m=>({...m,...h}))},[]),l=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),d=E.useCallback(()=>n,[n]),p=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:d,isLoading:p}),[a,l,u,f,d,p]),E.useEffect(()=>(He={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:d,isLoading:p},()=>{He=null}),[a,l,u,f,d,p]),L.jsx(C0,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,defaultChainId:i.defaultChainId,platformBalance:i.platformBalance,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,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)}})});E0.displayName="DepositManager";const S0=e=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.openDeposit(e||x0)},$0=()=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.closeDeposit()},P0=e=>{He&&He.updateDepositOptions(e)},Ks=e=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.setDepositLoading(e)},r$=()=>He?He.isOpen():!1,A0=()=>He?He.isLoading():!1,o$=()=>({openDeposit:S0,closeDeposit:$0,updateDepositOptions:P0,setDepositLoading:Ks,isOpen:r$,isLoading:A0}),s$=e=>{const{t}=_t(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return E.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=e$(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<a?{text:t("deposit.minDepositParsed",{amount:a,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!l,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function i$(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,d=o==null?void 0:o.contractAddress,p=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),w=a(),O=i({address:l,abi:gr,functionName:"allowance",args:[Nn(t||""),d],chainId:r,query:{enabled:!!(!p&&t&&r&&l&&d)}}),b=O!=null&&O.isSuccess?O.data:void 0,A=E.useMemo(()=>{if(p)return!0;if(!O.isSuccess||b===void 0||b===0n)return!1;try{const R=T5(String(Number(s||"0")||0),Number(f));return b>=R}catch{return!1}},[p,O.isSuccess,b,s,f]),M=E.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!w||!l||!d)return;const D=Nn(l),j=Nn(d);if((b||0n)>0n){const P=await m({abi:gr,address:D,functionName:"approve",args:[j,0n]});await w.waitForTransactionReceipt({hash:P})}const v=await m({abi:gr,address:D,functionName:"approve",args:[j,$p]});await w.waitForTransactionReceipt({hash:v}),O!=null&&O.refetch&&await O.refetch()}catch(R){console.error("[useApprove] onApprove failed:",R)}},[r,n,l,d,b,O,m,w,h]);return{approve:A,onApprove:M}}const a$=({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 E.useEffect(()=>{o(Nn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},T0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var O;const s=E.useMemo(()=>r.filter(b=>b.tokenAddress&&b.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=E.useState({}),a=E.useCallback((b,A)=>{c(M=>({...M,[b]:A}))},[]),u=(O=o==null?void 0:o.useBalance)==null?void 0:O.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),[l,f]=E.useState(0),d=E.useMemo(()=>s.map(b=>E.createElement(a$,{key:`${b.tokenAddress}-${l}`,token:b,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a,l]),p=E.useMemo(()=>{const b=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=s.map(R=>{const D=i[Nn(R.tokenAddress)],j=D==null?void 0:D.balance,g=j==null?void 0:j.data;return{address:Nn(R.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||R.decimals}}).filter(R=>R.address),M=A.reduce((R,D)=>({...R,[D.address]:{balance:D}}),{});return{balanceList:A,baseTokenBalance:b,combinedData:M}},[u,i,s]),h=E.useCallback(async()=>p,[p]),m=E.useMemo(()=>{const b=(u==null?void 0:u.isLoading)||!1,A=Object.values(i).some(M=>{var R;return(R=M.balance)==null?void 0:R.isLoading});return b||A},[u==null?void 0:u.isLoading,i]),w=E.useCallback(()=>f(b=>b+1),[]);return{multicallRun:h,multicallRefresh:w,multicallResult:p,validErcTokens:s,isLoading:m,queryComponents:d}};function c$({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=E.useState(null),[a,u]=E.useState(o);return E.useEffect(()=>{let l,f;const d=async()=>{try{const p=await e.readContract({address:t,abi:gr,functionName:"balanceOf",args:[n]});c(p),u(ja(p,r))}catch{u(o)}};d();try{l=e.watchContractEvent({address:t,abi:gr,eventName:"Transfer",args:{to:n},onLogs:()=>{d()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:gr,eventName:"Transfer",args:{from:n},onLogs:()=>{d()},poll:!0,pollingInterval:s})}catch{}return()=>{l==null||l(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const u$=({address:e,currentActiveChain:t,selectedToken:n,platformBalance:r,isLoading:o,wagmiHooks:s,onChainChange:i,onDeposit:c})=>{const{t:a}=_t(),u=s.useAccount(),l=t.tokenList.find(F=>F.token===n),f=t.chainId,[d,p]=E.useState("");E.useEffect(()=>{p("")},[n,t.chainId]);const{multicallResult:h,queryComponents:m}=T0({account:e,chainId:t.chainId,contractAddress:(l==null?void 0:l.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:s}),w=E.useMemo(()=>{var _;if(!l)return"0";if(!l.tokenAddress||l.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return h.baseTokenBalance.formatted;const F=h.combinedData[l.tokenAddress];return((_=F==null?void 0:F.balance)==null?void 0:_.formatted)||"0"},[l,h]),O="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",b="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",A=E.useMemo(()=>{var F,_;return XS({chain:QS,transport:O6(t.rpcUrl||((F=window==null?void 0:window.ENV)==null?void 0:F.CHAIN_RPC_URL_42161)||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),M="1000000000000",{formatted:R}=c$({client:A,tokenAddress:O,holder:b,decimals:6,fallbackFormatted:M,pollingInterval:12e3}),[D,j]=E.useState(!1),{approve:g,onApprove:v}=i$({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:l,amount:d,wagmiHooks:s}),P=E.useCallback(async()=>{if(!D)try{j(!0),await v()}catch(F){console.error("Approve failed:",F)}finally{j(!1)}},[D,v]),N=E.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),I=E.useCallback(async()=>{i&&i(f)},[i,f]);E.useEffect(()=>{N&&I()},[N,I]);const{showLayerZeroTip:$,layerZeroTipKey:S}=E.useMemo(()=>{const F=+t.chainId==42161||+t.chainId==421614,_=(n==null?void 0:n.toUpperCase())==="USDT",z=new ke(d||"0"),H=new ke("200000");let K=!1,W;if(F&&_&&d)if(z.gte(H))K=!0,W="deposit.layerZeroDepositTipGte200k";else{const Z=R;if(typeof Z=="string"&&Z.length>0){const Q=new ke(Z);!Q.isNaN()&&z.gte(Q)&&(K=!0,W="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:K,layerZeroTipKey:W}},[t.chainId,n,d,R]),x=E.useCallback(()=>n$(+t.chainId,w||"0",n),[w,t==null?void 0:t.chainId,n]),T=E.useMemo(()=>t$(+t.chainId,d,n),[t==null?void 0:t.chainId,d,n]),C=s$({isNetworkMismatch:N,depositAmount:d,approved:g,currentTokenBalance:w,selectedToken:n,showLayerZeroTip:$,minDeposit:10}),y=F=>{const _=F.target.value,z=x(),H=xa(_,z);if(H.isValid)p(H.formattedValue),H.errorType;else return H.errorType==="exceed_balance",void 0},k=E.useCallback(async()=>{Ks(!0);try{c&&c({amount:d,chainId:f,tokenAddress:(l==null?void 0:l.tokenAddress)||"",tokenSymbol:n})}catch(F){console.error("Deposit error:",F),Ks(!1)}},[c,d,f,l==null?void 0:l.tokenAddress,n]);return L.jsxs(L.Fragment,{children:[m,L.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[L.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[L.jsx("input",{type:"text",placeholder:a("deposit.amount"),value:d,onChange:y,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),L.jsx("button",{onClick:()=>{const F=x();p(F)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:a("deposit.max")})]}),L.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),L.jsxs("div",{className:"flex justify-between items-center",children:[L.jsx(er,{content:a("deposit.availableDesc"),children:L.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:a("deposit.available")})}),L.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:JS(w||"0",d,n)})]})]}),!g&&vv(d||"0",0)&&L.jsxs("div",{className:"flex justify-center flex-col items-center",children:[L.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:a("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),L.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:a("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),L.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:P,disabled:D,children:D?L.jsx(Oo,{size:"xs",inline:!0}):a("deposit.enableWithToken",{token:n})})]}),$&&L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:"flex mb-4",children:[L.jsx("div",{className:"w-5",children:L.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),L.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a(S||"deposit.layerZeroDepositTip")})]}),L.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),T&&L.jsxs("div",{className:"flex mb-4",children:[L.jsx("div",{className:"w-5",children:L.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),L.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.depositTipFor25w")})]}),T&&L.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),L.jsxs("div",{className:"flex mb-4",children:[L.jsx("div",{className:"w-5",children:!(T||$)&&L.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),L.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.noPrivateKeyWalletWarning")})]}),L.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[L.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[L.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.arrivalTime")}),L.jsx(er,{content:L.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[L.jsx("p",{children:a("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),L.jsx("p",{children:a("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:L.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:a("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),L.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[L.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.equity")}),L.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?L.jsxs("span",{className:"flex items-center gap-1",children:[ht(r),L.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),ht((parseFloat(r)+parseFloat(d)).toString())," ",n]}):`${ht(r)} ${n}`})]})]}),L.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${C.disabled||o?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:k,disabled:C.disabled||o,children:[(o||N)&&L.jsx(Oo,{size:"xs"}),C.text]})]})},O0=e=>e.toLocaleUpperCase()===vn?vn:oi,Ys=e=>O0(e.wallet)===vn,l$=e=>O0(e.wallet)===oi,C0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,defaultChainId:s,platformBalance:i="0",wagmiHooks:c,onDeposit:a,onCopy:u,onChainChange:l,onTokenChange:f})=>{const{t:d}=_t(),[p,h]=E.useState(()=>{var M;return!o||o.length===0?1:s||((M=o[0])==null?void 0:M.chainId)||1}),m=o.find(M=>M.chainId===p)||o[0],[w,O]=E.useState(()=>{var j;if(!o||o.length===0)return"";const M=s||((j=o[0])==null?void 0:j.chainId),R=o.find(g=>g.chainId===M);if(!R||!R.tokenList||R.tokenList.length===0)return"";const D=R.tokenList[0];return(D==null?void 0:D.token)||""}),b=E.useCallback(M=>{h(M),l==null||l(M)},[l]),A=E.useCallback(M=>{O(M),f==null||f(M)},[f]);return e?Ne.createPortal(L.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:L.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:L.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:[L.jsxs("div",{className:"flex items-center justify-between mb-4",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:d("deposit.title")}),L.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:L.jsx(hu,{className:"h-4 w-4"})})]}),L.jsx(yf,{currentActiveChain:m,chainList:o,onChainChange:b,curSelectToken:w,onTokenChange:A,walletType:Ys(r)?vn:oi}),Ys(r)&&L.jsx(Sv,{address:r.smartWalletAddress,currentActiveChain:m,selectedToken:w,onDeposit:a,onCopy:u,onClose:n}),l$(r)&&L.jsx(u$,{address:r.ethAddress,currentActiveChain:m,selectedToken:w,platformBalance:i,isLoading:t,wagmiHooks:c,onChainChange:b,onDeposit:a,onClose:n})]})})}),document.body):null},f$=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",fee:o="0.00",walletType:s="evm",receiverAddress:i="",onWithdrawAmountChange:c,onReceiverAddressChange:a,onAmountChanged:u})=>{const{t:l}=_t(),f=E.useMemo(()=>{if(!Ct(n==null?void 0:n.chainId)){const w=new ke(e||"0").minus(o||"0").decimalPlaces(2,ke.ROUND_DOWN);return w.isNegative()?"0.00":w.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),d=E.useMemo(()=>r||"0",[r]),p=w=>{const O=w.target.value,A=xa(O,d||"0");if(A.isValid)c(A.formattedValue),A.errorType;else return A.errorType==="exceed_balance",void 0;u==null||u(A.formattedValue)},h=()=>{c(d),u==null||u(d)},m=()=>{const w=parseFloat(r||"0"),O=parseFloat(e||"0");if(O>0){const b=w-O,A=ht(Math.max(0,b).toString());return L.jsxs("span",{className:"flex items-center gap-1",children:[ht(r||"0"),L.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),A," ",t]})}return`${ht(r||"0")} ${t}`};return L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[L.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[L.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:e,onChange:p,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),L.jsx("button",{onClick:h,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),L.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),L.jsxs("div",{className:"flex justify-between items-center",children:[L.jsx(er,{content:l("withdraw.availableDesc"),children:L.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),L.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:m()})]})]}),s==="mpc"&&!Ct(n==null?void 0:n.chainId)&&L.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:L.jsx("input",{type:"text",placeholder:l("withdraw.receiverAddress"),value:i,onChange:w=>a==null?void 0:a(w.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),L.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Ct(n==null?void 0:n.chainId)?L.jsxs(L.Fragment,{children:[L.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.noticeDesc")}),L.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:l("withdraw.commonWithdraw")})]}):L.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.crossChainTips")})}),L.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[L.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[L.jsx(er,{content:L.jsxs("div",{children:[L.jsx("div",{children:l("withdraw.speedNote")}),L.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[L.jsx(jr,{selectedLevel:pt.FAST,maxLevel:3}),L.jsx("span",{children:l("withdraw.speedNoteSpeed1")})]}),L.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[L.jsx(jr,{selectedLevel:pt.Medium,maxLevel:3}),L.jsx("span",{children:l("withdraw.speedNoteSpeed2")})]}),L.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[L.jsx(jr,{selectedLevel:pt.SLOW,maxLevel:3}),L.jsx("span",{children:l("withdraw.speedNoteSpeed3")})]})]}),children:L.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:l("withdraw.speed")})}),L.jsx("div",{className:"flex items-center",children:L.jsx(jr,{selectedLevel:Ct(n==null?void 0:n.chainId)?pt.SLOW:pt.FAST,maxLevel:3})})]}),!Ct(n==null?void 0:n.chainId)&&L.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[L.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l("withdraw.fee")}),L.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),L.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[L.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l(Ct(n==null?void 0:n.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),L.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[ht(f)," ",t]})]})]})]})},d$=[],p$={};let We=null;const I0=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=E.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=E.useCallback(h=>{c(m=>({...m,...h}))},[]),l=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),d=E.useCallback(()=>n,[n]),p=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:d,isLoading:p}),[a,l,u,f,d,p]),E.useEffect(()=>(We={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:d,isLoading:p},()=>{We=null}),[a,l,u,f,d,p]),L.jsx(B0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||d$,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||p$,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged})});I0.displayName="WithdrawManager";const N0=e=>{if(!We){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}We.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},k0=()=>{if(!We){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}We.closeWithdraw()},M0=e=>{if(!We){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}We.updateWithdrawOptions(e)},Xs=e=>{if(!We){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}We.setWithdrawLoading(e)},h$=()=>We?We.isOpen():!1,L0=()=>We?We.isLoading():!1,m$=()=>({openWithdraw:N0,closeWithdraw:k0,updateWithdrawOptions:M0,setWithdrawLoading:Xs,isOpen:h$,isLoading:L0}),g$=({address:e,walletType:t,chains:n,defaultChainId:r,defaultTokenAddress:o,defaultAmount:s="",metadata:i,currentEquity:c,platformBalance:a="0",fee:u="0.00",isLoading:l=!1,wagmiHooks:f,onWithdraw:d,onClose:p,onChainChange:h,onTokenChange:m,onAmountChanged:w})=>{var z;const{t:O}=_t(),[b,A]=E.useState(()=>{var H;return!n||n.length===0?1:r||((H=n[0])==null?void 0:H.chainId)||1}),[M,R]=E.useState(()=>{var Z;if(!n||n.length===0)return"";const H=r||((Z=n[0])==null?void 0:Z.chainId),K=n.find(q=>q.chainId===H);if(!K||!K.tokenList||K.tokenList.length===0)return"";const W=K.tokenList.find(q=>q.tokenAddress===o)||K.tokenList[0];return(W==null?void 0:W.token)||""}),[D,j]=E.useState(s),[g,v]=E.useState(""),P=E.useCallback(H=>{A(H),h==null||h(H)},[h]),N=E.useCallback(H=>{R(H),m==null||m(H)},[m]),I=E.useRef(!0),$=E.useRef(M),S=E.useRef(b);E.useEffect(()=>{if(I.current){I.current=!1,$.current=M,S.current=b;return}($.current!==M||S.current!==b)&&(j(""),$.current=M,S.current=b)},[M,b]);const x=n&&n.length>0?n.find(H=>H.chainId===b)||n[0]:null,T=(z=x==null?void 0:x.tokenList)==null?void 0:z.find(H=>H.token===M),{multicallResult:C,queryComponents:y}=T0({account:e,chainId:b,contractAddress:void 0,tokens:(x==null?void 0:x.tokenList)||[],wagmiHooks:f}),k=E.useMemo(()=>{var K;if(!T)return;if(!T.tokenAddress||T.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return C.baseTokenBalance.formatted;const H=C.combinedData[T.tokenAddress];return((K=H==null?void 0:H.balance)==null?void 0:K.formatted)||"0"},[T,C]),F=E.useMemo(()=>{const H=new ke(D||"0"),K=new ke(u||"0"),W=Ct(b);return!D||H.isZero()||!W&&H.isLessThan(K)?{text:O("withdraw.confirmWithdraw"),disabled:!0}:t==="mpc"&&!W&&!g.trim()?{text:O("withdraw.invalidReceiverAddress"),disabled:!0}:{text:O("withdraw.confirmWithdraw"),disabled:!1}},[O,b,D,t,g,u]),_=E.useCallback(async()=>{Xs(!0);try{if(d){const H=new ke(D||"0"),K=new ke(u||"0"),Z={amount:(Ct(b)?H:H.minus(K)).toString(),chainId:b,tokenAddress:(T==null?void 0:T.tokenAddress)||"",tokenSymbol:M};t==="mpc"&&!Ct(b)&&(Z.receiverAddress=g),d(Z)}}catch{Xs(!1)}},[d,D,u,b,T==null?void 0:T.tokenAddress,M,t,g]);return!n||n.length===0?L.jsx("div",{className:"text-center py-8",children:L.jsx("p",{className:"text-gray-400",children:"No chains available"})}):x?L.jsxs(L.Fragment,{children:[y,L.jsx(yf,{currentActiveChain:x,chainList:n,onChainChange:P,curSelectToken:M,onTokenChange:N,walletType:"EVM",txType:"withdraw"}),L.jsx(f$,{withdrawAmount:D,curSelectToken:M,curSelectTokenData:{balance:T==null?void 0:T.balance,allowance:T==null?void 0:T.allowance},currentActiveChain:x,currentEquity:c||0,amount:D,decimals:(T==null?void 0:T.decimals)||6,tokenBalance:k,platformBalance:a,fee:u,walletType:t,receiverAddress:g,onWithdrawAmountChange:j,onReceiverAddressChange:v,onAmountChanged:w}),L.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${F.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:_,disabled:F.disabled||l,children:[l&&L.jsx(Oo,{size:"xs"}),F.text]})]}):L.jsx("div",{className:"text-center py-8",children:L.jsx("p",{className:"text-gray-400",children:"Loading..."})})},B0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o,chains:s,defaultChainId:i,defaultTokenAddress:c,defaultAmount:a="",metadata:u,currentEquity:l=5e3,platformBalance:f="0",fee:d,wagmiHooks:p,onWithdraw:h,onChainChange:m,onTokenChange:w,onAmountChanged:O})=>{const{t:b}=_t();return e?Ne.createPortal(L.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:L.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:L.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:A=>{A.stopPropagation()},children:[L.jsxs("div",{className:"flex items-center justify-between mb-4",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:b("withdraw.withdraw")}),L.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:L.jsx(hu,{className:"h-4 w-4"})})]}),L.jsx(g$,{chains:s,address:Ys(o)?o.smartWalletAddress:o.ethAddress,walletType:Ys(o)?"mpc":"evm",defaultChainId:i,defaultTokenAddress:c,defaultAmount:a,metadata:u,currentEquity:l,platformBalance:f,fee:d,isLoading:t,wagmiHooks:p,onWithdraw:h,onClose:n,onChainChange:m,onTokenChange:w,onAmountChanged:O})]})})}),document.body):null};re.ChromeLoader=Oo,re.ComponentProvider=cm,re.DEFAULT_LOCALE=No,re.Deposit=C0,re.DepositManager=E0,re.LOCALE_NAMES=sm,re.LoadingSpinner=Oo,re.SUPPORTED_LOCALES=ei,re.Tooltip=er,re.Withdraw=B0,re.WithdrawManager=I0,re.closeDeposit=$0,re.closeWithdraw=k0,re.formatThousands=lm,re.isDepositLoading=A0,re.isWithdrawLoading=L0,re.openDeposit=S0,re.openWithdraw=N0,re.setDepositLoading=Ks,re.setWithdrawLoading=Xs,re.updateDepositOptions=P0,re.updateWithdrawOptions=M0,re.useComponentConfig=uu,re.useDeposit=fm,re.useDepositManager=o$,re.useTranslation=_t,re.useWithdraw=dm,re.useWithdrawManager=m$,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
151
+ `,children:[t,o&&M.jsx(O0,{ref:f,placement:h.placement||n})]})})]})},Io="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=",sP=(e,t)=>Number(e)>Number(t),At=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"},nu=(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 nu(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:At(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},Ys={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},iP=[Ys.ETHEREUM,Ys.SEPOLIA,Ys.ARBITRUM,Ys.ARBITRUM_SEPOLIA],aP=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!iP.includes(t)}return!0},cP=({currentActiveChain:e,selectedToken:t,address:n,onDeposit:r,onCopy:o,onClose:s})=>{const{t:i}=Ut(),c=x.useMemo(()=>aP(e||{}),[e]);return M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&M.jsx("div",{className:"bg-white rounded-lg",children:M.jsx(l0,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&M.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[M.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),M.jsx(lS,{onCopy:()=>{o&&o(n)},text:n,children:M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[M.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),M.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")]}),M.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[M.jsxs("div",{className:"flex items-start",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1",children:M.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),c&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),M.jsxs("div",{className:"text-sm",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[M.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),M.jsx(Vn,{content:M.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[M.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),M.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:M.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:i("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[M.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:["10 ",t]})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[M.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),M.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{r&&r({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),s()},children:i("deposit.title")})]})},No=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return M.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},uP=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=At(Math.max(0,s).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[At(e),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${At(e)} ${n}`},lP=(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)},fP=(e,t,n)=>{if(!Wh(e,n))return!1;try{const r=new $e(t||"0"),o=new $e("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},dP=(e,t,n)=>{let r=t||"0";if(Wh(e,n))try{const o=new $e(r),s=new $e("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}return r},I0={chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,platformBalance:"0"};let Ge=null;const N0=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState(I0),a=x.useCallback(h=>{c(h),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),d=x.useCallback(()=>n,[n]),p=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:d,isLoading:p}),[a,l,u,f,d,p]),x.useEffect(()=>(Ge={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:d,isLoading:p},()=>{Ge=null}),[a,l,u,f,d,p]),M.jsx(F0,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,defaultChainId:i.defaultChainId,platformBalance:i.platformBalance,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,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)}})});N0.displayName="DepositManager";const k0=e=>{if(!Ge){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ge.openDeposit(e||I0)},B0=()=>{if(!Ge){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ge.closeDeposit()},M0=e=>{Ge&&Ge.updateDepositOptions(e)},Xs=e=>{if(!Ge){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ge.setDepositLoading(e)},pP=()=>Ge?Ge.isOpen():!1,L0=()=>Ge?Ge.isLoading():!1,hP=()=>({openDeposit:k0,closeDeposit:B0,updateDepositOptions:M0,setDepositLoading:Xs,isOpen:pP,isLoading:L0}),mP=e=>{const{t}=Ut(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return x.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=lP(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<a?{text:t("deposit.minDepositParsed",{amount:a,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!l,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function gP(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,d=o==null?void 0:o.contractAddress,p=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),v=a(),$=i({address:l,abi:cr,functionName:"allowance",args:[An(t||""),d],chainId:r,query:{enabled:!!(!p&&t&&r&&l&&d)}}),y=$!=null&&$.isSuccess?$.data:void 0,T=x.useMemo(()=>{if(p)return!0;if(!$.isSuccess||y===void 0||y===0n)return!1;try{const L=ww(String(Number(s||"0")||0),Number(f));return y>=L}catch{return!1}},[p,$.isSuccess,y,s,f]),B=x.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!v||!l||!d)return;const _=An(l),F=An(d);if((y||0n)>0n){const A=await m({abi:cr,address:_,functionName:"approve",args:[F,0n]});await v.waitForTransactionReceipt({hash:A})}const w=await m({abi:cr,address:_,functionName:"approve",args:[F,jl]});await v.waitForTransactionReceipt({hash:w}),$!=null&&$.refetch&&await $.refetch()}catch(L){console.error("[useApprove] onApprove failed:",L)}},[r,n,l,d,y,$,m,v,h]);return{approve:T,onApprove:B}}const bP=({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 x.useEffect(()=>{o(An(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},R0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var $;const s=x.useMemo(()=>r.filter(y=>y.tokenAddress&&y.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=x.useState({}),a=x.useCallback((y,T)=>{c(B=>({...B,[y]:T}))},[]),u=($=o==null?void 0:o.useBalance)==null?void 0:$.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),[l,f]=x.useState(0),d=x.useMemo(()=>s.map(y=>x.createElement(bP,{key:`${y.tokenAddress}-${l}`,token:y,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a,l]),p=x.useMemo(()=>{const y=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"},T=s.map(L=>{const _=i[An(L.tokenAddress)],F=_==null?void 0:_.balance,g=F==null?void 0:F.data;return{address:An(L.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||L.decimals}}).filter(L=>L.address),B=T.reduce((L,_)=>({...L,[_.address]:{balance:_}}),{});return{balanceList:T,baseTokenBalance:y,combinedData:B}},[u,i,s]),h=x.useCallback(async()=>p,[p]),m=x.useMemo(()=>{const y=(u==null?void 0:u.isLoading)||!1,T=Object.values(i).some(B=>{var L;return(L=B.balance)==null?void 0:L.isLoading});return y||T},[u==null?void 0:u.isLoading,i]),v=x.useCallback(()=>f(y=>y+1),[]);return{multicallRun:h,multicallRefresh:v,multicallResult:p,validErcTokens:s,isLoading:m,queryComponents:d}},yP=({address:e,currentActiveChain:t,selectedToken:n,platformBalance:r,isLoading:o,wagmiHooks:s,onChainChange:i,onDeposit:c})=>{const{t:a}=Ut(),u=s.useAccount(),l=t.tokenList.find(D=>D.token===n),f=t.chainId,[d,p]=x.useState("");x.useEffect(()=>{p("")},[n,t.chainId]);const{multicallResult:h,queryComponents:m}=R0({account:e,chainId:t.chainId,contractAddress:(l==null?void 0:l.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:s}),v=x.useMemo(()=>{var j;if(!l)return"0";if(!l.tokenAddress||l.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return h.baseTokenBalance.formatted;const D=h.combinedData[l.tokenAddress];return((j=D==null?void 0:D.balance)==null?void 0:j.formatted)||"0"},[l,h]),$="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",y="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",T=x.useMemo(()=>{var D,j;return Da({chain:Fa,transport:fa(t.rpcUrl||((D=window==null?void 0:window.ENV)==null?void 0:D.CHAIN_RPC_URL_42161)||((j=window==null?void 0:window.ENV)==null?void 0:j.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),B="1000000000000",{formatted:L}=hs({client:T,tokenAddress:$,holder:y,decimals:6,fallbackFormatted:B,pollingInterval:12e3}),[_,F]=x.useState(!1),{approve:g,onApprove:w}=gP({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:l,amount:d,wagmiHooks:s}),A=x.useCallback(async()=>{if(!_)try{F(!0),await w()}catch(D){console.error("Approve failed:",D)}finally{F(!1)}},[_,w]),I=x.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),N=x.useCallback(async()=>{i&&i(f)},[i,f]);x.useEffect(()=>{I&&N()},[I,N]);const{showLayerZeroTip:P,layerZeroTipKey:S}=x.useMemo(()=>{const D=+t.chainId==42161||+t.chainId==421614,j=(n==null?void 0:n.toUpperCase())==="USDT",z=new $e(d||"0"),W=new $e("200000");let K=!1,H;if(D&&j&&d)if(z.gte(W))K=!0,H="deposit.layerZeroDepositTipGte200k";else{const Z=L;if(typeof Z=="string"&&Z.length>0){const J=new $e(Z);!J.isNaN()&&z.gte(J)&&(K=!0,H="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:K,layerZeroTipKey:H}},[t.chainId,n,d,L]),E=x.useCallback(()=>dP(+t.chainId,v||"0",n),[v,t==null?void 0:t.chainId,n]),C=x.useMemo(()=>fP(+t.chainId,d,n),[t==null?void 0:t.chainId,d,n]),O=mP({isNetworkMismatch:I,depositAmount:d,approved:g,currentTokenBalance:v,selectedToken:n,showLayerZeroTip:P,minDeposit:10}),b=D=>{const j=D.target.value,z=E(),W=nu(j,z);if(W.isValid)p(W.formattedValue),W.errorType;else return W.errorType==="exceed_balance",void 0},k=x.useCallback(async()=>{Xs(!0);try{c&&c({amount:d,chainId:f,tokenAddress:(l==null?void 0:l.tokenAddress)||"",tokenSymbol:n})}catch(D){console.error("Deposit error:",D),Xs(!1)}},[c,d,f,l==null?void 0:l.tokenAddress,n]);return M.jsxs(M.Fragment,{children:[m,M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:a("deposit.amount"),value:d,onChange:b,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:()=>{const D=E();p(D)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:a("deposit.max")})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx(Vn,{content:a("deposit.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:a("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:uP(v||"0",d,n)})]})]}),!g&&sP(d||"0",0)&&M.jsxs("div",{className:"flex justify-center flex-col items-center",children:[M.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:a("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),M.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:a("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),M.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:A,disabled:_,children:_?M.jsx(No,{size:"xs",inline:!0}):a("deposit.enableWithToken",{token:n})})]}),P&&M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a(S||"deposit.layerZeroDepositTip")})]}),M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),C&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.depositTipFor25w")})]}),C&&M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:!(C||P)&&M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.noPrivateKeyWalletWarning")})]}),M.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[M.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.arrivalTime")}),M.jsx(Vn,{content:M.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[M.jsx("p",{children:a("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),M.jsx("p",{children:a("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:M.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:a("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[M.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.equity")}),M.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?M.jsxs("span",{className:"flex items-center gap-1",children:[At(r),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),At((parseFloat(r)+parseFloat(d)).toString())," ",n]}):`${At(r)} ${n}`})]})]}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${O.disabled||o?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:k,disabled:O.disabled||o,children:[(o||I)&&M.jsx(No,{size:"xs"}),O.text]})]})},D0=e=>e.toLocaleUpperCase()===Dn?Dn:ja,Qs=e=>D0(e.wallet)===Dn,wP=e=>D0(e.wallet)===ja,F0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,defaultChainId:s,platformBalance:i="0",wagmiHooks:c,onDeposit:a,onCopy:u,onChainChange:l,onTokenChange:f})=>{const{t:d}=Ut(),[p,h]=x.useState(()=>{var B;return!o||o.length===0?1:s||((B=o[0])==null?void 0:B.chainId)||1}),m=o.find(B=>B.chainId===p)||o[0],[v,$]=x.useState(()=>{var F;if(!o||o.length===0)return"";const B=s||((F=o[0])==null?void 0:F.chainId),L=o.find(g=>g.chainId===B);if(!L||!L.tokenList||L.tokenList.length===0)return"";const _=L.tokenList[0];return(_==null?void 0:_.token)||""}),y=x.useCallback(B=>{h(B),l==null||l(B)},[l]),T=x.useCallback(B=>{$(B),f==null||f(B)},[f]);return e?Me.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:M.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:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:d("deposit.title")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(zd,{className:"h-4 w-4"})})]}),M.jsx(Vh,{currentActiveChain:m,chainList:o,onChainChange:y,curSelectToken:v,onTokenChange:T,walletType:Qs(r)?Dn:ja}),Qs(r)&&M.jsx(cP,{address:r.smartWalletAddress,currentActiveChain:m,selectedToken:v,onDeposit:a,onCopy:u,onClose:n}),wP(r)&&M.jsx(yP,{address:r.ethAddress,currentActiveChain:m,selectedToken:v,platformBalance:i,isLoading:t,wagmiHooks:c,onChainChange:y,onDeposit:a,onClose:n})]})})}),document.body):null},vP=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",fee:o="0.00",walletType:s="evm",receiverAddress:i="",onWithdrawAmountChange:c,onReceiverAddressChange:a,onAmountChanged:u,showPoolBalanceInsufficientTip:l=!1})=>{const{t:f}=Ut(),d=x.useMemo(()=>{if(!Ve(n==null?void 0:n.chainId)){const $=new $e(e||"0").minus(o||"0").decimalPlaces(2,$e.ROUND_DOWN);return $.isNegative()?"0.00":$.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),p=x.useMemo(()=>r||"0",[r]),h=$=>{const y=$.target.value,B=nu(y,p||"0");if(B.isValid)c(B.formattedValue),B.errorType;else return B.errorType==="exceed_balance",void 0;u==null||u(B.formattedValue)},m=()=>{c(p),u==null||u(p)},v=()=>{const $=parseFloat(r||"0"),y=parseFloat(e||"0");if(y>0){const T=$-y,B=At(Math.max(0,T).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[At(r||"0"),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),B," ",t]})}return`${At(r||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:e,onChange:h,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:m,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx(Vn,{content:f("withdraw.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:v()})]})]}),s==="mpc"&&!Ve(n==null?void 0:n.chainId)&&M.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:M.jsx("input",{type:"text",placeholder:f("withdraw.receiverAddress"),value:i,onChange:$=>a==null?void 0:a($.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),M.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Ve(n==null?void 0:n.chainId)?M.jsxs(M.Fragment,{children:[M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.noticeDesc")}),M.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:f("withdraw.commonWithdraw")})]}):M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.crossChainTips")})}),l&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f("withdraw.poolBalanceInsufficientTip")})]}),M.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[M.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[M.jsx(Vn,{content:M.jsxs("div",{children:[M.jsx("div",{children:f("withdraw.speedNote")}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(To,{selectedLevel:Pt.FAST,maxLevel:3}),M.jsx("span",{children:f("withdraw.speedNoteSpeed1")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(To,{selectedLevel:Pt.Medium,maxLevel:3}),M.jsx("span",{children:f("withdraw.speedNoteSpeed2")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(To,{selectedLevel:Pt.SLOW,maxLevel:3}),M.jsx("span",{children:f("withdraw.speedNoteSpeed3")})]})]}),children:M.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:f("withdraw.speed")})}),M.jsx("div",{className:"flex items-center",children:M.jsx(To,{selectedLevel:Ve(n==null?void 0:n.chainId)?Pt.SLOW:Pt.FAST,maxLevel:3})})]}),!Ve(n==null?void 0:n.chainId)&&M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx(Vn,{content:f("withdraw.feeCalculationTip"),children:M.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:f("withdraw.fee")})}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:f(Ve(n==null?void 0:n.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[At(d)," ",t]})]})]})]})},xP=[],EP={};let qe=null;const j0=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=x.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),d=x.useCallback(()=>n,[n]),p=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:d,isLoading:p}),[a,l,u,f,d,p]),x.useEffect(()=>(qe={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:d,isLoading:p},()=>{qe=null}),[a,l,u,f,d,p]),M.jsx(W0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||xP,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||EP,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged})});j0.displayName="WithdrawManager";const _0=e=>{if(!qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}qe.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},U0=()=>{if(!qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}qe.closeWithdraw()},z0=e=>{if(!qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}qe.updateWithdrawOptions(e)},Js=e=>{if(!qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}qe.setWithdrawLoading(e)},SP=()=>qe?qe.isOpen():!1,H0=()=>qe?qe.isLoading():!1,PP=()=>({openWithdraw:_0,closeWithdraw:U0,updateWithdrawOptions:z0,setWithdrawLoading:Js,isOpen:SP,isLoading:H0}),AP=({address:e,walletType:t,chains:n,defaultChainId:r,defaultTokenAddress:o,defaultAmount:s="",metadata:i,currentEquity:c,platformBalance:a="0",fee:u="0.00",isLoading:l=!1,wagmiHooks:f,onWithdraw:d,onClose:p,onChainChange:h,onTokenChange:m,onAmountChanged:v})=>{var Ee;const{t:$}=Ut(),y=x.useMemo(()=>{const X=[56,97],Q=re=>n==null?void 0:n.find(ue=>Number(ue==null?void 0:ue.chainId)===re),se=Q(X[0])||Q(X[1]);return se==null?void 0:se.rpcUrl},[n]),T=x.useMemo(()=>{const X=[42161,421614],Q=re=>n==null?void 0:n.find(ue=>Number(ue==null?void 0:ue.chainId)===re),se=Q(X[0])||Q(X[1]);return se==null?void 0:se.rpcUrl},[n]),{ARB_USDC_BALANCE:B,ARB_USDT_BALANCE:L,BNB_USDT_BALANCE:_}=Kv({bscRpcUrl:y,arbitrumRpcUrl:T}),[F,g]=x.useState(()=>{var X;return!n||n.length===0?1:r||((X=n[0])==null?void 0:X.chainId)||1}),[w,A]=x.useState(()=>{var re;if(!n||n.length===0)return"";const X=r||((re=n[0])==null?void 0:re.chainId),Q=n.find(ue=>ue.chainId===X);if(!Q||!Q.tokenList||Q.tokenList.length===0)return"";const se=Q.tokenList.find(ue=>ue.tokenAddress===o)||Q.tokenList[0];return(se==null?void 0:se.token)||""}),[I,N]=x.useState(s),[P,S]=x.useState(""),E=x.useCallback(X=>{g(X),h==null||h(X)},[h]),C=x.useCallback(X=>{A(X),m==null||m(X)},[m]),O=x.useRef(!0),b=x.useRef(w),k=x.useRef(F);x.useEffect(()=>{if(O.current){O.current=!1,b.current=w,k.current=F;return}(b.current!==w||k.current!==F)&&(N(""),b.current=w,k.current=F)},[w,F]);const D=n&&n.length>0?n.find(X=>X.chainId===F)||n[0]:null,j=(Ee=D==null?void 0:D.tokenList)==null?void 0:Ee.find(X=>X.token===w),{multicallResult:z,queryComponents:W}=R0({account:e,chainId:F,contractAddress:void 0,tokens:(D==null?void 0:D.tokenList)||[],wagmiHooks:f}),K=x.useMemo(()=>{var Q;if(!j)return;if(!j.tokenAddress||j.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return z.baseTokenBalance.formatted;const X=z.combinedData[j.tokenAddress];return((Q=X==null?void 0:X.balance)==null?void 0:Q.formatted)||"0"},[j,z]),H=X=>{if(!X)return"0";const Q=X.indexOf(".");return Q>=0?X.slice(0,Q):X},Z=x.useMemo(()=>{const X=(w||"").toUpperCase(),Q=Number(F),se=re=>{const ue=H(re);try{const vn=new $e(ue||"0").minus(1e4);return vn.isGreaterThan(0)?vn.toFixed(0):"0"}catch{return"0"}};if(Ve(Q))return"∞";if(Q===42161||Q===421614){if(X==="USDT")return se(L);if(X==="USDC")return se(B)}return Q===56&&X==="USDT"?se(_):"0"},[F,w,B,L,_]),q=x.useMemo(()=>{if(Ve(F))return!1;try{const X=new $e(I||"0"),Q=new $e((Z||"0").toString());return X.isGreaterThan(Q)}catch{return!1}},[F,I,Z]),J=x.useMemo(()=>{const X={},Q=(w||"").toUpperCase(),se=re=>{const ue=H(re);try{const vn=new $e(ue||"0").minus(1e4);return vn.isGreaterThan(0)?vn.toFixed(0):"0"}catch{return"0"}};return(n||[]).forEach(re=>{const ue=Number(re==null?void 0:re.chainId);if(ue){if(Ve(ue)){X[ue]="∞";return}if(ue===42161||ue===421614){Q==="USDT"?X[ue]=se(L):Q==="USDC"?X[ue]=se(B):X[ue]="0";return}if(ue===56){Q==="USDT"?X[ue]=se(_):X[ue]="0";return}X[ue]="0"}}),X},[n,w,B,L,_]),te=x.useMemo(()=>{const X=new $e(I||"0"),Q=new $e(u||"0"),se=Ve(F);let re=!1;if(!se)try{const ue=new $e((Z||"0").toString());re=X.isGreaterThan(ue)}catch{re=!1}return!I||X.isZero()||!se&&X.isLessThan(Q)||!se&&re?{text:$("withdraw.confirmWithdraw"),disabled:!0}:t==="mpc"&&!se&&!P.trim()?{text:$("withdraw.invalidReceiverAddress"),disabled:!0}:{text:$("withdraw.confirmWithdraw"),disabled:!1}},[$,F,I,t,P,u,Z]),pe=x.useCallback(async()=>{Js(!0);try{if(d){const Q={amount:new $e(I||"0").toString(),chainId:F,tokenAddress:(j==null?void 0:j.tokenAddress)||"",tokenSymbol:w};t==="mpc"&&!Ve(F)&&(Q.receiverAddress=P),d(Q)}}catch{Js(!1)}},[d,I,F,j==null?void 0:j.tokenAddress,w,t,P]);return!n||n.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):D?M.jsxs(M.Fragment,{children:[W,M.jsx(Vh,{currentActiveChain:D,chainList:n,chainPoolBalances:J,onChainChange:E,curSelectToken:w,onTokenChange:C,walletType:"EVM",txType:"withdraw"}),M.jsxs("div",{className:"p-3 my-4 bg-fill-input-primary rounded-lg flex items-center justify-between h-[38px]",children:[M.jsx("div",{className:"text-text-secondary text-sm",children:Ve(F)?$("withdraw.poolBalance"):$("withdraw.crossChainPoolBalance")}),M.jsxs("div",{className:"text-text-primary text-sm font-medium",children:[Z," ",w]})]}),M.jsx(vP,{withdrawAmount:I,curSelectToken:w,curSelectTokenData:{balance:j==null?void 0:j.balance,allowance:j==null?void 0:j.allowance},currentActiveChain:D,currentEquity:c||0,amount:I,decimals:(j==null?void 0:j.decimals)||6,tokenBalance:K,platformBalance:a,fee:u,walletType:t,receiverAddress:P,onWithdrawAmountChange:N,onReceiverAddressChange:S,onAmountChanged:v,showPoolBalanceInsufficientTip:q,poolBalanceMap:J}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${te.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:pe,disabled:te.disabled||l,children:[l&&M.jsx(No,{size:"xs"}),te.text]})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},W0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o,chains:s,defaultChainId:i,defaultTokenAddress:c,defaultAmount:a="",metadata:u,currentEquity:l=5e3,platformBalance:f="0",fee:d,wagmiHooks:p,onWithdraw:h,onChainChange:m,onTokenChange:v,onAmountChanged:$})=>{const{t:y}=Ut();return e?Me.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:T=>{T.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:y("withdraw.withdraw")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(zd,{className:"h-4 w-4"})})]}),M.jsx(AP,{chains:s,address:Qs(o)?o.smartWalletAddress:o.ethAddress,walletType:Qs(o)?"mpc":"evm",defaultChainId:i,defaultTokenAddress:c,defaultAmount:a,metadata:u,currentEquity:l,platformBalance:f,fee:d,isLoading:t,wagmiHooks:p,onWithdraw:h,onClose:n,onChainChange:m,onTokenChange:v,onAmountChanged:$})]})})}),document.body):null};ae.ChromeLoader=No,ae.ComponentProvider=mm,ae.DEFAULT_LOCALE=Bo,ae.Deposit=F0,ae.DepositManager=N0,ae.LOCALE_NAMES=dm,ae.LoadingSpinner=No,ae.SUPPORTED_LOCALES=ri,ae.Tooltip=Vn,ae.Withdraw=W0,ae.WithdrawManager=j0,ae.closeDeposit=B0,ae.closeWithdraw=U0,ae.formatThousands=bm,ae.isDepositLoading=L0,ae.isWithdrawLoading=H0,ae.openDeposit=k0,ae.openWithdraw=_0,ae.setDepositLoading=Xs,ae.setWithdrawLoading=Js,ae.updateDepositOptions=M0,ae.updateWithdrawOptions=z0,ae.useComponentConfig=mu,ae.useDeposit=Yv,ae.useDepositManager=hP,ae.useTranslation=Ut,ae.useWithdraw=Xv,ae.useWithdrawManager=PP,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"})});
152
152
  //# sourceMappingURL=index.umd.js.map