@edgex-web/components 0.1.0-beta.45 → 0.1.0-beta.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
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={};/**
1
+ (function(ie,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):(ie=typeof globalThis<"u"?globalThis:ie||self,x(ie.EdgeXComponents={},ie.React,ie.ReactDOM))})(this,function(ie,x,Le){"use strict";var ZP=Object.defineProperty;var KP=(ie,x,Le)=>x in ie?ZP(ie,x,{enumerable:!0,configurable:!0,writable:!0,value:Le}):ie[x]=Le;var Lo=(ie,x,Le)=>KP(ie,typeof x!="symbol"?x+"":x,Le);function du(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 z=du(x),Ir=du(Le);function im(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oi={exports:{}},Nr={};/**
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 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={};/**
9
+ */var pu;function am(){if(pu)return Nr;pu=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,d={},f=null,p=null;u!==void 0&&(f=""+u),a.key!==void 0&&(f=""+a.key),a.ref!==void 0&&(p=a.ref);for(l in a)r.call(a,l)&&!s.hasOwnProperty(l)&&(d[l]=a[l]);if(c&&c.defaultProps)for(l in a=c.defaultProps,a)d[l]===void 0&&(d[l]=a[l]);return{$$typeof:t,type:c,key:f,ref:p,props:d,_owner:o.current}}return Nr.Fragment=n,Nr.jsx=i,Nr.jsxs=i,Nr}var kr={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,95 +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 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 ce=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(ce);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(ce.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(ce.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)ce.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`
17
+ */var hu;function cm(){return hu||(hu=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"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function w(R){if(R===null||typeof R!="object")return null;var q=h&&R[h]||R[m];return typeof q=="function"?q:null}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(R){{for(var q=arguments.length,X=new Array(q>1?q-1:0),oe=1;oe<q;oe++)X[oe-1]=arguments[oe];$("error",R,X)}}function $(R,q,X){{var oe=T.ReactDebugCurrentFrame,he=oe.getStackAddendum();he!==""&&(q+="%s",X=X.concat([he]));var ge=X.map(function(fe){return String(fe)});ge.unshift("Warning: "+q),Function.prototype.apply.call(console[R],console,ge)}}var M=!1,L=!1,F=!1,j=!1,g=!1,v;v=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||j||R===p||M||L||F||typeof R=="object"&&R!==null&&(R.$$typeof===f||R.$$typeof===d||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===v||R.getModuleId!==void 0))}function N(R,q,X){var oe=R.displayName;if(oe)return oe;var he=q.displayName||q.name||"";return he!==""?X+"("+he+")":X}function I(R){return R.displayName||"Context"}function P(R){if(R==null)return null;if(typeof R.tag=="number"&&b("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 q=R;return I(q)+".Consumer";case i:var X=R;return I(X._context)+".Provider";case a:return N(R,R.render,"ForwardRef");case d:var oe=R.displayName||null;return oe!==null?oe:P(R.type)||"Memo";case f:{var he=R,ge=he._payload,fe=he._init;try{return P(fe(ge))}catch{return null}}}return null}var S=Object.assign,E=0,C,O,y,k,D,U,_;function H(){}H.__reactDisabledLog=!0;function K(){{if(E===0){C=console.log,O=console.info,y=console.warn,k=console.error,D=console.group,U=console.groupCollapsed,_=console.groupEnd;var R={configurable:!0,enumerable:!0,value:H,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}E++}}function W(){{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:y}),error:S({},R,{value:k}),group:S({},R,{value:D}),groupCollapsed:S({},R,{value:U}),groupEnd:S({},R,{value:_})})}E<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Z=T.ReactCurrentDispatcher,G;function J(R,q,X){{if(G===void 0)try{throw Error()}catch(he){var oe=he.stack.trim().match(/\n( *(at )?)/);G=oe&&oe[1]||""}return`
18
+ `+G+R}}var ne=!1,le;{var Se=typeof WeakMap=="function"?WeakMap:Map;le=new Se}function Me(R,q){if(!R||ne)return"";{var X=le.get(R);if(X!==void 0)return X}var oe;ne=!0;var he=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=Z.current,Z.current=null,K();try{if(q){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(Ke){oe=Ke}Reflect.construct(R,[],fe)}else{try{fe.call()}catch(Ke){oe=Ke}R.call(fe.prototype)}}else{try{throw Error()}catch(Ke){oe=Ke}R()}}catch(Ke){if(Ke&&oe&&typeof Ke.stack=="string"){for(var ce=Ke.stack.split(`
19
+ `),je=oe.stack.split(`
20
+ `),Pe=ce.length-1,Ae=je.length-1;Pe>=1&&Ae>=0&&ce[Pe]!==je[Ae];)Ae--;for(;Pe>=1&&Ae>=0;Pe--,Ae--)if(ce[Pe]!==je[Ae]){if(Pe!==1||Ae!==1)do if(Pe--,Ae--,Ae<0||ce[Pe]!==je[Ae]){var pt=`
21
+ `+ce[Pe].replace(" at new "," at ");return R.displayName&&pt.includes("<anonymous>")&&(pt=pt.replace("<anonymous>",R.displayName)),typeof R=="function"&&le.set(R,pt),pt}while(Pe>=1&&Ae>=0);break}}}finally{ne=!1,Z.current=ge,W(),Error.prepareStackTrace=he}var Or=R?R.displayName||R.name:"",Kn=Or?J(Or):"";return typeof R=="function"&&le.set(R,Kn),Kn}function Y(R,q,X){return Me(R,!1)}function ee(R){var q=R.prototype;return!!(q&&q.isReactComponent)}function Q(R,q,X){if(R==null)return"";if(typeof R=="function")return Me(R,ee(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 Y(R.render);case d:return Q(R.type,q,X);case f:{var oe=R,he=oe._payload,ge=oe._init;try{return Q(ge(he),q,X)}catch{}}}return""}var me=Object.prototype.hasOwnProperty,de={},qn=T.ReactDebugCurrentFrame;function Je(R){if(R){var q=R._owner,X=Q(R.type,R._source,q?q.type:null);qn.setExtraStackFrame(X)}else qn.setExtraStackFrame(null)}function Zn(R,q,X,oe,he){{var ge=Function.call.bind(me);for(var fe in R)if(ge(R,fe)){var ce=void 0;try{if(typeof R[fe]!="function"){var je=Error((oe||"React class")+": "+X+" type `"+fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw je.name="Invariant Violation",je}ce=R[fe](q,fe,oe,X,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Pe){ce=Pe}ce&&!(ce instanceof Error)&&(Je(he),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).",oe||"React class",X,fe,typeof ce),Je(null)),ce instanceof Error&&!(ce.message in de)&&(de[ce.message]=!0,Je(he),b("Failed %s type: %s",X,ce.message),Je(null))}}}var ri=Array.isArray;function su(R){return ri(R)}function CP(R){{var q=typeof Symbol=="function"&&Symbol.toStringTag,X=q&&R[Symbol.toStringTag]||R.constructor.name||"Object";return X}}function OP(R){try{return q0(R),!1}catch{return!0}}function q0(R){return""+R}function Z0(R){if(OP(R))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",CP(R)),q0(R)}var K0=T.ReactCurrentOwner,IP={key:!0,ref:!0,__self:!0,__source:!0},Y0,X0;function NP(R){if(me.call(R,"ref")){var q=Object.getOwnPropertyDescriptor(R,"ref").get;if(q&&q.isReactWarning)return!1}return R.ref!==void 0}function kP(R){if(me.call(R,"key")){var q=Object.getOwnPropertyDescriptor(R,"key").get;if(q&&q.isReactWarning)return!1}return R.key!==void 0}function BP(R,q){typeof R.ref=="string"&&K0.current}function MP(R,q){{var X=function(){Y0||(Y0=!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)",q))};X.isReactWarning=!0,Object.defineProperty(R,"key",{get:X,configurable:!0})}}function LP(R,q){{var X=function(){X0||(X0=!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)",q))};X.isReactWarning=!0,Object.defineProperty(R,"ref",{get:X,configurable:!0})}}var RP=function(R,q,X,oe,he,ge,fe){var ce={$$typeof:t,type:R,key:q,ref:X,props:fe,_owner:ge};return ce._store={},Object.defineProperty(ce._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ce,"_self",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.defineProperty(ce,"_source",{configurable:!1,enumerable:!1,writable:!1,value:he}),Object.freeze&&(Object.freeze(ce.props),Object.freeze(ce)),ce};function DP(R,q,X,oe,he){{var ge,fe={},ce=null,je=null;X!==void 0&&(Z0(X),ce=""+X),kP(q)&&(Z0(q.key),ce=""+q.key),NP(q)&&(je=q.ref,BP(q,he));for(ge in q)me.call(q,ge)&&!IP.hasOwnProperty(ge)&&(fe[ge]=q[ge]);if(R&&R.defaultProps){var Pe=R.defaultProps;for(ge in Pe)fe[ge]===void 0&&(fe[ge]=Pe[ge])}if(ce||je){var Ae=typeof R=="function"?R.displayName||R.name||"Unknown":R;ce&&MP(fe,Ae),je&&LP(fe,Ae)}return RP(R,ce,je,he,oe,K0.current,fe)}}var iu=T.ReactCurrentOwner,Q0=T.ReactDebugCurrentFrame;function Cr(R){if(R){var q=R._owner,X=Q(R.type,R._source,q?q.type:null);Q0.setExtraStackFrame(X)}else Q0.setExtraStackFrame(null)}var au;au=!1;function cu(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function J0(){{if(iu.current){var R=P(iu.current.type);if(R)return`
22
22
 
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=`
23
+ Check the render method of \``+R+"`."}return""}}function FP(R){return""}var em={};function jP(R){{var q=J0();if(!q){var X=typeof R=="string"?R:R.displayName||R.name;X&&(q=`
24
24
 
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(ce.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:
25
+ Check the top-level render call using <`+X+">.")}return q}}function tm(R,q){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var X=jP(q);if(em[X])return;em[X]=!0;var oe="";R&&R._owner&&R._owner!==iu.current&&(oe=" It was passed a child from "+P(R._owner.type)+"."),Cr(R),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',X,oe),Cr(null)}}function nm(R,q){{if(typeof R!="object")return;if(su(R))for(var X=0;X<R.length;X++){var oe=R[X];cu(oe)&&tm(oe,q)}else if(cu(R))R._store&&(R._store.validated=!0);else if(R){var he=w(R);if(typeof he=="function"&&he!==R.entries)for(var ge=he.call(R),fe;!(fe=ge.next()).done;)cu(fe.value)&&tm(fe.value,q)}}}function _P(R){{var q=R.type;if(q==null||typeof q=="string")return;var X;if(typeof q=="function")X=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===d))X=q.propTypes;else return;if(X){var oe=P(q);Zn(X,R.props,"prop",oe,R)}else if(q.PropTypes!==void 0&&!au){au=!0;var he=P(q);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",he||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function UP(R){{for(var q=Object.keys(R.props),X=0;X<q.length;X++){var oe=q[X];if(oe!=="children"&&oe!=="key"){Cr(R),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",oe),Cr(null);break}}R.ref!==null&&(Cr(R),b("Invalid attribute `ref` supplied to `React.Fragment`."),Cr(null))}}var rm={};function om(R,q,X,oe,he,ge){{var fe=A(R);if(!fe){var ce="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(ce+=" 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 je=FP();je?ce+=je:ce+=J0();var Pe;R===null?Pe="null":su(R)?Pe="array":R!==void 0&&R.$$typeof===t?(Pe="<"+(P(R.type)||"Unknown")+" />",ce=" Did you accidentally export a JSX literal instead of a component?"):Pe=typeof R,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Pe,ce)}var Ae=DP(R,q,X,he,ge);if(Ae==null)return Ae;if(fe){var pt=q.children;if(pt!==void 0)if(oe)if(su(pt)){for(var Or=0;Or<pt.length;Or++)nm(pt[Or],R);Object.freeze&&Object.freeze(pt)}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 nm(pt,R)}if(me.call(q,"key")){var Kn=P(R),Ke=Object.keys(q).filter(function(qP){return qP!=="key"}),uu=Ke.length>0?"{key: someKey, "+Ke.join(": ..., ")+": ...}":"{key: someKey}";if(!rm[Kn+uu]){var GP=Ke.length>0?"{"+Ke.join(": ..., ")+": ...}":"{}";b(`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} />`,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}:
30
+ <%s key={someKey} {...props} />`,uu,Kn,GP,Kn),rm[Kn+uu]=!0}}return R===r?UP(Ae):_P(Ae),Ae}}function zP(R,q,X){return om(R,q,X,!0)}function HP(R,q,X){return om(R,q,X,!1)}var WP=HP,VP=zP;kr.Fragment=r,kr.jsx=WP,kr.jsxs=VP}()),kr}process.env.NODE_ENV==="production"?oi.exports=am():oi.exports=cm();var B=oi.exports;const um={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:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。"}},lm={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",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",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."}},fm={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:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"}},dm={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:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."}},pm={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:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"}},si=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],mu={"en-US":lm,"ja-JP":fm,"ru-RU":dm,"zh-CN":um,"zh-TW":pm},Ro="en-US",hm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},mm=e=>si.includes(e)?mu[e]:mu[Ro],gm=e=>si.includes(e),gu=x.createContext(null),bm=({config:e,children:t})=>{const n=x.useMemo(()=>{const r=e.locale||Ro,o=gm(r)?r:Ro,s=mm(o);return{...e,currentLocale:o,translations:s}},[e]);return B.jsx(gu.Provider,{value:n,children:t})},bu=()=>{const e=x.useContext(gu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var ym=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ii=Math.ceil,et=Math.floor,_e="[BigNumber Error] ",yu=_e+"Number primitive has more than 15 significant digits: ",ht=1e14,se=14,ai=9007199254740991,ci=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ln=1e7,Oe=1e9;function wu(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,d=1e7,f=!1,p=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},w="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function b(g,v){var A,N,I,P,S,E,C,O,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>d?y.c=y.e=null:g.e<l?y.c=[y.e=0]:(y.e=g.e,y.c=g.c.slice());return}if((E=typeof g=="number")&&g*0==0){if(y.s=1/g<0?(g=-g,-1):1,g===~~g){for(P=0,S=g;S>=10;S/=10,P++);P>d?y.c=y.e=null:(y.e=P,y.c=[g]);return}O=String(g)}else{if(!ym.test(O=String(g)))return r(y,O,E);y.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(v,2,w.length,"Base"),v==10&&T)return y=new b(g),F(y,i+y.e+1,c);if(O=String(g),E=typeof g=="number"){if(g*0!=0)return r(y,O,E,v);if(y.s=1/g<0?(O=O.slice(1),-1):1,b.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(yu+g)}else y.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(A=w.slice(0,v),P=S=0,C=O.length;S<C;S++)if(A.indexOf(N=O.charAt(S))<0){if(N=="."){if(S>P){P=C;continue}}else if(!I&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){I=!0,S=-1,P=0;continue}return r(y,String(g),E,v)}E=!1,O=n(O,v,10,y.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&&b.DEBUG&&C>15&&(g>ai||g!==et(g)))throw Error(yu+y.s*g);if((P=P-S-1)>d)y.c=y.e=null;else if(P<l)y.c=[y.e=0];else{if(y.e=P,y.c=[],S=(P+1)%se,P<0&&(S+=se),S<C){for(S&&y.c.push(+O.slice(0,S)),C-=se;S<C;)y.c.push(+O.slice(S,S+=se));S=se-(O=O.slice(S)).length}else S-=C;for(;S--;O+="0");y.c.push(+O)}}else y.c=[y.e=0]}b.clone=wu,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,A;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(v="DECIMAL_PLACES")&&(A=g[v],we(A,0,Oe,v),i=A),g.hasOwnProperty(v="ROUNDING_MODE")&&(A=g[v],we(A,0,8,v),c=A),g.hasOwnProperty(v="EXPONENTIAL_AT")&&(A=g[v],A&&A.pop?(we(A[0],-Oe,0,v),we(A[1],0,Oe,v),a=A[0],u=A[1]):(we(A,-Oe,Oe,v),a=-(u=A<0?-A:A))),g.hasOwnProperty(v="RANGE"))if(A=g[v],A&&A.pop)we(A[0],-Oe,-1,v),we(A[1],1,Oe,v),l=A[0],d=A[1];else if(we(A,-Oe,Oe,v),A)l=-(d=A<0?-A:A);else throw Error(_e+v+" cannot be zero: "+A);if(g.hasOwnProperty(v="CRYPTO"))if(A=g[v],A===!!A)if(A)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=A;else throw f=!A,Error(_e+"crypto unavailable");else f=A;else throw Error(_e+v+" not true or false: "+A);if(g.hasOwnProperty(v="MODULO_MODE")&&(A=g[v],we(A,0,9,v),p=A),g.hasOwnProperty(v="POW_PRECISION")&&(A=g[v],we(A,0,Oe,v),h=A),g.hasOwnProperty(v="FORMAT"))if(A=g[v],typeof A=="object")m=A;else throw Error(_e+v+" not an object: "+A);if(g.hasOwnProperty(v="ALPHABET"))if(A=g[v],typeof A=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(A))T=A.slice(0,10)=="0123456789",w=A;else throw Error(_e+v+" invalid: "+A)}else throw Error(_e+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,d],CRYPTO:f,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,A,N=g.c,I=g.e,P=g.s;e:if({}.toString.call(N)=="[object Array]"){if((P===1||P===-1)&&I>=-Oe&&I<=Oe&&I===et(I)){if(N[0]===0){if(I===0&&N.length===1)return!0;break e}if(v=(I+1)%se,v<1&&(v+=se),String(N[0]).length==v){for(v=0;v<N.length;v++)if(A=N[v],A<0||A>=ht||A!==et(A))break e;if(A!==0)return!0}}}else if(N===null&&I===null&&(P===null||P===1||P===-1))return!0;throw Error(_e+"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 et(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var N,I,P,S,E,C=0,O=[],y=new b(s);if(A==null?A=i:we(A,0,Oe),S=ii(A/se),f)if(crypto.getRandomValues){for(N=crypto.getRandomValues(new Uint32Array(S*=2));C<S;)E=N[C]*131072+(N[C+1]>>>11),E>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),N[C]=I[0],N[C+1]=I[1]):(O.push(E%1e14),C+=2);C=S/2}else if(crypto.randomBytes){for(N=crypto.randomBytes(S*=7);C<S;)E=(N[C]&31)*281474976710656+N[C+1]*1099511627776+N[C+2]*4294967296+N[C+3]*16777216+(N[C+4]<<16)+(N[C+5]<<8)+N[C+6],E>=9e15?crypto.randomBytes(7).copy(N,C):(O.push(E%1e14),C+=7);C=S/7}else throw f=!1,Error(_e+"crypto unavailable");if(!f)for(;C<S;)E=v(),E<9e15&&(O[C++]=E%1e14);for(S=O[--C],A%=se,S&&A&&(E=ci[se-A],O[C]=et(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-=se);for(C=1,E=O[0];E>=10;E/=10,C++);C<se&&(P-=se-C)}return y.e=P,y.c=O,y}}(),b.sum=function(){for(var g=1,v=arguments,A=new b(v[0]);g<v.length;)A=A.plus(v[g++]);return A},n=function(){var g="0123456789";function v(A,N,I,P){for(var S,E=[0],C,O=0,y=A.length;O<y;){for(C=E.length;C--;E[C]*=N);for(E[0]+=P.indexOf(A.charAt(O++)),S=0;S<E.length;S++)E[S]>I-1&&(E[S+1]==null&&(E[S+1]=0),E[S+1]+=E[S]/I|0,E[S]%=I)}return E.reverse()}return function(A,N,I,P,S){var E,C,O,y,k,D,U,_,H=A.indexOf("."),K=i,W=c;for(H>=0&&(y=h,h=0,A=A.replace(".",""),_=new b(N),D=_.pow(A.length-H),h=y,_.c=v(zt(nt(D.c),D.e,"0"),10,I,g),_.e=_.c.length),U=v(A,N,I,S?(E=w,g):(E=g,w)),O=y=U.length;U[--y]==0;U.pop());if(!U[0])return E.charAt(0);if(H<0?--O:(D.c=U,D.e=O,D.s=P,D=t(D,_,K,W,I),U=D.c,k=D.r,O=D.e),C=O+K+1,H=U[C],y=I/2,k=k||C<0||U[C+1]!=null,k=W<4?(H!=null||k)&&(W==0||W==(D.s<0?3:2)):H>y||H==y&&(W==4||k||W==6&&U[C-1]&1||W==(D.s<0?8:7)),C<1||!U[0])A=k?zt(E.charAt(1),-K,E.charAt(0)):E.charAt(0);else{if(U.length=C,k)for(--I;++U[--C]>I;)U[C]=0,C||(++O,U=[1].concat(U));for(y=U.length;!U[--y];);for(H=0,A="";H<=y;A+=E.charAt(U[H++]));A=zt(A,O,E.charAt(0))}return A}}(),t=function(){function g(N,I,P){var S,E,C,O,y=0,k=N.length,D=I%ln,U=I/ln|0;for(N=N.slice();k--;)C=N[k]%ln,O=N[k]/ln|0,S=U*C+O*D,E=D*C+S%ln*ln+y,y=(E/P|0)+(S/ln|0)+U*O,N[k]=E%P;return y&&(N=[y].concat(N)),N}function v(N,I,P,S){var E,C;if(P!=S)C=P>S?1:-1;else for(E=C=0;E<P;E++)if(N[E]!=I[E]){C=N[E]>I[E]?1:-1;break}return C}function A(N,I,P,S){for(var E=0;P--;)N[P]-=E,E=N[P]<I[P]?1:0,N[P]=E*S+N[P]-I[P];for(;!N[0]&&N.length>1;N.splice(0,1));}return function(N,I,P,S,E){var C,O,y,k,D,U,_,H,K,W,Z,G,J,ne,le,Se,Me,Y=N.s==I.s?1:-1,ee=N.c,Q=I.c;if(!ee||!ee[0]||!Q||!Q[0])return new b(!N.s||!I.s||(ee?Q&&ee[0]==Q[0]:!Q)?NaN:ee&&ee[0]==0||!Q?Y*0:Y/0);for(H=new b(Y),K=H.c=[],O=N.e-I.e,Y=P+O+1,E||(E=ht,O=tt(N.e/se)-tt(I.e/se),Y=Y/se|0),y=0;Q[y]==(ee[y]||0);y++);if(Q[y]>(ee[y]||0)&&O--,Y<0)K.push(1),k=!0;else{for(ne=ee.length,Se=Q.length,y=0,Y+=2,D=et(E/(Q[0]+1)),D>1&&(Q=g(Q,D,E),ee=g(ee,D,E),Se=Q.length,ne=ee.length),J=Se,W=ee.slice(0,Se),Z=W.length;Z<Se;W[Z++]=0);Me=Q.slice(),Me=[0].concat(Me),le=Q[0],Q[1]>=E/2&&le++;do{if(D=0,C=v(Q,W,Se,Z),C<0){if(G=W[0],Se!=Z&&(G=G*E+(W[1]||0)),D=et(G/le),D>1)for(D>=E&&(D=E-1),U=g(Q,D,E),_=U.length,Z=W.length;v(U,W,_,Z)==1;)D--,A(U,Se<_?Me:Q,_,E),_=U.length,C=1;else D==0&&(C=D=1),U=Q.slice(),_=U.length;if(_<Z&&(U=[0].concat(U)),A(W,U,Z,E),Z=W.length,C==-1)for(;v(Q,W,Se,Z)<1;)D++,A(W,Se<Z?Me:Q,Z,E),Z=W.length}else C===0&&(D++,W=[0]);K[y++]=D,W[0]?W[Z++]=ee[J]||0:(W=[ee[J]],Z=1)}while((J++<ne||W[0]!=null)&&Y--);k=W[0]!=null,K[0]||K.splice(0,1)}if(E==ht){for(y=1,Y=K[0];Y>=10;Y/=10,y++);F(H,P+(H.e=y+O*se-1)+1,S,k)}else H.e=O,H.r=+k;return H}}();function $(g,v,A,N){var I,P,S,E,C;if(A==null?A=c:we(A,0,8),!g.c)return g.toString();if(I=g.c[0],S=g.e,v==null)C=nt(g.c),C=N==1||N==2&&(S<=a||S>=u)?Fo(C,S):zt(C,S,"0");else if(g=F(new b(g),v,A),P=g.e,C=nt(g.c),E=C.length,N==1||N==2&&(v<=P||P<=a)){for(;E<v;C+="0",E++);C=Fo(C,P)}else if(v-=S+(N===2&&P>S),C=zt(C,P,"0"),P+1>E){if(--v>0)for(C+=".";v--;C+="0");}else if(v+=P-E,v>0)for(P+1==E&&(C+=".");v--;C+="0");return g.s<0&&I?"-"+C:C}function M(g,v){for(var A,N,I=1,P=new b(g[0]);I<g.length;I++)N=new b(g[I]),(!N.s||(A=En(P,N))===v||A===0&&P.s===v)&&(P=N);return P}function L(g,v,A){for(var N=1,I=v.length;!v[--I];v.pop());for(I=v[0];I>=10;I/=10,N++);return(A=N+A*se-1)>d?g.c=g.e=null:A<l?g.c=[g.e=0]:(g.e=A,g.c=v),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,A=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(P,S,E,C){var O,y=E?S:S.replace(I,"");if(N.test(y))P.s=isNaN(y)?null:y<0?-1:1;else{if(!E&&(y=y.replace(g,function(k,D,U){return O=(U=U.toLowerCase())=="x"?16:U=="b"?2:8,!C||C==O?D:k}),C&&(O=C,y=y.replace(v,"$1").replace(A,"0.$1")),S!=y))return new b(y,O);if(b.DEBUG)throw Error(_e+"Not a"+(C?" base "+C:"")+" number: "+S);P.s=null}P.c=P.e=null}}();function F(g,v,A,N){var I,P,S,E,C,O,y,k=g.c,D=ci;if(k){e:{for(I=1,E=k[0];E>=10;E/=10,I++);if(P=v-I,P<0)P+=se,S=v,C=k[O=0],y=et(C/D[I-S-1]%10);else if(O=ii((P+1)/se),O>=k.length)if(N){for(;k.length<=O;k.push(0));C=y=0,I=1,P%=se,S=P-se+1}else break e;else{for(C=E=k[O],I=1;E>=10;E/=10,I++);P%=se,S=P-se+I,y=S<0?0:et(C/D[I-S-1]%10)}if(N=N||v<0||k[O+1]!=null||(S<0?C:C%D[I-S-1]),N=A<4?(y||N)&&(A==0||A==(g.s<0?3:2)):y>5||y==5&&(A==4||N||A==6&&(P>0?S>0?C/D[I-S]:0:k[O-1])%10&1||A==(g.s<0?8:7)),v<1||!k[0])return k.length=0,N?(v-=g.e+1,k[0]=D[(se-v%se)%se],g.e=-v||0):k[0]=g.e=0,g;if(P==0?(k.length=O,E=1,O--):(k.length=O+1,E=D[se-P],k[O]=S>0?et(C/D[I-S]%D[S])*E:0),N)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]==ht&&(k[0]=1));break}else{if(k[O]+=E,k[O]!=ht)break;k[O--]=0,E=1}for(P=k.length;k[--P]===0;k.pop());}g.e>d?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function j(g){var v,A=g.e;return A===null?g.toString():(v=nt(g.c),v=A<=a||A>=u?Fo(v,A):zt(v,A,"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 En(this,new b(g,v))},o.decimalPlaces=o.dp=function(g,v){var A,N,I,P=this;if(g!=null)return we(g,0,Oe),v==null?v=c:we(v,0,8),F(new b(P),g+P.e+1,v);if(!(A=P.c))return null;if(N=((I=A.length-1)-tt(this.e/se))*se,I=A[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 A,N,I,P,S,E,C,O,y,k=this;if(g=new b(g),g.c&&!g.isInteger())throw Error(_e+"Exponent not an integer: "+j(g));if(v!=null&&(v=new b(v)),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 y=new b(Math.pow(+j(k),E?g.s*(2-Do(g)):+j(g))),v?y.mod(v):y;if(C=g.s<0,v){if(v.c?!v.c[0]:!v.s)return new b(NaN);N=!C&&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||E&&k.c[1]>=24e7:k.c[0]<8e13||E&&k.c[0]<=9999975e7)))return P=k.s<0&&Do(g)?-0:0,k.e>-1&&(P=1/P),new b(C?1/P:P);h&&(P=ii(h/se+2))}for(E?(A=new b(.5),C&&(g.s=1),O=Do(g)):(I=Math.abs(+j(g)),O=I%2),y=new b(s);;){if(O){if(y=y.times(k),!y.c)break;P?y.c.length>P&&(y.c.length=P):N&&(y=y.mod(v))}if(I){if(I=et(I/2),I===0)break;O=I%2}else if(g=g.times(A),F(g,g.e+1,1),g.e>14)O=Do(g);else{if(I=+j(g),I===0)break;O=I%2}k=k.times(k),P?k.c&&k.c.length>P&&(k.c.length=P):N&&(k=k.mod(v))}return N?y:(C&&(y=s.div(y)),v?y.mod(v):P?F(y,h,c,S):y)},o.integerValue=function(g){var v=new b(this);return g==null?g=c:we(g,0,8),F(v,v.e+1,g)},o.isEqualTo=o.eq=function(g,v){return En(this,new b(g,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,v){return En(this,new b(g,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,v){return(v=En(this,new b(g,v)))===1||v===0},o.isInteger=function(){return!!this.c&&tt(this.e/se)>this.c.length-2},o.isLessThan=o.lt=function(g,v){return En(this,new b(g,v))<0},o.isLessThanOrEqualTo=o.lte=function(g,v){return(v=En(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 A,N,I,P,S=this,E=S.s;if(g=new b(g,v),v=g.s,!E||!v)return new b(NaN);if(E!=v)return g.s=-v,S.plus(g);var C=S.e/se,O=g.e/se,y=S.c,k=g.c;if(!C||!O){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(C=tt(C),O=tt(O),y=y.slice(),E=C-O){for((P=E<0)?(E=-E,I=y):(O=C,I=k),I.reverse(),v=E;v--;I.push(0));I.reverse()}else for(N=(P=(E=y.length)<(v=k.length))?E:v,E=v=0;v<N;v++)if(y[v]!=k[v]){P=y[v]<k[v];break}if(P&&(I=y,y=k,k=I,g.s=-g.s),v=(N=k.length)-(A=y.length),v>0)for(;v--;y[A++]=0);for(v=ht-1;N>E;){if(y[--N]<k[N]){for(A=N;A&&!y[--A];y[A]=v);--y[A],y[N]+=ht}y[N]-=k[N]}for(;y[0]==0;y.splice(0,1),--O);return y[0]?L(g,y,O):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,v){var A,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,A=t(I,g,0,3),g.s=N,A.s*=N):A=t(I,g,0,p),g=I.minus(A.times(g)),!g.c[0]&&p==1&&(g.s=I.s),g)},o.multipliedBy=o.times=function(g,v){var A,N,I,P,S,E,C,O,y,k,D,U,_,H,K,W=this,Z=W.c,G=(g=new b(g,v)).c;if(!Z||!G||!Z[0]||!G[0])return!W.s||!g.s||Z&&!Z[0]&&!G||G&&!G[0]&&!Z?g.c=g.e=g.s=null:(g.s*=W.s,!Z||!G?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(N=tt(W.e/se)+tt(g.e/se),g.s*=W.s,C=Z.length,k=G.length,C<k&&(_=Z,Z=G,G=_,I=C,C=k,k=I),I=C+k,_=[];I--;_.push(0));for(H=ht,K=ln,I=k;--I>=0;){for(A=0,D=G[I]%K,U=G[I]/K|0,S=C,P=I+S;P>I;)O=Z[--S]%K,y=Z[S]/K|0,E=U*O+y*D,O=D*O+E%K*K+_[P]+A,A=(O/H|0)+(E/K|0)+U*y,_[P--]=O%H;_[P]=A}return A?++N:_.splice(0,1),L(g,_,N)},o.negated=function(){var g=new b(this);return g.s=-g.s||null,g},o.plus=function(g,v){var A,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 P=N.e/se,S=g.e/se,E=N.c,C=g.c;if(!P||!S){if(!E||!C)return new b(I/0);if(!E[0]||!C[0])return C[0]?g:new b(E[0]?N:I*0)}if(P=tt(P),S=tt(S),E=E.slice(),I=P-S){for(I>0?(S=P,A=C):(I=-I,A=E),A.reverse();I--;A.push(0));A.reverse()}for(I=E.length,v=C.length,I-v<0&&(A=C,C=E,E=A,v=I),I=0;v;)I=(E[--v]=E[v]+C[v]+I)/ht|0,E[v]=ht===E[v]?0:E[v]%ht;return I&&(E=[I].concat(E),++S),L(g,E,S)},o.precision=o.sd=function(g,v){var A,N,I,P=this;if(g!=null&&g!==!!g)return we(g,1,Oe),v==null?v=c:we(v,0,8),F(new b(P),g,v);if(!(A=P.c))return null;if(I=A.length-1,N=I*se+1,I=A[I]){for(;I%10==0;I/=10,N--);for(I=A[0];I>=10;I/=10,N++);}return g&&P.e+1>N&&(N=P.e+1),N},o.shiftedBy=function(g){return we(g,-ai,ai),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,v,A,N,I,P=this,S=P.c,E=P.s,C=P.e,O=i+4,y=new b("0.5");if(E!==1||!S||!S[0])return new b(!E||E<0&&(!S||S[0])?NaN:S?P:1/0);if(E=Math.sqrt(+j(P)),E==0||E==1/0?(v=nt(S),(v.length+C)%2==0&&(v+="0"),E=Math.sqrt(+v),C=tt((C+1)/2)-(C<0||C%2),E==1/0?v="5e"+C:(v=E.toExponential(),v=v.slice(0,v.indexOf("e")+1)+C),A=new b(v)):A=new b(E+""),A.c[0]){for(C=A.e,E=C+O,E<3&&(E=0);;)if(I=A,A=y.times(I.plus(t(P,I,O,1))),nt(I.c).slice(0,E)===(v=nt(A.c)).slice(0,E))if(A.e<C&&--E,v=v.slice(E-3,E+1),v=="9999"||!N&&v=="4999"){if(!N&&(F(I,I.e+i+2,0),I.times(I).eq(P))){A=I;break}O+=4,E+=4,N=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(F(A,A.e+i+2,1),g=!A.times(A).eq(P));break}}return F(A,A.e+i+1,c,g)},o.toExponential=function(g,v){return g!=null&&(we(g,0,Oe),g++),$(this,g,v,1)},o.toFixed=function(g,v){return g!=null&&(we(g,0,Oe),g=g+this.e+1),$(this,g,v)},o.toFormat=function(g,v,A){var N,I=this;if(A==null)g!=null&&v&&typeof v=="object"?(A=v,v=null):g&&typeof g=="object"?(A=g,g=v=null):A=m;else if(typeof A!="object")throw Error(_e+"Argument not an object: "+A);if(N=I.toFixed(g,v),I.c){var P,S=N.split("."),E=+A.groupSize,C=+A.secondaryGroupSize,O=A.groupSeparator||"",y=S[0],k=S[1],D=I.s<0,U=D?y.slice(1):y,_=U.length;if(C&&(P=E,E=C,C=P,_-=P),E>0&&_>0){for(P=_%E||E,y=U.substr(0,P);P<_;P+=E)y+=O+U.substr(P,E);C>0&&(y+=O+U.slice(P)),D&&(y="-"+y)}N=k?y+(A.decimalSeparator||"")+((C=+A.fractionGroupSize)?k.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):k):y}return(A.prefix||"")+N+(A.suffix||"")},o.toFraction=function(g){var v,A,N,I,P,S,E,C,O,y,k,D,U=this,_=U.c;if(g!=null&&(E=new b(g),!E.isInteger()&&(E.c||E.s!==1)||E.lt(s)))throw Error(_e+"Argument "+(E.isInteger()?"out of range: ":"not an integer: ")+j(E));if(!_)return new b(U);for(v=new b(s),O=A=new b(s),N=C=new b(s),D=nt(_),P=v.e=D.length-U.e-1,v.c[0]=ci[(S=P%se)<0?se+S:S],g=!g||E.comparedTo(v)>0?P>0?v:O:E,S=d,d=1/0,E=new b(D),C.c[0]=0;y=t(E,v,0,1),I=A.plus(y.times(N)),I.comparedTo(g)!=1;)A=N,N=I,O=C.plus(y.times(I=O)),C=I,v=E.minus(y.times(I=v)),E=I;return I=t(g.minus(A),N,0,1),C=C.plus(I.times(O)),A=A.plus(I.times(N)),C.s=O.s=U.s,P=P*2,k=t(O,N,P,c).minus(U).abs().comparedTo(t(C,A,P,c).minus(U).abs())<1?[O,N]:[C,A],d=S,k},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,v){return g!=null&&we(g,1,Oe),$(this,g,v,2)},o.toString=function(g){var v,A=this,N=A.s,I=A.e;return I===null?N?(v="Infinity",N<0&&(v="-"+v)):v="NaN":(g==null?v=I<=a||I>=u?Fo(nt(A.c),I):zt(nt(A.c),I,"0"):g===10&&T?(A=F(new b(A),i+I+1,c),v=zt(nt(A.c),A.e,"0")):(we(g,2,w.length,"Base"),v=n(zt(nt(A.c),I,"0"),10,g,N,!0)),N<0&&A.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 tt(e){var t=e|0;return e>0||e===t?t:t-1}function nt(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=se-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function En(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!==et(e))throw Error(_e+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Do(e){var t=e.c.length-1;return tt(e.e/se)==t&&e.c[t]%2!=0}function Fo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function zt(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=wu();const wm=(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"}},Ht=()=>{const{translations:e,currentLocale:t}=bu();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 d=`{{${l}}}`;u=u.replace(new RegExp(d,"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}}}},vm="1.0.8";let Ye=class lu extends Error{constructor(t,n={}){var i;const r=n.cause instanceof lu?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof lu&&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@${vm}`].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 Wt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const vu=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,xu=/^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)?$/,Eu=/^\(.+?\).*?$/,Su=/^tuple(?<array>(\[(\d*)\])*)$/;function ui(e){let t=e.type;if(Su.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+=ui(s),o<n-1&&(t+=", ")}const r=Wt(Su,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,ui({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Br(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=ui(o),r!==n-1&&(t+=", ")}return t}function jo(e){var t;return e.type==="function"?`function ${e.name}(${Br(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Br(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Br(e.inputs)})`:e.type==="error"?`error ${e.name}(${Br(e.inputs)})`:e.type==="constructor"?`constructor(${Br(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Pu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function xm(e){return Pu.test(e)}function Em(e){return Wt(Pu,e)}const Au=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Sm(e){return Au.test(e)}function Pm(e){return Wt(Au,e)}const $u=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Am(e){return $u.test(e)}function $m(e){return Wt($u,e)}const Tu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function li(e){return Tu.test(e)}function Tm(e){return Wt(Tu,e)}const Cu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Cm(e){return Cu.test(e)}function Om(e){return Wt(Cu,e)}const Ou=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Im(e){return Ou.test(e)}function Nm(e){return Wt(Ou,e)}const km=/^receive\(\) external payable$/;function Bm(e){return km.test(e)}const Mm=new Set(["indexed"]),fi=new Set(["calldata","memory","storage"]);class Lm extends Ye{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Rm extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Dm extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Fm extends Ye{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class jm extends Ye{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class _m extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Um extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class zm extends Ye{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class Yn extends Ye{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Hm extends Ye{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Wm extends Ye{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Vm extends Ye{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Gm extends Ye{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function qm(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 di=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 pi(e,t={}){if(Am(e))return Zm(e,t);if(Sm(e))return Km(e,t);if(xm(e))return Ym(e,t);if(Cm(e))return Xm(e,t);if(Im(e))return Qm(e);if(Bm(e))return{type:"receive",stateMutability:"payable"};throw new Hm({signature:e})}function Zm(e,t={}){const n=$m(e);if(!n)throw new Yn({signature:e,type:"function"});const r=mt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Sn(r[c],{modifiers:fi,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(Sn(c[u],{modifiers:fi,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Km(e,t={}){const n=Pm(e);if(!n)throw new Yn({signature:e,type:"event"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Sn(r[i],{modifiers:Mm,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Ym(e,t={}){const n=Em(e);if(!n)throw new Yn({signature:e,type:"error"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Sn(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Xm(e,t={}){const n=Om(e);if(!n)throw new Yn({signature:e,type:"constructor"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Sn(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Qm(e){const t=Nm(e);if(!t)throw new Yn({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Jm=/^(?<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$_]*))?$/,eg=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,tg=/^u?int$/;function Sn(e,t){var d,f;const n=qm(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(di.has(n))return di.get(n);const r=Eu.test(e),o=Wt(r?eg:Jm,e);if(!o)throw new Fm({param:e});if(o.name&&rg(o.name))throw new jm({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(Sn(p[w],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(tg.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!Iu(a))throw new Dm({type:a});if(o.modifier){if(!((f=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&f.call(d,o.modifier)))throw new _m({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(fi.has(o.modifier)&&!og(a,!!o.array))throw new Um({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return di.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 Gm({current:n,depth:r});return t.push(n.trim()),t}function Iu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||vu.test(e)||xu.test(e)}const ng=/^(?: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 rg(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||vu.test(e)||xu.test(e)||ng.test(e)}function og(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Nu(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!li(c))continue;const a=Tm(c);if(!a)throw new Yn({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],d=u.length;for(let f=0;f<d;f++){const h=u[f].trim();if(!h)continue;const m=Sn(h,{type:"struct"});l.push(m)}if(!l.length)throw new Wm({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]=ku(a,t)}return r}const sg=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function ku(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(Eu.test(i.type))r.push(i);else{const a=Wt(sg,i.type);if(!(a!=null&&a.type))throw new zm({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Vm({type:l});r.push({...i,type:`tuple${u??""}`,components:ku(t[l]??[],t,new Set([...n,l]))})}else if(Iu(l))r.push(i);else throw new Rm({type:l})}}return r}function Bu(e){const t=Nu(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];li(s)||n.push(pi(s,t))}return n}function Mu(e){let t;if(typeof e=="string")t=pi(e);else{const n=Nu(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!li(s)){t=pi(s,n);break}}}if(!t)throw new Lm({signature:e});return t}function re(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 yg(e.type);return`${e.name}(${_o(e.inputs,{includeName:t})})`}function _o(e,{includeName:t=!1}={}){return e?e.map(n=>ig(n,{includeName:t})).join(t?", ":","):""}function ig(e,{includeName:t}){return e.type.startsWith("tuple")?`(${_o(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 xe(e){return bt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Lu="2.34.0";let Mr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Lu}`},V=class fu extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof fu?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof fu&&n.cause.docsPath||n.docsPath,s=(c=Mr.getDocsUrl)==null?void 0:c.call(Mr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Mr.version?[`Version: ${Mr.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=Lu}walk(t){return Ru(this,t)}};function Ru(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Ru(e.cause,t):t?null:e}class ag 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 Du 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 Fu 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: (${_o(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 Lr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class cg 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 ug 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 lg 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 fg 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 ju 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 _u 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 dg extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Uu 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 zu 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 Xn 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 Hu 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 pg 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 hg 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 mg=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Rr 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: (${_o(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 Uo 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(`
52
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class gg 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 bg 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 Wu=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
55
+ `),{name:"InvalidArrayError"})}};class yg extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
56
+ `),{name:"InvalidDefinitionTypeError"})}}class wg extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Vu=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"})}},Gu=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 qu 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 Qn(e,{dir:t,size:n=32}={}){return typeof e=="string"?fn(e,{dir:t,size:n}):vg(e,{dir:t,size:n})}function fn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Gu({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function vg(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Gu({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 Zu=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 xg 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 Eg 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 Sg=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Pn(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(xe(e)>t)throw new Sg({givenSize:xe(e),maxSize:t})}function Ct(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 Pg(e,t={}){let n=e;if(t.size&&(yt(n,{size:t.size}),n=Pn(n)),Pn(n)==="0x00")return!1;if(Pn(n)==="0x01")return!0;throw new Eg(n)}function Vt(e,t={}){return Number(Ct(e,t))}const Ag=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Gt(e,t={}){return typeof e=="number"||typeof e=="bigint"?te(e,t):typeof e=="string"?Dr(e,t):typeof e=="boolean"?Ku(e,t):Te(e,t)}function Ku(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(yt(n,{size:t.size}),Qn(n,{size:t.size})):n}function Te(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ag[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(yt(r,{size:t.size}),Qn(r,{dir:"right",size:t.size})):r}function te(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 Zu({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?Qn(c,{size:r}):c}const $g=new TextEncoder;function Dr(e,t={}){const n=$g.encode(e);return Te(n,t)}const Tg=new TextEncoder;function Jn(e,t={}){return typeof e=="number"||typeof e=="bigint"?Og(e,t):typeof e=="boolean"?Cg(e,t):bt(e)?wt(e,t):An(e,t)}function Cg(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(yt(n,{size:t.size}),Qn(n,{size:t.size})):n}const qt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Yu(e){if(e>=qt.zero&&e<=qt.nine)return e-qt.zero;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 wt(e,t={}){let n=e;t.size&&(yt(n,{size:t.size}),n=Qn(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=Yu(r.charCodeAt(c++)),u=Yu(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 Og(e,t){const n=te(e,t);return wt(n)}function An(e,t={}){const n=Tg.encode(e);return typeof t.size=="number"?(yt(n,{size:t.size}),Qn(n,{dir:"right",size:t.size})):n}const zo=BigInt(2**32-1),Xu=BigInt(32);function Ig(e,t=!1){return t?{h:Number(e&zo),l:Number(e>>Xu&zo)}:{h:Number(e>>Xu&zo)|0,l:Number(e&zo)|0}}function Ng(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}=Ig(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const kg=(e,t,n)=>e<<n|t>>>32-n,Bg=(e,t,n)=>t<<n|e>>>32-n,Mg=(e,t,n)=>t<<n-32|e>>>64-n,Lg=(e,t,n)=>e<<n-32|t>>>64-n,er=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ho(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Fr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Zt(e,...t){if(!Ho(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 Qu(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Fr(e.outputLen),Fr(e.blockLen)}function tr(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ju(e,t){Zt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Rg(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function nr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function hi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ot(e,t){return e<<32-t|e>>>t}const Dg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Fg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function jg(e){for(let t=0;t<e.length;t++)e[t]=Fg(e[t]);return e}const el=Dg?e=>e:jg,tl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",_g=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function rr(e){if(Zt(e),tl)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=_g[e[n]];return t}const Kt={_0:48,_9:57,A:65,F:70,a:97,f:102};function nl(e){if(e>=Kt._0&&e<=Kt._9)return e-Kt._0;if(e>=Kt.A&&e<=Kt.F)return e-(Kt.A-10);if(e>=Kt.a&&e<=Kt.f)return e-(Kt.a-10)}function Wo(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(tl)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=nl(e.charCodeAt(s)),c=nl(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 Ug(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Vo(e){return typeof e=="string"&&(e=Ug(e)),Zt(e),e}function dn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Zt(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 mi{}function rl(e){const t=r=>e().update(Vo(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ol(e=32){if(er&&typeof er.getRandomValues=="function")return er.getRandomValues(new Uint8Array(e));if(er&&typeof er.randomBytes=="function")return Uint8Array.from(er.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const zg=BigInt(0),jr=BigInt(1),Hg=BigInt(2),Wg=BigInt(7),Vg=BigInt(256),Gg=BigInt(113),sl=[],il=[],al=[];for(let e=0,t=jr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],sl.push(2*(5*r+n)),il.push((e+1)*(e+2)/2%64);let o=zg;for(let s=0;s<7;s++)t=(t<<jr^(t>>Wg)*Gg)%Vg,t&Hg&&(o^=jr<<(jr<<BigInt(s))-jr);al.push(o)}const cl=Ng(al,!0),qg=cl[0],Zg=cl[1],ul=(e,t,n)=>n>32?Mg(e,t,n):kg(e,t,n),ll=(e,t,n)=>n>32?Lg(e,t,n):Bg(e,t,n);function Kg(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],d=ul(u,l,1)^n[c],f=ll(u,l,1)^n[c+1];for(let p=0;p<50;p+=10)e[i+p]^=d,e[i+p+1]^=f}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=il[i],a=ul(o,s,c),u=ll(o,s,c),l=sl[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]^=qg[r],e[1]^=Zg[r]}nr(n)}class gi extends mi{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,Fr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Rg(this.state)}clone(){return this._cloneInto()}keccak(){el(this.state32),Kg(this.state32,this.rounds),el(this.state32),this.posOut=0,this.pos=0}update(t){tr(this),t=Vo(t),Zt(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){tr(this,!1),Zt(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 Fr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ju(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,nr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new gi(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 Yg=(e,t,n)=>rl(()=>new gi(t,e,n)),fl=Yg(1,136,256/8);function ke(e,t){const n=t||"hex",r=fl(bt(e,{strict:!1})?Jn(e):e);return n==="bytes"?r:Gt(r)}const Xg=e=>ke(Jn(e));function Qg(e){return Xg(e)}function Jg(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 eb=e=>{const t=typeof e=="string"?e:jo(e);return Jg(t)};function dl(e){return Qg(eb(e))}const Go=dl;let pn=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"})}},bi=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 yi=new bi(8192);function qo(e,t){if(yi.has(`${e}.${t}`))return yi.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=ke(An(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 yi.set(`${e}.${t}`,s),s}function $n(e,t){if(!rt(e,{strict:!1}))throw new pn({address:e});return qo(e,t)}const tb=/^0x[a-fA-F0-9]{40}$/,wi=new bi(8192);function rt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(wi.has(r))return wi.get(r);const o=tb.test(e)?e.toLowerCase()===e?!0:n?qo(e)===e:!0:!1;return wi.set(r,o),o}function vt(e){return typeof e[0]=="string"?or(e):nb(e)}function nb(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 or(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function sr(e,t,n,{strict:r}={}){return bt(e,{strict:!1})?gl(e,t,n,{strict:r}):ml(e,t,n,{strict:r})}function pl(e,t){if(typeof t=="number"&&t>0&&t>xe(e)-1)throw new Vu({offset:t,position:"start",size:xe(e)})}function hl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&xe(e)!==n-t)throw new Vu({offset:n,position:"end",size:xe(e)})}function ml(e,t,n,{strict:r}={}){pl(e,t);const o=e.slice(t,n);return r&&hl(o,t,n),o}function gl(e,t,n,{strict:r}={}){pl(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&hl(o,t,n),o}const rb=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,bl=/^(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 Yt(e,t){if(e.length!==t.length)throw new lg({expectedLength:e.length,givenLength:t.length});const n=ob({params:e,values:t}),r=xi(n);return r.length===0?"0x":r}function ob({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(vi({param:e[r],value:t[r]}));return n}function vi({param:e,value:t}){const n=Ei(e.type);if(n){const[r,o]=n;return ib(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return fb(t,{param:e});if(e.type==="address")return sb(t);if(e.type==="bool")return cb(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=bl.exec(e.type)??[];return ub(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return ab(t,{param:e});if(e.type==="string")return lb(t);throw new gg(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function xi(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(te(t+o,{size:32})),r.push(c),o+=xe(c)):n.push(c)}return vt([...n,...r])}function sb(e){if(!rt(e))throw new pn({address:e});return{dynamic:!1,encoded:fn(e.toLowerCase())}}function ib(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Wu(e);if(!r&&e.length!==t)throw new cg({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=vi({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=xi(s);if(r){const c=te(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 ab(e,{param:t}){const[,n]=t.type.split("bytes"),r=xe(e);if(!n){let o=e;return r%32!==0&&(o=fn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:vt([fn(te(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new ug({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:fn(e,{dir:"right"})}}function cb(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:fn(Ku(e))}}function ub(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 Zu({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:te(e,{size:32,signed:t})}}function lb(e){const t=Dr(e),n=Math.ceil(xe(t)/32),r=[];for(let o=0;o<n;o++)r.push(fn(sr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:vt([fn(te(xe(t),{size:32})),...r])}}function fb(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=vi({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?xi(r):vt(r.map(({encoded:o})=>o))}}function Ei(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const _r=e=>sr(dl(e),0,4);function Tn(e){const{abi:t,args:n=[],name:r}=e,o=bt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?_r(c)===r:c.type==="event"?Go(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 d="inputs"in c&&c.inputs[l];return d?Si(u,d):!1})){if(i&&"inputs"in i&&i.inputs){const u=yl(c.inputs,i.inputs,n);if(u)throw new hg({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Si(e,t){const n=typeof e,r=t.type;switch(r){case"address":return rt(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)=>Si(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=>Si(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function yl(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 yl(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")?rt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?rt(n[r],{strict:!1}):!1)return i}}const wl="/docs/contract/encodeEventTopics";function Ur(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=Tn({abi:t,name:n});if(!u)throw new zu(n,{docsPath:wl});o=u}if(o.type!=="event")throw new zu(void 0,{docsPath:wl});const s=gt(o),i=Go(s);let c=[];if(r&&"inputs"in o){const u=(a=o.inputs)==null?void 0:a.filter(d=>"indexed"in d&&d.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(d=>r[d.name]))??[]:[];l.length>0&&(c=(u==null?void 0:u.map((d,f)=>Array.isArray(l[f])?l[f].map((p,h)=>vl({param:d,value:l[f][h]})):typeof l[f]<"u"&&l[f]!==null?vl({param:d,value:l[f]}):null))??[])}return[i,...c]}function vl({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return ke(Jn(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new wg(e.type);return Yt([e],[t])}function Zo(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 xl(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=Zo(e,{method:"eth_newFilter"}),l=s?Ur({abi:r,args:o,eventName:s}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?te(i):i,toBlock:typeof a=="bigint"?te(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:d,request:u(d),strict:!!c,type:"event"}}function xt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const El="/docs/contract/encodeFunctionData";function db(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Tn({abi:t,args:n,name:r});if(!s)throw new Xn(r,{docsPath:El});o=s}if(o.type!=="function")throw new Xn(void 0,{docsPath:El});return{abi:[o],functionName:_r(gt(o))}}function It(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:db(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Yt(o.inputs,t??[]):void 0;return or([s,i??"0x"])}const Sl={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."},Pl={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},pb={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Al extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class $l extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class hb extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const mb={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 hb({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new $l({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Al({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 Al({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 Pi(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(mb);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function gb(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=Te(e,t);return Ct(n,t)}function bb(e,t={}){let n=e;if(typeof t.size<"u"&&(yt(n,{size:t.size}),n=Pn(n)),n.length>1||n[0]>1)throw new xg(n);return!!n[0]}function Xt(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=Te(e,t);return Vt(n,t)}function yb(e,t={}){let n=e;return typeof t.size<"u"&&(yt(n,{size:t.size}),n=Pn(n,{dir:"right"})),new TextDecoder().decode(n)}function zr(e,t){const n=typeof t=="string"?wt(t):t,r=Pi(n);if(xe(n)===0&&e.length>0)throw new Lr;if(xe(t)&&xe(t)<32)throw new Fu({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]=ir(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function ir(e,t,{staticPosition:n}){const r=Ei(t.type);if(r){const[o,s]=r;return vb(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return Pb(e,t,{staticPosition:n});if(t.type==="address")return wb(e);if(t.type==="bool")return xb(e);if(t.type.startsWith("bytes"))return Eb(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Sb(e,t);if(t.type==="string")return Ab(e,{staticPosition:n});throw new bg(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Tl=32,Ai=32;function wb(e){const t=e.readBytes(32);return[qo(Te(ml(t,-20))),32]}function vb(e,t,{length:n,staticPosition:r}){if(!n){const i=Xt(e.readBytes(Ai)),c=r+i,a=c+Tl;e.setPosition(c);const u=Xt(e.readBytes(Tl)),l=Hr(t);let d=0;const f=[];for(let p=0;p<u;++p){e.setPosition(a+(l?p*32:d));const[h,m]=ir(e,t,{staticPosition:a});d+=m,f.push(h)}return e.setPosition(r+32),[f,32]}if(Hr(t)){const i=Xt(e.readBytes(Ai)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=ir(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]=ir(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function xb(e){return[bb(e.readBytes(32),{size:32}),32]}function Eb(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Xt(e.readBytes(32));e.setPosition(n+i);const c=Xt(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 Sb(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?gb(o,{signed:n}):Xt(o,{signed:n}),32]}function Pb(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Hr(t)){const i=Xt(e.readBytes(Ai)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,d]=ir(e,u,{staticPosition:c});s+=d,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]=ir(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function Ab(e,{staticPosition:t}){const n=Xt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Xt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=yb(Pn(s));return e.setPosition(t+32),[i,32]}function Hr(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(Hr);const n=Ei(e.type);return!!(n&&Hr({...e,type:n[1]}))}function Cl(e){const{abi:t,data:n}=e,r=sr(n,0,4);if(r==="0x")throw new Lr;const s=[...t||[],Pl,pb].find(i=>i.type==="error"&&r===_r(gt(i)));if(!s)throw new _u(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?zr(s.inputs,sr(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 Ol({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 $b={gwei:9,wei:18},Tb={ether:-9,wei:9};function $i(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 Il(e,t="wei"){return $i(e,$b[t])}function Et(e,t="wei"){return $i(e,Tb[t])}class Cb extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Ob extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Nl(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
57
+ `,"")}function Ib(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
58
58
  `;return r.nonce&&(o+=` nonce: ${r.nonce}
59
59
  `),r.balance&&(o+=` balance: ${r.balance}
60
60
  `),r.code&&(o+=` code: ${r.code}
61
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 i,c,a;return Da({chain:Fd,transport:fa(jd(t,typeof window<"u"?(i=window==null?void 0:window.ENV)==null?void 0:i.CHAIN_RPC_URL_56:void 0,((a=(c=Fd.rpcUrls)==null?void 0:c.default)==null?void 0:a.http)||[]))})},[t]),s=x.useMemo(()=>{var i,c,a;return Da({chain:Fa,transport:fa(jd(n,typeof window<"u"?(i=window==null?void 0:window.ENV)==null?void 0:i.CHAIN_RPC_URL_42161:void 0,((a=(c=Fa.rpcUrls)==null?void 0:c.default)==null?void 0:a.http)||[]))})},[n]);return hs({client:o,tokenAddress:Hv,holder:Gv,decimals:18,fallbackFormatted:"0",pollingInterval:r}),hs({client:s,tokenAddress:Wv,holder:qv,decimals:6,fallbackFormatted:"0",pollingInterval:r}),hs({client:s,tokenAddress:Vv,holder:Zv,decimals:6,fallbackFormatted:"0",pollingInterval:r}),{BNB_USDT_BALANCE:"13000",ARB_USDT_BALANCE:"0",ARB_USDC_BALANCE:"11000"}}const Yv=()=>({openDeposit:x.useCallback(t=>{},[])}),Xv=()=>({openWithdraw:x.useCallback(t=>{},[])}),Dn="MPC",ja="EVM";/**
62
+ `,o+=Nl(r.state)),r.stateDiff&&(o+=` stateDiff:
63
+ `,o+=Nl(r.stateDiff)),o},` State Override:
64
+ `).slice(0,-1)}function Ko(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 Nb 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 kb extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Ko(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 kl 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 Bl 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 Bb extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Mb=e=>e,Wr=e=>e;class Ml extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:d,value:f,stateOverride:p}){var w;const h=n?xt(n):void 0;let m=Ko({from:h==null?void 0:h.address,to:d,value:typeof f<"u"&&`${Il(f)} ${((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+=`
67
+ ${Ib(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 Lb extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=Tn({abi:n,args:r,name:i}),u=a?Ol({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?gt(a,{includeName:!0}):void 0,d=Ko({address:o&&Mb(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," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=c}}class Ti extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=Cl({abi:t,data:n});const{abiItem:l,errorName:d,args:f}=i;if(d==="Error")a=f[0];else if(d==="Panic"){const[p]=f;a=Sl[p]}else{const p=l?gt(l,{includeName:!0}):void 0,h=l&&f?Ol({abiItem:l,args:f,includeFunctionName:!1,includeName:!1}):void 0;c=[p?`Error: ${p}`:"",h&&h!=="()"?` ${[...Array((d==null?void 0:d.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(l){s=l}else o&&(a=o);let u;s instanceof _u&&(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 Rb 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 Db 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 Yo 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 Cn 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: ${Wr(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 Ci extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Wr(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 Ll extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Wr(n)}`,`Request body: ${Ce(t)}`],name:"TimeoutError"})}}const Fb=-1;class Ue 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 Ci?t.code:n??Fb}}class Xe extends Ue{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Vr extends Ue{constructor(t){super(t,{code:Vr.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Vr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Gr extends Ue{constructor(t){super(t,{code:Gr.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class qr extends Ue{constructor(t,{method:n}={}){super(t,{code:qr.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Zr extends Ue{constructor(t){super(t,{code:Zr.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
69
+ `)})}}Object.defineProperty(Zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class On extends Ue{constructor(t){super(t,{code:On.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(On,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class In extends Ue{constructor(t){super(t,{code:In.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
70
+ `)})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Kr extends Ue{constructor(t){super(t,{code:Kr.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Kr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Yr extends Ue{constructor(t){super(t,{code:Yr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Yr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Xr extends Ue{constructor(t){super(t,{code:Xr.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Xr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Nn extends Ue{constructor(t,{method:n}={}){super(t,{code:Nn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class ar extends Ue{constructor(t){super(t,{code:ar.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Qr extends Ue{constructor(t){super(t,{code:Qr.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class cr extends Xe{constructor(t){super(t,{code:cr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(cr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Jr extends Xe{constructor(t){super(t,{code:Jr.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class eo extends Xe{constructor(t,{method:n}={}){super(t,{code:eo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class to extends Xe{constructor(t){super(t,{code:to.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class no extends Xe{constructor(t){super(t,{code:no.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ro extends Xe{constructor(t){super(t,{code:ro.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class oo extends Xe{constructor(t){super(t,{code:oo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class so extends Xe{constructor(t){super(t,{code:so.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class io extends Xe{constructor(t){super(t,{code:io.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class ao extends Xe{constructor(t){super(t,{code:ao.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class co extends Xe{constructor(t){super(t,{code:co.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class uo extends Xe{constructor(t){super(t,{code:uo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class lo extends Xe{constructor(t){super(t,{code:lo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class jb extends Ue{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const _b=3;function ur(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Yo?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:d,shortMessage:f}=c,p=e instanceof Lr?new Rb({functionName:s}):[_b,On.code].includes(a)&&(u||l||d||f)?new Ti({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof Ci?l:f??d}):e;return new Lb(p,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function Ub(e){const t=ke(`0x${e.substring(4)}`).substring(26);return qo(`0x${t}`)}async function zb({hash:e,signature:t}){const n=bt(e)?e:Gt(e),{secp256k1:r}=await Promise.resolve().then(()=>Nv);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:d,yParity:f}=t,p=Number(f??d),h=Rl(p);return new r.Signature(Ct(u),Ct(l)).addRecoveryBit(h)}const i=bt(t)?t:Gt(t);if(xe(i)!==65)throw new Error("invalid signature length");const c=Vt(`0x${i.slice(130)}`),a=Rl(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Rl(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 Dl({hash:e,signature:t}){return Ub(await zb({hash:e,signature:t}))}function Hb(e,t="hex"){const n=Fl(e),r=Pi(new Uint8Array(n.length));return n.encode(r),t==="hex"?Te(r.bytes):r.bytes}function Fl(e){return Array.isArray(e)?Wb(e.map(t=>Fl(t))):Vb(e)}function Wb(e){const t=e.reduce((o,s)=>o+s.length,0),n=jl(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 Vb(e){const t=typeof e=="string"?wt(e):e,n=jl(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 jl(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 Gb(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=ke(or(["0x05",Hb([t?te(t):"0x",o,n?te(n):"0x"])]));return r==="bytes"?wt(s):s}async function qb(e){const{authorization:t,signature:n}=e;return Dl({hash:Gb(t),signature:n??t})}class Zb extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:d,value:f}){var h;const p=Ko({from:n==null?void 0:n.address,to:d,value:typeof f<"u"&&`${Il(f)} ${((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 lr 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(lr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(lr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Xo 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(Xo,"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 Oi 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(Oi,"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 Ii 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(Ii,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ni 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(Ni,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class ki 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(ki,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Bi 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(Bi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Mi 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(Mi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Li 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(Li,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Ri extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Ri,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Qo 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(`
73
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Qo,"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 Jo extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Di(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===lr.code):e;return r instanceof V?new lr({cause:e,message:r.details}):lr.nodeMessage.test(n)?new lr({cause:e,message:e.details}):Xo.nodeMessage.test(n)?new Xo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Oi.nodeMessage.test(n)?new Oi({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ii.nodeMessage.test(n)?new Ii({cause:e,nonce:t==null?void 0:t.nonce}):Ni.nodeMessage.test(n)?new Ni({cause:e,nonce:t==null?void 0:t.nonce}):ki.nodeMessage.test(n)?new ki({cause:e,nonce:t==null?void 0:t.nonce}):Bi.nodeMessage.test(n)?new Bi({cause:e}):Mi.nodeMessage.test(n)?new Mi({cause:e,gas:t==null?void 0:t.gas}):Li.nodeMessage.test(n)?new Li({cause:e,gas:t==null?void 0:t.gas}):Ri.nodeMessage.test(n)?new Ri({cause:e}):Qo.nodeMessage.test(n)?new Qo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Jo({cause:e})}function Kb(e,{docsPath:t,...n}){const r=(()=>{const o=Di(e,n);return o instanceof Jo?e:o})();return new Zb(r,{docsPath:t,...n})}function Fi(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 Yb={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function es(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=Xb(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=te(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=te(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=te(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=te(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=te(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=te(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=Yb[e.type]),typeof e.value<"u"&&(t.value=te(e.value)),t}function Xb(e){return e.map(t=>({address:t.address,r:t.r?te(BigInt(t.r)):t.r,s:t.s?te(BigInt(t.s)):t.s,chainId:te(t.chainId),nonce:te(t.nonce),...typeof t.yParity<"u"?{yParity:te(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:te(t.v)}:{}}))}function _l(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new qu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new qu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Qb(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=te(t)),n!==void 0&&(i.nonce=te(n)),r!==void 0&&(i.state=_l(r)),o!==void 0){if(i.state)throw new Ob;i.stateDiff=_l(o)}return i}function ji(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!rt(n,{strict:!1}))throw new pn({address:n});if(t[n])throw new Cb({address:n});t[n]=Qb(r)}return t}const Ul=2n**256n-1n;function fo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?xt(t):void 0;if(i&&!rt(i.address))throw new pn({address:i.address});if(s&&!rt(s))throw new pn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new Nb;if(r&&r>Ul)throw new Xo({maxFeePerGas:r});if(o&&r&&o>r)throw new Qo({maxFeePerGas:r,maxPriorityFeePerGas:o})}class Jb extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class _i extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class ey extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Et(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class zl 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 Hl={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Wl(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Vt(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?Vt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Hl[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=ty(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 ty(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 Vl(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Wl(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 Nt(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var u,l,d;const s=o??!1,i=n!==void 0?te(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 zl({blockHash:t,blockNumber:n});return(((d=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:d.format)||Vl)(c)}async function Ui(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function ny(e,t){return Gl(e,t)}async function Gl(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 re(e,Nt,"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 Ct(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):re(e,Nt,"getBlock")({}),re(e,Ui,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new _i;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function ry(e,t){return zi(e,t)}async function zi(e,t){var f,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 Jb;const a=10**(((f=i.toString().split(".")[1])==null?void 0:f.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await re(e,Nt,"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 _i;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Gl(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 re(e,Ui,"getGasPrice")({}))}}async function ql(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?te(r):n]},{dedupe:!!r});return Vt(o)}function Zl(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=>Te(s))}function Kl(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=>Te(i))}function oy(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 sy(e,t,n){return e&t^~e&n}function iy(e,t,n){return e&t^e&n^t&n}class ay extends mi{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=hi(this.buffer)}update(t){tr(this),t=Vo(t),Zt(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=hi(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){tr(this),Ju(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,nr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let d=i;d<o;d++)n[d]=0;oy(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=hi(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 d=0;d<u;d++)c.setUint32(4*d,l[d],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos: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 hn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),cy=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]),mn=new Uint32Array(64);class uy extends ay{constructor(t=32){super(64,t,8,!1),this.A=hn[0]|0,this.B=hn[1]|0,this.C=hn[2]|0,this.D=hn[3]|0,this.E=hn[4]|0,this.F=hn[5]|0,this.G=hn[6]|0,this.H=hn[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 d=0;d<16;d++,n+=4)mn[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=mn[d-15],p=mn[d-2],h=Ot(f,7)^Ot(f,18)^f>>>3,m=Ot(p,17)^Ot(p,19)^p>>>10;mn[d]=m+mn[d-7]+h+mn[d-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Ot(c,6)^Ot(c,11)^Ot(c,25),p=l+f+sy(c,a,u)+cy[d]+mn[d]|0,m=(Ot(r,2)^Ot(r,13)^Ot(r,22))+iy(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(){nr(mn)}destroy(){this.set(0,0,0,0,0,0,0,0),nr(this.buffer)}}const Yl=rl(()=>new uy),ly=Yl;function fy(e,t){return ly(bt(e,{strict:!1})?Jn(e):e)}function dy(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=fy(t);return o.set([n],0),r==="bytes"?o:Te(o)}function py(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(dy({commitment:s,to:r,version:n}));return o}const Xl=6,Ql=32,Hi=4096,Jl=Ql*Hi,ef=Jl*Xl-1-1*Hi*Xl;class hy extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class my extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function gy(e){const t=typeof e.data=="string"?wt(e.data):e.data,n=xe(t);if(!n)throw new my;if(n>ef)throw new hy({maxSize:ef,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Pi(new Uint8Array(Jl));let c=0;for(;c<Hi;){const a=t.slice(s,s+(Ql-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 by(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??gy({data:t}),s=e.commitments??Zl({blobs:o,kzg:n,to:r}),i=e.proofs??Kl({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 yy(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 kb({transaction:e})}async function tf(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Vt(t)}const wy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],nf=new Map;async function rf(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=wy,type:l}=t,d=n&&xt(n),f={...t,...d?{from:d==null?void 0:d.address}:{}};let p;async function h(){return p||(p=await re(e,Nt,"getBlock")({blockTag:"latest"}),p)}let m;async function w(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await re(e,tf,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&d)if(a){const T=await w();f.nonce=await a.consume({address:d.address,chainId:T,client:e})}else f.nonce=await re(e,ql,"getTransactionCount")({address:d.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const T=Zl({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const b=py({commitments:T,to:"hex"});f.blobVersionedHashes=b}if(u.includes("sidecars")){const b=Kl({blobs:r,commitments:T,kzg:i}),$=by({blobs:r,commitments:T,proofs:b,to:"hex"});f.sidecars=$}}if(u.includes("chainId")&&(f.chainId=await w()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{f.type=yy(f)}catch{let T=nf.get(e.uid);if(typeof T>"u"){const b=await h();T=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",nf.set(e.uid,T)}f.type=T?"eip1559":"legacy"}if(u.includes("fees"))if(f.type!=="legacy"&&f.type!=="eip2930"){if(typeof f.maxFeePerGas>"u"||typeof f.maxPriorityFeePerGas>"u"){const T=await h(),{maxFeePerGas:b,maxPriorityFeePerGas:$}=await zi(e,{block:T,chain:o,request:f});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<$)throw new ey({maxPriorityFeePerGas:$});f.maxPriorityFeePerGas=$,f.maxFeePerGas=b}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new _i;if(typeof t.gasPrice>"u"){const T=await h(),{gasPrice:b}=await zi(e,{block:T,chain:o,request:f,type:"legacy"});f.gasPrice=b}}return u.includes("gas")&&typeof s>"u"&&(f.gas=await re(e,Wi,"estimateGas")({...f,account:d&&{address:d.address,type:"json-rpc"}})),fo(f),delete f.parameters,f}async function of(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?te(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Wi(e,t){var o,s,i;const{account:n=e.account}=t,r=n?xt(n):void 0;try{let S=function(C){const{block:O,request:y,rpcStateOverride:k}=C;return e.request({method:"eth_estimateGas",params:k?[y,O??e.experimental_blockTag??"latest",k]:O?[y,O]:[y]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:d,blockTag:f,data:p,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:T,maxPriorityFeePerGas:b,nonce:$,value:M,stateOverride:L,...F}=await rf(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof d=="bigint"?te(d):void 0)||f,v=ji(L),A=await(async()=>{if(F.to)return F.to;if(a&&a.length>0)return await qb({authorization:a[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})();fo(t);const N=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,P=(N||es)({...Fi(F,{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:T,maxPriorityFeePerGas:b,nonce:$,to:A,value:M});let E=BigInt(await S({block:g,request:P,rpcStateOverride:v}));if(a){const C=await of(e,{address:P.from}),O=await Promise.all(a.map(async y=>{const{address:k}=y,D=await S({block:g,request:{authorizationList:void 0,data:p,from:r==null?void 0:r.address,to:k,value:te(C)},rpcStateOverride:v}).catch(()=>100000n);return 2n*BigInt(D)}));E+=O.reduce((y,k)=>y+k,0n)}return E}catch(c){throw Kb(c,{...t,account:r,chain:e.chain})}}async function vy(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=It({abi:n,args:o,functionName:s});try{return await re(e,Wi,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?xt(c.account):void 0;throw ur(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function ts(e,t){if(!rt(e,{strict:!1}))throw new pn({address:e});if(!rt(t,{strict:!1}))throw new pn({address:t});return e.toLowerCase()===t.toLowerCase()}const sf="/docs/contract/decodeEventLog";function Vi(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new dg({docsPath:sf});const a=t.find(m=>m.type==="event"&&i===Go(gt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Uu(i,{docsPath:sf});const{name:u,inputs:l}=a,d=l==null?void 0:l.some(m=>!("name"in m&&m.name)),f=d?[]:{},p=l.map((m,w)=>[m,w]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<p.length;m++){const[w,T]=p[m],b=c[m];if(!b)throw new Uo({abiItem:a,param:w});f[d?T:w.name||T]=xy({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=zr(h,n);if(m)if(d)for(let w=0;w<l.length;w++)f[w]=f[w]??m.shift();else for(let w=0;w<h.length;w++)f[h[w].name]=m[w]}catch(m){if(s)throw m instanceof Fu||m instanceof $l?new Rr({abiItem:a,data:n,params:h,size:xe(n)}):m}else if(s)throw new Rr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(f).length>0?f:void 0}}function xy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(zr([e],t)||[])[0]}function Gi(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]===Go(l));if(!a)return null;const u=Vi({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!Ey({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof Uu)return null;if(a instanceof Rr||a instanceof Uo){if(o)return null;u=a.abiItem.name,l=(c=a.abiItem.inputs)==null?void 0:c.some(d=>!("name"in d&&d.name))}return{...i,args:l?[]:{},eventName:u}}}).filter(Boolean)}function Ey(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"?ts(i,c):s.type==="string"||s.type==="bytes"?ke(Jn(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 Qt(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 qi(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 d=[];l&&(d=[l.flatMap(m=>Ur({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(d=d[0]));let f;n?f=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:n}]}):f=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof r=="bigint"?te(r):r,toBlock:typeof o=="bigint"?te(o):o}]});const p=f.map(h=>Qt(h));return l?Gi({abi:l,args:c,logs:p,strict:u}):p}async function af(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?Tn({abi:n,name:i}):void 0,d=l?void 0:n.filter(f=>f.type==="event");return re(e,qi,"getLogs")({address:r,args:o,blockHash:s,event:l,events:d,fromBlock:c,toBlock:a,strict:u})}const Zi="/docs/contract/decodeFunctionResult";function kn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Tn({abi:t,args:n,name:r});if(!c)throw new Xn(r,{docsPath:Zi});s=c}if(s.type!=="function")throw new Xn(void 0,{docsPath:Zi});if(!s.outputs)throw new Hu(s.name,{docsPath:Zi});const i=zr(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 Ki=BigInt(0),Yi=BigInt(1);function ns(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function Bn(e,t,n=""){const r=Ho(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 rs(e){const t=e.toString(16);return t.length&1?"0"+t:t}function cf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Ki:BigInt("0x"+e)}function os(e){return cf(rr(e))}function uf(e){return Zt(e),cf(rr(Uint8Array.from(e).reverse()))}function Xi(e,t){return Wo(e.toString(16).padStart(t*2,"0"))}function lf(e,t){return Xi(e,t).reverse()}function ze(e,t,n){let r;if(typeof t=="string")try{r=Wo(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(Ho(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const Qi=e=>typeof e=="bigint"&&Ki<=e;function Sy(e,t,n){return Qi(e)&&Qi(t)&&Qi(n)&&t<=e&&e<n}function Py(e,t,n,r){if(!Sy(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function ff(e){let t;for(t=0;e>Ki;e>>=Yi,t+=1);return t}const po=e=>(Yi<<BigInt(e))-Yi;function Ay(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())},d=()=>{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 dn(...h)};return(p,h)=>{a(),l(p);let m;for(;!(m=h(d()));)l();return a(),m}}function Ji(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 df(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 $y="0.1.1";function Ty(){return $y}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@${Ty()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return pf(this,t)}}function pf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?pf(e.cause,t):t?null:e}const Cy="#__bigint";function Oy(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+Cy:o,n)}function Iy(e,t){if(gf(e)>t)throw new _y({givenSize:gf(e),maxSize:t})}const Jt={zero:48,nine:57,A:65,F:70,a:97,f:102};function hf(e){if(e>=Jt.zero&&e<=Jt.nine)return e-Jt.zero;if(e>=Jt.A&&e<=Jt.F)return e-(Jt.A-10);if(e>=Jt.a&&e<=Jt.f)return e-(Jt.a-10)}function Ny(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Uy({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 ea(e,t){if(ot(e)>t)throw new Gy({givenSize:ot(e),maxSize:t})}function ky(e,t){if(typeof t=="number"&&t>0&&t>ot(e)-1)throw new Ef({offset:t,position:"start",size:ot(e)})}function By(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ot(e)!==n-t)throw new Ef({offset:n,position:"end",size:ot(e)})}function mf(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 qy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const My=new TextEncoder;function Ly(e){return e instanceof Uint8Array?e:typeof e=="string"?Dy(e):Ry(e)}function Ry(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Dy(e,t={}){const{size:n}=t;let r=e;n&&(ea(e,n),r=Ln(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=hf(o.charCodeAt(a++)),l=hf(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 Fy(e,t={}){const{size:n}=t,r=My.encode(e);return typeof n=="number"?(Iy(r,n),jy(r,n)):r}function jy(e,t){return Ny(e,{dir:"right",size:t})}function gf(e){return e.length}let _y=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"})}},Uy=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 zy=new TextEncoder,Hy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Wy(e,t={}){const{strict:n=!1}=t;if(!e)throw new vf(e);if(typeof e!="string")throw new vf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new xf(e);if(!e.startsWith("0x"))throw new xf(e)}function kt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function bf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(ea(n,t.size),Mn(n,t.size)):n}function yf(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Hy[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(ea(r,t.size),Ln(r,t.size)):r}function Re(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 wf({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?Mn(a,r):a}function ta(e,t={}){return yf(zy.encode(e),t)}function Mn(e,t){return mf(e,{dir:"left",size:t})}function Ln(e,t){return mf(e,{dir:"right",size:t})}function na(e,t,n,r={}){const{strict:o}=r;ky(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&By(s,t,n),s}function ot(e){return Math.ceil((e.length-2)/2)}function Vy(e,t={}){const{strict:n=!1}=t;try{return Wy(e,{strict:n}),!0}catch{return!1}}class wf 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 vf extends be{constructor(t){super(`Value \`${typeof t=="object"?Oy(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 xf 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 Gy 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 Ef 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 qy 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 Zy(e){return{address:e.address,amount:Re(e.amount),index:Re(e.index),validatorIndex:Re(e.validatorIndex)}}function Sf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Re(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Re(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Re(e.gasLimit)},...typeof e.number=="bigint"&&{number:Re(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Re(e.prevRandao)},...typeof e.time=="bigint"&&{time:Re(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Zy)}}}const ra=[{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"}],oa=[{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"}]}],Pf=[{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"}],Af=[...Pf,{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"}]}],Ky=[...Pf,{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"}]}],$f=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Tf=[{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"}]}],Cf=[{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"}],fr=[{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"}]}],Yy="0x82ad56cb",Of="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Xy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Qy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class sa 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 If extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const ia="/docs/contract/encodeDeployData";function aa(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 ag({docsPath:ia});if(!("inputs"in o))throw new Du({docsPath:ia});if(!o.inputs||o.inputs.length===0)throw new Du({docsPath:ia});const s=Yt(o.inputs,n);return or([r,s])}function dr({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 sa({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new sa({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function Nf(e,{docsPath:t,...n}){const r=(()=>{const o=Di(e,n);return o instanceof Jo?e:o})();return new Ml(r,{docsPath:t,...n})}function kf(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const ca=new Map;function Bf({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const d=l.map(({args:f})=>f);d.length!==0&&e(d).then(f=>{o&&Array.isArray(f)&&f.sort(o);for(let p=0;p<l.length;p++){const{resolve:h}=l[p];h==null||h([f[p],f])}}).catch(f=>{for(let p=0;p<l.length;p++){const{reject:h}=l[p];h==null||h(f)}})},i=()=>ca.delete(t),c=()=>a().map(({args:l})=>l),a=()=>ca.get(t)||[],u=l=>ca.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:d,resolve:f,reject:p}=kf();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:f,reject:p}),d):(u({args:l,resolve:f,reject:p}),setTimeout(s,r),d)}}}async function ho(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:d,factory:f,factoryData:p,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:T,maxPriorityFeePerGas:b,nonce:$,to:M,value:L,stateOverride:F,...j}=t,g=n?xt(n):void 0;if(l&&(f||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&&d,A=f&&p&&M&&d,N=v||A,I=v?t1({code:l,data:d}):A?n1({data:d,factory:f,factoryData:p,to:M}):d;try{fo(t);const y=(typeof s=="bigint"?te(s):void 0)||i,k=u?Sf(u):void 0,D=ji(F),U=(C=(E=(S=e.chain)==null?void 0:S.formatters)==null?void 0:E.transactionRequest)==null?void 0:C.format,H=(U||es)({...Fi(j,{format:U}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:I,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:T,maxPriorityFeePerGas:b,nonce:$,to:N?void 0:M,value:L});if(o&&Jy({request:H})&&!D&&!k)try{return await e1(e,{...H,blockNumber:s,blockTag:i})}catch(Z){if(!(Z instanceof If)&&!(Z instanceof sa))throw Z}const K=(()=>{const Z=[H,y];return D&&k?[...Z,D,k]:D?[...Z,D]:k?[...Z,{},k]:Z})(),W=await e.request({method:"eth_call",params:K});return W==="0x"?{data:void 0}:{data:W}}catch(O){const y=r1(O),{offchainLookup:k,offchainLookupSignature:D}=await Promise.resolve().then(()=>sw);if(e.ccipRead!==!1&&(y==null?void 0:y.slice(0,10))===D&&M)return{data:await k(e,{data:y,to:M})};throw N&&(y==null?void 0:y.slice(0,10))==="0x101bb98d"?new Db({factory:f}):Nf(O,{...t,account:g,chain:e.chain})}}function Jy({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Yy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function e1(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 If;u=dr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const d=(typeof o=="bigint"?te(o):void 0)||s,{schedule:f}=Bf({id:`${e.uid}.${d}`,wait:r,shouldSplitBatch(w){return w.reduce((b,{data:$})=>b+($.length-2),0)>n*2},fn:async w=>{const T=w.map(M=>({allowFailure:!0,callData:M.data,target:M.to})),b=It({abi:ra,args:[T],functionName:"aggregate3"}),$=await e.request({method:"eth_call",params:[{data:b,to:u},d]});return kn({abi:ra,args:[T],functionName:"aggregate3",data:$||"0x"})}}),[{returnData:p,success:h}]=await f({data:i,to:a});if(!h)throw new Yo({data:p});return p==="0x"?{data:void 0}:{data:p}}function t1(e){const{code:t,data:n}=e;return aa({abi:Bu(["constructor(bytes, bytes)"]),bytecode:Of,args:[t,n]})}function n1(e){const{data:t,factory:n,factoryData:r,to:o}=e;return aa({abi:Bu(["constructor(address, bytes, address, bytes)"]),bytecode:Xy,args:[o,t,n,r]})}function r1(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 en(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=It({abi:n,args:o,functionName:s});try{const{data:a}=await re(e,ho,"call")({...i,data:c,to:r});return kn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw ur(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function o1(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?xt(c.account):e.account,u=It({abi:n,args:o,functionName:i});try{const{data:l}=await re(e,ho,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),d=kn({abi:n,args:o,functionName:i,data:l||"0x"}),f=n.filter(p=>"name"in p&&p.name===t.functionName);return{result:d,request:{abi:f,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(l){throw ur(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const ua=new Map,Mf=new Map;let s1=0;function gn(e,t,n){const r=++s1,o=()=>ua.get(e)||[],s=()=>{const l=o();ua.set(e,l.filter(d=>d.id!==r))},i=()=>{const l=o();if(!l.some(f=>f.id===r))return;const d=Mf.get(e);if(l.length===1&&d){const f=d();f instanceof Promise&&f.catch(()=>{})}s()},c=o();if(ua.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...d)=>{var p,h;const f=o();if(f.length!==0)for(const m of f)(h=(p=m.fns)[l])==null||h.call(p,...d)};const u=n(a);return typeof u=="function"&&Mf.set(e,u),i}async function la(e){return new Promise(t=>setTimeout(t,e))}function mo(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 la(a);const u=async()=>{o&&(await e({unpoll:s}),await la(r),u())};u()})(),s}const i1=new Map,a1=new Map;function c1(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,i1),r=t(e,a1);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function u1(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=c1(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 l1=e=>`blockNumber.${e}`;async function go(e,{cacheTime:t=e.cacheTime}={}){const n=await u1(()=>e.request({method:"eth_blockNumber"}),{cacheKey:l1(e.uid),cacheTime:t});return BigInt(n)}async function ss(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=>Qt(s));return!("abi"in t)||!t.abi?o:Gi({abi:t.abi,logs:o,strict:n})}async function is(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function f1(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:u,poll:l,pollingInterval:d=e.pollingInterval,strict:f}=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=f??!1,T=Ce(["watchContractEvent",r,o,s,e.uid,i,d,w,c]);return gn(T,{onLogs:u,onError:a},b=>{let $;c!==void 0&&($=c-1n);let M,L=!1;const F=mo(async()=>{var j;if(!L){try{M=await re(e,xl,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:w,fromBlock:c})}catch{}L=!0;return}try{let g;if(M)g=await re(e,ss,"getFilterChanges")({filter:M});else{const v=await re(e,go,"getBlockNumber")({});$&&$<v?g=await re(e,af,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:$+1n,toBlock:v,strict:w}):g=[],$=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 In&&(L=!1),(j=b.onError)==null||j.call(b,g)}},{emitOnBegin:!0,interval:d});return async()=>{M&&await re(e,is,"uninstallFilter")({filter:M}),F()}})})():(()=>{const w=f??!1,T=Ce(["watchContractEvent",r,o,s,e.uid,i,d,w]);let b=!0,$=()=>b=!1;return gn(T,{onLogs:u,onError:a},M=>((async()=>{try{const L=(()=>{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})(),F=i?Ur({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await L.subscribe({params:["logs",{address:r,topics:F}],onData(g){var A;if(!b)return;const v=g.result;try{const{eventName:N,args:I}=Vi({abi:n,data:v.data,topics:v.topics,strict:f}),P=Qt(v,{args:I,eventName:N});M.onLogs([P])}catch(N){let I,P;if(N instanceof Rr||N instanceof Uo){if(f)return;I=N.abiItem.name,P=(A=N.abiItem.inputs)==null?void 0:A.some(E=>!("name"in E&&E.name))}const S=Qt(v,{args:P?[]:{},eventName:I});M.onLogs([S])}},onError(g){var v;(v=M.onError)==null||v.call(M,g)}});$=j,b||$()}catch(L){a==null||a(L)}})(),()=>$()))})()}async function d1(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function fa(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 la(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 p1={"0x0":"reverted","0x1":"success"};function h1(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=>Qt(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Vt(e.transactionIndex):null,status:e.status?p1[e.status]:null,type:e.type?Hl[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const da=256;let as=da,cs;function Lf(e=11){if(!cs||as+e>da*2){cs="",as=0;for(let t=0;t<da;t++)cs+=(256+Math.random()*256|0).toString(16).substring(1)}return cs.substring(as,as+++e)}function m1(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,d=e.cacheTime??l,f=e.account?xt(e.account):void 0,{config:p,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),w={...p,...m},T={account:f,batch:t,cacheTime:d,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:w,type:i,uid:Lf(),...c?{experimental_blockTag:c}:{}};function b($){return M=>{const L=M($);for(const j in T)delete L[j];const F={...$,...L};return Object.assign(F,{extend:b(F)})}}return Object.assign(T,{extend:b(T)})}const us=new bi(8192);function g1(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 b1(e,t={}){return async(n,r={})=>{var d;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:u}=n;if((d=s==null?void 0:s.exclude)!=null&&d.includes(u))throw new Nn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Nn(new Error("method not supported"),{method:u});const l=o?Dr(`${a}.${Ce(n)}`):void 0;return g1(()=>fa(async()=>{try{return await e(n)}catch(f){const p=f;switch(p.code){case Vr.code:throw new Vr(p);case Gr.code:throw new Gr(p);case qr.code:throw new qr(p,{method:n.method});case Zr.code:throw new Zr(p);case On.code:throw new On(p);case In.code:throw new In(p);case Kr.code:throw new Kr(p);case Yr.code:throw new Yr(p);case Xr.code:throw new Xr(p);case Nn.code:throw new Nn(p,{method:n.method});case ar.code:throw new ar(p);case Qr.code:throw new Qr(p);case cr.code:throw new cr(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 co.code:throw new co(p);case uo.code:throw new uo(p);case lo.code:throw new lo(p);case 5e3:throw new cr(p);default:throw f instanceof V?f:new jb(p)}}},{delay:({count:f,error:p})=>{var h;if(p&&p instanceof Cn){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<<f)*i},retryCount:c,shouldRetry:({error:f})=>y1(f)}),{enabled:o,id:l})}}function y1(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===ar.code||e.code===On.code:e instanceof Cn&&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 w1({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=Lf();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:b1(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class v1 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 x1(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 E1(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Rf=E1();function S1(e,t={}){return{async request(n){var d;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 f=await x1(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Ce(r.map($=>({jsonrpc:"2.0",id:$.id??Rf.take(),...$}))):Ce({jsonrpc:"2.0",id:r.id??Rf.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},w=new Request(e,m),T=await(o==null?void 0:o(w,m))??{...m,url:e};return await fetch(T.url??e,T)},{errorInstance:new Ll({body:r,url:e}),timeout:i,signal:!0});s&&await s(f);let p;if((d=f.headers.get("Content-Type"))!=null&&d.startsWith("application/json"))p=await f.json();else{p=await f.text();try{p=JSON.parse(p||"{}")}catch(h){if(f.ok)throw h;p={error:p}}}if(!f.ok)throw new Cn({body:r,details:Ce(p.error)||f.statusText,headers:f.headers,status:f.status,url:e});return p}catch(f){throw f instanceof Cn||f instanceof Ll?f:new Cn({body:r,cause:f,url:e})}}}}function pa(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:d,retryCount:f,timeout:p})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},w=t.retryCount??f,T=p??t.timeout??1e4,b=e||(d==null?void 0:d.rpcUrls.default.http[0]);if(!b)throw new v1;const $=S1(b,{fetchOptions:r,onRequest:c,onResponse:a,timeout:T});return w1({key:o,methods:s,name:i,async request({method:M,params:L}){const F={method:M,params:L},{schedule:j}=Bf({id:b,wait:m,shouldSplitBatch(N){return N.length>h},fn:N=>$.request({body:N}),sort:(N,I)=>N.id-I.id}),g=async N=>n?j(N):[await $.request({body:N})],[{error:v,result:A}]=await g(F);if(l)return{error:v,result:A};if(v)throw new Ci({body:F,error:v,url:b});return A},retryCount:w,retryDelay:u,timeout:T,type:"http"},{fetchOptions:r,url:b})}}function ha(e,t){var r,o,s,i,c,a;if(!(e instanceof V))return!1;const n=e.walk(u=>u instanceof Ti);return n instanceof Ti?!!(((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===Sl[50]):!1}function P1(e){const{abi:t,data:n}=e,r=sr(n,0,4),o=t.find(s=>s.type==="function"&&r===_r(gt(s)));if(!o)throw new pg(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?zr(o.inputs,sr(n,4)):void 0}}const ma="/docs/contract/encodeErrorResult";function Df(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Tn({abi:t,args:r,name:n});if(!a)throw new ju(n,{docsPath:ma});o=a}if(o.type!=="error")throw new ju(void 0,{docsPath:ma});const s=gt(o),i=_r(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new fg(o.name,{docsPath:ma});c=Yt(o.inputs,r)}return or([i,c])}const ga="/docs/contract/encodeFunctionResult";function A1(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Tn({abi:t,name:n});if(!i)throw new Xn(n,{docsPath:ga});o=i}if(o.type!=="function")throw new Xn(void 0,{docsPath:ga});if(!o.outputs)throw new Hu(o.name,{docsPath:ga});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Wu(r)})();return Yt(o.outputs,s)}const ls="x-batch-gateway:true";async function Ff(e){const{data:t,ccipRequest:n}=e,{args:[r]}=P1({abi:oa,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(ls)?await Ff({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=$1(a)}})),A1({abi:oa,functionName:"query",result:[o,s]})}function $1(e){return e.name==="HttpRequestError"&&e.status?Df({abi:oa,errorName:"HttpError",args:[e.status,e.shortMessage]}):Df({abi:[Pl],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function jf(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 fs(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=jf(n[r]),s=o?Jn(o):ke(An(n[r]),"bytes");t=ke(vt([t,s]),"bytes")}return Te(t)}function T1(e){return`[${e.slice(2)}]`}function C1(e){const t=new Uint8Array(32).fill(0);return e?jf(e)||ke(An(e)):Te(t)}function ds(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(An(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=An(o[s]);i.byteLength>255&&(i=An(T1(C1(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 O1(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 dr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(d=>s.endsWith(d)))return null;try{const d=It({abi:Tf,functionName:"addr",...o!=null?{args:[fs(s),BigInt(o)]}:{args:[fs(s)]}}),f={address:u,abi:Af,functionName:"resolve",args:[Gt(ds(s)),d,i??[ls]],blockNumber:n,blockTag:r},h=await re(e,en,"readContract")(f);if(h[0]==="0x")return null;const m=kn({abi:Tf,args:o!=null?[fs(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||Pn(m)==="0x00"?null:m}catch(d){if(c)throw d;if(ha(d,"resolve"))return null;throw d}}class I1 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 bo extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class ba 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 N1 extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const k1=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,B1=/^(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>\/.*)?$/,M1=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,L1=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function R1(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 _f(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Uf({uri:e,gatewayUrls:t}){const n=M1.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=_f(t==null?void 0:t.ipfs,"https://ipfs.io"),o=_f(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(k1),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",d=i==="ipfs:/"||c==="ipfs/"||B1.test(e);if(e.startsWith("http")&&!l&&!d){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||d)&&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 f=e.replace(L1,"");if(f.startsWith("<svg")&&(f=`data:image/svg+xml;base64,${btoa(f)}`),f.startsWith("data:")||f.startsWith("{"))return{uri:f,isOnChain:!0,isEncoded:!1};throw new ba({uri:e})}function zf(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new I1({data:e});return e.image||e.image_url||e.image_data}async function D1({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await ya({gatewayUrls:e,uri:zf(n)})}catch{throw new ba({uri:t})}}async function ya({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Uf({uri:t,gatewayUrls:e});if(r||await R1(n))return n;throw new ba({uri:t})}function F1(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 bo({reason:"Only EIP-155 supported"});if(!i)throw new bo({reason:"Chain ID not found"});if(!a)throw new bo({reason:"Contract address not found"});if(!o)throw new bo({reason:"Token ID not found"});if(!c)throw new bo({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function j1(e,{nft:t}){if(t.namespace==="erc721")return en(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 en(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 N1({namespace:t.namespace})}async function _1(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?U1(e,{gatewayUrls:t,record:n}):ya({uri:n,gatewayUrls:t})}async function U1(e,{gatewayUrls:t,record:n}){const r=F1(n),o=await j1(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Uf({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 ya({uri:zf(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),D1({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Hf(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 dr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(d=>s.endsWith(d)))return null;try{const d={address:u,abi:Af,functionName:"resolve",args:[Gt(ds(s)),It({abi:$f,functionName:"text",args:[fs(s),o]}),i??[ls]],blockNumber:n,blockTag:r},p=await re(e,en,"readContract")(d);if(p[0]==="0x")return null;const h=kn({abi:$f,functionName:"text",data:p[0]});return h===""?null:h}catch(d){if(c)throw d;if(ha(d,"resolve"))return null;throw d}}async function z1(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await re(e,Hf,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await _1(e,{record:a,gatewayUrls:r})}catch{return null}}async function H1(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=dr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:Ky,functionName:"reverse",args:[Gt(ds(a))],blockNumber:n,blockTag:r},l=re(e,en,"readContract"),[d,f]=o?await l({...u,args:[...u.args,o]}):await l(u);return t.toLowerCase()!==f.toLowerCase()?null:d}catch(u){if(s)throw u;if(ha(u,"reverse"))return null;throw u}}async function W1(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 dr({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 re(e,en,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Gt(ds(o))],blockNumber:n,blockTag:r});return a}async function Wf(e,t){var w,T,b;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:p,...h}=t,m=n?xt(n):void 0;try{fo(t);const M=(typeof r=="bigint"?te(r):void 0)||o,L=(b=(T=(w=e.chain)==null?void 0:w.formatters)==null?void 0:T.transactionRequest)==null?void 0:b.format,j=(L||es)({...Fi(h,{format:L}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:p}),g=await e.request({method:"eth_createAccessList",params:[j,M]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch($){throw Nf($,{...t,account:m,chain:e.chain})}}async function V1(e){const t=Zo(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Vf(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=Zo(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(p=>Ur({abi:[p],eventName:p.name,args:n}))],r&&(l=l[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?te(s):s,toBlock:typeof c=="bigint"?te(c):c,...l.length?{topics:l}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:d,request:u(d),strict:!!i,toBlock:c,type:"event"}}async function Gf(e){const t=Zo(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function G1(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function q1(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?te(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}),Vt(s)}async function qf(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?te(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class Z1 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 K1(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,d]=await re(e,en,"readContract")({abi:Y1,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:u,salt:l},extensions:d,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Z1({address:n}):i}}const Y1=[{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 X1(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 Q1(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?te(n):void 0,i=await e.request({method:"eth_feeHistory",params:[te(t),s||r,o]},{dedupe:!!s});return X1(i)}async function J1(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Qt(s));return t.abi?Gi({abi:t.abi,logs:o,strict:n}):o}class ew 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=>` ${Wr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class tw extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Wr(n)}`,`Response: ${Ce(t)}`],name:"OffchainLookupResponseMalformedError"})}}class nw 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 rw="0x556f1830",Zf={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 ow(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Cl({data:r,abi:[Zf]}),[i,c,a,u,l]=s,{ccipRead:d}=e,f=d&&typeof(d==null?void 0:d.request)=="function"?d.request:Kf;try{if(!ts(o,i))throw new nw({sender:i,to:o});const p=c.includes(ls)?await Ff({data:a,ccipRequest:f}):await f({data:a,sender:i,urls:c}),{data:h}=await ho(e,{blockNumber:t,blockTag:n,data:vt([u,Yt([{type:"bytes"},{type:"bytes"}],[p,l])]),to:o});return h}catch(p){throw new ew({callbackSelector:u,cause:p,data:r,extraData:l,sender:i,urls:c})}}async function Kf({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 d;if((o=l.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?d=(await l.json()).data:d=await l.text(),!l.ok){r=new Cn({body:a,details:d!=null&&d.error?Ce(d.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!bt(d)){r=new tw({result:d,url:i});continue}return d}catch(l){r=new Cn({body:a,details:l.message,url:i})}}throw r}const sw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Kf,offchainLookup:ow,offchainLookupAbiItem:Zf,offchainLookupSignature:rw},Symbol.toStringTag,{value:"Module"}));function Yf(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class iw extends V{constructor({domain:t}){super(`Invalid domain "${Ce(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class aw 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 cw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function uw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:hw({domain:t}),...e.types};pw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(lw({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Xf({data:n,primaryType:r,types:o})),ke(vt(s))}function lw({domain:e,types:t}){return Xf({data:e,primaryType:"EIP712Domain",types:t})}function Xf({data:e,primaryType:t,types:n}){const r=Qf({data:e,primaryType:t,types:n});return ke(r)}function Qf({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[fw({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=ed({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Yt(r,o)}function fw({primaryType:e,types:t}){const n=Gt(dw({primaryType:e,types:t}));return ke(n)}function dw({primaryType:e,types:t}){let n="";const r=Jf({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 Jf({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])Jf({primaryType:s.type,types:t},n);return n}function ed({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},ke(Qf({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(Gt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>ed({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},ke(Yt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function pw(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,d=c[u],f=l.match(bl);if(f&&(typeof d=="number"||typeof d=="bigint")){const[m,w,T]=f;te(d,{signed:w==="int",size:Number.parseInt(T)/8})}if(l==="address"&&typeof d=="string"&&!rt(d))throw new pn({address:d});const p=l.match(rb);if(p){const[m,w]=p;if(w&&xe(d)!==Number.parseInt(w))throw new mg({expectedSize:Number.parseInt(w),givenSize:xe(d)})}const h=o[l];h&&(mw(l),s(h,d))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new iw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new aw({primaryType:r,types:o})}function hw({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 mw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new cw({type:e})}const gw=`Ethereum Signed Message:
75
+ `;function bw(e){const t=typeof e=="string"?Dr(e):typeof e.raw=="string"?e.raw:Te(e.raw),n=Dr(`${gw}${xe(t)}`);return vt([n,t])}function td(e,t){return ke(bw(e),t)}const nd="0x6492649264926492649264926492649264926492649264926492649264926492";function yw(e){return gl(e,-32)===nd}function ww(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=or([Yt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),nd]);return o==="hex"?s:wt(s)}class vw extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function xw(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new vw({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 Ew(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function Sw(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Vt(e.nonce):void 0,storageProof:e.storageProof?Ew(e.storageProof):void 0}}async function Pw(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?te(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return Sw(c)}async function Aw(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?te(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function wa(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,d,f;const i=r||"latest",c=n!==void 0?te(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,te(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,te(s)]},{dedupe:!!c}),!a)throw new kl({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((f=(d=(l=e.chain)==null?void 0:l.formatters)==null?void 0:d.transaction)==null?void 0:f.format)||Wl)(a)}async function $w(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([re(e,go,"getBlockNumber")({}),t?re(e,wa,"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 ps(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Bl({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||h1)(n)}async function Tw(e,t){var T;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof((T=e.batch)==null?void 0:T.multicall)=="object"&&e.batch.multicall.batchSize||1024);let d=c;if(!d){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");d=dr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const f=[[]];let p=0,h=0;for(let b=0;b<u.length;b++){const{abi:$,address:M,args:L,functionName:F}=u[b];try{const j=It({abi:$,args:L,functionName:F});h+=(j.length-2)/2,l>0&&h>l&&f[p].length>0&&(p++,h=(j.length-2)/2,f[p]=[]),f[p]=[...f[p],{allowFailure:!0,callData:j,target:M}]}catch(j){const g=ur(j,{abi:$,address:M,args:L,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!r)throw g;f[p]=[...f[p],{allowFailure:!0,callData:"0x",target:M}]}}const m=await Promise.allSettled(f.map(b=>re(e,en,"readContract")({abi:ra,account:n,address:d,args:[b],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),w=[];for(let b=0;b<m.length;b++){const $=m[b];if($.status==="rejected"){if(!r)throw $.reason;for(let L=0;L<f[b].length;L++)w.push({status:"failure",error:$.reason,result:void 0});continue}const M=$.value;for(let L=0;L<M.length;L++){const{returnData:F,success:j}=M[L],{callData:g}=f[b][L],{abi:v,address:A,functionName:N,args:I}=u[w.length];try{if(g==="0x")throw new Lr;if(!j)throw new Yo({data:F});const P=kn({abi:v,args:I,data:F,functionName:N});w.push(r?{result:P,status:"success"}:P)}catch(P){const S=ur(P,{abi:v,address:A,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 va(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 f of o){const p=f.blockOverrides?Sf(f.blockOverrides):void 0,h=f.calls.map(w=>{const T=w,b=T.account?xt(T.account):void 0,$=T.abi?It(T):T.data,M={...T,data:T.dataSuffix?vt([$||"0x",T.dataSuffix]):$,from:T.from??(b==null?void 0:b.address)};return fo(M),es(M)}),m=f.stateOverrides?ji(f.stateOverrides):void 0;a.push({blockOverrides:p,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?te(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((f,p)=>({...Vl(f),calls:f.calls.map((h,m)=>{var A,N;const{abi:w,args:T,functionName:b,to:$}=o[p].calls[m],M=((A=h.error)==null?void 0:A.data)??h.returnData,L=BigInt(h.gasUsed),F=(N=h.logs)==null?void 0:N.map(I=>Qt(I)),j=h.status==="0x1"?"success":"failure",g=w&&j==="success"&&M!=="0x"?kn({abi:w,data:M,functionName:b}):null,v=(()=>{var P;if(j==="success")return;let I;if(((P=h.error)==null?void 0:P.data)==="0x"?I=new Lr:h.error&&(I=new Yo(h.error)),!!I)return ur(I,{abi:w??[],address:$??"0x",args:T,functionName:b??"<unknown>"})})();return{data:M,gasUsed:L,logs:F,status:j,...j==="success"?{result:g}:{error:v}}})}))}catch(a){const u=a,l=Di(u,{});throw l instanceof Jo?u:l}}function rd(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=fl(Ly(e));return n==="Bytes"?r:yf(r)}class Cw 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 xa={checksum:new Cw(8192)}.checksum,Ow=/^0x[a-fA-F0-9]{40}$/;function hs(e,t={}){const{strict:n=!0}=t;if(!Ow.test(e))throw new od({address:e,cause:new Nw});if(n){if(e.toLowerCase()===e)return;if(Iw(e)!==e)throw new od({address:e,cause:new kw})}}function Iw(e){if(xa.has(e))return xa.get(e);hs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=rd(Fy(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 xa.set(e,o),o}function Ea(e,t={}){const{strict:n=!0}=t??{};try{return hs(e,{strict:n}),!0}catch{return!1}}class od 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 Nw 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 kw 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 Sa(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 Pa(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Ea(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)=>Pa(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=>Pa(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function sd(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 sd(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")?Ea(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Ea(n[r],{strict:!1}):!1)return i}}function id(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Mu(e):e;return{...r,...n?{hash:pr(r)}:{}}}function Bw(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Vy(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?ad(u)===na(t,0,4):u.type==="event"?pr(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new Aa({name:t});if(i.length===1)return{...i[0],...o?{hash:pr(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:pr(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((d,f)=>{const p="inputs"in u&&u.inputs[f];return p?Pa(d,p):!1})){if(c&&"inputs"in c&&c.inputs){const d=sd(u.inputs,c.inputs,r);if(d)throw new Lw({abiItem:u,type:d[0]},{abiItem:c,type:d[1]})}c=u}}const a=(()=>{if(c)return c;const[u,...l]=i;return{...u,overloads:l}})();if(!a)throw new Aa({name:t});return{...a,...o?{hash:pr(a)}:{}}}function ad(e){return na(pr(e),0,4)}function Mw(e){const t=typeof e=="string"?e:jo(e);return Sa(t)}function pr(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:rd(ta(Mw(e)))}class Lw extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Sa(jo(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Sa(jo(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 Aa 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 Rw=/^(.*)\[([0-9]*)\]$/,Dw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,cd=/^(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 Fw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push($a({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function $a({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Gw(r.type);if(o){const[s,i]=o;return _w(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Vw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return jw(n,{checksum:e});if(r.type==="bool")return zw(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=cd.exec(r.type)??[];return Hw(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Uw(n,{type:r.type});if(r.type==="string")return Ww(n);throw new dd(r.type)}function Ta(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=ot(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(Re(t+o,{size:32})),r.push(c),o+=ot(c)):n.push(c)}return kt(...n,...r)}function jw(e,t){const{checksum:n=!1}=t;return hs(e,{strict:n}),{dynamic:!1,encoded:Mn(e.toLowerCase())}}function _w(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new Zw(e);if(!s&&e.length!==r)throw new qw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=$a({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=Ta(c);if(s){const u=Re(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?kt(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:kt(...c.map(({encoded:a})=>a))}}function Uw(e,{type:t}){const[,n]=t.split("bytes"),r=ot(e);if(!n){let o=e;return r%32!==0&&(o=Ln(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:kt(Mn(Re(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new ld({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Ln(e)}}function zw(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Mn(bf(e))}}function Hw(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 wf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Re(e,{size:32,signed:t})}}function Ww(e){const t=ta(e),n=Math.ceil(ot(t)/32),r=[];for(let o=0;o<n;o++)r.push(Ln(na(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:kt(Ln(Re(ot(t),{size:32})),...r)}}function Vw(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=$a({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Ta(s):kt(...s.map(({encoded:i})=>i))}}function Gw(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function ud(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new fd({expectedLength:e.length,givenLength:t.length});const o=Fw({checksumAddress:r,parameters:e,values:t}),s=Ta(o);return s.length===0?"0x":s}function Ca(e,t){if(e.length!==t.length)throw new fd({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(Ca.encode(o,s))}return kt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return hs(a),Mn(a.toLowerCase(),o?32:0)}if(n==="string")return ta(r);if(n==="bytes")return r;if(n==="bool")return Mn(bf(r),o?32:1);const s=n.match(cd);if(s){const[a,u,l="256"]=s,d=Number.parseInt(l)/8;return Re(r,{size:o?32:d,signed:u==="int"})}const i=n.match(Dw);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new ld({expectedSize:Number.parseInt(u),value:r});return Ln(r,o?32:0)}const c=n.match(Rw);if(c&&Array.isArray(r)){const[a,u]=c,l=[];for(let d=0;d<r.length;d++)l.push(t(u,r[d],!0));return l.length===0?"0x":kt(...l)}throw new dd(n)}e.encode=t})(Ca||(Ca={}));class qw 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 ld extends be{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ot(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class fd 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 Zw 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 dd 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 Kw(e,t){var o;const{bytecode:n,args:r}=t;return kt(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?ud(e.inputs,r):"0x")}function Yw(e){return id(e)}function Xw(e,...t){const{overloads:n}=e,r=n?Qw([e,...n],e.name,{args:t[0]}):e,o=Jw(r),s=t.length>0?ud(r.inputs,t[0]):void 0;return s?kt(o,s):o}function hr(e,t={}){return id(e,t)}function Qw(e,t,n){const r=Bw(e,t,n);if(r.type!=="function")throw new Aa({name:t,type:"function"});return r}function Jw(e){return ad(e)}const ev="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Bt="0x0000000000000000000000000000000000000000",tv="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function nv(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?Kw(Yw("constructor(bytes, bytes)"),{bytecode:Of,args:[tv,Xw(hr("function getBalance(address)"),[u.address])]}):void 0,d=i?await Promise.all(t.calls.map(async y=>{if(!y.data&&!y.abi)return;const{accessList:k}=await Wf(e,{account:u.address,...y,data:y.abi?It(y):y.data});return k.map(({address:D,storageKeys:U})=>U.length>0?D:null)})).then(y=>y.flat().filter(Boolean)):[],f=await va(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:d.map((y,k)=>({abi:[hr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]}]:[],{calls:[...o,{}].map(y=>({...y,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:d.map((y,k)=>({abi:[hr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]},{calls:d.map((y,k)=>({to:y,abi:[hr("function decimals() returns (uint256)")],functionName:"decimals",from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]},{calls:d.map((y,k)=>({to:y,abi:[hr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]},{calls:d.map((y,k)=>({to:y,abi:[hr("function symbol() returns (string)")],functionName:"symbol",from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),p=i?f[2]:f[0],[h,m,,w,T,b,$,M]=i?f:[],{calls:L,...F}=p,j=L.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],v=(m==null?void 0:m.calls)??[],A=[...g,...v].map(y=>y.status==="success"?Ct(y.data):null),N=(w==null?void 0:w.calls)??[],I=(T==null?void 0:T.calls)??[],P=[...N,...I].map(y=>y.status==="success"?Ct(y.data):null),S=((b==null?void 0:b.calls)??[]).map(y=>y.status==="success"?y.result:null),E=((M==null?void 0:M.calls)??[]).map(y=>y.status==="success"?y.result:null),C=(($==null?void 0:$.calls)??[]).map(y=>y.status==="success"?y.result:null),O=[];for(const[y,k]of P.entries()){const D=A[y];if(typeof k!="bigint"||typeof D!="bigint")continue;const U=S[y-1],_=E[y-1],H=C[y-1],K=y===0?{address:ev,decimals:18,symbol:"ETH"}:{address:d[y-1],decimals:H||U?Number(U??1):void 0,symbol:_??void 0};O.some(W=>W.token.address===K.address)||O.push({token:K,value:{pre:D,post:k,diff:k-D}})}return{assetChanges:O,block:F,results:j}}class pd extends mi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Qu(t);const r=Vo(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),nr(s)}update(t){return tr(this),this.iHash.update(t),this}digestInto(t){tr(this),Zt(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 hd=(e,t,n)=>new pd(e,t).update(n).digest();hd.create=(e,t)=>new pd(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const He=BigInt(0),De=BigInt(1),Rn=BigInt(2),md=BigInt(3),gd=BigInt(4),bd=BigInt(5),rv=BigInt(7),yd=BigInt(8),ov=BigInt(9),wd=BigInt(16);function St(e,t){const n=e%t;return n>=He?n:t+n}function st(e,t,n){let r=e;for(;t-- >He;)r*=r,r%=n;return r}function vd(e,t){if(e===He)throw new Error("invert: expected non-zero number");if(t<=He)throw new Error("invert: expected positive modulus, got "+t);let n=St(e,t),r=t,o=He,s=De;for(;n!==He;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==De)throw new Error("invert: does not exist");return St(o,t)}function Oa(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function xd(e,t){const n=(e.ORDER+De)/gd,r=e.pow(t,n);return Oa(e,r,t),r}function sv(e,t){const n=(e.ORDER-bd)/yd,r=e.mul(t,Rn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Rn),o),c=e.mul(s,e.sub(i,e.ONE));return Oa(e,c,t),c}function iv(e){const t=yo(e),n=Ed(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+rv)/wd;return(c,a)=>{let u=c.pow(a,i),l=c.mul(u,r);const d=c.mul(u,o),f=c.mul(u,s),p=c.eql(c.sqr(l),a),h=c.eql(c.sqr(d),a);u=c.cmov(u,l,p),l=c.cmov(f,d,h);const m=c.eql(c.sqr(l),a),w=c.cmov(u,l,m);return Oa(c,w,a),w}}function Ed(e){if(e<md)throw new Error("sqrt is not defined for small field");let t=e-De,n=0;for(;t%Rn===He;)t/=Rn,n++;let r=Rn;const o=yo(e);for(;Pd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return xd;let s=o.pow(r,t);const i=(t+De)/Rn;return function(a,u){if(a.is0(u))return u;if(Pd(a,u)!==1)throw new Error("Cannot find square root");let l=n,d=a.mul(a.ONE,s),f=a.pow(u,t),p=a.pow(u,i);for(;!a.eql(f,a.ONE);){if(a.is0(f))return a.ZERO;let h=1,m=a.sqr(f);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===l)throw new Error("Cannot find square root");const w=De<<BigInt(l-h-1),T=a.pow(d,w);l=h,d=a.sqr(T),f=a.mul(f,d),p=a.mul(p,T)}return p}}function av(e){return e%gd===md?xd:e%yd===bd?sv:e%wd===ov?iv(e):Ed(e)}const cv=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function uv(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=cv.reduce((r,o)=>(r[o]="function",r),t);return Ji(e,n),e}function lv(e,t,n){if(n<He)throw new Error("invalid exponent, negatives unsupported");if(n===He)return e.ONE;if(n===De)return t;let r=e.ONE,o=t;for(;n>He;)n&De&&(r=e.mul(r,o)),o=e.sqr(o),n>>=De;return r}function Sd(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 Pd(e,t){const n=(e.ORDER-De)/Rn,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 Ad(e,t){t!==void 0&&Fr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function yo(e,t,n=!1,r={}){if(e<=He)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 f=t;f.BITS&&(o=f.BITS),f.sqrt&&(s=f.sqrt),typeof f.isLE=="boolean"&&(n=f.isLE),typeof f.modFromBytes=="boolean"&&(i=f.modFromBytes),c=f.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:u}=Ad(e,o);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const d=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:u,MASK:po(a),ZERO:He,ONE:De,allowedLengths:c,create:f=>St(f,e),isValid:f=>{if(typeof f!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof f);return He<=f&&f<e},is0:f=>f===He,isValidNot0:f=>!d.is0(f)&&d.isValid(f),isOdd:f=>(f&De)===De,neg:f=>St(-f,e),eql:(f,p)=>f===p,sqr:f=>St(f*f,e),add:(f,p)=>St(f+p,e),sub:(f,p)=>St(f-p,e),mul:(f,p)=>St(f*p,e),pow:(f,p)=>lv(d,f,p),div:(f,p)=>St(f*vd(p,e),e),sqrN:f=>f*f,addN:(f,p)=>f+p,subN:(f,p)=>f-p,mulN:(f,p)=>f*p,inv:f=>vd(f,e),sqrt:s||(f=>(l||(l=av(e)),l(d,f))),toBytes:f=>n?lf(f,u):Xi(f,u),fromBytes:(f,p=!0)=>{if(c){if(!c.includes(f.length)||f.length>u)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+f.length);const m=new Uint8Array(u);m.set(f,n?0:m.length-f.length),f=m}if(f.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+f.length);let h=n?uf(f):os(f);if(i&&(h=St(h,e)),!p&&!d.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:f=>Sd(d,f),cmov:(f,p,h)=>h?p:f});return Object.freeze(d)}function $d(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 Td(e){const t=$d(e);return t+Math.ceil(t/2)}function fv(e,t,n=!1){const r=e.length,o=$d(t),s=Td(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?uf(e):os(e),c=St(i,t-De)+De;return n?lf(c,o):Xi(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const mr=BigInt(0),Dn=BigInt(1);function ms(e,t){const n=t.negate();return e?n:t}function Ia(e,t){const n=Sd(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function Cd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Na(e,t){Cd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=po(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Od(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+=Dn);const u=t*r,l=u+Math.abs(c)-1,d=c===0,f=c<0,p=t%2!==0;return{nextN:a,offset:l,isZero:d,isNeg:f,isNegF:p,offsetF:u}}function dv(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 pv(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 ka=new WeakMap,Id=new WeakMap;function Ba(e){return Id.get(e)||1}function Nd(e){if(e!==mr)throw new Error("invalid wNAF")}class hv{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>mr;)n&Dn&&(r=r.add(o)),o=o.double(),n>>=Dn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Na(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=Na(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:d,isNegF:f,offsetF:p}=Od(r,c,i);r=a,l?s=s.add(ms(f,n[p])):o=o.add(ms(d,n[u]))}return Nd(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Na(t,this.bits);for(let i=0;i<s.windows&&r!==mr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=Od(r,i,s);if(r=c,!u){const d=n[a];o=o.add(l?d.negate():d)}}return Nd(r),o}getPrecomputes(t,n,r){let o=ka.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),ka.set(n,o))),o}cached(t,n,r){const o=Ba(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Ba(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){Cd(n,this.bits),Id.set(t,n),ka.delete(t)}hasCache(t){return Ba(t)!==1}}function mv(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>mr||r>mr;)n&Dn&&(s=s.add(o)),r&Dn&&(i=i.add(o)),o=o.double(),n>>=Dn,r>>=Dn;return{p1:s,p2:i}}function gv(e,t,n,r){dv(n,e),pv(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=ff(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=po(a),l=new Array(Number(u)+1).fill(i),d=Math.floor((t.BITS-1)/a)*a;let f=i;for(let p=d;p>=0;p-=a){l.fill(i);for(let m=0;m<s;m++){const w=r[m],T=Number(w>>BigInt(p)&u);l[T]=l[T].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(f=f.add(h),p!==0)for(let m=0;m<a;m++)f=f.double()}return f}function kd(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return uv(t),t}else return yo(e,{isLE:n})}function bv(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>mr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=kd(t.p,n.Fp,r),s=kd(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 Bd=(e,t)=>(e+(e>=0?t:-t)/Md)/t;function yv(e,t,n){const[[r,o],[s,i]]=t,c=Bd(i*e,n),a=Bd(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const d=u<nn,f=l<nn;d&&(u=-u),f&&(l=-l);const p=po(Math.ceil(ff(n)/2))+gr;if(u<nn||u>=p||l<nn||l>=p)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}function Ma(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function La(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return ns(n.lowS,"lowS"),ns(n.prehash,"prehash"),n.format!==void 0&&Ma(n.format),n}class wv extends Error{constructor(t=""){super(t)}}const tn={Err:wv,_tlv:{encode:(e,t)=>{const{Err:n}=tn;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=rs(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?rs(o.length/2|128):"";return rs(e)+s+o+t},decode(e,t){const{Err:n}=tn;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}=tn;if(e<nn)throw new t("integer: negative integers are not allowed");let n=rs(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}=tn;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 os(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=tn,o=ze("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}=tn,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},nn=BigInt(0),gr=BigInt(1),Md=BigInt(2),gs=BigInt(3),vv=BigInt(4);function br(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=ze("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 xv(e,t={}){const n=bv("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;Ji(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=Rd(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(I,P,S){const{x:E,y:C}=P.toAffine(),O=r.toBytes(E);if(ns(S,"isCompressed"),S){l();const y=!r.isOdd(C);return dn(Ld(y),O)}else return dn(Uint8Array.of(4),O,r.toBytes(C))}function f(I){Bn(I,void 0,"Point");const{publicKey:P,publicKeyUncompressed:S}=u,E=I.length,C=I[0],O=I.subarray(1);if(E===P&&(C===2||C===3)){const y=r.fromBytes(O);if(!r.isValid(y))throw new Error("bad point: is not on curve, wrong x");const k=m(y);let D;try{D=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 U=r.isOdd(D);return(C&1)===1!==U&&(D=r.neg(D)),{x:y,y:D}}else if(E===S&&C===4){const y=r.BYTES,k=r.fromBytes(O.subarray(0,y)),D=r.fromBytes(O.subarray(y,y*2));if(!w(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||d,h=t.fromBytes||f;function m(I){const P=r.sqr(I),S=r.mul(P,I);return r.add(r.add(S,r.mul(I,s.a)),s.b)}function w(I,P){const S=r.sqr(P),E=m(I);return r.eql(S,E)}if(!w(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const T=r.mul(r.pow(s.a,gs),vv),b=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(T,b)))throw new Error("bad curve params: a or b");function $(I,P,S=!1){if(!r.isValid(P)||S&&r.is0(P))throw new Error(`bad point coordinate ${I}`);return P}function M(I){if(!(I instanceof v))throw new Error("ProjectivePoint expected")}function L(I){if(!a||!a.basises)throw new Error("no endo");return yv(I,a.basises,o.ORDER)}const F=df((I,P)=>{const{X:S,Y:E,Z:C}=I;if(r.eql(C,r.ONE))return{x:S,y:E};const O=I.is0();P==null&&(P=O?r.ONE:r.inv(C));const y=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:y,y:k}}),j=df(I=>{if(I.is0()){if(t.allowInfinityPoint&&!r.is0(I.Y))return;throw new Error("bad point: ZERO")}const{x:P,y:S}=I.toAffine();if(!r.isValid(P)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!w(P,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,P,S,E,C){return S=new v(r.mul(S.X,I),S.Y,S.Z),P=ms(E,P),S=ms(C,S),P.add(S)}class v{constructor(P,S,E){this.X=$("x",P),this.Y=$("y",S,!0),this.Z=$("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 v)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(E)?v.ZERO:new v(S,E,r.ONE)}static fromBytes(P){const S=v.fromAffine(h(Bn(P,void 0,"point")));return S.assertValidity(),S}static fromHex(P){return v.fromBytes(ze("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,S=!0){return N.createCache(this,P),S||this.multiply(gs),this}assertValidity(){j(this)}hasEvenY(){const{y:P}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(P)}equals(P){M(P);const{X:S,Y:E,Z:C}=this,{X:O,Y:y,Z:k}=P,D=r.eql(r.mul(S,k),r.mul(O,C)),U=r.eql(r.mul(E,k),r.mul(y,C));return D&&U}negate(){return new v(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:S}=s,E=r.mul(S,gs),{X:C,Y:O,Z:y}=this;let k=r.ZERO,D=r.ZERO,U=r.ZERO,_=r.mul(C,C),H=r.mul(O,O),K=r.mul(y,y),W=r.mul(C,O);return W=r.add(W,W),U=r.mul(C,y),U=r.add(U,U),k=r.mul(P,U),D=r.mul(E,K),D=r.add(k,D),k=r.sub(H,D),D=r.add(H,D),D=r.mul(k,D),k=r.mul(W,k),U=r.mul(E,U),K=r.mul(P,K),W=r.sub(_,K),W=r.mul(P,W),W=r.add(W,U),U=r.add(_,_),_=r.add(U,_),_=r.add(_,K),_=r.mul(_,W),D=r.add(D,_),K=r.mul(O,y),K=r.add(K,K),_=r.mul(K,W),k=r.sub(k,_),U=r.mul(K,H),U=r.add(U,U),U=r.add(U,U),new v(k,D,U)}add(P){M(P);const{X:S,Y:E,Z:C}=this,{X:O,Y:y,Z:k}=P;let D=r.ZERO,U=r.ZERO,_=r.ZERO;const H=s.a,K=r.mul(s.b,gs);let W=r.mul(S,O),Z=r.mul(E,y),G=r.mul(C,k),J=r.add(S,E),ne=r.add(O,y);J=r.mul(J,ne),ne=r.add(W,Z),J=r.sub(J,ne),ne=r.add(S,C);let le=r.add(O,k);return ne=r.mul(ne,le),le=r.add(W,G),ne=r.sub(ne,le),le=r.add(E,C),D=r.add(y,k),le=r.mul(le,D),D=r.add(Z,G),le=r.sub(le,D),_=r.mul(H,ne),D=r.mul(K,G),_=r.add(D,_),D=r.sub(Z,_),_=r.add(Z,_),U=r.mul(D,_),Z=r.add(W,W),Z=r.add(Z,W),G=r.mul(H,G),ne=r.mul(K,ne),Z=r.add(Z,G),G=r.sub(W,G),G=r.mul(H,G),ne=r.add(ne,G),W=r.mul(Z,ne),U=r.add(U,W),W=r.mul(le,ne),D=r.mul(J,D),D=r.sub(D,W),W=r.mul(J,Z),_=r.mul(le,_),_=r.add(_,W),new v(D,U,_)}subtract(P){return this.add(P.negate())}is0(){return this.equals(v.ZERO)}multiply(P){const{endo:S}=t;if(!o.isValidNot0(P))throw new Error("invalid scalar: out of range");let E,C;const O=y=>N.cached(this,y,k=>Ia(v,k));if(S){const{k1neg:y,k1:k,k2neg:D,k2:U}=L(P),{p:_,f:H}=O(k),{p:K,f:W}=O(U);C=H.add(W),E=g(S.beta,_,K,y,D)}else{const{p:y,f:k}=O(P);E=y,C=k}return Ia(v,[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===nn||E.is0())return v.ZERO;if(P===gr)return E;if(N.hasCache(this))return this.multiply(P);if(S){const{k1neg:C,k1:O,k2neg:y,k2:k}=L(P),{p1:D,p2:U}=mv(v,E,O,k);return g(S.beta,D,U,C,y)}else return N.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 F(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return i===gr?!0:P?P(v,this):N.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:P}=t;return i===gr?this:P?P(v,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(P=!0){return ns(P,"isCompressed"),this.assertValidity(),p(v,this,P)}toHex(P=!0){return rr(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 Ia(v,P)}static msm(P,S){return gv(v,o,P,S)}static fromPrivateKey(P){return v.BASE.multiply(br(o,P))}}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 A=o.BITS,N=new hv(v,t.endo?Math.ceil(A/2):A);return v.BASE.precompute(8),v}function Ld(e){return Uint8Array.of(e?2:3)}function Rd(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Ev(e,t={}){const{Fn:n}=e,r=t.randomBytes||ol,o=Object.assign(Rd(e.Fp,n),{seed:Td(n.ORDER)});function s(p){try{return!!br(n,p)}catch{return!1}}function i(p,h){const{publicKey:m,publicKeyUncompressed:w}=o;try{const T=p.length;return h===!0&&T!==m||h===!1&&T!==w?!1:!!e.fromBytes(p)}catch{return!1}}function c(p=r(o.seed)){return fv(Bn(p,o.seed,"seed"),n.ORDER)}function a(p,h=!0){return e.BASE.multiply(br(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 T=ze("key",p).length;return T===m||T===w}function d(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=br(n,p);return e.fromHex(h).multiply(w).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:d,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:p=>br(n,p),precompute(p=8,h=e.BASE){return h.precompute(p,!1)}},lengths:o})}function Sv(e,t,n={}){Qu(t),Ji(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||ol,o=n.hmac||((S,...E)=>hd(t,S,dn(...E))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:p}=Ev(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function w(S){const E=c>>gr;return S>E}function T(S,E){if(!i.isValidNot0(E))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return E}function b(S,E){Ma(E);const C=p.signature,O=E==="compact"?C:E==="recovered"?C+1:void 0;return Bn(S,O,`${E} signature`)}class ${constructor(E,C,O){this.r=T("r",E),this.s=T("s",C),O!=null&&(this.recovery=O),Object.freeze(this)}static fromBytes(E,C=m){b(E,C);let O;if(C==="der"){const{r:U,s:_}=tn.toSig(Bn(E));return new $(U,_)}C==="recovered"&&(O=E[0],C="compact",E=E.subarray(1));const y=i.BYTES,k=E.subarray(0,y),D=E.subarray(y,y*2);return new $(i.fromBytes(k),i.fromBytes(D),O)}static fromHex(E,C){return this.fromBytes(Wo(E),C)}addRecoveryBit(E){return new $(this.r,this.s,E)}recoverPublicKey(E){const C=s.ORDER,{r:O,s:y,recovery:k}=this;if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");if(c*Md<C&&k>1)throw new Error("recovery id is ambiguous for h>1 curve");const U=k===2||k===3?O+c:O;if(!s.isValid(U))throw new Error("recovery id 2 or 3 invalid");const _=s.toBytes(U),H=e.fromBytes(dn(Ld((k&1)===0),_)),K=i.inv(U),W=L(ze("msgHash",E)),Z=i.create(-W*K),G=i.create(y*K),J=e.BASE.multiplyUnsafe(Z).add(H.multiplyUnsafe(G));if(J.is0())throw new Error("point at infinify");return J.assertValidity(),J}hasHighS(){return w(this.s)}toBytes(E=m){if(Ma(E),E==="der")return Wo(tn.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 dn(Uint8Array.of(this.recovery),C,O)}return dn(C,O)}toHex(E){return rr(this.toBytes(E))}assertValidity(){}static fromCompact(E){return $.fromBytes(ze("sig",E),"compact")}static fromDER(E){return $.fromBytes(ze("sig",E),"der")}normalizeS(){return this.hasHighS()?new $(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return rr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return rr(this.toBytes("compact"))}}const M=n.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");const C=os(E),O=E.length*8-a;return O>0?C>>BigInt(O):C},L=n.bits2int_modN||function(E){return i.create(M(E))},F=po(a);function j(S){return Py("num < 2^"+a,S,nn,F),i.toBytes(S)}function g(S,E){return Bn(S,void 0,"message"),E?Bn(t(S),void 0,"prehashed message"):S}function v(S,E,C){if(["recovered","canonical"].some(Z=>Z in C))throw new Error("sign() legacy options not supported");const{lowS:O,prehash:y,extraEntropy:k}=La(C,h);S=g(S,y);const D=L(S),U=br(i,E),_=[j(U),j(D)];if(k!=null&&k!==!1){const Z=k===!0?r(p.secretKey):k;_.push(ze("extraEntropy",Z))}const H=dn(..._),K=D;function W(Z){const G=M(Z);if(!i.isValidNot0(G))return;const J=i.inv(G),ne=e.BASE.multiply(G).toAffine(),le=i.create(ne.x);if(le===nn)return;const Se=i.create(J*i.create(K+le*U));if(Se===nn)return;let Me=(ne.x===le?0:2)|Number(ne.y&gr),Y=Se;return O&&w(Se)&&(Y=i.neg(Se),Me^=1),new $(le,Y,Me)}return{seed:H,k2sig:W}}function A(S,E,C={}){S=ze("message",S);const{seed:O,k2sig:y}=v(S,E,C);return Ay(t.outputLen,i.BYTES,o)(O,y)}function N(S){let E;const C=typeof S=="string"||Ho(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 $(S.r,S.s);else if(C){try{E=$.fromBytes(ze("sig",S),"der")}catch(y){if(!(y instanceof tn.Err))throw y}if(!E)try{E=$.fromBytes(ze("sig",S),"compact")}catch{return!1}}return E||!1}function I(S,E,C,O={}){const{lowS:y,prehash:k,format:D}=La(O,h);if(C=ze("publicKey",C),E=g(ze("message",E),k),"strict"in O)throw new Error("options.strict was renamed to lowS");const U=D===void 0?N(S):$.fromBytes(ze("sig",S),D);if(U===!1)return!1;try{const _=e.fromBytes(C);if(y&&U.hasHighS())return!1;const{r:H,s:K}=U,W=L(E),Z=i.inv(K),G=i.create(W*Z),J=i.create(H*Z),ne=e.BASE.multiplyUnsafe(G).add(_.multiplyUnsafe(J));return ne.is0()?!1:i.create(ne.x)===H}catch{return!1}}function P(S,E,C={}){const{prehash:O}=La(C,h);return E=g(E,O),$.fromBytes(S,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:p,Point:e,sign:A,verify:I,recoverPublicKey:P,Signature:$,hash:t})}function Pv(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=yo(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 Av(e){const{CURVE:t,curveOpts:n}=Pv(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 $v(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,Ad(n.Fn.ORDER,n.Fn.BITS))})}function Tv(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=Av(e),s=xv(t,n),i=Sv(s,r,o);return $v(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Cv(e,t){const n=r=>Tv({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ra={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Ov={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Dd=BigInt(2);function Iv(e){const t=Ra.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,d=st(l,n,t)*l%t,f=st(d,n,t)*l%t,p=st(f,Dd,t)*u%t,h=st(p,o,t)*p%t,m=st(h,s,t)*h%t,w=st(m,c,t)*m%t,T=st(w,a,t)*w%t,b=st(T,c,t)*m%t,$=st(b,n,t)*l%t,M=st($,i,t)*h%t,L=st(M,r,t)*u%t,F=st(L,Dd,t);if(!Da.eql(Da.sqr(F),e))throw new Error("Cannot find square root");return F}const Da=yo(Ra.p,{sqrt:Iv}),Fd=Cv({...Ra,Fp:Da,lowS:!0,endo:Ov},Yl),Nv=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Fd},Symbol.toStringTag,{value:"Module"}));function kv({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 Fd.Signature(Ct(e),Ct(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:wt(i)}async function Fa(e,t){var d,f,p;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(p=(f=(d=e.chain)==null?void 0:d.contracts)==null?void 0:f.universalSignatureVerifier)==null?void 0:p.address,...a}=t,u=bt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?kv(i):Te(i),l=await(async()=>!r&&!o||yw(u)?u:ww({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:It({abi:Cf,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:aa({abi:Cf,args:[n,s,l],bytecode:Qy}),...a},{data:m}=await re(e,ho,"call")(h);return Pg(m??"0x0")}catch(h){try{if(ts($n(n),await Dl({hash:s,signature:i})))return!0}catch{}if(h instanceof Ml)return!1;throw h}}async function Bv(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=td(n);return Fa(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function Mv(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,d=uw({message:i,primaryType:c,types:a,domain:u});return Fa(e,{address:n,factory:r,factoryData:o,hash:d,signature:s,...l})}function jd(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 d=Ce(["watchBlockNumber",e.uid,t,n,i]);return gn(d,{onBlockNumber:r,onError:o},f=>mo(async()=>{var p;try{const h=await re(e,go,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)f.onBlockNumber(m,a),a=m}(!a||h>a)&&(f.onBlockNumber(h,a),a=h)}catch(h){(p=f.onError)==null||p.call(f,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const d=Ce(["watchBlockNumber",e.uid,t,n]);return gn(d,{onBlockNumber:r,onError:o},f=>{let p=!0,h=()=>p=!1;return(async()=>{try{const m=(()=>{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:w}=await m.subscribe({params:["newHeads"],onData(T){var $;if(!p)return;const b=Ct(($=T.result)==null?void 0:$.number);f.onBlockNumber(b,a),a=b},onError(T){var b;(b=f.onError)==null||b.call(f,T)}});h=w,p||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function Lv(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 d,f,p,h=!1,m,w;const{promise:T,resolve:b,reject:$}=kf(),M=a?setTimeout(()=>{w(),m(),$(new Bb({hash:o}))},a):void 0;return m=gn(u,{onReplaced:s,resolve:b,reject:$},async L=>{if(p=await re(e,ps,"getTransactionReceipt")({hash:o}).catch(()=>{}),p&&r<=1){clearTimeout(M),L.resolve(p),m();return}w=re(e,jd,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(F){const j=v=>{clearTimeout(M),w(),v(),m()};let g=F;if(!h)try{if(p){if(r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;j(()=>L.resolve(p));return}if(n&&!d&&(h=!0,await fa(async()=>{d=await re(e,wa,"getTransaction")({hash:o}),d.blockNumber&&(g=d.blockNumber)},{delay:c,retryCount:i}),h=!1),p=await re(e,ps,"getTransactionReceipt")({hash:o}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;j(()=>L.resolve(p))}catch(v){if(v instanceof kl||v instanceof Bl){if(!d){h=!1;return}try{f=d,h=!0;const A=await fa(()=>re(e,Nt,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:P})=>P instanceof zl});h=!1;const N=A.transactions.find(({from:P,nonce:S})=>P===f.from&&S===f.nonce);if(!N||(p=await re(e,ps,"getTransactionReceipt")({hash:N.hash}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r)))return;let I="replaced";N.to===f.to&&N.value===f.value&&N.input===f.input?I="repriced":N.from===N.to&&N.value===0n&&(I="cancelled"),j(()=>{var P;(P=L.onReplaced)==null||P.call(L,{reason:I,replacedTransaction:f,transaction:N,transactionReceipt:p}),L.resolve(p)})}catch(A){j(()=>L.reject(A))}}else j(()=>L.reject(v))}}})}),T}function Rv(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 d;return u?(()=>{const h=Ce(["watchBlocks",e.uid,t,n,r,l,a]);return gn(h,{onBlock:o,onError:s},m=>mo(async()=>{var w;try{const T=await re(e,Nt,"getBlock")({blockTag:t,includeTransactions:l});if(T.number!==null&&(d==null?void 0:d.number)!=null){if(T.number===d.number)return;if(T.number-d.number>1&&n)for(let b=(d==null?void 0:d.number)+1n;b<T.number;b++){const $=await re(e,Nt,"getBlock")({blockNumber:b,includeTransactions:l});m.onBlock($,d),d=$}}((d==null?void 0:d.number)==null||t==="pending"&&(T==null?void 0:T.number)==null||T.number!==null&&T.number>d.number)&&(m.onBlock(T,d),d=T)}catch(T){(w=m.onError)==null||w.call(m,T)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,w=()=>h=!1;return(async()=>{try{r&&re(e,Nt,"getBlock")({blockTag:t,includeTransactions:l}).then($=>{h&&m&&(o($,void 0),m=!1)}).catch(s);const T=(()=>{if(e.transport.type==="fallback"){const $=e.transport.transports.find(M=>M.config.type==="webSocket"||M.config.type==="ipc");return $?$.value:e.transport}return e.transport})(),{unsubscribe:b}=await T.subscribe({params:["newHeads"],async onData($){var L;if(!h)return;const M=await re(e,Nt,"getBlock")({blockNumber:(L=$.result)==null?void 0:L.number,includeTransactions:l}).catch(()=>{});h&&(o(M,d),m=!1,d=M)},onError($){s==null||s($)}});w=b,h||w()}catch(T){s==null||s(T)}})(),()=>w()})()}function Dv(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:d}){const f=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=d??!1;return f?(()=>{const w=Ce(["watchEvent",t,n,r,e.uid,o,l,i]);return gn(w,{onLogs:a,onError:c},T=>{let b;i!==void 0&&(b=i-1n);let $,M=!1;const L=mo(async()=>{var F;if(!M){try{$=await re(e,Vf,"createEventFilter")({address:t,args:n,event:o,events:s,strict:p,fromBlock:i})}catch{}M=!0;return}try{let j;if($)j=await re(e,ss,"getFilterChanges")({filter:$});else{const g=await re(e,go,"getBlockNumber")({});b&&b!==g?j=await re(e,qi,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:b+1n,toBlock:g}):j=[],b=g}if(j.length===0)return;if(r)T.onLogs(j);else for(const g of j)T.onLogs([g])}catch(j){$&&j instanceof In&&(M=!1),(F=T.onError)==null||F.call(T,j)}},{emitOnBegin:!0,interval:l});return async()=>{$&&await re(e,is,"uninstallFilter")({filter:$}),L()}})})():(()=>{let w=!0,T=()=>w=!1;return(async()=>{try{const b=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),$=s??(o?[o]:void 0);let M=[];$&&(M=[$.flatMap(j=>Ur({abi:[j],eventName:j.name,args:n}))],o&&(M=M[0]));const{unsubscribe:L}=await b.subscribe({params:["logs",{address:t,topics:M}],onData(F){var g;if(!w)return;const j=F.result;try{const{eventName:v,args:A}=Vi({abi:$??[],data:j.data,topics:j.topics,strict:p}),N=Qt(j,{args:A,eventName:v});a([N])}catch(v){let A,N;if(v instanceof Rr||v instanceof Uo){if(d)return;A=v.abiItem.name,N=(g=v.abiItem.inputs)==null?void 0:g.some(P=>!("name"in P&&P.name))}const I=Qt(j,{args:N?[]:{},eventName:A});a([I])}},onError(F){c==null||c(F)}});T=L,w||T()}catch(b){c==null||c(b)}})(),()=>T()})()}function Fv(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 gn(u,{onTransactions:r,onError:n},l=>{let d;const f=mo(async()=>{var p;try{if(!d)try{d=await re(e,Gf,"createPendingTransactionFilter")({});return}catch(m){throw f(),m}const h=await re(e,ss,"getFilterChanges")({filter:d});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()=>{d&&await re(e,is,"uninstallFilter")({filter:d}),f()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(f){if(!u)return;const p=f.result;r([p])},onError(f){n==null||n(f)}});l=d,u||l()}catch(d){n==null||n(d)}})(),()=>l()})()}function jv(e){var d,f,p;const{scheme:t,statement:n,...r}=((d=e.match(_v))==null?void 0:d.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((f=e.match(Uv))==null?void 0:f.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 _v=/^(?:(?<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)?/,Uv=/(?: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 zv(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||!rt(r.address,{strict:!1})||t&&!ts(r.address,t))return!1}catch{return!1}return!0}async function Hv(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=jv(o);if(!l.address||!zv({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const f=td(o);return Fa(e,{address:l.address,hash:f,signature:c,...u})}function Wv(e){return{call:t=>ho(e,t),createAccessList:t=>Wf(e,t),createBlockFilter:()=>V1(e),createContractEventFilter:t=>xl(e,t),createEventFilter:t=>Vf(e,t),createPendingTransactionFilter:()=>Gf(e),estimateContractGas:t=>vy(e,t),estimateGas:t=>Wi(e,t),getBalance:t=>of(e,t),getBlobBaseFee:()=>G1(e),getBlock:t=>Nt(e,t),getBlockNumber:t=>go(e,t),getBlockTransactionCount:t=>q1(e,t),getBytecode:t=>qf(e,t),getChainId:()=>tf(e),getCode:t=>qf(e,t),getContractEvents:t=>af(e,t),getEip712Domain:t=>K1(e,t),getEnsAddress:t=>O1(e,t),getEnsAvatar:t=>z1(e,t),getEnsName:t=>H1(e,t),getEnsResolver:t=>W1(e,t),getEnsText:t=>Hf(e,t),getFeeHistory:t=>Q1(e,t),estimateFeesPerGas:t=>ry(e,t),getFilterChanges:t=>ss(e,t),getFilterLogs:t=>J1(e,t),getGasPrice:()=>Ui(e),getLogs:t=>qi(e,t),getProof:t=>Pw(e,t),estimateMaxPriorityFeePerGas:t=>ny(e,t),getStorageAt:t=>Aw(e,t),getTransaction:t=>wa(e,t),getTransactionConfirmations:t=>$w(e,t),getTransactionCount:t=>ql(e,t),getTransactionReceipt:t=>ps(e,t),multicall:t=>Tw(e,t),prepareTransactionRequest:t=>rf(e,t),readContract:t=>en(e,t),sendRawTransaction:t=>d1(e,t),simulate:t=>va(e,t),simulateBlocks:t=>va(e,t),simulateCalls:t=>nv(e,t),simulateContract:t=>o1(e,t),verifyMessage:t=>Bv(e,t),verifySiweMessage:t=>Hv(e,t),verifyTypedData:t=>Mv(e,t),uninstallFilter:t=>is(e,t),waitForTransactionReceipt:t=>Lv(e,t),watchBlocks:t=>Rv(e,t),watchBlockNumber:t=>jd(e,t),watchContractEvent:t=>f1(e,t),watchEvent:t=>Dv(e,t),watchPendingTransactions:t=>Fv(e,t)}}function ja(e){const{key:t="public",name:n="Public Client"}=e;return m1({...e,key:t,name:n,type:"publicClient"}).extend(Wv)}const _a=Yf({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}}}),_d=Yf({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 bs({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,d;const f=async()=>{try{const p=await e.readContract({address:t,abi:fr,functionName:"balanceOf",args:[n]});c(p),u($i(p,r))}catch{u(o)}};f();try{l=e.watchContractEvent({address:t,abi:fr,eventName:"Transfer",args:{to:n},onLogs:()=>{f()},poll:!0,pollingInterval:s}),d=e.watchContractEvent({address:t,abi:fr,eventName:"Transfer",args:{from:n},onLogs:()=>{f()},poll:!0,pollingInterval:s})}catch{}return()=>{l==null||l(),d==null||d()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const Vv="0x55d398326f99059fF775485246999027B3197955",Gv="0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",qv="0xaf88d065e77c8cC2239327C5EDb3A432268e5831",Zv="0x0520b0a951658db92b8a2dd9f146bb8223638740",Kv="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",Yv="0x81144d6E7084928830f9694a201E8c1ce6eD0cb2";function Ud(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 Xv(e={}){const{bscRpcUrl:t,arbitrumRpcUrl:n,pollingInterval:r=12e3}=e,o=x.useMemo(()=>{var i,c,a;return ja({chain:_d,transport:pa(Ud(t,typeof window<"u"?(i=window==null?void 0:window.ENV)==null?void 0:i.CHAIN_RPC_URL_56:void 0,((a=(c=_d.rpcUrls)==null?void 0:c.default)==null?void 0:a.http)||[]))})},[t]),s=x.useMemo(()=>{var i,c,a;return ja({chain:_a,transport:pa(Ud(n,typeof window<"u"?(i=window==null?void 0:window.ENV)==null?void 0:i.CHAIN_RPC_URL_42161:void 0,((a=(c=_a.rpcUrls)==null?void 0:c.default)==null?void 0:a.http)||[]))})},[n]);return bs({client:o,tokenAddress:Vv,holder:Zv,decimals:18,fallbackFormatted:"0",pollingInterval:r}),bs({client:s,tokenAddress:Gv,holder:Kv,decimals:6,fallbackFormatted:"0",pollingInterval:r}),bs({client:s,tokenAddress:qv,holder:Yv,decimals:6,fallbackFormatted:"0",pollingInterval:r}),{BNB_USDT_BALANCE:"13000",ARB_USDT_BALANCE:"0",ARB_USDC_BALANCE:"11000"}}const Qv=()=>({openDeposit:x.useCallback(t=>{},[])}),Jv=()=>({openWithdraw:x.useCallback(t=>{},[])}),Fn="MPC",Ua="EVM";/**
78
78
  * @license lucide-react v0.540.0 - ISC
79
79
  *
80
80
  * This source code is licensed under the ISC license.
81
81
  * See the LICENSE file in the root directory of this source tree.
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};/**
82
+ */const ex=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),tx=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),zd=e=>{const t=tx(e);return t.charAt(0).toUpperCase()+t.slice(1)},Hd=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),nx=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
83
83
  * @license lucide-react v0.540.0 - ISC
84
84
  *
85
85
  * This source code is licensed under the ISC license.
86
86
  * See the LICENSE file in the root directory of this source tree.
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"};/**
87
+ */var rx={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"};/**
88
88
  * @license lucide-react v0.540.0 - ISC
89
89
  *
90
90
  * This source code is licensed under the ISC license.
91
91
  * See the LICENSE file in the root directory of this source tree.
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]]));/**
92
+ */const ox=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,...rx,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Hd("lucide",o),...!s&&!nx(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,l])=>x.createElement(u,l)),...Array.isArray(s)?s:[s]]));/**
93
93
  * @license lucide-react v0.540.0 - ISC
94
94
  *
95
95
  * This source code is licensed under the ISC license.
96
96
  * See the LICENSE file in the root directory of this source tree.
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};/**
97
+ */const sx=(e,t)=>{const n=x.forwardRef(({className:r,...o},s)=>x.createElement(ox,{ref:s,iconNode:t,className:Hd(`lucide-${ex(zd(e))}`,`lucide-${e}`,r),...o}));return n.displayName=zd(e),n};/**
98
98
  * @license lucide-react v0.540.0 - ISC
99
99
  *
100
100
  * This source code is licensed under the ISC license.
101
101
  * See the LICENSE file in the root directory of this source tree.
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(`
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(`
102
+ */const Wd=sx("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ix=({tokens:e,selectedToken:t,onTokenChange:n})=>B.jsx("div",{className:"bg-fill-input-primary flex rounded-lg p-1",children:e.map(r=>B.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:[B.jsx("img",{src:r.iconUrl,alt:r.token,className:"w-4 h-4 rounded-full"}),B.jsx("span",{className:"ml-1",children:r.token||r.symbol})]},r.token))}),Vd=typeof document<"u"?x.useLayoutEffect:()=>{};var za;const ax=(za=x.useInsertionEffect)!==null&&za!==void 0?za:Vd;function cx(e){const t=x.useRef(null);return ax(()=>{t.current=e},[e]),x.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const bn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},jn=e=>e&&"window"in e&&e.window===e?e:bn(e).defaultView||window;function ux(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function lx(e){return ux(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let fx=!1;function Ha(){return fx}function Gd(e,t){if(!Ha())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:lx(n)?n=n.host:n=n.parentNode}return!1}const Wa=(e=document)=>{var t;if(!Ha())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 qd(e){return Ha()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function ys(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 Va(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 rn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ga=rn(function(){return Va(/^Mac/i)}),dx=rn(function(){return Va(/^iPhone/i)}),px=rn(function(){return Va(/^iPad/i)||Ga()&&navigator.maxTouchPoints>1}),hx=rn(function(){return dx()||px()});rn(function(){return Ga()||hx()}),rn(function(){return ys(/AppleWebKit/i)&&!mx()});const mx=rn(function(){return ys(/Chrome/i)}),gx=rn(function(){return ys(/Android/i)});rn(function(){return ys(/Firefox/i)});function Zd(){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 bx(e){return e.mozInputSource===0&&e.isTrusted?!0:gx()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Kd(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function yx(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Yd(e){let t=x.useRef({isFocused:!1,observer:null});Vd(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=cx(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=Kd(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 wx=!1,wo=null,qa=new Set,vo=new Map,_n=!1,Za=!1;const vx={Tab:!0,Escape:!0};function Ka(e,t){for(let n of qa)n(e,t)}function xx(e){return!(e.metaKey||!Ga()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ws(e){_n=!0,xx(e)&&(wo="keyboard",Ka("keyboard",e))}function it(e){wo="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(_n=!0,Ka("pointer",e))}function Xd(e){bx(e)&&(_n=!0,wo="virtual")}function Qd(e){e.target===window||e.target===document||wx||!e.isTrusted||(!_n&&!Za&&(wo="virtual",Ka("virtual",e)),_n=!1,Za=!1)}function Jd(){_n=!1,Za=!0}function Ya(e){if(typeof window>"u"||typeof document>"u"||vo.get(jn(e)))return;const t=jn(e),n=bn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){_n=!0,r.apply(this,arguments)},n.addEventListener("keydown",ws,!0),n.addEventListener("keyup",ws,!0),n.addEventListener("click",Xd,!0),t.addEventListener("focus",Qd,!0),t.addEventListener("blur",Jd,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",it,!0),n.addEventListener("pointermove",it,!0),n.addEventListener("pointerup",it,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",it,!0),n.addEventListener("mousemove",it,!0),n.addEventListener("mouseup",it,!0)),t.addEventListener("beforeunload",()=>{ep(e)},{once:!0}),vo.set(t,{focus:r})}const ep=(e,t)=>{const n=jn(e),r=bn(e);t&&r.removeEventListener("DOMContentLoaded",t),vo.has(n)&&(n.HTMLElement.prototype.focus=vo.get(n).focus,r.removeEventListener("keydown",ws,!0),r.removeEventListener("keyup",ws,!0),r.removeEventListener("click",Xd,!0),n.removeEventListener("focus",Qd,!0),n.removeEventListener("blur",Jd,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",it,!0),r.removeEventListener("pointermove",it,!0),r.removeEventListener("pointerup",it,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",it,!0),r.removeEventListener("mousemove",it,!0),r.removeEventListener("mouseup",it,!0)),vo.delete(n))};function Ex(e){const t=bn(e);let n;return t.readyState!=="loading"?Ya(e):(n=()=>{Ya(e)},t.addEventListener("DOMContentLoaded",n)),()=>ep(e,n)}typeof document<"u"&&Ex();function tp(){return wo!=="pointer"}const Sx=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Px(e,t,n){let r=bn(n==null?void 0:n.target);const o=typeof window<"u"?jn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?jn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?jn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?jn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Sx.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!vx[n.key])}function Ax(e,t,n){Ya(),x.useEffect(()=>{let r=(o,s)=>{Px(!!(n!=null&&n.isTextInput),o,s)&&e(tp())};return qa.add(r),()=>{qa.delete(r)}},t)}function $x(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=Yd(s),c=x.useCallback(a=>{const u=bn(a.target),l=u?Wa(u):Wa();a.target===a.currentTarget&&l===qd(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 Tx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=x.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=Zd(),a=x.useCallback(d=>{d.currentTarget.contains(d.target)&&s.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(d),o&&o(!1))},[n,o,s,c]),u=Yd(a),l=x.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const f=bn(d.target),p=Wa(f);if(!s.current.isFocusWithin&&p===qd(d.nativeEvent)){r&&r(d),o&&o(!0),s.current.isFocusWithin=!0,u(d);let h=d.currentTarget;i(f,"focus",m=>{if(s.current.isFocusWithin&&!Gd(h,m.target)){let w=new f.defaultView.FocusEvent("blur",{relatedTarget:m.target});yx(w,h);let T=Kd(w);a(T)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let vs=!1,xs=0;function Xa(){vs=!0,setTimeout(()=>{vs=!1},50)}function np(e){e.pointerType==="touch"&&Xa()}function Cx(){if(!(typeof document>"u"))return xs===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",np):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Xa)),xs++,()=>{xs--,!(xs>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",np):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Xa))}}function Ox(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(Cx,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=Zd(),{hoverProps:l,triggerHoverEnd:d}=x.useMemo(()=>{let f=(m,w)=>{if(c.pointerType=w,o||w==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let T=m.currentTarget;c.target=T,a(bn(m.target),"pointerover",b=>{c.isHovered&&c.target&&!Gd(c.target,b.target)&&p(b,b.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:T,pointerType:w}),n&&n(!0),i(!0)},p=(m,w)=>{let T=c.target;c.pointerType="",c.target=null,!(w==="touch"||!c.isHovered||!T)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:T,pointerType:w}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{vs&&m.pointerType==="mouse"||f(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&&!vs&&f(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&&d({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function Ix(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=x.useRef({isFocused:!1,isFocusVisible:t||tp()}),[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]);Ax(p=>{o.current.isFocusVisible=p,u()},[],{isTextInput:n});let{focusProps:d}=$x({isDisabled:r,onFocusChange:l}),{focusWithinProps:f}=Tx({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?f:d}}var Nx=Object.defineProperty,kx=(e,t,n)=>t in e?Nx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qa=(e,t,n)=>(kx(e,typeof t!="symbol"?t+"":t,n),n);let Bx=class{constructor(){Qa(this,"current",this.detect()),Qa(this,"handoffState","pending"),Qa(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"}},Mt=new Bx;function xo(e){var t,n;return Mt.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 rp(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Pt(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return rp(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Pt();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function yr(){let[e]=x.useState(Pt);return x.useEffect(()=>()=>e.dispose(),[e]),e}let ye=(e,t)=>{Mt.isServer?x.useEffect(e,t):x.useLayoutEffect(e,t)};function Un(e){let t=x.useRef(e);return ye(()=>{t.current=e},[e]),t}let ue=function(e){let t=Un(e);return x.useCallback((...n)=>t.current(...n),[t])};function Mx(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 Lx(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Rx({disabled:e=!1}={}){let t=x.useRef(null),[n,r]=x.useState(!1),o=yr(),s=ue(()=>{t.current=null,r(!1),o.dispose()}),i=ue(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=xo(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Mx(u);r(Lx(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Dx=x.createContext(void 0);function Ja(){return x.useContext(Dx)}function ec(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function at(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,at),r}var Es=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Es||{}),yn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(yn||{});function Qe(){let e=jx();return x.useCallback(t=>Fx({mergeRefs:e,...t}),[e])}function Fx({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??_x;let a=op(t,e);if(s)return Ss(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...d}=a;if(l)return Ss(d,n,r,i,c)}if(u&1){let{unmount:l=!0,...d}=a;return at(l?0:1,{0(){return null},1(){return Ss({...d,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return Ss(a,n,r,i,c)}function Ss(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=tc(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 d={};if(t){let f=!1,p=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(f=!0),m===!0&&p.push(h.replace(/([A-Z])/g,w=>`-${w.toLowerCase()}`));if(f){d["data-headlessui-state"]=p.join(" ");for(let h of p)d[`data-${h}`]=""}}if(s===x.Fragment&&(Object.keys(wn(a)).length>0||Object.keys(wn(d)).length>0))if(!x.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(wn(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(wn(a)).concat(Object.keys(wn(d))).map(f=>` - ${f}`).join(`
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(f=>` - ${f}`).join(`
104
104
  `)].join(`
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={};/**
105
+ `))}else{let f=l.props,p=f==null?void 0:f.className,h=typeof p=="function"?(...T)=>ec(p(...T),a.className):ec(p,a.className),m=h?{className:h}:{},w=op(l.props,wn(tc(a,["ref"])));for(let T in d)T in w&&delete d[T];return x.cloneElement(l,Object.assign({},w,d,u,{ref:o(Ux(l),u.ref)},m))}return x.createElement(s,Object.assign({},tc(a,["ref"]),s!==x.Fragment&&u,s!==x.Fragment&&d),l)}function jx(){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 _x(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function op(...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 sp(...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 We(e){var t;return Object.assign(x.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function wn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function tc(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Ux(e){return x.version.split(".")[0]>="19"?e.props.ref:e.ref}function zx(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,ue(u=>(s||o(u),t==null?void 0:t(u)))]}function Hx(e){let[t]=x.useState(e);return t}function ip(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))cp(n,ap(t,r),o);return n}function ap(e,t){return e?e+"["+t+"]":t}function cp(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())cp(e,ap(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,""]):ip(n,t,e)}function Wx(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 Vx="span";var nc=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(nc||{});function Gx(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 Qe()({ourProps:s,theirProps:o,slot:{},defaultTag:Vx,name:"Hidden"})}let up=We(Gx),qx=x.createContext(null);function Zx({children:e}){let t=x.useContext(qx);if(!t)return x.createElement(x.Fragment,null,e);let{target:n}=t;return n?Le.createPortal(x.createElement(x.Fragment,null,e),n):null}function Kx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=x.useState(null),c=yr();return x.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),x.createElement(Zx,null,x.createElement(Yx,{setForm:i,formId:t}),ip(e).map(([a,u])=>x.createElement(up,{features:nc.Hidden,...wn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function Yx({setForm:e,formId:t}){return x.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:x.createElement(up,{features:nc.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Xx=x.createContext(void 0);function lp(){return x.useContext(Xx)}function rc(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ps(e){return rc(e)&&"tagName"in e}function on(e){return Ps(e)&&"accessKey"in e}function wr(e){return Ps(e)&&"tabIndex"in e}function Qx(e){return Ps(e)&&"style"in e}function Jx(e){return on(e)&&e.nodeName==="IFRAME"}function fp(e){return on(e)&&e.nodeName==="INPUT"}function dp(e){return on(e)&&e.nodeName==="LABEL"}function eE(e){return on(e)&&e.nodeName==="FIELDSET"}function pp(e){return on(e)&&e.nodeName==="LEGEND"}function tE(e){return Ps(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function nE(e){let t=e.parentElement,n=null;for(;t&&!eE(t);)pp(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&rE(n)?!1:r}function rE(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(pp(t))return!1;t=t.previousElementSibling}return!0}let hp=Symbol();function oE(e,t=!0){return Object.assign(e,{[hp]:t})}function ct(...e){let t=x.useRef(e);x.useEffect(()=>{t.current=e},[e]);let n=ue(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[hp]))?void 0:n}let oc=x.createContext(null);oc.displayName="DescriptionContext";function mp(){let e=x.useContext(oc);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,mp),t}return e}function sE(){var e,t;return(t=(e=x.useContext(oc))==null?void 0:e.value)!=null?t:void 0}let iE="p";function aE(e,t){let n=x.useId(),r=Ja(),{id:o=`headlessui-description-${n}`,...s}=e,i=mp(),c=ct(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 Qe()({ourProps:l,theirProps:s,slot:u,defaultTag:iE,name:i.name||"Description"})}let cE=We(aE);Object.assign(cE,{});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 As=x.createContext(null);As.displayName="LabelContext";function gp(){let e=x.useContext(As);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,gp),t}return e}function bp(e){var t,n,r;let o=(n=(t=x.useContext(As))==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 uE({inherit:e=!1}={}){let t=bp(),[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=ue(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),d=l.indexOf(a);return d!==-1&&l.splice(d,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(As.Provider,{value:c},s.children)},[r])]}let lE="label";function fE(e,t){var n;let r=x.useId(),o=gp(),s=lp(),i=Ja(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,d=ct(t);ye(()=>o.register(c),[c,o.register]);let f=ue(w=>{let T=w.currentTarget;if(!(w.target!==w.currentTarget&&tE(w.target))&&(dp(T)&&w.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(w),dp(T))){let b=document.getElementById(T.htmlFor);if(b){let $=b.getAttribute("disabled");if($==="true"||$==="")return;let M=b.getAttribute("aria-disabled");if(M==="true"||M==="")return;(fp(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=x.useMemo(()=>({...o.slot,disabled:p}),[o.slot,p]),m={ref:d,...o.props,id:c,htmlFor:a,onClick:f};return u&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in l&&delete l.onClick),Qe()({ourProps:m,theirProps:l,slot:h,defaultTag:a?lE:"div",name:o.name||"Label"})}let dE=We(fE),pE=Object.assign(dE,{});function hE(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 mE(e=hE){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 gE(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function bE(e,t=!1){let[n,r]=x.useReducer(()=>({}),{}),o=x.useMemo(()=>gE(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 yp=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 yE=Object.defineProperty,wE=(e,t,n)=>t in e?yE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vE=(e,t,n)=>(wE(e,t+"",n),n),wp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ut=(e,t,n)=>(wp(e,t,"read from private field"),n?n.call(e):t.get(e)),sc=(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)},vp=(e,t,n,r)=>(wp(e,t,"write to private field"),t.set(e,n),n),Lt,Eo,So;let xp=class{constructor(t){sc(this,Lt,{}),sc(this,Eo,new yp(()=>new Set)),sc(this,So,new Set),vE(this,"disposables",Pt()),vp(this,Lt,t),Mt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return ut(this,Lt)}subscribe(t,n){if(Mt.isServer)return()=>{};let r={selector:t,callback:n,current:t(ut(this,Lt))};return ut(this,So).add(r),this.disposables.add(()=>{ut(this,So).delete(r)})}on(t,n){return Mt.isServer?()=>{}:(ut(this,Eo).get(t).add(n),this.disposables.add(()=>{ut(this,Eo).get(t).delete(n)}))}send(t){let n=this.reduce(ut(this,Lt),t);if(n!==ut(this,Lt)){vp(this,Lt,n);for(let r of ut(this,So)){let o=r.selector(ut(this,Lt));Ep(r.current,o)||(r.current=o,r.callback(o))}for(let r of ut(this,Eo).get(t.type))r(ut(this,Lt),t)}}};Lt=new WeakMap,Eo=new WeakMap,So=new WeakMap;function Ep(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:ic(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:ic(e.entries(),t.entries()):Sp(e)&&Sp(t)?ic(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function ic(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 Sp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function ac(e){let[t,n]=e(),r=Pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var xE=Object.defineProperty,EE=(e,t,n)=>t in e?xE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pp=(e,t,n)=>(EE(e,typeof t!="symbol"?t+"":t,n),n),Ap=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Ap||{});let SE={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}}},PE=class sm extends xp{constructor(){super(...arguments),Pp(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Pp(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new sm({stack:[]})}reduce(t,n){return at(n.type,SE,t,n)}};const cc=new yp(()=>PE.new());var uc={exports:{}},lc={};/**
106
106
  * @license React
107
107
  * use-sync-external-store-with-selector.production.js
108
108
  *
@@ -110,7 +110,7 @@ ${Cb(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
110
110
  *
111
111
  * This source code is licensed under the MIT license found in the
112
112
  * LICENSE file in the root directory of this source tree.
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={};/**
113
+ */var $p;function AE(){if($p)return lc;$p=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 lc.useSyncExternalStoreWithSelector=function(a,u,l,d,f){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(L){if(!T){if(T=!0,b=L,L=d(L),f!==void 0&&h.hasValue){var F=h.value;if(f(F,L))return $=F}return $=L}if(F=$,n(b,L))return F;var j=d(L);return f!==void 0&&f(F,j)?(b=L,F):(b=L,$=j)}var T=!1,b,$,M=l===void 0?null:l;return[function(){return w(u())},M===null?void 0:function(){return w(M())}]},[u,l,d,f]);var m=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},lc}var fc={};/**
114
114
  * @license React
115
115
  * use-sync-external-store-with-selector.development.js
116
116
  *
@@ -118,29 +118,29 @@ ${Cb(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
118
118
  *
119
119
  * This source code is licensed under the MIT license found in the
120
120
  * LICENSE file in the root directory of this source tree.
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}}/*!
121
+ */var Tp;function $E(){return Tp||(Tp=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;fc.useSyncExternalStoreWithSelector=function(a,u,l,d,f){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(L){if(!T){if(T=!0,b=L,L=d(L),f!==void 0&&h.hasValue){var F=h.value;if(f(F,L))return $=F}return $=L}if(F=$,n(b,L))return F;var j=d(L);return f!==void 0&&f(F,j)?(b=L,F):(b=L,$=j)}var T=!1,b,$,M=l===void 0?null:l;return[function(){return w(u())},M===null?void 0:function(){return w(M())}]},[u,l,d,f]);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())}()),fc}process.env.NODE_ENV==="production"?uc.exports=AE():uc.exports=$E();var TE=uc.exports;function lt(e,t,n=Ep){return TE.useSyncExternalStoreWithSelector(ue(r=>e.subscribe(CE,r)),ue(()=>e.state),ue(()=>e.state),ue(t),n)}function CE(e){return e}function Cp(e,t){let n=x.useId(),r=cc.get(t),[o,s]=lt(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 dc=new Map,Po=new Map;function Op(e){var t;let n=(t=Po.get(e))!=null?t:0;return Po.set(e,n+1),n!==0?()=>Ip(e):(dc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Ip(e))}function Ip(e){var t;let n=(t=Po.get(e))!=null?t:1;if(n===1?Po.delete(e):Po.set(e,n-1),n!==1)return;let r=dc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,dc.delete(e))}function OE(e,{allowed:t,disallowed:n}={}){let r=Cp(e,"inert-others");ye(()=>{var o,s;if(!r)return;let i=Pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(Op(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=xo(a);if(!u)continue;let l=a.parentElement;for(;l&&l!==u.body;){for(let d of l.children)c.some(f=>d.contains(f))||i.add(Op(d));l=l.parentElement}}return i.dispose},[r,t,n])}function IE(e,t,n){let r=Un(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:on(t)?t:t.current;if(!o)return;let s=Pt();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let pc=["[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(","),NE=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var hc=(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))(hc||{}),kE=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(kE||{}),BE=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(BE||{});function Np(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(pc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function ME(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(NE)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var mc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(mc||{});function kp(e,t=0){var n;return e===((n=xo(e))==null?void 0:n.body)?!1:at(t,{0(){return e.matches(pc)},1(){let r=e;for(;r!==null;){if(r.matches(pc))return!0;r=r.parentElement}return!1}})}var LE=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(LE||{});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 RE=["textarea","input"].join(",");function DE(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,RE))!=null?n:!1}function Bp(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 FE(e,t){return jE(Np(),t,{relativeTo:e})}function jE(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?Bp(e):e:t&64?ME(e):Np(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,d=i.length,f;do{if(l>=d||l+d<=0)return 0;let p=a+l;if(t&16)p=(p+d)%d;else{if(p<0)return 3;if(p>=d)return 1}f=i[p],f==null||f.focus(u),l+=c}while(f!==s.activeElement);return t&6&&DE(f)&&f.select(),2}function Mp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function _E(){return/Android/gi.test(window.navigator.userAgent)}function Lp(){return Mp()||_E()}function vr(e,t,n,r){let o=Un(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 UE(e,t,n,r){let o=Un(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 Rp=30;function zE(e,t,n){let r=Un(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 d(f){return typeof f=="function"?d(f()):Array.isArray(f)||f instanceof Set?f:[f]}(t);for(let d of l)if(d!==null&&(d.contains(u)||c.composed&&c.composedPath().includes(d)))return;return!kp(u,mc.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=x.useRef(null);vr(e,"pointerdown",c=>{var a,u;Lp()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),vr(e,"pointerup",c=>{if(Lp()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=x.useRef({x:0,y:0});vr(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),vr(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Rp||Math.abs(a.y-i.current.y)>=Rp))return o(c,()=>wr(c.target)?c.target:null)},!0),UE(e,"blur",c=>o(c,()=>Jx(window.document.activeElement)?window.document.activeElement:null),!0)}function gc(...e){return x.useMemo(()=>xo(...e),[...e])}var HE=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(HE||{});const $s={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},WE=200,Dp=5;function VE(e,{trigger:t,action:n,close:r,select:o}){let s=x.useRef(null),i=x.useRef(null),c=x.useRef(null);vr(e&&t!==null,"pointerdown",a=>{rc(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),vr(e&&t!==null,"pointerup",a=>{var u,l;let d=s.current;if(d===null||(s.current=null,!wr(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<Dp&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<Dp)return;let f=n(a);switch(f.kind){case 0:return;case 1:{a.timeStamp-d>WE&&(o(f.target),r());break}case 2:{r();break}}},{capture:!0})}function GE(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 qE(e){return x.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function ZE(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 KE(){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 YE(){return Mp()?{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=Pt();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(wr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);wr(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(wr(c.target)&&Qx(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(wr(c.target)){if(fp(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 XE(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function QE(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let zn=ZE(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Pt(),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:QE(n)},o=[YE(),KE(),XE()];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)}});zn.subscribe(()=>{let e=zn.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)&&zn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&zn.dispatch("TEARDOWN",n)}});function JE(e,t,n=()=>({containers:[]})){let r=qE(zn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ye(()=>{if(!(!t||!e))return zn.dispatch("PUSH",t,n),()=>zn.dispatch("POP",t,n)},[e,t]),s}function e2(e,t,n=()=>[document.body]){let r=Cp(e,"scroll-lock");JE(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Fp(e){return[e.screenX,e.screenY]}function t2(){let e=x.useRef([-1,-1]);return{wasMoved(t){let n=Fp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Fp(t)}}}function n2(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 jp,_p;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((jp=process==null?void 0:process.env)==null?void 0:jp.NODE_ENV)==="test"&&typeof((_p=Element==null?void 0:Element.prototype)==null?void 0:_p.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
122
+ `)),[]});var r2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(r2||{});function Up(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function zp(e,t,n,r){let[o,s]=x.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=n2(e&&o?3:0),u=x.useRef(!1),l=x.useRef(!1),d=yr();return ye(()=>{var f;if(e){if(n&&s(!0),!t){n&&c(3);return}return(f=r==null?void 0:r.start)==null||f.call(r,n),o2(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,d]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function o2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Pt();return i2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(s2(e,r))})}),s.dispose}function s2(e,t){var n,r;let o=Pt();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(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 i2(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 Ts(){return typeof window<"u"}function xr(e){return bc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ve(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(bc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bc(e){return Ts()?e instanceof Node||e instanceof Ve(e).Node:!1}function pe(e){return Ts()?e instanceof Element||e instanceof Ve(e).Element:!1}function Fe(e){return Ts()?e instanceof HTMLElement||e instanceof Ve(e).HTMLElement:!1}function yc(e){return!Ts()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ve(e).ShadowRoot}const a2=new Set(["inline","contents"]);function Ao(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ft(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!a2.has(o)}const c2=new Set(["table","td","th"]);function u2(e){return c2.has(xr(e))}const l2=[":popover-open",":modal"];function Cs(e){return l2.some(t=>{try{return e.matches(t)}catch{return!1}})}const f2=["transform","translate","scale","rotate","perspective"],d2=["transform","translate","scale","rotate","perspective","filter"],p2=["paint","layout","strict","content"];function wc(e){const t=Os(),n=pe(e)?ft(e):e;return f2.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)||d2.some(r=>(n.willChange||"").includes(r))||p2.some(r=>(n.contain||"").includes(r))}function h2(e){let t=an(e);for(;Fe(t)&&!sn(t);){if(wc(t))return t;if(Cs(t))return null;t=an(t)}return null}function Os(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const m2=new Set(["html","body","#document"]);function sn(e){return m2.has(xr(e))}function ft(e){return Ve(e).getComputedStyle(e)}function Is(e){return pe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function an(e){if(xr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yc(e)&&e.host||Rt(e);return yc(t)?t.host:t}function Hp(e){const t=an(e);return sn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Fe(t)&&Ao(t)?t:Hp(t)}function vn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Hp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ve(o);if(s){const c=vc(i);return t.concat(i,i.visualViewport||[],Ao(o)?o:[],c&&n?vn(c):[])}return t.concat(o,vn(o,[],n))}function vc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function g2(){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 cn=Math.min,Be=Math.max,$o=Math.round,Ns=Math.floor,Dt=e=>({x:e,y:e}),b2={left:"right",right:"left",bottom:"top",top:"bottom"},y2={start:"end",end:"start"};function xc(e,t,n){return Be(e,cn(t,n))}function Hn(e,t){return typeof e=="function"?e(t):e}function xn(e){return e.split("-")[0]}function Er(e){return e.split("-")[1]}function Wp(e){return e==="x"?"y":"x"}function Ec(e){return e==="y"?"height":"width"}const w2=new Set(["top","bottom"]);function un(e){return w2.has(xn(e))?"y":"x"}function Sc(e){return Wp(un(e))}function v2(e,t,n){n===void 0&&(n=!1);const r=Er(e),o=Sc(e),s=Ec(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=ks(i)),[i,ks(i)]}function x2(e){const t=ks(e);return[Pc(e),t,Pc(t)]}function Pc(e){return e.replace(/start|end/g,t=>y2[t])}const Vp=["left","right"],Gp=["right","left"],E2=["top","bottom"],S2=["bottom","top"];function P2(e,t,n){switch(e){case"top":case"bottom":return n?t?Gp:Vp:t?Vp:Gp;case"left":case"right":return t?E2:S2;default:return[]}}function A2(e,t,n,r){const o=Er(e);let s=P2(xn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Pc)))),s}function ks(e){return e.replace(/left|right|bottom|top/g,t=>b2[t])}function $2(e){return{top:0,right:0,bottom:0,left:0,...e}}function qp(e){return typeof e!="number"?$2(e):{top:e,right:e,bottom:e,left:e}}function Bs(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}}/*!
123
123
  * tabbable 6.2.0
124
124
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
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:`
125
+ */var T2=["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])"],Ac=T2.join(","),Zp=typeof Element>"u",To=Zp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ms=!Zp&&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},Ls=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},C2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},O2=function(t,n,r){if(Ls(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Ac));return n&&To.call(t,Ac)&&o.unshift(t),o=o.filter(r),o},I2=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Ls(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=To.call(i,Ac);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),f=!Ls(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&f){var p=e(d===!0?i.children:d.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},Kp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Yp=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||C2(t))&&!Kp(t)?0:t.tabIndex},N2=function(t,n){var r=Yp(t);return r<0&&n&&!Kp(t)?0:r},k2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Xp=function(t){return t.tagName==="INPUT"},B2=function(t){return Xp(t)&&t.type==="hidden"},M2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},L2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},R2=function(t){if(!t.name)return!0;var n=t.form||Ms(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=L2(o,t.form);return!s||s===t},D2=function(t){return Xp(t)&&t.type==="radio"},F2=function(t){return D2(t)&&!R2(t)},j2=function(t){var n,r=t&&Ms(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,d;r=Ms(o),o=(u=r)===null||u===void 0?void 0:u.host,s=!!((l=o)!==null&&l!==void 0&&(d=l.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return s},Qp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},_2=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=To.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(To.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=Ms(t);if(a&&!a.shadowRoot&&o(a)===!0)return Qp(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(j2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Qp(t);return!1},U2=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 To.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},z2=function(t,n){return!(n.disabled||Ls(n)||B2(n)||_2(n,t)||M2(n)||U2(n))},Jp=function(t,n){return!(F2(n)||Yp(n)<0||!z2(t,n))},H2=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},W2=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=N2(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(k2).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},eh=function(t,n){n=n||{};var r;return n.getShadowRoot?r=I2([t],n.includeContainer,{filter:Jp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:H2}):r=O2(t,n.includeContainer,Jp.bind(null,n)),W2(r)};function th(e,t,n){let{reference:r,floating:o}=e;const s=un(t),i=Sc(t),c=Ec(i),a=xn(t),u=s==="y",l=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=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:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Er(t)){case"start":p[i]-=f*(n&&u?-1:1);break;case"end":p[i]+=f*(n&&u?-1:1);break}return p}const V2=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:d}=th(u,r,a),f=r,p={},h=0;for(let m=0;m<c.length;m++){const{name:w,fn:T}=c[m],{x:b,y:$,data:M,reset:L}=await T({x:l,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:u,platform:i,elements:{reference:e,floating:t}});l=b??l,d=$??d,p={...p,[w]:{...p[w],...M}},L&&h<=50&&(h++,typeof L=="object"&&(L.placement&&(f=L.placement),L.rects&&(u=L.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:l,y:d}=th(u,f,a)),m=-1)}return{x:l,y:d,placement:f,strategy:o,middlewareData:p}};async function Rs(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:d="floating",altBoundary:f=!1,padding:p=0}=Hn(t,e),h=qp(p),w=c[f?d==="floating"?"reference":"floating":d],T=Bs(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=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,$=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),M=await(s.isElement==null?void 0:s.isElement($))?await(s.getScale==null?void 0:s.getScale($))||{x:1,y:1}:{x:1,y:1},L=Bs(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:$,strategy:a}):b);return{top:(T.top-L.top+h.top)/M.y,bottom:(L.bottom-T.bottom+h.bottom)/M.y,left:(T.left-L.left+h.left)/M.x,right:(L.right-T.right+h.right)/M.x}}const G2=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}=Hn(e,t)||{};if(u==null)return{};const d=qp(l),f={x:n,y:r},p=Sc(o),h=Ec(p),m=await i.getDimensions(u),w=p==="y",T=w?"top":"left",b=w?"bottom":"right",$=w?"clientHeight":"clientWidth",M=s.reference[h]+s.reference[p]-f[p]-s.floating[h],L=f[p]-s.reference[p],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=F?F[$]:0;(!j||!await(i.isElement==null?void 0:i.isElement(F)))&&(j=c.floating[$]||s.floating[h]);const g=M/2-L/2,v=j/2-m[h]/2-1,A=cn(d[T],v),N=cn(d[b],v),I=A,P=j-m[h]-N,S=j/2-m[h]/2+g,E=xc(I,S,P),C=!a.arrow&&Er(o)!=null&&S!==E&&s.reference[h]/2-(S<I?A:N)-m[h]/2<0,O=C?S<I?S-I:S-P:0;return{[p]:f[p]+O,data:{[p]:E,centerOffset:S-E-O,...C&&{alignmentOffset:O}},reset:C}}}),q2=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:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...w}=Hn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const T=xn(o),b=un(c),$=xn(c)===c,M=await(a.isRTL==null?void 0:a.isRTL(u.floating)),L=f||($||!m?[ks(c)]:x2(c)),F=h!=="none";!f&&F&&L.push(...A2(c,m,h,M));const j=[c,...L],g=await Rs(t,w),v=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&v.push(g[T]),d){const S=v2(o,i,M);v.push(g[S[0]],g[S[1]])}if(A=[...A,{placement:o,overflows:v}],!v.every(S=>S<=0)){var N,I;const S=(((N=s.flip)==null?void 0:N.index)||0)+1,E=j[S];if(E&&(!(d==="alignment"?b!==un(E):!1)||A.every(y=>un(y.placement)===b?y.overflows[0]>0:!0)))return{data:{index:S,overflows:A},reset:{placement:E}};let C=(I=A.filter(O=>O.overflows[0]<=0).sort((O,y)=>O.overflows[1]-y.overflows[1])[0])==null?void 0:I.placement;if(!C)switch(p){case"bestFit":{var P;const O=(P=A.filter(y=>{if(F){const k=un(y.placement);return k===b||k==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(k=>k>0).reduce((k,D)=>k+D,0)]).sort((y,k)=>y[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{}}}},Z2=new Set(["left","top"]);async function K2(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=xn(n),c=Er(n),a=un(n)==="y",u=Z2.has(i)?-1:1,l=s&&a?-1:1,d=Hn(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof h=="number"&&(p=c==="end"?h*-1:h),a?{x:p*l,y:f*u}:{x:f*u,y:p*l}}const Y2=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 K2(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}}}}},X2=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:T,y:b}=w;return{x:T,y:b}}},...a}=Hn(e,t),u={x:n,y:r},l=await Rs(t,a),d=un(xn(o)),f=Wp(d);let p=u[f],h=u[d];if(s){const w=f==="y"?"top":"left",T=f==="y"?"bottom":"right",b=p+l[w],$=p-l[T];p=xc(b,p,$)}if(i){const w=d==="y"?"top":"left",T=d==="y"?"bottom":"right",b=h+l[w],$=h-l[T];h=xc(b,h,$)}const m=c.fn({...t,[f]:p,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:s,[d]:i}}}}}},Q2=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}=Hn(e,t),l=await Rs(t,u),d=xn(o),f=Er(o),p=un(o)==="y",{width:h,height:m}=s.floating;let w,T;d==="top"||d==="bottom"?(w=d,T=f===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(T=d,w=f==="end"?"top":"bottom");const b=m-l.top-l.bottom,$=h-l.left-l.right,M=cn(m-l[w],b),L=cn(h-l[T],$),F=!t.middlewareData.shift;let j=M,g=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=$),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=b),F&&!f){const A=Be(l.left,0),N=Be(l.right,0),I=Be(l.top,0),P=Be(l.bottom,0);p?g=h-2*(A!==0||N!==0?A+N:Be(l.left,l.right)):j=m-2*(I!==0||P!==0?I+P:Be(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 nh(e){const t=ft(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Fe(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=$o(n)!==s||$o(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function $c(e){return pe(e)?e:e.contextElement}function Sr(e){const t=$c(e);if(!Fe(t))return Dt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=nh(t);let i=(s?$o(n.width):n.width)/r,c=(s?$o(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const J2=Dt(0);function rh(e){const t=Ve(e);return!Os()||!t.visualViewport?J2:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function e6(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ve(e)?!1:t}function Wn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=$c(e);let i=Dt(1);t&&(r?pe(r)&&(i=Sr(r)):i=Sr(e));const c=e6(s,n,r)?rh(s):Dt(0);let a=(o.left+c.x)/i.x,u=(o.top+c.y)/i.y,l=o.width/i.x,d=o.height/i.y;if(s){const f=Ve(s),p=r&&pe(r)?Ve(r):r;let h=f,m=vc(h);for(;m&&r&&p!==h;){const w=Sr(m),T=m.getBoundingClientRect(),b=ft(m),$=T.left+(m.clientLeft+parseFloat(b.paddingLeft))*w.x,M=T.top+(m.clientTop+parseFloat(b.paddingTop))*w.y;a*=w.x,u*=w.y,l*=w.x,d*=w.y,a+=$,u+=M,h=Ve(m),m=vc(h)}}return Bs({width:l,height:d,x:a,y:u})}function Ds(e,t){const n=Is(e).scrollLeft;return t?t.left+n:Wn(Rt(e)).left+n}function oh(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ds(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function t6(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Rt(r),c=t?Cs(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Dt(1);const l=Dt(0),d=Fe(r);if((d||!d&&!s)&&((xr(r)!=="body"||Ao(i))&&(a=Is(r)),Fe(r))){const p=Wn(r);u=Sr(r),l.x=p.x+r.clientLeft,l.y=p.y+r.clientTop}const f=i&&!d&&!s?oh(i,a):Dt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+f.x,y:n.y*u.y-a.scrollTop*u.y+l.y+f.y}}function n6(e){return Array.from(e.getClientRects())}function r6(e){const t=Rt(e),n=Is(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+Ds(e);const c=-n.scrollTop;return ft(r).direction==="rtl"&&(i+=Be(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const sh=25;function o6(e,t){const n=Ve(e),r=Rt(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=Os();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Ds(r);if(u<=0){const l=r.ownerDocument,d=l.body,f=getComputedStyle(d),p=l.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,h=Math.abs(r.clientWidth-d.clientWidth-p);h<=sh&&(s-=h)}else u<=sh&&(s+=u);return{width:s,height:i,x:c,y:a}}const s6=new Set(["absolute","fixed"]);function i6(e,t){const n=Wn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Fe(e)?Sr(e):Dt(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 ih(e,t,n){let r;if(t==="viewport")r=o6(e,n);else if(t==="document")r=r6(Rt(e));else if(pe(t))r=i6(t,n);else{const o=rh(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Bs(r)}function ah(e,t){const n=an(e);return n===t||!pe(n)||sn(n)?!1:ft(n).position==="fixed"||ah(n,t)}function a6(e,t){const n=t.get(e);if(n)return n;let r=vn(e,[],!1).filter(c=>pe(c)&&xr(c)!=="body"),o=null;const s=ft(e).position==="fixed";let i=s?an(e):e;for(;pe(i)&&!sn(i);){const c=ft(i),a=wc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&s6.has(o.position)||Ao(i)&&!a&&ah(e,i))?r=r.filter(l=>l!==i):o=c,i=an(i)}return t.set(e,r),r}function c6(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Cs(t)?[]:a6(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const d=ih(t,l,o);return u.top=Be(d.top,u.top),u.right=cn(d.right,u.right),u.bottom=cn(d.bottom,u.bottom),u.left=Be(d.left,u.left),u},ih(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function u6(e){const{width:t,height:n}=nh(e);return{width:t,height:n}}function l6(e,t,n){const r=Fe(t),o=Rt(t),s=n==="fixed",i=Wn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Dt(0);function u(){a.x=Ds(o)}if(r||!r&&!s)if((xr(t)!=="body"||Ao(o))&&(c=Is(t)),r){const p=Wn(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?oh(o,c):Dt(0),d=i.left+c.scrollLeft-a.x-l.x,f=i.top+c.scrollTop-a.y-l.y;return{x:d,y:f,width:i.width,height:i.height}}function Tc(e){return ft(e).position==="static"}function ch(e,t){if(!Fe(e)||ft(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function uh(e,t){const n=Ve(e);if(Cs(e))return n;if(!Fe(e)){let o=an(e);for(;o&&!sn(o);){if(pe(o)&&!Tc(o))return o;o=an(o)}return n}let r=ch(e,t);for(;r&&u2(r)&&Tc(r);)r=ch(r,t);return r&&sn(r)&&Tc(r)&&!wc(r)?n:r||h2(e)||n}const f6=async function(e){const t=this.getOffsetParent||uh,n=this.getDimensions,r=await n(e.floating);return{reference:l6(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function d6(e){return ft(e).direction==="rtl"}const p6={convertOffsetParentRelativeRectToViewportRelativeRect:t6,getDocumentElement:Rt,getClippingRect:c6,getOffsetParent:uh,getElementRects:f6,getClientRects:n6,getDimensions:u6,getScale:Sr,isElement:pe,isRTL:d6};function lh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function h6(e,t){let n=null,r;const o=Rt(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:d,width:f,height:p}=u;if(c||t(),!f||!p)return;const h=Ns(d),m=Ns(o.clientWidth-(l+f)),w=Ns(o.clientHeight-(d+p)),T=Ns(l),$={rootMargin:-h+"px "+-m+"px "+-w+"px "+-T+"px",threshold:Be(0,cn(1,a))||1};let M=!0;function L(F){const j=F[0].intersectionRatio;if(j!==a){if(!M)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!lh(u,e.getBoundingClientRect())&&i(),M=!1}try{n=new IntersectionObserver(L,{...$,root:o.ownerDocument})}catch{n=new IntersectionObserver(L,$)}n.observe(e)}return i(!0),s}function fh(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=$c(e),l=o||s?[...u?vn(u):[],...vn(t)]:[];l.forEach(T=>{o&&T.addEventListener("scroll",n,{passive:!0}),s&&T.addEventListener("resize",n)});const d=u&&c?h6(u,n):null;let f=-1,p=null;i&&(p=new ResizeObserver(T=>{let[b]=T;b&&b.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var $;($=p)==null||$.observe(t)})),n()}),u&&!a&&p.observe(u),p.observe(t));let h,m=a?Wn(e):null;a&&w();function w(){const T=Wn(e);m&&!lh(m,T)&&n(),m=T,h=requestAnimationFrame(w)}return n(),()=>{var T;l.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d==null||d(),(T=p)==null||T.disconnect(),p=null,a&&cancelAnimationFrame(h)}}const Cc=Rs,m6=Y2,g6=X2,b6=q2,y6=Q2,dh=G2,w6=(e,t,n)=>{const r=new Map,o={platform:p6,...n},s={...o.platform,_c:r};return V2(e,t,{...o,platform:s})};var v6=typeof document<"u",x6=function(){},Fs=v6?x.useLayoutEffect:x6;function js(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(!js(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)&&!js(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function ph(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hh(e,t){const n=ph(e);return Math.round(t*n)/n}function Oc(e){const t=z.useRef(e);return Fs(()=>{t.current=e}),t}function mh(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,d]=z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=z.useState(r);js(f,r)||p(r);const[h,m]=z.useState(null),[w,T]=z.useState(null),b=z.useCallback(y=>{y!==F.current&&(F.current=y,m(y))},[]),$=z.useCallback(y=>{y!==j.current&&(j.current=y,T(y))},[]),M=s||h,L=i||w,F=z.useRef(null),j=z.useRef(null),g=z.useRef(l),v=a!=null,A=Oc(a),N=Oc(o),I=Oc(u),P=z.useCallback(()=>{if(!F.current||!j.current)return;const y={placement:t,strategy:n,middleware:f};N.current&&(y.platform=N.current),w6(F.current,j.current,y).then(k=>{const D={...k,isPositioned:I.current!==!1};S.current&&!js(g.current,D)&&(g.current=D,Ir.flushSync(()=>{d(D)}))})},[f,t,n,N,I]);Fs(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,d(y=>({...y,isPositioned:!1})))},[u]);const S=z.useRef(!1);Fs(()=>(S.current=!0,()=>{S.current=!1}),[]),Fs(()=>{if(M&&(F.current=M),L&&(j.current=L),M&&L){if(A.current)return A.current(M,L,P);P()}},[M,L,P,A,v]);const E=z.useMemo(()=>({reference:F,floating:j,setReference:b,setFloating:$}),[b,$]),C=z.useMemo(()=>({reference:M,floating:L}),[M,L]),O=z.useMemo(()=>{const y={position:n,left:0,top:0};if(!C.floating)return y;const k=hh(C.floating,l.x),D=hh(C.floating,l.y);return c?{...y,transform:"translate("+k+"px, "+D+"px)",...ph(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:D}},[n,c,C.floating,l.x,l.y]);return z.useMemo(()=>({...l,update:P,refs:E,elements:C,floatingStyles:O}),[l,P,E,C,O])}const E6=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?dh({element:r.current,padding:o}).fn(n):{}:r?dh({element:r,padding:o}).fn(n):{}}}},Ic=(e,t)=>({...m6(e),options:[e,t]}),gh=(e,t)=>({...g6(e),options:[e,t]}),bh=(e,t)=>({...b6(e),options:[e,t]}),S6=(e,t)=>({...y6(e),options:[e,t]}),P6=(e,t)=>({...E6(e),options:[e,t]}),yh={...z},A6=yh.useInsertionEffect||(e=>e());function wh(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return A6(()=>{t.current=e}),z.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 Nc=typeof document<"u"?x.useLayoutEffect:x.useEffect;let vh=!1,$6=0;const xh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+$6++;function T6(){const[e,t]=z.useState(()=>vh?xh():void 0);return Nc(()=>{e==null&&t(xh())},[]),z.useEffect(()=>{vh=!0},[]),e}const C6=yh.useId||T6;let Co;process.env.NODE_ENV!=="production"&&(Co=new Set);function O6(){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=Co)!=null&&e.has(o))){var s;(s=Co)==null||s.add(o),console.warn(o)}}function I6(){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=Co)!=null&&e.has(o))){var s;(s=Co)==null||s.add(o),console.error(o)}}function N6(){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 k6=z.createContext(null),B6=z.createContext(null),M6=()=>{var e;return((e=z.useContext(k6))==null?void 0:e.id)||null},L6=()=>z.useContext(B6),R6="data-floating-ui-focusable";function D6(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=C6(),s=z.useRef({}),[i]=z.useState(()=>N6()),c=M6()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!pe(p)&&I6("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]=z.useState(r.reference),l=wh((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)}),d=z.useMemo(()=>({setPositionReference:u}),[]),f=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:f,events:i,floatingId:o,refs:d}),[t,l,f,i,o,d])}function F6(e){e===void 0&&(e={});const{nodeId:t}=e,n=D6({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),l=(o==null?void 0:o.domReference)||s,d=z.useRef(null),f=L6();Nc(()=>{l&&(d.current=l)},[l]);const p=mh({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback($=>{const M=pe($)?{getBoundingClientRect:()=>$.getBoundingClientRect(),contextElement:$}:$;a(M),p.refs.setReference(M)},[p.refs]),m=z.useCallback($=>{(pe($)||$===null)&&(d.current=$,i($)),(pe(p.refs.reference.current)||p.refs.reference.current===null||$!==null&&!pe($))&&p.refs.setReference($)},[p.refs]),w=z.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:d}),[p.refs,m,h]),T=z.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),b=z.useMemo(()=>({...p,...r,refs:w,elements:T,nodeId:t}),[p,w,T,t,r]);return Nc(()=>{r.dataRef.current.floatingContext=b;const $=f==null?void 0:f.nodesRef.current.find(M=>M.id===t);$&&($.context=b)}),z.useMemo(()=>({...p,context:b,refs:w,elements:T}),[p,w,T,b])}const Eh="active",Sh="selected";function kc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Eh]:i,[Sh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[R6]:""},...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&&[Eh,Sh].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var d;(d=r.get(u))==null||d.push(l),i[u]=function(){for(var f,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(f=r.get(u))==null?void 0:f.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function j6(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=z.useCallback(c=>kc(c,e,"reference"),t),s=z.useCallback(c=>kc(c,e,"floating"),n),i=z.useCallback(c=>kc(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Ph(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const _6=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}=Hn(e,t),{rects:d,elements:{floating:f}}=t,p=n.current[i],h=(u==null?void 0:u.current)||f,m=f.clientTop||h.clientTop,w=f.clientTop!==0,T=h.clientTop!==0,b=f===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||O6('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const $={...t,...await Ic(-p.offsetTop-f.clientTop-d.reference.height/2-p.offsetHeight/2-s).fn(t)},M=await Cc(Ph($,h.scrollHeight+m+f.clientTop),l),L=await Cc($,{...l,elementContext:"reference"}),F=Be(0,M.top),j=$.y+F,A=(h.scrollHeight>h.clientHeight?N=>N:$o)(Be(0,h.scrollHeight+(w&&b||T?m*2:0)-F-Be(0,M.bottom)));if(h.style.maxHeight=A+"px",h.scrollTop=F,o){const N=h.offsetHeight<p.offsetHeight*cn(c,n.current.length)-1||L.top>=-a||L.bottom>=-a;Ir.flushSync(()=>o(N))}return r&&(r.current=await Cc(Ph({...$,y:j},h.offsetHeight+m+f.clientTop),l)),{y:j}}});function U6(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=wh(c),u=z.useRef(!1),l=z.useRef(null),d=z.useRef(null);z.useEffect(()=>{if(!o)return;function p(m){if(m.ctrlKey||!h||s.current==null)return;const w=m.deltaY,T=s.current.top>=-.5,b=s.current.bottom>=-.5,$=h.scrollHeight-h.clientHeight,M=w<0?-1:1,L=w<0?"max":"min";h.scrollHeight<=h.clientHeight||(!T&&w>0||!b&&w<0?(m.preventDefault(),Ir.flushSync(()=>{a(F=>F+Math[L](w,$*M))})):/firefox/i.test(g2())&&(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&&(d.current={...s.current})}),()=>{l.current=null,d.current=null,h.removeEventListener("wheel",p)}},[o,n,r.floating,s,i,a]);const f=z.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)&&Ir.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=p.scrollTop})}}}),[r.floating,a,s,i]);return z.useMemo(()=>o?{floating:f}:{},[o,f])}let Pr=x.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Pr.displayName="FloatingContext";let Bc=x.createContext(null);Bc.displayName="PlacementContext";function z6(e){return x.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function H6(){return x.useContext(Pr).setReference}function W6(){return x.useContext(Pr).getReferenceProps}function V6(){let{getFloatingProps:e,slot:t}=x.useContext(Pr);return x.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function G6(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=x.useContext(Bc),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(Pr);return x.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Ah=4;function q6({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);Z6(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:d=0,offset:f=0,padding:p=0,inner:h}=K6(n,c),[m,w="center"]=l.split(" ");ye(()=>{u&&s(0)},[u]);let{refs:T,floatingStyles:b,context:$}=F6({open:u,placement:m==="selection"?w==="center"?"bottom":`bottom-${w}`:w==="center"?`${m}`:`${m}-${w}`,strategy:"absolute",transform:!1,middleware:[Ic({mainAxis:m==="selection"?0:d,crossAxis:f}),gh({padding:p}),m!=="selection"&&bh({padding:p}),m==="selection"&&h?_6({...h,padding:p,overflowRef:i,offset:o,minItemsVisible:Ah,referenceOverflowThreshold:p,onFallbackChange(N){var I,P;if(!N)return;let S=$.elements.floating;if(!S)return;let E=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,C=Math.min(Ah,S.childElementCount),O=0,y=0;for(let k of(P=(I=$.elements.floating)==null?void 0:I.childNodes)!=null?P:[])if(on(k)){let D=k.offsetTop,U=D+k.clientHeight+E,_=S.scrollTop,H=_+S.clientHeight;if(D>=_&&U<=H)C--;else{y=Math.max(0,Math.min(U,H)-Math.max(D,_)),O=k.clientHeight;break}}C>=1&&s(k=>{let D=O*C-y+E;return k>=D?k:D})}}):null,S6({padding:p,apply({availableWidth:N,availableHeight:I,elements:P}){Object.assign(P.floating.style,{overflow:"auto",maxWidth:`${N}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${I}px)`})}})].filter(Boolean),whileElementsMounted:fh}),[M=m,L=w]=$.placement.split("-");m==="selection"&&(M="selection");let F=x.useMemo(()=>({anchor:[M,L].filter(Boolean).join(" ")}),[M,L]),j=U6($,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:v}=j6([j]),A=ue(N=>{a(N),T.setFloating(N)});return z.createElement(Bc.Provider,{value:r},z.createElement(Pr.Provider,{value:{setFloating:A,setReference:T.setReference,styles:b,getReferenceProps:g,getFloatingProps:v,slot:F}},e))}function Z6(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 K6(e,t){var n,r,o;let s=Mc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Mc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Mc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Mc(e,t,n=void 0){let r=yr(),o=ue((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=Th(a,u);return[l,d=>{let f=$h(a);{let p=f.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[T,b]of f.entries()){let $=window.getComputedStyle(u).getPropertyValue(b);if(p[T]!==$){p[T]=$,m=!0;break}}if(!m)return;let w=Th(a,u);l!==w&&(d(w),l=w)})}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 $h(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,...$h(o)]:[r]}return[]}function Th(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 Y6(e,t){let[n,r]=x.useState(t);return!e&&n!==t&&r(t),e?n:t}let Lc=x.createContext(null);Lc.displayName="OpenClosedContext";var At=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(At||{});function Rc(){return x.useContext(Lc)}function Ch({value:e,children:t}){return x.createElement(Lc.Provider,{value:e},t)}function X6(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 _s(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:X6(e)}}var Oh=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Oh||{});function Ih(e){let t=ue(e),n=x.useRef(!1);x.useEffect(()=>(n.current=!1,()=>{n.current=!0,rp(()=>{n.current&&t()})}),[t])}function Q6(){let e=typeof document>"u";return"useSyncExternalStore"in z?(t=>t.useSyncExternalStore)(z)(()=>()=>{},()=>!1,()=>!e):!1}function Dc(){let e=Q6(),[t,n]=z.useState(Mt.isHandoffComplete);return t&&Mt.isHandoffComplete===!1&&n(!1),z.useEffect(()=>{t!==!0&&n(!0)},[t]),z.useEffect(()=>Mt.handoff(),[]),e?!1:t}let J6=x.createContext(!1);function e5(){return x.useContext(J6)}function t5(e){let t=e5(),n=x.useContext(kh),[r,o]=x.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Mt.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 Nh=x.Fragment,n5=We(function(e,t){let{ownerDocument:n=null,...r}=e,o=x.useRef(null),s=ct(oE(p=>{o.current=p}),t),i=gc(o),c=n??i,a=t5(c),[u]=x.useState(()=>{var p;return Mt.isServer?null:(p=c==null?void 0:c.createElement("div"))!=null?p:null}),l=x.useContext(i5),d=Dc();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]),Ih(()=>{var p;!a||!u||(rc(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a)))});let f=Qe();return d?!a||!u?null:Le.createPortal(f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Nh,name:"Portal"}),u):null});function r5(e,t){let n=ct(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Qe();return r?x.createElement(n5,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Nh,name:"Portal"})}let o5=x.Fragment,kh=x.createContext(null);function s5(e,t){let{target:n,...r}=e,o={ref:ct(t)},s=Qe();return x.createElement(kh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:o5,name:"Popover.Group"}))}let i5=x.createContext(null),a5=We(r5),c5=We(s5),u5=Object.assign(a5,{Group:c5});function l5(){let e=x.useRef(!1);return ye(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Bh(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Lh)!==x.Fragment||x.Children.count(e.children)===1}let Us=x.createContext(null);Us.displayName="TransitionContext";var f5=(e=>(e.Visible="visible",e.Hidden="hidden",e))(f5||{});function d5(){let e=x.useContext(Us);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function p5(){let e=x.useContext(zs);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let zs=x.createContext(null);zs.displayName="NestingContext";function Hs(e){return"children"in e?Hs(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Mh(e,t){let n=Un(e),r=x.useRef([]),o=l5(),s=yr(),i=ue((p,h=yn.Hidden)=>{let m=r.current.findIndex(({el:w})=>w===p);m!==-1&&(at(h,{[yn.Unmount](){r.current.splice(m,1)},[yn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var w;!Hs(r)&&o.current&&((w=n.current)==null||w.call(n))}))}),c=ue(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,yn.Unmount)}),a=x.useRef([]),u=x.useRef(Promise.resolve()),l=x.useRef({enter:[],leave:[]}),d=ue((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(([T,b])=>b)).then(()=>w())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),f=ue((p,h,m)=>{Promise.all(l.current[h].splice(0).map(([w,T])=>T)).then(()=>{var w;(w=a.current.shift())==null||w()}).then(()=>m(h))});return x.useMemo(()=>({children:r,register:c,unregister:i,onStart:d,onStop:f,wait:u,chains:l}),[c,i,r,d,f,l,u])}let Lh=x.Fragment,Rh=Es.RenderStrategy;function h5(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:d,entered:f,leave:p,leaveFrom:h,leaveTo:m,...w}=e,[T,b]=x.useState(null),$=x.useRef(null),M=Bh(e),L=ct(...M?[$,t,b]:t===null?[]:[t]),F=(n=w.unmount)==null||n?yn.Unmount:yn.Hidden,{show:j,appear:g,initial:v}=d5(),[A,N]=x.useState(j?"visible":"hidden"),I=p5(),{register:P,unregister:S}=I;ye(()=>P($),[P,$]),ye(()=>{if(F===yn.Hidden&&$.current){if(j&&A!=="visible"){N("visible");return}return at(A,{hidden:()=>S($),visible:()=>P($)})}},[A,$,P,S,j,F]);let E=Dc();ye(()=>{if(M&&E&&A==="visible"&&$.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[$,A,E,M]);let C=v&&!g,O=g&&j&&v,y=x.useRef(!1),k=Mh(()=>{y.current||(N("hidden"),S($))},I),D=ue(G=>{y.current=!0;let J=G?"enter":"leave";k.onStart($,J,ne=>{ne==="enter"?s==null||s():ne==="leave"&&(c==null||c())})}),U=ue(G=>{let J=G?"enter":"leave";y.current=!1,k.onStop($,J,ne=>{ne==="enter"?i==null||i():ne==="leave"&&(a==null||a())}),J==="leave"&&!Hs(k)&&(N("hidden"),S($))});x.useEffect(()=>{M&&o||(D(j),U(j))},[j,M,o]);let _=!(!o||!M||!E||C),[,H]=zp(_,T,j,{start:D,end:U}),K=wn({ref:L,className:((r=ec(w.className,O&&u,O&&l,H.enter&&u,H.enter&&H.closed&&l,H.enter&&!H.closed&&d,H.leave&&p,H.leave&&!H.closed&&h,H.leave&&H.closed&&m,!H.transition&&j&&f))==null?void 0:r.trim())||void 0,...Up(H)}),W=0;A==="visible"&&(W|=At.Open),A==="hidden"&&(W|=At.Closed),j&&A==="hidden"&&(W|=At.Opening),!j&&A==="visible"&&(W|=At.Closing);let Z=Qe();return x.createElement(zs.Provider,{value:k},x.createElement(Ch,{value:W},Z({ourProps:K,theirProps:w,defaultTag:Lh,features:Rh,visible:A==="visible",name:"Transition.Child"})))}function m5(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=x.useRef(null),c=Bh(e),a=ct(...c?[i,t]:t===null?[]:[t]);Dc();let u=Rc();if(n===void 0&&u!==null&&(n=(u&At.Open)===At.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,d]=x.useState(n?"visible":"hidden"),f=Mh(()=>{n||d("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 w=x.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);ye(()=>{n?d("visible"):!Hs(f)&&i.current!==null&&d("hidden")},[n,f]);let T={unmount:o},b=ue(()=>{var L;p&&h(!1),(L=e.beforeEnter)==null||L.call(e)}),$=ue(()=>{var L;p&&h(!1),(L=e.beforeLeave)==null||L.call(e)}),M=Qe();return x.createElement(zs.Provider,{value:f},x.createElement(Us.Provider,{value:w},M({ourProps:{...T,as:x.Fragment,children:x.createElement(Dh,{ref:a,...T,...s,beforeEnter:b,beforeLeave:$})},theirProps:{},defaultTag:x.Fragment,features:Rh,visible:l==="visible",name:"Transition"})))}function g5(e,t){let n=x.useContext(Us)!==null,r=Rc()!==null;return x.createElement(x.Fragment,null,!n&&r?x.createElement(Fc,{ref:t,...e}):x.createElement(Dh,{ref:t,...e}))}let Fc=We(m5),Dh=We(h5),b5=We(g5),y5=Object.assign(Fc,{Child:b5,Root:Fc});function w5(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 Fh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function jh(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!on(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 Fh.test(i)&&(i=i.replace(Fh,"")),i}function v5(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():jh(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return jh(e).trim()}function x5(e){let t=x.useRef(""),n=x.useRef("");return ue(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=v5(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var E5=Object.defineProperty,S5=(e,t,n)=>t in e?E5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_h=(e,t,n)=>(S5(e,typeof t!="symbol"?t+"":t,n),n),Ne=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ne||{}),Ft=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ft||{}),Ws=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ws||{}),Uh=(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))(Uh||{});function zh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Bp(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 P5={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 d=e.options[l].dataRef.current.domRef,f=_s(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(f!==null){let p=e.options[f].dataRef.current.domRef;if(((r=d.current)==null?void 0:r.previousElementSibling)===p.current||((o=p.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:f}}}}else if(t.focus===ve.Next){let l=e.activeOptionIndex;if(l!==null){let d=e.options[l].dataRef.current.domRef,f=_s(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(f!==null){let p=e.options[f].dataRef.current.domRef;if(((s=d.current)==null?void 0:s.nextElementSibling)===p.current||((i=p.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:f}}}}let a=zh(e),u=_s(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=_s(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,...zh(e),pendingShouldSort:!1}:e};class jc extends xp{constructor(t){super(t),_h(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return at(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:ac(()=>{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:ac(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:ac(()=>{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})}}),_h(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=cc.get(null);this.disposables.add(r.on(Ap.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 jc({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 at(n.type,P5,t,n)}}const Hh=x.createContext(null);function _c(e){let t=x.useContext(Hh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Wh),n}return t}function Wh({id:e,__demoMode:t=!1}){let n=x.useMemo(()=>jc.new({id:e,__demoMode:t}),[]);return Ih(()=>n.dispose()),n}let Vs=x.createContext(null);Vs.displayName="ListboxDataContext";function Oo(e){let t=x.useContext(Vs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Oo),n}return t}let A5=x.Fragment;function $5(e,t){let n=x.useId(),r=Ja(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:d=r||!1,horizontal:f=!1,multiple:p=!1,__demoMode:h=!1,...m}=e;const w=f?"horizontal":"vertical";let T=ct(t),b=Hx(s),[$=p?[]:void 0,M]=zx(o,a,b),L=Wh({id:n,__demoMode:h}),F=x.useRef({static:!1,hold:!1}),j=x.useRef(new Map),g=mE(u),v=x.useCallback(_=>at(A.mode,{[Ft.Multi]:()=>$.some(H=>g(H,_)),[Ft.Single]:()=>g($,_)}),[$]),A=x.useMemo(()=>({value:$,disabled:d,invalid:l,mode:p?Ft.Multi:Ft.Single,orientation:w,onChange:M,compare:g,isSelected:v,optionsPropsRef:F,listRef:j}),[$,d,l,p,w,M,g,v,F,j]);ye(()=>{L.state.dataRef.current=A},[A]);let N=lt(L,_=>_.listboxState),I=cc.get(null),P=lt(I,x.useCallback(_=>I.selectors.isTop(_,n),[I,n])),[S,E]=lt(L,_=>[_.buttonElement,_.optionsElement]);zE(P,[S,E],(_,H)=>{L.send({type:Uh.CloseListbox}),kp(H,mc.Loose)||(_.preventDefault(),S==null||S.focus())});let C=x.useMemo(()=>({open:N===Ne.Open,disabled:d,invalid:l,value:$}),[N,d,l,$]),[O,y]=uE({inherit:!0}),k={ref:T},D=x.useCallback(()=>{if(b!==void 0)return M==null?void 0:M(b)},[M,b]),U=Qe();return x.createElement(y,{value:O,props:{htmlFor:S==null?void 0:S.id},slot:{open:N===Ne.Open,disabled:d}},x.createElement(q6,null,x.createElement(Hh.Provider,{value:L},x.createElement(Vs.Provider,{value:A},x.createElement(Ch,{value:at(N,{[Ne.Open]:At.Open,[Ne.Closed]:At.Closed})},c!=null&&$!=null&&x.createElement(Kx,{disabled:d,data:{[c]:$},form:i,onReset:D}),U({ourProps:k,theirProps:m,slot:C,defaultTag:A5,name:"Listbox"}))))))}let T5="button";function C5(e,t){let n=x.useId(),r=lp(),o=Oo("Listbox.Button"),s=_c("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=ct(t,H6(),s.actions.setButtonElement),d=W6(),[f,p,h]=lt(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),m=f===Ne.Open;VE(m,{trigger:p,action:x.useCallback(y=>{if(p!=null&&p.contains(y.target))return $s.Ignore;let k=y.target.closest('[role="option"]:not([data-disabled])');return on(k)?$s.Select(k):h!=null&&h.contains(y.target)?$s.Ignore:$s.Close},[p,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let w=ue(y=>{switch(y.key){case Ie.Enter:Wx(y.currentTarget);break;case Ie.Space:case Ie.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ie.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),T=ue(y=>{switch(y.key){case Ie.Space:y.preventDefault();break}}),b=ue(y=>{var k;if(y.button===Oh.Left){if(nE(y.currentTarget))return y.preventDefault();s.state.listboxState===Ne.Open?(Le.flushSync(()=>s.actions.closeListbox()),(k=s.state.buttonElement)==null||k.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),$=x.useRef(null),M=ue(y=>{$.current=y.pointerType,y.pointerType==="mouse"&&b(y)}),L=ue(y=>{$.current!=="mouse"&&b(y)}),F=ue(y=>y.preventDefault()),j=bp([i]),g=sE(),{isFocusVisible:v,focusProps:A}=Ix({autoFocus:a}),{isHovered:N,hoverProps:I}=Ox({isDisabled:c}),{pressed:P,pressProps:S}=Rx({disabled:c}),E=x.useMemo(()=>({open:f===Ne.Open,active:P||f===Ne.Open,disabled:c,invalid:o.invalid,value:o.value,hover:N,focus:v,autofocus:a}),[f,o.value,c,N,v,P,o.invalid,a]),C=lt(s,y=>y.listboxState===Ne.Open),O=sp(d(),{ref:l,id:i,type:GE(e,p),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":C,"aria-labelledby":j,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:w,onKeyUp:T,onKeyPress:F,onPointerDown:M,onClick:L},A,I,S);return Qe()({ourProps:O,theirProps:u,slot:E,defaultTag:T5,name:"Listbox.Button"})}let Vh=x.createContext(!1),O5="div",I5=Es.RenderStrategy|Es.Static;function N5(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=z6(o),[l,d]=x.useState(null);u&&(s=!0);let f=Oo("Listbox.Options"),p=_c("Listbox.Options"),[h,m,w,T]=lt(p,G=>[G.listboxState,G.buttonElement,G.optionsElement,G.__demoMode]),b=gc(m),$=gc(w),M=Rc(),[L,F]=zp(c,l,M!==null?(M&At.Open)===At.Open:h===Ne.Open);IE(L,m,p.actions.closeListbox);let j=T?!1:i&&h===Ne.Open;e2(j,$);let g=T?!1:i&&h===Ne.Open;OE(g,{allowed:x.useCallback(()=>[m,w],[m,w])});let v=h!==Ne.Open,A=w5(v,m)?!1:L,N=L&&h===Ne.Closed,I=Y6(N,f.value),P=ue(G=>f.compare(I,G)),S=lt(p,G=>{var J;if(u==null||!((J=u==null?void 0:u.to)!=null&&J.includes("selection")))return null;let ne=G.options.findIndex(le=>P(le.dataRef.current.value));return ne===-1&&(ne=0),ne}),E=(()=>{if(u==null)return;if(S===null)return{...u,inner:void 0};let G=Array.from(f.listRef.current.values());return{...u,inner:{listRef:{current:G},index:S}}})(),[C,O]=G6(E),y=V6(),k=ct(t,u?C:null,p.actions.setOptionsElement,d),D=yr();x.useEffect(()=>{var G;let J=w;J&&h===Ne.Open&&J!==((G=xo(J))==null?void 0:G.activeElement)&&(J==null||J.focus({preventScroll:!0}))},[h,w]);let U=ue(G=>{var J,ne;switch(D.dispose(),G.key){case Ie.Space:if(p.state.searchQuery!=="")return G.preventDefault(),G.stopPropagation(),p.actions.search(G.key);case Ie.Enter:if(G.preventDefault(),G.stopPropagation(),p.state.activeOptionIndex!==null){let{dataRef:le}=p.state.options[p.state.activeOptionIndex];p.actions.onChange(le.current.value)}f.mode===Ft.Single&&(Le.flushSync(()=>p.actions.closeListbox()),(J=p.state.buttonElement)==null||J.focus({preventScroll:!0}));break;case at(f.orientation,{vertical:Ie.ArrowDown,horizontal:Ie.ArrowRight}):return G.preventDefault(),G.stopPropagation(),p.actions.goToOption({focus:ve.Next});case at(f.orientation,{vertical:Ie.ArrowUp,horizontal:Ie.ArrowLeft}):return G.preventDefault(),G.stopPropagation(),p.actions.goToOption({focus:ve.Previous});case Ie.Home:case Ie.PageUp:return G.preventDefault(),G.stopPropagation(),p.actions.goToOption({focus:ve.First});case Ie.End:case Ie.PageDown:return G.preventDefault(),G.stopPropagation(),p.actions.goToOption({focus:ve.Last});case Ie.Escape:G.preventDefault(),G.stopPropagation(),Le.flushSync(()=>p.actions.closeListbox()),(ne=p.state.buttonElement)==null||ne.focus({preventScroll:!0});return;case Ie.Tab:G.preventDefault(),G.stopPropagation(),Le.flushSync(()=>p.actions.closeListbox()),FE(p.state.buttonElement,G.shiftKey?hc.Previous:hc.Next);break;default:G.key.length===1&&(p.actions.search(G.key),D.setTimeout(()=>p.actions.clearSearch(),350));break}}),_=lt(p,G=>{var J;return(J=G.buttonElement)==null?void 0:J.id}),H=x.useMemo(()=>({open:h===Ne.Open}),[h]),K=sp(u?y():{},{id:r,ref:k,"aria-activedescendant":lt(p,p.selectors.activeDescendantId),"aria-multiselectable":f.mode===Ft.Multi?!0:void 0,"aria-labelledby":_,"aria-orientation":f.orientation,onKeyDown:U,role:"listbox",tabIndex:h===Ne.Open?0:void 0,style:{...a.style,...O,"--button-width":bE(m,!0).width},...Up(F)}),W=Qe(),Z=x.useMemo(()=>f.mode===Ft.Multi?f:{...f,isSelected:P},[f,P]);return x.createElement(u5,{enabled:s?e.static||L:!1,ownerDocument:b},x.createElement(Vs.Provider,{value:Z},W({ourProps:K,theirProps:a,slot:H,defaultTag:O5,features:I5,visible:A,name:"Listbox.Options"})))}let k5="div";function B5(e,t){let n=x.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=x.useContext(Vh)===!0,a=Oo("Listbox.Option"),u=_c("Listbox.Option"),l=lt(u,A=>u.selectors.isActive(A,r)),d=a.isSelected(s),f=x.useRef(null),p=x5(f),h=Un({disabled:o,value:s,domRef:f,get textValue(){return p()}}),m=ct(t,f,A=>{A?a.listRef.current.set(r,A):a.listRef.current.delete(r)}),w=lt(u,A=>u.selectors.shouldScrollIntoView(A,r));ye(()=>{if(w)return Pt().requestAnimationFrame(()=>{var A,N;(N=(A=f.current)==null?void 0:A.scrollIntoView)==null||N.call(A,{block:"nearest"})})},[w,f]),ye(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let T=ue(A=>{var N;if(o)return A.preventDefault();u.actions.onChange(s),a.mode===Ft.Single&&(Le.flushSync(()=>u.actions.closeListbox()),(N=u.state.buttonElement)==null||N.focus({preventScroll:!0}))}),b=ue(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),$=t2(),M=ue(A=>$.update(A)),L=ue(A=>{$.wasMoved(A)&&(o||l&&u.state.activationTrigger===Ws.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},Ws.Pointer))}),F=ue(A=>{$.wasMoved(A)&&(o||l&&u.state.activationTrigger===Ws.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),j=x.useMemo(()=>({active:l,focus:l,selected:d,disabled:o,selectedOption:d&&c}),[l,d,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":d,disabled:void 0,onClick:T,onFocus:b,onPointerEnter:M,onMouseEnter:M,onPointerMove:L,onMouseMove:L,onPointerLeave:F,onMouseLeave:F},v=Qe();return!d&&c?null:v({ourProps:g,theirProps:i,slot:j,defaultTag:k5,name:"Listbox.Option"})}let M5=x.Fragment;function L5(e,t){let{options:n,placeholder:r,...o}=e,s={ref:ct(t)},i=Oo("ListboxSelectedOption"),c=x.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Ft.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Qe();return x.createElement(Vh.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:x.createElement(x.Fragment,null,r&&a?r:n)},slot:c,defaultTag:M5,name:"ListboxSelectedOption"}))}let R5=We($5),D5=We(C5),F5=pE,j5=We(N5),_5=We(B5),U5=We(L5),Gs=Object.assign(R5,{Button:D5,Label:F5,Options:j5,Option:_5,SelectedOption:U5});const z5=()=>B.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[B.jsx("g",{clipPath:"url(#clip0_active)",children:B.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"})}),B.jsx("defs",{children:B.jsx("clipPath",{id:"clip0_active",children:B.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),H5=()=>B.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[B.jsx("g",{clipPath:"url(#clip0_inactive)",children:B.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"})}),B.jsx("defs",{children:B.jsx("clipPath",{id:"clip0_inactive",children:B.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Io=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return B.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>B.jsx("div",{className:"flex items-center justify-center",children:o>t-e?B.jsx(z5,{}):B.jsx(H5,{})},o))})};class $t{}Lo($t,"FAST",3),Lo($t,"Medium",2),Lo($t,"SLOW",1),Lo($t,"NONE",0);const W5=Object.values({MAINNET:1,SEPOLIA:11155111}),Ge=e=>{const t=typeof e=="string"?parseInt(e,10):e;return W5.includes(t)},V5={USDT:!0},Gh=(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:!V5[t.toUpperCase()]:!0},G5=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,chainPoolBalances:o,className:s="",walletType:i="mpc"})=>{const{t:c}=Ht();return B.jsx("div",{className:`relative ${s}`,children:B.jsx(Gs,{value:t,onChange:n,disabled:r,children:({open:a})=>B.jsxs(B.Fragment,{children:[B.jsxs(Gs.Button,{className:`
126
126
  relative w-full h-9 text-text-primary bg-fill-input-primary
127
127
  items-center justify-between flex px-3 rounded-lg
128
128
  focus:outline-none
129
129
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
130
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:`
131
+ `,children:[B.jsx("span",{className:"text-sm leading-[18px] font-medium",children:c("deposit.chain")}),B.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?B.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):B.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:B.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),B.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),B.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:[B.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:B.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"})}),B.jsx("defs",{children:B.jsx("clipPath",{id:"clip0_12919_27745",children:B.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),B.jsx(y5,{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:B.jsx(Gs.Options,{className:`
132
132
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
133
133
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
134
134
  focus:outline-none
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};/**
135
+ `,children:e.filter(u=>u[i==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(u=>B.jsx(Gs.Option,{value:u,className:({active:l,selected:d})=>`relative cursor-pointer select-none py-3 px-3 ${d?"bg-fill-btn-secondary":l?"bg-fill-input-secondary":""}`,children:({selected:l,active:d})=>B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"flex items-center justify-between",children:[B.jsxs("div",{className:"flex items-center space-x-3",children:[u.chainIconUrl?B.jsx("img",{src:u.chainIconUrl,alt:u.chain,className:"w-5 h-5 rounded-full"}):B.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:B.jsx("span",{className:"text-xs text-white font-bold",children:u.chain.charAt(0)})}),B.jsx("div",{className:"flex flex-col",children:B.jsx("span",{className:`text-sm font-medium ${l||d?"text-text-primary":"text-text-tertiary"}`,children:u.chain})})]}),B.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:B.jsx(Io,{className:"w-full justify-between",selectedLevel:Ge(u.chainId)?$t.SLOW:$t.FAST,maxLevel:3})})]}),o&&Object.keys(o).length>0&&B.jsxs("div",{className:"flex items-center justify-between pl-8 mt-2",children:[B.jsx("div",{className:"text-text-secondary text-xs",children:Ge(u.chainId)?c("withdraw.poolBalance"):c("withdraw.crossChainPoolBalance")}),B.jsxs("div",{className:"text-xs text-text-primary",children:["$",o[+u.chainId]]})]})]})},u.chainId))})})]})})})},qh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,chainPoolBalances:s,walletType:i=Fn,txType:c="deposit"})=>{const a=x.useCallback(w=>c==="withdraw"?i===Fn?w.allowAaWithdraw!==!1:w.allowWithdraw!==!1:i===Fn?w.allowAaDeposit!==!1:w.allowDeposit!==!1,[c,i]),u=x.useMemo(()=>{const w=new Set,T=[];for(const b of t)if(a(b))for(const $ of b.tokenList||[]){const M=$.symbol||$.token;!M||!(c!=="withdraw"||$.withdrawEnable===!0&&$.pullOff===!1)||w.has(M)||(w.add(M),T.push({token:M,symbol:M,iconUrl:$.iconUrl,decimals:$.decimals,tokenAddress:$.tokenAddress}))}return T},[t,a,c]),l=w=>{n(w.chainId)},d=w=>{const T=w.symbol||w.token;o(T);const b=[];for(const $ of t){if(!a($))continue;($.tokenList||[]).some(L=>(L.symbol||L.token)===T)&&b.push($.chainId)}!b.includes(e.chainId)&&b[0]!==void 0&&n(b[0])},f=x.useMemo(()=>{var b,$;const w=r||((b=u[0])==null?void 0:b.symbol)||(($=u[0])==null?void 0:$.token);if(!w)return[];const T=[];for(const M of t){if(!a(M))continue;const L=(M.tokenList||[]).find(F=>(F.symbol||F.token)===w?c==="withdraw"?F.withdrawEnable===!0&&F.pullOff===!1:!0:!1);L&&T.push({...M,tokenList:[{token:L.token,symbol:L.symbol,iconUrl:L.iconUrl,decimals:L.decimals,tokenAddress:L.tokenAddress}]})}return T},[t,r,u,a,c]),p=x.useMemo(()=>f.find(w=>w.chainId===e.chainId)||f[0],[f,e.chainId]),h=x.useMemo(()=>u,[u]),m=x.useMemo(()=>{if(h.length!==0)return h.find(w=>w.token===r||w.symbol===r)||h[0]},[h,r]);return x.useEffect(()=>{if(h.length===0)return;if(!h.some(T=>(T.symbol||T.token)===r)){const T=h[0];o(T.symbol||T.token)}},[h,r,o]),x.useEffect(()=>{if(f.length===0)return;f.some(T=>T.chainId===e.chainId)||n(f[0].chainId)},[f,e.chainId,n]),B.jsxs("div",{className:"space-y-4",children:[h.length>0&&m&&B.jsx(ix,{tokens:h,selectedToken:m,onTokenChange:d}),B.jsx(G5,{chains:f,selectedChain:p,chainPoolBalances:s,onChainChange:w=>{const T=t.find(b=>b.chainId===w.chainId);T&&l(T)},walletType:i,className:"w-full"})]})};var qs={},q5=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()}},Z5=q5,Zh={"text/plain":"Text","text/html":"Url",default:"Text"},K5="Copy to clipboard: #{key}, Enter";function Y5(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function X5(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=Z5(),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 d=Zh[t.format]||Zh.default;window.clipboardData.setData(d,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(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(d){n&&console.error("unable to copy using clipboardData: ",d),n&&console.error("falling back to prompt"),r=Y5("message"in t?t.message:K5),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var Q5=X5;function Uc(e){"@babel/helpers - typeof";return Uc=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},Uc(e)}Object.defineProperty(qs,"__esModule",{value:!0}),qs.CopyToClipboard=void 0;var Zs=Kh(x),J5=Kh(Q5),eS=["text","onCopy","options","children"];function Kh(e){return e&&e.__esModule?e:{default:e}}function Yh(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 Xh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yh(Object(n),!0).forEach(function(r){Hc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tS(e,t){if(e==null)return{};var n=nS(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 nS(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 rS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oS(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 sS(e,t,n){return t&&oS(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function iS(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&&zc(e,t)}function zc(e,t){return zc=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},zc(e,t)}function aS(e){var t=uS();return function(){var r=Ks(e),o;if(t){var s=Ks(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return cS(this,o)}}function cS(e,t){if(t&&(Uc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qh(e)}function Qh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uS(){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 Ks(e){return Ks=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Ks(e)}function Hc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jh=function(e){iS(n,e);var t=aS(n);function n(){var r;rS(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)),Hc(Qh(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,d=a.children,f=a.options,p=Zs.default.Children.only(d),h=(0,J5.default)(u,f);l&&l(u,h),p&&p.props&&typeof p.props.onClick=="function"&&p.props.onClick(c)}),r}return sS(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=tS(o,eS),c=Zs.default.Children.only(s);return Zs.default.cloneElement(c,Xh(Xh({},i),{},{onClick:this.onClick}))}}]),n}(Zs.default.PureComponent);qs.CopyToClipboard=Jh,Hc(Jh,"defaultProps",{onCopy:void 0,options:void 0});var lS=qs,Wc=lS.CopyToClipboard;Wc.CopyToClipboard=Wc;var fS=Wc;const dS=im(fS);var pS=Object.defineProperty,Ys=Object.getOwnPropertySymbols,e0=Object.prototype.hasOwnProperty,t0=Object.prototype.propertyIsEnumerable,n0=(e,t,n)=>t in e?pS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vc=(e,t)=>{for(var n in t||(t={}))e0.call(t,n)&&n0(e,n,t[n]);if(Ys)for(var n of Ys(t))t0.call(t,n)&&n0(e,n,t[n]);return e},Gc=(e,t)=>{var n={};for(var r in e)e0.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ys)for(var r of Ys(e))t.indexOf(r)<0&&t0.call(e,r)&&(n[r]=e[r]);return n};/**
136
136
  * @license QR Code generator library (TypeScript)
137
137
  * Copyright (c) Project Nayuki.
138
138
  * SPDX-License-Identifier: MIT
139
- */var Wn;(e=>{const t=class ue{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<ue.MIN_VERSION||a>ue.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 ue.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return ue.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,d=-1,p=!0){if(!(ue.MIN_VERSION<=l&&l<=f&&f<=ue.MAX_VERSION)||d<-1||d>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const T=ue.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[ue.Ecc.MEDIUM,ue.Ecc.QUARTILE,ue.Ecc.HIGH])p&&m<=ue.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 $=ue.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 ue(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!=ue.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=ue.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],d=ue.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],p=Math.floor(ue.getNumRawDataModules(u)/8),h=f-p%f,m=Math.floor(p/f);let v=[];const $=ue.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 _=ue.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(ue.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+=ue.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*ue.PENALTY_N3),p=this.modules[d][v],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*ue.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+=ue.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*ue.PENALTY_N3),p=this.modules[v][d],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*ue.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+=ue.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*ue.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<ue.MIN_VERSION||a>ue.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(ue.getNumRawDataModules(a)/8)-ue.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*ue.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]=ue.reedSolomonMultiply(u[d],l),d+1<u.length&&(u[d]^=u[d+1]);l=ue.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]^=ue.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;/**
139
+ */var Vn;(e=>{const t=class ae{constructor(a,u,l,d){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<ae.MIN_VERSION||a>ae.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let f=[];for(let h=0;h<this.size;h++)f.push(!1);for(let h=0;h<this.size;h++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(l);if(this.drawCodewords(p),d==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const w=this.getPenaltyScore();w<h&&(d=m,h=w),this.applyMask(m)}}o(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(a,u){const l=e.QrSegment.makeSegments(a);return ae.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return ae.encodeSegments([l],u)}static encodeSegments(a,u,l=1,d=40,f=-1,p=!0){if(!(ae.MIN_VERSION<=l&&l<=d&&d<=ae.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const $=ae.getNumDataCodewords(h,u)*8,M=i.getTotalBits(a,h);if(M<=$){m=M;break}if(h>=d)throw new RangeError("Data too long")}for(const $ of[ae.Ecc.MEDIUM,ae.Ecc.QUARTILE,ae.Ecc.HIGH])p&&m<=ae.getNumDataCodewords(h,$)*8&&(u=$);let w=[];for(const $ of a){n($.mode.modeBits,4,w),n($.numChars,$.mode.numCharCountBits(h),w);for(const M of $.getData())w.push(M)}o(w.length==m);const T=ae.getNumDataCodewords(h,u)*8;o(w.length<=T),n(0,Math.min(4,T-w.length),w),n(0,(8-w.length%8)%8,w),o(w.length%8==0);for(let $=236;w.length<T;$^=253)n($,8,w);let b=[];for(;b.length*8<w.length;)b.push(0);return w.forEach(($,M)=>b[M>>>3]|=$<<7-(M&7)),new ae(h,u,b,f)}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 d=0;d<u;d++)l==0&&d==0||l==0&&d==u-1||l==u-1&&d==0||this.drawAlignmentPattern(a[l],a[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let l=u;for(let f=0;f<10;f++)l=l<<1^(l>>>9)*1335;const d=(u<<10|l)^21522;o(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,r(d,f));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,r(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,r(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,r(d,f));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 d=r(u,l),f=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(f,p,d),this.setFunctionModule(p,f,d)}}drawFinderPattern(a,u){for(let l=-4;l<=4;l++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(l)),p=a+d,h=u+l;0<=p&&p<this.size&&0<=h&&h<this.size&&this.setFunctionModule(p,h,f!=2&&f!=4)}}drawAlignmentPattern(a,u){for(let l=-2;l<=2;l++)for(let d=-2;d<=2;d++)this.setFunctionModule(a+d,u+l,Math.max(Math.abs(d),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!=ae.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const d=ae.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],f=ae.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],p=Math.floor(ae.getNumRawDataModules(u)/8),h=d-p%d,m=Math.floor(p/d);let w=[];const T=ae.reedSolomonComputeDivisor(f);for(let $=0,M=0;$<d;$++){let L=a.slice(M,M+m-f+($<h?0:1));M+=L.length;const F=ae.reedSolomonComputeRemainder(L,T);$<h&&L.push(0),w.push(L.concat(F))}let b=[];for(let $=0;$<w[0].length;$++)w.forEach((M,L)=>{($!=m-f||L>=h)&&b.push(M[$])});return o(b.length==p),b}drawCodewords(a){if(a.length!=Math.floor(ae.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 d=0;d<this.size;d++)for(let f=0;f<2;f++){const p=l-f,m=(l+1&2)==0?this.size-1-d:d;!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 d;switch(a){case 0:d=(l+u)%2==0;break;case 1:d=u%2==0;break;case 2:d=l%3==0;break;case 3:d=(l+u)%3==0;break;case 4:d=(Math.floor(l/3)+Math.floor(u/2))%2==0;break;case 5:d=l*u%2+l*u%3==0;break;case 6:d=(l*u%2+l*u%3)%2==0;break;case 7:d=((l+u)%2+l*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][l]&&d&&(this.modules[u][l]=!this.modules[u][l])}}getPenaltyScore(){let a=0;for(let f=0;f<this.size;f++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[f][w]==p?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*ae.PENALTY_N3),p=this.modules[f][w],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*ae.PENALTY_N3}for(let f=0;f<this.size;f++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][f]==p?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*ae.PENALTY_N3),p=this.modules[w][f],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*ae.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let p=0;p<this.size-1;p++){const h=this.modules[f][p];h==this.modules[f][p+1]&&h==this.modules[f+1][p]&&h==this.modules[f+1][p+1]&&(a+=ae.PENALTY_N2)}let u=0;for(const f of this.modules)u=f.reduce((p,h)=>p+(h?1:0),u);const l=this.size*this.size,d=Math.ceil(Math.abs(u*20-l*10)/l)-1;return o(0<=d&&d<=9),a+=d*ae.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 d=this.size-7;l.length<a;d-=u)l.splice(1,0,d);return l}}static getNumRawDataModules(a){if(a<ae.MIN_VERSION||a>ae.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(ae.getNumRawDataModules(a)/8)-ae.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*ae.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 d=0;d<a-1;d++)u.push(0);u.push(1);let l=1;for(let d=0;d<a;d++){for(let f=0;f<u.length;f++)u[f]=ae.reedSolomonMultiply(u[f],l),f+1<u.length&&(u[f]^=u[f+1]);l=ae.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(a,u){let l=u.map(d=>0);for(const d of a){const f=d^l.shift();l.push(0),u.forEach((p,h)=>l[h]^=ae.reedSolomonMultiply(p,f))}return l}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let d=7;d>=0;d--)l=l<<1^(l>>>7)*285,l^=(u>>>d&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 Ee{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 Ee(Ee.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!Ee.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<a.length;){const d=Math.min(a.length-l,3);n(parseInt(a.substring(l,l+d),10),d*3+1,u),l+=d}return new Ee(Ee.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!Ee.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 d=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;d+=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(d,11,u)}return l<a.length&&n(Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new Ee(Ee.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:Ee.isNumeric(a)?[Ee.makeNumeric(a)]:Ee.isAlphanumeric(a)?[Ee.makeAlphanumeric(a)]:[Ee.makeBytes(Ee.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 Ee(Ee.Mode.ECI,0,u)}static isNumeric(a){return Ee.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Ee.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const d of a){const f=d.mode.numCharCountBits(u);if(d.numChars>=1<<f)return 1/0;l+=4+f+d.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})(Vn||(Vn={})),(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={}))})(Vn||(Vn={})),(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={}))})(Vn||(Vn={}));var Ar=Vn;/**
140
140
  * @license qrcode.react
141
141
  * Copyright (c) Paul O'Shannessy
142
142
  * SPDX-License-Identifier: ISC
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:`
143
+ */var hS={L:Ar.QrCode.Ecc.LOW,M:Ar.QrCode.Ecc.MEDIUM,Q:Ar.QrCode.Ecc.QUARTILE,H:Ar.QrCode.Ecc.HIGH},r0=128,o0="L",s0="#FFFFFF",i0="#000000",a0=!1,c0=1,mS=4,gS=0,bS=.1;function u0(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 l0(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 yS(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*bS),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,d=r.opacity==null?1:r.opacity;let f=null;if(r.excavate){let h=Math.floor(u),m=Math.floor(l),w=Math.ceil(c+u-h),T=Math.ceil(a+l-m);f={x:h,y:m,w,h:T}}const p=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:f,opacity:d,crossOrigin:p}}function wS(e,t){return t!=null?Math.max(Math.floor(t),0):e?mS:gS}function f0({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,w)=>(m.push(...Ar.QrSegment.makeSegments(w)),m),[]);return Ar.QrCode.encodeSegments(h,hS[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:d,calculatedImageSettings:f}=x.useMemo(()=>{let p=a.getModules();const h=wS(r,o),m=p.length+h*2,w=yS(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:d,calculatedImageSettings:f}}var vS=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),xS=x.forwardRef(function(t,n){const r=t,{value:o,size:s=r0,level:i=o0,bgColor:c=s0,fgColor:a=i0,includeMargin:u=a0,minVersion:l=c0,boostLevel:d,marginSize:f,imageSettings:p}=r,m=Gc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=m,T=Gc(m,["style"]),b=p==null?void 0:p.src,$=x.useRef(null),M=x.useRef(null),L=x.useCallback(S=>{$.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[F,j]=x.useState(!1),{margin:g,cells:v,numCells:A,calculatedImageSettings:N}=f0({value:o,level:i,minVersion:l,boostLevel:d,includeMargin:u,marginSize:f,imageSettings:p,size:s});x.useEffect(()=>{if($.current!=null){const S=$.current,E=S.getContext("2d");if(!E)return;let C=v;const O=M.current,y=N!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;y&&N.excavation!=null&&(C=l0(v,N.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,vS?E.fill(new Path2D(u0(C,g))):v.forEach(function(U,_){U.forEach(function(H,K){H&&E.fillRect(K+g,_+g,1,1)})}),N&&(E.globalAlpha=N.opacity),y&&E.drawImage(O,N.x+g,N.y+g,N.w,N.h)}}),x.useEffect(()=>{j(!1)},[b]);const I=Vc({height:s,width:s},w);let P=null;return b!=null&&(P=x.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{j(!0)},ref:M,crossOrigin:N==null?void 0:N.crossOrigin})),x.createElement(x.Fragment,null,x.createElement("canvas",Vc({style:I,height:s,width:s,ref:L,role:"img"},T)),P)});xS.displayName="QRCodeCanvas";var d0=x.forwardRef(function(t,n){const r=t,{value:o,size:s=r0,level:i=o0,bgColor:c=s0,fgColor:a=i0,includeMargin:u=a0,minVersion:l=c0,boostLevel:d,title:f,marginSize:p,imageSettings:h}=r,m=Gc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:T,numCells:b,calculatedImageSettings:$}=f0({value:o,level:i,minVersion:l,boostLevel:d,includeMargin:u,marginSize:p,imageSettings:h,size:s});let M=T,L=null;h!=null&&$!=null&&($.excavation!=null&&(M=l0(T,$.excavation)),L=x.createElement("image",{href:h.src,height:$.h,width:$.w,x:$.x+w,y:$.y+w,preserveAspectRatio:"none",opacity:$.opacity,crossOrigin:$.crossOrigin}));const F=u0(M,w);return x.createElement("svg",Vc({height:s,width:s,viewBox:`0 0 ${b} ${b}`,ref:n,role:"img"},m),!!f&&x.createElement("title",null,f),x.createElement("path",{fill:c,d:`M0,0 h${b}v${b}H0z`,shapeRendering:"crispEdges"}),x.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),L)});d0.displayName="QRCodeSVG";function ES(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function SS(){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 p0(){return/apple/i.test(navigator.vendor)}function PS(){return ES().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function AS(){return SS().includes("jsdom/")}const h0="data-floating-ui-focusable",$S="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function qc(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 $r(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&yc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Tr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Zc(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 TS(e){return e.matches("html,body")}function jt(e){return(e==null?void 0:e.ownerDocument)||document}function m0(e){return Fe(e)&&e.matches($S)}function CS(e){if(!e||AS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function OS(e){return e?e.hasAttribute(h0)?e:e.querySelector("["+h0+"]")||e:null}function Xs(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,...Xs(e,o.id,n)])}function IS(e){return"nativeEvent"in e}function No(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var NS=typeof document<"u",kS=function(){},_t=NS?x.useLayoutEffect:kS;const BS={...z};function Qs(e){const t=z.useRef(e);return _t(()=>{t.current=e}),t}const MS=BS.useInsertionEffect||(e=>e());function Ut(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return MS(()=>{t.current=e}),z.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 g0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function b0(e,t){const n=eh(e,g0()),r=n.length;if(r===0)return;const o=qc(jt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function LS(e){return b0(jt(e).body,1)||e}function RS(e){return b0(jt(e).body,-1)||e}function Kc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!$r(n,r)}function DS(e){eh(e,g0()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function y0(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 FS="data-floating-ui-focusable",w0="active",v0="selected",jS={...z};let x0=!1,_S=0;const E0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_S++;function US(){const[e,t]=z.useState(()=>x0?E0():void 0);return _t(()=>{e==null&&t(E0())},[]),z.useEffect(()=>{x0=!0},[]),e}const Yc=jS.useId||US;let Xc;process.env.NODE_ENV!=="production"&&(Xc=new Set);function zS(){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=Xc)!=null&&e.has(o))){var s;(s=Xc)==null||s.add(o),console.error(o)}}function HS(){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 WS=z.createContext(null),VS=z.createContext(null),Qc=()=>{var e;return((e=z.useContext(WS))==null?void 0:e.id)||null},Jc=()=>z.useContext(VS);function ko(e){return"data-floating-ui-"+e}function dt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const S0=ko("safe-polygon");function eu(e,t,n){if(n&&!No(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 tu(e){return typeof e=="function"?e():e}function GS(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:d=0,move:f=!0}=t,p=Jc(),h=Qc(),m=Qs(u),w=Qs(a),T=Qs(n),b=Qs(d),$=z.useRef(),M=z.useRef(-1),L=z.useRef(),F=z.useRef(-1),j=z.useRef(!0),g=z.useRef(!1),v=z.useRef(()=>{}),A=z.useRef(!1),N=Ut(()=>{var O;const y=(O=o.current.openEvent)==null?void 0:O.type;return(y==null?void 0:y.includes("mouse"))&&y!=="mousedown"});z.useEffect(()=>{if(!c)return;function O(y){let{open:k}=y;k||(dt(M),dt(F),j.current=!0,A.current=!1)}return s.on("openchange",O),()=>{s.off("openchange",O)}},[c,s]),z.useEffect(()=>{if(!c||!m.current||!n)return;function O(k){N()&&r(!1,k,"hover")}const y=jt(i.floating).documentElement;return y.addEventListener("mouseleave",O),()=>{y.removeEventListener("mouseleave",O)}},[i.floating,n,r,c,m,N]);const I=z.useCallback(function(O,y,k){y===void 0&&(y=!0),k===void 0&&(k="hover");const D=eu(w.current,"close",$.current);D&&!L.current?(dt(M),M.current=window.setTimeout(()=>r(!1,O,k),D)):y&&(dt(M),r(!1,O,k))},[w,r]),P=Ut(()=>{v.current(),L.current=void 0}),S=Ut(()=>{if(g.current){const O=jt(i.floating).body;O.style.pointerEvents="",O.removeAttribute(S0),g.current=!1}}),E=Ut(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);z.useEffect(()=>{if(!c)return;function O(_){if(dt(M),j.current=!1,l&&!No($.current)||tu(b.current)>0&&!eu(w.current,"open"))return;const H=eu(w.current,"open",$.current);H?M.current=window.setTimeout(()=>{T.current||r(!0,_,"hover")},H):n||r(!0,_,"hover")}function y(_){if(E()){S();return}v.current();const H=jt(i.floating);if(dt(F),A.current=!1,m.current&&o.current.floatingContext){n||dt(M),L.current=m.current({...o.current.floatingContext,tree:p,x:_.clientX,y:_.clientY,onClose(){S(),P(),E()||I(_,!0,"safe-polygon")}});const W=L.current;H.addEventListener("mousemove",W),v.current=()=>{H.removeEventListener("mousemove",W)};return}($.current==="touch"?!$r(i.floating,_.relatedTarget):!0)&&I(_)}function k(_){E()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:p,x:_.clientX,y:_.clientY,onClose(){S(),P(),E()||I(_)}})(_))}function D(){dt(M)}function U(_){E()||I(_,!1)}if(pe(i.domReference)){const _=i.domReference,H=i.floating;return n&&_.addEventListener("mouseleave",k),f&&_.addEventListener("mousemove",O,{once:!0}),_.addEventListener("mouseenter",O),_.addEventListener("mouseleave",y),H&&(H.addEventListener("mouseleave",k),H.addEventListener("mouseenter",D),H.addEventListener("mouseleave",U)),()=>{n&&_.removeEventListener("mouseleave",k),f&&_.removeEventListener("mousemove",O),_.removeEventListener("mouseenter",O),_.removeEventListener("mouseleave",y),H&&(H.removeEventListener("mouseleave",k),H.removeEventListener("mouseenter",D),H.removeEventListener("mouseleave",U))}}},[i,c,e,l,f,I,P,S,r,n,T,p,w,m,o,E,b]),_t(()=>{var O;if(c&&n&&(O=m.current)!=null&&(O=O.__options)!=null&&O.blockPointerEvents&&N()){g.current=!0;const k=i.floating;if(pe(i.domReference)&&k){var y;const D=jt(i.floating).body;D.setAttribute(S0,"");const U=i.domReference,_=p==null||(y=p.nodesRef.current.find(H=>H.id===h))==null||(y=y.context)==null?void 0:y.elements.floating;return _&&(_.style.pointerEvents=""),D.style.pointerEvents="none",U.style.pointerEvents="auto",k.style.pointerEvents="auto",()=>{D.style.pointerEvents="",U.style.pointerEvents="",k.style.pointerEvents=""}}}},[c,n,h,i,p,m,N]),_t(()=>{n||($.current=void 0,A.current=!1,P(),S())},[n,P,S]),z.useEffect(()=>()=>{P(),dt(M),dt(F),S()},[c,i.domReference,P,S]);const C=z.useMemo(()=>{function O(y){$.current=y.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(y){const{nativeEvent:k}=y;function D(){!j.current&&!T.current&&r(!0,k,"hover")}l&&!No($.current)||n||tu(b.current)===0||A.current&&y.movementX**2+y.movementY**2<2||(dt(F),$.current==="touch"?D():(A.current=!0,F.current=window.setTimeout(D,tu(b.current))))}}},[l,r,n,T,b]);return z.useMemo(()=>c?{reference:C}:{},[c,C])}const P0={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},A0=z.forwardRef(function(t,n){const[r,o]=z.useState();_t(()=>{p0()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[ko("focus-guard")]:"",style:P0};return B.jsx("span",{...t,...s})}),$0=z.createContext(null),T0=ko("portal");function qS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Yc(),o=KS(),[s,i]=z.useState(null),c=z.useRef(null);return _t(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),_t(()=>{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(T0,""),a.appendChild(u),c.current=u,i(u)},[t,r]),_t(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!bc(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(T0,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function ZS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=qS({id:n,root:r}),[i,c]=z.useState(null),a=z.useRef(null),u=z.useRef(null),l=z.useRef(null),d=z.useRef(null),f=i==null?void 0:i.modal,p=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return z.useEffect(()=>{if(!s||!o||f)return;function m(w){s&&Kc(w)&&(w.type==="focusin"?y0:DS)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,f]),z.useEffect(()=>{s&&(p||y0(s))},[p,s]),B.jsxs($0.Provider,{value:z.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:d,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&B.jsx(A0,{"data-type":"outside",ref:a,onFocus:m=>{if(Kc(m,s)){var w;(w=l.current)==null||w.focus()}else{const T=i?i.domReference:null,b=RS(T);b==null||b.focus()}}}),h&&s&&B.jsx("span",{"aria-owns":s.id,style:P0}),s&&Ir.createPortal(t,s),h&&s&&B.jsx(A0,{"data-type":"outside",ref:u,onFocus:m=>{if(Kc(m,s)){var w;(w=d.current)==null||w.focus()}else{const T=i?i.domReference:null,b=LS(T);b==null||b.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const KS=()=>z.useContext($0);function C0(e){return Fe(e.target)&&e.target.tagName==="BUTTON"}function YS(e){return Fe(e.target)&&e.target.tagName==="A"}function O0(e){return m0(e)}function XS(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:d=!0}=t,f=z.useRef(),p=z.useRef(!1),h=z.useMemo(()=>({onPointerDown(m){f.current=m.pointerType},onMouseDown(m){const w=f.current;m.button===0&&c!=="click"&&(No(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const w=f.current;if(c==="mousedown"&&f.current){f.current=void 0;return}No(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){f.current=void 0,!(m.defaultPrevented||!l||C0(m))&&(m.key===" "&&!O0(s)&&(m.preventDefault(),p.current=!0),!YS(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||C0(m)||O0(s)||m.key===" "&&p.current&&(p.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,d,a]);return z.useMemo(()=>i?{reference:h}:{},[i,h])}const QS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},JS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},I0=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 eP(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:d="pointerdown",ancestorScroll:f=!1,bubbles:p,capture:h}=t,m=Jc(),w=Ut(typeof a=="function"?a:()=>!1),T=typeof a=="function"?w:a,b=z.useRef(!1),{escapeKey:$,outsidePress:M}=I0(p),{escapeKey:L,outsidePress:F}=I0(h),j=z.useRef(!1),g=Ut(S=>{var E;if(!n||!i||!c||S.key!=="Escape"||j.current)return;const C=(E=s.current.floatingContext)==null?void 0:E.nodeId,O=m?Xs(m.nodesRef.current,C):[];if(!$&&(S.stopPropagation(),O.length>0)){let y=!0;if(O.forEach(k=>{var D;if((D=k.context)!=null&&D.open&&!k.context.dataRef.current.__escapeKeyBubbles){y=!1;return}}),!y)return}r(!1,IS(S)?S.nativeEvent:S,"escape-key")}),v=Ut(S=>{var E;const C=()=>{var O;g(S),(O=Tr(S))==null||O.removeEventListener("keydown",C)};(E=Tr(S))==null||E.addEventListener("keydown",C)}),A=Ut(S=>{var E;const C=s.current.insideReactTree;s.current.insideReactTree=!1;const O=b.current;if(b.current=!1,u==="click"&&O||C||typeof T=="function"&&!T(S))return;const y=Tr(S),k="["+ko("inert")+"]",D=jt(o.floating).querySelectorAll(k);let U=pe(y)?y:null;for(;U&&!sn(U);){const W=an(U);if(sn(W)||!pe(W))break;U=W}if(D.length&&pe(y)&&!TS(y)&&!$r(y,o.floating)&&Array.from(D).every(W=>!$r(U,W)))return;if(Fe(y)&&P){const W=sn(y),Z=ft(y),G=/auto|scroll/,J=W||G.test(Z.overflowX),ne=W||G.test(Z.overflowY),le=J&&y.clientWidth>0&&y.scrollWidth>y.clientWidth,Se=ne&&y.clientHeight>0&&y.scrollHeight>y.clientHeight,Me=Z.direction==="rtl",Y=Se&&(Me?S.offsetX<=y.offsetWidth-y.clientWidth:S.offsetX>y.clientWidth),ee=le&&S.offsetY>y.clientHeight;if(Y||ee)return}const _=(E=s.current.floatingContext)==null?void 0:E.nodeId,H=m&&Xs(m.nodesRef.current,_).some(W=>{var Z;return Zc(S,(Z=W.context)==null?void 0:Z.elements.floating)});if(Zc(S,o.floating)||Zc(S,o.domReference)||H)return;const K=m?Xs(m.nodesRef.current,_):[];if(K.length>0){let W=!0;if(K.forEach(Z=>{var G;if((G=Z.context)!=null&&G.open&&!Z.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}r(!1,S,"outside-press")}),N=Ut(S=>{var E;const C=()=>{var O;A(S),(O=Tr(S))==null||O.removeEventListener(u,C)};(E=Tr(S))==null||E.addEventListener(u,C)});z.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=$,s.current.__outsidePressBubbles=M;let S=-1;function E(D){r(!1,D,"ancestor-scroll")}function C(){window.clearTimeout(S),j.current=!0}function O(){S=window.setTimeout(()=>{j.current=!1},Os()?5:0)}const y=jt(o.floating);c&&(y.addEventListener("keydown",L?v:g,L),y.addEventListener("compositionstart",C),y.addEventListener("compositionend",O)),T&&y.addEventListener(u,F?N:A,F);let k=[];return f&&(pe(o.domReference)&&(k=vn(o.domReference)),pe(o.floating)&&(k=k.concat(vn(o.floating))),!pe(o.reference)&&o.reference&&o.reference.contextElement&&(k=k.concat(vn(o.reference.contextElement)))),k=k.filter(D=>{var U;return D!==((U=y.defaultView)==null?void 0:U.visualViewport)}),k.forEach(D=>{D.addEventListener("scroll",E,{passive:!0})}),()=>{c&&(y.removeEventListener("keydown",L?v:g,L),y.removeEventListener("compositionstart",C),y.removeEventListener("compositionend",O)),T&&y.removeEventListener(u,F?N:A,F),k.forEach(D=>{D.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,o,c,T,u,n,r,f,i,$,M,g,L,v,A,F,N]),z.useEffect(()=>{s.current.insideReactTree=!1},[s,T,u]);const I=z.useMemo(()=>({onKeyDown:g,...l&&{[QS[d]]:S=>{r(!1,S.nativeEvent,"reference-press")},...d!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,l,d]),P=z.useMemo(()=>({onKeyDown:g,onMouseDown(){b.current=!0},onMouseUp(){b.current=!0},[JS[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return z.useMemo(()=>i?{reference:I,floating:P}:{},[i,I,P])}function tP(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Yc(),s=z.useRef({}),[i]=z.useState(()=>HS()),c=Qc()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!pe(p)&&zS("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]=z.useState(r.reference),l=Ut((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)}),d=z.useMemo(()=>({setPositionReference:u}),[]),f=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:f,events:i,floatingId:o,refs:d}),[t,l,f,i,o,d])}function nP(e){e===void 0&&(e={});const{nodeId:t}=e,n=tP({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),l=(o==null?void 0:o.domReference)||s,d=z.useRef(null),f=Jc();_t(()=>{l&&(d.current=l)},[l]);const p=mh({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback($=>{const M=pe($)?{getBoundingClientRect:()=>$.getBoundingClientRect(),getClientRects:()=>$.getClientRects(),contextElement:$}:$;a(M),p.refs.setReference(M)},[p.refs]),m=z.useCallback($=>{(pe($)||$===null)&&(d.current=$,i($)),(pe(p.refs.reference.current)||p.refs.reference.current===null||$!==null&&!pe($))&&p.refs.setReference($)},[p.refs]),w=z.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:d}),[p.refs,m,h]),T=z.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),b=z.useMemo(()=>({...p,...r,refs:w,elements:T,nodeId:t}),[p,w,T,t,r]);return _t(()=>{r.dataRef.current.floatingContext=b;const $=f==null?void 0:f.nodesRef.current.find(M=>M.id===t);$&&($.context=b)}),z.useMemo(()=>({...p,context:b,refs:w,elements:T}),[p,w,T,b])}function nu(){return PS()&&p0()}function rP(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=z.useRef(!1),l=z.useRef(-1),d=z.useRef(!0);z.useEffect(()=>{if(!c)return;const p=Ve(i.domReference);function h(){!n&&Fe(i.domReference)&&i.domReference===qc(jt(i.domReference))&&(u.current=!0)}function m(){d.current=!0}function w(){d.current=!1}return p.addEventListener("blur",h),nu()&&(p.addEventListener("keydown",m,!0),p.addEventListener("pointerdown",w,!0)),()=>{p.removeEventListener("blur",h),nu()&&(p.removeEventListener("keydown",m,!0),p.removeEventListener("pointerdown",w,!0))}},[i.domReference,n,c]),z.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]),z.useEffect(()=>()=>{dt(l)},[]);const f=z.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(p){if(u.current)return;const h=Tr(p.nativeEvent);if(a&&pe(h)){if(nu()&&!p.relatedTarget){if(!d.current&&!m0(h))return}else if(!CS(h))return}r(!0,p.nativeEvent,"focus")},onBlur(p){u.current=!1;const h=p.relatedTarget,m=p.nativeEvent,w=pe(h)&&h.hasAttribute(ko("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var T;const b=qc(i.domReference?i.domReference.ownerDocument:document);!h&&b===i.domReference||$r((T=s.current.floatingContext)==null?void 0:T.refs.floating.current,b)||$r(i.domReference,b)||w||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return z.useMemo(()=>c?{reference:f}:{},[c,f])}function ru(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[w0]:i,[v0]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[FS]:""},...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&&[w0,v0].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var d;(d=r.get(u))==null||d.push(l),i[u]=function(){for(var f,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(f=r.get(u))==null?void 0:f.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function oP(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=z.useCallback(c=>ru(c,e,"reference"),t),s=z.useCallback(c=>ru(c,e,"floating"),n),i=z.useCallback(c=>ru(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const sP=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function iP(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=Yc(),l=((n=s.domReference)==null?void 0:n.id)||u,d=z.useMemo(()=>{var b;return((b=OS(s.floating))==null?void 0:b.id)||i},[s.floating,i]),f=(r=sP.get(a))!=null?r:a,h=Qc()!=null,m=z.useMemo(()=>f==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":o?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:l},...f==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[f,d,h,o,l,a]),w=z.useMemo(()=>{const b={id:d,...f&&{role:f}};return f==="tooltip"||a==="label"?b:{...b,...f==="menu"&&{"aria-labelledby":l}}},[f,d,l,a]),T=z.useCallback(b=>{let{active:$,selected:M}=b;const L={role:"option",...$&&{id:d+"-fui-option"}};switch(a){case"select":case"combobox":return{...L,"aria-selected":M}}return{}},[d,a]);return z.useMemo(()=>c?{reference:m,floating:w,item:T}:{},[c,m,w,T])}const N0=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 B.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});N0.displayName="TooltipArrow";const Gn=({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),d=x.useRef(null),{refs:f,floatingStyles:p,context:h}=nP({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:fh,middleware:[Ic(o?12:8),bh({fallbackAxisSideDirection:"start",padding:8}),gh({padding:8}),...o?[P6({element:d})]:[]]}),m=GS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),w=rP(h,{enabled:a.includes("focus")}),T=XS(h,{enabled:a.includes("click")}),b=eP(h),$=iP(h,{role:"tooltip"}),{getReferenceProps:M,getFloatingProps:L}=oP([m,w,T,b,$]);return i?B.jsx(B.Fragment,{children:e}):B.jsxs(B.Fragment,{children:[B.jsx("div",{ref:f.setReference,...M(),children:e}),u&&B.jsx(ZS,{children:B.jsxs("div",{ref:f.setFloating,...L(),style:p,className:`
144
144
  z-50 px-3 py-2
145
145
  bg-fill-page-secondary
146
146
  text-text-primary text-sm font-medium
@@ -148,5 +148,5 @@ ${Cb(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
148
148
  relative
149
149
  ${c}
150
150
  ${s}
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(ce=>Number(ce==null?void 0:ce.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(ce=>Number(ce==null?void 0:ce.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(ce=>ce.chainId===X);if(!Q||!Q.tokenList||Q.tokenList.length===0)return"";const se=Q.tokenList.find(ce=>ce.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 ce=H(re);try{const vn=new $e(ce||"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||Q===97)&&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 ce=H(re);try{const vn=new $e(ce||"0").minus(1e4);return vn.isGreaterThan(0)?vn.toFixed(0):"0"}catch{return"0"}};return(n||[]).forEach(re=>{const ce=Number(re==null?void 0:re.chainId);if(ce){if(Ve(ce)){X[ce]="∞";return}if(ce===42161||ce===421614){Q==="USDT"?X[ce]=se(L):Q==="USDC"?X[ce]=se(B):X[ce]="0";return}if(ce===56||ce===97){Q==="USDT"?X[ce]=se(_):X[ce]="0";return}X[ce]="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 ce=new $e((Z||"0").toString());re=X.isGreaterThan(ce)}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"})});
151
+ `,children:[t,o&&B.jsx(N0,{ref:d,placement:h.placement||n})]})})]})},Bo="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=",aP=(e,t)=>Number(e)>Number(t),Tt=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"},ou=(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 ou(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Tt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},Js={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},cP=[Js.ETHEREUM,Js.SEPOLIA,Js.ARBITRUM,Js.ARBITRUM_SEPOLIA],uP=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!cP.includes(t)}return!0},lP=({currentActiveChain:e,selectedToken:t,address:n,onDeposit:r,onCopy:o,onClose:s})=>{const{t:i}=Ht(),c=x.useMemo(()=>uP(e||{}),[e]);return B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&B.jsx("div",{className:"bg-white rounded-lg",children:B.jsx(d0,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&B.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[B.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),B.jsx(dS,{onCopy:()=>{o&&o(n)},text:n,children:B.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[B.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),B.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")]}),B.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[B.jsxs("div",{className:"flex items-start",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1",children:B.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),c&&B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),B.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),B.jsxs("div",{className:"text-sm",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[B.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),B.jsx(Gn,{content:B.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[B.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),B.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:B.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})})})]}),B.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[B.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),B.jsxs("span",{className:"text-text-primary font-medium text-right",children:["10 ",t]})]}),B.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[B.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),B.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),B.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")})]})},Mo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return B.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},fP=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Tt(Math.max(0,s).toString());return B.jsxs("span",{className:"flex items-center gap-1",children:[Tt(e),B.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Tt(e)} ${n}`},dP=(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)},pP=(e,t,n)=>{if(!Gh(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}},hP=(e,t,n)=>{let r=t||"0";if(Gh(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},k0={chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,platformBalance:"0"};let qe=null;const B0=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState(k0),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]),d=x.useCallback(h=>{s(h)},[]),f=x.useCallback(()=>n,[n]),p=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:d,isOpen:f,isLoading:p}),[a,l,u,d,f,p]),x.useEffect(()=>(qe={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:d,isOpen:f,isLoading:p},()=>{qe=null}),[a,l,u,d,f,p]),B.jsx(_0,{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)}})});B0.displayName="DepositManager";const M0=e=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.openDeposit(e||k0)},L0=()=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.closeDeposit()},R0=e=>{qe&&qe.updateDepositOptions(e)},ei=e=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.setDepositLoading(e)},mP=()=>qe?qe.isOpen():!1,D0=()=>qe?qe.isLoading():!1,gP=()=>({openDeposit:M0,closeDeposit:L0,updateDepositOptions:R0,setDepositLoading:ei,isOpen:mP,isLoading:D0}),bP=e=>{const{t}=Ht(),{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=dP(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 yP(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,d=(o==null?void 0:o.decimals)??18,f=o==null?void 0:o.contractAddress,p=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),w=a(),T=i({address:l,abi:fr,functionName:"allowance",args:[$n(t||""),f],chainId:r,query:{enabled:!!(!p&&t&&r&&l&&f)}}),b=T!=null&&T.isSuccess?T.data:void 0,$=x.useMemo(()=>{if(p)return!0;if(!T.isSuccess||b===void 0||b===0n)return!1;try{const L=xw(String(Number(s||"0")||0),Number(d));return b>=L}catch{return!1}},[p,T.isSuccess,b,s,d]),M=x.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!w||!l||!f)return;const F=$n(l),j=$n(f);if((b||0n)>0n){const A=await m({abi:fr,address:F,functionName:"approve",args:[j,0n]});await w.waitForTransactionReceipt({hash:A})}const v=await m({abi:fr,address:F,functionName:"approve",args:[j,Ul]});await w.waitForTransactionReceipt({hash:v}),T!=null&&T.refetch&&await T.refetch()}catch(L){console.error("[useApprove] onApprove failed:",L)}},[r,n,l,f,b,T,m,w,h]);return{approve:$,onApprove:M}}const wP=({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($n(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},F0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var T;const s=x.useMemo(()=>r.filter(b=>b.tokenAddress&&b.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=x.useState({}),a=x.useCallback((b,$)=>{c(M=>({...M,[b]:$}))},[]),u=(T=o==null?void 0:o.useBalance)==null?void 0:T.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),[l,d]=x.useState(0),f=x.useMemo(()=>s.map(b=>x.createElement(wP,{key:`${b.tokenAddress}-${l}`,token:b,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a,l]),p=x.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"},$=s.map(L=>{const F=i[$n(L.tokenAddress)],j=F==null?void 0:F.balance,g=j==null?void 0:j.data;return{address:$n(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),M=$.reduce((L,F)=>({...L,[F.address]:{balance:F}}),{});return{balanceList:$,baseTokenBalance:b,combinedData:M}},[u,i,s]),h=x.useCallback(async()=>p,[p]),m=x.useMemo(()=>{const b=(u==null?void 0:u.isLoading)||!1,$=Object.values(i).some(M=>{var L;return(L=M.balance)==null?void 0:L.isLoading});return b||$},[u==null?void 0:u.isLoading,i]),w=x.useCallback(()=>d(b=>b+1),[]);return{multicallRun:h,multicallRefresh:w,multicallResult:p,validErcTokens:s,isLoading:m,queryComponents:f}},vP=({address:e,currentActiveChain:t,selectedToken:n,platformBalance:r,isLoading:o,wagmiHooks:s,onChainChange:i,onDeposit:c})=>{const{t:a}=Ht(),u=s.useAccount(),l=t.tokenList.find(D=>D.token===n),d=t.chainId,[f,p]=x.useState("");x.useEffect(()=>{p("")},[n,t.chainId]);const{multicallResult:h,queryComponents:m}=F0({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=x.useMemo(()=>{var U;if(!l)return"0";if(!l.tokenAddress||l.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return h.baseTokenBalance.formatted;const D=h.combinedData[l.tokenAddress];return((U=D==null?void 0:D.balance)==null?void 0:U.formatted)||"0"},[l,h]),T="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",b="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",$=x.useMemo(()=>{var D,U;return ja({chain:_a,transport:pa(t.rpcUrl||((D=window==null?void 0:window.ENV)==null?void 0:D.CHAIN_RPC_URL_42161)||((U=window==null?void 0:window.ENV)==null?void 0:U.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),M="1000000000000",{formatted:L}=bs({client:$,tokenAddress:T,holder:b,decimals:6,fallbackFormatted:M,pollingInterval:12e3}),[F,j]=x.useState(!1),{approve:g,onApprove:v}=yP({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:l,amount:f,wagmiHooks:s}),A=x.useCallback(async()=>{if(!F)try{j(!0),await v()}catch(D){console.error("Approve failed:",D)}finally{j(!1)}},[F,v]),N=x.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),I=x.useCallback(async()=>{i&&i(d)},[i,d]);x.useEffect(()=>{N&&I()},[N,I]);const{showLayerZeroTip:P,layerZeroTipKey:S}=x.useMemo(()=>{const D=+t.chainId==42161||+t.chainId==421614,U=(n==null?void 0:n.toUpperCase())==="USDT",_=new $e(f||"0"),H=new $e("200000");let K=!1,W;if(D&&U&&f)if(_.gte(H))K=!0,W="deposit.layerZeroDepositTipGte200k";else{const Z=L;if(typeof Z=="string"&&Z.length>0){const J=new $e(Z);!J.isNaN()&&_.gte(J)&&(K=!0,W="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:K,layerZeroTipKey:W}},[t.chainId,n,f,L]),E=x.useCallback(()=>hP(+t.chainId,w||"0",n),[w,t==null?void 0:t.chainId,n]),C=x.useMemo(()=>pP(+t.chainId,f,n),[t==null?void 0:t.chainId,f,n]),O=bP({isNetworkMismatch:N,depositAmount:f,approved:g,currentTokenBalance:w,selectedToken:n,showLayerZeroTip:P,minDeposit:10}),y=D=>{const U=D.target.value,_=E(),H=ou(U,_);if(H.isValid)p(H.formattedValue),H.errorType;else return H.errorType==="exceed_balance",void 0},k=x.useCallback(async()=>{ei(!0);try{c&&c({amount:f,chainId:d,tokenAddress:(l==null?void 0:l.tokenAddress)||"",tokenSymbol:n})}catch(D){console.error("Deposit error:",D),ei(!1)}},[c,f,d,l==null?void 0:l.tokenAddress,n]);return B.jsxs(B.Fragment,{children:[m,B.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[B.jsx("input",{type:"text",placeholder:a("deposit.amount"),value:f,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"}),B.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")})]}),B.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),B.jsxs("div",{className:"flex justify-between items-center",children:[B.jsx(Gn,{content:a("deposit.availableDesc"),children:B.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:a("deposit.available")})}),B.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:fP(w||"0",f,n)})]})]}),!g&&aP(f||"0",0)&&B.jsxs("div",{className:"flex justify-center flex-col items-center",children:[B.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})}),B.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})}),B.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:F,children:F?B.jsx(Mo,{size:"xs",inline:!0}):a("deposit.enableWithToken",{token:n})})]}),P&&B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a(S||"deposit.layerZeroDepositTip")})]}),B.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),C&&B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.depositTipFor25w")})]}),C&&B.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:!(C||P)&&B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.noPrivateKeyWalletWarning")})]}),B.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[B.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.arrivalTime")}),B.jsx(Gn,{content:B.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[B.jsx("p",{children:a("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),B.jsx("p",{children:a("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:B.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})})})]}),B.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[B.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.equity")}),B.jsx("span",{className:"text-sm text-text-primary font-medium",children:f?B.jsxs("span",{className:"flex items-center gap-1",children:[Tt(r),B.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Tt((parseFloat(r)+parseFloat(f)).toString())," ",n]}):`${Tt(r)} ${n}`})]})]}),B.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||N)&&B.jsx(Mo,{size:"xs"}),O.text]})]})},j0=e=>e.toLocaleUpperCase()===Fn?Fn:Ua,ti=e=>j0(e.wallet)===Fn,xP=e=>j0(e.wallet)===Ua,_0=({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:d})=>{const{t:f}=Ht(),[p,h]=x.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,T]=x.useState(()=>{var j;if(!o||o.length===0)return"";const M=s||((j=o[0])==null?void 0:j.chainId),L=o.find(g=>g.chainId===M);if(!L||!L.tokenList||L.tokenList.length===0)return"";const F=L.tokenList[0];return(F==null?void 0:F.token)||""}),b=x.useCallback(M=>{h(M),l==null||l(M)},[l]),$=x.useCallback(M=>{T(M),d==null||d(M)},[d]);return e?Le.createPortal(B.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:B.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:B.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:[B.jsxs("div",{className:"flex items-center justify-between mb-4",children:[B.jsx("h2",{className:"text-lg font-semibold text-white",children:f("deposit.title")}),B.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:B.jsx(Wd,{className:"h-4 w-4"})})]}),B.jsx(qh,{currentActiveChain:m,chainList:o,onChainChange:b,curSelectToken:w,onTokenChange:$,walletType:ti(r)?Fn:Ua}),ti(r)&&B.jsx(lP,{address:r.smartWalletAddress,currentActiveChain:m,selectedToken:w,onDeposit:a,onCopy:u,onClose:n}),xP(r)&&B.jsx(vP,{address:r.ethAddress,currentActiveChain:m,selectedToken:w,platformBalance:i,isLoading:t,wagmiHooks:c,onChainChange:b,onDeposit:a,onClose:n})]})})}),document.body):null},EP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",onWithdrawAmountChange:a,onReceiverAddressChange:u,onAmountChanged:l,showPoolBalanceInsufficientTip:d=!1})=>{const{t:f}=Ht(),p=x.useMemo(()=>{if(!Ge(r==null?void 0:r.chainId)){const b=new $e(e||"0").minus(s||"0").decimalPlaces(2,$e.ROUND_DOWN);return b.isNegative()?"0.00":b.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId]),h=x.useMemo(()=>o||"0",[o]),m=b=>{const $=b.target.value,L=ou($,h||"0");if(L.isValid)a(L.formattedValue),L.errorType;else return L.errorType==="exceed_balance",void 0;l==null||l(L.formattedValue)},w=()=>{a(h),l==null||l(h)},T=()=>{const b=parseFloat(o||"0"),$=parseFloat(e||"0");if($>0){const M=b-$,L=Tt(Math.max(0,M).toString());return B.jsxs("span",{className:"flex items-center gap-1",children:[Tt(o||"0"),B.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),L," ",t]})}return`${Tt(o||"0")} ${t}`};return B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[B.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:e,onChange:m,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"}),B.jsx("button",{onClick:w,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),B.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),B.jsxs("div",{className:"flex justify-between items-center",children:[B.jsx(Gn,{content:f("withdraw.availableDesc"),children:B.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),B.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:T()})]})]}),i==="mpc"&&!Ge(r==null?void 0:r.chainId)&&B.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:B.jsx("input",{type:"text",placeholder:f("withdraw.receiverAddress"),value:c,onChange:b=>u==null?void 0:u(b.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"})}),B.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Ge(r==null?void 0:r.chainId)?B.jsxs(B.Fragment,{children:[B.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.noticeDesc")}),B.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")})]}):B.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.crossChainTips")})}),d&&B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f("withdraw.poolBalanceInsufficientTip")})]}),B.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[B.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[B.jsx(Gn,{content:B.jsxs("div",{children:[B.jsx("div",{children:f("withdraw.speedNote")}),B.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[B.jsx(Io,{selectedLevel:$t.FAST,maxLevel:3}),B.jsx("span",{children:f("withdraw.speedNoteSpeed1")})]}),B.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[B.jsx(Io,{selectedLevel:$t.Medium,maxLevel:3}),B.jsx("span",{children:f("withdraw.speedNoteSpeed2")})]}),B.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[B.jsx(Io,{selectedLevel:$t.SLOW,maxLevel:3}),B.jsx("span",{children:f("withdraw.speedNoteSpeed3")})]})]}),children:B.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:f("withdraw.speed")})}),B.jsx("div",{className:"flex items-center",children:B.jsx(Io,{selectedLevel:Ge(r==null?void 0:r.chainId)?$t.SLOW:$t.FAST,maxLevel:3})})]}),!Ge(r==null?void 0:r.chainId)&&B.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[B.jsx(Gn,{content:f("withdraw.feeCalculationTip"),children:B.jsxs("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:[f("withdraw.fee"),"/",f("withdraw.feeRate")]})}),B.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t," / ",(n==null?void 0:n.feeRate)||0,"%"]})]}),B.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[B.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:f(Ge(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),B.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Tt(p)," ",t]})]})]})]})},SP=[],PP={};let Ze=null;const U0=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]),d=x.useCallback(h=>{s(h)},[]),f=x.useCallback(()=>n,[n]),p=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:d,isOpen:f,isLoading:p}),[a,l,u,d,f,p]),x.useEffect(()=>(Ze={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:d,isOpen:f,isLoading:p},()=>{Ze=null}),[a,l,u,d,f,p]),B.jsx(G0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||SP,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||PP,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})});U0.displayName="WithdrawManager";const z0=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},H0=()=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.closeWithdraw()},W0=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.updateWithdrawOptions(e)},ni=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.setWithdrawLoading(e)},AP=()=>Ze?Ze.isOpen():!1,V0=()=>Ze?Ze.isLoading():!1,$P=()=>({openWithdraw:z0,closeWithdraw:H0,updateWithdrawOptions:W0,setWithdrawLoading:ni,isOpen:AP,isLoading:V0}),TP=({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:d,onWithdraw:f,onClose:p,onChainChange:h,onTokenChange:m,onAmountChanged:w})=>{var Me;const{t:T}=Ht(),b=x.useMemo(()=>{const Y=[56,97],ee=me=>n==null?void 0:n.find(de=>Number(de==null?void 0:de.chainId)===me),Q=ee(Y[0])||ee(Y[1]);return Q==null?void 0:Q.rpcUrl},[n]),$=x.useMemo(()=>{const Y=[42161,421614],ee=me=>n==null?void 0:n.find(de=>Number(de==null?void 0:de.chainId)===me),Q=ee(Y[0])||ee(Y[1]);return Q==null?void 0:Q.rpcUrl},[n]),M=x.useMemo(()=>{var qn,Je;const Y="USDC";if(!n||n.length===0)return{chainId:1,tokenSymbol:""};const ee=Zn=>Array.isArray(Zn.tokenList)&&Zn.tokenList.some(ri=>(ri.token||ri.symbol||"").toUpperCase()===Y),Q=n.find(ee)||n[0];if(!Q||!Array.isArray(Q.tokenList)||Q.tokenList.length===0)return{chainId:(Q==null?void 0:Q.chainId)||1,tokenSymbol:""};const me=Q.tokenList.find(Zn=>(Zn.token||Zn.symbol||"").toUpperCase()===Y),de=(me==null?void 0:me.token)||(me==null?void 0:me.symbol)||((qn=Q.tokenList[0])==null?void 0:qn.token)||((Je=Q.tokenList[0])==null?void 0:Je.symbol)||"";return{chainId:Q.chainId,tokenSymbol:de}},[n]),{ARB_USDC_BALANCE:L,ARB_USDT_BALANCE:F,BNB_USDT_BALANCE:j}=Xv({bscRpcUrl:b,arbitrumRpcUrl:$}),[g,v]=x.useState(()=>M.chainId),[A,N]=x.useState(()=>M.tokenSymbol),[I,P]=x.useState(s),[S,E]=x.useState(""),C=x.useCallback(Y=>{v(Y),h==null||h(Y)},[h]),O=x.useCallback(Y=>{N(Y),m==null||m(Y)},[m]),y=x.useRef(!0),k=x.useRef(A),D=x.useRef(g);x.useEffect(()=>{if(y.current){y.current=!1,k.current=A,D.current=g;return}(k.current!==A||D.current!==g)&&(P(""),k.current=A,D.current=g)},[A,g]);const U=n&&n.length>0?n.find(Y=>Y.chainId===g)||n[0]:null,_=(Me=U==null?void 0:U.tokenList)==null?void 0:Me.find(Y=>Y.token===A),{multicallResult:H,queryComponents:K}=F0({account:e,chainId:g,contractAddress:void 0,tokens:(U==null?void 0:U.tokenList)||[],wagmiHooks:d}),W=x.useMemo(()=>{var ee;if(!_)return;if(!_.tokenAddress||_.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return H.baseTokenBalance.formatted;const Y=H.combinedData[_.tokenAddress];return((ee=Y==null?void 0:Y.balance)==null?void 0:ee.formatted)||"0"},[_,H]),Z=Y=>{if(!Y)return"0";const ee=Y.indexOf(".");return ee>=0?Y.slice(0,ee):Y},G=x.useMemo(()=>{const Y=(A||"").toUpperCase(),ee=Number(g),Q=me=>{const de=Z(me);try{const Je=new $e(de||"0").minus(1e4);return Je.isGreaterThan(0)?Je.toFixed(0):"0"}catch{return"0"}};if(Ge(ee))return"∞";if(ee===42161||ee===421614){if(Y==="USDT")return Q(F);if(Y==="USDC")return Q(L)}return(ee===56||ee===97)&&Y==="USDT"?Q(j):"0"},[g,A,L,F,j]),J=x.useMemo(()=>{if(Ge(g))return!1;try{const Y=new $e(I||"0"),ee=new $e((G||"0").toString());return Y.isGreaterThan(ee)}catch{return!1}},[g,I,G]),ne=x.useMemo(()=>{const Y={},ee=(A||"").toUpperCase(),Q=me=>{const de=Z(me);try{const Je=new $e(de||"0").minus(1e4);return Je.isGreaterThan(0)?Je.toFixed(0):"0"}catch{return"0"}};return(n||[]).forEach(me=>{const de=Number(me==null?void 0:me.chainId);if(de){if(Ge(de)){Y[de]="∞";return}if(de===42161||de===421614){ee==="USDT"?Y[de]=Q(F):ee==="USDC"?Y[de]=Q(L):Y[de]="0";return}if(de===56||de===97){ee==="USDT"?Y[de]=Q(j):Y[de]="0";return}Y[de]="0"}}),Y},[n,A,L,F,j]),le=x.useMemo(()=>{const Y=new $e(I||"0"),ee=new $e(u||"0"),Q=Ge(g);let me=!1;if(!Q)try{const de=new $e((G||"0").toString());me=Y.isGreaterThan(de)}catch{me=!1}return!I||Y.isZero()||!Q&&Y.isLessThan(ee)||!Q&&me?{text:T("withdraw.confirmWithdraw"),disabled:!0}:t==="mpc"&&!Q&&!S.trim()?{text:T("withdraw.invalidReceiverAddress"),disabled:!0}:{text:T("withdraw.confirmWithdraw"),disabled:!1}},[T,g,I,t,S,u,G]),Se=x.useCallback(async()=>{ni(!0);try{if(f){const ee={amount:new $e(I||"0").toString(),chainId:g,tokenAddress:(_==null?void 0:_.tokenAddress)||"",tokenSymbol:A};t==="mpc"&&!Ge(g)&&(ee.receiverAddress=S),f(ee)}}catch{ni(!1)}},[f,I,g,_==null?void 0:_.tokenAddress,A,t,S]);return!n||n.length===0?B.jsx("div",{className:"text-center py-8",children:B.jsx("p",{className:"text-gray-400",children:"No chains available"})}):U?B.jsxs(B.Fragment,{children:[K,B.jsx(qh,{currentActiveChain:U,chainList:n,chainPoolBalances:ne,onChainChange:C,curSelectToken:A,onTokenChange:O,walletType:"EVM",txType:"withdraw"}),B.jsxs("div",{className:"p-3 my-4 bg-fill-input-primary rounded-lg flex items-center justify-between h-[38px]",children:[B.jsx("div",{className:"text-text-secondary text-sm",children:Ge(g)?T("withdraw.poolBalance"):T("withdraw.crossChainPoolBalance")}),B.jsxs("div",{className:"text-text-primary text-sm font-medium",children:[G," ",A]})]}),B.jsx(EP,{withdrawAmount:I,curSelectToken:A,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:U,currentEquity:c||0,amount:I,decimals:(_==null?void 0:_.decimals)||6,tokenBalance:W,platformBalance:a,fee:u,walletType:t,receiverAddress:S,onWithdrawAmountChange:P,onReceiverAddressChange:E,onAmountChanged:w,showPoolBalanceInsufficientTip:J,poolBalanceMap:ne}),B.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${le.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Se,disabled:le.disabled||l,children:[l&&B.jsx(Mo,{size:"xs"}),le.text]})]}):B.jsx("div",{className:"text-center py-8",children:B.jsx("p",{className:"text-gray-400",children:"Loading..."})})},G0=({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:d="0",fee:f,wagmiHooks:p,onWithdraw:h,onChainChange:m,onTokenChange:w,onAmountChanged:T})=>{const{t:b}=Ht();return e?Le.createPortal(B.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:B.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:B.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:$=>{$.stopPropagation()},children:[B.jsxs("div",{className:"flex items-center justify-between mb-4",children:[B.jsx("h2",{className:"text-lg font-semibold text-white",children:b("withdraw.withdraw")}),B.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:B.jsx(Wd,{className:"h-4 w-4"})})]}),B.jsx(TP,{chains:s,address:ti(o)?o.smartWalletAddress:o.ethAddress,walletType:ti(o)?"mpc":"evm",defaultChainId:i,defaultTokenAddress:c,defaultAmount:a,metadata:u,currentEquity:l,platformBalance:d,fee:f,isLoading:t,wagmiHooks:p,onWithdraw:h,onClose:n,onChainChange:m,onTokenChange:w,onAmountChanged:T})]})})}),document.body):null};ie.ChromeLoader=Mo,ie.ComponentProvider=bm,ie.DEFAULT_LOCALE=Ro,ie.Deposit=_0,ie.DepositManager=B0,ie.LOCALE_NAMES=hm,ie.LoadingSpinner=Mo,ie.SUPPORTED_LOCALES=si,ie.Tooltip=Gn,ie.Withdraw=G0,ie.WithdrawManager=U0,ie.closeDeposit=L0,ie.closeWithdraw=H0,ie.formatThousands=wm,ie.isDepositLoading=D0,ie.isWithdrawLoading=V0,ie.openDeposit=M0,ie.openWithdraw=z0,ie.setDepositLoading=ei,ie.setWithdrawLoading=ni,ie.updateDepositOptions=R0,ie.updateWithdrawOptions=W0,ie.useComponentConfig=bu,ie.useDeposit=Qv,ie.useDepositManager=gP,ie.useTranslation=Ht,ie.useWithdraw=Jv,ie.useWithdrawManager=$P,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})});
152
152
  //# sourceMappingURL=index.umd.js.map