@edgex-web/components 0.2.0-beta.27 → 0.2.0-beta.28

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(se,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],E):(se=typeof globalThis<"u"?globalThis:se||self,E(se.EdgeXComponents={},se.React,se.ReactDOM))})(this,function(se,E,je){"use strict";var EP=Object.defineProperty;var SP=(se,E,je)=>E in se?EP(se,E,{enumerable:!0,configurable:!0,writable:!0,value:je}):se[E]=je;var ts=(se,E,je)=>SP(se,typeof E!="symbol"?E+"":E,je);function jl(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=jl(E),zr=jl(je);function _m(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ti={exports:{}},Ur={};/**
1
+ (function(se,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],E):(se=typeof globalThis<"u"?globalThis:se||self,E(se.EdgeXComponents={},se.React,se.ReactDOM))})(this,function(se,E,je){"use strict";var $P=Object.defineProperty;var AP=(se,E,je)=>E in se?$P(se,E,{enumerable:!0,configurable:!0,writable:!0,value:je}):se[E]=je;var ns=(se,E,je)=>AP(se,typeof E!="symbol"?E+"":E,je);function _l(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=_l(E),zr=_l(je);function Um(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $i={exports:{}},Ur={};/**
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 _l;function zm(){if(_l)return Ur;_l=1;var e=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(c,a,l){var u,f={},d=null,p=null;l!==void 0&&(d=""+l),a.key!==void 0&&(d=""+a.key),a.ref!==void 0&&(p=a.ref);for(u in a)r.call(a,u)&&!s.hasOwnProperty(u)&&(f[u]=a[u]);if(c&&c.defaultProps)for(u in a=c.defaultProps,a)f[u]===void 0&&(f[u]=a[u]);return{$$typeof:t,type:c,key:d,ref:p,props:f,_owner:o.current}}return Ur.Fragment=n,Ur.jsx=i,Ur.jsxs=i,Ur}var Wr={};/**
9
+ */var zl;function Wm(){if(zl)return Ur;zl=1;var e=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(c,a,l){var u,f={},d=null,p=null;l!==void 0&&(d=""+l),a.key!==void 0&&(d=""+a.key),a.ref!==void 0&&(p=a.ref);for(u in a)r.call(a,u)&&!s.hasOwnProperty(u)&&(f[u]=a[u]);if(c&&c.defaultProps)for(u in a=c.defaultProps,a)f[u]===void 0&&(f[u]=a[u]);return{$$typeof:t,type:c,key:d,ref:p,props:f,_owner:o.current}}return Ur.Fragment=n,Ur.jsx=i,Ur.jsxs=i,Ur}var Wr={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,109 +14,109 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var zl;function Um(){return zl||(zl=1,process.env.NODE_ENV!=="production"&&function(){var e=E,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,b="@@iterator";function S(R){if(R===null||typeof R!="object")return null;var q=h&&R[h]||R[b];return typeof q=="function"?q:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(R){{for(var q=arguments.length,K=new Array(q>1?q-1:0),re=1;re<q;re++)K[re-1]=arguments[re];w("error",R,K)}}function w(R,q,K){{var re=P.ReactDebugCurrentFrame,be=re.getStackAddendum();be!==""&&(q+="%s",K=K.concat([be]));var ge=K.map(function(le){return String(le)});ge.unshift("Warning: "+q),Function.prototype.apply.call(console[R],console,ge)}}var A=!1,M=!1,B=!1,F=!1,m=!1,g;g=Symbol.for("react.module.reference");function v(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||m||R===o||R===l||R===u||F||R===p||A||M||B||typeof R=="object"&&R!==null&&(R.$$typeof===d||R.$$typeof===f||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===g||R.getModuleId!==void 0))}function $(R,q,K){var re=R.displayName;if(re)return re;var be=q.displayName||q.name||"";return be!==""?K+"("+be+")":K}function N(R){return R.displayName||"Context"}function O(R){if(R==null)return null;if(typeof R.tag=="number"&&x("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 l:return"Suspense";case u:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var q=R;return N(q)+".Consumer";case i:var K=R;return N(K._context)+".Provider";case a:return $(R,R.render,"ForwardRef");case f:var re=R.displayName||null;return re!==null?re:O(R.type)||"Memo";case d:{var be=R,ge=be._payload,le=be._init;try{return O(le(ge))}catch{return null}}}return null}var k=Object.assign,y=0,C,I,T,L,j,z,_;function H(){}H.__reactDisabledLog=!0;function Y(){{if(y===0){C=console.log,I=console.info,T=console.warn,L=console.error,j=console.group,z=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})}y++}}function G(){{if(y--,y===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},R,{value:C}),info:k({},R,{value:I}),warn:k({},R,{value:T}),error:k({},R,{value:L}),group:k({},R,{value:j}),groupCollapsed:k({},R,{value:z}),groupEnd:k({},R,{value:_})})}y<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var W=P.ReactCurrentDispatcher,Z;function J(R,q,K){{if(Z===void 0)try{throw Error()}catch(be){var re=be.stack.trim().match(/\n( *(at )?)/);Z=re&&re[1]||""}return`
18
- `+Z+R}}var ee=!1,fe;{var pe=typeof WeakMap=="function"?WeakMap:Map;fe=new pe}function he(R,q){if(!R||ee)return"";{var K=fe.get(R);if(K!==void 0)return K}var re;ee=!0;var be=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=W.current,W.current=null,Y();try{if(q){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(Je){re=Je}Reflect.construct(R,[],le)}else{try{le.call()}catch(Je){re=Je}R.call(le.prototype)}}else{try{throw Error()}catch(Je){re=Je}R()}}catch(Je){if(Je&&re&&typeof Je.stack=="string"){for(var ce=Je.stack.split(`
17
+ */var Ul;function Hm(){return Ul||(Ul=1,process.env.NODE_ENV!=="production"&&function(){var e=E,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,b="@@iterator";function S(R){if(R===null||typeof R!="object")return null;var Z=h&&R[h]||R[b];return typeof Z=="function"?Z:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(R){{for(var Z=arguments.length,Y=new Array(Z>1?Z-1:0),re=1;re<Z;re++)Y[re-1]=arguments[re];w("error",R,Y)}}function w(R,Z,Y){{var re=P.ReactDebugCurrentFrame,be=re.getStackAddendum();be!==""&&(Z+="%s",Y=Y.concat([be]));var ge=Y.map(function(ue){return String(ue)});ge.unshift("Warning: "+Z),Function.prototype.apply.call(console[R],console,ge)}}var $=!1,k=!1,B=!1,F=!1,m=!1,g;g=Symbol.for("react.module.reference");function v(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||m||R===o||R===l||R===u||F||R===p||$||k||B||typeof R=="object"&&R!==null&&(R.$$typeof===d||R.$$typeof===f||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===g||R.getModuleId!==void 0))}function A(R,Z,Y){var re=R.displayName;if(re)return re;var be=Z.displayName||Z.name||"";return be!==""?Y+"("+be+")":Y}function N(R){return R.displayName||"Context"}function O(R){if(R==null)return null;if(typeof R.tag=="number"&&x("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 l:return"Suspense";case u:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var Z=R;return N(Z)+".Consumer";case i:var Y=R;return N(Y._context)+".Provider";case a:return A(R,R.render,"ForwardRef");case f:var re=R.displayName||null;return re!==null?re:O(R.type)||"Memo";case d:{var be=R,ge=be._payload,ue=be._init;try{return O(ue(ge))}catch{return null}}}return null}var D=Object.assign,y=0,C,I,T,L,j,z,_;function W(){}W.__reactDisabledLog=!0;function K(){{if(y===0){C=console.log,I=console.info,T=console.warn,L=console.error,j=console.group,z=console.groupCollapsed,_=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})}y++}}function G(){{if(y--,y===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},R,{value:C}),info:D({},R,{value:I}),warn:D({},R,{value:T}),error:D({},R,{value:L}),group:D({},R,{value:j}),groupCollapsed:D({},R,{value:z}),groupEnd:D({},R,{value:_})})}y<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=P.ReactCurrentDispatcher,q;function Q(R,Z,Y){{if(q===void 0)try{throw Error()}catch(be){var re=be.stack.trim().match(/\n( *(at )?)/);q=re&&re[1]||""}return`
18
+ `+q+R}}var ee=!1,pe;{var le=typeof WeakMap=="function"?WeakMap:Map;pe=new le}function he(R,Z){if(!R||ee)return"";{var Y=pe.get(R);if(Y!==void 0)return Y}var re;ee=!0;var be=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=H.current,H.current=null,K();try{if(Z){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(Je){re=Je}Reflect.construct(R,[],ue)}else{try{ue.call()}catch(Je){re=Je}R.call(ue.prototype)}}else{try{throw Error()}catch(Je){re=Je}R()}}catch(Je){if(Je&&re&&typeof Je.stack=="string"){for(var ce=Je.stack.split(`
19
19
  `),Re=re.stack.split(`
20
20
  `),Pe=ce.length-1,Te=Re.length-1;Pe>=1&&Te>=0&&ce[Pe]!==Re[Te];)Te--;for(;Pe>=1&&Te>=0;Pe--,Te--)if(ce[Pe]!==Re[Te]){if(Pe!==1||Te!==1)do if(Pe--,Te--,Te<0||ce[Pe]!==Re[Te]){var wt=`
21
- `+ce[Pe].replace(" at new "," at ");return R.displayName&&wt.includes("<anonymous>")&&(wt=wt.replace("<anonymous>",R.displayName)),typeof R=="function"&&fe.set(R,wt),wt}while(Pe>=1&&Te>=0);break}}}finally{ee=!1,W.current=ge,G(),Error.prepareStackTrace=be}var _r=R?R.displayName||R.name:"",rr=_r?J(_r):"";return typeof R=="function"&&fe.set(R,rr),rr}function ie(R,q,K){return he(R,!1)}function me(R){var q=R.prototype;return!!(q&&q.isReactComponent)}function ne(R,q,K){if(R==null)return"";if(typeof R=="function")return he(R,me(R));if(typeof R=="string")return J(R);switch(R){case l:return J("Suspense");case u:return J("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return ie(R.render);case f:return ne(R.type,q,K);case d:{var re=R,be=re._payload,ge=re._init;try{return ne(ge(be),q,K)}catch{}}}return""}var Se=Object.prototype.hasOwnProperty,kn={},vt=P.ReactDebugCurrentFrame;function Pi(R){if(R){var q=R._owner,K=ne(R.type,R._source,q?q.type:null);vt.setExtraStackFrame(K)}else vt.setExtraStackFrame(null)}function eP(R,q,K,re,be){{var ge=Function.call.bind(Se);for(var le in R)if(ge(R,le)){var ce=void 0;try{if(typeof R[le]!="function"){var Re=Error((re||"React class")+": "+K+" type `"+le+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[le]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Re.name="Invariant Violation",Re}ce=R[le](q,le,re,K,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Pe){ce=Pe}ce&&!(ce instanceof Error)&&(Pi(be),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",re||"React class",K,le,typeof ce),Pi(null)),ce instanceof Error&&!(ce.message in kn)&&(kn[ce.message]=!0,Pi(be),x("Failed %s type: %s",K,ce.message),Pi(null))}}}var tP=Array.isArray;function kl(R){return tP(R)}function nP(R){{var q=typeof Symbol=="function"&&Symbol.toStringTag,K=q&&R[Symbol.toStringTag]||R.constructor.name||"Object";return K}}function rP(R){try{return $m(R),!1}catch{return!0}}function $m(R){return""+R}function Nm(R){if(rP(R))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",nP(R)),$m(R)}var Cm=P.ReactCurrentOwner,oP={key:!0,ref:!0,__self:!0,__source:!0},Om,Im;function sP(R){if(Se.call(R,"ref")){var q=Object.getOwnPropertyDescriptor(R,"ref").get;if(q&&q.isReactWarning)return!1}return R.ref!==void 0}function iP(R){if(Se.call(R,"key")){var q=Object.getOwnPropertyDescriptor(R,"key").get;if(q&&q.isReactWarning)return!1}return R.key!==void 0}function aP(R,q){typeof R.ref=="string"&&Cm.current}function cP(R,q){{var K=function(){Om||(Om=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};K.isReactWarning=!0,Object.defineProperty(R,"key",{get:K,configurable:!0})}}function lP(R,q){{var K=function(){Im||(Im=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};K.isReactWarning=!0,Object.defineProperty(R,"ref",{get:K,configurable:!0})}}var uP=function(R,q,K,re,be,ge,le){var ce={$$typeof:t,type:R,key:q,ref:K,props:le,_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:re}),Object.defineProperty(ce,"_source",{configurable:!1,enumerable:!1,writable:!1,value:be}),Object.freeze&&(Object.freeze(ce.props),Object.freeze(ce)),ce};function fP(R,q,K,re,be){{var ge,le={},ce=null,Re=null;K!==void 0&&(Nm(K),ce=""+K),iP(q)&&(Nm(q.key),ce=""+q.key),sP(q)&&(Re=q.ref,aP(q,be));for(ge in q)Se.call(q,ge)&&!oP.hasOwnProperty(ge)&&(le[ge]=q[ge]);if(R&&R.defaultProps){var Pe=R.defaultProps;for(ge in Pe)le[ge]===void 0&&(le[ge]=Pe[ge])}if(ce||Re){var Te=typeof R=="function"?R.displayName||R.name||"Unknown":R;ce&&cP(le,Te),Re&&lP(le,Te)}return uP(R,ce,Re,be,re,Cm.current,le)}}var Dl=P.ReactCurrentOwner,km=P.ReactDebugCurrentFrame;function jr(R){if(R){var q=R._owner,K=ne(R.type,R._source,q?q.type:null);km.setExtraStackFrame(K)}else km.setExtraStackFrame(null)}var Ml;Ml=!1;function Ll(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Dm(){{if(Dl.current){var R=O(Dl.current.type);if(R)return`
21
+ `+ce[Pe].replace(" at new "," at ");return R.displayName&&wt.includes("<anonymous>")&&(wt=wt.replace("<anonymous>",R.displayName)),typeof R=="function"&&pe.set(R,wt),wt}while(Pe>=1&&Te>=0);break}}}finally{ee=!1,H.current=ge,G(),Error.prepareStackTrace=be}var _r=R?R.displayName||R.name:"",rr=_r?Q(_r):"";return typeof R=="function"&&pe.set(R,rr),rr}function ie(R,Z,Y){return he(R,!1)}function me(R){var Z=R.prototype;return!!(Z&&Z.isReactComponent)}function ne(R,Z,Y){if(R==null)return"";if(typeof R=="function")return he(R,me(R));if(typeof R=="string")return Q(R);switch(R){case l:return Q("Suspense");case u:return Q("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return ie(R.render);case f:return ne(R.type,Z,Y);case d:{var re=R,be=re._payload,ge=re._init;try{return ne(ge(be),Z,Y)}catch{}}}return""}var Se=Object.prototype.hasOwnProperty,Dn={},vt=P.ReactDebugCurrentFrame;function Ti(R){if(R){var Z=R._owner,Y=ne(R.type,R._source,Z?Z.type:null);vt.setExtraStackFrame(Y)}else vt.setExtraStackFrame(null)}function oP(R,Z,Y,re,be){{var ge=Function.call.bind(Se);for(var ue in R)if(ge(R,ue)){var ce=void 0;try{if(typeof R[ue]!="function"){var Re=Error((re||"React class")+": "+Y+" type `"+ue+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[ue]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Re.name="Invariant Violation",Re}ce=R[ue](Z,ue,re,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Pe){ce=Pe}ce&&!(ce instanceof Error)&&(Ti(be),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",re||"React class",Y,ue,typeof ce),Ti(null)),ce instanceof Error&&!(ce.message in Dn)&&(Dn[ce.message]=!0,Ti(be),x("Failed %s type: %s",Y,ce.message),Ti(null))}}}var sP=Array.isArray;function Ml(R){return sP(R)}function iP(R){{var Z=typeof Symbol=="function"&&Symbol.toStringTag,Y=Z&&R[Symbol.toStringTag]||R.constructor.name||"Object";return Y}}function aP(R){try{return Cm(R),!1}catch{return!0}}function Cm(R){return""+R}function Om(R){if(aP(R))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",iP(R)),Cm(R)}var Im=P.ReactCurrentOwner,cP={key:!0,ref:!0,__self:!0,__source:!0},Dm,Mm;function lP(R){if(Se.call(R,"ref")){var Z=Object.getOwnPropertyDescriptor(R,"ref").get;if(Z&&Z.isReactWarning)return!1}return R.ref!==void 0}function uP(R){if(Se.call(R,"key")){var Z=Object.getOwnPropertyDescriptor(R,"key").get;if(Z&&Z.isReactWarning)return!1}return R.key!==void 0}function fP(R,Z){typeof R.ref=="string"&&Im.current}function dP(R,Z){{var Y=function(){Dm||(Dm=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Z))};Y.isReactWarning=!0,Object.defineProperty(R,"key",{get:Y,configurable:!0})}}function pP(R,Z){{var Y=function(){Mm||(Mm=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Z))};Y.isReactWarning=!0,Object.defineProperty(R,"ref",{get:Y,configurable:!0})}}var hP=function(R,Z,Y,re,be,ge,ue){var ce={$$typeof:t,type:R,key:Z,ref:Y,props:ue,_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:re}),Object.defineProperty(ce,"_source",{configurable:!1,enumerable:!1,writable:!1,value:be}),Object.freeze&&(Object.freeze(ce.props),Object.freeze(ce)),ce};function mP(R,Z,Y,re,be){{var ge,ue={},ce=null,Re=null;Y!==void 0&&(Om(Y),ce=""+Y),uP(Z)&&(Om(Z.key),ce=""+Z.key),lP(Z)&&(Re=Z.ref,fP(Z,be));for(ge in Z)Se.call(Z,ge)&&!cP.hasOwnProperty(ge)&&(ue[ge]=Z[ge]);if(R&&R.defaultProps){var Pe=R.defaultProps;for(ge in Pe)ue[ge]===void 0&&(ue[ge]=Pe[ge])}if(ce||Re){var Te=typeof R=="function"?R.displayName||R.name||"Unknown":R;ce&&dP(ue,Te),Re&&pP(ue,Te)}return hP(R,ce,Re,be,re,Im.current,ue)}}var kl=P.ReactCurrentOwner,km=P.ReactDebugCurrentFrame;function jr(R){if(R){var Z=R._owner,Y=ne(R.type,R._source,Z?Z.type:null);km.setExtraStackFrame(Y)}else km.setExtraStackFrame(null)}var Ll;Ll=!1;function Bl(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Lm(){{if(kl.current){var R=O(kl.current.type);if(R)return`
22
22
 
23
- Check the render method of \``+R+"`."}return""}}function dP(R){return""}var Mm={};function pP(R){{var q=Dm();if(!q){var K=typeof R=="string"?R:R.displayName||R.name;K&&(q=`
23
+ Check the render method of \``+R+"`."}return""}}function bP(R){return""}var Bm={};function gP(R){{var Z=Lm();if(!Z){var Y=typeof R=="string"?R:R.displayName||R.name;Y&&(Z=`
24
24
 
25
- Check the top-level render call using <`+K+">.")}return q}}function Lm(R,q){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var K=pP(q);if(Mm[K])return;Mm[K]=!0;var re="";R&&R._owner&&R._owner!==Dl.current&&(re=" It was passed a child from "+O(R._owner.type)+"."),jr(R),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',K,re),jr(null)}}function Bm(R,q){{if(typeof R!="object")return;if(kl(R))for(var K=0;K<R.length;K++){var re=R[K];Ll(re)&&Lm(re,q)}else if(Ll(R))R._store&&(R._store.validated=!0);else if(R){var be=S(R);if(typeof be=="function"&&be!==R.entries)for(var ge=be.call(R),le;!(le=ge.next()).done;)Ll(le.value)&&Lm(le.value,q)}}}function hP(R){{var q=R.type;if(q==null||typeof q=="string")return;var K;if(typeof q=="function")K=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===f))K=q.propTypes;else return;if(K){var re=O(q);eP(K,R.props,"prop",re,R)}else if(q.PropTypes!==void 0&&!Ml){Ml=!0;var be=O(q);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",be||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mP(R){{for(var q=Object.keys(R.props),K=0;K<q.length;K++){var re=q[K];if(re!=="children"&&re!=="key"){jr(R),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",re),jr(null);break}}R.ref!==null&&(jr(R),x("Invalid attribute `ref` supplied to `React.Fragment`."),jr(null))}}var Fm={};function Rm(R,q,K,re,be,ge){{var le=v(R);if(!le){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 Re=dP();Re?ce+=Re:ce+=Dm();var Pe;R===null?Pe="null":kl(R)?Pe="array":R!==void 0&&R.$$typeof===t?(Pe="<"+(O(R.type)||"Unknown")+" />",ce=" Did you accidentally export a JSX literal instead of a component?"):Pe=typeof R,x("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 Te=fP(R,q,K,be,ge);if(Te==null)return Te;if(le){var wt=q.children;if(wt!==void 0)if(re)if(kl(wt)){for(var _r=0;_r<wt.length;_r++)Bm(wt[_r],R);Object.freeze&&Object.freeze(wt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Bm(wt,R)}if(Se.call(q,"key")){var rr=O(R),Je=Object.keys(q).filter(function(xP){return xP!=="key"}),Bl=Je.length>0?"{key: someKey, "+Je.join(": ..., ")+": ...}":"{key: someKey}";if(!Fm[rr+Bl]){var wP=Je.length>0?"{"+Je.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+Y+">.")}return Z}}function Fm(R,Z){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var Y=gP(Z);if(Bm[Y])return;Bm[Y]=!0;var re="";R&&R._owner&&R._owner!==kl.current&&(re=" It was passed a child from "+O(R._owner.type)+"."),jr(R),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,re),jr(null)}}function Rm(R,Z){{if(typeof R!="object")return;if(Ml(R))for(var Y=0;Y<R.length;Y++){var re=R[Y];Bl(re)&&Fm(re,Z)}else if(Bl(R))R._store&&(R._store.validated=!0);else if(R){var be=S(R);if(typeof be=="function"&&be!==R.entries)for(var ge=be.call(R),ue;!(ue=ge.next()).done;)Bl(ue.value)&&Fm(ue.value,Z)}}}function yP(R){{var Z=R.type;if(Z==null||typeof Z=="string")return;var Y;if(typeof Z=="function")Y=Z.propTypes;else if(typeof Z=="object"&&(Z.$$typeof===a||Z.$$typeof===f))Y=Z.propTypes;else return;if(Y){var re=O(Z);oP(Y,R.props,"prop",re,R)}else if(Z.PropTypes!==void 0&&!Ll){Ll=!0;var be=O(Z);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",be||"Unknown")}typeof Z.getDefaultProps=="function"&&!Z.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function vP(R){{for(var Z=Object.keys(R.props),Y=0;Y<Z.length;Y++){var re=Z[Y];if(re!=="children"&&re!=="key"){jr(R),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",re),jr(null);break}}R.ref!==null&&(jr(R),x("Invalid attribute `ref` supplied to `React.Fragment`."),jr(null))}}var jm={};function _m(R,Z,Y,re,be,ge){{var ue=v(R);if(!ue){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 Re=bP();Re?ce+=Re:ce+=Lm();var Pe;R===null?Pe="null":Ml(R)?Pe="array":R!==void 0&&R.$$typeof===t?(Pe="<"+(O(R.type)||"Unknown")+" />",ce=" Did you accidentally export a JSX literal instead of a component?"):Pe=typeof R,x("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 Te=mP(R,Z,Y,be,ge);if(Te==null)return Te;if(ue){var wt=Z.children;if(wt!==void 0)if(re)if(Ml(wt)){for(var _r=0;_r<wt.length;_r++)Rm(wt[_r],R);Object.freeze&&Object.freeze(wt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Rm(wt,R)}if(Se.call(Z,"key")){var rr=O(R),Je=Object.keys(Z).filter(function(TP){return TP!=="key"}),Fl=Je.length>0?"{key: someKey, "+Je.join(": ..., ")+": ...}":"{key: someKey}";if(!jm[rr+Fl]){var PP=Je.length>0?"{"+Je.join(": ..., ")+": ...}":"{}";x(`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} />`,Bl,rr,wP,rr),Fm[rr+Bl]=!0}}return R===r?mP(Te):hP(Te),Te}}function bP(R,q,K){return Rm(R,q,K,!0)}function gP(R,q,K){return Rm(R,q,K,!1)}var yP=gP,vP=bP;Wr.Fragment=r,Wr.jsx=yP,Wr.jsxs=vP}()),Wr}process.env.NODE_ENV==="production"?Ti.exports=zm():Ti.exports=Um();var D=Ti.exports;const Wm={deposit:{title:"Einzahlen",chain:"Chain",asset:"Asset",amount:"Betrag",available:"Verfügbar",equity:"Eigenkapital",confirmDeposit:"Einzahlung bestätigen",switchNetwork:"Netzwerk wechseln",max:"Max.",arrivalTime:"Ankunftszeit",ethCrossChainDepositInitiated:"ETH-Cross-Chain-Einzahlung initiiert. Voraussichtliche Ankunft in 2 bis 5 Minuten.",minDeposit:"Mindestbetrag der Einzahlung",minDepositParsed:"Min. {{amount}} {{token}} einzahlen",maxDeposit:"Maximaler Einzahlungsbetrag",depositTipFor25w:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Wenn deine Einzahlung 200.000 übersteigt, verwende bitte die Ethereum-Chain.",depositAllTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
30
+ <%s key={someKey} {...props} />`,Fl,rr,PP,rr),jm[rr+Fl]=!0}}return R===r?vP(Te):yP(Te),Te}}function wP(R,Z,Y){return _m(R,Z,Y,!0)}function xP(R,Z,Y){return _m(R,Z,Y,!1)}var EP=xP,SP=wP;Wr.Fragment=r,Wr.jsx=EP,Wr.jsxs=SP}()),Wr}process.env.NODE_ENV==="production"?$i.exports=Wm():$i.exports=Hm();var M=$i.exports;const Vm={deposit:{title:"Einzahlen",chain:"Chain",asset:"Asset",amount:"Betrag",available:"Verfügbar",equity:"Eigenkapital",confirmDeposit:"Einzahlung bestätigen",switchNetwork:"Netzwerk wechseln",max:"Max.",arrivalTime:"Ankunftszeit",ethCrossChainDepositInitiated:"ETH-Cross-Chain-Einzahlung initiiert. Voraussichtliche Ankunft in 2 bis 5 Minuten.",minDeposit:"Mindestbetrag der Einzahlung",minDepositParsed:"Min. {{amount}} {{token}} einzahlen",maxDeposit:"Maximaler Einzahlungsbetrag",depositTipFor25w:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Wenn deine Einzahlung 200.000 übersteigt, verwende bitte die Ethereum-Chain.",depositAllTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
31
31
  Wenn der Einzahlungsbetrag 200.000 übersteigt, kann es zu einer Verzögerung der Ankunftszeit kommen. Bitte hab etwas Geduld.`,maxDepositSplitTip:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Falls du mehr als 200.000 einzahlen musst, teile den Betrag bitte in mehrere Einzahlungen auf.",spotDepositNotSupportedTip:"Einzahlungen werden nicht unterstützt. Bitte zahle auf das Perpetual-Konto ein und überweise den Betrag anschließend.",crossChainDepositFeeTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
32
- Bei Chain-übergreifenden Einzahlungen musst du die Edge-Gas-Gebühr zahlen. Der gutgeschriebene Betrag wird etwas geringer sein als dein Einzahlungsbetrag.`,addressUpdatedNotice:"Hinweis: Deine Einzahlungsadresse wurde aktualisiert. Verwende die neue Adresse. Die alte Adresse funktioniert nur während der Übergangszeit und wird dann deaktiviert. Wenn sie an einem anderen Ort gespeichert wurde, aktualisiere sie umgehend.",enableSystemProWithToken:"{{token}} auf {{network}} aktivieren",enableTokenDesc:"Bei der ersten Einzahlung auf {{network}} musst du {{token}} aktivieren.",enableWithToken:"{{token}} aktivieren",arrivaltimeTooltip1:"Die Gelder kommen in etwa {{v}} Minuten an (nach Erreichen von {{v1}} Blockbestätigungen).",arrivaltimeTooltip2:"Die geschätzte Zeit wird auf der Grundlage historischer Daten berechnet und dient nur als Referenz. Eine Überlastung des Netzwerks kann zu längeren tatsächlichen Ankunftszeiten führen.",arrivalEstimated:"≈ {{v}} Minuten",availableDesc:"Der maximale Betrag, den du einzahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Einzahlungen vorgenommen werden.",noPrivateKeyWalletWarning:"Verwende für Einzahlungen keine schlüssellosen Wallets. Einzahlungen mit einer schlüssellosen Wallet können zu einem unwiderruflichen Verlust der Gelder führen.",layerZeroDepositTip:"Das System wird deine Einzahlung über LayerZero auf Basis der tatsächlichen Einzahlungsbedingungen abschließen.",layerZeroDepositTipExceedPool:"Da der Einzahlungsbetrag den Pool übersteigt, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositTipGte200k:"Da der Einzahlungsbetrag größer als oder gleich 200.000 USDT ist, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositButton:"Mit LayerZero einzahlen",defaultSpotNotice:"Standardeinzahlungen werden dem Spot-Konto gutgeschrieben.",defaultSpotToPerpNotice:"Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt. Standardeinzahlungen werden dem Spot-Konto gutgeschrieben. Überweise Gelder vom Spot-Konto auf das Futures-Konto, um das Futures-Konto zu finanzieren."},withdraw:{noticeDesc:"Normale Auszahlungen erfolgen in zwei Schritten. Im aktuellen Schritt wird dein Auszahlungsantrag eingeleitet und auf Layer 2 bearbeitet. Sobald deine Gelder zur Verfügung stehen (dies kann bis zu 4 Stunden dauern), erhältst du eine Benachrichtigung, um deine Gelder in deine Wallet auszuzahlen. Aufgrund der Chain-Synchronisierung und anderer Faktoren kann die Dauer bis zu 48 Stunden betragen. Du bist für alle Gas-Gebühren der Transaktion verantwortlich.",crossChainTips:"Bei Chain-übergreifenden Auszahlungen ist eine Verifizierung über L2 (über ZK-Proofs) erforderlich. Die Auszahlung kann bis zu 2 Stunden dauern. Für die Abwicklung von Chain-übergreifenden Auszahlungen sind ausreichende Mittel im Asset-Pool der entsprechenden Chain erforderlich. Außerdem fallen Gas-Gebühren an. edgeX erhebt eine Gebühr zur Deckung dieser Kosten.",commonWithdraw:"FAQ zu Auszahlungen",withdraw:"Auszahlen",speed:"Geschwindigkeit",confirmWithdraw:"Auszahlung bestätigen",speedNote:"Bearbeitungszeiten:",speedNoteSpeed1:"Ca. 8 Minuten",speedNoteSpeed2:"Ca. 2-4 Stunden",speedNoteSpeed3:"Ca. 4 Stunden",receiverAddress:"Empfängeradresse",fee:"Gebühr",feeRate:"Gebührensatz",withdrawlAmount:"Auszahlungsbetrag",amountToReceive:"Zu erhaltender Betrag",minWithdraw:"Mindestauszahlungsbetrag",minWithdrawParsed:"Min. Auszahlung {{amount}} {{token}}",invalidReceiverAddress:"Die Adresse darf nicht leer sein.",availableDesc:"Der maximale Betrag, den du auszahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Auszahlungen vorgenommen werden.",feeCalculationTip:"Die Auszahlungsgebühren werden berechnet, indem der Auszahlungsbetrag mit dem Gebührensatz multipliziert wird. Der Mindestbetrag liegt bei 1 USDT/USDC. Der Gebührensatz kann auf Basis der tatsächlichen On-chain-Bedingungen angepasst werden.",crossChainPoolBalance:"Guthaben des Cross-Chain-Pools",poolBalance:"Pool-Guthaben",poolBalanceInsufficientTip:"Da der Auszahlungsbetrag das Pool-Guthaben übersteigt, kann die Auszahlung nicht bearbeitet werden. Bitte wähle eine Option mit ausreichendem Pool-Guthaben."},account:{title:"Konto",perpetual:"Perpetual-Konto",spot:"Spot-Konto"}},Hm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",ethCrossChainDepositInitiated:"ETH cross-chain deposit initiated. Estimated arrival in 2–5 minutes.",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
32
+ Bei Chain-übergreifenden Einzahlungen musst du die Edge-Gas-Gebühr zahlen. Der gutgeschriebene Betrag wird etwas geringer sein als dein Einzahlungsbetrag.`,addressUpdatedNotice:"Hinweis: Deine Einzahlungsadresse wurde aktualisiert. Verwende die neue Adresse. Die alte Adresse funktioniert nur während der Übergangszeit und wird dann deaktiviert. Wenn sie an einem anderen Ort gespeichert wurde, aktualisiere sie umgehend.",enableSystemProWithToken:"{{token}} auf {{network}} aktivieren",enableTokenDesc:"Bei der ersten Einzahlung auf {{network}} musst du {{token}} aktivieren.",enableWithToken:"{{token}} aktivieren",arrivaltimeTooltip1:"Die Gelder kommen in etwa {{v}} Minuten an (nach Erreichen von {{v1}} Blockbestätigungen).",arrivaltimeTooltip2:"Die geschätzte Zeit wird auf der Grundlage historischer Daten berechnet und dient nur als Referenz. Eine Überlastung des Netzwerks kann zu längeren tatsächlichen Ankunftszeiten führen.",arrivalEstimated:"≈ {{v}} Minuten",availableDesc:"Der maximale Betrag, den du einzahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Einzahlungen vorgenommen werden.",noPrivateKeyWalletWarning:"Verwende für Einzahlungen keine schlüssellosen Wallets. Einzahlungen mit einer schlüssellosen Wallet können zu einem unwiderruflichen Verlust der Gelder führen.",layerZeroDepositTip:"Das System wird deine Einzahlung über LayerZero auf Basis der tatsächlichen Einzahlungsbedingungen abschließen.",layerZeroDepositTipExceedPool:"Da der Einzahlungsbetrag den Pool übersteigt, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositTipGte200k:"Da der Einzahlungsbetrag größer als oder gleich 200.000 USDT ist, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositButton:"Mit LayerZero einzahlen",defaultSpotNotice:"Standardeinzahlungen werden dem Spot-Konto gutgeschrieben.",defaultSpotToPerpNotice:"Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt. Standardeinzahlungen werden dem Spot-Konto gutgeschrieben. Überweise Gelder vom Spot-Konto auf das Futures-Konto, um das Futures-Konto zu finanzieren."},withdraw:{noticeDesc:"Normale Auszahlungen erfolgen in zwei Schritten. Im aktuellen Schritt wird dein Auszahlungsantrag eingeleitet und auf Layer 2 bearbeitet. Sobald deine Gelder zur Verfügung stehen (dies kann bis zu 4 Stunden dauern), erhältst du eine Benachrichtigung, um deine Gelder in deine Wallet auszuzahlen. Aufgrund der Chain-Synchronisierung und anderer Faktoren kann die Dauer bis zu 48 Stunden betragen. Du bist für alle Gas-Gebühren der Transaktion verantwortlich.",crossChainTips:"Bei Chain-übergreifenden Auszahlungen ist eine Verifizierung über L2 (über ZK-Proofs) erforderlich. Die Auszahlung kann bis zu 2 Stunden dauern. Für die Abwicklung von Chain-übergreifenden Auszahlungen sind ausreichende Mittel im Asset-Pool der entsprechenden Chain erforderlich. Außerdem fallen Gas-Gebühren an. edgeX erhebt eine Gebühr zur Deckung dieser Kosten.",commonWithdraw:"FAQ zu Auszahlungen",withdraw:"Auszahlen",speed:"Geschwindigkeit",confirmWithdraw:"Auszahlung bestätigen",speedNote:"Bearbeitungszeiten:",speedNoteSpeed1:"Ca. 8 Minuten",speedNoteSpeed2:"Ca. 2-4 Stunden",speedNoteSpeed3:"Ca. 4 Stunden",receiverAddress:"Empfängeradresse",fee:"Gebühr",feeRate:"Gebührensatz",withdrawlAmount:"Auszahlungsbetrag",amountToReceive:"Zu erhaltender Betrag",minWithdraw:"Mindestauszahlungsbetrag",minWithdrawParsed:"Min. Auszahlung {{amount}} {{token}}",invalidReceiverAddress:"Die Adresse darf nicht leer sein.",availableDesc:"Der maximale Betrag, den du auszahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Auszahlungen vorgenommen werden.",feeCalculationTip:"Die Auszahlungsgebühren werden berechnet, indem der Auszahlungsbetrag mit dem Gebührensatz multipliziert wird. Der Mindestbetrag liegt bei 1 USDT/USDC. Der Gebührensatz kann auf Basis der tatsächlichen On-chain-Bedingungen angepasst werden.",crossChainPoolBalance:"Guthaben des Cross-Chain-Pools",poolBalance:"Pool-Guthaben",poolBalanceInsufficientTip:"Da der Auszahlungsbetrag das Pool-Guthaben übersteigt, kann die Auszahlung nicht bearbeitet werden. Bitte wähle eine Option mit ausreichendem Pool-Guthaben."},account:{title:"Konto",perpetual:"Perpetual-Konto",spot:"Spot-Konto"}},Gm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",ethCrossChainDepositInitiated:"ETH cross-chain deposit initiated. Estimated arrival in 2–5 minutes.",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
33
33
  If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,maxDepositSplitTip:"The maximum amount per deposit is 200,000. If you need to deposit more than 200,000, please split it into multiple deposits.",spotDepositNotSupportedTip:"Deposits aren't supported. Please deposit to perpetual account, then transfer.",crossChainDepositFeeTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
34
- Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account."},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",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",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."},account:{title:"Account",perpetual:"Perpetual Account",spot:"Spot Account"}},Vm={deposit:{title:"Depósito",chain:"Cadena",asset:"Activo",amount:"Monto",available:"Disponible",equity:"Capital",confirmDeposit:"Confirmar depósito",switchNetwork:"Cambiar de red",max:"Máx.",arrivalTime:"Hora de llegada",ethCrossChainDepositInitiated:"Se inició el depósito entre cadenas de ETH. Llegada estimada en 2 a 5 minutos.",minDeposit:"Monto mínimo de depósito",minDepositParsed:"Mín. de depósito: {{amount}} {{token}}",maxDeposit:"Monto máximo de depósito",depositTipFor25w:"El monto máximo por depósito es de 200,000. Si tu depósito supera los 200,000, usa la cadena Ethereum.",depositAllTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
34
+ Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account."},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",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",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."},account:{title:"Account",perpetual:"Perpetual Account",spot:"Spot Account"}},qm={deposit:{title:"Depósito",chain:"Cadena",asset:"Activo",amount:"Monto",available:"Disponible",equity:"Capital",confirmDeposit:"Confirmar depósito",switchNetwork:"Cambiar de red",max:"Máx.",arrivalTime:"Hora de llegada",ethCrossChainDepositInitiated:"Se inició el depósito entre cadenas de ETH. Llegada estimada en 2 a 5 minutos.",minDeposit:"Monto mínimo de depósito",minDepositParsed:"Mín. de depósito: {{amount}} {{token}}",maxDeposit:"Monto máximo de depósito",depositTipFor25w:"El monto máximo por depósito es de 200,000. Si tu depósito supera los 200,000, usa la cadena Ethereum.",depositAllTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
35
35
  Si el monto del depósito supera los 200,000, puede haber un retraso en la hora de llegada. Ten paciencia.`,maxDepositSplitTip:"El monto máximo por depósito es de 200,000. Si necesitas depositar más de 200,000, divídelo en varios depósitos.",spotDepositNotSupportedTip:"No se admiten depósitos. Deposita en la cuenta de perpetuos y luego haz la transferencia.",crossChainDepositFeeTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
36
- Los depósitos entre cadenas requieren el pago de la comisión de gas de Edge. El monto acreditado será ligeramente inferior al monto depositado.`,addressUpdatedNotice:"Aviso: Se actualizó tu dirección de depósito. Usa esta nueva dirección. La anterior solo funciona durante la transición y pronto se desactivará. Si la tienes guardada en otros dispositivos, actualízala lo antes posible.",enableSystemProWithToken:"Habilitar {{token}} en {{network}}",enableTokenDesc:"Debes habilitar {{token}} la primera vez que deposites en {{network}}.",enableWithToken:"Habilitar {{token}}",arrivaltimeTooltip1:"Los fondos se acreditarán en aproximadamente {{v}} minutos (tras obtener {{v1}} confirmaciones de bloque).",arrivaltimeTooltip2:"El tiempo estimado se calcula a partir de datos históricos y es solo de referencia. La congestión de la red puede ocasionar tiempos de acreditación más largos.",arrivalEstimated:"Aprox. {{v}} minutos",availableDesc:"Lo máximo que puedes depositar. Si el saldo disponible es 0 o negativo, los depósitos no están permitidos.",noPrivateKeyWalletWarning:"No uses billeteras sin clave para realizar depósitos. Existe el riesgo de una pérdida irreversible de los fondos.",layerZeroDepositTip:"El sistema completará tu depósito a través de LayerZero según las condiciones de depósito reales.",layerZeroDepositTipExceedPool:"Dado que el importe del depósito supera el pool, tu depósito se completará a través de LayerZero.",layerZeroDepositTipGte200k:"El depósito es de 200,000 USDT o más. Se completará a través de LayerZero.",layerZeroDepositButton:"Depositar con LayerZero",defaultSpotNotice:"Los depósitos predeterminados van a la cuenta spot.",defaultSpotToPerpNotice:"Esta dirección solo admite depósitos en {{coin}} ({{v}}) Los depósitos predeterminados van a la cuenta spot. Para agregar fondos a la cuenta de futuros, transfiere desde la cuenta spot a la cuenta de futuros."},withdraw:{noticeDesc:"Los retiros normales son un proceso de dos pasos. Este paso inicia tu solicitud de retiro, que se procesará en la capa 2. Una vez que tus fondos estén listos (puede tardar hasta 4 horas), recibirás una notificación para retirar fondos a tu billetera. Debido a la sincronización de la cadena y a otros factores, el proceso puede llevar hasta 48 horas. Las comisiones de gas de las transacciones corren por tu cuenta.",crossChainTips:"Los retiros entre cadenas requieren verificación en la capa 2 (mediante pruebas ZK) y el proceso de retiro puede tardar hasta 2 horas. Para procesar retiros entre cadenas, se requieren fondos suficientes en el pool de activos de la cadena correspondiente. También se incurrirá en comisiones de gas. edgeX cobrará una tarifa para cubrirlos.",commonWithdraw:"Preguntas frecuentes sobre los retiros",withdraw:"Retirar",speed:"Velocidad",confirmWithdraw:"Confirmar el retiro",speedNote:"Plazos de procesamiento:",speedNoteSpeed1:"Aprox. 8 minutos",speedNoteSpeed2:"Aprox. 2-4 horas",speedNoteSpeed3:"Aprox. 4 horas",receiverAddress:"Dirección del destinatario",fee:"Comisión",feeRate:"Tasa de comisión",withdrawlAmount:"Monto del retiro",amountToReceive:"Monto a recibir",minWithdraw:"Monto mínimo de retiro",minWithdrawParsed:"Min. de retiro: {{amount}} {{token}}",invalidReceiverAddress:"La dirección no puede estar vacía",availableDesc:"Lo máximo que puedes retirar. Si el saldo disponible es 0 o negativo, los retiros no están permitidos.",feeCalculationTip:"Las comisiones de retiro se calculan multiplicando el monto de retiro por la tasa de comisión, con un mínimo de 1 USDT/USDC. La tasa de la comisión puede modificarse en función de las condiciones reales de la cadena.",crossChainPoolBalance:"Saldo del pool cross-chain",poolBalance:"Saldo del pool",poolBalanceInsufficientTip:"El monto a retirar excede el saldo del pool. El retiro no se puede procesar. Selecciona una opción con un saldo suficiente en el pool."},account:{title:"Cuenta",perpetual:"Cuenta de perpetuos",spot:"Cuenta spot"}},Gm={deposit:{title:"Dépôt",chain:"Blockchain",asset:"Actif",amount:"Montant",available:"Disponible",equity:"Actif net",confirmDeposit:"Confirmer le dépôt",switchNetwork:"Changer de réseau",max:"Max.",arrivalTime:"Heure d’arrivée",ethCrossChainDepositInitiated:"Dépôt ETH inter-blockchains initié. Arrivée estimée dans 2 à 5 minutes.",minDeposit:"Montant minimum de dépôt",minDepositParsed:"Dépôt min. {{amount}} {{token}}",maxDeposit:"Montant maximum de dépôt",depositTipFor25w:"Le montant maximum par dépôt est de 200 000. Si votre dépôt dépasse 200 000, utilisez la blockchain Ethereum.",depositAllTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
36
+ Los depósitos entre cadenas requieren el pago de la comisión de gas de Edge. El monto acreditado será ligeramente inferior al monto depositado.`,addressUpdatedNotice:"Aviso: Se actualizó tu dirección de depósito. Usa esta nueva dirección. La anterior solo funciona durante la transición y pronto se desactivará. Si la tienes guardada en otros dispositivos, actualízala lo antes posible.",enableSystemProWithToken:"Habilitar {{token}} en {{network}}",enableTokenDesc:"Debes habilitar {{token}} la primera vez que deposites en {{network}}.",enableWithToken:"Habilitar {{token}}",arrivaltimeTooltip1:"Los fondos se acreditarán en aproximadamente {{v}} minutos (tras obtener {{v1}} confirmaciones de bloque).",arrivaltimeTooltip2:"El tiempo estimado se calcula a partir de datos históricos y es solo de referencia. La congestión de la red puede ocasionar tiempos de acreditación más largos.",arrivalEstimated:"Aprox. {{v}} minutos",availableDesc:"Lo máximo que puedes depositar. Si el saldo disponible es 0 o negativo, los depósitos no están permitidos.",noPrivateKeyWalletWarning:"No uses billeteras sin clave para realizar depósitos. Existe el riesgo de una pérdida irreversible de los fondos.",layerZeroDepositTip:"El sistema completará tu depósito a través de LayerZero según las condiciones de depósito reales.",layerZeroDepositTipExceedPool:"Dado que el importe del depósito supera el pool, tu depósito se completará a través de LayerZero.",layerZeroDepositTipGte200k:"El depósito es de 200,000 USDT o más. Se completará a través de LayerZero.",layerZeroDepositButton:"Depositar con LayerZero",defaultSpotNotice:"Los depósitos predeterminados van a la cuenta spot.",defaultSpotToPerpNotice:"Esta dirección solo admite depósitos en {{coin}} ({{v}}) Los depósitos predeterminados van a la cuenta spot. Para agregar fondos a la cuenta de futuros, transfiere desde la cuenta spot a la cuenta de futuros."},withdraw:{noticeDesc:"Los retiros normales son un proceso de dos pasos. Este paso inicia tu solicitud de retiro, que se procesará en la capa 2. Una vez que tus fondos estén listos (puede tardar hasta 4 horas), recibirás una notificación para retirar fondos a tu billetera. Debido a la sincronización de la cadena y a otros factores, el proceso puede llevar hasta 48 horas. Las comisiones de gas de las transacciones corren por tu cuenta.",crossChainTips:"Los retiros entre cadenas requieren verificación en la capa 2 (mediante pruebas ZK) y el proceso de retiro puede tardar hasta 2 horas. Para procesar retiros entre cadenas, se requieren fondos suficientes en el pool de activos de la cadena correspondiente. También se incurrirá en comisiones de gas. edgeX cobrará una tarifa para cubrirlos.",commonWithdraw:"Preguntas frecuentes sobre los retiros",withdraw:"Retirar",speed:"Velocidad",confirmWithdraw:"Confirmar el retiro",speedNote:"Plazos de procesamiento:",speedNoteSpeed1:"Aprox. 8 minutos",speedNoteSpeed2:"Aprox. 2-4 horas",speedNoteSpeed3:"Aprox. 4 horas",receiverAddress:"Dirección del destinatario",fee:"Comisión",feeRate:"Tasa de comisión",withdrawlAmount:"Monto del retiro",amountToReceive:"Monto a recibir",minWithdraw:"Monto mínimo de retiro",minWithdrawParsed:"Min. de retiro: {{amount}} {{token}}",invalidReceiverAddress:"La dirección no puede estar vacía",availableDesc:"Lo máximo que puedes retirar. Si el saldo disponible es 0 o negativo, los retiros no están permitidos.",feeCalculationTip:"Las comisiones de retiro se calculan multiplicando el monto de retiro por la tasa de comisión, con un mínimo de 1 USDT/USDC. La tasa de la comisión puede modificarse en función de las condiciones reales de la cadena.",crossChainPoolBalance:"Saldo del pool cross-chain",poolBalance:"Saldo del pool",poolBalanceInsufficientTip:"El monto a retirar excede el saldo del pool. El retiro no se puede procesar. Selecciona una opción con un saldo suficiente en el pool."},account:{title:"Cuenta",perpetual:"Cuenta de perpetuos",spot:"Cuenta spot"}},Zm={deposit:{title:"Dépôt",chain:"Blockchain",asset:"Actif",amount:"Montant",available:"Disponible",equity:"Actif net",confirmDeposit:"Confirmer le dépôt",switchNetwork:"Changer de réseau",max:"Max.",arrivalTime:"Heure d’arrivée",ethCrossChainDepositInitiated:"Dépôt ETH inter-blockchains initié. Arrivée estimée dans 2 à 5 minutes.",minDeposit:"Montant minimum de dépôt",minDepositParsed:"Dépôt min. {{amount}} {{token}}",maxDeposit:"Montant maximum de dépôt",depositTipFor25w:"Le montant maximum par dépôt est de 200 000. Si votre dépôt dépasse 200 000, utilisez la blockchain Ethereum.",depositAllTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
37
37
  Si le montant du dépôt dépasse 200 000, l’heure d’arrivée peut être retardée. Merci de patienter.`,maxDepositSplitTip:"Le montant maximum par dépôt est de 200 000. Si vous devez déposer plus de 200 000, veuillez effectuer plusieurs dépôts.",spotDepositNotSupportedTip:"Les dépôts ne sont pas pris en charge. Veuillez effectuer le dépôt sur le compte perpétuel, puis transférer les fonds.",crossChainDepositFeeTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
38
- Les dépôts inter-blockchains nécessitent le paiement des frais de gas Edge. Le montant crédité sera légèrement inférieur au montant déposé.`,addressUpdatedNotice:"Avis : Votre adresse de dépôt a été mise à jour. Utilisez la nouvelle adresse. L’ancienne ne fonctionne que pendant la transition et sera désactivée. Si vous l’avez enregistrée ailleurs, modifiez-la sans tarder.",enableSystemProWithToken:"Activer {{token}} sur {{network}}",enableTokenDesc:"Vous devez activer {{token}} lors de votre premier dépôt sur {{network}}.",enableWithToken:"Activer {{token}}",arrivaltimeTooltip1:"Les fonds arriveront dans environ {{v}} minutes (après {{v1}} confirmations de bloc).",arrivaltimeTooltip2:"La durée estimée est calculée sur la base de données historiques et n’est donnée qu’à titre indicatif. L’encombrement du réseau peut rallonger l’heure d’arrivée réelle.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"Montant maximal que vous pouvez déposer. Lorsque le solde disponible est nul ou négatif, aucun dépôt ne peut être effectué.",noPrivateKeyWalletWarning:"N’utilisez pas de wallets sans clé pour effectuer des dépôts. Un dépôt effectué depuis un wallet sans clé peut entraîner une perte irréversible des fonds.",layerZeroDepositTip:"Le système effectuera votre dépôt via LayerZero en fonction des conditions réelles du dépôt.",layerZeroDepositTipExceedPool:"Comme le montant du dépôt est supérieur au pool, votre dépôt sera effectué via LayerZero.",layerZeroDepositTipGte200k:"Comme le montant du dépôt est supérieur ou égal à 200 000 USDT, votre dépôt sera effectué via LayerZero.",layerZeroDepositButton:"Déposer via LayerZero",defaultSpotNotice:"Par défaut, les dépôts sont crédités sur le compte spot.",defaultSpotToPerpNotice:"Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse. Par défaut, les dépôts sont crédités sur le compte spot. Pour alimenter le compte futures, transférez des fonds du compte spot vers le compte futures."},withdraw:{noticeDesc:"Les retraits classiques s’effectuent en deux étapes. Cette étape initie votre demande de retrait et sera traitée sur la Layer 2. Une fois vos fonds prêts (cela peut prendre jusqu’à 4 heures), vous recevrez une notification pour retirer les fonds vers votre wallet. En raison de la synchronisation de la chaîne et d’autres facteurs, le délai peut atteindre 48 heures. Vous êtes responsable de tous les frais de gas liés aux transactions.",crossChainTips:"Les retraits inter-blockchains nécessitent une vérification sur L2 (via des preuves ZK) et le processus de retrait peut prendre jusqu’à 2 heures. Des fonds suffisants dans le pool d’actifs de la chaîne concernée sont nécessaires pour traiter les retraits inter-blockchains. Des frais de gas seront également appliqués. edgeX facturera des frais pour les couvrir.",commonWithdraw:"FAQ sur les retraits",withdraw:"Retrait",speed:"Vitesse",confirmWithdraw:"Confirmer le retrait",speedNote:"Délais de traitement :",speedNoteSpeed1:"Env. 8 minutes",speedNoteSpeed2:"Env. 2 à 4 heures",speedNoteSpeed3:"Env. 4 heures",receiverAddress:"Adresse de réception",fee:"Frais",feeRate:"Taux de frais",withdrawlAmount:"Montant du retrait",amountToReceive:"Montant à recevoir",minWithdraw:"Montant minimum de retrait",minWithdrawParsed:"Retrait min. {{amount}} {{token}}",invalidReceiverAddress:"L’adresse ne peut pas être vide",availableDesc:"Montant maximal que vous pouvez retirer. Lorsque le solde disponible est nul ou négatif, aucun retrait ne peut être effectué.",feeCalculationTip:"Les frais de retrait sont calculés en multipliant le montant du retrait par le taux de frais, avec un minimum de 1 USDT/USDC. Le taux de frais peut être ajusté en fonction des conditions réelles on-chain.",crossChainPoolBalance:"Solde du pool inter-blockchains",poolBalance:"Solde du pool",poolBalanceInsufficientTip:"Le montant du retrait dépasse le solde du pool de fonds ; le retrait ne peut pas être traité. Sélectionnez une option disposant d’un solde de pool de fonds suffisant."},account:{title:"Compte",perpetual:"Compte perpétuel",spot:"Compte spot"}},qm={deposit:{title:"Deposita",chain:"Blockchain",asset:"Asset",amount:"Importo",available:"Disponibile",equity:"Equity",confirmDeposit:"Conferma il deposito",switchNetwork:"Cambia rete",max:"Max",arrivalTime:"Orario di arrivo",ethCrossChainDepositInitiated:"Deposito cross-chain di ETH avviato. Il deposito arriverà tra 2-5 minuti.",minDeposit:"Importo minimo del deposito",minDepositParsed:"Deposito min. {{amount}} {{token}}",maxDeposit:"Importo massimo del deposito",depositTipFor25w:"L'importo massimo per deposito è 200.000. Se il tuo deposito supera i 200.000, utilizza la catena Ethereum.",depositAllTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
38
+ Les dépôts inter-blockchains nécessitent le paiement des frais de gas Edge. Le montant crédité sera légèrement inférieur au montant déposé.`,addressUpdatedNotice:"Avis : Votre adresse de dépôt a été mise à jour. Utilisez la nouvelle adresse. L’ancienne ne fonctionne que pendant la transition et sera désactivée. Si vous l’avez enregistrée ailleurs, modifiez-la sans tarder.",enableSystemProWithToken:"Activer {{token}} sur {{network}}",enableTokenDesc:"Vous devez activer {{token}} lors de votre premier dépôt sur {{network}}.",enableWithToken:"Activer {{token}}",arrivaltimeTooltip1:"Les fonds arriveront dans environ {{v}} minutes (après {{v1}} confirmations de bloc).",arrivaltimeTooltip2:"La durée estimée est calculée sur la base de données historiques et n’est donnée qu’à titre indicatif. L’encombrement du réseau peut rallonger l’heure d’arrivée réelle.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"Montant maximal que vous pouvez déposer. Lorsque le solde disponible est nul ou négatif, aucun dépôt ne peut être effectué.",noPrivateKeyWalletWarning:"N’utilisez pas de wallets sans clé pour effectuer des dépôts. Un dépôt effectué depuis un wallet sans clé peut entraîner une perte irréversible des fonds.",layerZeroDepositTip:"Le système effectuera votre dépôt via LayerZero en fonction des conditions réelles du dépôt.",layerZeroDepositTipExceedPool:"Comme le montant du dépôt est supérieur au pool, votre dépôt sera effectué via LayerZero.",layerZeroDepositTipGte200k:"Comme le montant du dépôt est supérieur ou égal à 200 000 USDT, votre dépôt sera effectué via LayerZero.",layerZeroDepositButton:"Déposer via LayerZero",defaultSpotNotice:"Par défaut, les dépôts sont crédités sur le compte spot.",defaultSpotToPerpNotice:"Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse. Par défaut, les dépôts sont crédités sur le compte spot. Pour alimenter le compte futures, transférez des fonds du compte spot vers le compte futures."},withdraw:{noticeDesc:"Les retraits classiques s’effectuent en deux étapes. Cette étape initie votre demande de retrait et sera traitée sur la Layer 2. Une fois vos fonds prêts (cela peut prendre jusqu’à 4 heures), vous recevrez une notification pour retirer les fonds vers votre wallet. En raison de la synchronisation de la chaîne et d’autres facteurs, le délai peut atteindre 48 heures. Vous êtes responsable de tous les frais de gas liés aux transactions.",crossChainTips:"Les retraits inter-blockchains nécessitent une vérification sur L2 (via des preuves ZK) et le processus de retrait peut prendre jusqu’à 2 heures. Des fonds suffisants dans le pool d’actifs de la chaîne concernée sont nécessaires pour traiter les retraits inter-blockchains. Des frais de gas seront également appliqués. edgeX facturera des frais pour les couvrir.",commonWithdraw:"FAQ sur les retraits",withdraw:"Retrait",speed:"Vitesse",confirmWithdraw:"Confirmer le retrait",speedNote:"Délais de traitement :",speedNoteSpeed1:"Env. 8 minutes",speedNoteSpeed2:"Env. 2 à 4 heures",speedNoteSpeed3:"Env. 4 heures",receiverAddress:"Adresse de réception",fee:"Frais",feeRate:"Taux de frais",withdrawlAmount:"Montant du retrait",amountToReceive:"Montant à recevoir",minWithdraw:"Montant minimum de retrait",minWithdrawParsed:"Retrait min. {{amount}} {{token}}",invalidReceiverAddress:"L’adresse ne peut pas être vide",availableDesc:"Montant maximal que vous pouvez retirer. Lorsque le solde disponible est nul ou négatif, aucun retrait ne peut être effectué.",feeCalculationTip:"Les frais de retrait sont calculés en multipliant le montant du retrait par le taux de frais, avec un minimum de 1 USDT/USDC. Le taux de frais peut être ajusté en fonction des conditions réelles on-chain.",crossChainPoolBalance:"Solde du pool inter-blockchains",poolBalance:"Solde du pool",poolBalanceInsufficientTip:"Le montant du retrait dépasse le solde du pool de fonds ; le retrait ne peut pas être traité. Sélectionnez une option disposant d’un solde de pool de fonds suffisant."},account:{title:"Compte",perpetual:"Compte perpétuel",spot:"Compte spot"}},Km={deposit:{title:"Deposita",chain:"Blockchain",asset:"Asset",amount:"Importo",available:"Disponibile",equity:"Equity",confirmDeposit:"Conferma il deposito",switchNetwork:"Cambia rete",max:"Max",arrivalTime:"Orario di arrivo",ethCrossChainDepositInitiated:"Deposito cross-chain di ETH avviato. Il deposito arriverà tra 2-5 minuti.",minDeposit:"Importo minimo del deposito",minDepositParsed:"Deposito min. {{amount}} {{token}}",maxDeposit:"Importo massimo del deposito",depositTipFor25w:"L'importo massimo per deposito è 200.000. Se il tuo deposito supera i 200.000, utilizza la catena Ethereum.",depositAllTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
39
39
  Se l'importo del deposito supera i 200.000, l'orario di arrivo potrebbe subire ritardi. Sii paziente.`,maxDepositSplitTip:"L'importo massimo per deposito è 200.000. Se devi depositare più di 200.000, dividi l'importo in più depositi.",spotDepositNotSupportedTip:"I depositi non sono supportati. Prima deposita sul conto perpetuo, quindi effettua il trasferimento.",crossChainDepositFeeTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
40
- Per i depositi cross-chain è necessario pagare la gas fee Edge. L'importo accreditato sarà leggermente inferiore all'importo del deposito.`,addressUpdatedNotice:"Avviso: il tuo indirizzo di deposito è stato aggiornato. Utilizza il nuovo indirizzo. L'indirizzo precedente funzionerà solo durante la transizione, quindi verrà disattivato. Se l'hai salvato altrove, aggiornarlo il prima possibile.",enableSystemProWithToken:"Abilita {{token}} su {{network}}",enableTokenDesc:"Devi abilitare {{token}} la prima volta che depositi su {{network}}.",enableWithToken:"Abilita {{token}}",arrivaltimeTooltip1:"I fondi arriveranno entro circa {{v}} minuti (dopo{{v1}} conferme di blocco).",arrivaltimeTooltip2:"Il tempo stimato è calcolato in base ai dati storici ed solo per riferimento. Se la rete è congestionata, potrebbero esserci dei ritardi.",arrivalEstimated:"≈ {{v}} minuti",availableDesc:"L'importo massimo che puoi depositare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare depositi.",noPrivateKeyWalletWarning:"Non effettuare depositi con wallet senza chiavi. Se effettui un deposito tramite un wallet senza chiave rischi di perdere i tuoi fondi per sempre.",layerZeroDepositTip:"Il sistema completerà il tuo deposito tramite LayerZero in base alle condizioni effettive di deposito.",layerZeroDepositTipExceedPool:"Poiché l'importo del deposito supera il pool, il deposito sarà completato tramite LayerZero.",layerZeroDepositTipGte200k:"Poiché l'importo del deposito è maggiore o uguale a 200.000 USDT, il deposito verrà completato tramite LayerZero.",layerZeroDepositButton:"Deposita con LayerZero",defaultSpotNotice:"I depositi predefiniti vanno sul conto spot.",defaultSpotToPerpNotice:"I depositi a questo indirizzo supportano solo {{coin}} ({{v}}). I depositi predefiniti vanno sul conto spot. Per finanziare il conto futures, effettua un trasferimento dal conto spot al conto futures."},withdraw:{noticeDesc:"I prelievi normali avvengono in due fasi. La fase attuale dà il via alla richiesta di prelievo, che verrà elaborata nel Layer 2. Non appena i fondi saranno pronti (possono volerci fino a 4 ore), riceverai una notifica per prelevarli nel tuo portafoglio. A causa della sincronizzazione della blockchain e di altri fattori, l'operazione potrebbe richiedere fino a 48 ore. Sei responsabile di eventuali gas fee per la transazione.",crossChainTips:"I prelievi cross-chain richiedono una verifica sul L2 (tramite prove ZK) e l'elaborazione del prelievo può richiedere fino a 2 ore. Per elaborare i prelievi cross-chain, il pool degli asset della blockchain corrispondente deve disporre di fondi a sufficienza. Inoltre, è necessario pagare delle gas fee. edgeX addebiterà una commissione per coprire tale costo.",commonWithdraw:"Domande frequenti sui prelievi",withdraw:"Preleva",speed:"Velocità",confirmWithdraw:"Conferma prelievo",speedNote:"Tempi di elaborazione:",speedNoteSpeed1:"Circa 8 minuti",speedNoteSpeed2:"Circa 2-4 ore",speedNoteSpeed3:"Circa 4 ore",receiverAddress:"Indirizzo del destinatario",fee:"Commissione",feeRate:"Tariffa",withdrawlAmount:"Importo del prelievo",amountToReceive:"Importo da ricevere",minWithdraw:"Importo minimo di prelievo",minWithdrawParsed:"Prelievo min. {{amount}} {{token}}",invalidReceiverAddress:"L'indirizzo non può essere vuoto",availableDesc:"L'importo massimo che puoi prelevare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare prelievi.",feeCalculationTip:"Le commissioni di prelievo vengono calcolate moltiplicando l'importo del prelievo per il tasso di commissione, con un minimo di 1 USDT/USDC. La tariffa può essere modificata in base alle condizioni effettive on-chain.",crossChainPoolBalance:"Equilibrio del pool cross-chain",poolBalance:"Equilibrio della piscina",poolBalanceInsufficientTip:"L'importo del prelievo supera il saldo del fondo e il prelievo non può essere elaborato. Selezionare un'opzione con un saldo di fondi sufficiente."},account:{title:"Account",perpetual:"Conto perpetuo",spot:"Conto Spot"}},Zm={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
40
+ Per i depositi cross-chain è necessario pagare la gas fee Edge. L'importo accreditato sarà leggermente inferiore all'importo del deposito.`,addressUpdatedNotice:"Avviso: il tuo indirizzo di deposito è stato aggiornato. Utilizza il nuovo indirizzo. L'indirizzo precedente funzionerà solo durante la transizione, quindi verrà disattivato. Se l'hai salvato altrove, aggiornarlo il prima possibile.",enableSystemProWithToken:"Abilita {{token}} su {{network}}",enableTokenDesc:"Devi abilitare {{token}} la prima volta che depositi su {{network}}.",enableWithToken:"Abilita {{token}}",arrivaltimeTooltip1:"I fondi arriveranno entro circa {{v}} minuti (dopo{{v1}} conferme di blocco).",arrivaltimeTooltip2:"Il tempo stimato è calcolato in base ai dati storici ed solo per riferimento. Se la rete è congestionata, potrebbero esserci dei ritardi.",arrivalEstimated:"≈ {{v}} minuti",availableDesc:"L'importo massimo che puoi depositare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare depositi.",noPrivateKeyWalletWarning:"Non effettuare depositi con wallet senza chiavi. Se effettui un deposito tramite un wallet senza chiave rischi di perdere i tuoi fondi per sempre.",layerZeroDepositTip:"Il sistema completerà il tuo deposito tramite LayerZero in base alle condizioni effettive di deposito.",layerZeroDepositTipExceedPool:"Poiché l'importo del deposito supera il pool, il deposito sarà completato tramite LayerZero.",layerZeroDepositTipGte200k:"Poiché l'importo del deposito è maggiore o uguale a 200.000 USDT, il deposito verrà completato tramite LayerZero.",layerZeroDepositButton:"Deposita con LayerZero",defaultSpotNotice:"I depositi predefiniti vanno sul conto spot.",defaultSpotToPerpNotice:"I depositi a questo indirizzo supportano solo {{coin}} ({{v}}). I depositi predefiniti vanno sul conto spot. Per finanziare il conto futures, effettua un trasferimento dal conto spot al conto futures."},withdraw:{noticeDesc:"I prelievi normali avvengono in due fasi. La fase attuale dà il via alla richiesta di prelievo, che verrà elaborata nel Layer 2. Non appena i fondi saranno pronti (possono volerci fino a 4 ore), riceverai una notifica per prelevarli nel tuo portafoglio. A causa della sincronizzazione della blockchain e di altri fattori, l'operazione potrebbe richiedere fino a 48 ore. Sei responsabile di eventuali gas fee per la transazione.",crossChainTips:"I prelievi cross-chain richiedono una verifica sul L2 (tramite prove ZK) e l'elaborazione del prelievo può richiedere fino a 2 ore. Per elaborare i prelievi cross-chain, il pool degli asset della blockchain corrispondente deve disporre di fondi a sufficienza. Inoltre, è necessario pagare delle gas fee. edgeX addebiterà una commissione per coprire tale costo.",commonWithdraw:"Domande frequenti sui prelievi",withdraw:"Preleva",speed:"Velocità",confirmWithdraw:"Conferma prelievo",speedNote:"Tempi di elaborazione:",speedNoteSpeed1:"Circa 8 minuti",speedNoteSpeed2:"Circa 2-4 ore",speedNoteSpeed3:"Circa 4 ore",receiverAddress:"Indirizzo del destinatario",fee:"Commissione",feeRate:"Tariffa",withdrawlAmount:"Importo del prelievo",amountToReceive:"Importo da ricevere",minWithdraw:"Importo minimo di prelievo",minWithdrawParsed:"Prelievo min. {{amount}} {{token}}",invalidReceiverAddress:"L'indirizzo non può essere vuoto",availableDesc:"L'importo massimo che puoi prelevare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare prelievi.",feeCalculationTip:"Le commissioni di prelievo vengono calcolate moltiplicando l'importo del prelievo per il tasso di commissione, con un minimo di 1 USDT/USDC. La tariffa può essere modificata in base alle condizioni effettive on-chain.",crossChainPoolBalance:"Equilibrio del pool cross-chain",poolBalance:"Equilibrio della piscina",poolBalanceInsufficientTip:"L'importo del prelievo supera il saldo del fondo e il prelievo non può essere elaborato. Selezionare un'opzione con un saldo di fondi sufficiente."},account:{title:"Account",perpetual:"Conto perpetuo",spot:"Conto Spot"}},Ym={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
41
41
  入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,maxDepositSplitTip:"1回の入金上限は200,000です。200,000を超える金額を入金する場合は、複数回に分けて行ってください。",spotDepositNotSupportedTip:"入金非対応。先に契約アカウント入金後、振替。",crossChainDepositFeeTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
42
- クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。"},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:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"},account:{title:"アカウント",perpetual:"パーペチュアルアカウント",spot:"スポットアカウント"}},Km={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
42
+ クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。"},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:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"},account:{title:"アカウント",perpetual:"パーペチュアルアカウント",spot:"スポットアカウント"}},Xm={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
43
43
  Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,maxDepositSplitTip:"Максимальная сумма одного пополнения — 200 000. Если вам нужно пополнить на сумму более 200 000, выполните несколько пополнений.",spotDepositNotSupportedTip:"Пополнение недоступно. Сначала контрактный счёт, затем перевод.",crossChainDepositFeeTip:`На этот адрес можно внести только {{coin}} ({{v}}).
44
44
  За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:`Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.
45
45
 
46
- Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный."},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:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."},account:{title:"Аккаунт",perpetual:"Перпетуальный счет",spot:"Спотовый счет"}},Ym={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
46
+ Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный."},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:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."},account:{title:"Аккаунт",perpetual:"Перпетуальный счет",spot:"Спотовый счет"}},Qm={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
47
47
  充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,maxDepositSplitTip:"单笔充值金额上限为200,000。若需要充值金额大于200,000,请分多笔进行操作。",spotDepositNotSupportedTip:"不支持充值,请先充入合约账户再划转。",crossChainDepositFeeTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
48
- 跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。"},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:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。"},account:{title:"账户",perpetual:"合约账户",spot:"现货账户"}},Xm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
48
+ 跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。"},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:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。"},account:{title:"账户",perpetual:"合约账户",spot:"现货账户"}},Jm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
49
49
  充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,maxDepositSplitTip:"單筆充值金額上限為 200,000。若需要充值金額大於 200,000,請分多筆進行操作。",spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
50
- 跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。"},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:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perpetual:"合約帳戶",spot:"現貨帳戶"}},Ai=["en-US","ja-JP","ru-RU","zh-CN","zh-TW","de-DE","es-LA","fr-FR","it-IT"],Ul={"en-US":Hm,"ja-JP":Zm,"ru-RU":Km,"zh-CN":Ym,"zh-TW":Xm,"de-DE":Wm,"es-LA":Vm,"fr-FR":Gm,"it-IT":qm},ns="en-US",Qm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский","de-DE":"Deutsch","es-LA":"Español (Latinoamérica)","fr-FR":"Français","it-IT":"Italiano"},Jm=e=>Ai.includes(e)?Ul[e]:Ul[ns],eb=e=>Ai.includes(e),Wl=E.createContext(null),tb=({config:e,children:t})=>{const n=E.useMemo(()=>{const r=e.locale||ns,o=eb(r)?r:ns,s=Jm(o);return{...e,currentLocale:o,translations:s}},[e]);return D.jsx(Wl.Provider,{value:n,children:t})},Hl=()=>{const e=E.useContext(Wl);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var nb=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,$i=Math.ceil,st=Math.floor,_e="[BigNumber Error] ",Vl=_e+"Number primitive has more than 15 significant digits: ",xt=1e14,oe=14,Ni=9007199254740991,Ci=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],pn=1e7,Ne=1e9;function Gl(e){var t,n,r,o=x.prototype={constructor:x,toString:null,valueOf:null},s=new x(1),i=20,c=4,a=-7,l=21,u=-1e7,f=1e7,d=!1,p=1,h=0,b={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function x(m,g){var v,$,N,O,k,y,C,I,T=this;if(!(T instanceof x))return new x(m,g);if(g==null){if(m&&m._isBigNumber===!0){T.s=m.s,!m.c||m.e>f?T.c=T.e=null:m.e<u?T.c=[T.e=0]:(T.e=m.e,T.c=m.c.slice());return}if((y=typeof m=="number")&&m*0==0){if(T.s=1/m<0?(m=-m,-1):1,m===~~m){for(O=0,k=m;k>=10;k/=10,O++);O>f?T.c=T.e=null:(T.e=O,T.c=[m]);return}I=String(m)}else{if(!nb.test(I=String(m)))return r(T,I,y);T.s=I.charCodeAt(0)==45?(I=I.slice(1),-1):1}(O=I.indexOf("."))>-1&&(I=I.replace(".","")),(k=I.search(/e/i))>0?(O<0&&(O=k),O+=+I.slice(k+1),I=I.substring(0,k)):O<0&&(O=I.length)}else{if(ye(g,2,S.length,"Base"),g==10&&P)return T=new x(m),B(T,i+T.e+1,c);if(I=String(m),y=typeof m=="number"){if(m*0!=0)return r(T,I,y,g);if(T.s=1/m<0?(I=I.slice(1),-1):1,x.DEBUG&&I.replace(/^0\.0*|\./,"").length>15)throw Error(Vl+m)}else T.s=I.charCodeAt(0)===45?(I=I.slice(1),-1):1;for(v=S.slice(0,g),O=k=0,C=I.length;k<C;k++)if(v.indexOf($=I.charAt(k))<0){if($=="."){if(k>O){O=C;continue}}else if(!N&&(I==I.toUpperCase()&&(I=I.toLowerCase())||I==I.toLowerCase()&&(I=I.toUpperCase()))){N=!0,k=-1,O=0;continue}return r(T,String(m),y,g)}y=!1,I=n(I,g,10,T.s),(O=I.indexOf("."))>-1?I=I.replace(".",""):O=I.length}for(k=0;I.charCodeAt(k)===48;k++);for(C=I.length;I.charCodeAt(--C)===48;);if(I=I.slice(k,++C)){if(C-=k,y&&x.DEBUG&&C>15&&(m>Ni||m!==st(m)))throw Error(Vl+T.s*m);if((O=O-k-1)>f)T.c=T.e=null;else if(O<u)T.c=[T.e=0];else{if(T.e=O,T.c=[],k=(O+1)%oe,O<0&&(k+=oe),k<C){for(k&&T.c.push(+I.slice(0,k)),C-=oe;k<C;)T.c.push(+I.slice(k,k+=oe));k=oe-(I=I.slice(k)).length}else k-=C;for(;k--;I+="0");T.c.push(+I)}}else T.c=[T.e=0]}x.clone=Gl,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(m){var g,v;if(m!=null)if(typeof m=="object"){if(m.hasOwnProperty(g="DECIMAL_PLACES")&&(v=m[g],ye(v,0,Ne,g),i=v),m.hasOwnProperty(g="ROUNDING_MODE")&&(v=m[g],ye(v,0,8,g),c=v),m.hasOwnProperty(g="EXPONENTIAL_AT")&&(v=m[g],v&&v.pop?(ye(v[0],-Ne,0,g),ye(v[1],0,Ne,g),a=v[0],l=v[1]):(ye(v,-Ne,Ne,g),a=-(l=v<0?-v:v))),m.hasOwnProperty(g="RANGE"))if(v=m[g],v&&v.pop)ye(v[0],-Ne,-1,g),ye(v[1],1,Ne,g),u=v[0],f=v[1];else if(ye(v,-Ne,Ne,g),v)u=-(f=v<0?-v:v);else throw Error(_e+g+" cannot be zero: "+v);if(m.hasOwnProperty(g="CRYPTO"))if(v=m[g],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))d=v;else throw d=!v,Error(_e+"crypto unavailable");else d=v;else throw Error(_e+g+" not true or false: "+v);if(m.hasOwnProperty(g="MODULO_MODE")&&(v=m[g],ye(v,0,9,g),p=v),m.hasOwnProperty(g="POW_PRECISION")&&(v=m[g],ye(v,0,Ne,g),h=v),m.hasOwnProperty(g="FORMAT"))if(v=m[g],typeof v=="object")b=v;else throw Error(_e+g+" not an object: "+v);if(m.hasOwnProperty(g="ALPHABET"))if(v=m[g],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))P=v.slice(0,10)=="0123456789",S=v;else throw Error(_e+g+" invalid: "+v)}else throw Error(_e+"Object expected: "+m);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,l],RANGE:[u,f],CRYPTO:d,MODULO_MODE:p,POW_PRECISION:h,FORMAT:b,ALPHABET:S}},x.isBigNumber=function(m){if(!m||m._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var g,v,$=m.c,N=m.e,O=m.s;e:if({}.toString.call($)=="[object Array]"){if((O===1||O===-1)&&N>=-Ne&&N<=Ne&&N===st(N)){if($[0]===0){if(N===0&&$.length===1)return!0;break e}if(g=(N+1)%oe,g<1&&(g+=oe),String($[0]).length==g){for(g=0;g<$.length;g++)if(v=$[g],v<0||v>=xt||v!==st(v))break e;if(v!==0)return!0}}}else if($===null&&N===null&&(O===null||O===1||O===-1))return!0;throw Error(_e+"Invalid BigNumber: "+m)},x.maximum=x.max=function(){return A(arguments,-1)},x.minimum=x.min=function(){return A(arguments,1)},x.random=function(){var m=9007199254740992,g=Math.random()*m&2097151?function(){return st(Math.random()*m)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var $,N,O,k,y,C=0,I=[],T=new x(s);if(v==null?v=i:ye(v,0,Ne),k=$i(v/oe),d)if(crypto.getRandomValues){for($=crypto.getRandomValues(new Uint32Array(k*=2));C<k;)y=$[C]*131072+($[C+1]>>>11),y>=9e15?(N=crypto.getRandomValues(new Uint32Array(2)),$[C]=N[0],$[C+1]=N[1]):(I.push(y%1e14),C+=2);C=k/2}else if(crypto.randomBytes){for($=crypto.randomBytes(k*=7);C<k;)y=($[C]&31)*281474976710656+$[C+1]*1099511627776+$[C+2]*4294967296+$[C+3]*16777216+($[C+4]<<16)+($[C+5]<<8)+$[C+6],y>=9e15?crypto.randomBytes(7).copy($,C):(I.push(y%1e14),C+=7);C=k/7}else throw d=!1,Error(_e+"crypto unavailable");if(!d)for(;C<k;)y=g(),y<9e15&&(I[C++]=y%1e14);for(k=I[--C],v%=oe,k&&v&&(y=Ci[oe-v],I[C]=st(k/y)*y);I[C]===0;I.pop(),C--);if(C<0)I=[O=0];else{for(O=-1;I[0]===0;I.splice(0,1),O-=oe);for(C=1,y=I[0];y>=10;y/=10,C++);C<oe&&(O-=oe-C)}return T.e=O,T.c=I,T}}(),x.sum=function(){for(var m=1,g=arguments,v=new x(g[0]);m<g.length;)v=v.plus(g[m++]);return v},n=function(){var m="0123456789";function g(v,$,N,O){for(var k,y=[0],C,I=0,T=v.length;I<T;){for(C=y.length;C--;y[C]*=$);for(y[0]+=O.indexOf(v.charAt(I++)),k=0;k<y.length;k++)y[k]>N-1&&(y[k+1]==null&&(y[k+1]=0),y[k+1]+=y[k]/N|0,y[k]%=N)}return y.reverse()}return function(v,$,N,O,k){var y,C,I,T,L,j,z,_,H=v.indexOf("."),Y=i,G=c;for(H>=0&&(T=h,h=0,v=v.replace(".",""),_=new x($),j=_.pow(v.length-H),h=T,_.c=g(qt(at(j.c),j.e,"0"),10,N,m),_.e=_.c.length),z=g(v,$,N,k?(y=S,m):(y=m,S)),I=T=z.length;z[--T]==0;z.pop());if(!z[0])return y.charAt(0);if(H<0?--I:(j.c=z,j.e=I,j.s=O,j=t(j,_,Y,G,N),z=j.c,L=j.r,I=j.e),C=I+Y+1,H=z[C],T=N/2,L=L||C<0||z[C+1]!=null,L=G<4?(H!=null||L)&&(G==0||G==(j.s<0?3:2)):H>T||H==T&&(G==4||L||G==6&&z[C-1]&1||G==(j.s<0?8:7)),C<1||!z[0])v=L?qt(y.charAt(1),-Y,y.charAt(0)):y.charAt(0);else{if(z.length=C,L)for(--N;++z[--C]>N;)z[C]=0,C||(++I,z=[1].concat(z));for(T=z.length;!z[--T];);for(H=0,v="";H<=T;v+=y.charAt(z[H++]));v=qt(v,I,y.charAt(0))}return v}}(),t=function(){function m($,N,O){var k,y,C,I,T=0,L=$.length,j=N%pn,z=N/pn|0;for($=$.slice();L--;)C=$[L]%pn,I=$[L]/pn|0,k=z*C+I*j,y=j*C+k%pn*pn+T,T=(y/O|0)+(k/pn|0)+z*I,$[L]=y%O;return T&&($=[T].concat($)),$}function g($,N,O,k){var y,C;if(O!=k)C=O>k?1:-1;else for(y=C=0;y<O;y++)if($[y]!=N[y]){C=$[y]>N[y]?1:-1;break}return C}function v($,N,O,k){for(var y=0;O--;)$[O]-=y,y=$[O]<N[O]?1:0,$[O]=y*k+$[O]-N[O];for(;!$[0]&&$.length>1;$.splice(0,1));}return function($,N,O,k,y){var C,I,T,L,j,z,_,H,Y,G,W,Z,J,ee,fe,pe,he,ie=$.s==N.s?1:-1,me=$.c,ne=N.c;if(!me||!me[0]||!ne||!ne[0])return new x(!$.s||!N.s||(me?ne&&me[0]==ne[0]:!ne)?NaN:me&&me[0]==0||!ne?ie*0:ie/0);for(H=new x(ie),Y=H.c=[],I=$.e-N.e,ie=O+I+1,y||(y=xt,I=it($.e/oe)-it(N.e/oe),ie=ie/oe|0),T=0;ne[T]==(me[T]||0);T++);if(ne[T]>(me[T]||0)&&I--,ie<0)Y.push(1),L=!0;else{for(ee=me.length,pe=ne.length,T=0,ie+=2,j=st(y/(ne[0]+1)),j>1&&(ne=m(ne,j,y),me=m(me,j,y),pe=ne.length,ee=me.length),J=pe,G=me.slice(0,pe),W=G.length;W<pe;G[W++]=0);he=ne.slice(),he=[0].concat(he),fe=ne[0],ne[1]>=y/2&&fe++;do{if(j=0,C=g(ne,G,pe,W),C<0){if(Z=G[0],pe!=W&&(Z=Z*y+(G[1]||0)),j=st(Z/fe),j>1)for(j>=y&&(j=y-1),z=m(ne,j,y),_=z.length,W=G.length;g(z,G,_,W)==1;)j--,v(z,pe<_?he:ne,_,y),_=z.length,C=1;else j==0&&(C=j=1),z=ne.slice(),_=z.length;if(_<W&&(z=[0].concat(z)),v(G,z,W,y),W=G.length,C==-1)for(;g(ne,G,pe,W)<1;)j++,v(G,pe<W?he:ne,W,y),W=G.length}else C===0&&(j++,G=[0]);Y[T++]=j,G[0]?G[W++]=me[J]||0:(G=[me[J]],W=1)}while((J++<ee||G[0]!=null)&&ie--);L=G[0]!=null,Y[0]||Y.splice(0,1)}if(y==xt){for(T=1,ie=Y[0];ie>=10;ie/=10,T++);B(H,O+(H.e=T+I*oe-1)+1,k,L)}else H.e=I,H.r=+L;return H}}();function w(m,g,v,$){var N,O,k,y,C;if(v==null?v=c:ye(v,0,8),!m.c)return m.toString();if(N=m.c[0],k=m.e,g==null)C=at(m.c),C=$==1||$==2&&(k<=a||k>=l)?os(C,k):qt(C,k,"0");else if(m=B(new x(m),g,v),O=m.e,C=at(m.c),y=C.length,$==1||$==2&&(g<=O||O<=a)){for(;y<g;C+="0",y++);C=os(C,O)}else if(g-=k+($===2&&O>k),C=qt(C,O,"0"),O+1>y){if(--g>0)for(C+=".";g--;C+="0");}else if(g+=O-y,g>0)for(O+1==y&&(C+=".");g--;C+="0");return m.s<0&&N?"-"+C:C}function A(m,g){for(var v,$,N=1,O=new x(m[0]);N<m.length;N++)$=new x(m[N]),(!$.s||(v=Dn(O,$))===g||v===0&&O.s===g)&&(O=$);return O}function M(m,g,v){for(var $=1,N=g.length;!g[--N];g.pop());for(N=g[0];N>=10;N/=10,$++);return(v=$+v*oe-1)>f?m.c=m.e=null:v<u?m.c=[m.e=0]:(m.e=v,m.c=g),m}r=function(){var m=/^(-?)0([xbo])(?=\w[\w.]*$)/i,g=/^([^.]+)\.$/,v=/^\.([^.]+)$/,$=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(O,k,y,C){var I,T=y?k:k.replace(N,"");if($.test(T))O.s=isNaN(T)?null:T<0?-1:1;else{if(!y&&(T=T.replace(m,function(L,j,z){return I=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!C||C==I?j:L}),C&&(I=C,T=T.replace(g,"$1").replace(v,"0.$1")),k!=T))return new x(T,I);if(x.DEBUG)throw Error(_e+"Not a"+(C?" base "+C:"")+" number: "+k);O.s=null}O.c=O.e=null}}();function B(m,g,v,$){var N,O,k,y,C,I,T,L=m.c,j=Ci;if(L){e:{for(N=1,y=L[0];y>=10;y/=10,N++);if(O=g-N,O<0)O+=oe,k=g,C=L[I=0],T=st(C/j[N-k-1]%10);else if(I=$i((O+1)/oe),I>=L.length)if($){for(;L.length<=I;L.push(0));C=T=0,N=1,O%=oe,k=O-oe+1}else break e;else{for(C=y=L[I],N=1;y>=10;y/=10,N++);O%=oe,k=O-oe+N,T=k<0?0:st(C/j[N-k-1]%10)}if($=$||g<0||L[I+1]!=null||(k<0?C:C%j[N-k-1]),$=v<4?(T||$)&&(v==0||v==(m.s<0?3:2)):T>5||T==5&&(v==4||$||v==6&&(O>0?k>0?C/j[N-k]:0:L[I-1])%10&1||v==(m.s<0?8:7)),g<1||!L[0])return L.length=0,$?(g-=m.e+1,L[0]=j[(oe-g%oe)%oe],m.e=-g||0):L[0]=m.e=0,m;if(O==0?(L.length=I,y=1,I--):(L.length=I+1,y=j[oe-O],L[I]=k>0?st(C/j[N-k]%j[k])*y:0),$)for(;;)if(I==0){for(O=1,k=L[0];k>=10;k/=10,O++);for(k=L[0]+=y,y=1;k>=10;k/=10,y++);O!=y&&(m.e++,L[0]==xt&&(L[0]=1));break}else{if(L[I]+=y,L[I]!=xt)break;L[I--]=0,y=1}for(O=L.length;L[--O]===0;L.pop());}m.e>f?m.c=m.e=null:m.e<u&&(m.c=[m.e=0])}return m}function F(m){var g,v=m.e;return v===null?m.toString():(g=at(m.c),g=v<=a||v>=l?os(g,v):qt(g,v,"0"),m.s<0?"-"+g:g)}return o.absoluteValue=o.abs=function(){var m=new x(this);return m.s<0&&(m.s=1),m},o.comparedTo=function(m,g){return Dn(this,new x(m,g))},o.decimalPlaces=o.dp=function(m,g){var v,$,N,O=this;if(m!=null)return ye(m,0,Ne),g==null?g=c:ye(g,0,8),B(new x(O),m+O.e+1,g);if(!(v=O.c))return null;if($=((N=v.length-1)-it(this.e/oe))*oe,N=v[N])for(;N%10==0;N/=10,$--);return $<0&&($=0),$},o.dividedBy=o.div=function(m,g){return t(this,new x(m,g),i,c)},o.dividedToIntegerBy=o.idiv=function(m,g){return t(this,new x(m,g),0,1)},o.exponentiatedBy=o.pow=function(m,g){var v,$,N,O,k,y,C,I,T,L=this;if(m=new x(m),m.c&&!m.isInteger())throw Error(_e+"Exponent not an integer: "+F(m));if(g!=null&&(g=new x(g)),y=m.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!m.c||!m.c[0])return T=new x(Math.pow(+F(L),y?m.s*(2-rs(m)):+F(m))),g?T.mod(g):T;if(C=m.s<0,g){if(g.c?!g.c[0]:!g.s)return new x(NaN);$=!C&&L.isInteger()&&g.isInteger(),$&&(L=L.mod(g))}else{if(m.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||y&&L.c[1]>=24e7:L.c[0]<8e13||y&&L.c[0]<=9999975e7)))return O=L.s<0&&rs(m)?-0:0,L.e>-1&&(O=1/O),new x(C?1/O:O);h&&(O=$i(h/oe+2))}for(y?(v=new x(.5),C&&(m.s=1),I=rs(m)):(N=Math.abs(+F(m)),I=N%2),T=new x(s);;){if(I){if(T=T.times(L),!T.c)break;O?T.c.length>O&&(T.c.length=O):$&&(T=T.mod(g))}if(N){if(N=st(N/2),N===0)break;I=N%2}else if(m=m.times(v),B(m,m.e+1,1),m.e>14)I=rs(m);else{if(N=+F(m),N===0)break;I=N%2}L=L.times(L),O?L.c&&L.c.length>O&&(L.c.length=O):$&&(L=L.mod(g))}return $?T:(C&&(T=s.div(T)),g?T.mod(g):O?B(T,h,c,k):T)},o.integerValue=function(m){var g=new x(this);return m==null?m=c:ye(m,0,8),B(g,g.e+1,m)},o.isEqualTo=o.eq=function(m,g){return Dn(this,new x(m,g))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(m,g){return Dn(this,new x(m,g))>0},o.isGreaterThanOrEqualTo=o.gte=function(m,g){return(g=Dn(this,new x(m,g)))===1||g===0},o.isInteger=function(){return!!this.c&&it(this.e/oe)>this.c.length-2},o.isLessThan=o.lt=function(m,g){return Dn(this,new x(m,g))<0},o.isLessThanOrEqualTo=o.lte=function(m,g){return(g=Dn(this,new x(m,g)))===-1||g===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(m,g){var v,$,N,O,k=this,y=k.s;if(m=new x(m,g),g=m.s,!y||!g)return new x(NaN);if(y!=g)return m.s=-g,k.plus(m);var C=k.e/oe,I=m.e/oe,T=k.c,L=m.c;if(!C||!I){if(!T||!L)return T?(m.s=-g,m):new x(L?k:NaN);if(!T[0]||!L[0])return L[0]?(m.s=-g,m):new x(T[0]?k:c==3?-0:0)}if(C=it(C),I=it(I),T=T.slice(),y=C-I){for((O=y<0)?(y=-y,N=T):(I=C,N=L),N.reverse(),g=y;g--;N.push(0));N.reverse()}else for($=(O=(y=T.length)<(g=L.length))?y:g,y=g=0;g<$;g++)if(T[g]!=L[g]){O=T[g]<L[g];break}if(O&&(N=T,T=L,L=N,m.s=-m.s),g=($=L.length)-(v=T.length),g>0)for(;g--;T[v++]=0);for(g=xt-1;$>y;){if(T[--$]<L[$]){for(v=$;v&&!T[--v];T[v]=g);--T[v],T[$]+=xt}T[$]-=L[$]}for(;T[0]==0;T.splice(0,1),--I);return T[0]?M(m,T,I):(m.s=c==3?-1:1,m.c=[m.e=0],m)},o.modulo=o.mod=function(m,g){var v,$,N=this;return m=new x(m,g),!N.c||!m.s||m.c&&!m.c[0]?new x(NaN):!m.c||N.c&&!N.c[0]?new x(N):(p==9?($=m.s,m.s=1,v=t(N,m,0,3),m.s=$,v.s*=$):v=t(N,m,0,p),m=N.minus(v.times(m)),!m.c[0]&&p==1&&(m.s=N.s),m)},o.multipliedBy=o.times=function(m,g){var v,$,N,O,k,y,C,I,T,L,j,z,_,H,Y,G=this,W=G.c,Z=(m=new x(m,g)).c;if(!W||!Z||!W[0]||!Z[0])return!G.s||!m.s||W&&!W[0]&&!Z||Z&&!Z[0]&&!W?m.c=m.e=m.s=null:(m.s*=G.s,!W||!Z?m.c=m.e=null:(m.c=[0],m.e=0)),m;for($=it(G.e/oe)+it(m.e/oe),m.s*=G.s,C=W.length,L=Z.length,C<L&&(_=W,W=Z,Z=_,N=C,C=L,L=N),N=C+L,_=[];N--;_.push(0));for(H=xt,Y=pn,N=L;--N>=0;){for(v=0,j=Z[N]%Y,z=Z[N]/Y|0,k=C,O=N+k;O>N;)I=W[--k]%Y,T=W[k]/Y|0,y=z*I+T*j,I=j*I+y%Y*Y+_[O]+v,v=(I/H|0)+(y/Y|0)+z*T,_[O--]=I%H;_[O]=v}return v?++$:_.splice(0,1),M(m,_,$)},o.negated=function(){var m=new x(this);return m.s=-m.s||null,m},o.plus=function(m,g){var v,$=this,N=$.s;if(m=new x(m,g),g=m.s,!N||!g)return new x(NaN);if(N!=g)return m.s=-g,$.minus(m);var O=$.e/oe,k=m.e/oe,y=$.c,C=m.c;if(!O||!k){if(!y||!C)return new x(N/0);if(!y[0]||!C[0])return C[0]?m:new x(y[0]?$:N*0)}if(O=it(O),k=it(k),y=y.slice(),N=O-k){for(N>0?(k=O,v=C):(N=-N,v=y),v.reverse();N--;v.push(0));v.reverse()}for(N=y.length,g=C.length,N-g<0&&(v=C,C=y,y=v,g=N),N=0;g;)N=(y[--g]=y[g]+C[g]+N)/xt|0,y[g]=xt===y[g]?0:y[g]%xt;return N&&(y=[N].concat(y),++k),M(m,y,k)},o.precision=o.sd=function(m,g){var v,$,N,O=this;if(m!=null&&m!==!!m)return ye(m,1,Ne),g==null?g=c:ye(g,0,8),B(new x(O),m,g);if(!(v=O.c))return null;if(N=v.length-1,$=N*oe+1,N=v[N]){for(;N%10==0;N/=10,$--);for(N=v[0];N>=10;N/=10,$++);}return m&&O.e+1>$&&($=O.e+1),$},o.shiftedBy=function(m){return ye(m,-Ni,Ni),this.times("1e"+m)},o.squareRoot=o.sqrt=function(){var m,g,v,$,N,O=this,k=O.c,y=O.s,C=O.e,I=i+4,T=new x("0.5");if(y!==1||!k||!k[0])return new x(!y||y<0&&(!k||k[0])?NaN:k?O:1/0);if(y=Math.sqrt(+F(O)),y==0||y==1/0?(g=at(k),(g.length+C)%2==0&&(g+="0"),y=Math.sqrt(+g),C=it((C+1)/2)-(C<0||C%2),y==1/0?g="5e"+C:(g=y.toExponential(),g=g.slice(0,g.indexOf("e")+1)+C),v=new x(g)):v=new x(y+""),v.c[0]){for(C=v.e,y=C+I,y<3&&(y=0);;)if(N=v,v=T.times(N.plus(t(O,N,I,1))),at(N.c).slice(0,y)===(g=at(v.c)).slice(0,y))if(v.e<C&&--y,g=g.slice(y-3,y+1),g=="9999"||!$&&g=="4999"){if(!$&&(B(N,N.e+i+2,0),N.times(N).eq(O))){v=N;break}I+=4,y+=4,$=1}else{(!+g||!+g.slice(1)&&g.charAt(0)=="5")&&(B(v,v.e+i+2,1),m=!v.times(v).eq(O));break}}return B(v,v.e+i+1,c,m)},o.toExponential=function(m,g){return m!=null&&(ye(m,0,Ne),m++),w(this,m,g,1)},o.toFixed=function(m,g){return m!=null&&(ye(m,0,Ne),m=m+this.e+1),w(this,m,g)},o.toFormat=function(m,g,v){var $,N=this;if(v==null)m!=null&&g&&typeof g=="object"?(v=g,g=null):m&&typeof m=="object"?(v=m,m=g=null):v=b;else if(typeof v!="object")throw Error(_e+"Argument not an object: "+v);if($=N.toFixed(m,g),N.c){var O,k=$.split("."),y=+v.groupSize,C=+v.secondaryGroupSize,I=v.groupSeparator||"",T=k[0],L=k[1],j=N.s<0,z=j?T.slice(1):T,_=z.length;if(C&&(O=y,y=C,C=O,_-=O),y>0&&_>0){for(O=_%y||y,T=z.substr(0,O);O<_;O+=y)T+=I+z.substr(O,y);C>0&&(T+=I+z.slice(O)),j&&(T="-"+T)}$=L?T+(v.decimalSeparator||"")+((C=+v.fractionGroupSize)?L.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):L):T}return(v.prefix||"")+$+(v.suffix||"")},o.toFraction=function(m){var g,v,$,N,O,k,y,C,I,T,L,j,z=this,_=z.c;if(m!=null&&(y=new x(m),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(_e+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+F(y));if(!_)return new x(z);for(g=new x(s),I=v=new x(s),$=C=new x(s),j=at(_),O=g.e=j.length-z.e-1,g.c[0]=Ci[(k=O%oe)<0?oe+k:k],m=!m||y.comparedTo(g)>0?O>0?g:I:y,k=f,f=1/0,y=new x(j),C.c[0]=0;T=t(y,g,0,1),N=v.plus(T.times($)),N.comparedTo(m)!=1;)v=$,$=N,I=C.plus(T.times(N=I)),C=N,g=y.minus(T.times(N=g)),y=N;return N=t(m.minus(v),$,0,1),C=C.plus(N.times(I)),v=v.plus(N.times($)),C.s=I.s=z.s,O=O*2,L=t(I,$,O,c).minus(z).abs().comparedTo(t(C,v,O,c).minus(z).abs())<1?[I,$]:[C,v],f=k,L},o.toNumber=function(){return+F(this)},o.toPrecision=function(m,g){return m!=null&&ye(m,1,Ne),w(this,m,g,2)},o.toString=function(m){var g,v=this,$=v.s,N=v.e;return N===null?$?(g="Infinity",$<0&&(g="-"+g)):g="NaN":(m==null?g=N<=a||N>=l?os(at(v.c),N):qt(at(v.c),N,"0"):m===10&&P?(v=B(new x(v),i+N+1,c),g=qt(at(v.c),v.e,"0")):(ye(m,2,S.length,"Base"),g=n(qt(at(v.c),N,"0"),10,m,$,!0)),$<0&&v.c[0]&&(g="-"+g)),g},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&&x.set(e),x}function it(e){var t=e|0;return e>0||e===t?t:t-1}function at(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=oe-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Dn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,l=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==l,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>l^n?1:-1;for(c=(a=o.length)<(l=s.length)?a:l,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==l?0:a>l^n?1:-1}function ye(e,t,n,r){if(e<t||e>n||e!==st(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 rs(e){var t=e.c.length-1;return it(e.e/oe)==t&&e.c[t]%2!=0}function os(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function qt(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 Ce=Gl();const rb=(e,t=6)=>{try{const n=new Ce(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Ce.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"}},Et=()=>{const{translations:e,currentLocale:t}=Hl();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const u of c)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let l=typeof a=="string"?a:s;return i&&typeof l=="string"&&Object.keys(i).forEach(u=>{const f=`{{${u}}}`;l=l.replace(new RegExp(f,"g"),String(i[u]))}),l}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}}}},ob="1.2.3";let ze=class Fl extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Fl?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Fl&&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@${ob}`].join(`
51
- `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Zt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const ql=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Zl=/^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)?$/,Kl=/^\(.+?\).*?$/,Yl=/^tuple(?<array>(\[(\d*)\])*)$/;function Oi(e){let t=e.type;if(Yl.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+=Oi(s),o<n-1&&(t+=", ")}const r=Zt(Yl,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,Oi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function or(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Oi(o),r!==n-1&&(t+=", ")}return t}function ss(e){var t;return e.type==="function"?`function ${e.name}(${or(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${or(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${or(e.inputs)})`:e.type==="error"?`error ${e.name}(${or(e.inputs)})`:e.type==="constructor"?`constructor(${or(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Xl=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function sb(e){return Xl.test(e)}function ib(e){return Zt(Xl,e)}const Ql=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function ab(e){return Ql.test(e)}function cb(e){return Zt(Ql,e)}const Jl=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function lb(e){return Jl.test(e)}function ub(e){return Zt(Jl,e)}const eu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function is(e){return eu.test(e)}function fb(e){return Zt(eu,e)}const tu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function db(e){return tu.test(e)}function pb(e){return Zt(tu,e)}const nu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function hb(e){return nu.test(e)}function mb(e){return Zt(nu,e)}const bb=/^receive\(\) external payable$/;function gb(e){return bb.test(e)}const ru=new Set(["memory","indexed","storage","calldata"]),yb=new Set(["indexed"]),Ii=new Set(["calldata","memory","storage"]);class vb extends ze{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 wb extends ze{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 xb extends ze{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 Eb extends ze{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class Sb extends ze{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Pb extends ze{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 Tb extends ze{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 Ab extends ze{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class $b extends ze{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 sr extends ze{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Nb extends ze{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Cb extends ze{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 Ob extends ze{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 Ib extends ze{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function kb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const ki=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 Di(e,t={}){if(lb(e))return Db(e,t);if(ab(e))return Mb(e,t);if(sb(e))return Lb(e,t);if(db(e))return Bb(e,t);if(hb(e))return Fb(e);if(gb(e))return{type:"receive",stateMutability:"payable"};throw new Nb({signature:e})}function Db(e,t={}){const n=ub(e);if(!n)throw new sr({signature:e,type:"function"});const r=et(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Kt(r[c],{modifiers:Ii,structs:t,type:"function"}));const i=[];if(n.returns){const c=et(n.returns),a=c.length;for(let l=0;l<a;l++)i.push(Kt(c[l],{modifiers:Ii,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Mb(e,t={}){const n=cb(e);if(!n)throw new sr({signature:e,type:"event"});const r=et(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Kt(r[i],{modifiers:yb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Lb(e,t={}){const n=ib(e);if(!n)throw new sr({signature:e,type:"error"});const r=et(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Kt(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Bb(e,t={}){const n=pb(e);if(!n)throw new sr({signature:e,type:"constructor"});const r=et(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Kt(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Fb(e){const t=mb(e);if(!t)throw new sr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Rb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,jb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,_b=/^u?int$/;function Kt(e,t){var f,d;const n=kb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(ki.has(n))return ki.get(n);const r=Kl.test(e),o=Zt(r?jb:Rb,e);if(!o)throw new Sb({param:e});if(o.name&&Ub(o.name))throw new Pb({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,l={};if(r){a="tuple";const p=et(o.type),h=[],b=p.length;for(let S=0;S<b;S++)h.push(Kt(p[S],{structs:c}));l={components:h}}else if(o.type in c)a="tuple",l={components:c[o.type]};else if(_b.test(o.type))a=`${o.type}256`;else if(o.type==="address payable")a="address";else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!ou(a))throw new xb({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 Tb({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Ii.has(o.modifier)&&!Wb(a,!!o.array))throw new Ab({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...l};return ki.set(n,u),u}function et(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?et(c,[...t,n.trim()]):et(c,t,`${n}${i}`,r);case"(":return et(c,t,`${n}${i}`,r+1);case")":return et(c,t,`${n}${i}`,r-1);default:return et(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Ib({current:n,depth:r});return t.push(n.trim()),t}function ou(e){return e==="address"||e==="bool"||e==="function"||e==="string"||ql.test(e)||Zl.test(e)}const zb=/^(?: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 Ub(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||ql.test(e)||Zl.test(e)||zb.test(e)}function Wb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Mi(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!is(c))continue;const a=fb(c);if(!a)throw new sr({signature:c,type:"struct"});const l=a.properties.split(";"),u=[],f=l.length;for(let d=0;d<f;d++){const h=l[d].trim();if(!h)continue;const b=Kt(h,{type:"struct"});u.push(b)}if(!u.length)throw new Cb({signature:c});t[a.name]=u}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=su(a,t)}return r}const Hb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function su(e=[],t={},n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(Kl.test(i.type))r.push(i);else{const a=Zt(Hb,i.type);if(!(a!=null&&a.type))throw new $b({abiParameter:i});const{array:l,type:u}=a;if(u in t){if(n.has(u))throw new Ob({type:u});r.push({...i,type:`tuple${l??""}`,components:su(t[u],t,new Set([...n,u]))})}else if(ou(u))r.push(i);else throw new wb({type:u})}}return r}function iu(e){const t=Mi(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];is(s)||n.push(Di(s,t))}return n}function au(e){let t;if(typeof e=="string")t=Di(e);else{const n=Mi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!is(s)){t=Di(s,n);break}}}if(!t)throw new vb({signature:e});return t}function cu(e){const t=[];if(typeof e=="string"){const n=et(e),r=n.length;for(let o=0;o<r;o++)t.push(Kt(n[o],{modifiers:ru}))}else{const n=Mi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(is(s))continue;const i=et(s),c=i.length;for(let a=0;a<c;a++)t.push(Kt(i[a],{modifiers:ru,structs:n}))}}if(t.length===0)throw new Eb({params:e});return t}function X(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 St(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new o1(e.type);return`${e.name}(${as(e.inputs,{includeName:t})})`}function as(e,{includeName:t=!1}={}){return e?e.map(n=>Vb(n,{includeName:t})).join(t?", ":","):""}function Vb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${as(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Pt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function ve(e){return Pt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const lu="2.47.2";let Hr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${lu}`},V=class Rl extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof Rl?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Rl&&n.cause.docsPath||n.docsPath,s=(c=Hr.getDocsUrl)==null?void 0:c.call(Hr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Hr.version?[`Version: ${Hr.version}`]:[]].join(`
52
- `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=lu}walk(t){return uu(this,t)}};function uu(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?uu(e.cause,t):t?null:e}class Gb 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(`
53
- `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class fu 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(`
54
- `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class du extends V{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
55
- `),{metaMessages:[`Params: (${as(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 Vr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class qb 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(`
56
- `),{name:"AbiEncodingArrayLengthMismatchError"})}}class Zb extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ve(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Kb extends V{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
57
- `),{name:"AbiEncodingLengthMismatchError"})}}class Yb 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(`
58
- `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class pu 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(`
59
- `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class hu 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://4byte.sourcify.dev/?q=${t}.`].join(`
60
- `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class Xb extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Qb 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://4byte.sourcify.dev/?q=${t}.`].join(`
61
- `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class mu 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(`
50
+ 跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",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充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。"},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:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perpetual:"合約帳戶",spot:"現貨帳戶"}},Ai=["en-US","ja-JP","ru-RU","zh-CN","zh-TW","de-DE","es-LA","fr-FR","it-IT"],Wl={"en-US":Gm,"ja-JP":Ym,"ru-RU":Xm,"zh-CN":Qm,"zh-TW":Jm,"de-DE":Vm,"es-LA":qm,"fr-FR":Zm,"it-IT":Km},rs="en-US",eb={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский","de-DE":"Deutsch","es-LA":"Español (Latinoamérica)","fr-FR":"Français","it-IT":"Italiano"},tb=e=>Ai.includes(e)?Wl[e]:Wl[rs],nb=e=>Ai.includes(e),Hl=E.createContext(null),rb=({config:e,children:t})=>{const n=E.useMemo(()=>{const r=e.locale||rs,o=nb(r)?r:rs,s=tb(o);return{...e,currentLocale:o,translations:s}},[e]);return M.jsx(Hl.Provider,{value:n,children:t})},Vl=()=>{const e=E.useContext(Hl);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var ob=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ni=Math.ceil,st=Math.floor,_e="[BigNumber Error] ",Gl=_e+"Number primitive has more than 15 significant digits: ",xt=1e14,oe=14,Ci=9007199254740991,Oi=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],pn=1e7,Ce=1e9;function ql(e){var t,n,r,o=x.prototype={constructor:x,toString:null,valueOf:null},s=new x(1),i=20,c=4,a=-7,l=21,u=-1e7,f=1e7,d=!1,p=1,h=0,b={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function x(m,g){var v,A,N,O,D,y,C,I,T=this;if(!(T instanceof x))return new x(m,g);if(g==null){if(m&&m._isBigNumber===!0){T.s=m.s,!m.c||m.e>f?T.c=T.e=null:m.e<u?T.c=[T.e=0]:(T.e=m.e,T.c=m.c.slice());return}if((y=typeof m=="number")&&m*0==0){if(T.s=1/m<0?(m=-m,-1):1,m===~~m){for(O=0,D=m;D>=10;D/=10,O++);O>f?T.c=T.e=null:(T.e=O,T.c=[m]);return}I=String(m)}else{if(!ob.test(I=String(m)))return r(T,I,y);T.s=I.charCodeAt(0)==45?(I=I.slice(1),-1):1}(O=I.indexOf("."))>-1&&(I=I.replace(".","")),(D=I.search(/e/i))>0?(O<0&&(O=D),O+=+I.slice(D+1),I=I.substring(0,D)):O<0&&(O=I.length)}else{if(ye(g,2,S.length,"Base"),g==10&&P)return T=new x(m),B(T,i+T.e+1,c);if(I=String(m),y=typeof m=="number"){if(m*0!=0)return r(T,I,y,g);if(T.s=1/m<0?(I=I.slice(1),-1):1,x.DEBUG&&I.replace(/^0\.0*|\./,"").length>15)throw Error(Gl+m)}else T.s=I.charCodeAt(0)===45?(I=I.slice(1),-1):1;for(v=S.slice(0,g),O=D=0,C=I.length;D<C;D++)if(v.indexOf(A=I.charAt(D))<0){if(A=="."){if(D>O){O=C;continue}}else if(!N&&(I==I.toUpperCase()&&(I=I.toLowerCase())||I==I.toLowerCase()&&(I=I.toUpperCase()))){N=!0,D=-1,O=0;continue}return r(T,String(m),y,g)}y=!1,I=n(I,g,10,T.s),(O=I.indexOf("."))>-1?I=I.replace(".",""):O=I.length}for(D=0;I.charCodeAt(D)===48;D++);for(C=I.length;I.charCodeAt(--C)===48;);if(I=I.slice(D,++C)){if(C-=D,y&&x.DEBUG&&C>15&&(m>Ci||m!==st(m)))throw Error(Gl+T.s*m);if((O=O-D-1)>f)T.c=T.e=null;else if(O<u)T.c=[T.e=0];else{if(T.e=O,T.c=[],D=(O+1)%oe,O<0&&(D+=oe),D<C){for(D&&T.c.push(+I.slice(0,D)),C-=oe;D<C;)T.c.push(+I.slice(D,D+=oe));D=oe-(I=I.slice(D)).length}else D-=C;for(;D--;I+="0");T.c.push(+I)}}else T.c=[T.e=0]}x.clone=ql,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(m){var g,v;if(m!=null)if(typeof m=="object"){if(m.hasOwnProperty(g="DECIMAL_PLACES")&&(v=m[g],ye(v,0,Ce,g),i=v),m.hasOwnProperty(g="ROUNDING_MODE")&&(v=m[g],ye(v,0,8,g),c=v),m.hasOwnProperty(g="EXPONENTIAL_AT")&&(v=m[g],v&&v.pop?(ye(v[0],-Ce,0,g),ye(v[1],0,Ce,g),a=v[0],l=v[1]):(ye(v,-Ce,Ce,g),a=-(l=v<0?-v:v))),m.hasOwnProperty(g="RANGE"))if(v=m[g],v&&v.pop)ye(v[0],-Ce,-1,g),ye(v[1],1,Ce,g),u=v[0],f=v[1];else if(ye(v,-Ce,Ce,g),v)u=-(f=v<0?-v:v);else throw Error(_e+g+" cannot be zero: "+v);if(m.hasOwnProperty(g="CRYPTO"))if(v=m[g],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))d=v;else throw d=!v,Error(_e+"crypto unavailable");else d=v;else throw Error(_e+g+" not true or false: "+v);if(m.hasOwnProperty(g="MODULO_MODE")&&(v=m[g],ye(v,0,9,g),p=v),m.hasOwnProperty(g="POW_PRECISION")&&(v=m[g],ye(v,0,Ce,g),h=v),m.hasOwnProperty(g="FORMAT"))if(v=m[g],typeof v=="object")b=v;else throw Error(_e+g+" not an object: "+v);if(m.hasOwnProperty(g="ALPHABET"))if(v=m[g],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))P=v.slice(0,10)=="0123456789",S=v;else throw Error(_e+g+" invalid: "+v)}else throw Error(_e+"Object expected: "+m);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,l],RANGE:[u,f],CRYPTO:d,MODULO_MODE:p,POW_PRECISION:h,FORMAT:b,ALPHABET:S}},x.isBigNumber=function(m){if(!m||m._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var g,v,A=m.c,N=m.e,O=m.s;e:if({}.toString.call(A)=="[object Array]"){if((O===1||O===-1)&&N>=-Ce&&N<=Ce&&N===st(N)){if(A[0]===0){if(N===0&&A.length===1)return!0;break e}if(g=(N+1)%oe,g<1&&(g+=oe),String(A[0]).length==g){for(g=0;g<A.length;g++)if(v=A[g],v<0||v>=xt||v!==st(v))break e;if(v!==0)return!0}}}else if(A===null&&N===null&&(O===null||O===1||O===-1))return!0;throw Error(_e+"Invalid BigNumber: "+m)},x.maximum=x.max=function(){return $(arguments,-1)},x.minimum=x.min=function(){return $(arguments,1)},x.random=function(){var m=9007199254740992,g=Math.random()*m&2097151?function(){return st(Math.random()*m)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var A,N,O,D,y,C=0,I=[],T=new x(s);if(v==null?v=i:ye(v,0,Ce),D=Ni(v/oe),d)if(crypto.getRandomValues){for(A=crypto.getRandomValues(new Uint32Array(D*=2));C<D;)y=A[C]*131072+(A[C+1]>>>11),y>=9e15?(N=crypto.getRandomValues(new Uint32Array(2)),A[C]=N[0],A[C+1]=N[1]):(I.push(y%1e14),C+=2);C=D/2}else if(crypto.randomBytes){for(A=crypto.randomBytes(D*=7);C<D;)y=(A[C]&31)*281474976710656+A[C+1]*1099511627776+A[C+2]*4294967296+A[C+3]*16777216+(A[C+4]<<16)+(A[C+5]<<8)+A[C+6],y>=9e15?crypto.randomBytes(7).copy(A,C):(I.push(y%1e14),C+=7);C=D/7}else throw d=!1,Error(_e+"crypto unavailable");if(!d)for(;C<D;)y=g(),y<9e15&&(I[C++]=y%1e14);for(D=I[--C],v%=oe,D&&v&&(y=Oi[oe-v],I[C]=st(D/y)*y);I[C]===0;I.pop(),C--);if(C<0)I=[O=0];else{for(O=-1;I[0]===0;I.splice(0,1),O-=oe);for(C=1,y=I[0];y>=10;y/=10,C++);C<oe&&(O-=oe-C)}return T.e=O,T.c=I,T}}(),x.sum=function(){for(var m=1,g=arguments,v=new x(g[0]);m<g.length;)v=v.plus(g[m++]);return v},n=function(){var m="0123456789";function g(v,A,N,O){for(var D,y=[0],C,I=0,T=v.length;I<T;){for(C=y.length;C--;y[C]*=A);for(y[0]+=O.indexOf(v.charAt(I++)),D=0;D<y.length;D++)y[D]>N-1&&(y[D+1]==null&&(y[D+1]=0),y[D+1]+=y[D]/N|0,y[D]%=N)}return y.reverse()}return function(v,A,N,O,D){var y,C,I,T,L,j,z,_,W=v.indexOf("."),K=i,G=c;for(W>=0&&(T=h,h=0,v=v.replace(".",""),_=new x(A),j=_.pow(v.length-W),h=T,_.c=g(qt(at(j.c),j.e,"0"),10,N,m),_.e=_.c.length),z=g(v,A,N,D?(y=S,m):(y=m,S)),I=T=z.length;z[--T]==0;z.pop());if(!z[0])return y.charAt(0);if(W<0?--I:(j.c=z,j.e=I,j.s=O,j=t(j,_,K,G,N),z=j.c,L=j.r,I=j.e),C=I+K+1,W=z[C],T=N/2,L=L||C<0||z[C+1]!=null,L=G<4?(W!=null||L)&&(G==0||G==(j.s<0?3:2)):W>T||W==T&&(G==4||L||G==6&&z[C-1]&1||G==(j.s<0?8:7)),C<1||!z[0])v=L?qt(y.charAt(1),-K,y.charAt(0)):y.charAt(0);else{if(z.length=C,L)for(--N;++z[--C]>N;)z[C]=0,C||(++I,z=[1].concat(z));for(T=z.length;!z[--T];);for(W=0,v="";W<=T;v+=y.charAt(z[W++]));v=qt(v,I,y.charAt(0))}return v}}(),t=function(){function m(A,N,O){var D,y,C,I,T=0,L=A.length,j=N%pn,z=N/pn|0;for(A=A.slice();L--;)C=A[L]%pn,I=A[L]/pn|0,D=z*C+I*j,y=j*C+D%pn*pn+T,T=(y/O|0)+(D/pn|0)+z*I,A[L]=y%O;return T&&(A=[T].concat(A)),A}function g(A,N,O,D){var y,C;if(O!=D)C=O>D?1:-1;else for(y=C=0;y<O;y++)if(A[y]!=N[y]){C=A[y]>N[y]?1:-1;break}return C}function v(A,N,O,D){for(var y=0;O--;)A[O]-=y,y=A[O]<N[O]?1:0,A[O]=y*D+A[O]-N[O];for(;!A[0]&&A.length>1;A.splice(0,1));}return function(A,N,O,D,y){var C,I,T,L,j,z,_,W,K,G,H,q,Q,ee,pe,le,he,ie=A.s==N.s?1:-1,me=A.c,ne=N.c;if(!me||!me[0]||!ne||!ne[0])return new x(!A.s||!N.s||(me?ne&&me[0]==ne[0]:!ne)?NaN:me&&me[0]==0||!ne?ie*0:ie/0);for(W=new x(ie),K=W.c=[],I=A.e-N.e,ie=O+I+1,y||(y=xt,I=it(A.e/oe)-it(N.e/oe),ie=ie/oe|0),T=0;ne[T]==(me[T]||0);T++);if(ne[T]>(me[T]||0)&&I--,ie<0)K.push(1),L=!0;else{for(ee=me.length,le=ne.length,T=0,ie+=2,j=st(y/(ne[0]+1)),j>1&&(ne=m(ne,j,y),me=m(me,j,y),le=ne.length,ee=me.length),Q=le,G=me.slice(0,le),H=G.length;H<le;G[H++]=0);he=ne.slice(),he=[0].concat(he),pe=ne[0],ne[1]>=y/2&&pe++;do{if(j=0,C=g(ne,G,le,H),C<0){if(q=G[0],le!=H&&(q=q*y+(G[1]||0)),j=st(q/pe),j>1)for(j>=y&&(j=y-1),z=m(ne,j,y),_=z.length,H=G.length;g(z,G,_,H)==1;)j--,v(z,le<_?he:ne,_,y),_=z.length,C=1;else j==0&&(C=j=1),z=ne.slice(),_=z.length;if(_<H&&(z=[0].concat(z)),v(G,z,H,y),H=G.length,C==-1)for(;g(ne,G,le,H)<1;)j++,v(G,le<H?he:ne,H,y),H=G.length}else C===0&&(j++,G=[0]);K[T++]=j,G[0]?G[H++]=me[Q]||0:(G=[me[Q]],H=1)}while((Q++<ee||G[0]!=null)&&ie--);L=G[0]!=null,K[0]||K.splice(0,1)}if(y==xt){for(T=1,ie=K[0];ie>=10;ie/=10,T++);B(W,O+(W.e=T+I*oe-1)+1,D,L)}else W.e=I,W.r=+L;return W}}();function w(m,g,v,A){var N,O,D,y,C;if(v==null?v=c:ye(v,0,8),!m.c)return m.toString();if(N=m.c[0],D=m.e,g==null)C=at(m.c),C=A==1||A==2&&(D<=a||D>=l)?ss(C,D):qt(C,D,"0");else if(m=B(new x(m),g,v),O=m.e,C=at(m.c),y=C.length,A==1||A==2&&(g<=O||O<=a)){for(;y<g;C+="0",y++);C=ss(C,O)}else if(g-=D+(A===2&&O>D),C=qt(C,O,"0"),O+1>y){if(--g>0)for(C+=".";g--;C+="0");}else if(g+=O-y,g>0)for(O+1==y&&(C+=".");g--;C+="0");return m.s<0&&N?"-"+C:C}function $(m,g){for(var v,A,N=1,O=new x(m[0]);N<m.length;N++)A=new x(m[N]),(!A.s||(v=Mn(O,A))===g||v===0&&O.s===g)&&(O=A);return O}function k(m,g,v){for(var A=1,N=g.length;!g[--N];g.pop());for(N=g[0];N>=10;N/=10,A++);return(v=A+v*oe-1)>f?m.c=m.e=null:v<u?m.c=[m.e=0]:(m.e=v,m.c=g),m}r=function(){var m=/^(-?)0([xbo])(?=\w[\w.]*$)/i,g=/^([^.]+)\.$/,v=/^\.([^.]+)$/,A=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(O,D,y,C){var I,T=y?D:D.replace(N,"");if(A.test(T))O.s=isNaN(T)?null:T<0?-1:1;else{if(!y&&(T=T.replace(m,function(L,j,z){return I=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!C||C==I?j:L}),C&&(I=C,T=T.replace(g,"$1").replace(v,"0.$1")),D!=T))return new x(T,I);if(x.DEBUG)throw Error(_e+"Not a"+(C?" base "+C:"")+" number: "+D);O.s=null}O.c=O.e=null}}();function B(m,g,v,A){var N,O,D,y,C,I,T,L=m.c,j=Oi;if(L){e:{for(N=1,y=L[0];y>=10;y/=10,N++);if(O=g-N,O<0)O+=oe,D=g,C=L[I=0],T=st(C/j[N-D-1]%10);else if(I=Ni((O+1)/oe),I>=L.length)if(A){for(;L.length<=I;L.push(0));C=T=0,N=1,O%=oe,D=O-oe+1}else break e;else{for(C=y=L[I],N=1;y>=10;y/=10,N++);O%=oe,D=O-oe+N,T=D<0?0:st(C/j[N-D-1]%10)}if(A=A||g<0||L[I+1]!=null||(D<0?C:C%j[N-D-1]),A=v<4?(T||A)&&(v==0||v==(m.s<0?3:2)):T>5||T==5&&(v==4||A||v==6&&(O>0?D>0?C/j[N-D]:0:L[I-1])%10&1||v==(m.s<0?8:7)),g<1||!L[0])return L.length=0,A?(g-=m.e+1,L[0]=j[(oe-g%oe)%oe],m.e=-g||0):L[0]=m.e=0,m;if(O==0?(L.length=I,y=1,I--):(L.length=I+1,y=j[oe-O],L[I]=D>0?st(C/j[N-D]%j[D])*y:0),A)for(;;)if(I==0){for(O=1,D=L[0];D>=10;D/=10,O++);for(D=L[0]+=y,y=1;D>=10;D/=10,y++);O!=y&&(m.e++,L[0]==xt&&(L[0]=1));break}else{if(L[I]+=y,L[I]!=xt)break;L[I--]=0,y=1}for(O=L.length;L[--O]===0;L.pop());}m.e>f?m.c=m.e=null:m.e<u&&(m.c=[m.e=0])}return m}function F(m){var g,v=m.e;return v===null?m.toString():(g=at(m.c),g=v<=a||v>=l?ss(g,v):qt(g,v,"0"),m.s<0?"-"+g:g)}return o.absoluteValue=o.abs=function(){var m=new x(this);return m.s<0&&(m.s=1),m},o.comparedTo=function(m,g){return Mn(this,new x(m,g))},o.decimalPlaces=o.dp=function(m,g){var v,A,N,O=this;if(m!=null)return ye(m,0,Ce),g==null?g=c:ye(g,0,8),B(new x(O),m+O.e+1,g);if(!(v=O.c))return null;if(A=((N=v.length-1)-it(this.e/oe))*oe,N=v[N])for(;N%10==0;N/=10,A--);return A<0&&(A=0),A},o.dividedBy=o.div=function(m,g){return t(this,new x(m,g),i,c)},o.dividedToIntegerBy=o.idiv=function(m,g){return t(this,new x(m,g),0,1)},o.exponentiatedBy=o.pow=function(m,g){var v,A,N,O,D,y,C,I,T,L=this;if(m=new x(m),m.c&&!m.isInteger())throw Error(_e+"Exponent not an integer: "+F(m));if(g!=null&&(g=new x(g)),y=m.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!m.c||!m.c[0])return T=new x(Math.pow(+F(L),y?m.s*(2-os(m)):+F(m))),g?T.mod(g):T;if(C=m.s<0,g){if(g.c?!g.c[0]:!g.s)return new x(NaN);A=!C&&L.isInteger()&&g.isInteger(),A&&(L=L.mod(g))}else{if(m.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||y&&L.c[1]>=24e7:L.c[0]<8e13||y&&L.c[0]<=9999975e7)))return O=L.s<0&&os(m)?-0:0,L.e>-1&&(O=1/O),new x(C?1/O:O);h&&(O=Ni(h/oe+2))}for(y?(v=new x(.5),C&&(m.s=1),I=os(m)):(N=Math.abs(+F(m)),I=N%2),T=new x(s);;){if(I){if(T=T.times(L),!T.c)break;O?T.c.length>O&&(T.c.length=O):A&&(T=T.mod(g))}if(N){if(N=st(N/2),N===0)break;I=N%2}else if(m=m.times(v),B(m,m.e+1,1),m.e>14)I=os(m);else{if(N=+F(m),N===0)break;I=N%2}L=L.times(L),O?L.c&&L.c.length>O&&(L.c.length=O):A&&(L=L.mod(g))}return A?T:(C&&(T=s.div(T)),g?T.mod(g):O?B(T,h,c,D):T)},o.integerValue=function(m){var g=new x(this);return m==null?m=c:ye(m,0,8),B(g,g.e+1,m)},o.isEqualTo=o.eq=function(m,g){return Mn(this,new x(m,g))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(m,g){return Mn(this,new x(m,g))>0},o.isGreaterThanOrEqualTo=o.gte=function(m,g){return(g=Mn(this,new x(m,g)))===1||g===0},o.isInteger=function(){return!!this.c&&it(this.e/oe)>this.c.length-2},o.isLessThan=o.lt=function(m,g){return Mn(this,new x(m,g))<0},o.isLessThanOrEqualTo=o.lte=function(m,g){return(g=Mn(this,new x(m,g)))===-1||g===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(m,g){var v,A,N,O,D=this,y=D.s;if(m=new x(m,g),g=m.s,!y||!g)return new x(NaN);if(y!=g)return m.s=-g,D.plus(m);var C=D.e/oe,I=m.e/oe,T=D.c,L=m.c;if(!C||!I){if(!T||!L)return T?(m.s=-g,m):new x(L?D:NaN);if(!T[0]||!L[0])return L[0]?(m.s=-g,m):new x(T[0]?D:c==3?-0:0)}if(C=it(C),I=it(I),T=T.slice(),y=C-I){for((O=y<0)?(y=-y,N=T):(I=C,N=L),N.reverse(),g=y;g--;N.push(0));N.reverse()}else for(A=(O=(y=T.length)<(g=L.length))?y:g,y=g=0;g<A;g++)if(T[g]!=L[g]){O=T[g]<L[g];break}if(O&&(N=T,T=L,L=N,m.s=-m.s),g=(A=L.length)-(v=T.length),g>0)for(;g--;T[v++]=0);for(g=xt-1;A>y;){if(T[--A]<L[A]){for(v=A;v&&!T[--v];T[v]=g);--T[v],T[A]+=xt}T[A]-=L[A]}for(;T[0]==0;T.splice(0,1),--I);return T[0]?k(m,T,I):(m.s=c==3?-1:1,m.c=[m.e=0],m)},o.modulo=o.mod=function(m,g){var v,A,N=this;return m=new x(m,g),!N.c||!m.s||m.c&&!m.c[0]?new x(NaN):!m.c||N.c&&!N.c[0]?new x(N):(p==9?(A=m.s,m.s=1,v=t(N,m,0,3),m.s=A,v.s*=A):v=t(N,m,0,p),m=N.minus(v.times(m)),!m.c[0]&&p==1&&(m.s=N.s),m)},o.multipliedBy=o.times=function(m,g){var v,A,N,O,D,y,C,I,T,L,j,z,_,W,K,G=this,H=G.c,q=(m=new x(m,g)).c;if(!H||!q||!H[0]||!q[0])return!G.s||!m.s||H&&!H[0]&&!q||q&&!q[0]&&!H?m.c=m.e=m.s=null:(m.s*=G.s,!H||!q?m.c=m.e=null:(m.c=[0],m.e=0)),m;for(A=it(G.e/oe)+it(m.e/oe),m.s*=G.s,C=H.length,L=q.length,C<L&&(_=H,H=q,q=_,N=C,C=L,L=N),N=C+L,_=[];N--;_.push(0));for(W=xt,K=pn,N=L;--N>=0;){for(v=0,j=q[N]%K,z=q[N]/K|0,D=C,O=N+D;O>N;)I=H[--D]%K,T=H[D]/K|0,y=z*I+T*j,I=j*I+y%K*K+_[O]+v,v=(I/W|0)+(y/K|0)+z*T,_[O--]=I%W;_[O]=v}return v?++A:_.splice(0,1),k(m,_,A)},o.negated=function(){var m=new x(this);return m.s=-m.s||null,m},o.plus=function(m,g){var v,A=this,N=A.s;if(m=new x(m,g),g=m.s,!N||!g)return new x(NaN);if(N!=g)return m.s=-g,A.minus(m);var O=A.e/oe,D=m.e/oe,y=A.c,C=m.c;if(!O||!D){if(!y||!C)return new x(N/0);if(!y[0]||!C[0])return C[0]?m:new x(y[0]?A:N*0)}if(O=it(O),D=it(D),y=y.slice(),N=O-D){for(N>0?(D=O,v=C):(N=-N,v=y),v.reverse();N--;v.push(0));v.reverse()}for(N=y.length,g=C.length,N-g<0&&(v=C,C=y,y=v,g=N),N=0;g;)N=(y[--g]=y[g]+C[g]+N)/xt|0,y[g]=xt===y[g]?0:y[g]%xt;return N&&(y=[N].concat(y),++D),k(m,y,D)},o.precision=o.sd=function(m,g){var v,A,N,O=this;if(m!=null&&m!==!!m)return ye(m,1,Ce),g==null?g=c:ye(g,0,8),B(new x(O),m,g);if(!(v=O.c))return null;if(N=v.length-1,A=N*oe+1,N=v[N]){for(;N%10==0;N/=10,A--);for(N=v[0];N>=10;N/=10,A++);}return m&&O.e+1>A&&(A=O.e+1),A},o.shiftedBy=function(m){return ye(m,-Ci,Ci),this.times("1e"+m)},o.squareRoot=o.sqrt=function(){var m,g,v,A,N,O=this,D=O.c,y=O.s,C=O.e,I=i+4,T=new x("0.5");if(y!==1||!D||!D[0])return new x(!y||y<0&&(!D||D[0])?NaN:D?O:1/0);if(y=Math.sqrt(+F(O)),y==0||y==1/0?(g=at(D),(g.length+C)%2==0&&(g+="0"),y=Math.sqrt(+g),C=it((C+1)/2)-(C<0||C%2),y==1/0?g="5e"+C:(g=y.toExponential(),g=g.slice(0,g.indexOf("e")+1)+C),v=new x(g)):v=new x(y+""),v.c[0]){for(C=v.e,y=C+I,y<3&&(y=0);;)if(N=v,v=T.times(N.plus(t(O,N,I,1))),at(N.c).slice(0,y)===(g=at(v.c)).slice(0,y))if(v.e<C&&--y,g=g.slice(y-3,y+1),g=="9999"||!A&&g=="4999"){if(!A&&(B(N,N.e+i+2,0),N.times(N).eq(O))){v=N;break}I+=4,y+=4,A=1}else{(!+g||!+g.slice(1)&&g.charAt(0)=="5")&&(B(v,v.e+i+2,1),m=!v.times(v).eq(O));break}}return B(v,v.e+i+1,c,m)},o.toExponential=function(m,g){return m!=null&&(ye(m,0,Ce),m++),w(this,m,g,1)},o.toFixed=function(m,g){return m!=null&&(ye(m,0,Ce),m=m+this.e+1),w(this,m,g)},o.toFormat=function(m,g,v){var A,N=this;if(v==null)m!=null&&g&&typeof g=="object"?(v=g,g=null):m&&typeof m=="object"?(v=m,m=g=null):v=b;else if(typeof v!="object")throw Error(_e+"Argument not an object: "+v);if(A=N.toFixed(m,g),N.c){var O,D=A.split("."),y=+v.groupSize,C=+v.secondaryGroupSize,I=v.groupSeparator||"",T=D[0],L=D[1],j=N.s<0,z=j?T.slice(1):T,_=z.length;if(C&&(O=y,y=C,C=O,_-=O),y>0&&_>0){for(O=_%y||y,T=z.substr(0,O);O<_;O+=y)T+=I+z.substr(O,y);C>0&&(T+=I+z.slice(O)),j&&(T="-"+T)}A=L?T+(v.decimalSeparator||"")+((C=+v.fractionGroupSize)?L.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):L):T}return(v.prefix||"")+A+(v.suffix||"")},o.toFraction=function(m){var g,v,A,N,O,D,y,C,I,T,L,j,z=this,_=z.c;if(m!=null&&(y=new x(m),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(_e+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+F(y));if(!_)return new x(z);for(g=new x(s),I=v=new x(s),A=C=new x(s),j=at(_),O=g.e=j.length-z.e-1,g.c[0]=Oi[(D=O%oe)<0?oe+D:D],m=!m||y.comparedTo(g)>0?O>0?g:I:y,D=f,f=1/0,y=new x(j),C.c[0]=0;T=t(y,g,0,1),N=v.plus(T.times(A)),N.comparedTo(m)!=1;)v=A,A=N,I=C.plus(T.times(N=I)),C=N,g=y.minus(T.times(N=g)),y=N;return N=t(m.minus(v),A,0,1),C=C.plus(N.times(I)),v=v.plus(N.times(A)),C.s=I.s=z.s,O=O*2,L=t(I,A,O,c).minus(z).abs().comparedTo(t(C,v,O,c).minus(z).abs())<1?[I,A]:[C,v],f=D,L},o.toNumber=function(){return+F(this)},o.toPrecision=function(m,g){return m!=null&&ye(m,1,Ce),w(this,m,g,2)},o.toString=function(m){var g,v=this,A=v.s,N=v.e;return N===null?A?(g="Infinity",A<0&&(g="-"+g)):g="NaN":(m==null?g=N<=a||N>=l?ss(at(v.c),N):qt(at(v.c),N,"0"):m===10&&P?(v=B(new x(v),i+N+1,c),g=qt(at(v.c),v.e,"0")):(ye(m,2,S.length,"Base"),g=n(qt(at(v.c),N,"0"),10,m,A,!0)),A<0&&v.c[0]&&(g="-"+g)),g},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&&x.set(e),x}function it(e){var t=e|0;return e>0||e===t?t:t-1}function at(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=oe-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Mn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,l=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==l,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>l^n?1:-1;for(c=(a=o.length)<(l=s.length)?a:l,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==l?0:a>l^n?1:-1}function ye(e,t,n,r){if(e<t||e>n||e!==st(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 os(e){var t=e.c.length-1;return it(e.e/oe)==t&&e.c[t]%2!=0}function ss(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function qt(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=ql();const sb=(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"}},Et=()=>{const{translations:e,currentLocale:t}=Vl();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const u of c)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let l=typeof a=="string"?a:s;return i&&typeof l=="string"&&Object.keys(i).forEach(u=>{const f=`{{${u}}}`;l=l.replace(new RegExp(f,"g"),String(i[u]))}),l}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}}}},ib="1.2.3";let ze=class Rl extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Rl?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Rl&&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@${ib}`].join(`
51
+ `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Zt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Zl=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Kl=/^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)?$/,Yl=/^\(.+?\).*?$/,Xl=/^tuple(?<array>(\[(\d*)\])*)$/;function Ii(e){let t=e.type;if(Xl.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+=Ii(s),o<n-1&&(t+=", ")}const r=Zt(Xl,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,Ii({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function or(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Ii(o),r!==n-1&&(t+=", ")}return t}function is(e){var t;return e.type==="function"?`function ${e.name}(${or(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${or(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${or(e.inputs)})`:e.type==="error"?`error ${e.name}(${or(e.inputs)})`:e.type==="constructor"?`constructor(${or(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Ql=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function ab(e){return Ql.test(e)}function cb(e){return Zt(Ql,e)}const Jl=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function lb(e){return Jl.test(e)}function ub(e){return Zt(Jl,e)}const eu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function fb(e){return eu.test(e)}function db(e){return Zt(eu,e)}const tu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function as(e){return tu.test(e)}function pb(e){return Zt(tu,e)}const nu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function hb(e){return nu.test(e)}function mb(e){return Zt(nu,e)}const ru=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function bb(e){return ru.test(e)}function gb(e){return Zt(ru,e)}const yb=/^receive\(\) external payable$/;function vb(e){return yb.test(e)}const ou=new Set(["memory","indexed","storage","calldata"]),wb=new Set(["indexed"]),Di=new Set(["calldata","memory","storage"]);class xb extends ze{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 Eb extends ze{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 Sb extends ze{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 Pb extends ze{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class Tb extends ze{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class $b extends ze{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 Ab extends ze{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 Nb extends ze{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 Cb extends ze{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 sr extends ze{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Ob extends ze{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Ib extends ze{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 Db extends ze{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 Mb extends ze{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function kb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const Mi=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function ki(e,t={}){if(fb(e))return Lb(e,t);if(lb(e))return Bb(e,t);if(ab(e))return Fb(e,t);if(hb(e))return Rb(e,t);if(bb(e))return jb(e);if(vb(e))return{type:"receive",stateMutability:"payable"};throw new Ob({signature:e})}function Lb(e,t={}){const n=db(e);if(!n)throw new sr({signature:e,type:"function"});const r=et(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Kt(r[c],{modifiers:Di,structs:t,type:"function"}));const i=[];if(n.returns){const c=et(n.returns),a=c.length;for(let l=0;l<a;l++)i.push(Kt(c[l],{modifiers:Di,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Bb(e,t={}){const n=ub(e);if(!n)throw new sr({signature:e,type:"event"});const r=et(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Kt(r[i],{modifiers:wb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Fb(e,t={}){const n=cb(e);if(!n)throw new sr({signature:e,type:"error"});const r=et(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Kt(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Rb(e,t={}){const n=mb(e);if(!n)throw new sr({signature:e,type:"constructor"});const r=et(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Kt(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function jb(e){const t=gb(e);if(!t)throw new sr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const _b=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,zb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Ub=/^u?int$/;function Kt(e,t){var f,d;const n=kb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Mi.has(n))return Mi.get(n);const r=Yl.test(e),o=Zt(r?zb:_b,e);if(!o)throw new Tb({param:e});if(o.name&&Hb(o.name))throw new $b({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,l={};if(r){a="tuple";const p=et(o.type),h=[],b=p.length;for(let S=0;S<b;S++)h.push(Kt(p[S],{structs:c}));l={components:h}}else if(o.type in c)a="tuple",l={components:c[o.type]};else if(Ub.test(o.type))a=`${o.type}256`;else if(o.type==="address payable")a="address";else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!su(a))throw new Sb({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 Ab({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Di.has(o.modifier)&&!Vb(a,!!o.array))throw new Nb({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...l};return Mi.set(n,u),u}function et(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?et(c,[...t,n.trim()]):et(c,t,`${n}${i}`,r);case"(":return et(c,t,`${n}${i}`,r+1);case")":return et(c,t,`${n}${i}`,r-1);default:return et(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Mb({current:n,depth:r});return t.push(n.trim()),t}function su(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Zl.test(e)||Kl.test(e)}const Wb=/^(?: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 Hb(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Zl.test(e)||Kl.test(e)||Wb.test(e)}function Vb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Li(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!as(c))continue;const a=pb(c);if(!a)throw new sr({signature:c,type:"struct"});const l=a.properties.split(";"),u=[],f=l.length;for(let d=0;d<f;d++){const h=l[d].trim();if(!h)continue;const b=Kt(h,{type:"struct"});u.push(b)}if(!u.length)throw new Ib({signature:c});t[a.name]=u}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 Gb=/^(?<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(Yl.test(i.type))r.push(i);else{const a=Zt(Gb,i.type);if(!(a!=null&&a.type))throw new Cb({abiParameter:i});const{array:l,type:u}=a;if(u in t){if(n.has(u))throw new Db({type:u});r.push({...i,type:`tuple${l??""}`,components:iu(t[u],t,new Set([...n,u]))})}else if(su(u))r.push(i);else throw new Eb({type:u})}}return r}function au(e){const t=Li(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];as(s)||n.push(ki(s,t))}return n}function cu(e){let t;if(typeof e=="string")t=ki(e);else{const n=Li(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!as(s)){t=ki(s,n);break}}}if(!t)throw new xb({signature:e});return t}function lu(e){const t=[];if(typeof e=="string"){const n=et(e),r=n.length;for(let o=0;o<r;o++)t.push(Kt(n[o],{modifiers:ou}))}else{const n=Li(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(as(s))continue;const i=et(s),c=i.length;for(let a=0;a<c;a++)t.push(Kt(i[a],{modifiers:ou,structs:n}))}}if(t.length===0)throw new Pb({params:e});return t}function X(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 St(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new i1(e.type);return`${e.name}(${cs(e.inputs,{includeName:t})})`}function cs(e,{includeName:t=!1}={}){return e?e.map(n=>qb(n,{includeName:t})).join(t?", ":","):""}function qb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${cs(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Pt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function ve(e){return Pt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const uu="2.47.2";let Hr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${uu}`},V=class jl extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof jl?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof jl&&n.cause.docsPath||n.docsPath,s=(c=Hr.getDocsUrl)==null?void 0:c.call(Hr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Hr.version?[`Version: ${Hr.version}`]:[]].join(`
52
+ `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=uu}walk(t){return fu(this,t)}};function fu(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?fu(e.cause,t):t?null:e}class Zb 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(`
53
+ `),{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(`
54
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class pu extends V{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
55
+ `),{metaMessages:[`Params: (${cs(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 Vr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class Kb 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(`
56
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class Yb extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ve(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Xb extends V{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
57
+ `),{name:"AbiEncodingLengthMismatchError"})}}class Qb 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(`
58
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class hu 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(`
59
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class mu 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://4byte.sourcify.dev/?q=${t}.`].join(`
60
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class Jb extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class e1 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://4byte.sourcify.dev/?q=${t}.`].join(`
61
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class bu 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(`
62
62
  `),{docsPath:n,name:"AbiEventNotFoundError"})}}class ir 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(`
63
- `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class bu 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(`
64
- `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Jb 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://4byte.sourcify.dev/?q=${t}.`].join(`
65
- `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class e1 extends V{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${St(t.abiItem)}\`, and`,`\`${n.type}\` in \`${St(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let t1=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class cs 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(`
66
- `),{metaMessages:[`Params: (${as(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 Li extends V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${St(t,{includeName:!0})}".`].join(`
67
- `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class n1 extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
68
- `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class r1 extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
69
- `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let gu=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
70
- `),{name:"InvalidArrayError"})}};class o1 extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
71
- `),{name:"InvalidDefinitionTypeError"})}}class s1 extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let yu=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"})}},vu=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 wu 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 ar(e,{dir:t,size:n=32}={}){return typeof e=="string"?hn(e,{dir:t,size:n}):i1(e,{dir:t,size:n})}function hn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new vu({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function i1(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new vu({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 Bi=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"})}},a1=class 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 c1 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 l1=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Mn(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 Tt(e,{size:t}){if(ve(e)>t)throw new l1({givenSize:ve(e),maxSize:t})}function Lt(e,t={}){const{signed:n}=t;t.size&&Tt(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 u1(e,t={}){let n=e;if(t.size&&(Tt(n,{size:t.size}),n=Mn(n)),Mn(n)==="0x00")return!1;if(Mn(n)==="0x01")return!0;throw new c1(n)}function Yt(e,t={}){const n=Lt(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new Bi({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const f1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function mn(e,t={}){return typeof e=="number"||typeof e=="bigint"?Q(e,t):typeof e=="string"?Gr(e,t):typeof e=="boolean"?xu(e,t):Ae(e,t)}function xu(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Tt(n,{size:t.size}),ar(n,{size:t.size})):n}function Ae(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=f1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Tt(r,{size:t.size}),ar(r,{dir:"right",size:t.size})):r}function Q(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 Bi({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?ar(c,{size:r}):c}const d1=new TextEncoder;function Gr(e,t={}){const n=d1.encode(e);return Ae(n,t)}const p1=new TextEncoder;function cr(e,t={}){return typeof e=="number"||typeof e=="bigint"?m1(e,t):typeof e=="boolean"?h1(e,t):Pt(e)?Bt(e,t):Ln(e,t)}function h1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Tt(n,{size:t.size}),ar(n,{size:t.size})):n}const Xt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Eu(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 Bt(e,t={}){let n=e;t.size&&(Tt(n,{size:t.size}),n=ar(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=Eu(r.charCodeAt(c++)),l=Eu(r.charCodeAt(c++));if(a===void 0||l===void 0)throw new V(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+l}return s}function m1(e,t){const n=Q(e,t);return Bt(n)}function Ln(e,t={}){const n=p1.encode(e);return typeof t.size=="number"?(Tt(n,{size:t.size}),ar(n,{dir:"right",size:t.size})):n}const ls=BigInt(2**32-1),Su=BigInt(32);function b1(e,t=!1){return t?{h:Number(e&ls),l:Number(e>>Su&ls)}:{h:Number(e>>Su&ls)|0,l:Number(e&ls)|0}}function g1(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}=b1(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const y1=(e,t,n)=>e<<n|t>>>32-n,v1=(e,t,n)=>t<<n|e>>>32-n,w1=(e,t,n)=>t<<n-32|e>>>64-n,x1=(e,t,n)=>e<<n-32|t>>>64-n,lr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function E1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Bn(e,...t){if(!E1(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 S1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");qr(e.outputLen),qr(e.blockLen)}function ur(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 Pu(e,t){Bn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function P1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function fr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Fi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ft(e,t){return e<<32-t|e>>>t}const T1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function A1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function $1(e){for(let t=0;t<e.length;t++)e[t]=A1(e[t]);return e}const Tu=T1?e=>e:$1;function N1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function us(e){return typeof e=="string"&&(e=N1(e)),Bn(e),e}function C1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Bn(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 Ri{}function Au(e){const t=r=>e().update(us(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function O1(e=32){if(lr&&typeof lr.getRandomValues=="function")return lr.getRandomValues(new Uint8Array(e));if(lr&&typeof lr.randomBytes=="function")return Uint8Array.from(lr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const I1=BigInt(0),Zr=BigInt(1),k1=BigInt(2),D1=BigInt(7),M1=BigInt(256),L1=BigInt(113),$u=[],Nu=[],Cu=[];for(let e=0,t=Zr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],$u.push(2*(5*r+n)),Nu.push((e+1)*(e+2)/2%64);let o=I1;for(let s=0;s<7;s++)t=(t<<Zr^(t>>D1)*L1)%M1,t&k1&&(o^=Zr<<(Zr<<BigInt(s))-Zr);Cu.push(o)}const Ou=g1(Cu,!0),B1=Ou[0],F1=Ou[1],Iu=(e,t,n)=>n>32?w1(e,t,n):y1(e,t,n),ku=(e,t,n)=>n>32?x1(e,t,n):v1(e,t,n);function R1(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,l=n[a],u=n[a+1],f=Iu(l,u,1)^n[c],d=ku(l,u,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=Nu[i],a=Iu(o,s,c),l=ku(o,s,c),u=$u[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=l}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]^=B1[r],e[1]^=F1[r]}fr(n)}class ji extends Ri{constructor(t,n,r,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,qr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=P1(this.state)}clone(){return this._cloneInto()}keccak(){Tu(this.state32),R1(this.state32,this.rounds),Tu(this.state32),this.posOut=0,this.pos=0}update(t){ur(this),t=us(t),Bn(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){ur(this,!1),Bn(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return qr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Pu(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,fr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new ji(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 j1=(e,t,n)=>Au(()=>new ji(t,e,n)),Du=j1(1,136,256/8);function ke(e,t){const n=t||"hex",r=Du(Pt(e,{strict:!1})?cr(e):e);return n==="bytes"?r:mn(r)}const _1=e=>ke(cr(e));function z1(e){return _1(e)}function U1(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 W1=e=>{const t=typeof e=="string"?e:ss(e);return U1(t)};function Mu(e){return z1(W1(e))}const fs=Mu;let bn=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"})}},ds=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 _i=new ds(8192);function ps(e,t){if(_i.has(`${e}.${t}`))return _i.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=ke(Ln(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 _i.set(`${e}.${t}`,s),s}function Qt(e,t){if(!ct(e,{strict:!1}))throw new bn({address:e});return ps(e,t)}const H1=/^0x[a-fA-F0-9]{40}$/,zi=new ds(8192);function ct(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(zi.has(r))return zi.get(r);const o=H1.test(e)?e.toLowerCase()===e?!0:n?ps(e)===e:!0:!1;return zi.set(r,o),o}function At(e){return typeof e[0]=="string"?dr(e):V1(e)}function V1(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 dr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Fn(e,t,n,{strict:r}={}){return Pt(e,{strict:!1})?G1(e,t,n,{strict:r}):Fu(e,t,n,{strict:r})}function Lu(e,t){if(typeof t=="number"&&t>0&&t>ve(e)-1)throw new yu({offset:t,position:"start",size:ve(e)})}function Bu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ve(e)!==n-t)throw new yu({offset:n,position:"end",size:ve(e)})}function Fu(e,t,n,{strict:r}={}){Lu(e,t);const o=e.slice(t,n);return r&&Bu(o,t,n),o}function G1(e,t,n,{strict:r}={}){Lu(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Bu(o,t,n),o}const q1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ru=/^(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 gn(e,t){if(e.length!==t.length)throw new Kb({expectedLength:e.length,givenLength:t.length});const n=Z1({params:e,values:t}),r=Wi(n);return r.length===0?"0x":r}function Z1({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Ui({param:e[r],value:t[r]}));return n}function Ui({param:e,value:t}){const n=Hi(e.type);if(n){const[r,o]=n;return Y1(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return tg(t,{param:e});if(e.type==="address")return K1(t);if(e.type==="bool")return Q1(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=Ru.exec(e.type)??[];return J1(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return X1(t,{param:e});if(e.type==="string")return eg(t);throw new n1(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+=ve(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(Q(t+o,{size:32})),r.push(c),o+=ve(c)):n.push(c)}return At([...n,...r])}function K1(e){if(!ct(e))throw new bn({address:e});return{dynamic:!1,encoded:hn(e.toLowerCase())}}function Y1(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new gu(e);if(!r&&e.length!==t)throw new qb({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=Ui({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=Wi(s);if(r){const c=Q(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?At([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:At(s.map(({encoded:i})=>i))}}function X1(e,{param:t}){const[,n]=t.type.split("bytes"),r=ve(e);if(!n){let o=e;return r%32!==0&&(o=hn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:At([hn(Q(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new Zb({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:hn(e,{dir:"right"})}}function Q1(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:hn(xu(e))}}function J1(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 Bi({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Q(e,{size:32,signed:t})}}function eg(e){const t=Gr(e),n=Math.ceil(ve(t)/32),r=[];for(let o=0;o<n;o++)r.push(hn(Fn(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:At([hn(Q(ve(t),{size:32})),...r])}}function tg(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=Ui({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Wi(r):At(r.map(({encoded:o})=>o))}}function Hi(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Kr=e=>Fn(Mu(e),0,4);function Rn(e){const{abi:t,args:n=[],name:r}=e,o=Pt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Kr(c)===r:c.type==="event"?fs(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((l,u)=>{const f="inputs"in c&&c.inputs[u];return f?Vi(l,f):!1})){if(i&&"inputs"in i&&i.inputs){const l=ju(c.inputs,i.inputs,n);if(l)throw new e1({abiItem:c,type:l[0]},{abiItem:i,type:l[1]})}i=c}}return i||s[0]}function Vi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ct(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>n==="object"&&Vi(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=>Vi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function ju(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 ju(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")?ct(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ct(n[r],{strict:!1}):!1)return i}}const _u="/docs/contract/encodeEventTopics";function Yr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const l=Rn({abi:t,name:n});if(!l)throw new mu(n,{docsPath:_u});o=l}if(o.type!=="event")throw new mu(void 0,{docsPath:_u});const s=St(o),i=fs(s);let c=[];if(r&&"inputs"in o){const l=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(l==null?void 0:l.map(f=>r[f.name]))??[]:[];u.length>0&&(c=(l==null?void 0:l.map((f,d)=>Array.isArray(u[d])?u[d].map((p,h)=>zu({param:f,value:u[d][h]})):typeof u[d]<"u"&&u[d]!==null?zu({param:f,value:u[d]}):null))??[])}return[i,...c]}function zu({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return ke(cr(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new s1(e.type);return gn([e],[t])}function hs(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 Uu(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,l=hs(e,{method:"eth_newFilter"}),u=s?Yr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?Q(i):i,toBlock:typeof a=="bigint"?Q(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:l(f),strict:!!c,type:"event"}}function tt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const Wu="/docs/contract/encodeFunctionData";function ng(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Rn({abi:t,args:n,name:r});if(!s)throw new ir(r,{docsPath:Wu});o=s}if(o.type!=="function")throw new ir(void 0,{docsPath:Wu});return{abi:[o],functionName:Kr(St(o))}}function lt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:ng(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?gn(o.inputs,t??[]):void 0;return dr([s,i??"0x"])}const rg={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."},Hu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},og={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let Vu=class extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},Gu=class extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},sg=class extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const ig={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 sg({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Gu({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Vu({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 Vu({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 Gi(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ig);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function ag(e,t={}){typeof t.size<"u"&&Tt(e,{size:t.size});const n=Ae(e,t);return Lt(n,t)}function cg(e,t={}){let n=e;if(typeof t.size<"u"&&(Tt(n,{size:t.size}),n=Mn(n)),n.length>1||n[0]>1)throw new a1(n);return!!n[0]}function Jt(e,t={}){typeof t.size<"u"&&Tt(e,{size:t.size});const n=Ae(e,t);return Yt(n,t)}function lg(e,t={}){let n=e;return typeof t.size<"u"&&(Tt(n,{size:t.size}),n=Mn(n,{dir:"right"})),new TextDecoder().decode(n)}function Xr(e,t){const n=typeof t=="string"?Bt(t):t,r=Gi(n);if(ve(n)===0&&e.length>0)throw new Vr;if(ve(t)&&ve(t)<32)throw new du({data:typeof t=="string"?t:Ae(t),params:e,size:ve(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,l]=pr(r,c,{staticPosition:0});o+=l,s.push(a)}return s}function pr(e,t,{staticPosition:n}){const r=Hi(t.type);if(r){const[o,s]=r;return fg(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return mg(e,t,{staticPosition:n});if(t.type==="address")return ug(e);if(t.type==="bool")return dg(e);if(t.type.startsWith("bytes"))return pg(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return hg(e,t);if(t.type==="string")return bg(e,{staticPosition:n});throw new r1(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const qu=32,qi=32;function ug(e){const t=e.readBytes(32);return[ps(Ae(Fu(t,-20))),32]}function fg(e,t,{length:n,staticPosition:r}){if(!n){const i=Jt(e.readBytes(qi)),c=r+i,a=c+qu;e.setPosition(c);const l=Jt(e.readBytes(qu)),u=Qr(t);let f=0;const d=[];for(let p=0;p<l;++p){e.setPosition(a+(u?p*32:f));const[h,b]=pr(e,t,{staticPosition:a});f+=b,d.push(h)}return e.setPosition(r+32),[d,32]}if(Qr(t)){const i=Jt(e.readBytes(qi)),c=r+i,a=[];for(let l=0;l<n;++l){e.setPosition(c+l*32);const[u]=pr(e,t,{staticPosition:c});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=pr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function dg(e){return[cg(e.readBytes(32),{size:32}),32]}function pg(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Jt(e.readBytes(32));e.setPosition(n+i);const c=Jt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Ae(a),32]}return[Ae(e.readBytes(Number.parseInt(o,10),32)),32]}function hg(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?ag(o,{signed:n}):Jt(o,{signed:n}),32]}function mg(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Qr(t)){const i=Jt(e.readBytes(qi)),c=n+i;for(let a=0;a<t.components.length;++a){const l=t.components[a];e.setPosition(c+s);const[u,f]=pr(e,l,{staticPosition:c});s+=f,o[r?a:l==null?void 0:l.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,l]=pr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=l}return[o,s]}function bg(e,{staticPosition:t}){const n=Jt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Jt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=lg(Mn(s));return e.setPosition(t+32),[i,32]}function Qr(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(Qr);const n=Hi(e.type);return!!(n&&Qr({...e,type:n[1]}))}function Zu(e){const{abi:t,data:n}=e,r=Fn(n,0,4);if(r==="0x")throw new Vr;const s=[...t||[],Hu,og].find(i=>i.type==="error"&&r===Kr(St(i)));if(!s)throw new hu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Xr(s.inputs,Fn(n,4)):void 0,errorName:s.name}}const $e=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Ku({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"?$e(t[s]):t[s]}`).join(", ")})`}const gg={gwei:9,wei:18},yg={ether:-9,wei:9};function Zi(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 Ki(e,t="wei"){return Zi(e,gg[t])}function Ue(e,t="wei"){return Zi(e,yg[t])}class vg extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class wg extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Yu(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
72
- `,"")}function xg(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
63
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class gu 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(`
64
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class t1 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://4byte.sourcify.dev/?q=${t}.`].join(`
65
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class n1 extends V{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${St(t.abiItem)}\`, and`,`\`${n.type}\` in \`${St(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let r1=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class ls 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(`
66
+ `),{metaMessages:[`Params: (${cs(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 Bi extends V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${St(t,{includeName:!0})}".`].join(`
67
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class o1 extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
68
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class s1 extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
69
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let yu=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
70
+ `),{name:"InvalidArrayError"})}};class i1 extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
71
+ `),{name:"InvalidDefinitionTypeError"})}}class a1 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"})}},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 xu 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 ar(e,{dir:t,size:n=32}={}){return typeof e=="string"?hn(e,{dir:t,size:n}):c1(e,{dir:t,size:n})}function hn(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 c1(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 Fi=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"})}},l1=class 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 u1 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 f1=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function kn(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 Tt(e,{size:t}){if(ve(e)>t)throw new f1({givenSize:ve(e),maxSize:t})}function Lt(e,t={}){const{signed:n}=t;t.size&&Tt(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 d1(e,t={}){let n=e;if(t.size&&(Tt(n,{size:t.size}),n=kn(n)),kn(n)==="0x00")return!1;if(kn(n)==="0x01")return!0;throw new u1(n)}function Yt(e,t={}){const n=Lt(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new Fi({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const p1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function mn(e,t={}){return typeof e=="number"||typeof e=="bigint"?J(e,t):typeof e=="string"?Gr(e,t):typeof e=="boolean"?Eu(e,t):Ae(e,t)}function Eu(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Tt(n,{size:t.size}),ar(n,{size:t.size})):n}function Ae(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=p1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Tt(r,{size:t.size}),ar(r,{dir:"right",size:t.size})):r}function J(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 Fi({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?ar(c,{size:r}):c}const h1=new TextEncoder;function Gr(e,t={}){const n=h1.encode(e);return Ae(n,t)}const m1=new TextEncoder;function cr(e,t={}){return typeof e=="number"||typeof e=="bigint"?g1(e,t):typeof e=="boolean"?b1(e,t):Pt(e)?Bt(e,t):Ln(e,t)}function b1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Tt(n,{size:t.size}),ar(n,{size:t.size})):n}const Xt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Su(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 Bt(e,t={}){let n=e;t.size&&(Tt(n,{size:t.size}),n=ar(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=Su(r.charCodeAt(c++)),l=Su(r.charCodeAt(c++));if(a===void 0||l===void 0)throw new V(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+l}return s}function g1(e,t){const n=J(e,t);return Bt(n)}function Ln(e,t={}){const n=m1.encode(e);return typeof t.size=="number"?(Tt(n,{size:t.size}),ar(n,{dir:"right",size:t.size})):n}const us=BigInt(2**32-1),Pu=BigInt(32);function y1(e,t=!1){return t?{h:Number(e&us),l:Number(e>>Pu&us)}:{h:Number(e>>Pu&us)|0,l:Number(e&us)|0}}function v1(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}=y1(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const w1=(e,t,n)=>e<<n|t>>>32-n,x1=(e,t,n)=>t<<n|e>>>32-n,E1=(e,t,n)=>t<<n-32|e>>>64-n,S1=(e,t,n)=>e<<n-32|t>>>64-n,lr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function P1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Bn(e,...t){if(!P1(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 T1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");qr(e.outputLen),qr(e.blockLen)}function ur(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 Tu(e,t){Bn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function $1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function fr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ri(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ft(e,t){return e<<32-t|e>>>t}const A1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function N1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function C1(e){for(let t=0;t<e.length;t++)e[t]=N1(e[t]);return e}const $u=A1?e=>e:C1;function O1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function fs(e){return typeof e=="string"&&(e=O1(e)),Bn(e),e}function I1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Bn(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class ji{}function Au(e){const t=r=>e().update(fs(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function D1(e=32){if(lr&&typeof lr.getRandomValues=="function")return lr.getRandomValues(new Uint8Array(e));if(lr&&typeof lr.randomBytes=="function")return Uint8Array.from(lr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const M1=BigInt(0),Zr=BigInt(1),k1=BigInt(2),L1=BigInt(7),B1=BigInt(256),F1=BigInt(113),Nu=[],Cu=[],Ou=[];for(let e=0,t=Zr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Nu.push(2*(5*r+n)),Cu.push((e+1)*(e+2)/2%64);let o=M1;for(let s=0;s<7;s++)t=(t<<Zr^(t>>L1)*F1)%B1,t&k1&&(o^=Zr<<(Zr<<BigInt(s))-Zr);Ou.push(o)}const Iu=v1(Ou,!0),R1=Iu[0],j1=Iu[1],Du=(e,t,n)=>n>32?E1(e,t,n):w1(e,t,n),Mu=(e,t,n)=>n>32?S1(e,t,n):x1(e,t,n);function _1(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,l=n[a],u=n[a+1],f=Du(l,u,1)^n[c],d=Mu(l,u,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=Cu[i],a=Du(o,s,c),l=Mu(o,s,c),u=Nu[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=l}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]^=R1[r],e[1]^=j1[r]}fr(n)}class _i extends ji{constructor(t,n,r,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,qr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$1(this.state)}clone(){return this._cloneInto()}keccak(){$u(this.state32),_1(this.state32,this.rounds),$u(this.state32),this.posOut=0,this.pos=0}update(t){ur(this),t=fs(t),Bn(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){ur(this,!1),Bn(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return qr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Tu(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,fr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new _i(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 z1=(e,t,n)=>Au(()=>new _i(t,e,n)),ku=z1(1,136,256/8);function De(e,t){const n=t||"hex",r=ku(Pt(e,{strict:!1})?cr(e):e);return n==="bytes"?r:mn(r)}const U1=e=>De(cr(e));function W1(e){return U1(e)}function H1(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 V1=e=>{const t=typeof e=="string"?e:is(e);return H1(t)};function Lu(e){return W1(V1(e))}const ds=Lu;let bn=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"})}},ps=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 zi=new ps(8192);function hs(e,t){if(zi.has(`${e}.${t}`))return zi.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=De(Ln(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 zi.set(`${e}.${t}`,s),s}function Qt(e,t){if(!ct(e,{strict:!1}))throw new bn({address:e});return hs(e,t)}const G1=/^0x[a-fA-F0-9]{40}$/,Ui=new ps(8192);function ct(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ui.has(r))return Ui.get(r);const o=G1.test(e)?e.toLowerCase()===e?!0:n?hs(e)===e:!0:!1;return Ui.set(r,o),o}function $t(e){return typeof e[0]=="string"?dr(e):q1(e)}function q1(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 dr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Fn(e,t,n,{strict:r}={}){return Pt(e,{strict:!1})?Z1(e,t,n,{strict:r}):Ru(e,t,n,{strict:r})}function Bu(e,t){if(typeof t=="number"&&t>0&&t>ve(e)-1)throw new vu({offset:t,position:"start",size:ve(e)})}function Fu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ve(e)!==n-t)throw new vu({offset:n,position:"end",size:ve(e)})}function Ru(e,t,n,{strict:r}={}){Bu(e,t);const o=e.slice(t,n);return r&&Fu(o,t,n),o}function Z1(e,t,n,{strict:r}={}){Bu(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Fu(o,t,n),o}const K1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ju=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function gn(e,t){if(e.length!==t.length)throw new Xb({expectedLength:e.length,givenLength:t.length});const n=Y1({params:e,values:t}),r=Hi(n);return r.length===0?"0x":r}function Y1({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Wi({param:e[r],value:t[r]}));return n}function Wi({param:e,value:t}){const n=Vi(e.type);if(n){const[r,o]=n;return Q1(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return rg(t,{param:e});if(e.type==="address")return X1(t);if(e.type==="bool")return eg(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=ju.exec(e.type)??[];return tg(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return J1(t,{param:e});if(e.type==="string")return ng(t);throw new o1(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Hi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=ve(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(J(t+o,{size:32})),r.push(c),o+=ve(c)):n.push(c)}return $t([...n,...r])}function X1(e){if(!ct(e))throw new bn({address:e});return{dynamic:!1,encoded:hn(e.toLowerCase())}}function Q1(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new yu(e);if(!r&&e.length!==t)throw new Kb({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=Wi({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=Hi(s);if(r){const c=J(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?$t([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:$t(s.map(({encoded:i})=>i))}}function J1(e,{param:t}){const[,n]=t.type.split("bytes"),r=ve(e);if(!n){let o=e;return r%32!==0&&(o=hn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:$t([hn(J(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new Yb({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:hn(e,{dir:"right"})}}function eg(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:hn(Eu(e))}}function tg(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 Fi({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:J(e,{size:32,signed:t})}}function ng(e){const t=Gr(e),n=Math.ceil(ve(t)/32),r=[];for(let o=0;o<n;o++)r.push(hn(Fn(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:$t([hn(J(ve(t),{size:32})),...r])}}function rg(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=Wi({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Hi(r):$t(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 Kr=e=>Fn(Lu(e),0,4);function Rn(e){const{abi:t,args:n=[],name:r}=e,o=Pt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Kr(c)===r:c.type==="event"?ds(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((l,u)=>{const f="inputs"in c&&c.inputs[u];return f?Gi(l,f):!1})){if(i&&"inputs"in i&&i.inputs){const l=_u(c.inputs,i.inputs,n);if(l)throw new n1({abiItem:c,type:l[0]},{abiItem:i,type:l[1]})}i=c}}return i||s[0]}function Gi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ct(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>n==="object"&&Gi(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=>Gi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function _u(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 _u(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")?ct(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ct(n[r],{strict:!1}):!1)return i}}const zu="/docs/contract/encodeEventTopics";function Yr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const l=Rn({abi:t,name:n});if(!l)throw new bu(n,{docsPath:zu});o=l}if(o.type!=="event")throw new bu(void 0,{docsPath:zu});const s=St(o),i=ds(s);let c=[];if(r&&"inputs"in o){const l=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(l==null?void 0:l.map(f=>r[f.name]))??[]:[];u.length>0&&(c=(l==null?void 0:l.map((f,d)=>Array.isArray(u[d])?u[d].map((p,h)=>Uu({param:f,value:u[d][h]})):typeof u[d]<"u"&&u[d]!==null?Uu({param:f,value:u[d]}):null))??[])}return[i,...c]}function Uu({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return De(cr(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new a1(e.type);return gn([e],[t])}function ms(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 Wu(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,l=ms(e,{method:"eth_newFilter"}),u=s?Yr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?J(i):i,toBlock:typeof a=="bigint"?J(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:l(f),strict:!!c,type:"event"}}function tt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const Hu="/docs/contract/encodeFunctionData";function og(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Rn({abi:t,args:n,name:r});if(!s)throw new ir(r,{docsPath:Hu});o=s}if(o.type!=="function")throw new ir(void 0,{docsPath:Hu});return{abi:[o],functionName:Kr(St(o))}}function lt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:og(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?gn(o.inputs,t??[]):void 0;return dr([s,i??"0x"])}const sg={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."},Vu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},ig={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let Gu=class extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},qu=class extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},ag=class extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const cg={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 ag({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new qu({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Gu({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 Gu({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 qi(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(cg);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function lg(e,t={}){typeof t.size<"u"&&Tt(e,{size:t.size});const n=Ae(e,t);return Lt(n,t)}function ug(e,t={}){let n=e;if(typeof t.size<"u"&&(Tt(n,{size:t.size}),n=kn(n)),n.length>1||n[0]>1)throw new l1(n);return!!n[0]}function Jt(e,t={}){typeof t.size<"u"&&Tt(e,{size:t.size});const n=Ae(e,t);return Yt(n,t)}function fg(e,t={}){let n=e;return typeof t.size<"u"&&(Tt(n,{size:t.size}),n=kn(n,{dir:"right"})),new TextDecoder().decode(n)}function Xr(e,t){const n=typeof t=="string"?Bt(t):t,r=qi(n);if(ve(n)===0&&e.length>0)throw new Vr;if(ve(t)&&ve(t)<32)throw new pu({data:typeof t=="string"?t:Ae(t),params:e,size:ve(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,l]=pr(r,c,{staticPosition:0});o+=l,s.push(a)}return s}function pr(e,t,{staticPosition:n}){const r=Vi(t.type);if(r){const[o,s]=r;return pg(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return gg(e,t,{staticPosition:n});if(t.type==="address")return dg(e);if(t.type==="bool")return hg(e);if(t.type.startsWith("bytes"))return mg(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return bg(e,t);if(t.type==="string")return yg(e,{staticPosition:n});throw new s1(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Zu=32,Zi=32;function dg(e){const t=e.readBytes(32);return[hs(Ae(Ru(t,-20))),32]}function pg(e,t,{length:n,staticPosition:r}){if(!n){const i=Jt(e.readBytes(Zi)),c=r+i,a=c+Zu;e.setPosition(c);const l=Jt(e.readBytes(Zu)),u=Qr(t);let f=0;const d=[];for(let p=0;p<l;++p){e.setPosition(a+(u?p*32:f));const[h,b]=pr(e,t,{staticPosition:a});f+=b,d.push(h)}return e.setPosition(r+32),[d,32]}if(Qr(t)){const i=Jt(e.readBytes(Zi)),c=r+i,a=[];for(let l=0;l<n;++l){e.setPosition(c+l*32);const[u]=pr(e,t,{staticPosition:c});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=pr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function hg(e){return[ug(e.readBytes(32),{size:32}),32]}function mg(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Jt(e.readBytes(32));e.setPosition(n+i);const c=Jt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Ae(a),32]}return[Ae(e.readBytes(Number.parseInt(o,10),32)),32]}function bg(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?lg(o,{signed:n}):Jt(o,{signed:n}),32]}function gg(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Qr(t)){const i=Jt(e.readBytes(Zi)),c=n+i;for(let a=0;a<t.components.length;++a){const l=t.components[a];e.setPosition(c+s);const[u,f]=pr(e,l,{staticPosition:c});s+=f,o[r?a:l==null?void 0:l.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,l]=pr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=l}return[o,s]}function yg(e,{staticPosition:t}){const n=Jt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Jt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=fg(kn(s));return e.setPosition(t+32),[i,32]}function Qr(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(Qr);const n=Vi(e.type);return!!(n&&Qr({...e,type:n[1]}))}function Ku(e){const{abi:t,data:n}=e,r=Fn(n,0,4);if(r==="0x")throw new Vr;const s=[...t||[],Vu,ig].find(i=>i.type==="error"&&r===Kr(St(i)));if(!s)throw new mu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Xr(s.inputs,Fn(n,4)):void 0,errorName:s.name}}const Ne=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Yu({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"?Ne(t[s]):t[s]}`).join(", ")})`}const vg={gwei:9,wei:18},wg={ether:-9,wei:9};function Ki(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 Yi(e,t="wei"){return Ki(e,vg[t])}function Ue(e,t="wei"){return Ki(e,wg[t])}class xg extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Eg extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Xu(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
72
+ `,"")}function Sg(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
73
73
  `;return r.nonce&&(o+=` nonce: ${r.nonce}
74
74
  `),r.balance&&(o+=` balance: ${r.balance}
75
75
  `),r.code&&(o+=` code: ${r.code}
76
76
  `),r.state&&(o+=` state:
77
- `,o+=Yu(r.state)),r.stateDiff&&(o+=` stateDiff:
78
- `,o+=Yu(r.stateDiff)),o},` State Override:
77
+ `,o+=Xu(r.state)),r.stateDiff&&(o+=` stateDiff:
78
+ `,o+=Xu(r.stateDiff)),o},` State Override:
79
79
  `).slice(0,-1)}function Jr(e){const t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
80
- `)}class Eg extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Jr(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 Sg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:d}){var h;const p=Jr({chain:o&&`${o==null?void 0:o.name} (id: ${o==null?void 0:o.id})`,from:n==null?void 0:n.address,to:f,value:typeof d<"u"&&`${Ki(d)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ue(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ue(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ue(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",p].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Xu 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 Qu 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 Pg extends V{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class Tg extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Ag=e=>e,eo=e=>e;class Ju extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:d,stateOverride:p}){var S;const h=n?tt(n):void 0;let b=Jr({from:h==null?void 0:h.address,to:f,value:typeof d<"u"&&`${Ki(d)} ${((S=o==null?void 0:o.nativeCurrency)==null?void 0:S.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ue(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ue(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ue(l)} gwei`,nonce:u});p&&(b+=`
81
- ${xg(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",b].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class ef extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=Rn({abi:n,args:r,name:i}),l=a?Ku({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?St(a,{includeName:!0}):void 0,f=Jr({address:o&&Ag(o),function:u,args:l&&l!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${l}`,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 Yi extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=Zu({abi:t,data:n});const{abiItem:u,errorName:f,args:d}=i;if(f==="Error")a=d[0];else if(f==="Panic"){const[p]=d;a=rg[p]}else{const p=u?St(u,{includeName:!0}):void 0,h=u&&d?Ku({abiItem:u,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(u){s=u}else o&&(a=o);let l;s instanceof hu&&(l=s.signature,c=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${l}.`]),super(a&&a!=="execution reverted"||l?[`The contract function "${r}" reverted with the following ${l?"signature":"reason"}:`,a||l].join(`
82
- `):`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=l}}class $g 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 Ng 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 ms 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 jn 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: ${eo(i)}`,t&&`Request body: ${$e(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 Xi extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${eo(r)}`,`Request body: ${$e(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class tf extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${eo(n)}`,`Request body: ${$e(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const Cg=-1;class We 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 Xi?t.code:n??Cg}}class He extends We{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class to extends We{constructor(t){super(t,{code:to.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class no extends We{constructor(t){super(t,{code:no.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ro extends We{constructor(t,{method:n}={}){super(t,{code:ro.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class oo extends We{constructor(t){super(t,{code:oo.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
80
+ `)}class Pg extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Jr(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 Tg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:d}){var h;const p=Jr({chain:o&&`${o==null?void 0:o.name} (id: ${o==null?void 0:o.id})`,from:n==null?void 0:n.address,to:f,value:typeof d<"u"&&`${Yi(d)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ue(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ue(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ue(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",p].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Qu 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 Ju 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 $g extends V{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class Ag extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Ng=e=>e,eo=e=>e;class ef extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:d,stateOverride:p}){var S;const h=n?tt(n):void 0;let b=Jr({from:h==null?void 0:h.address,to:f,value:typeof d<"u"&&`${Yi(d)} ${((S=o==null?void 0:o.nativeCurrency)==null?void 0:S.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ue(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ue(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ue(l)} gwei`,nonce:u});p&&(b+=`
81
+ ${Sg(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",b].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class tf extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=Rn({abi:n,args:r,name:i}),l=a?Yu({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?St(a,{includeName:!0}):void 0,f=Jr({address:o&&Ng(o),function:u,args:l&&l!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${l}`,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 Xi extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=Ku({abi:t,data:n});const{abiItem:u,errorName:f,args:d}=i;if(f==="Error")a=d[0];else if(f==="Panic"){const[p]=d;a=sg[p]}else{const p=u?St(u,{includeName:!0}):void 0,h=u&&d?Yu({abiItem:u,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(u){s=u}else o&&(a=o);let l;s instanceof mu&&(l=s.signature,c=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${l}.`]),super(a&&a!=="execution reverted"||l?[`The contract function "${r}" reverted with the following ${l?"signature":"reason"}:`,a||l].join(`
82
+ `):`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=l}}class Cg 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 Og 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 bs 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 jn 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: ${eo(i)}`,t&&`Request body: ${Ne(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 Qi extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${eo(r)}`,`Request body: ${Ne(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class nf extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${eo(n)}`,`Request body: ${Ne(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const Ig=-1;class We 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 Qi?t.code:n??Ig}}class He extends We{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class to extends We{constructor(t){super(t,{code:to.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class no extends We{constructor(t){super(t,{code:no.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ro extends We{constructor(t,{method:n}={}){super(t,{code:ro.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class oo extends We{constructor(t){super(t,{code:oo.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
83
83
  `)})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class _n extends We{constructor(t){super(t,{code:_n.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(_n,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class yn extends We{constructor(t){super(t,{code:yn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
84
- `)})}}Object.defineProperty(yn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class so extends We{constructor(t){super(t,{code:so.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class io extends We{constructor(t){super(t,{code:io.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class ao extends We{constructor(t){super(t,{code:ao.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class zn extends We{constructor(t,{method:n}={}){super(t,{code:zn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(zn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class hr extends We{constructor(t){super(t,{code:hr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(hr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class co extends We{constructor(t){super(t,{code:co.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class mr extends He{constructor(t){super(t,{code:mr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(mr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class lo extends He{constructor(t){super(t,{code:lo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class uo extends He{constructor(t,{method:n}={}){super(t,{code:uo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class fo extends He{constructor(t){super(t,{code:fo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class po extends He{constructor(t){super(t,{code:po.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ho extends He{constructor(t){super(t,{code:ho.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class mo extends He{constructor(t){super(t,{code:mo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class bo extends He{constructor(t){super(t,{code:bo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class go extends He{constructor(t){super(t,{code:go.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class yo extends He{constructor(t){super(t,{code:yo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class vo extends He{constructor(t){super(t,{code:vo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class wo extends He{constructor(t){super(t,{code:wo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class xo extends He{constructor(t){super(t,{code:xo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Eo extends He{constructor(t){super(t,{code:Eo.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class Og extends We{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Ig=3;function br(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof ms?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:l,details:u,message:f,shortMessage:d}=c,p=e instanceof Vr?new $g({functionName:s}):[Ig,_n.code].includes(a)&&(l||u||f||d)||a===yn.code&&u==="execution reverted"&&l?new Yi({abi:t,data:typeof l=="object"?l.data:l,functionName:s,message:c instanceof Xi?u:d??f}):e;return new ef(p,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function kg(e){const t=ke(`0x${e.substring(4)}`).substring(26);return ps(`0x${t}`)}async function Dg({hash:e,signature:t}){const n=Pt(e)?e:mn(e),{secp256k1:r}=await Promise.resolve().then(()=>h6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:f,yParity:d}=t,p=Number(d??f),h=nf(p);return new r.Signature(Lt(l),Lt(u)).addRecoveryBit(h)}const i=Pt(t)?t:mn(t);if(ve(i)!==65)throw new Error("invalid signature length");const c=Yt(`0x${i.slice(130)}`),a=nf(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function nf(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 rf({hash:e,signature:t}){return kg(await Dg({hash:e,signature:t}))}function Mg(e,t="hex"){const n=of(e),r=Gi(new Uint8Array(n.length));return n.encode(r),t==="hex"?Ae(r.bytes):r.bytes}function of(e){return Array.isArray(e)?Lg(e.map(t=>of(t))):Bg(e)}function Lg(e){const t=e.reduce((o,s)=>o+s.length,0),n=sf(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 Bg(e){const t=typeof e=="string"?Bt(e):e,n=sf(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 sf(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 Fg(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=ke(dr(["0x05",Mg([t?Q(t):"0x",o,n?Q(n):"0x"])]));return r==="bytes"?Bt(s):s}async function af(e){const{authorization:t,signature:n}=e;return rf({hash:Fg(t),signature:n??t})}class Rg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:d}){var h;const p=Jr({from:n==null?void 0:n.address,to:f,value:typeof d<"u"&&`${Ki(d)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ue(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ue(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ue(l)} gwei`,nonce:u});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 gr 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(gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(gr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class bs extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ue(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(bs,"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 Qi extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ue(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Qi,"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 Ji 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(Ji,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class ea 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(`
85
- `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(ea,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class ta 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(ta,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class na extends V{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
86
- `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(na,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class ra 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(ra,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class oa 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(oa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class sa extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(sa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class gs extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Ue(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Ue(r)} gwei`:""}).`].join(`
87
- `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(gs,"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 So extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function ys(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===gr.code):e;return r instanceof V?new gr({cause:e,message:r.details}):gr.nodeMessage.test(n)?new gr({cause:e,message:e.details}):bs.nodeMessage.test(n)?new bs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Qi.nodeMessage.test(n)?new Qi({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ji.nodeMessage.test(n)?new Ji({cause:e,nonce:t==null?void 0:t.nonce}):ea.nodeMessage.test(n)?new ea({cause:e,nonce:t==null?void 0:t.nonce}):ta.nodeMessage.test(n)?new ta({cause:e,nonce:t==null?void 0:t.nonce}):na.nodeMessage.test(n)?new na({cause:e}):ra.nodeMessage.test(n)?new ra({cause:e,gas:t==null?void 0:t.gas}):oa.nodeMessage.test(n)?new oa({cause:e,gas:t==null?void 0:t.gas}):sa.nodeMessage.test(n)?new sa({cause:e}):gs.nodeMessage.test(n)?new gs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new So({cause:e})}function jg(e,{docsPath:t,...n}){const r=(()=>{const o=ys(e,n);return o instanceof So?e:o})();return new Rg(r,{docsPath:t,...n})}function vs(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 _g={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Po(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=zg(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>Ae(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=Q(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=Q(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=Q(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=Q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=Q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=Q(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=_g[e.type]),typeof e.value<"u"&&(n.value=Q(e.value)),n}function zg(e){return e.map(t=>({address:t.address,r:t.r?Q(BigInt(t.r)):t.r,s:t.s?Q(BigInt(t.s)):t.s,chainId:Q(t.chainId),nonce:Q(t.nonce),...typeof t.yParity<"u"?{yParity:Q(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Q(t.v)}:{}}))}function cf(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new wu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new wu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Ug(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=Q(t)),n!==void 0&&(i.nonce=Q(n)),r!==void 0&&(i.state=cf(r)),o!==void 0){if(i.state)throw new wg;i.stateDiff=cf(o)}return i}function ia(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ct(n,{strict:!1}))throw new bn({address:n});if(t[n])throw new vg({address:n});t[n]=Ug(r)}return t}const lf=2n**256n-1n;function yr(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?tt(t):void 0;if(s&&!ct(s.address))throw new bn({address:s.address});if(o&&!ct(o))throw new bn({address:o});if(n&&n>lf)throw new bs({maxFeePerGas:n});if(r&&n&&r>n)throw new gs({maxFeePerGas:n,maxPriorityFeePerGas:r})}class uf extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class aa extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Wg extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Ue(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class ff 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 df={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function ca(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Yt(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?Yt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?df[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=Hg(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function Hg(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 pf(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:ca(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function $t(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var l,u,f;const s=o??!1,i=n!==void 0?Q(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 ff({blockHash:t,blockNumber:n});return(((f=(u=(l=e.chain)==null?void 0:l.formatters)==null?void 0:u.block)==null?void 0:f.format)||pf)(c,"getBlock")}async function la(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Vg(e,t){return hf(e,t)}async function hf(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 l=n||await X(e,$t,"getBlock")({}),u=await c({block:l,client:e,request:o});if(u===null)throw new Error;return u}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Lt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):X(e,$t,"getBlock")({}),X(e,la,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new aa;const l=a-c.baseFeePerGas;return l<0n?0n:l}}async function Gg(e,t){return ua(e,t)}async function ua(e,t){var d,p;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,b;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((b=r==null?void 0:r.fees)==null?void 0:b.baseFeeMultiplier)??1.2})();if(i<1)throw new uf;const a=10**(((d=i.toString().split(".")[1])==null?void 0:d.length)??0),l=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await X(e,$t,"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:l,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new aa;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await hf(e,{block:u,chain:r,request:o}),b=l(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??b+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??l(await X(e,la,"getGasPrice")({}))}}async function mf(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?Q(r):n]},{dedupe:!!r});return Yt(o)}function bf(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=>Ae(s))}function gf(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=>Ae(i))}function qg(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,l=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+l,c,r)}function Zg(e,t,n){return e&t^~e&n}function Kg(e,t,n){return e&t^e&n^t&n}class Yg extends Ri{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=Fi(this.buffer)}update(t){ur(this),t=us(t),Bn(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=Fi(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){ur(this),Pu(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,fr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;qg(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Fi(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<l;f++)c.setUint32(4*f,u[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos: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 vn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Xg=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]),wn=new Uint32Array(64);class Qg extends Yg{constructor(t=32){super(64,t,8,!1),this.A=vn[0]|0,this.B=vn[1]|0,this.C=vn[2]|0,this.D=vn[3]|0,this.E=vn[4]|0,this.F=vn[5]|0,this.G=vn[6]|0,this.H=vn[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)wn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const d=wn[f-15],p=wn[f-2],h=Ft(d,7)^Ft(d,18)^d>>>3,b=Ft(p,17)^Ft(p,19)^p>>>10;wn[f]=b+wn[f-7]+h+wn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:l,H:u}=this;for(let f=0;f<64;f++){const d=Ft(c,6)^Ft(c,11)^Ft(c,25),p=u+d+Zg(c,a,l)+Xg[f]+wn[f]|0,b=(Ft(r,2)^Ft(r,13)^Ft(r,22))+Kg(r,o,s)|0;u=l,l=a,a=c,c=i+p|0,i=s,s=o,o=r,r=p+b|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,l=l+this.G|0,u=u+this.H|0,this.set(r,o,s,i,c,a,l,u)}roundClean(){fr(wn)}destroy(){this.set(0,0,0,0,0,0,0,0),fr(this.buffer)}}const yf=Au(()=>new Qg),Jg=yf;function ey(e,t){return Jg(Pt(e,{strict:!1})?cr(e):e)}function ty(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=ey(t);return o.set([n],0),r==="bytes"?o:Ae(o)}function ny(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(ty({commitment:s,to:r,version:n}));return o}const vf=6,wf=32,fa=4096,xf=wf*fa,Ef=xf*vf-1-1*fa*vf;class ry extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class oy extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function sy(e){const t=typeof e.data=="string"?Bt(e.data):e.data,n=ve(t);if(!n)throw new oy;if(n>Ef)throw new ry({maxSize:Ef,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Gi(new Uint8Array(xf));let c=0;for(;c<fa;){const a=t.slice(s,s+(wf-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=>Ae(i.bytes))}function iy(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??sy({data:t}),s=e.commitments??bf({blobs:o,kzg:n,to:r}),i=e.proofs??gf({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 ay(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 Eg({transaction:e})}function cy(e,{docsPath:t,...n}){const r=(()=>{const o=ys(e,n);return o instanceof So?e:o})();return new Sg(r,{docsPath:t,...n})}async function da(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Yt(t)}async function Sf(e,t){var m,g,v,$,N;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:c,data:a,gas:l,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:d,maxPriorityFeePerGas:p,nonce:h,nonceManager:b,to:S,type:P,value:x,...w}=t,A=await(async()=>{if(!n||!b||typeof h<"u")return h;const O=tt(n),k=s?s.id:await X(e,da,"getChainId")({});return await b.consume({address:O.address,chainId:k,client:e})})();yr(t);const M=(g=(m=s==null?void 0:s.formatters)==null?void 0:m.transactionRequest)==null?void 0:g.format,F=(M||Po)({...vs(w,{format:M}),account:n?tt(n):void 0,accessList:r,authorizationList:o,blobs:c,blobVersionedHashes:i,data:a,gas:l,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:d,maxPriorityFeePerGas:p,nonce:A,to:S,type:P,value:x},"fillTransaction");try{const O=await e.request({method:"eth_fillTransaction",params:[F]}),y=((($=(v=s==null?void 0:s.formatters)==null?void 0:v.transaction)==null?void 0:$.format)||ca)(O.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const C=await(async()=>{var j,z;if(typeof((j=s==null?void 0:s.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const _=await X(e,$t,"getBlock")({});return s.fees.baseFeeMultiplier({block:_,client:e,request:t})}return((z=s==null?void 0:s.fees)==null?void 0:z.baseFeeMultiplier)??1.2})();if(C<1)throw new uf;const T=10**(((N=C.toString().split(".")[1])==null?void 0:N.length)??0),L=j=>j*BigInt(Math.ceil(C*T))/BigInt(T);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=L(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=L(y.gasPrice)),{raw:O.raw,transaction:{from:F.from,...y}}}catch(O){throw cy(O,{...t,chain:e.chain})}}const ly=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Pf=new Map,pa=new ds(128);async function Tf(e,t){var A,M,B;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=ly);const{account:r,chain:o=e.chain,nonceManager:s,parameters:i}=n,c=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function l(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await X(e,da,"getChainId")({}),a))}const u=r&&tt(r);let f=n.nonce;if(i.includes("nonce")&&typeof f>"u"&&u&&s){const F=await l();f=await s.consume({address:u.address,chainId:F,client:e})}c!=null&&c.fn&&((A=c.runAt)!=null&&A.includes("beforeFillTransaction"))&&(n=await c.fn({...n,chain:o},{phase:"beforeFillTransaction"}),f??(f=n.nonce));const p=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||pa.get(e.uid)===!1||!["fees","gas"].some(m=>i.includes(m))?!1:!!(i.includes("chainId")&&typeof n.chainId!="number"||i.includes("nonce")&&typeof f!="number"||i.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof n.gas!="bigint"))?await X(e,Sf,"fillTransaction")({...n,nonce:f}).then(F=>{const{chainId:m,from:g,gas:v,gasPrice:$,nonce:N,maxFeePerBlobGas:O,maxFeePerGas:k,maxPriorityFeePerGas:y,type:C,...I}=F.transaction;return pa.set(e.uid,!0),{...n,...g?{from:g}:{},...C&&!n.type?{type:C}:{},...typeof m<"u"?{chainId:m}:{},...typeof v<"u"?{gas:v}:{},...typeof $<"u"?{gasPrice:$}:{},...typeof N<"u"?{nonce:N}:{},...typeof O<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:O}:{},...typeof k<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:k}:{},...typeof y<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in I&&typeof I.nonceKey<"u"?{nonceKey:I.nonceKey}:{}}}).catch(F=>{var v;const m=F;return m.name!=="TransactionExecutionError"||((v=m.walk)==null?void 0:v.call(m,$=>{const N=$;return N.name==="MethodNotFoundRpcError"||N.name==="MethodNotSupportedRpcError"}))&&pa.set(e.uid,!1),n}):n;f??(f=p.nonce),n={...p,...u?{from:u==null?void 0:u.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:b,kzg:S,type:P}=n;c!=null&&c.fn&&((M=c.runAt)!=null&&M.includes("beforeFillParameters"))&&(n=await c.fn({...n,chain:o},{phase:"beforeFillParameters"}));let x;async function w(){return x||(x=await X(e,$t,"getBlock")({blockTag:"latest"}),x)}if(i.includes("nonce")&&typeof f>"u"&&u&&!s&&(n.nonce=await X(e,mf,"getTransactionCount")({address:u.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&S){const F=bf({blobs:h,kzg:S});if(i.includes("blobVersionedHashes")){const m=ny({commitments:F,to:"hex"});n.blobVersionedHashes=m}if(i.includes("sidecars")){const m=gf({blobs:h,commitments:F,kzg:S}),g=iy({blobs:h,commitments:F,proofs:m,to:"hex"});n.sidecars=g}}if(i.includes("chainId")&&(n.chainId=await l()),(i.includes("fees")||i.includes("type"))&&typeof P>"u")try{n.type=ay(n)}catch{let F=Pf.get(e.uid);if(typeof F>"u"){const m=await w();F=typeof(m==null?void 0:m.baseFeePerGas)=="bigint",Pf.set(e.uid,F)}n.type=F?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const F=await w(),{maxFeePerGas:m,maxPriorityFeePerGas:g}=await ua(e,{block:F,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<g)throw new Wg({maxPriorityFeePerGas:g});n.maxPriorityFeePerGas=g,n.maxFeePerGas=m}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new aa;if(typeof n.gasPrice>"u"){const F=await w(),{gasPrice:m}=await ua(e,{block:F,chain:o,request:n,type:"legacy"});n.gasPrice=m}}return i.includes("gas")&&typeof b>"u"&&(n.gas=await X(e,ha,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),c!=null&&c.fn&&((B=c.runAt)!=null&&B.includes("afterFillParameters"))&&(n=await c.fn({...n,chain:o},{phase:"afterFillParameters"})),yr(n),delete n.parameters,n}async function ha(e,t){var i,c,a;const{account:n=e.account,prepare:r=!0}=t,o=n?tt(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const l=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await af({authorization:t.authorizationList[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:f,blobs:d,blobVersionedHashes:p,blockNumber:h,blockTag:b,data:S,gas:P,gasPrice:x,maxFeePerBlobGas:w,maxFeePerGas:A,maxPriorityFeePerGas:M,nonce:B,value:F,stateOverride:m,...g}=r?await Tf(e,{...t,parameters:s,to:l}):t;if(P&&t.gas!==P)return P;const $=(typeof h=="bigint"?Q(h):void 0)||b,N=ia(m);yr(t);const O=(a=(c=(i=e.chain)==null?void 0:i.formatters)==null?void 0:c.transactionRequest)==null?void 0:a.format,y=(O||Po)({...vs(g,{format:O}),account:o,accessList:u,authorizationList:f,blobs:d,blobVersionedHashes:p,data:S,gasPrice:x,maxFeePerBlobGas:w,maxFeePerGas:A,maxPriorityFeePerGas:M,nonce:B,to:l,value:F},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:N?[y,$??e.experimental_blockTag??"latest",N]:$?[y,$]:[y]}))}catch(l){throw jg(l,{...t,account:o,chain:e.chain})}}async function uy(e,t){var l;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(l=e.dataSuffix)==null?void 0:l.value,...c}=t,a=lt({abi:n,args:o,functionName:s});try{return await X(e,ha,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const f=c.account?tt(c.account):void 0;throw br(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:f==null?void 0:f.address})}}function To(e,t){if(!ct(e,{strict:!1}))throw new bn({address:e});if(!ct(t,{strict:!1}))throw new bn({address:t});return e.toLowerCase()===t.toLowerCase()}function Rt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const Af="/docs/contract/decodeEventLog";function ws(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new Xb({docsPath:Af});const a=t.find(P=>P.type==="event"&&i===fs(St(P)));if(!(a&&"name"in a)||a.type!=="event")throw new Qb(i,{docsPath:Af});const{name:l,inputs:u}=a,f=u==null?void 0:u.some(P=>!("name"in P&&P.name)),d=f?[]:{},p=u.map((P,x)=>[P,x]).filter(([P])=>"indexed"in P&&P.indexed),h=[];for(let P=0;P<p.length;P++){const[x,w]=p[P],A=c[P];if(!A){if(s)throw new Li({abiItem:a,param:x});h.push([x,w]);continue}d[f?w:x.name||w]=fy({param:x,value:A})}const b=u.filter(P=>!("indexed"in P&&P.indexed)),S=s?b:[...h.map(([P])=>P),...b];if(S.length>0){if(n&&n!=="0x")try{const P=Xr(S,n);if(P){let x=0;if(!s)for(const[w,A]of h)d[f?A:w.name||A]=P[x++];if(f)for(let w=0;w<u.length;w++)d[w]===void 0&&x<P.length&&(d[w]=P[x++]);else for(let w=0;w<b.length;w++)d[b[w].name]=P[x++]}}catch(P){if(s)throw P instanceof du||P instanceof Gu?new cs({abiItem:a,data:n,params:S,size:ve(n)}):P}else if(s)throw new cs({abiItem:a,data:"0x",params:S,size:0})}return{eventName:l,args:Object.values(d).length>0?d:void 0}}function fy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Xr([e],t)||[])[0]}function ma(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),i=t.filter(c=>c.type==="event").map(c=>({abi:c,selector:fs(c)}));return r.map(c=>{var d;const a=typeof c.blockNumber=="string"?Rt(c):c,l=i.filter(p=>a.topics[0]===p.selector);if(l.length===0)return null;let u,f;for(const p of l)try{u=ws({...a,abi:[p.abi],strict:!0}),f=p;break}catch{}if(!u&&!o){f=l[0];try{u=ws({data:a.data,topics:a.topics,abi:[f.abi],strict:!1})}catch{const p=(d=f.abi.inputs)==null?void 0:d.some(h=>!("name"in h&&h.name));return{...a,args:p?[]:{},eventName:f.abi.name}}}return!u||!f||s&&!s.includes(u.eventName)||!dy({args:u.args,inputs:f.abi.inputs,matchArgs:n})?null:{...u,...a}}).filter(Boolean)}function dy(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"?To(i,c):s.type==="string"||s.type==="bytes"?ke(cr(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(l=>o(c,l,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(l=>l.name===s);return c?(Array.isArray(i)?i:[i]).some(l=>o(c,l,t[s])):!1}):!1}async function ba(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const l=a??!1,u=i??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(b=>Yr({abi:[b],eventName:b.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"?Q(r):r,toBlock:typeof o=="bigint"?Q(o):o}]});const p=d.map(h=>Rt(h));return u?ma({abi:u,args:c,logs:p,strict:l}):p}async function $f(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:l}=t,u=i?Rn({abi:n,name:i}):void 0,f=u?void 0:n.filter(d=>d.type==="event");return X(e,ba,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:c,toBlock:a,strict:l})}const ga="/docs/contract/decodeFunctionResult";function xn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Rn({abi:t,args:n,name:r});if(!c)throw new ir(r,{docsPath:ga});s=c}if(s.type!=="function")throw new ir(void 0,{docsPath:ga});if(!s.outputs)throw new bu(s.name,{docsPath:ga});const i=Xr(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ya=BigInt(0),va=BigInt(1);function Ao(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function wa(e){if(!Ao(e))throw new Error("Uint8Array expected")}function $o(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function xs(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Nf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?ya:BigInt("0x"+e)}const Cf=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",py=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function No(e){if(wa(e),Cf)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=py[e[n]];return t}const en={_0:48,_9:57,A:65,F:70,a:97,f:102};function Of(e){if(e>=en._0&&e<=en._9)return e-en._0;if(e>=en.A&&e<=en.F)return e-(en.A-10);if(e>=en.a&&e<=en.f)return e-(en.a-10)}function Es(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Cf)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=Of(e.charCodeAt(s)),c=Of(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 Un(e){return Nf(No(e))}function If(e){return wa(e),Nf(No(Uint8Array.from(e).reverse()))}function Co(e,t){return Es(e.toString(16).padStart(t*2,"0"))}function kf(e,t){return Co(e,t).reverse()}function ut(e,t,n){let r;if(typeof t=="string")try{r=Es(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Ao(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}function Ss(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];wa(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}const xa=e=>typeof e=="bigint"&&ya<=e;function Ea(e,t,n){return xa(e)&&xa(t)&&xa(n)&&t<=e&&e<n}function vr(e,t,n,r){if(!Ea(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function hy(e){let t;for(t=0;e>ya;e>>=va,t+=1);return t}const Ps=e=>(va<<BigInt(e))-va,Sa=e=>new Uint8Array(e),Df=e=>Uint8Array.from(e);function my(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Sa(e),o=Sa(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},c=(...f)=>n(o,r,...f),a=(f=Sa(0))=>{o=c(Df([0]),f),r=c(),f.length!==0&&(o=c(Df([1]),f),r=c())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<t;){r=c();const p=r.slice();d.push(p),f+=r.length}return Ss(...d)};return(f,d)=>{i(),a(f);let p;for(;!(p=d(l()));)a();return i(),p}}const by={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ao(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Ts(e,t,n={}){const r=(o,s,i)=>{const c=by[s];if(typeof c!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!c(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function Mf(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 gy="0.1.1";function yy(){return gy}class te extends Error{static setStaticOptions(t){te.prototype.docsOrigin=t.docsOrigin,te.prototype.showVersion=t.showVersion,te.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var u;if(n.cause instanceof te){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),o=n.cause instanceof te&&n.cause.docsPath||n.docsPath,s=n.docsOrigin??te.prototype.docsOrigin,i=`${s}${o??""}`,c=!!(n.version??te.prototype.showVersion),a=n.version??te.prototype.version,l=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o||c?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0,c?`Version: ${a}`:void 0]:[]].filter(u=>typeof u=="string").join(`
88
- `);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=i,this.docsOrigin=s,this.docsPath=o,this.shortMessage=t,this.showVersion=c,this.version=a}walk(t){return Lf(this,t)}}Object.defineProperty(te,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${yy()}`}}),te.setStaticOptions(te.defaultStaticOptions);function Lf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Lf(e.cause,t):t?null:e}function Oo(e,t){if(wr(e)>t)throw new Ly({givenSize:wr(e),maxSize:t})}const tn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Bf(e){if(e>=tn.zero&&e<=tn.nine)return e-tn.zero;if(e>=tn.A&&e<=tn.F)return e-(tn.A-10);if(e>=tn.a&&e<=tn.f)return e-(tn.a-10)}function vy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new By({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 Ff(e,t={}){const{dir:n="left"}=t;let r=e,o=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)o++;return r=n==="left"?r.slice(o):r.slice(0,r.length-o),r}function As(e,t){if(nt(e)>t)throw new Uy({givenSize:nt(e),maxSize:t})}function wy(e,t){if(typeof t=="number"&&t>0&&t>nt(e)-1)throw new Zf({offset:t,position:"start",size:nt(e)})}function xy(e,t,n){if(typeof t=="number"&&typeof n=="number"&&nt(e)!==n-t)throw new Zf({offset:n,position:"end",size:nt(e)})}function Rf(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 Wy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Ey="#__bigint";function jf(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+Ey:o,n)}const Sy=new TextDecoder,Py=new TextEncoder;function Ty(e){return e instanceof Uint8Array?e:typeof e=="string"?_f(e):Ay(e)}function Ay(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function _f(e,t={}){const{size:n}=t;let r=e;n&&(As(e,n),r=Hn(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 l=Bf(o.charCodeAt(a++)),u=Bf(o.charCodeAt(a++));if(l===void 0||u===void 0)throw new te(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=l<<4|u}return i}function $y(e,t={}){const{size:n}=t,r=Py.encode(e);return typeof n=="number"?(Oo(r,n),Ny(r,n)):r}function Ny(e,t){return vy(e,{dir:"right",size:t})}function wr(e){return e.length}function Cy(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function Oy(e,t={}){const{size:n}=t;typeof n<"u"&&Oo(e,n);const r=Ct(e,t);return Wf(r,t)}function Iy(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Oo(r,n),r=zf(r)),r.length>1||r[0]>1)throw new My(r);return!!r[0]}function nn(e,t={}){const{size:n}=t;typeof n<"u"&&Oo(e,n);const r=Ct(e,t);return Hf(r,t)}function ky(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Oo(r,n),r=Dy(r)),Sy.decode(r)}function zf(e){return Ff(e,{dir:"left"})}function Dy(e){return Ff(e,{dir:"right"})}class My extends te{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let Ly=class extends te{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"})}},By=class extends te{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 Fy=new TextEncoder,Ry=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function jy(e,t={}){const{strict:n=!1}=t;if(!e)throw new Gf(e);if(typeof e!="string")throw new Gf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new qf(e);if(!e.startsWith("0x"))throw new qf(e)}function Nt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function _y(e){return e instanceof Uint8Array?Ct(e):Array.isArray(e)?Ct(new Uint8Array(e)):e}function Uf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(As(n,t.size),Wn(n,t.size)):n}function Ct(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ry[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(As(r,t.size),Hn(r,t.size)):r}function Be(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 l=typeof e=="bigint"?"n":"";throw new Vf({max:s?`${s}${l}`:void 0,min:`${i}${l}`,signed:n,size:r,value:`${e}${l}`})}const a=`0x${(n&&o<0?BigInt.asUintN(r*8,BigInt(o)):o).toString(16)}`;return r?Wn(a,r):a}function Pa(e,t={}){return Ct(Fy.encode(e),t)}function Wn(e,t){return Rf(e,{dir:"left",size:t})}function Hn(e,t){return Rf(e,{dir:"right",size:t})}function jt(e,t,n,r={}){const{strict:o}=r;wy(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&xy(s,t,n),s}function nt(e){return Math.ceil((e.length-2)/2)}function Wf(e,t={}){const{signed:n}=t;t.size&&As(e,t.size);const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n)-1n,i=s>>1n;return r<=i?r:r-s-1n}function Hf(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:Wf(e,t))}function zy(e,t={}){const{strict:n=!1}=t;try{return jy(e,{strict:n}),!0}catch{return!1}}class Vf extends te{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 Gf extends te{constructor(t){super(`Value \`${typeof t=="object"?jf(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 qf extends te{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 Uy extends te{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 Zf extends te{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 Wy extends te{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 Hy(e){return{address:e.address,amount:Be(e.amount),index:Be(e.index),validatorIndex:Be(e.validatorIndex)}}function Kf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Be(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Be(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Be(e.gasLimit)},...typeof e.number=="bigint"&&{number:Be(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Be(e.prevRandao)},...typeof e.time=="bigint"&&{time:Be(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Hy)}}}const xr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],Ta=[{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"}]}],Yf=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],Xf=[...Yf,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Vy=[...Yf,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],Qf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Jf=[{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"}]}],ed=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],td=[{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"}],Er=[{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"}]}],Gy="0x82ad56cb",nd="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",qy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Zy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Aa="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class $a 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 rd extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const Na="/docs/contract/encodeDeployData";function Ca(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 Gb({docsPath:Na});if(!("inputs"in o))throw new fu({docsPath:Na});if(!o.inputs||o.inputs.length===0)throw new fu({docsPath:Na});const s=gn(o.inputs,n);return dr([r,s])}function Sr({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 $a({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new $a({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function od(e,{docsPath:t,...n}){const r=(()=>{const o=ys(e,n);return o instanceof So?e:o})();return new Ju(r,{docsPath:t,...n})}function sd(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Oa=new Map;function id({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const u=a();i();const f=u.map(({args:d})=>d);f.length!==0&&e(f).then(d=>{o&&Array.isArray(d)&&d.sort(o);for(let p=0;p<u.length;p++){const{resolve:h}=u[p];h==null||h([d[p],d])}}).catch(d=>{for(let p=0;p<u.length;p++){const{reject:h}=u[p];h==null||h(d)}})},i=()=>Oa.delete(t),c=()=>a().map(({args:u})=>u),a=()=>Oa.get(t)||[],l=u=>Oa.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:d,reject:p}=sd();return(n==null?void 0:n([...c(),u]))&&s(),a().length>0?(l({args:u,resolve:d,reject:p}),f):(l({args:u,resolve:d,reject:p}),setTimeout(s,r),f)}}}async function Pr(e,t){var O,k,y,C;const{account:n=e.account,authorizationList:r,batch:o=!!((O=e.batch)!=null&&O.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:l,code:u,data:f,factory:d,factoryData:p,gas:h,gasPrice:b,maxFeePerBlobGas:S,maxFeePerGas:P,maxPriorityFeePerGas:x,nonce:w,to:A,value:M,stateOverride:B,...F}=t,m=n?tt(n):void 0;if(u&&(d||p))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&A)throw new V("Cannot provide both `code` & `to` as parameters.");const g=u&&f,v=d&&p&&A&&f,$=g||v,N=g?ad({code:u,data:f}):v?Xy({data:f,factory:d,factoryData:p,to:A}):f;try{yr(t);const T=(typeof s=="bigint"?Q(s):void 0)||i,L=l?Kf(l):void 0,j=ia(B),z=(C=(y=(k=e.chain)==null?void 0:k.formatters)==null?void 0:y.transactionRequest)==null?void 0:C.format,H=(z||Po)({...vs(F,{format:z}),accessList:c,account:m,authorizationList:r,blobs:a,data:N,gas:h,gasPrice:b,maxFeePerBlobGas:S,maxFeePerGas:P,maxPriorityFeePerGas:x,nonce:w,to:$?void 0:A,value:M},"call");if(o&&Ky({request:H})&&!j&&!L)try{return await Yy(e,{...H,blockNumber:s,blockTag:i})}catch(W){if(!(W instanceof rd)&&!(W instanceof $a))throw W}const Y=(()=>{const W=[H,T];return j&&L?[...W,j,L]:j?[...W,j]:L?[...W,{},L]:W})(),G=await e.request({method:"eth_call",params:Y});return G==="0x"?{data:void 0}:{data:G}}catch(I){const T=Qy(I),{offchainLookup:L,offchainLookupSignature:j}=await Promise.resolve().then(()=>Xv);if(e.ccipRead!==!1&&(T==null?void 0:T.slice(0,10))===j&&A)return{data:await L(e,{data:T,to:A})};throw $&&(T==null?void 0:T.slice(0,10))==="0x101bb98d"?new Ng({factory:d}):od(I,{...t,account:m,chain:e.chain})}}function Ky({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Gy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Yy(e,t){var b;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((b=e.batch)==null?void 0:b.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:c,to:a}=t,l=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Sr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new rd})(),f=(typeof s=="bigint"?Q(s):void 0)||i,{schedule:d}=id({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(S){return S.reduce((x,{data:w})=>x+(w.length-2),0)>n*2},fn:async S=>{const P=S.map(A=>({allowFailure:!0,callData:A.data,target:A.to})),x=lt({abi:xr,args:[P],functionName:"aggregate3"}),w=await e.request({method:"eth_call",params:[{...l===null?{data:ad({code:Aa,data:x})}:{to:l,data:x}},f]});return xn({abi:xr,args:[P],functionName:"aggregate3",data:w||"0x"})}}),[{returnData:p,success:h}]=await d({data:c,to:a});if(!h)throw new ms({data:p});return p==="0x"?{data:void 0}:{data:p}}function ad(e){const{code:t,data:n}=e;return Ca({abi:iu(["constructor(bytes, bytes)"]),bytecode:nd,args:[t,n]})}function Xy(e){const{data:t,factory:n,factoryData:r,to:o}=e;return Ca({abi:iu(["constructor(address, bytes, address, bytes)"]),bytecode:qy,args:[o,t,n,r]})}function Qy(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 Ot(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=lt({abi:n,args:o,functionName:s});try{const{data:a}=await X(e,Pr,"call")({...i,data:c,to:r});return xn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw br(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Jy(e,t){var u;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...c}=t,a=c.account?tt(c.account):e.account,l=lt({abi:n,args:o,functionName:s});try{const{data:f}=await X(e,Pr,"call")({batch:!1,data:`${l}${i?i.replace("0x",""):""}`,to:r,...c,account:a}),d=xn({abi:n,args:o,functionName:s,data:f||"0x"}),p=n.filter(h=>"name"in h&&h.name===t.functionName);return{result:d,request:{abi:p,address:r,args:o,dataSuffix:i,functionName:s,...c,account:a}}}catch(f){throw br(f,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:a==null?void 0:a.address})}}const Ia=new Map,cd=new Map;let ev=0;function En(e,t,n){const r=++ev,o=()=>Ia.get(e)||[],s=()=>{const u=o();Ia.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(d=>d.id===r))return;const f=cd.get(e);if(u.length===1&&f){const d=f();d instanceof Promise&&d.catch(()=>{})}s()},c=o();if(Ia.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const u in t)a[u]=(...f)=>{var p,h;const d=o();if(d.length!==0)for(const b of d)(h=(p=b.fns)[u])==null||h.call(p,...f)};const l=n(a);return typeof l=="function"&&cd.set(e,l),i}async function ka(e){return new Promise(t=>setTimeout(t,e))}function Io(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 ka(a);const l=async()=>{o&&(await e({unpoll:s}),await ka(r),l())};l()})(),s}const tv=new Map,nv=new Map;function rv(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,tv),r=t(e,nv);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function ov(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=rv(t),o=r.response.get();if(o&&n>0&&Date.now()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const sv=e=>`blockNumber.${e}`;async function ko(e,{cacheTime:t=e.cacheTime}={}){const n=await ov(()=>e.request({method:"eth_blockNumber"}),{cacheKey:sv(e.uid),cacheTime:t});return BigInt(n)}async function $s(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=>Rt(s));return!("abi"in t)||!t.abi?o:ma({abi:t.abi,logs:o,strict:n})}async function Ns(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function iv(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:l,poll:u,pollingInterval:f=e.pollingInterval,strict:d}=t;return(typeof u<"u"?u: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 S=d??!1,P=$e(["watchContractEvent",r,o,s,e.uid,i,f,S,c]);return En(P,{onLogs:l,onError:a},x=>{let w;c!==void 0&&(w=c-1n);let A,M=!1;const B=Io(async()=>{var F;if(!M){try{A=await X(e,Uu,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:S,fromBlock:c})}catch{}M=!0;return}try{let m;if(A)m=await X(e,$s,"getFilterChanges")({filter:A});else{const g=await X(e,ko,"getBlockNumber")({});w&&w<g?m=await X(e,$f,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:w+1n,toBlock:g,strict:S}):m=[],w=g}if(m.length===0)return;if(s)x.onLogs(m);else for(const g of m)x.onLogs([g])}catch(m){A&&m instanceof yn&&(M=!1),(F=x.onError)==null||F.call(x,m)}},{emitOnBegin:!0,interval:f});return async()=>{A&&await X(e,Ns,"uninstallFilter")({filter:A}),B()}})})():(()=>{const S=d??!1,P=$e(["watchContractEvent",r,o,s,e.uid,i,f,S]);let x=!0,w=()=>x=!1;return En(P,{onLogs:l,onError:a},A=>((async()=>{try{const M=(()=>{if(e.transport.type==="fallback"){const m=e.transport.transports.find(g=>g.config.type==="webSocket"||g.config.type==="ipc");return m?m.value:e.transport}return e.transport})(),B=i?Yr({abi:n,eventName:i,args:o}):[],{unsubscribe:F}=await M.subscribe({params:["logs",{address:r,topics:B}],onData(m){var v;if(!x)return;const g=m.result;try{const{eventName:$,args:N}=ws({abi:n,data:g.data,topics:g.topics,strict:d}),O=Rt(g,{args:N,eventName:$});A.onLogs([O])}catch($){let N,O;if($ instanceof cs||$ instanceof Li){if(d)return;N=$.abiItem.name,O=(v=$.abiItem.inputs)==null?void 0:v.some(y=>!("name"in y&&y.name))}const k=Rt(g,{args:O?[]:{},eventName:N});A.onLogs([k])}},onError(m){var g;(g=A.onError)==null||g.call(A,m)}});w=F,x||w()}catch(M){a==null||a(M)}})(),()=>w()))})()}async function av(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Da(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:l})=>{const u=typeof t=="function"?t({count:c,error:l}):t;u&&await ka(u),i({count:c+1})};try{const l=await e();o(l)}catch(l){if(c<n&&await r({count:c,error:l}))return a({error:l});s(l)}};i()})}const cv={"0x0":"reverted","0x1":"success"};function ld(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Rt(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Yt(e.transactionIndex):null,status:e.status?cv[e.status]:null,type:e.type?df[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Ma=256;let Cs=Ma,Os;function ud(e=11){if(!Os||Cs+e>Ma*2){Os="",Cs=0;for(let t=0;t<Ma;t++)Os+=(256+Math.random()*256|0).toString(16).substring(1)}return Os.substring(Cs,Cs+++e)}function lv(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:o,key:s="base",name:i="Base Client",type:c="base"}=e,a=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),l=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(l/2),500),4e3),f=e.pollingInterval??u,d=e.cacheTime??f,p=e.account?tt(e.account):void 0,{config:h,request:b,value:S}=e.transport({account:p,chain:n,pollingInterval:f}),P={...h,...S},x={account:p,batch:t,cacheTime:d,ccipRead:r,chain:n,dataSuffix:o,key:s,name:i,pollingInterval:f,request:b,transport:P,type:c,uid:ud(),...a?{experimental_blockTag:a}:{}};function w(A){return M=>{const B=M(A);for(const m in x)delete B[m];const F={...A,...B};return Object.assign(F,{extend:w(F)})}}return Object.assign(x,{extend:w(x)})}function La(e){var n,r,o,s,i,c;if(!(e instanceof V))return!1;const t=e.walk(a=>a instanceof Yi);return t instanceof Yi?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((c=t.data)==null?void 0:c.errorName)==="UnsupportedResolverProfile":!1}function uv(e){const{abi:t,data:n}=e,r=Fn(n,0,4),o=t.find(s=>s.type==="function"&&r===Kr(St(s)));if(!o)throw new Jb(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Xr(o.inputs,Fn(n,4)):void 0}}const Ba="/docs/contract/encodeErrorResult";function fd(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Rn({abi:t,args:r,name:n});if(!a)throw new pu(n,{docsPath:Ba});o=a}if(o.type!=="error")throw new pu(void 0,{docsPath:Ba});const s=St(o),i=Kr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new Yb(o.name,{docsPath:Ba});c=gn(o.inputs,r)}return dr([i,c])}const Fa="/docs/contract/encodeFunctionResult";function fv(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Rn({abi:t,name:n});if(!i)throw new ir(n,{docsPath:Fa});o=i}if(o.type!=="function")throw new ir(void 0,{docsPath:Fa});if(!o.outputs)throw new bu(o.name,{docsPath:Fa});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new gu(r)})();return gn(o.outputs,s)}const Do="x-batch-gateway:true";async function dd(e){const{data:t,ccipRequest:n}=e,{args:[r]}=uv({abi:Ta,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(Do)?await dd({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=dv(a)}})),fv({abi:Ta,functionName:"query",result:[o,s]})}function dv(e){return e.name==="HttpRequestError"&&e.status?fd({abi:Ta,errorName:"HttpError",args:[e.status,e.shortMessage]}):fd({abi:[Hu],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function pd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Pt(t)?t:null}function Ra(e){let t=new Uint8Array(32).fill(0);if(!e)return Ae(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=pd(n[r]),s=o?cr(o):ke(Ln(n[r]),"bytes");t=ke(At([t,s]),"bytes")}return Ae(t)}function pv(e){return`[${e.slice(2)}]`}function hv(e){const t=new Uint8Array(32).fill(0);return e?pd(e)||ke(Ln(e)):Ae(t)}function ja(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Ln(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Ln(o[s]);i.byteLength>255&&(i=Ln(pv(hv(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 mv(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Sr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(d=>s.endsWith(d)))return null;const f=o!=null?[Ra(s),BigInt(o)]:[Ra(s)];try{const d=lt({abi:Jf,functionName:"addr",args:f}),p={address:l,abi:Xf,functionName:"resolveWithGateways",args:[mn(ja(s)),d,i??[Do]],blockNumber:n,blockTag:r},b=await X(e,Ot,"readContract")(p);if(b[0]==="0x")return null;const S=xn({abi:Jf,args:f,functionName:"addr",data:b[0]});return S==="0x"||Mn(S)==="0x00"?null:S}catch(d){if(c)throw d;if(La(d))return null;throw d}}class bv 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 Mo extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class _a 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 gv extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const yv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,vv=/^(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>\/.*)?$/,wv=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,xv=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Ev(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function hd(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function md({uri:e,gatewayUrls:t}){const n=wv.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=hd(t==null?void 0:t.ipfs,"https://ipfs.io"),o=hd(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(yv),{protocol:i,subpath:c,target:a,subtarget:l=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||vv.test(e);if(e.startsWith("http")&&!u&&!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((u||f)&&a)return{uri:`${r}/${u?"ipns":"ipfs"}/${a}${l}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${l||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(xv,"");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 _a({uri:e})}function bd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new bv({data:e});return e.image||e.image_url||e.image_data}async function Sv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await za({gatewayUrls:e,uri:bd(n)})}catch{throw new _a({uri:t})}}async function za({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=md({uri:t,gatewayUrls:e});if(r||await Ev(n))return n;throw new _a({uri:t})}function Pv(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 Mo({reason:"Only EIP-155 supported"});if(!i)throw new Mo({reason:"Chain ID not found"});if(!a)throw new Mo({reason:"Contract address not found"});if(!o)throw new Mo({reason:"Token ID not found"});if(!c)throw new Mo({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function Tv(e,{nft:t}){if(t.namespace==="erc721")return Ot(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 Ot(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 gv({namespace:t.namespace})}async function Av(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?$v(e,{gatewayUrls:t,record:n}):za({uri:n,gatewayUrls:t})}async function $v(e,{gatewayUrls:t,record:n}){const r=Pv(n),o=await Tv(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=md({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const l=c?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(l);return za({uri:bd(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Sv({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function gd(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Sr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(f=>s.endsWith(f)))return null;try{const f={address:l,abi:Xf,args:[mn(ja(s)),lt({abi:Qf,functionName:"text",args:[Ra(s),o]}),i??[Do]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},p=await X(e,Ot,"readContract")(f);if(p[0]==="0x")return null;const h=xn({abi:Qf,functionName:"text",data:p[0]});return h===""?null:h}catch(f){if(c)throw f;if(La(f))return null;throw f}}async function Nv(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await X(e,gd,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await Av(e,{record:a,gatewayUrls:r})}catch{return null}}async function Cv(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Sr({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const u={address:l,abi:Vy,args:[n,s,i??[Do]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=X(e,Ot,"readContract"),[d]=await f(u);return d||null}catch(u){if(c)throw u;if(La(u))return null;throw u}}async function Ov(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 Sr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(l=>o.endsWith(l)))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 X(e,Ot,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[mn(ja(o))],blockNumber:n,blockTag:r});return a}async function yd(e,t){var S,P,x;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:d,value:p,...h}=t,b=n?tt(n):void 0;try{yr(t);const A=(typeof r=="bigint"?Q(r):void 0)||o,M=(x=(P=(S=e.chain)==null?void 0:S.formatters)==null?void 0:P.transactionRequest)==null?void 0:x.format,F=(M||Po)({...vs(h,{format:M}),account:b,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:d,value:p},"createAccessList"),m=await e.request({method:"eth_createAccessList",params:[F,A]});return{accessList:m.accessList,gasUsed:BigInt(m.gasUsed)}}catch(w){throw od(w,{...t,account:b,chain:e.chain})}}async function Iv(e){const t=hs(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function vd(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),l=hs(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(p=>Yr({abi:[p],eventName:p.name,args:n}))],r&&(u=u[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?Q(s):s,toBlock:typeof c=="bigint"?Q(c):c,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:l(f),strict:!!i,toBlock:c,type:"event"}}async function wd(e){const t=hs(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function kv(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var i,c,a;if((i=e.batch)!=null&&i.multicall&&((a=(c=e.chain)==null?void 0:c.contracts)!=null&&a.multicall3)){const l=e.chain.contracts.multicall3.address,u=lt({abi:xr,functionName:"getEthBalance",args:[t]}),{data:f}=await X(e,Pr,"call")({to:l,data:u,blockNumber:n,blockTag:r});return xn({abi:xr,functionName:"getEthBalance",args:[t],data:f||"0x"})}const o=typeof n=="bigint"?Q(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Dv(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Mv(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?Q(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}),Yt(s)}async function Is(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?Q(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}async function Lv(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=await Is(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(o&&ve(o)===23&&o.startsWith("0xef0100"))return Qt(Fn(o,3,23))}class Bv 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 Fv(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,l,u,f]=await X(e,Ot,"readContract")({abi:Rv,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:l,salt:u},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Bv({address:n}):i}}const Rv=[{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 jv(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 _v(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?Q(n):void 0,i=await e.request({method:"eth_feeHistory",params:[Q(t),s||r,o]},{dedupe:!!s});return jv(i)}async function zv(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Rt(s));return t.abi?ma({abi:t.abi,logs:o,strict:n}):o}async function Uv({address:e,authorization:t,signature:n}){return To(Qt(e),await af({authorization:t,signature:n}))}const ks=new ds(8192);function Wv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(ks.get(n))return ks.get(n);const r=e().finally(()=>ks.delete(n));return ks.set(n,r),r}function Hv(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:l}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(l))throw new zn(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new zn(new Error("method not supported"),{method:l});const u=o?Gr(`${a}.${$e(n)}`):void 0;return Wv(()=>Da(async()=>{try{return await e(n)}catch(d){const p=d;switch(p.code){case to.code:throw new to(p);case no.code:throw new no(p);case ro.code:throw new ro(p,{method:n.method});case oo.code:throw new oo(p);case _n.code:throw new _n(p);case yn.code:throw new yn(p);case so.code:throw new so(p);case io.code:throw new io(p);case ao.code:throw new ao(p);case zn.code:throw new zn(p,{method:n.method});case hr.code:throw new hr(p);case co.code:throw new co(p);case mr.code:throw new mr(p);case lo.code:throw new lo(p);case uo.code:throw new uo(p);case fo.code:throw new fo(p);case po.code:throw new po(p);case ho.code:throw new ho(p);case mo.code:throw new mo(p);case bo.code:throw new bo(p);case go.code:throw new go(p);case yo.code:throw new yo(p);case vo.code:throw new vo(p);case wo.code:throw new wo(p);case xo.code:throw new xo(p);case 5e3:throw new mr(p);case Eo.code:throw new Eo(p);default:throw d instanceof V?d:new Og(p)}}},{delay:({count:d,error:p})=>{var h;if(p&&p instanceof jn){const b=(h=p==null?void 0:p.headers)==null?void 0:h.get("Retry-After");if(b!=null&&b.match(/\d/))return Number.parseInt(b,10)*1e3}return~~(1<<d)*i},retryCount:c,shouldRetry:({error:d})=>Vv(d)}),{enabled:o,id:u})}}function Vv(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===hr.code||e.code===_n.code:e instanceof jn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class Gv 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=>` ${eo(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class qv extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${eo(n)}`,`Response: ${$e(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Zv 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 Kv="0x556f1830",xd={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 Yv(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Zu({data:r,abi:[xd]}),[i,c,a,l,u]=s,{ccipRead:f}=e,d=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Ed;try{if(!To(o,i))throw new Zv({sender:i,to:o});const p=c.includes(Do)?await dd({data:a,ccipRequest:d}):await d({data:a,sender:i,urls:c}),{data:h}=await Pr(e,{blockNumber:t,blockTag:n,data:At([l,gn([{type:"bytes"},{type:"bytes"}],[p,u])]),to:o});return h}catch(p){throw new Gv({callbackSelector:l,cause:p,data:r,extraData:u,sender:i,urls:c})}}async function Ed({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,l=c==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:l,method:c});let f;if((o=u.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await u.json()).data:f=await u.text(),!u.ok){r=new jn({body:a,details:f!=null&&f.error?$e(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!Pt(f)){r=new qv({result:f,url:i});continue}return f}catch(u){r=new jn({body:a,details:u.message,url:i})}}throw r}const Xv=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Ed,offchainLookup:Yv,offchainLookupAbiItem:xd,offchainLookupSignature:Kv},Symbol.toStringTag,{value:"Module"}));function Qv(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return o=>{const s=typeof o=="function"?o(r):o,i={...r,...s};return Object.assign(i,{extend:n(i)})}}return Object.assign(t,{extend:n(t)})}function Jv(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 ew(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Sd=ew();function tw(e,t={}){const{url:n,headers:r}=nw(e);return{async request(o){var h;const{body:s,fetchFn:i=t.fetchFn??fetch,onRequest:c=t.onRequest,onResponse:a=t.onResponse,timeout:l=t.timeout??1e4}=o,u={...t.fetchOptions??{},...o.fetchOptions??{}},{headers:f,method:d,signal:p}=u;try{const b=await Jv(async({signal:P})=>{const x={...u,body:Array.isArray(s)?$e(s.map(B=>({jsonrpc:"2.0",id:B.id??Sd.take(),...B}))):$e({jsonrpc:"2.0",id:s.id??Sd.take(),...s}),headers:{...r,"Content-Type":"application/json",...f},method:d||"POST",signal:p||(l>0?P:null)},w=new Request(n,x),A=await(c==null?void 0:c(w,x))??{...x,url:n};return await i(A.url??n,A)},{errorInstance:new tf({body:s,url:n}),timeout:l,signal:!0});a&&await a(b);let S;if((h=b.headers.get("Content-Type"))!=null&&h.startsWith("application/json"))S=await b.json();else{S=await b.text();try{S=JSON.parse(S||"{}")}catch(P){if(b.ok)throw P;S={error:S}}}if(!b.ok)throw new jn({body:s,details:$e(S.error)||b.statusText,headers:b.headers,status:b.status,url:n});return S}catch(b){throw b instanceof jn||b instanceof tf?b:new jn({body:s,cause:b,url:n})}}}}function nw(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const rw=`Ethereum Signed Message:
89
- `;function ow(e){const t=typeof e=="string"?Gr(e):typeof e.raw=="string"?e.raw:Ae(e.raw),n=Gr(`${rw}${ve(t)}`);return At([n,t])}function Pd(e,t){return ke(ow(e),t)}class sw extends V{constructor({domain:t}){super(`Invalid domain "${$e(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class iw 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 aw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function cw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:l,type:u}=a,f=c[l],d=u.match(Ru);if(d&&(typeof f=="number"||typeof f=="bigint")){const[b,S,P]=d;Q(f,{signed:S==="int",size:Number.parseInt(P,10)/8})}if(u==="address"&&typeof f=="string"&&!ct(f))throw new bn({address:f});const p=u.match(q1);if(p){const[b,S]=p;if(S&&ve(f)!==Number.parseInt(S,10))throw new t1({expectedSize:Number.parseInt(S,10),givenSize:ve(f)})}const h=o[u];h&&(uw(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new sw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new iw({primaryType:r,types:o})}function lw({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 uw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new aw({type:e})}function fw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:lw({domain:t}),...e.types};cw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(dw({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Td({data:n,primaryType:r,types:o})),ke(At(s))}function dw({domain:e,types:t}){return Td({data:e,primaryType:"EIP712Domain",types:t})}function Td({data:e,primaryType:t,types:n}){const r=Ad({data:e,primaryType:t,types:n});return ke(r)}function Ad({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[pw({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Nd({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return gn(r,o)}function pw({primaryType:e,types:t}){const n=mn(hw({primaryType:e,types:t}));return ke(n)}function hw({primaryType:e,types:t}){let n="";const r=$d({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 $d({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])$d({primaryType:s.type,types:t},n);return n}function Nd({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},ke(Ad({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},ke(r)];if(n==="string")return[{type:"bytes32"},ke(mn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Nd({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},ke(gn(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class mw 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 Ua={checksum:new mw(8192)}.checksum;class Cd extends Ri{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,S1(t);const r=us(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),fr(s)}update(t){return ur(this),this.iHash.update(t),this}digestInto(t){ur(this),Bn(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 Od=(e,t,n)=>new Cd(e,t).update(n).digest();Od.create=(e,t)=>new Cd(e,t);function Id(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Du(Ty(e));return n==="Bytes"?r:Ct(r)}const bw=/^0x[a-fA-F0-9]{40}$/;function Ds(e,t={}){const{strict:n=!0}=t;if(!bw.test(e))throw new Dd({address:e,cause:new gw});if(n){if(e.toLowerCase()===e)return;if(kd(e)!==e)throw new Dd({address:e,cause:new yw})}}function kd(e){if(Ua.has(e))return Ua.get(e);Ds(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Id($y(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const o=`0x${r.join("")}`;return Ua.set(e,o),o}function Wa(e,t={}){const{strict:n=!0}=t??{};try{return Ds(e,{strict:n}),!0}catch{return!1}}class Dd extends te{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 gw extends te{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 yw extends te{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const vw=/^(.*)\[([0-9]*)\]$/,ww=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Md=/^(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)?$/,Ld=2n**256n-1n;function Tr(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=qa(t.type);if(s){const[i,c]=s;return Ew(e,{...t,type:c},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return Aw(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return xw(e,{checksum:r});if(t.type==="bool")return Sw(e);if(t.type.startsWith("bytes"))return Pw(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Tw(e,t);if(t.type==="string")return $w(e,{staticPosition:o});throw new Ya(t.type)}const Bd=32,Ha=32;function xw(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?kd(s):s)(Ct(Cy(r,-20))),32]}function Ew(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=nn(e.readBytes(Ha)),l=s+a,u=l+Bd;e.setPosition(l);const f=nn(e.readBytes(Bd)),d=Lo(t);let p=0;const h=[];for(let b=0;b<f;++b){e.setPosition(u+(d?b*32:p));const[S,P]=Tr(e,t,{checksumAddress:r,staticPosition:u});p+=P,h.push(S)}return e.setPosition(s+32),[h,32]}if(Lo(t)){const a=nn(e.readBytes(Ha)),l=s+a,u=[];for(let f=0;f<o;++f){e.setPosition(l+f*32);const[d]=Tr(e,t,{checksumAddress:r,staticPosition:l});u.push(d)}return e.setPosition(s+32),[u,32]}let i=0;const c=[];for(let a=0;a<o;++a){const[l,u]=Tr(e,t,{checksumAddress:r,staticPosition:s+i});i+=u,c.push(l)}return[c,i]}function Sw(e){return[Iy(e.readBytes(32),{size:32}),32]}function Pw(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=nn(e.readBytes(32));e.setPosition(n+i);const c=nn(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Ct(a),32]}return[Ct(e.readBytes(Number.parseInt(o,10),32)),32]}function Tw(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?Oy(o,{signed:n}):nn(o,{signed:n}),32]}function Aw(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let c=0;if(Lo(t)){const a=nn(e.readBytes(Ha)),l=o+a;for(let u=0;u<t.components.length;++u){const f=t.components[u];e.setPosition(l+c);const[d,p]=Tr(e,f,{checksumAddress:r,staticPosition:l});c+=p,i[s?u:f==null?void 0:f.name]=d}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const l=t.components[a],[u,f]=Tr(e,l,{checksumAddress:r,staticPosition:o});i[s?a:l==null?void 0:l.name]=u,c+=f}return[i,c]}function $w(e,{staticPosition:t}){const n=nn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=nn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=ky(zf(s));return e.setPosition(t+32),[i,32]}function Nw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Va({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Va({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=qa(r.type);if(o){const[s,i]=o;return Ow(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Lw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Cw(n,{checksum:e});if(r.type==="bool")return kw(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Md.exec(r.type)??[];return Dw(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Iw(n,{type:r.type});if(r.type==="string")return Mw(n);throw new Ya(r.type)}function Ga(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(Be(t+o,{size:32})),r.push(c),o+=nt(c)):n.push(c)}return Nt(...n,...r)}function Cw(e,t){const{checksum:n=!1}=t;return Ds(e,{strict:n}),{dynamic:!1,encoded:Wn(e.toLowerCase())}}function Ow(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new Hw(e);if(!s&&e.length!==r)throw new Ww({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const l=Va({checksumAddress:n,parameter:o,value:e[a]});l.dynamic&&(i=!0),c.push(l)}if(s||i){const a=Ga(c);if(s){const l=Be(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Nt(l,a):l}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Nt(...c.map(({encoded:a})=>a))}}function Iw(e,{type:t}){const[,n]=t.split("bytes"),r=nt(e);if(!n){let o=e;return r%32!==0&&(o=Hn(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Nt(Wn(Be(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new jd({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Hn(e)}}function kw(e){if(typeof e!="boolean")throw new te(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Wn(Uf(e))}}function Dw(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 Vf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Be(e,{size:32,signed:t})}}function Mw(e){const t=Pa(e),n=Math.ceil(nt(t)/32),r=[];for(let o=0;o<n;o++)r.push(Hn(jt(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Nt(Hn(Be(nt(t),{size:32})),...r)}}function Lw(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,l=Va({checksumAddress:n,parameter:c,value:e[a]});s.push(l),l.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Ga(s):Nt(...s.map(({encoded:i})=>i))}}function qa(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Lo(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(Lo);const n=qa(e.type);return!!(n&&Lo({...e,type:n[1]}))}const Bw={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 jw({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Rw({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Fd({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 Fd({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 Fw(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Bw);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Fd extends te{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Rw extends te{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class jw extends te{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function _w(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?_f(t):t,i=Fw(s);if(wr(s)===0&&e.length>0)throw new Uw;if(wr(s)&&wr(s)<32)throw new zw({data:typeof t=="string"?t:Ct(t),parameters:e,size:wr(s)});let c=0;const a=r==="Array"?[]:{};for(let l=0;l<e.length;++l){const u=e[l];i.setPosition(c);const[f,d]=Tr(i,u,{checksumAddress:o,staticPosition:0});c+=d,r==="Array"?a.push(f):a[u.name??l]=f}return a}function Za(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new _d({expectedLength:e.length,givenLength:t.length});const o=Nw({checksumAddress:r,parameters:e,values:t}),s=Ga(o);return s.length===0?"0x":s}function Ka(e,t){if(e.length!==t.length)throw new _d({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(Ka.encode(o,s))}return Nt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Ds(a),Wn(a.toLowerCase(),o?32:0)}if(n==="string")return Pa(r);if(n==="bytes")return r;if(n==="bool")return Wn(Uf(r),o?32:1);const s=n.match(Md);if(s){const[a,l,u="256"]=s,f=Number.parseInt(u,10)/8;return Be(r,{size:o?32:f,signed:l==="int"})}const i=n.match(ww);if(i){const[a,l]=i;if(Number.parseInt(l,10)!==(r.length-2)/2)throw new jd({expectedSize:Number.parseInt(l,10),value:r});return Hn(r,o?32:0)}const c=n.match(vw);if(c&&Array.isArray(r)){const[a,l]=c,u=[];for(let f=0;f<r.length;f++)u.push(t(l,r[f],!0));return u.length===0?"0x":Nt(...u)}throw new Ya(n)}e.encode=t})(Ka||(Ka={}));function Rd(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?cu(e):e}class zw extends te{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${or(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Uw extends te{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Ww extends te{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 jd extends te{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 _d extends te{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
90
- `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Hw extends te{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class Ya extends te{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ve=BigInt(0),Fe=BigInt(1),Vn=BigInt(2),Vw=BigInt(3),zd=BigInt(4),Ud=BigInt(5),Wd=BigInt(8);function Ge(e,t){const n=e%t;return n>=Ve?n:t+n}function ft(e,t,n){let r=e;for(;t-- >Ve;)r*=r,r%=n;return r}function Xa(e,t){if(e===Ve)throw new Error("invert: expected non-zero number");if(t<=Ve)throw new Error("invert: expected positive modulus, got "+t);let n=Ge(e,t),r=t,o=Ve,s=Fe;for(;n!==Ve;){const c=r/n,a=r%n,l=o-s*c;r=n,n=a,o=s,s=l}if(r!==Fe)throw new Error("invert: does not exist");return Ge(o,t)}function Hd(e,t){const n=(e.ORDER+Fe)/zd,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Gw(e,t){const n=(e.ORDER-Ud)/Wd,r=e.mul(t,Vn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Vn),o),c=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(c),t))throw new Error("Cannot find square root");return c}function qw(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Fe,n=0;for(;t%Vn===Ve;)t/=Vn,n++;let r=Vn;const o=Qa(e);for(;Gd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Hd;let s=o.pow(r,t);const i=(t+Fe)/Vn;return function(a,l){if(a.is0(l))return l;if(Gd(a,l)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),d=a.pow(l,t),p=a.pow(l,i);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let h=1,b=a.sqr(d);for(;!a.eql(b,a.ONE);)if(h++,b=a.sqr(b),h===u)throw new Error("Cannot find square root");const S=Fe<<BigInt(u-h-1),P=a.pow(f,S);u=h,f=a.sqr(P),d=a.mul(d,f),p=a.mul(p,P)}return p}}function Zw(e){return e%zd===Vw?Hd:e%Wd===Ud?Gw:qw(e)}const Kw=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Yw(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Kw.reduce((r,o)=>(r[o]="function",r),t);return Ts(e,n)}function Xw(e,t,n){if(n<Ve)throw new Error("invalid exponent, negatives unsupported");if(n===Ve)return e.ONE;if(n===Fe)return t;let r=e.ONE,o=t;for(;n>Ve;)n&Fe&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Fe;return r}function Vd(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 Gd(e,t){const n=(e.ORDER-Fe)/Vn,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 qd(e,t){t!==void 0&&qr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Qa(e,t,n=!1,r={}){if(e<=Ve)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=qd(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const c=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:Ps(o),ZERO:Ve,ONE:Fe,create:a=>Ge(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return Ve<=a&&a<e},is0:a=>a===Ve,isOdd:a=>(a&Fe)===Fe,neg:a=>Ge(-a,e),eql:(a,l)=>a===l,sqr:a=>Ge(a*a,e),add:(a,l)=>Ge(a+l,e),sub:(a,l)=>Ge(a-l,e),mul:(a,l)=>Ge(a*l,e),pow:(a,l)=>Xw(c,a,l),div:(a,l)=>Ge(a*Xa(l,e),e),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>Xa(a,e),sqrt:r.sqrt||(a=>(i||(i=Zw(e)),i(c,a))),toBytes:a=>n?kf(a,s):Co(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?If(a):Un(a)},invertBatch:a=>Vd(c,a),cmov:(a,l,u)=>u?l:a});return Object.freeze(c)}function Zd(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 Kd(e){const t=Zd(e);return t+Math.ceil(t/2)}function Qw(e,t,n=!1){const r=e.length,o=Zd(t),s=Kd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?If(e):Un(e),c=Ge(i,t-Fe)+Fe;return n?kf(c,o):Co(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Yd=BigInt(0),Ja=BigInt(1);function ec(e,t){const n=t.negate();return e?n:t}function Xd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function tc(e,t){Xd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Ps(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Qd(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+=Ja);const l=t*r,u=l+Math.abs(c)-1,f=c===0,d=c<0,p=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:d,isNegF:p,offsetF:l}}function Jw(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 e6(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 nc=new WeakMap,Jd=new WeakMap;function rc(e){return Jd.get(e)||1}function t6(e,t){return{constTimeNegate:ec,hasPrecomputes(n){return rc(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>Yd;)r&Ja&&(o=o.add(s)),s=s.double(),r>>=Ja;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=tc(r,t),i=[];let c=n,a=c;for(let l=0;l<o;l++){a=c,i.push(a);for(let u=1;u<s;u++)a=a.add(c),i.push(a);c=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const c=tc(n,t);for(let a=0;a<c.windows;a++){const{nextN:l,offset:u,isZero:f,isNeg:d,isNegF:p,offsetF:h}=Qd(o,a,c);o=l,f?i=i.add(ec(p,r[h])):s=s.add(ec(d,r[u]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=tc(n,t);for(let c=0;c<i.windows&&o!==Yd;c++){const{nextN:a,offset:l,isZero:u,isNeg:f}=Qd(o,c,i);if(o=a,!u){const d=r[l];s=s.add(f?d.negate():d)}}return s},getPrecomputes(n,r,o){let s=nc.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&nc.set(r,o(s))),s},wNAFCached(n,r,o){const s=rc(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=rc(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){Xd(r,t),Jd.set(n,r),nc.delete(n)}}}function n6(e,t,n,r){Jw(n,e),e6(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=hy(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const l=Ps(a),u=new Array(Number(l)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let d=i;for(let p=f;p>=0;p-=a){u.fill(i);for(let b=0;b<s;b++){const S=r[b],P=Number(S>>BigInt(p)&l);u[P]=u[P].add(n[b])}let h=i;for(let b=u.length-1,S=i;b>0;b--)S=S.add(u[b]),h=h.add(S);if(d=d.add(h),p!==0)for(let b=0;b<a;b++)d=d.double()}return d}function e0(e){return Yw(e.Fp),Ts(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...qd(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function t0(e){e.lowS!==void 0&&$o("lowS",e.lowS),e.prehash!==void 0&&$o("prehash",e.prehash)}function r6(e){const t=e0(e);Ts(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}class o6 extends Error{constructor(t=""){super(t)}}const rn={Err:o6,_tlv:{encode:(e,t)=>{const{Err:n}=rn;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=xs(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?xs(o.length/2|128):"";return xs(e)+s+o+t},decode(e,t){const{Err:n}=rn;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 l=t.subarray(r,r+a);if(l.length!==a)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)i=i<<8|u;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}=rn;if(e<on)throw new t("integer: negative integers are not allowed");let n=xs(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}=rn;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 Un(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=rn,o=ut("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:l,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=rn,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}};function oc(e,t){return No(Co(e,t))}const on=BigInt(0),Oe=BigInt(1);BigInt(2);const sc=BigInt(3),s6=BigInt(4);function i6(e){const t=r6(e),{Fp:n}=t,r=Qa(t.n,t.nBitLength),o=t.toBytes||((w,A,M)=>{const B=A.toAffine();return Ss(Uint8Array.from([4]),n.toBytes(B.x),n.toBytes(B.y))}),s=t.fromBytes||(w=>{const A=w.subarray(1),M=n.fromBytes(A.subarray(0,n.BYTES)),B=n.fromBytes(A.subarray(n.BYTES,2*n.BYTES));return{x:M,y:B}});function i(w){const{a:A,b:M}=t,B=n.sqr(w),F=n.mul(B,w);return n.add(n.add(F,n.mul(w,A)),M)}function c(w,A){const M=n.sqr(A),B=i(w);return n.eql(M,B)}if(!c(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,sc),s6),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,l)))throw new Error("bad curve params: a or b");function u(w){return Ea(w,Oe,t.n)}function f(w){const{allowedPrivateKeyLengths:A,nByteLength:M,wrapPrivateKey:B,n:F}=t;if(A&&typeof w!="bigint"){if(Ao(w)&&(w=No(w)),typeof w!="string"||!A.includes(w.length))throw new Error("invalid private key");w=w.padStart(M*2,"0")}let m;try{m=typeof w=="bigint"?w:Un(ut("private key",w,M))}catch{throw new Error("invalid private key, expected hex or "+M+" bytes, got "+typeof w)}return B&&(m=Ge(m,F)),vr("private key",m,Oe,F),m}function d(w){if(!(w instanceof b))throw new Error("ProjectivePoint expected")}const p=Mf((w,A)=>{const{px:M,py:B,pz:F}=w;if(n.eql(F,n.ONE))return{x:M,y:B};const m=w.is0();A==null&&(A=m?n.ONE:n.inv(F));const g=n.mul(M,A),v=n.mul(B,A),$=n.mul(F,A);if(m)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:g,y:v}}),h=Mf(w=>{if(w.is0()){if(t.allowInfinityPoint&&!n.is0(w.py))return;throw new Error("bad point: ZERO")}const{x:A,y:M}=w.toAffine();if(!n.isValid(A)||!n.isValid(M))throw new Error("bad point: x or y not FE");if(!c(A,M))throw new Error("bad point: equation left != right");if(!w.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class b{constructor(A,M,B){if(A==null||!n.isValid(A))throw new Error("x required");if(M==null||!n.isValid(M)||n.is0(M))throw new Error("y required");if(B==null||!n.isValid(B))throw new Error("z required");this.px=A,this.py=M,this.pz=B,Object.freeze(this)}static fromAffine(A){const{x:M,y:B}=A||{};if(!A||!n.isValid(M)||!n.isValid(B))throw new Error("invalid affine point");if(A instanceof b)throw new Error("projective point not allowed");const F=m=>n.eql(m,n.ZERO);return F(M)&&F(B)?b.ZERO:new b(M,B,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){const M=Vd(n,A.map(B=>B.pz));return A.map((B,F)=>B.toAffine(M[F])).map(b.fromAffine)}static fromHex(A){const M=b.fromAffine(s(ut("pointHex",A)));return M.assertValidity(),M}static fromPrivateKey(A){return b.BASE.multiply(f(A))}static msm(A,M){return n6(b,r,A,M)}_setWindowSize(A){x.setWindowSize(this,A)}assertValidity(){h(this)}hasEvenY(){const{y:A}=this.toAffine();if(n.isOdd)return!n.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){d(A);const{px:M,py:B,pz:F}=this,{px:m,py:g,pz:v}=A,$=n.eql(n.mul(M,v),n.mul(m,F)),N=n.eql(n.mul(B,v),n.mul(g,F));return $&&N}negate(){return new b(this.px,n.neg(this.py),this.pz)}double(){const{a:A,b:M}=t,B=n.mul(M,sc),{px:F,py:m,pz:g}=this;let v=n.ZERO,$=n.ZERO,N=n.ZERO,O=n.mul(F,F),k=n.mul(m,m),y=n.mul(g,g),C=n.mul(F,m);return C=n.add(C,C),N=n.mul(F,g),N=n.add(N,N),v=n.mul(A,N),$=n.mul(B,y),$=n.add(v,$),v=n.sub(k,$),$=n.add(k,$),$=n.mul(v,$),v=n.mul(C,v),N=n.mul(B,N),y=n.mul(A,y),C=n.sub(O,y),C=n.mul(A,C),C=n.add(C,N),N=n.add(O,O),O=n.add(N,O),O=n.add(O,y),O=n.mul(O,C),$=n.add($,O),y=n.mul(m,g),y=n.add(y,y),O=n.mul(y,C),v=n.sub(v,O),N=n.mul(y,k),N=n.add(N,N),N=n.add(N,N),new b(v,$,N)}add(A){d(A);const{px:M,py:B,pz:F}=this,{px:m,py:g,pz:v}=A;let $=n.ZERO,N=n.ZERO,O=n.ZERO;const k=t.a,y=n.mul(t.b,sc);let C=n.mul(M,m),I=n.mul(B,g),T=n.mul(F,v),L=n.add(M,B),j=n.add(m,g);L=n.mul(L,j),j=n.add(C,I),L=n.sub(L,j),j=n.add(M,F);let z=n.add(m,v);return j=n.mul(j,z),z=n.add(C,T),j=n.sub(j,z),z=n.add(B,F),$=n.add(g,v),z=n.mul(z,$),$=n.add(I,T),z=n.sub(z,$),O=n.mul(k,j),$=n.mul(y,T),O=n.add($,O),$=n.sub(I,O),O=n.add(I,O),N=n.mul($,O),I=n.add(C,C),I=n.add(I,C),T=n.mul(k,T),j=n.mul(y,j),I=n.add(I,T),T=n.sub(C,T),T=n.mul(k,T),j=n.add(j,T),C=n.mul(I,j),N=n.add(N,C),C=n.mul(z,j),$=n.mul(L,$),$=n.sub($,C),C=n.mul(L,I),O=n.mul(z,O),O=n.add(O,C),new b($,N,O)}subtract(A){return this.add(A.negate())}is0(){return this.equals(b.ZERO)}wNAF(A){return x.wNAFCached(this,A,b.normalizeZ)}multiplyUnsafe(A){const{endo:M,n:B}=t;vr("scalar",A,on,B);const F=b.ZERO;if(A===on)return F;if(this.is0()||A===Oe)return this;if(!M||x.hasPrecomputes(this))return x.wNAFCachedUnsafe(this,A,b.normalizeZ);let{k1neg:m,k1:g,k2neg:v,k2:$}=M.splitScalar(A),N=F,O=F,k=this;for(;g>on||$>on;)g&Oe&&(N=N.add(k)),$&Oe&&(O=O.add(k)),k=k.double(),g>>=Oe,$>>=Oe;return m&&(N=N.negate()),v&&(O=O.negate()),O=new b(n.mul(O.px,M.beta),O.py,O.pz),N.add(O)}multiply(A){const{endo:M,n:B}=t;vr("scalar",A,Oe,B);let F,m;if(M){const{k1neg:g,k1:v,k2neg:$,k2:N}=M.splitScalar(A);let{p:O,f:k}=this.wNAF(v),{p:y,f:C}=this.wNAF(N);O=x.constTimeNegate(g,O),y=x.constTimeNegate($,y),y=new b(n.mul(y.px,M.beta),y.py,y.pz),F=O.add(y),m=k.add(C)}else{const{p:g,f:v}=this.wNAF(A);F=g,m=v}return b.normalizeZ([F,m])[0]}multiplyAndAddUnsafe(A,M,B){const F=b.BASE,m=(v,$)=>$===on||$===Oe||!v.equals(F)?v.multiplyUnsafe($):v.multiply($),g=m(this,M).add(m(A,B));return g.is0()?void 0:g}toAffine(A){return p(this,A)}isTorsionFree(){const{h:A,isTorsionFree:M}=t;if(A===Oe)return!0;if(M)return M(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:A,clearCofactor:M}=t;return A===Oe?this:M?M(b,this):this.multiplyUnsafe(t.h)}toRawBytes(A=!0){return $o("isCompressed",A),this.assertValidity(),o(b,this,A)}toHex(A=!0){return $o("isCompressed",A),No(this.toRawBytes(A))}}b.BASE=new b(t.Gx,t.Gy,n.ONE),b.ZERO=new b(n.ZERO,n.ONE,n.ZERO);const{endo:S,nBitLength:P}=t,x=t6(b,S?Math.ceil(P/2):P);return{CURVE:t,ProjectivePoint:b,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:u}}function a6(e){const t=e0(e);return Ts(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function c6(e){const t=a6(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,c=2*n.BYTES+1;function a(y){return Ge(y,r)}function l(y){return Xa(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:f,weierstrassEquation:d,isWithinCurveOrder:p}=i6({...t,toBytes(y,C,I){const T=C.toAffine(),L=n.toBytes(T.x),j=Ss;return $o("isCompressed",I),I?j(Uint8Array.from([C.hasEvenY()?2:3]),L):j(Uint8Array.from([4]),L,n.toBytes(T.y))},fromBytes(y){const C=y.length,I=y[0],T=y.subarray(1);if(C===i&&(I===2||I===3)){const L=Un(T);if(!Ea(L,Oe,n.ORDER))throw new Error("Point is not on curve");const j=d(L);let z;try{z=n.sqrt(j)}catch(Y){const G=Y instanceof Error?": "+Y.message:"";throw new Error("Point is not on curve"+G)}const _=(z&Oe)===Oe;return(I&1)===1!==_&&(z=n.neg(z)),{x:L,y:z}}else if(C===c&&I===4){const L=n.fromBytes(T.subarray(0,n.BYTES)),j=n.fromBytes(T.subarray(n.BYTES,2*n.BYTES));return{x:L,y:j}}else{const L=i,j=c;throw new Error("invalid Point, expected length of "+L+", or uncompressed "+j+", got "+C)}}});function h(y){const C=r>>Oe;return y>C}function b(y){return h(y)?a(-y):y}const S=(y,C,I)=>Un(y.slice(C,I));class P{constructor(C,I,T){vr("r",C,Oe,r),vr("s",I,Oe,r),this.r=C,this.s=I,T!=null&&(this.recovery=T),Object.freeze(this)}static fromCompact(C){const I=o;return C=ut("compactSignature",C,I*2),new P(S(C,0,I),S(C,I,2*I))}static fromDER(C){const{r:I,s:T}=rn.toSig(ut("DER",C));return new P(I,T)}assertValidity(){}addRecoveryBit(C){return new P(this.r,this.s,C)}recoverPublicKey(C){const{r:I,s:T,recovery:L}=this,j=F(ut("msgHash",C));if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");const z=L===2||L===3?I+t.n:I;if(z>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const _=L&1?"03":"02",H=u.fromHex(_+oc(z,n.BYTES)),Y=l(z),G=a(-j*Y),W=a(T*Y),Z=u.BASE.multiplyAndAddUnsafe(H,G,W);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Es(this.toDERHex())}toDERHex(){return rn.hexFromSig(this)}toCompactRawBytes(){return Es(this.toCompactHex())}toCompactHex(){const C=o;return oc(this.r,C)+oc(this.s,C)}}const x={isValidPrivateKey(y){try{return f(y),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const y=Kd(t.n);return Qw(t.randomBytes(y),t.n)},precompute(y=8,C=u.BASE){return C._setWindowSize(y),C.multiply(BigInt(3)),C}};function w(y,C=!0){return u.fromPrivateKey(y).toRawBytes(C)}function A(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const I=ut("key",y).length,T=n.BYTES,L=T+1,j=2*T+1;if(!(t.allowedPrivateKeyLengths||o===L))return I===L||I===j}function M(y,C,I=!0){if(A(y)===!0)throw new Error("first arg must be private key");if(A(C)===!1)throw new Error("second arg must be public key");return u.fromHex(C).multiply(f(y)).toRawBytes(I)}const B=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const C=Un(y),I=y.length*8-s;return I>0?C>>BigInt(I):C},F=t.bits2int_modN||function(y){return a(B(y))},m=Ps(s);function g(y){return vr("num < 2^"+s,y,on,m),Co(y,o)}function v(y,C,I=$){if(["recovered","canonical"].some(ee=>ee in I))throw new Error("sign() legacy options not supported");const{hash:T,randomBytes:L}=t;let{lowS:j,prehash:z,extraEntropy:_}=I;j==null&&(j=!0),y=ut("msgHash",y),t0(I),z&&(y=ut("prehashed msgHash",T(y)));const H=F(y),Y=f(C),G=[g(Y),g(H)];if(_!=null&&_!==!1){const ee=_===!0?L(n.BYTES):_;G.push(ut("extraEntropy",ee))}const W=Ss(...G),Z=H;function J(ee){const fe=B(ee);if(!p(fe))return;const pe=l(fe),he=u.BASE.multiply(fe).toAffine(),ie=a(he.x);if(ie===on)return;const me=a(pe*a(Z+ie*Y));if(me===on)return;let ne=(he.x===ie?0:2)|Number(he.y&Oe),Se=me;return j&&h(me)&&(Se=b(me),ne^=1),new P(ie,Se,ne)}return{seed:W,k2sig:J}}const $={lowS:t.lowS,prehash:!1},N={lowS:t.lowS,prehash:!1};function O(y,C,I=$){const{seed:T,k2sig:L}=v(y,C,I),j=t;return my(j.hash.outputLen,j.nByteLength,j.hmac)(T,L)}u.BASE._setWindowSize(8);function k(y,C,I,T=N){var ne;const L=y;C=ut("msgHash",C),I=ut("publicKey",I);const{lowS:j,prehash:z,format:_}=T;if(t0(T),"strict"in T)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");const H=typeof L=="string"||Ao(L),Y=!H&&!_&&typeof L=="object"&&L!==null&&typeof L.r=="bigint"&&typeof L.s=="bigint";if(!H&&!Y)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let G,W;try{if(Y&&(G=new P(L.r,L.s)),H){try{_!=="compact"&&(G=P.fromDER(L))}catch(Se){if(!(Se instanceof rn.Err))throw Se}!G&&_!=="der"&&(G=P.fromCompact(L))}W=u.fromHex(I)}catch{return!1}if(!G||j&&G.hasHighS())return!1;z&&(C=t.hash(C));const{r:Z,s:J}=G,ee=F(C),fe=l(J),pe=a(ee*fe),he=a(Z*fe),ie=(ne=u.BASE.multiplyAndAddUnsafe(W,pe,he))==null?void 0:ne.toAffine();return ie?a(ie.x)===Z:!1}return{CURVE:t,getPublicKey:w,getSharedSecret:M,sign:O,verify:k,ProjectivePoint:u,Signature:P,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function l6(e){return{hash:e,hmac:(t,...n)=>Od(e,t,C1(...n)),randomBytes:O1}}function u6(e,t){const n=r=>c6({...e,...l6(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const n0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),r0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),f6=BigInt(0),d6=BigInt(1),ic=BigInt(2),o0=(e,t)=>(e+t/ic)/t;function p6(e){const t=n0,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),l=e*e*e%t,u=l*l*e%t,f=ft(u,n,t)*u%t,d=ft(f,n,t)*u%t,p=ft(d,ic,t)*l%t,h=ft(p,o,t)*p%t,b=ft(h,s,t)*h%t,S=ft(b,c,t)*b%t,P=ft(S,a,t)*S%t,x=ft(P,c,t)*b%t,w=ft(x,n,t)*u%t,A=ft(w,i,t)*h%t,M=ft(A,r,t)*l%t,B=ft(M,ic,t);if(!ac.eql(ac.sqr(B),e))throw new Error("Cannot find square root");return B}const ac=Qa(n0,void 0,void 0,{sqrt:p6}),s0=u6({a:f6,b:BigInt(7),Fp:ac,n:r0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=r0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-d6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),c=o0(s*e,t),a=o0(-r*e,t);let l=Ge(e-c*n-a*o,t),u=Ge(-c*r-a*s,t);const f=l>i,d=u>i;if(f&&(l=t-l),d&&(u=t-u),l>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:l,k2neg:d,k2:u}}}},yf),h6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:s0},Symbol.toStringTag,{value:"Module"}));function i0(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new lc({signature:e});if(typeof e.s>"u")throw new lc({signature:e});if(n&&typeof e.yParity>"u")throw new lc({signature:e});if(e.r<0n||e.r>Ld)throw new x6({value:e.r});if(e.s<0n||e.s>Ld)throw new E6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new uc({value:e.yParity})}function m6(e){return a0(Ct(e))}function a0(e){if(e.length!==130&&e.length!==132)throw new w6({signature:e});const t=BigInt(jt(e,0,32)),n=BigInt(jt(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return cc(o)}catch{throw new uc({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function b6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return g6(e)}function g6(e){const t=typeof e=="string"?a0(e):e instanceof Uint8Array?m6(e):typeof e.r=="string"?v6(e):e.v?y6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return i0(t),t}function y6(e){return{r:e.r,s:e.s,yParity:cc(e.v)}}function v6(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=cc(n)),typeof r!="number")throw new uc({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function cc(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new S6({value:e})}class w6 extends te{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${nt(_y(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class lc extends te{constructor({signature:t}){super(`Signature \`${jf(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class x6 extends te{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class E6 extends te{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class uc extends te{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class S6 extends te{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function P6(e,t={}){return typeof e.chainId=="string"?T6(e):{...e,...t.signature}}function T6(e){const{address:t,chainId:n,nonce:r}=e,o=b6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const A6="0x8010801080108010801080108010801080108010801080108010801080108010",$6=Rd("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function c0(e){if(typeof e=="string"){if(jt(e,-32)!==A6)throw new O6(e)}else i0(e.authorization)}function N6(e){c0(e);const t=Hf(jt(e,-64,-32)),n=jt(e,-t-64,-64),r=jt(e,0,-t-64),[o,s,i]=_w($6,n);return{authorization:P6({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:r,...i&&i!=="0x"?{data:i,to:s}:{}}}function C6(e){try{return c0(e),!0}catch{return!1}}let O6=class extends te{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};class I6 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function k6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new I6({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 D6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function M6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Yt(e.nonce):void 0,storageProof:e.storageProof?D6(e.storageProof):void 0}}async function L6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?Q(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return M6(c)}async function B6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?Q(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function fc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:c}){var d,p,h;const a=r||"latest",l=n!==void 0?Q(n):void 0;let u=null;if(o?u=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Q(s)]},{dedupe:!0}):typeof s=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||a,Q(s)]},{dedupe:!!l}):i&&typeof c=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,Q(c)]},{dedupe:!0})),!u)throw new Xu({blockHash:t,blockNumber:n,blockTag:a,hash:o,index:s});return(((h=(p=(d=e.chain)==null?void 0:d.formatters)==null?void 0:p.transaction)==null?void 0:h.format)||ca)(u,"getTransaction")}async function F6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([X(e,ko,"getBlockNumber")({}),t?X(e,fc,"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 Ms(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Qu({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||ld)(n,"getTransactionReceipt")}async function R6(e,t){var x;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:c,stateOverride:a}=t,l=t.contracts,{batchSize:u=t.batchSize??1024,deployless:f=t.deployless??!1}=typeof((x=e.batch)==null?void 0:x.multicall)=="object"?e.batch.multicall:{},d=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return Sr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),p=[[]];let h=0,b=0;for(let w=0;w<l.length;w++){const{abi:A,address:M,args:B,functionName:F}=l[w];try{const m=lt({abi:A,args:B,functionName:F});b+=(m.length-2)/2,u>0&&b>u&&p[h].length>0&&(h++,b=(m.length-2)/2,p[h]=[]),p[h]=[...p[h],{allowFailure:!0,callData:m,target:M}]}catch(m){const g=br(m,{abi:A,address:M,args:B,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!o)throw g;p[h]=[...p[h],{allowFailure:!0,callData:"0x",target:M}]}}const S=await Promise.allSettled(p.map(w=>X(e,Ot,"readContract")({...d===null?{code:Aa}:{address:d},abi:xr,account:n,args:[w],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:c,functionName:"aggregate3",stateOverride:a}))),P=[];for(let w=0;w<S.length;w++){const A=S[w];if(A.status==="rejected"){if(!o)throw A.reason;for(let B=0;B<p[w].length;B++)P.push({status:"failure",error:A.reason,result:void 0});continue}const M=A.value;for(let B=0;B<M.length;B++){const{returnData:F,success:m}=M[B],{callData:g}=p[w][B],{abi:v,address:$,functionName:N,args:O}=l[P.length];try{if(g==="0x")throw new Vr;if(!m)throw new ms({data:F});const k=xn({abi:v,args:O,data:F,functionName:N});P.push(o?{result:k,status:"success"}:k)}catch(k){const y=br(k,{abi:v,address:$,args:O,docsPath:"/docs/contract/multicall",functionName:N});if(!o)throw y;P.push({error:y,result:void 0,status:"failure"})}}}if(P.length!==l.length)throw new V("multicall results mismatch");return P}async function dc(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?Kf(d.blockOverrides):void 0,h=d.calls.map(S=>{const P=S,x=P.account?tt(P.account):void 0,w=P.abi?lt(P):P.data,A={...P,account:x,data:P.dataSuffix?At([w||"0x",P.dataSuffix]):w,from:P.from??(x==null?void 0:x.address)};return yr(A),Po(A)}),b=d.stateOverrides?ia(d.stateOverrides):void 0;a.push({blockOverrides:p,calls:h,stateOverrides:b})}const u=(typeof n=="bigint"?Q(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},u]})).map((d,p)=>({...pf(d),calls:d.calls.map((h,b)=>{var v,$;const{abi:S,args:P,functionName:x,to:w}=o[p].calls[b],A=((v=h.error)==null?void 0:v.data)??h.returnData,M=BigInt(h.gasUsed),B=($=h.logs)==null?void 0:$.map(N=>Rt(N)),F=h.status==="0x1"?"success":"failure",m=S&&F==="success"&&A!=="0x"?xn({abi:S,data:A,functionName:x}):null,g=(()=>{if(F==="success")return;let N;if(A==="0x"?N=new Vr:A&&(N=new ms({data:A})),!!N)return br(N,{abi:S??[],address:w??"0x",args:P,functionName:x??"<unknown>"})})();return{data:A,gasUsed:M,logs:B,status:F,...F==="success"?{result:m}:{error:g}}})}))}catch(a){const l=a,u=ys(l,{});throw u instanceof So?l:u}}function pc(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 te("Unable to normalize signature.");return o}function hc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Wa(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)=>hc(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=>hc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function l0(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 l0(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")?Wa(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Wa(n[r],{strict:!1}):!1)return i}}function u0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?au(e):e;return{...r,...n?{hash:Ar(r)}:{}}}function Ls(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=zy(t,{strict:!1}),i=e.filter(l=>s?l.type==="function"||l.type==="error"?f0(l)===jt(t,0,4):l.type==="event"?Ar(l)===t:!1:"name"in l&&l.name===t);if(i.length===0)throw new Bs({name:t});if(i.length===1)return{...i[0],...o?{hash:Ar(i[0])}:{}};let c;for(const l of i){if(!("inputs"in l))continue;if(!r||r.length===0){if(!l.inputs||l.inputs.length===0)return{...l,...o?{hash:Ar(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==r.length)continue;if(r.every((f,d)=>{const p="inputs"in l&&l.inputs[d];return p?hc(f,p):!1})){if(c&&"inputs"in c&&c.inputs){const f=l0(l.inputs,c.inputs,r);if(f)throw new _6({abiItem:l,type:f[0]},{abiItem:c,type:f[1]})}c=l}}const a=(()=>{if(c)return c;const[l,...u]=i;return{...l,overloads:u}})();if(!a)throw new Bs({name:t});return{...a,...o?{hash:Ar(a)}:{}}}function f0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Ls(n,r)}return e[0]})();return jt(Ar(t),0,4)}function j6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return Ls(r,o)}return e[0]})(),n=typeof t=="string"?t:ss(t);return pc(n)}function Ar(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Ls(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Id(Pa(j6(t)))}class _6 extends te{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${pc(ss(t.abiItem))}\`, and`,`\`${n.type}\` in \`${pc(ss(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 Bs extends te{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function z6(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,c]=e;return[W6(i),c]}return e})(),{bytecode:r,args:o}=n;return Nt(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?Za(t.inputs,o):"0x")}function U6(e){return u0(e)}function W6(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new Bs({name:"constructor"});return t}function H6(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[l,u,f]=e;return[d0(l,u,{args:f}),f]}const[c,a]=e;return[c,a]})(),{overloads:r}=t,o=r?d0([t,...r],t.name,{args:n}):t,s=V6(o),i=n.length>0?Za(o.inputs,n):void 0;return i?Nt(s,i):s}function $r(e,t={}){return u0(e,t)}function d0(e,t,n){const r=Ls(e,t,n);if(r.type!=="function")throw new Bs({name:t,type:"function"});return r}function V6(e){return f0(e)}const G6="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",It="0x0000000000000000000000000000000000000000",q6="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function Z6(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,l=t.account?tt(t.account):void 0;if(i&&!l)throw new V("`account` is required when `traceAssetChanges` is true");const u=l?z6(U6("constructor(bytes, bytes)"),{bytecode:nd,args:[q6,H6($r("function getBalance(address)"),[l.address])]}):void 0,f=i?await Promise.all(t.calls.map(async T=>{if(!T.data&&!T.abi)return;const{accessList:L}=await yd(e,{account:l.address,...T,data:T.abi?lt(T):T.data});return L.map(({address:j,storageKeys:z})=>z.length>0?j:null)})).then(T=>T.flat().filter(Boolean)):[],d=await dc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((T,L)=>({abi:[$r("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:T,from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]}]:[],{calls:[...o,{to:It}].map(T=>({...T,from:l==null?void 0:l.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((T,L)=>({abi:[$r("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:T,from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]},{calls:f.map((T,L)=>({to:T,abi:[$r("function decimals() returns (uint256)")],functionName:"decimals",from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]},{calls:f.map((T,L)=>({to:T,abi:[$r("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]},{calls:f.map((T,L)=>({to:T,abi:[$r("function symbol() returns (string)")],functionName:"symbol",from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]}]:[]],traceTransfers:c,validation:a}),p=i?d[2]:d[0],[h,b,,S,P,x,w,A]=i?d:[],{calls:M,...B}=p,F=M.slice(0,-1)??[],m=(h==null?void 0:h.calls)??[],g=(b==null?void 0:b.calls)??[],v=[...m,...g].map(T=>T.status==="success"?Lt(T.data):null),$=(S==null?void 0:S.calls)??[],N=(P==null?void 0:P.calls)??[],O=[...$,...N].map(T=>T.status==="success"?Lt(T.data):null),k=((x==null?void 0:x.calls)??[]).map(T=>T.status==="success"?T.result:null),y=((A==null?void 0:A.calls)??[]).map(T=>T.status==="success"?T.result:null),C=((w==null?void 0:w.calls)??[]).map(T=>T.status==="success"?T.result:null),I=[];for(const[T,L]of O.entries()){const j=v[T];if(typeof L!="bigint"||typeof j!="bigint")continue;const z=k[T-1],_=y[T-1],H=C[T-1],Y=T===0?{address:G6,decimals:18,symbol:"ETH"}:{address:f[T-1],decimals:H||z?Number(z??1):void 0,symbol:_??void 0};I.some(G=>G.token.address===Y.address)||I.push({token:Y,value:{pre:j,post:L,diff:L-j}})}return{assetChanges:I,block:B,results:F}}const p0="0x6492649264926492649264926492649264926492649264926492649264926492";function K6(e){if(jt(e,-32)!==p0)throw new Q6(e)}function Y6(e){const{data:t,signature:n,to:r}=e;return Nt(Za(Rd("address, bytes, bytes"),[r,t,n]),p0)}function X6(e){try{return K6(e),!0}catch{return!1}}class Q6 extends te{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function J6({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 s0.Signature(Lt(e),Lt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:Bt(i)}async function Fs(e,t){var a,l,u,f;const{address:n,chain:r=e.chain,hash:o,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??((l=(a=r==null?void 0:r.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:l.address),multicallAddress:i=t.multicallAddress??((f=(u=r==null?void 0:r.contracts)==null?void 0:u.multicall3)==null?void 0:f.address)}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const c=(()=>{const d=t.signature;return Pt(d)?d:typeof d=="object"&&"r"in d&&"s"in d?J6(d):Ae(d)})();try{return C6(c)?await e5(e,{...t,multicallAddress:i,signature:c}):await t5(e,{...t,verifierAddress:s,signature:c})}catch(d){try{if(To(Qt(n),await rf({hash:o,signature:c})))return!0}catch{}if(d instanceof Gn)return!1;throw d}}async function e5(e,t){var S;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:c,data:a,signature:l,to:u}=N6(t.signature);if(await Is(e,{address:n,blockNumber:r,blockTag:o})===dr(["0xef0100",c.address]))return await n5(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:l});const d={address:c.address,chainId:Number(c.chainId),nonce:Number(c.nonce),r:Q(c.r,{size:32}),s:Q(c.s,{size:32}),yParity:c.yParity};if(!await Uv({address:n,authorization:d}))throw new Gn;const h=await X(e,Ot,"readContract")({...i?{address:i}:{code:Aa},authorizationList:[d],abi:xr,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:u??n,callData:a}]:[],{allowFailure:!0,target:n,callData:lt({abi:ed,functionName:"isValidSignature",args:[s,l]})}]]}),b=(S=h[h.length-1])==null?void 0:S.returnData;if(b!=null&&b.startsWith("0x1626ba7e"))return!0;throw new Gn}async function t5(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:c,...a}=t,l=await(async()=>!r&&!o||X6(i)?i:Y6({data:o,signature:i,to:r}))(),u=c?{to:c,data:lt({abi:td,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:Ca({abi:td,args:[n,s,l],bytecode:Zy}),...a},{data:f}=await X(e,Pr,"call")(u).catch(d=>{throw d instanceof Ju?new Gn:d});if(u1(f??"0x0"))return!0;throw new Gn}async function n5(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await X(e,Ot,"readContract")({address:n,abi:ed,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof ef?new Gn:a})).startsWith("0x1626ba7e"))return!0;throw new Gn}class Gn extends Error{}async function r5(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Pd(n);return X(e,Fs,"verifyHash")({address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function o5(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:l,...u}=t,f=fw({message:i,primaryType:c,types:a,domain:l});return X(e,Fs,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function h0(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=$e(["watchBlockNumber",e.uid,t,n,i]);return En(f,{onBlockNumber:r,onError:o},d=>Io(async()=>{var p;try{const h=await X(e,ko,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let b=a+1n;b<h;b++)d.onBlockNumber(b,a),a=b}(a===void 0||h>a)&&(d.onBlockNumber(h,a),a=h)}catch(h){(p=d.onError)==null||p.call(d,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=$e(["watchBlockNumber",e.uid,t,n]);return En(f,{onBlockNumber:r,onError:o},d=>{let p=!0,h=()=>p=!1;return(async()=>{try{const b=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:S}=await b.subscribe({params:["newHeads"],onData(P){var w;if(!p)return;const x=Lt((w=P.result)==null?void 0:w.number);d.onBlockNumber(x,a),a=x},onError(P){var x;(x=d.onError)==null||x.call(d,P)}});h=S,p||h()}catch(b){o==null||o(b)}})(),()=>h()})})()}async function s5(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:M})=>~~(1<<M)*200,timeout:a=18e4}=t,l=$e(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var M;return t.pollingInterval?t.pollingInterval:(M=e.chain)!=null&&M.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,d,p,h=!1,b,S;const{promise:P,resolve:x,reject:w}=sd(),A=a?setTimeout(()=>{S==null||S(),b==null||b(),w(new Tg({hash:o}))},a):void 0;return b=En(l,{onReplaced:s,resolve:x,reject:w},async M=>{if(p=await X(e,Ms,"getTransactionReceipt")({hash:o}).catch(()=>{}),p&&r<=1){clearTimeout(A),M.resolve(p),b==null||b();return}S=X(e,h0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(B){const F=g=>{clearTimeout(A),S==null||S(),g(),b==null||b()};let m=B;if(!h)try{if(p){if(r>1&&(!p.blockNumber||m-p.blockNumber+1n<r))return;F(()=>M.resolve(p));return}if(n&&!f&&(h=!0,await Da(async()=>{f=await X(e,fc,"getTransaction")({hash:o}),f.blockNumber&&(m=f.blockNumber)},{delay:c,retryCount:i}),h=!1),p=await X(e,Ms,"getTransactionReceipt")({hash:o}),r>1&&(!p.blockNumber||m-p.blockNumber+1n<r))return;F(()=>M.resolve(p))}catch(g){if(g instanceof Xu||g instanceof Qu){if(!f){h=!1;return}try{d=f,h=!0;const v=await Da(()=>X(e,$t,"getBlock")({blockNumber:m,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:O})=>O instanceof ff});h=!1;const $=v.transactions.find(({from:O,nonce:k})=>O===d.from&&k===d.nonce);if(!$||(p=await X(e,Ms,"getTransactionReceipt")({hash:$.hash}),r>1&&(!p.blockNumber||m-p.blockNumber+1n<r)))return;let N="replaced";$.to===d.to&&$.value===d.value&&$.input===d.input?N="repriced":$.from===$.to&&$.value===0n&&(N="cancelled"),F(()=>{var O;(O=M.onReplaced)==null||O.call(M,{reason:N,replacedTransaction:d,transaction:$,transactionReceipt:p}),M.resolve(p)})}catch(v){F(()=>M.reject(v))}}else F(()=>M.reject(g))}}})}),P}function i5(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 l=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")),u=i??!1;let f;return l?(()=>{const h=$e(["watchBlocks",e.uid,t,n,r,u,a]);return En(h,{onBlock:o,onError:s},b=>Io(async()=>{var S;try{const P=await X(e,$t,"getBlock")({blockTag:t,includeTransactions:u});if(P.number!==null&&(f==null?void 0:f.number)!=null){if(P.number===f.number)return;if(P.number-f.number>1&&n)for(let x=(f==null?void 0:f.number)+1n;x<P.number;x++){const w=await X(e,$t,"getBlock")({blockNumber:x,includeTransactions:u});b.onBlock(w,f),f=w}}((f==null?void 0:f.number)==null||t==="pending"&&(P==null?void 0:P.number)==null||P.number!==null&&P.number>f.number)&&(b.onBlock(P,f),f=P)}catch(P){(S=b.onError)==null||S.call(b,P)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,b=!0,S=()=>h=!1;return(async()=>{try{r&&X(e,$t,"getBlock")({blockTag:t,includeTransactions:u}).then(w=>{h&&b&&(o(w,void 0),b=!1)}).catch(s);const P=(()=>{if(e.transport.type==="fallback"){const w=e.transport.transports.find(A=>A.config.type==="webSocket"||A.config.type==="ipc");return w?w.value:e.transport}return e.transport})(),{unsubscribe:x}=await P.subscribe({params:["newHeads"],async onData(w){var M;if(!h)return;const A=await X(e,$t,"getBlock")({blockNumber:(M=w.result)==null?void 0:M.number,includeTransactions:u}).catch(()=>{});h&&(o(A,f),b=!1,f=A)},onError(w){s==null||s(w)}});S=x,h||S()}catch(P){s==null||s(P)}})(),()=>S()})()}function a5(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:l,pollingInterval:u=e.pollingInterval,strict:f}){const d=typeof l<"u"?l: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 S=$e(["watchEvent",t,n,r,e.uid,o,u,i]);return En(S,{onLogs:a,onError:c},P=>{let x;i!==void 0&&(x=i-1n);let w,A=!1;const M=Io(async()=>{var B;if(!A){try{w=await X(e,vd,"createEventFilter")({address:t,args:n,event:o,events:s,strict:p,fromBlock:i})}catch{}A=!0;return}try{let F;if(w)F=await X(e,$s,"getFilterChanges")({filter:w});else{const m=await X(e,ko,"getBlockNumber")({});x&&x!==m?F=await X(e,ba,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:x+1n,toBlock:m}):F=[],x=m}if(F.length===0)return;if(r)P.onLogs(F);else for(const m of F)P.onLogs([m])}catch(F){w&&F instanceof yn&&(A=!1),(B=P.onError)==null||B.call(P,F)}},{emitOnBegin:!0,interval:u});return async()=>{w&&await X(e,Ns,"uninstallFilter")({filter:w}),M()}})})():(()=>{let S=!0,P=()=>S=!1;return(async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const B=e.transport.transports.find(F=>F.config.type==="webSocket"||F.config.type==="ipc");return B?B.value:e.transport}return e.transport})(),w=s??(o?[o]:void 0);let A=[];w&&(A=[w.flatMap(F=>Yr({abi:[F],eventName:F.name,args:n}))],o&&(A=A[0]));const{unsubscribe:M}=await x.subscribe({params:["logs",{address:t,topics:A}],onData(B){var m;if(!S)return;const F=B.result;try{const{eventName:g,args:v}=ws({abi:w??[],data:F.data,topics:F.topics,strict:p}),$=Rt(F,{args:v,eventName:g});a([$])}catch(g){let v,$;if(g instanceof cs||g instanceof Li){if(f)return;v=g.abiItem.name,$=(m=g.abiItem.inputs)==null?void 0:m.some(O=>!("name"in O&&O.name))}const N=Rt(F,{args:$?[]:{},eventName:v});a([N])}},onError(B){c==null||c(B)}});P=M,S||P()}catch(x){c==null||c(x)}})(),()=>P()})()}function c5(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 l=$e(["watchPendingTransactions",e.uid,t,s]);return En(l,{onTransactions:r,onError:n},u=>{let f;const d=Io(async()=>{var p;try{if(!f)try{f=await X(e,wd,"createPendingTransactionFilter")({});return}catch(b){throw d(),b}const h=await X(e,$s,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const b of h)u.onTransactions([b])}catch(h){(p=u.onError)==null||p.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await X(e,Ns,"uninstallFilter")({filter:f}),d()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(d){if(!l)return;const p=d.result;r([p])},onError(d){n==null||n(d)}});u=f,l||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function l5(e){var f,d,p;const{scheme:t,statement:n,...r}=((f=e.match(u5))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...l}=((d=e.match(f5))==null?void 0:d.groups)??{},u=(p=e.split("Resources:")[1])==null?void 0:p.split(`
91
- - `).slice(1);return{...r,...l,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const u5=/^(?:(?<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)?/,f5=/(?: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 d5(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||!ct(r.address,{strict:!1})||t&&!To(r.address,t))return!1}catch{return!1}return!0}async function p5(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...l}=t,u=l5(o);if(!u.address||!d5({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const d=Pd(o);return Fs(e,{address:u.address,hash:d,signature:c,...l})}async function h5(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var c,a,l;const o=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),i=(((l=(a=(c=e.chain)==null?void 0:c.formatters)==null?void 0:a.transactionReceipt)==null?void 0:l.format)||ld)(o);if(i.status==="reverted"&&n)throw new Pg({receipt:i});return i}function m5(e){return{call:t=>Pr(e,t),createAccessList:t=>yd(e,t),createBlockFilter:()=>Iv(e),createContractEventFilter:t=>Uu(e,t),createEventFilter:t=>vd(e,t),createPendingTransactionFilter:()=>wd(e),estimateContractGas:t=>uy(e,t),estimateGas:t=>ha(e,t),getBalance:t=>kv(e,t),getBlobBaseFee:()=>Dv(e),getBlock:t=>$t(e,t),getBlockNumber:t=>ko(e,t),getBlockTransactionCount:t=>Mv(e,t),getBytecode:t=>Is(e,t),getChainId:()=>da(e),getCode:t=>Is(e,t),getContractEvents:t=>$f(e,t),getDelegation:t=>Lv(e,t),getEip712Domain:t=>Fv(e,t),getEnsAddress:t=>mv(e,t),getEnsAvatar:t=>Nv(e,t),getEnsName:t=>Cv(e,t),getEnsResolver:t=>Ov(e,t),getEnsText:t=>gd(e,t),getFeeHistory:t=>_v(e,t),estimateFeesPerGas:t=>Gg(e,t),getFilterChanges:t=>$s(e,t),getFilterLogs:t=>zv(e,t),getGasPrice:()=>la(e),getLogs:t=>ba(e,t),getProof:t=>L6(e,t),estimateMaxPriorityFeePerGas:t=>Vg(e,t),fillTransaction:t=>Sf(e,t),getStorageAt:t=>B6(e,t),getTransaction:t=>fc(e,t),getTransactionConfirmations:t=>F6(e,t),getTransactionCount:t=>mf(e,t),getTransactionReceipt:t=>Ms(e,t),multicall:t=>R6(e,t),prepareTransactionRequest:t=>Tf(e,t),readContract:t=>Ot(e,t),sendRawTransaction:t=>av(e,t),sendRawTransactionSync:t=>h5(e,t),simulate:t=>dc(e,t),simulateBlocks:t=>dc(e,t),simulateCalls:t=>Z6(e,t),simulateContract:t=>Jy(e,t),verifyHash:t=>Fs(e,t),verifyMessage:t=>r5(e,t),verifySiweMessage:t=>p5(e,t),verifyTypedData:t=>o5(e,t),uninstallFilter:t=>Ns(e,t),waitForTransactionReceipt:t=>s5(e,t),watchBlocks:t=>i5(e,t),watchBlockNumber:t=>h0(e,t),watchContractEvent:t=>iv(e,t),watchEvent:t=>a5(e,t),watchPendingTransactions:t=>c5(e,t)}}function b5(e){const{key:t="public",name:n="Public Client"}=e;return lv({...e,key:t,name:n,type:"publicClient"}).extend(m5)}function g5({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const l=ud();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:Hv(r,{methods:t,retryCount:o,retryDelay:s,uid:l}),value:a}}class y5 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 v5(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:s="http",methods:i,name:c="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:l,retryDelay:u,raw:f}=t;return({chain:d,retryCount:p,timeout:h})=>{const{batchSize:b=1e3,wait:S=0}=typeof n=="object"?n:{},P=t.retryCount??p,x=h??t.timeout??1e4,w=e||(d==null?void 0:d.rpcUrls.default.http[0]);if(!w)throw new y5;const A=tw(w,{fetchFn:r,fetchOptions:o,onRequest:a,onResponse:l,timeout:x});return g5({key:s,methods:i,name:c,async request({method:M,params:B}){const F={method:M,params:B},{schedule:m}=id({id:w,wait:S,shouldSplitBatch(N){return N.length>b},fn:N=>A.request({body:N}),sort:(N,O)=>N.id-O.id}),g=async N=>n?m(N):[await A.request({body:N})],[{error:v,result:$}]=await g(F);if(f)return{error:v,result:$};if(v)throw new Xi({body:F,error:v,url:w});return $},retryCount:P,retryDelay:u,timeout:x,type:"http"},{fetchOptions:o,url:w})}}const w5=Qv({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}});function x5({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=E.useState(null),[a,l]=E.useState(o);return E.useEffect(()=>{let u,f;const d=async()=>{try{const p=await e.readContract({address:t,abi:Er,functionName:"balanceOf",args:[n]});c(p),l(Zi(p,r))}catch{l(o)}};d();try{u=e.watchContractEvent({address:t,abi:Er,eventName:"Transfer",args:{to:n},onLogs:()=>{d()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:Er,eventName:"Transfer",args:{from:n},onLogs:()=>{d()},poll:!0,pollingInterval:s})}catch{}return()=>{u==null||u(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const E5=()=>({openDeposit:E.useCallback(t=>{},[])}),S5=()=>({openWithdraw:E.useCallback(t=>{},[])}),Sn="MPC",mc="EVM",P5="spot",m0="perpetual";/**
84
+ `)})}}Object.defineProperty(yn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class so extends We{constructor(t){super(t,{code:so.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class io extends We{constructor(t){super(t,{code:io.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class ao extends We{constructor(t){super(t,{code:ao.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class zn extends We{constructor(t,{method:n}={}){super(t,{code:zn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(zn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class hr extends We{constructor(t){super(t,{code:hr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(hr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class co extends We{constructor(t){super(t,{code:co.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class mr extends He{constructor(t){super(t,{code:mr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(mr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class lo extends He{constructor(t){super(t,{code:lo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class uo extends He{constructor(t,{method:n}={}){super(t,{code:uo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class fo extends He{constructor(t){super(t,{code:fo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class po extends He{constructor(t){super(t,{code:po.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ho extends He{constructor(t){super(t,{code:ho.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class mo extends He{constructor(t){super(t,{code:mo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class bo extends He{constructor(t){super(t,{code:bo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class go extends He{constructor(t){super(t,{code:go.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class yo extends He{constructor(t){super(t,{code:yo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class vo extends He{constructor(t){super(t,{code:vo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class wo extends He{constructor(t){super(t,{code:wo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class xo extends He{constructor(t){super(t,{code:xo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Eo extends He{constructor(t){super(t,{code:Eo.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class Dg extends We{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Mg=3;function br(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof bs?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:l,details:u,message:f,shortMessage:d}=c,p=e instanceof Vr?new Cg({functionName:s}):[Mg,_n.code].includes(a)&&(l||u||f||d)||a===yn.code&&u==="execution reverted"&&l?new Xi({abi:t,data:typeof l=="object"?l.data:l,functionName:s,message:c instanceof Qi?u:d??f}):e;return new tf(p,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function kg(e){const t=De(`0x${e.substring(4)}`).substring(26);return hs(`0x${t}`)}async function Lg({hash:e,signature:t}){const n=Pt(e)?e:mn(e),{secp256k1:r}=await Promise.resolve().then(()=>b6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:f,yParity:d}=t,p=Number(d??f),h=rf(p);return new r.Signature(Lt(l),Lt(u)).addRecoveryBit(h)}const i=Pt(t)?t:mn(t);if(ve(i)!==65)throw new Error("invalid signature length");const c=Yt(`0x${i.slice(130)}`),a=rf(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function rf(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 of({hash:e,signature:t}){return kg(await Lg({hash:e,signature:t}))}function Bg(e,t="hex"){const n=sf(e),r=qi(new Uint8Array(n.length));return n.encode(r),t==="hex"?Ae(r.bytes):r.bytes}function sf(e){return Array.isArray(e)?Fg(e.map(t=>sf(t))):Rg(e)}function Fg(e){const t=e.reduce((o,s)=>o+s.length,0),n=af(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 Rg(e){const t=typeof e=="string"?Bt(e):e,n=af(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 af(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 jg(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=De(dr(["0x05",Bg([t?J(t):"0x",o,n?J(n):"0x"])]));return r==="bytes"?Bt(s):s}async function cf(e){const{authorization:t,signature:n}=e;return of({hash:jg(t),signature:n??t})}class _g extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:d}){var h;const p=Jr({from:n==null?void 0:n.address,to:f,value:typeof d<"u"&&`${Yi(d)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ue(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ue(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ue(l)} gwei`,nonce:u});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 gr 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(gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(gr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class gs extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ue(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(gs,"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 Ji extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ue(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Ji,"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 ea 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(ea,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class ta 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(`
85
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(ta,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class na 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(na,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class ra extends V{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
86
+ `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(ra,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class oa 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(oa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class sa 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(sa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class ia extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(ia,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class ys extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Ue(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Ue(r)} gwei`:""}).`].join(`
87
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(ys,"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 So extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function vs(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===gr.code):e;return r instanceof V?new gr({cause:e,message:r.details}):gr.nodeMessage.test(n)?new gr({cause:e,message:e.details}):gs.nodeMessage.test(n)?new gs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ji.nodeMessage.test(n)?new Ji({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):ea.nodeMessage.test(n)?new ea({cause:e,nonce:t==null?void 0:t.nonce}):ta.nodeMessage.test(n)?new ta({cause:e,nonce:t==null?void 0:t.nonce}):na.nodeMessage.test(n)?new na({cause:e,nonce:t==null?void 0:t.nonce}):ra.nodeMessage.test(n)?new ra({cause:e}):oa.nodeMessage.test(n)?new oa({cause:e,gas:t==null?void 0:t.gas}):sa.nodeMessage.test(n)?new sa({cause:e,gas:t==null?void 0:t.gas}):ia.nodeMessage.test(n)?new ia({cause:e}):ys.nodeMessage.test(n)?new ys({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new So({cause:e})}function zg(e,{docsPath:t,...n}){const r=(()=>{const o=vs(e,n);return o instanceof So?e:o})();return new _g(r,{docsPath:t,...n})}function ws(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 Ug={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Po(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Wg(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>Ae(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=J(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=J(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=J(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=J(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=J(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=J(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Ug[e.type]),typeof e.value<"u"&&(n.value=J(e.value)),n}function Wg(e){return e.map(t=>({address:t.address,r:t.r?J(BigInt(t.r)):t.r,s:t.s?J(BigInt(t.s)):t.s,chainId:J(t.chainId),nonce:J(t.nonce),...typeof t.yParity<"u"?{yParity:J(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:J(t.v)}:{}}))}function lf(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new xu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new xu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Hg(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=J(t)),n!==void 0&&(i.nonce=J(n)),r!==void 0&&(i.state=lf(r)),o!==void 0){if(i.state)throw new Eg;i.stateDiff=lf(o)}return i}function aa(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ct(n,{strict:!1}))throw new bn({address:n});if(t[n])throw new xg({address:n});t[n]=Hg(r)}return t}const uf=2n**256n-1n;function yr(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?tt(t):void 0;if(s&&!ct(s.address))throw new bn({address:s.address});if(o&&!ct(o))throw new bn({address:o});if(n&&n>uf)throw new gs({maxFeePerGas:n});if(r&&n&&r>n)throw new ys({maxFeePerGas:n,maxPriorityFeePerGas:r})}class ff extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class ca extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Vg extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Ue(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class df 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 pf={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function la(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Yt(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?Yt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?pf[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=Gg(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function Gg(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 hf(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:la(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function At(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var l,u,f;const s=o??!1,i=n!==void 0?J(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 df({blockHash:t,blockNumber:n});return(((f=(u=(l=e.chain)==null?void 0:l.formatters)==null?void 0:u.block)==null?void 0:f.format)||hf)(c,"getBlock")}async function ua(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function qg(e,t){return mf(e,t)}async function mf(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 l=n||await X(e,At,"getBlock")({}),u=await c({block:l,client:e,request:o});if(u===null)throw new Error;return u}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Lt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):X(e,At,"getBlock")({}),X(e,ua,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new ca;const l=a-c.baseFeePerGas;return l<0n?0n:l}}async function Zg(e,t){return fa(e,t)}async function fa(e,t){var d,p;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,b;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((b=r==null?void 0:r.fees)==null?void 0:b.baseFeeMultiplier)??1.2})();if(i<1)throw new ff;const a=10**(((d=i.toString().split(".")[1])==null?void 0:d.length)??0),l=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await X(e,At,"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:l,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new ca;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await mf(e,{block:u,chain:r,request:o}),b=l(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??b+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??l(await X(e,ua,"getGasPrice")({}))}}async function bf(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?J(r):n]},{dedupe:!!r});return Yt(o)}function gf(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=>Ae(s))}function yf(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=>Ae(i))}function Kg(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,l=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+l,c,r)}function Yg(e,t,n){return e&t^~e&n}function Xg(e,t,n){return e&t^e&n^t&n}class Qg extends ji{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=Ri(this.buffer)}update(t){ur(this),t=fs(t),Bn(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=Ri(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){ur(this),Tu(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,fr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;Kg(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Ri(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<l;f++)c.setUint32(4*f,u[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos: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 vn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Jg=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]),wn=new Uint32Array(64);class ey extends Qg{constructor(t=32){super(64,t,8,!1),this.A=vn[0]|0,this.B=vn[1]|0,this.C=vn[2]|0,this.D=vn[3]|0,this.E=vn[4]|0,this.F=vn[5]|0,this.G=vn[6]|0,this.H=vn[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)wn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const d=wn[f-15],p=wn[f-2],h=Ft(d,7)^Ft(d,18)^d>>>3,b=Ft(p,17)^Ft(p,19)^p>>>10;wn[f]=b+wn[f-7]+h+wn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:l,H:u}=this;for(let f=0;f<64;f++){const d=Ft(c,6)^Ft(c,11)^Ft(c,25),p=u+d+Yg(c,a,l)+Jg[f]+wn[f]|0,b=(Ft(r,2)^Ft(r,13)^Ft(r,22))+Xg(r,o,s)|0;u=l,l=a,a=c,c=i+p|0,i=s,s=o,o=r,r=p+b|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,l=l+this.G|0,u=u+this.H|0,this.set(r,o,s,i,c,a,l,u)}roundClean(){fr(wn)}destroy(){this.set(0,0,0,0,0,0,0,0),fr(this.buffer)}}const vf=Au(()=>new ey),ty=vf;function ny(e,t){return ty(Pt(e,{strict:!1})?cr(e):e)}function ry(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=ny(t);return o.set([n],0),r==="bytes"?o:Ae(o)}function oy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(ry({commitment:s,to:r,version:n}));return o}const wf=6,xf=32,da=4096,Ef=xf*da,Sf=Ef*wf-1-1*da*wf;class sy extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class iy extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function ay(e){const t=typeof e.data=="string"?Bt(e.data):e.data,n=ve(t);if(!n)throw new iy;if(n>Sf)throw new sy({maxSize:Sf,size:n});const r=[];let o=!0,s=0;for(;o;){const i=qi(new Uint8Array(Ef));let c=0;for(;c<da;){const a=t.slice(s,s+(xf-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=>Ae(i.bytes))}function cy(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??ay({data:t}),s=e.commitments??gf({blobs:o,kzg:n,to:r}),i=e.proofs??yf({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 ly(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 Pg({transaction:e})}function uy(e,{docsPath:t,...n}){const r=(()=>{const o=vs(e,n);return o instanceof So?e:o})();return new Tg(r,{docsPath:t,...n})}async function pa(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Yt(t)}async function Pf(e,t){var m,g,v,A,N;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:c,data:a,gas:l,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:d,maxPriorityFeePerGas:p,nonce:h,nonceManager:b,to:S,type:P,value:x,...w}=t,$=await(async()=>{if(!n||!b||typeof h<"u")return h;const O=tt(n),D=s?s.id:await X(e,pa,"getChainId")({});return await b.consume({address:O.address,chainId:D,client:e})})();yr(t);const k=(g=(m=s==null?void 0:s.formatters)==null?void 0:m.transactionRequest)==null?void 0:g.format,F=(k||Po)({...ws(w,{format:k}),account:n?tt(n):void 0,accessList:r,authorizationList:o,blobs:c,blobVersionedHashes:i,data:a,gas:l,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:d,maxPriorityFeePerGas:p,nonce:$,to:S,type:P,value:x},"fillTransaction");try{const O=await e.request({method:"eth_fillTransaction",params:[F]}),y=(((A=(v=s==null?void 0:s.formatters)==null?void 0:v.transaction)==null?void 0:A.format)||la)(O.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const C=await(async()=>{var j,z;if(typeof((j=s==null?void 0:s.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const _=await X(e,At,"getBlock")({});return s.fees.baseFeeMultiplier({block:_,client:e,request:t})}return((z=s==null?void 0:s.fees)==null?void 0:z.baseFeeMultiplier)??1.2})();if(C<1)throw new ff;const T=10**(((N=C.toString().split(".")[1])==null?void 0:N.length)??0),L=j=>j*BigInt(Math.ceil(C*T))/BigInt(T);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=L(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=L(y.gasPrice)),{raw:O.raw,transaction:{from:F.from,...y}}}catch(O){throw uy(O,{...t,chain:e.chain})}}const fy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Tf=new Map,ha=new ps(128);async function $f(e,t){var $,k,B;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=fy);const{account:r,chain:o=e.chain,nonceManager:s,parameters:i}=n,c=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function l(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await X(e,pa,"getChainId")({}),a))}const u=r&&tt(r);let f=n.nonce;if(i.includes("nonce")&&typeof f>"u"&&u&&s){const F=await l();f=await s.consume({address:u.address,chainId:F,client:e})}c!=null&&c.fn&&(($=c.runAt)!=null&&$.includes("beforeFillTransaction"))&&(n=await c.fn({...n,chain:o},{phase:"beforeFillTransaction"}),f??(f=n.nonce));const p=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||ha.get(e.uid)===!1||!["fees","gas"].some(m=>i.includes(m))?!1:!!(i.includes("chainId")&&typeof n.chainId!="number"||i.includes("nonce")&&typeof f!="number"||i.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof n.gas!="bigint"))?await X(e,Pf,"fillTransaction")({...n,nonce:f}).then(F=>{const{chainId:m,from:g,gas:v,gasPrice:A,nonce:N,maxFeePerBlobGas:O,maxFeePerGas:D,maxPriorityFeePerGas:y,type:C,...I}=F.transaction;return ha.set(e.uid,!0),{...n,...g?{from:g}:{},...C&&!n.type?{type:C}:{},...typeof m<"u"?{chainId:m}:{},...typeof v<"u"?{gas:v}:{},...typeof A<"u"?{gasPrice:A}:{},...typeof N<"u"?{nonce:N}:{},...typeof O<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:O}:{},...typeof D<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:D}:{},...typeof y<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in I&&typeof I.nonceKey<"u"?{nonceKey:I.nonceKey}:{}}}).catch(F=>{var v;const m=F;return m.name!=="TransactionExecutionError"||((v=m.walk)==null?void 0:v.call(m,A=>{const N=A;return N.name==="MethodNotFoundRpcError"||N.name==="MethodNotSupportedRpcError"}))&&ha.set(e.uid,!1),n}):n;f??(f=p.nonce),n={...p,...u?{from:u==null?void 0:u.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:b,kzg:S,type:P}=n;c!=null&&c.fn&&((k=c.runAt)!=null&&k.includes("beforeFillParameters"))&&(n=await c.fn({...n,chain:o},{phase:"beforeFillParameters"}));let x;async function w(){return x||(x=await X(e,At,"getBlock")({blockTag:"latest"}),x)}if(i.includes("nonce")&&typeof f>"u"&&u&&!s&&(n.nonce=await X(e,bf,"getTransactionCount")({address:u.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&S){const F=gf({blobs:h,kzg:S});if(i.includes("blobVersionedHashes")){const m=oy({commitments:F,to:"hex"});n.blobVersionedHashes=m}if(i.includes("sidecars")){const m=yf({blobs:h,commitments:F,kzg:S}),g=cy({blobs:h,commitments:F,proofs:m,to:"hex"});n.sidecars=g}}if(i.includes("chainId")&&(n.chainId=await l()),(i.includes("fees")||i.includes("type"))&&typeof P>"u")try{n.type=ly(n)}catch{let F=Tf.get(e.uid);if(typeof F>"u"){const m=await w();F=typeof(m==null?void 0:m.baseFeePerGas)=="bigint",Tf.set(e.uid,F)}n.type=F?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const F=await w(),{maxFeePerGas:m,maxPriorityFeePerGas:g}=await fa(e,{block:F,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<g)throw new Vg({maxPriorityFeePerGas:g});n.maxPriorityFeePerGas=g,n.maxFeePerGas=m}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new ca;if(typeof n.gasPrice>"u"){const F=await w(),{gasPrice:m}=await fa(e,{block:F,chain:o,request:n,type:"legacy"});n.gasPrice=m}}return i.includes("gas")&&typeof b>"u"&&(n.gas=await X(e,ma,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),c!=null&&c.fn&&((B=c.runAt)!=null&&B.includes("afterFillParameters"))&&(n=await c.fn({...n,chain:o},{phase:"afterFillParameters"})),yr(n),delete n.parameters,n}async function ma(e,t){var i,c,a;const{account:n=e.account,prepare:r=!0}=t,o=n?tt(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const l=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await cf({authorization:t.authorizationList[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:f,blobs:d,blobVersionedHashes:p,blockNumber:h,blockTag:b,data:S,gas:P,gasPrice:x,maxFeePerBlobGas:w,maxFeePerGas:$,maxPriorityFeePerGas:k,nonce:B,value:F,stateOverride:m,...g}=r?await $f(e,{...t,parameters:s,to:l}):t;if(P&&t.gas!==P)return P;const A=(typeof h=="bigint"?J(h):void 0)||b,N=aa(m);yr(t);const O=(a=(c=(i=e.chain)==null?void 0:i.formatters)==null?void 0:c.transactionRequest)==null?void 0:a.format,y=(O||Po)({...ws(g,{format:O}),account:o,accessList:u,authorizationList:f,blobs:d,blobVersionedHashes:p,data:S,gasPrice:x,maxFeePerBlobGas:w,maxFeePerGas:$,maxPriorityFeePerGas:k,nonce:B,to:l,value:F},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:N?[y,A??e.experimental_blockTag??"latest",N]:A?[y,A]:[y]}))}catch(l){throw zg(l,{...t,account:o,chain:e.chain})}}async function dy(e,t){var l;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(l=e.dataSuffix)==null?void 0:l.value,...c}=t,a=lt({abi:n,args:o,functionName:s});try{return await X(e,ma,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const f=c.account?tt(c.account):void 0;throw br(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:f==null?void 0:f.address})}}function To(e,t){if(!ct(e,{strict:!1}))throw new bn({address:e});if(!ct(t,{strict:!1}))throw new bn({address:t});return e.toLowerCase()===t.toLowerCase()}function Rt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const Af="/docs/contract/decodeEventLog";function xs(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new Jb({docsPath:Af});const a=t.find(P=>P.type==="event"&&i===ds(St(P)));if(!(a&&"name"in a)||a.type!=="event")throw new e1(i,{docsPath:Af});const{name:l,inputs:u}=a,f=u==null?void 0:u.some(P=>!("name"in P&&P.name)),d=f?[]:{},p=u.map((P,x)=>[P,x]).filter(([P])=>"indexed"in P&&P.indexed),h=[];for(let P=0;P<p.length;P++){const[x,w]=p[P],$=c[P];if(!$){if(s)throw new Bi({abiItem:a,param:x});h.push([x,w]);continue}d[f?w:x.name||w]=py({param:x,value:$})}const b=u.filter(P=>!("indexed"in P&&P.indexed)),S=s?b:[...h.map(([P])=>P),...b];if(S.length>0){if(n&&n!=="0x")try{const P=Xr(S,n);if(P){let x=0;if(!s)for(const[w,$]of h)d[f?$:w.name||$]=P[x++];if(f)for(let w=0;w<u.length;w++)d[w]===void 0&&x<P.length&&(d[w]=P[x++]);else for(let w=0;w<b.length;w++)d[b[w].name]=P[x++]}}catch(P){if(s)throw P instanceof pu||P instanceof qu?new ls({abiItem:a,data:n,params:S,size:ve(n)}):P}else if(s)throw new ls({abiItem:a,data:"0x",params:S,size:0})}return{eventName:l,args:Object.values(d).length>0?d:void 0}}function py({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Xr([e],t)||[])[0]}function ba(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),i=t.filter(c=>c.type==="event").map(c=>({abi:c,selector:ds(c)}));return r.map(c=>{var d;const a=typeof c.blockNumber=="string"?Rt(c):c,l=i.filter(p=>a.topics[0]===p.selector);if(l.length===0)return null;let u,f;for(const p of l)try{u=xs({...a,abi:[p.abi],strict:!0}),f=p;break}catch{}if(!u&&!o){f=l[0];try{u=xs({data:a.data,topics:a.topics,abi:[f.abi],strict:!1})}catch{const p=(d=f.abi.inputs)==null?void 0:d.some(h=>!("name"in h&&h.name));return{...a,args:p?[]:{},eventName:f.abi.name}}}return!u||!f||s&&!s.includes(u.eventName)||!hy({args:u.args,inputs:f.abi.inputs,matchArgs:n})?null:{...u,...a}}).filter(Boolean)}function hy(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"?To(i,c):s.type==="string"||s.type==="bytes"?De(cr(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(l=>o(c,l,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(l=>l.name===s);return c?(Array.isArray(i)?i:[i]).some(l=>o(c,l,t[s])):!1}):!1}async function ga(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const l=a??!1,u=i??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(b=>Yr({abi:[b],eventName:b.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"?J(r):r,toBlock:typeof o=="bigint"?J(o):o}]});const p=d.map(h=>Rt(h));return u?ba({abi:u,args:c,logs:p,strict:l}):p}async function Nf(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:l}=t,u=i?Rn({abi:n,name:i}):void 0,f=u?void 0:n.filter(d=>d.type==="event");return X(e,ga,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:c,toBlock:a,strict:l})}const ya="/docs/contract/decodeFunctionResult";function xn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Rn({abi:t,args:n,name:r});if(!c)throw new ir(r,{docsPath:ya});s=c}if(s.type!=="function")throw new ir(void 0,{docsPath:ya});if(!s.outputs)throw new gu(s.name,{docsPath:ya});const i=Xr(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const va=BigInt(0),wa=BigInt(1);function $o(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function xa(e){if(!$o(e))throw new Error("Uint8Array expected")}function Ao(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function Es(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===""?va:BigInt("0x"+e)}const Of=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",my=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function No(e){if(xa(e),Of)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=my[e[n]];return t}const en={_0:48,_9:57,A:65,F:70,a:97,f:102};function If(e){if(e>=en._0&&e<=en._9)return e-en._0;if(e>=en.A&&e<=en.F)return e-(en.A-10);if(e>=en.a&&e<=en.f)return e-(en.a-10)}function Ss(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Of)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=If(e.charCodeAt(s)),c=If(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 Un(e){return Cf(No(e))}function Df(e){return xa(e),Cf(No(Uint8Array.from(e).reverse()))}function Co(e,t){return Ss(e.toString(16).padStart(t*2,"0"))}function Mf(e,t){return Co(e,t).reverse()}function ut(e,t,n){let r;if(typeof t=="string")try{r=Ss(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if($o(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}function Ps(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];xa(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}const Ea=e=>typeof e=="bigint"&&va<=e;function Sa(e,t,n){return Ea(e)&&Ea(t)&&Ea(n)&&t<=e&&e<n}function vr(e,t,n,r){if(!Sa(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function by(e){let t;for(t=0;e>va;e>>=wa,t+=1);return t}const Ts=e=>(wa<<BigInt(e))-wa,Pa=e=>new Uint8Array(e),kf=e=>Uint8Array.from(e);function gy(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Pa(e),o=Pa(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},c=(...f)=>n(o,r,...f),a=(f=Pa(0))=>{o=c(kf([0]),f),r=c(),f.length!==0&&(o=c(kf([1]),f),r=c())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<t;){r=c();const p=r.slice();d.push(p),f+=r.length}return Ps(...d)};return(f,d)=>{i(),a(f);let p;for(;!(p=d(l()));)a();return i(),p}}const yy={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||$o(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function $s(e,t,n={}){const r=(o,s,i)=>{const c=yy[s];if(typeof c!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!c(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function 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 vy="0.1.1";function wy(){return vy}class te extends Error{static setStaticOptions(t){te.prototype.docsOrigin=t.docsOrigin,te.prototype.showVersion=t.showVersion,te.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var u;if(n.cause instanceof te){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),o=n.cause instanceof te&&n.cause.docsPath||n.docsPath,s=n.docsOrigin??te.prototype.docsOrigin,i=`${s}${o??""}`,c=!!(n.version??te.prototype.showVersion),a=n.version??te.prototype.version,l=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o||c?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0,c?`Version: ${a}`:void 0]:[]].filter(u=>typeof u=="string").join(`
88
+ `);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=i,this.docsOrigin=s,this.docsPath=o,this.shortMessage=t,this.showVersion=c,this.version=a}walk(t){return Bf(this,t)}}Object.defineProperty(te,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${wy()}`}}),te.setStaticOptions(te.defaultStaticOptions);function Bf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Bf(e.cause,t):t?null:e}function Oo(e,t){if(wr(e)>t)throw new Fy({givenSize:wr(e),maxSize:t})}const tn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ff(e){if(e>=tn.zero&&e<=tn.nine)return e-tn.zero;if(e>=tn.A&&e<=tn.F)return e-(tn.A-10);if(e>=tn.a&&e<=tn.f)return e-(tn.a-10)}function xy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Ry({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 Rf(e,t={}){const{dir:n="left"}=t;let r=e,o=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)o++;return r=n==="left"?r.slice(o):r.slice(0,r.length-o),r}function As(e,t){if(nt(e)>t)throw new Hy({givenSize:nt(e),maxSize:t})}function Ey(e,t){if(typeof t=="number"&&t>0&&t>nt(e)-1)throw new Kf({offset:t,position:"start",size:nt(e)})}function Sy(e,t,n){if(typeof t=="number"&&typeof n=="number"&&nt(e)!==n-t)throw new Kf({offset:n,position:"end",size:nt(e)})}function jf(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const o=e.replace("0x","");if(o.length>r*2)throw new Vy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Py="#__bigint";function _f(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+Py:o,n)}const Ty=new TextDecoder,$y=new TextEncoder;function Ay(e){return e instanceof Uint8Array?e:typeof e=="string"?zf(e):Ny(e)}function Ny(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function zf(e,t={}){const{size:n}=t;let r=e;n&&(As(e,n),r=Hn(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 l=Ff(o.charCodeAt(a++)),u=Ff(o.charCodeAt(a++));if(l===void 0||u===void 0)throw new te(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=l<<4|u}return i}function Cy(e,t={}){const{size:n}=t,r=$y.encode(e);return typeof n=="number"?(Oo(r,n),Oy(r,n)):r}function Oy(e,t){return xy(e,{dir:"right",size:t})}function wr(e){return e.length}function Iy(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function Dy(e,t={}){const{size:n}=t;typeof n<"u"&&Oo(e,n);const r=Ct(e,t);return Hf(r,t)}function My(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Oo(r,n),r=Uf(r)),r.length>1||r[0]>1)throw new By(r);return!!r[0]}function nn(e,t={}){const{size:n}=t;typeof n<"u"&&Oo(e,n);const r=Ct(e,t);return Vf(r,t)}function ky(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Oo(r,n),r=Ly(r)),Ty.decode(r)}function Uf(e){return Rf(e,{dir:"left"})}function Ly(e){return Rf(e,{dir:"right"})}class By extends te{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let Fy=class extends te{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"})}},Ry=class extends te{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 jy=new TextEncoder,_y=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 qf(e);if(typeof e!="string")throw new qf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Zf(e);if(!e.startsWith("0x"))throw new Zf(e)}function Nt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Uy(e){return e instanceof Uint8Array?Ct(e):Array.isArray(e)?Ct(new Uint8Array(e)):e}function Wf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(As(n,t.size),Wn(n,t.size)):n}function Ct(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=_y[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(As(r,t.size),Hn(r,t.size)):r}function Be(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 l=typeof e=="bigint"?"n":"";throw new Gf({max:s?`${s}${l}`:void 0,min:`${i}${l}`,signed:n,size:r,value:`${e}${l}`})}const a=`0x${(n&&o<0?BigInt.asUintN(r*8,BigInt(o)):o).toString(16)}`;return r?Wn(a,r):a}function Ta(e,t={}){return Ct(jy.encode(e),t)}function Wn(e,t){return jf(e,{dir:"left",size:t})}function Hn(e,t){return jf(e,{dir:"right",size:t})}function jt(e,t,n,r={}){const{strict:o}=r;Ey(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&Sy(s,t,n),s}function nt(e){return Math.ceil((e.length-2)/2)}function Hf(e,t={}){const{signed:n}=t;t.size&&As(e,t.size);const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n)-1n,i=s>>1n;return r<=i?r:r-s-1n}function Vf(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:Hf(e,t))}function Wy(e,t={}){const{strict:n=!1}=t;try{return zy(e,{strict:n}),!0}catch{return!1}}class Gf extends te{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 qf extends te{constructor(t){super(`Value \`${typeof t=="object"?_f(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 Zf extends te{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 Hy extends te{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 Kf extends te{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 te{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:Be(e.amount),index:Be(e.index),validatorIndex:Be(e.validatorIndex)}}function Yf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Be(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Be(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Be(e.gasLimit)},...typeof e.number=="bigint"&&{number:Be(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Be(e.prevRandao)},...typeof e.time=="bigint"&&{time:Be(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Gy)}}}const xr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],$a=[{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"}]}],Xf=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],Qf=[...Xf,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],qy=[...Xf,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],Jf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],ed=[{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"}]}],td=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],nd=[{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"}],Er=[{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",rd="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Ky="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Yy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Aa="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class Na 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 od extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const Ca="/docs/contract/encodeDeployData";function Oa(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 Zb({docsPath:Ca});if(!("inputs"in o))throw new du({docsPath:Ca});if(!o.inputs||o.inputs.length===0)throw new du({docsPath:Ca});const s=gn(o.inputs,n);return dr([r,s])}function Sr({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 Na({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Na({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function sd(e,{docsPath:t,...n}){const r=(()=>{const o=vs(e,n);return o instanceof So?e:o})();return new ef(r,{docsPath:t,...n})}function id(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Ia=new Map;function ad({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const u=a();i();const f=u.map(({args:d})=>d);f.length!==0&&e(f).then(d=>{o&&Array.isArray(d)&&d.sort(o);for(let p=0;p<u.length;p++){const{resolve:h}=u[p];h==null||h([d[p],d])}}).catch(d=>{for(let p=0;p<u.length;p++){const{reject:h}=u[p];h==null||h(d)}})},i=()=>Ia.delete(t),c=()=>a().map(({args:u})=>u),a=()=>Ia.get(t)||[],l=u=>Ia.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:d,reject:p}=id();return(n==null?void 0:n([...c(),u]))&&s(),a().length>0?(l({args:u,resolve:d,reject:p}),f):(l({args:u,resolve:d,reject:p}),setTimeout(s,r),f)}}}async function Pr(e,t){var O,D,y,C;const{account:n=e.account,authorizationList:r,batch:o=!!((O=e.batch)!=null&&O.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:l,code:u,data:f,factory:d,factoryData:p,gas:h,gasPrice:b,maxFeePerBlobGas:S,maxFeePerGas:P,maxPriorityFeePerGas:x,nonce:w,to:$,value:k,stateOverride:B,...F}=t,m=n?tt(n):void 0;if(u&&(d||p))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&$)throw new V("Cannot provide both `code` & `to` as parameters.");const g=u&&f,v=d&&p&&$&&f,A=g||v,N=g?cd({code:u,data:f}):v?Jy({data:f,factory:d,factoryData:p,to:$}):f;try{yr(t);const T=(typeof s=="bigint"?J(s):void 0)||i,L=l?Yf(l):void 0,j=aa(B),z=(C=(y=(D=e.chain)==null?void 0:D.formatters)==null?void 0:y.transactionRequest)==null?void 0:C.format,W=(z||Po)({...ws(F,{format:z}),accessList:c,account:m,authorizationList:r,blobs:a,data:N,gas:h,gasPrice:b,maxFeePerBlobGas:S,maxFeePerGas:P,maxPriorityFeePerGas:x,nonce:w,to:A?void 0:$,value:k},"call");if(o&&Xy({request:W})&&!j&&!L)try{return await Qy(e,{...W,blockNumber:s,blockTag:i})}catch(H){if(!(H instanceof od)&&!(H instanceof Na))throw H}const K=(()=>{const H=[W,T];return j&&L?[...H,j,L]:j?[...H,j]:L?[...H,{},L]:H})(),G=await e.request({method:"eth_call",params:K});return G==="0x"?{data:void 0}:{data:G}}catch(I){const T=ev(I),{offchainLookup:L,offchainLookupSignature:j}=await Promise.resolve().then(()=>Jv);if(e.ccipRead!==!1&&(T==null?void 0:T.slice(0,10))===j&&$)return{data:await L(e,{data:T,to:$})};throw A&&(T==null?void 0:T.slice(0,10))==="0x101bb98d"?new Og({factory:d}):sd(I,{...t,account:m,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 b;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((b=e.batch)==null?void 0:b.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:c,to:a}=t,l=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Sr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new od})(),f=(typeof s=="bigint"?J(s):void 0)||i,{schedule:d}=ad({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(S){return S.reduce((x,{data:w})=>x+(w.length-2),0)>n*2},fn:async S=>{const P=S.map($=>({allowFailure:!0,callData:$.data,target:$.to})),x=lt({abi:xr,args:[P],functionName:"aggregate3"}),w=await e.request({method:"eth_call",params:[{...l===null?{data:cd({code:Aa,data:x})}:{to:l,data:x}},f]});return xn({abi:xr,args:[P],functionName:"aggregate3",data:w||"0x"})}}),[{returnData:p,success:h}]=await d({data:c,to:a});if(!h)throw new bs({data:p});return p==="0x"?{data:void 0}:{data:p}}function cd(e){const{code:t,data:n}=e;return Oa({abi:au(["constructor(bytes, bytes)"]),bytecode:rd,args:[t,n]})}function Jy(e){const{data:t,factory:n,factoryData:r,to:o}=e;return Oa({abi:au(["constructor(address, bytes, address, bytes)"]),bytecode:Ky,args:[o,t,n,r]})}function ev(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 Ot(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=lt({abi:n,args:o,functionName:s});try{const{data:a}=await X(e,Pr,"call")({...i,data:c,to:r});return xn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw br(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function tv(e,t){var u;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...c}=t,a=c.account?tt(c.account):e.account,l=lt({abi:n,args:o,functionName:s});try{const{data:f}=await X(e,Pr,"call")({batch:!1,data:`${l}${i?i.replace("0x",""):""}`,to:r,...c,account:a}),d=xn({abi:n,args:o,functionName:s,data:f||"0x"}),p=n.filter(h=>"name"in h&&h.name===t.functionName);return{result:d,request:{abi:p,address:r,args:o,dataSuffix:i,functionName:s,...c,account:a}}}catch(f){throw br(f,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:a==null?void 0:a.address})}}const Da=new Map,ld=new Map;let nv=0;function En(e,t,n){const r=++nv,o=()=>Da.get(e)||[],s=()=>{const u=o();Da.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(d=>d.id===r))return;const f=ld.get(e);if(u.length===1&&f){const d=f();d instanceof Promise&&d.catch(()=>{})}s()},c=o();if(Da.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const u in t)a[u]=(...f)=>{var p,h;const d=o();if(d.length!==0)for(const b of d)(h=(p=b.fns)[u])==null||h.call(p,...f)};const l=n(a);return typeof l=="function"&&ld.set(e,l),i}async function Ma(e){return new Promise(t=>setTimeout(t,e))}function Io(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 Ma(a);const l=async()=>{o&&(await e({unpoll:s}),await Ma(r),l())};l()})(),s}const rv=new Map,ov=new Map;function sv(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,rv),r=t(e,ov);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function iv(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=sv(t),o=r.response.get();if(o&&n>0&&Date.now()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const av=e=>`blockNumber.${e}`;async function Do(e,{cacheTime:t=e.cacheTime}={}){const n=await iv(()=>e.request({method:"eth_blockNumber"}),{cacheKey:av(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=>Rt(s));return!("abi"in t)||!t.abi?o:ba({abi:t.abi,logs:o,strict:n})}async function Cs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function cv(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:l,poll:u,pollingInterval:f=e.pollingInterval,strict:d}=t;return(typeof u<"u"?u: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 S=d??!1,P=Ne(["watchContractEvent",r,o,s,e.uid,i,f,S,c]);return En(P,{onLogs:l,onError:a},x=>{let w;c!==void 0&&(w=c-1n);let $,k=!1;const B=Io(async()=>{var F;if(!k){try{$=await X(e,Wu,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:S,fromBlock:c})}catch{}k=!0;return}try{let m;if($)m=await X(e,Ns,"getFilterChanges")({filter:$});else{const g=await X(e,Do,"getBlockNumber")({});w&&w<g?m=await X(e,Nf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:w+1n,toBlock:g,strict:S}):m=[],w=g}if(m.length===0)return;if(s)x.onLogs(m);else for(const g of m)x.onLogs([g])}catch(m){$&&m instanceof yn&&(k=!1),(F=x.onError)==null||F.call(x,m)}},{emitOnBegin:!0,interval:f});return async()=>{$&&await X(e,Cs,"uninstallFilter")({filter:$}),B()}})})():(()=>{const S=d??!1,P=Ne(["watchContractEvent",r,o,s,e.uid,i,f,S]);let x=!0,w=()=>x=!1;return En(P,{onLogs:l,onError:a},$=>((async()=>{try{const k=(()=>{if(e.transport.type==="fallback"){const m=e.transport.transports.find(g=>g.config.type==="webSocket"||g.config.type==="ipc");return m?m.value:e.transport}return e.transport})(),B=i?Yr({abi:n,eventName:i,args:o}):[],{unsubscribe:F}=await k.subscribe({params:["logs",{address:r,topics:B}],onData(m){var v;if(!x)return;const g=m.result;try{const{eventName:A,args:N}=xs({abi:n,data:g.data,topics:g.topics,strict:d}),O=Rt(g,{args:N,eventName:A});$.onLogs([O])}catch(A){let N,O;if(A instanceof ls||A instanceof Bi){if(d)return;N=A.abiItem.name,O=(v=A.abiItem.inputs)==null?void 0:v.some(y=>!("name"in y&&y.name))}const D=Rt(g,{args:O?[]:{},eventName:N});$.onLogs([D])}},onError(m){var g;(g=$.onError)==null||g.call($,m)}});w=F,x||w()}catch(k){a==null||a(k)}})(),()=>w()))})()}async function lv(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function ka(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:l})=>{const u=typeof t=="function"?t({count:c,error:l}):t;u&&await Ma(u),i({count:c+1})};try{const l=await e();o(l)}catch(l){if(c<n&&await r({count:c,error:l}))return a({error:l});s(l)}};i()})}const uv={"0x0":"reverted","0x1":"success"};function ud(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Rt(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Yt(e.transactionIndex):null,status:e.status?uv[e.status]:null,type:e.type?pf[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const La=256;let Os=La,Is;function fd(e=11){if(!Is||Os+e>La*2){Is="",Os=0;for(let t=0;t<La;t++)Is+=(256+Math.random()*256|0).toString(16).substring(1)}return Is.substring(Os,Os+++e)}function fv(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:o,key:s="base",name:i="Base Client",type:c="base"}=e,a=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),l=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(l/2),500),4e3),f=e.pollingInterval??u,d=e.cacheTime??f,p=e.account?tt(e.account):void 0,{config:h,request:b,value:S}=e.transport({account:p,chain:n,pollingInterval:f}),P={...h,...S},x={account:p,batch:t,cacheTime:d,ccipRead:r,chain:n,dataSuffix:o,key:s,name:i,pollingInterval:f,request:b,transport:P,type:c,uid:fd(),...a?{experimental_blockTag:a}:{}};function w($){return k=>{const B=k($);for(const m in x)delete B[m];const F={...$,...B};return Object.assign(F,{extend:w(F)})}}return Object.assign(x,{extend:w(x)})}function Ba(e){var n,r,o,s,i,c;if(!(e instanceof V))return!1;const t=e.walk(a=>a instanceof Xi);return t instanceof Xi?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((c=t.data)==null?void 0:c.errorName)==="UnsupportedResolverProfile":!1}function dv(e){const{abi:t,data:n}=e,r=Fn(n,0,4),o=t.find(s=>s.type==="function"&&r===Kr(St(s)));if(!o)throw new t1(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Xr(o.inputs,Fn(n,4)):void 0}}const Fa="/docs/contract/encodeErrorResult";function dd(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Rn({abi:t,args:r,name:n});if(!a)throw new hu(n,{docsPath:Fa});o=a}if(o.type!=="error")throw new hu(void 0,{docsPath:Fa});const s=St(o),i=Kr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new Qb(o.name,{docsPath:Fa});c=gn(o.inputs,r)}return dr([i,c])}const Ra="/docs/contract/encodeFunctionResult";function pv(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Rn({abi:t,name:n});if(!i)throw new ir(n,{docsPath:Ra});o=i}if(o.type!=="function")throw new ir(void 0,{docsPath:Ra});if(!o.outputs)throw new gu(o.name,{docsPath:Ra});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new yu(r)})();return gn(o.outputs,s)}const Mo="x-batch-gateway:true";async function pd(e){const{data:t,ccipRequest:n}=e,{args:[r]}=dv({abi:$a,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(Mo)?await pd({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=hv(a)}})),pv({abi:$a,functionName:"query",result:[o,s]})}function hv(e){return e.name==="HttpRequestError"&&e.status?dd({abi:$a,errorName:"HttpError",args:[e.status,e.shortMessage]}):dd({abi:[Vu],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function hd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Pt(t)?t:null}function ja(e){let t=new Uint8Array(32).fill(0);if(!e)return Ae(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=hd(n[r]),s=o?cr(o):De(Ln(n[r]),"bytes");t=De($t([t,s]),"bytes")}return Ae(t)}function mv(e){return`[${e.slice(2)}]`}function bv(e){const t=new Uint8Array(32).fill(0);return e?hd(e)||De(Ln(e)):Ae(t)}function _a(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Ln(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Ln(o[s]);i.byteLength>255&&(i=Ln(mv(bv(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 gv(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Sr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(d=>s.endsWith(d)))return null;const f=o!=null?[ja(s),BigInt(o)]:[ja(s)];try{const d=lt({abi:ed,functionName:"addr",args:f}),p={address:l,abi:Qf,functionName:"resolveWithGateways",args:[mn(_a(s)),d,i??[Mo]],blockNumber:n,blockTag:r},b=await X(e,Ot,"readContract")(p);if(b[0]==="0x")return null;const S=xn({abi:ed,args:f,functionName:"addr",data:b[0]});return S==="0x"||kn(S)==="0x00"?null:S}catch(d){if(c)throw d;if(Ba(d))return null;throw d}}class yv 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 ko extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class za 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 vv extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const wv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,xv=/^(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>\/.*)?$/,Ev=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Sv=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Pv(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function md(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function bd({uri:e,gatewayUrls:t}){const n=Ev.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=md(t==null?void 0:t.ipfs,"https://ipfs.io"),o=md(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(wv),{protocol:i,subpath:c,target:a,subtarget:l=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||xv.test(e);if(e.startsWith("http")&&!u&&!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((u||f)&&a)return{uri:`${r}/${u?"ipns":"ipfs"}/${a}${l}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${l||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(Sv,"");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 za({uri:e})}function gd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new yv({data:e});return e.image||e.image_url||e.image_data}async function Tv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Ua({gatewayUrls:e,uri:gd(n)})}catch{throw new za({uri:t})}}async function Ua({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=bd({uri:t,gatewayUrls:e});if(r||await Pv(n))return n;throw new za({uri:t})}function $v(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 ko({reason:"Only EIP-155 supported"});if(!i)throw new ko({reason:"Chain ID not found"});if(!a)throw new ko({reason:"Contract address not found"});if(!o)throw new ko({reason:"Token ID not found"});if(!c)throw new ko({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function Av(e,{nft:t}){if(t.namespace==="erc721")return Ot(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 Ot(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 vv({namespace:t.namespace})}async function Nv(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Cv(e,{gatewayUrls:t,record:n}):Ua({uri:n,gatewayUrls:t})}async function Cv(e,{gatewayUrls:t,record:n}){const r=$v(n),o=await Av(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=bd({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const l=c?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(l);return Ua({uri:gd(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Tv({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function yd(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Sr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(f=>s.endsWith(f)))return null;try{const f={address:l,abi:Qf,args:[mn(_a(s)),lt({abi:Jf,functionName:"text",args:[ja(s),o]}),i??[Mo]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},p=await X(e,Ot,"readContract")(f);if(p[0]==="0x")return null;const h=xn({abi:Jf,functionName:"text",data:p[0]});return h===""?null:h}catch(f){if(c)throw f;if(Ba(f))return null;throw f}}async function Ov(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await X(e,yd,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await Nv(e,{record:a,gatewayUrls:r})}catch{return null}}async function Iv(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Sr({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const u={address:l,abi:qy,args:[n,s,i??[Mo]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=X(e,Ot,"readContract"),[d]=await f(u);return d||null}catch(u){if(c)throw u;if(Ba(u))return null;throw u}}async function Dv(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 Sr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(l=>o.endsWith(l)))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 X(e,Ot,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[mn(_a(o))],blockNumber:n,blockTag:r});return a}async function vd(e,t){var S,P,x;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:d,value:p,...h}=t,b=n?tt(n):void 0;try{yr(t);const $=(typeof r=="bigint"?J(r):void 0)||o,k=(x=(P=(S=e.chain)==null?void 0:S.formatters)==null?void 0:P.transactionRequest)==null?void 0:x.format,F=(k||Po)({...ws(h,{format:k}),account:b,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:d,value:p},"createAccessList"),m=await e.request({method:"eth_createAccessList",params:[F,$]});return{accessList:m.accessList,gasUsed:BigInt(m.gasUsed)}}catch(w){throw sd(w,{...t,account:b,chain:e.chain})}}async function Mv(e){const t=ms(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function wd(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),l=ms(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(p=>Yr({abi:[p],eventName:p.name,args:n}))],r&&(u=u[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?J(s):s,toBlock:typeof c=="bigint"?J(c):c,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:l(f),strict:!!i,toBlock:c,type:"event"}}async function xd(e){const t=ms(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function kv(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var i,c,a;if((i=e.batch)!=null&&i.multicall&&((a=(c=e.chain)==null?void 0:c.contracts)!=null&&a.multicall3)){const l=e.chain.contracts.multicall3.address,u=lt({abi:xr,functionName:"getEthBalance",args:[t]}),{data:f}=await X(e,Pr,"call")({to:l,data:u,blockNumber:n,blockTag:r});return xn({abi:xr,functionName:"getEthBalance",args:[t],data:f||"0x"})}const o=typeof n=="bigint"?J(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Lv(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Bv(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?J(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}),Yt(s)}async function Ds(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?J(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}async function Fv(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=await Ds(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(o&&ve(o)===23&&o.startsWith("0xef0100"))return Qt(Fn(o,3,23))}class Rv 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 jv(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,l,u,f]=await X(e,Ot,"readContract")({abi:_v,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:l,salt:u},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Rv({address:n}):i}}const _v=[{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 zv(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 Uv(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?J(n):void 0,i=await e.request({method:"eth_feeHistory",params:[J(t),s||r,o]},{dedupe:!!s});return zv(i)}async function Wv(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Rt(s));return t.abi?ba({abi:t.abi,logs:o,strict:n}):o}async function Hv({address:e,authorization:t,signature:n}){return To(Qt(e),await cf({authorization:t,signature:n}))}const Ms=new ps(8192);function Vv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Ms.get(n))return Ms.get(n);const r=e().finally(()=>Ms.delete(n));return Ms.set(n,r),r}function Gv(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:l}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(l))throw new zn(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new zn(new Error("method not supported"),{method:l});const u=o?Gr(`${a}.${Ne(n)}`):void 0;return Vv(()=>ka(async()=>{try{return await e(n)}catch(d){const p=d;switch(p.code){case to.code:throw new to(p);case no.code:throw new no(p);case ro.code:throw new ro(p,{method:n.method});case oo.code:throw new oo(p);case _n.code:throw new _n(p);case yn.code:throw new yn(p);case so.code:throw new so(p);case io.code:throw new io(p);case ao.code:throw new ao(p);case zn.code:throw new zn(p,{method:n.method});case hr.code:throw new hr(p);case co.code:throw new co(p);case mr.code:throw new mr(p);case lo.code:throw new lo(p);case uo.code:throw new uo(p);case fo.code:throw new fo(p);case po.code:throw new po(p);case ho.code:throw new ho(p);case mo.code:throw new mo(p);case bo.code:throw new bo(p);case go.code:throw new go(p);case yo.code:throw new yo(p);case vo.code:throw new vo(p);case wo.code:throw new wo(p);case xo.code:throw new xo(p);case 5e3:throw new mr(p);case Eo.code:throw new Eo(p);default:throw d instanceof V?d:new Dg(p)}}},{delay:({count:d,error:p})=>{var h;if(p&&p instanceof jn){const b=(h=p==null?void 0:p.headers)==null?void 0:h.get("Retry-After");if(b!=null&&b.match(/\d/))return Number.parseInt(b,10)*1e3}return~~(1<<d)*i},retryCount:c,shouldRetry:({error:d})=>qv(d)}),{enabled:o,id:u})}}function qv(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===hr.code||e.code===_n.code:e instanceof jn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class Zv 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=>` ${eo(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class Kv extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${eo(n)}`,`Response: ${Ne(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Yv 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 Xv="0x556f1830",Ed={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 Qv(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Ku({data:r,abi:[Ed]}),[i,c,a,l,u]=s,{ccipRead:f}=e,d=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Sd;try{if(!To(o,i))throw new Yv({sender:i,to:o});const p=c.includes(Mo)?await pd({data:a,ccipRequest:d}):await d({data:a,sender:i,urls:c}),{data:h}=await Pr(e,{blockNumber:t,blockTag:n,data:$t([l,gn([{type:"bytes"},{type:"bytes"}],[p,u])]),to:o});return h}catch(p){throw new Zv({callbackSelector:l,cause:p,data:r,extraData:u,sender:i,urls:c})}}async function Sd({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,l=c==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:l,method:c});let f;if((o=u.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await u.json()).data:f=await u.text(),!u.ok){r=new jn({body:a,details:f!=null&&f.error?Ne(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!Pt(f)){r=new Kv({result:f,url:i});continue}return f}catch(u){r=new jn({body:a,details:u.message,url:i})}}throw r}const Jv=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Sd,offchainLookup:Qv,offchainLookupAbiItem:Ed,offchainLookupSignature:Xv},Symbol.toStringTag,{value:"Module"}));function ew(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return o=>{const s=typeof o=="function"?o(r):o,i={...r,...s};return Object.assign(i,{extend:n(i)})}}return Object.assign(t,{extend:n(t)})}function tw(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 nw(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Pd=nw();function rw(e,t={}){const{url:n,headers:r}=ow(e);return{async request(o){var h;const{body:s,fetchFn:i=t.fetchFn??fetch,onRequest:c=t.onRequest,onResponse:a=t.onResponse,timeout:l=t.timeout??1e4}=o,u={...t.fetchOptions??{},...o.fetchOptions??{}},{headers:f,method:d,signal:p}=u;try{const b=await tw(async({signal:P})=>{const x={...u,body:Array.isArray(s)?Ne(s.map(B=>({jsonrpc:"2.0",id:B.id??Pd.take(),...B}))):Ne({jsonrpc:"2.0",id:s.id??Pd.take(),...s}),headers:{...r,"Content-Type":"application/json",...f},method:d||"POST",signal:p||(l>0?P:null)},w=new Request(n,x),$=await(c==null?void 0:c(w,x))??{...x,url:n};return await i($.url??n,$)},{errorInstance:new nf({body:s,url:n}),timeout:l,signal:!0});a&&await a(b);let S;if((h=b.headers.get("Content-Type"))!=null&&h.startsWith("application/json"))S=await b.json();else{S=await b.text();try{S=JSON.parse(S||"{}")}catch(P){if(b.ok)throw P;S={error:S}}}if(!b.ok)throw new jn({body:s,details:Ne(S.error)||b.statusText,headers:b.headers,status:b.status,url:n});return S}catch(b){throw b instanceof jn||b instanceof nf?b:new jn({body:s,cause:b,url:n})}}}}function ow(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const sw=`Ethereum Signed Message:
89
+ `;function iw(e){const t=typeof e=="string"?Gr(e):typeof e.raw=="string"?e.raw:Ae(e.raw),n=Gr(`${sw}${ve(t)}`);return $t([n,t])}function Td(e,t){return De(iw(e),t)}class aw extends V{constructor({domain:t}){super(`Invalid domain "${Ne(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class cw 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 lw 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,types:o}=e,s=(i,c)=>{for(const a of i){const{name:l,type:u}=a,f=c[l],d=u.match(ju);if(d&&(typeof f=="number"||typeof f=="bigint")){const[b,S,P]=d;J(f,{signed:S==="int",size:Number.parseInt(P,10)/8})}if(u==="address"&&typeof f=="string"&&!ct(f))throw new bn({address:f});const p=u.match(K1);if(p){const[b,S]=p;if(S&&ve(f)!==Number.parseInt(S,10))throw new r1({expectedSize:Number.parseInt(S,10),givenSize:ve(f)})}const h=o[u];h&&(dw(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new aw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new cw({primaryType:r,types:o})}function fw({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 dw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new lw({type:e})}function pw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:fw({domain:t}),...e.types};uw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(hw({domain:t,types:o})),r!=="EIP712Domain"&&s.push($d({data:n,primaryType:r,types:o})),De($t(s))}function hw({domain:e,types:t}){return $d({data:e,primaryType:"EIP712Domain",types:t})}function $d({data:e,primaryType:t,types:n}){const r=Ad({data:e,primaryType:t,types:n});return De(r)}function Ad({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[mw({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Cd({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return gn(r,o)}function mw({primaryType:e,types:t}){const n=mn(bw({primaryType:e,types:t}));return De(n)}function bw({primaryType:e,types:t}){let n="";const r=Nd({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 Nd({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])Nd({primaryType:s.type,types:t},n);return n}function Cd({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},De(Ad({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},De(r)];if(n==="string")return[{type:"bytes32"},De(mn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Cd({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},De(gn(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class gw 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 gw(8192)}.checksum;class Od extends ji{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,T1(t);const r=fs(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),fr(s)}update(t){return ur(this),this.iHash.update(t),this}digestInto(t){ur(this),Bn(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 Id=(e,t,n)=>new Od(e,t).update(n).digest();Id.create=(e,t)=>new Od(e,t);function Dd(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=ku(Ay(e));return n==="Bytes"?r:Ct(r)}const yw=/^0x[a-fA-F0-9]{40}$/;function ks(e,t={}){const{strict:n=!0}=t;if(!yw.test(e))throw new kd({address:e,cause:new vw});if(n){if(e.toLowerCase()===e)return;if(Md(e)!==e)throw new kd({address:e,cause:new ww})}}function Md(e){if(Wa.has(e))return Wa.get(e);ks(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Dd(Cy(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 Ha(e,t={}){const{strict:n=!0}=t??{};try{return ks(e,{strict:n}),!0}catch{return!1}}class kd extends te{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 vw extends te{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 ww extends te{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const xw=/^(.*)\[([0-9]*)\]$/,Ew=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ld=/^(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)?$/,Bd=2n**256n-1n;function Tr(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=Za(t.type);if(s){const[i,c]=s;return Pw(e,{...t,type:c},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return Nw(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return Sw(e,{checksum:r});if(t.type==="bool")return Tw(e);if(t.type.startsWith("bytes"))return $w(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Aw(e,t);if(t.type==="string")return Cw(e,{staticPosition:o});throw new Xa(t.type)}const Fd=32,Va=32;function Sw(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Md(s):s)(Ct(Iy(r,-20))),32]}function Pw(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=nn(e.readBytes(Va)),l=s+a,u=l+Fd;e.setPosition(l);const f=nn(e.readBytes(Fd)),d=Lo(t);let p=0;const h=[];for(let b=0;b<f;++b){e.setPosition(u+(d?b*32:p));const[S,P]=Tr(e,t,{checksumAddress:r,staticPosition:u});p+=P,h.push(S)}return e.setPosition(s+32),[h,32]}if(Lo(t)){const a=nn(e.readBytes(Va)),l=s+a,u=[];for(let f=0;f<o;++f){e.setPosition(l+f*32);const[d]=Tr(e,t,{checksumAddress:r,staticPosition:l});u.push(d)}return e.setPosition(s+32),[u,32]}let i=0;const c=[];for(let a=0;a<o;++a){const[l,u]=Tr(e,t,{checksumAddress:r,staticPosition:s+i});i+=u,c.push(l)}return[c,i]}function Tw(e){return[My(e.readBytes(32),{size:32}),32]}function $w(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=nn(e.readBytes(32));e.setPosition(n+i);const c=nn(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Ct(a),32]}return[Ct(e.readBytes(Number.parseInt(o,10),32)),32]}function Aw(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?Dy(o,{signed:n}):nn(o,{signed:n}),32]}function Nw(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let c=0;if(Lo(t)){const a=nn(e.readBytes(Va)),l=o+a;for(let u=0;u<t.components.length;++u){const f=t.components[u];e.setPosition(l+c);const[d,p]=Tr(e,f,{checksumAddress:r,staticPosition:l});c+=p,i[s?u:f==null?void 0:f.name]=d}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const l=t.components[a],[u,f]=Tr(e,l,{checksumAddress:r,staticPosition:o});i[s?a:l==null?void 0:l.name]=u,c+=f}return[i,c]}function Cw(e,{staticPosition:t}){const n=nn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=nn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=ky(Uf(s));return e.setPosition(t+32),[i,32]}function Ow({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Ga({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Ga({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Za(r.type);if(o){const[s,i]=o;return Dw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Fw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Iw(n,{checksum:e});if(r.type==="bool")return kw(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Ld.exec(r.type)??[];return Lw(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Mw(n,{type:r.type});if(r.type==="string")return Bw(n);throw new Xa(r.type)}function qa(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(Be(t+o,{size:32})),r.push(c),o+=nt(c)):n.push(c)}return Nt(...n,...r)}function Iw(e,t){const{checksum:n=!1}=t;return ks(e,{strict:n}),{dynamic:!1,encoded:Wn(e.toLowerCase())}}function Dw(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 l=Ga({checksumAddress:n,parameter:o,value:e[a]});l.dynamic&&(i=!0),c.push(l)}if(s||i){const a=qa(c);if(s){const l=Be(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Nt(l,a):l}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Nt(...c.map(({encoded:a})=>a))}}function Mw(e,{type:t}){const[,n]=t.split("bytes"),r=nt(e);if(!n){let o=e;return r%32!==0&&(o=Hn(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Nt(Wn(Be(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new _d({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Hn(e)}}function kw(e){if(typeof e!="boolean")throw new te(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Wn(Wf(e))}}function Lw(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 Gf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Be(e,{size:32,signed:t})}}function Bw(e){const t=Ta(e),n=Math.ceil(nt(t)/32),r=[];for(let o=0;o<n;o++)r.push(Hn(jt(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Nt(Hn(Be(nt(t),{size:32})),...r)}}function Fw(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,l=Ga({checksumAddress:n,parameter:c,value:e[a]});s.push(l),l.dynamic&&(o=!0)}return{dynamic:o,encoded:o?qa(s):Nt(...s.map(({encoded:i})=>i))}}function Za(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Lo(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(Lo);const n=Za(e.type);return!!(n&&Lo({...e,type:n[1]}))}const Rw={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 zw({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new _w({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Rd({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 Rd({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 jw(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Rw);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Rd extends te{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class _w extends te{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class zw extends te{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function Uw(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?zf(t):t,i=jw(s);if(wr(s)===0&&e.length>0)throw new Hw;if(wr(s)&&wr(s)<32)throw new Ww({data:typeof t=="string"?t:Ct(t),parameters:e,size:wr(s)});let c=0;const a=r==="Array"?[]:{};for(let l=0;l<e.length;++l){const u=e[l];i.setPosition(c);const[f,d]=Tr(i,u,{checksumAddress:o,staticPosition:0});c+=d,r==="Array"?a.push(f):a[u.name??l]=f}return a}function Ka(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new zd({expectedLength:e.length,givenLength:t.length});const o=Ow({checksumAddress:r,parameters:e,values:t}),s=qa(o);return s.length===0?"0x":s}function Ya(e,t){if(e.length!==t.length)throw new zd({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(Ya.encode(o,s))}return Nt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return ks(a),Wn(a.toLowerCase(),o?32:0)}if(n==="string")return Ta(r);if(n==="bytes")return r;if(n==="bool")return Wn(Wf(r),o?32:1);const s=n.match(Ld);if(s){const[a,l,u="256"]=s,f=Number.parseInt(u,10)/8;return Be(r,{size:o?32:f,signed:l==="int"})}const i=n.match(Ew);if(i){const[a,l]=i;if(Number.parseInt(l,10)!==(r.length-2)/2)throw new _d({expectedSize:Number.parseInt(l,10),value:r});return Hn(r,o?32:0)}const c=n.match(xw);if(c&&Array.isArray(r)){const[a,l]=c,u=[];for(let f=0;f<r.length;f++)u.push(t(l,r[f],!0));return u.length===0?"0x":Nt(...u)}throw new Xa(n)}e.encode=t})(Ya||(Ya={}));function jd(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?lu(e):e}class Ww extends te{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${or(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Hw extends te{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Vw extends te{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 _d extends te{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 zd extends te{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
90
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Gw extends te{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class Xa extends te{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ve=BigInt(0),Fe=BigInt(1),Vn=BigInt(2),qw=BigInt(3),Ud=BigInt(4),Wd=BigInt(5),Hd=BigInt(8);function Ge(e,t){const n=e%t;return n>=Ve?n:t+n}function ft(e,t,n){let r=e;for(;t-- >Ve;)r*=r,r%=n;return r}function Qa(e,t){if(e===Ve)throw new Error("invert: expected non-zero number");if(t<=Ve)throw new Error("invert: expected positive modulus, got "+t);let n=Ge(e,t),r=t,o=Ve,s=Fe;for(;n!==Ve;){const c=r/n,a=r%n,l=o-s*c;r=n,n=a,o=s,s=l}if(r!==Fe)throw new Error("invert: does not exist");return Ge(o,t)}function Vd(e,t){const n=(e.ORDER+Fe)/Ud,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Zw(e,t){const n=(e.ORDER-Wd)/Hd,r=e.mul(t,Vn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Vn),o),c=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(c),t))throw new Error("Cannot find square root");return c}function Kw(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Fe,n=0;for(;t%Vn===Ve;)t/=Vn,n++;let r=Vn;const o=Ja(e);for(;qd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Vd;let s=o.pow(r,t);const i=(t+Fe)/Vn;return function(a,l){if(a.is0(l))return l;if(qd(a,l)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),d=a.pow(l,t),p=a.pow(l,i);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let h=1,b=a.sqr(d);for(;!a.eql(b,a.ONE);)if(h++,b=a.sqr(b),h===u)throw new Error("Cannot find square root");const S=Fe<<BigInt(u-h-1),P=a.pow(f,S);u=h,f=a.sqr(P),d=a.mul(d,f),p=a.mul(p,P)}return p}}function Yw(e){return e%Ud===qw?Vd:e%Hd===Wd?Zw:Kw(e)}const Xw=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Qw(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Xw.reduce((r,o)=>(r[o]="function",r),t);return $s(e,n)}function Jw(e,t,n){if(n<Ve)throw new Error("invalid exponent, negatives unsupported");if(n===Ve)return e.ONE;if(n===Fe)return t;let r=e.ONE,o=t;for(;n>Ve;)n&Fe&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Fe;return r}function Gd(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 qd(e,t){const n=(e.ORDER-Fe)/Vn,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 Zd(e,t){t!==void 0&&qr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Ja(e,t,n=!1,r={}){if(e<=Ve)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=Zd(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const c=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:Ts(o),ZERO:Ve,ONE:Fe,create:a=>Ge(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return Ve<=a&&a<e},is0:a=>a===Ve,isOdd:a=>(a&Fe)===Fe,neg:a=>Ge(-a,e),eql:(a,l)=>a===l,sqr:a=>Ge(a*a,e),add:(a,l)=>Ge(a+l,e),sub:(a,l)=>Ge(a-l,e),mul:(a,l)=>Ge(a*l,e),pow:(a,l)=>Jw(c,a,l),div:(a,l)=>Ge(a*Qa(l,e),e),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>Qa(a,e),sqrt:r.sqrt||(a=>(i||(i=Yw(e)),i(c,a))),toBytes:a=>n?Mf(a,s):Co(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Df(a):Un(a)},invertBatch:a=>Gd(c,a),cmov:(a,l,u)=>u?l:a});return Object.freeze(c)}function Kd(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 Yd(e){const t=Kd(e);return t+Math.ceil(t/2)}function e6(e,t,n=!1){const r=e.length,o=Kd(t),s=Yd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Df(e):Un(e),c=Ge(i,t-Fe)+Fe;return n?Mf(c,o):Co(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xd=BigInt(0),ec=BigInt(1);function tc(e,t){const n=t.negate();return e?n:t}function Qd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function nc(e,t){Qd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Ts(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Jd(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+=ec);const l=t*r,u=l+Math.abs(c)-1,f=c===0,d=c<0,p=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:d,isNegF:p,offsetF:l}}function t6(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 n6(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 rc=new WeakMap,e0=new WeakMap;function oc(e){return e0.get(e)||1}function r6(e,t){return{constTimeNegate:tc,hasPrecomputes(n){return oc(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>Xd;)r&ec&&(o=o.add(s)),s=s.double(),r>>=ec;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=nc(r,t),i=[];let c=n,a=c;for(let l=0;l<o;l++){a=c,i.push(a);for(let u=1;u<s;u++)a=a.add(c),i.push(a);c=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const c=nc(n,t);for(let a=0;a<c.windows;a++){const{nextN:l,offset:u,isZero:f,isNeg:d,isNegF:p,offsetF:h}=Jd(o,a,c);o=l,f?i=i.add(tc(p,r[h])):s=s.add(tc(d,r[u]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=nc(n,t);for(let c=0;c<i.windows&&o!==Xd;c++){const{nextN:a,offset:l,isZero:u,isNeg:f}=Jd(o,c,i);if(o=a,!u){const d=r[l];s=s.add(f?d.negate():d)}}return s},getPrecomputes(n,r,o){let s=rc.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&rc.set(r,o(s))),s},wNAFCached(n,r,o){const s=oc(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=oc(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){Qd(r,t),e0.set(n,r),rc.delete(n)}}}function o6(e,t,n,r){t6(n,e),n6(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=by(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const l=Ts(a),u=new Array(Number(l)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let d=i;for(let p=f;p>=0;p-=a){u.fill(i);for(let b=0;b<s;b++){const S=r[b],P=Number(S>>BigInt(p)&l);u[P]=u[P].add(n[b])}let h=i;for(let b=u.length-1,S=i;b>0;b--)S=S.add(u[b]),h=h.add(S);if(d=d.add(h),p!==0)for(let b=0;b<a;b++)d=d.double()}return d}function t0(e){return Qw(e.Fp),$s(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Zd(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function n0(e){e.lowS!==void 0&&Ao("lowS",e.lowS),e.prehash!==void 0&&Ao("prehash",e.prehash)}function s6(e){const t=t0(e);$s(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}class i6 extends Error{constructor(t=""){super(t)}}const rn={Err:i6,_tlv:{encode:(e,t)=>{const{Err:n}=rn;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}=rn;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 l=t.subarray(r,r+a);if(l.length!==a)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)i=i<<8|u;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}=rn;if(e<on)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}=rn;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 Un(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=rn,o=ut("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:l,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=rn,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}};function sc(e,t){return No(Co(e,t))}const on=BigInt(0),Oe=BigInt(1);BigInt(2);const ic=BigInt(3),a6=BigInt(4);function c6(e){const t=s6(e),{Fp:n}=t,r=Ja(t.n,t.nBitLength),o=t.toBytes||((w,$,k)=>{const B=$.toAffine();return Ps(Uint8Array.from([4]),n.toBytes(B.x),n.toBytes(B.y))}),s=t.fromBytes||(w=>{const $=w.subarray(1),k=n.fromBytes($.subarray(0,n.BYTES)),B=n.fromBytes($.subarray(n.BYTES,2*n.BYTES));return{x:k,y:B}});function i(w){const{a:$,b:k}=t,B=n.sqr(w),F=n.mul(B,w);return n.add(n.add(F,n.mul(w,$)),k)}function c(w,$){const k=n.sqr($),B=i(w);return n.eql(k,B)}if(!c(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,ic),a6),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,l)))throw new Error("bad curve params: a or b");function u(w){return Sa(w,Oe,t.n)}function f(w){const{allowedPrivateKeyLengths:$,nByteLength:k,wrapPrivateKey:B,n:F}=t;if($&&typeof w!="bigint"){if($o(w)&&(w=No(w)),typeof w!="string"||!$.includes(w.length))throw new Error("invalid private key");w=w.padStart(k*2,"0")}let m;try{m=typeof w=="bigint"?w:Un(ut("private key",w,k))}catch{throw new Error("invalid private key, expected hex or "+k+" bytes, got "+typeof w)}return B&&(m=Ge(m,F)),vr("private key",m,Oe,F),m}function d(w){if(!(w instanceof b))throw new Error("ProjectivePoint expected")}const p=Lf((w,$)=>{const{px:k,py:B,pz:F}=w;if(n.eql(F,n.ONE))return{x:k,y:B};const m=w.is0();$==null&&($=m?n.ONE:n.inv(F));const g=n.mul(k,$),v=n.mul(B,$),A=n.mul(F,$);if(m)return{x:n.ZERO,y:n.ZERO};if(!n.eql(A,n.ONE))throw new Error("invZ was invalid");return{x:g,y:v}}),h=Lf(w=>{if(w.is0()){if(t.allowInfinityPoint&&!n.is0(w.py))return;throw new Error("bad point: ZERO")}const{x:$,y:k}=w.toAffine();if(!n.isValid($)||!n.isValid(k))throw new Error("bad point: x or y not FE");if(!c($,k))throw new Error("bad point: equation left != right");if(!w.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class b{constructor($,k,B){if($==null||!n.isValid($))throw new Error("x required");if(k==null||!n.isValid(k)||n.is0(k))throw new Error("y required");if(B==null||!n.isValid(B))throw new Error("z required");this.px=$,this.py=k,this.pz=B,Object.freeze(this)}static fromAffine($){const{x:k,y:B}=$||{};if(!$||!n.isValid(k)||!n.isValid(B))throw new Error("invalid affine point");if($ instanceof b)throw new Error("projective point not allowed");const F=m=>n.eql(m,n.ZERO);return F(k)&&F(B)?b.ZERO:new b(k,B,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ($){const k=Gd(n,$.map(B=>B.pz));return $.map((B,F)=>B.toAffine(k[F])).map(b.fromAffine)}static fromHex($){const k=b.fromAffine(s(ut("pointHex",$)));return k.assertValidity(),k}static fromPrivateKey($){return b.BASE.multiply(f($))}static msm($,k){return o6(b,r,$,k)}_setWindowSize($){x.setWindowSize(this,$)}assertValidity(){h(this)}hasEvenY(){const{y:$}=this.toAffine();if(n.isOdd)return!n.isOdd($);throw new Error("Field doesn't support isOdd")}equals($){d($);const{px:k,py:B,pz:F}=this,{px:m,py:g,pz:v}=$,A=n.eql(n.mul(k,v),n.mul(m,F)),N=n.eql(n.mul(B,v),n.mul(g,F));return A&&N}negate(){return new b(this.px,n.neg(this.py),this.pz)}double(){const{a:$,b:k}=t,B=n.mul(k,ic),{px:F,py:m,pz:g}=this;let v=n.ZERO,A=n.ZERO,N=n.ZERO,O=n.mul(F,F),D=n.mul(m,m),y=n.mul(g,g),C=n.mul(F,m);return C=n.add(C,C),N=n.mul(F,g),N=n.add(N,N),v=n.mul($,N),A=n.mul(B,y),A=n.add(v,A),v=n.sub(D,A),A=n.add(D,A),A=n.mul(v,A),v=n.mul(C,v),N=n.mul(B,N),y=n.mul($,y),C=n.sub(O,y),C=n.mul($,C),C=n.add(C,N),N=n.add(O,O),O=n.add(N,O),O=n.add(O,y),O=n.mul(O,C),A=n.add(A,O),y=n.mul(m,g),y=n.add(y,y),O=n.mul(y,C),v=n.sub(v,O),N=n.mul(y,D),N=n.add(N,N),N=n.add(N,N),new b(v,A,N)}add($){d($);const{px:k,py:B,pz:F}=this,{px:m,py:g,pz:v}=$;let A=n.ZERO,N=n.ZERO,O=n.ZERO;const D=t.a,y=n.mul(t.b,ic);let C=n.mul(k,m),I=n.mul(B,g),T=n.mul(F,v),L=n.add(k,B),j=n.add(m,g);L=n.mul(L,j),j=n.add(C,I),L=n.sub(L,j),j=n.add(k,F);let z=n.add(m,v);return j=n.mul(j,z),z=n.add(C,T),j=n.sub(j,z),z=n.add(B,F),A=n.add(g,v),z=n.mul(z,A),A=n.add(I,T),z=n.sub(z,A),O=n.mul(D,j),A=n.mul(y,T),O=n.add(A,O),A=n.sub(I,O),O=n.add(I,O),N=n.mul(A,O),I=n.add(C,C),I=n.add(I,C),T=n.mul(D,T),j=n.mul(y,j),I=n.add(I,T),T=n.sub(C,T),T=n.mul(D,T),j=n.add(j,T),C=n.mul(I,j),N=n.add(N,C),C=n.mul(z,j),A=n.mul(L,A),A=n.sub(A,C),C=n.mul(L,I),O=n.mul(z,O),O=n.add(O,C),new b(A,N,O)}subtract($){return this.add($.negate())}is0(){return this.equals(b.ZERO)}wNAF($){return x.wNAFCached(this,$,b.normalizeZ)}multiplyUnsafe($){const{endo:k,n:B}=t;vr("scalar",$,on,B);const F=b.ZERO;if($===on)return F;if(this.is0()||$===Oe)return this;if(!k||x.hasPrecomputes(this))return x.wNAFCachedUnsafe(this,$,b.normalizeZ);let{k1neg:m,k1:g,k2neg:v,k2:A}=k.splitScalar($),N=F,O=F,D=this;for(;g>on||A>on;)g&Oe&&(N=N.add(D)),A&Oe&&(O=O.add(D)),D=D.double(),g>>=Oe,A>>=Oe;return m&&(N=N.negate()),v&&(O=O.negate()),O=new b(n.mul(O.px,k.beta),O.py,O.pz),N.add(O)}multiply($){const{endo:k,n:B}=t;vr("scalar",$,Oe,B);let F,m;if(k){const{k1neg:g,k1:v,k2neg:A,k2:N}=k.splitScalar($);let{p:O,f:D}=this.wNAF(v),{p:y,f:C}=this.wNAF(N);O=x.constTimeNegate(g,O),y=x.constTimeNegate(A,y),y=new b(n.mul(y.px,k.beta),y.py,y.pz),F=O.add(y),m=D.add(C)}else{const{p:g,f:v}=this.wNAF($);F=g,m=v}return b.normalizeZ([F,m])[0]}multiplyAndAddUnsafe($,k,B){const F=b.BASE,m=(v,A)=>A===on||A===Oe||!v.equals(F)?v.multiplyUnsafe(A):v.multiply(A),g=m(this,k).add(m($,B));return g.is0()?void 0:g}toAffine($){return p(this,$)}isTorsionFree(){const{h:$,isTorsionFree:k}=t;if($===Oe)return!0;if(k)return k(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:$,clearCofactor:k}=t;return $===Oe?this:k?k(b,this):this.multiplyUnsafe(t.h)}toRawBytes($=!0){return Ao("isCompressed",$),this.assertValidity(),o(b,this,$)}toHex($=!0){return Ao("isCompressed",$),No(this.toRawBytes($))}}b.BASE=new b(t.Gx,t.Gy,n.ONE),b.ZERO=new b(n.ZERO,n.ONE,n.ZERO);const{endo:S,nBitLength:P}=t,x=r6(b,S?Math.ceil(P/2):P);return{CURVE:t,ProjectivePoint:b,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:u}}function l6(e){const t=t0(e);return $s(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function u6(e){const t=l6(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,c=2*n.BYTES+1;function a(y){return Ge(y,r)}function l(y){return Qa(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:f,weierstrassEquation:d,isWithinCurveOrder:p}=c6({...t,toBytes(y,C,I){const T=C.toAffine(),L=n.toBytes(T.x),j=Ps;return Ao("isCompressed",I),I?j(Uint8Array.from([C.hasEvenY()?2:3]),L):j(Uint8Array.from([4]),L,n.toBytes(T.y))},fromBytes(y){const C=y.length,I=y[0],T=y.subarray(1);if(C===i&&(I===2||I===3)){const L=Un(T);if(!Sa(L,Oe,n.ORDER))throw new Error("Point is not on curve");const j=d(L);let z;try{z=n.sqrt(j)}catch(K){const G=K instanceof Error?": "+K.message:"";throw new Error("Point is not on curve"+G)}const _=(z&Oe)===Oe;return(I&1)===1!==_&&(z=n.neg(z)),{x:L,y:z}}else if(C===c&&I===4){const L=n.fromBytes(T.subarray(0,n.BYTES)),j=n.fromBytes(T.subarray(n.BYTES,2*n.BYTES));return{x:L,y:j}}else{const L=i,j=c;throw new Error("invalid Point, expected length of "+L+", or uncompressed "+j+", got "+C)}}});function h(y){const C=r>>Oe;return y>C}function b(y){return h(y)?a(-y):y}const S=(y,C,I)=>Un(y.slice(C,I));class P{constructor(C,I,T){vr("r",C,Oe,r),vr("s",I,Oe,r),this.r=C,this.s=I,T!=null&&(this.recovery=T),Object.freeze(this)}static fromCompact(C){const I=o;return C=ut("compactSignature",C,I*2),new P(S(C,0,I),S(C,I,2*I))}static fromDER(C){const{r:I,s:T}=rn.toSig(ut("DER",C));return new P(I,T)}assertValidity(){}addRecoveryBit(C){return new P(this.r,this.s,C)}recoverPublicKey(C){const{r:I,s:T,recovery:L}=this,j=F(ut("msgHash",C));if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");const z=L===2||L===3?I+t.n:I;if(z>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const _=L&1?"03":"02",W=u.fromHex(_+sc(z,n.BYTES)),K=l(z),G=a(-j*K),H=a(T*K),q=u.BASE.multiplyAndAddUnsafe(W,G,H);if(!q)throw new Error("point at infinify");return q.assertValidity(),q}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Ss(this.toDERHex())}toDERHex(){return rn.hexFromSig(this)}toCompactRawBytes(){return Ss(this.toCompactHex())}toCompactHex(){const C=o;return sc(this.r,C)+sc(this.s,C)}}const x={isValidPrivateKey(y){try{return f(y),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const y=Yd(t.n);return e6(t.randomBytes(y),t.n)},precompute(y=8,C=u.BASE){return C._setWindowSize(y),C.multiply(BigInt(3)),C}};function w(y,C=!0){return u.fromPrivateKey(y).toRawBytes(C)}function $(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const I=ut("key",y).length,T=n.BYTES,L=T+1,j=2*T+1;if(!(t.allowedPrivateKeyLengths||o===L))return I===L||I===j}function k(y,C,I=!0){if($(y)===!0)throw new Error("first arg must be private key");if($(C)===!1)throw new Error("second arg must be public key");return u.fromHex(C).multiply(f(y)).toRawBytes(I)}const B=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const C=Un(y),I=y.length*8-s;return I>0?C>>BigInt(I):C},F=t.bits2int_modN||function(y){return a(B(y))},m=Ts(s);function g(y){return vr("num < 2^"+s,y,on,m),Co(y,o)}function v(y,C,I=A){if(["recovered","canonical"].some(ee=>ee in I))throw new Error("sign() legacy options not supported");const{hash:T,randomBytes:L}=t;let{lowS:j,prehash:z,extraEntropy:_}=I;j==null&&(j=!0),y=ut("msgHash",y),n0(I),z&&(y=ut("prehashed msgHash",T(y)));const W=F(y),K=f(C),G=[g(K),g(W)];if(_!=null&&_!==!1){const ee=_===!0?L(n.BYTES):_;G.push(ut("extraEntropy",ee))}const H=Ps(...G),q=W;function Q(ee){const pe=B(ee);if(!p(pe))return;const le=l(pe),he=u.BASE.multiply(pe).toAffine(),ie=a(he.x);if(ie===on)return;const me=a(le*a(q+ie*K));if(me===on)return;let ne=(he.x===ie?0:2)|Number(he.y&Oe),Se=me;return j&&h(me)&&(Se=b(me),ne^=1),new P(ie,Se,ne)}return{seed:H,k2sig:Q}}const A={lowS:t.lowS,prehash:!1},N={lowS:t.lowS,prehash:!1};function O(y,C,I=A){const{seed:T,k2sig:L}=v(y,C,I),j=t;return gy(j.hash.outputLen,j.nByteLength,j.hmac)(T,L)}u.BASE._setWindowSize(8);function D(y,C,I,T=N){var ne;const L=y;C=ut("msgHash",C),I=ut("publicKey",I);const{lowS:j,prehash:z,format:_}=T;if(n0(T),"strict"in T)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");const W=typeof L=="string"||$o(L),K=!W&&!_&&typeof L=="object"&&L!==null&&typeof L.r=="bigint"&&typeof L.s=="bigint";if(!W&&!K)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let G,H;try{if(K&&(G=new P(L.r,L.s)),W){try{_!=="compact"&&(G=P.fromDER(L))}catch(Se){if(!(Se instanceof rn.Err))throw Se}!G&&_!=="der"&&(G=P.fromCompact(L))}H=u.fromHex(I)}catch{return!1}if(!G||j&&G.hasHighS())return!1;z&&(C=t.hash(C));const{r:q,s:Q}=G,ee=F(C),pe=l(Q),le=a(ee*pe),he=a(q*pe),ie=(ne=u.BASE.multiplyAndAddUnsafe(H,le,he))==null?void 0:ne.toAffine();return ie?a(ie.x)===q:!1}return{CURVE:t,getPublicKey:w,getSharedSecret:k,sign:O,verify:D,ProjectivePoint:u,Signature:P,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function f6(e){return{hash:e,hmac:(t,...n)=>Id(e,t,I1(...n)),randomBytes:D1}}function d6(e,t){const n=r=>u6({...e,...f6(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),o0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),p6=BigInt(0),h6=BigInt(1),ac=BigInt(2),s0=(e,t)=>(e+t/ac)/t;function m6(e){const t=r0,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),l=e*e*e%t,u=l*l*e%t,f=ft(u,n,t)*u%t,d=ft(f,n,t)*u%t,p=ft(d,ac,t)*l%t,h=ft(p,o,t)*p%t,b=ft(h,s,t)*h%t,S=ft(b,c,t)*b%t,P=ft(S,a,t)*S%t,x=ft(P,c,t)*b%t,w=ft(x,n,t)*u%t,$=ft(w,i,t)*h%t,k=ft($,r,t)*l%t,B=ft(k,ac,t);if(!cc.eql(cc.sqr(B),e))throw new Error("Cannot find square root");return B}const cc=Ja(r0,void 0,void 0,{sqrt:m6}),i0=d6({a:p6,b:BigInt(7),Fp:cc,n:o0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=o0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-h6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),c=s0(s*e,t),a=s0(-r*e,t);let l=Ge(e-c*n-a*o,t),u=Ge(-c*r-a*s,t);const f=l>i,d=u>i;if(f&&(l=t-l),d&&(u=t-u),l>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:l,k2neg:d,k2:u}}}},vf),b6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:i0},Symbol.toStringTag,{value:"Module"}));function a0(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new uc({signature:e});if(typeof e.s>"u")throw new uc({signature:e});if(n&&typeof e.yParity>"u")throw new uc({signature:e});if(e.r<0n||e.r>Bd)throw new S6({value:e.r});if(e.s<0n||e.s>Bd)throw new P6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new fc({value:e.yParity})}function g6(e){return c0(Ct(e))}function c0(e){if(e.length!==130&&e.length!==132)throw new E6({signature:e});const t=BigInt(jt(e,0,32)),n=BigInt(jt(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return lc(o)}catch{throw new fc({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function y6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return v6(e)}function v6(e){const t=typeof e=="string"?c0(e):e instanceof Uint8Array?g6(e):typeof e.r=="string"?x6(e):e.v?w6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return a0(t),t}function w6(e){return{r:e.r,s:e.s,yParity:lc(e.v)}}function x6(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=lc(n)),typeof r!="number")throw new fc({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function lc(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new T6({value:e})}class E6 extends te{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${nt(Uy(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class uc extends te{constructor({signature:t}){super(`Signature \`${_f(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class S6 extends te{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class P6 extends te{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class fc extends te{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class T6 extends te{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function $6(e,t={}){return typeof e.chainId=="string"?A6(e):{...e,...t.signature}}function A6(e){const{address:t,chainId:n,nonce:r}=e,o=y6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const N6="0x8010801080108010801080108010801080108010801080108010801080108010",C6=jd("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function l0(e){if(typeof e=="string"){if(jt(e,-32)!==N6)throw new D6(e)}else a0(e.authorization)}function O6(e){l0(e);const t=Vf(jt(e,-64,-32)),n=jt(e,-t-64,-64),r=jt(e,0,-t-64),[o,s,i]=Uw(C6,n);return{authorization:$6({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:r,...i&&i!=="0x"?{data:i,to:s}:{}}}function I6(e){try{return l0(e),!0}catch{return!1}}let D6=class extends te{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};class M6 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function k6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new M6({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 L6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function B6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Yt(e.nonce):void 0,storageProof:e.storageProof?L6(e.storageProof):void 0}}async function F6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?J(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return B6(c)}async function R6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?J(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function dc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:c}){var d,p,h;const a=r||"latest",l=n!==void 0?J(n):void 0;let u=null;if(o?u=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,J(s)]},{dedupe:!0}):typeof s=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||a,J(s)]},{dedupe:!!l}):i&&typeof c=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,J(c)]},{dedupe:!0})),!u)throw new Qu({blockHash:t,blockNumber:n,blockTag:a,hash:o,index:s});return(((h=(p=(d=e.chain)==null?void 0:d.formatters)==null?void 0:p.transaction)==null?void 0:h.format)||la)(u,"getTransaction")}async function j6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([X(e,Do,"getBlockNumber")({}),t?X(e,dc,"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 Ju({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||ud)(n,"getTransactionReceipt")}async function _6(e,t){var x;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:c,stateOverride:a}=t,l=t.contracts,{batchSize:u=t.batchSize??1024,deployless:f=t.deployless??!1}=typeof((x=e.batch)==null?void 0:x.multicall)=="object"?e.batch.multicall:{},d=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return Sr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),p=[[]];let h=0,b=0;for(let w=0;w<l.length;w++){const{abi:$,address:k,args:B,functionName:F}=l[w];try{const m=lt({abi:$,args:B,functionName:F});b+=(m.length-2)/2,u>0&&b>u&&p[h].length>0&&(h++,b=(m.length-2)/2,p[h]=[]),p[h]=[...p[h],{allowFailure:!0,callData:m,target:k}]}catch(m){const g=br(m,{abi:$,address:k,args:B,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!o)throw g;p[h]=[...p[h],{allowFailure:!0,callData:"0x",target:k}]}}const S=await Promise.allSettled(p.map(w=>X(e,Ot,"readContract")({...d===null?{code:Aa}:{address:d},abi:xr,account:n,args:[w],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:c,functionName:"aggregate3",stateOverride:a}))),P=[];for(let w=0;w<S.length;w++){const $=S[w];if($.status==="rejected"){if(!o)throw $.reason;for(let B=0;B<p[w].length;B++)P.push({status:"failure",error:$.reason,result:void 0});continue}const k=$.value;for(let B=0;B<k.length;B++){const{returnData:F,success:m}=k[B],{callData:g}=p[w][B],{abi:v,address:A,functionName:N,args:O}=l[P.length];try{if(g==="0x")throw new Vr;if(!m)throw new bs({data:F});const D=xn({abi:v,args:O,data:F,functionName:N});P.push(o?{result:D,status:"success"}:D)}catch(D){const y=br(D,{abi:v,address:A,args:O,docsPath:"/docs/contract/multicall",functionName:N});if(!o)throw y;P.push({error:y,result:void 0,status:"failure"})}}}if(P.length!==l.length)throw new V("multicall results mismatch");return P}async function pc(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?Yf(d.blockOverrides):void 0,h=d.calls.map(S=>{const P=S,x=P.account?tt(P.account):void 0,w=P.abi?lt(P):P.data,$={...P,account:x,data:P.dataSuffix?$t([w||"0x",P.dataSuffix]):w,from:P.from??(x==null?void 0:x.address)};return yr($),Po($)}),b=d.stateOverrides?aa(d.stateOverrides):void 0;a.push({blockOverrides:p,calls:h,stateOverrides:b})}const u=(typeof n=="bigint"?J(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},u]})).map((d,p)=>({...hf(d),calls:d.calls.map((h,b)=>{var v,A;const{abi:S,args:P,functionName:x,to:w}=o[p].calls[b],$=((v=h.error)==null?void 0:v.data)??h.returnData,k=BigInt(h.gasUsed),B=(A=h.logs)==null?void 0:A.map(N=>Rt(N)),F=h.status==="0x1"?"success":"failure",m=S&&F==="success"&&$!=="0x"?xn({abi:S,data:$,functionName:x}):null,g=(()=>{if(F==="success")return;let N;if($==="0x"?N=new Vr:$&&(N=new bs({data:$})),!!N)return br(N,{abi:S??[],address:w??"0x",args:P,functionName:x??"<unknown>"})})();return{data:$,gasUsed:k,logs:B,status:F,...F==="success"?{result:m}:{error:g}}})}))}catch(a){const l=a,u=vs(l,{});throw u instanceof So?l:u}}function hc(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 te("Unable to normalize signature.");return o}function mc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Ha(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)=>mc(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=>mc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function u0(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 u0(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")?Ha(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Ha(n[r],{strict:!1}):!1)return i}}function f0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?cu(e):e;return{...r,...n?{hash:$r(r)}:{}}}function Bs(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Wy(t,{strict:!1}),i=e.filter(l=>s?l.type==="function"||l.type==="error"?d0(l)===jt(t,0,4):l.type==="event"?$r(l)===t:!1:"name"in l&&l.name===t);if(i.length===0)throw new Fs({name:t});if(i.length===1)return{...i[0],...o?{hash:$r(i[0])}:{}};let c;for(const l of i){if(!("inputs"in l))continue;if(!r||r.length===0){if(!l.inputs||l.inputs.length===0)return{...l,...o?{hash:$r(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==r.length)continue;if(r.every((f,d)=>{const p="inputs"in l&&l.inputs[d];return p?mc(f,p):!1})){if(c&&"inputs"in c&&c.inputs){const f=u0(l.inputs,c.inputs,r);if(f)throw new U6({abiItem:l,type:f[0]},{abiItem:c,type:f[1]})}c=l}}const a=(()=>{if(c)return c;const[l,...u]=i;return{...l,overloads:u}})();if(!a)throw new Fs({name:t});return{...a,...o?{hash:$r(a)}:{}}}function d0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Bs(n,r)}return e[0]})();return jt($r(t),0,4)}function z6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return Bs(r,o)}return e[0]})(),n=typeof t=="string"?t:is(t);return hc(n)}function $r(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Bs(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Dd(Ta(z6(t)))}class U6 extends te{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${hc(is(t.abiItem))}\`, and`,`\`${n.type}\` in \`${hc(is(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 Fs extends te{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function W6(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,c]=e;return[V6(i),c]}return e})(),{bytecode:r,args:o}=n;return Nt(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?Ka(t.inputs,o):"0x")}function H6(e){return f0(e)}function V6(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new Fs({name:"constructor"});return t}function G6(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[l,u,f]=e;return[p0(l,u,{args:f}),f]}const[c,a]=e;return[c,a]})(),{overloads:r}=t,o=r?p0([t,...r],t.name,{args:n}):t,s=q6(o),i=n.length>0?Ka(o.inputs,n):void 0;return i?Nt(s,i):s}function Ar(e,t={}){return f0(e,t)}function p0(e,t,n){const r=Bs(e,t,n);if(r.type!=="function")throw new Fs({name:t,type:"function"});return r}function q6(e){return d0(e)}const Z6="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",It="0x0000000000000000000000000000000000000000",K6="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function Y6(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,l=t.account?tt(t.account):void 0;if(i&&!l)throw new V("`account` is required when `traceAssetChanges` is true");const u=l?W6(H6("constructor(bytes, bytes)"),{bytecode:rd,args:[K6,G6(Ar("function getBalance(address)"),[l.address])]}):void 0,f=i?await Promise.all(t.calls.map(async T=>{if(!T.data&&!T.abi)return;const{accessList:L}=await vd(e,{account:l.address,...T,data:T.abi?lt(T):T.data});return L.map(({address:j,storageKeys:z})=>z.length>0?j:null)})).then(T=>T.flat().filter(Boolean)):[],d=await pc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((T,L)=>({abi:[Ar("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:T,from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]}]:[],{calls:[...o,{to:It}].map(T=>({...T,from:l==null?void 0:l.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((T,L)=>({abi:[Ar("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:T,from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]},{calls:f.map((T,L)=>({to:T,abi:[Ar("function decimals() returns (uint256)")],functionName:"decimals",from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]},{calls:f.map((T,L)=>({to:T,abi:[Ar("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]},{calls:f.map((T,L)=>({to:T,abi:[Ar("function symbol() returns (string)")],functionName:"symbol",from:It,nonce:L})),stateOverrides:[{address:It,nonce:0}]}]:[]],traceTransfers:c,validation:a}),p=i?d[2]:d[0],[h,b,,S,P,x,w,$]=i?d:[],{calls:k,...B}=p,F=k.slice(0,-1)??[],m=(h==null?void 0:h.calls)??[],g=(b==null?void 0:b.calls)??[],v=[...m,...g].map(T=>T.status==="success"?Lt(T.data):null),A=(S==null?void 0:S.calls)??[],N=(P==null?void 0:P.calls)??[],O=[...A,...N].map(T=>T.status==="success"?Lt(T.data):null),D=((x==null?void 0:x.calls)??[]).map(T=>T.status==="success"?T.result:null),y=(($==null?void 0:$.calls)??[]).map(T=>T.status==="success"?T.result:null),C=((w==null?void 0:w.calls)??[]).map(T=>T.status==="success"?T.result:null),I=[];for(const[T,L]of O.entries()){const j=v[T];if(typeof L!="bigint"||typeof j!="bigint")continue;const z=D[T-1],_=y[T-1],W=C[T-1],K=T===0?{address:Z6,decimals:18,symbol:"ETH"}:{address:f[T-1],decimals:W||z?Number(z??1):void 0,symbol:_??void 0};I.some(G=>G.token.address===K.address)||I.push({token:K,value:{pre:j,post:L,diff:L-j}})}return{assetChanges:I,block:B,results:F}}const h0="0x6492649264926492649264926492649264926492649264926492649264926492";function X6(e){if(jt(e,-32)!==h0)throw new e5(e)}function Q6(e){const{data:t,signature:n,to:r}=e;return Nt(Ka(jd("address, bytes, bytes"),[r,t,n]),h0)}function J6(e){try{return X6(e),!0}catch{return!1}}class e5 extends te{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function t5({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 i0.Signature(Lt(e),Lt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:Bt(i)}async function Rs(e,t){var a,l,u,f;const{address:n,chain:r=e.chain,hash:o,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??((l=(a=r==null?void 0:r.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:l.address),multicallAddress:i=t.multicallAddress??((f=(u=r==null?void 0:r.contracts)==null?void 0:u.multicall3)==null?void 0:f.address)}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const c=(()=>{const d=t.signature;return Pt(d)?d:typeof d=="object"&&"r"in d&&"s"in d?t5(d):Ae(d)})();try{return I6(c)?await n5(e,{...t,multicallAddress:i,signature:c}):await r5(e,{...t,verifierAddress:s,signature:c})}catch(d){try{if(To(Qt(n),await of({hash:o,signature:c})))return!0}catch{}if(d instanceof Gn)return!1;throw d}}async function n5(e,t){var S;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:c,data:a,signature:l,to:u}=O6(t.signature);if(await Ds(e,{address:n,blockNumber:r,blockTag:o})===dr(["0xef0100",c.address]))return await o5(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:l});const d={address:c.address,chainId:Number(c.chainId),nonce:Number(c.nonce),r:J(c.r,{size:32}),s:J(c.s,{size:32}),yParity:c.yParity};if(!await Hv({address:n,authorization:d}))throw new Gn;const h=await X(e,Ot,"readContract")({...i?{address:i}:{code:Aa},authorizationList:[d],abi:xr,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:u??n,callData:a}]:[],{allowFailure:!0,target:n,callData:lt({abi:td,functionName:"isValidSignature",args:[s,l]})}]]}),b=(S=h[h.length-1])==null?void 0:S.returnData;if(b!=null&&b.startsWith("0x1626ba7e"))return!0;throw new Gn}async function r5(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:c,...a}=t,l=await(async()=>!r&&!o||J6(i)?i:Q6({data:o,signature:i,to:r}))(),u=c?{to:c,data:lt({abi:nd,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:Oa({abi:nd,args:[n,s,l],bytecode:Yy}),...a},{data:f}=await X(e,Pr,"call")(u).catch(d=>{throw d instanceof ef?new Gn:d});if(d1(f??"0x0"))return!0;throw new Gn}async function o5(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await X(e,Ot,"readContract")({address:n,abi:td,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof tf?new Gn:a})).startsWith("0x1626ba7e"))return!0;throw new Gn}class Gn extends Error{}async function s5(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Td(n);return X(e,Rs,"verifyHash")({address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function i5(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:l,...u}=t,f=pw({message:i,primaryType:c,types:a,domain:l});return X(e,Rs,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function m0(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=Ne(["watchBlockNumber",e.uid,t,n,i]);return En(f,{onBlockNumber:r,onError:o},d=>Io(async()=>{var p;try{const h=await X(e,Do,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let b=a+1n;b<h;b++)d.onBlockNumber(b,a),a=b}(a===void 0||h>a)&&(d.onBlockNumber(h,a),a=h)}catch(h){(p=d.onError)==null||p.call(d,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Ne(["watchBlockNumber",e.uid,t,n]);return En(f,{onBlockNumber:r,onError:o},d=>{let p=!0,h=()=>p=!1;return(async()=>{try{const b=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:S}=await b.subscribe({params:["newHeads"],onData(P){var w;if(!p)return;const x=Lt((w=P.result)==null?void 0:w.number);d.onBlockNumber(x,a),a=x},onError(P){var x;(x=d.onError)==null||x.call(d,P)}});h=S,p||h()}catch(b){o==null||o(b)}})(),()=>h()})})()}async function a5(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:k})=>~~(1<<k)*200,timeout:a=18e4}=t,l=Ne(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var k;return t.pollingInterval?t.pollingInterval:(k=e.chain)!=null&&k.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,d,p,h=!1,b,S;const{promise:P,resolve:x,reject:w}=id(),$=a?setTimeout(()=>{S==null||S(),b==null||b(),w(new Ag({hash:o}))},a):void 0;return b=En(l,{onReplaced:s,resolve:x,reject:w},async k=>{if(p=await X(e,Ls,"getTransactionReceipt")({hash:o}).catch(()=>{}),p&&r<=1){clearTimeout($),k.resolve(p),b==null||b();return}S=X(e,m0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(B){const F=g=>{clearTimeout($),S==null||S(),g(),b==null||b()};let m=B;if(!h)try{if(p){if(r>1&&(!p.blockNumber||m-p.blockNumber+1n<r))return;F(()=>k.resolve(p));return}if(n&&!f&&(h=!0,await ka(async()=>{f=await X(e,dc,"getTransaction")({hash:o}),f.blockNumber&&(m=f.blockNumber)},{delay:c,retryCount:i}),h=!1),p=await X(e,Ls,"getTransactionReceipt")({hash:o}),r>1&&(!p.blockNumber||m-p.blockNumber+1n<r))return;F(()=>k.resolve(p))}catch(g){if(g instanceof Qu||g instanceof Ju){if(!f){h=!1;return}try{d=f,h=!0;const v=await ka(()=>X(e,At,"getBlock")({blockNumber:m,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:O})=>O instanceof df});h=!1;const A=v.transactions.find(({from:O,nonce:D})=>O===d.from&&D===d.nonce);if(!A||(p=await X(e,Ls,"getTransactionReceipt")({hash:A.hash}),r>1&&(!p.blockNumber||m-p.blockNumber+1n<r)))return;let N="replaced";A.to===d.to&&A.value===d.value&&A.input===d.input?N="repriced":A.from===A.to&&A.value===0n&&(N="cancelled"),F(()=>{var O;(O=k.onReplaced)==null||O.call(k,{reason:N,replacedTransaction:d,transaction:A,transactionReceipt:p}),k.resolve(p)})}catch(v){F(()=>k.reject(v))}}else F(()=>k.reject(g))}}})}),P}function c5(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 l=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")),u=i??!1;let f;return l?(()=>{const h=Ne(["watchBlocks",e.uid,t,n,r,u,a]);return En(h,{onBlock:o,onError:s},b=>Io(async()=>{var S;try{const P=await X(e,At,"getBlock")({blockTag:t,includeTransactions:u});if(P.number!==null&&(f==null?void 0:f.number)!=null){if(P.number===f.number)return;if(P.number-f.number>1&&n)for(let x=(f==null?void 0:f.number)+1n;x<P.number;x++){const w=await X(e,At,"getBlock")({blockNumber:x,includeTransactions:u});b.onBlock(w,f),f=w}}((f==null?void 0:f.number)==null||t==="pending"&&(P==null?void 0:P.number)==null||P.number!==null&&P.number>f.number)&&(b.onBlock(P,f),f=P)}catch(P){(S=b.onError)==null||S.call(b,P)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,b=!0,S=()=>h=!1;return(async()=>{try{r&&X(e,At,"getBlock")({blockTag:t,includeTransactions:u}).then(w=>{h&&b&&(o(w,void 0),b=!1)}).catch(s);const P=(()=>{if(e.transport.type==="fallback"){const w=e.transport.transports.find($=>$.config.type==="webSocket"||$.config.type==="ipc");return w?w.value:e.transport}return e.transport})(),{unsubscribe:x}=await P.subscribe({params:["newHeads"],async onData(w){var k;if(!h)return;const $=await X(e,At,"getBlock")({blockNumber:(k=w.result)==null?void 0:k.number,includeTransactions:u}).catch(()=>{});h&&(o($,f),b=!1,f=$)},onError(w){s==null||s(w)}});S=x,h||S()}catch(P){s==null||s(P)}})(),()=>S()})()}function l5(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:l,pollingInterval:u=e.pollingInterval,strict:f}){const d=typeof l<"u"?l: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 S=Ne(["watchEvent",t,n,r,e.uid,o,u,i]);return En(S,{onLogs:a,onError:c},P=>{let x;i!==void 0&&(x=i-1n);let w,$=!1;const k=Io(async()=>{var B;if(!$){try{w=await X(e,wd,"createEventFilter")({address:t,args:n,event:o,events:s,strict:p,fromBlock:i})}catch{}$=!0;return}try{let F;if(w)F=await X(e,Ns,"getFilterChanges")({filter:w});else{const m=await X(e,Do,"getBlockNumber")({});x&&x!==m?F=await X(e,ga,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:x+1n,toBlock:m}):F=[],x=m}if(F.length===0)return;if(r)P.onLogs(F);else for(const m of F)P.onLogs([m])}catch(F){w&&F instanceof yn&&($=!1),(B=P.onError)==null||B.call(P,F)}},{emitOnBegin:!0,interval:u});return async()=>{w&&await X(e,Cs,"uninstallFilter")({filter:w}),k()}})})():(()=>{let S=!0,P=()=>S=!1;return(async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const B=e.transport.transports.find(F=>F.config.type==="webSocket"||F.config.type==="ipc");return B?B.value:e.transport}return e.transport})(),w=s??(o?[o]:void 0);let $=[];w&&($=[w.flatMap(F=>Yr({abi:[F],eventName:F.name,args:n}))],o&&($=$[0]));const{unsubscribe:k}=await x.subscribe({params:["logs",{address:t,topics:$}],onData(B){var m;if(!S)return;const F=B.result;try{const{eventName:g,args:v}=xs({abi:w??[],data:F.data,topics:F.topics,strict:p}),A=Rt(F,{args:v,eventName:g});a([A])}catch(g){let v,A;if(g instanceof ls||g instanceof Bi){if(f)return;v=g.abiItem.name,A=(m=g.abiItem.inputs)==null?void 0:m.some(O=>!("name"in O&&O.name))}const N=Rt(F,{args:A?[]:{},eventName:v});a([N])}},onError(B){c==null||c(B)}});P=k,S||P()}catch(x){c==null||c(x)}})(),()=>P()})()}function u5(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 l=Ne(["watchPendingTransactions",e.uid,t,s]);return En(l,{onTransactions:r,onError:n},u=>{let f;const d=Io(async()=>{var p;try{if(!f)try{f=await X(e,xd,"createPendingTransactionFilter")({});return}catch(b){throw d(),b}const h=await X(e,Ns,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const b of h)u.onTransactions([b])}catch(h){(p=u.onError)==null||p.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await X(e,Cs,"uninstallFilter")({filter:f}),d()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(d){if(!l)return;const p=d.result;r([p])},onError(d){n==null||n(d)}});u=f,l||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function f5(e){var f,d,p;const{scheme:t,statement:n,...r}=((f=e.match(d5))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...l}=((d=e.match(p5))==null?void 0:d.groups)??{},u=(p=e.split("Resources:")[1])==null?void 0:p.split(`
91
+ - `).slice(1);return{...r,...l,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const d5=/^(?:(?<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)?/,p5=/(?: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 h5(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||!ct(r.address,{strict:!1})||t&&!To(r.address,t))return!1}catch{return!1}return!0}async function m5(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...l}=t,u=f5(o);if(!u.address||!h5({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const d=Td(o);return Rs(e,{address:u.address,hash:d,signature:c,...l})}async function b5(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var c,a,l;const o=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),i=(((l=(a=(c=e.chain)==null?void 0:c.formatters)==null?void 0:a.transactionReceipt)==null?void 0:l.format)||ud)(o);if(i.status==="reverted"&&n)throw new $g({receipt:i});return i}function g5(e){return{call:t=>Pr(e,t),createAccessList:t=>vd(e,t),createBlockFilter:()=>Mv(e),createContractEventFilter:t=>Wu(e,t),createEventFilter:t=>wd(e,t),createPendingTransactionFilter:()=>xd(e),estimateContractGas:t=>dy(e,t),estimateGas:t=>ma(e,t),getBalance:t=>kv(e,t),getBlobBaseFee:()=>Lv(e),getBlock:t=>At(e,t),getBlockNumber:t=>Do(e,t),getBlockTransactionCount:t=>Bv(e,t),getBytecode:t=>Ds(e,t),getChainId:()=>pa(e),getCode:t=>Ds(e,t),getContractEvents:t=>Nf(e,t),getDelegation:t=>Fv(e,t),getEip712Domain:t=>jv(e,t),getEnsAddress:t=>gv(e,t),getEnsAvatar:t=>Ov(e,t),getEnsName:t=>Iv(e,t),getEnsResolver:t=>Dv(e,t),getEnsText:t=>yd(e,t),getFeeHistory:t=>Uv(e,t),estimateFeesPerGas:t=>Zg(e,t),getFilterChanges:t=>Ns(e,t),getFilterLogs:t=>Wv(e,t),getGasPrice:()=>ua(e),getLogs:t=>ga(e,t),getProof:t=>F6(e,t),estimateMaxPriorityFeePerGas:t=>qg(e,t),fillTransaction:t=>Pf(e,t),getStorageAt:t=>R6(e,t),getTransaction:t=>dc(e,t),getTransactionConfirmations:t=>j6(e,t),getTransactionCount:t=>bf(e,t),getTransactionReceipt:t=>Ls(e,t),multicall:t=>_6(e,t),prepareTransactionRequest:t=>$f(e,t),readContract:t=>Ot(e,t),sendRawTransaction:t=>lv(e,t),sendRawTransactionSync:t=>b5(e,t),simulate:t=>pc(e,t),simulateBlocks:t=>pc(e,t),simulateCalls:t=>Y6(e,t),simulateContract:t=>tv(e,t),verifyHash:t=>Rs(e,t),verifyMessage:t=>s5(e,t),verifySiweMessage:t=>m5(e,t),verifyTypedData:t=>i5(e,t),uninstallFilter:t=>Cs(e,t),waitForTransactionReceipt:t=>a5(e,t),watchBlocks:t=>c5(e,t),watchBlockNumber:t=>m0(e,t),watchContractEvent:t=>cv(e,t),watchEvent:t=>l5(e,t),watchPendingTransactions:t=>u5(e,t)}}function y5(e){const{key:t="public",name:n="Public Client"}=e;return fv({...e,key:t,name:n,type:"publicClient"}).extend(g5)}function v5({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const l=fd();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:Gv(r,{methods:t,retryCount:o,retryDelay:s,uid:l}),value:a}}class w5 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 x5(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:s="http",methods:i,name:c="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:l,retryDelay:u,raw:f}=t;return({chain:d,retryCount:p,timeout:h})=>{const{batchSize:b=1e3,wait:S=0}=typeof n=="object"?n:{},P=t.retryCount??p,x=h??t.timeout??1e4,w=e||(d==null?void 0:d.rpcUrls.default.http[0]);if(!w)throw new w5;const $=rw(w,{fetchFn:r,fetchOptions:o,onRequest:a,onResponse:l,timeout:x});return v5({key:s,methods:i,name:c,async request({method:k,params:B}){const F={method:k,params:B},{schedule:m}=ad({id:w,wait:S,shouldSplitBatch(N){return N.length>b},fn:N=>$.request({body:N}),sort:(N,O)=>N.id-O.id}),g=async N=>n?m(N):[await $.request({body:N})],[{error:v,result:A}]=await g(F);if(f)return{error:v,result:A};if(v)throw new Qi({body:F,error:v,url:w});return A},retryCount:P,retryDelay:u,timeout:x,type:"http"},{fetchOptions:o,url:w})}}const E5=ew({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}});function S5({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=E.useState(null),[a,l]=E.useState(o);return E.useEffect(()=>{let u,f;const d=async()=>{try{const p=await e.readContract({address:t,abi:Er,functionName:"balanceOf",args:[n]});c(p),l(Ki(p,r))}catch{l(o)}};d();try{u=e.watchContractEvent({address:t,abi:Er,eventName:"Transfer",args:{to:n},onLogs:()=>{d()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:Er,eventName:"Transfer",args:{from:n},onLogs:()=>{d()},poll:!0,pollingInterval:s})}catch{}return()=>{u==null||u(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const P5=()=>({openDeposit:E.useCallback(t=>{},[])}),T5=()=>({openWithdraw:E.useCallback(t=>{},[])}),Sn="MPC",bc="EVM",$5="spot",b0="perpetual";/**
92
92
  * @license lucide-react v0.540.0 - ISC
93
93
  *
94
94
  * This source code is licensed under the ISC license.
95
95
  * See the LICENSE file in the root directory of this source tree.
96
- */const T5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),A5=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),b0=e=>{const t=A5(e);return t.charAt(0).toUpperCase()+t.slice(1)},g0=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),$5=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
96
+ */const A5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),N5=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),g0=e=>{const t=N5(e);return t.charAt(0).toUpperCase()+t.slice(1)},y0=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),C5=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
97
97
  * @license lucide-react v0.540.0 - ISC
98
98
  *
99
99
  * This source code is licensed under the ISC license.
100
100
  * See the LICENSE file in the root directory of this source tree.
101
- */var N5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
101
+ */var O5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
102
102
  * @license lucide-react v0.540.0 - ISC
103
103
  *
104
104
  * This source code is licensed under the ISC license.
105
105
  * See the LICENSE file in the root directory of this source tree.
106
- */const C5=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>E.createElement("svg",{ref:a,...N5,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:g0("lucide",o),...!s&&!$5(c)&&{"aria-hidden":"true"},...c},[...i.map(([l,u])=>E.createElement(l,u)),...Array.isArray(s)?s:[s]]));/**
106
+ */const I5=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>E.createElement("svg",{ref:a,...O5,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:y0("lucide",o),...!s&&!C5(c)&&{"aria-hidden":"true"},...c},[...i.map(([l,u])=>E.createElement(l,u)),...Array.isArray(s)?s:[s]]));/**
107
107
  * @license lucide-react v0.540.0 - ISC
108
108
  *
109
109
  * This source code is licensed under the ISC license.
110
110
  * See the LICENSE file in the root directory of this source tree.
111
- */const O5=(e,t)=>{const n=E.forwardRef(({className:r,...o},s)=>E.createElement(C5,{ref:s,iconNode:t,className:g0(`lucide-${T5(b0(e))}`,`lucide-${e}`,r),...o}));return n.displayName=b0(e),n};/**
111
+ */const D5=(e,t)=>{const n=E.forwardRef(({className:r,...o},s)=>E.createElement(I5,{ref:s,iconNode:t,className:y0(`lucide-${A5(g0(e))}`,`lucide-${e}`,r),...o}));return n.displayName=g0(e),n};/**
112
112
  * @license lucide-react v0.540.0 - ISC
113
113
  *
114
114
  * This source code is licensed under the ISC license.
115
115
  * See the LICENSE file in the root directory of this source tree.
116
- */const y0=O5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),I5=typeof document<"u"?E.useLayoutEffect:()=>{},Pn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},qn=e=>e&&"window"in e&&e.window===e?e:Pn(e).defaultView||window;function k5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function D5(e){return k5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let M5=!1;function bc(){return M5}function Tn(e,t){if(!bc())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:D5(n)?n=n.host:n=n.parentNode}return!1}const Nr=(e=document)=>{var t;if(!bc())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 De(e){if(bc()&&e.target instanceof Element&&e.target.shadowRoot){var t,n;if("composedPath"in e)return(t=e.composedPath()[0])!==null&&t!==void 0?t:null;if("composedPath"in e.nativeEvent)return(n=e.nativeEvent.composedPath()[0])!==null&&n!==void 0?n:null}return e.target}function L5(e){if(B5())e.focus({preventScroll:!0});else{let t=F5(e);e.focus(),R5(t)}}let Rs=null;function B5(){if(Rs==null){Rs=!1;try{document.createElement("div").focus({get preventScroll(){return Rs=!0,!0}})}catch{}}return Rs}function F5(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function R5(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function js(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 gc(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 sn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Bo=sn(function(){return gc(/^Mac/i)}),j5=sn(function(){return gc(/^iPhone/i)}),v0=sn(function(){return gc(/^iPad/i)||Bo()&&navigator.maxTouchPoints>1}),_5=sn(function(){return j5()||v0()});sn(function(){return Bo()||_5()});const z5=sn(function(){return js(/AppleWebKit/i)&&!U5()}),U5=sn(function(){return js(/Chrome/i)}),W5=sn(function(){return js(/Android/i)}),H5=sn(function(){return js(/Firefox/i)});function Fo(e,t,n=!0){var r,o;let{metaKey:s,ctrlKey:i,altKey:c,shiftKey:a}=t;H5()&&(!((o=window.event)===null||o===void 0||(r=o.type)===null||r===void 0)&&r.startsWith("key"))&&e.target==="_blank"&&(Bo()?s=!0:i=!0);let l=z5()&&Bo()&&!v0()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:i,altKey:c,shiftKey:a}):new MouseEvent("click",{metaKey:s,ctrlKey:i,altKey:c,shiftKey:a,detail:1,bubbles:!0,cancelable:!0});Fo.isOpening=n,L5(e),e.dispatchEvent(l),Fo.isOpening=!1}Fo.isOpening=!1;function w0(){let e=E.useRef(new Map),t=E.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...l)=>{e.current.delete(i),i(...l)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=E.useCallback((o,s,i,c)=>{var a;let l=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,l,c),e.current.delete(i)},[]),r=E.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return E.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function V5(e){return e.pointerType===""&&e.isTrusted?!0:W5()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function x0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function G5(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function E0(e){let t=E.useRef({isFocused:!1,observer:null});return I5(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),E.useCallback(n=>{let r=De(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=x0(i);e==null||e(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===Nr()?null:Nr();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"]})}},[e])}let q5=!1,Ro=null;const yc=new Set;let jo=new Map,Zn=!1,vc=!1;const Z5={Tab:!0,Escape:!0};function wc(e,t){for(let n of yc)n(e,t)}function K5(e){return!(e.metaKey||!Bo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function _s(e){Zn=!0,!Fo.isOpening&&K5(e)&&(Ro="keyboard",wc("keyboard",e))}function dt(e){Ro="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(Zn=!0,wc("pointer",e))}function S0(e){!Fo.isOpening&&V5(e)&&(Zn=!0,Ro="virtual")}function P0(e){De(e)===window||De(e)===document||q5||!e.isTrusted||(!Zn&&!vc&&(Ro="virtual",wc("virtual",e)),Zn=!1,vc=!1)}function T0(){Zn=!1,vc=!0}function xc(e){if(typeof window>"u"||typeof document>"u"||jo.get(qn(e)))return;const t=qn(e),n=Pn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Zn=!0,r.apply(this,arguments)},n.addEventListener("keydown",_s,!0),n.addEventListener("keyup",_s,!0),n.addEventListener("click",S0,!0),t.addEventListener("focus",P0,!0),t.addEventListener("blur",T0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",dt,!0),n.addEventListener("pointermove",dt,!0),n.addEventListener("pointerup",dt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",dt,!0),n.addEventListener("mousemove",dt,!0),n.addEventListener("mouseup",dt,!0)),t.addEventListener("beforeunload",()=>{A0(e)},{once:!0}),jo.set(t,{focus:r})}const A0=(e,t)=>{const n=qn(e),r=Pn(e);t&&r.removeEventListener("DOMContentLoaded",t),jo.has(n)&&(n.HTMLElement.prototype.focus=jo.get(n).focus,r.removeEventListener("keydown",_s,!0),r.removeEventListener("keyup",_s,!0),r.removeEventListener("click",S0,!0),n.removeEventListener("focus",P0,!0),n.removeEventListener("blur",T0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",dt,!0),r.removeEventListener("pointermove",dt,!0),r.removeEventListener("pointerup",dt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",dt,!0),r.removeEventListener("mousemove",dt,!0),r.removeEventListener("mouseup",dt,!0)),jo.delete(n))};function Y5(e){const t=Pn(e);let n;return t.readyState!=="loading"?xc(e):(n=()=>{xc(e)},t.addEventListener("DOMContentLoaded",n)),()=>A0(e,n)}typeof document<"u"&&Y5();function Ec(){return Ro!=="pointer"}const X5=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Q5(e,t,n){let r=Pn(n?De(n):void 0),o=n?De(n):void 0;const s=typeof window<"u"?qn(o).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?qn(o).HTMLTextAreaElement:HTMLTextAreaElement,c=typeof window<"u"?qn(o).HTMLElement:HTMLElement,a=typeof window<"u"?qn(o).KeyboardEvent:KeyboardEvent;let l=Nr(r);return e=e||l instanceof s&&!X5.has(l.type)||l instanceof i||l instanceof c&&l.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!Z5[n.key])}function J5(e,t,n){xc(),E.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let r=(o,s)=>{Q5(!!(n!=null&&n.isTextInput),o,s)&&e(Ec())};return yc.add(r),()=>{yc.delete(r)}},t)}function ex(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=E.useCallback(a=>{if(De(a)===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=E0(s),c=E.useCallback(a=>{let l=De(a);const u=Pn(l),f=u?Nr(u):Nr();l===a.currentTarget&&l===f&&(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=E.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=w0(),a=E.useCallback(f=>{Tn(f.currentTarget,De(f))&&s.current.isFocusWithin&&!Tn(f.currentTarget,f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),l=E0(a),u=E.useCallback(f=>{if(!Tn(f.currentTarget,De(f)))return;let d=De(f);const p=Pn(d),h=Nr(p);if(!s.current.isFocusWithin&&h===d){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,l(f);let b=f.currentTarget;i(p,"focus",S=>{let P=De(S);if(s.current.isFocusWithin&&!Tn(b,P)){let x=new p.defaultView.FocusEvent("blur",{relatedTarget:P});G5(x,b);let w=x0(x);a(w)}},{capture:!0})}},[r,o,l,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let zs=!1,Us=0;function Sc(){zs=!0,setTimeout(()=>{zs=!1},50)}function $0(e){e.pointerType==="touch"&&Sc()}function nx(){if(!(typeof document>"u"))return Us===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",$0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Sc)),Us++,()=>{Us--,!(Us>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",$0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Sc))}}function rx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=E.useState(!1),c=E.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;E.useEffect(nx,[]);let{addGlobalListener:a,removeAllGlobalListeners:l}=w0(),{hoverProps:u,triggerHoverEnd:f}=E.useMemo(()=>{let d=(b,S)=>{if(c.pointerType=S,o||S==="touch"||c.isHovered||!Tn(b.currentTarget,De(b)))return;c.isHovered=!0;let P=b.currentTarget;c.target=P,a(Pn(De(b)),"pointerover",x=>{c.isHovered&&c.target&&!Tn(c.target,De(x))&&p(x,x.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:P,pointerType:S}),n&&n(!0),i(!0)},p=(b,S)=>{let P=c.target;c.pointerType="",c.target=null,!(S==="touch"||!c.isHovered||!P)&&(c.isHovered=!1,l(),r&&r({type:"hoverend",target:P,pointerType:S}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=b=>{zs&&b.pointerType==="mouse"||d(b,b.pointerType)},h.onPointerLeave=b=>{!o&&Tn(b.currentTarget,De(b))&&p(b,b.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=b=>{!c.ignoreEmulatedMouseEvents&&!zs&&d(b,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=b=>{!o&&Tn(b.currentTarget,De(b))&&p(b,"mouse")}),{hoverProps:h,triggerHoverEnd:p}},[t,n,r,o,c,a,l]);return E.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:u,isHovered:s}}function ox(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=E.useRef({isFocused:!1,isFocusVisible:t||Ec()}),[s,i]=E.useState(!1),[c,a]=E.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=E.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=E.useCallback(p=>{o.current.isFocused=p,o.current.isFocusVisible=Ec(),i(p),l()},[l]);J5(p=>{o.current.isFocusVisible=p,l()},[n,s],{enabled:s,isTextInput:n});let{focusProps:f}=ex({isDisabled:r,onFocusChange:u}),{focusWithinProps:d}=tx({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:c,focusProps:r?d:f}}var sx=Object.defineProperty,ix=(e,t,n)=>t in e?sx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pc=(e,t,n)=>(ix(e,typeof t!="symbol"?t+"":t,n),n);let ax=class{constructor(){Pc(this,"current",this.detect()),Pc(this,"handoffState","pending"),Pc(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},_t=new ax;function Ws(e){var t;return _t.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Hs(e){var t,n;return _t.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function N0(e){var t,n;return(n=(t=Hs(e))==null?void 0:t.activeElement)!=null?n:null}function cx(e){return N0(e)===e}function C0(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function rt(){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 C0(()=>{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=rt();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 Kn(){let[e]=E.useState(rt);return E.useEffect(()=>()=>e.dispose(),[e]),e}let Ee=(e,t)=>{_t.isServer?E.useEffect(e,t):E.useLayoutEffect(e,t)};function Yn(e){let t=E.useRef(e);return Ee(()=>{t.current=e},[e]),t}let ue=function(e){let t=Yn(e);return E.useCallback((...n)=>t.current(...n),[t])};function lx(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 ux(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function fx({disabled:e=!1}={}){let t=E.useRef(null),[n,r]=E.useState(!1),o=Kn(),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=Ws(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",l=>{if(t.current){let u=lx(l);r(ux(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}function An(e){return E.useMemo(()=>e,Object.values(e))}let dx=E.createContext(void 0);function Tc(){return E.useContext(dx)}function Ac(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function pt(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,pt),r}var Vs=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Vs||{}),$n=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))($n||{});function ot(){let e=hx();return E.useCallback(t=>px({mergeRefs:e,...t}),[e])}function px({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??mx;let a=O0(t,e);if(s)return Gs(a,n,r,i,c);let l=o??0;if(l&2){let{static:u=!1,...f}=a;if(u)return Gs(f,n,r,i,c)}if(l&1){let{unmount:u=!0,...f}=a;return pt(u?0:1,{0(){return null},1(){return Gs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return Gs(a,n,r,i,c)}function Gs(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=$c(e,["unmount","static"]),l=e.ref!==void 0?{[c]:e.ref}:{},u=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let d=!1,p=[];for(let[h,b]of Object.entries(t))typeof b=="boolean"&&(d=!0),b===!0&&p.push(h.replace(/([A-Z])/g,S=>`-${S.toLowerCase()}`));if(d){f["data-headlessui-state"]=p.join(" ");for(let h of p)f[`data-${h}`]=""}}if(_o(s)&&(Object.keys(Nn(a)).length>0||Object.keys(Nn(f)).length>0))if(!E.isValidElement(u)||Array.isArray(u)&&u.length>1||gx(u)){if(Object.keys(Nn(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(Nn(a)).concat(Object.keys(Nn(f))).map(d=>` - ${d}`).join(`
116
+ */const v0=D5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),M5=typeof document<"u"?E.useLayoutEffect:()=>{},Pn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},qn=e=>e&&"window"in e&&e.window===e?e:Pn(e).defaultView||window;function k5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function L5(e){return k5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let B5=!1;function gc(){return B5}function Tn(e,t){if(!gc())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:L5(n)?n=n.host:n=n.parentNode}return!1}const Nr=(e=document)=>{var t;if(!gc())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 Me(e){if(gc()&&e.target instanceof Element&&e.target.shadowRoot){var t,n;if("composedPath"in e)return(t=e.composedPath()[0])!==null&&t!==void 0?t:null;if("composedPath"in e.nativeEvent)return(n=e.nativeEvent.composedPath()[0])!==null&&n!==void 0?n:null}return e.target}function F5(e){if(R5())e.focus({preventScroll:!0});else{let t=j5(e);e.focus(),_5(t)}}let js=null;function R5(){if(js==null){js=!1;try{document.createElement("div").focus({get preventScroll(){return js=!0,!0}})}catch{}}return js}function j5(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function _5(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function _s(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 yc(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 sn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Bo=sn(function(){return yc(/^Mac/i)}),z5=sn(function(){return yc(/^iPhone/i)}),w0=sn(function(){return yc(/^iPad/i)||Bo()&&navigator.maxTouchPoints>1}),U5=sn(function(){return z5()||w0()});sn(function(){return Bo()||U5()});const W5=sn(function(){return _s(/AppleWebKit/i)&&!H5()}),H5=sn(function(){return _s(/Chrome/i)}),V5=sn(function(){return _s(/Android/i)}),G5=sn(function(){return _s(/Firefox/i)});function Fo(e,t,n=!0){var r,o;let{metaKey:s,ctrlKey:i,altKey:c,shiftKey:a}=t;G5()&&(!((o=window.event)===null||o===void 0||(r=o.type)===null||r===void 0)&&r.startsWith("key"))&&e.target==="_blank"&&(Bo()?s=!0:i=!0);let l=W5()&&Bo()&&!w0()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:i,altKey:c,shiftKey:a}):new MouseEvent("click",{metaKey:s,ctrlKey:i,altKey:c,shiftKey:a,detail:1,bubbles:!0,cancelable:!0});Fo.isOpening=n,F5(e),e.dispatchEvent(l),Fo.isOpening=!1}Fo.isOpening=!1;function x0(){let e=E.useRef(new Map),t=E.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...l)=>{e.current.delete(i),i(...l)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=E.useCallback((o,s,i,c)=>{var a;let l=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,l,c),e.current.delete(i)},[]),r=E.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return E.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function q5(e){return e.pointerType===""&&e.isTrusted?!0:V5()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function E0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Z5(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function S0(e){let t=E.useRef({isFocused:!1,observer:null});return M5(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),E.useCallback(n=>{let r=Me(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=E0(i);e==null||e(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===Nr()?null:Nr();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"]})}},[e])}let K5=!1,Ro=null;const vc=new Set;let jo=new Map,Zn=!1,wc=!1;const Y5={Tab:!0,Escape:!0};function xc(e,t){for(let n of vc)n(e,t)}function X5(e){return!(e.metaKey||!Bo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function zs(e){Zn=!0,!Fo.isOpening&&X5(e)&&(Ro="keyboard",xc("keyboard",e))}function dt(e){Ro="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(Zn=!0,xc("pointer",e))}function P0(e){!Fo.isOpening&&q5(e)&&(Zn=!0,Ro="virtual")}function T0(e){Me(e)===window||Me(e)===document||K5||!e.isTrusted||(!Zn&&!wc&&(Ro="virtual",xc("virtual",e)),Zn=!1,wc=!1)}function $0(){Zn=!1,wc=!0}function Ec(e){if(typeof window>"u"||typeof document>"u"||jo.get(qn(e)))return;const t=qn(e),n=Pn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Zn=!0,r.apply(this,arguments)},n.addEventListener("keydown",zs,!0),n.addEventListener("keyup",zs,!0),n.addEventListener("click",P0,!0),t.addEventListener("focus",T0,!0),t.addEventListener("blur",$0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",dt,!0),n.addEventListener("pointermove",dt,!0),n.addEventListener("pointerup",dt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",dt,!0),n.addEventListener("mousemove",dt,!0),n.addEventListener("mouseup",dt,!0)),t.addEventListener("beforeunload",()=>{A0(e)},{once:!0}),jo.set(t,{focus:r})}const A0=(e,t)=>{const n=qn(e),r=Pn(e);t&&r.removeEventListener("DOMContentLoaded",t),jo.has(n)&&(n.HTMLElement.prototype.focus=jo.get(n).focus,r.removeEventListener("keydown",zs,!0),r.removeEventListener("keyup",zs,!0),r.removeEventListener("click",P0,!0),n.removeEventListener("focus",T0,!0),n.removeEventListener("blur",$0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",dt,!0),r.removeEventListener("pointermove",dt,!0),r.removeEventListener("pointerup",dt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",dt,!0),r.removeEventListener("mousemove",dt,!0),r.removeEventListener("mouseup",dt,!0)),jo.delete(n))};function Q5(e){const t=Pn(e);let n;return t.readyState!=="loading"?Ec(e):(n=()=>{Ec(e)},t.addEventListener("DOMContentLoaded",n)),()=>A0(e,n)}typeof document<"u"&&Q5();function Sc(){return Ro!=="pointer"}const J5=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function ex(e,t,n){let r=Pn(n?Me(n):void 0),o=n?Me(n):void 0;const s=typeof window<"u"?qn(o).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?qn(o).HTMLTextAreaElement:HTMLTextAreaElement,c=typeof window<"u"?qn(o).HTMLElement:HTMLElement,a=typeof window<"u"?qn(o).KeyboardEvent:KeyboardEvent;let l=Nr(r);return e=e||l instanceof s&&!J5.has(l.type)||l instanceof i||l instanceof c&&l.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!Y5[n.key])}function tx(e,t,n){Ec(),E.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let r=(o,s)=>{ex(!!(n!=null&&n.isTextInput),o,s)&&e(Sc())};return vc.add(r),()=>{vc.delete(r)}},t)}function nx(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=E.useCallback(a=>{if(Me(a)===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=S0(s),c=E.useCallback(a=>{let l=Me(a);const u=Pn(l),f=u?Nr(u):Nr();l===a.currentTarget&&l===f&&(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 rx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=E.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=x0(),a=E.useCallback(f=>{Tn(f.currentTarget,Me(f))&&s.current.isFocusWithin&&!Tn(f.currentTarget,f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),l=S0(a),u=E.useCallback(f=>{if(!Tn(f.currentTarget,Me(f)))return;let d=Me(f);const p=Pn(d),h=Nr(p);if(!s.current.isFocusWithin&&h===d){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,l(f);let b=f.currentTarget;i(p,"focus",S=>{let P=Me(S);if(s.current.isFocusWithin&&!Tn(b,P)){let x=new p.defaultView.FocusEvent("blur",{relatedTarget:P});Z5(x,b);let w=E0(x);a(w)}},{capture:!0})}},[r,o,l,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let Us=!1,Ws=0;function Pc(){Us=!0,setTimeout(()=>{Us=!1},50)}function N0(e){e.pointerType==="touch"&&Pc()}function ox(){if(!(typeof document>"u"))return Ws===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",N0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Pc)),Ws++,()=>{Ws--,!(Ws>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",N0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Pc))}}function sx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=E.useState(!1),c=E.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;E.useEffect(ox,[]);let{addGlobalListener:a,removeAllGlobalListeners:l}=x0(),{hoverProps:u,triggerHoverEnd:f}=E.useMemo(()=>{let d=(b,S)=>{if(c.pointerType=S,o||S==="touch"||c.isHovered||!Tn(b.currentTarget,Me(b)))return;c.isHovered=!0;let P=b.currentTarget;c.target=P,a(Pn(Me(b)),"pointerover",x=>{c.isHovered&&c.target&&!Tn(c.target,Me(x))&&p(x,x.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:P,pointerType:S}),n&&n(!0),i(!0)},p=(b,S)=>{let P=c.target;c.pointerType="",c.target=null,!(S==="touch"||!c.isHovered||!P)&&(c.isHovered=!1,l(),r&&r({type:"hoverend",target:P,pointerType:S}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=b=>{Us&&b.pointerType==="mouse"||d(b,b.pointerType)},h.onPointerLeave=b=>{!o&&Tn(b.currentTarget,Me(b))&&p(b,b.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=b=>{!c.ignoreEmulatedMouseEvents&&!Us&&d(b,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=b=>{!o&&Tn(b.currentTarget,Me(b))&&p(b,"mouse")}),{hoverProps:h,triggerHoverEnd:p}},[t,n,r,o,c,a,l]);return E.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:u,isHovered:s}}function ix(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=E.useRef({isFocused:!1,isFocusVisible:t||Sc()}),[s,i]=E.useState(!1),[c,a]=E.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=E.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=E.useCallback(p=>{o.current.isFocused=p,o.current.isFocusVisible=Sc(),i(p),l()},[l]);tx(p=>{o.current.isFocusVisible=p,l()},[n,s],{enabled:s,isTextInput:n});let{focusProps:f}=nx({isDisabled:r,onFocusChange:u}),{focusWithinProps:d}=rx({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:c,focusProps:r?d:f}}var ax=Object.defineProperty,cx=(e,t,n)=>t in e?ax(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tc=(e,t,n)=>(cx(e,typeof t!="symbol"?t+"":t,n),n);let lx=class{constructor(){Tc(this,"current",this.detect()),Tc(this,"handoffState","pending"),Tc(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},_t=new lx;function Hs(e){var t;return _t.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Vs(e){var t,n;return _t.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function C0(e){var t,n;return(n=(t=Vs(e))==null?void 0:t.activeElement)!=null?n:null}function ux(e){return C0(e)===e}function O0(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function rt(){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 O0(()=>{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=rt();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 Kn(){let[e]=E.useState(rt);return E.useEffect(()=>()=>e.dispose(),[e]),e}let Ee=(e,t)=>{_t.isServer?E.useEffect(e,t):E.useLayoutEffect(e,t)};function Yn(e){let t=E.useRef(e);return Ee(()=>{t.current=e},[e]),t}let fe=function(e){let t=Yn(e);return E.useCallback((...n)=>t.current(...n),[t])};function fx(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 dx(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function px({disabled:e=!1}={}){let t=E.useRef(null),[n,r]=E.useState(!1),o=Kn(),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=Hs(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",l=>{if(t.current){let u=fx(l);r(dx(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}function $n(e){return E.useMemo(()=>e,Object.values(e))}let hx=E.createContext(void 0);function $c(){return E.useContext(hx)}function Ac(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function pt(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,pt),r}var Gs=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Gs||{}),An=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(An||{});function ot(){let e=bx();return E.useCallback(t=>mx({mergeRefs:e,...t}),[e])}function mx({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??gx;let a=I0(t,e);if(s)return qs(a,n,r,i,c);let l=o??0;if(l&2){let{static:u=!1,...f}=a;if(u)return qs(f,n,r,i,c)}if(l&1){let{unmount:u=!0,...f}=a;return pt(u?0:1,{0(){return null},1(){return qs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return qs(a,n,r,i,c)}function qs(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=Nc(e,["unmount","static"]),l=e.ref!==void 0?{[c]:e.ref}:{},u=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let d=!1,p=[];for(let[h,b]of Object.entries(t))typeof b=="boolean"&&(d=!0),b===!0&&p.push(h.replace(/([A-Z])/g,S=>`-${S.toLowerCase()}`));if(d){f["data-headlessui-state"]=p.join(" ");for(let h of p)f[`data-${h}`]=""}}if(_o(s)&&(Object.keys(Nn(a)).length>0||Object.keys(Nn(f)).length>0))if(!E.isValidElement(u)||Array.isArray(u)&&u.length>1||vx(u)){if(Object.keys(Nn(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(Nn(a)).concat(Object.keys(Nn(f))).map(d=>` - ${d}`).join(`
117
117
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(d=>` - ${d}`).join(`
118
118
  `)].join(`
119
- `))}else{let d=u.props,p=d==null?void 0:d.className,h=typeof p=="function"?(...P)=>Ac(p(...P),a.className):Ac(p,a.className),b=h?{className:h}:{},S=O0(u.props,Nn($c(a,["ref"])));for(let P in f)P in S&&delete f[P];return E.cloneElement(u,Object.assign({},S,f,l,{ref:o(bx(u),l.ref)},b))}return E.createElement(s,Object.assign({},$c(a,["ref"]),!_o(s)&&l,!_o(s)&&f),u)}function hx(){let e=E.useRef([]),t=E.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function mx(...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 O0(...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 I0(...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 qe(e){var t;return Object.assign(E.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Nn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function $c(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function bx(e){return E.version.split(".")[0]>="19"?e.props.ref:e.ref}function _o(e){return e===E.Fragment||e===Symbol.for("react.fragment")}function gx(e){return _o(e.type)}function yx(e,t,n){let[r,o]=E.useState(n),s=e!==void 0,i=E.useRef(s),c=E.useRef(!1),a=E.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,ue(l=>(s||je.flushSync(()=>o(l)),t==null?void 0:t(l)))]}function vx(e){let[t]=E.useState(e);return t}function k0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))M0(n,D0(t,r),o);return n}function D0(e,t){return e?e+"["+t+"]":t}function M0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())M0(e,D0(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,""]):xx(n)&&!E.isValidElement(n)&&k0(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)}}function xx(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let Ex="span";var Nc=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Nc||{});function Sx(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 ot()({ourProps:s,theirProps:o,slot:{},defaultTag:Ex,name:"Hidden"})}let L0=qe(Sx),Px=E.createContext(null);function Tx({children:e}){let t=E.useContext(Px);if(!t)return E.createElement(E.Fragment,null,e);let{target:n}=t;return n?je.createPortal(E.createElement(E.Fragment,null,e),n):null}function Ax({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=E.useState(null),c=Kn();return E.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),E.createElement(Tx,null,E.createElement($x,{setForm:i,formId:t}),k0(e).map(([a,l])=>E.createElement(L0,{features:Nc.Hidden,...Nn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:l,...o})})))}function $x({setForm:e,formId:t}){return E.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:E.createElement(L0,{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 Nx=E.createContext(void 0);function B0(){return E.useContext(Nx)}function F0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function qs(e){return F0(e)&&"tagName"in e}function an(e){return qs(e)&&"accessKey"in e}function Cr(e){return qs(e)&&"tabIndex"in e}function Cx(e){return qs(e)&&"style"in e}function Ox(e){return an(e)&&e.nodeName==="IFRAME"}function R0(e){return an(e)&&e.nodeName==="INPUT"}function j0(e){return an(e)&&e.nodeName==="LABEL"}function Ix(e){return an(e)&&e.nodeName==="FIELDSET"}function _0(e){return an(e)&&e.nodeName==="LEGEND"}function kx(e){return qs(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function z0(e){let t=e.parentElement,n=null;for(;t&&!Ix(t);)_0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Dx(n)?!1:r}function Dx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(_0(t))return!1;t=t.previousElementSibling}return!0}let U0=Symbol();function Mx(e,t=!0){return Object.assign(e,{[U0]:t})}function ht(...e){let t=E.useRef(e);E.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[U0]))?void 0:n}let Cc=E.createContext(null);Cc.displayName="DescriptionContext";function W0(){let e=E.useContext(Cc);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,W0),t}return e}function Lx(){var e,t;return(t=(e=E.useContext(Cc))==null?void 0:e.value)!=null?t:void 0}let Bx="p";function Fx(e,t){let n=E.useId(),r=Tc(),{id:o=`headlessui-description-${n}`,...s}=e,i=W0(),c=ht(t);Ee(()=>i.register(o),[o,i.register]);let a=An({...i.slot,disabled:r||!1}),l={ref:c,...i.props,id:o};return ot()({ourProps:l,theirProps:s,slot:a,defaultTag:Bx,name:i.name||"Description"})}let Rx=qe(Fx);Object.assign(Rx,{});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 Zs=E.createContext(null);Zs.displayName="LabelContext";function H0(){let e=E.useContext(Zs);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,H0),t}return e}function V0(e){var t,n,r;let o=(n=(t=E.useContext(Zs))==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 jx({inherit:e=!1}={}){let t=V0(),[n,r]=E.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,E.useMemo(()=>function(s){let i=ue(a=>(r(l=>[...l,a]),()=>r(l=>{let u=l.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),c=E.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return E.createElement(Zs.Provider,{value:c},s.children)},[r])]}let _x="label";function zx(e,t){var n;let r=E.useId(),o=H0(),s=B0(),i=Tc(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...u}=e,f=ht(t);Ee(()=>o.register(c),[c,o.register]);let d=ue(b=>{let S=b.currentTarget;if(!(b.target!==b.currentTarget&&kx(b.target))&&(j0(S)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),j0(S))){let P=document.getElementById(S.htmlFor);if(P){let x=P.getAttribute("disabled");if(x==="true"||x==="")return;let w=P.getAttribute("aria-disabled");if(w==="true"||w==="")return;(R0(P)&&(P.type==="file"||P.type==="radio"||P.type==="checkbox")||P.role==="radio"||P.role==="checkbox"||P.role==="switch")&&P.click(),P.focus({preventScroll:!0})}}}),p=An({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:c,htmlFor:a,onClick:d};return l&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in u&&delete u.onClick),ot()({ourProps:h,theirProps:u,slot:p,defaultTag:a?_x:"div",name:o.name||"Label"})}let Ux=qe(zx),Wx=Object.assign(Ux,{});function Hx(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 Vx(e=Hx){return E.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function G0(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Gx(e,t,n=!1){let[r,o]=E.useState(()=>G0(t));return Ee(()=>{if(!t||!e)return;let s=rt();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(c=>{let a=G0(t);return a.width===c.width&&a.height===c.height?c:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var q0=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(q0||{});function qx(e){let t=E.useRef(null),n=ue(o=>{t.current=o.pointerType,!z0(o.currentTarget)&&o.pointerType==="mouse"&&o.button===q0.Left&&(o.preventDefault(),e(o))}),r=ue(o=>{t.current!=="mouse"&&(z0(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let Z0=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 Zx=Object.defineProperty,Kx=(e,t,n)=>t in e?Zx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yx=(e,t,n)=>(Kx(e,t+"",n),n),K0=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},mt=(e,t,n)=>(K0(e,t,"read from private field"),n?n.call(e):t.get(e)),Oc=(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)},Y0=(e,t,n,r)=>(K0(e,t,"write to private field"),t.set(e,n),n),zt,zo,Uo;let X0=class{constructor(t){Oc(this,zt,{}),Oc(this,zo,new Z0(()=>new Set)),Oc(this,Uo,new Set),Yx(this,"disposables",rt()),Y0(this,zt,t),_t.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return mt(this,zt)}subscribe(t,n){if(_t.isServer)return()=>{};let r={selector:t,callback:n,current:t(mt(this,zt))};return mt(this,Uo).add(r),this.disposables.add(()=>{mt(this,Uo).delete(r)})}on(t,n){return _t.isServer?()=>{}:(mt(this,zo).get(t).add(n),this.disposables.add(()=>{mt(this,zo).get(t).delete(n)}))}send(t){let n=this.reduce(mt(this,zt),t);if(n!==mt(this,zt)){Y0(this,zt,n);for(let r of mt(this,Uo)){let o=r.selector(mt(this,zt));Q0(r.current,o)||(r.current=o,r.callback(o))}for(let r of mt(this,zo).get(t.type))r(mt(this,zt),t)}}};zt=new WeakMap,zo=new WeakMap,Uo=new WeakMap;function Q0(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()):J0(e)&&J0(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 J0(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function kc(e){let[t,n]=e(),r=rt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Xx=Object.defineProperty,Qx=(e,t,n)=>t in e?Xx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ep=(e,t,n)=>(Qx(e,typeof t!="symbol"?t+"":t,n),n),tp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(tp||{});let Jx={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}}},e2=class jm extends X0{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 jm({stack:[]})}reduce(t,n){return pt(n.type,Jx,t,n)}};const Dc=new Z0(()=>e2.new());var Mc={exports:{}},Lc={};/**
119
+ `))}else{let d=u.props,p=d==null?void 0:d.className,h=typeof p=="function"?(...P)=>Ac(p(...P),a.className):Ac(p,a.className),b=h?{className:h}:{},S=I0(u.props,Nn(Nc(a,["ref"])));for(let P in f)P in S&&delete f[P];return E.cloneElement(u,Object.assign({},S,f,l,{ref:o(yx(u),l.ref)},b))}return E.createElement(s,Object.assign({},Nc(a,["ref"]),!_o(s)&&l,!_o(s)&&f),u)}function bx(){let e=E.useRef([]),t=E.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function gx(...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 I0(...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 D0(...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 qe(e){var t;return Object.assign(E.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Nn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Nc(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function yx(e){return E.version.split(".")[0]>="19"?e.props.ref:e.ref}function _o(e){return e===E.Fragment||e===Symbol.for("react.fragment")}function vx(e){return _o(e.type)}function wx(e,t,n){let[r,o]=E.useState(n),s=e!==void 0,i=E.useRef(s),c=E.useRef(!1),a=E.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,fe(l=>(s||je.flushSync(()=>o(l)),t==null?void 0:t(l)))]}function xx(e){let[t]=E.useState(e);return t}function M0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))L0(n,k0(t,r),o);return n}function k0(e,t){return e?e+"["+t+"]":t}function L0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())L0(e,k0(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,""]):Sx(n)&&!E.isValidElement(n)&&M0(n,t,e)}function Ex(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}function Sx(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let Px="span";var Cc=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Cc||{});function Tx(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 ot()({ourProps:s,theirProps:o,slot:{},defaultTag:Px,name:"Hidden"})}let B0=qe(Tx),$x=E.createContext(null);function Ax({children:e}){let t=E.useContext($x);if(!t)return E.createElement(E.Fragment,null,e);let{target:n}=t;return n?je.createPortal(E.createElement(E.Fragment,null,e),n):null}function Nx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=E.useState(null),c=Kn();return E.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),E.createElement(Ax,null,E.createElement(Cx,{setForm:i,formId:t}),M0(e).map(([a,l])=>E.createElement(B0,{features:Cc.Hidden,...Nn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:l,...o})})))}function Cx({setForm:e,formId:t}){return E.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:E.createElement(B0,{features:Cc.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Ox=E.createContext(void 0);function F0(){return E.useContext(Ox)}function R0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Zs(e){return R0(e)&&"tagName"in e}function an(e){return Zs(e)&&"accessKey"in e}function Cr(e){return Zs(e)&&"tabIndex"in e}function Ix(e){return Zs(e)&&"style"in e}function Dx(e){return an(e)&&e.nodeName==="IFRAME"}function j0(e){return an(e)&&e.nodeName==="INPUT"}function _0(e){return an(e)&&e.nodeName==="LABEL"}function Mx(e){return an(e)&&e.nodeName==="FIELDSET"}function z0(e){return an(e)&&e.nodeName==="LEGEND"}function kx(e){return Zs(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function U0(e){let t=e.parentElement,n=null;for(;t&&!Mx(t);)z0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Lx(n)?!1:r}function Lx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(z0(t))return!1;t=t.previousElementSibling}return!0}let W0=Symbol();function Bx(e,t=!0){return Object.assign(e,{[W0]:t})}function ht(...e){let t=E.useRef(e);E.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[W0]))?void 0:n}let Oc=E.createContext(null);Oc.displayName="DescriptionContext";function H0(){let e=E.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,H0),t}return e}function Fx(){var e,t;return(t=(e=E.useContext(Oc))==null?void 0:e.value)!=null?t:void 0}let Rx="p";function jx(e,t){let n=E.useId(),r=$c(),{id:o=`headlessui-description-${n}`,...s}=e,i=H0(),c=ht(t);Ee(()=>i.register(o),[o,i.register]);let a=$n({...i.slot,disabled:r||!1}),l={ref:c,...i.props,id:o};return ot()({ourProps:l,theirProps:s,slot:a,defaultTag:Rx,name:i.name||"Description"})}let _x=qe(jx);Object.assign(_x,{});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 Ks=E.createContext(null);Ks.displayName="LabelContext";function V0(){let e=E.useContext(Ks);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,V0),t}return e}function G0(e){var t,n,r;let o=(n=(t=E.useContext(Ks))==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 zx({inherit:e=!1}={}){let t=G0(),[n,r]=E.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,E.useMemo(()=>function(s){let i=fe(a=>(r(l=>[...l,a]),()=>r(l=>{let u=l.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),c=E.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return E.createElement(Ks.Provider,{value:c},s.children)},[r])]}let Ux="label";function Wx(e,t){var n;let r=E.useId(),o=V0(),s=F0(),i=$c(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...u}=e,f=ht(t);Ee(()=>o.register(c),[c,o.register]);let d=fe(b=>{let S=b.currentTarget;if(!(b.target!==b.currentTarget&&kx(b.target))&&(_0(S)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),_0(S))){let P=document.getElementById(S.htmlFor);if(P){let x=P.getAttribute("disabled");if(x==="true"||x==="")return;let w=P.getAttribute("aria-disabled");if(w==="true"||w==="")return;(j0(P)&&(P.type==="file"||P.type==="radio"||P.type==="checkbox")||P.role==="radio"||P.role==="checkbox"||P.role==="switch")&&P.click(),P.focus({preventScroll:!0})}}}),p=$n({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:c,htmlFor:a,onClick:d};return l&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in u&&delete u.onClick),ot()({ourProps:h,theirProps:u,slot:p,defaultTag:a?Ux:"div",name:o.name||"Label"})}let Hx=qe(Wx),Vx=Object.assign(Hx,{});function Gx(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 qx(e=Gx){return E.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function q0(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Zx(e,t,n=!1){let[r,o]=E.useState(()=>q0(t));return Ee(()=>{if(!t||!e)return;let s=rt();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(c=>{let a=q0(t);return a.width===c.width&&a.height===c.height?c:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var Z0=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Z0||{});function Kx(e){let t=E.useRef(null),n=fe(o=>{t.current=o.pointerType,!U0(o.currentTarget)&&o.pointerType==="mouse"&&o.button===Z0.Left&&(o.preventDefault(),e(o))}),r=fe(o=>{t.current!=="mouse"&&(U0(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let K0=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 Yx=Object.defineProperty,Xx=(e,t,n)=>t in e?Yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qx=(e,t,n)=>(Xx(e,t+"",n),n),Y0=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},mt=(e,t,n)=>(Y0(e,t,"read from private field"),n?n.call(e):t.get(e)),Ic=(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)},X0=(e,t,n,r)=>(Y0(e,t,"write to private field"),t.set(e,n),n),zt,zo,Uo;let Q0=class{constructor(t){Ic(this,zt,{}),Ic(this,zo,new K0(()=>new Set)),Ic(this,Uo,new Set),Qx(this,"disposables",rt()),X0(this,zt,t),_t.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return mt(this,zt)}subscribe(t,n){if(_t.isServer)return()=>{};let r={selector:t,callback:n,current:t(mt(this,zt))};return mt(this,Uo).add(r),this.disposables.add(()=>{mt(this,Uo).delete(r)})}on(t,n){return _t.isServer?()=>{}:(mt(this,zo).get(t).add(n),this.disposables.add(()=>{mt(this,zo).get(t).delete(n)}))}send(t){let n=this.reduce(mt(this,zt),t);if(n!==mt(this,zt)){X0(this,zt,n);for(let r of mt(this,Uo)){let o=r.selector(mt(this,zt));J0(r.current,o)||(r.current=o,r.callback(o))}for(let r of mt(this,zo).get(t.type))r(mt(this,zt),t)}}};zt=new WeakMap,zo=new WeakMap,Uo=new WeakMap;function J0(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:Dc(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Dc(e.entries(),t.entries()):ep(e)&&ep(t)?Dc(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Dc(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 ep(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Mc(e){let[t,n]=e(),r=rt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Jx=Object.defineProperty,e2=(e,t,n)=>t in e?Jx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tp=(e,t,n)=>(e2(e,typeof t!="symbol"?t+"":t,n),n),np=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(np||{});let t2={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}}},n2=class zm extends Q0{constructor(){super(...arguments),tp(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),tp(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new zm({stack:[]})}reduce(t,n){return pt(n.type,t2,t,n)}};const kc=new K0(()=>n2.new());var Lc={exports:{}},Bc={};/**
120
120
  * @license React
121
121
  * use-sync-external-store-with-selector.production.js
122
122
  *
@@ -124,7 +124,7 @@ ${xg(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
124
124
  *
125
125
  * This source code is licensed under the MIT license found in the
126
126
  * LICENSE file in the root directory of this source tree.
127
- */var np;function t2(){if(np)return Lc;np=1;var e=E;function t(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}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,l,u,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 S(M){if(!P){if(P=!0,x=M,M=f(M),d!==void 0&&h.hasValue){var B=h.value;if(d(B,M))return w=B}return w=M}if(B=w,n(x,M))return B;var F=f(M);return d!==void 0&&d(B,F)?(x=M,B):(x=M,w=F)}var P=!1,x,w,A=u===void 0?null:u;return[function(){return S(l())},A===null?void 0:function(){return S(A())}]},[l,u,f,d]);var b=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),c(b),b},Lc}var Bc={};/**
127
+ */var rp;function r2(){if(rp)return Bc;rp=1;var e=E;function t(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}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 Bc.useSyncExternalStoreWithSelector=function(a,l,u,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 S(k){if(!P){if(P=!0,x=k,k=f(k),d!==void 0&&h.hasValue){var B=h.value;if(d(B,k))return w=B}return w=k}if(B=w,n(x,k))return B;var F=f(k);return d!==void 0&&d(B,F)?(x=k,B):(x=k,w=F)}var P=!1,x,w,$=u===void 0?null:u;return[function(){return S(l())},$===null?void 0:function(){return S($())}]},[l,u,f,d]);var b=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),c(b),b},Bc}var Fc={};/**
128
128
  * @license React
129
129
  * use-sync-external-store-with-selector.development.js
130
130
  *
@@ -132,49 +132,49 @@ ${xg(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
132
132
  *
133
133
  * This source code is licensed under the MIT license found in the
134
134
  * LICENSE file in the root directory of this source tree.
135
- */var rp;function n2(){return rp||(rp=1,process.env.NODE_ENV!=="production"&&function(){function e(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=E,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Bc.useSyncExternalStoreWithSelector=function(a,l,u,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 S(M){if(!P){if(P=!0,x=M,M=f(M),d!==void 0&&h.hasValue){var B=h.value;if(d(B,M))return w=B}return w=M}if(B=w,n(x,M))return B;var F=f(M);return d!==void 0&&d(B,F)?(x=M,B):(x=M,w=F)}var P=!1,x,w,A=u===void 0?null:u;return[function(){return S(l())},A===null?void 0:function(){return S(A())}]},[l,u,f,d]);var b=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),c(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Bc}process.env.NODE_ENV==="production"?Mc.exports=t2():Mc.exports=n2();var r2=Mc.exports;function Ze(e,t,n=Q0){return r2.useSyncExternalStoreWithSelector(ue(r=>e.subscribe(o2,r)),ue(()=>e.state),ue(()=>e.state),ue(t),n)}function o2(e){return e}function op(e,t){let n=E.useId(),r=Dc.get(t),[o,s]=Ze(r,E.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Ee(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Fc=new Map,Wo=new Map;function sp(e){var t;let n=(t=Wo.get(e))!=null?t:0;return Wo.set(e,n+1),n!==0?()=>ip(e):(Fc.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=Wo.get(e))!=null?t:1;if(n===1?Wo.delete(e):Wo.set(e,n-1),n!==1)return;let r=Fc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Fc.delete(e))}function s2(e,{allowed:t,disallowed:n}={}){let r=op(e,"inert-others");Ee(()=>{var o,s;if(!r)return;let i=rt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(sp(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let l=Ws(a);if(!l)continue;let u=a.parentElement;for(;u&&u!==l.body;){for(let f of u.children)c.some(d=>f.contains(d))||i.add(sp(f));u=u.parentElement}}return i.dispose},[r,t,n])}function i2(e,t,n){let r=Yn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});E.useEffect(()=>{if(!e)return;let o=t===null?null:an(t)?t:t.current;if(!o)return;let s=rt();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 Rc=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),a2=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var jc=(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))(jc||{}),c2=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(c2||{}),l2=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(l2||{});function ap(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Rc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function u2(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(a2)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var _c=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(_c||{});function cp(e,t=0){var n;return e===((n=Ws(e))==null?void 0:n.body)?!1:pt(t,{0(){return e.matches(Rc)},1(){let r=e;for(;r!==null;){if(r.matches(Rc))return!0;r=r.parentElement}return!1}})}var f2=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(f2||{});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 d2=["textarea","input"].join(",");function p2(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,d2))!=null?n:!1}function lp(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 h2(e,t,n=e===null?document.body:Hs(e)){return m2(ap(n),t,{relativeTo:e})}function m2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?Hs(e[0]):document:Hs(e),i=Array.isArray(e)?n?lp(e):e:t&64?u2(e):ap(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==null?void 0: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")})(),l=t&32?{preventScroll:!0}:{},u=0,f=i.length,d;do{if(u>=f||u+f<=0)return 0;let p=a+u;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(l),u+=c}while(d!==N0(d));return t&6&&p2(d)&&d.select(),2}function up(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function b2(){return/Android/gi.test(window.navigator.userAgent)}function fp(){return up()||b2()}function Or(e,t,n,r){let o=Yn(n);E.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function g2(e,t,n,r){let o=Yn(n);E.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const dp=30;function y2(e,t,n){let r=Yn(n),o=E.useCallback(function(c,a){if(c.defaultPrevented)return;let l=a(c);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function f(d){return typeof d=="function"?f(d()):Array.isArray(d)||d instanceof Set?d:[d]}(t);for(let f of u)if(f!==null&&(f.contains(l)||c.composed&&c.composedPath().includes(f)))return;return!cp(l,_c.Loose)&&l.tabIndex!==-1&&c.preventDefault(),r.current(c,l)},[r,t]),s=E.useRef(null);Or(e,"pointerdown",c=>{var a,l;fp()||(s.current=((l=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:l[0])||c.target)},!0),Or(e,"pointerup",c=>{if(fp()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=E.useRef({x:0,y:0});Or(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),Or(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=dp||Math.abs(a.y-i.current.y)>=dp))return o(c,()=>Cr(c.target)?c.target:null)},!0),g2(e,"blur",c=>o(c,()=>Ox(window.document.activeElement)?window.document.activeElement:null),!0)}function zc(...e){return E.useMemo(()=>Ws(...e),[...e])}var v2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(v2||{});const Ks={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},w2=200,pp=5;function x2(e,{trigger:t,action:n,close:r,select:o}){let s=E.useRef(null),i=E.useRef(null),c=E.useRef(null);Or(e&&t!==null,"pointerdown",a=>{F0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),Or(e&&t!==null,"pointerup",a=>{var l,u;let f=s.current;if(f===null||(s.current=null,!Cr(a.target))||Math.abs(a.x-((l=i.current)!=null?l:a.x))<pp&&Math.abs(a.y-((u=c.current)!=null?u:a.y))<pp)return;let d=n(a);switch(d.kind){case 0:return;case 1:{a.timeStamp-f>w2&&(o(d.target),r());break}case 2:{r();break}}},{capture:!0})}function E2(e,t){return E.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function S2(e){return E.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function P2(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 T2(){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 A2(){return up()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=rt();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(Cr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:l}=new URL(a.href),u=e.querySelector(l);Cr(u)&&!r(u)&&(i=u)}catch{}},!0),t.group(c=>{t.addEventListener(e,"touchstart",a=>{if(c.dispose(),Cr(a.target)&&Cx(a.target))if(r(a.target)){let l=a.target;for(;l.parentElement&&r(l.parentElement);)l=l.parentElement;c.style(l,"overscrollBehavior","contain")}else c.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",c=>{if(Cr(c.target)){if(R0(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 $2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function hp(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Xn=P2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:rt(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=hp(r.meta),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=hp(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[A2(),T2(),$2()];n.forEach(({before:r})=>r==null?void 0:r(t)),n.forEach(({after:r})=>r==null?void 0:r(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Xn.subscribe(()=>{let e=Xn.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)&&Xn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Xn.dispatch("TEARDOWN",n)}});function N2(e,t,n=()=>({containers:[]})){let r=S2(Xn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Ee(()=>{if(!(!t||!e))return Xn.dispatch("PUSH",t,n),()=>Xn.dispatch("POP",t,n)},[e,t]),s}function C2(e,t,n=()=>[document.body]){let r=op(e,"scroll-lock");N2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function mp(e){return[e.screenX,e.screenY]}function O2(){let e=E.useRef([-1,-1]);return{wasMoved(t){let n=mp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=mp(t)}}}function I2(e=0){let[t,n]=E.useState(e),r=E.useCallback(a=>n(a),[]),o=E.useCallback(a=>n(l=>l|a),[]),s=E.useCallback(a=>(t&a)===a,[t]),i=E.useCallback(a=>n(l=>l&~a),[]),c=E.useCallback(a=>n(l=>l^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var bp,gp;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((bp=process==null?void 0:process.env)==null?void 0:bp.NODE_ENV)==="test"&&typeof((gp=Element==null?void 0:Element.prototype)==null?void 0:gp.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
136
- `)),[]});var k2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(k2||{});function yp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function vp(e,t,n,r){let[o,s]=E.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=I2(e&&o?3:0),l=E.useRef(!1),u=E.useRef(!1),f=Kn();return Ee(()=>{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),D2(t,{inFlight:l,prepare(){u.current?u.current=!1:u.current=l.current,l.current=!0,!u.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){u.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var p;u.current&&B2(t)||(l.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 D2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=rt();return L2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(M2(e,r))})}),s.dispose}function M2(e,t){var n,r;let o=rt();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 L2(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 B2(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function Ys(){return typeof window<"u"}function Ir(e){return Uc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ke(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ut(e){var t;return(t=(Uc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Uc(e){return Ys()?e instanceof Node||e instanceof Ke(e).Node:!1}function de(e){return Ys()?e instanceof Element||e instanceof Ke(e).Element:!1}function Ye(e){return Ys()?e instanceof HTMLElement||e instanceof Ke(e).HTMLElement:!1}function Wc(e){return!Ys()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ke(e).ShadowRoot}function Ho(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=bt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function F2(e){return/^(table|td|th)$/.test(Ir(e))}function Xs(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const R2=/transform|translate|scale|rotate|perspective|filter/,j2=/paint|layout|strict|content/,Qn=e=>!!e&&e!=="none";let Hc;function Vc(e){const t=de(e)?bt(e):e;return Qn(t.transform)||Qn(t.translate)||Qn(t.scale)||Qn(t.rotate)||Qn(t.perspective)||!Qs()&&(Qn(t.backdropFilter)||Qn(t.filter))||R2.test(t.willChange||"")||j2.test(t.contain||"")}function _2(e){let t=ln(e);for(;Ye(t)&&!cn(t);){if(Vc(t))return t;if(Xs(t))return null;t=ln(t)}return null}function Qs(){return Hc==null&&(Hc=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Hc}function cn(e){return/^(html|body|#document)$/.test(Ir(e))}function bt(e){return Ke(e).getComputedStyle(e)}function Js(e){return de(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ln(e){if(Ir(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Wc(e)&&e.host||Ut(e);return Wc(t)?t.host:t}function wp(e){const t=ln(e);return cn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ye(t)&&Ho(t)?t:wp(t)}function Cn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=wp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ke(o);if(s){const c=Gc(i);return t.concat(i,i.visualViewport||[],Ho(o)?o:[],c&&n?Cn(c):[])}else return t.concat(o,Cn(o,[],n))}function Gc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function z2(){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 un=Math.min,Me=Math.max,Vo=Math.round,ei=Math.floor,Wt=e=>({x:e,y:e}),U2={left:"right",right:"left",bottom:"top",top:"bottom"};function qc(e,t,n){return Me(e,un(t,n))}function Jn(e,t){return typeof e=="function"?e(t):e}function On(e){return e.split("-")[0]}function kr(e){return e.split("-")[1]}function xp(e){return e==="x"?"y":"x"}function Zc(e){return e==="y"?"height":"width"}function fn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Kc(e){return xp(fn(e))}function W2(e,t,n){n===void 0&&(n=!1);const r=kr(e),o=Kc(e),s=Zc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=ti(i)),[i,ti(i)]}function H2(e){const t=ti(e);return[Yc(e),t,Yc(t)]}function Yc(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ep=["left","right"],Sp=["right","left"],V2=["top","bottom"],G2=["bottom","top"];function q2(e,t,n){switch(e){case"top":case"bottom":return n?t?Sp:Ep:t?Ep:Sp;case"left":case"right":return t?V2:G2;default:return[]}}function Z2(e,t,n,r){const o=kr(e);let s=q2(On(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Yc)))),s}function ti(e){const t=On(e);return U2[t]+e.slice(t.length)}function K2(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pp(e){return typeof e!="number"?K2(e):{top:e,right:e,bottom:e,left:e}}function ni(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
135
+ */var op;function o2(){return op||(op=1,process.env.NODE_ENV!=="production"&&function(){function e(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=E,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Fc.useSyncExternalStoreWithSelector=function(a,l,u,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 S(k){if(!P){if(P=!0,x=k,k=f(k),d!==void 0&&h.hasValue){var B=h.value;if(d(B,k))return w=B}return w=k}if(B=w,n(x,k))return B;var F=f(k);return d!==void 0&&d(B,F)?(x=k,B):(x=k,w=F)}var P=!1,x,w,$=u===void 0?null:u;return[function(){return S(l())},$===null?void 0:function(){return S($())}]},[l,u,f,d]);var b=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),c(b),b},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"?Lc.exports=r2():Lc.exports=o2();var s2=Lc.exports;function Ze(e,t,n=J0){return s2.useSyncExternalStoreWithSelector(fe(r=>e.subscribe(i2,r)),fe(()=>e.state),fe(()=>e.state),fe(t),n)}function i2(e){return e}function sp(e,t){let n=E.useId(),r=kc.get(t),[o,s]=Ze(r,E.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Ee(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Rc=new Map,Wo=new Map;function ip(e){var t;let n=(t=Wo.get(e))!=null?t:0;return Wo.set(e,n+1),n!==0?()=>ap(e):(Rc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>ap(e))}function ap(e){var t;let n=(t=Wo.get(e))!=null?t:1;if(n===1?Wo.delete(e):Wo.set(e,n-1),n!==1)return;let r=Rc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Rc.delete(e))}function a2(e,{allowed:t,disallowed:n}={}){let r=sp(e,"inert-others");Ee(()=>{var o,s;if(!r)return;let i=rt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(ip(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let l=Hs(a);if(!l)continue;let u=a.parentElement;for(;u&&u!==l.body;){for(let f of u.children)c.some(d=>f.contains(d))||i.add(ip(f));u=u.parentElement}}return i.dispose},[r,t,n])}function c2(e,t,n){let r=Yn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});E.useEffect(()=>{if(!e)return;let o=t===null?null:an(t)?t:t.current;if(!o)return;let s=rt();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 jc=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),l2=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var _c=(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))(_c||{}),u2=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(u2||{}),f2=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(f2||{});function cp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(jc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function d2(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(l2)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var zc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(zc||{});function lp(e,t=0){var n;return e===((n=Hs(e))==null?void 0:n.body)?!1:pt(t,{0(){return e.matches(jc)},1(){let r=e;for(;r!==null;){if(r.matches(jc))return!0;r=r.parentElement}return!1}})}var p2=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(p2||{});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 h2=["textarea","input"].join(",");function m2(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,h2))!=null?n:!1}function up(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 b2(e,t,n=e===null?document.body:Vs(e)){return g2(cp(n),t,{relativeTo:e})}function g2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?Vs(e[0]):document:Vs(e),i=Array.isArray(e)?n?up(e):e:t&64?d2(e):cp(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==null?void 0: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")})(),l=t&32?{preventScroll:!0}:{},u=0,f=i.length,d;do{if(u>=f||u+f<=0)return 0;let p=a+u;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(l),u+=c}while(d!==C0(d));return t&6&&m2(d)&&d.select(),2}function fp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function y2(){return/Android/gi.test(window.navigator.userAgent)}function dp(){return fp()||y2()}function Or(e,t,n,r){let o=Yn(n);E.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function v2(e,t,n,r){let o=Yn(n);E.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const pp=30;function w2(e,t,n){let r=Yn(n),o=E.useCallback(function(c,a){if(c.defaultPrevented)return;let l=a(c);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function f(d){return typeof d=="function"?f(d()):Array.isArray(d)||d instanceof Set?d:[d]}(t);for(let f of u)if(f!==null&&(f.contains(l)||c.composed&&c.composedPath().includes(f)))return;return!lp(l,zc.Loose)&&l.tabIndex!==-1&&c.preventDefault(),r.current(c,l)},[r,t]),s=E.useRef(null);Or(e,"pointerdown",c=>{var a,l;dp()||(s.current=((l=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:l[0])||c.target)},!0),Or(e,"pointerup",c=>{if(dp()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=E.useRef({x:0,y:0});Or(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),Or(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=pp||Math.abs(a.y-i.current.y)>=pp))return o(c,()=>Cr(c.target)?c.target:null)},!0),v2(e,"blur",c=>o(c,()=>Dx(window.document.activeElement)?window.document.activeElement:null),!0)}function Uc(...e){return E.useMemo(()=>Hs(...e),[...e])}var x2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(x2||{});const Ys={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},E2=200,hp=5;function S2(e,{trigger:t,action:n,close:r,select:o}){let s=E.useRef(null),i=E.useRef(null),c=E.useRef(null);Or(e&&t!==null,"pointerdown",a=>{R0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),Or(e&&t!==null,"pointerup",a=>{var l,u;let f=s.current;if(f===null||(s.current=null,!Cr(a.target))||Math.abs(a.x-((l=i.current)!=null?l:a.x))<hp&&Math.abs(a.y-((u=c.current)!=null?u:a.y))<hp)return;let d=n(a);switch(d.kind){case 0:return;case 1:{a.timeStamp-f>E2&&(o(d.target),r());break}case 2:{r();break}}},{capture:!0})}function P2(e,t){return E.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function T2(e){return E.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function $2(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 A2(){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 N2(){return fp()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=rt();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(Cr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:l}=new URL(a.href),u=e.querySelector(l);Cr(u)&&!r(u)&&(i=u)}catch{}},!0),t.group(c=>{t.addEventListener(e,"touchstart",a=>{if(c.dispose(),Cr(a.target)&&Ix(a.target))if(r(a.target)){let l=a.target;for(;l.parentElement&&r(l.parentElement);)l=l.parentElement;c.style(l,"overscrollBehavior","contain")}else c.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",c=>{if(Cr(c.target)){if(j0(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 C2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function mp(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Xn=$2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:rt(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=mp(r.meta),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=mp(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[N2(),A2(),C2()];n.forEach(({before:r})=>r==null?void 0:r(t)),n.forEach(({after:r})=>r==null?void 0:r(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Xn.subscribe(()=>{let e=Xn.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)&&Xn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Xn.dispatch("TEARDOWN",n)}});function O2(e,t,n=()=>({containers:[]})){let r=T2(Xn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Ee(()=>{if(!(!t||!e))return Xn.dispatch("PUSH",t,n),()=>Xn.dispatch("POP",t,n)},[e,t]),s}function I2(e,t,n=()=>[document.body]){let r=sp(e,"scroll-lock");O2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function bp(e){return[e.screenX,e.screenY]}function D2(){let e=E.useRef([-1,-1]);return{wasMoved(t){let n=bp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=bp(t)}}}function M2(e=0){let[t,n]=E.useState(e),r=E.useCallback(a=>n(a),[]),o=E.useCallback(a=>n(l=>l|a),[]),s=E.useCallback(a=>(t&a)===a,[t]),i=E.useCallback(a=>n(l=>l&~a),[]),c=E.useCallback(a=>n(l=>l^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var gp,yp;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((gp=process==null?void 0:process.env)==null?void 0:gp.NODE_ENV)==="test"&&typeof((yp=Element==null?void 0:Element.prototype)==null?void 0:yp.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
136
+ `)),[]});var k2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(k2||{});function vp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function wp(e,t,n,r){let[o,s]=E.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=M2(e&&o?3:0),l=E.useRef(!1),u=E.useRef(!1),f=Kn();return Ee(()=>{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),L2(t,{inFlight:l,prepare(){u.current?u.current=!1:u.current=l.current,l.current=!0,!u.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){u.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var p;u.current&&R2(t)||(l.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 L2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=rt();return F2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(B2(e,r))})}),s.dispose}function B2(e,t){var n,r;let o=rt();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 F2(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 R2(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function Xs(){return typeof window<"u"}function Ir(e){return Wc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ke(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ut(e){var t;return(t=(Wc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Wc(e){return Xs()?e instanceof Node||e instanceof Ke(e).Node:!1}function de(e){return Xs()?e instanceof Element||e instanceof Ke(e).Element:!1}function Ye(e){return Xs()?e instanceof HTMLElement||e instanceof Ke(e).HTMLElement:!1}function Hc(e){return!Xs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ke(e).ShadowRoot}function Ho(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=bt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function j2(e){return/^(table|td|th)$/.test(Ir(e))}function Qs(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const _2=/transform|translate|scale|rotate|perspective|filter/,z2=/paint|layout|strict|content/,Qn=e=>!!e&&e!=="none";let Vc;function Gc(e){const t=de(e)?bt(e):e;return Qn(t.transform)||Qn(t.translate)||Qn(t.scale)||Qn(t.rotate)||Qn(t.perspective)||!Js()&&(Qn(t.backdropFilter)||Qn(t.filter))||_2.test(t.willChange||"")||z2.test(t.contain||"")}function U2(e){let t=ln(e);for(;Ye(t)&&!cn(t);){if(Gc(t))return t;if(Qs(t))return null;t=ln(t)}return null}function Js(){return Vc==null&&(Vc=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Vc}function cn(e){return/^(html|body|#document)$/.test(Ir(e))}function bt(e){return Ke(e).getComputedStyle(e)}function ei(e){return de(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ln(e){if(Ir(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hc(e)&&e.host||Ut(e);return Hc(t)?t.host:t}function xp(e){const t=ln(e);return cn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ye(t)&&Ho(t)?t:xp(t)}function Cn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=xp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ke(o);if(s){const c=qc(i);return t.concat(i,i.visualViewport||[],Ho(o)?o:[],c&&n?Cn(c):[])}else return t.concat(o,Cn(o,[],n))}function qc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function W2(){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 un=Math.min,ke=Math.max,Vo=Math.round,ti=Math.floor,Wt=e=>({x:e,y:e}),H2={left:"right",right:"left",bottom:"top",top:"bottom"};function Zc(e,t,n){return ke(e,un(t,n))}function Jn(e,t){return typeof e=="function"?e(t):e}function On(e){return e.split("-")[0]}function Dr(e){return e.split("-")[1]}function Ep(e){return e==="x"?"y":"x"}function Kc(e){return e==="y"?"height":"width"}function fn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Yc(e){return Ep(fn(e))}function V2(e,t,n){n===void 0&&(n=!1);const r=Dr(e),o=Yc(e),s=Kc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=ni(i)),[i,ni(i)]}function G2(e){const t=ni(e);return[Xc(e),t,Xc(t)]}function Xc(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Sp=["left","right"],Pp=["right","left"],q2=["top","bottom"],Z2=["bottom","top"];function K2(e,t,n){switch(e){case"top":case"bottom":return n?t?Pp:Sp:t?Sp:Pp;case"left":case"right":return t?q2:Z2;default:return[]}}function Y2(e,t,n,r){const o=Dr(e);let s=K2(On(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Xc)))),s}function ni(e){const t=On(e);return H2[t]+e.slice(t.length)}function X2(e){return{top:0,right:0,bottom:0,left:0,...e}}function Tp(e){return typeof e!="number"?X2(e):{top:e,right:e,bottom:e,left:e}}function ri(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
137
137
  * tabbable 6.4.0
138
138
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
139
- */var Y2=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Xc=Y2.join(","),Tp=typeof Element>"u",Go=Tp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ri=!Tp&&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},oi=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):oi(t.parentNode));return i},X2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Q2=function(t,n,r){if(oi(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Xc));return n&&Go.call(t,Xc)&&o.unshift(t),o=o.filter(r),o},Qc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!oi(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,l=Qc(a,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{var u=Go.call(i,Xc);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),d=!oi(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&d){var p=Qc(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},Ap=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},$p=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||X2(t))&&!Ap(t)?0:t.tabIndex},J2=function(t,n){var r=$p(t);return r<0&&n&&!Ap(t)?0:r},eE=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Np=function(t){return t.tagName==="INPUT"},tE=function(t){return Np(t)&&t.type==="hidden"},nE=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},rE=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},oE=function(t){if(!t.name)return!0;var n=t.form||ri(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=rE(o,t.form);return!s||s===t},sE=function(t){return Np(t)&&t.type==="radio"},iE=function(t){return sE(t)&&!oE(t)},aE=function(t){var n,r=t&&ri(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 l,u,f;r=ri(o),o=(l=r)===null||l===void 0?void 0:l.host,s=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Cp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},cE=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=Go.call(t,"details>summary:first-of-type"),c=i?t.parentElement:t;if(Go.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var l=t.parentElement,u=ri(t);if(l&&!l.shadowRoot&&o(l)===!0)return Cp(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=a}if(aE(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Cp(t);return!1},lE=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 Go.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},uE=function(t,n){return!(n.disabled||tE(n)||cE(n,t)||nE(n)||lE(n))},Op=function(t,n){return!(iE(n)||$p(n)<0||!uE(t,n))},fE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ip=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=J2(c,i),l=i?Ip(o.candidates):c;a===0?i?n.push.apply(n,l):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:l})}),r.sort(eE).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},kp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Qc([t],n.includeContainer,{filter:Op.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:fE}):r=Q2(t,n.includeContainer,Op.bind(null,n)),Ip(r)};function Dp(e,t,n){let{reference:r,floating:o}=e;const s=fn(t),i=Kc(t),c=Zc(i),a=On(t),l=s==="y",u=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:u,y:r.y-o.height};break;case"bottom":p={x:u,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(kr(t)){case"start":p[i]-=d*(n&&l?-1:1);break;case"end":p[i]+=d*(n&&l?-1:1);break}return p}async function Mp(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=Jn(t,e),h=Pp(p),S=c[d?f==="floating"?"reference":"floating":f],P=ni(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(S)))==null||n?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),A=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},M=ni(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:w,strategy:a}):x);return{top:(P.top-M.top+h.top)/A.y,bottom:(M.bottom-P.bottom+h.bottom)/A.y,left:(P.left-M.left+h.left)/A.x,right:(M.right-P.right+h.right)/A.x}}const dE=50,pE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Mp},a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Dp(l,r,a),d=r,p=0;const h={};for(let b=0;b<s.length;b++){const S=s[b];if(!S)continue;const{name:P,fn:x}=S,{x:w,y:A,data:M,reset:B}=await x({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:h,rects:l,platform:c,elements:{reference:e,floating:t}});u=w??u,f=A??f,h[P]={...h[P],...M},B&&p<dE&&(p++,typeof B=="object"&&(B.placement&&(d=B.placement),B.rects&&(l=B.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):B.rects),{x:u,y:f}=Dp(l,d,a)),b=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:h}},hE=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:l,padding:u=0}=Jn(e,t)||{};if(l==null)return{};const f=Pp(u),d={x:n,y:r},p=Kc(o),h=Zc(p),b=await i.getDimensions(l),S=p==="y",P=S?"top":"left",x=S?"bottom":"right",w=S?"clientHeight":"clientWidth",A=s.reference[h]+s.reference[p]-d[p]-s.floating[h],M=d[p]-s.reference[p],B=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let F=B?B[w]:0;(!F||!await(i.isElement==null?void 0:i.isElement(B)))&&(F=c.floating[w]||s.floating[h]);const m=A/2-M/2,g=F/2-b[h]/2-1,v=un(f[P],g),$=un(f[x],g),N=v,O=F-b[h]-$,k=F/2-b[h]/2+m,y=qc(N,k,O),C=!a.arrow&&kr(o)!=null&&k!==y&&s.reference[h]/2-(k<N?v:$)-b[h]/2<0,I=C?k<N?k-N:k-O:0;return{[p]:d[p]+I,data:{[p]:y,centerOffset:k-y-I,...C&&{alignmentOffset:I}},reset:C}}}),mE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:b=!0,...S}=Jn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const P=On(o),x=fn(c),w=On(c)===c,A=await(a.isRTL==null?void 0:a.isRTL(l.floating)),M=d||(w||!b?[ti(c)]:H2(c)),B=h!=="none";!d&&B&&M.push(...Z2(c,b,h,A));const F=[c,...M],m=await a.detectOverflow(t,S),g=[];let v=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&g.push(m[P]),f){const k=W2(o,i,A);g.push(m[k[0]],m[k[1]])}if(v=[...v,{placement:o,overflows:g}],!g.every(k=>k<=0)){var $,N;const k=((($=s.flip)==null?void 0:$.index)||0)+1,y=F[k];if(y&&(!(f==="alignment"?x!==fn(y):!1)||v.every(T=>fn(T.placement)===x?T.overflows[0]>0:!0)))return{data:{index:k,overflows:v},reset:{placement:y}};let C=(N=v.filter(I=>I.overflows[0]<=0).sort((I,T)=>I.overflows[1]-T.overflows[1])[0])==null?void 0:N.placement;if(!C)switch(p){case"bestFit":{var O;const I=(O=v.filter(T=>{if(B){const L=fn(T.placement);return L===x||L==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(L=>L>0).reduce((L,j)=>L+j,0)]).sort((T,L)=>T[1]-L[1])[0])==null?void 0:O[0];I&&(C=I);break}case"initialPlacement":C=c;break}if(o!==C)return{reset:{placement:C}}}return{}}}},bE=new Set(["left","top"]);async function gE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=On(n),c=kr(n),a=fn(n)==="y",l=bE.has(i)?-1:1,u=s&&a?-1:1,f=Jn(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*u,y:d*l}:{x:d*l,y:p*u}}const yE=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 gE(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}}}}},vE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:P=>{let{x,y:w}=P;return{x,y:w}}},...l}=Jn(e,t),u={x:n,y:r},f=await s.detectOverflow(t,l),d=fn(On(o)),p=xp(d);let h=u[p],b=u[d];if(i){const P=p==="y"?"top":"left",x=p==="y"?"bottom":"right",w=h+f[P],A=h-f[x];h=qc(w,h,A)}if(c){const P=d==="y"?"top":"left",x=d==="y"?"bottom":"right",w=b+f[P],A=b-f[x];b=qc(w,b,A)}const S=a.fn({...t,[p]:h,[d]:b});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[p]:i,[d]:c}}}}}},wE=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=()=>{},...l}=Jn(e,t),u=await i.detectOverflow(t,l),f=On(o),d=kr(o),p=fn(o)==="y",{width:h,height:b}=s.floating;let S,P;f==="top"||f==="bottom"?(S=f,P=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(P=f,S=d==="end"?"top":"bottom");const x=b-u.top-u.bottom,w=h-u.left-u.right,A=un(b-u[S],x),M=un(h-u[P],w),B=!t.middlewareData.shift;let F=A,m=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(m=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=x),B&&!d){const v=Me(u.left,0),$=Me(u.right,0),N=Me(u.top,0),O=Me(u.bottom,0);p?m=h-2*(v!==0||$!==0?v+$:Me(u.left,u.right)):F=b-2*(N!==0||O!==0?N+O:Me(u.top,u.bottom))}await a({...t,availableWidth:m,availableHeight:F});const g=await i.getDimensions(c.floating);return h!==g.width||b!==g.height?{reset:{rects:!0}}:{}}}};function Lp(e){const t=bt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ye(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Vo(n)!==s||Vo(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Jc(e){return de(e)?e:e.contextElement}function Dr(e){const t=Jc(e);if(!Ye(t))return Wt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Lp(t);let i=(s?Vo(n.width):n.width)/r,c=(s?Vo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const xE=Wt(0);function Bp(e){const t=Ke(e);return!Qs()||!t.visualViewport?xE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function EE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ke(e)?!1:t}function er(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Jc(e);let i=Wt(1);t&&(r?de(r)&&(i=Dr(r)):i=Dr(e));const c=EE(s,n,r)?Bp(s):Wt(0);let a=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const d=Ke(s),p=r&&de(r)?Ke(r):r;let h=d,b=Gc(h);for(;b&&r&&p!==h;){const S=Dr(b),P=b.getBoundingClientRect(),x=bt(b),w=P.left+(b.clientLeft+parseFloat(x.paddingLeft))*S.x,A=P.top+(b.clientTop+parseFloat(x.paddingTop))*S.y;a*=S.x,l*=S.y,u*=S.x,f*=S.y,a+=w,l+=A,h=Ke(b),b=Gc(h)}}return ni({width:u,height:f,x:a,y:l})}function si(e,t){const n=Js(e).scrollLeft;return t?t.left+n:er(Ut(e)).left+n}function Fp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-si(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function SE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Ut(r),c=t?Xs(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=Wt(1);const u=Wt(0),f=Ye(r);if((f||!f&&!s)&&((Ir(r)!=="body"||Ho(i))&&(a=Js(r)),f)){const p=er(r);l=Dr(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const d=i&&!f&&!s?Fp(i,a):Wt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+d.x,y:n.y*l.y-a.scrollTop*l.y+u.y+d.y}}function PE(e){return Array.from(e.getClientRects())}function TE(e){const t=Ut(e),n=Js(e),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+si(e);const c=-n.scrollTop;return bt(r).direction==="rtl"&&(i+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Rp=25;function AE(e,t){const n=Ke(e),r=Ut(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const u=Qs();(!u||u&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const l=si(r);if(l<=0){const u=r.ownerDocument,f=u.body,d=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-p);h<=Rp&&(s-=h)}else l<=Rp&&(s+=l);return{width:s,height:i,x:c,y:a}}function $E(e,t){const n=er(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ye(e)?Dr(e):Wt(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=r*s.y;return{width:i,height:c,x:a,y:l}}function jp(e,t,n){let r;if(t==="viewport")r=AE(e,n);else if(t==="document")r=TE(Ut(e));else if(de(t))r=$E(t,n);else{const o=Bp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ni(r)}function _p(e,t){const n=ln(e);return n===t||!de(n)||cn(n)?!1:bt(n).position==="fixed"||_p(n,t)}function NE(e,t){const n=t.get(e);if(n)return n;let r=Cn(e,[],!1).filter(c=>de(c)&&Ir(c)!=="body"),o=null;const s=bt(e).position==="fixed";let i=s?ln(e):e;for(;de(i)&&!cn(i);){const c=bt(i),a=Vc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Ho(i)&&!a&&_p(e,i))?r=r.filter(u=>u!==i):o=c,i=ln(i)}return t.set(e,r),r}function CE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Xs(t)?[]:NE(t,this._c):[].concat(n),r],c=jp(t,i[0],o);let a=c.top,l=c.right,u=c.bottom,f=c.left;for(let d=1;d<i.length;d++){const p=jp(t,i[d],o);a=Me(p.top,a),l=un(p.right,l),u=un(p.bottom,u),f=Me(p.left,f)}return{width:l-f,height:u-a,x:f,y:a}}function OE(e){const{width:t,height:n}=Lp(e);return{width:t,height:n}}function IE(e,t,n){const r=Ye(t),o=Ut(t),s=n==="fixed",i=er(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Wt(0);function l(){a.x=si(o)}if(r||!r&&!s)if((Ir(t)!=="body"||Ho(o))&&(c=Js(t)),r){const p=er(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&l();s&&!r&&o&&l();const u=o&&!r&&!s?Fp(o,c):Wt(0),f=i.left+c.scrollLeft-a.x-u.x,d=i.top+c.scrollTop-a.y-u.y;return{x:f,y:d,width:i.width,height:i.height}}function el(e){return bt(e).position==="static"}function zp(e,t){if(!Ye(e)||bt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ut(e)===n&&(n=n.ownerDocument.body),n}function Up(e,t){const n=Ke(e);if(Xs(e))return n;if(!Ye(e)){let o=ln(e);for(;o&&!cn(o);){if(de(o)&&!el(o))return o;o=ln(o)}return n}let r=zp(e,t);for(;r&&F2(r)&&el(r);)r=zp(r,t);return r&&cn(r)&&el(r)&&!Vc(r)?n:r||_2(e)||n}const kE=async function(e){const t=this.getOffsetParent||Up,n=this.getDimensions,r=await n(e.floating);return{reference:IE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function DE(e){return bt(e).direction==="rtl"}const ME={convertOffsetParentRelativeRectToViewportRelativeRect:SE,getDocumentElement:Ut,getClippingRect:CE,getOffsetParent:Up,getElementRects:kE,getClientRects:PE,getDimensions:OE,getScale:Dr,isElement:de,isRTL:DE};function Wp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function LE(e,t){let n=null,r;const o=Ut(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 l=e.getBoundingClientRect(),{left:u,top:f,width:d,height:p}=l;if(c||t(),!d||!p)return;const h=ei(f),b=ei(o.clientWidth-(u+d)),S=ei(o.clientHeight-(f+p)),P=ei(u),w={rootMargin:-h+"px "+-b+"px "+-S+"px "+-P+"px",threshold:Me(0,un(1,a))||1};let A=!0;function M(B){const F=B[0].intersectionRatio;if(F!==a){if(!A)return i();F?i(!1,F):r=setTimeout(()=>{i(!1,1e-7)},1e3)}F===1&&!Wp(l,e.getBoundingClientRect())&&i(),A=!1}try{n=new IntersectionObserver(M,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(M,w)}n.observe(e)}return i(!0),s}function Hp(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,l=Jc(e),u=o||s?[...l?Cn(l):[],...t?Cn(t):[]]:[];u.forEach(P=>{o&&P.addEventListener("scroll",n,{passive:!0}),s&&P.addEventListener("resize",n)});const f=l&&c?LE(l,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(P=>{let[x]=P;x&&x.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),l&&!a&&p.observe(l),t&&p.observe(t));let h,b=a?er(e):null;a&&S();function S(){const P=er(e);b&&!Wp(b,P)&&n(),b=P,h=requestAnimationFrame(S)}return n(),()=>{var P;u.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(P=p)==null||P.disconnect(),p=null,a&&cancelAnimationFrame(h)}}const tl=Mp,BE=yE,FE=vE,RE=mE,jE=wE,Vp=hE,_E=(e,t,n)=>{const r=new Map,o={platform:ME,...n},s={...o.platform,_c:r};return pE(e,t,{...o,platform:s})};var zE=typeof document<"u",UE=function(){},ii=zE?E.useLayoutEffect:UE;function ai(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(!ai(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)&&!ai(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Gp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qp(e,t){const n=Gp(e);return Math.round(t*n)/n}function nl(e){const t=U.useRef(e);return ii(()=>{t.current=e}),t}function Zp(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:l}=e,[u,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=U.useState(r);ai(d,r)||p(r);const[h,b]=U.useState(null),[S,P]=U.useState(null),x=U.useCallback(T=>{T!==B.current&&(B.current=T,b(T))},[]),w=U.useCallback(T=>{T!==F.current&&(F.current=T,P(T))},[]),A=s||h,M=i||S,B=U.useRef(null),F=U.useRef(null),m=U.useRef(u),g=a!=null,v=nl(a),$=nl(o),N=nl(l),O=U.useCallback(()=>{if(!B.current||!F.current)return;const T={placement:t,strategy:n,middleware:d};$.current&&(T.platform=$.current),_E(B.current,F.current,T).then(L=>{const j={...L,isPositioned:N.current!==!1};k.current&&!ai(m.current,j)&&(m.current=j,zr.flushSync(()=>{f(j)}))})},[d,t,n,$,N]);ii(()=>{l===!1&&m.current.isPositioned&&(m.current.isPositioned=!1,f(T=>({...T,isPositioned:!1})))},[l]);const k=U.useRef(!1);ii(()=>(k.current=!0,()=>{k.current=!1}),[]),ii(()=>{if(A&&(B.current=A),M&&(F.current=M),A&&M){if(v.current)return v.current(A,M,O);O()}},[A,M,O,v,g]);const y=U.useMemo(()=>({reference:B,floating:F,setReference:x,setFloating:w}),[x,w]),C=U.useMemo(()=>({reference:A,floating:M}),[A,M]),I=U.useMemo(()=>{const T={position:n,left:0,top:0};if(!C.floating)return T;const L=qp(C.floating,u.x),j=qp(C.floating,u.y);return c?{...T,transform:"translate("+L+"px, "+j+"px)",...Gp(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:j}},[n,c,C.floating,u.x,u.y]);return U.useMemo(()=>({...u,update:O,refs:y,elements:C,floatingStyles:I}),[u,O,y,C,I])}const WE=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?Vp({element:r.current,padding:o}).fn(n):{}:r?Vp({element:r,padding:o}).fn(n):{}}}},rl=(e,t)=>{const n=BE(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kp=(e,t)=>{const n=FE(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yp=(e,t)=>{const n=RE(e);return{name:n.name,fn:n.fn,options:[e,t]}},HE=(e,t)=>{const n=jE(e);return{name:n.name,fn:n.fn,options:[e,t]}},VE=(e,t)=>{const n=WE(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xp={...U},GE=Xp.useInsertionEffect||(e=>e());function Qp(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return GE(()=>{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 ol=typeof document<"u"?E.useLayoutEffect:E.useEffect;let Jp=!1,qE=0;const eh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+qE++;function ZE(){const[e,t]=U.useState(()=>Jp?eh():void 0);return ol(()=>{e==null&&t(eh())},[]),U.useEffect(()=>{Jp=!0},[]),e}const KE=Xp.useId||ZE;let qo;process.env.NODE_ENV!=="production"&&(qo=new Set);function YE(){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=qo)!=null&&e.has(o))){var s;(s=qo)==null||s.add(o),console.warn(o)}}function XE(){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=qo)!=null&&e.has(o))){var s;(s=qo)==null||s.add(o),console.error(o)}}function QE(){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 JE=U.createContext(null),e8=U.createContext(null),t8=()=>{var e;return((e=U.useContext(JE))==null?void 0:e.id)||null},n8=()=>U.useContext(e8),r8="data-floating-ui-focusable";function o8(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=KE(),s=U.useRef({}),[i]=U.useState(()=>QE()),c=t8()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!de(p)&&XE("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=U.useState(r.reference),u=Qp((p,h,b)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:b,nested:c}),n==null||n(p,h,b)}),f=U.useMemo(()=>({setPositionReference:l}),[]),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:u,elements:d,events:i,floatingId:o,refs:f}),[t,u,d,i,o,f])}function s8(e){e===void 0&&(e={});const{nodeId:t}=e,n=o8({...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),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),d=n8();ol(()=>{u&&(f.current=u)},[u]);const p=Zp({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(w=>{const A=de(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),contextElement:w}:w;a(A),p.refs.setReference(A)},[p.refs]),b=U.useCallback(w=>{(de(w)||w===null)&&(f.current=w,i(w)),(de(p.refs.reference.current)||p.refs.reference.current===null||w!==null&&!de(w))&&p.refs.setReference(w)},[p.refs]),S=U.useMemo(()=>({...p.refs,setReference:b,setPositionReference:h,domReference:f}),[p.refs,b,h]),P=U.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),x=U.useMemo(()=>({...p,...r,refs:S,elements:P,nodeId:t}),[p,S,P,t,r]);return ol(()=>{r.dataRef.current.floatingContext=x;const w=d==null?void 0:d.nodesRef.current.find(A=>A.id===t);w&&(w.context=x)}),U.useMemo(()=>({...p,context:x,refs:S,elements:P}),[p,S,P,x])}const th="active",nh="selected";function sl(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[th]:i,[nh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[r8]:""},...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[l,u]=a;if(!(o&&[th,nh].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var d,p=arguments.length,h=new Array(p),b=0;b<p;b++)h[b]=arguments[b];return(d=r.get(l))==null?void 0:d.map(S=>S(...h)).find(S=>S!==void 0)}}}else i[l]=u}),i),{})}}function i8(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=>sl(c,e,"reference"),t),s=U.useCallback(c=>sl(c,e,"floating"),n),i=U.useCallback(c=>sl(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function rh(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const a8=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:l,...u}=Jn(e,t),{rects:f,elements:{floating:d}}=t,p=n.current[i],h=(l==null?void 0:l.current)||d,b=d.clientTop||h.clientTop,S=d.clientTop!==0,P=h.clientTop!==0,x=d===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||YE('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const w={...t,...await rl(-p.offsetTop-d.clientTop-f.reference.height/2-p.offsetHeight/2-s).fn(t)},A=await tl(rh(w,h.scrollHeight+b+d.clientTop),u),M=await tl(w,{...u,elementContext:"reference"}),B=Me(0,A.top),F=w.y+B,v=(h.scrollHeight>h.clientHeight?$=>$:Vo)(Me(0,h.scrollHeight+(S&&x||P?b*2:0)-B-Me(0,A.bottom)));if(h.style.maxHeight=v+"px",h.scrollTop=B,o){const $=h.offsetHeight<p.offsetHeight*un(c,n.current.length)-1||M.top>=-a||M.bottom>=-a;zr.flushSync(()=>o($))}return r&&(r.current=await tl(rh({...w,y:F},h.offsetHeight+b+d.clientTop),u)),{y:F}}});function c8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Qp(c),l=U.useRef(!1),u=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function p(b){if(b.ctrlKey||!h||s.current==null)return;const S=b.deltaY,P=s.current.top>=-.5,x=s.current.bottom>=-.5,w=h.scrollHeight-h.clientHeight,A=S<0?-1:1,M=S<0?"max":"min";h.scrollHeight<=h.clientHeight||(!P&&S>0||!x&&S<0?(b.preventDefault(),zr.flushSync(()=>{a(B=>B+Math[M](S,w*A))})):/firefox/i.test(z2())&&(h.scrollTop+=S))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",p),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{u.current=null,f.current=null,h.removeEventListener("wheel",p)}},[o,n,r.floating,s,i,a]);const d=U.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const p=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!p||!l.current)){if(u.current!==null){const h=p.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&zr.flushSync(()=>a(b=>b+h))}requestAnimationFrame(()=>{u.current=p.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:d}:{},[o,d])}let Mr=E.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Mr.displayName="FloatingContext";let il=E.createContext(null);il.displayName="PlacementContext";function l8(e){return E.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function u8(){return E.useContext(Mr).setReference}function f8(){return E.useContext(Mr).getReferenceProps}function d8(){let{getFloatingProps:e,slot:t}=E.useContext(Mr);return E.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function p8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=E.useContext(il),n=E.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Ee(()=>{t==null||t(n??null)},[t,n]);let r=E.useContext(Mr);return E.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let oh=4;function h8({children:e,enabled:t=!0}){let[n,r]=E.useState(null),[o,s]=E.useState(0),i=E.useRef(null),[c,a]=E.useState(null);m8(c);let l=t&&n!==null&&c!==null,{to:u="bottom",gap:f=0,offset:d=0,padding:p=0,inner:h}=b8(n,c),[b,S="center"]=u.split(" ");Ee(()=>{l&&s(0)},[l]);let{refs:P,floatingStyles:x,context:w}=s8({open:l,placement:b==="selection"?S==="center"?"bottom":`bottom-${S}`:S==="center"?`${b}`:`${b}-${S}`,strategy:"absolute",transform:!1,middleware:[rl({mainAxis:b==="selection"?0:f,crossAxis:d}),Kp({padding:p}),b!=="selection"&&Yp({padding:p}),b==="selection"&&h?a8({...h,padding:p,overflowRef:i,offset:o,minItemsVisible:oh,referenceOverflowThreshold:p,onFallbackChange($){var N,O;if(!$)return;let k=w.elements.floating;if(!k)return;let y=parseFloat(getComputedStyle(k).scrollPaddingBottom)||0,C=Math.min(oh,k.childElementCount),I=0,T=0;for(let L of(O=(N=w.elements.floating)==null?void 0:N.childNodes)!=null?O:[])if(an(L)){let j=L.offsetTop,z=j+L.clientHeight+y,_=k.scrollTop,H=_+k.clientHeight;if(j>=_&&z<=H)C--;else{T=Math.max(0,Math.min(z,H)-Math.max(j,_)),I=L.clientHeight;break}}C>=1&&s(L=>{let j=I*C-T+y;return L>=j?L:j})}}):null,HE({padding:p,apply({availableWidth:$,availableHeight:N,elements:O}){Object.assign(O.floating.style,{overflow:"auto",maxWidth:`${$}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${N}px)`})}})].filter(Boolean),whileElementsMounted:Hp}),[A=b,M=S]=w.placement.split("-");b==="selection"&&(A="selection");let B=E.useMemo(()=>({anchor:[A,M].filter(Boolean).join(" ")}),[A,M]),F=c8(w,{overflowRef:i,onChange:s}),{getReferenceProps:m,getFloatingProps:g}=i8([F]),v=ue($=>{a($),P.setFloating($)});return U.createElement(il.Provider,{value:r},U.createElement(Mr.Provider,{value:{setFloating:v,setReference:P.setReference,styles:x,getReferenceProps:m,getFloatingProps:g,slot:B}},e))}function m8(e){Ee(()=>{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 b8(e,t){var n,r,o;let s=al((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=al((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=al((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function al(e,t,n=void 0){let r=Kn(),o=ue((a,l)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!l)return[n,null];let u=ih(a,l);return[u,f=>{let d=sh(a);{let p=d.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let b=!1;for(let[P,x]of d.entries()){let w=window.getComputedStyle(l).getPropertyValue(x);if(p[P]!==w){p[P]=w,b=!0;break}}if(!b)return;let S=ih(a,l);u!==S&&(f(S),u=S)})}return r.dispose}]}return[n,null]}),s=E.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=E.useState();return Ee(()=>{let[a,l]=o(e,t);if(c(a),!!l)return l(c)},[e,t]),i}function sh(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,...sh(o)]:[r]}return[]}function ih(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 g8({children:e,freeze:t},n){let r=ah(t,e);return E.isValidElement(r)?E.cloneElement(r,{ref:n}):E.createElement(E.Fragment,null,r)}E.forwardRef(g8);function ah(e,t){let[n,r]=E.useState(t);return!e&&n!==t&&r(t),e?n:t}let cl=E.createContext(null);cl.displayName="OpenClosedContext";var kt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(kt||{});function ll(){return E.useContext(cl)}function ch({value:e,children:t}){return E.createElement(cl.Provider,{value:e},t)}function y8(e){throw new Error("Unexpected object: "+e)}var we=(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))(we||{});function ci(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:y8(e)}}function lh(e){let t=ue(e),n=E.useRef(!1);E.useEffect(()=>(n.current=!1,()=>{n.current=!0,C0(()=>{n.current&&t()})}),[t])}let v8=E.createContext(!1);function w8(){return E.useContext(v8)}function x8(e){let t=w8(),n=E.useContext(fh),[r,o]=E.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(_t.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return E.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),E.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let uh=E.Fragment,E8=qe(function(e,t){let{ownerDocument:n=null,...r}=e,o=E.useRef(null),s=ht(Mx(d=>{o.current=d}),t),i=zc(o.current),c=n??i,a=x8(c),l=E.useContext(A8),u=Kn(),f=ot();return lh(()=>{var d;a&&a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a))}),a?je.createPortal(E.createElement("div",{"data-headlessui-portal":"",ref:d=>{u.dispose(),l&&d&&u.add(l.register(d))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:uh,name:"Portal"})),a):null});function S8(e,t){let n=ht(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=ot();return r?E.createElement(E8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:uh,name:"Portal"})}let P8=E.Fragment,fh=E.createContext(null);function T8(e,t){let{target:n,...r}=e,o={ref:ht(t)},s=ot();return E.createElement(fh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:P8,name:"Popover.Group"}))}let A8=E.createContext(null),$8=qe(S8),N8=qe(T8),C8=Object.assign($8,{Group:N8});const li={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function dh(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function O8(e,t,n){let r=rt();if(t.kind==="Tracked"){let o=function(){s!==dh(e)&&(r.dispose(),n())},{position:s}=t,i=new ResizeObserver(o);i.observe(e),r.add(()=>i.disconnect()),r.addEventListener(window,"scroll",o,{passive:!0}),r.addEventListener(window,"resize",o)}return()=>r.dispose()}function I8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function ph(){let e=I8(),[t,n]=U.useState(_t.isHandoffComplete);return t&&_t.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>_t.handoff(),[]),e?!1:t}function k8(){let e=E.useRef(!1);return Ee(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function hh(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!_o((t=e.as)!=null?t:bh)||E.Children.count(e.children)===1}let ui=E.createContext(null);ui.displayName="TransitionContext";var D8=(e=>(e.Visible="visible",e.Hidden="hidden",e))(D8||{});function M8(){let e=E.useContext(ui);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function L8(){let e=E.useContext(fi);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let fi=E.createContext(null);fi.displayName="NestingContext";function di(e){return"children"in e?di(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function mh(e,t){let n=Yn(e),r=E.useRef([]),o=k8(),s=Kn(),i=ue((p,h=$n.Hidden)=>{let b=r.current.findIndex(({el:S})=>S===p);b!==-1&&(pt(h,{[$n.Unmount](){r.current.splice(b,1)},[$n.Hidden](){r.current[b].state="hidden"}}),s.microTask(()=>{var S;!di(r)&&o.current&&((S=n.current)==null||S.call(n))}))}),c=ue(p=>{let h=r.current.find(({el:b})=>b===p);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:p,state:"visible"}),()=>i(p,$n.Unmount)}),a=E.useRef([]),l=E.useRef(Promise.resolve()),u=E.useRef({enter:[],leave:[]}),f=ue((p,h,b)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([S])=>S!==p)),t==null||t.chains.current[h].push([p,new Promise(S=>{a.current.push(S)})]),t==null||t.chains.current[h].push([p,new Promise(S=>{Promise.all(u.current[h].map(([P,x])=>x)).then(()=>S())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(h)):b(h)}),d=ue((p,h,b)=>{Promise.all(u.current[h].splice(0).map(([S,P])=>P)).then(()=>{var S;(S=a.current.shift())==null||S()}).then(()=>b(h))});return E.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:d,wait:l,chains:u}),[c,i,r,f,d,u,l])}let bh=E.Fragment,gh=Vs.RenderStrategy;function B8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:l,enterFrom:u,enterTo:f,entered:d,leave:p,leaveFrom:h,leaveTo:b,...S}=e,[P,x]=E.useState(null),w=E.useRef(null),A=hh(e),M=ht(...A?[w,t,x]:t===null?[]:[t]),B=(n=S.unmount)==null||n?$n.Unmount:$n.Hidden,{show:F,appear:m,initial:g}=M8(),[v,$]=E.useState(F?"visible":"hidden"),N=L8(),{register:O,unregister:k}=N;Ee(()=>O(w),[O,w]),Ee(()=>{if(B===$n.Hidden&&w.current){if(F&&v!=="visible"){$("visible");return}return pt(v,{hidden:()=>k(w),visible:()=>O(w)})}},[v,w,O,k,F,B]);let y=ph();Ee(()=>{if(A&&y&&v==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,v,y,A]);let C=g&&!m,I=m&&F&&g,T=E.useRef(!1),L=mh(()=>{T.current||($("hidden"),k(w))},N),j=ue(Z=>{T.current=!0;let J=Z?"enter":"leave";L.onStart(w,J,ee=>{ee==="enter"?s==null||s():ee==="leave"&&(c==null||c())})}),z=ue(Z=>{let J=Z?"enter":"leave";T.current=!1,L.onStop(w,J,ee=>{ee==="enter"?i==null||i():ee==="leave"&&(a==null||a())}),J==="leave"&&!di(L)&&($("hidden"),k(w))});E.useEffect(()=>{A&&o||(j(F),z(F))},[F,A,o]);let _=!(!o||!A||!y||C),[,H]=vp(_,P,F,{start:j,end:z}),Y=Nn({ref:M,className:((r=Ac(S.className,I&&l,I&&u,H.enter&&l,H.enter&&H.closed&&u,H.enter&&!H.closed&&f,H.leave&&p,H.leave&&!H.closed&&h,H.leave&&H.closed&&b,!H.transition&&F&&d))==null?void 0:r.trim())||void 0,...yp(H)}),G=0;v==="visible"&&(G|=kt.Open),v==="hidden"&&(G|=kt.Closed),F&&v==="hidden"&&(G|=kt.Opening),!F&&v==="visible"&&(G|=kt.Closing);let W=ot();return E.createElement(fi.Provider,{value:L},E.createElement(ch,{value:G},W({ourProps:Y,theirProps:S,defaultTag:bh,features:gh,visible:v==="visible",name:"Transition.Child"})))}function F8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=E.useRef(null),c=hh(e),a=ht(...c?[i,t]:t===null?[]:[t]);ph();let l=ll();if(n===void 0&&l!==null&&(n=(l&kt.Open)===kt.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=E.useState(n?"visible":"hidden"),d=mh(()=>{n||f("hidden")}),[p,h]=E.useState(!0),b=E.useRef([n]);Ee(()=>{p!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),h(!1))},[b,n]);let S=E.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);Ee(()=>{n?f("visible"):!di(d)&&i.current!==null&&f("hidden")},[n,d]);let P={unmount:o},x=ue(()=>{var M;p&&h(!1),(M=e.beforeEnter)==null||M.call(e)}),w=ue(()=>{var M;p&&h(!1),(M=e.beforeLeave)==null||M.call(e)}),A=ot();return E.createElement(fi.Provider,{value:d},E.createElement(ui.Provider,{value:S},A({ourProps:{...P,as:E.Fragment,children:E.createElement(yh,{ref:a,...P,...s,beforeEnter:x,beforeLeave:w})},theirProps:{},defaultTag:E.Fragment,features:gh,visible:u==="visible",name:"Transition"})))}function R8(e,t){let n=E.useContext(ui)!==null,r=ll()!==null;return E.createElement(E.Fragment,null,!n&&r?E.createElement(ul,{ref:t,...e}):E.createElement(yh,{ref:t,...e}))}let ul=qe(F8),yh=qe(B8),j8=qe(R8),fl=Object.assign(ul,{Child:j8,Root:ul}),vh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function wh(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!an(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 vh.test(i)&&(i=i.replace(vh,"")),i}function _8(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():wh(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return wh(e).trim()}function z8(e){let t=E.useRef(""),n=E.useRef("");return ue(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=_8(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var U8=Object.defineProperty,W8=(e,t,n)=>t in e?U8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xh=(e,t,n)=>(W8(e,typeof t!="symbol"?t+"":t,n),n),Le=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Le||{}),In=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(In||{}),pi=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(pi||{}),Eh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.SelectOption=5]="SelectOption",e[e.RegisterOptions=6]="RegisterOptions",e[e.UnregisterOptions=7]="UnregisterOptions",e[e.SetButtonElement=8]="SetButtonElement",e[e.SetOptionsElement=9]="SetOptionsElement",e[e.SortOptions=10]="SortOptions",e[e.MarkButtonAsMoved=11]="MarkButtonAsMoved",e))(Eh||{});function Sh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=lp(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 H8={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?li.Tracked(dh(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:we.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:t}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,frozenValue:!1,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1,buttonPositionState:li.Idle}},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===we.Nothing)return{...c,activeOptionIndex:null};if(t.focus===we.Specific)return{...c,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===we.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,d=ci(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===we.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,d=ci(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=Sh(e),l=ci(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...c,...a,activeOptionIndex:l}},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){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==we.Nothing&&(r=ci(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:we.Nothing},pendingShouldSort:!0}},7:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},8:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},9:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},10:e=>e.pendingShouldSort?{...e,...Sh(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:li.Moved}}};class dl extends X0{constructor(t){super(t),xh(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return pt(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(l=>o(l,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:kc(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:6,options:n.splice(0)}))]}),unregisterOption:kc(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:kc(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{var n;if(this.state.activeOptionIndex!==null){let{dataRef:r}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(r.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(n=this.state.buttonElement)==null||n.focus({preventScroll:!0}))},selectOption:n=>{this.send({type:5,value:n})},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:8,element:n})},setOptionsElement:n=>{this.send({type:9,element:n})}}),xh(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,r=Dc.get(null);this.disposables.add(r.on(tp.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}this.disposables.group(n=>{this.on(1,r=>{r.buttonElement&&(n.dispose(),n.add(O8(r.buttonElement,r.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(n,r)=>{var o;this.actions.onChange(r.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(o=this.state.buttonElement)==null||o.focus({preventScroll:!0}))})}static new({id:t,__demoMode:n=!1}){return new dl({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:we.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:li.Idle})}reduce(t,n){return pt(n.type,H8,t,n)}}const Ph=E.createContext(null);function pl(e){let t=E.useContext(Ph);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Th),n}return t}function Th({id:e,__demoMode:t=!1}){let n=E.useMemo(()=>dl.new({id:e,__demoMode:t}),[]);return lh(()=>n.dispose()),n}let hi=E.createContext(null);hi.displayName="ListboxDataContext";function Zo(e){let t=E.useContext(hi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Zo),n}return t}let V8=E.Fragment;function G8(e,t){let n=E.useId(),r=Tc(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:l,invalid:u=!1,disabled:f=r||!1,horizontal:d=!1,multiple:p=!1,__demoMode:h=!1,...b}=e;const S=d?"horizontal":"vertical";let P=ht(t),x=vx(s),[w=p?[]:void 0,A]=yx(o,a,x),M=Th({id:n,__demoMode:h}),B=E.useRef({static:!1,hold:!1}),F=E.useRef(new Map),m=Vx(l),g=E.useCallback(_=>pt(v.mode,{[In.Multi]:()=>w.some(H=>m(H,_)),[In.Single]:()=>m(w,_)}),[w]),v=An({value:w,disabled:f,invalid:u,mode:p?In.Multi:In.Single,orientation:S,onChange:A,compare:m,isSelected:g,optionsPropsRef:B,listRef:F});Ee(()=>{M.state.dataRef.current=v},[v]);let $=Ze(M,_=>_.listboxState),N=Dc.get(null),O=Ze(N,E.useCallback(_=>N.selectors.isTop(_,n),[N,n])),[k,y]=Ze(M,_=>[_.buttonElement,_.optionsElement]);y2(O,[k,y],(_,H)=>{M.send({type:Eh.CloseListbox}),cp(H,_c.Loose)||(_.preventDefault(),k==null||k.focus())});let C=An({open:$===Le.Open,disabled:f,invalid:u,value:w}),[I,T]=jx({inherit:!0}),L={ref:P},j=E.useCallback(()=>{if(x!==void 0)return A==null?void 0:A(x)},[A,x]),z=ot();return E.createElement(T,{value:I,props:{htmlFor:k==null?void 0:k.id},slot:{open:$===Le.Open,disabled:f}},E.createElement(h8,null,E.createElement(Ph.Provider,{value:M},E.createElement(hi.Provider,{value:v},E.createElement(ch,{value:pt($,{[Le.Open]:kt.Open,[Le.Closed]:kt.Closed})},c!=null&&w!=null&&E.createElement(Ax,{disabled:f,data:{[c]:w},form:i,onReset:j}),z({ourProps:L,theirProps:b,slot:C,defaultTag:V8,name:"Listbox"}))))))}let q8="button";function Z8(e,t){let n=E.useId(),r=B0(),o=Zo("Listbox.Button"),s=pl("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...l}=e,u=ht(t,u8(),s.actions.setButtonElement),f=f8(),[d,p,h]=Ze(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),b=d===Le.Open;x2(b,{trigger:p,action:E.useCallback(y=>{if(p!=null&&p.contains(y.target))return Ks.Ignore;let C=y.target.closest('[role="option"]:not([data-disabled])');return an(C)?Ks.Select(C):h!=null&&h.contains(y.target)?Ks.Ignore:Ks.Close},[p,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let S=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?we.Nothing:we.First});break;case Ie.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?we.Nothing:we.Last});break}}),P=ue(y=>{switch(y.key){case Ie.Space:y.preventDefault();break}}),x=qx(y=>{var C;s.state.listboxState===Le.Open?(je.flushSync(()=>s.actions.closeListbox()),(C=s.state.buttonElement)==null||C.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:we.Nothing}))}),w=ue(y=>y.preventDefault()),A=V0([i]),M=Lx(),{isFocusVisible:B,focusProps:F}=ox({autoFocus:a}),{isHovered:m,hoverProps:g}=rx({isDisabled:c}),{pressed:v,pressProps:$}=fx({disabled:c}),N=An({open:d===Le.Open,active:v||d===Le.Open,disabled:c,invalid:o.invalid,value:o.value,hover:m,focus:B,autofocus:a}),O=Ze(s,y=>y.listboxState===Le.Open),k=I0(f(),{ref:u,id:i,type:E2(e,p),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":O,"aria-labelledby":A,"aria-describedby":M,disabled:c||void 0,autoFocus:a,onKeyDown:S,onKeyUp:P,onKeyPress:w},x,F,g,$);return ot()({ourProps:k,theirProps:l,slot:N,defaultTag:q8,name:"Listbox.Button"})}let Ah=E.createContext(!1),K8="div",Y8=Vs.RenderStrategy|Vs.Static;function X8(e,t){let n=E.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,l=l8(o),[u,f]=E.useState(null);l&&(s=!0);let d=Zo("Listbox.Options"),p=pl("Listbox.Options"),[h,b,S,P]=Ze(p,W=>[W.listboxState,W.buttonElement,W.optionsElement,W.__demoMode]),x=zc(b),w=zc(S),A=ll(),[M,B]=vp(c,u,A!==null?(A&kt.Open)===kt.Open:h===Le.Open);i2(M,b,p.actions.closeListbox);let F=P?!1:i&&h===Le.Open;C2(F,w);let m=P?!1:i&&h===Le.Open;s2(m,{allowed:E.useCallback(()=>[b,S],[b,S])});let g=Ze(p,p.selectors.didButtonMove)?!1:M,v=Ze(p,p.selectors.hasFrozenValue)&&!e.static,$=ah(v,d.value),N=E.useCallback(W=>d.compare($,W),[d.compare,$]),O=Ze(p,W=>{var Z;if(l==null||!((Z=l==null?void 0:l.to)!=null&&Z.includes("selection")))return null;let J=W.options.findIndex(ee=>N(ee.dataRef.current.value));return J===-1&&(J=0),J}),k=(()=>{if(l==null)return;if(O===null)return{...l,inner:void 0};let W=Array.from(d.listRef.current.values());return{...l,inner:{listRef:{current:W},index:O}}})(),[y,C]=p8(k),I=d8(),T=ht(t,l?y:null,p.actions.setOptionsElement,f),L=Kn();E.useEffect(()=>{let W=S;W&&h===Le.Open&&(cx(W)||W==null||W.focus({preventScroll:!0}))},[h,S]);let j=ue(W=>{var Z;switch(L.dispose(),W.key){case Ie.Space:if(p.state.searchQuery!=="")return W.preventDefault(),W.stopPropagation(),p.actions.search(W.key);case Ie.Enter:W.preventDefault(),W.stopPropagation(),p.actions.selectActiveOption();break;case pt(d.orientation,{vertical:Ie.ArrowDown,horizontal:Ie.ArrowRight}):return W.preventDefault(),W.stopPropagation(),p.actions.goToOption({focus:we.Next});case pt(d.orientation,{vertical:Ie.ArrowUp,horizontal:Ie.ArrowLeft}):return W.preventDefault(),W.stopPropagation(),p.actions.goToOption({focus:we.Previous});case Ie.Home:case Ie.PageUp:return W.preventDefault(),W.stopPropagation(),p.actions.goToOption({focus:we.First});case Ie.End:case Ie.PageDown:return W.preventDefault(),W.stopPropagation(),p.actions.goToOption({focus:we.Last});case Ie.Escape:W.preventDefault(),W.stopPropagation(),je.flushSync(()=>p.actions.closeListbox()),(Z=p.state.buttonElement)==null||Z.focus({preventScroll:!0});return;case Ie.Tab:W.preventDefault(),W.stopPropagation(),je.flushSync(()=>p.actions.closeListbox()),h2(p.state.buttonElement,W.shiftKey?jc.Previous:jc.Next);break;default:W.key.length===1&&(p.actions.search(W.key),L.setTimeout(()=>p.actions.clearSearch(),350));break}}),z=Ze(p,W=>{var Z;return(Z=W.buttonElement)==null?void 0:Z.id}),_=An({open:h===Le.Open}),H=I0(l?I():{},{id:r,ref:T,"aria-activedescendant":Ze(p,p.selectors.activeDescendantId),"aria-multiselectable":d.mode===In.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":d.orientation,onKeyDown:j,role:"listbox",tabIndex:h===Le.Open?0:void 0,style:{...a.style,...C,"--button-width":Gx(M,b,!0).width},...yp(B)}),Y=ot(),G=E.useMemo(()=>d.mode===In.Multi?d:{...d,isSelected:N},[d,N]);return E.createElement(C8,{enabled:s?e.static||M:!1,ownerDocument:x},E.createElement(hi.Provider,{value:G},Y({ourProps:H,theirProps:a,slot:_,defaultTag:K8,features:Y8,visible:g,name:"Listbox.Options"})))}let Q8="div";function J8(e,t){let n=E.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=E.useContext(Ah)===!0,a=Zo("Listbox.Option"),l=pl("Listbox.Option"),u=Ze(l,v=>l.selectors.isActive(v,r)),f=a.isSelected(s),d=E.useRef(null),p=z8(d),h=Yn({disabled:o,value:s,domRef:d,get textValue(){return p()}}),b=ht(t,d,v=>{v?a.listRef.current.set(r,v):a.listRef.current.delete(r)}),S=Ze(l,v=>l.selectors.shouldScrollIntoView(v,r));Ee(()=>{if(S)return rt().requestAnimationFrame(()=>{var v,$;($=(v=d.current)==null?void 0:v.scrollIntoView)==null||$.call(v,{block:"nearest"})})},[S,d]),Ee(()=>{if(!c)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,c]);let P=ue(v=>{if(o)return v.preventDefault();l.actions.selectOption(s)}),x=ue(()=>{if(o)return l.actions.goToOption({focus:we.Nothing});l.actions.goToOption({focus:we.Specific,id:r})}),w=O2(),A=ue(v=>w.update(v)),M=ue(v=>{w.wasMoved(v)&&(o||u&&l.state.activationTrigger===pi.Pointer||l.actions.goToOption({focus:we.Specific,id:r},pi.Pointer))}),B=ue(v=>{w.wasMoved(v)&&(o||u&&l.state.activationTrigger===pi.Pointer&&l.actions.goToOption({focus:we.Nothing}))}),F=An({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&c}),m=c?{}:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:P,onFocus:x,onPointerEnter:A,onMouseEnter:A,onPointerMove:M,onMouseMove:M,onPointerLeave:B,onMouseLeave:B},g=ot();return!f&&c?null:g({ourProps:m,theirProps:i,slot:F,defaultTag:Q8,name:"Listbox.Option"})}let e3=E.Fragment;function t3(e,t){let{options:n,placeholder:r,...o}=e,s={ref:ht(t)},i=Zo("ListboxSelectedOption"),c=An({}),a=i.value===void 0||i.value===null||i.mode===In.Multi&&Array.isArray(i.value)&&i.value.length===0,l=ot();return E.createElement(Ah.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:E.createElement(E.Fragment,null,r&&a?r:n)},slot:c,defaultTag:e3,name:"ListboxSelectedOption"}))}let n3=qe(G8),r3=qe(Z8),o3=Wx,s3=qe(X8),i3=qe(J8),a3=qe(t3),gt=Object.assign(n3,{Button:r3,Label:o3,Options:s3,Option:i3,SelectedOption:a3});const c3=()=>D.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[D.jsx("g",{clipPath:"url(#clip0_active)",children:D.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"})}),D.jsx("defs",{children:D.jsx("clipPath",{id:"clip0_active",children:D.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),l3=()=>D.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[D.jsx("g",{clipPath:"url(#clip0_inactive)",children:D.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"})}),D.jsx("defs",{children:D.jsx("clipPath",{id:"clip0_inactive",children:D.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Ko=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return D.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>D.jsx("div",{className:"flex items-center justify-center",children:o>t-e?D.jsx(c3,{}):D.jsx(l3,{})},o))})};class Dt{}ts(Dt,"FAST",3),ts(Dt,"Medium",2),ts(Dt,"SLOW",1),ts(Dt,"NONE",0);const u3=Object.values({MAINNET:1,SEPOLIA:11155111}),dn=e=>{const t=typeof e=="string"?parseInt(e,10):e;return u3.includes(t)},f3={USDT:!0},$h=(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:!f3[t.toUpperCase()]:!0},d3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=Et();return D.jsx("div",{className:`relative ${o}`,children:D.jsx(gt,{value:t,onChange:n,disabled:r,children:({open:c})=>D.jsxs(D.Fragment,{children:[D.jsxs(gt.Button,{className:`
139
+ */var Q2=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Qc=Q2.join(","),$p=typeof Element>"u",Go=$p?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,oi=!$p&&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},si=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):si(t.parentNode));return i},J2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},eE=function(t,n,r){if(si(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Qc));return n&&Go.call(t,Qc)&&o.unshift(t),o=o.filter(r),o},Jc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!si(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,l=Jc(a,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{var u=Go.call(i,Qc);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),d=!si(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&d){var p=Jc(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},Ap=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Np=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||J2(t))&&!Ap(t)?0:t.tabIndex},tE=function(t,n){var r=Np(t);return r<0&&n&&!Ap(t)?0:r},nE=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Cp=function(t){return t.tagName==="INPUT"},rE=function(t){return Cp(t)&&t.type==="hidden"},oE=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},sE=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},iE=function(t){if(!t.name)return!0;var n=t.form||oi(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=sE(o,t.form);return!s||s===t},aE=function(t){return Cp(t)&&t.type==="radio"},cE=function(t){return aE(t)&&!iE(t)},lE=function(t){var n,r=t&&oi(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 l,u,f;r=oi(o),o=(l=r)===null||l===void 0?void 0:l.host,s=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Op=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},uE=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=Go.call(t,"details>summary:first-of-type"),c=i?t.parentElement:t;if(Go.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var l=t.parentElement,u=oi(t);if(l&&!l.shadowRoot&&o(l)===!0)return Op(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=a}if(lE(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Op(t);return!1},fE=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 Go.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},dE=function(t,n){return!(n.disabled||rE(n)||uE(n,t)||oE(n)||fE(n))},Ip=function(t,n){return!(cE(n)||Np(n)<0||!dE(t,n))},pE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Dp=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=tE(c,i),l=i?Dp(o.candidates):c;a===0?i?n.push.apply(n,l):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:l})}),r.sort(nE).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Mp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Jc([t],n.includeContainer,{filter:Ip.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:pE}):r=eE(t,n.includeContainer,Ip.bind(null,n)),Dp(r)};function kp(e,t,n){let{reference:r,floating:o}=e;const s=fn(t),i=Yc(t),c=Kc(i),a=On(t),l=s==="y",u=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:u,y:r.y-o.height};break;case"bottom":p={x:u,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(Dr(t)){case"start":p[i]-=d*(n&&l?-1:1);break;case"end":p[i]+=d*(n&&l?-1:1);break}return p}async function Lp(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=Jn(t,e),h=Tp(p),S=c[d?f==="floating"?"reference":"floating":f],P=ri(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(S)))==null||n?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),$=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},k=ri(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:w,strategy:a}):x);return{top:(P.top-k.top+h.top)/$.y,bottom:(k.bottom-P.bottom+h.bottom)/$.y,left:(P.left-k.left+h.left)/$.x,right:(k.right-P.right+h.right)/$.x}}const hE=50,mE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Lp},a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=kp(l,r,a),d=r,p=0;const h={};for(let b=0;b<s.length;b++){const S=s[b];if(!S)continue;const{name:P,fn:x}=S,{x:w,y:$,data:k,reset:B}=await x({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:h,rects:l,platform:c,elements:{reference:e,floating:t}});u=w??u,f=$??f,h[P]={...h[P],...k},B&&p<hE&&(p++,typeof B=="object"&&(B.placement&&(d=B.placement),B.rects&&(l=B.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):B.rects),{x:u,y:f}=kp(l,d,a)),b=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:h}},bE=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:l,padding:u=0}=Jn(e,t)||{};if(l==null)return{};const f=Tp(u),d={x:n,y:r},p=Yc(o),h=Kc(p),b=await i.getDimensions(l),S=p==="y",P=S?"top":"left",x=S?"bottom":"right",w=S?"clientHeight":"clientWidth",$=s.reference[h]+s.reference[p]-d[p]-s.floating[h],k=d[p]-s.reference[p],B=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let F=B?B[w]:0;(!F||!await(i.isElement==null?void 0:i.isElement(B)))&&(F=c.floating[w]||s.floating[h]);const m=$/2-k/2,g=F/2-b[h]/2-1,v=un(f[P],g),A=un(f[x],g),N=v,O=F-b[h]-A,D=F/2-b[h]/2+m,y=Zc(N,D,O),C=!a.arrow&&Dr(o)!=null&&D!==y&&s.reference[h]/2-(D<N?v:A)-b[h]/2<0,I=C?D<N?D-N:D-O:0;return{[p]:d[p]+I,data:{[p]:y,centerOffset:D-y-I,...C&&{alignmentOffset:I}},reset:C}}}),gE=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:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:b=!0,...S}=Jn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const P=On(o),x=fn(c),w=On(c)===c,$=await(a.isRTL==null?void 0:a.isRTL(l.floating)),k=d||(w||!b?[ni(c)]:G2(c)),B=h!=="none";!d&&B&&k.push(...Y2(c,b,h,$));const F=[c,...k],m=await a.detectOverflow(t,S),g=[];let v=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&g.push(m[P]),f){const D=V2(o,i,$);g.push(m[D[0]],m[D[1]])}if(v=[...v,{placement:o,overflows:g}],!g.every(D=>D<=0)){var A,N;const D=(((A=s.flip)==null?void 0:A.index)||0)+1,y=F[D];if(y&&(!(f==="alignment"?x!==fn(y):!1)||v.every(T=>fn(T.placement)===x?T.overflows[0]>0:!0)))return{data:{index:D,overflows:v},reset:{placement:y}};let C=(N=v.filter(I=>I.overflows[0]<=0).sort((I,T)=>I.overflows[1]-T.overflows[1])[0])==null?void 0:N.placement;if(!C)switch(p){case"bestFit":{var O;const I=(O=v.filter(T=>{if(B){const L=fn(T.placement);return L===x||L==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(L=>L>0).reduce((L,j)=>L+j,0)]).sort((T,L)=>T[1]-L[1])[0])==null?void 0:O[0];I&&(C=I);break}case"initialPlacement":C=c;break}if(o!==C)return{reset:{placement:C}}}return{}}}},yE=new Set(["left","top"]);async function vE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=On(n),c=Dr(n),a=fn(n)==="y",l=yE.has(i)?-1:1,u=s&&a?-1:1,f=Jn(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*u,y:d*l}:{x:d*l,y:p*u}}const wE=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 vE(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}}}}},xE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:P=>{let{x,y:w}=P;return{x,y:w}}},...l}=Jn(e,t),u={x:n,y:r},f=await s.detectOverflow(t,l),d=fn(On(o)),p=Ep(d);let h=u[p],b=u[d];if(i){const P=p==="y"?"top":"left",x=p==="y"?"bottom":"right",w=h+f[P],$=h-f[x];h=Zc(w,h,$)}if(c){const P=d==="y"?"top":"left",x=d==="y"?"bottom":"right",w=b+f[P],$=b-f[x];b=Zc(w,b,$)}const S=a.fn({...t,[p]:h,[d]:b});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[p]:i,[d]:c}}}}}},EE=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=()=>{},...l}=Jn(e,t),u=await i.detectOverflow(t,l),f=On(o),d=Dr(o),p=fn(o)==="y",{width:h,height:b}=s.floating;let S,P;f==="top"||f==="bottom"?(S=f,P=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(P=f,S=d==="end"?"top":"bottom");const x=b-u.top-u.bottom,w=h-u.left-u.right,$=un(b-u[S],x),k=un(h-u[P],w),B=!t.middlewareData.shift;let F=$,m=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(m=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=x),B&&!d){const v=ke(u.left,0),A=ke(u.right,0),N=ke(u.top,0),O=ke(u.bottom,0);p?m=h-2*(v!==0||A!==0?v+A:ke(u.left,u.right)):F=b-2*(N!==0||O!==0?N+O:ke(u.top,u.bottom))}await a({...t,availableWidth:m,availableHeight:F});const g=await i.getDimensions(c.floating);return h!==g.width||b!==g.height?{reset:{rects:!0}}:{}}}};function Bp(e){const t=bt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ye(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Vo(n)!==s||Vo(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function el(e){return de(e)?e:e.contextElement}function Mr(e){const t=el(e);if(!Ye(t))return Wt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Bp(t);let i=(s?Vo(n.width):n.width)/r,c=(s?Vo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const SE=Wt(0);function Fp(e){const t=Ke(e);return!Js()||!t.visualViewport?SE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function PE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ke(e)?!1:t}function er(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=el(e);let i=Wt(1);t&&(r?de(r)&&(i=Mr(r)):i=Mr(e));const c=PE(s,n,r)?Fp(s):Wt(0);let a=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const d=Ke(s),p=r&&de(r)?Ke(r):r;let h=d,b=qc(h);for(;b&&r&&p!==h;){const S=Mr(b),P=b.getBoundingClientRect(),x=bt(b),w=P.left+(b.clientLeft+parseFloat(x.paddingLeft))*S.x,$=P.top+(b.clientTop+parseFloat(x.paddingTop))*S.y;a*=S.x,l*=S.y,u*=S.x,f*=S.y,a+=w,l+=$,h=Ke(b),b=qc(h)}}return ri({width:u,height:f,x:a,y:l})}function ii(e,t){const n=ei(e).scrollLeft;return t?t.left+n:er(Ut(e)).left+n}function Rp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ii(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function TE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Ut(r),c=t?Qs(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=Wt(1);const u=Wt(0),f=Ye(r);if((f||!f&&!s)&&((Ir(r)!=="body"||Ho(i))&&(a=ei(r)),f)){const p=er(r);l=Mr(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const d=i&&!f&&!s?Rp(i,a):Wt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+d.x,y:n.y*l.y-a.scrollTop*l.y+u.y+d.y}}function $E(e){return Array.from(e.getClientRects())}function AE(e){const t=Ut(e),n=ei(e),r=e.ownerDocument.body,o=ke(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ke(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ii(e);const c=-n.scrollTop;return bt(r).direction==="rtl"&&(i+=ke(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const jp=25;function NE(e,t){const n=Ke(e),r=Ut(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const u=Js();(!u||u&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const l=ii(r);if(l<=0){const u=r.ownerDocument,f=u.body,d=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-p);h<=jp&&(s-=h)}else l<=jp&&(s+=l);return{width:s,height:i,x:c,y:a}}function CE(e,t){const n=er(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ye(e)?Mr(e):Wt(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=r*s.y;return{width:i,height:c,x:a,y:l}}function _p(e,t,n){let r;if(t==="viewport")r=NE(e,n);else if(t==="document")r=AE(Ut(e));else if(de(t))r=CE(t,n);else{const o=Fp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ri(r)}function zp(e,t){const n=ln(e);return n===t||!de(n)||cn(n)?!1:bt(n).position==="fixed"||zp(n,t)}function OE(e,t){const n=t.get(e);if(n)return n;let r=Cn(e,[],!1).filter(c=>de(c)&&Ir(c)!=="body"),o=null;const s=bt(e).position==="fixed";let i=s?ln(e):e;for(;de(i)&&!cn(i);){const c=bt(i),a=Gc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Ho(i)&&!a&&zp(e,i))?r=r.filter(u=>u!==i):o=c,i=ln(i)}return t.set(e,r),r}function IE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Qs(t)?[]:OE(t,this._c):[].concat(n),r],c=_p(t,i[0],o);let a=c.top,l=c.right,u=c.bottom,f=c.left;for(let d=1;d<i.length;d++){const p=_p(t,i[d],o);a=ke(p.top,a),l=un(p.right,l),u=un(p.bottom,u),f=ke(p.left,f)}return{width:l-f,height:u-a,x:f,y:a}}function DE(e){const{width:t,height:n}=Bp(e);return{width:t,height:n}}function ME(e,t,n){const r=Ye(t),o=Ut(t),s=n==="fixed",i=er(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Wt(0);function l(){a.x=ii(o)}if(r||!r&&!s)if((Ir(t)!=="body"||Ho(o))&&(c=ei(t)),r){const p=er(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&l();s&&!r&&o&&l();const u=o&&!r&&!s?Rp(o,c):Wt(0),f=i.left+c.scrollLeft-a.x-u.x,d=i.top+c.scrollTop-a.y-u.y;return{x:f,y:d,width:i.width,height:i.height}}function tl(e){return bt(e).position==="static"}function Up(e,t){if(!Ye(e)||bt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ut(e)===n&&(n=n.ownerDocument.body),n}function Wp(e,t){const n=Ke(e);if(Qs(e))return n;if(!Ye(e)){let o=ln(e);for(;o&&!cn(o);){if(de(o)&&!tl(o))return o;o=ln(o)}return n}let r=Up(e,t);for(;r&&j2(r)&&tl(r);)r=Up(r,t);return r&&cn(r)&&tl(r)&&!Gc(r)?n:r||U2(e)||n}const kE=async function(e){const t=this.getOffsetParent||Wp,n=this.getDimensions,r=await n(e.floating);return{reference:ME(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function LE(e){return bt(e).direction==="rtl"}const BE={convertOffsetParentRelativeRectToViewportRelativeRect:TE,getDocumentElement:Ut,getClippingRect:IE,getOffsetParent:Wp,getElementRects:kE,getClientRects:$E,getDimensions:DE,getScale:Mr,isElement:de,isRTL:LE};function Hp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function FE(e,t){let n=null,r;const o=Ut(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 l=e.getBoundingClientRect(),{left:u,top:f,width:d,height:p}=l;if(c||t(),!d||!p)return;const h=ti(f),b=ti(o.clientWidth-(u+d)),S=ti(o.clientHeight-(f+p)),P=ti(u),w={rootMargin:-h+"px "+-b+"px "+-S+"px "+-P+"px",threshold:ke(0,un(1,a))||1};let $=!0;function k(B){const F=B[0].intersectionRatio;if(F!==a){if(!$)return i();F?i(!1,F):r=setTimeout(()=>{i(!1,1e-7)},1e3)}F===1&&!Hp(l,e.getBoundingClientRect())&&i(),$=!1}try{n=new IntersectionObserver(k,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,w)}n.observe(e)}return i(!0),s}function Vp(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,l=el(e),u=o||s?[...l?Cn(l):[],...t?Cn(t):[]]:[];u.forEach(P=>{o&&P.addEventListener("scroll",n,{passive:!0}),s&&P.addEventListener("resize",n)});const f=l&&c?FE(l,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(P=>{let[x]=P;x&&x.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),l&&!a&&p.observe(l),t&&p.observe(t));let h,b=a?er(e):null;a&&S();function S(){const P=er(e);b&&!Hp(b,P)&&n(),b=P,h=requestAnimationFrame(S)}return n(),()=>{var P;u.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(P=p)==null||P.disconnect(),p=null,a&&cancelAnimationFrame(h)}}const nl=Lp,RE=wE,jE=xE,_E=gE,zE=EE,Gp=bE,UE=(e,t,n)=>{const r=new Map,o={platform:BE,...n},s={...o.platform,_c:r};return mE(e,t,{...o,platform:s})};var WE=typeof document<"u",HE=function(){},ai=WE?E.useLayoutEffect:HE;function ci(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(!ci(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)&&!ci(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function qp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zp(e,t){const n=qp(e);return Math.round(t*n)/n}function rl(e){const t=U.useRef(e);return ai(()=>{t.current=e}),t}function Kp(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:l}=e,[u,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=U.useState(r);ci(d,r)||p(r);const[h,b]=U.useState(null),[S,P]=U.useState(null),x=U.useCallback(T=>{T!==B.current&&(B.current=T,b(T))},[]),w=U.useCallback(T=>{T!==F.current&&(F.current=T,P(T))},[]),$=s||h,k=i||S,B=U.useRef(null),F=U.useRef(null),m=U.useRef(u),g=a!=null,v=rl(a),A=rl(o),N=rl(l),O=U.useCallback(()=>{if(!B.current||!F.current)return;const T={placement:t,strategy:n,middleware:d};A.current&&(T.platform=A.current),UE(B.current,F.current,T).then(L=>{const j={...L,isPositioned:N.current!==!1};D.current&&!ci(m.current,j)&&(m.current=j,zr.flushSync(()=>{f(j)}))})},[d,t,n,A,N]);ai(()=>{l===!1&&m.current.isPositioned&&(m.current.isPositioned=!1,f(T=>({...T,isPositioned:!1})))},[l]);const D=U.useRef(!1);ai(()=>(D.current=!0,()=>{D.current=!1}),[]),ai(()=>{if($&&(B.current=$),k&&(F.current=k),$&&k){if(v.current)return v.current($,k,O);O()}},[$,k,O,v,g]);const y=U.useMemo(()=>({reference:B,floating:F,setReference:x,setFloating:w}),[x,w]),C=U.useMemo(()=>({reference:$,floating:k}),[$,k]),I=U.useMemo(()=>{const T={position:n,left:0,top:0};if(!C.floating)return T;const L=Zp(C.floating,u.x),j=Zp(C.floating,u.y);return c?{...T,transform:"translate("+L+"px, "+j+"px)",...qp(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:j}},[n,c,C.floating,u.x,u.y]);return U.useMemo(()=>({...u,update:O,refs:y,elements:C,floatingStyles:I}),[u,O,y,C,I])}const VE=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?Gp({element:r.current,padding:o}).fn(n):{}:r?Gp({element:r,padding:o}).fn(n):{}}}},ol=(e,t)=>{const n=RE(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yp=(e,t)=>{const n=jE(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xp=(e,t)=>{const n=_E(e);return{name:n.name,fn:n.fn,options:[e,t]}},GE=(e,t)=>{const n=zE(e);return{name:n.name,fn:n.fn,options:[e,t]}},qE=(e,t)=>{const n=VE(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qp={...U},ZE=Qp.useInsertionEffect||(e=>e());function Jp(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return ZE(()=>{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 sl=typeof document<"u"?E.useLayoutEffect:E.useEffect;let eh=!1,KE=0;const th=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+KE++;function YE(){const[e,t]=U.useState(()=>eh?th():void 0);return sl(()=>{e==null&&t(th())},[]),U.useEffect(()=>{eh=!0},[]),e}const XE=Qp.useId||YE;let qo;process.env.NODE_ENV!=="production"&&(qo=new Set);function QE(){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=qo)!=null&&e.has(o))){var s;(s=qo)==null||s.add(o),console.warn(o)}}function JE(){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=qo)!=null&&e.has(o))){var s;(s=qo)==null||s.add(o),console.error(o)}}function e8(){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 t8=U.createContext(null),n8=U.createContext(null),r8=()=>{var e;return((e=U.useContext(t8))==null?void 0:e.id)||null},o8=()=>U.useContext(n8),s8="data-floating-ui-focusable";function i8(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=XE(),s=U.useRef({}),[i]=U.useState(()=>e8()),c=r8()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!de(p)&&JE("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=U.useState(r.reference),u=Jp((p,h,b)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:b,nested:c}),n==null||n(p,h,b)}),f=U.useMemo(()=>({setPositionReference:l}),[]),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:u,elements:d,events:i,floatingId:o,refs:f}),[t,u,d,i,o,f])}function a8(e){e===void 0&&(e={});const{nodeId:t}=e,n=i8({...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),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),d=o8();sl(()=>{u&&(f.current=u)},[u]);const p=Kp({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(w=>{const $=de(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),contextElement:w}:w;a($),p.refs.setReference($)},[p.refs]),b=U.useCallback(w=>{(de(w)||w===null)&&(f.current=w,i(w)),(de(p.refs.reference.current)||p.refs.reference.current===null||w!==null&&!de(w))&&p.refs.setReference(w)},[p.refs]),S=U.useMemo(()=>({...p.refs,setReference:b,setPositionReference:h,domReference:f}),[p.refs,b,h]),P=U.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),x=U.useMemo(()=>({...p,...r,refs:S,elements:P,nodeId:t}),[p,S,P,t,r]);return sl(()=>{r.dataRef.current.floatingContext=x;const w=d==null?void 0:d.nodesRef.current.find($=>$.id===t);w&&(w.context=x)}),U.useMemo(()=>({...p,context:x,refs:S,elements:P}),[p,S,P,x])}const nh="active",rh="selected";function il(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[nh]:i,[rh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[s8]:""},...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[l,u]=a;if(!(o&&[nh,rh].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var d,p=arguments.length,h=new Array(p),b=0;b<p;b++)h[b]=arguments[b];return(d=r.get(l))==null?void 0:d.map(S=>S(...h)).find(S=>S!==void 0)}}}else i[l]=u}),i),{})}}function c8(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=>il(c,e,"reference"),t),s=U.useCallback(c=>il(c,e,"floating"),n),i=U.useCallback(c=>il(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function oh(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const l8=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:l,...u}=Jn(e,t),{rects:f,elements:{floating:d}}=t,p=n.current[i],h=(l==null?void 0:l.current)||d,b=d.clientTop||h.clientTop,S=d.clientTop!==0,P=h.clientTop!==0,x=d===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||QE('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const w={...t,...await ol(-p.offsetTop-d.clientTop-f.reference.height/2-p.offsetHeight/2-s).fn(t)},$=await nl(oh(w,h.scrollHeight+b+d.clientTop),u),k=await nl(w,{...u,elementContext:"reference"}),B=ke(0,$.top),F=w.y+B,v=(h.scrollHeight>h.clientHeight?A=>A:Vo)(ke(0,h.scrollHeight+(S&&x||P?b*2:0)-B-ke(0,$.bottom)));if(h.style.maxHeight=v+"px",h.scrollTop=B,o){const A=h.offsetHeight<p.offsetHeight*un(c,n.current.length)-1||k.top>=-a||k.bottom>=-a;zr.flushSync(()=>o(A))}return r&&(r.current=await nl(oh({...w,y:F},h.offsetHeight+b+d.clientTop),u)),{y:F}}});function u8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Jp(c),l=U.useRef(!1),u=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function p(b){if(b.ctrlKey||!h||s.current==null)return;const S=b.deltaY,P=s.current.top>=-.5,x=s.current.bottom>=-.5,w=h.scrollHeight-h.clientHeight,$=S<0?-1:1,k=S<0?"max":"min";h.scrollHeight<=h.clientHeight||(!P&&S>0||!x&&S<0?(b.preventDefault(),zr.flushSync(()=>{a(B=>B+Math[k](S,w*$))})):/firefox/i.test(W2())&&(h.scrollTop+=S))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",p),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{u.current=null,f.current=null,h.removeEventListener("wheel",p)}},[o,n,r.floating,s,i,a]);const d=U.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const p=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!p||!l.current)){if(u.current!==null){const h=p.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&zr.flushSync(()=>a(b=>b+h))}requestAnimationFrame(()=>{u.current=p.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:d}:{},[o,d])}let kr=E.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});kr.displayName="FloatingContext";let al=E.createContext(null);al.displayName="PlacementContext";function f8(e){return E.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function d8(){return E.useContext(kr).setReference}function p8(){return E.useContext(kr).getReferenceProps}function h8(){let{getFloatingProps:e,slot:t}=E.useContext(kr);return E.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function m8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=E.useContext(al),n=E.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Ee(()=>{t==null||t(n??null)},[t,n]);let r=E.useContext(kr);return E.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let sh=4;function b8({children:e,enabled:t=!0}){let[n,r]=E.useState(null),[o,s]=E.useState(0),i=E.useRef(null),[c,a]=E.useState(null);g8(c);let l=t&&n!==null&&c!==null,{to:u="bottom",gap:f=0,offset:d=0,padding:p=0,inner:h}=y8(n,c),[b,S="center"]=u.split(" ");Ee(()=>{l&&s(0)},[l]);let{refs:P,floatingStyles:x,context:w}=a8({open:l,placement:b==="selection"?S==="center"?"bottom":`bottom-${S}`:S==="center"?`${b}`:`${b}-${S}`,strategy:"absolute",transform:!1,middleware:[ol({mainAxis:b==="selection"?0:f,crossAxis:d}),Yp({padding:p}),b!=="selection"&&Xp({padding:p}),b==="selection"&&h?l8({...h,padding:p,overflowRef:i,offset:o,minItemsVisible:sh,referenceOverflowThreshold:p,onFallbackChange(A){var N,O;if(!A)return;let D=w.elements.floating;if(!D)return;let y=parseFloat(getComputedStyle(D).scrollPaddingBottom)||0,C=Math.min(sh,D.childElementCount),I=0,T=0;for(let L of(O=(N=w.elements.floating)==null?void 0:N.childNodes)!=null?O:[])if(an(L)){let j=L.offsetTop,z=j+L.clientHeight+y,_=D.scrollTop,W=_+D.clientHeight;if(j>=_&&z<=W)C--;else{T=Math.max(0,Math.min(z,W)-Math.max(j,_)),I=L.clientHeight;break}}C>=1&&s(L=>{let j=I*C-T+y;return L>=j?L:j})}}):null,GE({padding:p,apply({availableWidth:A,availableHeight:N,elements:O}){Object.assign(O.floating.style,{overflow:"auto",maxWidth:`${A}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${N}px)`})}})].filter(Boolean),whileElementsMounted:Vp}),[$=b,k=S]=w.placement.split("-");b==="selection"&&($="selection");let B=E.useMemo(()=>({anchor:[$,k].filter(Boolean).join(" ")}),[$,k]),F=u8(w,{overflowRef:i,onChange:s}),{getReferenceProps:m,getFloatingProps:g}=c8([F]),v=fe(A=>{a(A),P.setFloating(A)});return U.createElement(al.Provider,{value:r},U.createElement(kr.Provider,{value:{setFloating:v,setReference:P.setReference,styles:x,getReferenceProps:m,getFloatingProps:g,slot:B}},e))}function g8(e){Ee(()=>{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 y8(e,t){var n,r,o;let s=cl((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=cl((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=cl((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function cl(e,t,n=void 0){let r=Kn(),o=fe((a,l)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!l)return[n,null];let u=ah(a,l);return[u,f=>{let d=ih(a);{let p=d.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let b=!1;for(let[P,x]of d.entries()){let w=window.getComputedStyle(l).getPropertyValue(x);if(p[P]!==w){p[P]=w,b=!0;break}}if(!b)return;let S=ah(a,l);u!==S&&(f(S),u=S)})}return r.dispose}]}return[n,null]}),s=E.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=E.useState();return Ee(()=>{let[a,l]=o(e,t);if(c(a),!!l)return l(c)},[e,t]),i}function ih(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,...ih(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 v8({children:e,freeze:t},n){let r=ch(t,e);return E.isValidElement(r)?E.cloneElement(r,{ref:n}):E.createElement(E.Fragment,null,r)}E.forwardRef(v8);function ch(e,t){let[n,r]=E.useState(t);return!e&&n!==t&&r(t),e?n:t}let ll=E.createContext(null);ll.displayName="OpenClosedContext";var Dt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Dt||{});function ul(){return E.useContext(ll)}function lh({value:e,children:t}){return E.createElement(ll.Provider,{value:e},t)}function w8(e){throw new Error("Unexpected object: "+e)}var we=(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))(we||{});function li(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:w8(e)}}function uh(e){let t=fe(e),n=E.useRef(!1);E.useEffect(()=>(n.current=!1,()=>{n.current=!0,O0(()=>{n.current&&t()})}),[t])}let x8=E.createContext(!1);function E8(){return E.useContext(x8)}function S8(e){let t=E8(),n=E.useContext(dh),[r,o]=E.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(_t.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return E.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),E.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let fh=E.Fragment,P8=qe(function(e,t){let{ownerDocument:n=null,...r}=e,o=E.useRef(null),s=ht(Bx(d=>{o.current=d}),t),i=Uc(o.current),c=n??i,a=S8(c),l=E.useContext(N8),u=Kn(),f=ot();return uh(()=>{var d;a&&a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a))}),a?je.createPortal(E.createElement("div",{"data-headlessui-portal":"",ref:d=>{u.dispose(),l&&d&&u.add(l.register(d))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:fh,name:"Portal"})),a):null});function T8(e,t){let n=ht(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=ot();return r?E.createElement(P8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:fh,name:"Portal"})}let $8=E.Fragment,dh=E.createContext(null);function A8(e,t){let{target:n,...r}=e,o={ref:ht(t)},s=ot();return E.createElement(dh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:$8,name:"Popover.Group"}))}let N8=E.createContext(null),C8=qe(T8),O8=qe(A8),I8=Object.assign(C8,{Group:O8});const ui={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function ph(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function D8(e,t,n){let r=rt();if(t.kind==="Tracked"){let o=function(){s!==ph(e)&&(r.dispose(),n())},{position:s}=t,i=new ResizeObserver(o);i.observe(e),r.add(()=>i.disconnect()),r.addEventListener(window,"scroll",o,{passive:!0}),r.addEventListener(window,"resize",o)}return()=>r.dispose()}function M8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function hh(){let e=M8(),[t,n]=U.useState(_t.isHandoffComplete);return t&&_t.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>_t.handoff(),[]),e?!1:t}function k8(){let e=E.useRef(!1);return Ee(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function mh(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!_o((t=e.as)!=null?t:gh)||E.Children.count(e.children)===1}let fi=E.createContext(null);fi.displayName="TransitionContext";var L8=(e=>(e.Visible="visible",e.Hidden="hidden",e))(L8||{});function B8(){let e=E.useContext(fi);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function F8(){let e=E.useContext(di);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let di=E.createContext(null);di.displayName="NestingContext";function pi(e){return"children"in e?pi(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function bh(e,t){let n=Yn(e),r=E.useRef([]),o=k8(),s=Kn(),i=fe((p,h=An.Hidden)=>{let b=r.current.findIndex(({el:S})=>S===p);b!==-1&&(pt(h,{[An.Unmount](){r.current.splice(b,1)},[An.Hidden](){r.current[b].state="hidden"}}),s.microTask(()=>{var S;!pi(r)&&o.current&&((S=n.current)==null||S.call(n))}))}),c=fe(p=>{let h=r.current.find(({el:b})=>b===p);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:p,state:"visible"}),()=>i(p,An.Unmount)}),a=E.useRef([]),l=E.useRef(Promise.resolve()),u=E.useRef({enter:[],leave:[]}),f=fe((p,h,b)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([S])=>S!==p)),t==null||t.chains.current[h].push([p,new Promise(S=>{a.current.push(S)})]),t==null||t.chains.current[h].push([p,new Promise(S=>{Promise.all(u.current[h].map(([P,x])=>x)).then(()=>S())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(h)):b(h)}),d=fe((p,h,b)=>{Promise.all(u.current[h].splice(0).map(([S,P])=>P)).then(()=>{var S;(S=a.current.shift())==null||S()}).then(()=>b(h))});return E.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:d,wait:l,chains:u}),[c,i,r,f,d,u,l])}let gh=E.Fragment,yh=Gs.RenderStrategy;function R8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:l,enterFrom:u,enterTo:f,entered:d,leave:p,leaveFrom:h,leaveTo:b,...S}=e,[P,x]=E.useState(null),w=E.useRef(null),$=mh(e),k=ht(...$?[w,t,x]:t===null?[]:[t]),B=(n=S.unmount)==null||n?An.Unmount:An.Hidden,{show:F,appear:m,initial:g}=B8(),[v,A]=E.useState(F?"visible":"hidden"),N=F8(),{register:O,unregister:D}=N;Ee(()=>O(w),[O,w]),Ee(()=>{if(B===An.Hidden&&w.current){if(F&&v!=="visible"){A("visible");return}return pt(v,{hidden:()=>D(w),visible:()=>O(w)})}},[v,w,O,D,F,B]);let y=hh();Ee(()=>{if($&&y&&v==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,v,y,$]);let C=g&&!m,I=m&&F&&g,T=E.useRef(!1),L=bh(()=>{T.current||(A("hidden"),D(w))},N),j=fe(q=>{T.current=!0;let Q=q?"enter":"leave";L.onStart(w,Q,ee=>{ee==="enter"?s==null||s():ee==="leave"&&(c==null||c())})}),z=fe(q=>{let Q=q?"enter":"leave";T.current=!1,L.onStop(w,Q,ee=>{ee==="enter"?i==null||i():ee==="leave"&&(a==null||a())}),Q==="leave"&&!pi(L)&&(A("hidden"),D(w))});E.useEffect(()=>{$&&o||(j(F),z(F))},[F,$,o]);let _=!(!o||!$||!y||C),[,W]=wp(_,P,F,{start:j,end:z}),K=Nn({ref:k,className:((r=Ac(S.className,I&&l,I&&u,W.enter&&l,W.enter&&W.closed&&u,W.enter&&!W.closed&&f,W.leave&&p,W.leave&&!W.closed&&h,W.leave&&W.closed&&b,!W.transition&&F&&d))==null?void 0:r.trim())||void 0,...vp(W)}),G=0;v==="visible"&&(G|=Dt.Open),v==="hidden"&&(G|=Dt.Closed),F&&v==="hidden"&&(G|=Dt.Opening),!F&&v==="visible"&&(G|=Dt.Closing);let H=ot();return E.createElement(di.Provider,{value:L},E.createElement(lh,{value:G},H({ourProps:K,theirProps:S,defaultTag:gh,features:yh,visible:v==="visible",name:"Transition.Child"})))}function j8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=E.useRef(null),c=mh(e),a=ht(...c?[i,t]:t===null?[]:[t]);hh();let l=ul();if(n===void 0&&l!==null&&(n=(l&Dt.Open)===Dt.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=E.useState(n?"visible":"hidden"),d=bh(()=>{n||f("hidden")}),[p,h]=E.useState(!0),b=E.useRef([n]);Ee(()=>{p!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),h(!1))},[b,n]);let S=E.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);Ee(()=>{n?f("visible"):!pi(d)&&i.current!==null&&f("hidden")},[n,d]);let P={unmount:o},x=fe(()=>{var k;p&&h(!1),(k=e.beforeEnter)==null||k.call(e)}),w=fe(()=>{var k;p&&h(!1),(k=e.beforeLeave)==null||k.call(e)}),$=ot();return E.createElement(di.Provider,{value:d},E.createElement(fi.Provider,{value:S},$({ourProps:{...P,as:E.Fragment,children:E.createElement(vh,{ref:a,...P,...s,beforeEnter:x,beforeLeave:w})},theirProps:{},defaultTag:E.Fragment,features:yh,visible:u==="visible",name:"Transition"})))}function _8(e,t){let n=E.useContext(fi)!==null,r=ul()!==null;return E.createElement(E.Fragment,null,!n&&r?E.createElement(fl,{ref:t,...e}):E.createElement(vh,{ref:t,...e}))}let fl=qe(j8),vh=qe(R8),z8=qe(_8),dl=Object.assign(fl,{Child:z8,Root:fl}),wh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function xh(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!an(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 wh.test(i)&&(i=i.replace(wh,"")),i}function U8(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():xh(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return xh(e).trim()}function W8(e){let t=E.useRef(""),n=E.useRef("");return fe(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=U8(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var H8=Object.defineProperty,V8=(e,t,n)=>t in e?H8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Eh=(e,t,n)=>(V8(e,typeof t!="symbol"?t+"":t,n),n),Le=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Le||{}),In=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(In||{}),hi=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(hi||{}),Sh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.SelectOption=5]="SelectOption",e[e.RegisterOptions=6]="RegisterOptions",e[e.UnregisterOptions=7]="UnregisterOptions",e[e.SetButtonElement=8]="SetButtonElement",e[e.SetOptionsElement=9]="SetOptionsElement",e[e.SortOptions=10]="SortOptions",e[e.MarkButtonAsMoved=11]="MarkButtonAsMoved",e))(Sh||{});function Ph(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=up(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 G8={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?ui.Tracked(ph(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:we.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:t}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,frozenValue:!1,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1,buttonPositionState:ui.Idle}},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===we.Nothing)return{...c,activeOptionIndex:null};if(t.focus===we.Specific)return{...c,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===we.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,d=li(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===we.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,d=li(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=Ph(e),l=li(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...c,...a,activeOptionIndex:l}},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){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==we.Nothing&&(r=li(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:we.Nothing},pendingShouldSort:!0}},7:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},8:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},9:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},10:e=>e.pendingShouldSort?{...e,...Ph(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:ui.Moved}}};class pl extends Q0{constructor(t){super(t),Eh(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return pt(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(l=>o(l,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:Mc(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:6,options:n.splice(0)}))]}),unregisterOption:Mc(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Mc(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{var n;if(this.state.activeOptionIndex!==null){let{dataRef:r}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(r.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(n=this.state.buttonElement)==null||n.focus({preventScroll:!0}))},selectOption:n=>{this.send({type:5,value:n})},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:8,element:n})},setOptionsElement:n=>{this.send({type:9,element:n})}}),Eh(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,r=kc.get(null);this.disposables.add(r.on(np.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}this.disposables.group(n=>{this.on(1,r=>{r.buttonElement&&(n.dispose(),n.add(D8(r.buttonElement,r.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(n,r)=>{var o;this.actions.onChange(r.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(o=this.state.buttonElement)==null||o.focus({preventScroll:!0}))})}static new({id:t,__demoMode:n=!1}){return new pl({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:we.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:ui.Idle})}reduce(t,n){return pt(n.type,G8,t,n)}}const Th=E.createContext(null);function hl(e){let t=E.useContext(Th);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,$h),n}return t}function $h({id:e,__demoMode:t=!1}){let n=E.useMemo(()=>pl.new({id:e,__demoMode:t}),[]);return uh(()=>n.dispose()),n}let mi=E.createContext(null);mi.displayName="ListboxDataContext";function Zo(e){let t=E.useContext(mi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Zo),n}return t}let q8=E.Fragment;function Z8(e,t){let n=E.useId(),r=$c(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:l,invalid:u=!1,disabled:f=r||!1,horizontal:d=!1,multiple:p=!1,__demoMode:h=!1,...b}=e;const S=d?"horizontal":"vertical";let P=ht(t),x=xx(s),[w=p?[]:void 0,$]=wx(o,a,x),k=$h({id:n,__demoMode:h}),B=E.useRef({static:!1,hold:!1}),F=E.useRef(new Map),m=qx(l),g=E.useCallback(_=>pt(v.mode,{[In.Multi]:()=>w.some(W=>m(W,_)),[In.Single]:()=>m(w,_)}),[w]),v=$n({value:w,disabled:f,invalid:u,mode:p?In.Multi:In.Single,orientation:S,onChange:$,compare:m,isSelected:g,optionsPropsRef:B,listRef:F});Ee(()=>{k.state.dataRef.current=v},[v]);let A=Ze(k,_=>_.listboxState),N=kc.get(null),O=Ze(N,E.useCallback(_=>N.selectors.isTop(_,n),[N,n])),[D,y]=Ze(k,_=>[_.buttonElement,_.optionsElement]);w2(O,[D,y],(_,W)=>{k.send({type:Sh.CloseListbox}),lp(W,zc.Loose)||(_.preventDefault(),D==null||D.focus())});let C=$n({open:A===Le.Open,disabled:f,invalid:u,value:w}),[I,T]=zx({inherit:!0}),L={ref:P},j=E.useCallback(()=>{if(x!==void 0)return $==null?void 0:$(x)},[$,x]),z=ot();return E.createElement(T,{value:I,props:{htmlFor:D==null?void 0:D.id},slot:{open:A===Le.Open,disabled:f}},E.createElement(b8,null,E.createElement(Th.Provider,{value:k},E.createElement(mi.Provider,{value:v},E.createElement(lh,{value:pt(A,{[Le.Open]:Dt.Open,[Le.Closed]:Dt.Closed})},c!=null&&w!=null&&E.createElement(Nx,{disabled:f,data:{[c]:w},form:i,onReset:j}),z({ourProps:L,theirProps:b,slot:C,defaultTag:q8,name:"Listbox"}))))))}let K8="button";function Y8(e,t){let n=E.useId(),r=F0(),o=Zo("Listbox.Button"),s=hl("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...l}=e,u=ht(t,d8(),s.actions.setButtonElement),f=p8(),[d,p,h]=Ze(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),b=d===Le.Open;S2(b,{trigger:p,action:E.useCallback(y=>{if(p!=null&&p.contains(y.target))return Ys.Ignore;let C=y.target.closest('[role="option"]:not([data-disabled])');return an(C)?Ys.Select(C):h!=null&&h.contains(y.target)?Ys.Ignore:Ys.Close},[p,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let S=fe(y=>{switch(y.key){case Ie.Enter:Ex(y.currentTarget);break;case Ie.Space:case Ie.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?we.Nothing:we.First});break;case Ie.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?we.Nothing:we.Last});break}}),P=fe(y=>{switch(y.key){case Ie.Space:y.preventDefault();break}}),x=Kx(y=>{var C;s.state.listboxState===Le.Open?(je.flushSync(()=>s.actions.closeListbox()),(C=s.state.buttonElement)==null||C.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:we.Nothing}))}),w=fe(y=>y.preventDefault()),$=G0([i]),k=Fx(),{isFocusVisible:B,focusProps:F}=ix({autoFocus:a}),{isHovered:m,hoverProps:g}=sx({isDisabled:c}),{pressed:v,pressProps:A}=px({disabled:c}),N=$n({open:d===Le.Open,active:v||d===Le.Open,disabled:c,invalid:o.invalid,value:o.value,hover:m,focus:B,autofocus:a}),O=Ze(s,y=>y.listboxState===Le.Open),D=D0(f(),{ref:u,id:i,type:P2(e,p),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":O,"aria-labelledby":$,"aria-describedby":k,disabled:c||void 0,autoFocus:a,onKeyDown:S,onKeyUp:P,onKeyPress:w},x,F,g,A);return ot()({ourProps:D,theirProps:l,slot:N,defaultTag:K8,name:"Listbox.Button"})}let Ah=E.createContext(!1),X8="div",Q8=Gs.RenderStrategy|Gs.Static;function J8(e,t){let n=E.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,l=f8(o),[u,f]=E.useState(null);l&&(s=!0);let d=Zo("Listbox.Options"),p=hl("Listbox.Options"),[h,b,S,P]=Ze(p,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),x=Uc(b),w=Uc(S),$=ul(),[k,B]=wp(c,u,$!==null?($&Dt.Open)===Dt.Open:h===Le.Open);c2(k,b,p.actions.closeListbox);let F=P?!1:i&&h===Le.Open;I2(F,w);let m=P?!1:i&&h===Le.Open;a2(m,{allowed:E.useCallback(()=>[b,S],[b,S])});let g=Ze(p,p.selectors.didButtonMove)?!1:k,v=Ze(p,p.selectors.hasFrozenValue)&&!e.static,A=ch(v,d.value),N=E.useCallback(H=>d.compare(A,H),[d.compare,A]),O=Ze(p,H=>{var q;if(l==null||!((q=l==null?void 0:l.to)!=null&&q.includes("selection")))return null;let Q=H.options.findIndex(ee=>N(ee.dataRef.current.value));return Q===-1&&(Q=0),Q}),D=(()=>{if(l==null)return;if(O===null)return{...l,inner:void 0};let H=Array.from(d.listRef.current.values());return{...l,inner:{listRef:{current:H},index:O}}})(),[y,C]=m8(D),I=h8(),T=ht(t,l?y:null,p.actions.setOptionsElement,f),L=Kn();E.useEffect(()=>{let H=S;H&&h===Le.Open&&(ux(H)||H==null||H.focus({preventScroll:!0}))},[h,S]);let j=fe(H=>{var q;switch(L.dispose(),H.key){case Ie.Space:if(p.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),p.actions.search(H.key);case Ie.Enter:H.preventDefault(),H.stopPropagation(),p.actions.selectActiveOption();break;case pt(d.orientation,{vertical:Ie.ArrowDown,horizontal:Ie.ArrowRight}):return H.preventDefault(),H.stopPropagation(),p.actions.goToOption({focus:we.Next});case pt(d.orientation,{vertical:Ie.ArrowUp,horizontal:Ie.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),p.actions.goToOption({focus:we.Previous});case Ie.Home:case Ie.PageUp:return H.preventDefault(),H.stopPropagation(),p.actions.goToOption({focus:we.First});case Ie.End:case Ie.PageDown:return H.preventDefault(),H.stopPropagation(),p.actions.goToOption({focus:we.Last});case Ie.Escape:H.preventDefault(),H.stopPropagation(),je.flushSync(()=>p.actions.closeListbox()),(q=p.state.buttonElement)==null||q.focus({preventScroll:!0});return;case Ie.Tab:H.preventDefault(),H.stopPropagation(),je.flushSync(()=>p.actions.closeListbox()),b2(p.state.buttonElement,H.shiftKey?_c.Previous:_c.Next);break;default:H.key.length===1&&(p.actions.search(H.key),L.setTimeout(()=>p.actions.clearSearch(),350));break}}),z=Ze(p,H=>{var q;return(q=H.buttonElement)==null?void 0:q.id}),_=$n({open:h===Le.Open}),W=D0(l?I():{},{id:r,ref:T,"aria-activedescendant":Ze(p,p.selectors.activeDescendantId),"aria-multiselectable":d.mode===In.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":d.orientation,onKeyDown:j,role:"listbox",tabIndex:h===Le.Open?0:void 0,style:{...a.style,...C,"--button-width":Zx(k,b,!0).width},...vp(B)}),K=ot(),G=E.useMemo(()=>d.mode===In.Multi?d:{...d,isSelected:N},[d,N]);return E.createElement(I8,{enabled:s?e.static||k:!1,ownerDocument:x},E.createElement(mi.Provider,{value:G},K({ourProps:W,theirProps:a,slot:_,defaultTag:X8,features:Q8,visible:g,name:"Listbox.Options"})))}let e3="div";function t3(e,t){let n=E.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=E.useContext(Ah)===!0,a=Zo("Listbox.Option"),l=hl("Listbox.Option"),u=Ze(l,v=>l.selectors.isActive(v,r)),f=a.isSelected(s),d=E.useRef(null),p=W8(d),h=Yn({disabled:o,value:s,domRef:d,get textValue(){return p()}}),b=ht(t,d,v=>{v?a.listRef.current.set(r,v):a.listRef.current.delete(r)}),S=Ze(l,v=>l.selectors.shouldScrollIntoView(v,r));Ee(()=>{if(S)return rt().requestAnimationFrame(()=>{var v,A;(A=(v=d.current)==null?void 0:v.scrollIntoView)==null||A.call(v,{block:"nearest"})})},[S,d]),Ee(()=>{if(!c)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,c]);let P=fe(v=>{if(o)return v.preventDefault();l.actions.selectOption(s)}),x=fe(()=>{if(o)return l.actions.goToOption({focus:we.Nothing});l.actions.goToOption({focus:we.Specific,id:r})}),w=D2(),$=fe(v=>w.update(v)),k=fe(v=>{w.wasMoved(v)&&(o||u&&l.state.activationTrigger===hi.Pointer||l.actions.goToOption({focus:we.Specific,id:r},hi.Pointer))}),B=fe(v=>{w.wasMoved(v)&&(o||u&&l.state.activationTrigger===hi.Pointer&&l.actions.goToOption({focus:we.Nothing}))}),F=$n({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&c}),m=c?{}:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:P,onFocus:x,onPointerEnter:$,onMouseEnter:$,onPointerMove:k,onMouseMove:k,onPointerLeave:B,onMouseLeave:B},g=ot();return!f&&c?null:g({ourProps:m,theirProps:i,slot:F,defaultTag:e3,name:"Listbox.Option"})}let n3=E.Fragment;function r3(e,t){let{options:n,placeholder:r,...o}=e,s={ref:ht(t)},i=Zo("ListboxSelectedOption"),c=$n({}),a=i.value===void 0||i.value===null||i.mode===In.Multi&&Array.isArray(i.value)&&i.value.length===0,l=ot();return E.createElement(Ah.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:E.createElement(E.Fragment,null,r&&a?r:n)},slot:c,defaultTag:n3,name:"ListboxSelectedOption"}))}let o3=qe(Z8),s3=qe(Y8),i3=Vx,a3=qe(J8),c3=qe(t3),l3=qe(r3),gt=Object.assign(o3,{Button:s3,Label:i3,Options:a3,Option:c3,SelectedOption:l3});const u3=()=>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)"})})})]}),f3=()=>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)"})})})]}),Ko=({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(u3,{}):M.jsx(f3,{})},o))})};class Mt{}ns(Mt,"FAST",3),ns(Mt,"Medium",2),ns(Mt,"SLOW",1),ns(Mt,"NONE",0);const d3=Object.values({MAINNET:1,SEPOLIA:11155111}),dn=e=>{const t=typeof e=="string"?parseInt(e,10):e;return d3.includes(t)},p3={USDT:!0},Nh=(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:!p3[t.toUpperCase()]:!0},h3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=Et();return M.jsx("div",{className:`relative ${o}`,children:M.jsx(gt,{value:t,onChange:n,disabled:r,children:({open:c})=>M.jsxs(M.Fragment,{children:[M.jsxs(gt.Button,{className:`
140
140
  relative w-full h-9 text-text-primary bg-fill-input-primary
141
141
  items-center justify-between flex px-3 rounded-lg
142
142
  focus:outline-none
143
143
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
144
144
  ${c?"ring-1 ring-white":""}
145
- `,children:[D.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),D.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?D.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):D.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:D.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),D.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),D.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${c?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[D.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:D.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"})}),D.jsx("defs",{children:D.jsx("clipPath",{id:"clip0_12919_27745",children:D.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),D.jsx(fl,{as:E.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:D.jsx(gt.Options,{className:`
145
+ `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("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 ${c?"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(dl,{as:E.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:M.jsx(gt.Options,{className:`
146
146
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
147
147
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
148
148
  focus:outline-none
149
- `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>D.jsx(gt.Option,{value:a,className:({active:l,selected:u})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-fill-btn-secondary":l?"bg-fill-input-secondary":""}`,children:({selected:l,active:u})=>D.jsx(D.Fragment,{children:D.jsxs("div",{className:"flex items-center justify-between",children:[D.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?D.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):D.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:D.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),D.jsx("div",{className:"flex flex-col",children:D.jsx("span",{className:`text-sm font-medium ${l||u?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),D.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:D.jsx(Ko,{className:"w-full justify-between",selectedLevel:dn(a.chainId)?Dt.SLOW:Dt.FAST,maxLevel:3})})]})})},a.chainId))})})]})})})},p3=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s,accountType:i})=>{const{t:c}=Et(),a=l=>l.token||l.symbol;return D.jsx("div",{className:`relative ${o}`,children:D.jsx(gt,{value:t,onChange:n,disabled:r,children:({open:l})=>D.jsxs(D.Fragment,{children:[D.jsxs(gt.Button,{className:`
149
+ `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>M.jsx(gt.Option,{value:a,className:({active:l,selected:u})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-fill-btn-secondary":l?"bg-fill-input-secondary":""}`,children:({selected:l,active:u})=>M.jsx(M.Fragment,{children:M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?M.jsx("img",{src:a.chainIconUrl,alt:a.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:a.chain.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${l||u?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),M.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:M.jsx(Ko,{className:"w-full justify-between",selectedLevel:dn(a.chainId)?Mt.SLOW:Mt.FAST,maxLevel:3})})]})})},a.chainId))})})]})})})},m3=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s,accountType:i})=>{const{t:c}=Et(),a=l=>l.token||l.symbol;return M.jsx("div",{className:`relative ${o}`,children:M.jsx(gt,{value:t,onChange:n,disabled:r,children:({open:l})=>M.jsxs(M.Fragment,{children:[M.jsxs(gt.Button,{className:`
150
150
  relative w-full h-9 text-text-primary bg-fill-input-primary
151
151
  items-center justify-between flex px-3 rounded-lg
152
152
  focus:outline-none
153
153
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
154
154
  ${l?"ring-1 ring-white":""}
155
- `,children:[D.jsx("span",{className:"text-sm leading-[18px] font-medium",children:c("deposit.asset")}),D.jsxs("div",{className:"flex items-center space-x-2",children:[D.jsx("img",{src:t.iconUrl,alt:a(t),className:"w-4 h-4 rounded-full"}),D.jsx("span",{className:"text-sm text-white ml-1",children:a(t)}),D.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${l?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[D.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:D.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"})}),D.jsx("defs",{children:D.jsx("clipPath",{id:"clip0_asset_selector",children:D.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),D.jsx(fl,{as:E.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:D.jsx(gt.Options,{className:`
155
+ `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:c("deposit.asset")}),M.jsxs("div",{className:"flex items-center space-x-2",children:[M.jsx("img",{src:t.iconUrl,alt:a(t),className:"w-4 h-4 rounded-full"}),M.jsx("span",{className:"text-sm text-white ml-1",children:a(t)}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${l?"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_asset_selector)",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_asset_selector",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(dl,{as:E.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:M.jsx(gt.Options,{className:`
156
156
  absolute z-50 mt-1 w-full max-h-[230px] overflow-y-auto rounded-lg
157
157
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
158
158
  focus:outline-none
159
- `,children:e.map(u=>D.jsx(gt.Option,{value:u,className:({active:f,selected:d})=>`relative cursor-pointer select-none py-3 px-3 ${d?"bg-fill-btn-secondary":f?"bg-fill-input-secondary":""}`,children:({selected:f,active:d})=>D.jsxs("div",{className:"flex items-center space-x-3",children:[D.jsx("img",{src:u.iconUrl,alt:a(u),className:"w-5 h-5 rounded-full"}),D.jsxs("div",{className:"flex flex-col",children:[D.jsx("span",{className:`text-sm font-medium ${f||d?"text-text-primary":"text-text-tertiary"}`,children:a(u)}),s===Sn&&i==="perpetual"&&u.token==="USDC"&&D.jsx("p",{className:"mt-2 text-xs text-text-tertiary whitespace-pre-line",children:c("deposit.defaultSpotNotice")})]})]})},a(u)))})})]})})})},Nh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=Sn,txType:i="deposit",accountType:c})=>{const a=E.useCallback(S=>i==="withdraw"?s===Sn?S.allowAaWithdraw!==!1:S.allowWithdraw!==!1:s===Sn?S.allowAaDeposit!==!1:S.allowDeposit!==!1,[i,s]),l=E.useMemo(()=>{const S=new Set,P=[];for(const x of t)if(a(x))for(const w of x.tokenList||[]){const A=w.symbol||w.token;!A||!(i!=="withdraw"||w.withdrawEnable===!0&&w.pullOff===!1)||S.has(A)||(S.add(A),P.push({token:A,symbol:A,iconUrl:w.iconUrl,decimals:w.decimals,tokenAddress:w.tokenAddress}))}return P},[t,a,i]),u=S=>{n(S.chainId)},f=S=>{const P=S.symbol||S.token;o(P);const x=[];for(const w of t){if(!a(w))continue;(w.tokenList||[]).some(M=>(M.symbol||M.token)===P)&&x.push(w.chainId)}!x.includes(e.chainId)&&x[0]!==void 0&&n(x[0])},d=E.useMemo(()=>{var x,w;const S=r||((x=l[0])==null?void 0:x.symbol)||((w=l[0])==null?void 0:w.token);if(!S)return[];const P=[];for(const A of t){if(!a(A))continue;const M=(A.tokenList||[]).find(B=>(B.symbol||B.token)===S?i==="withdraw"?B.withdrawEnable===!0&&B.pullOff===!1:!0:!1);M&&P.push({...A,tokenList:[{token:M.token,symbol:M.symbol,iconUrl:M.iconUrl,decimals:M.decimals,tokenAddress:M.tokenAddress}]})}return P},[t,r,l,a,i]),p=E.useMemo(()=>d.find(S=>S.chainId===e.chainId)||d[0],[d,e.chainId]),h=E.useMemo(()=>l,[l]),b=E.useMemo(()=>{if(h.length!==0)return h.find(S=>S.token===r||S.symbol===r)||h[0]},[h,r]);return E.useEffect(()=>{if(h.length===0)return;if(!h.some(P=>(P.symbol||P.token)===r)){const P=h[0];o(P.symbol||P.token)}},[h,r,o]),E.useEffect(()=>{if(d.length===0)return;d.some(P=>P.chainId===e.chainId)||n(d[0].chainId)},[d,e.chainId,n]),D.jsxs("div",{className:"space-y-4",children:[h.length>0&&b&&D.jsx(p3,{tokens:h,selectedToken:b,onTokenChange:f,walletType:s,accountType:c}),D.jsx(d3,{chains:d,selectedChain:p,onChainChange:S=>{const P=t.find(x=>x.chainId===S.chainId);P&&u(P)},walletType:s,className:"w-full"})]})},h3=({options:e})=>D.jsx(D.Fragment,{children:e.map(t=>D.jsx(gt.Option,{value:t.value,className:({active:n,selected:r})=>`relative cursor-pointer select-none py-3 px-3 ${r?"bg-fill-btn-secondary":n?"bg-fill-input-secondary":""}`,children:({selected:n,active:r})=>D.jsx("div",{className:"flex items-center justify-between",children:D.jsx("div",{className:"flex items-center space-x-3",children:D.jsx("div",{className:"flex flex-col",children:D.jsx("span",{className:`text-sm font-medium ${n||r?"text-text-primary":"text-text-tertiary"}`,children:t.label})})})})},t.value))}),Ch=({selectedAccount:e,onAccountChange:t,disabled:n=!1,className:r=""})=>{var f;const{t:o}=Et(),s=E.useMemo(()=>[{value:"spot",label:o("account.spot")},{value:"perpetual",label:o("account.perpetual")}],[o]),i=((f=s.find(d=>d.value===(e??"spot")))==null?void 0:f.label)||"",[c,a]=E.useState(e??"spot"),l=e??c,u=d=>{t==null||t(d),e||a(d)};return D.jsx("div",{className:`relative mb-4 ${r}`,children:D.jsx(gt,{value:l,onChange:u,disabled:n,children:({open:d})=>D.jsxs(D.Fragment,{children:[D.jsxs(gt.Button,{className:`
159
+ `,children:e.map(u=>M.jsx(gt.Option,{value:u,className:({active:f,selected:d})=>`relative cursor-pointer select-none py-3 px-3 ${d?"bg-fill-btn-secondary":f?"bg-fill-input-secondary":""}`,children:({selected:f,active:d})=>M.jsxs("div",{className:"flex items-center space-x-3",children:[M.jsx("img",{src:u.iconUrl,alt:a(u),className:"w-5 h-5 rounded-full"}),M.jsxs("div",{className:"flex flex-col",children:[M.jsx("span",{className:`text-sm font-medium ${f||d?"text-text-primary":"text-text-tertiary"}`,children:a(u)}),s===Sn&&i==="perpetual"&&u.token==="USDC"&&M.jsx("p",{className:"mt-2 text-xs text-text-tertiary whitespace-pre-line",children:c("deposit.defaultSpotNotice")})]})]})},a(u)))})})]})})})},Ch=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=Sn,txType:i="deposit",accountType:c})=>{const a=E.useCallback(S=>i==="withdraw"?s===Sn?S.allowAaWithdraw!==!1:S.allowWithdraw!==!1:s===Sn?S.allowAaDeposit!==!1:S.allowDeposit!==!1,[i,s]),l=E.useMemo(()=>{const S=new Set,P=[];for(const x of t)if(a(x))for(const w of x.tokenList||[]){const $=w.symbol||w.token;!$||!(i!=="withdraw"||w.withdrawEnable===!0&&w.pullOff===!1)||S.has($)||(S.add($),P.push({token:$,symbol:$,iconUrl:w.iconUrl,decimals:w.decimals,tokenAddress:w.tokenAddress}))}return P},[t,a,i]),u=S=>{n(S.chainId)},f=S=>{const P=S.symbol||S.token;o(P);const x=[];for(const w of t){if(!a(w))continue;(w.tokenList||[]).some(k=>(k.symbol||k.token)===P)&&x.push(w.chainId)}!x.includes(e.chainId)&&x[0]!==void 0&&n(x[0])},d=E.useMemo(()=>{var x,w;const S=r||((x=l[0])==null?void 0:x.symbol)||((w=l[0])==null?void 0:w.token);if(!S)return[];const P=[];for(const $ of t){if(!a($))continue;const k=($.tokenList||[]).find(B=>(B.symbol||B.token)===S?i==="withdraw"?B.withdrawEnable===!0&&B.pullOff===!1:!0:!1);k&&P.push({...$,tokenList:[{token:k.token,symbol:k.symbol,iconUrl:k.iconUrl,decimals:k.decimals,tokenAddress:k.tokenAddress}]})}return P},[t,r,l,a,i]),p=E.useMemo(()=>d.find(S=>S.chainId===e.chainId)||d[0],[d,e.chainId]),h=E.useMemo(()=>l,[l]),b=E.useMemo(()=>{if(h.length!==0)return h.find(S=>S.token===r||S.symbol===r)||h[0]},[h,r]);return E.useEffect(()=>{if(h.length===0)return;if(!h.some(P=>(P.symbol||P.token)===r)){const P=h[0];o(P.symbol||P.token)}},[h,r,o]),E.useEffect(()=>{if(d.length===0)return;d.some(P=>P.chainId===e.chainId)||n(d[0].chainId)},[d,e.chainId,n]),M.jsxs("div",{className:"space-y-4",children:[h.length>0&&b&&M.jsx(m3,{tokens:h,selectedToken:b,onTokenChange:f,walletType:s,accountType:c}),M.jsx(h3,{chains:d,selectedChain:p,onChainChange:S=>{const P=t.find(x=>x.chainId===S.chainId);P&&u(P)},walletType:s,className:"w-full"})]})},b3=({options:e})=>M.jsx(M.Fragment,{children:e.map(t=>M.jsx(gt.Option,{value:t.value,className:({active:n,selected:r})=>`relative cursor-pointer select-none py-3 px-3 ${r?"bg-fill-btn-secondary":n?"bg-fill-input-secondary":""}`,children:({selected:n,active:r})=>M.jsx("div",{className:"flex items-center justify-between",children:M.jsx("div",{className:"flex items-center space-x-3",children:M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${n||r?"text-text-primary":"text-text-tertiary"}`,children:t.label})})})})},t.value))}),Oh=({selectedAccount:e,onAccountChange:t,disabled:n=!1,className:r=""})=>{var f;const{t:o}=Et(),s=E.useMemo(()=>[{value:"spot",label:o("account.spot")},{value:"perpetual",label:o("account.perpetual")}],[o]),i=((f=s.find(d=>d.value===(e??"spot")))==null?void 0:f.label)||"",[c,a]=E.useState(e??"spot"),l=e??c,u=d=>{t==null||t(d),e||a(d)};return M.jsx("div",{className:`relative mb-4 ${r}`,children:M.jsx(gt,{value:l,onChange:u,disabled:n,children:({open:d})=>M.jsxs(M.Fragment,{children:[M.jsxs(gt.Button,{className:`
160
160
  relative w-full h-9 text-text-primary bg-fill-input-primary
161
161
  items-center justify-between flex px-3 rounded-lg
162
162
  focus:outline-none
163
163
  ${n?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
164
164
  ${d?"ring-1 ring-white":""}
165
- `,children:[D.jsx("span",{className:"text-sm leading-[18px] font-medium",children:o("account.title")}),D.jsxs("div",{className:"flex items-center space-x-2",children:[D.jsx("span",{className:"text-sm text-white ml-1",children:i}),D.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${d?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[D.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:D.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"})}),D.jsx("defs",{children:D.jsx("clipPath",{id:"clip0_asset_selector",children:D.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),D.jsx(fl,{as:E.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:D.jsx(gt.Options,{className:`
165
+ `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:o("account.title")}),M.jsxs("div",{className:"flex items-center space-x-2",children:[M.jsx("span",{className:"text-sm text-white ml-1",children:i}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${d?"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_asset_selector)",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_asset_selector",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(dl,{as:E.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:M.jsx(gt.Options,{className:`
166
166
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
167
167
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
168
168
  focus:outline-none
169
- `,children:D.jsx(h3,{options:s})})})]})})})};var mi={},m3=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()}},b3=m3,Oh={"text/plain":"Text","text/html":"Url",default:"Text"},g3="Copy to clipboard: #{key}, Enter";function y3(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function v3(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=b3(),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(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=Oh[t.format]||Oh.default;window.clipboardData.setData(f,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");a=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(f){n&&console.error("unable to copy using clipboardData: ",f),n&&console.error("falling back to prompt"),r=y3("message"in t?t.message:g3),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var w3=v3;Object.defineProperty(mi,"__esModule",{value:!0}),mi.CopyToClipboard=void 0;var x3=Ih(w3),bi=Ih(E),E3=["text","onCopy","options","children"];function Ih(e){return e&&e.__esModule?e:{default:e}}function Lr(e){"@babel/helpers - typeof";return Lr=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},Lr(e)}function kh(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 Dh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kh(Object(n),!0).forEach(function(r){ml(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function S3(e,t){if(e==null)return{};var n,r,o=P3(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function P3(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function T3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A3(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,Lh(r.key),r)}}function $3(e,t,n){return t&&A3(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function N3(e,t,n){return t=gi(t),C3(e,Mh()?Reflect.construct(t,n||[],gi(e).constructor):t.apply(e,n))}function C3(e,t){if(t&&(Lr(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return O3(e)}function O3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mh(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Mh=function(){return!!e})()}function gi(e){return gi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gi(e)}function I3(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&&hl(e,t)}function hl(e,t){return hl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},hl(e,t)}function ml(e,t,n){return(t=Lh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lh(e){var t=k3(e,"string");return Lr(t)=="symbol"?t:t+""}function k3(e,t){if(Lr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Lr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var D3=mi.CopyToClipboard=function(e){function t(){var n;T3(this,t);for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=N3(this,t,[].concat(o)),ml(n,"onClick",function(i){var c=n.props,a=c.text,l=c.onCopy,u=c.children,f=c.options,d=bi.default.Children.only(u),p=(0,x3.default)(a,f);l&&l(a,p),d!=null&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(i)}),n}return I3(t,e),$3(t,[{key:"render",value:function(){var r=this.props;r.text,r.onCopy,r.options;var o=r.children,s=S3(r,E3),i=bi.default.Children.only(o);return bi.default.cloneElement(i,Dh(Dh({},s),{},{onClick:this.onClick}))}}])}(bi.default.PureComponent);ml(D3,"defaultProps",{onCopy:void 0,options:void 0});var M3=mi,bl=M3.CopyToClipboard;bl.CopyToClipboard=bl;var L3=bl;const B3=_m(L3);var F3=Object.defineProperty,yi=Object.getOwnPropertySymbols,Bh=Object.prototype.hasOwnProperty,Fh=Object.prototype.propertyIsEnumerable,Rh=(e,t,n)=>t in e?F3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gl=(e,t)=>{for(var n in t||(t={}))Bh.call(t,n)&&Rh(e,n,t[n]);if(yi)for(var n of yi(t))Fh.call(t,n)&&Rh(e,n,t[n]);return e},yl=(e,t)=>{var n={};for(var r in e)Bh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&yi)for(var r of yi(e))t.indexOf(r)<0&&Fh.call(e,r)&&(n[r]=e[r]);return n};/**
169
+ `,children:M.jsx(b3,{options:s})})})]})})})};var bi={},g3=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()}},y3=g3,Ih={"text/plain":"Text","text/html":"Url",default:"Text"},v3="Copy to clipboard: #{key}, Enter";function w3(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function x3(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=y3(),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(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=Ih[t.format]||Ih.default;window.clipboardData.setData(f,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");a=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(f){n&&console.error("unable to copy using clipboardData: ",f),n&&console.error("falling back to prompt"),r=w3("message"in t?t.message:v3),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var E3=x3;Object.defineProperty(bi,"__esModule",{value:!0}),bi.CopyToClipboard=void 0;var S3=Dh(E3),gi=Dh(E),P3=["text","onCopy","options","children"];function Dh(e){return e&&e.__esModule?e:{default:e}}function Lr(e){"@babel/helpers - typeof";return Lr=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},Lr(e)}function Mh(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?Mh(Object(n),!0).forEach(function(r){bl(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function T3(e,t){if(e==null)return{};var n,r,o=$3(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function $3(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function A3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N3(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,Bh(r.key),r)}}function C3(e,t,n){return t&&N3(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function O3(e,t,n){return t=yi(t),I3(e,Lh()?Reflect.construct(t,n||[],yi(e).constructor):t.apply(e,n))}function I3(e,t){if(t&&(Lr(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return D3(e)}function D3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lh(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Lh=function(){return!!e})()}function yi(e){return yi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yi(e)}function M3(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&&ml(e,t)}function ml(e,t){return ml=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ml(e,t)}function bl(e,t,n){return(t=Bh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bh(e){var t=k3(e,"string");return Lr(t)=="symbol"?t:t+""}function k3(e,t){if(Lr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Lr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var L3=bi.CopyToClipboard=function(e){function t(){var n;A3(this,t);for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=O3(this,t,[].concat(o)),bl(n,"onClick",function(i){var c=n.props,a=c.text,l=c.onCopy,u=c.children,f=c.options,d=gi.default.Children.only(u),p=(0,S3.default)(a,f);l&&l(a,p),d!=null&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(i)}),n}return M3(t,e),C3(t,[{key:"render",value:function(){var r=this.props;r.text,r.onCopy,r.options;var o=r.children,s=T3(r,P3),i=gi.default.Children.only(o);return gi.default.cloneElement(i,kh(kh({},s),{},{onClick:this.onClick}))}}])}(gi.default.PureComponent);bl(L3,"defaultProps",{onCopy:void 0,options:void 0});var B3=bi,gl=B3.CopyToClipboard;gl.CopyToClipboard=gl;var F3=gl;const R3=Um(F3);var j3=Object.defineProperty,vi=Object.getOwnPropertySymbols,Fh=Object.prototype.hasOwnProperty,Rh=Object.prototype.propertyIsEnumerable,jh=(e,t,n)=>t in e?j3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yl=(e,t)=>{for(var n in t||(t={}))Fh.call(t,n)&&jh(e,n,t[n]);if(vi)for(var n of vi(t))Rh.call(t,n)&&jh(e,n,t[n]);return e},vl=(e,t)=>{var n={};for(var r in e)Fh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&vi)for(var r of vi(e))t.indexOf(r)<0&&Rh.call(e,r)&&(n[r]=e[r]);return n};/**
170
170
  * @license QR Code generator library (TypeScript)
171
171
  * Copyright (c) Project Nayuki.
172
172
  * SPDX-License-Identifier: MIT
173
- */var tr;(e=>{const t=class ae{constructor(a,l,u,f){if(this.version=a,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],a<ae.MIN_VERSION||a>ae.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(u);if(this.drawCodewords(p),f==-1){let h=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);const S=this.getPenaltyScore();S<h&&(f=b,h=S),this.applyMask(b)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,l){const u=e.QrSegment.makeSegments(a);return ae.encodeSegments(u,l)}static encodeBinary(a,l){const u=e.QrSegment.makeBytes(a);return ae.encodeSegments([u],l)}static encodeSegments(a,l,u=1,f=40,d=-1,p=!0){if(!(ae.MIN_VERSION<=u&&u<=f&&f<=ae.MAX_VERSION)||d<-1||d>7)throw new RangeError("Invalid value");let h,b;for(h=u;;h++){const w=ae.getNumDataCodewords(h,l)*8,A=i.getTotalBits(a,h);if(A<=w){b=A;break}if(h>=f)throw new RangeError("Data too long")}for(const w of[ae.Ecc.MEDIUM,ae.Ecc.QUARTILE,ae.Ecc.HIGH])p&&b<=ae.getNumDataCodewords(h,w)*8&&(l=w);let S=[];for(const w of a){n(w.mode.modeBits,4,S),n(w.numChars,w.mode.numCharCountBits(h),S);for(const A of w.getData())S.push(A)}o(S.length==b);const P=ae.getNumDataCodewords(h,l)*8;o(S.length<=P),n(0,Math.min(4,P-S.length),S),n(0,(8-S.length%8)%8,S),o(S.length%8==0);for(let w=236;S.length<P;w^=253)n(w,8,S);let x=[];for(;x.length*8<S.length;)x.push(0);return S.forEach((w,A)=>x[A>>>3]|=w<<7-(A&7)),new ae(h,l,x,d)}getModule(a,l){return 0<=a&&a<this.size&&0<=l&&l<this.size&&this.modules[l][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),l=a.length;for(let u=0;u<l;u++)for(let f=0;f<l;f++)u==0&&f==0||u==0&&f==l-1||u==l-1&&f==0||this.drawAlignmentPattern(a[u],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const l=this.errorCorrectionLevel.formatBits<<3|a;let u=l;for(let d=0;d<10;d++)u=u<<1^(u>>>9)*1335;const f=(l<<10|u)^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 u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const l=this.version<<12|a;o(l>>>18==0);for(let u=0;u<18;u++){const f=r(l,u),d=this.size-11+u%3,p=Math.floor(u/3);this.setFunctionModule(d,p,f),this.setFunctionModule(p,d,f)}}drawFinderPattern(a,l){for(let u=-4;u<=4;u++)for(let f=-4;f<=4;f++){const d=Math.max(Math.abs(f),Math.abs(u)),p=a+f,h=l+u;0<=p&&p<this.size&&0<=h&&h<this.size&&this.setFunctionModule(p,h,d!=2&&d!=4)}}drawAlignmentPattern(a,l){for(let u=-2;u<=2;u++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,l+u,Math.max(Math.abs(f),Math.abs(u))!=1)}setFunctionModule(a,l,u){this.modules[l][a]=u,this.isFunction[l][a]=!0}addEccAndInterleave(a){const l=this.version,u=this.errorCorrectionLevel;if(a.length!=ae.getNumDataCodewords(l,u))throw new RangeError("Invalid argument");const f=ae.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l],d=ae.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l],p=Math.floor(ae.getNumRawDataModules(l)/8),h=f-p%f,b=Math.floor(p/f);let S=[];const P=ae.reedSolomonComputeDivisor(d);for(let w=0,A=0;w<f;w++){let M=a.slice(A,A+b-d+(w<h?0:1));A+=M.length;const B=ae.reedSolomonComputeRemainder(M,P);w<h&&M.push(0),S.push(M.concat(B))}let x=[];for(let w=0;w<S[0].length;w++)S.forEach((A,M)=>{(w!=b-d||M>=h)&&x.push(A[w])});return o(x.length==p),x}drawCodewords(a){if(a.length!=Math.floor(ae.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let f=0;f<this.size;f++)for(let d=0;d<2;d++){const p=u-d,b=(u+1&2)==0?this.size-1-f:f;!this.isFunction[b][p]&&l<a.length*8&&(this.modules[b][p]=r(a[l>>>3],7-(l&7)),l++)}}o(l==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let u=0;u<this.size;u++){let f;switch(a){case 0:f=(u+l)%2==0;break;case 1:f=l%2==0;break;case 2:f=u%3==0;break;case 3:f=(u+l)%3==0;break;case 4:f=(Math.floor(u/3)+Math.floor(l/2))%2==0;break;case 5:f=u*l%2+u*l%3==0;break;case 6:f=(u*l%2+u*l%3)%2==0;break;case 7:f=((u+l)%2+u*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][u]&&f&&(this.modules[l][u]=!this.modules[l][u])}}getPenaltyScore(){let a=0;for(let d=0;d<this.size;d++){let p=!1,h=0,b=[0,0,0,0,0,0,0];for(let S=0;S<this.size;S++)this.modules[d][S]==p?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),p||(a+=this.finderPenaltyCountPatterns(b)*ae.PENALTY_N3),p=this.modules[d][S],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,b)*ae.PENALTY_N3}for(let d=0;d<this.size;d++){let p=!1,h=0,b=[0,0,0,0,0,0,0];for(let S=0;S<this.size;S++)this.modules[S][d]==p?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),p||(a+=this.finderPenaltyCountPatterns(b)*ae.PENALTY_N3),p=this.modules[S][d],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,b)*ae.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+=ae.PENALTY_N2)}let l=0;for(const d of this.modules)l=d.reduce((p,h)=>p+(h?1:0),l);const u=this.size*this.size,f=Math.ceil(Math.abs(l*20-u*10)/u)-1;return o(0<=f&&f<=9),a+=f*ae.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let u=[6];for(let f=this.size-7;u.length<a;f-=l)u.splice(1,0,f);return u}}static getNumRawDataModules(a){if(a<ae.MIN_VERSION||a>ae.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*a+128)*a+64;if(a>=2){const u=Math.floor(a/7)+2;l-=(25*u-10)*u-55,a>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(a,l){return Math.floor(ae.getNumRawDataModules(a)/8)-ae.ECC_CODEWORDS_PER_BLOCK[l.ordinal][a]*ae.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let l=[];for(let f=0;f<a-1;f++)l.push(0);l.push(1);let u=1;for(let f=0;f<a;f++){for(let d=0;d<l.length;d++)l[d]=ae.reedSolomonMultiply(l[d],u),d+1<l.length&&(l[d]^=l[d+1]);u=ae.reedSolomonMultiply(u,2)}return l}static reedSolomonComputeRemainder(a,l){let u=l.map(f=>0);for(const f of a){const d=f^u.shift();u.push(0),l.forEach((p,h)=>u[h]^=ae.reedSolomonMultiply(p,d))}return u}static reedSolomonMultiply(a,l){if(a>>>8||l>>>8)throw new RangeError("Byte out of range");let u=0;for(let f=7;f>=0;f--)u=u<<1^(u>>>7)*285,u^=(l>>>f&1)*a;return o(u>>>8==0),u}finderPenaltyCountPatterns(a){const l=a[1];o(l<=this.size*3);const u=l>0&&a[2]==l&&a[3]==l*3&&a[4]==l&&a[5]==l;return(u&&a[0]>=l*4&&a[6]>=l?1:0)+(u&&a[6]>=l*4&&a[0]>=l?1:0)}finderPenaltyTerminateAndCount(a,l,u){return a&&(this.finderPenaltyAddHistory(l,u),l=0),l+=this.size,this.finderPenaltyAddHistory(l,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(a,l){l[0]==0&&(a+=this.size),l.pop(),l.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,l){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let u=a-1;u>=0;u--)l.push(c>>>u&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class xe{constructor(a,l,u){if(this.mode=a,this.numChars=l,this.bitData=u,l<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(a){let l=[];for(const u of a)n(u,8,l);return new xe(xe.Mode.BYTE,a.length,l)}static makeNumeric(a){if(!xe.isNumeric(a))throw new RangeError("String contains non-numeric characters");let l=[];for(let u=0;u<a.length;){const f=Math.min(a.length-u,3);n(parseInt(a.substring(u,u+f),10),f*3+1,l),u+=f}return new xe(xe.Mode.NUMERIC,a.length,l)}static makeAlphanumeric(a){if(!xe.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],u;for(u=0;u+2<=a.length;u+=2){let f=xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u))*45;f+=xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u+1)),n(f,11,l)}return u<a.length&&n(xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u)),6,l),new xe(xe.Mode.ALPHANUMERIC,a.length,l)}static makeSegments(a){return a==""?[]:xe.isNumeric(a)?[xe.makeNumeric(a)]:xe.isAlphanumeric(a)?[xe.makeAlphanumeric(a)]:[xe.makeBytes(xe.toUtf8ByteArray(a))]}static makeEci(a){let l=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,l);else if(a<16384)n(2,2,l),n(a,14,l);else if(a<1e6)n(6,3,l),n(a,21,l);else throw new RangeError("ECI assignment value out of range");return new xe(xe.Mode.ECI,0,l)}static isNumeric(a){return xe.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return xe.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,l){let u=0;for(const f of a){const d=f.mode.numCharCountBits(l);if(f.numChars>=1<<d)return 1/0;u+=4+d+f.bitData.length}return u}static toUtf8ByteArray(a){a=encodeURI(a);let l=[];for(let u=0;u<a.length;u++)a.charAt(u)!="%"?l.push(a.charCodeAt(u)):(l.push(parseInt(a.substring(u+1,u+3),16)),u+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(tr||(tr={})),(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={}))})(tr||(tr={})),(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={}))})(tr||(tr={}));var Br=tr;/**
173
+ */var tr;(e=>{const t=class ae{constructor(a,l,u,f){if(this.version=a,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],a<ae.MIN_VERSION||a>ae.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(u);if(this.drawCodewords(p),f==-1){let h=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);const S=this.getPenaltyScore();S<h&&(f=b,h=S),this.applyMask(b)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,l){const u=e.QrSegment.makeSegments(a);return ae.encodeSegments(u,l)}static encodeBinary(a,l){const u=e.QrSegment.makeBytes(a);return ae.encodeSegments([u],l)}static encodeSegments(a,l,u=1,f=40,d=-1,p=!0){if(!(ae.MIN_VERSION<=u&&u<=f&&f<=ae.MAX_VERSION)||d<-1||d>7)throw new RangeError("Invalid value");let h,b;for(h=u;;h++){const w=ae.getNumDataCodewords(h,l)*8,$=i.getTotalBits(a,h);if($<=w){b=$;break}if(h>=f)throw new RangeError("Data too long")}for(const w of[ae.Ecc.MEDIUM,ae.Ecc.QUARTILE,ae.Ecc.HIGH])p&&b<=ae.getNumDataCodewords(h,w)*8&&(l=w);let S=[];for(const w of a){n(w.mode.modeBits,4,S),n(w.numChars,w.mode.numCharCountBits(h),S);for(const $ of w.getData())S.push($)}o(S.length==b);const P=ae.getNumDataCodewords(h,l)*8;o(S.length<=P),n(0,Math.min(4,P-S.length),S),n(0,(8-S.length%8)%8,S),o(S.length%8==0);for(let w=236;S.length<P;w^=253)n(w,8,S);let x=[];for(;x.length*8<S.length;)x.push(0);return S.forEach((w,$)=>x[$>>>3]|=w<<7-($&7)),new ae(h,l,x,d)}getModule(a,l){return 0<=a&&a<this.size&&0<=l&&l<this.size&&this.modules[l][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),l=a.length;for(let u=0;u<l;u++)for(let f=0;f<l;f++)u==0&&f==0||u==0&&f==l-1||u==l-1&&f==0||this.drawAlignmentPattern(a[u],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const l=this.errorCorrectionLevel.formatBits<<3|a;let u=l;for(let d=0;d<10;d++)u=u<<1^(u>>>9)*1335;const f=(l<<10|u)^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 u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const l=this.version<<12|a;o(l>>>18==0);for(let u=0;u<18;u++){const f=r(l,u),d=this.size-11+u%3,p=Math.floor(u/3);this.setFunctionModule(d,p,f),this.setFunctionModule(p,d,f)}}drawFinderPattern(a,l){for(let u=-4;u<=4;u++)for(let f=-4;f<=4;f++){const d=Math.max(Math.abs(f),Math.abs(u)),p=a+f,h=l+u;0<=p&&p<this.size&&0<=h&&h<this.size&&this.setFunctionModule(p,h,d!=2&&d!=4)}}drawAlignmentPattern(a,l){for(let u=-2;u<=2;u++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,l+u,Math.max(Math.abs(f),Math.abs(u))!=1)}setFunctionModule(a,l,u){this.modules[l][a]=u,this.isFunction[l][a]=!0}addEccAndInterleave(a){const l=this.version,u=this.errorCorrectionLevel;if(a.length!=ae.getNumDataCodewords(l,u))throw new RangeError("Invalid argument");const f=ae.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l],d=ae.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l],p=Math.floor(ae.getNumRawDataModules(l)/8),h=f-p%f,b=Math.floor(p/f);let S=[];const P=ae.reedSolomonComputeDivisor(d);for(let w=0,$=0;w<f;w++){let k=a.slice($,$+b-d+(w<h?0:1));$+=k.length;const B=ae.reedSolomonComputeRemainder(k,P);w<h&&k.push(0),S.push(k.concat(B))}let x=[];for(let w=0;w<S[0].length;w++)S.forEach(($,k)=>{(w!=b-d||k>=h)&&x.push($[w])});return o(x.length==p),x}drawCodewords(a){if(a.length!=Math.floor(ae.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let f=0;f<this.size;f++)for(let d=0;d<2;d++){const p=u-d,b=(u+1&2)==0?this.size-1-f:f;!this.isFunction[b][p]&&l<a.length*8&&(this.modules[b][p]=r(a[l>>>3],7-(l&7)),l++)}}o(l==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let u=0;u<this.size;u++){let f;switch(a){case 0:f=(u+l)%2==0;break;case 1:f=l%2==0;break;case 2:f=u%3==0;break;case 3:f=(u+l)%3==0;break;case 4:f=(Math.floor(u/3)+Math.floor(l/2))%2==0;break;case 5:f=u*l%2+u*l%3==0;break;case 6:f=(u*l%2+u*l%3)%2==0;break;case 7:f=((u+l)%2+u*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][u]&&f&&(this.modules[l][u]=!this.modules[l][u])}}getPenaltyScore(){let a=0;for(let d=0;d<this.size;d++){let p=!1,h=0,b=[0,0,0,0,0,0,0];for(let S=0;S<this.size;S++)this.modules[d][S]==p?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),p||(a+=this.finderPenaltyCountPatterns(b)*ae.PENALTY_N3),p=this.modules[d][S],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,b)*ae.PENALTY_N3}for(let d=0;d<this.size;d++){let p=!1,h=0,b=[0,0,0,0,0,0,0];for(let S=0;S<this.size;S++)this.modules[S][d]==p?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),p||(a+=this.finderPenaltyCountPatterns(b)*ae.PENALTY_N3),p=this.modules[S][d],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,b)*ae.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+=ae.PENALTY_N2)}let l=0;for(const d of this.modules)l=d.reduce((p,h)=>p+(h?1:0),l);const u=this.size*this.size,f=Math.ceil(Math.abs(l*20-u*10)/u)-1;return o(0<=f&&f<=9),a+=f*ae.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let u=[6];for(let f=this.size-7;u.length<a;f-=l)u.splice(1,0,f);return u}}static getNumRawDataModules(a){if(a<ae.MIN_VERSION||a>ae.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*a+128)*a+64;if(a>=2){const u=Math.floor(a/7)+2;l-=(25*u-10)*u-55,a>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(a,l){return Math.floor(ae.getNumRawDataModules(a)/8)-ae.ECC_CODEWORDS_PER_BLOCK[l.ordinal][a]*ae.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let l=[];for(let f=0;f<a-1;f++)l.push(0);l.push(1);let u=1;for(let f=0;f<a;f++){for(let d=0;d<l.length;d++)l[d]=ae.reedSolomonMultiply(l[d],u),d+1<l.length&&(l[d]^=l[d+1]);u=ae.reedSolomonMultiply(u,2)}return l}static reedSolomonComputeRemainder(a,l){let u=l.map(f=>0);for(const f of a){const d=f^u.shift();u.push(0),l.forEach((p,h)=>u[h]^=ae.reedSolomonMultiply(p,d))}return u}static reedSolomonMultiply(a,l){if(a>>>8||l>>>8)throw new RangeError("Byte out of range");let u=0;for(let f=7;f>=0;f--)u=u<<1^(u>>>7)*285,u^=(l>>>f&1)*a;return o(u>>>8==0),u}finderPenaltyCountPatterns(a){const l=a[1];o(l<=this.size*3);const u=l>0&&a[2]==l&&a[3]==l*3&&a[4]==l&&a[5]==l;return(u&&a[0]>=l*4&&a[6]>=l?1:0)+(u&&a[6]>=l*4&&a[0]>=l?1:0)}finderPenaltyTerminateAndCount(a,l,u){return a&&(this.finderPenaltyAddHistory(l,u),l=0),l+=this.size,this.finderPenaltyAddHistory(l,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(a,l){l[0]==0&&(a+=this.size),l.pop(),l.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,l){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let u=a-1;u>=0;u--)l.push(c>>>u&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class xe{constructor(a,l,u){if(this.mode=a,this.numChars=l,this.bitData=u,l<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(a){let l=[];for(const u of a)n(u,8,l);return new xe(xe.Mode.BYTE,a.length,l)}static makeNumeric(a){if(!xe.isNumeric(a))throw new RangeError("String contains non-numeric characters");let l=[];for(let u=0;u<a.length;){const f=Math.min(a.length-u,3);n(parseInt(a.substring(u,u+f),10),f*3+1,l),u+=f}return new xe(xe.Mode.NUMERIC,a.length,l)}static makeAlphanumeric(a){if(!xe.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],u;for(u=0;u+2<=a.length;u+=2){let f=xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u))*45;f+=xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u+1)),n(f,11,l)}return u<a.length&&n(xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u)),6,l),new xe(xe.Mode.ALPHANUMERIC,a.length,l)}static makeSegments(a){return a==""?[]:xe.isNumeric(a)?[xe.makeNumeric(a)]:xe.isAlphanumeric(a)?[xe.makeAlphanumeric(a)]:[xe.makeBytes(xe.toUtf8ByteArray(a))]}static makeEci(a){let l=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,l);else if(a<16384)n(2,2,l),n(a,14,l);else if(a<1e6)n(6,3,l),n(a,21,l);else throw new RangeError("ECI assignment value out of range");return new xe(xe.Mode.ECI,0,l)}static isNumeric(a){return xe.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return xe.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,l){let u=0;for(const f of a){const d=f.mode.numCharCountBits(l);if(f.numChars>=1<<d)return 1/0;u+=4+d+f.bitData.length}return u}static toUtf8ByteArray(a){a=encodeURI(a);let l=[];for(let u=0;u<a.length;u++)a.charAt(u)!="%"?l.push(a.charCodeAt(u)):(l.push(parseInt(a.substring(u+1,u+3),16)),u+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(tr||(tr={})),(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={}))})(tr||(tr={})),(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={}))})(tr||(tr={}));var Br=tr;/**
174
174
  * @license qrcode.react
175
175
  * Copyright (c) Paul O'Shannessy
176
176
  * SPDX-License-Identifier: ISC
177
- */var R3={L:Br.QrCode.Ecc.LOW,M:Br.QrCode.Ecc.MEDIUM,Q:Br.QrCode.Ecc.QUARTILE,H:Br.QrCode.Ecc.HIGH},jh=128,_h="L",zh="#FFFFFF",Uh="#000000",Wh=!1,Hh=1,j3=4,_3=0,z3=.1;function Vh(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 Gh(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 U3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*z3),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,l=r.x==null?e.length/2-c/2:r.x*i,u=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(l),b=Math.floor(u),S=Math.ceil(c+l-h),P=Math.ceil(a+u-b);d={x:h,y:b,w:S,h:P}}const p=r.crossOrigin;return{x:l,y:u,h:a,w:c,excavation:d,opacity:f,crossOrigin:p}}function W3(e,t){return t!=null?Math.max(Math.floor(t),0):e?j3:_3}function qh({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=E.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((b,S)=>(b.push(...Br.QrSegment.makeSegments(S)),b),[]);return Br.QrCode.encodeSegments(h,R3[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:l,margin:u,numCells:f,calculatedImageSettings:d}=E.useMemo(()=>{let p=a.getModules();const h=W3(r,o),b=p.length+h*2,S=U3(p,i,h,s);return{cells:p,margin:h,numCells:b,calculatedImageSettings:S}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:l,numCells:f,calculatedImageSettings:d}}var H3=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),V3=E.forwardRef(function(t,n){const r=t,{value:o,size:s=jh,level:i=_h,bgColor:c=zh,fgColor:a=Uh,includeMargin:l=Wh,minVersion:u=Hh,boostLevel:f,marginSize:d,imageSettings:p}=r,b=yl(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:S}=b,P=yl(b,["style"]),x=p==null?void 0:p.src,w=E.useRef(null),A=E.useRef(null),M=E.useCallback(k=>{w.current=k,typeof n=="function"?n(k):n&&(n.current=k)},[n]),[B,F]=E.useState(!1),{margin:m,cells:g,numCells:v,calculatedImageSettings:$}=qh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:d,imageSettings:p,size:s});E.useEffect(()=>{if(w.current!=null){const k=w.current,y=k.getContext("2d");if(!y)return;let C=g;const I=A.current,T=$!=null&&I!==null&&I.complete&&I.naturalHeight!==0&&I.naturalWidth!==0;T&&$.excavation!=null&&(C=Gh(g,$.excavation));const L=window.devicePixelRatio||1;k.height=k.width=s*L;const j=s/v*L;y.scale(j,j),y.fillStyle=c,y.fillRect(0,0,v,v),y.fillStyle=a,H3?y.fill(new Path2D(Vh(C,m))):g.forEach(function(z,_){z.forEach(function(H,Y){H&&y.fillRect(Y+m,_+m,1,1)})}),$&&(y.globalAlpha=$.opacity),T&&y.drawImage(I,$.x+m,$.y+m,$.w,$.h)}}),E.useEffect(()=>{F(!1)},[x]);const N=gl({height:s,width:s},S);let O=null;return x!=null&&(O=E.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{F(!0)},ref:A,crossOrigin:$==null?void 0:$.crossOrigin})),E.createElement(E.Fragment,null,E.createElement("canvas",gl({style:N,height:s,width:s,ref:M,role:"img"},P)),O)});V3.displayName="QRCodeCanvas";var Zh=E.forwardRef(function(t,n){const r=t,{value:o,size:s=jh,level:i=_h,bgColor:c=zh,fgColor:a=Uh,includeMargin:l=Wh,minVersion:u=Hh,boostLevel:f,title:d,marginSize:p,imageSettings:h}=r,b=yl(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:S,cells:P,numCells:x,calculatedImageSettings:w}=qh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:p,imageSettings:h,size:s});let A=P,M=null;h!=null&&w!=null&&(w.excavation!=null&&(A=Gh(P,w.excavation)),M=E.createElement("image",{href:h.src,height:w.h,width:w.w,x:w.x+S,y:w.y+S,preserveAspectRatio:"none",opacity:w.opacity,crossOrigin:w.crossOrigin}));const B=Vh(A,S);return E.createElement("svg",gl({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},b),!!d&&E.createElement("title",null,d),E.createElement("path",{fill:c,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),E.createElement("path",{fill:a,d:B,shapeRendering:"crispEdges"}),M)});Zh.displayName="QRCodeSVG";function G3(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function q3(){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 Kh(){return/apple/i.test(navigator.vendor)}function Z3(){return G3().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function K3(){return q3().includes("jsdom/")}const Yh="data-floating-ui-focusable",Y3="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function vl(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 Fr(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Wc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Rr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function wl(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 X3(e){return e.matches("html,body")}function Ht(e){return(e==null?void 0:e.ownerDocument)||document}function Xh(e){return Ye(e)&&e.matches(Y3)}function Q3(e){if(!e||K3())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function J3(e){return e?e.hasAttribute(Yh)?e:e.querySelector("["+Yh+"]")||e:null}function vi(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,...vi(e,o.id,n)])}function eS(e){return"nativeEvent"in e}function Yo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var tS=typeof document<"u",nS=function(){},Vt=tS?E.useLayoutEffect:nS;const rS={...U};function wi(e){const t=U.useRef(e);return Vt(()=>{t.current=e}),t}const oS=rS.useInsertionEffect||(e=>e());function Gt(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return oS(()=>{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 Qh=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Jh(e,t){const n=kp(e,Qh()),r=n.length;if(r===0)return;const o=vl(Ht(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function sS(e){return Jh(Ht(e).body,1)||e}function iS(e){return Jh(Ht(e).body,-1)||e}function xl(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Fr(n,r)}function aS(e){kp(e,Qh()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function em(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 cS="data-floating-ui-focusable",tm="active",nm="selected",lS={...U};let rm=!1,uS=0;const om=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+uS++;function fS(){const[e,t]=U.useState(()=>rm?om():void 0);return Vt(()=>{e==null&&t(om())},[]),U.useEffect(()=>{rm=!0},[]),e}const El=lS.useId||fS;let Sl;process.env.NODE_ENV!=="production"&&(Sl=new Set);function dS(){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=Sl)!=null&&e.has(o))){var s;(s=Sl)==null||s.add(o),console.error(o)}}function pS(){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 hS=U.createContext(null),mS=U.createContext(null),Pl=()=>{var e;return((e=U.useContext(hS))==null?void 0:e.id)||null},Tl=()=>U.useContext(mS);function Xo(e){return"data-floating-ui-"+e}function yt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const sm=Xo("safe-polygon");function Al(e,t,n){if(n&&!Yo(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 $l(e){return typeof e=="function"?e():e}function bS(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:l=null,mouseOnly:u=!1,restMs:f=0,move:d=!0}=t,p=Tl(),h=Pl(),b=wi(l),S=wi(a),P=wi(n),x=wi(f),w=U.useRef(),A=U.useRef(-1),M=U.useRef(),B=U.useRef(-1),F=U.useRef(!0),m=U.useRef(!1),g=U.useRef(()=>{}),v=U.useRef(!1),$=Gt(()=>{var I;const T=(I=o.current.openEvent)==null?void 0:I.type;return(T==null?void 0:T.includes("mouse"))&&T!=="mousedown"});U.useEffect(()=>{if(!c)return;function I(T){let{open:L}=T;L||(yt(A),yt(B),F.current=!0,v.current=!1)}return s.on("openchange",I),()=>{s.off("openchange",I)}},[c,s]),U.useEffect(()=>{if(!c||!b.current||!n)return;function I(L){$()&&r(!1,L,"hover")}const T=Ht(i.floating).documentElement;return T.addEventListener("mouseleave",I),()=>{T.removeEventListener("mouseleave",I)}},[i.floating,n,r,c,b,$]);const N=U.useCallback(function(I,T,L){T===void 0&&(T=!0),L===void 0&&(L="hover");const j=Al(S.current,"close",w.current);j&&!M.current?(yt(A),A.current=window.setTimeout(()=>r(!1,I,L),j)):T&&(yt(A),r(!1,I,L))},[S,r]),O=Gt(()=>{g.current(),M.current=void 0}),k=Gt(()=>{if(m.current){const I=Ht(i.floating).body;I.style.pointerEvents="",I.removeAttribute(sm),m.current=!1}}),y=Gt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!c)return;function I(_){if(yt(A),F.current=!1,u&&!Yo(w.current)||$l(x.current)>0&&!Al(S.current,"open"))return;const H=Al(S.current,"open",w.current);H?A.current=window.setTimeout(()=>{P.current||r(!0,_,"hover")},H):n||r(!0,_,"hover")}function T(_){if(y()){k();return}g.current();const H=Ht(i.floating);if(yt(B),v.current=!1,b.current&&o.current.floatingContext){n||yt(A),M.current=b.current({...o.current.floatingContext,tree:p,x:_.clientX,y:_.clientY,onClose(){k(),O(),y()||N(_,!0,"safe-polygon")}});const G=M.current;H.addEventListener("mousemove",G),g.current=()=>{H.removeEventListener("mousemove",G)};return}(w.current==="touch"?!Fr(i.floating,_.relatedTarget):!0)&&N(_)}function L(_){y()||o.current.floatingContext&&(b.current==null||b.current({...o.current.floatingContext,tree:p,x:_.clientX,y:_.clientY,onClose(){k(),O(),y()||N(_)}})(_))}function j(){yt(A)}function z(_){y()||N(_,!1)}if(de(i.domReference)){const _=i.domReference,H=i.floating;return n&&_.addEventListener("mouseleave",L),d&&_.addEventListener("mousemove",I,{once:!0}),_.addEventListener("mouseenter",I),_.addEventListener("mouseleave",T),H&&(H.addEventListener("mouseleave",L),H.addEventListener("mouseenter",j),H.addEventListener("mouseleave",z)),()=>{n&&_.removeEventListener("mouseleave",L),d&&_.removeEventListener("mousemove",I),_.removeEventListener("mouseenter",I),_.removeEventListener("mouseleave",T),H&&(H.removeEventListener("mouseleave",L),H.removeEventListener("mouseenter",j),H.removeEventListener("mouseleave",z))}}},[i,c,e,u,d,N,O,k,r,n,P,p,S,b,o,y,x]),Vt(()=>{var I;if(c&&n&&(I=b.current)!=null&&(I=I.__options)!=null&&I.blockPointerEvents&&$()){m.current=!0;const L=i.floating;if(de(i.domReference)&&L){var T;const j=Ht(i.floating).body;j.setAttribute(sm,"");const z=i.domReference,_=p==null||(T=p.nodesRef.current.find(H=>H.id===h))==null||(T=T.context)==null?void 0:T.elements.floating;return _&&(_.style.pointerEvents=""),j.style.pointerEvents="none",z.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{j.style.pointerEvents="",z.style.pointerEvents="",L.style.pointerEvents=""}}}},[c,n,h,i,p,b,$]),Vt(()=>{n||(w.current=void 0,v.current=!1,O(),k())},[n,O,k]),U.useEffect(()=>()=>{O(),yt(A),yt(B),k()},[c,i.domReference,O,k]);const C=U.useMemo(()=>{function I(T){w.current=T.pointerType}return{onPointerDown:I,onPointerEnter:I,onMouseMove(T){const{nativeEvent:L}=T;function j(){!F.current&&!P.current&&r(!0,L,"hover")}u&&!Yo(w.current)||n||$l(x.current)===0||v.current&&T.movementX**2+T.movementY**2<2||(yt(B),w.current==="touch"?j():(v.current=!0,B.current=window.setTimeout(j,$l(x.current))))}}},[u,r,n,P,x]);return U.useMemo(()=>c?{reference:C}:{},[c,C])}const gS={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},im=U.forwardRef(function(t,n){const[r,o]=U.useState();Vt(()=>{Kh()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Xo("focus-guard")]:"",style:gS};return D.jsx("span",{...t,...s})}),yS={clipPath:"inset(50%)",position:"fixed",top:0,left:0},am=U.createContext(null),cm=Xo("portal");function vS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=El(),o=xS(),[s,i]=U.useState(null),c=U.useRef(null);return Vt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Vt(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const l=document.createElement("div");l.id=r,l.setAttribute(cm,""),a.appendChild(l),c.current=l,i(l)},[t,r]),Vt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Uc(a)&&(a=a.current),a=a||document.body;let l=null;t&&(l=document.createElement("div"),l.id=t,a.appendChild(l));const u=document.createElement("div");u.id=r,u.setAttribute(cm,""),a=l||a,a.appendChild(u),c.current=u,i(u)},[t,n,r,o]),s}function wS(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),l=U.useRef(null),u=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 b(S){s&&xl(S)&&(S.type==="focusin"?em:aS)(s)}return s.addEventListener("focusin",b,!0),s.addEventListener("focusout",b,!0),()=>{s.removeEventListener("focusin",b,!0),s.removeEventListener("focusout",b,!0)}},[s,o,d]),U.useEffect(()=>{s&&(p||em(s))},[p,s]),D.jsxs(am.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&D.jsx(im,{"data-type":"outside",ref:a,onFocus:b=>{if(xl(b,s)){var S;(S=u.current)==null||S.focus()}else{const P=i?i.domReference:null,x=iS(P);x==null||x.focus()}}}),h&&s&&D.jsx("span",{"aria-owns":s.id,style:yS}),s&&zr.createPortal(t,s),h&&s&&D.jsx(im,{"data-type":"outside",ref:l,onFocus:b=>{if(xl(b,s)){var S;(S=f.current)==null||S.focus()}else{const P=i?i.domReference:null,x=sS(P);x==null||x.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,b.nativeEvent,"focus-out"))}}})]})}const xS=()=>U.useContext(am);function lm(e){return Ye(e.target)&&e.target.tagName==="BUTTON"}function ES(e){return Ye(e.target)&&e.target.tagName==="A"}function um(e){return Xh(e)}function SS(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:l=!1,keyboardHandlers:u=!0,stickIfOpen:f=!0}=t,d=U.useRef(),p=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(b){d.current=b.pointerType},onMouseDown(b){const S=d.current;b.button===0&&c!=="click"&&(Yo(S,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,b.nativeEvent,"click"):(b.preventDefault(),r(!0,b.nativeEvent,"click"))))},onClick(b){const S=d.current;if(c==="mousedown"&&d.current){d.current=void 0;return}Yo(S,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,b.nativeEvent,"click"):r(!0,b.nativeEvent,"click"))},onKeyDown(b){d.current=void 0,!(b.defaultPrevented||!u||lm(b))&&(b.key===" "&&!um(s)&&(b.preventDefault(),p.current=!0),!ES(b)&&b.key==="Enter"&&r(!(n&&a),b.nativeEvent,"click"))},onKeyUp(b){b.defaultPrevented||!u||lm(b)||um(s)||b.key===" "&&p.current&&(p.current=!1,r(!(n&&a),b.nativeEvent,"click"))}}),[o,s,c,l,u,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const PS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},TS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},fm=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 AS(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:l="pointerdown",referencePress:u=!1,referencePressEvent:f="pointerdown",ancestorScroll:d=!1,bubbles:p,capture:h}=t,b=Tl(),S=Gt(typeof a=="function"?a:()=>!1),P=typeof a=="function"?S:a,x=U.useRef(!1),{escapeKey:w,outsidePress:A}=fm(p),{escapeKey:M,outsidePress:B}=fm(h),F=U.useRef(!1),m=Gt(k=>{var y;if(!n||!i||!c||k.key!=="Escape"||F.current)return;const C=(y=s.current.floatingContext)==null?void 0:y.nodeId,I=b?vi(b.nodesRef.current,C):[];if(!w&&(k.stopPropagation(),I.length>0)){let T=!0;if(I.forEach(L=>{var j;if((j=L.context)!=null&&j.open&&!L.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,eS(k)?k.nativeEvent:k,"escape-key")}),g=Gt(k=>{var y;const C=()=>{var I;m(k),(I=Rr(k))==null||I.removeEventListener("keydown",C)};(y=Rr(k))==null||y.addEventListener("keydown",C)}),v=Gt(k=>{var y;const C=s.current.insideReactTree;s.current.insideReactTree=!1;const I=x.current;if(x.current=!1,l==="click"&&I||C||typeof P=="function"&&!P(k))return;const T=Rr(k),L="["+Xo("inert")+"]",j=Ht(o.floating).querySelectorAll(L);let z=de(T)?T:null;for(;z&&!cn(z);){const G=ln(z);if(cn(G)||!de(G))break;z=G}if(j.length&&de(T)&&!X3(T)&&!Fr(T,o.floating)&&Array.from(j).every(G=>!Fr(z,G)))return;if(Ye(T)&&O){const G=cn(T),W=bt(T),Z=/auto|scroll/,J=G||Z.test(W.overflowX),ee=G||Z.test(W.overflowY),fe=J&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,pe=ee&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,he=W.direction==="rtl",ie=pe&&(he?k.offsetX<=T.offsetWidth-T.clientWidth:k.offsetX>T.clientWidth),me=fe&&k.offsetY>T.clientHeight;if(ie||me)return}const _=(y=s.current.floatingContext)==null?void 0:y.nodeId,H=b&&vi(b.nodesRef.current,_).some(G=>{var W;return wl(k,(W=G.context)==null?void 0:W.elements.floating)});if(wl(k,o.floating)||wl(k,o.domReference)||H)return;const Y=b?vi(b.nodesRef.current,_):[];if(Y.length>0){let G=!0;if(Y.forEach(W=>{var Z;if((Z=W.context)!=null&&Z.open&&!W.context.dataRef.current.__outsidePressBubbles){G=!1;return}}),!G)return}r(!1,k,"outside-press")}),$=Gt(k=>{var y;const C=()=>{var I;v(k),(I=Rr(k))==null||I.removeEventListener(l,C)};(y=Rr(k))==null||y.addEventListener(l,C)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=w,s.current.__outsidePressBubbles=A;let k=-1;function y(j){r(!1,j,"ancestor-scroll")}function C(){window.clearTimeout(k),F.current=!0}function I(){k=window.setTimeout(()=>{F.current=!1},Qs()?5:0)}const T=Ht(o.floating);c&&(T.addEventListener("keydown",M?g:m,M),T.addEventListener("compositionstart",C),T.addEventListener("compositionend",I)),P&&T.addEventListener(l,B?$:v,B);let L=[];return d&&(de(o.domReference)&&(L=Cn(o.domReference)),de(o.floating)&&(L=L.concat(Cn(o.floating))),!de(o.reference)&&o.reference&&o.reference.contextElement&&(L=L.concat(Cn(o.reference.contextElement)))),L=L.filter(j=>{var z;return j!==((z=T.defaultView)==null?void 0:z.visualViewport)}),L.forEach(j=>{j.addEventListener("scroll",y,{passive:!0})}),()=>{c&&(T.removeEventListener("keydown",M?g:m,M),T.removeEventListener("compositionstart",C),T.removeEventListener("compositionend",I)),P&&T.removeEventListener(l,B?$:v,B),L.forEach(j=>{j.removeEventListener("scroll",y)}),window.clearTimeout(k)}},[s,o,c,P,l,n,r,d,i,w,A,m,M,g,v,B,$]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,P,l]);const N=U.useMemo(()=>({onKeyDown:m,...u&&{[PS[f]]:k=>{r(!1,k.nativeEvent,"reference-press")},...f!=="click"&&{onClick(k){r(!1,k.nativeEvent,"reference-press")}}}}),[m,r,u,f]),O=U.useMemo(()=>{function k(y){y.button===0&&(x.current=!0)}return{onKeyDown:m,onMouseDown:k,onMouseUp:k,[TS[l]]:()=>{s.current.insideReactTree=!0}}},[m,l,s]);return U.useMemo(()=>i?{reference:N,floating:O}:{},[i,N,O])}function $S(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=El(),s=U.useRef({}),[i]=U.useState(()=>pS()),c=Pl()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!de(p)&&dS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=U.useState(r.reference),u=Gt((p,h,b)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:b,nested:c}),n==null||n(p,h,b)}),f=U.useMemo(()=>({setPositionReference:l}),[]),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:u,elements:d,events:i,floatingId:o,refs:f}),[t,u,d,i,o,f])}function NS(e){e===void 0&&(e={});const{nodeId:t}=e,n=$S({...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),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),d=Tl();Vt(()=>{u&&(f.current=u)},[u]);const p=Zp({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(w=>{const A=de(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),getClientRects:()=>w.getClientRects(),contextElement:w}:w;a(A),p.refs.setReference(A)},[p.refs]),b=U.useCallback(w=>{(de(w)||w===null)&&(f.current=w,i(w)),(de(p.refs.reference.current)||p.refs.reference.current===null||w!==null&&!de(w))&&p.refs.setReference(w)},[p.refs]),S=U.useMemo(()=>({...p.refs,setReference:b,setPositionReference:h,domReference:f}),[p.refs,b,h]),P=U.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),x=U.useMemo(()=>({...p,...r,refs:S,elements:P,nodeId:t}),[p,S,P,t,r]);return Vt(()=>{r.dataRef.current.floatingContext=x;const w=d==null?void 0:d.nodesRef.current.find(A=>A.id===t);w&&(w.context=x)}),U.useMemo(()=>({...p,context:x,refs:S,elements:P}),[p,S,P,x])}function Nl(){return Z3()&&Kh()}function CS(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,l=U.useRef(!1),u=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!c)return;const p=Ke(i.domReference);function h(){!n&&Ye(i.domReference)&&i.domReference===vl(Ht(i.domReference))&&(l.current=!0)}function b(){f.current=!0}function S(){f.current=!1}return p.addEventListener("blur",h),Nl()&&(p.addEventListener("keydown",b,!0),p.addEventListener("pointerdown",S,!0)),()=>{p.removeEventListener("blur",h),Nl()&&(p.removeEventListener("keydown",b,!0),p.removeEventListener("pointerdown",S,!0))}},[i.domReference,n,c]),U.useEffect(()=>{if(!c)return;function p(h){let{reason:b}=h;(b==="reference-press"||b==="escape-key")&&(l.current=!0)}return o.on("openchange",p),()=>{o.off("openchange",p)}},[o,c]),U.useEffect(()=>()=>{yt(u)},[]);const d=U.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(p){if(l.current)return;const h=Rr(p.nativeEvent);if(a&&de(h)){if(Nl()&&!p.relatedTarget){if(!f.current&&!Xh(h))return}else if(!Q3(h))return}r(!0,p.nativeEvent,"focus")},onBlur(p){l.current=!1;const h=p.relatedTarget,b=p.nativeEvent,S=de(h)&&h.hasAttribute(Xo("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var P;const x=vl(i.domReference?i.domReference.ownerDocument:document);!h&&x===i.domReference||Fr((P=s.current.floatingContext)==null?void 0:P.refs.floating.current,x)||Fr(i.domReference,x)||S||r(!1,b,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>c?{reference:d}:{},[c,d])}function Cl(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[tm]:i,[nm]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[cS]:""},...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[l,u]=a;if(!(o&&[tm,nm].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var d,p=arguments.length,h=new Array(p),b=0;b<p;b++)h[b]=arguments[b];return(d=r.get(l))==null?void 0:d.map(S=>S(...h)).find(S=>S!==void 0)}}}else i[l]=u}),i),{})}}function OS(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=>Cl(c,e,"reference"),t),s=U.useCallback(c=>Cl(c,e,"floating"),n),i=U.useCallback(c=>Cl(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const IS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function kS(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,l=El(),u=((n=s.domReference)==null?void 0:n.id)||l,f=U.useMemo(()=>{var x;return((x=J3(s.floating))==null?void 0:x.id)||i},[s.floating,i]),d=(r=IS.get(a))!=null?r:a,h=Pl()!=null,b=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:u},...d==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,f,h,o,u,a]),S=U.useMemo(()=>{const x={id:f,...d&&{role:d}};return d==="tooltip"||a==="label"?x:{...x,...d==="menu"&&{"aria-labelledby":u}}},[d,f,u,a]),P=U.useCallback(x=>{let{active:w,selected:A}=x;const M={role:"option",...w&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...M,"aria-selected":A}}return{}},[f,a]);return U.useMemo(()=>c?{reference:b,floating:S,item:P}:{},[c,b,S,P])}const dm=E.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return D.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});dm.displayName="TooltipArrow";const nr=({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[l,u]=E.useState(!1),f=E.useRef(null),{refs:d,floatingStyles:p,context:h}=NS({open:l&&!i,onOpenChange:u,placement:n,whileElementsMounted:Hp,middleware:[rl(o?12:8),Yp({fallbackAxisSideDirection:"start",padding:8}),Kp({padding:8}),...o?[VE({element:f})]:[]]}),b=bS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),S=CS(h,{enabled:a.includes("focus")}),P=SS(h,{enabled:a.includes("click")}),x=AS(h),w=kS(h,{role:"tooltip"}),{getReferenceProps:A,getFloatingProps:M}=OS([b,S,P,x,w]);return i?D.jsx(D.Fragment,{children:e}):D.jsxs(D.Fragment,{children:[D.jsx("div",{ref:d.setReference,...A(),className:"cursor-help",children:e}),l&&D.jsx(wS,{children:D.jsxs("div",{ref:d.setFloating,...M(),style:{...p,zIndex:101},className:`
177
+ */var _3={L:Br.QrCode.Ecc.LOW,M:Br.QrCode.Ecc.MEDIUM,Q:Br.QrCode.Ecc.QUARTILE,H:Br.QrCode.Ecc.HIGH},_h=128,zh="L",Uh="#FFFFFF",Wh="#000000",Hh=!1,Vh=1,z3=4,U3=0,W3=.1;function Gh(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 qh(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 H3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*W3),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,l=r.x==null?e.length/2-c/2:r.x*i,u=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(l),b=Math.floor(u),S=Math.ceil(c+l-h),P=Math.ceil(a+u-b);d={x:h,y:b,w:S,h:P}}const p=r.crossOrigin;return{x:l,y:u,h:a,w:c,excavation:d,opacity:f,crossOrigin:p}}function V3(e,t){return t!=null?Math.max(Math.floor(t),0):e?z3:U3}function Zh({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=E.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((b,S)=>(b.push(...Br.QrSegment.makeSegments(S)),b),[]);return Br.QrCode.encodeSegments(h,_3[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:l,margin:u,numCells:f,calculatedImageSettings:d}=E.useMemo(()=>{let p=a.getModules();const h=V3(r,o),b=p.length+h*2,S=H3(p,i,h,s);return{cells:p,margin:h,numCells:b,calculatedImageSettings:S}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:l,numCells:f,calculatedImageSettings:d}}var G3=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),q3=E.forwardRef(function(t,n){const r=t,{value:o,size:s=_h,level:i=zh,bgColor:c=Uh,fgColor:a=Wh,includeMargin:l=Hh,minVersion:u=Vh,boostLevel:f,marginSize:d,imageSettings:p}=r,b=vl(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:S}=b,P=vl(b,["style"]),x=p==null?void 0:p.src,w=E.useRef(null),$=E.useRef(null),k=E.useCallback(D=>{w.current=D,typeof n=="function"?n(D):n&&(n.current=D)},[n]),[B,F]=E.useState(!1),{margin:m,cells:g,numCells:v,calculatedImageSettings:A}=Zh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:d,imageSettings:p,size:s});E.useEffect(()=>{if(w.current!=null){const D=w.current,y=D.getContext("2d");if(!y)return;let C=g;const I=$.current,T=A!=null&&I!==null&&I.complete&&I.naturalHeight!==0&&I.naturalWidth!==0;T&&A.excavation!=null&&(C=qh(g,A.excavation));const L=window.devicePixelRatio||1;D.height=D.width=s*L;const j=s/v*L;y.scale(j,j),y.fillStyle=c,y.fillRect(0,0,v,v),y.fillStyle=a,G3?y.fill(new Path2D(Gh(C,m))):g.forEach(function(z,_){z.forEach(function(W,K){W&&y.fillRect(K+m,_+m,1,1)})}),A&&(y.globalAlpha=A.opacity),T&&y.drawImage(I,A.x+m,A.y+m,A.w,A.h)}}),E.useEffect(()=>{F(!1)},[x]);const N=yl({height:s,width:s},S);let O=null;return x!=null&&(O=E.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{F(!0)},ref:$,crossOrigin:A==null?void 0:A.crossOrigin})),E.createElement(E.Fragment,null,E.createElement("canvas",yl({style:N,height:s,width:s,ref:k,role:"img"},P)),O)});q3.displayName="QRCodeCanvas";var Kh=E.forwardRef(function(t,n){const r=t,{value:o,size:s=_h,level:i=zh,bgColor:c=Uh,fgColor:a=Wh,includeMargin:l=Hh,minVersion:u=Vh,boostLevel:f,title:d,marginSize:p,imageSettings:h}=r,b=vl(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:S,cells:P,numCells:x,calculatedImageSettings:w}=Zh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:p,imageSettings:h,size:s});let $=P,k=null;h!=null&&w!=null&&(w.excavation!=null&&($=qh(P,w.excavation)),k=E.createElement("image",{href:h.src,height:w.h,width:w.w,x:w.x+S,y:w.y+S,preserveAspectRatio:"none",opacity:w.opacity,crossOrigin:w.crossOrigin}));const B=Gh($,S);return E.createElement("svg",yl({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},b),!!d&&E.createElement("title",null,d),E.createElement("path",{fill:c,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),E.createElement("path",{fill:a,d:B,shapeRendering:"crispEdges"}),k)});Kh.displayName="QRCodeSVG";function Z3(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function K3(){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 Yh(){return/apple/i.test(navigator.vendor)}function Y3(){return Z3().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function X3(){return K3().includes("jsdom/")}const Xh="data-floating-ui-focusable",Q3="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function wl(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 Fr(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Hc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Rr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function xl(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 J3(e){return e.matches("html,body")}function Ht(e){return(e==null?void 0:e.ownerDocument)||document}function Qh(e){return Ye(e)&&e.matches(Q3)}function eS(e){if(!e||X3())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function tS(e){return e?e.hasAttribute(Xh)?e:e.querySelector("["+Xh+"]")||e:null}function wi(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,...wi(e,o.id,n)])}function nS(e){return"nativeEvent"in e}function Yo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var rS=typeof document<"u",oS=function(){},Vt=rS?E.useLayoutEffect:oS;const sS={...U};function xi(e){const t=U.useRef(e);return Vt(()=>{t.current=e}),t}const iS=sS.useInsertionEffect||(e=>e());function Gt(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return iS(()=>{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 Jh=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function em(e,t){const n=Mp(e,Jh()),r=n.length;if(r===0)return;const o=wl(Ht(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function aS(e){return em(Ht(e).body,1)||e}function cS(e){return em(Ht(e).body,-1)||e}function El(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Fr(n,r)}function lS(e){Mp(e,Jh()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function tm(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 uS="data-floating-ui-focusable",nm="active",rm="selected",fS={...U};let om=!1,dS=0;const sm=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+dS++;function pS(){const[e,t]=U.useState(()=>om?sm():void 0);return Vt(()=>{e==null&&t(sm())},[]),U.useEffect(()=>{om=!0},[]),e}const Sl=fS.useId||pS;let Pl;process.env.NODE_ENV!=="production"&&(Pl=new Set);function hS(){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=Pl)!=null&&e.has(o))){var s;(s=Pl)==null||s.add(o),console.error(o)}}function mS(){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 bS=U.createContext(null),gS=U.createContext(null),Tl=()=>{var e;return((e=U.useContext(bS))==null?void 0:e.id)||null},$l=()=>U.useContext(gS);function Xo(e){return"data-floating-ui-"+e}function yt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const im=Xo("safe-polygon");function Al(e,t,n){if(n&&!Yo(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 Nl(e){return typeof e=="function"?e():e}function yS(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:l=null,mouseOnly:u=!1,restMs:f=0,move:d=!0}=t,p=$l(),h=Tl(),b=xi(l),S=xi(a),P=xi(n),x=xi(f),w=U.useRef(),$=U.useRef(-1),k=U.useRef(),B=U.useRef(-1),F=U.useRef(!0),m=U.useRef(!1),g=U.useRef(()=>{}),v=U.useRef(!1),A=Gt(()=>{var I;const T=(I=o.current.openEvent)==null?void 0:I.type;return(T==null?void 0:T.includes("mouse"))&&T!=="mousedown"});U.useEffect(()=>{if(!c)return;function I(T){let{open:L}=T;L||(yt($),yt(B),F.current=!0,v.current=!1)}return s.on("openchange",I),()=>{s.off("openchange",I)}},[c,s]),U.useEffect(()=>{if(!c||!b.current||!n)return;function I(L){A()&&r(!1,L,"hover")}const T=Ht(i.floating).documentElement;return T.addEventListener("mouseleave",I),()=>{T.removeEventListener("mouseleave",I)}},[i.floating,n,r,c,b,A]);const N=U.useCallback(function(I,T,L){T===void 0&&(T=!0),L===void 0&&(L="hover");const j=Al(S.current,"close",w.current);j&&!k.current?(yt($),$.current=window.setTimeout(()=>r(!1,I,L),j)):T&&(yt($),r(!1,I,L))},[S,r]),O=Gt(()=>{g.current(),k.current=void 0}),D=Gt(()=>{if(m.current){const I=Ht(i.floating).body;I.style.pointerEvents="",I.removeAttribute(im),m.current=!1}}),y=Gt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!c)return;function I(_){if(yt($),F.current=!1,u&&!Yo(w.current)||Nl(x.current)>0&&!Al(S.current,"open"))return;const W=Al(S.current,"open",w.current);W?$.current=window.setTimeout(()=>{P.current||r(!0,_,"hover")},W):n||r(!0,_,"hover")}function T(_){if(y()){D();return}g.current();const W=Ht(i.floating);if(yt(B),v.current=!1,b.current&&o.current.floatingContext){n||yt($),k.current=b.current({...o.current.floatingContext,tree:p,x:_.clientX,y:_.clientY,onClose(){D(),O(),y()||N(_,!0,"safe-polygon")}});const G=k.current;W.addEventListener("mousemove",G),g.current=()=>{W.removeEventListener("mousemove",G)};return}(w.current==="touch"?!Fr(i.floating,_.relatedTarget):!0)&&N(_)}function L(_){y()||o.current.floatingContext&&(b.current==null||b.current({...o.current.floatingContext,tree:p,x:_.clientX,y:_.clientY,onClose(){D(),O(),y()||N(_)}})(_))}function j(){yt($)}function z(_){y()||N(_,!1)}if(de(i.domReference)){const _=i.domReference,W=i.floating;return n&&_.addEventListener("mouseleave",L),d&&_.addEventListener("mousemove",I,{once:!0}),_.addEventListener("mouseenter",I),_.addEventListener("mouseleave",T),W&&(W.addEventListener("mouseleave",L),W.addEventListener("mouseenter",j),W.addEventListener("mouseleave",z)),()=>{n&&_.removeEventListener("mouseleave",L),d&&_.removeEventListener("mousemove",I),_.removeEventListener("mouseenter",I),_.removeEventListener("mouseleave",T),W&&(W.removeEventListener("mouseleave",L),W.removeEventListener("mouseenter",j),W.removeEventListener("mouseleave",z))}}},[i,c,e,u,d,N,O,D,r,n,P,p,S,b,o,y,x]),Vt(()=>{var I;if(c&&n&&(I=b.current)!=null&&(I=I.__options)!=null&&I.blockPointerEvents&&A()){m.current=!0;const L=i.floating;if(de(i.domReference)&&L){var T;const j=Ht(i.floating).body;j.setAttribute(im,"");const z=i.domReference,_=p==null||(T=p.nodesRef.current.find(W=>W.id===h))==null||(T=T.context)==null?void 0:T.elements.floating;return _&&(_.style.pointerEvents=""),j.style.pointerEvents="none",z.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{j.style.pointerEvents="",z.style.pointerEvents="",L.style.pointerEvents=""}}}},[c,n,h,i,p,b,A]),Vt(()=>{n||(w.current=void 0,v.current=!1,O(),D())},[n,O,D]),U.useEffect(()=>()=>{O(),yt($),yt(B),D()},[c,i.domReference,O,D]);const C=U.useMemo(()=>{function I(T){w.current=T.pointerType}return{onPointerDown:I,onPointerEnter:I,onMouseMove(T){const{nativeEvent:L}=T;function j(){!F.current&&!P.current&&r(!0,L,"hover")}u&&!Yo(w.current)||n||Nl(x.current)===0||v.current&&T.movementX**2+T.movementY**2<2||(yt(B),w.current==="touch"?j():(v.current=!0,B.current=window.setTimeout(j,Nl(x.current))))}}},[u,r,n,P,x]);return U.useMemo(()=>c?{reference:C}:{},[c,C])}const vS={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},am=U.forwardRef(function(t,n){const[r,o]=U.useState();Vt(()=>{Yh()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Xo("focus-guard")]:"",style:vS};return M.jsx("span",{...t,...s})}),wS={clipPath:"inset(50%)",position:"fixed",top:0,left:0},cm=U.createContext(null),lm=Xo("portal");function xS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Sl(),o=SS(),[s,i]=U.useState(null),c=U.useRef(null);return Vt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Vt(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const l=document.createElement("div");l.id=r,l.setAttribute(lm,""),a.appendChild(l),c.current=l,i(l)},[t,r]),Vt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Wc(a)&&(a=a.current),a=a||document.body;let l=null;t&&(l=document.createElement("div"),l.id=t,a.appendChild(l));const u=document.createElement("div");u.id=r,u.setAttribute(lm,""),a=l||a,a.appendChild(u),c.current=u,i(u)},[t,n,r,o]),s}function ES(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=xS({id:n,root:r}),[i,c]=U.useState(null),a=U.useRef(null),l=U.useRef(null),u=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 b(S){s&&El(S)&&(S.type==="focusin"?tm:lS)(s)}return s.addEventListener("focusin",b,!0),s.addEventListener("focusout",b,!0),()=>{s.removeEventListener("focusin",b,!0),s.removeEventListener("focusout",b,!0)}},[s,o,d]),U.useEffect(()=>{s&&(p||tm(s))},[p,s]),M.jsxs(cm.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&M.jsx(am,{"data-type":"outside",ref:a,onFocus:b=>{if(El(b,s)){var S;(S=u.current)==null||S.focus()}else{const P=i?i.domReference:null,x=cS(P);x==null||x.focus()}}}),h&&s&&M.jsx("span",{"aria-owns":s.id,style:wS}),s&&zr.createPortal(t,s),h&&s&&M.jsx(am,{"data-type":"outside",ref:l,onFocus:b=>{if(El(b,s)){var S;(S=f.current)==null||S.focus()}else{const P=i?i.domReference:null,x=aS(P);x==null||x.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,b.nativeEvent,"focus-out"))}}})]})}const SS=()=>U.useContext(cm);function um(e){return Ye(e.target)&&e.target.tagName==="BUTTON"}function PS(e){return Ye(e.target)&&e.target.tagName==="A"}function fm(e){return Qh(e)}function TS(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:l=!1,keyboardHandlers:u=!0,stickIfOpen:f=!0}=t,d=U.useRef(),p=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(b){d.current=b.pointerType},onMouseDown(b){const S=d.current;b.button===0&&c!=="click"&&(Yo(S,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,b.nativeEvent,"click"):(b.preventDefault(),r(!0,b.nativeEvent,"click"))))},onClick(b){const S=d.current;if(c==="mousedown"&&d.current){d.current=void 0;return}Yo(S,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,b.nativeEvent,"click"):r(!0,b.nativeEvent,"click"))},onKeyDown(b){d.current=void 0,!(b.defaultPrevented||!u||um(b))&&(b.key===" "&&!fm(s)&&(b.preventDefault(),p.current=!0),!PS(b)&&b.key==="Enter"&&r(!(n&&a),b.nativeEvent,"click"))},onKeyUp(b){b.defaultPrevented||!u||um(b)||fm(s)||b.key===" "&&p.current&&(p.current=!1,r(!(n&&a),b.nativeEvent,"click"))}}),[o,s,c,l,u,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const $S={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},AS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},dm=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 NS(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:l="pointerdown",referencePress:u=!1,referencePressEvent:f="pointerdown",ancestorScroll:d=!1,bubbles:p,capture:h}=t,b=$l(),S=Gt(typeof a=="function"?a:()=>!1),P=typeof a=="function"?S:a,x=U.useRef(!1),{escapeKey:w,outsidePress:$}=dm(p),{escapeKey:k,outsidePress:B}=dm(h),F=U.useRef(!1),m=Gt(D=>{var y;if(!n||!i||!c||D.key!=="Escape"||F.current)return;const C=(y=s.current.floatingContext)==null?void 0:y.nodeId,I=b?wi(b.nodesRef.current,C):[];if(!w&&(D.stopPropagation(),I.length>0)){let T=!0;if(I.forEach(L=>{var j;if((j=L.context)!=null&&j.open&&!L.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,nS(D)?D.nativeEvent:D,"escape-key")}),g=Gt(D=>{var y;const C=()=>{var I;m(D),(I=Rr(D))==null||I.removeEventListener("keydown",C)};(y=Rr(D))==null||y.addEventListener("keydown",C)}),v=Gt(D=>{var y;const C=s.current.insideReactTree;s.current.insideReactTree=!1;const I=x.current;if(x.current=!1,l==="click"&&I||C||typeof P=="function"&&!P(D))return;const T=Rr(D),L="["+Xo("inert")+"]",j=Ht(o.floating).querySelectorAll(L);let z=de(T)?T:null;for(;z&&!cn(z);){const G=ln(z);if(cn(G)||!de(G))break;z=G}if(j.length&&de(T)&&!J3(T)&&!Fr(T,o.floating)&&Array.from(j).every(G=>!Fr(z,G)))return;if(Ye(T)&&O){const G=cn(T),H=bt(T),q=/auto|scroll/,Q=G||q.test(H.overflowX),ee=G||q.test(H.overflowY),pe=Q&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,le=ee&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,he=H.direction==="rtl",ie=le&&(he?D.offsetX<=T.offsetWidth-T.clientWidth:D.offsetX>T.clientWidth),me=pe&&D.offsetY>T.clientHeight;if(ie||me)return}const _=(y=s.current.floatingContext)==null?void 0:y.nodeId,W=b&&wi(b.nodesRef.current,_).some(G=>{var H;return xl(D,(H=G.context)==null?void 0:H.elements.floating)});if(xl(D,o.floating)||xl(D,o.domReference)||W)return;const K=b?wi(b.nodesRef.current,_):[];if(K.length>0){let G=!0;if(K.forEach(H=>{var q;if((q=H.context)!=null&&q.open&&!H.context.dataRef.current.__outsidePressBubbles){G=!1;return}}),!G)return}r(!1,D,"outside-press")}),A=Gt(D=>{var y;const C=()=>{var I;v(D),(I=Rr(D))==null||I.removeEventListener(l,C)};(y=Rr(D))==null||y.addEventListener(l,C)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=w,s.current.__outsidePressBubbles=$;let D=-1;function y(j){r(!1,j,"ancestor-scroll")}function C(){window.clearTimeout(D),F.current=!0}function I(){D=window.setTimeout(()=>{F.current=!1},Js()?5:0)}const T=Ht(o.floating);c&&(T.addEventListener("keydown",k?g:m,k),T.addEventListener("compositionstart",C),T.addEventListener("compositionend",I)),P&&T.addEventListener(l,B?A:v,B);let L=[];return d&&(de(o.domReference)&&(L=Cn(o.domReference)),de(o.floating)&&(L=L.concat(Cn(o.floating))),!de(o.reference)&&o.reference&&o.reference.contextElement&&(L=L.concat(Cn(o.reference.contextElement)))),L=L.filter(j=>{var z;return j!==((z=T.defaultView)==null?void 0:z.visualViewport)}),L.forEach(j=>{j.addEventListener("scroll",y,{passive:!0})}),()=>{c&&(T.removeEventListener("keydown",k?g:m,k),T.removeEventListener("compositionstart",C),T.removeEventListener("compositionend",I)),P&&T.removeEventListener(l,B?A:v,B),L.forEach(j=>{j.removeEventListener("scroll",y)}),window.clearTimeout(D)}},[s,o,c,P,l,n,r,d,i,w,$,m,k,g,v,B,A]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,P,l]);const N=U.useMemo(()=>({onKeyDown:m,...u&&{[$S[f]]:D=>{r(!1,D.nativeEvent,"reference-press")},...f!=="click"&&{onClick(D){r(!1,D.nativeEvent,"reference-press")}}}}),[m,r,u,f]),O=U.useMemo(()=>{function D(y){y.button===0&&(x.current=!0)}return{onKeyDown:m,onMouseDown:D,onMouseUp:D,[AS[l]]:()=>{s.current.insideReactTree=!0}}},[m,l,s]);return U.useMemo(()=>i?{reference:N,floating:O}:{},[i,N,O])}function CS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Sl(),s=U.useRef({}),[i]=U.useState(()=>mS()),c=Tl()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!de(p)&&hS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=U.useState(r.reference),u=Gt((p,h,b)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:b,nested:c}),n==null||n(p,h,b)}),f=U.useMemo(()=>({setPositionReference:l}),[]),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:u,elements:d,events:i,floatingId:o,refs:f}),[t,u,d,i,o,f])}function OS(e){e===void 0&&(e={});const{nodeId:t}=e,n=CS({...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),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),d=$l();Vt(()=>{u&&(f.current=u)},[u]);const p=Kp({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(w=>{const $=de(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),getClientRects:()=>w.getClientRects(),contextElement:w}:w;a($),p.refs.setReference($)},[p.refs]),b=U.useCallback(w=>{(de(w)||w===null)&&(f.current=w,i(w)),(de(p.refs.reference.current)||p.refs.reference.current===null||w!==null&&!de(w))&&p.refs.setReference(w)},[p.refs]),S=U.useMemo(()=>({...p.refs,setReference:b,setPositionReference:h,domReference:f}),[p.refs,b,h]),P=U.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),x=U.useMemo(()=>({...p,...r,refs:S,elements:P,nodeId:t}),[p,S,P,t,r]);return Vt(()=>{r.dataRef.current.floatingContext=x;const w=d==null?void 0:d.nodesRef.current.find($=>$.id===t);w&&(w.context=x)}),U.useMemo(()=>({...p,context:x,refs:S,elements:P}),[p,S,P,x])}function Cl(){return Y3()&&Yh()}function IS(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,l=U.useRef(!1),u=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!c)return;const p=Ke(i.domReference);function h(){!n&&Ye(i.domReference)&&i.domReference===wl(Ht(i.domReference))&&(l.current=!0)}function b(){f.current=!0}function S(){f.current=!1}return p.addEventListener("blur",h),Cl()&&(p.addEventListener("keydown",b,!0),p.addEventListener("pointerdown",S,!0)),()=>{p.removeEventListener("blur",h),Cl()&&(p.removeEventListener("keydown",b,!0),p.removeEventListener("pointerdown",S,!0))}},[i.domReference,n,c]),U.useEffect(()=>{if(!c)return;function p(h){let{reason:b}=h;(b==="reference-press"||b==="escape-key")&&(l.current=!0)}return o.on("openchange",p),()=>{o.off("openchange",p)}},[o,c]),U.useEffect(()=>()=>{yt(u)},[]);const d=U.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(p){if(l.current)return;const h=Rr(p.nativeEvent);if(a&&de(h)){if(Cl()&&!p.relatedTarget){if(!f.current&&!Qh(h))return}else if(!eS(h))return}r(!0,p.nativeEvent,"focus")},onBlur(p){l.current=!1;const h=p.relatedTarget,b=p.nativeEvent,S=de(h)&&h.hasAttribute(Xo("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var P;const x=wl(i.domReference?i.domReference.ownerDocument:document);!h&&x===i.domReference||Fr((P=s.current.floatingContext)==null?void 0:P.refs.floating.current,x)||Fr(i.domReference,x)||S||r(!1,b,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>c?{reference:d}:{},[c,d])}function Ol(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[nm]:i,[rm]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[uS]:""},...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[l,u]=a;if(!(o&&[nm,rm].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var d,p=arguments.length,h=new Array(p),b=0;b<p;b++)h[b]=arguments[b];return(d=r.get(l))==null?void 0:d.map(S=>S(...h)).find(S=>S!==void 0)}}}else i[l]=u}),i),{})}}function DS(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=>Ol(c,e,"reference"),t),s=U.useCallback(c=>Ol(c,e,"floating"),n),i=U.useCallback(c=>Ol(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const MS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function kS(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,l=Sl(),u=((n=s.domReference)==null?void 0:n.id)||l,f=U.useMemo(()=>{var x;return((x=tS(s.floating))==null?void 0:x.id)||i},[s.floating,i]),d=(r=MS.get(a))!=null?r:a,h=Tl()!=null,b=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:u},...d==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,f,h,o,u,a]),S=U.useMemo(()=>{const x={id:f,...d&&{role:d}};return d==="tooltip"||a==="label"?x:{...x,...d==="menu"&&{"aria-labelledby":u}}},[d,f,u,a]),P=U.useCallback(x=>{let{active:w,selected:$}=x;const k={role:"option",...w&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...k,"aria-selected":$}}return{}},[f,a]);return U.useMemo(()=>c?{reference:b,floating:S,item:P}:{},[c,b,S,P])}const pm=E.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return M.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});pm.displayName="TooltipArrow";const nr=({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[l,u]=E.useState(!1),f=E.useRef(null),{refs:d,floatingStyles:p,context:h}=OS({open:l&&!i,onOpenChange:u,placement:n,whileElementsMounted:Vp,middleware:[ol(o?12:8),Xp({fallbackAxisSideDirection:"start",padding:8}),Yp({padding:8}),...o?[qE({element:f})]:[]]}),b=yS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),S=IS(h,{enabled:a.includes("focus")}),P=TS(h,{enabled:a.includes("click")}),x=NS(h),w=kS(h,{role:"tooltip"}),{getReferenceProps:$,getFloatingProps:k}=DS([b,S,P,x,w]);return i?M.jsx(M.Fragment,{children:e}):M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:d.setReference,...$(),className:"cursor-help",children:e}),l&&M.jsx(ES,{children:M.jsxs("div",{ref:d.setFloating,...k(),style:{...p,zIndex:101},className:`
178
178
  z-[101] px-3 py-2 cursor-help
179
179
  bg-fill-page-secondary
180
180
  text-text-primary text-sm font-medium
@@ -182,6 +182,6 @@ ${xg(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
182
182
  relative
183
183
  ${c}
184
184
  ${s}
185
- `,children:[t,o&&D.jsx(dm,{ref:f,placement:h.placement||n})]})})]})},Qo="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=",DS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,onDeposit:o,onCopy:s,onClose:i})=>{const{t:c}=Et(),a=r===P5,l=E.useMemo(()=>{if(!e)return!1;const h=Number(e.chainId);return!Number.isNaN(h)&&(h===42161||h===421614)},[e]),u=a,f=E.useMemo(()=>{var h;return(h=e==null?void 0:e.tokenList)==null?void 0:h.find(b=>b.token===t||b.symbol===t)},[e,t]),d=E.useMemo(()=>{const h=(t||"").toUpperCase();if(!u&&h==="USDC")return c("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const P=c(u?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return u&&(!l||h==="USDC")?String(P).split(`
186
- `)[0]:P},[c,t,e==null?void 0:e.chain,u,l]),p=(f==null?void 0:f.minDepositSize)||"10";return D.jsxs(D.Fragment,{children:[D.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&D.jsx("div",{className:"bg-white rounded-lg",children:D.jsx(Zh,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&D.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[D.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),D.jsx(B3,{onCopy:()=>{s&&s(n)},text:n,children:D.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[D.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),D.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")]}),D.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[D.jsxs("div",{className:"flex items-start",children:[D.jsx("div",{className:"w-5",children:D.jsx("img",{src:Qo,className:"w-4 h-4",alt:"Warning"})}),D.jsx("div",{className:"flex-1",children:D.jsx("p",{className:"text-xs text-functional-orange-1",children:d})})]}),r===m0&&D.jsxs(D.Fragment,{children:[D.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),D.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:c("deposit.addressUpdatedNotice")})]})]}),D.jsxs("div",{className:"text-sm",children:[(a||t.toUpperCase()!=="USDC")&&D.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[D.jsx("span",{className:"text-text-tertiary",children:c("deposit.arrivalTime")}),D.jsx(nr,{content:D.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[D.jsx("p",{children:c("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),D.jsx("p",{children:c("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:D.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:c("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),D.jsxs("div",{className:`flex justify-between items-center h-[18px] ${a||t.toUpperCase()!=="USDC"?"mt-1":"mt-4"}`,children:[D.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),D.jsxs("span",{className:"text-text-primary font-medium text-right",children:[p," ",t]})]}),r===m0&&t.toUpperCase()!=="USDC"&&D.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[D.jsx("span",{className:"text-text-tertiary",children:c("deposit.maxDeposit")}),D.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),D.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:()=>{o&&o({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),i()},children:c("deposit.title")})]})},Jo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return D.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},MS=(e,t)=>Number(e)>Number(t),Mt=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"},xi=(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 xi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Mt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},LS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Mt(Math.max(0,s).toString());return D.jsxs("span",{className:"flex items-center gap-1",children:[Mt(e),D.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Mt(e)} ${n}`},BS=(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)},FS=(e,t,n)=>{if(!$h(e,n))return!1;try{const r=new Ce(t||"0"),o=new Ce("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},RS=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&$h(e,n))try{const i=new Ce(o),c=new Ce("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Ce(o||"0");return console.log("bn:",i),console.log("bn:",i.isNaN()),i.isNaN()?o:i.decimalPlaces(6,Ce.ROUND_DOWN).toString()}catch{return o}},pm={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let Xe=null;const hm=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState(pm),a=E.useCallback(h=>{c(h),r(!0)},[]),l=E.useCallback(h=>{c(b=>({...b,...h}))},[]),u=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),d=E.useCallback(()=>n,[n]),p=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:d,isLoading:p}),[a,u,l,f,d,p]),E.useEffect(()=>(Xe={openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:d,isLoading:p},()=>{Xe=null}),[a,u,l,f,d,p]),n?D.jsx(wm,{isOpen:n,isLoading:o,onClose:u,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var b;return(b=i.onChainChange)==null?void 0:b.call(i,h)},onTokenChange:h=>{var b;return(b=i.onTokenChange)==null?void 0:b.call(i,h)}}):null});hm.displayName="DepositManager";const mm=e=>{if(!Xe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Xe.openDeposit(e||pm)},bm=()=>{if(!Xe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Xe.closeDeposit()},gm=e=>{Xe&&Xe.updateDepositOptions(e)},Ei=e=>{if(!Xe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Xe.setDepositLoading(e)},jS=()=>Xe?Xe.isOpen():!1,ym=()=>Xe?Xe.isLoading():!1,_S=()=>({openDeposit:mm,closeDeposit:bm,updateDepositOptions:gm,setDepositLoading:Ei,isOpen:jS,isLoading:ym}),zS=e=>{const{t}=Et(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return E.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const l=parseFloat(r||"0"),u=a,f=BS(r,s||"0",o);return!r||l===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:l<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function US(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:l}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,d=o==null?void 0:o.contractAddress,p=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=l(),{writeContractAsync:b}=c(),S=a(),P=i({address:u,abi:Er,functionName:"allowance",args:[Qt(t||""),d],chainId:r,query:{enabled:!!(!p&&t&&r&&u&&d)}}),x=P!=null&&P.isSuccess?P.data:void 0,w=E.useMemo(()=>{if(p)return!0;if(!P.isSuccess||x===void 0||x===0n)return!1;try{const M=k6(String(Number(s||"0")||0),Number(f));return x>=M}catch{return!1}},[p,P.isSuccess,x,s,f]),A=E.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!b||!S||!u||!d)return;const B=Qt(u),F=Qt(d);if((x||0n)>0n){const v=await b({abi:Er,address:B,functionName:"approve",args:[F,0n]});await S.waitForTransactionReceipt({hash:v})}const g=await b({abi:Er,address:B,functionName:"approve",args:[F,lf]});await S.waitForTransactionReceipt({hash:g}),P!=null&&P.refetch&&await P.refetch()}catch(M){console.error("[useApprove] onApprove failed:",M)}},[r,n,u,d,x,P,b,S,h]);return{approve:w,onApprove:A}}const WS=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return E.useEffect(()=>{o(Qt(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},HS=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var x;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=E.useMemo(()=>{const w="0x0000000000000000000000000000000000000000",A="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(M=>{const B=M.tokenAddress;if(!B)return!1;const F=B.toLowerCase();return!(B===w||F===A)})},[r]),[c,a]=E.useState({}),l=E.useCallback((w,A)=>{a(M=>({...M,[w]:A}))},[]),u=(x=o==null?void 0:o.useBalance)==null?void 0:x.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,d]=E.useState(0),p=E.useMemo(()=>i.map(w=>E.createElement(WS,{key:`${w.tokenAddress}-${f}`,token:w,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:l})),[i,e,s,n,o,l,f]),h=E.useMemo(()=>{const w=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},A=i.map(B=>{const F=c[Qt(B.tokenAddress)],m=F==null?void 0:F.balance,g=m==null?void 0:m.data;return{address:Qt(B.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)||B.decimals}}).filter(B=>B.address),M=A.reduce((B,F)=>({...B,[F.address]:{balance:F}}),{});return{balanceList:A,baseTokenBalance:w,combinedData:M}},[u,c,i]),b=E.useCallback(async()=>h,[h]),S=E.useMemo(()=>{const w=(u==null?void 0:u.isLoading)||!1,A=Object.values(c).some(M=>{var B;return(B=M.balance)==null?void 0:B.isLoading});return w||A},[u==null?void 0:u.isLoading,c]),P=E.useCallback(()=>d(w=>w+1),[]);return{multicallRun:b,multicallRefresh:P,multicallResult:h,validErcTokens:i,isLoading:S,queryComponents:p}},VS=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:l}=Et(),u=i.useAccount(),f=t.tokenList.find(_=>_.token===n||_.symbol===n),d=t.chainId,[p,h]=E.useState("");E.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:b,queryComponents:S}=HS({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),P=E.useMemo(()=>{var H;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return b.baseTokenBalance.formatted;const _=b.combinedData[f.tokenAddress];return((H=_==null?void 0:_.balance)==null?void 0:H.formatted)||"0"},[f,b]),x="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",w="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",A=E.useMemo(()=>{var _,H;return b5({chain:w5,transport:v5(t.rpcUrl||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_42161)||((H=window==null?void 0:window.ENV)==null?void 0:H.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),M="1000000000000",{formatted:B}=x5({client:A,tokenAddress:x,holder:w,decimals:6,fallbackFormatted:M,pollingInterval:12e3}),[F,m]=E.useState(!1),{approve:g,onApprove:v}=US({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:p,wagmiHooks:i}),$=E.useCallback(async()=>{if(!F)try{m(!0),await v()}catch(_){console.error("Approve failed:",_)}finally{m(!1)}},[F,v]),N=E.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),O=E.useCallback(async()=>{c&&c(d)},[c,d]);E.useEffect(()=>{N&&O()},[N,O]);const{showLayerZeroTip:k,layerZeroTipKey:y}=E.useMemo(()=>{const _=+t.chainId==42161||+t.chainId==421614,H=(n==null?void 0:n.toUpperCase())==="USDT",Y=new Ce(p||"0"),G=new Ce("200000");let W=!1,Z;if(_&&H&&p)if(Y.gte(G))W=!0,Z="deposit.layerZeroDepositTipGte200k";else{const J=B;if(typeof J=="string"&&J.length>0){const fe=new Ce(J);!fe.isNaN()&&Y.gte(fe)&&(W=!0,Z="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:W,layerZeroTipKey:Z}},[t.chainId,n,p,B]),C=E.useCallback(()=>RS(+t.chainId,P||"0",n,r),[P,t==null?void 0:t.chainId,n,r]),I=E.useMemo(()=>r!=="spot"&&FS(+t.chainId,p,n),[r,t==null?void 0:t.chainId,p,n]),T=E.useMemo(()=>"deposit.maxDepositSplitTip",[]),L=zS({isNetworkMismatch:N,depositAmount:p,approved:g,currentTokenBalance:P,selectedToken:n,showLayerZeroTip:k,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),j=_=>{const H=_.target.value,Y=C(),G=xi(H,Y);if(G.isValid)h(G.formattedValue),G.errorType;else return G.errorType==="exceed_balance",void 0},z=E.useCallback(async()=>{Ei(!0);try{a&&a({amount:p,chainId:d,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(_){console.error("Deposit error:",_),Ei(!1)}},[a,p,d,f==null?void 0:f.tokenAddress,r,n]);return D.jsxs(D.Fragment,{children:[S,D.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[D.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[D.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:p,onChange:j,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"}),D.jsx("button",{onClick:()=>{const _=C();h(_)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),D.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),D.jsxs("div",{className:"flex justify-between items-center",children:[D.jsx(nr,{content:l("deposit.availableDesc"),children:D.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),D.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:LS(P||"0",p,n)})]})]}),!g&&MS(p||"0",0)&&D.jsxs("div",{className:"flex justify-center flex-col items-center",children:[D.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:l("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),D.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:l("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),D.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:$,disabled:F,children:F?D.jsx(Jo,{size:"xs",inline:!0}):l("deposit.enableWithToken",{token:n})})]}),k&&D.jsxs(D.Fragment,{children:[D.jsxs("div",{className:"flex mb-4",children:[D.jsx("div",{className:"w-5",children:D.jsx("img",{src:Qo,className:"w-4 h-4",alt:"Warning"})}),D.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(y||"deposit.layerZeroDepositTip")})]}),D.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),I&&D.jsxs("div",{className:"flex mb-4",children:[D.jsx("div",{className:"w-5",children:D.jsx("img",{src:Qo,className:"w-4 h-4",alt:"Warning"})}),D.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(T)})]}),I&&D.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),D.jsxs("div",{className:"flex mb-4",children:[D.jsx("div",{className:"w-5",children:!(I||k)&&D.jsx("img",{src:Qo,className:"w-4 h-4",alt:"Warning"})}),D.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:l("deposit.noPrivateKeyWalletWarning")})]}),D.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[D.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[D.jsx("span",{className:"text-sm text-text-tertiary",children:l("deposit.arrivalTime")}),D.jsx(nr,{content:D.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[D.jsx("p",{children:l("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),D.jsx("p",{children:l("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:D.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:l("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),D.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[D.jsx("span",{className:"text-sm text-text-tertiary",children:l("deposit.equity")}),D.jsx("span",{className:"text-sm text-text-primary font-medium",children:p?D.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o),D.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Mt((parseFloat(o)+parseFloat(p)).toString())," ",n]}):`${Mt(o)} ${n}`})]})]}),D.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${L.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:L.disabled||s,children:[(s||N)&&D.jsx(Jo,{size:"xs"}),L.text]})]})},vm=e=>e.toLocaleUpperCase()===Sn?Sn:mc,Ol=e=>vm(e.wallet)===Sn,GS=e=>vm(e.wallet)===mc,wm=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultSymbol:c,defaultAccountType:a="perpetual",balances:l,wagmiHooks:u,onDeposit:f,onCopy:d,onChainChange:p,onTokenChange:h})=>{const{t:b}=Et(),[S,P]=E.useState(a),x=E.useCallback(j=>j==="spot"&&s&&s.length>0?s:o,[o,s]),w=x(a),A=()=>{var W;if(!w||w.length===0)return{chainId:1,token:""};const j=i||((W=w[0])==null?void 0:W.chainId),z=w.find(Z=>Z.chainId===j)||w[0],_=(z==null?void 0:z.tokenList)||[],H=(c||"").toUpperCase();if(H&&_.length>0){const Z=_.find(J=>(J.token||J.symbol||"").toUpperCase()===H);if(Z)return{chainId:z.chainId,token:Z.token||Z.symbol||""}}if(H)for(const Z of w){const ee=((Z==null?void 0:Z.tokenList)||[]).find(fe=>(fe.token||fe.symbol||"").toUpperCase()===H);if(ee)return{chainId:Z.chainId,token:ee.token||ee.symbol||""}}const Y=_.length>0?z:w.find(Z=>(Z.tokenList||[]).length>0)||z,G=((Y==null?void 0:Y.tokenList)||[])[0];return{chainId:(Y==null?void 0:Y.chainId)||z.chainId||1,token:(G==null?void 0:G.token)||(G==null?void 0:G.symbol)||""}},[{chainId:M,token:B}]=E.useState(()=>A()),[F,m]=E.useState(M),g=E.useMemo(()=>x(S),[S,x]),v=g.find(j=>j.chainId===F)||g[0],[$,N]=E.useState(B),O=E.useCallback(j=>{m(j),p==null||p(j)},[p]),k=E.useCallback(j=>{N(j),h==null||h(j)},[h]),y=E.useMemo(()=>{const j=($||"").toLowerCase();if(!j)return"0";const z=S==="spot"?l==null?void 0:l.spot:l==null?void 0:l.perpetual,_=z==null?void 0:z[j];return typeof _=="string"&&_.length>0?_:"0"},[l,S,$]),[C,I]=E.useState(!1),T=j=>{j.target===j.currentTarget?I(!0):I(!1)},L=j=>{C&&j.target===j.currentTarget&&n(),I(!1)};return e?je.createPortal(D.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:D.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:T,onMouseUp:L,"aria-hidden":"true",children:D.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:j=>{j.stopPropagation()},children:[D.jsxs("div",{className:"flex items-center justify-between mb-4",children:[D.jsx("h2",{className:"text-lg font-semibold text-white",children:b("deposit.title")}),D.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:D.jsx(y0,{className:"h-4 w-4"})})]}),D.jsx(Ch,{selectedAccount:S,onAccountChange:j=>{var ee,fe;const z=j||"perpetual";P(z);const _=x(z);if(!_||_.length===0)return;const H=_.find(pe=>pe.chainId===F),Y=H?H.chainId:_[0].chainId;m(Y),p==null||p(Y);const G=_.find(pe=>pe.chainId===Y),W=(G==null?void 0:G.tokenList)||[],J=W.some(pe=>(pe.symbol||pe.token)===$)?$:((ee=W[0])==null?void 0:ee.symbol)||((fe=W[0])==null?void 0:fe.token)||"";J&&(N(J),h==null||h(J))},className:"w-full"}),D.jsx(Nh,{currentActiveChain:v,chainList:g,onChainChange:O,curSelectToken:$,onTokenChange:k,walletType:Ol(r)?Sn:mc,accountType:S}),Ol(r)&&D.jsx(DS,{address:r.smartWalletAddress,currentActiveChain:v,selectedToken:$,accountType:S,onDeposit:f,onCopy:d,onClose:n}),GS(r)&&D.jsx(VS,{address:r.ethAddress,currentActiveChain:v,selectedToken:$,accountType:S,platformBalance:y,isLoading:t,wagmiHooks:u,onChainChange:O,onDeposit:f,onClose:n})]})})}),document.body):null},Il=6,qS=(e,t=Il)=>{const n=Number(e);return!Number.isFinite(n)||n<0?t:Math.floor(n)},ZS=e=>{if(e==null||e==="")return null;try{const t=new Ce(e);return!t.isFinite()||t.isNaN()||t.lte(0)?null:t.decimalPlaces()??0}catch{return null}},es=(e,t)=>{if(!e)return e;const n=Math.max(0,Math.floor(t));if(e===".")return n===0?"0":"0.";if((e.match(/\./g)||[]).length!==1)return e;const[o,s=""]=e.split(".");return n===0?o:s.length<=n?e:`${o}.${s.slice(0,n)}`},KS=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",decimals:i=Il,walletType:c="evm",receiverAddress:a="",accountType:l="perpetual",onWithdrawAmountChange:u,onReceiverAddressChange:f,onAmountChanged:d,showPoolBalanceInsufficientTip:p=!1})=>{const{t:h}=Et(),b=E.useMemo(()=>{const m=qS((n==null?void 0:n.decimals)??i,Il),g=ZS((n==null?void 0:n.stepSize)??(n==null?void 0:n.stepsize));return g===null?m:Math.min(m,g)},[i,n==null?void 0:n.decimals,n==null?void 0:n.stepSize,n==null?void 0:n.stepsize]),S=E.useMemo(()=>{if(l==="spot"||!dn(r==null?void 0:r.chainId)){const m=new Ce(e||"0").minus(s||"0");if(m.isNegative()||m.isZero())return"0";const g=Math.min(m.decimalPlaces()??0,18);return m.decimalPlaces(g,Ce.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,l]),P=E.useMemo(()=>o||"0",[o]),x=E.useMemo(()=>{const m=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ce(m||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),w=E.useMemo(()=>x==="0",[x]),A=E.useMemo(()=>{const m=(t||"").toUpperCase();return m==="USDT"||m==="USDC"},[t]),M=m=>{const g=m.target.value,v=es(g,b),N=xi(v,P||"0");if(N.isValid){const O=es(N.formattedValue,b);u(O),N.errorType}else return N.errorType==="exceed_balance",void 0;d==null||d(es(N.formattedValue,b))},B=()=>{const m=P||"0",g=es(m,b),v=xi(g,m),$=es(v.formattedValue,b);u($),d==null||d($)},F=()=>{const m=parseFloat(o||"0"),g=parseFloat(e||"0");if(g>0){const v=m-g,$=Mt(Math.max(0,v).toString());return D.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o||"0"),D.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),$," ",t]})}return`${Mt(o||"0")} ${t}`};return D.jsxs(D.Fragment,{children:[D.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[D.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[D.jsx("input",{type:"text",placeholder:h("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"}),D.jsx("button",{onClick:B,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:h("deposit.max")})]}),D.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),D.jsxs("div",{className:"flex justify-between items-center",children:[D.jsx(nr,{content:h("withdraw.availableDesc"),children:D.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:h("deposit.available")})}),D.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:F()})]})]}),c==="mpc"&&(l==="spot"||!dn(r==null?void 0:r.chainId))?D.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:D.jsx("input",{type:"text",placeholder:h("withdraw.receiverAddress"),value:a,onChange:m=>f==null?void 0:f(m.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"})}):null,l!=="spot"&&D.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:dn(r==null?void 0:r.chainId)?D.jsxs(D.Fragment,{children:[D.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:h("withdraw.noticeDesc")}),D.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:h("withdraw.commonWithdraw")})]}):D.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:h("withdraw.crossChainTips")})}),p&&D.jsxs("div",{className:"flex mb-4",children:[D.jsx("div",{className:"w-5",children:D.jsx("img",{src:Qo,className:"w-4 h-4",alt:"Warning"})}),D.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:h("withdraw.poolBalanceInsufficientTip")})]}),D.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[D.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[D.jsx(nr,{content:D.jsxs("div",{children:[D.jsx("div",{children:h("withdraw.speedNote")}),D.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[D.jsx(Ko,{selectedLevel:Dt.FAST,maxLevel:3}),D.jsx("span",{children:h("withdraw.speedNoteSpeed1")})]}),D.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[D.jsx(Ko,{selectedLevel:Dt.Medium,maxLevel:3}),D.jsx("span",{children:h("withdraw.speedNoteSpeed2")})]}),D.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[D.jsx(Ko,{selectedLevel:Dt.SLOW,maxLevel:3}),D.jsx("span",{children:h("withdraw.speedNoteSpeed3")})]})]}),children:D.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:h("withdraw.speed")})}),D.jsx("div",{className:"flex items-center",children:D.jsx(Ko,{selectedLevel:dn(r==null?void 0:r.chainId)?Dt.SLOW:Dt.FAST,maxLevel:3})})]}),(l==="spot"||!dn(r==null?void 0:r.chainId))&&D.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[w||!A?D.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:w?h("withdraw.fee"):`${h("withdraw.fee")}/${h("withdraw.feeRate")}`}):D.jsx(nr,{className:"w-[320px] font-normal flex items-center justify-center",content:D.jsx("span",{className:"flex items-center justify-center text-center",children:h("withdraw.feeCalculationTip")}),children:D.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${h("withdraw.fee")}/${h("withdraw.feeRate")}`})}),D.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!w&&` / ${x}%`]})]}),D.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[D.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:h(dn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),D.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Mt(S)," ",t]})]})]})]})},YS=[];let Qe=null;const xm=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=E.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),l=E.useCallback(h=>{c(b=>({...b,...h}))},[]),u=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),d=E.useCallback(()=>n,[n]),p=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:d,isLoading:p}),[a,u,l,f,d,p]),E.useEffect(()=>(Qe={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:d,isLoading:p},()=>{Qe=null}),[a,u,l,f,d,p]),n?D.jsx(Am,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||YS,spotChains:i.spotChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});xm.displayName="WithdrawManager";const Em=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:""}})},Sm=()=>{if(!Qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Qe.closeWithdraw()},Pm=e=>{if(!Qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Qe.updateWithdrawOptions(e)},Si=e=>{if(!Qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Qe.setWithdrawLoading(e)},XS=()=>Qe?Qe.isOpen():!1,Tm=()=>Qe?Qe.isLoading():!1,QS=()=>({openWithdraw:Em,closeWithdraw:Sm,updateWithdrawOptions:Pm,setWithdrawLoading:Si,isOpen:XS,isLoading:Tm}),JS=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultSymbol:o,defaultAmount:s="",defaultAccountType:i="perpetual",currentEquity:c,platformBalance:a="0",balances:l,fee:u="0.00",isLoading:f=!1,onWithdraw:d,onClose:p,onChainChange:h,onTokenChange:b,onAmountChanged:S,onAccountChange:P})=>{var W;const{t:x}=Et(),[w,A]=E.useState(i),M=E.useCallback(Z=>Z==="spot"&&n&&n.length>0?n:t,[t,n]),B=E.useMemo(()=>M(w),[w,M]),F=E.useMemo(()=>{if(!B||B.length===0)return{chainId:1,tokenSymbol:""};const Z=he=>{const ie=he||[];if(!ie.length)return"";const ne="USDC".toUpperCase(),kn=ie.find(vt=>(vt.token||vt.symbol||"").toUpperCase()===ne)||ie[0];return kn.token||kn.symbol||""};if(o){const he=o==null?void 0:o.toUpperCase();for(const ie of B){const me=ie.tokenList||[];let ne;if(he&&(ne=me.find(Se=>(Se.token||Se.symbol||"").toUpperCase()===he)),ne){const Se=ne.token||ne.symbol||o||"";return{chainId:ie.chainId,tokenSymbol:Se}}}}if(r){const he=B.find(ne=>ne.chainId===r)||B[0],ie=he.tokenList||[],me=Z(ie);return{chainId:he.chainId,tokenSymbol:me}}const J="USDC",ee=he=>Array.isArray(he.tokenList)&&he.tokenList.some(ie=>(ie.token||ie.symbol||"").toUpperCase()===J),fe=B.find(ee)||B[0];if(!fe)return{chainId:1,tokenSymbol:""};const pe=Z(fe.tokenList);return{chainId:fe.chainId,tokenSymbol:pe}},[B,r,o]),[m,g]=E.useState(()=>F.chainId),[v,$]=E.useState(()=>F.tokenSymbol),[N,O]=E.useState(s),[k,y]=E.useState(""),C=E.useCallback(Z=>{g(Z),h==null||h(Z)},[h]),I=E.useCallback(Z=>{$(Z),b==null||b(Z)},[b]),T=E.useRef(!0),L=E.useRef(v),j=E.useRef(m);E.useEffect(()=>{if(T.current){T.current=!1,L.current=v,j.current=m;return}(L.current!==v||j.current!==m)&&(O(""),L.current=v,j.current=m)},[v,m]);const z=B&&B.length>0?B.find(Z=>Z.chainId===m)||B[0]:null,_=(W=z==null?void 0:z.tokenList)==null?void 0:W.find(Z=>Z.token===v),H=E.useMemo(()=>{const Z=new Ce(N||"0"),J=new Ce(u||"0"),ee=dn(m);return _!=null&&_.minWithdrawSize&&Z.lt(_.minWithdrawSize)?{text:x("withdraw.minWithdrawParsed",{amount:_.minWithdrawSize,token:_.symbol||_.token}),disabled:!0}:!N||Z.isZero()||!ee&&Z.isLessThan(J)?{text:x("withdraw.confirmWithdraw"),disabled:!0}:e==="mpc"&&(!ee||w==="spot")&&!k.trim()?{text:x("withdraw.invalidReceiverAddress"),disabled:!0}:{text:x("withdraw.confirmWithdraw"),disabled:!1}},[x,m,N,e,k,u,w,_]),Y=E.useMemo(()=>{const Z=(v||"").toLowerCase();if(!Z)return a||"0";const J=w==="spot"?l==null?void 0:l.spot:l==null?void 0:l.perpetual,ee=J==null?void 0:J[Z];return typeof ee=="string"&&ee.length>0?ee:a||"0"},[l,w,v,a]),G=E.useCallback(async()=>{Si(!0);try{if(d){const J={amount:new Ce(N||"0").toString(),chainId:m,tokenAddress:(_==null?void 0:_.tokenAddress)||"",coinId:(_==null?void 0:_.coinId)||"",tokenSymbol:v,accountType:w,selectedToken:_};e==="mpc"&&(!dn(m)||w==="spot")&&(J.receiverAddress=k),d(J)}}catch{Si(!1)}},[d,w,_,N,m,v,e,k]);return!B||B.length===0?D.jsx("div",{className:"text-center py-8",children:D.jsx("p",{className:"text-gray-400",children:"No chains available"})}):z?D.jsxs(D.Fragment,{children:[D.jsx(Ch,{selectedAccount:w,onAccountChange:Z=>{var Se,kn;const J=Z||"perpetual";A(J),P==null||P(J);const ee=M(J);if(!ee||ee.length===0)return;const fe=ee.find(vt=>vt.chainId===m),pe=fe?fe.chainId:ee[0].chainId;g(pe),h==null||h(pe);const he=ee.find(vt=>vt.chainId===pe),ie=(he==null?void 0:he.tokenList)||[],ne=ie.some(vt=>(vt.symbol||vt.token)===v)?v:((Se=ie[0])==null?void 0:Se.symbol)||((kn=ie[0])==null?void 0:kn.token)||"";ne&&($(ne),b==null||b(ne))},className:"w-full"}),D.jsx(Nh,{currentActiveChain:z,chainList:B,onChainChange:C,curSelectToken:v,onTokenChange:I,walletType:"EVM",txType:"withdraw"}),D.jsx(KS,{withdrawAmount:N,curSelectToken:v,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:z,currentEquity:c||0,decimals:(_==null?void 0:_.decimals)??6,platformBalance:Y,fee:u,walletType:e,accountType:w,receiverAddress:k,onWithdrawAmountChange:O,onReceiverAddressChange:y,onAmountChanged:S}),D.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${H.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:G,disabled:H.disabled||f,children:[f&&D.jsx(Jo,{size:"xs"}),H.text]})]}):D.jsx("div",{className:"text-center py-8",children:D.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Am=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultSymbol:l,defaultAmount:u="",currentEquity:f=5e3,platformBalance:d="0",balances:p,fee:h,wagmiHooks:b,onWithdraw:S,onChainChange:P,onTokenChange:x,onAmountChanged:w,onAccountChange:A})=>{const{t:M}=Et(),[B,F]=E.useState(!1),m=v=>{v.target===v.currentTarget?F(!0):F(!1)},g=v=>{B&&v.target===v.currentTarget&&r(),F(!1)};return e?je.createPortal(D.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:D.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:m,onMouseUp:g,"aria-hidden":"true",children:D.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:v=>{v.stopPropagation()},children:[D.jsxs("div",{className:"flex items-center justify-between mb-4",children:[D.jsx("h2",{className:"text-lg font-semibold text-white",children:M("withdraw.withdraw")}),D.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:D.jsx(y0,{className:"h-4 w-4"})})]}),D.jsx(JS,{chains:i,spotChains:c,walletType:Ol(s)?"mpc":"evm",defaultChainId:a,defaultSymbol:l,defaultAmount:u,defaultAccountType:n,currentEquity:f,platformBalance:d,balances:p,fee:h,isLoading:t,wagmiHooks:b,onWithdraw:S,onClose:r,onChainChange:P,onTokenChange:x,onAmountChanged:w,onAccountChange:A})]})})}),document.body):null};se.ChromeLoader=Jo,se.ComponentProvider=tb,se.DEFAULT_LOCALE=ns,se.Deposit=wm,se.DepositManager=hm,se.LOCALE_NAMES=Qm,se.LoadingSpinner=Jo,se.SUPPORTED_LOCALES=Ai,se.Tooltip=nr,se.Withdraw=Am,se.WithdrawManager=xm,se.closeDeposit=bm,se.closeWithdraw=Sm,se.formatThousands=rb,se.isDepositLoading=ym,se.isWithdrawLoading=Tm,se.openDeposit=mm,se.openWithdraw=Em,se.setDepositLoading=Ei,se.setWithdrawLoading=Si,se.updateDepositOptions=gm,se.updateWithdrawOptions=Pm,se.useComponentConfig=Hl,se.useDeposit=E5,se.useDepositManager=_S,se.useTranslation=Et,se.useWithdraw=S5,se.useWithdrawManager=QS,Object.defineProperty(se,Symbol.toStringTag,{value:"Module"})});
185
+ `,children:[t,o&&M.jsx(pm,{ref:f,placement:h.placement||n})]})})]})},Qo="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=",LS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,onDeposit:o,onCopy:s,onClose:i})=>{const{t:c}=Et(),a=r===$5,l=E.useMemo(()=>{if(!e)return!1;const h=Number(e.chainId);return!Number.isNaN(h)&&(h===42161||h===421614)},[e]),u=a,f=E.useMemo(()=>{var h;return(h=e==null?void 0:e.tokenList)==null?void 0:h.find(b=>b.token===t||b.symbol===t)},[e,t]),d=E.useMemo(()=>{const h=(t||"").toUpperCase();if(!u&&h==="USDC")return c("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const P=c(u?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return u&&(!l||h==="USDC")?String(P).split(`
186
+ `)[0]:P},[c,t,e==null?void 0:e.chain,u,l]),p=(f==null?void 0:f.minDepositSize)||"10";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(Kh,{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(R3,{onCopy:()=>{s&&s(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:Qo,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:d})})]}),r===b0&&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:c("deposit.addressUpdatedNotice")})]})]}),M.jsxs("div",{className:"text-sm",children:[(a||t.toUpperCase()!=="USDC")&&M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[M.jsx("span",{className:"text-text-tertiary",children:c("deposit.arrivalTime")}),M.jsx(nr,{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:c("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),M.jsx("p",{children:c("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:c("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),M.jsxs("div",{className:`flex justify-between items-center h-[18px] ${a||t.toUpperCase()!=="USDC"?"mt-1":"mt-4"}`,children:[M.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:[p," ",t]})]}),r===b0&&t.toUpperCase()!=="USDC"&&M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[M.jsx("span",{className:"text-text-tertiary",children:c("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:()=>{o&&o({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),i()},children:c("deposit.title")})]})},Jo=({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"})},BS=(e,t)=>Number(e)>Number(t),kt=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"},es=(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 es(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:kt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},FS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=kt(Math.max(0,s).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[kt(e),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${kt(e)} ${n}`},RS=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},jS=(e,t,n)=>{if(!Nh(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}},_S=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&Nh(e,n))try{const i=new $e(o),c=new $e("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new $e(o||"0");return console.log("bn:",i),console.log("bn:",i.isNaN()),i.isNaN()?o:i.decimalPlaces(6,$e.ROUND_DOWN).toString()}catch{return o}},hm={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let Xe=null;const mm=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState(hm),a=E.useCallback(h=>{c(h),r(!0)},[]),l=E.useCallback(h=>{c(b=>({...b,...h}))},[]),u=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),d=E.useCallback(()=>n,[n]),p=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:d,isLoading:p}),[a,u,l,f,d,p]),E.useEffect(()=>(Xe={openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:d,isLoading:p},()=>{Xe=null}),[a,u,l,f,d,p]),n?M.jsx(Em,{isOpen:n,isLoading:o,onClose:u,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var b;return(b=i.onChainChange)==null?void 0:b.call(i,h)},onTokenChange:h=>{var b;return(b=i.onTokenChange)==null?void 0:b.call(i,h)}}):null});mm.displayName="DepositManager";const bm=e=>{if(!Xe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Xe.openDeposit(e||hm)},gm=()=>{if(!Xe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Xe.closeDeposit()},ym=e=>{Xe&&Xe.updateDepositOptions(e)},Ei=e=>{if(!Xe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Xe.setDepositLoading(e)},zS=()=>Xe?Xe.isOpen():!1,vm=()=>Xe?Xe.isLoading():!1,US=()=>({openDeposit:bm,closeDeposit:gm,updateDepositOptions:ym,setDepositLoading:Ei,isOpen:zS,isLoading:vm}),WS=e=>{const{t}=Et(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return E.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const l=parseFloat(r||"0"),u=a,f=RS(r,s||"0",o);return!r||l===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:l<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function HS(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:l}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,d=o==null?void 0:o.contractAddress,p=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=l(),{writeContractAsync:b}=c(),S=a(),P=i({address:u,abi:Er,functionName:"allowance",args:[Qt(t||""),d],chainId:r,query:{enabled:!!(!p&&t&&r&&u&&d)}}),x=P!=null&&P.isSuccess?P.data:void 0,w=E.useMemo(()=>{if(p)return!0;if(!P.isSuccess||x===void 0||x===0n)return!1;try{const k=k6(String(Number(s||"0")||0),Number(f));return x>=k}catch{return!1}},[p,P.isSuccess,x,s,f]),$=E.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!b||!S||!u||!d)return;const B=Qt(u),F=Qt(d);if((x||0n)>0n){const v=await b({abi:Er,address:B,functionName:"approve",args:[F,0n]});await S.waitForTransactionReceipt({hash:v})}const g=await b({abi:Er,address:B,functionName:"approve",args:[F,uf]});await S.waitForTransactionReceipt({hash:g}),P!=null&&P.refetch&&await P.refetch()}catch(k){console.error("[useApprove] onApprove failed:",k)}},[r,n,u,d,x,P,b,S,h]);return{approve:w,onApprove:$}}const VS=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return E.useEffect(()=>{o(Qt(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},GS=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var x;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=E.useMemo(()=>{const w="0x0000000000000000000000000000000000000000",$="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(k=>{const B=k.tokenAddress;if(!B)return!1;const F=B.toLowerCase();return!(B===w||F===$)})},[r]),[c,a]=E.useState({}),l=E.useCallback((w,$)=>{a(k=>({...k,[w]:$}))},[]),u=(x=o==null?void 0:o.useBalance)==null?void 0:x.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,d]=E.useState(0),p=E.useMemo(()=>i.map(w=>E.createElement(VS,{key:`${w.tokenAddress}-${f}`,token:w,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:l})),[i,e,s,n,o,l,f]),h=E.useMemo(()=>{const w=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"},$=i.map(B=>{const F=c[Qt(B.tokenAddress)],m=F==null?void 0:F.balance,g=m==null?void 0:m.data;return{address:Qt(B.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)||B.decimals}}).filter(B=>B.address),k=$.reduce((B,F)=>({...B,[F.address]:{balance:F}}),{});return{balanceList:$,baseTokenBalance:w,combinedData:k}},[u,c,i]),b=E.useCallback(async()=>h,[h]),S=E.useMemo(()=>{const w=(u==null?void 0:u.isLoading)||!1,$=Object.values(c).some(k=>{var B;return(B=k.balance)==null?void 0:B.isLoading});return w||$},[u==null?void 0:u.isLoading,c]),P=E.useCallback(()=>d(w=>w+1),[]);return{multicallRun:b,multicallRefresh:P,multicallResult:h,validErcTokens:i,isLoading:S,queryComponents:p}},wm=6,qS=(e,t=wm)=>{const n=Number(e);return!Number.isFinite(n)||n<0?t:Math.floor(n)},ZS=e=>{if(e==null||e==="")return null;try{const t=new $e(e);return!t.isFinite()||t.isNaN()||t.lte(0)?null:t.decimalPlaces()??0}catch{return null}},Si=(e,t)=>{if(!e)return e;const n=Math.max(0,Math.floor(t));if(e===".")return n===0?"0":"0.";if((e.match(/\./g)||[]).length!==1)return e;const[o,s=""]=e.split(".");return n===0?o:s.length<=n?e:`${o}.${s.slice(0,n)}`},KS=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:l}=Et(),u=i.useAccount(),f=t.tokenList.find(W=>W.token===n||W.symbol===n),d=t.chainId,[p,h]=E.useState("");E.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:b,queryComponents:S}=GS({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),P=E.useMemo(()=>{var K;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return b.baseTokenBalance.formatted;const W=b.combinedData[f.tokenAddress];return((K=W==null?void 0:W.balance)==null?void 0:K.formatted)||"0"},[f,b]),x="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",w="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",$=E.useMemo(()=>{var W,K;return y5({chain:E5,transport:x5(t.rpcUrl||((W=window==null?void 0:window.ENV)==null?void 0:W.CHAIN_RPC_URL_42161)||((K=window==null?void 0:window.ENV)==null?void 0:K.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),k="1000000000000",{formatted:B}=S5({client:$,tokenAddress:x,holder:w,decimals:6,fallbackFormatted:k,pollingInterval:12e3}),[F,m]=E.useState(!1),{approve:g,onApprove:v}=HS({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:p,wagmiHooks:i}),A=E.useCallback(async()=>{if(!F)try{m(!0),await v()}catch(W){console.error("Approve failed:",W)}finally{m(!1)}},[F,v]),N=E.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),O=E.useCallback(async()=>{c&&c(d)},[c,d]);E.useEffect(()=>{N&&O()},[N,O]);const{showLayerZeroTip:D,layerZeroTipKey:y}=E.useMemo(()=>{const W=+t.chainId==42161||+t.chainId==421614,K=(n==null?void 0:n.toUpperCase())==="USDT",G=new $e(p||"0"),H=new $e("200000");let q=!1,Q;if(W&&K&&p)if(G.gte(H))q=!0,Q="deposit.layerZeroDepositTipGte200k";else{const ee=B;if(typeof ee=="string"&&ee.length>0){const le=new $e(ee);!le.isNaN()&&G.gte(le)&&(q=!0,Q="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:q,layerZeroTipKey:Q}},[t.chainId,n,p,B]),C=E.useCallback(()=>_S(+t.chainId,P||"0",n,r),[P,t==null?void 0:t.chainId,n,r]),I=E.useMemo(()=>{const W=qS(f==null?void 0:f.decimals,wm),K=ZS((f==null?void 0:f.stepSize)??(f==null?void 0:f.stepsize));return K===null?W:Math.min(W,K)},[f==null?void 0:f.decimals,f==null?void 0:f.stepSize,f==null?void 0:f.stepsize]),T=E.useMemo(()=>r!=="spot"&&jS(+t.chainId,p,n),[r,t==null?void 0:t.chainId,p,n]),L=E.useMemo(()=>"deposit.maxDepositSplitTip",[]),j=WS({isNetworkMismatch:N,depositAmount:p,approved:g,currentTokenBalance:P,selectedToken:n,showLayerZeroTip:D,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),z=W=>{const K=W.target.value,G=Si(K,I),H=C(),q=es(G,H);if(q.isValid){const Q=Si(q.formattedValue,I);h(Q),q.errorType}else return q.errorType==="exceed_balance",void 0},_=E.useCallback(async()=>{Ei(!0);try{a&&a({amount:p,chainId:d,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(W){console.error("Deposit error:",W),Ei(!1)}},[a,p,d,f==null?void 0:f.tokenAddress,r,n]);return M.jsxs(M.Fragment,{children:[S,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:l("deposit.amount"),value:p,onChange:z,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 W=C(),K=Si(W,I),G=es(K,W);h(Si(G.formattedValue,I))},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("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(nr,{content:l("deposit.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:FS(P||"0",p,n)})]})]}),!g&&BS(p||"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:l("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:l("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:F,children:F?M.jsx(Jo,{size:"xs",inline:!0}):l("deposit.enableWithToken",{token:n})})]}),D&&M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Qo,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(y||"deposit.layerZeroDepositTip")})]}),M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),T&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Qo,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(L)})]}),T&&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:!(T||D)&&M.jsx("img",{src:Qo,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:l("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:l("deposit.arrivalTime")}),M.jsx(nr,{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:l("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),M.jsx("p",{children:l("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:l("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:l("deposit.equity")}),M.jsx("span",{className:"text-sm text-text-primary font-medium",children:p?M.jsxs("span",{className:"flex items-center gap-1",children:[kt(o),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),kt((parseFloat(o)+parseFloat(p)).toString())," ",n]}):`${kt(o)} ${n}`})]})]}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${j.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:_,disabled:j.disabled||s,children:[(s||N)&&M.jsx(Jo,{size:"xs"}),j.text]})]})},xm=e=>e.toLocaleUpperCase()===Sn?Sn:bc,Il=e=>xm(e.wallet)===Sn,YS=e=>xm(e.wallet)===bc,Em=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultSymbol:c,defaultAccountType:a="perpetual",balances:l,wagmiHooks:u,onDeposit:f,onCopy:d,onChainChange:p,onTokenChange:h})=>{const{t:b}=Et(),[S,P]=E.useState(a),x=E.useCallback(j=>j==="spot"&&s&&s.length>0?s:o,[o,s]),w=x(a),$=()=>{var H;if(!w||w.length===0)return{chainId:1,token:""};const j=i||((H=w[0])==null?void 0:H.chainId),z=w.find(q=>q.chainId===j)||w[0],_=(z==null?void 0:z.tokenList)||[],W=(c||"").toUpperCase();if(W&&_.length>0){const q=_.find(Q=>(Q.token||Q.symbol||"").toUpperCase()===W);if(q)return{chainId:z.chainId,token:q.token||q.symbol||""}}if(W)for(const q of w){const ee=((q==null?void 0:q.tokenList)||[]).find(pe=>(pe.token||pe.symbol||"").toUpperCase()===W);if(ee)return{chainId:q.chainId,token:ee.token||ee.symbol||""}}const K=_.length>0?z:w.find(q=>(q.tokenList||[]).length>0)||z,G=((K==null?void 0:K.tokenList)||[])[0];return{chainId:(K==null?void 0:K.chainId)||z.chainId||1,token:(G==null?void 0:G.token)||(G==null?void 0:G.symbol)||""}},[{chainId:k,token:B}]=E.useState(()=>$()),[F,m]=E.useState(k),g=E.useMemo(()=>x(S),[S,x]),v=g.find(j=>j.chainId===F)||g[0],[A,N]=E.useState(B),O=E.useCallback(j=>{m(j),p==null||p(j)},[p]),D=E.useCallback(j=>{N(j),h==null||h(j)},[h]),y=E.useMemo(()=>{const j=(A||"").toLowerCase();if(!j)return"0";const z=S==="spot"?l==null?void 0:l.spot:l==null?void 0:l.perpetual,_=z==null?void 0:z[j];return typeof _=="string"&&_.length>0?_:"0"},[l,S,A]),[C,I]=E.useState(!1),T=j=>{j.target===j.currentTarget?I(!0):I(!1)},L=j=>{C&&j.target===j.currentTarget&&n(),I(!1)};return e?je.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:T,onMouseUp:L,"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 border-[2px] border-solid border-line-divider-secondary",onClick:j=>{j.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:b("deposit.title")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(v0,{className:"h-4 w-4"})})]}),M.jsx(Oh,{selectedAccount:S,onAccountChange:j=>{var ee,pe;const z=j||"perpetual";P(z);const _=x(z);if(!_||_.length===0)return;const W=_.find(le=>le.chainId===F),K=W?W.chainId:_[0].chainId;m(K),p==null||p(K);const G=_.find(le=>le.chainId===K),H=(G==null?void 0:G.tokenList)||[],Q=H.some(le=>(le.symbol||le.token)===A)?A:((ee=H[0])==null?void 0:ee.symbol)||((pe=H[0])==null?void 0:pe.token)||"";Q&&(N(Q),h==null||h(Q))},className:"w-full"}),M.jsx(Ch,{currentActiveChain:v,chainList:g,onChainChange:O,curSelectToken:A,onTokenChange:D,walletType:Il(r)?Sn:bc,accountType:S}),Il(r)&&M.jsx(LS,{address:r.smartWalletAddress,currentActiveChain:v,selectedToken:A,accountType:S,onDeposit:f,onCopy:d,onClose:n}),YS(r)&&M.jsx(KS,{address:r.ethAddress,currentActiveChain:v,selectedToken:A,accountType:S,platformBalance:y,isLoading:t,wagmiHooks:u,onChainChange:O,onDeposit:f,onClose:n})]})})}),document.body):null},Dl=6,XS=(e,t=Dl)=>{const n=Number(e);return!Number.isFinite(n)||n<0?t:Math.floor(n)},QS=e=>{if(e==null||e==="")return null;try{const t=new $e(e);return!t.isFinite()||t.isNaN()||t.lte(0)?null:t.decimalPlaces()??0}catch{return null}},ts=(e,t)=>{if(!e)return e;const n=Math.max(0,Math.floor(t));if(e===".")return n===0?"0":"0.";if((e.match(/\./g)||[]).length!==1)return e;const[o,s=""]=e.split(".");return n===0?o:s.length<=n?e:`${o}.${s.slice(0,n)}`},JS=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",decimals:i=Dl,walletType:c="evm",receiverAddress:a="",accountType:l="perpetual",onWithdrawAmountChange:u,onReceiverAddressChange:f,onAmountChanged:d,showPoolBalanceInsufficientTip:p=!1})=>{const{t:h}=Et(),b=E.useMemo(()=>{const m=XS((n==null?void 0:n.decimals)??i,Dl),g=QS((n==null?void 0:n.stepSize)??(n==null?void 0:n.stepsize));return g===null?m:Math.min(m,g)},[i,n==null?void 0:n.decimals,n==null?void 0:n.stepSize,n==null?void 0:n.stepsize]),S=E.useMemo(()=>{if(l==="spot"||!dn(r==null?void 0:r.chainId)){const m=new $e(e||"0").minus(s||"0");if(m.isNegative()||m.isZero())return"0";const g=Math.min(m.decimalPlaces()??0,18);return m.decimalPlaces(g,$e.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,l]),P=E.useMemo(()=>o||"0",[o]),x=E.useMemo(()=>{const m=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new $e(m||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),w=E.useMemo(()=>x==="0",[x]),$=E.useMemo(()=>{const m=(t||"").toUpperCase();return m==="USDT"||m==="USDC"},[t]),k=m=>{const g=m.target.value,v=ts(g,b),N=es(v,P||"0");if(N.isValid){const O=ts(N.formattedValue,b);u(O),N.errorType}else return N.errorType==="exceed_balance",void 0;d==null||d(ts(N.formattedValue,b))},B=()=>{const m=P||"0",g=ts(m,b),v=es(g,m),A=ts(v.formattedValue,b);u(A),d==null||d(A)},F=()=>{const m=parseFloat(o||"0"),g=parseFloat(e||"0");if(g>0){const v=m-g,A=kt(Math.max(0,v).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[kt(o||"0"),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),A," ",t]})}return`${kt(o||"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:h("deposit.amount"),value:e,onChange:k,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:B,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:h("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(nr,{content:h("withdraw.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:h("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:F()})]})]}),c==="mpc"&&(l==="spot"||!dn(r==null?void 0:r.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:h("withdraw.receiverAddress"),value:a,onChange:m=>f==null?void 0:f(m.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"})}):null,l!=="spot"&&M.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:dn(r==null?void 0:r.chainId)?M.jsxs(M.Fragment,{children:[M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:h("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:h("withdraw.commonWithdraw")})]}):M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:h("withdraw.crossChainTips")})}),p&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Qo,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:h("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(nr,{content:M.jsxs("div",{children:[M.jsx("div",{children:h("withdraw.speedNote")}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ko,{selectedLevel:Mt.FAST,maxLevel:3}),M.jsx("span",{children:h("withdraw.speedNoteSpeed1")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ko,{selectedLevel:Mt.Medium,maxLevel:3}),M.jsx("span",{children:h("withdraw.speedNoteSpeed2")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ko,{selectedLevel:Mt.SLOW,maxLevel:3}),M.jsx("span",{children:h("withdraw.speedNoteSpeed3")})]})]}),children:M.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:h("withdraw.speed")})}),M.jsx("div",{className:"flex items-center",children:M.jsx(Ko,{selectedLevel:dn(r==null?void 0:r.chainId)?Mt.SLOW:Mt.FAST,maxLevel:3})})]}),(l==="spot"||!dn(r==null?void 0:r.chainId))&&M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[w||!$?M.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:w?h("withdraw.fee"):`${h("withdraw.fee")}/${h("withdraw.feeRate")}`}):M.jsx(nr,{className:"w-[320px] font-normal flex items-center justify-center",content:M.jsx("span",{className:"flex items-center justify-center text-center",children:h("withdraw.feeCalculationTip")}),children:M.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${h("withdraw.fee")}/${h("withdraw.feeRate")}`})}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!w&&` / ${x}%`]})]}),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:h(dn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[kt(S)," ",t]})]})]})]})},eP=[];let Qe=null;const Sm=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=E.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),l=E.useCallback(h=>{c(b=>({...b,...h}))},[]),u=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),d=E.useCallback(()=>n,[n]),p=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:d,isLoading:p}),[a,u,l,f,d,p]),E.useEffect(()=>(Qe={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:d,isLoading:p},()=>{Qe=null}),[a,u,l,f,d,p]),n?M.jsx(Nm,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||eP,spotChains:i.spotChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});Sm.displayName="WithdrawManager";const Pm=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:""}})},Tm=()=>{if(!Qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Qe.closeWithdraw()},$m=e=>{if(!Qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Qe.updateWithdrawOptions(e)},Pi=e=>{if(!Qe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Qe.setWithdrawLoading(e)},tP=()=>Qe?Qe.isOpen():!1,Am=()=>Qe?Qe.isLoading():!1,nP=()=>({openWithdraw:Pm,closeWithdraw:Tm,updateWithdrawOptions:$m,setWithdrawLoading:Pi,isOpen:tP,isLoading:Am}),rP=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultSymbol:o,defaultAmount:s="",defaultAccountType:i="perpetual",currentEquity:c,platformBalance:a="0",balances:l,fee:u="0.00",isLoading:f=!1,onWithdraw:d,onClose:p,onChainChange:h,onTokenChange:b,onAmountChanged:S,onAccountChange:P})=>{var H;const{t:x}=Et(),[w,$]=E.useState(i),k=E.useCallback(q=>q==="spot"&&n&&n.length>0?n:t,[t,n]),B=E.useMemo(()=>k(w),[w,k]),F=E.useMemo(()=>{if(!B||B.length===0)return{chainId:1,tokenSymbol:""};const q=he=>{const ie=he||[];if(!ie.length)return"";const ne="USDC".toUpperCase(),Dn=ie.find(vt=>(vt.token||vt.symbol||"").toUpperCase()===ne)||ie[0];return Dn.token||Dn.symbol||""};if(o){const he=o==null?void 0:o.toUpperCase();for(const ie of B){const me=ie.tokenList||[];let ne;if(he&&(ne=me.find(Se=>(Se.token||Se.symbol||"").toUpperCase()===he)),ne){const Se=ne.token||ne.symbol||o||"";return{chainId:ie.chainId,tokenSymbol:Se}}}}if(r){const he=B.find(ne=>ne.chainId===r)||B[0],ie=he.tokenList||[],me=q(ie);return{chainId:he.chainId,tokenSymbol:me}}const Q="USDC",ee=he=>Array.isArray(he.tokenList)&&he.tokenList.some(ie=>(ie.token||ie.symbol||"").toUpperCase()===Q),pe=B.find(ee)||B[0];if(!pe)return{chainId:1,tokenSymbol:""};const le=q(pe.tokenList);return{chainId:pe.chainId,tokenSymbol:le}},[B,r,o]),[m,g]=E.useState(()=>F.chainId),[v,A]=E.useState(()=>F.tokenSymbol),[N,O]=E.useState(s),[D,y]=E.useState(""),C=E.useCallback(q=>{g(q),h==null||h(q)},[h]),I=E.useCallback(q=>{A(q),b==null||b(q)},[b]),T=E.useRef(!0),L=E.useRef(v),j=E.useRef(m);E.useEffect(()=>{if(T.current){T.current=!1,L.current=v,j.current=m;return}(L.current!==v||j.current!==m)&&(O(""),L.current=v,j.current=m)},[v,m]);const z=B&&B.length>0?B.find(q=>q.chainId===m)||B[0]:null,_=(H=z==null?void 0:z.tokenList)==null?void 0:H.find(q=>q.token===v),W=E.useMemo(()=>{const q=new $e(N||"0"),Q=new $e(u||"0"),ee=dn(m);return _!=null&&_.minWithdrawSize&&q.lt(_.minWithdrawSize)?{text:x("withdraw.minWithdrawParsed",{amount:_.minWithdrawSize,token:_.symbol||_.token}),disabled:!0}:!N||q.isZero()||!ee&&q.isLessThan(Q)?{text:x("withdraw.confirmWithdraw"),disabled:!0}:e==="mpc"&&(!ee||w==="spot")&&!D.trim()?{text:x("withdraw.invalidReceiverAddress"),disabled:!0}:{text:x("withdraw.confirmWithdraw"),disabled:!1}},[x,m,N,e,D,u,w,_]),K=E.useMemo(()=>{const q=(v||"").toLowerCase();if(!q)return a||"0";const Q=w==="spot"?l==null?void 0:l.spot:l==null?void 0:l.perpetual,ee=Q==null?void 0:Q[q];return typeof ee=="string"&&ee.length>0?ee:a||"0"},[l,w,v,a]),G=E.useCallback(async()=>{Pi(!0);try{if(d){const Q={amount:new $e(N||"0").toString(),chainId:m,tokenAddress:(_==null?void 0:_.tokenAddress)||"",coinId:(_==null?void 0:_.coinId)||"",tokenSymbol:v,accountType:w,selectedToken:_};e==="mpc"&&(!dn(m)||w==="spot")&&(Q.receiverAddress=D),d(Q)}}catch{Pi(!1)}},[d,w,_,N,m,v,e,D]);return!B||B.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):z?M.jsxs(M.Fragment,{children:[M.jsx(Oh,{selectedAccount:w,onAccountChange:q=>{var Se,Dn;const Q=q||"perpetual";$(Q),P==null||P(Q);const ee=k(Q);if(!ee||ee.length===0)return;const pe=ee.find(vt=>vt.chainId===m),le=pe?pe.chainId:ee[0].chainId;g(le),h==null||h(le);const he=ee.find(vt=>vt.chainId===le),ie=(he==null?void 0:he.tokenList)||[],ne=ie.some(vt=>(vt.symbol||vt.token)===v)?v:((Se=ie[0])==null?void 0:Se.symbol)||((Dn=ie[0])==null?void 0:Dn.token)||"";ne&&(A(ne),b==null||b(ne))},className:"w-full"}),M.jsx(Ch,{currentActiveChain:z,chainList:B,onChainChange:C,curSelectToken:v,onTokenChange:I,walletType:"EVM",txType:"withdraw"}),M.jsx(JS,{withdrawAmount:N,curSelectToken:v,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:z,currentEquity:c||0,decimals:(_==null?void 0:_.decimals)??6,platformBalance:K,fee:u,walletType:e,accountType:w,receiverAddress:D,onWithdrawAmountChange:O,onReceiverAddressChange:y,onAmountChanged:S}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${W.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:G,disabled:W.disabled||f,children:[f&&M.jsx(Jo,{size:"xs"}),W.text]})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Nm=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultSymbol:l,defaultAmount:u="",currentEquity:f=5e3,platformBalance:d="0",balances:p,fee:h,wagmiHooks:b,onWithdraw:S,onChainChange:P,onTokenChange:x,onAmountChanged:w,onAccountChange:$})=>{const{t:k}=Et(),[B,F]=E.useState(!1),m=v=>{v.target===v.currentTarget?F(!0):F(!1)},g=v=>{B&&v.target===v.currentTarget&&r(),F(!1)};return e?je.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:m,onMouseUp:g,"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:v=>{v.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:k("withdraw.withdraw")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:M.jsx(v0,{className:"h-4 w-4"})})]}),M.jsx(rP,{chains:i,spotChains:c,walletType:Il(s)?"mpc":"evm",defaultChainId:a,defaultSymbol:l,defaultAmount:u,defaultAccountType:n,currentEquity:f,platformBalance:d,balances:p,fee:h,isLoading:t,wagmiHooks:b,onWithdraw:S,onClose:r,onChainChange:P,onTokenChange:x,onAmountChanged:w,onAccountChange:$})]})})}),document.body):null};se.ChromeLoader=Jo,se.ComponentProvider=rb,se.DEFAULT_LOCALE=rs,se.Deposit=Em,se.DepositManager=mm,se.LOCALE_NAMES=eb,se.LoadingSpinner=Jo,se.SUPPORTED_LOCALES=Ai,se.Tooltip=nr,se.Withdraw=Nm,se.WithdrawManager=Sm,se.closeDeposit=gm,se.closeWithdraw=Tm,se.formatThousands=sb,se.isDepositLoading=vm,se.isWithdrawLoading=Am,se.openDeposit=bm,se.openWithdraw=Pm,se.setDepositLoading=Ei,se.setWithdrawLoading=Pi,se.updateDepositOptions=ym,se.updateWithdrawOptions=$m,se.useComponentConfig=Vl,se.useDeposit=P5,se.useDepositManager=US,se.useTranslation=Et,se.useWithdraw=T5,se.useWithdrawManager=nP,Object.defineProperty(se,Symbol.toStringTag,{value:"Module"})});
187
187
  //# sourceMappingURL=index.umd.js.map