@edgex-web/components 1.0.0-beta.7 → 1.0.0-beta.9
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/{ccip-PikfM9kh.mjs → ccip-NjFsH2bp.mjs} +2 -2
- package/dist/{ccip-PikfM9kh.mjs.map → ccip-NjFsH2bp.mjs.map} +1 -1
- package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/evm/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/mpc/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/mpc/types/index.d.ts +4 -0
- package/dist/components/Deposit/src/components/mpc/types/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/index.d.ts.map +1 -1
- package/dist/components/Deposit/types/index.d.ts +24 -0
- package/dist/components/Deposit/types/index.d.ts.map +1 -1
- package/dist/{index-BJxeI_Vg.mjs → index-NZSqlsBa.mjs} +5682 -5614
- package/dist/{index-BJxeI_Vg.mjs.map → index-NZSqlsBa.mjs.map} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +76 -76
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(le,
|
|
1
|
+
(function(le,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],y):(le=typeof globalThis<"u"?globalThis:le||self,y(le.EdgeXComponents={},le.React,le.ReactDOM))})(this,function(le,y,Ke){"use strict";var yP=Object.defineProperty;var vP=(le,y,Ke)=>y in le?yP(le,y,{enumerable:!0,configurable:!0,writable:!0,value:Ke}):le[y]=Ke;var os=(le,y,Ke)=>vP(le,typeof y!="symbol"?y+"":y,Ke);function Wc(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=Wc(y),Hr=Wc(Ke);function qm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ci={exports:{}},Gr={};/**
|
|
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
|
|
9
|
+
*/var Vc;function Km(){if(Vc)return Gr;Vc=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,a,c){var u,f={},p=null,d=null;c!==void 0&&(p=""+c),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(d=a.ref);for(u in a)r.call(a,u)&&!s.hasOwnProperty(u)&&(f[u]=a[u]);if(l&&l.defaultProps)for(u in a=l.defaultProps,a)f[u]===void 0&&(f[u]=a[u]);return{$$typeof:t,type:l,key:p,ref:d,props:f,_owner:o.current}}return Gr.Fragment=n,Gr.jsx=i,Gr.jsxs=i,Gr}var qr={};/**
|
|
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
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),Ce=
|
|
21
|
-
`+
|
|
17
|
+
*/var Hc;function Zm(){return Hc||(Hc=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function g(R){if(R===null||typeof R!="object")return null;var G=h&&R[h]||R[m];return typeof G=="function"?G:null}var N=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(R){{for(var G=arguments.length,Y=new Array(G>1?G-1:0),oe=1;oe<G;oe++)Y[oe-1]=arguments[oe];P("error",R,Y)}}function P(R,G,Y){{var oe=N.ReactDebugCurrentFrame,ve=oe.getStackAddendum();ve!==""&&(G+="%s",Y=Y.concat([ve]));var xe=Y.map(function(he){return String(he)});xe.unshift("Warning: "+G),Function.prototype.apply.call(console[R],console,xe)}}var C=!1,D=!1,F=!1,L=!1,b=!1,v;v=Symbol.for("react.module.reference");function E(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||b||R===o||R===c||R===u||L||R===d||C||D||F||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===f||R.$$typeof===i||R.$$typeof===l||R.$$typeof===a||R.$$typeof===v||R.getModuleId!==void 0))}function $(R,G,Y){var oe=R.displayName;if(oe)return oe;var ve=G.displayName||G.name||"";return ve!==""?Y+"("+ve+")":Y}function I(R){return R.displayName||"Context"}function T(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 c:return"Suspense";case u:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case l:var G=R;return I(G)+".Consumer";case i:var Y=R;return I(Y._context)+".Provider";case a:return $(R,R.render,"ForwardRef");case f:var oe=R.displayName||null;return oe!==null?oe:T(R.type)||"Memo";case p:{var ve=R,xe=ve._payload,he=ve._init;try{return T(he(xe))}catch{return null}}}return null}var B=Object.assign,w=0,O,k,S,M,j,z,_;function q(){}q.__reactDisabledLog=!0;function Q(){{if(w===0){O=console.log,k=console.info,S=console.warn,M=console.error,j=console.group,z=console.groupCollapsed,_=console.groupEnd;var R={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}w++}}function K(){{if(w--,w===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},R,{value:O}),info:B({},R,{value:k}),warn:B({},R,{value:S}),error:B({},R,{value:M}),group:B({},R,{value:j}),groupCollapsed:B({},R,{value:z}),groupEnd:B({},R,{value:_})})}w<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var W=N.ReactCurrentDispatcher,te;function be(R,G,Y){{if(te===void 0)try{throw Error()}catch(ve){var oe=ve.stack.trim().match(/\n( *(at )?)/);te=oe&&oe[1]||""}return`
|
|
18
|
+
`+te+R}}var de=!1,Ee;{var Z=typeof WeakMap=="function"?WeakMap:Map;Ee=new Z}function H(R,G){if(!R||de)return"";{var Y=Ee.get(R);if(Y!==void 0)return Y}var oe;de=!0;var ve=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var xe;xe=W.current,W.current=null,Q();try{if(G){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(it){oe=it}Reflect.construct(R,[],he)}else{try{he.call()}catch(it){oe=it}R.call(he.prototype)}}else{try{throw Error()}catch(it){oe=it}R()}}catch(it){if(it&&oe&&typeof it.stack=="string"){for(var fe=it.stack.split(`
|
|
19
|
+
`),qe=oe.stack.split(`
|
|
20
|
+
`),Ce=fe.length-1,Ie=qe.length-1;Ce>=1&&Ie>=0&&fe[Ce]!==qe[Ie];)Ie--;for(;Ce>=1&&Ie>=0;Ce--,Ie--)if(fe[Ce]!==qe[Ie]){if(Ce!==1||Ie!==1)do if(Ce--,Ie--,Ie<0||fe[Ce]!==qe[Ie]){var At=`
|
|
21
|
+
`+fe[Ce].replace(" at new "," at ");return R.displayName&&At.includes("<anonymous>")&&(At=At.replace("<anonymous>",R.displayName)),typeof R=="function"&&Ee.set(R,At),At}while(Ce>=1&&Ie>=0);break}}}finally{de=!1,W.current=xe,K(),Error.prepareStackTrace=ve}var Vr=R?R.displayName||R.name:"",ur=Vr?be(Vr):"";return typeof R=="function"&&Ee.set(R,ur),ur}function X(R,G,Y){return H(R,!1)}function ae(R){var G=R.prototype;return!!(G&&G.isReactComponent)}function ee(R,G,Y){if(R==null)return"";if(typeof R=="function")return H(R,ae(R));if(typeof R=="string")return be(R);switch(R){case c:return be("Suspense");case u:return be("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return X(R.render);case f:return ee(R.type,G,Y);case p:{var oe=R,ve=oe._payload,xe=oe._init;try{return ee(xe(ve),G,Y)}catch{}}}return""}var ge=Object.prototype.hasOwnProperty,J={},se=N.ReactDebugCurrentFrame;function pe(R){if(R){var G=R._owner,Y=ee(R.type,R._source,G?G.type:null);se.setExtraStackFrame(Y)}else se.setExtraStackFrame(null)}function Oe(R,G,Y,oe,ve){{var xe=Function.call.bind(ge);for(var he in R)if(xe(R,he)){var fe=void 0;try{if(typeof R[he]!="function"){var qe=Error((oe||"React class")+": "+Y+" type `"+he+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[he]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw qe.name="Invariant Violation",qe}fe=R[he](G,he,oe,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ce){fe=Ce}fe&&!(fe instanceof Error)&&(pe(ve),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).",oe||"React class",Y,he,typeof fe),pe(null)),fe instanceof Error&&!(fe.message in J)&&(J[fe.message]=!0,pe(ve),x("Failed %s type: %s",Y,fe.message),pe(null))}}}var _e=Array.isArray;function we(R){return _e(R)}function je(R){{var G=typeof Symbol=="function"&&Symbol.toStringTag,Y=G&&R[Symbol.toStringTag]||R.constructor.name||"Object";return Y}}function cr(R){try{return Ge(R),!1}catch{return!0}}function Ge(R){return""+R}function Ut(R){if(cr(R))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",je(R)),Ge(R)}var zn=N.ReactCurrentOwner,_t={key:!0,ref:!0,__self:!0,__source:!0},Fm,Rm;function tP(R){if(ge.call(R,"ref")){var G=Object.getOwnPropertyDescriptor(R,"ref").get;if(G&&G.isReactWarning)return!1}return R.ref!==void 0}function nP(R){if(ge.call(R,"key")){var G=Object.getOwnPropertyDescriptor(R,"key").get;if(G&&G.isReactWarning)return!1}return R.key!==void 0}function rP(R,G){typeof R.ref=="string"&&zn.current}function oP(R,G){{var Y=function(){Fm||(Fm=!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)",G))};Y.isReactWarning=!0,Object.defineProperty(R,"key",{get:Y,configurable:!0})}}function sP(R,G){{var Y=function(){Rm||(Rm=!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)",G))};Y.isReactWarning=!0,Object.defineProperty(R,"ref",{get:Y,configurable:!0})}}var iP=function(R,G,Y,oe,ve,xe,he){var fe={$$typeof:t,type:R,key:G,ref:Y,props:he,_owner:xe};return fe._store={},Object.defineProperty(fe._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(fe,"_self",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.defineProperty(fe,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ve}),Object.freeze&&(Object.freeze(fe.props),Object.freeze(fe)),fe};function aP(R,G,Y,oe,ve){{var xe,he={},fe=null,qe=null;Y!==void 0&&(Ut(Y),fe=""+Y),nP(G)&&(Ut(G.key),fe=""+G.key),tP(G)&&(qe=G.ref,rP(G,ve));for(xe in G)ge.call(G,xe)&&!_t.hasOwnProperty(xe)&&(he[xe]=G[xe]);if(R&&R.defaultProps){var Ce=R.defaultProps;for(xe in Ce)he[xe]===void 0&&(he[xe]=Ce[xe])}if(fe||qe){var Ie=typeof R=="function"?R.displayName||R.name||"Unknown":R;fe&&oP(he,Ie),qe&&sP(he,Ie)}return iP(R,fe,qe,ve,oe,zn.current,he)}}var Fc=N.ReactCurrentOwner,jm=N.ReactDebugCurrentFrame;function Wr(R){if(R){var G=R._owner,Y=ee(R.type,R._source,G?G.type:null);jm.setExtraStackFrame(Y)}else jm.setExtraStackFrame(null)}var Rc;Rc=!1;function jc(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function zm(){{if(Fc.current){var R=T(Fc.current.type);if(R)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+R+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+R+"`."}return""}}function lP(R){return""}var Um={};function cP(R){{var G=zm();if(!G){var Y=typeof R=="string"?R:R.displayName||R.name;Y&&(G=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+Y+">.")}return G}}function _m(R,G){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var Y=cP(G);if(Um[Y])return;Um[Y]=!0;var oe="";R&&R._owner&&R._owner!==Fc.current&&(oe=" It was passed a child from "+T(R._owner.type)+"."),Wr(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,oe),Wr(null)}}function Wm(R,G){{if(typeof R!="object")return;if(we(R))for(var Y=0;Y<R.length;Y++){var oe=R[Y];jc(oe)&&_m(oe,G)}else if(jc(R))R._store&&(R._store.validated=!0);else if(R){var ve=g(R);if(typeof ve=="function"&&ve!==R.entries)for(var xe=ve.call(R),he;!(he=xe.next()).done;)jc(he.value)&&_m(he.value,G)}}}function uP(R){{var G=R.type;if(G==null||typeof G=="string")return;var Y;if(typeof G=="function")Y=G.propTypes;else if(typeof G=="object"&&(G.$$typeof===a||G.$$typeof===f))Y=G.propTypes;else return;if(Y){var oe=T(G);Oe(Y,R.props,"prop",oe,R)}else if(G.PropTypes!==void 0&&!Rc){Rc=!0;var ve=T(G);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ve||"Unknown")}typeof G.getDefaultProps=="function"&&!G.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function fP(R){{for(var G=Object.keys(R.props),Y=0;Y<G.length;Y++){var oe=G[Y];if(oe!=="children"&&oe!=="key"){Wr(R),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",oe),Wr(null);break}}R.ref!==null&&(Wr(R),x("Invalid attribute `ref` supplied to `React.Fragment`."),Wr(null))}}var Vm={};function Hm(R,G,Y,oe,ve,xe){{var he=E(R);if(!he){var fe="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(fe+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var qe=lP();qe?fe+=qe:fe+=zm();var Ce;R===null?Ce="null":we(R)?Ce="array":R!==void 0&&R.$$typeof===t?(Ce="<"+(T(R.type)||"Unknown")+" />",fe=" Did you accidentally export a JSX literal instead of a component?"):Ce=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",Ce,fe)}var Ie=aP(R,G,Y,ve,xe);if(Ie==null)return Ie;if(he){var At=G.children;if(At!==void 0)if(oe)if(we(At)){for(var Vr=0;Vr<At.length;Vr++)Wm(At[Vr],R);Object.freeze&&Object.freeze(At)}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 Wm(At,R)}if(ge.call(G,"key")){var ur=T(R),it=Object.keys(G).filter(function(gP){return gP!=="key"}),zc=it.length>0?"{key: someKey, "+it.join(": ..., ")+": ...}":"{key: someKey}";if(!Vm[ur+zc]){var bP=it.length>0?"{"+it.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} />`,
|
|
30
|
+
<%s key={someKey} {...props} />`,zc,ur,bP,ur),Vm[ur+zc]=!0}}return R===r?fP(Ie):uP(Ie),Ie}}function dP(R,G,Y){return Hm(R,G,Y,!0)}function pP(R,G,Y){return Hm(R,G,Y,!1)}var hP=pP,mP=dP;qr.Fragment=r,qr.jsx=hP,qr.jsxs=mP}()),qr}process.env.NODE_ENV==="production"?Ci.exports=Km():Ci.exports=Zm();var A=Ci.exports;const Ym={deposit:{title:"Einzahlen",chain:"Chain",asset:"Asset",amount:"Betrag",available:"Verfügbar",equity:"Eigenkapital",confirmDeposit:"Einzahlung bestätigen",switchNetwork:"Netzwerk wechseln",max:"Max.",fast:"Schnell",standard:"Standard",arrivalTime:"Ankunftszeit",ethCrossChainDepositInitiated:"ETH-Cross-Chain-Einzahlung initiiert. Voraussichtliche Ankunft in 2 bis 5 Minuten.",minDeposit:"Mindestbetrag der Einzahlung",minDepositParsed:"Min. {{amount}} {{token}} einzahlen",maxDeposit:"Maximaler Einzahlungsbetrag",depositTipFor25w:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Wenn deine Einzahlung 200.000 übersteigt, verwende bitte die Ethereum-Chain.",depositAllTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
|
|
31
31
|
Wenn der Einzahlungsbetrag 200.000 übersteigt, kann es zu einer Verzögerung der Ankunftszeit kommen. Bitte hab etwas Geduld.`,maxDepositSplitTip:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Falls du mehr als 200.000 einzahlen musst, teile den Betrag bitte in mehrere Einzahlungen auf.",spotDepositNotSupportedTip:"Einzahlungen werden nicht unterstützt. Bitte zahle auf das Perpetual-Konto ein und überweise den Betrag anschließend.",crossChainDepositFeeTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
|
|
32
|
-
Bei Chain-übergreifenden Einzahlungen musst du die Edge-Gas-Gebühr zahlen. Der gutgeschriebene Betrag wird etwas geringer sein als dein Einzahlungsbetrag.`,addressUpdatedNotice:"Hinweis: Deine Einzahlungsadresse wurde aktualisiert. Verwende die neue Adresse. Die alte Adresse funktioniert nur während der Übergangszeit und wird dann deaktiviert. Wenn sie an einem anderen Ort gespeichert wurde, aktualisiere sie umgehend.",enableSystemProWithToken:"{{token}} auf {{network}} aktivieren",enableTokenDesc:"Bei der ersten Einzahlung auf {{network}} musst du {{token}} aktivieren.",enableWithToken:"{{token}} aktivieren",arrivaltimeTooltip1:"Die Gelder kommen in etwa {{v}} Minuten an (nach Erreichen von {{v1}} Blockbestätigungen).",arrivaltimeTooltip2:"Die geschätzte Zeit wird auf der Grundlage historischer Daten berechnet und dient nur als Referenz. Eine Überlastung des Netzwerks kann zu längeren tatsächlichen Ankunftszeiten führen.",arrivalEstimated:"≈ {{v}} Minuten",feeRateTooltip:"Geschätzte Gebühr, tatsächliche Abzug maßgeblich.",availableDesc:"Der maximale Betrag, den du einzahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Einzahlungen vorgenommen werden.",noPrivateKeyWalletWarning:"Verwende für Einzahlungen keine schlüssellosen Wallets. Einzahlungen mit einer schlüssellosen Wallet können zu einem unwiderruflichen Verlust der Gelder führen.",layerZeroDepositTip:"Das System wird deine Einzahlung über LayerZero auf Basis der tatsächlichen Einzahlungsbedingungen abschließen.",layerZeroDepositTipExceedPool:"Da der Einzahlungsbetrag den Pool übersteigt, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositTipGte200k:"Da der Einzahlungsbetrag größer als oder gleich 200.000 USDT ist, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositButton:"Mit LayerZero einzahlen",defaultSpotNotice:"Standardeinzahlungen werden dem Spot-Konto gutgeschrieben.",defaultSpotToPerpNotice:"Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt. Standardeinzahlungen werden dem Spot-Konto gutgeschrieben. Überweise Gelder vom Spot-Konto auf das Futures-Konto, um das Futures-Konto zu finanzieren.",connectedWalletTitle:"Einzahlung von einer verbundenen Wallet",connectedWalletDesc:"Verwende MetaMask, WalletConnect oder einen anderen Anbieter, um Geld von deiner Krypto-Wallet einzuzahlen",externalWalletTitle:"Einzahlung von externem Konto",externalWalletDesc:"Überweise Gelder von Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Auszahlung an verbundene Wallet",connectedWalletDesc:"Zahle Geld an deine verbundene Krypto-Wallet, MetaMask, WalletConnect oder einen anderen Anbieter aus",externalWalletTitle:"Auszahlung an externes Konto",externalWalletDesc:"Zahle Geld an Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets aus"},account:{title:"Konto",perp:"Perpetual-Konto","perpetual-v1":"Perpetuals-V1-Konto","perpetual-v2":"Perpetuals-V2-Konto",spot:"Spot-Konto"}},
|
|
32
|
+
Bei Chain-übergreifenden Einzahlungen musst du die Edge-Gas-Gebühr zahlen. Der gutgeschriebene Betrag wird etwas geringer sein als dein Einzahlungsbetrag.`,addressUpdatedNotice:"Hinweis: Deine Einzahlungsadresse wurde aktualisiert. Verwende die neue Adresse. Die alte Adresse funktioniert nur während der Übergangszeit und wird dann deaktiviert. Wenn sie an einem anderen Ort gespeichert wurde, aktualisiere sie umgehend.",enableSystemProWithToken:"{{token}} auf {{network}} aktivieren",enableTokenDesc:"Bei der ersten Einzahlung auf {{network}} musst du {{token}} aktivieren.",enableWithToken:"{{token}} aktivieren",arrivaltimeTooltip1:"Die Gelder kommen in etwa {{v}} Minuten an (nach Erreichen von {{v1}} Blockbestätigungen).",arrivaltimeTooltip2:"Die geschätzte Zeit wird auf der Grundlage historischer Daten berechnet und dient nur als Referenz. Eine Überlastung des Netzwerks kann zu längeren tatsächlichen Ankunftszeiten führen.",arrivalEstimated:"≈ {{v}} Minuten",feeRateTooltip:"Geschätzte Gebühr, tatsächliche Abzug maßgeblich.",availableDesc:"Der maximale Betrag, den du einzahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Einzahlungen vorgenommen werden.",noPrivateKeyWalletWarning:"Verwende für Einzahlungen keine schlüssellosen Wallets. Einzahlungen mit einer schlüssellosen Wallet können zu einem unwiderruflichen Verlust der Gelder führen.",layerZeroDepositTip:"Das System wird deine Einzahlung über LayerZero auf Basis der tatsächlichen Einzahlungsbedingungen abschließen.",layerZeroDepositTipExceedPool:"Da der Einzahlungsbetrag den Pool übersteigt, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositTipGte200k:"Da der Einzahlungsbetrag größer als oder gleich 200.000 USDT ist, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositButton:"Mit LayerZero einzahlen",defaultSpotNotice:"Standardeinzahlungen werden dem Spot-Konto gutgeschrieben.",defaultSpotToPerpNotice:"Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt. Standardeinzahlungen werden dem Spot-Konto gutgeschrieben. Überweise Gelder vom Spot-Konto auf das Futures-Konto, um das Futures-Konto zu finanzieren.",connectedWalletTitle:"Einzahlung von einer verbundenen Wallet",connectedWalletDesc:"Verwende MetaMask, WalletConnect oder einen anderen Anbieter, um Geld von deiner Krypto-Wallet einzuzahlen",externalWalletTitle:"Einzahlung von externem Konto",externalWalletDesc:"Überweise Gelder von Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Auszahlung an verbundene Wallet",connectedWalletDesc:"Zahle Geld an deine verbundene Krypto-Wallet, MetaMask, WalletConnect oder einen anderen Anbieter aus",externalWalletTitle:"Auszahlung an externes Konto",externalWalletDesc:"Zahle Geld an Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets aus"},account:{title:"Konto",perp:"Perpetual-Konto","perpetual-v1":"Perpetuals-V1-Konto","perpetual-v2":"Perpetuals-V2-Konto",spot:"Spot-Konto"}},Xm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",fast:"Fast",standard:"Standard",arrivalTime:"Arrival Time",ethCrossChainDepositInitiated:"ETH cross-chain deposit initiated. Estimated arrival in 2–5 minutes.",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
|
|
33
33
|
If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,maxDepositSplitTip:"The maximum amount per deposit is 200,000. If you need to deposit more than 200,000, please split it into multiple deposits.",spotDepositNotSupportedTip:"Deposits aren't supported. Please deposit to perpetual account, then transfer.",crossChainDepositFeeTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
|
|
34
|
-
Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Estimated fee, subject to actual deduction.",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Arbitrum, and other wallets",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Withdraw to connected wallet",connectedWalletDesc:"Withdraw funds to your connected crypto wallet, MetaMask, WalletConnect, or another provider",externalWalletTitle:"Withdraw to external account",externalWalletDesc:"Withdraw funds to Binance or other exchanges, chains like Arbitrum, and other wallets"},account:{title:"Account",perp:"Perpetual Account","perpetual-v1":"Perpetuals V1 Account","perpetual-v2":"Perpetuals V2 Account",spot:"Spot Account"}},
|
|
34
|
+
Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Estimated fee, subject to actual deduction.",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Arbitrum, and other wallets",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Withdraw to connected wallet",connectedWalletDesc:"Withdraw funds to your connected crypto wallet, MetaMask, WalletConnect, or another provider",externalWalletTitle:"Withdraw to external account",externalWalletDesc:"Withdraw funds to Binance or other exchanges, chains like Arbitrum, and other wallets"},account:{title:"Account",perp:"Perpetual Account","perpetual-v1":"Perpetuals V1 Account","perpetual-v2":"Perpetuals V2 Account",spot:"Spot Account"}},Jm={deposit:{title:"Depósito",chain:"Cadena",asset:"Activo",amount:"Monto",available:"Disponible",equity:"Capital",confirmDeposit:"Confirmar depósito",switchNetwork:"Cambiar de red",max:"Máx.",fast:"Rápido",standard:"Estándar",arrivalTime:"Hora de llegada",ethCrossChainDepositInitiated:"Se inició el depósito entre cadenas de ETH. Llegada estimada en 2 a 5 minutos.",minDeposit:"Monto mínimo de depósito",minDepositParsed:"Mín. de depósito: {{amount}} {{token}}",maxDeposit:"Monto máximo de depósito",depositTipFor25w:"El monto máximo por depósito es de 200,000. Si tu depósito supera los 200,000, usa la cadena Ethereum.",depositAllTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
|
|
35
35
|
Si el monto del depósito supera los 200,000, puede haber un retraso en la hora de llegada. Ten paciencia.`,maxDepositSplitTip:"El monto máximo por depósito es de 200,000. Si necesitas depositar más de 200,000, divídelo en varios depósitos.",spotDepositNotSupportedTip:"No se admiten depósitos. Deposita en la cuenta de perpetuos y luego haz la transferencia.",crossChainDepositFeeTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
|
|
36
|
-
Los depósitos entre cadenas requieren el pago de la comisión de gas de Edge. El monto acreditado será ligeramente inferior al monto depositado.`,addressUpdatedNotice:"Aviso: Se actualizó tu dirección de depósito. Usa esta nueva dirección. La anterior solo funciona durante la transición y pronto se desactivará. Si la tienes guardada en otros dispositivos, actualízala lo antes posible.",enableSystemProWithToken:"Habilitar {{token}} en {{network}}",enableTokenDesc:"Debes habilitar {{token}} la primera vez que deposites en {{network}}.",enableWithToken:"Habilitar {{token}}",arrivaltimeTooltip1:"Los fondos se acreditarán en aproximadamente {{v}} minutos (tras obtener {{v1}} confirmaciones de bloque).",arrivaltimeTooltip2:"El tiempo estimado se calcula a partir de datos históricos y es solo de referencia. La congestión de la red puede ocasionar tiempos de acreditación más largos.",arrivalEstimated:"Aprox. {{v}} minutos",feeRateTooltip:"Tarifa estimada, deducción real prevalece.",availableDesc:"Lo máximo que puedes depositar. Si el saldo disponible es 0 o negativo, los depósitos no están permitidos.",noPrivateKeyWalletWarning:"No uses billeteras sin clave para realizar depósitos. Existe el riesgo de una pérdida irreversible de los fondos.",layerZeroDepositTip:"El sistema completará tu depósito a través de LayerZero según las condiciones de depósito reales.",layerZeroDepositTipExceedPool:"Dado que el importe del depósito supera el pool, tu depósito se completará a través de LayerZero.",layerZeroDepositTipGte200k:"El depósito es de 200,000 USDT o más. Se completará a través de LayerZero.",layerZeroDepositButton:"Depositar con LayerZero",defaultSpotNotice:"Los depósitos predeterminados van a la cuenta spot.",defaultSpotToPerpNotice:"Esta dirección solo admite depósitos en {{coin}} ({{v}}) Los depósitos predeterminados van a la cuenta spot. Para agregar fondos a la cuenta de futuros, transfiere desde la cuenta spot a la cuenta de futuros.",connectedWalletTitle:"Depósito desde una billetera conectada",connectedWalletDesc:"Usa MetaMask, WalletConnect u otro proveedor para depositar fondos desde tu billetera cripto.",externalWalletTitle:"Depósito desde una cuenta externa",externalWalletDesc:"Transfiere fondos desde Binance u otros exchanges, cadenas como Arbitrum y otras billeteras.",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Retiro a una billetera conectada",connectedWalletDesc:"Retira fondos a la billetera cripto que tengas conectada: MetaMask, WalletConnect u otro proveedor.",externalWalletTitle:"Retiro a una cuenta externa",externalWalletDesc:"Retira fondos a Binance u otros exchanges, cadenas como Arbitrum y otras billeteras."},account:{title:"Cuenta",perp:"Cuenta de perpetuos","perpetual-v1":"Cuenta de perpetuos V1","perpetual-v2":"Cuenta de perpetuos V2",spot:"Cuenta spot"}},
|
|
36
|
+
Los depósitos entre cadenas requieren el pago de la comisión de gas de Edge. El monto acreditado será ligeramente inferior al monto depositado.`,addressUpdatedNotice:"Aviso: Se actualizó tu dirección de depósito. Usa esta nueva dirección. La anterior solo funciona durante la transición y pronto se desactivará. Si la tienes guardada en otros dispositivos, actualízala lo antes posible.",enableSystemProWithToken:"Habilitar {{token}} en {{network}}",enableTokenDesc:"Debes habilitar {{token}} la primera vez que deposites en {{network}}.",enableWithToken:"Habilitar {{token}}",arrivaltimeTooltip1:"Los fondos se acreditarán en aproximadamente {{v}} minutos (tras obtener {{v1}} confirmaciones de bloque).",arrivaltimeTooltip2:"El tiempo estimado se calcula a partir de datos históricos y es solo de referencia. La congestión de la red puede ocasionar tiempos de acreditación más largos.",arrivalEstimated:"Aprox. {{v}} minutos",feeRateTooltip:"Tarifa estimada, deducción real prevalece.",availableDesc:"Lo máximo que puedes depositar. Si el saldo disponible es 0 o negativo, los depósitos no están permitidos.",noPrivateKeyWalletWarning:"No uses billeteras sin clave para realizar depósitos. Existe el riesgo de una pérdida irreversible de los fondos.",layerZeroDepositTip:"El sistema completará tu depósito a través de LayerZero según las condiciones de depósito reales.",layerZeroDepositTipExceedPool:"Dado que el importe del depósito supera el pool, tu depósito se completará a través de LayerZero.",layerZeroDepositTipGte200k:"El depósito es de 200,000 USDT o más. Se completará a través de LayerZero.",layerZeroDepositButton:"Depositar con LayerZero",defaultSpotNotice:"Los depósitos predeterminados van a la cuenta spot.",defaultSpotToPerpNotice:"Esta dirección solo admite depósitos en {{coin}} ({{v}}) Los depósitos predeterminados van a la cuenta spot. Para agregar fondos a la cuenta de futuros, transfiere desde la cuenta spot a la cuenta de futuros.",connectedWalletTitle:"Depósito desde una billetera conectada",connectedWalletDesc:"Usa MetaMask, WalletConnect u otro proveedor para depositar fondos desde tu billetera cripto.",externalWalletTitle:"Depósito desde una cuenta externa",externalWalletDesc:"Transfiere fondos desde Binance u otros exchanges, cadenas como Arbitrum y otras billeteras.",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Retiro a una billetera conectada",connectedWalletDesc:"Retira fondos a la billetera cripto que tengas conectada: MetaMask, WalletConnect u otro proveedor.",externalWalletTitle:"Retiro a una cuenta externa",externalWalletDesc:"Retira fondos a Binance u otros exchanges, cadenas como Arbitrum y otras billeteras."},account:{title:"Cuenta",perp:"Cuenta de perpetuos","perpetual-v1":"Cuenta de perpetuos V1","perpetual-v2":"Cuenta de perpetuos V2",spot:"Cuenta spot"}},Qm={deposit:{title:"Dépôt",chain:"Blockchain",asset:"Actif",amount:"Montant",available:"Disponible",equity:"Actif net",confirmDeposit:"Confirmer le dépôt",switchNetwork:"Changer de réseau",max:"Max.",fast:"Rapide",standard:"Standard",arrivalTime:"Heure d’arrivée",ethCrossChainDepositInitiated:"Dépôt ETH inter-blockchains initié. Arrivée estimée dans 2 à 5 minutes.",minDeposit:"Montant minimum de dépôt",minDepositParsed:"Dépôt min. {{amount}} {{token}}",maxDeposit:"Montant maximum de dépôt",depositTipFor25w:"Le montant maximum par dépôt est de 200 000. Si votre dépôt dépasse 200 000, utilisez la blockchain Ethereum.",depositAllTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
|
|
37
37
|
Si le montant du dépôt dépasse 200 000, l’heure d’arrivée peut être retardée. Merci de patienter.`,maxDepositSplitTip:"Le montant maximum par dépôt est de 200 000. Si vous devez déposer plus de 200 000, veuillez effectuer plusieurs dépôts.",spotDepositNotSupportedTip:"Les dépôts ne sont pas pris en charge. Veuillez effectuer le dépôt sur le compte perpétuel, puis transférer les fonds.",crossChainDepositFeeTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
|
|
38
|
-
Les dépôts inter-blockchains nécessitent le paiement des frais de gas Edge. Le montant crédité sera légèrement inférieur au montant déposé.`,addressUpdatedNotice:"Avis : Votre adresse de dépôt a été mise à jour. Utilisez la nouvelle adresse. L’ancienne ne fonctionne que pendant la transition et sera désactivée. Si vous l’avez enregistrée ailleurs, modifiez-la sans tarder.",enableSystemProWithToken:"Activer {{token}} sur {{network}}",enableTokenDesc:"Vous devez activer {{token}} lors de votre premier dépôt sur {{network}}.",enableWithToken:"Activer {{token}}",arrivaltimeTooltip1:"Les fonds arriveront dans environ {{v}} minutes (après {{v1}} confirmations de bloc).",arrivaltimeTooltip2:"La durée estimée est calculée sur la base de données historiques et n’est donnée qu’à titre indicatif. L’encombrement du réseau peut rallonger l’heure d’arrivée réelle.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Frais estimés, déduction réelle fait foi.",availableDesc:"Montant maximal que vous pouvez déposer. Lorsque le solde disponible est nul ou négatif, aucun dépôt ne peut être effectué.",noPrivateKeyWalletWarning:"N’utilisez pas de wallets sans clé pour effectuer des dépôts. Un dépôt effectué depuis un wallet sans clé peut entraîner une perte irréversible des fonds.",layerZeroDepositTip:"Le système effectuera votre dépôt via LayerZero en fonction des conditions réelles du dépôt.",layerZeroDepositTipExceedPool:"Comme le montant du dépôt est supérieur au pool, votre dépôt sera effectué via LayerZero.",layerZeroDepositTipGte200k:"Comme le montant du dépôt est supérieur ou égal à 200 000 USDT, votre dépôt sera effectué via LayerZero.",layerZeroDepositButton:"Déposer via LayerZero",defaultSpotNotice:"Par défaut, les dépôts sont crédités sur le compte spot.",defaultSpotToPerpNotice:"Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse. Par défaut, les dépôts sont crédités sur le compte spot. Pour alimenter le compte futures, transférez des fonds du compte spot vers le compte futures.",connectedWalletTitle:"Dépôt depuis un wallet connecté",connectedWalletDesc:"Utilisez MetaMask, WalletConnect ou un autre fournisseur pour déposer des fonds depuis votre wallet crypto",externalWalletTitle:"Dépôt depuis un compte externe",externalWalletDesc:"Transférez des fonds depuis Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Retrait vers un wallet connecté",connectedWalletDesc:"Retirez des fonds vers votre wallet crypto connecté, MetaMask, WalletConnect ou un autre fournisseur",externalWalletTitle:"Retrait vers un compte externe",externalWalletDesc:"Retirez des fonds vers Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets"},account:{title:"Compte",perp:"Compte perpétuel","perpetual-v1":"Compte Perpétuels V1","perpetual-v2":"Compte Perpétuels V2",spot:"Compte spot"}},
|
|
38
|
+
Les dépôts inter-blockchains nécessitent le paiement des frais de gas Edge. Le montant crédité sera légèrement inférieur au montant déposé.`,addressUpdatedNotice:"Avis : Votre adresse de dépôt a été mise à jour. Utilisez la nouvelle adresse. L’ancienne ne fonctionne que pendant la transition et sera désactivée. Si vous l’avez enregistrée ailleurs, modifiez-la sans tarder.",enableSystemProWithToken:"Activer {{token}} sur {{network}}",enableTokenDesc:"Vous devez activer {{token}} lors de votre premier dépôt sur {{network}}.",enableWithToken:"Activer {{token}}",arrivaltimeTooltip1:"Les fonds arriveront dans environ {{v}} minutes (après {{v1}} confirmations de bloc).",arrivaltimeTooltip2:"La durée estimée est calculée sur la base de données historiques et n’est donnée qu’à titre indicatif. L’encombrement du réseau peut rallonger l’heure d’arrivée réelle.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Frais estimés, déduction réelle fait foi.",availableDesc:"Montant maximal que vous pouvez déposer. Lorsque le solde disponible est nul ou négatif, aucun dépôt ne peut être effectué.",noPrivateKeyWalletWarning:"N’utilisez pas de wallets sans clé pour effectuer des dépôts. Un dépôt effectué depuis un wallet sans clé peut entraîner une perte irréversible des fonds.",layerZeroDepositTip:"Le système effectuera votre dépôt via LayerZero en fonction des conditions réelles du dépôt.",layerZeroDepositTipExceedPool:"Comme le montant du dépôt est supérieur au pool, votre dépôt sera effectué via LayerZero.",layerZeroDepositTipGte200k:"Comme le montant du dépôt est supérieur ou égal à 200 000 USDT, votre dépôt sera effectué via LayerZero.",layerZeroDepositButton:"Déposer via LayerZero",defaultSpotNotice:"Par défaut, les dépôts sont crédités sur le compte spot.",defaultSpotToPerpNotice:"Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse. Par défaut, les dépôts sont crédités sur le compte spot. Pour alimenter le compte futures, transférez des fonds du compte spot vers le compte futures.",connectedWalletTitle:"Dépôt depuis un wallet connecté",connectedWalletDesc:"Utilisez MetaMask, WalletConnect ou un autre fournisseur pour déposer des fonds depuis votre wallet crypto",externalWalletTitle:"Dépôt depuis un compte externe",externalWalletDesc:"Transférez des fonds depuis Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Retrait vers un wallet connecté",connectedWalletDesc:"Retirez des fonds vers votre wallet crypto connecté, MetaMask, WalletConnect ou un autre fournisseur",externalWalletTitle:"Retrait vers un compte externe",externalWalletDesc:"Retirez des fonds vers Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets"},account:{title:"Compte",perp:"Compte perpétuel","perpetual-v1":"Compte Perpétuels V1","perpetual-v2":"Compte Perpétuels V2",spot:"Compte spot"}},eb={deposit:{title:"Deposita",chain:"Blockchain",asset:"Asset",amount:"Importo",available:"Disponibile",equity:"Equity",confirmDeposit:"Conferma il deposito",switchNetwork:"Cambia rete",max:"Max",fast:"Rapido",standard:"Standard",arrivalTime:"Orario di arrivo",ethCrossChainDepositInitiated:"Deposito cross-chain di ETH avviato. Il deposito arriverà tra 2-5 minuti.",minDeposit:"Importo minimo del deposito",minDepositParsed:"Deposito min. {{amount}} {{token}}",maxDeposit:"Importo massimo del deposito",depositTipFor25w:"L'importo massimo per deposito è 200.000. Se il tuo deposito supera i 200.000, utilizza la catena Ethereum.",depositAllTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
|
|
39
39
|
Se l'importo del deposito supera i 200.000, l'orario di arrivo potrebbe subire ritardi. Sii paziente.`,maxDepositSplitTip:"L'importo massimo per deposito è 200.000. Se devi depositare più di 200.000, dividi l'importo in più depositi.",spotDepositNotSupportedTip:"I depositi non sono supportati. Prima deposita sul conto perpetuo, quindi effettua il trasferimento.",crossChainDepositFeeTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
|
|
40
|
-
Per i depositi cross-chain è necessario pagare la gas fee Edge. L'importo accreditato sarà leggermente inferiore all'importo del deposito.`,addressUpdatedNotice:"Avviso: il tuo indirizzo di deposito è stato aggiornato. Utilizza il nuovo indirizzo. L'indirizzo precedente funzionerà solo durante la transizione, quindi verrà disattivato. Se l'hai salvato altrove, aggiornarlo il prima possibile.",enableSystemProWithToken:"Abilita {{token}} su {{network}}",enableTokenDesc:"Devi abilitare {{token}} la prima volta che depositi su {{network}}.",enableWithToken:"Abilita {{token}}",arrivaltimeTooltip1:"I fondi arriveranno entro circa {{v}} minuti (dopo{{v1}} conferme di blocco).",arrivaltimeTooltip2:"Il tempo stimato è calcolato in base ai dati storici ed solo per riferimento. Se la rete è congestionata, potrebbero esserci dei ritardi.",arrivalEstimated:"≈ {{v}} minuti",feeRateTooltip:"Commissione stimata, detrazione effettiva prevalente.",availableDesc:"L'importo massimo che puoi depositare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare depositi.",noPrivateKeyWalletWarning:"Non effettuare depositi con wallet senza chiavi. Se effettui un deposito tramite un wallet senza chiave rischi di perdere i tuoi fondi per sempre.",layerZeroDepositTip:"Il sistema completerà il tuo deposito tramite LayerZero in base alle condizioni effettive di deposito.",layerZeroDepositTipExceedPool:"Poiché l'importo del deposito supera il pool, il deposito sarà completato tramite LayerZero.",layerZeroDepositTipGte200k:"Poiché l'importo del deposito è maggiore o uguale a 200.000 USDT, il deposito verrà completato tramite LayerZero.",layerZeroDepositButton:"Deposita con LayerZero",defaultSpotNotice:"I depositi predefiniti vanno sul conto spot.",defaultSpotToPerpNotice:"I depositi a questo indirizzo supportano solo {{coin}} ({{v}}). I depositi predefiniti vanno sul conto spot. Per finanziare il conto futures, effettua un trasferimento dal conto spot al conto futures.",connectedWalletTitle:"Deposita dal wallet collegato",connectedWalletDesc:"Usa MetaMask, WalletConnect o un altro fornitore per depositare fondi dal tuo wallet crypto",externalWalletTitle:"Deposita da account esterno",externalWalletDesc:"Trasferisci fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Preleva sul wallet collegato",connectedWalletDesc:"Preleva fondi dal wallet crypto collegato, MetaMask, WalletConnect o un altro fornitore",externalWalletTitle:"Preleva sull'account esterno",externalWalletDesc:"Preleva fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet"},account:{title:"Account",perp:"Conto perpetuo","perpetual-v1":"Conto perpetuo V1","perpetual-v2":"Conto perpetuo V2",spot:"Conto Spot"}},
|
|
40
|
+
Per i depositi cross-chain è necessario pagare la gas fee Edge. L'importo accreditato sarà leggermente inferiore all'importo del deposito.`,addressUpdatedNotice:"Avviso: il tuo indirizzo di deposito è stato aggiornato. Utilizza il nuovo indirizzo. L'indirizzo precedente funzionerà solo durante la transizione, quindi verrà disattivato. Se l'hai salvato altrove, aggiornarlo il prima possibile.",enableSystemProWithToken:"Abilita {{token}} su {{network}}",enableTokenDesc:"Devi abilitare {{token}} la prima volta che depositi su {{network}}.",enableWithToken:"Abilita {{token}}",arrivaltimeTooltip1:"I fondi arriveranno entro circa {{v}} minuti (dopo{{v1}} conferme di blocco).",arrivaltimeTooltip2:"Il tempo stimato è calcolato in base ai dati storici ed solo per riferimento. Se la rete è congestionata, potrebbero esserci dei ritardi.",arrivalEstimated:"≈ {{v}} minuti",feeRateTooltip:"Commissione stimata, detrazione effettiva prevalente.",availableDesc:"L'importo massimo che puoi depositare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare depositi.",noPrivateKeyWalletWarning:"Non effettuare depositi con wallet senza chiavi. Se effettui un deposito tramite un wallet senza chiave rischi di perdere i tuoi fondi per sempre.",layerZeroDepositTip:"Il sistema completerà il tuo deposito tramite LayerZero in base alle condizioni effettive di deposito.",layerZeroDepositTipExceedPool:"Poiché l'importo del deposito supera il pool, il deposito sarà completato tramite LayerZero.",layerZeroDepositTipGte200k:"Poiché l'importo del deposito è maggiore o uguale a 200.000 USDT, il deposito verrà completato tramite LayerZero.",layerZeroDepositButton:"Deposita con LayerZero",defaultSpotNotice:"I depositi predefiniti vanno sul conto spot.",defaultSpotToPerpNotice:"I depositi a questo indirizzo supportano solo {{coin}} ({{v}}). I depositi predefiniti vanno sul conto spot. Per finanziare il conto futures, effettua un trasferimento dal conto spot al conto futures.",connectedWalletTitle:"Deposita dal wallet collegato",connectedWalletDesc:"Usa MetaMask, WalletConnect o un altro fornitore per depositare fondi dal tuo wallet crypto",externalWalletTitle:"Deposita da account esterno",externalWalletDesc:"Trasferisci fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet",or:"OR"},withdraw:{noticeDesc:"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.",connectedWalletTitle:"Preleva sul wallet collegato",connectedWalletDesc:"Preleva fondi dal wallet crypto collegato, MetaMask, WalletConnect o un altro fornitore",externalWalletTitle:"Preleva sull'account esterno",externalWalletDesc:"Preleva fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet"},account:{title:"Account",perp:"Conto perpetuo","perpetual-v1":"Conto perpetuo V1","perpetual-v2":"Conto perpetuo V2",spot:"Conto Spot"}},tb={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",fast:"高速",standard:"標準",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
|
|
41
41
|
入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,maxDepositSplitTip:"1回の入金上限は200,000です。200,000を超える金額を入金する場合は、複数回に分けて行ってください。",spotDepositNotSupportedTip:"入金非対応。先に契約アカウント入金後、振替。",crossChainDepositFeeTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
|
|
42
|
-
クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",feeRateTooltip:"手数料の見積もり額で、実際の控除額を基準とします。",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。",connectedWalletTitle:"接続済みウォレットから入庫",connectedWalletDesc:"MetaMask、WalletConnect、またはその他のプロバイダーを使用し、暗号資産ウォレットから資産を入庫してください。",externalWalletTitle:"外部アカウントから入庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他ウォレットから資産を入庫する",or:"OR"},withdraw:{noticeDesc:"通常出金は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:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。",connectedWalletTitle:"接続済みウォレットへ出庫",connectedWalletDesc:"接続済み暗号資産ウォレット、MetaMask、WalletConnect、またはその他のプロバイダーへ資産を出庫する",externalWalletTitle:"外部アカウントへ出庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他のウォレットへ資産を出庫する"},account:{title:"アカウント",perp:"パーペチュアルアカウント","perpetual-v1":"先物V1アカウント","perpetual-v2":"先物V2アカウント",spot:"スポットアカウント"}},
|
|
42
|
+
クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",feeRateTooltip:"手数料の見積もり額で、実際の控除額を基準とします。",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。",connectedWalletTitle:"接続済みウォレットから入庫",connectedWalletDesc:"MetaMask、WalletConnect、またはその他のプロバイダーを使用し、暗号資産ウォレットから資産を入庫してください。",externalWalletTitle:"外部アカウントから入庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他ウォレットから資産を入庫する",or:"OR"},withdraw:{noticeDesc:"通常出金は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:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。",connectedWalletTitle:"接続済みウォレットへ出庫",connectedWalletDesc:"接続済み暗号資産ウォレット、MetaMask、WalletConnect、またはその他のプロバイダーへ資産を出庫する",externalWalletTitle:"外部アカウントへ出庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他のウォレットへ資産を出庫する"},account:{title:"アカウント",perp:"パーペチュアルアカウント","perpetual-v1":"先物V1アカウント","perpetual-v2":"先物V2アカウント",spot:"スポットアカウント"}},nb={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",fast:"Быстрый",standard:"Стандартный",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
|
|
43
43
|
Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,maxDepositSplitTip:"Максимальная сумма одного пополнения — 200 000. Если вам нужно пополнить на сумму более 200 000, выполните несколько пополнений.",spotDepositNotSupportedTip:"Пополнение недоступно. Сначала контрактный счёт, затем перевод.",crossChainDepositFeeTip:`На этот адрес можно внести только {{coin}} ({{v}}).
|
|
44
44
|
За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",feeRateTooltip:"Предварительная комиссия, фактическое списание в качестве окончательного.",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:`Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.
|
|
45
45
|
|
|
46
|
-
Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный.",connectedWalletTitle:"Депозит с подключенного кошелька",connectedWalletDesc:"Используйте MetaMask, WalletConnect или другой сервис для внесения средств с криптокошелька",externalWalletTitle:"Депозит с внешнего аккаунта",externalWalletDesc:"Переводите средства с Binance или других бирж, блокчейнов, таких как Arbitrum, и других кошельков",or:"OR"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на 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:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств.",connectedWalletTitle:"Вывод на подключенный кошелек",connectedWalletDesc:"Выведите средства на подключенный криптокошелек: MetaMask, WalletConnect или другой",externalWalletTitle:"Вывод средств на внешний аккаунт",externalWalletDesc:"Выведите средства на Binance или другие биржи, блокчейны, такие как Arbitrum, и другие кошельки"},account:{title:"Аккаунт",perp:"Перпетуальный счет","perpetual-v1":"Перпетуальный счёт V1","perpetual-v2":"Перпетуальный счёт V2",spot:"Спотовый счет"}},
|
|
46
|
+
Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный.",connectedWalletTitle:"Депозит с подключенного кошелька",connectedWalletDesc:"Используйте MetaMask, WalletConnect или другой сервис для внесения средств с криптокошелька",externalWalletTitle:"Депозит с внешнего аккаунта",externalWalletDesc:"Переводите средства с Binance или других бирж, блокчейнов, таких как Arbitrum, и других кошельков",or:"OR"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на 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:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств.",connectedWalletTitle:"Вывод на подключенный кошелек",connectedWalletDesc:"Выведите средства на подключенный криптокошелек: MetaMask, WalletConnect или другой",externalWalletTitle:"Вывод средств на внешний аккаунт",externalWalletDesc:"Выведите средства на Binance или другие биржи, блокчейны, такие как Arbitrum, и другие кошельки"},account:{title:"Аккаунт",perp:"Перпетуальный счет","perpetual-v1":"Перпетуальный счёт V1","perpetual-v2":"Перпетуальный счёт V2",spot:"Спотовый счет"}},rb={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
|
|
47
47
|
充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,maxDepositSplitTip:"单笔充值金额上限为200,000。若需要充值金额大于200,000,请分多笔进行操作。",spotDepositNotSupportedTip:"不支持充值,请先充入合约账户再划转。",crossChainDepositFeeTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
|
|
48
|
-
跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",feeRateTooltip:"预估手续费,以实际扣除为准。",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。",connectedWalletTitle:"从已连接钱包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他钱包进行充值",externalWalletTitle:"从外部钱包充值",externalWalletDesc:"从 Binance 或其他交易所、Arbitrum 等链或其他钱包转账",or:"或"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 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:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。",connectedWalletTitle:"提现至已连接钱包",connectedWalletDesc:"将资金提现至您已连接的加密钱包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提现至外部账户",externalWalletDesc:"将资金提现至 Binance 或其他交易所、Arbitrum 等链及其他钱包"},account:{title:"账户",perp:"合约账户","perpetual-v1":"合约V1账户","perpetual-v2":"合约V2账户",spot:"现货账户"}},
|
|
48
|
+
跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",feeRateTooltip:"预估手续费,以实际扣除为准。",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。",connectedWalletTitle:"从已连接钱包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他钱包进行充值",externalWalletTitle:"从外部钱包充值",externalWalletDesc:"从 Binance 或其他交易所、Arbitrum 等链或其他钱包转账",or:"或"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 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:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。",connectedWalletTitle:"提现至已连接钱包",connectedWalletDesc:"将资金提现至您已连接的加密钱包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提现至外部账户",externalWalletDesc:"将资金提现至 Binance 或其他交易所、Arbitrum 等链及其他钱包"},account:{title:"账户",perp:"合约账户","perpetual-v1":"合约V1账户","perpetual-v2":"合约V2账户",spot:"现货账户"}},ob={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
|
|
49
49
|
充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,maxDepositSplitTip:"單筆充值金額上限為 200,000。若需要充值金額大於 200,000,請分多筆進行操作。",spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
|
|
50
|
-
跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",feeRateTooltip:"預估手續費,以實際扣除為準。",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。",connectedWalletTitle:"從已連接錢包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他錢包進行充值",externalWalletTitle:"從外部錢包充值",externalWalletDesc:"從 Binance 或其他交易所、Arbitrum 等鏈或其他錢包轉帳",or:"或"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 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:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。",connectedWalletTitle:"提現至已連接錢包",connectedWalletDesc:"將資金提現至您已連接的加密錢包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提現至外部帳戶",externalWalletDesc:"將資金提現至 Binance 或其他交易所、Arbitrum 等鏈及其他錢包"},account:{title:"帳戶",perp:"合約帳戶","perpetual-v1":"合約V1賬戶","perpetual-v2":"合約V2賬戶",spot:"現貨帳戶"}},Oi=["en-US","ja-JP","ru-RU","zh-CN","zh-TW","de-DE","es-LA","fr-FR","it-IT"],Hl={"en-US":Zm,"ja-JP":Qm,"ru-RU":eb,"zh-CN":tb,"zh-TW":nb,"de-DE":Km,"es-LA":Ym,"fr-FR":Xm,"it-IT":Jm},ss="en-US",rb={"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"},ob=e=>Oi.includes(e)?Hl[e]:Hl[ss],sb=e=>Oi.includes(e),Gl=v.createContext(null),ib=({config:e,children:t})=>{const n=v.useMemo(()=>{const r=e.locale||ss,o=sb(r)?r:ss,s=ob(o);return{...e,currentLocale:o,translations:s}},[e]);return A.jsx(Gl.Provider,{value:n,children:t})},ql=()=>{const e=v.useContext(Gl);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var ab=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ii=Math.ceil,dt=Math.floor,Ke="[BigNumber Error] ",Kl=Ke+"Number primitive has more than 15 significant digits: ",At=1e14,ce=14,$i=9007199254740991,ki=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Sn=1e7,Me=1e9;function Zl(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,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},g="0123456789abcdefghijklmnopqrstuvwxyz",N=!0;function x(b,y){var E,T,I,$,D,w,O,k,S=this;if(!(S instanceof x))return new x(b,y);if(y==null){if(b&&b._isBigNumber===!0){S.s=b.s,!b.c||b.e>f?S.c=S.e=null:b.e<u?S.c=[S.e=0]:(S.e=b.e,S.c=b.c.slice());return}if((w=typeof b=="number")&&b*0==0){if(S.s=1/b<0?(b=-b,-1):1,b===~~b){for($=0,D=b;D>=10;D/=10,$++);$>f?S.c=S.e=null:(S.e=$,S.c=[b]);return}k=String(b)}else{if(!ab.test(k=String(b)))return r(S,k,w);S.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}($=k.indexOf("."))>-1&&(k=k.replace(".","")),(D=k.search(/e/i))>0?($<0&&($=D),$+=+k.slice(D+1),k=k.substring(0,D)):$<0&&($=k.length)}else{if(Ee(y,2,g.length,"Base"),y==10&&N)return S=new x(b),L(S,i+S.e+1,c);if(k=String(b),w=typeof b=="number"){if(b*0!=0)return r(S,k,w,y);if(S.s=1/b<0?(k=k.slice(1),-1):1,x.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(Kl+b)}else S.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(E=g.slice(0,y),$=D=0,O=k.length;D<O;D++)if(E.indexOf(T=k.charAt(D))<0){if(T=="."){if(D>$){$=O;continue}}else if(!I&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){I=!0,D=-1,$=0;continue}return r(S,String(b),w,y)}w=!1,k=n(k,y,10,S.s),($=k.indexOf("."))>-1?k=k.replace(".",""):$=k.length}for(D=0;k.charCodeAt(D)===48;D++);for(O=k.length;k.charCodeAt(--O)===48;);if(k=k.slice(D,++O)){if(O-=D,w&&x.DEBUG&&O>15&&(b>$i||b!==dt(b)))throw Error(Kl+S.s*b);if(($=$-D-1)>f)S.c=S.e=null;else if($<u)S.c=[S.e=0];else{if(S.e=$,S.c=[],D=($+1)%ce,$<0&&(D+=ce),D<O){for(D&&S.c.push(+k.slice(0,D)),O-=ce;D<O;)S.c.push(+k.slice(D,D+=ce));D=ce-(k=k.slice(D)).length}else D-=O;for(;D--;k+="0");S.c.push(+k)}}else S.c=[S.e=0]}x.clone=Zl,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(b){var y,E;if(b!=null)if(typeof b=="object"){if(b.hasOwnProperty(y="DECIMAL_PLACES")&&(E=b[y],Ee(E,0,Me,y),i=E),b.hasOwnProperty(y="ROUNDING_MODE")&&(E=b[y],Ee(E,0,8,y),c=E),b.hasOwnProperty(y="EXPONENTIAL_AT")&&(E=b[y],E&&E.pop?(Ee(E[0],-Me,0,y),Ee(E[1],0,Me,y),a=E[0],l=E[1]):(Ee(E,-Me,Me,y),a=-(l=E<0?-E:E))),b.hasOwnProperty(y="RANGE"))if(E=b[y],E&&E.pop)Ee(E[0],-Me,-1,y),Ee(E[1],1,Me,y),u=E[0],f=E[1];else if(Ee(E,-Me,Me,y),E)u=-(f=E<0?-E:E);else throw Error(Ke+y+" cannot be zero: "+E);if(b.hasOwnProperty(y="CRYPTO"))if(E=b[y],E===!!E)if(E)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=E;else throw p=!E,Error(Ke+"crypto unavailable");else p=E;else throw Error(Ke+y+" not true or false: "+E);if(b.hasOwnProperty(y="MODULO_MODE")&&(E=b[y],Ee(E,0,9,y),d=E),b.hasOwnProperty(y="POW_PRECISION")&&(E=b[y],Ee(E,0,Me,y),h=E),b.hasOwnProperty(y="FORMAT"))if(E=b[y],typeof E=="object")m=E;else throw Error(Ke+y+" not an object: "+E);if(b.hasOwnProperty(y="ALPHABET"))if(E=b[y],typeof E=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(E))N=E.slice(0,10)=="0123456789",g=E;else throw Error(Ke+y+" invalid: "+E)}else throw Error(Ke+"Object expected: "+b);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,l],RANGE:[u,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:g}},x.isBigNumber=function(b){if(!b||b._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var y,E,T=b.c,I=b.e,$=b.s;e:if({}.toString.call(T)=="[object Array]"){if(($===1||$===-1)&&I>=-Me&&I<=Me&&I===dt(I)){if(T[0]===0){if(I===0&&T.length===1)return!0;break e}if(y=(I+1)%ce,y<1&&(y+=ce),String(T[0]).length==y){for(y=0;y<T.length;y++)if(E=T[y],E<0||E>=At||E!==dt(E))break e;if(E!==0)return!0}}}else if(T===null&&I===null&&($===null||$===1||$===-1))return!0;throw Error(Ke+"Invalid BigNumber: "+b)},x.maximum=x.max=function(){return C(arguments,-1)},x.minimum=x.min=function(){return C(arguments,1)},x.random=function(){var b=9007199254740992,y=Math.random()*b&2097151?function(){return dt(Math.random()*b)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(E){var T,I,$,D,w,O=0,k=[],S=new x(s);if(E==null?E=i:Ee(E,0,Me),D=Ii(E/ce),p)if(crypto.getRandomValues){for(T=crypto.getRandomValues(new Uint32Array(D*=2));O<D;)w=T[O]*131072+(T[O+1]>>>11),w>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),T[O]=I[0],T[O+1]=I[1]):(k.push(w%1e14),O+=2);O=D/2}else if(crypto.randomBytes){for(T=crypto.randomBytes(D*=7);O<D;)w=(T[O]&31)*281474976710656+T[O+1]*1099511627776+T[O+2]*4294967296+T[O+3]*16777216+(T[O+4]<<16)+(T[O+5]<<8)+T[O+6],w>=9e15?crypto.randomBytes(7).copy(T,O):(k.push(w%1e14),O+=7);O=D/7}else throw p=!1,Error(Ke+"crypto unavailable");if(!p)for(;O<D;)w=y(),w<9e15&&(k[O++]=w%1e14);for(D=k[--O],E%=ce,D&&E&&(w=ki[ce-E],k[O]=dt(D/w)*w);k[O]===0;k.pop(),O--);if(O<0)k=[$=0];else{for($=-1;k[0]===0;k.splice(0,1),$-=ce);for(O=1,w=k[0];w>=10;w/=10,O++);O<ce&&($-=ce-O)}return S.e=$,S.c=k,S}}(),x.sum=function(){for(var b=1,y=arguments,E=new x(y[0]);b<y.length;)E=E.plus(y[b++]);return E},n=function(){var b="0123456789";function y(E,T,I,$){for(var D,w=[0],O,k=0,S=E.length;k<S;){for(O=w.length;O--;w[O]*=T);for(w[0]+=$.indexOf(E.charAt(k++)),D=0;D<w.length;D++)w[D]>I-1&&(w[D+1]==null&&(w[D+1]=0),w[D+1]+=w[D]/I|0,w[D]%=I)}return w.reverse()}return function(E,T,I,$,D){var w,O,k,S,B,j,U,_,G=E.indexOf("."),Q=i,q=c;for(G>=0&&(S=h,h=0,E=E.replace(".",""),_=new x(T),j=_.pow(E.length-G),h=S,_.c=y(tn(ht(j.c),j.e,"0"),10,I,b),_.e=_.c.length),U=y(E,T,I,D?(w=g,b):(w=b,g)),k=S=U.length;U[--S]==0;U.pop());if(!U[0])return w.charAt(0);if(G<0?--k:(j.c=U,j.e=k,j.s=$,j=t(j,_,Q,q,I),U=j.c,B=j.r,k=j.e),O=k+Q+1,G=U[O],S=I/2,B=B||O<0||U[O+1]!=null,B=q<4?(G!=null||B)&&(q==0||q==(j.s<0?3:2)):G>S||G==S&&(q==4||B||q==6&&U[O-1]&1||q==(j.s<0?8:7)),O<1||!U[0])E=B?tn(w.charAt(1),-Q,w.charAt(0)):w.charAt(0);else{if(U.length=O,B)for(--I;++U[--O]>I;)U[O]=0,O||(++k,U=[1].concat(U));for(S=U.length;!U[--S];);for(G=0,E="";G<=S;E+=w.charAt(U[G++]));E=tn(E,k,w.charAt(0))}return E}}(),t=function(){function b(T,I,$){var D,w,O,k,S=0,B=T.length,j=I%Sn,U=I/Sn|0;for(T=T.slice();B--;)O=T[B]%Sn,k=T[B]/Sn|0,D=U*O+k*j,w=j*O+D%Sn*Sn+S,S=(w/$|0)+(D/Sn|0)+U*k,T[B]=w%$;return S&&(T=[S].concat(T)),T}function y(T,I,$,D){var w,O;if($!=D)O=$>D?1:-1;else for(w=O=0;w<$;w++)if(T[w]!=I[w]){O=T[w]>I[w]?1:-1;break}return O}function E(T,I,$,D){for(var w=0;$--;)T[$]-=w,w=T[$]<I[$]?1:0,T[$]=w*D+T[$]-I[$];for(;!T[0]&&T.length>1;T.splice(0,1));}return function(T,I,$,D,w){var O,k,S,B,j,U,_,G,Q,q,W,ee,ve,K,oe,se,Z,J=T.s==I.s?1:-1,ie=T.c,re=I.c;if(!ie||!ie[0]||!re||!re[0])return new x(!T.s||!I.s||(ie?re&&ie[0]==re[0]:!re)?NaN:ie&&ie[0]==0||!re?J*0:J/0);for(G=new x(J),Q=G.c=[],k=T.e-I.e,J=$+k+1,w||(w=At,k=pt(T.e/ce)-pt(I.e/ce),J=J/ce|0),S=0;re[S]==(ie[S]||0);S++);if(re[S]>(ie[S]||0)&&k--,J<0)Q.push(1),B=!0;else{for(K=ie.length,se=re.length,S=0,J+=2,j=dt(w/(re[0]+1)),j>1&&(re=b(re,j,w),ie=b(ie,j,w),se=re.length,K=ie.length),ve=se,q=ie.slice(0,se),W=q.length;W<se;q[W++]=0);Z=re.slice(),Z=[0].concat(Z),oe=re[0],re[1]>=w/2&&oe++;do{if(j=0,O=y(re,q,se,W),O<0){if(ee=q[0],se!=W&&(ee=ee*w+(q[1]||0)),j=dt(ee/oe),j>1)for(j>=w&&(j=w-1),U=b(re,j,w),_=U.length,W=q.length;y(U,q,_,W)==1;)j--,E(U,se<_?Z:re,_,w),_=U.length,O=1;else j==0&&(O=j=1),U=re.slice(),_=U.length;if(_<W&&(U=[0].concat(U)),E(q,U,W,w),W=q.length,O==-1)for(;y(re,q,se,W)<1;)j++,E(q,se<W?Z:re,W,w),W=q.length}else O===0&&(j++,q=[0]);Q[S++]=j,q[0]?q[W++]=ie[ve]||0:(q=[ie[ve]],W=1)}while((ve++<K||q[0]!=null)&&J--);B=q[0]!=null,Q[0]||Q.splice(0,1)}if(w==At){for(S=1,J=Q[0];J>=10;J/=10,S++);L(G,$+(G.e=S+k*ce-1)+1,D,B)}else G.e=k,G.r=+B;return G}}();function P(b,y,E,T){var I,$,D,w,O;if(E==null?E=c:Ee(E,0,8),!b.c)return b.toString();if(I=b.c[0],D=b.e,y==null)O=ht(b.c),O=T==1||T==2&&(D<=a||D>=l)?as(O,D):tn(O,D,"0");else if(b=L(new x(b),y,E),$=b.e,O=ht(b.c),w=O.length,T==1||T==2&&(y<=$||$<=a)){for(;w<y;O+="0",w++);O=as(O,$)}else if(y-=D+(T===2&&$>D),O=tn(O,$,"0"),$+1>w){if(--y>0)for(O+=".";y--;O+="0");}else if(y+=$-w,y>0)for($+1==w&&(O+=".");y--;O+="0");return b.s<0&&I?"-"+O:O}function C(b,y){for(var E,T,I=1,$=new x(b[0]);I<b.length;I++)T=new x(b[I]),(!T.s||(E=Un($,T))===y||E===0&&$.s===y)&&($=T);return $}function M(b,y,E){for(var T=1,I=y.length;!y[--I];y.pop());for(I=y[0];I>=10;I/=10,T++);return(E=T+E*ce-1)>f?b.c=b.e=null:E<u?b.c=[b.e=0]:(b.e=E,b.c=y),b}r=function(){var b=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,E=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,D,w,O){var k,S=w?D:D.replace(I,"");if(T.test(S))$.s=isNaN(S)?null:S<0?-1:1;else{if(!w&&(S=S.replace(b,function(B,j,U){return k=(U=U.toLowerCase())=="x"?16:U=="b"?2:8,!O||O==k?j:B}),O&&(k=O,S=S.replace(y,"$1").replace(E,"0.$1")),D!=S))return new x(S,k);if(x.DEBUG)throw Error(Ke+"Not a"+(O?" base "+O:"")+" number: "+D);$.s=null}$.c=$.e=null}}();function L(b,y,E,T){var I,$,D,w,O,k,S,B=b.c,j=ki;if(B){e:{for(I=1,w=B[0];w>=10;w/=10,I++);if($=y-I,$<0)$+=ce,D=y,O=B[k=0],S=dt(O/j[I-D-1]%10);else if(k=Ii(($+1)/ce),k>=B.length)if(T){for(;B.length<=k;B.push(0));O=S=0,I=1,$%=ce,D=$-ce+1}else break e;else{for(O=w=B[k],I=1;w>=10;w/=10,I++);$%=ce,D=$-ce+I,S=D<0?0:dt(O/j[I-D-1]%10)}if(T=T||y<0||B[k+1]!=null||(D<0?O:O%j[I-D-1]),T=E<4?(S||T)&&(E==0||E==(b.s<0?3:2)):S>5||S==5&&(E==4||T||E==6&&($>0?D>0?O/j[I-D]:0:B[k-1])%10&1||E==(b.s<0?8:7)),y<1||!B[0])return B.length=0,T?(y-=b.e+1,B[0]=j[(ce-y%ce)%ce],b.e=-y||0):B[0]=b.e=0,b;if($==0?(B.length=k,w=1,k--):(B.length=k+1,w=j[ce-$],B[k]=D>0?dt(O/j[I-D]%j[D])*w:0),T)for(;;)if(k==0){for($=1,D=B[0];D>=10;D/=10,$++);for(D=B[0]+=w,w=1;D>=10;D/=10,w++);$!=w&&(b.e++,B[0]==At&&(B[0]=1));break}else{if(B[k]+=w,B[k]!=At)break;B[k--]=0,w=1}for($=B.length;B[--$]===0;B.pop());}b.e>f?b.c=b.e=null:b.e<u&&(b.c=[b.e=0])}return b}function F(b){var y,E=b.e;return E===null?b.toString():(y=ht(b.c),y=E<=a||E>=l?as(y,E):tn(y,E,"0"),b.s<0?"-"+y:y)}return o.absoluteValue=o.abs=function(){var b=new x(this);return b.s<0&&(b.s=1),b},o.comparedTo=function(b,y){return Un(this,new x(b,y))},o.decimalPlaces=o.dp=function(b,y){var E,T,I,$=this;if(b!=null)return Ee(b,0,Me),y==null?y=c:Ee(y,0,8),L(new x($),b+$.e+1,y);if(!(E=$.c))return null;if(T=((I=E.length-1)-pt(this.e/ce))*ce,I=E[I])for(;I%10==0;I/=10,T--);return T<0&&(T=0),T},o.dividedBy=o.div=function(b,y){return t(this,new x(b,y),i,c)},o.dividedToIntegerBy=o.idiv=function(b,y){return t(this,new x(b,y),0,1)},o.exponentiatedBy=o.pow=function(b,y){var E,T,I,$,D,w,O,k,S,B=this;if(b=new x(b),b.c&&!b.isInteger())throw Error(Ke+"Exponent not an integer: "+F(b));if(y!=null&&(y=new x(y)),w=b.e>14,!B.c||!B.c[0]||B.c[0]==1&&!B.e&&B.c.length==1||!b.c||!b.c[0])return S=new x(Math.pow(+F(B),w?b.s*(2-is(b)):+F(b))),y?S.mod(y):S;if(O=b.s<0,y){if(y.c?!y.c[0]:!y.s)return new x(NaN);T=!O&&B.isInteger()&&y.isInteger(),T&&(B=B.mod(y))}else{if(b.e>9&&(B.e>0||B.e<-1||(B.e==0?B.c[0]>1||w&&B.c[1]>=24e7:B.c[0]<8e13||w&&B.c[0]<=9999975e7)))return $=B.s<0&&is(b)?-0:0,B.e>-1&&($=1/$),new x(O?1/$:$);h&&($=Ii(h/ce+2))}for(w?(E=new x(.5),O&&(b.s=1),k=is(b)):(I=Math.abs(+F(b)),k=I%2),S=new x(s);;){if(k){if(S=S.times(B),!S.c)break;$?S.c.length>$&&(S.c.length=$):T&&(S=S.mod(y))}if(I){if(I=dt(I/2),I===0)break;k=I%2}else if(b=b.times(E),L(b,b.e+1,1),b.e>14)k=is(b);else{if(I=+F(b),I===0)break;k=I%2}B=B.times(B),$?B.c&&B.c.length>$&&(B.c.length=$):T&&(B=B.mod(y))}return T?S:(O&&(S=s.div(S)),y?S.mod(y):$?L(S,h,c,D):S)},o.integerValue=function(b){var y=new x(this);return b==null?b=c:Ee(b,0,8),L(y,y.e+1,b)},o.isEqualTo=o.eq=function(b,y){return Un(this,new x(b,y))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(b,y){return Un(this,new x(b,y))>0},o.isGreaterThanOrEqualTo=o.gte=function(b,y){return(y=Un(this,new x(b,y)))===1||y===0},o.isInteger=function(){return!!this.c&&pt(this.e/ce)>this.c.length-2},o.isLessThan=o.lt=function(b,y){return Un(this,new x(b,y))<0},o.isLessThanOrEqualTo=o.lte=function(b,y){return(y=Un(this,new x(b,y)))===-1||y===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(b,y){var E,T,I,$,D=this,w=D.s;if(b=new x(b,y),y=b.s,!w||!y)return new x(NaN);if(w!=y)return b.s=-y,D.plus(b);var O=D.e/ce,k=b.e/ce,S=D.c,B=b.c;if(!O||!k){if(!S||!B)return S?(b.s=-y,b):new x(B?D:NaN);if(!S[0]||!B[0])return B[0]?(b.s=-y,b):new x(S[0]?D:c==3?-0:0)}if(O=pt(O),k=pt(k),S=S.slice(),w=O-k){for(($=w<0)?(w=-w,I=S):(k=O,I=B),I.reverse(),y=w;y--;I.push(0));I.reverse()}else for(T=($=(w=S.length)<(y=B.length))?w:y,w=y=0;y<T;y++)if(S[y]!=B[y]){$=S[y]<B[y];break}if($&&(I=S,S=B,B=I,b.s=-b.s),y=(T=B.length)-(E=S.length),y>0)for(;y--;S[E++]=0);for(y=At-1;T>w;){if(S[--T]<B[T]){for(E=T;E&&!S[--E];S[E]=y);--S[E],S[T]+=At}S[T]-=B[T]}for(;S[0]==0;S.splice(0,1),--k);return S[0]?M(b,S,k):(b.s=c==3?-1:1,b.c=[b.e=0],b)},o.modulo=o.mod=function(b,y){var E,T,I=this;return b=new x(b,y),!I.c||!b.s||b.c&&!b.c[0]?new x(NaN):!b.c||I.c&&!I.c[0]?new x(I):(d==9?(T=b.s,b.s=1,E=t(I,b,0,3),b.s=T,E.s*=T):E=t(I,b,0,d),b=I.minus(E.times(b)),!b.c[0]&&d==1&&(b.s=I.s),b)},o.multipliedBy=o.times=function(b,y){var E,T,I,$,D,w,O,k,S,B,j,U,_,G,Q,q=this,W=q.c,ee=(b=new x(b,y)).c;if(!W||!ee||!W[0]||!ee[0])return!q.s||!b.s||W&&!W[0]&&!ee||ee&&!ee[0]&&!W?b.c=b.e=b.s=null:(b.s*=q.s,!W||!ee?b.c=b.e=null:(b.c=[0],b.e=0)),b;for(T=pt(q.e/ce)+pt(b.e/ce),b.s*=q.s,O=W.length,B=ee.length,O<B&&(_=W,W=ee,ee=_,I=O,O=B,B=I),I=O+B,_=[];I--;_.push(0));for(G=At,Q=Sn,I=B;--I>=0;){for(E=0,j=ee[I]%Q,U=ee[I]/Q|0,D=O,$=I+D;$>I;)k=W[--D]%Q,S=W[D]/Q|0,w=U*k+S*j,k=j*k+w%Q*Q+_[$]+E,E=(k/G|0)+(w/Q|0)+U*S,_[$--]=k%G;_[$]=E}return E?++T:_.splice(0,1),M(b,_,T)},o.negated=function(){var b=new x(this);return b.s=-b.s||null,b},o.plus=function(b,y){var E,T=this,I=T.s;if(b=new x(b,y),y=b.s,!I||!y)return new x(NaN);if(I!=y)return b.s=-y,T.minus(b);var $=T.e/ce,D=b.e/ce,w=T.c,O=b.c;if(!$||!D){if(!w||!O)return new x(I/0);if(!w[0]||!O[0])return O[0]?b:new x(w[0]?T:I*0)}if($=pt($),D=pt(D),w=w.slice(),I=$-D){for(I>0?(D=$,E=O):(I=-I,E=w),E.reverse();I--;E.push(0));E.reverse()}for(I=w.length,y=O.length,I-y<0&&(E=O,O=w,w=E,y=I),I=0;y;)I=(w[--y]=w[y]+O[y]+I)/At|0,w[y]=At===w[y]?0:w[y]%At;return I&&(w=[I].concat(w),++D),M(b,w,D)},o.precision=o.sd=function(b,y){var E,T,I,$=this;if(b!=null&&b!==!!b)return Ee(b,1,Me),y==null?y=c:Ee(y,0,8),L(new x($),b,y);if(!(E=$.c))return null;if(I=E.length-1,T=I*ce+1,I=E[I]){for(;I%10==0;I/=10,T--);for(I=E[0];I>=10;I/=10,T++);}return b&&$.e+1>T&&(T=$.e+1),T},o.shiftedBy=function(b){return Ee(b,-$i,$i),this.times("1e"+b)},o.squareRoot=o.sqrt=function(){var b,y,E,T,I,$=this,D=$.c,w=$.s,O=$.e,k=i+4,S=new x("0.5");if(w!==1||!D||!D[0])return new x(!w||w<0&&(!D||D[0])?NaN:D?$:1/0);if(w=Math.sqrt(+F($)),w==0||w==1/0?(y=ht(D),(y.length+O)%2==0&&(y+="0"),w=Math.sqrt(+y),O=pt((O+1)/2)-(O<0||O%2),w==1/0?y="5e"+O:(y=w.toExponential(),y=y.slice(0,y.indexOf("e")+1)+O),E=new x(y)):E=new x(w+""),E.c[0]){for(O=E.e,w=O+k,w<3&&(w=0);;)if(I=E,E=S.times(I.plus(t($,I,k,1))),ht(I.c).slice(0,w)===(y=ht(E.c)).slice(0,w))if(E.e<O&&--w,y=y.slice(w-3,w+1),y=="9999"||!T&&y=="4999"){if(!T&&(L(I,I.e+i+2,0),I.times(I).eq($))){E=I;break}k+=4,w+=4,T=1}else{(!+y||!+y.slice(1)&&y.charAt(0)=="5")&&(L(E,E.e+i+2,1),b=!E.times(E).eq($));break}}return L(E,E.e+i+1,c,b)},o.toExponential=function(b,y){return b!=null&&(Ee(b,0,Me),b++),P(this,b,y,1)},o.toFixed=function(b,y){return b!=null&&(Ee(b,0,Me),b=b+this.e+1),P(this,b,y)},o.toFormat=function(b,y,E){var T,I=this;if(E==null)b!=null&&y&&typeof y=="object"?(E=y,y=null):b&&typeof b=="object"?(E=b,b=y=null):E=m;else if(typeof E!="object")throw Error(Ke+"Argument not an object: "+E);if(T=I.toFixed(b,y),I.c){var $,D=T.split("."),w=+E.groupSize,O=+E.secondaryGroupSize,k=E.groupSeparator||"",S=D[0],B=D[1],j=I.s<0,U=j?S.slice(1):S,_=U.length;if(O&&($=w,w=O,O=$,_-=$),w>0&&_>0){for($=_%w||w,S=U.substr(0,$);$<_;$+=w)S+=k+U.substr($,w);O>0&&(S+=k+U.slice($)),j&&(S="-"+S)}T=B?S+(E.decimalSeparator||"")+((O=+E.fractionGroupSize)?B.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+(E.fractionGroupSeparator||"")):B):S}return(E.prefix||"")+T+(E.suffix||"")},o.toFraction=function(b){var y,E,T,I,$,D,w,O,k,S,B,j,U=this,_=U.c;if(b!=null&&(w=new x(b),!w.isInteger()&&(w.c||w.s!==1)||w.lt(s)))throw Error(Ke+"Argument "+(w.isInteger()?"out of range: ":"not an integer: ")+F(w));if(!_)return new x(U);for(y=new x(s),k=E=new x(s),T=O=new x(s),j=ht(_),$=y.e=j.length-U.e-1,y.c[0]=ki[(D=$%ce)<0?ce+D:D],b=!b||w.comparedTo(y)>0?$>0?y:k:w,D=f,f=1/0,w=new x(j),O.c[0]=0;S=t(w,y,0,1),I=E.plus(S.times(T)),I.comparedTo(b)!=1;)E=T,T=I,k=O.plus(S.times(I=k)),O=I,y=w.minus(S.times(I=y)),w=I;return I=t(b.minus(E),T,0,1),O=O.plus(I.times(k)),E=E.plus(I.times(T)),O.s=k.s=U.s,$=$*2,B=t(k,T,$,c).minus(U).abs().comparedTo(t(O,E,$,c).minus(U).abs())<1?[k,T]:[O,E],f=D,B},o.toNumber=function(){return+F(this)},o.toPrecision=function(b,y){return b!=null&&Ee(b,1,Me),P(this,b,y,2)},o.toString=function(b){var y,E=this,T=E.s,I=E.e;return I===null?T?(y="Infinity",T<0&&(y="-"+y)):y="NaN":(b==null?y=I<=a||I>=l?as(ht(E.c),I):tn(ht(E.c),I,"0"):b===10&&N?(E=L(new x(E),i+I+1,c),y=tn(ht(E.c),E.e,"0")):(Ee(b,2,g.length,"Base"),y=n(tn(ht(E.c),I,"0"),10,b,T,!0)),T<0&&E.c[0]&&(y="-"+y)),y},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 pt(e){var t=e|0;return e>0||e===t?t:t-1}function ht(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ce-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Un(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 Ee(e,t,n,r){if(e<t||e>n||e!==dt(e))throw Error(Ke+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function is(e){var t=e.c.length-1;return pt(e.e/ce)==t&&e.c[t]%2!=0}function as(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function tn(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 Le=Zl();const cb=(e,t=6)=>{try{const n=new Le(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Le.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"}},Nt=()=>{const{translations:e,currentLocale:t}=ql();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}}}},lb="1.1.0";let Ze=class zl extends Error{constructor(t,n={}){var i;const r=n.cause instanceof zl?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof zl&&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@${lb}`].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 nn(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Yl=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Xl=/^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)?$/,Jl=/^\(.+?\).*?$/,Ql=/^tuple(?<array>(\[(\d*)\])*)$/;function Mi(e){let t=e.type;if(Ql.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+=Mi(s),o<n-1&&(t+=", ")}const r=nn(Ql,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Mi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function fr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Mi(o),r!==n-1&&(t+=", ")}return t}function cs(e){var t;return e.type==="function"?`function ${e.name}(${fr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${fr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${fr(e.inputs)})`:e.type==="error"?`error ${e.name}(${fr(e.inputs)})`:e.type==="constructor"?`constructor(${fr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const eu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function ub(e){return eu.test(e)}function fb(e){return nn(eu,e)}const tu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function db(e){return tu.test(e)}function pb(e){return nn(tu,e)}const nu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function hb(e){return nu.test(e)}function mb(e){return nn(nu,e)}const ru=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function ls(e){return ru.test(e)}function bb(e){return nn(ru,e)}const ou=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function gb(e){return ou.test(e)}function yb(e){return nn(ou,e)}const su=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function vb(e){return su.test(e)}function wb(e){return nn(su,e)}const xb=/^receive\(\) external payable$/;function Eb(e){return xb.test(e)}const iu=new Set(["memory","indexed","storage","calldata"]),Sb=new Set(["indexed"]),Di=new Set(["calldata","memory","storage"]);class Pb 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 Tb 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 Ab 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 Nb 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 Cb extends Ze{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Ob 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 Ib 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 $b 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 kb 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 dr 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 Mb extends Ze{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Db 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 Bb 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 Lb 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 Fb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const Bi=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 Li(e,t={}){if(hb(e))return Rb(e,t);if(db(e))return jb(e,t);if(ub(e))return zb(e,t);if(gb(e))return Ub(e,t);if(vb(e))return _b(e);if(Eb(e))return{type:"receive",stateMutability:"payable"};throw new Mb({signature:e})}function Rb(e,t={}){const n=mb(e);if(!n)throw new dr({signature:e,type:"function"});const r=it(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(rn(r[c],{modifiers:Di,structs:t,type:"function"}));const i=[];if(n.returns){const c=it(n.returns),a=c.length;for(let l=0;l<a;l++)i.push(rn(c[l],{modifiers:Di,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function jb(e,t={}){const n=pb(e);if(!n)throw new dr({signature:e,type:"event"});const r=it(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(rn(r[i],{modifiers:Sb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function zb(e,t={}){const n=fb(e);if(!n)throw new dr({signature:e,type:"error"});const r=it(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(rn(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Ub(e,t={}){const n=yb(e);if(!n)throw new dr({signature:e,type:"constructor"});const r=it(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(rn(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function _b(e){const t=wb(e);if(!t)throw new dr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Wb=/^(?<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$_]*))?$/,Vb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Hb=/^u?int$/;function rn(e,t){var f,p;const n=Fb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Bi.has(n))return Bi.get(n);const r=Jl.test(e),o=nn(r?Vb:Wb,e);if(!o)throw new Cb({param:e});if(o.name&&qb(o.name))throw new Ob({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 d=it(o.type),h=[],m=d.length;for(let g=0;g<m;g++)h.push(rn(d[g],{structs:c}));l={components:h}}else if(o.type in c)a="tuple",l={components:c[o.type]};else if(Hb.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"&&!au(a))throw new Ab({type:a});if(o.modifier){if(!((p=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&p.call(f,o.modifier)))throw new Ib({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Di.has(o.modifier)&&!Kb(a,!!o.array))throw new $b({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...l};return Bi.set(n,u),u}function it(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?it(c,[...t,n.trim()]):it(c,t,`${n}${i}`,r);case"(":return it(c,t,`${n}${i}`,r+1);case")":return it(c,t,`${n}${i}`,r-1);default:return it(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Lb({current:n,depth:r});return t.push(n.trim()),t}function au(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Yl.test(e)||Xl.test(e)}const Gb=/^(?: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 qb(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Yl.test(e)||Xl.test(e)||Gb.test(e)}function Kb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Fi(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!ls(c))continue;const a=bb(c);if(!a)throw new dr({signature:c,type:"struct"});const l=a.properties.split(";"),u=[],f=l.length;for(let p=0;p<f;p++){const h=l[p].trim();if(!h)continue;const m=rn(h,{type:"struct"});u.push(m)}if(!u.length)throw new Db({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]=cu(a,t)}return r}const Zb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function cu(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(Jl.test(i.type))r.push(i);else{const a=nn(Zb,i.type);if(!(a!=null&&a.type))throw new kb({abiParameter:i});const{array:l,type:u}=a;if(u in t){if(n.has(u))throw new Bb({type:u});r.push({...i,type:`tuple${l??""}`,components:cu(t[u]??[],t,new Set([...n,u]))})}else if(au(u))r.push(i);else throw new Tb({type:u})}}return r}function lu(e){const t=Fi(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];ls(s)||n.push(Li(s,t))}return n}function uu(e){let t;if(typeof e=="string")t=Li(e);else{const n=Fi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!ls(s)){t=Li(s,n);break}}}if(!t)throw new Pb({signature:e});return t}function fu(e){const t=[];if(typeof e=="string"){const n=it(e),r=n.length;for(let o=0;o<r;o++)t.push(rn(n[o],{modifiers:iu}))}else{const n=Fi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(ls(s))continue;const i=it(s),c=i.length;for(let a=0;a<c;a++)t.push(rn(i[a],{modifiers:iu,structs:n}))}}if(t.length===0)throw new Nb({params:e});return t}function te(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function Ct(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new l1(e.type);return`${e.name}(${us(e.inputs,{includeName:t})})`}function us(e,{includeName:t=!1}={}){return e?e.map(n=>Yb(n,{includeName:t})).join(t?", ":","):""}function Yb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${us(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Ot(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Se(e){return Ot(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const du="2.42.1";let Kr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${du}`},V=class Ul extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof Ul?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Ul&&n.cause.docsPath||n.docsPath,s=(c=Kr.getDocsUrl)==null?void 0:c.call(Kr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Kr.version?[`Version: ${Kr.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=
|
|
53
|
-
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class
|
|
54
|
-
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class
|
|
55
|
-
`),{metaMessages:[`Params: (${us(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 Zr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class
|
|
56
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class
|
|
57
|
-
`),{name:"AbiEncodingLengthMismatchError"})}}class
|
|
58
|
-
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class
|
|
59
|
-
`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class
|
|
60
|
-
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class
|
|
61
|
-
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class
|
|
50
|
+
跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",feeRateTooltip:"預估手續費,以實際扣除為準。",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。",connectedWalletTitle:"從已連接錢包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他錢包進行充值",externalWalletTitle:"從外部錢包充值",externalWalletDesc:"從 Binance 或其他交易所、Arbitrum 等鏈或其他錢包轉帳",or:"或"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 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:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。",connectedWalletTitle:"提現至已連接錢包",connectedWalletDesc:"將資金提現至您已連接的加密錢包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提現至外部帳戶",externalWalletDesc:"將資金提現至 Binance 或其他交易所、Arbitrum 等鏈及其他錢包"},account:{title:"帳戶",perp:"合約帳戶","perpetual-v1":"合約V1賬戶","perpetual-v2":"合約V2賬戶",spot:"現貨帳戶"}},Oi=["en-US","ja-JP","ru-RU","zh-CN","zh-TW","de-DE","es-LA","fr-FR","it-IT"],Gc={"en-US":Xm,"ja-JP":tb,"ru-RU":nb,"zh-CN":rb,"zh-TW":ob,"de-DE":Ym,"es-LA":Jm,"fr-FR":Qm,"it-IT":eb},ss="en-US",sb={"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"},ib=e=>Oi.includes(e)?Gc[e]:Gc[ss],ab=e=>Oi.includes(e),qc=y.createContext(null),lb=({config:e,children:t})=>{const n=y.useMemo(()=>{const r=e.locale||ss,o=ab(r)?r:ss,s=ib(o);return{...e,currentLocale:o,translations:s}},[e]);return A.jsx(qc.Provider,{value:n,children:t})},Kc=()=>{const e=y.useContext(qc);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var cb=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ii=Math.ceil,pt=Math.floor,Ze="[BigNumber Error] ",Zc=Ze+"Number primitive has more than 15 significant digits: ",Nt=1e14,ie=14,$i=9007199254740991,ki=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Sn=1e7,Me=1e9;function Yc(e){var t,n,r,o=x.prototype={constructor:x,toString:null,valueOf:null},s=new x(1),i=20,l=4,a=-7,c=21,u=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},g="0123456789abcdefghijklmnopqrstuvwxyz",N=!0;function x(b,v){var E,$,I,T,B,w,O,k,S=this;if(!(S instanceof x))return new x(b,v);if(v==null){if(b&&b._isBigNumber===!0){S.s=b.s,!b.c||b.e>f?S.c=S.e=null:b.e<u?S.c=[S.e=0]:(S.e=b.e,S.c=b.c.slice());return}if((w=typeof b=="number")&&b*0==0){if(S.s=1/b<0?(b=-b,-1):1,b===~~b){for(T=0,B=b;B>=10;B/=10,T++);T>f?S.c=S.e=null:(S.e=T,S.c=[b]);return}k=String(b)}else{if(!cb.test(k=String(b)))return r(S,k,w);S.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}(T=k.indexOf("."))>-1&&(k=k.replace(".","")),(B=k.search(/e/i))>0?(T<0&&(T=B),T+=+k.slice(B+1),k=k.substring(0,B)):T<0&&(T=k.length)}else{if(Se(v,2,g.length,"Base"),v==10&&N)return S=new x(b),F(S,i+S.e+1,l);if(k=String(b),w=typeof b=="number"){if(b*0!=0)return r(S,k,w,v);if(S.s=1/b<0?(k=k.slice(1),-1):1,x.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(Zc+b)}else S.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(E=g.slice(0,v),T=B=0,O=k.length;B<O;B++)if(E.indexOf($=k.charAt(B))<0){if($=="."){if(B>T){T=O;continue}}else if(!I&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){I=!0,B=-1,T=0;continue}return r(S,String(b),w,v)}w=!1,k=n(k,v,10,S.s),(T=k.indexOf("."))>-1?k=k.replace(".",""):T=k.length}for(B=0;k.charCodeAt(B)===48;B++);for(O=k.length;k.charCodeAt(--O)===48;);if(k=k.slice(B,++O)){if(O-=B,w&&x.DEBUG&&O>15&&(b>$i||b!==pt(b)))throw Error(Zc+S.s*b);if((T=T-B-1)>f)S.c=S.e=null;else if(T<u)S.c=[S.e=0];else{if(S.e=T,S.c=[],B=(T+1)%ie,T<0&&(B+=ie),B<O){for(B&&S.c.push(+k.slice(0,B)),O-=ie;B<O;)S.c.push(+k.slice(B,B+=ie));B=ie-(k=k.slice(B)).length}else B-=O;for(;B--;k+="0");S.c.push(+k)}}else S.c=[S.e=0]}x.clone=Yc,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(b){var v,E;if(b!=null)if(typeof b=="object"){if(b.hasOwnProperty(v="DECIMAL_PLACES")&&(E=b[v],Se(E,0,Me,v),i=E),b.hasOwnProperty(v="ROUNDING_MODE")&&(E=b[v],Se(E,0,8,v),l=E),b.hasOwnProperty(v="EXPONENTIAL_AT")&&(E=b[v],E&&E.pop?(Se(E[0],-Me,0,v),Se(E[1],0,Me,v),a=E[0],c=E[1]):(Se(E,-Me,Me,v),a=-(c=E<0?-E:E))),b.hasOwnProperty(v="RANGE"))if(E=b[v],E&&E.pop)Se(E[0],-Me,-1,v),Se(E[1],1,Me,v),u=E[0],f=E[1];else if(Se(E,-Me,Me,v),E)u=-(f=E<0?-E:E);else throw Error(Ze+v+" cannot be zero: "+E);if(b.hasOwnProperty(v="CRYPTO"))if(E=b[v],E===!!E)if(E)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=E;else throw p=!E,Error(Ze+"crypto unavailable");else p=E;else throw Error(Ze+v+" not true or false: "+E);if(b.hasOwnProperty(v="MODULO_MODE")&&(E=b[v],Se(E,0,9,v),d=E),b.hasOwnProperty(v="POW_PRECISION")&&(E=b[v],Se(E,0,Me,v),h=E),b.hasOwnProperty(v="FORMAT"))if(E=b[v],typeof E=="object")m=E;else throw Error(Ze+v+" not an object: "+E);if(b.hasOwnProperty(v="ALPHABET"))if(E=b[v],typeof E=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(E))N=E.slice(0,10)=="0123456789",g=E;else throw Error(Ze+v+" invalid: "+E)}else throw Error(Ze+"Object expected: "+b);return{DECIMAL_PLACES:i,ROUNDING_MODE:l,EXPONENTIAL_AT:[a,c],RANGE:[u,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:g}},x.isBigNumber=function(b){if(!b||b._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var v,E,$=b.c,I=b.e,T=b.s;e:if({}.toString.call($)=="[object Array]"){if((T===1||T===-1)&&I>=-Me&&I<=Me&&I===pt(I)){if($[0]===0){if(I===0&&$.length===1)return!0;break e}if(v=(I+1)%ie,v<1&&(v+=ie),String($[0]).length==v){for(v=0;v<$.length;v++)if(E=$[v],E<0||E>=Nt||E!==pt(E))break e;if(E!==0)return!0}}}else if($===null&&I===null&&(T===null||T===1||T===-1))return!0;throw Error(Ze+"Invalid BigNumber: "+b)},x.maximum=x.max=function(){return C(arguments,-1)},x.minimum=x.min=function(){return C(arguments,1)},x.random=function(){var b=9007199254740992,v=Math.random()*b&2097151?function(){return pt(Math.random()*b)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(E){var $,I,T,B,w,O=0,k=[],S=new x(s);if(E==null?E=i:Se(E,0,Me),B=Ii(E/ie),p)if(crypto.getRandomValues){for($=crypto.getRandomValues(new Uint32Array(B*=2));O<B;)w=$[O]*131072+($[O+1]>>>11),w>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),$[O]=I[0],$[O+1]=I[1]):(k.push(w%1e14),O+=2);O=B/2}else if(crypto.randomBytes){for($=crypto.randomBytes(B*=7);O<B;)w=($[O]&31)*281474976710656+$[O+1]*1099511627776+$[O+2]*4294967296+$[O+3]*16777216+($[O+4]<<16)+($[O+5]<<8)+$[O+6],w>=9e15?crypto.randomBytes(7).copy($,O):(k.push(w%1e14),O+=7);O=B/7}else throw p=!1,Error(Ze+"crypto unavailable");if(!p)for(;O<B;)w=v(),w<9e15&&(k[O++]=w%1e14);for(B=k[--O],E%=ie,B&&E&&(w=ki[ie-E],k[O]=pt(B/w)*w);k[O]===0;k.pop(),O--);if(O<0)k=[T=0];else{for(T=-1;k[0]===0;k.splice(0,1),T-=ie);for(O=1,w=k[0];w>=10;w/=10,O++);O<ie&&(T-=ie-O)}return S.e=T,S.c=k,S}}(),x.sum=function(){for(var b=1,v=arguments,E=new x(v[0]);b<v.length;)E=E.plus(v[b++]);return E},n=function(){var b="0123456789";function v(E,$,I,T){for(var B,w=[0],O,k=0,S=E.length;k<S;){for(O=w.length;O--;w[O]*=$);for(w[0]+=T.indexOf(E.charAt(k++)),B=0;B<w.length;B++)w[B]>I-1&&(w[B+1]==null&&(w[B+1]=0),w[B+1]+=w[B]/I|0,w[B]%=I)}return w.reverse()}return function(E,$,I,T,B){var w,O,k,S,M,j,z,_,q=E.indexOf("."),Q=i,K=l;for(q>=0&&(S=h,h=0,E=E.replace(".",""),_=new x($),j=_.pow(E.length-q),h=S,_.c=v(tn(mt(j.c),j.e,"0"),10,I,b),_.e=_.c.length),z=v(E,$,I,B?(w=g,b):(w=b,g)),k=S=z.length;z[--S]==0;z.pop());if(!z[0])return w.charAt(0);if(q<0?--k:(j.c=z,j.e=k,j.s=T,j=t(j,_,Q,K,I),z=j.c,M=j.r,k=j.e),O=k+Q+1,q=z[O],S=I/2,M=M||O<0||z[O+1]!=null,M=K<4?(q!=null||M)&&(K==0||K==(j.s<0?3:2)):q>S||q==S&&(K==4||M||K==6&&z[O-1]&1||K==(j.s<0?8:7)),O<1||!z[0])E=M?tn(w.charAt(1),-Q,w.charAt(0)):w.charAt(0);else{if(z.length=O,M)for(--I;++z[--O]>I;)z[O]=0,O||(++k,z=[1].concat(z));for(S=z.length;!z[--S];);for(q=0,E="";q<=S;E+=w.charAt(z[q++]));E=tn(E,k,w.charAt(0))}return E}}(),t=function(){function b($,I,T){var B,w,O,k,S=0,M=$.length,j=I%Sn,z=I/Sn|0;for($=$.slice();M--;)O=$[M]%Sn,k=$[M]/Sn|0,B=z*O+k*j,w=j*O+B%Sn*Sn+S,S=(w/T|0)+(B/Sn|0)+z*k,$[M]=w%T;return S&&($=[S].concat($)),$}function v($,I,T,B){var w,O;if(T!=B)O=T>B?1:-1;else for(w=O=0;w<T;w++)if($[w]!=I[w]){O=$[w]>I[w]?1:-1;break}return O}function E($,I,T,B){for(var w=0;T--;)$[T]-=w,w=$[T]<I[T]?1:0,$[T]=w*B+$[T]-I[T];for(;!$[0]&&$.length>1;$.splice(0,1));}return function($,I,T,B,w){var O,k,S,M,j,z,_,q,Q,K,W,te,be,de,Ee,Z,H,X=$.s==I.s?1:-1,ae=$.c,ee=I.c;if(!ae||!ae[0]||!ee||!ee[0])return new x(!$.s||!I.s||(ae?ee&&ae[0]==ee[0]:!ee)?NaN:ae&&ae[0]==0||!ee?X*0:X/0);for(q=new x(X),Q=q.c=[],k=$.e-I.e,X=T+k+1,w||(w=Nt,k=ht($.e/ie)-ht(I.e/ie),X=X/ie|0),S=0;ee[S]==(ae[S]||0);S++);if(ee[S]>(ae[S]||0)&&k--,X<0)Q.push(1),M=!0;else{for(de=ae.length,Z=ee.length,S=0,X+=2,j=pt(w/(ee[0]+1)),j>1&&(ee=b(ee,j,w),ae=b(ae,j,w),Z=ee.length,de=ae.length),be=Z,K=ae.slice(0,Z),W=K.length;W<Z;K[W++]=0);H=ee.slice(),H=[0].concat(H),Ee=ee[0],ee[1]>=w/2&&Ee++;do{if(j=0,O=v(ee,K,Z,W),O<0){if(te=K[0],Z!=W&&(te=te*w+(K[1]||0)),j=pt(te/Ee),j>1)for(j>=w&&(j=w-1),z=b(ee,j,w),_=z.length,W=K.length;v(z,K,_,W)==1;)j--,E(z,Z<_?H:ee,_,w),_=z.length,O=1;else j==0&&(O=j=1),z=ee.slice(),_=z.length;if(_<W&&(z=[0].concat(z)),E(K,z,W,w),W=K.length,O==-1)for(;v(ee,K,Z,W)<1;)j++,E(K,Z<W?H:ee,W,w),W=K.length}else O===0&&(j++,K=[0]);Q[S++]=j,K[0]?K[W++]=ae[be]||0:(K=[ae[be]],W=1)}while((be++<de||K[0]!=null)&&X--);M=K[0]!=null,Q[0]||Q.splice(0,1)}if(w==Nt){for(S=1,X=Q[0];X>=10;X/=10,S++);F(q,T+(q.e=S+k*ie-1)+1,B,M)}else q.e=k,q.r=+M;return q}}();function P(b,v,E,$){var I,T,B,w,O;if(E==null?E=l:Se(E,0,8),!b.c)return b.toString();if(I=b.c[0],B=b.e,v==null)O=mt(b.c),O=$==1||$==2&&(B<=a||B>=c)?as(O,B):tn(O,B,"0");else if(b=F(new x(b),v,E),T=b.e,O=mt(b.c),w=O.length,$==1||$==2&&(v<=T||T<=a)){for(;w<v;O+="0",w++);O=as(O,T)}else if(v-=B+($===2&&T>B),O=tn(O,T,"0"),T+1>w){if(--v>0)for(O+=".";v--;O+="0");}else if(v+=T-w,v>0)for(T+1==w&&(O+=".");v--;O+="0");return b.s<0&&I?"-"+O:O}function C(b,v){for(var E,$,I=1,T=new x(b[0]);I<b.length;I++)$=new x(b[I]),(!$.s||(E=Un(T,$))===v||E===0&&T.s===v)&&(T=$);return T}function D(b,v,E){for(var $=1,I=v.length;!v[--I];v.pop());for(I=v[0];I>=10;I/=10,$++);return(E=$+E*ie-1)>f?b.c=b.e=null:E<u?b.c=[b.e=0]:(b.e=E,b.c=v),b}r=function(){var b=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,E=/^\.([^.]+)$/,$=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(T,B,w,O){var k,S=w?B:B.replace(I,"");if($.test(S))T.s=isNaN(S)?null:S<0?-1:1;else{if(!w&&(S=S.replace(b,function(M,j,z){return k=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!O||O==k?j:M}),O&&(k=O,S=S.replace(v,"$1").replace(E,"0.$1")),B!=S))return new x(S,k);if(x.DEBUG)throw Error(Ze+"Not a"+(O?" base "+O:"")+" number: "+B);T.s=null}T.c=T.e=null}}();function F(b,v,E,$){var I,T,B,w,O,k,S,M=b.c,j=ki;if(M){e:{for(I=1,w=M[0];w>=10;w/=10,I++);if(T=v-I,T<0)T+=ie,B=v,O=M[k=0],S=pt(O/j[I-B-1]%10);else if(k=Ii((T+1)/ie),k>=M.length)if($){for(;M.length<=k;M.push(0));O=S=0,I=1,T%=ie,B=T-ie+1}else break e;else{for(O=w=M[k],I=1;w>=10;w/=10,I++);T%=ie,B=T-ie+I,S=B<0?0:pt(O/j[I-B-1]%10)}if($=$||v<0||M[k+1]!=null||(B<0?O:O%j[I-B-1]),$=E<4?(S||$)&&(E==0||E==(b.s<0?3:2)):S>5||S==5&&(E==4||$||E==6&&(T>0?B>0?O/j[I-B]:0:M[k-1])%10&1||E==(b.s<0?8:7)),v<1||!M[0])return M.length=0,$?(v-=b.e+1,M[0]=j[(ie-v%ie)%ie],b.e=-v||0):M[0]=b.e=0,b;if(T==0?(M.length=k,w=1,k--):(M.length=k+1,w=j[ie-T],M[k]=B>0?pt(O/j[I-B]%j[B])*w:0),$)for(;;)if(k==0){for(T=1,B=M[0];B>=10;B/=10,T++);for(B=M[0]+=w,w=1;B>=10;B/=10,w++);T!=w&&(b.e++,M[0]==Nt&&(M[0]=1));break}else{if(M[k]+=w,M[k]!=Nt)break;M[k--]=0,w=1}for(T=M.length;M[--T]===0;M.pop());}b.e>f?b.c=b.e=null:b.e<u&&(b.c=[b.e=0])}return b}function L(b){var v,E=b.e;return E===null?b.toString():(v=mt(b.c),v=E<=a||E>=c?as(v,E):tn(v,E,"0"),b.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var b=new x(this);return b.s<0&&(b.s=1),b},o.comparedTo=function(b,v){return Un(this,new x(b,v))},o.decimalPlaces=o.dp=function(b,v){var E,$,I,T=this;if(b!=null)return Se(b,0,Me),v==null?v=l:Se(v,0,8),F(new x(T),b+T.e+1,v);if(!(E=T.c))return null;if($=((I=E.length-1)-ht(this.e/ie))*ie,I=E[I])for(;I%10==0;I/=10,$--);return $<0&&($=0),$},o.dividedBy=o.div=function(b,v){return t(this,new x(b,v),i,l)},o.dividedToIntegerBy=o.idiv=function(b,v){return t(this,new x(b,v),0,1)},o.exponentiatedBy=o.pow=function(b,v){var E,$,I,T,B,w,O,k,S,M=this;if(b=new x(b),b.c&&!b.isInteger())throw Error(Ze+"Exponent not an integer: "+L(b));if(v!=null&&(v=new x(v)),w=b.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!b.c||!b.c[0])return S=new x(Math.pow(+L(M),w?b.s*(2-is(b)):+L(b))),v?S.mod(v):S;if(O=b.s<0,v){if(v.c?!v.c[0]:!v.s)return new x(NaN);$=!O&&M.isInteger()&&v.isInteger(),$&&(M=M.mod(v))}else{if(b.e>9&&(M.e>0||M.e<-1||(M.e==0?M.c[0]>1||w&&M.c[1]>=24e7:M.c[0]<8e13||w&&M.c[0]<=9999975e7)))return T=M.s<0&&is(b)?-0:0,M.e>-1&&(T=1/T),new x(O?1/T:T);h&&(T=Ii(h/ie+2))}for(w?(E=new x(.5),O&&(b.s=1),k=is(b)):(I=Math.abs(+L(b)),k=I%2),S=new x(s);;){if(k){if(S=S.times(M),!S.c)break;T?S.c.length>T&&(S.c.length=T):$&&(S=S.mod(v))}if(I){if(I=pt(I/2),I===0)break;k=I%2}else if(b=b.times(E),F(b,b.e+1,1),b.e>14)k=is(b);else{if(I=+L(b),I===0)break;k=I%2}M=M.times(M),T?M.c&&M.c.length>T&&(M.c.length=T):$&&(M=M.mod(v))}return $?S:(O&&(S=s.div(S)),v?S.mod(v):T?F(S,h,l,B):S)},o.integerValue=function(b){var v=new x(this);return b==null?b=l:Se(b,0,8),F(v,v.e+1,b)},o.isEqualTo=o.eq=function(b,v){return Un(this,new x(b,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(b,v){return Un(this,new x(b,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(b,v){return(v=Un(this,new x(b,v)))===1||v===0},o.isInteger=function(){return!!this.c&&ht(this.e/ie)>this.c.length-2},o.isLessThan=o.lt=function(b,v){return Un(this,new x(b,v))<0},o.isLessThanOrEqualTo=o.lte=function(b,v){return(v=Un(this,new x(b,v)))===-1||v===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(b,v){var E,$,I,T,B=this,w=B.s;if(b=new x(b,v),v=b.s,!w||!v)return new x(NaN);if(w!=v)return b.s=-v,B.plus(b);var O=B.e/ie,k=b.e/ie,S=B.c,M=b.c;if(!O||!k){if(!S||!M)return S?(b.s=-v,b):new x(M?B:NaN);if(!S[0]||!M[0])return M[0]?(b.s=-v,b):new x(S[0]?B:l==3?-0:0)}if(O=ht(O),k=ht(k),S=S.slice(),w=O-k){for((T=w<0)?(w=-w,I=S):(k=O,I=M),I.reverse(),v=w;v--;I.push(0));I.reverse()}else for($=(T=(w=S.length)<(v=M.length))?w:v,w=v=0;v<$;v++)if(S[v]!=M[v]){T=S[v]<M[v];break}if(T&&(I=S,S=M,M=I,b.s=-b.s),v=($=M.length)-(E=S.length),v>0)for(;v--;S[E++]=0);for(v=Nt-1;$>w;){if(S[--$]<M[$]){for(E=$;E&&!S[--E];S[E]=v);--S[E],S[$]+=Nt}S[$]-=M[$]}for(;S[0]==0;S.splice(0,1),--k);return S[0]?D(b,S,k):(b.s=l==3?-1:1,b.c=[b.e=0],b)},o.modulo=o.mod=function(b,v){var E,$,I=this;return b=new x(b,v),!I.c||!b.s||b.c&&!b.c[0]?new x(NaN):!b.c||I.c&&!I.c[0]?new x(I):(d==9?($=b.s,b.s=1,E=t(I,b,0,3),b.s=$,E.s*=$):E=t(I,b,0,d),b=I.minus(E.times(b)),!b.c[0]&&d==1&&(b.s=I.s),b)},o.multipliedBy=o.times=function(b,v){var E,$,I,T,B,w,O,k,S,M,j,z,_,q,Q,K=this,W=K.c,te=(b=new x(b,v)).c;if(!W||!te||!W[0]||!te[0])return!K.s||!b.s||W&&!W[0]&&!te||te&&!te[0]&&!W?b.c=b.e=b.s=null:(b.s*=K.s,!W||!te?b.c=b.e=null:(b.c=[0],b.e=0)),b;for($=ht(K.e/ie)+ht(b.e/ie),b.s*=K.s,O=W.length,M=te.length,O<M&&(_=W,W=te,te=_,I=O,O=M,M=I),I=O+M,_=[];I--;_.push(0));for(q=Nt,Q=Sn,I=M;--I>=0;){for(E=0,j=te[I]%Q,z=te[I]/Q|0,B=O,T=I+B;T>I;)k=W[--B]%Q,S=W[B]/Q|0,w=z*k+S*j,k=j*k+w%Q*Q+_[T]+E,E=(k/q|0)+(w/Q|0)+z*S,_[T--]=k%q;_[T]=E}return E?++$:_.splice(0,1),D(b,_,$)},o.negated=function(){var b=new x(this);return b.s=-b.s||null,b},o.plus=function(b,v){var E,$=this,I=$.s;if(b=new x(b,v),v=b.s,!I||!v)return new x(NaN);if(I!=v)return b.s=-v,$.minus(b);var T=$.e/ie,B=b.e/ie,w=$.c,O=b.c;if(!T||!B){if(!w||!O)return new x(I/0);if(!w[0]||!O[0])return O[0]?b:new x(w[0]?$:I*0)}if(T=ht(T),B=ht(B),w=w.slice(),I=T-B){for(I>0?(B=T,E=O):(I=-I,E=w),E.reverse();I--;E.push(0));E.reverse()}for(I=w.length,v=O.length,I-v<0&&(E=O,O=w,w=E,v=I),I=0;v;)I=(w[--v]=w[v]+O[v]+I)/Nt|0,w[v]=Nt===w[v]?0:w[v]%Nt;return I&&(w=[I].concat(w),++B),D(b,w,B)},o.precision=o.sd=function(b,v){var E,$,I,T=this;if(b!=null&&b!==!!b)return Se(b,1,Me),v==null?v=l:Se(v,0,8),F(new x(T),b,v);if(!(E=T.c))return null;if(I=E.length-1,$=I*ie+1,I=E[I]){for(;I%10==0;I/=10,$--);for(I=E[0];I>=10;I/=10,$++);}return b&&T.e+1>$&&($=T.e+1),$},o.shiftedBy=function(b){return Se(b,-$i,$i),this.times("1e"+b)},o.squareRoot=o.sqrt=function(){var b,v,E,$,I,T=this,B=T.c,w=T.s,O=T.e,k=i+4,S=new x("0.5");if(w!==1||!B||!B[0])return new x(!w||w<0&&(!B||B[0])?NaN:B?T:1/0);if(w=Math.sqrt(+L(T)),w==0||w==1/0?(v=mt(B),(v.length+O)%2==0&&(v+="0"),w=Math.sqrt(+v),O=ht((O+1)/2)-(O<0||O%2),w==1/0?v="5e"+O:(v=w.toExponential(),v=v.slice(0,v.indexOf("e")+1)+O),E=new x(v)):E=new x(w+""),E.c[0]){for(O=E.e,w=O+k,w<3&&(w=0);;)if(I=E,E=S.times(I.plus(t(T,I,k,1))),mt(I.c).slice(0,w)===(v=mt(E.c)).slice(0,w))if(E.e<O&&--w,v=v.slice(w-3,w+1),v=="9999"||!$&&v=="4999"){if(!$&&(F(I,I.e+i+2,0),I.times(I).eq(T))){E=I;break}k+=4,w+=4,$=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(F(E,E.e+i+2,1),b=!E.times(E).eq(T));break}}return F(E,E.e+i+1,l,b)},o.toExponential=function(b,v){return b!=null&&(Se(b,0,Me),b++),P(this,b,v,1)},o.toFixed=function(b,v){return b!=null&&(Se(b,0,Me),b=b+this.e+1),P(this,b,v)},o.toFormat=function(b,v,E){var $,I=this;if(E==null)b!=null&&v&&typeof v=="object"?(E=v,v=null):b&&typeof b=="object"?(E=b,b=v=null):E=m;else if(typeof E!="object")throw Error(Ze+"Argument not an object: "+E);if($=I.toFixed(b,v),I.c){var T,B=$.split("."),w=+E.groupSize,O=+E.secondaryGroupSize,k=E.groupSeparator||"",S=B[0],M=B[1],j=I.s<0,z=j?S.slice(1):S,_=z.length;if(O&&(T=w,w=O,O=T,_-=T),w>0&&_>0){for(T=_%w||w,S=z.substr(0,T);T<_;T+=w)S+=k+z.substr(T,w);O>0&&(S+=k+z.slice(T)),j&&(S="-"+S)}$=M?S+(E.decimalSeparator||"")+((O=+E.fractionGroupSize)?M.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+(E.fractionGroupSeparator||"")):M):S}return(E.prefix||"")+$+(E.suffix||"")},o.toFraction=function(b){var v,E,$,I,T,B,w,O,k,S,M,j,z=this,_=z.c;if(b!=null&&(w=new x(b),!w.isInteger()&&(w.c||w.s!==1)||w.lt(s)))throw Error(Ze+"Argument "+(w.isInteger()?"out of range: ":"not an integer: ")+L(w));if(!_)return new x(z);for(v=new x(s),k=E=new x(s),$=O=new x(s),j=mt(_),T=v.e=j.length-z.e-1,v.c[0]=ki[(B=T%ie)<0?ie+B:B],b=!b||w.comparedTo(v)>0?T>0?v:k:w,B=f,f=1/0,w=new x(j),O.c[0]=0;S=t(w,v,0,1),I=E.plus(S.times($)),I.comparedTo(b)!=1;)E=$,$=I,k=O.plus(S.times(I=k)),O=I,v=w.minus(S.times(I=v)),w=I;return I=t(b.minus(E),$,0,1),O=O.plus(I.times(k)),E=E.plus(I.times($)),O.s=k.s=z.s,T=T*2,M=t(k,$,T,l).minus(z).abs().comparedTo(t(O,E,T,l).minus(z).abs())<1?[k,$]:[O,E],f=B,M},o.toNumber=function(){return+L(this)},o.toPrecision=function(b,v){return b!=null&&Se(b,1,Me),P(this,b,v,2)},o.toString=function(b){var v,E=this,$=E.s,I=E.e;return I===null?$?(v="Infinity",$<0&&(v="-"+v)):v="NaN":(b==null?v=I<=a||I>=c?as(mt(E.c),I):tn(mt(E.c),I,"0"):b===10&&N?(E=F(new x(E),i+I+1,l),v=tn(mt(E.c),E.e,"0")):(Se(b,2,g.length,"Base"),v=n(tn(mt(E.c),I,"0"),10,b,$,!0)),$<0&&E.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return L(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&x.set(e),x}function ht(e){var t=e|0;return e>0||e===t?t:t-1}function mt(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ie-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Un(e,t){var n,r,o=e.c,s=t.c,i=e.s,l=t.s,a=e.e,c=t.e;if(!i||!l)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-l:i;if(i!=l)return i;if(n=i<0,r=a==c,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>c^n?1:-1;for(l=(a=o.length)<(c=s.length)?a:c,i=0;i<l;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==c?0:a>c^n?1:-1}function Se(e,t,n,r){if(e<t||e>n||e!==pt(e))throw Error(Ze+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function is(e){var t=e.c.length-1;return ht(e.e/ie)==t&&e.c[t]%2!=0}function as(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function tn(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 Le=Yc();const ub=(e,t=6)=>{try{const n=new Le(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Le.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const l=(s||"").padEnd(t,"0");return`${i}.${l}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},Ct=()=>{const{translations:e,currentLocale:t}=Kc();return{t:(s,i)=>{try{const l=s.split(".");let a=e;for(const u of l)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let c=typeof a=="string"?a:s;return i&&typeof c=="string"&&Object.keys(i).forEach(u=>{const f=`{{${u}}}`;c=c.replace(new RegExp(f,"g"),String(i[u]))}),c}catch(l){return console.warn(`Translation error for key "${s}":`,l),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return{};return typeof l=="object"?l:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return!1;return typeof l=="string"}catch{return!1}}}},fb="1.1.0";let Ye=class Uc extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Uc?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Uc&&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@${fb}`].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 nn(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Xc=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Jc=/^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)?$/,Qc=/^\(.+?\).*?$/,eu=/^tuple(?<array>(\[(\d*)\])*)$/;function Mi(e){let t=e.type;if(eu.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+=Mi(s),o<n-1&&(t+=", ")}const r=nn(eu,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Mi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function fr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Mi(o),r!==n-1&&(t+=", ")}return t}function ls(e){var t;return e.type==="function"?`function ${e.name}(${fr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${fr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${fr(e.inputs)})`:e.type==="error"?`error ${e.name}(${fr(e.inputs)})`:e.type==="constructor"?`constructor(${fr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const tu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function db(e){return tu.test(e)}function pb(e){return nn(tu,e)}const nu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function hb(e){return nu.test(e)}function mb(e){return nn(nu,e)}const ru=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function bb(e){return ru.test(e)}function gb(e){return nn(ru,e)}const ou=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function cs(e){return ou.test(e)}function yb(e){return nn(ou,e)}const su=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function vb(e){return su.test(e)}function wb(e){return nn(su,e)}const iu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function xb(e){return iu.test(e)}function Eb(e){return nn(iu,e)}const Sb=/^receive\(\) external payable$/;function Pb(e){return Sb.test(e)}const au=new Set(["memory","indexed","storage","calldata"]),Tb=new Set(["indexed"]),Di=new Set(["calldata","memory","storage"]);class Ab extends Ye{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Nb extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Cb extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Ob extends Ye{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class Ib extends Ye{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class $b extends Ye{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class kb extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Mb extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Db extends Ye{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class dr extends Ye{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Bb extends Ye{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Lb extends Ye{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Fb extends Ye{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Rb extends Ye{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function jb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const Bi=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 Li(e,t={}){if(bb(e))return zb(e,t);if(hb(e))return Ub(e,t);if(db(e))return _b(e,t);if(vb(e))return Wb(e,t);if(xb(e))return Vb(e);if(Pb(e))return{type:"receive",stateMutability:"payable"};throw new Bb({signature:e})}function zb(e,t={}){const n=gb(e);if(!n)throw new dr({signature:e,type:"function"});const r=at(n.parameters),o=[],s=r.length;for(let l=0;l<s;l++)o.push(rn(r[l],{modifiers:Di,structs:t,type:"function"}));const i=[];if(n.returns){const l=at(n.returns),a=l.length;for(let c=0;c<a;c++)i.push(rn(l[c],{modifiers:Di,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Ub(e,t={}){const n=mb(e);if(!n)throw new dr({signature:e,type:"event"});const r=at(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(rn(r[i],{modifiers:Tb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function _b(e,t={}){const n=pb(e);if(!n)throw new dr({signature:e,type:"error"});const r=at(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(rn(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Wb(e,t={}){const n=wb(e);if(!n)throw new dr({signature:e,type:"constructor"});const r=at(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(rn(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Vb(e){const t=Eb(e);if(!t)throw new dr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Hb=/^(?<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$_]*))?$/,Gb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,qb=/^u?int$/;function rn(e,t){var f,p;const n=jb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Bi.has(n))return Bi.get(n);const r=Qc.test(e),o=nn(r?Gb:Hb,e);if(!o)throw new Ib({param:e});if(o.name&&Zb(o.name))throw new $b({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},l=(t==null?void 0:t.structs)??{};let a,c={};if(r){a="tuple";const d=at(o.type),h=[],m=d.length;for(let g=0;g<m;g++)h.push(rn(d[g],{structs:l}));c={components:h}}else if(o.type in l)a="tuple",c={components:l[o.type]};else if(qb.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"&&!lu(a))throw new Cb({type:a});if(o.modifier){if(!((p=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&p.call(f,o.modifier)))throw new kb({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Di.has(o.modifier)&&!Yb(a,!!o.array))throw new Mb({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...c};return Bi.set(n,u),u}function at(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],l=e.slice(s+1);switch(i){case",":return r===0?at(l,[...t,n.trim()]):at(l,t,`${n}${i}`,r);case"(":return at(l,t,`${n}${i}`,r+1);case")":return at(l,t,`${n}${i}`,r-1);default:return at(l,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Rb({current:n,depth:r});return t.push(n.trim()),t}function lu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Xc.test(e)||Jc.test(e)}const Kb=/^(?: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 Zb(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Xc.test(e)||Jc.test(e)||Kb.test(e)}function Yb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Fi(e){const t={},n=e.length;for(let i=0;i<n;i++){const l=e[i];if(!cs(l))continue;const a=yb(l);if(!a)throw new dr({signature:l,type:"struct"});const c=a.properties.split(";"),u=[],f=c.length;for(let p=0;p<f;p++){const h=c[p].trim();if(!h)continue;const m=rn(h,{type:"struct"});u.push(m)}if(!u.length)throw new Lb({signature:l});t[a.name]=u}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[l,a]=o[i];r[l]=cu(a,t)}return r}const Xb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function cu(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(Qc.test(i.type))r.push(i);else{const a=nn(Xb,i.type);if(!(a!=null&&a.type))throw new Db({abiParameter:i});const{array:c,type:u}=a;if(u in t){if(n.has(u))throw new Fb({type:u});r.push({...i,type:`tuple${c??""}`,components:cu(t[u]??[],t,new Set([...n,u]))})}else if(lu(u))r.push(i);else throw new Nb({type:u})}}return r}function uu(e){const t=Fi(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];cs(s)||n.push(Li(s,t))}return n}function fu(e){let t;if(typeof e=="string")t=Li(e);else{const n=Fi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!cs(s)){t=Li(s,n);break}}}if(!t)throw new Ab({signature:e});return t}function du(e){const t=[];if(typeof e=="string"){const n=at(e),r=n.length;for(let o=0;o<r;o++)t.push(rn(n[o],{modifiers:au}))}else{const n=Fi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(cs(s))continue;const i=at(s),l=i.length;for(let a=0;a<l;a++)t.push(rn(i[a],{modifiers:au,structs:n}))}}if(t.length===0)throw new Ob({params:e});return t}function ne(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function Ot(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new f1(e.type);return`${e.name}(${us(e.inputs,{includeName:t})})`}function us(e,{includeName:t=!1}={}){return e?e.map(n=>Jb(n,{includeName:t})).join(t?", ":","):""}function Jb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${us(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function It(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Pe(e){return It(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const pu="2.42.1";let Kr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${pu}`},V=class _c extends Error{constructor(t,n={}){var l;const r=(()=>{var a;return n.cause instanceof _c?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof _c&&n.cause.docsPath||n.docsPath,s=(l=Kr.getDocsUrl)==null?void 0:l.call(Kr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Kr.version?[`Version: ${Kr.version}`]:[]].join(`
|
|
52
|
+
`);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=pu}walk(t){return hu(this,t)}};function hu(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?hu(e.cause,t):t?null:e}class Qb 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 mu 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 bu 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: (${us(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 Zr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class e1 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 t1 extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Pe(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class n1 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 r1 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 gu 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 yu extends V{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
60
|
+
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class o1 extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class s1 extends V{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
61
|
+
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class vu 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 pr 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
|
|
64
|
-
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class
|
|
65
|
-
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class
|
|
66
|
-
`),{metaMessages:[`Params: (${us(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 Ri extends V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${
|
|
67
|
-
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class
|
|
68
|
-
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class
|
|
69
|
-
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let
|
|
70
|
-
`),{name:"InvalidArrayError"})}};class
|
|
71
|
-
`),{name:"InvalidDefinitionTypeError"})}}class u1 extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let xu=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"})}},Eu=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 Su 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 hr(e,{dir:t,size:n=32}={}){return typeof e=="string"?Pn(e,{dir:t,size:n}):f1(e,{dir:t,size:n})}function Pn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Eu({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function f1(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Eu({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 Pu=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"})}},d1=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 p1 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 h1=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function _n(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 It(e,{size:t}){if(Se(e)>t)throw new h1({givenSize:Se(e),maxSize:t})}function _t(e,t={}){const{signed:n}=t;t.size&&It(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 m1(e,t={}){let n=e;if(t.size&&(It(n,{size:t.size}),n=_n(n)),_n(n)==="0x00")return!1;if(_n(n)==="0x01")return!0;throw new p1(n)}function on(e,t={}){return Number(_t(e,t))}const b1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Tn(e,t={}){return typeof e=="number"||typeof e=="bigint"?ne(e,t):typeof e=="string"?Yr(e,t):typeof e=="boolean"?Tu(e,t):$e(e,t)}function Tu(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(It(n,{size:t.size}),hr(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=b1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(It(r,{size:t.size}),hr(r,{dir:"right",size:t.size})):r}function ne(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new Pu({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?hr(c,{size:r}):c}const g1=new TextEncoder;function Yr(e,t={}){const n=g1.encode(e);return $e(n,t)}const y1=new TextEncoder;function mr(e,t={}){return typeof e=="number"||typeof e=="bigint"?w1(e,t):typeof e=="boolean"?v1(e,t):Ot(e)?Wt(e,t):Wn(e,t)}function v1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(It(n,{size:t.size}),hr(n,{size:t.size})):n}const sn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Au(e){if(e>=sn.zero&&e<=sn.nine)return e-sn.zero;if(e>=sn.A&&e<=sn.F)return e-(sn.A-10);if(e>=sn.a&&e<=sn.f)return e-(sn.a-10)}function Wt(e,t={}){let n=e;t.size&&(It(n,{size:t.size}),n=hr(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=Au(r.charCodeAt(c++)),l=Au(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 w1(e,t){const n=ne(e,t);return Wt(n)}function Wn(e,t={}){const n=y1.encode(e);return typeof t.size=="number"?(It(n,{size:t.size}),hr(n,{dir:"right",size:t.size})):n}const ds=BigInt(2**32-1),Nu=BigInt(32);function x1(e,t=!1){return t?{h:Number(e&ds),l:Number(e>>Nu&ds)}:{h:Number(e>>Nu&ds)|0,l:Number(e&ds)|0}}function E1(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}=x1(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const S1=(e,t,n)=>e<<n|t>>>32-n,P1=(e,t,n)=>t<<n|e>>>32-n,T1=(e,t,n)=>t<<n-32|e>>>64-n,A1=(e,t,n)=>e<<n-32|t>>>64-n,br=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function N1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Xr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Vn(e,...t){if(!N1(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 C1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Xr(e.outputLen),Xr(e.blockLen)}function gr(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 Cu(e,t){Vn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function O1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function yr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ji(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Vt(e,t){return e<<32-t|e>>>t}const I1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function $1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function k1(e){for(let t=0;t<e.length;t++)e[t]=$1(e[t]);return e}const Ou=I1?e=>e:k1;function M1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ps(e){return typeof e=="string"&&(e=M1(e)),Vn(e),e}function D1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Vn(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 zi{}function Iu(e){const t=r=>e().update(ps(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function B1(e=32){if(br&&typeof br.getRandomValues=="function")return br.getRandomValues(new Uint8Array(e));if(br&&typeof br.randomBytes=="function")return Uint8Array.from(br.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const L1=BigInt(0),Jr=BigInt(1),F1=BigInt(2),R1=BigInt(7),j1=BigInt(256),z1=BigInt(113),$u=[],ku=[],Mu=[];for(let e=0,t=Jr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],$u.push(2*(5*r+n)),ku.push((e+1)*(e+2)/2%64);let o=L1;for(let s=0;s<7;s++)t=(t<<Jr^(t>>R1)*z1)%j1,t&F1&&(o^=Jr<<(Jr<<BigInt(s))-Jr);Mu.push(o)}const Du=E1(Mu,!0),U1=Du[0],_1=Du[1],Bu=(e,t,n)=>n>32?T1(e,t,n):S1(e,t,n),Lu=(e,t,n)=>n>32?A1(e,t,n):P1(e,t,n);function W1(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=Bu(l,u,1)^n[c],p=Lu(l,u,1)^n[c+1];for(let d=0;d<50;d+=10)e[i+d]^=f,e[i+d+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=ku[i],a=Bu(o,s,c),l=Lu(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]^=U1[r],e[1]^=_1[r]}yr(n)}class Ui extends zi{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,Xr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=O1(this.state)}clone(){return this._cloneInto()}keccak(){Ou(this.state32),W1(this.state32,this.rounds),Ou(this.state32),this.posOut=0,this.pos=0}update(t){gr(this),t=ps(t),Vn(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){gr(this,!1),Vn(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 Xr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Cu(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,yr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Ui(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 V1=(e,t,n)=>Iu(()=>new Ui(t,e,n)),Fu=V1(1,136,256/8);function Fe(e,t){const n=t||"hex",r=Fu(Ot(e,{strict:!1})?mr(e):e);return n==="bytes"?r:Tn(r)}const H1=e=>Fe(mr(e));function G1(e){return H1(e)}function q1(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 K1=e=>{const t=typeof e=="string"?e:cs(e);return q1(t)};function Ru(e){return G1(K1(e))}const hs=Ru;let An=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"})}},ms=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 ms(8192);function bs(e,t){if(_i.has(`${e}.${t}`))return _i.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Fe(Wn(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 Nn(e,t){if(!mt(e,{strict:!1}))throw new An({address:e});return bs(e,t)}const Z1=/^0x[a-fA-F0-9]{40}$/,Wi=new ms(8192);function mt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Wi.has(r))return Wi.get(r);const o=Z1.test(e)?e.toLowerCase()===e?!0:n?bs(e)===e:!0:!1;return Wi.set(r,o),o}function $t(e){return typeof e[0]=="string"?vr(e):Y1(e)}function Y1(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 vr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function wr(e,t,n,{strict:r}={}){return Ot(e,{strict:!1})?X1(e,t,n,{strict:r}):Uu(e,t,n,{strict:r})}function ju(e,t){if(typeof t=="number"&&t>0&&t>Se(e)-1)throw new xu({offset:t,position:"start",size:Se(e)})}function zu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Se(e)!==n-t)throw new xu({offset:n,position:"end",size:Se(e)})}function Uu(e,t,n,{strict:r}={}){ju(e,t);const o=e.slice(t,n);return r&&zu(o,t,n),o}function X1(e,t,n,{strict:r}={}){ju(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&zu(o,t,n),o}const J1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,_u=/^(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 Cn(e,t){if(e.length!==t.length)throw new e1({expectedLength:e.length,givenLength:t.length});const n=Q1({params:e,values:t}),r=Hi(n);return r.length===0?"0x":r}function Q1({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Vi({param:e[r],value:t[r]}));return n}function Vi({param:e,value:t}){const n=Gi(e.type);if(n){const[r,o]=n;return tg(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return ig(t,{param:e});if(e.type==="address")return eg(t);if(e.type==="bool")return rg(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=_u.exec(e.type)??[];return og(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return ng(t,{param:e});if(e.type==="string")return sg(t);throw new a1(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+=Se(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(ne(t+o,{size:32})),r.push(c),o+=Se(c)):n.push(c)}return $t([...n,...r])}function eg(e){if(!mt(e))throw new An({address:e});return{dynamic:!1,encoded:Pn(e.toLowerCase())}}function tg(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new wu(e);if(!r&&e.length!==t)throw new Jb({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=Vi({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=Hi(s);if(r){const c=ne(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 ng(e,{param:t}){const[,n]=t.type.split("bytes"),r=Se(e);if(!n){let o=e;return r%32!==0&&(o=Pn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:$t([Pn(ne(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new Qb({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Pn(e,{dir:"right"})}}function rg(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Pn(Tu(e))}}function og(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 Pu({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:ne(e,{size:32,signed:t})}}function sg(e){const t=Yr(e),n=Math.ceil(Se(t)/32),r=[];for(let o=0;o<n;o++)r.push(Pn(wr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:$t([Pn(ne(Se(t),{size:32})),...r])}}function ig(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,c=Vi({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Hi(r):$t(r.map(({encoded:o})=>o))}}function Gi(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Qr=e=>wr(Ru(e),0,4);function Hn(e){const{abi:t,args:n=[],name:r}=e,o=Ot(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Qr(c)===r:c.type==="event"?hs(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?qi(l,f):!1})){if(i&&"inputs"in i&&i.inputs){const l=Wu(c.inputs,i.inputs,n);if(l)throw new s1({abiItem:c,type:l[0]},{abiItem:i,type:l[1]})}i=c}}return i||s[0]}function qi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return mt(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)=>qi(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=>qi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Wu(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 Wu(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")?mt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?mt(n[r],{strict:!1}):!1)return i}}const Vu="/docs/contract/encodeEventTopics";function eo(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const l=Hn({abi:t,name:n});if(!l)throw new yu(n,{docsPath:Vu});o=l}if(o.type!=="event")throw new yu(void 0,{docsPath:Vu});const s=Ct(o),i=hs(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,p)=>Array.isArray(u[p])?u[p].map((d,h)=>Hu({param:f,value:u[p][h]})):typeof u[p]<"u"&&u[p]!==null?Hu({param:f,value:u[p]}):null))??[])}return[i,...c]}function Hu({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Fe(mr(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new u1(e.type);return Cn([e],[t])}function gs(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 Gu(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,l=gs(e,{method:"eth_newFilter"}),u=s?eo({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?ne(i):i,toBlock:typeof a=="bigint"?ne(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:l(f),strict:!!c,type:"event"}}function at(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const qu="/docs/contract/encodeFunctionData";function ag(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Hn({abi:t,args:n,name:r});if(!s)throw new pr(r,{docsPath:qu});o=s}if(o.type!=="function")throw new pr(void 0,{docsPath:qu});return{abi:[o],functionName:Qr(Ct(o))}}function kt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:ag(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Cn(o.inputs,t??[]):void 0;return vr([s,i??"0x"])}const cg={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."},Ku={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},lg={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let Zu=class extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},Yu=class extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},ug=class extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const fg={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 ug({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Yu({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Zu({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 Zu({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 Ki(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(fg);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function dg(e,t={}){typeof t.size<"u"&&It(e,{size:t.size});const n=$e(e,t);return _t(n,t)}function pg(e,t={}){let n=e;if(typeof t.size<"u"&&(It(n,{size:t.size}),n=_n(n)),n.length>1||n[0]>1)throw new d1(n);return!!n[0]}function an(e,t={}){typeof t.size<"u"&&It(e,{size:t.size});const n=$e(e,t);return on(n,t)}function hg(e,t={}){let n=e;return typeof t.size<"u"&&(It(n,{size:t.size}),n=_n(n,{dir:"right"})),new TextDecoder().decode(n)}function to(e,t){const n=typeof t=="string"?Wt(t):t,r=Ki(n);if(Se(n)===0&&e.length>0)throw new Zr;if(Se(t)&&Se(t)<32)throw new mu({data:typeof t=="string"?t:$e(t),params:e,size:Se(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,l]=xr(r,c,{staticPosition:0});o+=l,s.push(a)}return s}function xr(e,t,{staticPosition:n}){const r=Gi(t.type);if(r){const[o,s]=r;return bg(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return wg(e,t,{staticPosition:n});if(t.type==="address")return mg(e);if(t.type==="bool")return gg(e);if(t.type.startsWith("bytes"))return yg(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return vg(e,t);if(t.type==="string")return xg(e,{staticPosition:n});throw new c1(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Xu=32,Zi=32;function mg(e){const t=e.readBytes(32);return[bs($e(Uu(t,-20))),32]}function bg(e,t,{length:n,staticPosition:r}){if(!n){const i=an(e.readBytes(Zi)),c=r+i,a=c+Xu;e.setPosition(c);const l=an(e.readBytes(Xu)),u=no(t);let f=0;const p=[];for(let d=0;d<l;++d){e.setPosition(a+(u?d*32:f));const[h,m]=xr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(no(t)){const i=an(e.readBytes(Zi)),c=r+i,a=[];for(let l=0;l<n;++l){e.setPosition(c+l*32);const[u]=xr(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]=xr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function gg(e){return[pg(e.readBytes(32),{size:32}),32]}function yg(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=an(e.readBytes(32));e.setPosition(n+i);const c=an(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[$e(a),32]}return[$e(e.readBytes(Number.parseInt(o,10),32)),32]}function vg(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?dg(o,{signed:n}):an(o,{signed:n}),32]}function wg(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(no(t)){const i=an(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]=xr(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]=xr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=l}return[o,s]}function xg(e,{staticPosition:t}){const n=an(e.readBytes(32)),r=t+n;e.setPosition(r);const o=an(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=hg(_n(s));return e.setPosition(t+32),[i,32]}function no(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(no);const n=Gi(e.type);return!!(n&&no({...e,type:n[1]}))}function Ju(e){const{abi:t,data:n}=e,r=wr(n,0,4);if(r==="0x")throw new Zr;const s=[...t||[],Ku,lg].find(i=>i.type==="error"&&r===Qr(Ct(i)));if(!s)throw new gu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?to(s.inputs,wr(n,4)):void 0,errorName:s.name}}const ke=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Qu({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"?ke(t[s]):t[s]}`).join(", ")})`}const Eg={gwei:9,wei:18},Sg={ether:-9,wei:9};function Yi(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 Xi(e,t="wei"){return Yi(e,Eg[t])}function Ye(e,t="wei"){return Yi(e,Sg[t])}class Pg extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Tg extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function ef(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
72
|
-
`,"")}function
|
|
63
|
+
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class wu 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 i1 extends V{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
65
|
+
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class a1 extends V{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Ot(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Ot(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let l1=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class fs 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: (${us(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 Ri extends V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Ot(t,{includeName:!0})}".`].join(`
|
|
67
|
+
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class c1 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 u1 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 xu=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
70
|
+
`),{name:"InvalidArrayError"})}};class f1 extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
71
|
+
`),{name:"InvalidDefinitionTypeError"})}}class d1 extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Eu=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"})}},Su=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 Pu 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 hr(e,{dir:t,size:n=32}={}){return typeof e=="string"?Pn(e,{dir:t,size:n}):p1(e,{dir:t,size:n})}function Pn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Su({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function p1(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Su({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 Tu=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"})}},h1=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 m1 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 b1=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function _n(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 $t(e,{size:t}){if(Pe(e)>t)throw new b1({givenSize:Pe(e),maxSize:t})}function Wt(e,t={}){const{signed:n}=t;t.size&&$t(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 g1(e,t={}){let n=e;if(t.size&&($t(n,{size:t.size}),n=_n(n)),_n(n)==="0x00")return!1;if(_n(n)==="0x01")return!0;throw new m1(n)}function on(e,t={}){return Number(Wt(e,t))}const y1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Tn(e,t={}){return typeof e=="number"||typeof e=="bigint"?re(e,t):typeof e=="string"?Yr(e,t):typeof e=="boolean"?Au(e,t):$e(e,t)}function Au(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?($t(n,{size:t.size}),hr(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=y1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?($t(r,{size:t.size}),hr(r,{dir:"right",size:t.size})):r}function re(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new Tu({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const l=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?hr(l,{size:r}):l}const v1=new TextEncoder;function Yr(e,t={}){const n=v1.encode(e);return $e(n,t)}const w1=new TextEncoder;function mr(e,t={}){return typeof e=="number"||typeof e=="bigint"?E1(e,t):typeof e=="boolean"?x1(e,t):It(e)?Vt(e,t):Wn(e,t)}function x1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?($t(n,{size:t.size}),hr(n,{size:t.size})):n}const sn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Nu(e){if(e>=sn.zero&&e<=sn.nine)return e-sn.zero;if(e>=sn.A&&e<=sn.F)return e-(sn.A-10);if(e>=sn.a&&e<=sn.f)return e-(sn.a-10)}function Vt(e,t={}){let n=e;t.size&&($t(n,{size:t.size}),n=hr(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,l=0;i<o;i++){const a=Nu(r.charCodeAt(l++)),c=Nu(r.charCodeAt(l++));if(a===void 0||c===void 0)throw new V(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);s[i]=a*16+c}return s}function E1(e,t){const n=re(e,t);return Vt(n)}function Wn(e,t={}){const n=w1.encode(e);return typeof t.size=="number"?($t(n,{size:t.size}),hr(n,{dir:"right",size:t.size})):n}const ds=BigInt(2**32-1),Cu=BigInt(32);function S1(e,t=!1){return t?{h:Number(e&ds),l:Number(e>>Cu&ds)}:{h:Number(e>>Cu&ds)|0,l:Number(e&ds)|0}}function P1(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}=S1(e[s],t);[r[s],o[s]]=[i,l]}return[r,o]}const T1=(e,t,n)=>e<<n|t>>>32-n,A1=(e,t,n)=>t<<n|e>>>32-n,N1=(e,t,n)=>t<<n-32|e>>>64-n,C1=(e,t,n)=>e<<n-32|t>>>64-n,br=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function O1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Xr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Vn(e,...t){if(!O1(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 I1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Xr(e.outputLen),Xr(e.blockLen)}function gr(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 Ou(e,t){Vn(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 yr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ji(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ht(e,t){return e<<32-t|e>>>t}const k1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function M1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function D1(e){for(let t=0;t<e.length;t++)e[t]=M1(e[t]);return e}const Iu=k1?e=>e:D1;function B1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ps(e){return typeof e=="string"&&(e=B1(e)),Vn(e),e}function L1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Vn(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 zi{}function $u(e){const t=r=>e().update(ps(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function F1(e=32){if(br&&typeof br.getRandomValues=="function")return br.getRandomValues(new Uint8Array(e));if(br&&typeof br.randomBytes=="function")return Uint8Array.from(br.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const R1=BigInt(0),Jr=BigInt(1),j1=BigInt(2),z1=BigInt(7),U1=BigInt(256),_1=BigInt(113),ku=[],Mu=[],Du=[];for(let e=0,t=Jr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ku.push(2*(5*r+n)),Mu.push((e+1)*(e+2)/2%64);let o=R1;for(let s=0;s<7;s++)t=(t<<Jr^(t>>z1)*_1)%U1,t&j1&&(o^=Jr<<(Jr<<BigInt(s))-Jr);Du.push(o)}const Bu=P1(Du,!0),W1=Bu[0],V1=Bu[1],Lu=(e,t,n)=>n>32?N1(e,t,n):T1(e,t,n),Fu=(e,t,n)=>n>32?C1(e,t,n):A1(e,t,n);function H1(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const l=(i+8)%10,a=(i+2)%10,c=n[a],u=n[a+1],f=Lu(c,u,1)^n[l],p=Fu(c,u,1)^n[l+1];for(let d=0;d<50;d+=10)e[i+d]^=f,e[i+d+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const l=Mu[i],a=Lu(o,s,l),c=Fu(o,s,l),u=ku[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=c}for(let i=0;i<50;i+=10){for(let l=0;l<10;l++)n[l]=e[i+l];for(let l=0;l<10;l++)e[i+l]^=~n[(l+2)%10]&n[(l+4)%10]}e[0]^=W1[r],e[1]^=V1[r]}yr(n)}class Ui extends zi{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,Xr(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(){Iu(this.state32),H1(this.state32,this.rounds),Iu(this.state32),this.posOut=0,this.pos=0}update(t){gr(this),t=ps(t),Vn(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let l=0;l<i;l++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){gr(this,!1),Vn(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 Xr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ou(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,yr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Ui(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 G1=(e,t,n)=>$u(()=>new Ui(t,e,n)),Ru=G1(1,136,256/8);function Fe(e,t){const n=t||"hex",r=Ru(It(e,{strict:!1})?mr(e):e);return n==="bytes"?r:Tn(r)}const q1=e=>Fe(mr(e));function K1(e){return q1(e)}function Z1(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new V("Unable to normalize signature.");return o}const Y1=e=>{const t=typeof e=="string"?e:ls(e);return Z1(t)};function ju(e){return K1(Y1(e))}const hs=ju;let An=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"})}},ms=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 ms(8192);function bs(e,t){if(_i.has(`${e}.${t}`))return _i.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Fe(Wn(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 Nn(e,t){if(!bt(e,{strict:!1}))throw new An({address:e});return bs(e,t)}const X1=/^0x[a-fA-F0-9]{40}$/,Wi=new ms(8192);function bt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Wi.has(r))return Wi.get(r);const o=X1.test(e)?e.toLowerCase()===e?!0:n?bs(e)===e:!0:!1;return Wi.set(r,o),o}function kt(e){return typeof e[0]=="string"?vr(e):J1(e)}function J1(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 vr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function wr(e,t,n,{strict:r}={}){return It(e,{strict:!1})?Q1(e,t,n,{strict:r}):_u(e,t,n,{strict:r})}function zu(e,t){if(typeof t=="number"&&t>0&&t>Pe(e)-1)throw new Eu({offset:t,position:"start",size:Pe(e)})}function Uu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Pe(e)!==n-t)throw new Eu({offset:n,position:"end",size:Pe(e)})}function _u(e,t,n,{strict:r}={}){zu(e,t);const o=e.slice(t,n);return r&&Uu(o,t,n),o}function Q1(e,t,n,{strict:r}={}){zu(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Uu(o,t,n),o}const eg=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Wu=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Cn(e,t){if(e.length!==t.length)throw new n1({expectedLength:e.length,givenLength:t.length});const n=tg({params:e,values:t}),r=Hi(n);return r.length===0?"0x":r}function tg({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Vi({param:e[r],value:t[r]}));return n}function Vi({param:e,value:t}){const n=Gi(e.type);if(n){const[r,o]=n;return rg(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return lg(t,{param:e});if(e.type==="address")return ng(t);if(e.type==="bool")return sg(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=Wu.exec(e.type)??[];return ig(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return og(t,{param:e});if(e.type==="string")return ag(t);throw new c1(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Hi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=Pe(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(re(t+o,{size:32})),r.push(l),o+=Pe(l)):n.push(l)}return kt([...n,...r])}function ng(e){if(!bt(e))throw new An({address:e});return{dynamic:!1,encoded:Pn(e.toLowerCase())}}function rg(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new xu(e);if(!r&&e.length!==t)throw new e1({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const l=Vi({param:n,value:e[i]});l.dynamic&&(o=!0),s.push(l)}if(r||o){const i=Hi(s);if(r){const l=re(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?kt([l,i]):l}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:kt(s.map(({encoded:i})=>i))}}function og(e,{param:t}){const[,n]=t.type.split("bytes"),r=Pe(e);if(!n){let o=e;return r%32!==0&&(o=Pn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:kt([Pn(re(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new t1({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Pn(e,{dir:"right"})}}function sg(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Pn(Au(e))}}function ig(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 Tu({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:re(e,{size:32,signed:t})}}function ag(e){const t=Yr(e),n=Math.ceil(Pe(t)/32),r=[];for(let o=0;o<n;o++)r.push(Pn(wr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:kt([Pn(re(Pe(t),{size:32})),...r])}}function lg(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,l=Vi({param:s,value:e[i]});r.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Hi(r):kt(r.map(({encoded:o})=>o))}}function Gi(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Qr=e=>wr(ju(e),0,4);function Hn(e){const{abi:t,args:n=[],name:r}=e,o=It(r,{strict:!1}),s=t.filter(l=>o?l.type==="function"?Qr(l)===r:l.type==="event"?hs(l)===r:!1:"name"in l&&l.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const l of s){if(!("inputs"in l))continue;if(!n||n.length===0){if(!l.inputs||l.inputs.length===0)return l;continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==n.length)continue;if(n.every((c,u)=>{const f="inputs"in l&&l.inputs[u];return f?qi(c,f):!1})){if(i&&"inputs"in i&&i.inputs){const c=Vu(l.inputs,i.inputs,n);if(c)throw new a1({abiItem:l,type:c[0]},{abiItem:i,type:c[1]})}i=l}}return i||s[0]}function qi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return bt(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)=>qi(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=>qi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Vu(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 Vu(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")?bt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?bt(n[r],{strict:!1}):!1)return i}}const Hu="/docs/contract/encodeEventTopics";function eo(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const c=Hn({abi:t,name:n});if(!c)throw new vu(n,{docsPath:Hu});o=c}if(o.type!=="event")throw new vu(void 0,{docsPath:Hu});const s=Ot(o),i=hs(s);let l=[];if(r&&"inputs"in o){const c=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(c==null?void 0:c.map(f=>r[f.name]))??[]:[];u.length>0&&(l=(c==null?void 0:c.map((f,p)=>Array.isArray(u[p])?u[p].map((d,h)=>Gu({param:f,value:u[p][h]})):typeof u[p]<"u"&&u[p]!==null?Gu({param:f,value:u[p]}):null))??[])}return[i,...l]}function Gu({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Fe(mr(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new d1(e.type);return Cn([e],[t])}function gs(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:l,transport:a})=>{l==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function qu(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:l,toBlock:a}=t,c=gs(e,{method:"eth_newFilter"}),u=s?eo({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?re(i):i,toBlock:typeof a=="bigint"?re(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:c(f),strict:!!l,type:"event"}}function lt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const Ku="/docs/contract/encodeFunctionData";function cg(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Hn({abi:t,args:n,name:r});if(!s)throw new pr(r,{docsPath:Ku});o=s}if(o.type!=="function")throw new pr(void 0,{docsPath:Ku});return{abi:[o],functionName:Qr(Ot(o))}}function Mt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var l;return e.abi.length===1&&((l=e.functionName)!=null&&l.startsWith("0x"))?e:cg(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Cn(o.inputs,t??[]):void 0;return vr([s,i??"0x"])}const ug={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."},Zu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},fg={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let Yu=class extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},Xu=class extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},dg=class extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const pg={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 dg({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Xu({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Yu({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 Yu({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 Ki(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(pg);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function hg(e,t={}){typeof t.size<"u"&&$t(e,{size:t.size});const n=$e(e,t);return Wt(n,t)}function mg(e,t={}){let n=e;if(typeof t.size<"u"&&($t(n,{size:t.size}),n=_n(n)),n.length>1||n[0]>1)throw new h1(n);return!!n[0]}function an(e,t={}){typeof t.size<"u"&&$t(e,{size:t.size});const n=$e(e,t);return on(n,t)}function bg(e,t={}){let n=e;return typeof t.size<"u"&&($t(n,{size:t.size}),n=_n(n,{dir:"right"})),new TextDecoder().decode(n)}function to(e,t){const n=typeof t=="string"?Vt(t):t,r=Ki(n);if(Pe(n)===0&&e.length>0)throw new Zr;if(Pe(t)&&Pe(t)<32)throw new bu({data:typeof t=="string"?t:$e(t),params:e,size:Pe(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const l=e[i];r.setPosition(o);const[a,c]=xr(r,l,{staticPosition:0});o+=c,s.push(a)}return s}function xr(e,t,{staticPosition:n}){const r=Gi(t.type);if(r){const[o,s]=r;return yg(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return Eg(e,t,{staticPosition:n});if(t.type==="address")return gg(e);if(t.type==="bool")return vg(e);if(t.type.startsWith("bytes"))return wg(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return xg(e,t);if(t.type==="string")return Sg(e,{staticPosition:n});throw new u1(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Ju=32,Zi=32;function gg(e){const t=e.readBytes(32);return[bs($e(_u(t,-20))),32]}function yg(e,t,{length:n,staticPosition:r}){if(!n){const i=an(e.readBytes(Zi)),l=r+i,a=l+Ju;e.setPosition(l);const c=an(e.readBytes(Ju)),u=no(t);let f=0;const p=[];for(let d=0;d<c;++d){e.setPosition(a+(u?d*32:f));const[h,m]=xr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(no(t)){const i=an(e.readBytes(Zi)),l=r+i,a=[];for(let c=0;c<n;++c){e.setPosition(l+c*32);const[u]=xr(e,t,{staticPosition:l});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[l,a]=xr(e,t,{staticPosition:r+o});o+=a,s.push(l)}return[s,o]}function vg(e){return[mg(e.readBytes(32),{size:32}),32]}function wg(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=an(e.readBytes(32));e.setPosition(n+i);const l=an(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[$e(a),32]}return[$e(e.readBytes(Number.parseInt(o,10),32)),32]}function xg(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?hg(o,{signed:n}):an(o,{signed:n}),32]}function Eg(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(no(t)){const i=an(e.readBytes(Zi)),l=n+i;for(let a=0;a<t.components.length;++a){const c=t.components[a];e.setPosition(l+s);const[u,f]=xr(e,c,{staticPosition:l});s+=f,o[r?a:c==null?void 0:c.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const l=t.components[i],[a,c]=xr(e,l,{staticPosition:n});o[r?i:l==null?void 0:l.name]=a,s+=c}return[o,s]}function Sg(e,{staticPosition:t}){const n=an(e.readBytes(32)),r=t+n;e.setPosition(r);const o=an(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=bg(_n(s));return e.setPosition(t+32),[i,32]}function no(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(no);const n=Gi(e.type);return!!(n&&no({...e,type:n[1]}))}function Qu(e){const{abi:t,data:n}=e,r=wr(n,0,4);if(r==="0x")throw new Zr;const s=[...t||[],Zu,fg].find(i=>i.type==="error"&&r===Qr(Ot(i)));if(!s)throw new yu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?to(s.inputs,wr(n,4)):void 0,errorName:s.name}}const ke=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function ef({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"?ke(t[s]):t[s]}`).join(", ")})`}const Pg={gwei:9,wei:18},Tg={ether:-9,wei:9};function Yi(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 Xi(e,t="wei"){return Yi(e,Pg[t])}function Xe(e,t="wei"){return Yi(e,Tg[t])}class Ag extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Ng extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function tf(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
72
|
+
`,"")}function Cg(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+=
|
|
78
|
-
`,o+=
|
|
77
|
+
`,o+=tf(r.state)),r.stateDiff&&(o+=` stateDiff:
|
|
78
|
+
`,o+=tf(r.stateDiff)),o},` State Override:
|
|
79
79
|
`).slice(0,-1)}function ro(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
|
|
81
|
-
${
|
|
82
|
-
`):`The contract function "${r}" reverted.`,{cause:s,metaMessages:
|
|
83
|
-
`)})}}Object.defineProperty(
|
|
84
|
-
`)})}}Object.defineProperty(On,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class lo extends Xe{constructor(t){super(t,{code:lo.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class uo extends Xe{constructor(t){super(t,{code:uo.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class fo extends Xe{constructor(t){super(t,{code:fo.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Kn extends Xe{constructor(t,{method:n}={}){super(t,{code:Kn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Er extends Xe{constructor(t){super(t,{code:Er.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Er,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class po extends Xe{constructor(t){super(t,{code:po.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Sr extends ct{constructor(t){super(t,{code:Sr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Sr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class ho extends ct{constructor(t){super(t,{code:ho.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class mo extends ct{constructor(t,{method:n}={}){super(t,{code:mo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class bo extends ct{constructor(t){super(t,{code:bo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class go extends ct{constructor(t){super(t,{code:go.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class yo extends ct{constructor(t){super(t,{code:yo.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class vo extends ct{constructor(t){super(t,{code:vo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class wo extends ct{constructor(t){super(t,{code:wo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class xo extends ct{constructor(t){super(t,{code:xo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class Eo extends ct{constructor(t){super(t,{code:Eo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class So extends ct{constructor(t){super(t,{code:So.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(So,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Po extends ct{constructor(t){super(t,{code:Po.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Po,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class To extends ct{constructor(t){super(t,{code:To.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(To,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Bg extends Xe{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Lg=3;function Pr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof ys?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:l,details:u,message:f,shortMessage:p}=c,d=e instanceof Zr?new kg({functionName:s}):[Lg,qn.code].includes(a)&&(l||u||f||p)||a===On.code&&u==="execution reverted"&&l?new Ji({abi:t,data:typeof l=="object"?l.data:l,functionName:s,message:c instanceof Qi?u:p??f}):e;return new of(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function Fg(e){const t=Fe(`0x${e.substring(4)}`).substring(26);return bs(`0x${t}`)}async function Rg({hash:e,signature:t}){const n=Ot(e)?e:Tn(e),{secp256k1:r}=await Promise.resolve().then(()=>g6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:f,yParity:p}=t,d=Number(p??f),h=af(d);return new r.Signature(_t(l),_t(u)).addRecoveryBit(h)}const i=Ot(t)?t:Tn(t);if(Se(i)!==65)throw new Error("invalid signature length");const c=on(`0x${i.slice(130)}`),a=af(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function af(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 cf({hash:e,signature:t}){return Fg(await Rg({hash:e,signature:t}))}function jg(e,t="hex"){const n=lf(e),r=Ki(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function lf(e){return Array.isArray(e)?zg(e.map(t=>lf(t))):Ug(e)}function zg(e){const t=e.reduce((o,s)=>o+s.length,0),n=uf(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 Ug(e){const t=typeof e=="string"?Wt(e):e,n=uf(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 uf(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 _g(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Fe(vr(["0x05",jg([t?ne(t):"0x",o,n?ne(n):"0x"])]));return r==="bytes"?Wt(s):s}async function ff(e){const{authorization:t,signature:n}=e;return cf({hash:_g(t),signature:n??t})}class Wg 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:p}){var h;const d=ro({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Xi(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ye(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ye(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ye(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Tr 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(Tr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Tr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class vs extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ye(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(vs,"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 ea extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ye(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(ea,"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 ta 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(ta,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class na 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(`
|
|
80
|
+
`)}class Og extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",ro(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 Ig extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p}){var h;const d=ro({chain:o&&`${o==null?void 0:o.name} (id: ${o==null?void 0:o.id})`,from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Xi(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",d].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class nf 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 rf 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 kg extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Mg=e=>e,oo=e=>e;class of extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p,stateOverride:d}){var g;const h=n?lt(n):void 0;let m=ro({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${Xi(p)} ${((g=o==null?void 0:o.nativeCurrency)==null?void 0:g.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});d&&(m+=`
|
|
81
|
+
${Cg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class sf extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:l}){const a=Hn({abi:n,args:r,name:i}),c=a?ef({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?Ot(a,{includeName:!0}):void 0,f=ro({address:o&&Mg(o),function:u,args:c&&c!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${c}`,sender:l});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=l}}class Ji extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,l,a;if(n&&n!=="0x")try{i=Qu({abi:t,data:n});const{abiItem:u,errorName:f,args:p}=i;if(f==="Error")a=p[0];else if(f==="Panic"){const[d]=p;a=ug[d]}else{const d=u?Ot(u,{includeName:!0}):void 0,h=u&&p?ef({abiItem:u,args:p,includeFunctionName:!1,includeName:!1}):void 0;l=[d?`Error: ${d}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(u){s=u}else o&&(a=o);let c;s instanceof yu&&(c=s.signature,l=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(a&&a!=="execution reverted"||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,a||c].join(`
|
|
82
|
+
`):`The contract function "${r}" reverted.`,{cause:s,metaMessages:l,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.raw=n,this.reason=a,this.signature=c}}class Dg 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 Bg 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 ys 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 Gn 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: ${oo(i)}`,t&&`Request body: ${ke(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: ${oo(r)}`,`Request body: ${ke(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 af extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${oo(n)}`,`Request body: ${ke(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const Lg=-1;class Je 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??Lg}}class ct extends Je{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class so extends Je{constructor(t){super(t,{code:so.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class io extends Je{constructor(t){super(t,{code:io.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ao extends Je{constructor(t,{method:n}={}){super(t,{code:ao.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class lo extends Je{constructor(t){super(t,{code:lo.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
83
|
+
`)})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class qn extends Je{constructor(t){super(t,{code:qn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(qn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class On extends Je{constructor(t){super(t,{code:On.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
84
|
+
`)})}}Object.defineProperty(On,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class co extends Je{constructor(t){super(t,{code:co.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class uo extends Je{constructor(t){super(t,{code:uo.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class fo extends Je{constructor(t){super(t,{code:fo.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Kn extends Je{constructor(t,{method:n}={}){super(t,{code:Kn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Er extends Je{constructor(t){super(t,{code:Er.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Er,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class po extends Je{constructor(t){super(t,{code:po.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Sr extends ct{constructor(t){super(t,{code:Sr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Sr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class ho extends ct{constructor(t){super(t,{code:ho.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class mo extends ct{constructor(t,{method:n}={}){super(t,{code:mo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class bo extends ct{constructor(t){super(t,{code:bo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class go extends ct{constructor(t){super(t,{code:go.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class yo extends ct{constructor(t){super(t,{code:yo.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class vo extends ct{constructor(t){super(t,{code:vo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class wo extends ct{constructor(t){super(t,{code:wo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class xo extends ct{constructor(t){super(t,{code:xo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class Eo extends ct{constructor(t){super(t,{code:Eo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class So extends ct{constructor(t){super(t,{code:So.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(So,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Po extends ct{constructor(t){super(t,{code:Po.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Po,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class To extends ct{constructor(t){super(t,{code:To.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(To,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Fg extends Je{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Rg=3;function Pr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const l=e instanceof ys?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:c,details:u,message:f,shortMessage:p}=l,d=e instanceof Zr?new Dg({functionName:s}):[Rg,qn.code].includes(a)&&(c||u||f||p)||a===On.code&&u==="execution reverted"&&c?new Ji({abi:t,data:typeof c=="object"?c.data:c,functionName:s,message:l instanceof Qi?u:p??f}):e;return new sf(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function jg(e){const t=Fe(`0x${e.substring(4)}`).substring(26);return bs(`0x${t}`)}async function zg({hash:e,signature:t}){const n=It(e)?e:Tn(e),{secp256k1:r}=await Promise.resolve().then(()=>v6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:c,s:u,v:f,yParity:p}=t,d=Number(p??f),h=lf(d);return new r.Signature(Wt(c),Wt(u)).addRecoveryBit(h)}const i=It(t)?t:Tn(t);if(Pe(i)!==65)throw new Error("invalid signature length");const l=on(`0x${i.slice(130)}`),a=lf(l);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function lf(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 cf({hash:e,signature:t}){return jg(await zg({hash:e,signature:t}))}function Ug(e,t="hex"){const n=uf(e),r=Ki(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function uf(e){return Array.isArray(e)?_g(e.map(t=>uf(t))):Wg(e)}function _g(e){const t=e.reduce((o,s)=>o+s.length,0),n=ff(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 Wg(e){const t=typeof e=="string"?Vt(e):e,n=ff(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 ff(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 Vg(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Fe(vr(["0x05",Ug([t?re(t):"0x",o,n?re(n):"0x"])]));return r==="bytes"?Vt(s):s}async function df(e){const{authorization:t,signature:n}=e;return cf({hash:Vg(t),signature:n??t})}class Hg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p}){var h;const d=ro({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Xi(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Tr 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(Tr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Tr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class vs extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(vs,"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 ea extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(ea,"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 ta 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(ta,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class na 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
85
|
`),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(na,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class ra 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(ra,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class oa 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(oa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class sa 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(sa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class ia 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(ia,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class aa extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(aa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class ws extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${
|
|
87
|
-
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(ws,"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 Ao extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function xs(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===Tr.code):e;return r instanceof V?new Tr({cause:e,message:r.details}):Tr.nodeMessage.test(n)?new Tr({cause:e,message:e.details}):vs.nodeMessage.test(n)?new vs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):ea.nodeMessage.test(n)?new ea({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):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,nonce:t==null?void 0:t.nonce}):oa.nodeMessage.test(n)?new oa({cause:e}):sa.nodeMessage.test(n)?new sa({cause:e,gas:t==null?void 0:t.gas}):ia.nodeMessage.test(n)?new ia({cause:e,gas:t==null?void 0:t.gas}):aa.nodeMessage.test(n)?new aa({cause:e}):ws.nodeMessage.test(n)?new ws({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Ao({cause:e})}function Vg(e,{docsPath:t,...n}){const r=(()=>{const o=xs(e,n);return o instanceof Ao?e:o})();return new Wg(r,{docsPath:t,...n})}function Es(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 Hg={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function No(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Gg(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=>$e(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=ne(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=ne(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=ne(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=ne(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=ne(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=ne(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Hg[e.type]),typeof e.value<"u"&&(n.value=ne(e.value)),n}function Gg(e){return e.map(t=>({address:t.address,r:t.r?ne(BigInt(t.r)):t.r,s:t.s?ne(BigInt(t.s)):t.s,chainId:ne(t.chainId),nonce:ne(t.nonce),...typeof t.yParity<"u"?{yParity:ne(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:ne(t.v)}:{}}))}function df(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Su({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Su({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function qg(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=ne(t)),n!==void 0&&(i.nonce=ne(n)),r!==void 0&&(i.state=df(r)),o!==void 0){if(i.state)throw new Tg;i.stateDiff=df(o)}return i}function ca(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!mt(n,{strict:!1}))throw new An({address:n});if(t[n])throw new Pg({address:n});t[n]=qg(r)}return t}const pf=2n**256n-1n;function Ar(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?at(t):void 0;if(s&&!mt(s.address))throw new An({address:s.address});if(o&&!mt(o))throw new An({address:o});if(n&&n>pf)throw new vs({maxFeePerGas:n});if(r&&n&&r>n)throw new ws({maxFeePerGas:n,maxPriorityFeePerGas:r})}class hf extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class la extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Kg extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Ye(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class mf 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 bf={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function ua(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?on(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?on(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?bf[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=Zg(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 Zg(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 gf(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:ua(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 Mt(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?ne(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 mf({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)||gf)(c,"getBlock")}async function fa(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Yg(e,t){return yf(e,t)}async function yf(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 te(e,Mt,"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 _t(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):te(e,Mt,"getBlock")({}),te(e,fa,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new la;const l=a-c.baseFeePerGas;return l<0n?0n:l}}async function Xg(e,t){return da(e,t)}async function da(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new hf;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),l=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await te(e,Mt,"getBlock")({});if(typeof((d=r==null?void 0:r.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:l,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new la;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await yf(e,{block:u,chain:r,request:o}),m=l(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??l(await te(e,fa,"getGasPrice")({}))}}async function vf(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?ne(r):n]},{dedupe:!!r});return on(o)}function wf(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>Wt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>$e(s))}function xf(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>Wt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>Wt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>$e(i))}function Jg(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 Qg(e,t,n){return e&t^~e&n}function ey(e,t,n){return e&t^e&n^t&n}class ty extends zi{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=ji(this.buffer)}update(t){gr(this),t=ps(t),Vn(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=ji(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){gr(this),Cu(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,yr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;Jg(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=ji(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 In=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ny=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]),$n=new Uint32Array(64);class ry extends ty{constructor(t=32){super(64,t,8,!1),this.A=In[0]|0,this.B=In[1]|0,this.C=In[2]|0,this.D=In[3]|0,this.E=In[4]|0,this.F=In[5]|0,this.G=In[6]|0,this.H=In[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)$n[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=$n[f-15],d=$n[f-2],h=Vt(p,7)^Vt(p,18)^p>>>3,m=Vt(d,17)^Vt(d,19)^d>>>10;$n[f]=m+$n[f-7]+h+$n[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 p=Vt(c,6)^Vt(c,11)^Vt(c,25),d=u+p+Qg(c,a,l)+ny[f]+$n[f]|0,m=(Vt(r,2)^Vt(r,13)^Vt(r,22))+ey(r,o,s)|0;u=l,l=a,a=c,c=i+d|0,i=s,s=o,o=r,r=d+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,o,s,i,c,a,l,u)}roundClean(){yr($n)}destroy(){this.set(0,0,0,0,0,0,0,0),yr(this.buffer)}}const Ef=Iu(()=>new ry),oy=Ef;function sy(e,t){return oy(Ot(e,{strict:!1})?mr(e):e)}function iy(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=sy(t);return o.set([n],0),r==="bytes"?o:$e(o)}function ay(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(iy({commitment:s,to:r,version:n}));return o}const Sf=6,Pf=32,pa=4096,Tf=Pf*pa,Af=Tf*Sf-1-1*pa*Sf;class cy extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class ly extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function uy(e){const t=typeof e.data=="string"?Wt(e.data):e.data,n=Se(t);if(!n)throw new ly;if(n>Af)throw new cy({maxSize:Af,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Ki(new Uint8Array(Tf));let c=0;for(;c<pa;){const a=t.slice(s,s+(Pf-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=>$e(i.bytes))}function fy(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??uy({data:t}),s=e.commitments??wf({blobs:o,kzg:n,to:r}),i=e.proofs??xf({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 dy(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 Ng({transaction:e})}function py(e,{docsPath:t,...n}){const r=(()=>{const o=xs(e,n);return o instanceof Ao?e:o})();return new Cg(r,{docsPath:t,...n})}async function ha(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return on(t)}async function Nf(e,t){var b,y,E,T,I;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:p,maxPriorityFeePerGas:d,nonce:h,nonceManager:m,to:g,type:N,value:x,...P}=t,C=await(async()=>{if(!n||!m||typeof h<"u")return h;const $=at(n),D=s?s.id:await te(e,ha,"getChainId")({});return await m.consume({address:$.address,chainId:D,client:e})})();Ar(t);const M=(y=(b=s==null?void 0:s.formatters)==null?void 0:b.transactionRequest)==null?void 0:y.format,F=(M||No)({...Es(P,{format:M}),account:n?at(n):void 0,accessList:r,authorizationList:o,blobs:c,blobVersionedHashes:i,data:a,gas:l,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:C,to:g,type:N,value:x},"fillTransaction");try{const $=await e.request({method:"eth_fillTransaction",params:[F]}),w=(((T=(E=s==null?void 0:s.formatters)==null?void 0:E.transaction)==null?void 0:T.format)||ua)($.tx);delete w.blockHash,delete w.blockNumber,delete w.r,delete w.s,delete w.transactionIndex,delete w.v,delete w.yParity,w.data=w.input,w.gas&&(w.gas=t.gas??w.gas),w.gasPrice&&(w.gasPrice=t.gasPrice??w.gasPrice),w.maxFeePerBlobGas&&(w.maxFeePerBlobGas=t.maxFeePerBlobGas??w.maxFeePerBlobGas),w.maxFeePerGas&&(w.maxFeePerGas=t.maxFeePerGas??w.maxFeePerGas),w.maxPriorityFeePerGas&&(w.maxPriorityFeePerGas=t.maxPriorityFeePerGas??w.maxPriorityFeePerGas),w.nonce&&(w.nonce=t.nonce??w.nonce);const O=await(async()=>{var j,U;if(typeof((j=s==null?void 0:s.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const _=await te(e,Mt,"getBlock")({});return s.fees.baseFeeMultiplier({block:_,client:e,request:t})}return((U=s==null?void 0:s.fees)==null?void 0:U.baseFeeMultiplier)??1.2})();if(O<1)throw new hf;const S=10**(((I=O.toString().split(".")[1])==null?void 0:I.length)??0),B=j=>j*BigInt(Math.ceil(O*S))/BigInt(S);return w.maxFeePerGas&&!t.maxFeePerGas&&(w.maxFeePerGas=B(w.maxFeePerGas)),w.gasPrice&&!t.gasPrice&&(w.gasPrice=B(w.gasPrice)),{raw:$.raw,transaction:{from:F.from,...w}}}catch($){throw py($,{...t,chain:e.chain})}}const hy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Cf=new Map,ma=new ms(128);async function Of(e,t){var C,M,L;let n=t;const{account:r=e.account,chain:o=e.chain,nonceManager:s,parameters:i=hy}=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 te(e,ha,"getChainId")({}),a))}const u=r&&at(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=c.runAt)!=null&&C.includes("beforeFillTransaction"))&&(n=await c.fn(n,{phase:"beforeFillTransaction"}),f??(f=n.nonce));const d=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||ma.get(e.uid)===!1||!["fees","gas"].some(b=>i.includes(b))?!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 te(e,Nf,"fillTransaction")({...n,nonce:f}).then(F=>{const{chainId:b,from:y,gas:E,gasPrice:T,nonce:I,maxFeePerBlobGas:$,maxFeePerGas:D,maxPriorityFeePerGas:w,type:O,...k}=F.transaction;return ma.set(e.uid,!0),{...n,...y?{from:y}:{},...O?{type:O}:{},...typeof b<"u"?{chainId:b}:{},...typeof E<"u"?{gas:E}:{},...typeof T<"u"?{gasPrice:T}:{},...typeof I<"u"?{nonce:I}:{},...typeof $<"u"?{maxFeePerBlobGas:$}:{},...typeof D<"u"?{maxFeePerGas:D}:{},...typeof w<"u"?{maxPriorityFeePerGas:w}:{},..."nonceKey"in k&&typeof k.nonceKey<"u"?{nonceKey:k.nonceKey}:{}}}).catch(F=>{var E;const b=F;return((E=b.walk)==null?void 0:E.call(b,T=>{const I=T;return I.name==="MethodNotFoundRpcError"||I.name==="MethodNotSupportedRpcError"}))&&ma.set(e.uid,!1),n}):n;f??(f=d.nonce),n={...d,...u?{from:u==null?void 0:u.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:m,kzg:g,type:N}=n;c!=null&&c.fn&&((M=c.runAt)!=null&&M.includes("beforeFillParameters"))&&(n=await c.fn(n,{phase:"beforeFillParameters"}));let x;async function P(){return x||(x=await te(e,Mt,"getBlock")({blockTag:"latest"}),x)}if(i.includes("nonce")&&typeof f>"u"&&u&&!s&&(n.nonce=await te(e,vf,"getTransactionCount")({address:u.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&g){const F=wf({blobs:h,kzg:g});if(i.includes("blobVersionedHashes")){const b=ay({commitments:F,to:"hex"});n.blobVersionedHashes=b}if(i.includes("sidecars")){const b=xf({blobs:h,commitments:F,kzg:g}),y=fy({blobs:h,commitments:F,proofs:b,to:"hex"});n.sidecars=y}}if(i.includes("chainId")&&(n.chainId=await l()),(i.includes("fees")||i.includes("type"))&&typeof N>"u")try{n.type=dy(n)}catch{let F=Cf.get(e.uid);if(typeof F>"u"){const b=await P();F=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",Cf.set(e.uid,F)}n.type=F?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const F=await P(),{maxFeePerGas:b,maxPriorityFeePerGas:y}=await da(e,{block:F,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<y)throw new Kg({maxPriorityFeePerGas:y});n.maxPriorityFeePerGas=y,n.maxFeePerGas=b}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new la;if(typeof n.gasPrice>"u"){const F=await P(),{gasPrice:b}=await da(e,{block:F,chain:o,request:n,type:"legacy"});n.gasPrice=b}}return i.includes("gas")&&typeof m>"u"&&(n.gas=await te(e,ba,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),c!=null&&c.fn&&((L=c.runAt)!=null&&L.includes("afterFillParameters"))&&(n=await c.fn(n,{phase:"afterFillParameters"})),Ar(n),delete n.parameters,n}async function ba(e,t){var i,c,a;const{account:n=e.account,prepare:r=!0}=t,o=n?at(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 ff({authorization:t.authorizationList[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,blockNumber:h,blockTag:m,data:g,gas:N,gasPrice:x,maxFeePerBlobGas:P,maxFeePerGas:C,maxPriorityFeePerGas:M,nonce:L,value:F,stateOverride:b,...y}=r?await Of(e,{...t,parameters:s,to:l}):t;if(N&&t.gas!==N)return N;const T=(typeof h=="bigint"?ne(h):void 0)||m,I=ca(b);Ar(t);const $=(a=(c=(i=e.chain)==null?void 0:i.formatters)==null?void 0:c.transactionRequest)==null?void 0:a.format,w=($||No)({...Es(y,{format:$}),account:o,accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,data:g,gasPrice:x,maxFeePerBlobGas:P,maxFeePerGas:C,maxPriorityFeePerGas:M,nonce:L,to:l,value:F},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:I?[w,T??e.experimental_blockTag??"latest",I]:T?[w,T]:[w]}))}catch(l){throw Vg(l,{...t,account:o,chain:e.chain})}}async function my(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=kt({abi:n,args:o,functionName:s});try{return await te(e,ba,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(l){const u=c.account?at(c.account):void 0;throw Pr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:u==null?void 0:u.address})}}function Co(e,t){if(!mt(e,{strict:!1}))throw new An({address:e});if(!mt(t,{strict:!1}))throw new An({address:t});return e.toLowerCase()===t.toLowerCase()}const If="/docs/contract/decodeEventLog";function Ss(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new n1({docsPath:If});const a=t.find(m=>m.type==="event"&&i===hs(Ct(m)));if(!(a&&"name"in a)||a.type!=="event")throw new r1(i,{docsPath:If});const{name:l,inputs:u}=a,f=u==null?void 0:u.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=u.map((m,g)=>[m,g]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[g,N]=d[m],x=c[m];if(!x)throw new Ri({abiItem:a,param:g});p[f?N:g.name||N]=by({param:g,value:x})}const h=u.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=to(h,n);if(m)if(f)for(let g=0;g<u.length;g++)p[g]=p[g]??m.shift();else for(let g=0;g<h.length;g++)p[h[g].name]=m[g]}catch(m){if(s)throw m instanceof mu||m instanceof Yu?new fs({abiItem:a,data:n,params:h,size:Se(n)}):m}else if(s)throw new fs({abiItem:a,data:"0x",params:h,size:0})}return{eventName:l,args:Object.values(p).length>0?p:void 0}}function by({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(to([e],t)||[])[0]}function ga(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var u;const c=t.filter(f=>f.type==="event"&&i.topics[0]===hs(f));if(c.length===0)return null;let a,l;for(const f of c)try{a=Ss({...i,abi:[f],strict:!0}),l=f;break}catch{}if(!a&&!o){l=c[0];try{a=Ss({...i,abi:[l],strict:!1})}catch{const f=(u=l.inputs)==null?void 0:u.some(p=>!("name"in p&&p.name));return{...i,args:f?[]:{},eventName:l.name}}}return!a||!l||s&&!s.includes(a.eventName)||!gy({args:a.args,inputs:l.inputs,matchArgs:n})?null:{...a,...i}}).filter(Boolean)}function gy(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"?Co(i,c):s.type==="string"||s.type==="bytes"?Fe(mr(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}function cn(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}:{}}}async function ya(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(m=>eo({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?ne(r):r,toBlock:typeof o=="bigint"?ne(o):o}]});const d=p.map(h=>cn(h));return u?ga({abi:u,args:c,logs:d,strict:l}):d}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?Hn({abi:n,name:i}):void 0,f=u?void 0:n.filter(p=>p.type==="event");return te(e,ya,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:c,toBlock:a,strict:l})}const va="/docs/contract/decodeFunctionResult";function Zn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Hn({abi:t,args:n,name:r});if(!c)throw new pr(r,{docsPath:va});s=c}if(s.type!=="function")throw new pr(void 0,{docsPath:va});if(!s.outputs)throw new vu(s.name,{docsPath:va});const i=to(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 wa=BigInt(0),xa=BigInt(1);function Oo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ea(e){if(!Oo(e))throw new Error("Uint8Array expected")}function Io(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function Ps(e){const t=e.toString(16);return t.length&1?"0"+t:t}function kf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?wa:BigInt("0x"+e)}const Mf=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",yy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function $o(e){if(Ea(e),Mf)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=yy[e[n]];return t}const ln={_0:48,_9:57,A:65,F:70,a:97,f:102};function Df(e){if(e>=ln._0&&e<=ln._9)return e-ln._0;if(e>=ln.A&&e<=ln.F)return e-(ln.A-10);if(e>=ln.a&&e<=ln.f)return e-(ln.a-10)}function Ts(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Mf)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=Df(e.charCodeAt(s)),c=Df(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 Yn(e){return kf($o(e))}function Bf(e){return Ea(e),kf($o(Uint8Array.from(e).reverse()))}function ko(e,t){return Ts(e.toString(16).padStart(t*2,"0"))}function Lf(e,t){return ko(e,t).reverse()}function bt(e,t,n){let r;if(typeof t=="string")try{r=Ts(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Oo(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 As(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Ea(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 Sa=e=>typeof e=="bigint"&&wa<=e;function Pa(e,t,n){return Sa(e)&&Sa(t)&&Sa(n)&&t<=e&&e<n}function Nr(e,t,n,r){if(!Pa(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function vy(e){let t;for(t=0;e>wa;e>>=xa,t+=1);return t}const Ns=e=>(xa<<BigInt(e))-xa,Ta=e=>new Uint8Array(e),Ff=e=>Uint8Array.from(e);function wy(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=Ta(e),o=Ta(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},c=(...f)=>n(o,r,...f),a=(f=Ta(0))=>{o=c(Ff([0]),f),r=c(),f.length!==0&&(o=c(Ff([1]),f),r=c())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const p=[];for(;f<t;){r=c();const d=r.slice();p.push(d),f+=r.length}return As(...p)};return(f,p)=>{i(),a(f);let d;for(;!(d=p(l()));)a();return i(),d}}const xy={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"||Oo(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 Cs(e,t,n={}){const r=(o,s,i)=>{const c=xy[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 Rf(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 Ey="0.1.1";function Sy(){return Ey}class ue extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof ue){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof ue&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
|
|
88
|
-
`);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Sy()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return jf(this,t)}}function jf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?jf(e.cause,t):t?null:e}function Mo(e,t){if(Cr(e)>t)throw new zy({givenSize:Cr(e),maxSize:t})}const un={zero:48,nine:57,A:65,F:70,a:97,f:102};function zf(e){if(e>=un.zero&&e<=un.nine)return e-un.zero;if(e>=un.A&&e<=un.F)return e-(un.A-10);if(e>=un.a&&e<=un.f)return e-(un.a-10)}function Py(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Uy({size:e.length,targetSize:r,type:"Bytes"});const o=new Uint8Array(r);for(let s=0;s<r;s++){const i=n==="right";o[i?s:r-s-1]=e[i?s:e.length-s-1]}return o}function Uf(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 Os(e,t){if(lt(e)>t)throw new qy({givenSize:lt(e),maxSize:t})}function Ty(e,t){if(typeof t=="number"&&t>0&&t>lt(e)-1)throw new Jf({offset:t,position:"start",size:lt(e)})}function Ay(e,t,n){if(typeof t=="number"&&typeof n=="number"&<(e)!==n-t)throw new Jf({offset:n,position:"end",size:lt(e)})}function _f(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 Ky({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Ny="#__bigint";function Wf(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+Ny:o,n)}const Cy=new TextDecoder,Oy=new TextEncoder;function Iy(e){return e instanceof Uint8Array?e:typeof e=="string"?Vf(e):$y(e)}function $y(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Vf(e,t={}){const{size:n}=t;let r=e;n&&(Os(e,n),r=Jn(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=zf(o.charCodeAt(a++)),u=zf(o.charCodeAt(a++));if(l===void 0||u===void 0)throw new ue(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=l*16+u}return i}function ky(e,t={}){const{size:n}=t,r=Oy.encode(e);return typeof n=="number"?(Mo(r,n),My(r,n)):r}function My(e,t){return Py(e,{dir:"right",size:t})}function Cr(e){return e.length}function Dy(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function By(e,t={}){const{size:n}=t;typeof n<"u"&&Mo(e,n);const r=Bt(e,t);return qf(r,t)}function Ly(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Mo(r,n),r=Hf(r)),r.length>1||r[0]>1)throw new jy(r);return!!r[0]}function fn(e,t={}){const{size:n}=t;typeof n<"u"&&Mo(e,n);const r=Bt(e,t);return Kf(r,t)}function Fy(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Mo(r,n),r=Ry(r)),Cy.decode(r)}function Hf(e){return Uf(e,{dir:"left"})}function Ry(e){return Uf(e,{dir:"right"})}class jy extends ue{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let zy=class extends ue{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Uy=class extends ue{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const _y=new TextEncoder,Wy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Vy(e,t={}){const{strict:n=!1}=t;if(!e)throw new Yf(e);if(typeof e!="string")throw new Yf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Xf(e);if(!e.startsWith("0x"))throw new Xf(e)}function Dt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Hy(e){return e instanceof Uint8Array?Bt(e):Array.isArray(e)?Bt(new Uint8Array(e)):e}function Gf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Os(n,t.size),Xn(n,t.size)):n}function Bt(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Wy[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Os(r,t.size),Jn(r,t.size)):r}function _e(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 Zf({max:s?`${s}${l}`:void 0,min:`${i}${l}`,signed:n,size:r,value:`${e}${l}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Xn(a,r):a}function Aa(e,t={}){return Bt(_y.encode(e),t)}function Xn(e,t){return _f(e,{dir:"left",size:t})}function Jn(e,t){return _f(e,{dir:"right",size:t})}function Ht(e,t,n,r={}){const{strict:o}=r;Ty(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&Ay(s,t,n),s}function lt(e){return Math.ceil((e.length-2)/2)}function qf(e,t={}){const{signed:n}=t;t.size&&Os(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 Kf(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:qf(e,t))}function Gy(e,t={}){const{strict:n=!1}=t;try{return Vy(e,{strict:n}),!0}catch{return!1}}class Zf extends ue{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class Yf extends ue{constructor(t){super(`Value \`${typeof t=="object"?Wf(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class Xf extends ue{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 qy extends ue{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 Jf extends ue{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 Ky extends ue{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function Zy(e){return{address:e.address,amount:_e(e.amount),index:_e(e.index),validatorIndex:_e(e.validatorIndex)}}function Qf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:_e(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:_e(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:_e(e.gasLimit)},...typeof e.number=="bigint"&&{number:_e(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:_e(e.prevRandao)},...typeof e.time=="bigint"&&{time:_e(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Zy)}}}const Is=[{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:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],Na=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],ed=[{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"}],td=[...ed,{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"}]}],Yy=[...ed,{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"}]}],nd=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],rd=[{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"}]}],od=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],sd=[{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"}],Or=[{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"}]}],Xy="0x82ad56cb",id="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Jy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Qy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Ca="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class Oa 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 ad extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const Ia="/docs/contract/encodeDeployData";function $a(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Xb({docsPath:Ia});if(!("inputs"in o))throw new hu({docsPath:Ia});if(!o.inputs||o.inputs.length===0)throw new hu({docsPath:Ia});const s=Cn(o.inputs,n);return vr([r,s])}function Ir({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 Oa({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Oa({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function cd(e,{docsPath:t,...n}){const r=(()=>{const o=xs(e,n);return o instanceof Ao?e:o})();return new rf(r,{docsPath:t,...n})}function ld(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const ka=new Map;function ud({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const u=a();i();const f=u.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<u.length;d++){const{resolve:h}=u[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<u.length;d++){const{reject:h}=u[d];h==null||h(p)}})},i=()=>ka.delete(t),c=()=>a().map(({args:u})=>u),a=()=>ka.get(t)||[],l=u=>ka.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:p,reject:d}=ld();return(n==null?void 0:n([...c(),u]))&&s(),a().length>0?(l({args:u,resolve:p,reject:d}),f):(l({args:u,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Do(e,t){var $,D,w,O;const{account:n=e.account,authorizationList:r,batch:o=!!(($=e.batch)!=null&&$.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:l,code:u,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:N,maxPriorityFeePerGas:x,nonce:P,to:C,value:M,stateOverride:L,...F}=t,b=n?at(n):void 0;if(u&&(p||d))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&C)throw new V("Cannot provide both `code` & `to` as parameters.");const y=u&&f,E=p&&d&&C&&f,T=y||E,I=y?fd({code:u,data:f}):E?nv({data:f,factory:p,factoryData:d,to:C}):f;try{Ar(t);const S=(typeof s=="bigint"?ne(s):void 0)||i,B=l?Qf(l):void 0,j=ca(L),U=(O=(w=(D=e.chain)==null?void 0:D.formatters)==null?void 0:w.transactionRequest)==null?void 0:O.format,G=(U||No)({...Es(F,{format:U}),accessList:c,account:b,authorizationList:r,blobs:a,data:I,gas:h,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:N,maxPriorityFeePerGas:x,nonce:P,to:T?void 0:C,value:M},"call");if(o&&ev({request:G})&&!j&&!B)try{return await tv(e,{...G,blockNumber:s,blockTag:i})}catch(W){if(!(W instanceof ad)&&!(W instanceof Oa))throw W}const Q=(()=>{const W=[G,S];return j&&B?[...W,j,B]:j?[...W,j]:B?[...W,{},B]:W})(),q=await e.request({method:"eth_call",params:Q});return q==="0x"?{data:void 0}:{data:q}}catch(k){const S=rv(k),{offchainLookup:B,offchainLookupSignature:j}=await Promise.resolve().then(()=>tw);if(e.ccipRead!==!1&&(S==null?void 0:S.slice(0,10))===j&&C)return{data:await B(e,{data:S,to:C})};throw T&&(S==null?void 0:S.slice(0,10))==="0x101bb98d"?new Mg({factory:p}):cd(k,{...t,account:b,chain:e.chain})}}function ev({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Xy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function tv(e,t){var m;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:c,to:a}=t,l=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Ir({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new ad})(),f=(typeof s=="bigint"?ne(s):void 0)||i,{schedule:p}=ud({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(g){return g.reduce((x,{data:P})=>x+(P.length-2),0)>n*2},fn:async g=>{const N=g.map(C=>({allowFailure:!0,callData:C.data,target:C.to})),x=kt({abi:Is,args:[N],functionName:"aggregate3"}),P=await e.request({method:"eth_call",params:[{...l===null?{data:fd({code:Ca,data:x})}:{to:l,data:x}},f]});return Zn({abi:Is,args:[N],functionName:"aggregate3",data:P||"0x"})}}),[{returnData:d,success:h}]=await p({data:c,to:a});if(!h)throw new ys({data:d});return d==="0x"?{data:void 0}:{data:d}}function fd(e){const{code:t,data:n}=e;return $a({abi:lu(["constructor(bytes, bytes)"]),bytecode:id,args:[t,n]})}function nv(e){const{data:t,factory:n,factoryData:r,to:o}=e;return $a({abi:lu(["constructor(address, bytes, address, bytes)"]),bytecode:Jy,args:[o,t,n,r]})}function rv(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 Lt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=kt({abi:n,args:o,functionName:s});try{const{data:a}=await te(e,Do,"call")({...i,data:c,to:r});return Zn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw Pr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function ov(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?at(c.account):e.account,l=kt({abi:n,args:o,functionName:i});try{const{data:u}=await te(e,Do,"call")({batch:!1,data:`${l}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Zn({abi:n,args:o,functionName:i,data:u||"0x"}),p=n.filter(d=>"name"in d&&d.name===t.functionName);return{result:f,request:{abi:p,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(u){throw Pr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const Ma=new Map,dd=new Map;let sv=0;function kn(e,t,n){const r=++sv,o=()=>Ma.get(e)||[],s=()=>{const u=o();Ma.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(p=>p.id===r))return;const f=dd.get(e);if(u.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(Ma.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const u in t)a[u]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[u])==null||h.call(d,...f)};const l=n(a);return typeof l=="function"&&dd.set(e,l),i}async function Da(e){return new Promise(t=>setTimeout(t,e))}function Bo(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 Da(a);const l=async()=>{o&&(await e({unpoll:s}),await Da(r),l())};l()})(),s}const iv=new Map,av=new Map;function cv(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,iv),r=t(e,av);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function lv(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=cv(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 uv=e=>`blockNumber.${e}`;async function Lo(e,{cacheTime:t=e.cacheTime}={}){const n=await lv(()=>e.request({method:"eth_blockNumber"}),{cacheKey:uv(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=>cn(s));return!("abi"in t)||!t.abi?o:ga({abi:t.abi,logs:o,strict:n})}async function ks(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function fv(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:p}=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 g=p??!1,N=ke(["watchContractEvent",r,o,s,e.uid,i,f,g,c]);return kn(N,{onLogs:l,onError:a},x=>{let P;c!==void 0&&(P=c-1n);let C,M=!1;const L=Bo(async()=>{var F;if(!M){try{C=await te(e,Gu,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:g,fromBlock:c})}catch{}M=!0;return}try{let b;if(C)b=await te(e,$s,"getFilterChanges")({filter:C});else{const y=await te(e,Lo,"getBlockNumber")({});P&&P<y?b=await te(e,$f,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:P+1n,toBlock:y,strict:g}):b=[],P=y}if(b.length===0)return;if(s)x.onLogs(b);else for(const y of b)x.onLogs([y])}catch(b){C&&b instanceof On&&(M=!1),(F=x.onError)==null||F.call(x,b)}},{emitOnBegin:!0,interval:f});return async()=>{C&&await te(e,ks,"uninstallFilter")({filter:C}),L()}})})():(()=>{const g=p??!1,N=ke(["watchContractEvent",r,o,s,e.uid,i,f,g]);let x=!0,P=()=>x=!1;return kn(N,{onLogs:l,onError:a},C=>((async()=>{try{const M=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(y=>y.config.type==="webSocket"||y.config.type==="ipc");return b?b.value:e.transport}return e.transport})(),L=i?eo({abi:n,eventName:i,args:o}):[],{unsubscribe:F}=await M.subscribe({params:["logs",{address:r,topics:L}],onData(b){var E;if(!x)return;const y=b.result;try{const{eventName:T,args:I}=Ss({abi:n,data:y.data,topics:y.topics,strict:p}),$=cn(y,{args:I,eventName:T});C.onLogs([$])}catch(T){let I,$;if(T instanceof fs||T instanceof Ri){if(p)return;I=T.abiItem.name,$=(E=T.abiItem.inputs)==null?void 0:E.some(w=>!("name"in w&&w.name))}const D=cn(y,{args:$?[]:{},eventName:I});C.onLogs([D])}},onError(b){var y;(y=C.onError)==null||y.call(C,b)}});P=F,x||P()}catch(M){a==null||a(M)}})(),()=>P()))})()}async function dv(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Ba(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 Da(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 pv={"0x0":"reverted","0x1":"success"};function pd(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=>cn(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?on(e.transactionIndex):null,status:e.status?pv[e.status]:null,type:e.type?bf[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 Ms=La,Ds;function hd(e=11){if(!Ds||Ms+e>La*2){Ds="",Ms=0;for(let t=0;t<La;t++)Ds+=(256+Math.random()*256|0).toString(16).substring(1)}return Ds.substring(Ms,Ms+++e)}function hv(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,l=Math.min(Math.max(Math.floor(a/2),500),4e3),u=e.pollingInterval??l,f=e.cacheTime??u,p=e.account?at(e.account):void 0,{config:d,request:h,value:m}=e.transport({account:p,chain:n,pollingInterval:u}),g={...d,...m},N={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:u,request:h,transport:g,type:i,uid:hd(),...c?{experimental_blockTag:c}:{}};function x(P){return C=>{const M=C(P);for(const F in N)delete M[F];const L={...P,...M};return Object.assign(L,{extend:x(L)})}}return Object.assign(N,{extend:x(N)})}function Fa(e){var n,r,o,s,i,c;if(!(e instanceof V))return!1;const t=e.walk(a=>a instanceof Ji);return t instanceof Ji?((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 mv(e){const{abi:t,data:n}=e,r=wr(n,0,4),o=t.find(s=>s.type==="function"&&r===Qr(Ct(s)));if(!o)throw new o1(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?to(o.inputs,wr(n,4)):void 0}}const Ra="/docs/contract/encodeErrorResult";function md(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Hn({abi:t,args:r,name:n});if(!a)throw new bu(n,{docsPath:Ra});o=a}if(o.type!=="error")throw new bu(void 0,{docsPath:Ra});const s=Ct(o),i=Qr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new t1(o.name,{docsPath:Ra});c=Cn(o.inputs,r)}return vr([i,c])}const ja="/docs/contract/encodeFunctionResult";function bv(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Hn({abi:t,name:n});if(!i)throw new pr(n,{docsPath:ja});o=i}if(o.type!=="function")throw new pr(void 0,{docsPath:ja});if(!o.outputs)throw new vu(o.name,{docsPath:ja});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new wu(r)})();return Cn(o.outputs,s)}const Fo="x-batch-gateway:true";async function bd(e){const{data:t,ccipRequest:n}=e,{args:[r]}=mv({abi:Na,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(Fo)?await bd({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=gv(a)}})),bv({abi:Na,functionName:"query",result:[o,s]})}function gv(e){return e.name==="HttpRequestError"&&e.status?md({abi:Na,errorName:"HttpError",args:[e.status,e.shortMessage]}):md({abi:[Ku],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function gd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Ot(t)?t:null}function za(e){let t=new Uint8Array(32).fill(0);if(!e)return $e(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=gd(n[r]),s=o?mr(o):Fe(Wn(n[r]),"bytes");t=Fe($t([t,s]),"bytes")}return $e(t)}function yv(e){return`[${e.slice(2)}]`}function vv(e){const t=new Uint8Array(32).fill(0);return e?gd(e)||Fe(Wn(e)):$e(t)}function Ua(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Wn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Wn(o[s]);i.byteLength>255&&(i=Wn(yv(vv(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 wv(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 Ir({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(p=>s.endsWith(p)))return null;const f=o!=null?[za(s),BigInt(o)]:[za(s)];try{const p=kt({abi:rd,functionName:"addr",args:f}),d={address:l,abi:td,functionName:"resolveWithGateways",args:[Tn(Ua(s)),p,i??[Fo]],blockNumber:n,blockTag:r},m=await te(e,Lt,"readContract")(d);if(m[0]==="0x")return null;const g=Zn({abi:rd,args:f,functionName:"addr",data:m[0]});return g==="0x"||_n(g)==="0x00"?null:g}catch(p){if(c)throw p;if(Fa(p))return null;throw p}}class xv 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 Ro 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 Ev extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const Sv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Pv=/^(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>\/.*)?$/,Tv=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Av=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Nv(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 yd(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function vd({uri:e,gatewayUrls:t}){const n=Tv.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=yd(t==null?void 0:t.ipfs,"https://ipfs.io"),o=yd(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(Sv),{protocol:i,subpath:c,target:a,subtarget:l=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||Pv.test(e);if(e.startsWith("http")&&!u&&!f){let d=e;return t!=null&&t.arweave&&(d=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:d,isOnChain:!1,isEncoded:!1}}if((u||f)&&a)return{uri:`${r}/${u?"ipns":"ipfs"}/${a}${l}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${l||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(Av,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new _a({uri:e})}function wd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new xv({data:e});return e.image||e.image_url||e.image_data}async function Cv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Wa({gatewayUrls:e,uri:wd(n)})}catch{throw new _a({uri:t})}}async function Wa({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=vd({uri:t,gatewayUrls:e});if(r||await Nv(n))return n;throw new _a({uri:t})}function Ov(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 Ro({reason:"Only EIP-155 supported"});if(!i)throw new Ro({reason:"Chain ID not found"});if(!a)throw new Ro({reason:"Contract address not found"});if(!o)throw new Ro({reason:"Token ID not found"});if(!c)throw new Ro({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function Iv(e,{nft:t}){if(t.namespace==="erc721")return Lt(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 Lt(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 Ev({namespace:t.namespace})}async function $v(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?kv(e,{gatewayUrls:t,record:n}):Wa({uri:n,gatewayUrls:t})}async function kv(e,{gatewayUrls:t,record:n}){const r=Ov(n),o=await Iv(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=vd({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 Wa({uri:wd(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Cv({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function xd(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 Ir({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:td,args:[Tn(Ua(s)),kt({abi:nd,functionName:"text",args:[za(s),o]}),i??[Fo]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},d=await te(e,Lt,"readContract")(f);if(d[0]==="0x")return null;const h=Zn({abi:nd,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(Fa(f))return null;throw f}}async function Mv(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await te(e,xd,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await $v(e,{record:a,gatewayUrls:r})}catch{return null}}async function Dv(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 Ir({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const u={address:l,abi:Yy,args:[n,s,i??[Fo]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=te(e,Lt,"readContract"),[p]=await f(u);return p||null}catch(u){if(c)throw u;if(Fa(u))return null;throw u}}async function Bv(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 Ir({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 te(e,Lt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Tn(Ua(o))],blockNumber:n,blockTag:r});return a}async function Ed(e,t){var g,N,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:p,value:d,...h}=t,m=n?at(n):void 0;try{Ar(t);const C=(typeof r=="bigint"?ne(r):void 0)||o,M=(x=(N=(g=e.chain)==null?void 0:g.formatters)==null?void 0:N.transactionRequest)==null?void 0:x.format,F=(M||No)({...Es(h,{format:M}),account:m,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d},"createAccessList"),b=await e.request({method:"eth_createAccessList",params:[F,C]});return{accessList:b.accessList,gasUsed:BigInt(b.gasUsed)}}catch(P){throw cd(P,{...t,account:m,chain:e.chain})}}async function Lv(e){const t=gs(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Sd(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),l=gs(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(d=>eo({abi:[d],eventName:d.name,args:n}))],r&&(u=u[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?ne(s):s,toBlock:typeof c=="bigint"?ne(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 Pd(e){const t=gs(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Fv(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?ne(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Rv(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function jv(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?ne(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),on(s)}async function Va(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?ne(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class zv 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 Uv(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,l,u,f]=await te(e,Lt,"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 zv({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 Wv(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 Vv(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?ne(n):void 0,i=await e.request({method:"eth_feeHistory",params:[ne(t),s||r,o]},{dedupe:!!s});return Wv(i)}async function Hv(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>cn(s));return t.abi?ga({abi:t.abi,logs:o,strict:n}):o}async function Gv({address:e,authorization:t,signature:n}){return Co(Nn(e),await ff({authorization:t,signature:n}))}const Bs=new ms(8192);function qv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Bs.get(n))return Bs.get(n);const r=e().finally(()=>Bs.delete(n));return Bs.set(n,r),r}function Kv(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 Kn(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new Kn(new Error("method not supported"),{method:l});const u=o?Yr(`${a}.${ke(n)}`):void 0;return qv(()=>Ba(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d,{method:n.method});case co.code:throw new co(d);case qn.code:throw new qn(d);case On.code:throw new On(d);case lo.code:throw new lo(d);case uo.code:throw new uo(d);case fo.code:throw new fo(d);case Kn.code:throw new Kn(d,{method:n.method});case Er.code:throw new Er(d);case po.code:throw new po(d);case Sr.code:throw new Sr(d);case ho.code:throw new ho(d);case mo.code:throw new mo(d);case bo.code:throw new bo(d);case go.code:throw new go(d);case yo.code:throw new yo(d);case vo.code:throw new vo(d);case wo.code:throw new wo(d);case xo.code:throw new xo(d);case Eo.code:throw new Eo(d);case So.code:throw new So(d);case Po.code:throw new Po(d);case To.code:throw new To(d);case 5e3:throw new Sr(d);default:throw p instanceof V?p:new Bg(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Gn){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m,10)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>Zv(p)}),{enabled:o,id:u})}}function Zv(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Er.code||e.code===qn.code:e instanceof Gn&&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 Yv 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=>` ${oo(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class Xv extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${oo(n)}`,`Response: ${ke(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Jv 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 Qv="0x556f1830",Td={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 ew(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Ju({data:r,abi:[Td]}),[i,c,a,l,u]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Ad;try{if(!Co(o,i))throw new Jv({sender:i,to:o});const d=c.includes(Fo)?await bd({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await Do(e,{blockNumber:t,blockTag:n,data:$t([l,Cn([{type:"bytes"},{type:"bytes"}],[d,u])]),to:o});return h}catch(d){throw new Yv({callbackSelector:l,cause:d,data:r,extraData:u,sender:i,urls:c})}}async function Ad({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 Gn({body:a,details:f!=null&&f.error?ke(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!Ot(f)){r=new Xv({result:f,url:i});continue}return f}catch(u){r=new Gn({body:a,details:u.message,url:i})}}throw r}const tw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Ad,offchainLookup:ew,offchainLookupAbiItem:Td,offchainLookupSignature:Qv},Symbol.toStringTag,{value:"Module"}));function nw(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}function rw(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 ow(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Nd=ow();function sw(e,t={}){return{async request(n){var p;const{body:r,fetchFn:o=t.fetchFn??fetch,onRequest:s=t.onRequest,onResponse:i=t.onResponse,timeout:c=t.timeout??1e4}=n,a={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:l,method:u,signal:f}=a;try{const d=await rw(async({signal:m})=>{const g={...a,body:Array.isArray(r)?ke(r.map(C=>({jsonrpc:"2.0",id:C.id??Nd.take(),...C}))):ke({jsonrpc:"2.0",id:r.id??Nd.take(),...r}),headers:{"Content-Type":"application/json",...l},method:u||"POST",signal:f||(c>0?m:null)},N=new Request(e,g),x=await(s==null?void 0:s(N,g))??{...g,url:e};return await o(x.url??e,x)},{errorInstance:new sf({body:r,url:e}),timeout:c,signal:!0});i&&await i(d);let h;if((p=d.headers.get("Content-Type"))!=null&&p.startsWith("application/json"))h=await d.json();else{h=await d.text();try{h=JSON.parse(h||"{}")}catch(m){if(d.ok)throw m;h={error:h}}}if(!d.ok)throw new Gn({body:r,details:ke(h.error)||d.statusText,headers:d.headers,status:d.status,url:e});return h}catch(d){throw d instanceof Gn||d instanceof sf?d:new Gn({body:r,cause:d,url:e})}}}}const iw=`Ethereum Signed Message:
|
|
89
|
-
`;function aw(e){const t=typeof e=="string"?Yr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=Yr(`${iw}${Se(t)}`);return $t([n,t])}function Cd(e,t){return Fe(aw(e),t)}class cw extends V{constructor({domain:t}){super(`Invalid domain "${ke(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class lw 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 uw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function fw(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],p=u.match(_u);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,g,N]=p;ne(f,{signed:g==="int",size:Number.parseInt(N,10)/8})}if(u==="address"&&typeof f=="string"&&!mt(f))throw new An({address:f});const d=u.match(J1);if(d){const[m,g]=d;if(g&&Se(f)!==Number.parseInt(g,10))throw new i1({expectedSize:Number.parseInt(g,10),givenSize:Se(f)})}const h=o[u];h&&(pw(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new cw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new lw({primaryType:r,types:o})}function dw({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function pw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new uw({type:e})}function hw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:dw({domain:t}),...e.types};fw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(mw({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Od({data:n,primaryType:r,types:o})),Fe($t(s))}function mw({domain:e,types:t}){return Od({data:e,primaryType:"EIP712Domain",types:t})}function Od({data:e,primaryType:t,types:n}){const r=Id({data:e,primaryType:t,types:n});return Fe(r)}function Id({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[bw({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=kd({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Cn(r,o)}function bw({primaryType:e,types:t}){const n=Tn(gw({primaryType:e,types:t}));return Fe(n)}function gw({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 kd({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Fe(Id({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},Fe(r)];if(n==="string")return[{type:"bytes32"},Fe(Tn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>kd({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Fe(Cn(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class yw 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 Ha={checksum:new yw(8192)}.checksum;function Md(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Fu(Iy(e));return n==="Bytes"?r:Bt(r)}const vw=/^0x[a-fA-F0-9]{40}$/;function Ls(e,t={}){const{strict:n=!0}=t;if(!vw.test(e))throw new Bd({address:e,cause:new ww});if(n){if(e.toLowerCase()===e)return;if(Dd(e)!==e)throw new Bd({address:e,cause:new xw})}}function Dd(e){if(Ha.has(e))return Ha.get(e);Ls(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Md(ky(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 Ha.set(e,o),o}function Ga(e,t={}){const{strict:n=!0}=t??{};try{return Ls(e,{strict:n}),!0}catch{return!1}}class Bd extends ue{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 ww extends ue{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 xw extends ue{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const Ew=/^(.*)\[([0-9]*)\]$/,Sw=/^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)?$/,Fd=2n**256n-1n;function $r(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=Ya(t.type);if(s){const[i,c]=s;return Tw(e,{...t,type:c},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return Ow(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return Pw(e,{checksum:r});if(t.type==="bool")return Aw(e);if(t.type.startsWith("bytes"))return Nw(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Cw(e,t);if(t.type==="string")return Iw(e,{staticPosition:o});throw new Qa(t.type)}const Rd=32,qa=32;function Pw(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Dd(s):s)(Bt(Dy(r,-20))),32]}function Tw(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=fn(e.readBytes(qa)),l=s+a,u=l+Rd;e.setPosition(l);const f=fn(e.readBytes(Rd)),p=jo(t);let d=0;const h=[];for(let m=0;m<f;++m){e.setPosition(u+(p?m*32:d));const[g,N]=$r(e,t,{checksumAddress:r,staticPosition:u});d+=N,h.push(g)}return e.setPosition(s+32),[h,32]}if(jo(t)){const a=fn(e.readBytes(qa)),l=s+a,u=[];for(let f=0;f<o;++f){e.setPosition(l+f*32);const[p]=$r(e,t,{checksumAddress:r,staticPosition:l});u.push(p)}return e.setPosition(s+32),[u,32]}let i=0;const c=[];for(let a=0;a<o;++a){const[l,u]=$r(e,t,{checksumAddress:r,staticPosition:s+i});i+=u,c.push(l)}return[c,i]}function Aw(e){return[Ly(e.readBytes(32),{size:32}),32]}function Nw(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=fn(e.readBytes(32));e.setPosition(n+i);const c=fn(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Bt(a),32]}return[Bt(e.readBytes(Number.parseInt(o,10),32)),32]}function Cw(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?By(o,{signed:n}):fn(o,{signed:n}),32]}function Ow(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(jo(t)){const a=fn(e.readBytes(qa)),l=o+a;for(let u=0;u<t.components.length;++u){const f=t.components[u];e.setPosition(l+c);const[p,d]=$r(e,f,{checksumAddress:r,staticPosition:l});c+=d,i[s?u:f==null?void 0:f.name]=p}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const l=t.components[a],[u,f]=$r(e,l,{checksumAddress:r,staticPosition:o});i[s?a:l==null?void 0:l.name]=u,c+=f}return[i,c]}function Iw(e,{staticPosition:t}){const n=fn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=fn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=Fy(Hf(s));return e.setPosition(t+32),[i,32]}function $w({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Ka({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Ka({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Ya(r.type);if(o){const[s,i]=o;return Mw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Rw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return kw(n,{checksum:e});if(r.type==="bool")return Bw(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 Dw(n,{type:r.type});if(r.type==="string")return Fw(n);throw new Qa(r.type)}function Za(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=lt(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(_e(t+o,{size:32})),r.push(c),o+=lt(c)):n.push(c)}return Dt(...n,...r)}function kw(e,t){const{checksum:n=!1}=t;return Ls(e,{strict:n}),{dynamic:!1,encoded:Xn(e.toLowerCase())}}function Mw(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new qw(e);if(!s&&e.length!==r)throw new Gw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const l=Ka({checksumAddress:n,parameter:o,value:e[a]});l.dynamic&&(i=!0),c.push(l)}if(s||i){const a=Za(c);if(s){const l=_e(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Dt(l,a):l}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Dt(...c.map(({encoded:a})=>a))}}function Dw(e,{type:t}){const[,n]=t.split("bytes"),r=lt(e);if(!n){let o=e;return r%32!==0&&(o=Jn(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Dt(Xn(_e(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new Ud({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Jn(e)}}function Bw(e){if(typeof e!="boolean")throw new ue(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xn(Gf(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 Zf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:_e(e,{size:32,signed:t})}}function Fw(e){const t=Aa(e),n=Math.ceil(lt(t)/32),r=[];for(let o=0;o<n;o++)r.push(Jn(Ht(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Dt(Jn(_e(lt(t),{size:32})),...r)}}function Rw(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=Ka({checksumAddress:n,parameter:c,value:e[a]});s.push(l),l.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Za(s):Dt(...s.map(({encoded:i})=>i))}}function Ya(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function jo(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(jo);const n=Ya(e.type);return!!(n&&jo({...e,type:n[1]}))}const jw={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new _w({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Uw({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new jd({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 jd({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 zw(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(jw);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class jd extends ue{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Uw extends ue{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 _w extends ue{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 Ww(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?Vf(t):t,i=zw(s);if(Cr(s)===0&&e.length>0)throw new Hw;if(Cr(s)&&Cr(s)<32)throw new Vw({data:typeof t=="string"?t:Bt(t),parameters:e,size:Cr(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,p]=$r(i,u,{checksumAddress:o,staticPosition:0});c+=p,r==="Array"?a.push(f):a[u.name??l]=f}return a}function Xa(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new _d({expectedLength:e.length,givenLength:t.length});const o=$w({checksumAddress:r,parameters:e,values:t}),s=Za(o);return s.length===0?"0x":s}function Ja(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(Ja.encode(o,s))}return Dt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Ls(a),Xn(a.toLowerCase(),o?32:0)}if(n==="string")return Aa(r);if(n==="bytes")return r;if(n==="bool")return Xn(Gf(r),o?32:1);const s=n.match(Ld);if(s){const[a,l,u="256"]=s,f=Number.parseInt(u,10)/8;return _e(r,{size:o?32:f,signed:l==="int"})}const i=n.match(Sw);if(i){const[a,l]=i;if(Number.parseInt(l,10)!==(r.length-2)/2)throw new Ud({expectedSize:Number.parseInt(l,10),value:r});return Jn(r,o?32:0)}const c=n.match(Ew);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":Dt(...u)}throw new Qa(n)}e.encode=t})(Ja||(Ja={}));function zd(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?fu(e):e}class Vw extends ue{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${fr(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Hw extends ue{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Gw extends ue{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 Ud extends ue{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${lt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class _d extends ue{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 qw extends ue{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class Qa extends ue{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}class Wd extends zi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,C1(t);const r=ps(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),yr(s)}update(t){return gr(this),this.iHash.update(t),this}digestInto(t){gr(this),Vn(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 Vd=(e,t,n)=>new Wd(e,t).update(n).digest();Vd.create=(e,t)=>new Wd(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Je=BigInt(0),We=BigInt(1),Qn=BigInt(2),Kw=BigInt(3),Hd=BigInt(4),Gd=BigInt(5),qd=BigInt(8);function Qe(e,t){const n=e%t;return n>=Je?n:t+n}function gt(e,t,n){let r=e;for(;t-- >Je;)r*=r,r%=n;return r}function ec(e,t){if(e===Je)throw new Error("invert: expected non-zero number");if(t<=Je)throw new Error("invert: expected positive modulus, got "+t);let n=Qe(e,t),r=t,o=Je,s=We;for(;n!==Je;){const c=r/n,a=r%n,l=o-s*c;r=n,n=a,o=s,s=l}if(r!==We)throw new Error("invert: does not exist");return Qe(o,t)}function Kd(e,t){const n=(e.ORDER+We)/Hd,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-Gd)/qd,r=e.mul(t,Qn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Qn),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 Yw(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-We,n=0;for(;t%Qn===Je;)t/=Qn,n++;let r=Qn;const o=tc(e);for(;Yd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Kd;let s=o.pow(r,t);const i=(t+We)/Qn;return function(a,l){if(a.is0(l))return l;if(Yd(a,l)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),p=a.pow(l,t),d=a.pow(l,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===u)throw new Error("Cannot find square root");const g=We<<BigInt(u-h-1),N=a.pow(f,g);u=h,f=a.sqr(N),p=a.mul(p,f),d=a.mul(d,N)}return d}}function Xw(e){return e%Hd===Kw?Kd:e%qd===Gd?Zw:Yw(e)}const Jw=["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=Jw.reduce((r,o)=>(r[o]="function",r),t);return Cs(e,n)}function e6(e,t,n){if(n<Je)throw new Error("invalid exponent, negatives unsupported");if(n===Je)return e.ONE;if(n===We)return t;let r=e.ONE,o=t;for(;n>Je;)n&We&&(r=e.mul(r,o)),o=e.sqr(o),n>>=We;return r}function Zd(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 Yd(e,t){const n=(e.ORDER-We)/Qn,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 Xd(e,t){t!==void 0&&Xr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function tc(e,t,n=!1,r={}){if(e<=Je)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=Xd(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:Ns(o),ZERO:Je,ONE:We,create:a=>Qe(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return Je<=a&&a<e},is0:a=>a===Je,isOdd:a=>(a&We)===We,neg:a=>Qe(-a,e),eql:(a,l)=>a===l,sqr:a=>Qe(a*a,e),add:(a,l)=>Qe(a+l,e),sub:(a,l)=>Qe(a-l,e),mul:(a,l)=>Qe(a*l,e),pow:(a,l)=>e6(c,a,l),div:(a,l)=>Qe(a*ec(l,e),e),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>ec(a,e),sqrt:r.sqrt||(a=>(i||(i=Xw(e)),i(c,a))),toBytes:a=>n?Lf(a,s):ko(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Bf(a):Yn(a)},invertBatch:a=>Zd(c,a),cmov:(a,l,u)=>u?l:a});return Object.freeze(c)}function Jd(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 Qd(e){const t=Jd(e);return t+Math.ceil(t/2)}function t6(e,t,n=!1){const r=e.length,o=Jd(t),s=Qd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Bf(e):Yn(e),c=Qe(i,t-We)+We;return n?Lf(c,o):ko(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e0=BigInt(0),nc=BigInt(1);function rc(e,t){const n=t.negate();return e?n:t}function t0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function oc(e,t){t0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Ns(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function n0(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+=nc);const l=t*r,u=l+Math.abs(c)-1,f=c===0,p=c<0,d=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:l}}function n6(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 r6(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 sc=new WeakMap,r0=new WeakMap;function ic(e){return r0.get(e)||1}function o6(e,t){return{constTimeNegate:rc,hasPrecomputes(n){return ic(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>e0;)r&nc&&(o=o.add(s)),s=s.double(),r>>=nc;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=oc(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=oc(n,t);for(let a=0;a<c.windows;a++){const{nextN:l,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:h}=n0(o,a,c);o=l,f?i=i.add(rc(d,r[h])):s=s.add(rc(p,r[u]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=oc(n,t);for(let c=0;c<i.windows&&o!==e0;c++){const{nextN:a,offset:l,isZero:u,isNeg:f}=n0(o,c,i);if(o=a,!u){const p=r[l];s=s.add(f?p.negate():p)}}return s},getPrecomputes(n,r,o){let s=sc.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&sc.set(r,o(s))),s},wNAFCached(n,r,o){const s=ic(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=ic(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){t0(r,t),r0.set(n,r),sc.delete(n)}}}function s6(e,t,n,r){n6(n,e),r6(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=vy(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const l=Ns(a),u=new Array(Number(l)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){u.fill(i);for(let m=0;m<s;m++){const g=r[m],N=Number(g>>BigInt(d)&l);u[N]=u[N].add(n[m])}let h=i;for(let m=u.length-1,g=i;m>0;m--)g=g.add(u[m]),h=h.add(g);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function o0(e){return Qw(e.Fp),Cs(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Xd(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function s0(e){e.lowS!==void 0&&Io("lowS",e.lowS),e.prehash!==void 0&&Io("prehash",e.prehash)}function i6(e){const t=o0(e);Cs(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 a6 extends Error{constructor(t=""){super(t)}}const dn={Err:a6,_tlv:{encode:(e,t)=>{const{Err:n}=dn;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=Ps(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Ps(o.length/2|128):"";return Ps(e)+s+o+t},decode(e,t){const{Err:n}=dn;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}=dn;if(e<pn)throw new t("integer: negative integers are not allowed");let n=Ps(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}=dn;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 Yn(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=dn,o=bt("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}=dn,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 ac(e,t){return $o(ko(e,t))}const pn=BigInt(0),De=BigInt(1);BigInt(2);const cc=BigInt(3),c6=BigInt(4);function l6(e){const t=i6(e),{Fp:n}=t,r=tc(t.n,t.nBitLength),o=t.toBytes||((P,C,M)=>{const L=C.toAffine();return As(Uint8Array.from([4]),n.toBytes(L.x),n.toBytes(L.y))}),s=t.fromBytes||(P=>{const C=P.subarray(1),M=n.fromBytes(C.subarray(0,n.BYTES)),L=n.fromBytes(C.subarray(n.BYTES,2*n.BYTES));return{x:M,y:L}});function i(P){const{a:C,b:M}=t,L=n.sqr(P),F=n.mul(L,P);return n.add(n.add(F,n.mul(P,C)),M)}function c(P,C){const M=n.sqr(C),L=i(P);return n.eql(M,L)}if(!c(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,cc),c6),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(P){return Pa(P,De,t.n)}function f(P){const{allowedPrivateKeyLengths:C,nByteLength:M,wrapPrivateKey:L,n:F}=t;if(C&&typeof P!="bigint"){if(Oo(P)&&(P=$o(P)),typeof P!="string"||!C.includes(P.length))throw new Error("invalid private key");P=P.padStart(M*2,"0")}let b;try{b=typeof P=="bigint"?P:Yn(bt("private key",P,M))}catch{throw new Error("invalid private key, expected hex or "+M+" bytes, got "+typeof P)}return L&&(b=Qe(b,F)),Nr("private key",b,De,F),b}function p(P){if(!(P instanceof m))throw new Error("ProjectivePoint expected")}const d=Rf((P,C)=>{const{px:M,py:L,pz:F}=P;if(n.eql(F,n.ONE))return{x:M,y:L};const b=P.is0();C==null&&(C=b?n.ONE:n.inv(F));const y=n.mul(M,C),E=n.mul(L,C),T=n.mul(F,C);if(b)return{x:n.ZERO,y:n.ZERO};if(!n.eql(T,n.ONE))throw new Error("invZ was invalid");return{x:y,y:E}}),h=Rf(P=>{if(P.is0()){if(t.allowInfinityPoint&&!n.is0(P.py))return;throw new Error("bad point: ZERO")}const{x:C,y:M}=P.toAffine();if(!n.isValid(C)||!n.isValid(M))throw new Error("bad point: x or y not FE");if(!c(C,M))throw new Error("bad point: equation left != right");if(!P.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class m{constructor(C,M,L){if(C==null||!n.isValid(C))throw new Error("x required");if(M==null||!n.isValid(M)||n.is0(M))throw new Error("y required");if(L==null||!n.isValid(L))throw new Error("z required");this.px=C,this.py=M,this.pz=L,Object.freeze(this)}static fromAffine(C){const{x:M,y:L}=C||{};if(!C||!n.isValid(M)||!n.isValid(L))throw new Error("invalid affine point");if(C instanceof m)throw new Error("projective point not allowed");const F=b=>n.eql(b,n.ZERO);return F(M)&&F(L)?m.ZERO:new m(M,L,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(C){const M=Zd(n,C.map(L=>L.pz));return C.map((L,F)=>L.toAffine(M[F])).map(m.fromAffine)}static fromHex(C){const M=m.fromAffine(s(bt("pointHex",C)));return M.assertValidity(),M}static fromPrivateKey(C){return m.BASE.multiply(f(C))}static msm(C,M){return s6(m,r,C,M)}_setWindowSize(C){x.setWindowSize(this,C)}assertValidity(){h(this)}hasEvenY(){const{y:C}=this.toAffine();if(n.isOdd)return!n.isOdd(C);throw new Error("Field doesn't support isOdd")}equals(C){p(C);const{px:M,py:L,pz:F}=this,{px:b,py:y,pz:E}=C,T=n.eql(n.mul(M,E),n.mul(b,F)),I=n.eql(n.mul(L,E),n.mul(y,F));return T&&I}negate(){return new m(this.px,n.neg(this.py),this.pz)}double(){const{a:C,b:M}=t,L=n.mul(M,cc),{px:F,py:b,pz:y}=this;let E=n.ZERO,T=n.ZERO,I=n.ZERO,$=n.mul(F,F),D=n.mul(b,b),w=n.mul(y,y),O=n.mul(F,b);return O=n.add(O,O),I=n.mul(F,y),I=n.add(I,I),E=n.mul(C,I),T=n.mul(L,w),T=n.add(E,T),E=n.sub(D,T),T=n.add(D,T),T=n.mul(E,T),E=n.mul(O,E),I=n.mul(L,I),w=n.mul(C,w),O=n.sub($,w),O=n.mul(C,O),O=n.add(O,I),I=n.add($,$),$=n.add(I,$),$=n.add($,w),$=n.mul($,O),T=n.add(T,$),w=n.mul(b,y),w=n.add(w,w),$=n.mul(w,O),E=n.sub(E,$),I=n.mul(w,D),I=n.add(I,I),I=n.add(I,I),new m(E,T,I)}add(C){p(C);const{px:M,py:L,pz:F}=this,{px:b,py:y,pz:E}=C;let T=n.ZERO,I=n.ZERO,$=n.ZERO;const D=t.a,w=n.mul(t.b,cc);let O=n.mul(M,b),k=n.mul(L,y),S=n.mul(F,E),B=n.add(M,L),j=n.add(b,y);B=n.mul(B,j),j=n.add(O,k),B=n.sub(B,j),j=n.add(M,F);let U=n.add(b,E);return j=n.mul(j,U),U=n.add(O,S),j=n.sub(j,U),U=n.add(L,F),T=n.add(y,E),U=n.mul(U,T),T=n.add(k,S),U=n.sub(U,T),$=n.mul(D,j),T=n.mul(w,S),$=n.add(T,$),T=n.sub(k,$),$=n.add(k,$),I=n.mul(T,$),k=n.add(O,O),k=n.add(k,O),S=n.mul(D,S),j=n.mul(w,j),k=n.add(k,S),S=n.sub(O,S),S=n.mul(D,S),j=n.add(j,S),O=n.mul(k,j),I=n.add(I,O),O=n.mul(U,j),T=n.mul(B,T),T=n.sub(T,O),O=n.mul(B,k),$=n.mul(U,$),$=n.add($,O),new m(T,I,$)}subtract(C){return this.add(C.negate())}is0(){return this.equals(m.ZERO)}wNAF(C){return x.wNAFCached(this,C,m.normalizeZ)}multiplyUnsafe(C){const{endo:M,n:L}=t;Nr("scalar",C,pn,L);const F=m.ZERO;if(C===pn)return F;if(this.is0()||C===De)return this;if(!M||x.hasPrecomputes(this))return x.wNAFCachedUnsafe(this,C,m.normalizeZ);let{k1neg:b,k1:y,k2neg:E,k2:T}=M.splitScalar(C),I=F,$=F,D=this;for(;y>pn||T>pn;)y&De&&(I=I.add(D)),T&De&&($=$.add(D)),D=D.double(),y>>=De,T>>=De;return b&&(I=I.negate()),E&&($=$.negate()),$=new m(n.mul($.px,M.beta),$.py,$.pz),I.add($)}multiply(C){const{endo:M,n:L}=t;Nr("scalar",C,De,L);let F,b;if(M){const{k1neg:y,k1:E,k2neg:T,k2:I}=M.splitScalar(C);let{p:$,f:D}=this.wNAF(E),{p:w,f:O}=this.wNAF(I);$=x.constTimeNegate(y,$),w=x.constTimeNegate(T,w),w=new m(n.mul(w.px,M.beta),w.py,w.pz),F=$.add(w),b=D.add(O)}else{const{p:y,f:E}=this.wNAF(C);F=y,b=E}return m.normalizeZ([F,b])[0]}multiplyAndAddUnsafe(C,M,L){const F=m.BASE,b=(E,T)=>T===pn||T===De||!E.equals(F)?E.multiplyUnsafe(T):E.multiply(T),y=b(this,M).add(b(C,L));return y.is0()?void 0:y}toAffine(C){return d(this,C)}isTorsionFree(){const{h:C,isTorsionFree:M}=t;if(C===De)return!0;if(M)return M(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:C,clearCofactor:M}=t;return C===De?this:M?M(m,this):this.multiplyUnsafe(t.h)}toRawBytes(C=!0){return Io("isCompressed",C),this.assertValidity(),o(m,this,C)}toHex(C=!0){return Io("isCompressed",C),$o(this.toRawBytes(C))}}m.BASE=new m(t.Gx,t.Gy,n.ONE),m.ZERO=new m(n.ZERO,n.ONE,n.ZERO);const{endo:g,nBitLength:N}=t,x=o6(m,g?Math.ceil(N/2):N);return{CURVE:t,ProjectivePoint:m,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:u}}function u6(e){const t=o0(e);return Cs(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function f6(e){const t=u6(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,c=2*n.BYTES+1;function a(w){return Qe(w,r)}function l(w){return ec(w,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:f,weierstrassEquation:p,isWithinCurveOrder:d}=l6({...t,toBytes(w,O,k){const S=O.toAffine(),B=n.toBytes(S.x),j=As;return Io("isCompressed",k),k?j(Uint8Array.from([O.hasEvenY()?2:3]),B):j(Uint8Array.from([4]),B,n.toBytes(S.y))},fromBytes(w){const O=w.length,k=w[0],S=w.subarray(1);if(O===i&&(k===2||k===3)){const B=Yn(S);if(!Pa(B,De,n.ORDER))throw new Error("Point is not on curve");const j=p(B);let U;try{U=n.sqrt(j)}catch(Q){const q=Q instanceof Error?": "+Q.message:"";throw new Error("Point is not on curve"+q)}const _=(U&De)===De;return(k&1)===1!==_&&(U=n.neg(U)),{x:B,y:U}}else if(O===c&&k===4){const B=n.fromBytes(S.subarray(0,n.BYTES)),j=n.fromBytes(S.subarray(n.BYTES,2*n.BYTES));return{x:B,y:j}}else{const B=i,j=c;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+j+", got "+O)}}});function h(w){const O=r>>De;return w>O}function m(w){return h(w)?a(-w):w}const g=(w,O,k)=>Yn(w.slice(O,k));class N{constructor(O,k,S){Nr("r",O,De,r),Nr("s",k,De,r),this.r=O,this.s=k,S!=null&&(this.recovery=S),Object.freeze(this)}static fromCompact(O){const k=o;return O=bt("compactSignature",O,k*2),new N(g(O,0,k),g(O,k,2*k))}static fromDER(O){const{r:k,s:S}=dn.toSig(bt("DER",O));return new N(k,S)}assertValidity(){}addRecoveryBit(O){return new N(this.r,this.s,O)}recoverPublicKey(O){const{r:k,s:S,recovery:B}=this,j=F(bt("msgHash",O));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const U=B===2||B===3?k+t.n:k;if(U>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const _=B&1?"03":"02",G=u.fromHex(_+ac(U,n.BYTES)),Q=l(U),q=a(-j*Q),W=a(S*Q),ee=u.BASE.multiplyAndAddUnsafe(G,q,W);if(!ee)throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new N(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Ts(this.toDERHex())}toDERHex(){return dn.hexFromSig(this)}toCompactRawBytes(){return Ts(this.toCompactHex())}toCompactHex(){const O=o;return ac(this.r,O)+ac(this.s,O)}}const x={isValidPrivateKey(w){try{return f(w),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const w=Qd(t.n);return t6(t.randomBytes(w),t.n)},precompute(w=8,O=u.BASE){return O._setWindowSize(w),O.multiply(BigInt(3)),O}};function P(w,O=!0){return u.fromPrivateKey(w).toRawBytes(O)}function C(w){if(typeof w=="bigint")return!1;if(w instanceof u)return!0;const k=bt("key",w).length,S=n.BYTES,B=S+1,j=2*S+1;if(!(t.allowedPrivateKeyLengths||o===B))return k===B||k===j}function M(w,O,k=!0){if(C(w)===!0)throw new Error("first arg must be private key");if(C(O)===!1)throw new Error("second arg must be public key");return u.fromHex(O).multiply(f(w)).toRawBytes(k)}const L=t.bits2int||function(w){if(w.length>8192)throw new Error("input is too large");const O=Yn(w),k=w.length*8-s;return k>0?O>>BigInt(k):O},F=t.bits2int_modN||function(w){return a(L(w))},b=Ns(s);function y(w){return Nr("num < 2^"+s,w,pn,b),ko(w,o)}function E(w,O,k=T){if(["recovered","canonical"].some(K=>K in k))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:B}=t;let{lowS:j,prehash:U,extraEntropy:_}=k;j==null&&(j=!0),w=bt("msgHash",w),s0(k),U&&(w=bt("prehashed msgHash",S(w)));const G=F(w),Q=f(O),q=[y(Q),y(G)];if(_!=null&&_!==!1){const K=_===!0?B(n.BYTES):_;q.push(bt("extraEntropy",K))}const W=As(...q),ee=G;function ve(K){const oe=L(K);if(!d(oe))return;const se=l(oe),Z=u.BASE.multiply(oe).toAffine(),J=a(Z.x);if(J===pn)return;const ie=a(se*a(ee+J*Q));if(ie===pn)return;let re=(Z.x===J?0:2)|Number(Z.y&De),be=ie;return j&&h(ie)&&(be=m(ie),re^=1),new N(J,be,re)}return{seed:W,k2sig:ve}}const T={lowS:t.lowS,prehash:!1},I={lowS:t.lowS,prehash:!1};function $(w,O,k=T){const{seed:S,k2sig:B}=E(w,O,k),j=t;return wy(j.hash.outputLen,j.nByteLength,j.hmac)(S,B)}u.BASE._setWindowSize(8);function D(w,O,k,S=I){var re;const B=w;O=bt("msgHash",O),k=bt("publicKey",k);const{lowS:j,prehash:U,format:_}=S;if(s0(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");const G=typeof B=="string"||Oo(B),Q=!G&&!_&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!G&&!Q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let q,W;try{if(Q&&(q=new N(B.r,B.s)),G){try{_!=="compact"&&(q=N.fromDER(B))}catch(be){if(!(be instanceof dn.Err))throw be}!q&&_!=="der"&&(q=N.fromCompact(B))}W=u.fromHex(k)}catch{return!1}if(!q||j&&q.hasHighS())return!1;U&&(O=t.hash(O));const{r:ee,s:ve}=q,K=F(O),oe=l(ve),se=a(K*oe),Z=a(ee*oe),J=(re=u.BASE.multiplyAndAddUnsafe(W,se,Z))==null?void 0:re.toAffine();return J?a(J.x)===ee:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:M,sign:$,verify:D,ProjectivePoint:u,Signature:N,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function d6(e){return{hash:e,hmac:(t,...n)=>Vd(e,t,D1(...n)),randomBytes:B1}}function p6(e,t){const n=r=>f6({...e,...d6(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const i0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),a0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h6=BigInt(0),m6=BigInt(1),lc=BigInt(2),c0=(e,t)=>(e+t/lc)/t;function b6(e){const t=i0,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=gt(u,n,t)*u%t,p=gt(f,n,t)*u%t,d=gt(p,lc,t)*l%t,h=gt(d,o,t)*d%t,m=gt(h,s,t)*h%t,g=gt(m,c,t)*m%t,N=gt(g,a,t)*g%t,x=gt(N,c,t)*m%t,P=gt(x,n,t)*u%t,C=gt(P,i,t)*h%t,M=gt(C,r,t)*l%t,L=gt(M,lc,t);if(!uc.eql(uc.sqr(L),e))throw new Error("Cannot find square root");return L}const uc=tc(i0,void 0,void 0,{sqrt:b6}),l0=p6({a:h6,b:BigInt(7),Fp:uc,n:a0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=a0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-m6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),c=c0(s*e,t),a=c0(-r*e,t);let l=Qe(e-c*n-a*o,t),u=Qe(-c*r-a*s,t);const f=l>i,p=u>i;if(f&&(l=t-l),p&&(u=t-u),l>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:l,k2neg:p,k2:u}}}},Ef),g6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:l0},Symbol.toStringTag,{value:"Module"}));function u0(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new dc({signature:e});if(typeof e.s>"u")throw new dc({signature:e});if(n&&typeof e.yParity>"u")throw new dc({signature:e});if(e.r<0n||e.r>Fd)throw new P6({value:e.r});if(e.s<0n||e.s>Fd)throw new T6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new pc({value:e.yParity})}function y6(e){return f0(Bt(e))}function f0(e){if(e.length!==130&&e.length!==132)throw new S6({signature:e});const t=BigInt(Ht(e,0,32)),n=BigInt(Ht(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return fc(o)}catch{throw new pc({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function v6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return w6(e)}function w6(e){const t=typeof e=="string"?f0(e):e instanceof Uint8Array?y6(e):typeof e.r=="string"?E6(e):e.v?x6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return u0(t),t}function x6(e){return{r:e.r,s:e.s,yParity:fc(e.v)}}function E6(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=fc(n)),typeof r!="number")throw new pc({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function fc(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 A6({value:e})}class S6 extends ue{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${lt(Hy(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class dc extends ue{constructor({signature:t}){super(`Signature \`${Wf(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class P6 extends ue{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 T6 extends ue{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 pc extends ue{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 A6 extends ue{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 N6(e,t={}){return typeof e.chainId=="string"?C6(e):{...e,...t.signature}}function C6(e){const{address:t,chainId:n,nonce:r}=e,o=v6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const O6="0x8010801080108010801080108010801080108010801080108010801080108010",I6=zd("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function d0(e){if(typeof e=="string"){if(Ht(e,-32)!==O6)throw new M6(e)}else u0(e.authorization)}function $6(e){d0(e);const t=Kf(Ht(e,-64,-32)),n=Ht(e,-t-64,-64),r=Ht(e,0,-t-64),[o,s,i]=Ww(I6,n);return{authorization:N6({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 k6(e){try{return d0(e),!0}catch{return!1}}let M6=class extends ue{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 D6 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function B6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new D6({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 F6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?on(e.nonce):void 0,storageProof:e.storageProof?L6(e.storageProof):void 0}}async function R6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?ne(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return F6(c)}async function j6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?ne(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function hc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:c}){var p,d,h;const a=r||"latest",l=n!==void 0?ne(n):void 0;let u=null;if(o?u=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,ne(s)]},{dedupe:!0}):typeof s=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||a,ne(s)]},{dedupe:!!l}):i&&typeof c=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,ne(c)]},{dedupe:!0})),!u)throw new tf({blockHash:t,blockNumber:n,blockTag:a,hash:o,index:s});return(((h=(d=(p=e.chain)==null?void 0:p.formatters)==null?void 0:d.transaction)==null?void 0:h.format)||ua)(u,"getTransaction")}async function z6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([te(e,Lo,"getBlockNumber")({}),t?te(e,hc,"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 Fs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new nf({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||pd)(n,"getTransactionReceipt")}async function U6(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:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return Ir({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),d=[[]];let h=0,m=0;for(let P=0;P<l.length;P++){const{abi:C,address:M,args:L,functionName:F}=l[P];try{const b=kt({abi:C,args:L,functionName:F});m+=(b.length-2)/2,u>0&&m>u&&d[h].length>0&&(h++,m=(b.length-2)/2,d[h]=[]),d[h]=[...d[h],{allowFailure:!0,callData:b,target:M}]}catch(b){const y=Pr(b,{abi:C,address:M,args:L,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!o)throw y;d[h]=[...d[h],{allowFailure:!0,callData:"0x",target:M}]}}const g=await Promise.allSettled(d.map(P=>te(e,Lt,"readContract")({...p===null?{code:Ca}:{address:p},abi:Is,account:n,args:[P],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:c,functionName:"aggregate3",stateOverride:a}))),N=[];for(let P=0;P<g.length;P++){const C=g[P];if(C.status==="rejected"){if(!o)throw C.reason;for(let L=0;L<d[P].length;L++)N.push({status:"failure",error:C.reason,result:void 0});continue}const M=C.value;for(let L=0;L<M.length;L++){const{returnData:F,success:b}=M[L],{callData:y}=d[P][L],{abi:E,address:T,functionName:I,args:$}=l[N.length];try{if(y==="0x")throw new Zr;if(!b)throw new ys({data:F});const D=Zn({abi:E,args:$,data:F,functionName:I});N.push(o?{result:D,status:"success"}:D)}catch(D){const w=Pr(D,{abi:E,address:T,args:$,docsPath:"/docs/contract/multicall",functionName:I});if(!o)throw w;N.push({error:w,result:void 0,status:"failure"})}}}if(N.length!==l.length)throw new V("multicall results mismatch");return N}async function mc(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 p of o){const d=p.blockOverrides?Qf(p.blockOverrides):void 0,h=p.calls.map(g=>{const N=g,x=N.account?at(N.account):void 0,P=N.abi?kt(N):N.data,C={...N,account:x,data:N.dataSuffix?$t([P||"0x",N.dataSuffix]):P,from:N.from??(x==null?void 0:x.address)};return Ar(C),No(C)}),m=p.stateOverrides?ca(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const u=(typeof n=="bigint"?ne(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},u]})).map((p,d)=>({...gf(p),calls:p.calls.map((h,m)=>{var E,T;const{abi:g,args:N,functionName:x,to:P}=o[d].calls[m],C=((E=h.error)==null?void 0:E.data)??h.returnData,M=BigInt(h.gasUsed),L=(T=h.logs)==null?void 0:T.map(I=>cn(I)),F=h.status==="0x1"?"success":"failure",b=g&&F==="success"&&C!=="0x"?Zn({abi:g,data:C,functionName:x}):null,y=(()=>{var $;if(F==="success")return;let I;if((($=h.error)==null?void 0:$.data)==="0x"?I=new Zr:h.error&&(I=new ys(h.error)),!!I)return Pr(I,{abi:g??[],address:P??"0x",args:N,functionName:x??"<unknown>"})})();return{data:C,gasUsed:M,logs:L,status:F,...F==="success"?{result:b}:{error:y}}})}))}catch(a){const l=a,u=xs(l,{});throw u instanceof Ao?l:u}}function bc(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new ue("Unable to normalize signature.");return o}function gc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Ga(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)=>gc(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=>gc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function p0(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return p0(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?Ga(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Ga(n[r],{strict:!1}):!1)return i}}function h0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?uu(e):e;return{...r,...n?{hash:kr(r)}:{}}}function Rs(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Gy(t,{strict:!1}),i=e.filter(l=>s?l.type==="function"||l.type==="error"?m0(l)===Ht(t,0,4):l.type==="event"?kr(l)===t:!1:"name"in l&&l.name===t);if(i.length===0)throw new js({name:t});if(i.length===1)return{...i[0],...o?{hash:kr(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:kr(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in l&&l.inputs[p];return d?gc(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=p0(l.inputs,c.inputs,r);if(f)throw new W6({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 js({name:t});return{...a,...o?{hash:kr(a)}:{}}}function m0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Rs(n,r)}return e[0]})();return Ht(kr(t),0,4)}function _6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return Rs(r,o)}return e[0]})(),n=typeof t=="string"?t:cs(t);return bc(n)}function kr(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Rs(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Md(Aa(_6(t)))}class W6 extends ue{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${bc(cs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${bc(cs(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 js extends ue{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 V6(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,c]=e;return[G6(i),c]}return e})(),{bytecode:r,args:o}=n;return Dt(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?Xa(t.inputs,o):"0x")}function H6(e){return h0(e)}function G6(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new js({name:"constructor"});return t}function q6(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[l,u,f]=e;return[b0(l,u,{args:f}),f]}const[c,a]=e;return[c,a]})(),{overloads:r}=t,o=r?b0([t,...r],t.name,{args:n}):t,s=K6(o),i=n.length>0?Xa(o.inputs,n):void 0;return i?Dt(s,i):s}function Mr(e,t={}){return h0(e,t)}function b0(e,t,n){const r=Rs(e,t,n);if(r.type!=="function")throw new js({name:t,type:"function"});return r}function K6(e){return m0(e)}const Z6="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Gt="0x0000000000000000000000000000000000000000",Y6="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function X6(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,l=t.account?at(t.account):void 0;if(i&&!l)throw new V("`account` is required when `traceAssetChanges` is true");const u=l?V6(H6("constructor(bytes, bytes)"),{bytecode:id,args:[Y6,q6(Mr("function getBalance(address)"),[l.address])]}):void 0,f=i?await Promise.all(t.calls.map(async S=>{if(!S.data&&!S.abi)return;const{accessList:B}=await Ed(e,{account:l.address,...S,data:S.abi?kt(S):S.data});return B.map(({address:j,storageKeys:U})=>U.length>0?j:null)})).then(S=>S.flat().filter(Boolean)):[],p=await mc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((S,B)=>({abi:[Mr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:S,from:Gt,nonce:B})),stateOverrides:[{address:Gt,nonce:0}]}]:[],{calls:[...o,{}].map(S=>({...S,from:l==null?void 0:l.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((S,B)=>({abi:[Mr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:S,from:Gt,nonce:B})),stateOverrides:[{address:Gt,nonce:0}]},{calls:f.map((S,B)=>({to:S,abi:[Mr("function decimals() returns (uint256)")],functionName:"decimals",from:Gt,nonce:B})),stateOverrides:[{address:Gt,nonce:0}]},{calls:f.map((S,B)=>({to:S,abi:[Mr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Gt,nonce:B})),stateOverrides:[{address:Gt,nonce:0}]},{calls:f.map((S,B)=>({to:S,abi:[Mr("function symbol() returns (string)")],functionName:"symbol",from:Gt,nonce:B})),stateOverrides:[{address:Gt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,g,N,x,P,C]=i?p:[],{calls:M,...L}=d,F=M.slice(0,-1)??[],b=(h==null?void 0:h.calls)??[],y=(m==null?void 0:m.calls)??[],E=[...b,...y].map(S=>S.status==="success"?_t(S.data):null),T=(g==null?void 0:g.calls)??[],I=(N==null?void 0:N.calls)??[],$=[...T,...I].map(S=>S.status==="success"?_t(S.data):null),D=((x==null?void 0:x.calls)??[]).map(S=>S.status==="success"?S.result:null),w=((C==null?void 0:C.calls)??[]).map(S=>S.status==="success"?S.result:null),O=((P==null?void 0:P.calls)??[]).map(S=>S.status==="success"?S.result:null),k=[];for(const[S,B]of $.entries()){const j=E[S];if(typeof B!="bigint"||typeof j!="bigint")continue;const U=D[S-1],_=w[S-1],G=O[S-1],Q=S===0?{address:Z6,decimals:18,symbol:"ETH"}:{address:f[S-1],decimals:G||U?Number(U??1):void 0,symbol:_??void 0};k.some(q=>q.token.address===Q.address)||k.push({token:Q,value:{pre:j,post:B,diff:B-j}})}return{assetChanges:k,block:L,results:F}}const g0="0x6492649264926492649264926492649264926492649264926492649264926492";function J6(e){if(Ht(e,-32)!==g0)throw new t5(e)}function Q6(e){const{data:t,signature:n,to:r}=e;return Dt(Xa(zd("address, bytes, bytes"),[r,t,n]),g0)}function e5(e){try{return J6(e),!0}catch{return!1}}class t5 extends ue{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 n5({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 l0.Signature(_t(e),_t(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:Wt(i)}async function zs(e,t){var c,a,l,u,f,p;const{address:n,hash:r,erc6492VerifierAddress:o=t.universalSignatureVerifierAddress??((l=(a=(c=e.chain)==null?void 0:c.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:l.address),multicallAddress:s=t.multicallAddress??((p=(f=(u=e.chain)==null?void 0:u.contracts)==null?void 0:f.multicall3)==null?void 0:p.address)}=t,i=(()=>{const d=t.signature;return Ot(d)?d:typeof d=="object"&&"r"in d&&"s"in d?n5(d):$e(d)})();try{return k6(i)?await r5(e,{...t,multicallAddress:s,signature:i}):await o5(e,{...t,verifierAddress:o,signature:i})}catch(d){try{if(Co(Nn(n),await cf({hash:r,signature:i})))return!0}catch{}if(d instanceof er)return!1;throw d}}async function r5(e,t){var g;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:c,data:a,signature:l,to:u}=$6(t.signature);if(await Va(e,{address:n,blockNumber:r,blockTag:o})===vr(["0xef0100",c.address]))return await s5(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:l});const p={address:c.address,chainId:Number(c.chainId),nonce:Number(c.nonce),r:ne(c.r,{size:32}),s:ne(c.s,{size:32}),yParity:c.yParity};if(!await Gv({address:n,authorization:p}))throw new er;const h=await te(e,Lt,"readContract")({...i?{address:i}:{code:Ca},authorizationList:[p],abi:Is,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:u??n,callData:a}]:[],{allowFailure:!0,target:n,callData:kt({abi:od,functionName:"isValidSignature",args:[s,l]})}]]}),m=(g=h[h.length-1])==null?void 0:g.returnData;if(m!=null&&m.startsWith("0x1626ba7e"))return!0;throw new er}async function o5(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:c,...a}=t,l=await(async()=>!r&&!o||e5(i)?i:Q6({data:o,signature:i,to:r}))(),u=c?{to:c,data:kt({abi:sd,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:$a({abi:sd,args:[n,s,l],bytecode:Qy}),...a},{data:f}=await te(e,Do,"call")(u).catch(p=>{throw p instanceof rf?new er:p});if(m1(f??"0x0"))return!0;throw new er}async function s5(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await te(e,Lt,"readContract")({address:n,abi:od,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof of?new er:a})).startsWith("0x1626ba7e"))return!0;throw new er}class er extends Error{}async function i5(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Cd(n);return te(e,zs,"verifyHash")({address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function a5(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:l,...u}=t,f=hw({message:i,primaryType:c,types:a,domain:l});return te(e,zs,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function y0(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=ke(["watchBlockNumber",e.uid,t,n,i]);return kn(f,{onBlockNumber:r,onError:o},p=>Bo(async()=>{var d;try{const h=await te(e,Lo,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(a===void 0||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=ke(["watchBlockNumber",e.uid,t,n]);return kn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const N=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return N?N.value:e.transport}return e.transport})(),{unsubscribe:g}=await m.subscribe({params:["newHeads"],onData(N){var P;if(!d)return;const x=_t((P=N.result)==null?void 0:P.number);p.onBlockNumber(x,a),a=x},onError(N){var x;(x=p.onError)==null||x.call(p,N)}});h=g,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function c5(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=ke(["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,p,d,h=!1,m,g;const{promise:N,resolve:x,reject:P}=ld(),C=a?setTimeout(()=>{g==null||g(),m==null||m(),P(new Ig({hash:o}))},a):void 0;return m=kn(l,{onReplaced:s,resolve:x,reject:P},async M=>{if(d=await te(e,Fs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(C),M.resolve(d),m==null||m();return}g=te(e,y0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(L){const F=y=>{clearTimeout(C),g==null||g(),y(),m==null||m()};let b=L;if(!h)try{if(d){if(r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;F(()=>M.resolve(d));return}if(n&&!f&&(h=!0,await Ba(async()=>{f=await te(e,hc,"getTransaction")({hash:o}),f.blockNumber&&(b=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await te(e,Fs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;F(()=>M.resolve(d))}catch(y){if(y instanceof tf||y instanceof nf){if(!f){h=!1;return}try{p=f,h=!0;const E=await Ba(()=>te(e,Mt,"getBlock")({blockNumber:b,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:$})=>$ instanceof mf});h=!1;const T=E.transactions.find(({from:$,nonce:D})=>$===p.from&&D===p.nonce);if(!T||(d=await te(e,Fs,"getTransactionReceipt")({hash:T.hash}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r)))return;let I="replaced";T.to===p.to&&T.value===p.value&&T.input===p.input?I="repriced":T.from===T.to&&T.value===0n&&(I="cancelled"),F(()=>{var $;($=M.onReplaced)==null||$.call(M,{reason:I,replacedTransaction:p,transaction:T,transactionReceipt:d}),M.resolve(d)})}catch(E){F(()=>M.reject(E))}}else F(()=>M.reject(y))}}})}),N}function l5(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=ke(["watchBlocks",e.uid,t,n,r,u,a]);return kn(h,{onBlock:o,onError:s},m=>Bo(async()=>{var g;try{const N=await te(e,Mt,"getBlock")({blockTag:t,includeTransactions:u});if(N.number!==null&&(f==null?void 0:f.number)!=null){if(N.number===f.number)return;if(N.number-f.number>1&&n)for(let x=(f==null?void 0:f.number)+1n;x<N.number;x++){const P=await te(e,Mt,"getBlock")({blockNumber:x,includeTransactions:u});m.onBlock(P,f),f=P}}((f==null?void 0:f.number)==null||t==="pending"&&(N==null?void 0:N.number)==null||N.number!==null&&N.number>f.number)&&(m.onBlock(N,f),f=N)}catch(N){(g=m.onError)==null||g.call(m,N)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,g=()=>h=!1;return(async()=>{try{r&&te(e,Mt,"getBlock")({blockTag:t,includeTransactions:u}).then(P=>{h&&m&&(o(P,void 0),m=!1)}).catch(s);const N=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(C=>C.config.type==="webSocket"||C.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:x}=await N.subscribe({params:["newHeads"],async onData(P){var M;if(!h)return;const C=await te(e,Mt,"getBlock")({blockNumber:(M=P.result)==null?void 0:M.number,includeTransactions:u}).catch(()=>{});h&&(o(C,f),m=!1,f=C)},onError(P){s==null||s(P)}});g=x,h||g()}catch(N){s==null||s(N)}})(),()=>g()})()}function u5(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 p=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")),d=f??!1;return p?(()=>{const g=ke(["watchEvent",t,n,r,e.uid,o,u,i]);return kn(g,{onLogs:a,onError:c},N=>{let x;i!==void 0&&(x=i-1n);let P,C=!1;const M=Bo(async()=>{var L;if(!C){try{P=await te(e,Sd,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}C=!0;return}try{let F;if(P)F=await te(e,$s,"getFilterChanges")({filter:P});else{const b=await te(e,Lo,"getBlockNumber")({});x&&x!==b?F=await te(e,ya,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:x+1n,toBlock:b}):F=[],x=b}if(F.length===0)return;if(r)N.onLogs(F);else for(const b of F)N.onLogs([b])}catch(F){P&&F instanceof On&&(C=!1),(L=N.onError)==null||L.call(N,F)}},{emitOnBegin:!0,interval:u});return async()=>{P&&await te(e,ks,"uninstallFilter")({filter:P}),M()}})})():(()=>{let g=!0,N=()=>g=!1;return(async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const L=e.transport.transports.find(F=>F.config.type==="webSocket"||F.config.type==="ipc");return L?L.value:e.transport}return e.transport})(),P=s??(o?[o]:void 0);let C=[];P&&(C=[P.flatMap(F=>eo({abi:[F],eventName:F.name,args:n}))],o&&(C=C[0]));const{unsubscribe:M}=await x.subscribe({params:["logs",{address:t,topics:C}],onData(L){var b;if(!g)return;const F=L.result;try{const{eventName:y,args:E}=Ss({abi:P??[],data:F.data,topics:F.topics,strict:d}),T=cn(F,{args:E,eventName:y});a([T])}catch(y){let E,T;if(y instanceof fs||y instanceof Ri){if(f)return;E=y.abiItem.name,T=(b=y.abiItem.inputs)==null?void 0:b.some($=>!("name"in $&&$.name))}const I=cn(F,{args:T?[]:{},eventName:E});a([I])}},onError(L){c==null||c(L)}});N=M,g||N()}catch(x){c==null||c(x)}})(),()=>N()})()}function f5(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=ke(["watchPendingTransactions",e.uid,t,s]);return kn(l,{onTransactions:r,onError:n},u=>{let f;const p=Bo(async()=>{var d;try{if(!f)try{f=await te(e,Pd,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await te(e,$s,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const m of h)u.onTransactions([m])}catch(h){(d=u.onError)==null||d.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await te(e,ks,"uninstallFilter")({filter:f}),p()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!l)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});u=f,l||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function d5(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(p5))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...l}=((p=e.match(h5))==null?void 0:p.groups)??{},u=(d=e.split("Resources:")[1])==null?void 0:d.split(`
|
|
91
|
-
- `).slice(1);return{...r,...
|
|
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(oa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class sa 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(sa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class ia 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(ia,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class aa extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(aa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class ws extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Xe(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Xe(r)} gwei`:""}).`].join(`
|
|
87
|
+
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(ws,"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 Ao extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function xs(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===Tr.code):e;return r instanceof V?new Tr({cause:e,message:r.details}):Tr.nodeMessage.test(n)?new Tr({cause:e,message:e.details}):vs.nodeMessage.test(n)?new vs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):ea.nodeMessage.test(n)?new ea({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):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,nonce:t==null?void 0:t.nonce}):oa.nodeMessage.test(n)?new oa({cause:e}):sa.nodeMessage.test(n)?new sa({cause:e,gas:t==null?void 0:t.gas}):ia.nodeMessage.test(n)?new ia({cause:e,gas:t==null?void 0:t.gas}):aa.nodeMessage.test(n)?new aa({cause:e}):ws.nodeMessage.test(n)?new ws({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Ao({cause:e})}function Gg(e,{docsPath:t,...n}){const r=(()=>{const o=xs(e,n);return o instanceof Ao?e:o})();return new Hg(r,{docsPath:t,...n})}function Es(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const l of i)l in e&&(n[l]=e[l]),s[l]&&typeof s[l]=="object"&&!Array.isArray(s[l])&&r(s[l])}const o=t(e||{});return r(o),n}const qg={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function No(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Kg(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=>$e(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=re(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=re(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=re(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=re(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=re(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=re(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=qg[e.type]),typeof e.value<"u"&&(n.value=re(e.value)),n}function Kg(e){return e.map(t=>({address:t.address,r:t.r?re(BigInt(t.r)):t.r,s:t.s?re(BigInt(t.s)):t.s,chainId:re(t.chainId),nonce:re(t.nonce),...typeof t.yParity<"u"?{yParity:re(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:re(t.v)}:{}}))}function pf(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Pu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Pu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Zg(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=re(t)),n!==void 0&&(i.nonce=re(n)),r!==void 0&&(i.state=pf(r)),o!==void 0){if(i.state)throw new Ng;i.stateDiff=pf(o)}return i}function la(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!bt(n,{strict:!1}))throw new An({address:n});if(t[n])throw new Ag({address:n});t[n]=Zg(r)}return t}const hf=2n**256n-1n;function Ar(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?lt(t):void 0;if(s&&!bt(s.address))throw new An({address:s.address});if(o&&!bt(o))throw new An({address:o});if(n&&n>hf)throw new vs({maxFeePerGas:n});if(r&&n&&r>n)throw new ws({maxFeePerGas:n,maxPriorityFeePerGas:r})}class mf 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 Yg extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Xe(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class bf 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 gf={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function ua(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?on(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?on(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?gf[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=Xg(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 Xg(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 yf(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:ua(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 Dt(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var c,u,f;const s=o??!1,i=n!==void 0?re(n):void 0;let l=null;if(t?l=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):l=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!l)throw new bf({blockHash:t,blockNumber:n});return(((f=(u=(c=e.chain)==null?void 0:c.formatters)==null?void 0:u.block)==null?void 0:f.format)||yf)(l,"getBlock")}async function fa(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Jg(e,t){return vf(e,t)}async function vf(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const l=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof l=="function"){const c=n||await ne(e,Dt,"getBlock")({}),u=await l({block:c,client:e,request:o});if(u===null)throw new Error;return u}if(typeof l<"u")return l;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Wt(a)}catch{const[l,a]=await Promise.all([n?Promise.resolve(n):ne(e,Dt,"getBlock")({}),ne(e,fa,"getGasPrice")({})]);if(typeof l.baseFeePerGas!="bigint")throw new ca;const c=a-l.baseFeePerGas;return c<0n?0n:c}}async function Qg(e,t){return da(e,t)}async function da(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new mf;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),c=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await ne(e,Dt,"getBlock")({});if(typeof((d=r==null?void 0:r.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:c,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new ca;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await vf(e,{block:u,chain:r,request:o}),m=c(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??c(await ne(e,fa,"getGasPrice")({}))}}async function wf(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?re(r):n]},{dedupe:!!r});return on(o)}function xf(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=>Vt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>$e(s))}function Ef(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=>Vt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>Vt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const l=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(l,a)))}return n==="bytes"?s:s.map(i=>$e(i))}function ey(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),l=Number(n&s),a=r?4:0,c=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+c,l,r)}function ty(e,t,n){return e&t^~e&n}function ny(e,t,n){return e&t^e&n^t&n}class ry extends zi{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=ji(this.buffer)}update(t){gr(this),t=ps(t),Vn(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const l=Math.min(o-this.pos,s-i);if(l===o){const a=ji(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+l),this.pos),this.pos+=l,i+=l,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){gr(this),Ou(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,yr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;ey(r,o-8,BigInt(this.length*8),s),this.process(r,0);const l=ji(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)l.setUint32(4*f,u[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:l}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=l,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const In=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),oy=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]),$n=new Uint32Array(64);class sy extends ry{constructor(t=32){super(64,t,8,!1),this.A=In[0]|0,this.B=In[1]|0,this.C=In[2]|0,this.D=In[3]|0,this.E=In[4]|0,this.F=In[5]|0,this.G=In[6]|0,this.H=In[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:l,H:a}=this;return[t,n,r,o,s,i,l,a]}set(t,n,r,o,s,i,l,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=l|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)$n[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=$n[f-15],d=$n[f-2],h=Ht(p,7)^Ht(p,18)^p>>>3,m=Ht(d,17)^Ht(d,19)^d>>>10;$n[f]=m+$n[f-7]+h+$n[f-16]|0}let{A:r,B:o,C:s,D:i,E:l,F:a,G:c,H:u}=this;for(let f=0;f<64;f++){const p=Ht(l,6)^Ht(l,11)^Ht(l,25),d=u+p+ty(l,a,c)+oy[f]+$n[f]|0,m=(Ht(r,2)^Ht(r,13)^Ht(r,22))+ny(r,o,s)|0;u=c,c=a,a=l,l=i+d|0,i=s,s=o,o=r,r=d+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,l=l+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,o,s,i,l,a,c,u)}roundClean(){yr($n)}destroy(){this.set(0,0,0,0,0,0,0,0),yr(this.buffer)}}const Sf=$u(()=>new sy),iy=Sf;function ay(e,t){return iy(It(e,{strict:!1})?mr(e):e)}function ly(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=ay(t);return o.set([n],0),r==="bytes"?o:$e(o)}function cy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(ly({commitment:s,to:r,version:n}));return o}const Pf=6,Tf=32,pa=4096,Af=Tf*pa,Nf=Af*Pf-1-1*pa*Pf;class uy extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class fy extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function dy(e){const t=typeof e.data=="string"?Vt(e.data):e.data,n=Pe(t);if(!n)throw new fy;if(n>Nf)throw new uy({maxSize:Nf,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Ki(new Uint8Array(Af));let l=0;for(;l<pa;){const a=t.slice(s,s+(Tf-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}l++,s+=31}r.push(i)}return r.map(i=>$e(i.bytes))}function py(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??dy({data:t}),s=e.commitments??xf({blobs:o,kzg:n,to:r}),i=e.proofs??Ef({blobs:o,commitments:s,kzg:n,to:r}),l=[];for(let a=0;a<o.length;a++)l.push({blob:o[a],commitment:s[a],proof:i[a]});return l}function hy(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 Og({transaction:e})}function my(e,{docsPath:t,...n}){const r=(()=>{const o=xs(e,n);return o instanceof Ao?e:o})();return new Ig(r,{docsPath:t,...n})}async function ha(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return on(t)}async function Cf(e,t){var b,v,E,$,I;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:l,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:h,nonceManager:m,to:g,type:N,value:x,...P}=t,C=await(async()=>{if(!n||!m||typeof h<"u")return h;const T=lt(n),B=s?s.id:await ne(e,ha,"getChainId")({});return await m.consume({address:T.address,chainId:B,client:e})})();Ar(t);const D=(v=(b=s==null?void 0:s.formatters)==null?void 0:b.transactionRequest)==null?void 0:v.format,L=(D||No)({...Es(P,{format:D}),account:n?lt(n):void 0,accessList:r,authorizationList:o,blobs:l,blobVersionedHashes:i,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:C,to:g,type:N,value:x},"fillTransaction");try{const T=await e.request({method:"eth_fillTransaction",params:[L]}),w=((($=(E=s==null?void 0:s.formatters)==null?void 0:E.transaction)==null?void 0:$.format)||ua)(T.tx);delete w.blockHash,delete w.blockNumber,delete w.r,delete w.s,delete w.transactionIndex,delete w.v,delete w.yParity,w.data=w.input,w.gas&&(w.gas=t.gas??w.gas),w.gasPrice&&(w.gasPrice=t.gasPrice??w.gasPrice),w.maxFeePerBlobGas&&(w.maxFeePerBlobGas=t.maxFeePerBlobGas??w.maxFeePerBlobGas),w.maxFeePerGas&&(w.maxFeePerGas=t.maxFeePerGas??w.maxFeePerGas),w.maxPriorityFeePerGas&&(w.maxPriorityFeePerGas=t.maxPriorityFeePerGas??w.maxPriorityFeePerGas),w.nonce&&(w.nonce=t.nonce??w.nonce);const O=await(async()=>{var j,z;if(typeof((j=s==null?void 0:s.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const _=await ne(e,Dt,"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(O<1)throw new mf;const S=10**(((I=O.toString().split(".")[1])==null?void 0:I.length)??0),M=j=>j*BigInt(Math.ceil(O*S))/BigInt(S);return w.maxFeePerGas&&!t.maxFeePerGas&&(w.maxFeePerGas=M(w.maxFeePerGas)),w.gasPrice&&!t.gasPrice&&(w.gasPrice=M(w.gasPrice)),{raw:T.raw,transaction:{from:L.from,...w}}}catch(T){throw my(T,{...t,chain:e.chain})}}const by=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Of=new Map,ma=new ms(128);async function If(e,t){var C,D,F;let n=t;const{account:r=e.account,chain:o=e.chain,nonceManager:s,parameters:i=by}=n,l=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function c(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await ne(e,ha,"getChainId")({}),a))}const u=r&<(r);let f=n.nonce;if(i.includes("nonce")&&typeof f>"u"&&u&&s){const L=await c();f=await s.consume({address:u.address,chainId:L,client:e})}l!=null&&l.fn&&((C=l.runAt)!=null&&C.includes("beforeFillTransaction"))&&(n=await l.fn(n,{phase:"beforeFillTransaction"}),f??(f=n.nonce));const d=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||ma.get(e.uid)===!1||!["fees","gas"].some(b=>i.includes(b))?!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 ne(e,Cf,"fillTransaction")({...n,nonce:f}).then(L=>{const{chainId:b,from:v,gas:E,gasPrice:$,nonce:I,maxFeePerBlobGas:T,maxFeePerGas:B,maxPriorityFeePerGas:w,type:O,...k}=L.transaction;return ma.set(e.uid,!0),{...n,...v?{from:v}:{},...O?{type:O}:{},...typeof b<"u"?{chainId:b}:{},...typeof E<"u"?{gas:E}:{},...typeof $<"u"?{gasPrice:$}:{},...typeof I<"u"?{nonce:I}:{},...typeof T<"u"?{maxFeePerBlobGas:T}:{},...typeof B<"u"?{maxFeePerGas:B}:{},...typeof w<"u"?{maxPriorityFeePerGas:w}:{},..."nonceKey"in k&&typeof k.nonceKey<"u"?{nonceKey:k.nonceKey}:{}}}).catch(L=>{var E;const b=L;return((E=b.walk)==null?void 0:E.call(b,$=>{const I=$;return I.name==="MethodNotFoundRpcError"||I.name==="MethodNotSupportedRpcError"}))&&ma.set(e.uid,!1),n}):n;f??(f=d.nonce),n={...d,...u?{from:u==null?void 0:u.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:m,kzg:g,type:N}=n;l!=null&&l.fn&&((D=l.runAt)!=null&&D.includes("beforeFillParameters"))&&(n=await l.fn(n,{phase:"beforeFillParameters"}));let x;async function P(){return x||(x=await ne(e,Dt,"getBlock")({blockTag:"latest"}),x)}if(i.includes("nonce")&&typeof f>"u"&&u&&!s&&(n.nonce=await ne(e,wf,"getTransactionCount")({address:u.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&g){const L=xf({blobs:h,kzg:g});if(i.includes("blobVersionedHashes")){const b=cy({commitments:L,to:"hex"});n.blobVersionedHashes=b}if(i.includes("sidecars")){const b=Ef({blobs:h,commitments:L,kzg:g}),v=py({blobs:h,commitments:L,proofs:b,to:"hex"});n.sidecars=v}}if(i.includes("chainId")&&(n.chainId=await c()),(i.includes("fees")||i.includes("type"))&&typeof N>"u")try{n.type=hy(n)}catch{let L=Of.get(e.uid);if(typeof L>"u"){const b=await P();L=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",Of.set(e.uid,L)}n.type=L?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const L=await P(),{maxFeePerGas:b,maxPriorityFeePerGas:v}=await da(e,{block:L,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<v)throw new Yg({maxPriorityFeePerGas:v});n.maxPriorityFeePerGas=v,n.maxFeePerGas=b}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new ca;if(typeof n.gasPrice>"u"){const L=await P(),{gasPrice:b}=await da(e,{block:L,chain:o,request:n,type:"legacy"});n.gasPrice=b}}return i.includes("gas")&&typeof m>"u"&&(n.gas=await ne(e,ba,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),l!=null&&l.fn&&((F=l.runAt)!=null&&F.includes("afterFillParameters"))&&(n=await l.fn(n,{phase:"afterFillParameters"})),Ar(n),delete n.parameters,n}async function ba(e,t){var i,l,a;const{account:n=e.account,prepare:r=!0}=t,o=n?lt(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const c=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await df({authorization:t.authorizationList[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,blockNumber:h,blockTag:m,data:g,gas:N,gasPrice:x,maxFeePerBlobGas:P,maxFeePerGas:C,maxPriorityFeePerGas:D,nonce:F,value:L,stateOverride:b,...v}=r?await If(e,{...t,parameters:s,to:c}):t;if(N&&t.gas!==N)return N;const $=(typeof h=="bigint"?re(h):void 0)||m,I=la(b);Ar(t);const T=(a=(l=(i=e.chain)==null?void 0:i.formatters)==null?void 0:l.transactionRequest)==null?void 0:a.format,w=(T||No)({...Es(v,{format:T}),account:o,accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,data:g,gasPrice:x,maxFeePerBlobGas:P,maxFeePerGas:C,maxPriorityFeePerGas:D,nonce:F,to:c,value:L},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:I?[w,$??e.experimental_blockTag??"latest",I]:$?[w,$]:[w]}))}catch(c){throw Gg(c,{...t,account:o,chain:e.chain})}}async function gy(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...l}=t,a=Mt({abi:n,args:o,functionName:s});try{return await ne(e,ba,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...l})}catch(c){const u=l.account?lt(l.account):void 0;throw Pr(c,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:u==null?void 0:u.address})}}function Co(e,t){if(!bt(e,{strict:!1}))throw new An({address:e});if(!bt(t,{strict:!1}))throw new An({address:t});return e.toLowerCase()===t.toLowerCase()}const $f="/docs/contract/decodeEventLog";function Ss(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...l]=o;if(!i)throw new o1({docsPath:$f});const a=t.find(m=>m.type==="event"&&i===hs(Ot(m)));if(!(a&&"name"in a)||a.type!=="event")throw new s1(i,{docsPath:$f});const{name:c,inputs:u}=a,f=u==null?void 0:u.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=u.map((m,g)=>[m,g]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[g,N]=d[m],x=l[m];if(!x)throw new Ri({abiItem:a,param:g});p[f?N:g.name||N]=yy({param:g,value:x})}const h=u.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=to(h,n);if(m)if(f)for(let g=0;g<u.length;g++)p[g]=p[g]??m.shift();else for(let g=0;g<h.length;g++)p[h[g].name]=m[g]}catch(m){if(s)throw m instanceof bu||m instanceof Xu?new fs({abiItem:a,data:n,params:h,size:Pe(n)}):m}else if(s)throw new fs({abiItem:a,data:"0x",params:h,size:0})}return{eventName:c,args:Object.values(p).length>0?p:void 0}}function yy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(to([e],t)||[])[0]}function ga(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var u;const l=t.filter(f=>f.type==="event"&&i.topics[0]===hs(f));if(l.length===0)return null;let a,c;for(const f of l)try{a=Ss({...i,abi:[f],strict:!0}),c=f;break}catch{}if(!a&&!o){c=l[0];try{a=Ss({...i,abi:[c],strict:!1})}catch{const f=(u=c.inputs)==null?void 0:u.some(p=>!("name"in p&&p.name));return{...i,args:f?[]:{},eventName:c.name}}}return!a||!c||s&&!s.includes(a.eventName)||!vy({args:a.args,inputs:c.inputs,matchArgs:n})?null:{...a,...i}}).filter(Boolean)}function vy(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,l){try{return s.type==="address"?Co(i,l):s.type==="string"||s.type==="bytes"?Fe(mr(i))===l:i===l}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const l=n[i];return l?(Array.isArray(s)?s:[s]).some(c=>o(l,c,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const l=n.find(c=>c.name===s);return l?(Array.isArray(i)?i:[i]).some(c=>o(l,c,t[s])):!1}):!1}function ln(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}:{}}}async function ya(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:l,strict:a}={}){const c=a??!1,u=i??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(m=>eo({abi:[m],eventName:m.name,args:i?void 0:l}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?re(r):r,toBlock:typeof o=="bigint"?re(o):o}]});const d=p.map(h=>ln(h));return u?ga({abi:u,args:l,logs:d,strict:c}):d}async function kf(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:l,toBlock:a,strict:c}=t,u=i?Hn({abi:n,name:i}):void 0,f=u?void 0:n.filter(p=>p.type==="event");return ne(e,ya,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:l,toBlock:a,strict:c})}const va="/docs/contract/decodeFunctionResult";function Zn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const l=Hn({abi:t,args:n,name:r});if(!l)throw new pr(r,{docsPath:va});s=l}if(s.type!=="function")throw new pr(void 0,{docsPath:va});if(!s.outputs)throw new wu(s.name,{docsPath:va});const i=to(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 wa=BigInt(0),xa=BigInt(1);function Oo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ea(e){if(!Oo(e))throw new Error("Uint8Array expected")}function Io(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function Ps(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Mf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?wa:BigInt("0x"+e)}const Df=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",wy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function $o(e){if(Ea(e),Df)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=wy[e[n]];return t}const cn={_0:48,_9:57,A:65,F:70,a:97,f:102};function Bf(e){if(e>=cn._0&&e<=cn._9)return e-cn._0;if(e>=cn.A&&e<=cn.F)return e-(cn.A-10);if(e>=cn.a&&e<=cn.f)return e-(cn.a-10)}function Ts(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Df)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=Bf(e.charCodeAt(s)),l=Bf(e.charCodeAt(s+1));if(i===void 0||l===void 0){const a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[o]=i*16+l}return r}function Yn(e){return Mf($o(e))}function Lf(e){return Ea(e),Mf($o(Uint8Array.from(e).reverse()))}function ko(e,t){return Ts(e.toString(16).padStart(t*2,"0"))}function Ff(e,t){return ko(e,t).reverse()}function gt(e,t,n){let r;if(typeof t=="string")try{r=Ts(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Oo(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 As(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Ea(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 Sa=e=>typeof e=="bigint"&&wa<=e;function Pa(e,t,n){return Sa(e)&&Sa(t)&&Sa(n)&&t<=e&&e<n}function Nr(e,t,n,r){if(!Pa(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function xy(e){let t;for(t=0;e>wa;e>>=xa,t+=1);return t}const Ns=e=>(xa<<BigInt(e))-xa,Ta=e=>new Uint8Array(e),Rf=e=>Uint8Array.from(e);function Ey(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=Ta(e),o=Ta(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},l=(...f)=>n(o,r,...f),a=(f=Ta(0))=>{o=l(Rf([0]),f),r=l(),f.length!==0&&(o=l(Rf([1]),f),r=l())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const p=[];for(;f<t;){r=l();const d=r.slice();p.push(d),f+=r.length}return As(...p)};return(f,p)=>{i(),a(f);let d;for(;!(d=p(c()));)a();return i(),d}}const Sy={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"||Oo(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 Cs(e,t,n={}){const r=(o,s,i)=>{const l=Sy[s];if(typeof l!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!l(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function jf(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const Py="0.1.1";function Ty(){return Py}class ce extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof ce){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof ce&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,l=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
|
|
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,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Ty()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return zf(this,t)}}function zf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?zf(e.cause,t):t?null:e}function Mo(e,t){if(Cr(e)>t)throw new _y({givenSize:Cr(e),maxSize:t})}const un={zero:48,nine:57,A:65,F:70,a:97,f:102};function Uf(e){if(e>=un.zero&&e<=un.nine)return e-un.zero;if(e>=un.A&&e<=un.F)return e-(un.A-10);if(e>=un.a&&e<=un.f)return e-(un.a-10)}function Ay(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Wy({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 _f(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 Os(e,t){if(ut(e)>t)throw new Zy({givenSize:ut(e),maxSize:t})}function Ny(e,t){if(typeof t=="number"&&t>0&&t>ut(e)-1)throw new Qf({offset:t,position:"start",size:ut(e)})}function Cy(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ut(e)!==n-t)throw new Qf({offset:n,position:"end",size:ut(e)})}function Wf(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 Yy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Oy="#__bigint";function Vf(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+Oy:o,n)}const Iy=new TextDecoder,$y=new TextEncoder;function ky(e){return e instanceof Uint8Array?e:typeof e=="string"?Hf(e):My(e)}function My(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Hf(e,t={}){const{size:n}=t;let r=e;n&&(Os(e,n),r=Jn(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let l=0,a=0;l<s;l++){const c=Uf(o.charCodeAt(a++)),u=Uf(o.charCodeAt(a++));if(c===void 0||u===void 0)throw new ce(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[l]=c*16+u}return i}function Dy(e,t={}){const{size:n}=t,r=$y.encode(e);return typeof n=="number"?(Mo(r,n),By(r,n)):r}function By(e,t){return Ay(e,{dir:"right",size:t})}function Cr(e){return e.length}function Ly(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function Fy(e,t={}){const{size:n}=t;typeof n<"u"&&Mo(e,n);const r=Lt(e,t);return Kf(r,t)}function Ry(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Mo(r,n),r=Gf(r)),r.length>1||r[0]>1)throw new Uy(r);return!!r[0]}function fn(e,t={}){const{size:n}=t;typeof n<"u"&&Mo(e,n);const r=Lt(e,t);return Zf(r,t)}function jy(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Mo(r,n),r=zy(r)),Iy.decode(r)}function Gf(e){return _f(e,{dir:"left"})}function zy(e){return _f(e,{dir:"right"})}class Uy extends ce{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 _y=class extends ce{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"})}},Wy=class extends ce{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 Vy=new TextEncoder,Hy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Gy(e,t={}){const{strict:n=!1}=t;if(!e)throw new Xf(e);if(typeof e!="string")throw new Xf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Jf(e);if(!e.startsWith("0x"))throw new Jf(e)}function Bt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function qy(e){return e instanceof Uint8Array?Lt(e):Array.isArray(e)?Lt(new Uint8Array(e)):e}function qf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Os(n,t.size),Xn(n,t.size)):n}function Lt(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Hy[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Os(r,t.size),Jn(r,t.size)):r}function We(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const c=typeof e=="bigint"?"n":"";throw new Yf({max:s?`${s}${c}`:void 0,min:`${i}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Xn(a,r):a}function Aa(e,t={}){return Lt(Vy.encode(e),t)}function Xn(e,t){return Wf(e,{dir:"left",size:t})}function Jn(e,t){return Wf(e,{dir:"right",size:t})}function Gt(e,t,n,r={}){const{strict:o}=r;Ny(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&Cy(s,t,n),s}function ut(e){return Math.ceil((e.length-2)/2)}function Kf(e,t={}){const{signed:n}=t;t.size&&Os(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 Zf(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:Kf(e,t))}function Ky(e,t={}){const{strict:n=!1}=t;try{return Gy(e,{strict:n}),!0}catch{return!1}}class Yf extends ce{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 Xf extends ce{constructor(t){super(`Value \`${typeof t=="object"?Vf(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 Jf extends ce{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 Zy extends ce{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 Qf extends ce{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 Yy extends ce{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 Xy(e){return{address:e.address,amount:We(e.amount),index:We(e.index),validatorIndex:We(e.validatorIndex)}}function ed(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:We(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:We(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:We(e.gasLimit)},...typeof e.number=="bigint"&&{number:We(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:We(e.prevRandao)},...typeof e.time=="bigint"&&{time:We(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Xy)}}}const Is=[{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:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],Na=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],td=[{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"}],nd=[...td,{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"}]}],Jy=[...td,{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"}]}],rd=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],od=[{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"}]}],sd=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],id=[{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"}],Or=[{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"}]}],Qy="0x82ad56cb",ad="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",ev="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",tv="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Ca="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class Oa 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 ld extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const Ia="/docs/contract/encodeDeployData";function $a(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Qb({docsPath:Ia});if(!("inputs"in o))throw new mu({docsPath:Ia});if(!o.inputs||o.inputs.length===0)throw new mu({docsPath:Ia});const s=Cn(o.inputs,n);return vr([r,s])}function Ir({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 Oa({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Oa({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function cd(e,{docsPath:t,...n}){const r=(()=>{const o=xs(e,n);return o instanceof Ao?e:o})();return new of(r,{docsPath:t,...n})}function ud(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const ka=new Map;function fd({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const u=a();i();const f=u.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<u.length;d++){const{resolve:h}=u[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<u.length;d++){const{reject:h}=u[d];h==null||h(p)}})},i=()=>ka.delete(t),l=()=>a().map(({args:u})=>u),a=()=>ka.get(t)||[],c=u=>ka.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:p,reject:d}=ud();return(n==null?void 0:n([...l(),u]))&&s(),a().length>0?(c({args:u,resolve:p,reject:d}),f):(c({args:u,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Do(e,t){var T,B,w,O;const{account:n=e.account,authorizationList:r,batch:o=!!((T=e.batch)!=null&&T.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:l,blobs:a,blockOverrides:c,code:u,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:N,maxPriorityFeePerGas:x,nonce:P,to:C,value:D,stateOverride:F,...L}=t,b=n?lt(n):void 0;if(u&&(p||d))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&C)throw new V("Cannot provide both `code` & `to` as parameters.");const v=u&&f,E=p&&d&&C&&f,$=v||E,I=v?dd({code:u,data:f}):E?ov({data:f,factory:p,factoryData:d,to:C}):f;try{Ar(t);const S=(typeof s=="bigint"?re(s):void 0)||i,M=c?ed(c):void 0,j=la(F),z=(O=(w=(B=e.chain)==null?void 0:B.formatters)==null?void 0:w.transactionRequest)==null?void 0:O.format,q=(z||No)({...Es(L,{format:z}),accessList:l,account:b,authorizationList:r,blobs:a,data:I,gas:h,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:N,maxPriorityFeePerGas:x,nonce:P,to:$?void 0:C,value:D},"call");if(o&&nv({request:q})&&!j&&!M)try{return await rv(e,{...q,blockNumber:s,blockTag:i})}catch(W){if(!(W instanceof ld)&&!(W instanceof Oa))throw W}const Q=(()=>{const W=[q,S];return j&&M?[...W,j,M]:j?[...W,j]:M?[...W,{},M]:W})(),K=await e.request({method:"eth_call",params:Q});return K==="0x"?{data:void 0}:{data:K}}catch(k){const S=sv(k),{offchainLookup:M,offchainLookupSignature:j}=await Promise.resolve().then(()=>rw);if(e.ccipRead!==!1&&(S==null?void 0:S.slice(0,10))===j&&C)return{data:await M(e,{data:S,to:C})};throw $&&(S==null?void 0:S.slice(0,10))==="0x101bb98d"?new Bg({factory:p}):cd(k,{...t,account:b,chain:e.chain})}}function nv({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Qy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function rv(e,t){var m;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:l,to:a}=t,c=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Ir({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new ld})(),f=(typeof s=="bigint"?re(s):void 0)||i,{schedule:p}=fd({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(g){return g.reduce((x,{data:P})=>x+(P.length-2),0)>n*2},fn:async g=>{const N=g.map(C=>({allowFailure:!0,callData:C.data,target:C.to})),x=Mt({abi:Is,args:[N],functionName:"aggregate3"}),P=await e.request({method:"eth_call",params:[{...c===null?{data:dd({code:Ca,data:x})}:{to:c,data:x}},f]});return Zn({abi:Is,args:[N],functionName:"aggregate3",data:P||"0x"})}}),[{returnData:d,success:h}]=await p({data:l,to:a});if(!h)throw new ys({data:d});return d==="0x"?{data:void 0}:{data:d}}function dd(e){const{code:t,data:n}=e;return $a({abi:uu(["constructor(bytes, bytes)"]),bytecode:ad,args:[t,n]})}function ov(e){const{data:t,factory:n,factoryData:r,to:o}=e;return $a({abi:uu(["constructor(address, bytes, address, bytes)"]),bytecode:ev,args:[o,t,n,r]})}function sv(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 Ft(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,l=Mt({abi:n,args:o,functionName:s});try{const{data:a}=await ne(e,Do,"call")({...i,data:l,to:r});return Zn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw Pr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function iv(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...l}=t,a=l.account?lt(l.account):e.account,c=Mt({abi:n,args:o,functionName:i});try{const{data:u}=await ne(e,Do,"call")({batch:!1,data:`${c}${s?s.replace("0x",""):""}`,to:r,...l,account:a}),f=Zn({abi:n,args:o,functionName:i,data:u||"0x"}),p=n.filter(d=>"name"in d&&d.name===t.functionName);return{result:f,request:{abi:p,address:r,args:o,dataSuffix:s,functionName:i,...l,account:a}}}catch(u){throw Pr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const Ma=new Map,pd=new Map;let av=0;function kn(e,t,n){const r=++av,o=()=>Ma.get(e)||[],s=()=>{const u=o();Ma.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(p=>p.id===r))return;const f=pd.get(e);if(u.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},l=o();if(Ma.set(e,[...l,{id:r,fns:t}]),l&&l.length>0)return i;const a={};for(const u in t)a[u]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[u])==null||h.call(d,...f)};const c=n(a);return typeof c=="function"&&pd.set(e,c),i}async function Da(e){return new Promise(t=>setTimeout(t,e))}function Bo(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let l;t&&(l=await e({unpoll:s}));const a=await(n==null?void 0:n(l))??r;await Da(a);const c=async()=>{o&&(await e({unpoll:s}),await Da(r),c())};c()})(),s}const lv=new Map,cv=new Map;function uv(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,lv),r=t(e,cv);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function fv(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=uv(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 dv=e=>`blockNumber.${e}`;async function Lo(e,{cacheTime:t=e.cacheTime}={}){const n=await fv(()=>e.request({method:"eth_blockNumber"}),{cacheKey:dv(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=>ln(s));return!("abi"in t)||!t.abi?o:ga({abi:t.abi,logs:o,strict:n})}async function ks(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function pv(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:l,onError:a,onLogs:c,poll:u,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof u<"u"?u:typeof l=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const g=p??!1,N=ke(["watchContractEvent",r,o,s,e.uid,i,f,g,l]);return kn(N,{onLogs:c,onError:a},x=>{let P;l!==void 0&&(P=l-1n);let C,D=!1;const F=Bo(async()=>{var L;if(!D){try{C=await ne(e,qu,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:g,fromBlock:l})}catch{}D=!0;return}try{let b;if(C)b=await ne(e,$s,"getFilterChanges")({filter:C});else{const v=await ne(e,Lo,"getBlockNumber")({});P&&P<v?b=await ne(e,kf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:P+1n,toBlock:v,strict:g}):b=[],P=v}if(b.length===0)return;if(s)x.onLogs(b);else for(const v of b)x.onLogs([v])}catch(b){C&&b instanceof On&&(D=!1),(L=x.onError)==null||L.call(x,b)}},{emitOnBegin:!0,interval:f});return async()=>{C&&await ne(e,ks,"uninstallFilter")({filter:C}),F()}})})():(()=>{const g=p??!1,N=ke(["watchContractEvent",r,o,s,e.uid,i,f,g]);let x=!0,P=()=>x=!1;return kn(N,{onLogs:c,onError:a},C=>((async()=>{try{const D=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(v=>v.config.type==="webSocket"||v.config.type==="ipc");return b?b.value:e.transport}return e.transport})(),F=i?eo({abi:n,eventName:i,args:o}):[],{unsubscribe:L}=await D.subscribe({params:["logs",{address:r,topics:F}],onData(b){var E;if(!x)return;const v=b.result;try{const{eventName:$,args:I}=Ss({abi:n,data:v.data,topics:v.topics,strict:p}),T=ln(v,{args:I,eventName:$});C.onLogs([T])}catch($){let I,T;if($ instanceof fs||$ instanceof Ri){if(p)return;I=$.abiItem.name,T=(E=$.abiItem.inputs)==null?void 0:E.some(w=>!("name"in w&&w.name))}const B=ln(v,{args:T?[]:{},eventName:I});C.onLogs([B])}},onError(b){var v;(v=C.onError)==null||v.call(C,b)}});P=L,x||P()}catch(D){a==null||a(D)}})(),()=>P()))})()}async function hv(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Ba(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:l=0}={})=>{const a=async({error:c})=>{const u=typeof t=="function"?t({count:l,error:c}):t;u&&await Da(u),i({count:l+1})};try{const c=await e();o(c)}catch(c){if(l<n&&await r({count:l,error:c}))return a({error:c});s(c)}};i()})}const mv={"0x0":"reverted","0x1":"success"};function hd(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=>ln(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?on(e.transactionIndex):null,status:e.status?mv[e.status]:null,type:e.type?gf[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 Ms=La,Ds;function md(e=11){if(!Ds||Ms+e>La*2){Ds="",Ms=0;for(let t=0;t<La;t++)Ds+=(256+Math.random()*256|0).toString(16).substring(1)}return Ds.substring(Ms,Ms+++e)}function bv(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,l=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,c=Math.min(Math.max(Math.floor(a/2),500),4e3),u=e.pollingInterval??c,f=e.cacheTime??u,p=e.account?lt(e.account):void 0,{config:d,request:h,value:m}=e.transport({account:p,chain:n,pollingInterval:u}),g={...d,...m},N={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:u,request:h,transport:g,type:i,uid:md(),...l?{experimental_blockTag:l}:{}};function x(P){return C=>{const D=C(P);for(const L in N)delete D[L];const F={...P,...D};return Object.assign(F,{extend:x(F)})}}return Object.assign(N,{extend:x(N)})}function Fa(e){var n,r,o,s,i,l;if(!(e instanceof V))return!1;const t=e.walk(a=>a instanceof Ji);return t instanceof Ji?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((l=t.data)==null?void 0:l.errorName)==="UnsupportedResolverProfile":!1}function gv(e){const{abi:t,data:n}=e,r=wr(n,0,4),o=t.find(s=>s.type==="function"&&r===Qr(Ot(s)));if(!o)throw new i1(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?to(o.inputs,wr(n,4)):void 0}}const Ra="/docs/contract/encodeErrorResult";function bd(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Hn({abi:t,args:r,name:n});if(!a)throw new gu(n,{docsPath:Ra});o=a}if(o.type!=="error")throw new gu(void 0,{docsPath:Ra});const s=Ot(o),i=Qr(s);let l="0x";if(r&&r.length>0){if(!o.inputs)throw new r1(o.name,{docsPath:Ra});l=Cn(o.inputs,r)}return vr([i,l])}const ja="/docs/contract/encodeFunctionResult";function yv(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Hn({abi:t,name:n});if(!i)throw new pr(n,{docsPath:ja});o=i}if(o.type!=="function")throw new pr(void 0,{docsPath:ja});if(!o.outputs)throw new wu(o.name,{docsPath:ja});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new xu(r)})();return Cn(o.outputs,s)}const Fo="x-batch-gateway:true";async function gd(e){const{data:t,ccipRequest:n}=e,{args:[r]}=gv({abi:Na,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,l)=>{try{s[l]=i.urls.includes(Fo)?await gd({data:i.data,ccipRequest:n}):await n(i),o[l]=!1}catch(a){o[l]=!0,s[l]=vv(a)}})),yv({abi:Na,functionName:"query",result:[o,s]})}function vv(e){return e.name==="HttpRequestError"&&e.status?bd({abi:Na,errorName:"HttpError",args:[e.status,e.shortMessage]}):bd({abi:[Zu],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function yd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return It(t)?t:null}function za(e){let t=new Uint8Array(32).fill(0);if(!e)return $e(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=yd(n[r]),s=o?mr(o):Fe(Wn(n[r]),"bytes");t=Fe(kt([t,s]),"bytes")}return $e(t)}function wv(e){return`[${e.slice(2)}]`}function xv(e){const t=new Uint8Array(32).fill(0);return e?yd(e)||Fe(Wn(e)):$e(t)}function Ua(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Wn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Wn(o[s]);i.byteLength>255&&(i=Wn(wv(xv(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 Ev(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Ir({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(p=>s.endsWith(p)))return null;const f=o!=null?[za(s),BigInt(o)]:[za(s)];try{const p=Mt({abi:od,functionName:"addr",args:f}),d={address:c,abi:nd,functionName:"resolveWithGateways",args:[Tn(Ua(s)),p,i??[Fo]],blockNumber:n,blockTag:r},m=await ne(e,Ft,"readContract")(d);if(m[0]==="0x")return null;const g=Zn({abi:od,args:f,functionName:"addr",data:m[0]});return g==="0x"||_n(g)==="0x00"?null:g}catch(p){if(l)throw p;if(Fa(p))return null;throw p}}class Sv 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 Ro 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 Pv extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const Tv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Av=/^(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>\/.*)?$/,Nv=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Cv=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Ov(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 vd(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function wd({uri:e,gatewayUrls:t}){const n=Nv.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=vd(t==null?void 0:t.ipfs,"https://ipfs.io"),o=vd(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(Tv),{protocol:i,subpath:l,target:a,subtarget:c=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||l==="ipns/",f=i==="ipfs:/"||l==="ipfs/"||Av.test(e);if(e.startsWith("http")&&!u&&!f){let d=e;return t!=null&&t.arweave&&(d=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:d,isOnChain:!1,isEncoded:!1}}if((u||f)&&a)return{uri:`${r}/${u?"ipns":"ipfs"}/${a}${c}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${c||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(Cv,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new _a({uri:e})}function xd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Sv({data:e});return e.image||e.image_url||e.image_data}async function Iv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Wa({gatewayUrls:e,uri:xd(n)})}catch{throw new _a({uri:t})}}async function Wa({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=wd({uri:t,gatewayUrls:e});if(r||await Ov(n))return n;throw new _a({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(":"),[l,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new Ro({reason:"Only EIP-155 supported"});if(!i)throw new Ro({reason:"Chain ID not found"});if(!a)throw new Ro({reason:"Contract address not found"});if(!o)throw new Ro({reason:"Token ID not found"});if(!l)throw new Ro({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:l.toLowerCase(),contractAddress:a,tokenID:o}}async function kv(e,{nft:t}){if(t.namespace==="erc721")return Ft(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 Ft(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 Pv({namespace:t.namespace})}async function Mv(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Dv(e,{gatewayUrls:t,record:n}):Wa({uri:n,gatewayUrls:t})}async function Dv(e,{gatewayUrls:t,record:n}){const r=$v(n),o=await kv(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:l}=wd({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const c=l?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(c);return Wa({uri:xd(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Iv({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Ed(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Ir({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(f=>s.endsWith(f)))return null;try{const f={address:c,abi:nd,args:[Tn(Ua(s)),Mt({abi:rd,functionName:"text",args:[za(s),o]}),i??[Fo]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},d=await ne(e,Ft,"readContract")(f);if(d[0]==="0x")return null;const h=Zn({abi:rd,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(l)throw f;if(Fa(f))return null;throw f}}async function Bv(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:l}){const a=await ne(e,Ed,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:l,gatewayUrls:s,strict:i});if(!a)return null;try{return await Mv(e,{record:a,gatewayUrls:r})}catch{return null}}async function Lv(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Ir({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const u={address:c,abi:Jy,args:[n,s,i??[Fo]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=ne(e,Ft,"readContract"),[p]=await f(u);return p||null}catch(u){if(l)throw u;if(Fa(u))return null;throw u}}async function Fv(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 Ir({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),l=s==null?void 0:s.ensTlds;if(l&&!l.some(c=>o.endsWith(c)))throw new Error(`${o} is not a valid ENS TLD (${l==null?void 0:l.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await ne(e,Ft,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Tn(Ua(o))],blockNumber:n,blockTag:r});return a}async function Sd(e,t){var g,N,x;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?lt(n):void 0;try{Ar(t);const C=(typeof r=="bigint"?re(r):void 0)||o,D=(x=(N=(g=e.chain)==null?void 0:g.formatters)==null?void 0:N.transactionRequest)==null?void 0:x.format,L=(D||No)({...Es(h,{format:D}),account:m,blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d},"createAccessList"),b=await e.request({method:"eth_createAccessList",params:[L,C]});return{accessList:b.accessList,gasUsed:BigInt(b.gasUsed)}}catch(P){throw cd(P,{...t,account:m,chain:e.chain})}}async function Rv(e){const t=gs(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Pd(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:l}={}){const a=o??(r?[r]:void 0),c=gs(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(d=>eo({abi:[d],eventName:d.name,args:n}))],r&&(u=u[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?re(s):s,toBlock:typeof l=="bigint"?re(l):l,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:c(f),strict:!!i,toBlock:l,type:"event"}}async function Td(e){const t=gs(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function jv(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?re(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function zv(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Uv(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?re(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}),on(s)}async function Va(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?re(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class _v 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 Wv(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,l,a,c,u,f]=await ne(e,Ft,"readContract")({abi:Vv,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:l,chainId:Number(a),verifyingContract:c,salt:u},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new _v({address:n}):i}}const Vv=[{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 Hv(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 Gv(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?re(n):void 0,i=await e.request({method:"eth_feeHistory",params:[re(t),s||r,o]},{dedupe:!!s});return Hv(i)}async function qv(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>ln(s));return t.abi?ga({abi:t.abi,logs:o,strict:n}):o}async function Kv({address:e,authorization:t,signature:n}){return Co(Nn(e),await df({authorization:t,signature:n}))}const Bs=new ms(8192);function Zv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Bs.get(n))return Bs.get(n);const r=e().finally(()=>Bs.delete(n));return Bs.set(n,r),r}function Yv(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:l=3,uid:a}={...t,...r},{method:c}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(c))throw new Kn(new Error("method not supported"),{method:c});if(s!=null&&s.include&&!s.include.includes(c))throw new Kn(new Error("method not supported"),{method:c});const u=o?Yr(`${a}.${ke(n)}`):void 0;return Zv(()=>Ba(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d,{method:n.method});case lo.code:throw new lo(d);case qn.code:throw new qn(d);case On.code:throw new On(d);case co.code:throw new co(d);case uo.code:throw new uo(d);case fo.code:throw new fo(d);case Kn.code:throw new Kn(d,{method:n.method});case Er.code:throw new Er(d);case po.code:throw new po(d);case Sr.code:throw new Sr(d);case ho.code:throw new ho(d);case mo.code:throw new mo(d);case bo.code:throw new bo(d);case go.code:throw new go(d);case yo.code:throw new yo(d);case vo.code:throw new vo(d);case wo.code:throw new wo(d);case xo.code:throw new xo(d);case Eo.code:throw new Eo(d);case So.code:throw new So(d);case Po.code:throw new Po(d);case To.code:throw new To(d);case 5e3:throw new Sr(d);default:throw p instanceof V?p:new Fg(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Gn){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m,10)*1e3}return~~(1<<p)*i},retryCount:l,shouldRetry:({error:p})=>Xv(p)}),{enabled:o,id:u})}}function Xv(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Er.code||e.code===qn.code:e instanceof Gn&&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 Jv extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var l;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(l=n.metaMessages)!=null&&l.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${oo(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: ${oo(n)}`,`Response: ${ke(t)}`],name:"OffchainLookupResponseMalformedError"})}}class ew extends V{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const tw="0x556f1830",Ad={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function nw(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Qu({data:r,abi:[Ad]}),[i,l,a,c,u]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Nd;try{if(!Co(o,i))throw new ew({sender:i,to:o});const d=l.includes(Fo)?await gd({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:l}),{data:h}=await Do(e,{blockNumber:t,blockTag:n,data:kt([c,Cn([{type:"bytes"},{type:"bytes"}],[d,u])]),to:o});return h}catch(d){throw new Jv({callbackSelector:c,cause:d,data:r,extraData:u,sender:i,urls:l})}}async function Nd({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],l=i.includes("{data}")?"GET":"POST",a=l==="POST"?{data:e,sender:t}:void 0,c=l==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:c,method:l});let f;if((o=u.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await u.json()).data:f=await u.text(),!u.ok){r=new Gn({body:a,details:f!=null&&f.error?ke(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!It(f)){r=new Qv({result:f,url:i});continue}return f}catch(u){r=new Gn({body:a,details:u.message,url:i})}}throw r}const rw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Nd,offchainLookup:nw,offchainLookupAbiItem:Ad,offchainLookupSignature:tw},Symbol.toStringTag,{value:"Module"}));function ow(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}function sw(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const l=new AbortController;n>0&&(i=setTimeout(()=>{r&&l.abort()},n)),o(await e({signal:(l==null?void 0:l.signal)||null}))}catch(l){(l==null?void 0:l.name)==="AbortError"&&s(t),s(l)}finally{clearTimeout(i)}})()})}function iw(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Cd=iw();function aw(e,t={}){return{async request(n){var p;const{body:r,fetchFn:o=t.fetchFn??fetch,onRequest:s=t.onRequest,onResponse:i=t.onResponse,timeout:l=t.timeout??1e4}=n,a={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:c,method:u,signal:f}=a;try{const d=await sw(async({signal:m})=>{const g={...a,body:Array.isArray(r)?ke(r.map(C=>({jsonrpc:"2.0",id:C.id??Cd.take(),...C}))):ke({jsonrpc:"2.0",id:r.id??Cd.take(),...r}),headers:{"Content-Type":"application/json",...c},method:u||"POST",signal:f||(l>0?m:null)},N=new Request(e,g),x=await(s==null?void 0:s(N,g))??{...g,url:e};return await o(x.url??e,x)},{errorInstance:new af({body:r,url:e}),timeout:l,signal:!0});i&&await i(d);let h;if((p=d.headers.get("Content-Type"))!=null&&p.startsWith("application/json"))h=await d.json();else{h=await d.text();try{h=JSON.parse(h||"{}")}catch(m){if(d.ok)throw m;h={error:h}}}if(!d.ok)throw new Gn({body:r,details:ke(h.error)||d.statusText,headers:d.headers,status:d.status,url:e});return h}catch(d){throw d instanceof Gn||d instanceof af?d:new Gn({body:r,cause:d,url:e})}}}}const lw=`Ethereum Signed Message:
|
|
89
|
+
`;function cw(e){const t=typeof e=="string"?Yr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=Yr(`${lw}${Pe(t)}`);return kt([n,t])}function Od(e,t){return Fe(cw(e),t)}class uw extends V{constructor({domain:t}){super(`Invalid domain "${ke(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class fw 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 dw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function pw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,l)=>{for(const a of i){const{name:c,type:u}=a,f=l[c],p=u.match(Wu);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,g,N]=p;re(f,{signed:g==="int",size:Number.parseInt(N,10)/8})}if(u==="address"&&typeof f=="string"&&!bt(f))throw new An({address:f});const d=u.match(eg);if(d){const[m,g]=d;if(g&&Pe(f)!==Number.parseInt(g,10))throw new l1({expectedSize:Number.parseInt(g,10),givenSize:Pe(f)})}const h=o[u];h&&(mw(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new uw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new fw({primaryType:r,types:o})}function hw({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function mw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new dw({type:e})}function bw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:hw({domain:t}),...e.types};pw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(gw({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Id({data:n,primaryType:r,types:o})),Fe(kt(s))}function gw({domain:e,types:t}){return Id({data:e,primaryType:"EIP712Domain",types:t})}function Id({data:e,primaryType:t,types:n}){const r=$d({data:e,primaryType:t,types:n});return Fe(r)}function $d({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[yw({primaryType:t,types:n})];for(const s of n[t]){const[i,l]=Md({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(l)}return Cn(r,o)}function yw({primaryType:e,types:t}){const n=Tn(vw({primaryType:e,types:t}));return Fe(n)}function vw({primaryType:e,types:t}){let n="";const r=kd({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const s of o)n+=`${s}(${t[s].map(({name:i,type:l})=>`${l} ${i}`).join(",")})`;return n}function kd({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])kd({primaryType:s.type,types:t},n);return n}function Md({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Fe($d({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},Fe(r)];if(n==="string")return[{type:"bytes32"},Fe(Tn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Md({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Fe(Cn(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class ww 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 Ha={checksum:new ww(8192)}.checksum;function Dd(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Ru(ky(e));return n==="Bytes"?r:Lt(r)}const xw=/^0x[a-fA-F0-9]{40}$/;function Ls(e,t={}){const{strict:n=!0}=t;if(!xw.test(e))throw new Ld({address:e,cause:new Ew});if(n){if(e.toLowerCase()===e)return;if(Bd(e)!==e)throw new Ld({address:e,cause:new Sw})}}function Bd(e){if(Ha.has(e))return Ha.get(e);Ls(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Dd(Dy(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 Ha.set(e,o),o}function Ga(e,t={}){const{strict:n=!0}=t??{};try{return Ls(e,{strict:n}),!0}catch{return!1}}class Ld extends ce{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 Ew extends ce{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 Sw extends ce{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const Pw=/^(.*)\[([0-9]*)\]$/,Tw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Fd=/^(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)?$/,Rd=2n**256n-1n;function $r(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=Ya(t.type);if(s){const[i,l]=s;return Nw(e,{...t,type:l},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return $w(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return Aw(e,{checksum:r});if(t.type==="bool")return Cw(e);if(t.type.startsWith("bytes"))return Ow(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Iw(e,t);if(t.type==="string")return kw(e,{staticPosition:o});throw new Qa(t.type)}const jd=32,qa=32;function Aw(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Bd(s):s)(Lt(Ly(r,-20))),32]}function Nw(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=fn(e.readBytes(qa)),c=s+a,u=c+jd;e.setPosition(c);const f=fn(e.readBytes(jd)),p=jo(t);let d=0;const h=[];for(let m=0;m<f;++m){e.setPosition(u+(p?m*32:d));const[g,N]=$r(e,t,{checksumAddress:r,staticPosition:u});d+=N,h.push(g)}return e.setPosition(s+32),[h,32]}if(jo(t)){const a=fn(e.readBytes(qa)),c=s+a,u=[];for(let f=0;f<o;++f){e.setPosition(c+f*32);const[p]=$r(e,t,{checksumAddress:r,staticPosition:c});u.push(p)}return e.setPosition(s+32),[u,32]}let i=0;const l=[];for(let a=0;a<o;++a){const[c,u]=$r(e,t,{checksumAddress:r,staticPosition:s+i});i+=u,l.push(c)}return[l,i]}function Cw(e){return[Ry(e.readBytes(32),{size:32}),32]}function Ow(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=fn(e.readBytes(32));e.setPosition(n+i);const l=fn(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[Lt(a),32]}return[Lt(e.readBytes(Number.parseInt(o,10),32)),32]}function Iw(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?Fy(o,{signed:n}):fn(o,{signed:n}),32]}function $w(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let l=0;if(jo(t)){const a=fn(e.readBytes(qa)),c=o+a;for(let u=0;u<t.components.length;++u){const f=t.components[u];e.setPosition(c+l);const[p,d]=$r(e,f,{checksumAddress:r,staticPosition:c});l+=d,i[s?u:f==null?void 0:f.name]=p}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const c=t.components[a],[u,f]=$r(e,c,{checksumAddress:r,staticPosition:o});i[s?a:c==null?void 0:c.name]=u,l+=f}return[i,l]}function kw(e,{staticPosition:t}){const n=fn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=fn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=jy(Gf(s));return e.setPosition(t+32),[i,32]}function Mw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Ka({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Ka({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Ya(r.type);if(o){const[s,i]=o;return Bw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return zw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Dw(n,{checksum:e});if(r.type==="bool")return Fw(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Fd.exec(r.type)??[];return Rw(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Lw(n,{type:r.type});if(r.type==="string")return jw(n);throw new Qa(r.type)}function Za(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=ut(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(We(t+o,{size:32})),r.push(l),o+=ut(l)):n.push(l)}return Bt(...n,...r)}function Dw(e,t){const{checksum:n=!1}=t;return Ls(e,{strict:n}),{dynamic:!1,encoded:Xn(e.toLowerCase())}}function Bw(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new Zw(e);if(!s&&e.length!==r)throw new Kw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const l=[];for(let a=0;a<e.length;a++){const c=Ka({checksumAddress:n,parameter:o,value:e[a]});c.dynamic&&(i=!0),l.push(c)}if(s||i){const a=Za(l);if(s){const c=We(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?Bt(c,a):c}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Bt(...l.map(({encoded:a})=>a))}}function Lw(e,{type:t}){const[,n]=t.split("bytes"),r=ut(e);if(!n){let o=e;return r%32!==0&&(o=Jn(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Bt(Xn(We(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new _d({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Jn(e)}}function Fw(e){if(typeof e!="boolean")throw new ce(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xn(qf(e))}}function Rw(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 Yf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:We(e,{size:32,signed:t})}}function jw(e){const t=Aa(e),n=Math.ceil(ut(t)/32),r=[];for(let o=0;o<n;o++)r.push(Jn(Gt(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Bt(Jn(We(ut(t),{size:32})),...r)}}function zw(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const l=r.components[i],a=Array.isArray(e)?i:l.name,c=Ka({checksumAddress:n,parameter:l,value:e[a]});s.push(c),c.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Za(s):Bt(...s.map(({encoded:i})=>i))}}function Ya(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function jo(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(jo);const n=Ya(e.type);return!!(n&&jo({...e,type:n[1]}))}const Uw={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 Vw({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Ww({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new zd({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 zd({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 _w(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Uw);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class zd extends ce{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Ww extends ce{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 Vw extends ce{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 Hw(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?Hf(t):t,i=_w(s);if(Cr(s)===0&&e.length>0)throw new qw;if(Cr(s)&&Cr(s)<32)throw new Gw({data:typeof t=="string"?t:Lt(t),parameters:e,size:Cr(s)});let l=0;const a=r==="Array"?[]:{};for(let c=0;c<e.length;++c){const u=e[c];i.setPosition(l);const[f,p]=$r(i,u,{checksumAddress:o,staticPosition:0});l+=p,r==="Array"?a.push(f):a[u.name??c]=f}return a}function Xa(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Wd({expectedLength:e.length,givenLength:t.length});const o=Mw({checksumAddress:r,parameters:e,values:t}),s=Za(o);return s.length===0?"0x":s}function Ja(e,t){if(e.length!==t.length)throw new Wd({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(Ja.encode(o,s))}return Bt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Ls(a),Xn(a.toLowerCase(),o?32:0)}if(n==="string")return Aa(r);if(n==="bytes")return r;if(n==="bool")return Xn(qf(r),o?32:1);const s=n.match(Fd);if(s){const[a,c,u="256"]=s,f=Number.parseInt(u,10)/8;return We(r,{size:o?32:f,signed:c==="int"})}const i=n.match(Tw);if(i){const[a,c]=i;if(Number.parseInt(c,10)!==(r.length-2)/2)throw new _d({expectedSize:Number.parseInt(c,10),value:r});return Jn(r,o?32:0)}const l=n.match(Pw);if(l&&Array.isArray(r)){const[a,c]=l,u=[];for(let f=0;f<r.length;f++)u.push(t(c,r[f],!0));return u.length===0?"0x":Bt(...u)}throw new Qa(n)}e.encode=t})(Ja||(Ja={}));function Ud(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?du(e):e}class Gw extends ce{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${fr(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class qw extends ce{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Kw extends ce{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 ce{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ut(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Wd extends ce{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 Zw extends ce{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class Qa extends ce{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}class Vd extends zi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,I1(t);const r=ps(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),yr(s)}update(t){return gr(this),this.iHash.update(t),this}digestInto(t){gr(this),Vn(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:l}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=l,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Hd=(e,t,n)=>new Vd(e,t).update(n).digest();Hd.create=(e,t)=>new Vd(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Qe=BigInt(0),Ve=BigInt(1),Qn=BigInt(2),Yw=BigInt(3),Gd=BigInt(4),qd=BigInt(5),Kd=BigInt(8);function et(e,t){const n=e%t;return n>=Qe?n:t+n}function yt(e,t,n){let r=e;for(;t-- >Qe;)r*=r,r%=n;return r}function el(e,t){if(e===Qe)throw new Error("invert: expected non-zero number");if(t<=Qe)throw new Error("invert: expected positive modulus, got "+t);let n=et(e,t),r=t,o=Qe,s=Ve;for(;n!==Qe;){const l=r/n,a=r%n,c=o-s*l;r=n,n=a,o=s,s=c}if(r!==Ve)throw new Error("invert: does not exist");return et(o,t)}function Zd(e,t){const n=(e.ORDER+Ve)/Gd,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Xw(e,t){const n=(e.ORDER-qd)/Kd,r=e.mul(t,Qn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Qn),o),l=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(l),t))throw new Error("Cannot find square root");return l}function Jw(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Ve,n=0;for(;t%Qn===Qe;)t/=Qn,n++;let r=Qn;const o=tl(e);for(;Xd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Zd;let s=o.pow(r,t);const i=(t+Ve)/Qn;return function(a,c){if(a.is0(c))return c;if(Xd(a,c)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),p=a.pow(c,t),d=a.pow(c,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===u)throw new Error("Cannot find square root");const g=Ve<<BigInt(u-h-1),N=a.pow(f,g);u=h,f=a.sqr(N),p=a.mul(p,f),d=a.mul(d,N)}return d}}function Qw(e){return e%Gd===Yw?Zd:e%Kd===qd?Xw:Jw(e)}const e6=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function t6(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=e6.reduce((r,o)=>(r[o]="function",r),t);return Cs(e,n)}function n6(e,t,n){if(n<Qe)throw new Error("invalid exponent, negatives unsupported");if(n===Qe)return e.ONE;if(n===Ve)return t;let r=e.ONE,o=t;for(;n>Qe;)n&Ve&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Ve;return r}function Yd(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,l,a)=>e.is0(l)?i:(r[a]=i,e.mul(i,l)),e.ONE),s=e.inv(o);return t.reduceRight((i,l,a)=>e.is0(l)?i:(r[a]=e.mul(i,r[a]),e.mul(i,l)),s),r}function Xd(e,t){const n=(e.ORDER-Ve)/Qn,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 Jd(e,t){t!==void 0&&Xr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function tl(e,t,n=!1,r={}){if(e<=Qe)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=Jd(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const l=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:Ns(o),ZERO:Qe,ONE:Ve,create:a=>et(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return Qe<=a&&a<e},is0:a=>a===Qe,isOdd:a=>(a&Ve)===Ve,neg:a=>et(-a,e),eql:(a,c)=>a===c,sqr:a=>et(a*a,e),add:(a,c)=>et(a+c,e),sub:(a,c)=>et(a-c,e),mul:(a,c)=>et(a*c,e),pow:(a,c)=>n6(l,a,c),div:(a,c)=>et(a*el(c,e),e),sqrN:a=>a*a,addN:(a,c)=>a+c,subN:(a,c)=>a-c,mulN:(a,c)=>a*c,inv:a=>el(a,e),sqrt:r.sqrt||(a=>(i||(i=Qw(e)),i(l,a))),toBytes:a=>n?Ff(a,s):ko(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Lf(a):Yn(a)},invertBatch:a=>Yd(l,a),cmov:(a,c,u)=>u?c:a});return Object.freeze(l)}function Qd(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 e0(e){const t=Qd(e);return t+Math.ceil(t/2)}function r6(e,t,n=!1){const r=e.length,o=Qd(t),s=e0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Lf(e):Yn(e),l=et(i,t-Ve)+Ve;return n?Ff(l,o):ko(l,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t0=BigInt(0),nl=BigInt(1);function rl(e,t){const n=t.negate();return e?n:t}function n0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function ol(e,t){n0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Ns(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function r0(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let l=Number(e&o),a=e>>i;l>r&&(l-=s,a+=nl);const c=t*r,u=c+Math.abs(l)-1,f=l===0,p=l<0,d=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:c}}function o6(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 s6(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 sl=new WeakMap,o0=new WeakMap;function il(e){return o0.get(e)||1}function i6(e,t){return{constTimeNegate:rl,hasPrecomputes(n){return il(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>t0;)r&nl&&(o=o.add(s)),s=s.double(),r>>=nl;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=ol(r,t),i=[];let l=n,a=l;for(let c=0;c<o;c++){a=l,i.push(a);for(let u=1;u<s;u++)a=a.add(l),i.push(a);l=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const l=ol(n,t);for(let a=0;a<l.windows;a++){const{nextN:c,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:h}=r0(o,a,l);o=c,f?i=i.add(rl(d,r[h])):s=s.add(rl(p,r[u]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=ol(n,t);for(let l=0;l<i.windows&&o!==t0;l++){const{nextN:a,offset:c,isZero:u,isNeg:f}=r0(o,l,i);if(o=a,!u){const p=r[c];s=s.add(f?p.negate():p)}}return s},getPrecomputes(n,r,o){let s=sl.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&sl.set(r,o(s))),s},wNAFCached(n,r,o){const s=il(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=il(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){n0(r,t),o0.set(n,r),sl.delete(n)}}}function a6(e,t,n,r){o6(n,e),s6(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,l=xy(BigInt(o));let a=1;l>12?a=l-3:l>4?a=l-2:l>0&&(a=2);const c=Ns(a),u=new Array(Number(c)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){u.fill(i);for(let m=0;m<s;m++){const g=r[m],N=Number(g>>BigInt(d)&c);u[N]=u[N].add(n[m])}let h=i;for(let m=u.length-1,g=i;m>0;m--)g=g.add(u[m]),h=h.add(g);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function s0(e){return t6(e.Fp),Cs(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Jd(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function i0(e){e.lowS!==void 0&&Io("lowS",e.lowS),e.prehash!==void 0&&Io("prehash",e.prehash)}function l6(e){const t=s0(e);Cs(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 c6 extends Error{constructor(t=""){super(t)}}const dn={Err:c6,_tlv:{encode:(e,t)=>{const{Err:n}=dn;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=Ps(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Ps(o.length/2|128):"";return Ps(e)+s+o+t},decode(e,t){const{Err:n}=dn;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const c=t.subarray(r,r+a);if(c.length!==a)throw new n("tlv.decode: length bytes not complete");if(c[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of c)i=i<<8|u;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const l=t.subarray(r,r+i);if(l.length!==i)throw new n("tlv.decode: wrong value length");return{v:l,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=dn;if(e<pn)throw new t("integer: negative integers are not allowed");let n=Ps(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}=dn;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 Yn(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=dn,o=gt("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:l,l:a}=r.decode(2,s),{v:c,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(l),s:n.decode(c)}},hexFromSig(e){const{_tlv:t,_int:n}=dn,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 al(e,t){return $o(ko(e,t))}const pn=BigInt(0),De=BigInt(1);BigInt(2);const ll=BigInt(3),u6=BigInt(4);function f6(e){const t=l6(e),{Fp:n}=t,r=tl(t.n,t.nBitLength),o=t.toBytes||((P,C,D)=>{const F=C.toAffine();return As(Uint8Array.from([4]),n.toBytes(F.x),n.toBytes(F.y))}),s=t.fromBytes||(P=>{const C=P.subarray(1),D=n.fromBytes(C.subarray(0,n.BYTES)),F=n.fromBytes(C.subarray(n.BYTES,2*n.BYTES));return{x:D,y:F}});function i(P){const{a:C,b:D}=t,F=n.sqr(P),L=n.mul(F,P);return n.add(n.add(L,n.mul(P,C)),D)}function l(P,C){const D=n.sqr(C),F=i(P);return n.eql(D,F)}if(!l(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,ll),u6),c=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,c)))throw new Error("bad curve params: a or b");function u(P){return Pa(P,De,t.n)}function f(P){const{allowedPrivateKeyLengths:C,nByteLength:D,wrapPrivateKey:F,n:L}=t;if(C&&typeof P!="bigint"){if(Oo(P)&&(P=$o(P)),typeof P!="string"||!C.includes(P.length))throw new Error("invalid private key");P=P.padStart(D*2,"0")}let b;try{b=typeof P=="bigint"?P:Yn(gt("private key",P,D))}catch{throw new Error("invalid private key, expected hex or "+D+" bytes, got "+typeof P)}return F&&(b=et(b,L)),Nr("private key",b,De,L),b}function p(P){if(!(P instanceof m))throw new Error("ProjectivePoint expected")}const d=jf((P,C)=>{const{px:D,py:F,pz:L}=P;if(n.eql(L,n.ONE))return{x:D,y:F};const b=P.is0();C==null&&(C=b?n.ONE:n.inv(L));const v=n.mul(D,C),E=n.mul(F,C),$=n.mul(L,C);if(b)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:v,y:E}}),h=jf(P=>{if(P.is0()){if(t.allowInfinityPoint&&!n.is0(P.py))return;throw new Error("bad point: ZERO")}const{x:C,y:D}=P.toAffine();if(!n.isValid(C)||!n.isValid(D))throw new Error("bad point: x or y not FE");if(!l(C,D))throw new Error("bad point: equation left != right");if(!P.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class m{constructor(C,D,F){if(C==null||!n.isValid(C))throw new Error("x required");if(D==null||!n.isValid(D)||n.is0(D))throw new Error("y required");if(F==null||!n.isValid(F))throw new Error("z required");this.px=C,this.py=D,this.pz=F,Object.freeze(this)}static fromAffine(C){const{x:D,y:F}=C||{};if(!C||!n.isValid(D)||!n.isValid(F))throw new Error("invalid affine point");if(C instanceof m)throw new Error("projective point not allowed");const L=b=>n.eql(b,n.ZERO);return L(D)&&L(F)?m.ZERO:new m(D,F,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(C){const D=Yd(n,C.map(F=>F.pz));return C.map((F,L)=>F.toAffine(D[L])).map(m.fromAffine)}static fromHex(C){const D=m.fromAffine(s(gt("pointHex",C)));return D.assertValidity(),D}static fromPrivateKey(C){return m.BASE.multiply(f(C))}static msm(C,D){return a6(m,r,C,D)}_setWindowSize(C){x.setWindowSize(this,C)}assertValidity(){h(this)}hasEvenY(){const{y:C}=this.toAffine();if(n.isOdd)return!n.isOdd(C);throw new Error("Field doesn't support isOdd")}equals(C){p(C);const{px:D,py:F,pz:L}=this,{px:b,py:v,pz:E}=C,$=n.eql(n.mul(D,E),n.mul(b,L)),I=n.eql(n.mul(F,E),n.mul(v,L));return $&&I}negate(){return new m(this.px,n.neg(this.py),this.pz)}double(){const{a:C,b:D}=t,F=n.mul(D,ll),{px:L,py:b,pz:v}=this;let E=n.ZERO,$=n.ZERO,I=n.ZERO,T=n.mul(L,L),B=n.mul(b,b),w=n.mul(v,v),O=n.mul(L,b);return O=n.add(O,O),I=n.mul(L,v),I=n.add(I,I),E=n.mul(C,I),$=n.mul(F,w),$=n.add(E,$),E=n.sub(B,$),$=n.add(B,$),$=n.mul(E,$),E=n.mul(O,E),I=n.mul(F,I),w=n.mul(C,w),O=n.sub(T,w),O=n.mul(C,O),O=n.add(O,I),I=n.add(T,T),T=n.add(I,T),T=n.add(T,w),T=n.mul(T,O),$=n.add($,T),w=n.mul(b,v),w=n.add(w,w),T=n.mul(w,O),E=n.sub(E,T),I=n.mul(w,B),I=n.add(I,I),I=n.add(I,I),new m(E,$,I)}add(C){p(C);const{px:D,py:F,pz:L}=this,{px:b,py:v,pz:E}=C;let $=n.ZERO,I=n.ZERO,T=n.ZERO;const B=t.a,w=n.mul(t.b,ll);let O=n.mul(D,b),k=n.mul(F,v),S=n.mul(L,E),M=n.add(D,F),j=n.add(b,v);M=n.mul(M,j),j=n.add(O,k),M=n.sub(M,j),j=n.add(D,L);let z=n.add(b,E);return j=n.mul(j,z),z=n.add(O,S),j=n.sub(j,z),z=n.add(F,L),$=n.add(v,E),z=n.mul(z,$),$=n.add(k,S),z=n.sub(z,$),T=n.mul(B,j),$=n.mul(w,S),T=n.add($,T),$=n.sub(k,T),T=n.add(k,T),I=n.mul($,T),k=n.add(O,O),k=n.add(k,O),S=n.mul(B,S),j=n.mul(w,j),k=n.add(k,S),S=n.sub(O,S),S=n.mul(B,S),j=n.add(j,S),O=n.mul(k,j),I=n.add(I,O),O=n.mul(z,j),$=n.mul(M,$),$=n.sub($,O),O=n.mul(M,k),T=n.mul(z,T),T=n.add(T,O),new m($,I,T)}subtract(C){return this.add(C.negate())}is0(){return this.equals(m.ZERO)}wNAF(C){return x.wNAFCached(this,C,m.normalizeZ)}multiplyUnsafe(C){const{endo:D,n:F}=t;Nr("scalar",C,pn,F);const L=m.ZERO;if(C===pn)return L;if(this.is0()||C===De)return this;if(!D||x.hasPrecomputes(this))return x.wNAFCachedUnsafe(this,C,m.normalizeZ);let{k1neg:b,k1:v,k2neg:E,k2:$}=D.splitScalar(C),I=L,T=L,B=this;for(;v>pn||$>pn;)v&De&&(I=I.add(B)),$&De&&(T=T.add(B)),B=B.double(),v>>=De,$>>=De;return b&&(I=I.negate()),E&&(T=T.negate()),T=new m(n.mul(T.px,D.beta),T.py,T.pz),I.add(T)}multiply(C){const{endo:D,n:F}=t;Nr("scalar",C,De,F);let L,b;if(D){const{k1neg:v,k1:E,k2neg:$,k2:I}=D.splitScalar(C);let{p:T,f:B}=this.wNAF(E),{p:w,f:O}=this.wNAF(I);T=x.constTimeNegate(v,T),w=x.constTimeNegate($,w),w=new m(n.mul(w.px,D.beta),w.py,w.pz),L=T.add(w),b=B.add(O)}else{const{p:v,f:E}=this.wNAF(C);L=v,b=E}return m.normalizeZ([L,b])[0]}multiplyAndAddUnsafe(C,D,F){const L=m.BASE,b=(E,$)=>$===pn||$===De||!E.equals(L)?E.multiplyUnsafe($):E.multiply($),v=b(this,D).add(b(C,F));return v.is0()?void 0:v}toAffine(C){return d(this,C)}isTorsionFree(){const{h:C,isTorsionFree:D}=t;if(C===De)return!0;if(D)return D(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:C,clearCofactor:D}=t;return C===De?this:D?D(m,this):this.multiplyUnsafe(t.h)}toRawBytes(C=!0){return Io("isCompressed",C),this.assertValidity(),o(m,this,C)}toHex(C=!0){return Io("isCompressed",C),$o(this.toRawBytes(C))}}m.BASE=new m(t.Gx,t.Gy,n.ONE),m.ZERO=new m(n.ZERO,n.ONE,n.ZERO);const{endo:g,nBitLength:N}=t,x=i6(m,g?Math.ceil(N/2):N);return{CURVE:t,ProjectivePoint:m,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:u}}function d6(e){const t=s0(e);return Cs(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function p6(e){const t=d6(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,l=2*n.BYTES+1;function a(w){return et(w,r)}function c(w){return el(w,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:f,weierstrassEquation:p,isWithinCurveOrder:d}=f6({...t,toBytes(w,O,k){const S=O.toAffine(),M=n.toBytes(S.x),j=As;return Io("isCompressed",k),k?j(Uint8Array.from([O.hasEvenY()?2:3]),M):j(Uint8Array.from([4]),M,n.toBytes(S.y))},fromBytes(w){const O=w.length,k=w[0],S=w.subarray(1);if(O===i&&(k===2||k===3)){const M=Yn(S);if(!Pa(M,De,n.ORDER))throw new Error("Point is not on curve");const j=p(M);let z;try{z=n.sqrt(j)}catch(Q){const K=Q instanceof Error?": "+Q.message:"";throw new Error("Point is not on curve"+K)}const _=(z&De)===De;return(k&1)===1!==_&&(z=n.neg(z)),{x:M,y:z}}else if(O===l&&k===4){const M=n.fromBytes(S.subarray(0,n.BYTES)),j=n.fromBytes(S.subarray(n.BYTES,2*n.BYTES));return{x:M,y:j}}else{const M=i,j=l;throw new Error("invalid Point, expected length of "+M+", or uncompressed "+j+", got "+O)}}});function h(w){const O=r>>De;return w>O}function m(w){return h(w)?a(-w):w}const g=(w,O,k)=>Yn(w.slice(O,k));class N{constructor(O,k,S){Nr("r",O,De,r),Nr("s",k,De,r),this.r=O,this.s=k,S!=null&&(this.recovery=S),Object.freeze(this)}static fromCompact(O){const k=o;return O=gt("compactSignature",O,k*2),new N(g(O,0,k),g(O,k,2*k))}static fromDER(O){const{r:k,s:S}=dn.toSig(gt("DER",O));return new N(k,S)}assertValidity(){}addRecoveryBit(O){return new N(this.r,this.s,O)}recoverPublicKey(O){const{r:k,s:S,recovery:M}=this,j=L(gt("msgHash",O));if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");const z=M===2||M===3?k+t.n:k;if(z>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const _=M&1?"03":"02",q=u.fromHex(_+al(z,n.BYTES)),Q=c(z),K=a(-j*Q),W=a(S*Q),te=u.BASE.multiplyAndAddUnsafe(q,K,W);if(!te)throw new Error("point at infinify");return te.assertValidity(),te}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new N(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Ts(this.toDERHex())}toDERHex(){return dn.hexFromSig(this)}toCompactRawBytes(){return Ts(this.toCompactHex())}toCompactHex(){const O=o;return al(this.r,O)+al(this.s,O)}}const x={isValidPrivateKey(w){try{return f(w),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const w=e0(t.n);return r6(t.randomBytes(w),t.n)},precompute(w=8,O=u.BASE){return O._setWindowSize(w),O.multiply(BigInt(3)),O}};function P(w,O=!0){return u.fromPrivateKey(w).toRawBytes(O)}function C(w){if(typeof w=="bigint")return!1;if(w instanceof u)return!0;const k=gt("key",w).length,S=n.BYTES,M=S+1,j=2*S+1;if(!(t.allowedPrivateKeyLengths||o===M))return k===M||k===j}function D(w,O,k=!0){if(C(w)===!0)throw new Error("first arg must be private key");if(C(O)===!1)throw new Error("second arg must be public key");return u.fromHex(O).multiply(f(w)).toRawBytes(k)}const F=t.bits2int||function(w){if(w.length>8192)throw new Error("input is too large");const O=Yn(w),k=w.length*8-s;return k>0?O>>BigInt(k):O},L=t.bits2int_modN||function(w){return a(F(w))},b=Ns(s);function v(w){return Nr("num < 2^"+s,w,pn,b),ko(w,o)}function E(w,O,k=$){if(["recovered","canonical"].some(de=>de in k))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:M}=t;let{lowS:j,prehash:z,extraEntropy:_}=k;j==null&&(j=!0),w=gt("msgHash",w),i0(k),z&&(w=gt("prehashed msgHash",S(w)));const q=L(w),Q=f(O),K=[v(Q),v(q)];if(_!=null&&_!==!1){const de=_===!0?M(n.BYTES):_;K.push(gt("extraEntropy",de))}const W=As(...K),te=q;function be(de){const Ee=F(de);if(!d(Ee))return;const Z=c(Ee),H=u.BASE.multiply(Ee).toAffine(),X=a(H.x);if(X===pn)return;const ae=a(Z*a(te+X*Q));if(ae===pn)return;let ee=(H.x===X?0:2)|Number(H.y&De),ge=ae;return j&&h(ae)&&(ge=m(ae),ee^=1),new N(X,ge,ee)}return{seed:W,k2sig:be}}const $={lowS:t.lowS,prehash:!1},I={lowS:t.lowS,prehash:!1};function T(w,O,k=$){const{seed:S,k2sig:M}=E(w,O,k),j=t;return Ey(j.hash.outputLen,j.nByteLength,j.hmac)(S,M)}u.BASE._setWindowSize(8);function B(w,O,k,S=I){var ee;const M=w;O=gt("msgHash",O),k=gt("publicKey",k);const{lowS:j,prehash:z,format:_}=S;if(i0(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");const q=typeof M=="string"||Oo(M),Q=!q&&!_&&typeof M=="object"&&M!==null&&typeof M.r=="bigint"&&typeof M.s=="bigint";if(!q&&!Q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let K,W;try{if(Q&&(K=new N(M.r,M.s)),q){try{_!=="compact"&&(K=N.fromDER(M))}catch(ge){if(!(ge instanceof dn.Err))throw ge}!K&&_!=="der"&&(K=N.fromCompact(M))}W=u.fromHex(k)}catch{return!1}if(!K||j&&K.hasHighS())return!1;z&&(O=t.hash(O));const{r:te,s:be}=K,de=L(O),Ee=c(be),Z=a(de*Ee),H=a(te*Ee),X=(ee=u.BASE.multiplyAndAddUnsafe(W,Z,H))==null?void 0:ee.toAffine();return X?a(X.x)===te:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:D,sign:T,verify:B,ProjectivePoint:u,Signature:N,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function h6(e){return{hash:e,hmac:(t,...n)=>Hd(e,t,L1(...n)),randomBytes:F1}}function m6(e,t){const n=r=>p6({...e,...h6(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const a0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),l0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),b6=BigInt(0),g6=BigInt(1),cl=BigInt(2),c0=(e,t)=>(e+t/cl)/t;function y6(e){const t=a0,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),l=BigInt(44),a=BigInt(88),c=e*e*e%t,u=c*c*e%t,f=yt(u,n,t)*u%t,p=yt(f,n,t)*u%t,d=yt(p,cl,t)*c%t,h=yt(d,o,t)*d%t,m=yt(h,s,t)*h%t,g=yt(m,l,t)*m%t,N=yt(g,a,t)*g%t,x=yt(N,l,t)*m%t,P=yt(x,n,t)*u%t,C=yt(P,i,t)*h%t,D=yt(C,r,t)*c%t,F=yt(D,cl,t);if(!ul.eql(ul.sqr(F),e))throw new Error("Cannot find square root");return F}const ul=tl(a0,void 0,void 0,{sqrt:y6}),u0=m6({a:b6,b:BigInt(7),Fp:ul,n:l0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=l0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-g6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),l=c0(s*e,t),a=c0(-r*e,t);let c=et(e-l*n-a*o,t),u=et(-l*r-a*s,t);const f=c>i,p=u>i;if(f&&(c=t-c),p&&(u=t-u),c>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:c,k2neg:p,k2:u}}}},Sf),v6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:u0},Symbol.toStringTag,{value:"Module"}));function f0(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new dl({signature:e});if(typeof e.s>"u")throw new dl({signature:e});if(n&&typeof e.yParity>"u")throw new dl({signature:e});if(e.r<0n||e.r>Rd)throw new A6({value:e.r});if(e.s<0n||e.s>Rd)throw new N6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new pl({value:e.yParity})}function w6(e){return d0(Lt(e))}function d0(e){if(e.length!==130&&e.length!==132)throw new T6({signature:e});const t=BigInt(Gt(e,0,32)),n=BigInt(Gt(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return fl(o)}catch{throw new pl({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function x6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return E6(e)}function E6(e){const t=typeof e=="string"?d0(e):e instanceof Uint8Array?w6(e):typeof e.r=="string"?P6(e):e.v?S6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return f0(t),t}function S6(e){return{r:e.r,s:e.s,yParity:fl(e.v)}}function P6(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=fl(n)),typeof r!="number")throw new pl({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function fl(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 C6({value:e})}class T6 extends ce{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${ut(qy(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class dl extends ce{constructor({signature:t}){super(`Signature \`${Vf(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class A6 extends ce{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 N6 extends ce{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class pl extends ce{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 C6 extends ce{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 O6(e,t={}){return typeof e.chainId=="string"?I6(e):{...e,...t.signature}}function I6(e){const{address:t,chainId:n,nonce:r}=e,o=x6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const $6="0x8010801080108010801080108010801080108010801080108010801080108010",k6=Ud("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function p0(e){if(typeof e=="string"){if(Gt(e,-32)!==$6)throw new B6(e)}else f0(e.authorization)}function M6(e){p0(e);const t=Zf(Gt(e,-64,-32)),n=Gt(e,-t-64,-64),r=Gt(e,0,-t-64),[o,s,i]=Hw(k6,n);return{authorization:O6({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 D6(e){try{return p0(e),!0}catch{return!1}}let B6=class extends ce{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 L6 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function F6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new L6({value:e});let[n,r="0"]=e.split(".");const o=n.startsWith("-");if(o&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),t===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>t){const[s,i,l]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${l}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function R6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function j6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?on(e.nonce):void 0,storageProof:e.storageProof?R6(e.storageProof):void 0}}async function z6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?re(n):void 0,l=await e.request({method:"eth_getProof",params:[t,o,i||s]});return j6(l)}async function U6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?re(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function hl(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:l}){var p,d,h;const a=r||"latest",c=n!==void 0?re(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,re(s)]},{dedupe:!0}):typeof s=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||a,re(s)]},{dedupe:!!c}):i&&typeof l=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,re(l)]},{dedupe:!0})),!u)throw new nf({blockHash:t,blockNumber:n,blockTag:a,hash:o,index:s});return(((h=(d=(p=e.chain)==null?void 0:p.formatters)==null?void 0:d.transaction)==null?void 0:h.format)||ua)(u,"getTransaction")}async function _6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([ne(e,Lo,"getBlockNumber")({}),t?ne(e,hl,"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 Fs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new rf({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||hd)(n,"getTransactionReceipt")}async function W6(e,t){var x;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:l,stateOverride:a}=t,c=t.contracts,{batchSize:u=t.batchSize??1024,deployless:f=t.deployless??!1}=typeof((x=e.batch)==null?void 0:x.multicall)=="object"?e.batch.multicall:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return Ir({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),d=[[]];let h=0,m=0;for(let P=0;P<c.length;P++){const{abi:C,address:D,args:F,functionName:L}=c[P];try{const b=Mt({abi:C,args:F,functionName:L});m+=(b.length-2)/2,u>0&&m>u&&d[h].length>0&&(h++,m=(b.length-2)/2,d[h]=[]),d[h]=[...d[h],{allowFailure:!0,callData:b,target:D}]}catch(b){const v=Pr(b,{abi:C,address:D,args:F,docsPath:"/docs/contract/multicall",functionName:L,sender:n});if(!o)throw v;d[h]=[...d[h],{allowFailure:!0,callData:"0x",target:D}]}}const g=await Promise.allSettled(d.map(P=>ne(e,Ft,"readContract")({...p===null?{code:Ca}:{address:p},abi:Is,account:n,args:[P],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:l,functionName:"aggregate3",stateOverride:a}))),N=[];for(let P=0;P<g.length;P++){const C=g[P];if(C.status==="rejected"){if(!o)throw C.reason;for(let F=0;F<d[P].length;F++)N.push({status:"failure",error:C.reason,result:void 0});continue}const D=C.value;for(let F=0;F<D.length;F++){const{returnData:L,success:b}=D[F],{callData:v}=d[P][F],{abi:E,address:$,functionName:I,args:T}=c[N.length];try{if(v==="0x")throw new Zr;if(!b)throw new ys({data:L});const B=Zn({abi:E,args:T,data:L,functionName:I});N.push(o?{result:B,status:"success"}:B)}catch(B){const w=Pr(B,{abi:E,address:$,args:T,docsPath:"/docs/contract/multicall",functionName:I});if(!o)throw w;N.push({error:w,result:void 0,status:"failure"})}}}if(N.length!==c.length)throw new V("multicall results mismatch");return N}async function ml(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:l}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?ed(p.blockOverrides):void 0,h=p.calls.map(g=>{const N=g,x=N.account?lt(N.account):void 0,P=N.abi?Mt(N):N.data,C={...N,account:x,data:N.dataSuffix?kt([P||"0x",N.dataSuffix]):P,from:N.from??(x==null?void 0:x.address)};return Ar(C),No(C)}),m=p.stateOverrides?la(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const u=(typeof n=="bigint"?re(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:l},u]})).map((p,d)=>({...yf(p),calls:p.calls.map((h,m)=>{var E,$;const{abi:g,args:N,functionName:x,to:P}=o[d].calls[m],C=((E=h.error)==null?void 0:E.data)??h.returnData,D=BigInt(h.gasUsed),F=($=h.logs)==null?void 0:$.map(I=>ln(I)),L=h.status==="0x1"?"success":"failure",b=g&&L==="success"&&C!=="0x"?Zn({abi:g,data:C,functionName:x}):null,v=(()=>{var T;if(L==="success")return;let I;if(((T=h.error)==null?void 0:T.data)==="0x"?I=new Zr:h.error&&(I=new ys(h.error)),!!I)return Pr(I,{abi:g??[],address:P??"0x",args:N,functionName:x??"<unknown>"})})();return{data:C,gasUsed:D,logs:F,status:L,...L==="success"?{result:b}:{error:v}}})}))}catch(a){const c=a,u=xs(c,{});throw u instanceof Ao?c:u}}function bl(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function","error",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new ce("Unable to normalize signature.");return o}function gl(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Ga(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)=>gl(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=>gl(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function h0(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 h0(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")?Ga(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Ga(n[r],{strict:!1}):!1)return i}}function m0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?fu(e):e;return{...r,...n?{hash:kr(r)}:{}}}function Rs(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Ky(t,{strict:!1}),i=e.filter(c=>s?c.type==="function"||c.type==="error"?b0(c)===Gt(t,0,4):c.type==="event"?kr(c)===t:!1:"name"in c&&c.name===t);if(i.length===0)throw new js({name:t});if(i.length===1)return{...i[0],...o?{hash:kr(i[0])}:{}};let l;for(const c of i){if(!("inputs"in c))continue;if(!r||r.length===0){if(!c.inputs||c.inputs.length===0)return{...c,...o?{hash:kr(c)}:{}};continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in c&&c.inputs[p];return d?gl(f,d):!1})){if(l&&"inputs"in l&&l.inputs){const f=h0(c.inputs,l.inputs,r);if(f)throw new H6({abiItem:c,type:f[0]},{abiItem:l,type:f[1]})}l=c}}const a=(()=>{if(l)return l;const[c,...u]=i;return{...c,overloads:u}})();if(!a)throw new js({name:t});return{...a,...o?{hash:kr(a)}:{}}}function b0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Rs(n,r)}return e[0]})();return Gt(kr(t),0,4)}function V6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return Rs(r,o)}return e[0]})(),n=typeof t=="string"?t:ls(t);return bl(n)}function kr(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Rs(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Dd(Aa(V6(t)))}class H6 extends ce{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${bl(ls(t.abiItem))}\`, and`,`\`${n.type}\` in \`${bl(ls(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 js extends ce{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 G6(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,l]=e;return[K6(i),l]}return e})(),{bytecode:r,args:o}=n;return Bt(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?Xa(t.inputs,o):"0x")}function q6(e){return m0(e)}function K6(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new js({name:"constructor"});return t}function Z6(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[c,u,f]=e;return[g0(c,u,{args:f}),f]}const[l,a]=e;return[l,a]})(),{overloads:r}=t,o=r?g0([t,...r],t.name,{args:n}):t,s=Y6(o),i=n.length>0?Xa(o.inputs,n):void 0;return i?Bt(s,i):s}function Mr(e,t={}){return m0(e,t)}function g0(e,t,n){const r=Rs(e,t,n);if(r.type!=="function")throw new js({name:t,type:"function"});return r}function Y6(e){return b0(e)}const X6="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",qt="0x0000000000000000000000000000000000000000",J6="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function Q6(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:l,validation:a}=t,c=t.account?lt(t.account):void 0;if(i&&!c)throw new V("`account` is required when `traceAssetChanges` is true");const u=c?G6(q6("constructor(bytes, bytes)"),{bytecode:ad,args:[J6,Z6(Mr("function getBalance(address)"),[c.address])]}):void 0,f=i?await Promise.all(t.calls.map(async S=>{if(!S.data&&!S.abi)return;const{accessList:M}=await Sd(e,{account:c.address,...S,data:S.abi?Mt(S):S.data});return M.map(({address:j,storageKeys:z})=>z.length>0?j:null)})).then(S=>S.flat().filter(Boolean)):[],p=await ml(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((S,M)=>({abi:[Mr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:S,from:qt,nonce:M})),stateOverrides:[{address:qt,nonce:0}]}]:[],{calls:[...o,{}].map(S=>({...S,from:c==null?void 0:c.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((S,M)=>({abi:[Mr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:S,from:qt,nonce:M})),stateOverrides:[{address:qt,nonce:0}]},{calls:f.map((S,M)=>({to:S,abi:[Mr("function decimals() returns (uint256)")],functionName:"decimals",from:qt,nonce:M})),stateOverrides:[{address:qt,nonce:0}]},{calls:f.map((S,M)=>({to:S,abi:[Mr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:qt,nonce:M})),stateOverrides:[{address:qt,nonce:0}]},{calls:f.map((S,M)=>({to:S,abi:[Mr("function symbol() returns (string)")],functionName:"symbol",from:qt,nonce:M})),stateOverrides:[{address:qt,nonce:0}]}]:[]],traceTransfers:l,validation:a}),d=i?p[2]:p[0],[h,m,,g,N,x,P,C]=i?p:[],{calls:D,...F}=d,L=D.slice(0,-1)??[],b=(h==null?void 0:h.calls)??[],v=(m==null?void 0:m.calls)??[],E=[...b,...v].map(S=>S.status==="success"?Wt(S.data):null),$=(g==null?void 0:g.calls)??[],I=(N==null?void 0:N.calls)??[],T=[...$,...I].map(S=>S.status==="success"?Wt(S.data):null),B=((x==null?void 0:x.calls)??[]).map(S=>S.status==="success"?S.result:null),w=((C==null?void 0:C.calls)??[]).map(S=>S.status==="success"?S.result:null),O=((P==null?void 0:P.calls)??[]).map(S=>S.status==="success"?S.result:null),k=[];for(const[S,M]of T.entries()){const j=E[S];if(typeof M!="bigint"||typeof j!="bigint")continue;const z=B[S-1],_=w[S-1],q=O[S-1],Q=S===0?{address:X6,decimals:18,symbol:"ETH"}:{address:f[S-1],decimals:q||z?Number(z??1):void 0,symbol:_??void 0};k.some(K=>K.token.address===Q.address)||k.push({token:Q,value:{pre:j,post:M,diff:M-j}})}return{assetChanges:k,block:F,results:L}}const y0="0x6492649264926492649264926492649264926492649264926492649264926492";function e5(e){if(Gt(e,-32)!==y0)throw new r5(e)}function t5(e){const{data:t,signature:n,to:r}=e;return Bt(Xa(Ud("address, bytes, bytes"),[r,t,n]),y0)}function n5(e){try{return e5(e),!0}catch{return!1}}class r5 extends ce{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 o5({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 u0.Signature(Wt(e),Wt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:Vt(i)}async function zs(e,t){var l,a,c,u,f,p;const{address:n,hash:r,erc6492VerifierAddress:o=t.universalSignatureVerifierAddress??((c=(a=(l=e.chain)==null?void 0:l.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:c.address),multicallAddress:s=t.multicallAddress??((p=(f=(u=e.chain)==null?void 0:u.contracts)==null?void 0:f.multicall3)==null?void 0:p.address)}=t,i=(()=>{const d=t.signature;return It(d)?d:typeof d=="object"&&"r"in d&&"s"in d?o5(d):$e(d)})();try{return D6(i)?await s5(e,{...t,multicallAddress:s,signature:i}):await i5(e,{...t,verifierAddress:o,signature:i})}catch(d){try{if(Co(Nn(n),await cf({hash:r,signature:i})))return!0}catch{}if(d instanceof er)return!1;throw d}}async function s5(e,t){var g;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:l,data:a,signature:c,to:u}=M6(t.signature);if(await Va(e,{address:n,blockNumber:r,blockTag:o})===vr(["0xef0100",l.address]))return await a5(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:c});const p={address:l.address,chainId:Number(l.chainId),nonce:Number(l.nonce),r:re(l.r,{size:32}),s:re(l.s,{size:32}),yParity:l.yParity};if(!await Kv({address:n,authorization:p}))throw new er;const h=await ne(e,Ft,"readContract")({...i?{address:i}:{code:Ca},authorizationList:[p],abi:Is,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:u??n,callData:a}]:[],{allowFailure:!0,target:n,callData:Mt({abi:sd,functionName:"isValidSignature",args:[s,c]})}]]}),m=(g=h[h.length-1])==null?void 0:g.returnData;if(m!=null&&m.startsWith("0x1626ba7e"))return!0;throw new er}async function i5(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:l,...a}=t,c=await(async()=>!r&&!o||n5(i)?i:t5({data:o,signature:i,to:r}))(),u=l?{to:l,data:Mt({abi:id,functionName:"isValidSig",args:[n,s,c]}),...a}:{data:$a({abi:id,args:[n,s,c],bytecode:tv}),...a},{data:f}=await ne(e,Do,"call")(u).catch(p=>{throw p instanceof of?new er:p});if(g1(f??"0x0"))return!0;throw new er}async function a5(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await ne(e,Ft,"readContract")({address:n,abi:sd,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof sf?new er:a})).startsWith("0x1626ba7e"))return!0;throw new er}class er extends Error{}async function l5(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const l=Od(n);return ne(e,zs,"verifyHash")({address:t,factory:r,factoryData:o,hash:l,signature:s,...i})}async function c5(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:l,types:a,domain:c,...u}=t,f=bw({message:i,primaryType:l,types:a,domain:c});return ne(e,zs,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function v0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const l=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return l?(()=>{const f=ke(["watchBlockNumber",e.uid,t,n,i]);return kn(f,{onBlockNumber:r,onError:o},p=>Bo(async()=>{var d;try{const h=await ne(e,Lo,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(a===void 0||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=ke(["watchBlockNumber",e.uid,t,n]);return kn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const N=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return N?N.value:e.transport}return e.transport})(),{unsubscribe:g}=await m.subscribe({params:["newHeads"],onData(N){var P;if(!d)return;const x=Wt((P=N.result)==null?void 0:P.number);p.onBlockNumber(x,a),a=x},onError(N){var x;(x=p.onError)==null||x.call(p,N)}});h=g,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function u5(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:l=({count:D})=>~~(1<<D)*200,timeout:a=18e4}=t,c=ke(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var D;return t.pollingInterval?t.pollingInterval:(D=e.chain)!=null&&D.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,g;const{promise:N,resolve:x,reject:P}=ud(),C=a?setTimeout(()=>{g==null||g(),m==null||m(),P(new kg({hash:o}))},a):void 0;return m=kn(c,{onReplaced:s,resolve:x,reject:P},async D=>{if(d=await ne(e,Fs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(C),D.resolve(d),m==null||m();return}g=ne(e,v0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(F){const L=v=>{clearTimeout(C),g==null||g(),v(),m==null||m()};let b=F;if(!h)try{if(d){if(r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;L(()=>D.resolve(d));return}if(n&&!f&&(h=!0,await Ba(async()=>{f=await ne(e,hl,"getTransaction")({hash:o}),f.blockNumber&&(b=f.blockNumber)},{delay:l,retryCount:i}),h=!1),d=await ne(e,Fs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;L(()=>D.resolve(d))}catch(v){if(v instanceof nf||v instanceof rf){if(!f){h=!1;return}try{p=f,h=!0;const E=await Ba(()=>ne(e,Dt,"getBlock")({blockNumber:b,includeTransactions:!0}),{delay:l,retryCount:i,shouldRetry:({error:T})=>T instanceof bf});h=!1;const $=E.transactions.find(({from:T,nonce:B})=>T===p.from&&B===p.nonce);if(!$||(d=await ne(e,Fs,"getTransactionReceipt")({hash:$.hash}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r)))return;let I="replaced";$.to===p.to&&$.value===p.value&&$.input===p.input?I="repriced":$.from===$.to&&$.value===0n&&(I="cancelled"),L(()=>{var T;(T=D.onReplaced)==null||T.call(D,{reason:I,replacedTransaction:p,transaction:$,transactionReceipt:d}),D.resolve(d)})}catch(E){L(()=>D.reject(E))}}else L(()=>D.reject(v))}}})}),N}function f5(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:l,pollingInterval:a=e.pollingInterval}){const c=typeof l<"u"?l:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),u=i??!1;let f;return c?(()=>{const h=ke(["watchBlocks",e.uid,t,n,r,u,a]);return kn(h,{onBlock:o,onError:s},m=>Bo(async()=>{var g;try{const N=await ne(e,Dt,"getBlock")({blockTag:t,includeTransactions:u});if(N.number!==null&&(f==null?void 0:f.number)!=null){if(N.number===f.number)return;if(N.number-f.number>1&&n)for(let x=(f==null?void 0:f.number)+1n;x<N.number;x++){const P=await ne(e,Dt,"getBlock")({blockNumber:x,includeTransactions:u});m.onBlock(P,f),f=P}}((f==null?void 0:f.number)==null||t==="pending"&&(N==null?void 0:N.number)==null||N.number!==null&&N.number>f.number)&&(m.onBlock(N,f),f=N)}catch(N){(g=m.onError)==null||g.call(m,N)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,g=()=>h=!1;return(async()=>{try{r&&ne(e,Dt,"getBlock")({blockTag:t,includeTransactions:u}).then(P=>{h&&m&&(o(P,void 0),m=!1)}).catch(s);const N=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(C=>C.config.type==="webSocket"||C.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:x}=await N.subscribe({params:["newHeads"],async onData(P){var D;if(!h)return;const C=await ne(e,Dt,"getBlock")({blockNumber:(D=P.result)==null?void 0:D.number,includeTransactions:u}).catch(()=>{});h&&(o(C,f),m=!1,f=C)},onError(P){s==null||s(P)}});g=x,h||g()}catch(N){s==null||s(N)}})(),()=>g()})()}function d5(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:l,onLogs:a,poll:c,pollingInterval:u=e.pollingInterval,strict:f}){const p=typeof c<"u"?c:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),d=f??!1;return p?(()=>{const g=ke(["watchEvent",t,n,r,e.uid,o,u,i]);return kn(g,{onLogs:a,onError:l},N=>{let x;i!==void 0&&(x=i-1n);let P,C=!1;const D=Bo(async()=>{var F;if(!C){try{P=await ne(e,Pd,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}C=!0;return}try{let L;if(P)L=await ne(e,$s,"getFilterChanges")({filter:P});else{const b=await ne(e,Lo,"getBlockNumber")({});x&&x!==b?L=await ne(e,ya,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:x+1n,toBlock:b}):L=[],x=b}if(L.length===0)return;if(r)N.onLogs(L);else for(const b of L)N.onLogs([b])}catch(L){P&&L instanceof On&&(C=!1),(F=N.onError)==null||F.call(N,L)}},{emitOnBegin:!0,interval:u});return async()=>{P&&await ne(e,ks,"uninstallFilter")({filter:P}),D()}})})():(()=>{let g=!0,N=()=>g=!1;return(async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(L=>L.config.type==="webSocket"||L.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),P=s??(o?[o]:void 0);let C=[];P&&(C=[P.flatMap(L=>eo({abi:[L],eventName:L.name,args:n}))],o&&(C=C[0]));const{unsubscribe:D}=await x.subscribe({params:["logs",{address:t,topics:C}],onData(F){var b;if(!g)return;const L=F.result;try{const{eventName:v,args:E}=Ss({abi:P??[],data:L.data,topics:L.topics,strict:d}),$=ln(L,{args:E,eventName:v});a([$])}catch(v){let E,$;if(v instanceof fs||v instanceof Ri){if(f)return;E=v.abiItem.name,$=(b=v.abiItem.inputs)==null?void 0:b.some(T=>!("name"in T&&T.name))}const I=ln(L,{args:$?[]:{},eventName:E});a([I])}},onError(F){l==null||l(F)}});N=D,g||N()}catch(x){l==null||l(x)}})(),()=>N()})()}function p5(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const c=ke(["watchPendingTransactions",e.uid,t,s]);return kn(c,{onTransactions:r,onError:n},u=>{let f;const p=Bo(async()=>{var d;try{if(!f)try{f=await ne(e,Td,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await ne(e,$s,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const m of h)u.onTransactions([m])}catch(h){(d=u.onError)==null||d.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await ne(e,ks,"uninstallFilter")({filter:f}),p()}})})():(()=>{let c=!0,u=()=>c=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!c)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});u=f,c||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function h5(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(m5))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:l,requestId:a,...c}=((p=e.match(b5))==null?void 0:p.groups)??{},u=(d=e.split("Resources:")[1])==null?void 0:d.split(`
|
|
91
|
+
- `).slice(1);return{...r,...c,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...l?{notBefore:new Date(l)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const m5=/^(?:(?<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)?/,b5=/(?: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 g5(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||!bt(r.address,{strict:!1})||t&&!Co(r.address,t))return!1}catch{return!1}return!0}async function y5(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:l,time:a=new Date,...c}=t,u=h5(o);if(!u.address||!g5({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const p=Od(o);return zs(e,{address:u.address,hash:p,signature:l,...c})}async function v5(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var l,a,c;const o=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,re(r)]:[t]},{retryCount:0}),i=(((c=(a=(l=e.chain)==null?void 0:l.formatters)==null?void 0:a.transactionReceipt)==null?void 0:c.format)||hd)(o);if(i.status==="reverted"&&n)throw new $g({receipt:i});return i}function w5(e){return{call:t=>Do(e,t),createAccessList:t=>Sd(e,t),createBlockFilter:()=>Rv(e),createContractEventFilter:t=>qu(e,t),createEventFilter:t=>Pd(e,t),createPendingTransactionFilter:()=>Td(e),estimateContractGas:t=>gy(e,t),estimateGas:t=>ba(e,t),getBalance:t=>jv(e,t),getBlobBaseFee:()=>zv(e),getBlock:t=>Dt(e,t),getBlockNumber:t=>Lo(e,t),getBlockTransactionCount:t=>Uv(e,t),getBytecode:t=>Va(e,t),getChainId:()=>ha(e),getCode:t=>Va(e,t),getContractEvents:t=>kf(e,t),getEip712Domain:t=>Wv(e,t),getEnsAddress:t=>Ev(e,t),getEnsAvatar:t=>Bv(e,t),getEnsName:t=>Lv(e,t),getEnsResolver:t=>Fv(e,t),getEnsText:t=>Ed(e,t),getFeeHistory:t=>Gv(e,t),estimateFeesPerGas:t=>Qg(e,t),getFilterChanges:t=>$s(e,t),getFilterLogs:t=>qv(e,t),getGasPrice:()=>fa(e),getLogs:t=>ya(e,t),getProof:t=>z6(e,t),estimateMaxPriorityFeePerGas:t=>Jg(e,t),fillTransaction:t=>Cf(e,t),getStorageAt:t=>U6(e,t),getTransaction:t=>hl(e,t),getTransactionConfirmations:t=>_6(e,t),getTransactionCount:t=>wf(e,t),getTransactionReceipt:t=>Fs(e,t),multicall:t=>W6(e,t),prepareTransactionRequest:t=>If(e,t),readContract:t=>Ft(e,t),sendRawTransaction:t=>hv(e,t),sendRawTransactionSync:t=>v5(e,t),simulate:t=>ml(e,t),simulateBlocks:t=>ml(e,t),simulateCalls:t=>Q6(e,t),simulateContract:t=>iv(e,t),verifyHash:t=>zs(e,t),verifyMessage:t=>l5(e,t),verifySiweMessage:t=>y5(e,t),verifyTypedData:t=>c5(e,t),uninstallFilter:t=>ks(e,t),waitForTransactionReceipt:t=>u5(e,t),watchBlocks:t=>f5(e,t),watchBlockNumber:t=>v0(e,t),watchContractEvent:t=>pv(e,t),watchEvent:t=>d5(e,t),watchPendingTransactions:t=>p5(e,t)}}function x5(e){const{key:t="public",name:n="Public Client"}=e;return bv({...e,key:t,name:n,type:"publicClient"}).extend(w5)}function E5({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:l},a){const c=md();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:l},request:Yv(r,{methods:t,retryCount:o,retryDelay:s,uid:c}),value:a}}class S5 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 P5(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:s="http",methods:i,name:l="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:c,retryDelay:u,raw:f}=t;return({chain:p,retryCount:d,timeout:h})=>{const{batchSize:m=1e3,wait:g=0}=typeof n=="object"?n:{},N=t.retryCount??d,x=h??t.timeout??1e4,P=e||(p==null?void 0:p.rpcUrls.default.http[0]);if(!P)throw new S5;const C=aw(P,{fetchFn:r,fetchOptions:o,onRequest:a,onResponse:c,timeout:x});return E5({key:s,methods:i,name:l,async request({method:D,params:F}){const L={method:D,params:F},{schedule:b}=fd({id:P,wait:g,shouldSplitBatch(I){return I.length>m},fn:I=>C.request({body:I}),sort:(I,T)=>I.id-T.id}),v=async I=>n?b(I):[await C.request({body:I})],[{error:E,result:$}]=await v(L);if(f)return{error:E,result:$};if(E)throw new Qi({body:L,error:E,url:P});return $},retryCount:N,retryDelay:u,timeout:x,type:"http"},{fetchOptions:o,url:P})}}const T5=ow({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 A5({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,l]=y.useState(null),[a,c]=y.useState(o);return y.useEffect(()=>{let u,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:Or,functionName:"balanceOf",args:[n]});l(d),c(Yi(d,r))}catch{c(o)}};p();try{u=e.watchContractEvent({address:t,abi:Or,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:Or,eventName:"Transfer",args:{from:n},onLogs:()=>{p()},poll:!0,pollingInterval:s})}catch{}return()=>{u==null||u(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const N5=()=>({openDeposit:y.useCallback(t=>{},[])}),C5=()=>({openWithdraw:y.useCallback(t=>{},[])}),hn="MPC",Us="EVM";var Re=(e=>(e.SPOT="spot",e.PERPETUAL="perpetual",e.PERPETUALV2="perpetual_v2",e))(Re||{});const O5="spot",I5="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
|
|
96
|
+
*/const $5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),k5=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),w0=e=>{const t=k5(e);return t.charAt(0).toUpperCase()+t.slice(1)},x0=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),M5=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
|
|
101
|
+
*/var D5={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
|
|
106
|
+
*/const B5=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},a)=>y.createElement("svg",{ref:a,...D5,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:x0("lucide",o),...!s&&!M5(l)&&{"aria-hidden":"true"},...l},[...i.map(([c,u])=>y.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
|
|
107
107
|
* @license lucide-react v0.540.0 - ISC
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const
|
|
111
|
+
*/const L5=(e,t)=>{const n=y.forwardRef(({className:r,...o},s)=>y.createElement(B5,{ref:s,iconNode:t,className:x0(`lucide-${$5(w0(e))}`,`lucide-${e}`,r),...o}));return n.displayName=w0(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 x0=D5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),E0=typeof document<"u"?v.useLayoutEffect:()=>{};var yc;const B5=(yc=v.useInsertionEffect)!==null&&yc!==void 0?yc:E0;function L5(e){const t=v.useRef(null);return B5(()=>{t.current=e},[e]),v.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const Mn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},tr=e=>e&&"window"in e&&e.window===e?e:Mn(e).defaultView||window;function F5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function R5(e){return F5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let j5=!1;function vc(){return j5}function S0(e,t){if(!vc())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:R5(n)?n=n.host:n=n.parentNode}return!1}const wc=(e=document)=>{var t;if(!vc())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 P0(e){return vc()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}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 xc(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 mn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ec=mn(function(){return xc(/^Mac/i)}),z5=mn(function(){return xc(/^iPhone/i)}),U5=mn(function(){return xc(/^iPad/i)||Ec()&&navigator.maxTouchPoints>1}),_5=mn(function(){return z5()||U5()});mn(function(){return Ec()||_5()}),mn(function(){return _s(/AppleWebKit/i)&&!W5()});const W5=mn(function(){return _s(/Chrome/i)}),V5=mn(function(){return _s(/Android/i)});mn(function(){return _s(/Firefox/i)});function T0(){let e=v.useRef(new Map),t=v.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=v.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=v.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return v.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function H5(e){return e.pointerType===""&&e.isTrusted?!0:V5()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function A0(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 N0(e){let t=v.useRef({isFocused:!1,observer:null});E0(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=L5(r=>{e==null||e(r)});return v.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=A0(i);n(c)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let q5=!1,zo=null,Sc=new Set,Uo=new Map,nr=!1,Pc=!1;const K5={Tab:!0,Escape:!0};function Tc(e,t){for(let n of Sc)n(e,t)}function Z5(e){return!(e.metaKey||!Ec()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Ws(e){nr=!0,Z5(e)&&(zo="keyboard",Tc("keyboard",e))}function yt(e){zo="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(nr=!0,Tc("pointer",e))}function C0(e){H5(e)&&(nr=!0,zo="virtual")}function O0(e){e.target===window||e.target===document||q5||!e.isTrusted||(!nr&&!Pc&&(zo="virtual",Tc("virtual",e)),nr=!1,Pc=!1)}function I0(){nr=!1,Pc=!0}function Ac(e){if(typeof window>"u"||typeof document>"u"||Uo.get(tr(e)))return;const t=tr(e),n=Mn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){nr=!0,r.apply(this,arguments)},n.addEventListener("keydown",Ws,!0),n.addEventListener("keyup",Ws,!0),n.addEventListener("click",C0,!0),t.addEventListener("focus",O0,!0),t.addEventListener("blur",I0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",yt,!0),n.addEventListener("pointermove",yt,!0),n.addEventListener("pointerup",yt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",yt,!0),n.addEventListener("mousemove",yt,!0),n.addEventListener("mouseup",yt,!0)),t.addEventListener("beforeunload",()=>{$0(e)},{once:!0}),Uo.set(t,{focus:r})}const $0=(e,t)=>{const n=tr(e),r=Mn(e);t&&r.removeEventListener("DOMContentLoaded",t),Uo.has(n)&&(n.HTMLElement.prototype.focus=Uo.get(n).focus,r.removeEventListener("keydown",Ws,!0),r.removeEventListener("keyup",Ws,!0),r.removeEventListener("click",C0,!0),n.removeEventListener("focus",O0,!0),n.removeEventListener("blur",I0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",yt,!0),r.removeEventListener("pointermove",yt,!0),r.removeEventListener("pointerup",yt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",yt,!0),r.removeEventListener("mousemove",yt,!0),r.removeEventListener("mouseup",yt,!0)),Uo.delete(n))};function Y5(e){const t=Mn(e);let n;return t.readyState!=="loading"?Ac(e):(n=()=>{Ac(e)},t.addEventListener("DOMContentLoaded",n)),()=>$0(e,n)}typeof document<"u"&&Y5();function k0(){return zo!=="pointer"}const X5=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function J5(e,t,n){let r=Mn(n==null?void 0:n.target);const o=typeof window<"u"?tr(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?tr(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?tr(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?tr(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!X5.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!K5[n.key])}function Q5(e,t,n){Ac(),v.useEffect(()=>{let r=(o,s)=>{J5(!!(n!=null&&n.isTextInput),o,s)&&e(k0())};return Sc.add(r),()=>{Sc.delete(r)}},t)}function ex(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=v.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=N0(s),c=v.useCallback(a=>{const l=Mn(a.target),u=l?wc(l):wc();a.target===a.currentTarget&&u===P0(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function tx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=v.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=T0(),a=v.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),l=N0(a),u=v.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=Mn(f.target),d=wc(p);if(!s.current.isFocusWithin&&d===P0(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,l(f);let h=f.currentTarget;i(p,"focus",m=>{if(s.current.isFocusWithin&&!S0(h,m.target)){let g=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});G5(g,h);let N=A0(g);a(N)}},{capture:!0})}},[r,o,l,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let Vs=!1,Hs=0;function Nc(){Vs=!0,setTimeout(()=>{Vs=!1},50)}function M0(e){e.pointerType==="touch"&&Nc()}function nx(){if(!(typeof document>"u"))return Hs===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",M0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Nc)),Hs++,()=>{Hs--,!(Hs>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",M0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Nc))}}function rx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=v.useState(!1),c=v.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;v.useEffect(nx,[]);let{addGlobalListener:a,removeAllGlobalListeners:l}=T0(),{hoverProps:u,triggerHoverEnd:f}=v.useMemo(()=>{let p=(m,g)=>{if(c.pointerType=g,o||g==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let N=m.currentTarget;c.target=N,a(Mn(m.target),"pointerover",x=>{c.isHovered&&c.target&&!S0(c.target,x.target)&&d(x,x.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:N,pointerType:g}),n&&n(!0),i(!0)},d=(m,g)=>{let N=c.target;c.pointerType="",c.target=null,!(g==="touch"||!c.isHovered||!N)&&(c.isHovered=!1,l(),r&&r({type:"hoverend",target:N,pointerType:g}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Vs&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!Vs&&p(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,c,a,l]);return v.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=v.useRef({isFocused:!1,isFocusVisible:t||k0()}),[s,i]=v.useState(!1),[c,a]=v.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=v.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=v.useCallback(d=>{o.current.isFocused=d,i(d),l()},[l]);Q5(d=>{o.current.isFocusVisible=d,l()},[],{isTextInput:n});let{focusProps:f}=ex({isDisabled:r,onFocusChange:u}),{focusWithinProps:p}=tx({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:c,focusProps:r?p: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,Cc=(e,t,n)=>(ix(e,typeof t!="symbol"?t+"":t,n),n);let ax=class{constructor(){Cc(this,"current",this.detect()),Cc(this,"handoffState","pending"),Cc(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"}},qt=new ax;function Gs(e){var t;return qt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function qs(e){var t,n;return qt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function D0(e){var t,n;return(n=(t=qs(e))==null?void 0:t.activeElement)!=null?n:null}function cx(e){return D0(e)===e}function B0(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ut(){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 B0(()=>{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=ut();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 rr(){let[e]=v.useState(ut);return v.useEffect(()=>()=>e.dispose(),[e]),e}let Ae=(e,t)=>{qt.isServer?v.useEffect(e,t):v.useLayoutEffect(e,t)};function or(e){let t=v.useRef(e);return Ae(()=>{t.current=e},[e]),t}let me=function(e){let t=or(e);return v.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=v.useRef(null),[n,r]=v.useState(!1),o=rr(),s=me(()=>{t.current=null,r(!1),o.dispose()}),i=me(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=Gs(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 Dn(e){return v.useMemo(()=>e,Object.values(e))}let dx=v.createContext(void 0);function Oc(){return v.useContext(dx)}function Ic(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function vt(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,vt),r}var Ks=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Ks||{}),Bn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Bn||{});function ft(){let e=hx();return v.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=L0(t,e);if(s)return Zs(a,n,r,i,c);let l=o??0;if(l&2){let{static:u=!1,...f}=a;if(u)return Zs(f,n,r,i,c)}if(l&1){let{unmount:u=!0,...f}=a;return vt(u?0:1,{0(){return null},1(){return Zs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return Zs(a,n,r,i,c)}function Zs(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 p=!1,d=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&d.push(h.replace(/([A-Z])/g,g=>`-${g.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(_o(s)&&(Object.keys(Ln(a)).length>0||Object.keys(Ln(f)).length>0))if(!v.isValidElement(u)||Array.isArray(u)&&u.length>1||gx(u)){if(Object.keys(Ln(a)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Ln(a)).concat(Object.keys(Ln(f))).map(p=>` - ${p}`).join(`
|
|
116
|
+
*/const E0=L5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),S0=typeof document<"u"?y.useLayoutEffect:()=>{};var yl;const F5=(yl=y.useInsertionEffect)!==null&&yl!==void 0?yl:S0;function R5(e){const t=y.useRef(null);return F5(()=>{t.current=e},[e]),y.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const Mn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},tr=e=>e&&"window"in e&&e.window===e?e:Mn(e).defaultView||window;function j5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function z5(e){return j5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let U5=!1;function vl(){return U5}function P0(e,t){if(!vl())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:z5(n)?n=n.host:n=n.parentNode}return!1}const wl=(e=document)=>{var t;if(!vl())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 T0(e){return vl()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}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 xl(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 mn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const El=mn(function(){return xl(/^Mac/i)}),_5=mn(function(){return xl(/^iPhone/i)}),W5=mn(function(){return xl(/^iPad/i)||El()&&navigator.maxTouchPoints>1}),V5=mn(function(){return _5()||W5()});mn(function(){return El()||V5()}),mn(function(){return _s(/AppleWebKit/i)&&!H5()});const H5=mn(function(){return _s(/Chrome/i)}),G5=mn(function(){return _s(/Android/i)});mn(function(){return _s(/Firefox/i)});function A0(){let e=y.useRef(new Map),t=y.useCallback((o,s,i,l)=>{let a=l!=null&&l.once?(...c)=>{e.current.delete(i),i(...c)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:l}),o.addEventListener(s,a,l)},[]),n=y.useCallback((o,s,i,l)=>{var a;let c=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,c,l),e.current.delete(i)},[]),r=y.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return y.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function q5(e){return e.pointerType===""&&e.isTrusted?!0:G5()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function N0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function K5(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function C0(e){let t=y.useRef({isFocused:!1,observer:null});S0(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=R5(r=>{e==null||e(r)});return y.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let l=N0(i);n(l)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let l=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let Z5=!1,zo=null,Sl=new Set,Uo=new Map,nr=!1,Pl=!1;const Y5={Tab:!0,Escape:!0};function Tl(e,t){for(let n of Sl)n(e,t)}function X5(e){return!(e.metaKey||!El()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Ws(e){nr=!0,X5(e)&&(zo="keyboard",Tl("keyboard",e))}function vt(e){zo="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(nr=!0,Tl("pointer",e))}function O0(e){q5(e)&&(nr=!0,zo="virtual")}function I0(e){e.target===window||e.target===document||Z5||!e.isTrusted||(!nr&&!Pl&&(zo="virtual",Tl("virtual",e)),nr=!1,Pl=!1)}function $0(){nr=!1,Pl=!0}function Al(e){if(typeof window>"u"||typeof document>"u"||Uo.get(tr(e)))return;const t=tr(e),n=Mn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){nr=!0,r.apply(this,arguments)},n.addEventListener("keydown",Ws,!0),n.addEventListener("keyup",Ws,!0),n.addEventListener("click",O0,!0),t.addEventListener("focus",I0,!0),t.addEventListener("blur",$0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",vt,!0),n.addEventListener("pointermove",vt,!0),n.addEventListener("pointerup",vt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",vt,!0),n.addEventListener("mousemove",vt,!0),n.addEventListener("mouseup",vt,!0)),t.addEventListener("beforeunload",()=>{k0(e)},{once:!0}),Uo.set(t,{focus:r})}const k0=(e,t)=>{const n=tr(e),r=Mn(e);t&&r.removeEventListener("DOMContentLoaded",t),Uo.has(n)&&(n.HTMLElement.prototype.focus=Uo.get(n).focus,r.removeEventListener("keydown",Ws,!0),r.removeEventListener("keyup",Ws,!0),r.removeEventListener("click",O0,!0),n.removeEventListener("focus",I0,!0),n.removeEventListener("blur",$0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",vt,!0),r.removeEventListener("pointermove",vt,!0),r.removeEventListener("pointerup",vt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",vt,!0),r.removeEventListener("mousemove",vt,!0),r.removeEventListener("mouseup",vt,!0)),Uo.delete(n))};function J5(e){const t=Mn(e);let n;return t.readyState!=="loading"?Al(e):(n=()=>{Al(e)},t.addEventListener("DOMContentLoaded",n)),()=>k0(e,n)}typeof document<"u"&&J5();function M0(){return zo!=="pointer"}const Q5=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function ex(e,t,n){let r=Mn(n==null?void 0:n.target);const o=typeof window<"u"?tr(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?tr(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?tr(n==null?void 0:n.target).HTMLElement:HTMLElement,l=typeof window<"u"?tr(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Q5.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof l&&!Y5[n.key])}function tx(e,t,n){Al(),y.useEffect(()=>{let r=(o,s)=>{ex(!!(n!=null&&n.isTextInput),o,s)&&e(M0())};return Sl.add(r),()=>{Sl.delete(r)}},t)}function nx(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=y.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=C0(s),l=y.useCallback(a=>{const c=Mn(a.target),u=c?wl(c):wl();a.target===a.currentTarget&&u===T0(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?l:void 0,onBlur:!t&&(r||o)?s:void 0}}}function rx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=y.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:l}=A0(),a=y.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,l(),n&&n(f),o&&o(!1))},[n,o,s,l]),c=C0(a),u=y.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=Mn(f.target),d=wl(p);if(!s.current.isFocusWithin&&d===T0(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,c(f);let h=f.currentTarget;i(p,"focus",m=>{if(s.current.isFocusWithin&&!P0(h,m.target)){let g=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});K5(g,h);let N=N0(g);a(N)}},{capture:!0})}},[r,o,c,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let Vs=!1,Hs=0;function Nl(){Vs=!0,setTimeout(()=>{Vs=!1},50)}function D0(e){e.pointerType==="touch"&&Nl()}function ox(){if(!(typeof document>"u"))return Hs===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",D0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Nl)),Hs++,()=>{Hs--,!(Hs>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",D0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Nl))}}function sx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=y.useState(!1),l=y.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;y.useEffect(ox,[]);let{addGlobalListener:a,removeAllGlobalListeners:c}=A0(),{hoverProps:u,triggerHoverEnd:f}=y.useMemo(()=>{let p=(m,g)=>{if(l.pointerType=g,o||g==="touch"||l.isHovered||!m.currentTarget.contains(m.target))return;l.isHovered=!0;let N=m.currentTarget;l.target=N,a(Mn(m.target),"pointerover",x=>{l.isHovered&&l.target&&!P0(l.target,x.target)&&d(x,x.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:N,pointerType:g}),n&&n(!0),i(!0)},d=(m,g)=>{let N=l.target;l.pointerType="",l.target=null,!(g==="touch"||!l.isHovered||!N)&&(l.isHovered=!1,c(),r&&r({type:"hoverend",target:N,pointerType:g}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Vs&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{l.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!l.ignoreEmulatedMouseEvents&&!Vs&&p(m,"mouse"),l.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,l,a,c]);return y.useEffect(()=>{o&&f({currentTarget:l.target},l.pointerType)},[o]),{hoverProps:u,isHovered:s}}function ix(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=y.useRef({isFocused:!1,isFocusVisible:t||M0()}),[s,i]=y.useState(!1),[l,a]=y.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=y.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=y.useCallback(d=>{o.current.isFocused=d,i(d),c()},[c]);tx(d=>{o.current.isFocusVisible=d,c()},[],{isTextInput:n});let{focusProps:f}=nx({isDisabled:r,onFocusChange:u}),{focusWithinProps:p}=rx({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:l,focusProps:r?p:f}}var ax=Object.defineProperty,lx=(e,t,n)=>t in e?ax(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cl=(e,t,n)=>(lx(e,typeof t!="symbol"?t+"":t,n),n);let cx=class{constructor(){Cl(this,"current",this.detect()),Cl(this,"handoffState","pending"),Cl(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Kt=new cx;function Gs(e){var t;return Kt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function qs(e){var t,n;return Kt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function B0(e){var t,n;return(n=(t=qs(e))==null?void 0:t.activeElement)!=null?n:null}function ux(e){return B0(e)===e}function L0(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ft(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return L0(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=ft();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function rr(){let[e]=y.useState(ft);return y.useEffect(()=>()=>e.dispose(),[e]),e}let Ne=(e,t)=>{Kt.isServer?y.useEffect(e,t):y.useLayoutEffect(e,t)};function or(e){let t=y.useRef(e);return Ne(()=>{t.current=e},[e]),t}let me=function(e){let t=or(e);return y.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=y.useRef(null),[n,r]=y.useState(!1),o=rr(),s=me(()=>{t.current=null,r(!1),o.dispose()}),i=me(l=>{if(o.dispose(),t.current===null){t.current=l.currentTarget,r(!0);{let a=Gs(l.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",c=>{if(t.current){let u=fx(c);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 Dn(e){return y.useMemo(()=>e,Object.values(e))}let hx=y.createContext(void 0);function Ol(){return y.useContext(hx)}function Il(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function wt(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,wt),r}var Ks=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Ks||{}),Bn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Bn||{});function dt(){let e=bx();return y.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:l}){l=l??gx;let a=F0(t,e);if(s)return Zs(a,n,r,i,l);let c=o??0;if(c&2){let{static:u=!1,...f}=a;if(u)return Zs(f,n,r,i,l)}if(c&1){let{unmount:u=!0,...f}=a;return wt(u?0:1,{0(){return null},1(){return Zs({...f,hidden:!0,style:{display:"none"}},n,r,i,l)}})}return Zs(a,n,r,i,l)}function Zs(e,t={},n,r,o){let{as:s=n,children:i,refName:l="ref",...a}=$l(e,["unmount","static"]),c=e.ref!==void 0?{[l]:e.ref}:{},u=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let p=!1,d=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&d.push(h.replace(/([A-Z])/g,g=>`-${g.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(_o(s)&&(Object.keys(Ln(a)).length>0||Object.keys(Ln(f)).length>0))if(!y.isValidElement(u)||Array.isArray(u)&&u.length>1||vx(u)){if(Object.keys(Ln(a)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Ln(a)).concat(Object.keys(Ln(f))).map(p=>` - ${p}`).join(`
|
|
117
117
|
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>` - ${p}`).join(`
|
|
118
118
|
`)].join(`
|
|
119
|
-
`))}else{let p=u.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...N)=>Ic(d(...N),a.className):Ic(d,a.className),m=h?{className:h}:{},g=L0(u.props,Ln($c(a,["ref"])));for(let N in f)N in g&&delete f[N];return v.cloneElement(u,Object.assign({},g,f,l,{ref:o(bx(u),l.ref)},m))}return v.createElement(s,Object.assign({},$c(a,["ref"]),!_o(s)&&l,!_o(s)&&f),u)}function hx(){let e=v.useRef([]),t=v.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 L0(...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 F0(...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 et(e){var t;return Object.assign(v.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Ln(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function $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 v.version.split(".")[0]>="19"?e.props.ref:e.ref}function _o(e){return e===v.Fragment||e===Symbol.for("react.fragment")}function gx(e){return _o(e.type)}function yx(e,t,n){let[r,o]=v.useState(n),s=e!==void 0,i=v.useRef(s),c=v.useRef(!1),a=v.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,me(l=>(s||qe.flushSync(()=>o(l)),t==null?void 0:t(l)))]}function vx(e){let[t]=v.useState(e);return t}function R0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))z0(n,j0(t,r),o);return n}function j0(e,t){return e?e+"["+t+"]":t}function z0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())z0(e,j0(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)&&!v.isValidElement(n)&&R0(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 kc=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(kc||{});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 ft()({ourProps:s,theirProps:o,slot:{},defaultTag:Ex,name:"Hidden"})}let U0=et(Sx),Px=v.createContext(null);function Tx({children:e}){let t=v.useContext(Px);if(!t)return v.createElement(v.Fragment,null,e);let{target:n}=t;return n?qe.createPortal(v.createElement(v.Fragment,null,e),n):null}function Ax({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=v.useState(null),c=rr();return v.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),v.createElement(Tx,null,v.createElement(Nx,{setForm:i,formId:t}),R0(e).map(([a,l])=>v.createElement(U0,{features:kc.Hidden,...Ln({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:l,...o})})))}function Nx({setForm:e,formId:t}){return v.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:v.createElement(U0,{features:kc.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Cx=v.createContext(void 0);function _0(){return v.useContext(Cx)}function W0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ys(e){return W0(e)&&"tagName"in e}function bn(e){return Ys(e)&&"accessKey"in e}function Dr(e){return Ys(e)&&"tabIndex"in e}function Ox(e){return Ys(e)&&"style"in e}function Ix(e){return bn(e)&&e.nodeName==="IFRAME"}function V0(e){return bn(e)&&e.nodeName==="INPUT"}function H0(e){return bn(e)&&e.nodeName==="LABEL"}function $x(e){return bn(e)&&e.nodeName==="FIELDSET"}function G0(e){return bn(e)&&e.nodeName==="LEGEND"}function kx(e){return Ys(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function q0(e){let t=e.parentElement,n=null;for(;t&&!$x(t);)G0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Mx(n)?!1:r}function Mx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(G0(t))return!1;t=t.previousElementSibling}return!0}let K0=Symbol();function Dx(e,t=!0){return Object.assign(e,{[K0]:t})}function wt(...e){let t=v.useRef(e);v.useEffect(()=>{t.current=e},[e]);let n=me(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[K0]))?void 0:n}let Mc=v.createContext(null);Mc.displayName="DescriptionContext";function Z0(){let e=v.useContext(Mc);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,Z0),t}return e}function Bx(){var e,t;return(t=(e=v.useContext(Mc))==null?void 0:e.value)!=null?t:void 0}let Lx="p";function Fx(e,t){let n=v.useId(),r=Oc(),{id:o=`headlessui-description-${n}`,...s}=e,i=Z0(),c=wt(t);Ae(()=>i.register(o),[o,i.register]);let a=Dn({...i.slot,disabled:r||!1}),l={ref:c,...i.props,id:o};return ft()({ourProps:l,theirProps:s,slot:a,defaultTag:Lx,name:i.name||"Description"})}let Rx=et(Fx);Object.assign(Rx,{});var Be=(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))(Be||{});let Xs=v.createContext(null);Xs.displayName="LabelContext";function Y0(){let e=v.useContext(Xs);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,Y0),t}return e}function X0(e){var t,n,r;let o=(n=(t=v.useContext(Xs))==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=X0(),[n,r]=v.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,v.useMemo(()=>function(s){let i=me(a=>(r(l=>[...l,a]),()=>r(l=>{let u=l.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),c=v.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 v.createElement(Xs.Provider,{value:c},s.children)},[r])]}let zx="label";function Ux(e,t){var n;let r=v.useId(),o=Y0(),s=_0(),i=Oc(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...u}=e,f=wt(t);Ae(()=>o.register(c),[c,o.register]);let p=me(m=>{let g=m.currentTarget;if(!(m.target!==m.currentTarget&&kx(m.target))&&(H0(g)&&m.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(m),H0(g))){let N=document.getElementById(g.htmlFor);if(N){let x=N.getAttribute("disabled");if(x==="true"||x==="")return;let P=N.getAttribute("aria-disabled");if(P==="true"||P==="")return;(V0(N)&&(N.type==="file"||N.type==="radio"||N.type==="checkbox")||N.role==="radio"||N.role==="checkbox"||N.role==="switch")&&N.click(),N.focus({preventScroll:!0})}}}),d=Dn({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return l&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in u&&delete u.onClick),ft()({ourProps:h,theirProps:u,slot:d,defaultTag:a?zx:"div",name:o.name||"Label"})}let _x=et(Ux),Wx=Object.assign(_x,{});function Vx(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 Hx(e=Vx){return v.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 J0(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]=v.useState(()=>J0(t));return Ae(()=>{if(!t||!e)return;let s=ut();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(c=>{let a=J0(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=v.useRef(null),n=me(o=>{t.current=o.pointerType,!q0(o.currentTarget)&&o.pointerType==="mouse"&&o.button===Q0.Left&&(o.preventDefault(),e(o))}),r=me(o=>{t.current!=="mouse"&&(q0(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let ep=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 Kx=Object.defineProperty,Zx=(e,t,n)=>t in e?Kx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yx=(e,t,n)=>(Zx(e,t+"",n),n),tp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},xt=(e,t,n)=>(tp(e,t,"read from private field"),n?n.call(e):t.get(e)),Dc=(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)},np=(e,t,n,r)=>(tp(e,t,"write to private field"),t.set(e,n),n),Kt,Wo,Vo;let rp=class{constructor(t){Dc(this,Kt,{}),Dc(this,Wo,new ep(()=>new Set)),Dc(this,Vo,new Set),Yx(this,"disposables",ut()),np(this,Kt,t),qt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return xt(this,Kt)}subscribe(t,n){if(qt.isServer)return()=>{};let r={selector:t,callback:n,current:t(xt(this,Kt))};return xt(this,Vo).add(r),this.disposables.add(()=>{xt(this,Vo).delete(r)})}on(t,n){return qt.isServer?()=>{}:(xt(this,Wo).get(t).add(n),this.disposables.add(()=>{xt(this,Wo).get(t).delete(n)}))}send(t){let n=this.reduce(xt(this,Kt),t);if(n!==xt(this,Kt)){np(this,Kt,n);for(let r of xt(this,Vo)){let o=r.selector(xt(this,Kt));op(r.current,o)||(r.current=o,r.callback(o))}for(let r of xt(this,Wo).get(t.type))r(xt(this,Kt),t)}}};Kt=new WeakMap,Wo=new WeakMap,Vo=new WeakMap;function op(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:Bc(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Bc(e.entries(),t.entries()):sp(e)&&sp(t)?Bc(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Bc(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function sp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Lc(e){let[t,n]=e(),r=ut();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Xx=Object.defineProperty,Jx=(e,t,n)=>t in e?Xx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ip=(e,t,n)=>(Jx(e,typeof t!="symbol"?t+"":t,n),n),ap=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(ap||{});let Qx={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 Vm extends rp{constructor(){super(...arguments),ip(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),ip(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Vm({stack:[]})}reduce(t,n){return vt(n.type,Qx,t,n)}};const Fc=new ep(()=>e2.new());var Rc={exports:{}},jc={};/**
|
|
119
|
+
`))}else{let p=u.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...N)=>Il(d(...N),a.className):Il(d,a.className),m=h?{className:h}:{},g=F0(u.props,Ln($l(a,["ref"])));for(let N in f)N in g&&delete f[N];return y.cloneElement(u,Object.assign({},g,f,c,{ref:o(yx(u),c.ref)},m))}return y.createElement(s,Object.assign({},$l(a,["ref"]),!_o(s)&&c,!_o(s)&&f),u)}function bx(){let e=y.useRef([]),t=y.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 F0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let i=n[r];for(let l of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;l(o,...s)}}});return t}function R0(...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 tt(e){var t;return Object.assign(y.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Ln(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function $l(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function yx(e){return y.version.split(".")[0]>="19"?e.props.ref:e.ref}function _o(e){return e===y.Fragment||e===Symbol.for("react.fragment")}function vx(e){return _o(e.type)}function wx(e,t,n){let[r,o]=y.useState(n),s=e!==void 0,i=y.useRef(s),l=y.useRef(!1),a=y.useRef(!1);return s&&!i.current&&!l.current?(l.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,me(c=>(s||Ke.flushSync(()=>o(c)),t==null?void 0:t(c)))]}function xx(e){let[t]=y.useState(e);return t}function j0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))U0(n,z0(t,r),o);return n}function z0(e,t){return e?e+"["+t+"]":t}function U0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())U0(e,z0(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)&&!y.isValidElement(n)&&j0(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 kl=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(kl||{});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 dt()({ourProps:s,theirProps:o,slot:{},defaultTag:Px,name:"Hidden"})}let _0=tt(Tx),Ax=y.createContext(null);function Nx({children:e}){let t=y.useContext(Ax);if(!t)return y.createElement(y.Fragment,null,e);let{target:n}=t;return n?Ke.createPortal(y.createElement(y.Fragment,null,e),n):null}function Cx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=y.useState(null),l=rr();return y.useEffect(()=>{if(r&&s)return l.addEventListener(s,"reset",r)},[s,t,r]),y.createElement(Nx,null,y.createElement(Ox,{setForm:i,formId:t}),j0(e).map(([a,c])=>y.createElement(_0,{features:kl.Hidden,...Ln({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:c,...o})})))}function Ox({setForm:e,formId:t}){return y.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:y.createElement(_0,{features:kl.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Ix=y.createContext(void 0);function W0(){return y.useContext(Ix)}function V0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ys(e){return V0(e)&&"tagName"in e}function bn(e){return Ys(e)&&"accessKey"in e}function Dr(e){return Ys(e)&&"tabIndex"in e}function $x(e){return Ys(e)&&"style"in e}function kx(e){return bn(e)&&e.nodeName==="IFRAME"}function H0(e){return bn(e)&&e.nodeName==="INPUT"}function G0(e){return bn(e)&&e.nodeName==="LABEL"}function Mx(e){return bn(e)&&e.nodeName==="FIELDSET"}function q0(e){return bn(e)&&e.nodeName==="LEGEND"}function Dx(e){return Ys(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function K0(e){let t=e.parentElement,n=null;for(;t&&!Mx(t);)q0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Bx(n)?!1:r}function Bx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(q0(t))return!1;t=t.previousElementSibling}return!0}let Z0=Symbol();function Lx(e,t=!0){return Object.assign(e,{[Z0]:t})}function xt(...e){let t=y.useRef(e);y.useEffect(()=>{t.current=e},[e]);let n=me(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[Z0]))?void 0:n}let Ml=y.createContext(null);Ml.displayName="DescriptionContext";function Y0(){let e=y.useContext(Ml);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,Y0),t}return e}function Fx(){var e,t;return(t=(e=y.useContext(Ml))==null?void 0:e.value)!=null?t:void 0}let Rx="p";function jx(e,t){let n=y.useId(),r=Ol(),{id:o=`headlessui-description-${n}`,...s}=e,i=Y0(),l=xt(t);Ne(()=>i.register(o),[o,i.register]);let a=Dn({...i.slot,disabled:r||!1}),c={ref:l,...i.props,id:o};return dt()({ourProps:c,theirProps:s,slot:a,defaultTag:Rx,name:i.name||"Description"})}let zx=tt(jx);Object.assign(zx,{});var Be=(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))(Be||{});let Xs=y.createContext(null);Xs.displayName="LabelContext";function X0(){let e=y.useContext(Xs);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,X0),t}return e}function J0(e){var t,n,r;let o=(n=(t=y.useContext(Xs))==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 Ux({inherit:e=!1}={}){let t=J0(),[n,r]=y.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,y.useMemo(()=>function(s){let i=me(a=>(r(c=>[...c,a]),()=>r(c=>{let u=c.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),l=y.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 y.createElement(Xs.Provider,{value:l},s.children)},[r])]}let _x="label";function Wx(e,t){var n;let r=y.useId(),o=X0(),s=W0(),i=Ol(),{id:l=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:c=!1,...u}=e,f=xt(t);Ne(()=>o.register(l),[l,o.register]);let p=me(m=>{let g=m.currentTarget;if(!(m.target!==m.currentTarget&&Dx(m.target))&&(G0(g)&&m.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(m),G0(g))){let N=document.getElementById(g.htmlFor);if(N){let x=N.getAttribute("disabled");if(x==="true"||x==="")return;let P=N.getAttribute("aria-disabled");if(P==="true"||P==="")return;(H0(N)&&(N.type==="file"||N.type==="radio"||N.type==="checkbox")||N.role==="radio"||N.role==="checkbox"||N.role==="switch")&&N.click(),N.focus({preventScroll:!0})}}}),d=Dn({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:l,htmlFor:a,onClick:p};return c&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in u&&delete u.onClick),dt()({ourProps:h,theirProps:u,slot:d,defaultTag:a?_x:"div",name:o.name||"Label"})}let Vx=tt(Wx),Hx=Object.assign(Vx,{});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 y.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 Kx(e,t,n=!1){let[r,o]=y.useState(()=>Q0(t));return Ne(()=>{if(!t||!e)return;let s=ft();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(l=>{let a=Q0(t);return a.width===l.width&&a.height===l.height?l:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var ep=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(ep||{});function Zx(e){let t=y.useRef(null),n=me(o=>{t.current=o.pointerType,!K0(o.currentTarget)&&o.pointerType==="mouse"&&o.button===ep.Left&&(o.preventDefault(),e(o))}),r=me(o=>{t.current!=="mouse"&&(K0(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let tp=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,Jx=(e,t,n)=>(Xx(e,t+"",n),n),np=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Et=(e,t,n)=>(np(e,t,"read from private field"),n?n.call(e):t.get(e)),Dl=(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)},rp=(e,t,n,r)=>(np(e,t,"write to private field"),t.set(e,n),n),Zt,Wo,Vo;let op=class{constructor(t){Dl(this,Zt,{}),Dl(this,Wo,new tp(()=>new Set)),Dl(this,Vo,new Set),Jx(this,"disposables",ft()),rp(this,Zt,t),Kt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Et(this,Zt)}subscribe(t,n){if(Kt.isServer)return()=>{};let r={selector:t,callback:n,current:t(Et(this,Zt))};return Et(this,Vo).add(r),this.disposables.add(()=>{Et(this,Vo).delete(r)})}on(t,n){return Kt.isServer?()=>{}:(Et(this,Wo).get(t).add(n),this.disposables.add(()=>{Et(this,Wo).get(t).delete(n)}))}send(t){let n=this.reduce(Et(this,Zt),t);if(n!==Et(this,Zt)){rp(this,Zt,n);for(let r of Et(this,Vo)){let o=r.selector(Et(this,Zt));sp(r.current,o)||(r.current=o,r.callback(o))}for(let r of Et(this,Wo).get(t.type))r(Et(this,Zt),t)}}};Zt=new WeakMap,Wo=new WeakMap,Vo=new WeakMap;function sp(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:Bl(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Bl(e.entries(),t.entries()):ip(e)&&ip(t)?Bl(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Bl(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 ip(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Ll(e){let[t,n]=e(),r=ft();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Qx=Object.defineProperty,e2=(e,t,n)=>t in e?Qx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ap=(e,t,n)=>(e2(e,typeof t!="symbol"?t+"":t,n),n),lp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(lp||{});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 Gm extends op{constructor(){super(...arguments),ap(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),ap(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Gm({stack:[]})}reduce(t,n){return wt(n.type,t2,t,n)}};const Fl=new tp(()=>n2.new());var Rl={exports:{}},jl={};/**
|
|
120
120
|
* @license React
|
|
121
121
|
* use-sync-external-store-with-selector.production.js
|
|
122
122
|
*
|
|
@@ -124,7 +124,7 @@ ${Ag(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
124
124
|
*
|
|
125
125
|
* This source code is licensed under the MIT license found in the
|
|
126
126
|
* LICENSE file in the root directory of this source tree.
|
|
127
|
-
*/var cp;function
|
|
127
|
+
*/var cp;function r2(){if(cp)return jl;cp=1;var e=y;function t(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,l=e.useDebugValue;return jl.useSyncExternalStoreWithSelector=function(a,c,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function g(D){if(!N){if(N=!0,x=D,D=f(D),p!==void 0&&h.hasValue){var F=h.value;if(p(F,D))return P=F}return P=D}if(F=P,n(x,D))return F;var L=f(D);return p!==void 0&&p(F,L)?(x=D,F):(x=D,P=L)}var N=!1,x,P,C=u===void 0?null:u;return[function(){return g(c())},C===null?void 0:function(){return g(C())}]},[c,u,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),l(m),m},jl}var zl={};/**
|
|
128
128
|
* @license React
|
|
129
129
|
* use-sync-external-store-with-selector.development.js
|
|
130
130
|
*
|
|
@@ -132,56 +132,56 @@ ${Ag(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
132
132
|
*
|
|
133
133
|
* This source code is licensed under the MIT license found in the
|
|
134
134
|
* LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/var lp;function n2(){return lp||(lp=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=v,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;zc.useSyncExternalStoreWithSelector=function(a,l,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function g(M){if(!N){if(N=!0,x=M,M=f(M),p!==void 0&&h.hasValue){var L=h.value;if(p(L,M))return P=L}return P=M}if(L=P,n(x,M))return L;var F=f(M);return p!==void 0&&p(L,F)?(x=M,L):(x=M,P=F)}var N=!1,x,P,C=u===void 0?null:u;return[function(){return g(l())},C===null?void 0:function(){return g(C())}]},[l,u,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),zc}process.env.NODE_ENV==="production"?Rc.exports=t2():Rc.exports=n2();var r2=Rc.exports;function tt(e,t,n=op){return r2.useSyncExternalStoreWithSelector(me(r=>e.subscribe(o2,r)),me(()=>e.state),me(()=>e.state),me(t),n)}function o2(e){return e}function up(e,t){let n=v.useId(),r=Fc.get(t),[o,s]=tt(r,v.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Ae(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Uc=new Map,Ho=new Map;function fp(e){var t;let n=(t=Ho.get(e))!=null?t:0;return Ho.set(e,n+1),n!==0?()=>dp(e):(Uc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>dp(e))}function dp(e){var t;let n=(t=Ho.get(e))!=null?t:1;if(n===1?Ho.delete(e):Ho.set(e,n-1),n!==1)return;let r=Uc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Uc.delete(e))}function s2(e,{allowed:t,disallowed:n}={}){let r=up(e,"inert-others");Ae(()=>{var o,s;if(!r)return;let i=ut();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(fp(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let l=Gs(a);if(!l)continue;let u=a.parentElement;for(;u&&u!==l.body;){for(let f of u.children)c.some(p=>f.contains(p))||i.add(fp(f));u=u.parentElement}}return i.dispose},[r,t,n])}function i2(e,t,n){let r=or(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});v.useEffect(()=>{if(!e)return;let o=t===null?null:bn(t)?t:t.current;if(!o)return;let s=ut();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 _c=["[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 Wc=(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))(Wc||{}),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 pp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(_c)).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 Vc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Vc||{});function hp(e,t=0){var n;return e===((n=Gs(e))==null?void 0:n.body)?!1:vt(t,{0(){return e.matches(_c)},1(){let r=e;for(;r!==null;){if(r.matches(_c))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 mp(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:qs(e)){return m2(pp(n),t,{relativeTo:e})}function m2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?qs(e[0]):document:qs(e),i=Array.isArray(e)?n?mp(e):e:t&64?u2(e):pp(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??(s==null?void 0:s.activeElement);let 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,p;do{if(u>=f||u+f<=0)return 0;let d=a+u;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(l),u+=c}while(p!==D0(p));return t&6&&p2(p)&&p.select(),2}function bp(){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 gp(){return bp()||b2()}function Br(e,t,n,r){let o=or(n);v.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=or(n);v.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 yp=30;function y2(e,t,n){let r=or(n),o=v.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(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of u)if(f!==null&&(f.contains(l)||c.composed&&c.composedPath().includes(f)))return;return!hp(l,Vc.Loose)&&l.tabIndex!==-1&&c.preventDefault(),r.current(c,l)},[r,t]),s=v.useRef(null);Br(e,"pointerdown",c=>{var a,l;gp()||(s.current=((l=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:l[0])||c.target)},!0),Br(e,"pointerup",c=>{if(gp()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=v.useRef({x:0,y:0});Br(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),Br(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=yp||Math.abs(a.y-i.current.y)>=yp))return o(c,()=>Dr(c.target)?c.target:null)},!0),g2(e,"blur",c=>o(c,()=>Ix(window.document.activeElement)?window.document.activeElement:null),!0)}function Hc(...e){return v.useMemo(()=>Gs(...e),[...e])}var v2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(v2||{});const Js={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},w2=200,vp=5;function x2(e,{trigger:t,action:n,close:r,select:o}){let s=v.useRef(null),i=v.useRef(null),c=v.useRef(null);Br(e&&t!==null,"pointerdown",a=>{W0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),Br(e&&t!==null,"pointerup",a=>{var l,u;let f=s.current;if(f===null||(s.current=null,!Dr(a.target))||Math.abs(a.x-((l=i.current)!=null?l:a.x))<vp&&Math.abs(a.y-((u=c.current)!=null?u:a.y))<vp)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>w2&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function E2(e,t){return v.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 v.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 bp()?{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=ut();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(Dr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:l}=new URL(a.href),u=e.querySelector(l);Dr(u)&&!r(u)&&(i=u)}catch{}},!0),t.group(c=>{t.addEventListener(e,"touchstart",a=>{if(c.dispose(),Dr(a.target)&&Ox(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(Dr(c.target)){if(V0(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 N2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function wp(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let sr=P2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:ut(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=wp(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=wp(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[A2(),T2(),N2()];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)}});sr.subscribe(()=>{let e=sr.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)&&sr.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&sr.dispatch("TEARDOWN",n)}});function C2(e,t,n=()=>({containers:[]})){let r=S2(sr),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Ae(()=>{if(!(!t||!e))return sr.dispatch("PUSH",t,n),()=>sr.dispatch("POP",t,n)},[e,t]),s}function O2(e,t,n=()=>[document.body]){let r=up(e,"scroll-lock");C2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function xp(e){return[e.screenX,e.screenY]}function I2(){let e=v.useRef([-1,-1]);return{wasMoved(t){let n=xp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=xp(t)}}}function $2(e=0){let[t,n]=v.useState(e),r=v.useCallback(a=>n(a),[]),o=v.useCallback(a=>n(l=>l|a),[]),s=v.useCallback(a=>(t&a)===a,[t]),i=v.useCallback(a=>n(l=>l&~a),[]),c=v.useCallback(a=>n(l=>l^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var Ep,Sp;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Ep=process==null?void 0:process.env)==null?void 0:Ep.NODE_ENV)==="test"&&typeof((Sp=Element==null?void 0:Element.prototype)==null?void 0:Sp.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
|
|
135
|
+
*/var up;function o2(){return up||(up=1,process.env.NODE_ENV!=="production"&&function(){function e(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=y,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,l=t.useDebugValue;zl.useSyncExternalStoreWithSelector=function(a,c,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function g(D){if(!N){if(N=!0,x=D,D=f(D),p!==void 0&&h.hasValue){var F=h.value;if(p(F,D))return P=F}return P=D}if(F=P,n(x,D))return F;var L=f(D);return p!==void 0&&p(F,L)?(x=D,F):(x=D,P=L)}var N=!1,x,P,C=u===void 0?null:u;return[function(){return g(c())},C===null?void 0:function(){return g(C())}]},[c,u,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),l(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),zl}process.env.NODE_ENV==="production"?Rl.exports=r2():Rl.exports=o2();var s2=Rl.exports;function nt(e,t,n=sp){return s2.useSyncExternalStoreWithSelector(me(r=>e.subscribe(i2,r)),me(()=>e.state),me(()=>e.state),me(t),n)}function i2(e){return e}function fp(e,t){let n=y.useId(),r=Fl.get(t),[o,s]=nt(r,y.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Ne(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Ul=new Map,Ho=new Map;function dp(e){var t;let n=(t=Ho.get(e))!=null?t:0;return Ho.set(e,n+1),n!==0?()=>pp(e):(Ul.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>pp(e))}function pp(e){var t;let n=(t=Ho.get(e))!=null?t:1;if(n===1?Ho.delete(e):Ho.set(e,n-1),n!==1)return;let r=Ul.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Ul.delete(e))}function a2(e,{allowed:t,disallowed:n}={}){let r=fp(e,"inert-others");Ne(()=>{var o,s;if(!r)return;let i=ft();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(dp(a));let l=(s=t==null?void 0:t())!=null?s:[];for(let a of l){if(!a)continue;let c=Gs(a);if(!c)continue;let u=a.parentElement;for(;u&&u!==c.body;){for(let f of u.children)l.some(p=>f.contains(p))||i.add(dp(f));u=u.parentElement}}return i.dispose},[r,t,n])}function l2(e,t,n){let r=or(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});y.useEffect(()=>{if(!e)return;let o=t===null?null:bn(t)?t:t.current;if(!o)return;let s=ft();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let _l=["[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(","),c2=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Wl=(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))(Wl||{}),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 hp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(_l)).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(c2)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Vl=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Vl||{});function mp(e,t=0){var n;return e===((n=Gs(e))==null?void 0:n.body)?!1:wt(t,{0(){return e.matches(_l)},1(){let r=e;for(;r!==null;){if(r.matches(_l))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 bp(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let i=o.compareDocumentPosition(s);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function b2(e,t,n=e===null?document.body:qs(e)){return g2(hp(n),t,{relativeTo:e})}function g2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?qs(e[0]):document:qs(e),i=Array.isArray(e)?n?bp(e):e:t&64?d2(e):hp(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??(s==null?void 0:s.activeElement);let l=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},u=0,f=i.length,p;do{if(u>=f||u+f<=0)return 0;let d=a+u;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(c),u+=l}while(p!==B0(p));return t&6&&m2(p)&&p.select(),2}function gp(){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 yp(){return gp()||y2()}function Br(e,t,n,r){let o=or(n);y.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=or(n);y.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 vp=30;function w2(e,t,n){let r=or(n),o=y.useCallback(function(l,a){if(l.defaultPrevented)return;let c=a(l);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let u=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of u)if(f!==null&&(f.contains(c)||l.composed&&l.composedPath().includes(f)))return;return!mp(c,Vl.Loose)&&c.tabIndex!==-1&&l.preventDefault(),r.current(l,c)},[r,t]),s=y.useRef(null);Br(e,"pointerdown",l=>{var a,c;yp()||(s.current=((c=(a=l.composedPath)==null?void 0:a.call(l))==null?void 0:c[0])||l.target)},!0),Br(e,"pointerup",l=>{if(yp()||!s.current)return;let a=s.current;return s.current=null,o(l,()=>a)},!0);let i=y.useRef({x:0,y:0});Br(e,"touchstart",l=>{i.current.x=l.touches[0].clientX,i.current.y=l.touches[0].clientY},!0),Br(e,"touchend",l=>{let a={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=vp||Math.abs(a.y-i.current.y)>=vp))return o(l,()=>Dr(l.target)?l.target:null)},!0),v2(e,"blur",l=>o(l,()=>kx(window.document.activeElement)?window.document.activeElement:null),!0)}function Hl(...e){return y.useMemo(()=>Gs(...e),[...e])}var x2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(x2||{});const Js={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},E2=200,wp=5;function S2(e,{trigger:t,action:n,close:r,select:o}){let s=y.useRef(null),i=y.useRef(null),l=y.useRef(null);Br(e&&t!==null,"pointerdown",a=>{V0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,l.current=a.y,s.current=a.timeStamp)}),Br(e&&t!==null,"pointerup",a=>{var c,u;let f=s.current;if(f===null||(s.current=null,!Dr(a.target))||Math.abs(a.x-((c=i.current)!=null?c:a.x))<wp&&Math.abs(a.y-((u=l.current)!=null?u:a.y))<wp)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>E2&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function P2(e,t){return y.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 y.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function A2(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(l=>l()))}}}function N2(){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 C2(){return gp()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let l=ft();l.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>l.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",l=>{if(Dr(l.target))try{let a=l.target.closest("a");if(!a)return;let{hash:c}=new URL(a.href),u=e.querySelector(c);Dr(u)&&!r(u)&&(i=u)}catch{}},!0),t.group(l=>{t.addEventListener(e,"touchstart",a=>{if(l.dispose(),Dr(a.target)&&$x(a.target))if(r(a.target)){let c=a.target;for(;c.parentElement&&r(c.parentElement);)c=c.parentElement;l.style(c,"overscrollBehavior","contain")}else l.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",l=>{if(Dr(l.target)){if(H0(l.target))return;if(r(l.target)){let a=l.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),t.add(()=>{var l;let a=(l=window.scrollY)!=null?l:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function O2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function xp(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let sr=A2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:ft(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=xp(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=xp(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[C2(),N2(),O2()];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)}});sr.subscribe(()=>{let e=sr.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)&&sr.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&sr.dispatch("TEARDOWN",n)}});function I2(e,t,n=()=>({containers:[]})){let r=T2(sr),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Ne(()=>{if(!(!t||!e))return sr.dispatch("PUSH",t,n),()=>sr.dispatch("POP",t,n)},[e,t]),s}function $2(e,t,n=()=>[document.body]){let r=fp(e,"scroll-lock");I2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Ep(e){return[e.screenX,e.screenY]}function k2(){let e=y.useRef([-1,-1]);return{wasMoved(t){let n=Ep(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Ep(t)}}}function M2(e=0){let[t,n]=y.useState(e),r=y.useCallback(a=>n(a),[]),o=y.useCallback(a=>n(c=>c|a),[]),s=y.useCallback(a=>(t&a)===a,[t]),i=y.useCallback(a=>n(c=>c&~a),[]),l=y.useCallback(a=>n(c=>c^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:l}}var Sp,Pp;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Sp=process==null?void 0:process.env)==null?void 0:Sp.NODE_ENV)==="test"&&typeof((Pp=Element==null?void 0:Element.prototype)==null?void 0:Pp.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 D2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(D2||{});function Tp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Ap(e,t,n,r){let[o,s]=y.useState(n),{hasFlag:i,addFlag:l,removeFlag:a}=M2(e&&o?3:0),c=y.useRef(!1),u=y.useRef(!1),f=rr();return Ne(()=>{var p;if(e){if(n&&s(!0),!t){n&&l(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),B2(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(l(3),a(4)):(l(4),a(2)))},run(){u.current?n?(a(3),l(4)):(a(4),l(3)):n?a(1):l(1)},done(){var d;u.current&&R2(t)||(c.current=!1,a(7),n||s(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,f]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function B2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=ft();return F2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(L2(e,r))})}),s.dispose}function L2(e,t){var n,r;let o=ft();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(l=>l instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(l=>l.finished)).then(()=>{s||t()}),o.dispose)}function 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 Qs(){return typeof window<"u"}function Lr(e){return Gl(e)?(e.nodeName||"").toLowerCase():"#document"}function rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yt(e){var t;return(t=(Gl(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Gl(e){return Qs()?e instanceof Node||e instanceof rt(e).Node:!1}function ye(e){return Qs()?e instanceof Element||e instanceof rt(e).Element:!1}function He(e){return Qs()?e instanceof HTMLElement||e instanceof rt(e).HTMLElement:!1}function ql(e){return!Qs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rt(e).ShadowRoot}const j2=new Set(["inline","contents"]);function Go(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=St(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!j2.has(o)}const z2=new Set(["table","td","th"]);function U2(e){return z2.has(Lr(e))}const _2=[":popover-open",":modal"];function ei(e){return _2.some(t=>{try{return e.matches(t)}catch{return!1}})}const W2=["transform","translate","scale","rotate","perspective"],V2=["transform","translate","scale","rotate","perspective","filter"],H2=["paint","layout","strict","content"];function Kl(e){const t=ti(),n=ye(e)?St(e):e;return W2.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||V2.some(r=>(n.willChange||"").includes(r))||H2.some(r=>(n.contain||"").includes(r))}function G2(e){let t=yn(e);for(;He(t)&&!gn(t);){if(Kl(t))return t;if(ei(t))return null;t=yn(t)}return null}function ti(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const q2=new Set(["html","body","#document"]);function gn(e){return q2.has(Lr(e))}function St(e){return rt(e).getComputedStyle(e)}function ni(e){return ye(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function yn(e){if(Lr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ql(e)&&e.host||Yt(e);return ql(t)?t.host:t}function Np(e){const t=yn(e);return gn(t)?e.ownerDocument?e.ownerDocument.body:e.body:He(t)&&Go(t)?t:Np(t)}function Fn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Np(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=rt(o);if(s){const l=Zl(i);return t.concat(i,i.visualViewport||[],Go(o)?o:[],l&&n?Fn(l):[])}return t.concat(o,Fn(o,[],n))}function Zl(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function K2(){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 vn=Math.min,ze=Math.max,qo=Math.round,ri=Math.floor,Xt=e=>({x:e,y:e}),Z2={left:"right",right:"left",bottom:"top",top:"bottom"},Y2={start:"end",end:"start"};function Yl(e,t,n){return ze(e,vn(t,n))}function ir(e,t){return typeof e=="function"?e(t):e}function Rn(e){return e.split("-")[0]}function Fr(e){return e.split("-")[1]}function Cp(e){return e==="x"?"y":"x"}function Xl(e){return e==="y"?"height":"width"}const X2=new Set(["top","bottom"]);function wn(e){return X2.has(Rn(e))?"y":"x"}function Jl(e){return Cp(wn(e))}function J2(e,t,n){n===void 0&&(n=!1);const r=Fr(e),o=Jl(e),s=Xl(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=oi(i)),[i,oi(i)]}function Q2(e){const t=oi(e);return[Ql(e),t,Ql(t)]}function Ql(e){return e.replace(/start|end/g,t=>Y2[t])}const Op=["left","right"],Ip=["right","left"],eE=["top","bottom"],tE=["bottom","top"];function nE(e,t,n){switch(e){case"top":case"bottom":return n?t?Ip:Op:t?Op:Ip;case"left":case"right":return t?eE:tE;default:return[]}}function rE(e,t,n,r){const o=Fr(e);let s=nE(Rn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ql)))),s}function oi(e){return e.replace(/left|right|bottom|top/g,t=>Z2[t])}function oE(e){return{top:0,right:0,bottom:0,left:0,...e}}function $p(e){return typeof e!="number"?oE(e):{top:e,right:e,bottom:e,left:e}}function si(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.3.0
|
|
138
138
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
139
|
-
*/var rE=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],el=rE.join(","),$p=typeof Element>"u",Ko=$p?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ii=!$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},Zo=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&&Zo(t.parentNode);return i},oE=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},sE=function(t,n,r){if(Zo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(el));return n&&Ko.call(t,el)&&o.unshift(t),o=o.filter(r),o},tl=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Zo(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,l=tl(a,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{var u=Ko.call(i,el);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Zo(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=tl(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},kp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Mp=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||oE(t))&&!kp(t)?0:t.tabIndex},iE=function(t,n){var r=Mp(t);return r<0&&n&&!kp(t)?0:r},aE=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Dp=function(t){return t.tagName==="INPUT"},cE=function(t){return Dp(t)&&t.type==="hidden"},lE=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},uE=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},fE=function(t){if(!t.name)return!0;var n=t.form||ii(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=uE(o,t.form);return!s||s===t},dE=function(t){return Dp(t)&&t.type==="radio"},pE=function(t){return dE(t)&&!fE(t)},hE=function(t){var n,r=t&&ii(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=ii(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},Bp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},mE=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=Ko.call(t,"details>summary:first-of-type"),c=i?t.parentElement:t;if(Ko.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=ii(t);if(l&&!l.shadowRoot&&o(l)===!0)return Bp(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=a}if(hE(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Bp(t);return!1},bE=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 Ko.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},gE=function(t,n){return!(n.disabled||Zo(n)||cE(n)||mE(n,t)||lE(n)||bE(n))},Lp=function(t,n){return!(pE(n)||Mp(n)<0||!gE(t,n))},yE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Fp=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=iE(c,i),l=i?Fp(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(aE).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Rp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=tl([t],n.includeContainer,{filter:Lp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:yE}):r=sE(t,n.includeContainer,Lp.bind(null,n)),Fp(r)};function jp(e,t,n){let{reference:r,floating:o}=e;const s=wn(t),i=Jc(t),c=Xc(i),a=Rn(t),l=s==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let d;switch(a){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(Fr(t)){case"start":d[i]-=p*(n&&l?-1:1);break;case"end":d[i]+=p*(n&&l?-1:1);break}return d}const vE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=jp(l,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:g,fn:N}=c[m],{x,y:P,data:C,reset:M}=await N({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:l,platform:i,elements:{reference:e,floating:t}});u=x??u,f=P??f,d={...d,[g]:{...d[g],...C}},M&&h<=50&&(h++,typeof M=="object"&&(M.placement&&(p=M.placement),M.rects&&(l=M.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):M.rects),{x:u,y:f}=jp(l,p,a)),m=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}};async function ai(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:p=!1,padding:d=0}=ir(t,e),h=Ip(d),g=c[p?f==="floating"?"reference":"floating":f],N=si(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.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,P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),C=await(s.isElement==null?void 0:s.isElement(P))?await(s.getScale==null?void 0:s.getScale(P))||{x:1,y:1}:{x:1,y:1},M=si(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:P,strategy:a}):x);return{top:(N.top-M.top+h.top)/C.y,bottom:(M.bottom-N.bottom+h.bottom)/C.y,left:(N.left-M.left+h.left)/C.x,right:(M.right-N.right+h.right)/C.x}}const wE=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}=ir(e,t)||{};if(l==null)return{};const f=Ip(u),p={x:n,y:r},d=Jc(o),h=Xc(d),m=await i.getDimensions(l),g=d==="y",N=g?"top":"left",x=g?"bottom":"right",P=g?"clientHeight":"clientWidth",C=s.reference[h]+s.reference[d]-p[d]-s.floating[h],M=p[d]-s.reference[d],L=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let F=L?L[P]:0;(!F||!await(i.isElement==null?void 0:i.isElement(L)))&&(F=c.floating[P]||s.floating[h]);const b=C/2-M/2,y=F/2-m[h]/2-1,E=vn(f[N],y),T=vn(f[x],y),I=E,$=F-m[h]-T,D=F/2-m[h]/2+b,w=Yc(I,D,$),O=!a.arrow&&Fr(o)!=null&&D!==w&&s.reference[h]/2-(D<I?E:T)-m[h]/2<0,k=O?D<I?D-I:D-$:0;return{[d]:p[d]+k,data:{[d]:w,centerOffset:D-w-k,...O&&{alignmentOffset:k}},reset:O}}}),xE=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:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=ir(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const N=Rn(o),x=wn(c),P=Rn(c)===c,C=await(a.isRTL==null?void 0:a.isRTL(l.floating)),M=p||(P||!m?[oi(c)]:X2(c)),L=h!=="none";!p&&L&&M.push(...tE(c,m,h,C));const F=[c,...M],b=await ai(t,g),y=[];let E=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&y.push(b[N]),f){const D=Y2(o,i,C);y.push(b[D[0]],b[D[1]])}if(E=[...E,{placement:o,overflows:y}],!y.every(D=>D<=0)){var T,I;const D=(((T=s.flip)==null?void 0:T.index)||0)+1,w=F[D];if(w&&(!(f==="alignment"?x!==wn(w):!1)||E.every(S=>wn(S.placement)===x?S.overflows[0]>0:!0)))return{data:{index:D,overflows:E},reset:{placement:w}};let O=(I=E.filter(k=>k.overflows[0]<=0).sort((k,S)=>k.overflows[1]-S.overflows[1])[0])==null?void 0:I.placement;if(!O)switch(d){case"bestFit":{var $;const k=($=E.filter(S=>{if(L){const B=wn(S.placement);return B===x||B==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(B=>B>0).reduce((B,j)=>B+j,0)]).sort((S,B)=>S[1]-B[1])[0])==null?void 0:$[0];k&&(O=k);break}case"initialPlacement":O=c;break}if(o!==O)return{reset:{placement:O}}}return{}}}},EE=new Set(["left","top"]);async function SE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Rn(n),c=Fr(n),a=wn(n)==="y",l=EE.has(i)?-1:1,u=s&&a?-1:1,f=ir(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),a?{x:d*u,y:p*l}:{x:p*l,y:d*u}}const PE=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 SE(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}}}}},TE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:g=>{let{x:N,y:x}=g;return{x:N,y:x}}},...a}=ir(e,t),l={x:n,y:r},u=await ai(t,a),f=wn(Rn(o)),p=Np(f);let d=l[p],h=l[f];if(s){const g=p==="y"?"top":"left",N=p==="y"?"bottom":"right",x=d+u[g],P=d-u[N];d=Yc(x,d,P)}if(i){const g=f==="y"?"top":"left",N=f==="y"?"bottom":"right",x=h+u[g],P=h-u[N];h=Yc(x,h,P)}const m=c.fn({...t,[p]:d,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},AE=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}=ir(e,t),u=await ai(t,l),f=Rn(o),p=Fr(o),d=wn(o)==="y",{width:h,height:m}=s.floating;let g,N;f==="top"||f==="bottom"?(g=f,N=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(N=f,g=p==="end"?"top":"bottom");const x=m-u.top-u.bottom,P=h-u.left-u.right,C=vn(m-u[g],x),M=vn(h-u[N],P),L=!t.middlewareData.shift;let F=C,b=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(b=P),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=x),L&&!p){const E=ze(u.left,0),T=ze(u.right,0),I=ze(u.top,0),$=ze(u.bottom,0);d?b=h-2*(E!==0||T!==0?E+T:ze(u.left,u.right)):F=m-2*(I!==0||$!==0?I+$:ze(u.top,u.bottom))}await a({...t,availableWidth:b,availableHeight:F});const y=await i.getDimensions(c.floating);return h!==y.width||m!==y.height?{reset:{rects:!0}}:{}}}};function zp(e){const t=Et(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ve(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=qo(n)!==s||qo(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function nl(e){return ye(e)?e:e.contextElement}function Rr(e){const t=nl(e);if(!Ve(t))return Yt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=zp(t);let i=(s?qo(n.width):n.width)/r,c=(s?qo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const NE=Yt(0);function Up(e){const t=nt(e);return!ti()||!t.visualViewport?NE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function CE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==nt(e)?!1:t}function ar(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=nl(e);let i=Yt(1);t&&(r?ye(r)&&(i=Rr(r)):i=Rr(e));const c=CE(s,n,r)?Up(s):Yt(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 p=nt(s),d=r&&ye(r)?nt(r):r;let h=p,m=Zc(h);for(;m&&r&&d!==h;){const g=Rr(m),N=m.getBoundingClientRect(),x=Et(m),P=N.left+(m.clientLeft+parseFloat(x.paddingLeft))*g.x,C=N.top+(m.clientTop+parseFloat(x.paddingTop))*g.y;a*=g.x,l*=g.y,u*=g.x,f*=g.y,a+=P,l+=C,h=nt(m),m=Zc(h)}}return si({width:u,height:f,x:a,y:l})}function ci(e,t){const n=ni(e).scrollLeft;return t?t.left+n:ar(Zt(e)).left+n}function _p(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ci(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function OE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Zt(r),c=t?ei(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=Yt(1);const u=Yt(0),f=Ve(r);if((f||!f&&!s)&&((Lr(r)!=="body"||Go(i))&&(a=ni(r)),Ve(r))){const d=ar(r);l=Rr(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=i&&!f&&!s?_p(i,a):Yt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+p.x,y:n.y*l.y-a.scrollTop*l.y+u.y+p.y}}function IE(e){return Array.from(e.getClientRects())}function $E(e){const t=Zt(e),n=ni(e),r=e.ownerDocument.body,o=ze(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ze(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ci(e);const c=-n.scrollTop;return Et(r).direction==="rtl"&&(i+=ze(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Wp=25;function kE(e,t){const n=nt(e),r=Zt(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=ti();(!u||u&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const l=ci(r);if(l<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),d=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Wp&&(s-=h)}else l<=Wp&&(s+=l);return{width:s,height:i,x:c,y:a}}const ME=new Set(["absolute","fixed"]);function DE(e,t){const n=ar(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ve(e)?Rr(e):Yt(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 Vp(e,t,n){let r;if(t==="viewport")r=kE(e,n);else if(t==="document")r=$E(Zt(e));else if(ye(t))r=DE(t,n);else{const o=Up(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return si(r)}function Hp(e,t){const n=yn(e);return n===t||!ye(n)||gn(n)?!1:Et(n).position==="fixed"||Hp(n,t)}function BE(e,t){const n=t.get(e);if(n)return n;let r=Fn(e,[],!1).filter(c=>ye(c)&&Lr(c)!=="body"),o=null;const s=Et(e).position==="fixed";let i=s?yn(e):e;for(;ye(i)&&!gn(i);){const c=Et(i),a=Kc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&ME.has(o.position)||Go(i)&&!a&&Hp(e,i))?r=r.filter(u=>u!==i):o=c,i=yn(i)}return t.set(e,r),r}function LE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?ei(t)?[]:BE(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((l,u)=>{const f=Vp(t,u,o);return l.top=ze(f.top,l.top),l.right=vn(f.right,l.right),l.bottom=vn(f.bottom,l.bottom),l.left=ze(f.left,l.left),l},Vp(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function FE(e){const{width:t,height:n}=zp(e);return{width:t,height:n}}function RE(e,t,n){const r=Ve(t),o=Zt(t),s=n==="fixed",i=ar(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Yt(0);function l(){a.x=ci(o)}if(r||!r&&!s)if((Lr(t)!=="body"||Go(o))&&(c=ni(t)),r){const d=ar(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&l();s&&!r&&o&&l();const u=o&&!r&&!s?_p(o,c):Yt(0),f=i.left+c.scrollLeft-a.x-u.x,p=i.top+c.scrollTop-a.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function rl(e){return Et(e).position==="static"}function Gp(e,t){if(!Ve(e)||Et(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Zt(e)===n&&(n=n.ownerDocument.body),n}function qp(e,t){const n=nt(e);if(ei(e))return n;if(!Ve(e)){let o=yn(e);for(;o&&!gn(o);){if(ye(o)&&!rl(o))return o;o=yn(o)}return n}let r=Gp(e,t);for(;r&&j2(r)&&rl(r);)r=Gp(r,t);return r&&gn(r)&&rl(r)&&!Kc(r)?n:r||V2(e)||n}const jE=async function(e){const t=this.getOffsetParent||qp,n=this.getDimensions,r=await n(e.floating);return{reference:RE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zE(e){return Et(e).direction==="rtl"}const UE={convertOffsetParentRelativeRectToViewportRelativeRect:OE,getDocumentElement:Zt,getClippingRect:LE,getOffsetParent:qp,getElementRects:jE,getClientRects:IE,getDimensions:FE,getScale:Rr,isElement:ye,isRTL:zE};function Kp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _E(e,t){let n=null,r;const o=Zt(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:p,height:d}=l;if(c||t(),!p||!d)return;const h=ri(f),m=ri(o.clientWidth-(u+p)),g=ri(o.clientHeight-(f+d)),N=ri(u),P={rootMargin:-h+"px "+-m+"px "+-g+"px "+-N+"px",threshold:ze(0,vn(1,a))||1};let C=!0;function M(L){const F=L[0].intersectionRatio;if(F!==a){if(!C)return i();F?i(!1,F):r=setTimeout(()=>{i(!1,1e-7)},1e3)}F===1&&!Kp(l,e.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(M,{...P,root:o.ownerDocument})}catch{n=new IntersectionObserver(M,P)}n.observe(e)}return i(!0),s}function Zp(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=nl(e),u=o||s?[...l?Fn(l):[],...Fn(t)]:[];u.forEach(N=>{o&&N.addEventListener("scroll",n,{passive:!0}),s&&N.addEventListener("resize",n)});const f=l&&c?_E(l,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(N=>{let[x]=N;x&&x.target===l&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var P;(P=d)==null||P.observe(t)})),n()}),l&&!a&&d.observe(l),d.observe(t));let h,m=a?ar(e):null;a&&g();function g(){const N=ar(e);m&&!Kp(m,N)&&n(),m=N,h=requestAnimationFrame(g)}return n(),()=>{var N;u.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(N=d)==null||N.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const ol=ai,WE=PE,VE=TE,HE=xE,GE=AE,Yp=wE,qE=(e,t,n)=>{const r=new Map,o={platform:UE,...n},s={...o.platform,_c:r};return vE(e,t,{...o,platform:s})};var KE=typeof document<"u",ZE=function(){},li=KE?v.useLayoutEffect:ZE;function ui(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(!ui(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)&&!ui(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Xp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jp(e,t){const n=Xp(e);return Math.round(t*n)/n}function sl(e){const t=z.useRef(e);return li(()=>{t.current=e}),t}function Qp(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]=z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=z.useState(r);ui(p,r)||d(r);const[h,m]=z.useState(null),[g,N]=z.useState(null),x=z.useCallback(S=>{S!==L.current&&(L.current=S,m(S))},[]),P=z.useCallback(S=>{S!==F.current&&(F.current=S,N(S))},[]),C=s||h,M=i||g,L=z.useRef(null),F=z.useRef(null),b=z.useRef(u),y=a!=null,E=sl(a),T=sl(o),I=sl(l),$=z.useCallback(()=>{if(!L.current||!F.current)return;const S={placement:t,strategy:n,middleware:p};T.current&&(S.platform=T.current),qE(L.current,F.current,S).then(B=>{const j={...B,isPositioned:I.current!==!1};D.current&&!ui(b.current,j)&&(b.current=j,Hr.flushSync(()=>{f(j)}))})},[p,t,n,T,I]);li(()=>{l===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,f(S=>({...S,isPositioned:!1})))},[l]);const D=z.useRef(!1);li(()=>(D.current=!0,()=>{D.current=!1}),[]),li(()=>{if(C&&(L.current=C),M&&(F.current=M),C&&M){if(E.current)return E.current(C,M,$);$()}},[C,M,$,E,y]);const w=z.useMemo(()=>({reference:L,floating:F,setReference:x,setFloating:P}),[x,P]),O=z.useMemo(()=>({reference:C,floating:M}),[C,M]),k=z.useMemo(()=>{const S={position:n,left:0,top:0};if(!O.floating)return S;const B=Jp(O.floating,u.x),j=Jp(O.floating,u.y);return c?{...S,transform:"translate("+B+"px, "+j+"px)",...Xp(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:j}},[n,c,O.floating,u.x,u.y]);return z.useMemo(()=>({...u,update:$,refs:w,elements:O,floatingStyles:k}),[u,$,w,O,k])}const YE=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?Yp({element:r.current,padding:o}).fn(n):{}:r?Yp({element:r,padding:o}).fn(n):{}}}},il=(e,t)=>({...WE(e),options:[e,t]}),eh=(e,t)=>({...VE(e),options:[e,t]}),th=(e,t)=>({...HE(e),options:[e,t]}),XE=(e,t)=>({...GE(e),options:[e,t]}),JE=(e,t)=>({...YE(e),options:[e,t]}),nh={...z},QE=nh.useInsertionEffect||(e=>e());function rh(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return QE(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var al=typeof document<"u"?v.useLayoutEffect:v.useEffect;let oh=!1,e8=0;const sh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+e8++;function t8(){const[e,t]=z.useState(()=>oh?sh():void 0);return al(()=>{e==null&&t(sh())},[]),z.useEffect(()=>{oh=!0},[]),e}const n8=nh.useId||t8;let Yo;process.env.NODE_ENV!=="production"&&(Yo=new Set);function r8(){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=Yo)!=null&&e.has(o))){var s;(s=Yo)==null||s.add(o),console.warn(o)}}function o8(){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=Yo)!=null&&e.has(o))){var s;(s=Yo)==null||s.add(o),console.error(o)}}function s8(){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 i8=z.createContext(null),a8=z.createContext(null),c8=()=>{var e;return((e=z.useContext(i8))==null?void 0:e.id)||null},l8=()=>z.useContext(a8),u8="data-floating-ui-focusable";function f8(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=n8(),s=z.useRef({}),[i]=z.useState(()=>s8()),c=c8()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!ye(d)&&o8("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]=z.useState(r.reference),u=rh((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:l}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function d8(e){e===void 0&&(e={});const{nodeId:t}=e,n=f8({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),u=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=l8();al(()=>{u&&(f.current=u)},[u]);const d=Qp({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(P=>{const C=ye(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;a(C),d.refs.setReference(C)},[d.refs]),m=z.useCallback(P=>{(ye(P)||P===null)&&(f.current=P,i(P)),(ye(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!ye(P))&&d.refs.setReference(P)},[d.refs]),g=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),N=z.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=z.useMemo(()=>({...d,...r,refs:g,elements:N,nodeId:t}),[d,g,N,t,r]);return al(()=>{r.dataRef.current.floatingContext=x;const P=p==null?void 0:p.nodesRef.current.find(C=>C.id===t);P&&(P.context=x)}),z.useMemo(()=>({...d,context:x,refs:g,elements:N}),[d,g,N,x])}const ih="active",ah="selected";function cl(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[ih]:i,[ah]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[u8]:""},...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&&[ih,ah].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 p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(l))==null?void 0:p.map(g=>g(...h)).find(g=>g!==void 0)}}}else i[l]=u}),i),{})}}function p8(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>cl(c,e,"reference"),t),s=z.useCallback(c=>cl(c,e,"floating"),n),i=z.useCallback(c=>cl(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function ch(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const h8=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}=ir(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(l==null?void 0:l.current)||p,m=p.clientTop||h.clientTop,g=p.clientTop!==0,N=h.clientTop!==0,x=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||r8('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const P={...t,...await il(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},C=await ol(ch(P,h.scrollHeight+m+p.clientTop),u),M=await ol(P,{...u,elementContext:"reference"}),L=ze(0,C.top),F=P.y+L,E=(h.scrollHeight>h.clientHeight?T=>T:qo)(ze(0,h.scrollHeight+(g&&x||N?m*2:0)-L-ze(0,C.bottom)));if(h.style.maxHeight=E+"px",h.scrollTop=L,o){const T=h.offsetHeight<d.offsetHeight*vn(c,n.current.length)-1||M.top>=-a||M.bottom>=-a;Hr.flushSync(()=>o(T))}return r&&(r.current=await ol(ch({...P,y:F},h.offsetHeight+m+p.clientTop),u)),{y:F}}});function m8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=rh(c),l=z.useRef(!1),u=z.useRef(null),f=z.useRef(null);z.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const g=m.deltaY,N=s.current.top>=-.5,x=s.current.bottom>=-.5,P=h.scrollHeight-h.clientHeight,C=g<0?-1:1,M=g<0?"max":"min";h.scrollHeight<=h.clientHeight||(!N&&g>0||!x&&g<0?(m.preventDefault(),Hr.flushSync(()=>{a(L=>L+Math[M](g,P*C))})):/firefox/i.test(G2())&&(h.scrollTop+=g))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{u.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=z.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!l.current)){if(u.current!==null){const h=d.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Hr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{u.current=d.scrollTop})}}}),[r.floating,a,s,i]);return z.useMemo(()=>o?{floating:p}:{},[o,p])}let jr=v.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});jr.displayName="FloatingContext";let ll=v.createContext(null);ll.displayName="PlacementContext";function b8(e){return v.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function g8(){return v.useContext(jr).setReference}function y8(){return v.useContext(jr).getReferenceProps}function v8(){let{getFloatingProps:e,slot:t}=v.useContext(jr);return v.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function w8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=v.useContext(ll),n=v.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Ae(()=>{t==null||t(n??null)},[t,n]);let r=v.useContext(jr);return v.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let lh=4;function x8({children:e,enabled:t=!0}){let[n,r]=v.useState(null),[o,s]=v.useState(0),i=v.useRef(null),[c,a]=v.useState(null);E8(c);let l=t&&n!==null&&c!==null,{to:u="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=S8(n,c),[m,g="center"]=u.split(" ");Ae(()=>{l&&s(0)},[l]);let{refs:N,floatingStyles:x,context:P}=d8({open:l,placement:m==="selection"?g==="center"?"bottom":`bottom-${g}`:g==="center"?`${m}`:`${m}-${g}`,strategy:"absolute",transform:!1,middleware:[il({mainAxis:m==="selection"?0:f,crossAxis:p}),eh({padding:d}),m!=="selection"&&th({padding:d}),m==="selection"&&h?h8({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:lh,referenceOverflowThreshold:d,onFallbackChange(T){var I,$;if(!T)return;let D=P.elements.floating;if(!D)return;let w=parseFloat(getComputedStyle(D).scrollPaddingBottom)||0,O=Math.min(lh,D.childElementCount),k=0,S=0;for(let B of($=(I=P.elements.floating)==null?void 0:I.childNodes)!=null?$:[])if(bn(B)){let j=B.offsetTop,U=j+B.clientHeight+w,_=D.scrollTop,G=_+D.clientHeight;if(j>=_&&U<=G)O--;else{S=Math.max(0,Math.min(U,G)-Math.max(j,_)),k=B.clientHeight;break}}O>=1&&s(B=>{let j=k*O-S+w;return B>=j?B:j})}}):null,XE({padding:d,apply({availableWidth:T,availableHeight:I,elements:$}){Object.assign($.floating.style,{overflow:"auto",maxWidth:`${T}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${I}px)`})}})].filter(Boolean),whileElementsMounted:Zp}),[C=m,M=g]=P.placement.split("-");m==="selection"&&(C="selection");let L=v.useMemo(()=>({anchor:[C,M].filter(Boolean).join(" ")}),[C,M]),F=m8(P,{overflowRef:i,onChange:s}),{getReferenceProps:b,getFloatingProps:y}=p8([F]),E=me(T=>{a(T),N.setFloating(T)});return z.createElement(ll.Provider,{value:r},z.createElement(jr.Provider,{value:{setFloating:E,setReference:N.setReference,styles:x,getReferenceProps:b,getFloatingProps:y,slot:L}},e))}function E8(e){Ae(()=>{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 S8(e,t){var n,r,o;let s=ul((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=ul((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=ul((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function ul(e,t,n=void 0){let r=rr(),o=me((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=fh(a,l);return[u,f=>{let p=uh(a);{let d=p.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[N,x]of p.entries()){let P=window.getComputedStyle(l).getPropertyValue(x);if(d[N]!==P){d[N]=P,m=!0;break}}if(!m)return;let g=fh(a,l);u!==g&&(f(g),u=g)})}return r.dispose}]}return[n,null]}),s=v.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=v.useState();return Ae(()=>{let[a,l]=o(e,t);if(c(a),!!l)return l(c)},[e,t]),i}function uh(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,...uh(o)]:[r]}return[]}function fh(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 P8({children:e,freeze:t},n){let r=dh(t,e);return v.isValidElement(r)?v.cloneElement(r,{ref:n}):v.createElement(v.Fragment,null,r)}v.forwardRef(P8);function dh(e,t){let[n,r]=v.useState(t);return!e&&n!==t&&r(t),e?n:t}let fl=v.createContext(null);fl.displayName="OpenClosedContext";var Ft=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ft||{});function dl(){return v.useContext(fl)}function ph({value:e,children:t}){return v.createElement(fl.Provider,{value:e},t)}function T8(e){throw new Error("Unexpected object: "+e)}var Pe=(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))(Pe||{});function fi(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:T8(e)}}function hh(e){let t=me(e),n=v.useRef(!1);v.useEffect(()=>(n.current=!1,()=>{n.current=!0,B0(()=>{n.current&&t()})}),[t])}let A8=v.createContext(!1);function N8(){return v.useContext(A8)}function C8(e){let t=N8(),n=v.useContext(bh),[r,o]=v.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(qt.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 v.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),v.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let mh=v.Fragment,O8=et(function(e,t){let{ownerDocument:n=null,...r}=e,o=v.useRef(null),s=wt(Dx(p=>{o.current=p}),t),i=Hc(o.current),c=n??i,a=C8(c),l=v.useContext(M8),u=rr(),f=ft();return hh(()=>{var p;a&&a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a))}),a?qe.createPortal(v.createElement("div",{"data-headlessui-portal":"",ref:p=>{u.dispose(),l&&p&&u.add(l.register(p))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:mh,name:"Portal"})),a):null});function I8(e,t){let n=wt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=ft();return r?v.createElement(O8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:mh,name:"Portal"})}let $8=v.Fragment,bh=v.createContext(null);function k8(e,t){let{target:n,...r}=e,o={ref:wt(t)},s=ft();return v.createElement(bh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:$8,name:"Popover.Group"}))}let M8=v.createContext(null),D8=et(I8),B8=et(k8),L8=Object.assign(D8,{Group:B8});const di={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function gh(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function F8(e,t,n){let r=ut();if(t.kind==="Tracked"){let o=function(){s!==gh(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 R8(){let e=typeof document>"u";return"useSyncExternalStore"in z?(t=>t.useSyncExternalStore)(z)(()=>()=>{},()=>!1,()=>!e):!1}function yh(){let e=R8(),[t,n]=z.useState(qt.isHandoffComplete);return t&&qt.isHandoffComplete===!1&&n(!1),z.useEffect(()=>{t!==!0&&n(!0)},[t]),z.useEffect(()=>qt.handoff(),[]),e?!1:t}function j8(){let e=v.useRef(!1);return Ae(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function vh(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!_o((t=e.as)!=null?t:xh)||v.Children.count(e.children)===1}let pi=v.createContext(null);pi.displayName="TransitionContext";var z8=(e=>(e.Visible="visible",e.Hidden="hidden",e))(z8||{});function U8(){let e=v.useContext(pi);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function _8(){let e=v.useContext(hi);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let hi=v.createContext(null);hi.displayName="NestingContext";function mi(e){return"children"in e?mi(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function wh(e,t){let n=or(e),r=v.useRef([]),o=j8(),s=rr(),i=me((d,h=Bn.Hidden)=>{let m=r.current.findIndex(({el:g})=>g===d);m!==-1&&(vt(h,{[Bn.Unmount](){r.current.splice(m,1)},[Bn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var g;!mi(r)&&o.current&&((g=n.current)==null||g.call(n))}))}),c=me(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,Bn.Unmount)}),a=v.useRef([]),l=v.useRef(Promise.resolve()),u=v.useRef({enter:[],leave:[]}),f=me((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([g])=>g!==d)),t==null||t.chains.current[h].push([d,new Promise(g=>{a.current.push(g)})]),t==null||t.chains.current[h].push([d,new Promise(g=>{Promise.all(u.current[h].map(([N,x])=>x)).then(()=>g())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=me((d,h,m)=>{Promise.all(u.current[h].splice(0).map(([g,N])=>N)).then(()=>{var g;(g=a.current.shift())==null||g()}).then(()=>m(h))});return v.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:l,chains:u}),[c,i,r,f,p,u,l])}let xh=v.Fragment,Eh=Ks.RenderStrategy;function W8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:l,enterFrom:u,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...g}=e,[N,x]=v.useState(null),P=v.useRef(null),C=vh(e),M=wt(...C?[P,t,x]:t===null?[]:[t]),L=(n=g.unmount)==null||n?Bn.Unmount:Bn.Hidden,{show:F,appear:b,initial:y}=U8(),[E,T]=v.useState(F?"visible":"hidden"),I=_8(),{register:$,unregister:D}=I;Ae(()=>$(P),[$,P]),Ae(()=>{if(L===Bn.Hidden&&P.current){if(F&&E!=="visible"){T("visible");return}return vt(E,{hidden:()=>D(P),visible:()=>$(P)})}},[E,P,$,D,F,L]);let w=yh();Ae(()=>{if(C&&w&&E==="visible"&&P.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[P,E,w,C]);let O=y&&!b,k=b&&F&&y,S=v.useRef(!1),B=wh(()=>{S.current||(T("hidden"),D(P))},I),j=me(ee=>{S.current=!0;let ve=ee?"enter":"leave";B.onStart(P,ve,K=>{K==="enter"?s==null||s():K==="leave"&&(c==null||c())})}),U=me(ee=>{let ve=ee?"enter":"leave";S.current=!1,B.onStop(P,ve,K=>{K==="enter"?i==null||i():K==="leave"&&(a==null||a())}),ve==="leave"&&!mi(B)&&(T("hidden"),D(P))});v.useEffect(()=>{C&&o||(j(F),U(F))},[F,C,o]);let _=!(!o||!C||!w||O),[,G]=Tp(_,N,F,{start:j,end:U}),Q=Ln({ref:M,className:((r=Ic(g.className,k&&l,k&&u,G.enter&&l,G.enter&&G.closed&&u,G.enter&&!G.closed&&f,G.leave&&d,G.leave&&!G.closed&&h,G.leave&&G.closed&&m,!G.transition&&F&&p))==null?void 0:r.trim())||void 0,...Pp(G)}),q=0;E==="visible"&&(q|=Ft.Open),E==="hidden"&&(q|=Ft.Closed),F&&E==="hidden"&&(q|=Ft.Opening),!F&&E==="visible"&&(q|=Ft.Closing);let W=ft();return v.createElement(hi.Provider,{value:B},v.createElement(ph,{value:q},W({ourProps:Q,theirProps:g,defaultTag:xh,features:Eh,visible:E==="visible",name:"Transition.Child"})))}function V8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=v.useRef(null),c=vh(e),a=wt(...c?[i,t]:t===null?[]:[t]);yh();let l=dl();if(n===void 0&&l!==null&&(n=(l&Ft.Open)===Ft.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=v.useState(n?"visible":"hidden"),p=wh(()=>{n||f("hidden")}),[d,h]=v.useState(!0),m=v.useRef([n]);Ae(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let g=v.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);Ae(()=>{n?f("visible"):!mi(p)&&i.current!==null&&f("hidden")},[n,p]);let N={unmount:o},x=me(()=>{var M;d&&h(!1),(M=e.beforeEnter)==null||M.call(e)}),P=me(()=>{var M;d&&h(!1),(M=e.beforeLeave)==null||M.call(e)}),C=ft();return v.createElement(hi.Provider,{value:p},v.createElement(pi.Provider,{value:g},C({ourProps:{...N,as:v.Fragment,children:v.createElement(Sh,{ref:a,...N,...s,beforeEnter:x,beforeLeave:P})},theirProps:{},defaultTag:v.Fragment,features:Eh,visible:u==="visible",name:"Transition"})))}function H8(e,t){let n=v.useContext(pi)!==null,r=dl()!==null;return v.createElement(v.Fragment,null,!n&&r?v.createElement(pl,{ref:t,...e}):v.createElement(Sh,{ref:t,...e}))}let pl=et(V8),Sh=et(W8),G8=et(H8),hl=Object.assign(pl,{Child:G8,Root:pl}),Ph=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Th(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!bn(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 Ph.test(i)&&(i=i.replace(Ph,"")),i}function q8(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():Th(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Th(e).trim()}function K8(e){let t=v.useRef(""),n=v.useRef("");return me(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=q8(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var Z8=Object.defineProperty,Y8=(e,t,n)=>t in e?Z8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ah=(e,t,n)=>(Y8(e,typeof t!="symbol"?t+"":t,n),n),Ue=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ue||{}),jn=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(jn||{}),bi=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(bi||{}),Nh=(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))(Nh||{});function Ch(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=mp(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 X8={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?di.Tracked(gh(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:Pe.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:di.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===Pe.Nothing)return{...c,activeOptionIndex:null};if(t.focus===Pe.Specific)return{...c,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===Pe.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=fi(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:p}}}}else if(t.focus===Pe.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=fi(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:p}}}}let a=Ch(e),l=fi(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!==Pe.Nothing&&(r=fi(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:Pe.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,...Ch(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:di.Moved}}};class ml extends rp{constructor(t){super(t),Ah(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return vt(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:Lc(()=>{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:Lc(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Lc(()=>{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})}}),Ah(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=Fc.get(null);this.disposables.add(r.on(ap.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}this.disposables.group(n=>{this.on(1,r=>{r.buttonElement&&(n.dispose(),n.add(F8(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 ml({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:Pe.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:di.Idle})}reduce(t,n){return vt(n.type,X8,t,n)}}const Oh=v.createContext(null);function bl(e){let t=v.useContext(Oh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ih),n}return t}function Ih({id:e,__demoMode:t=!1}){let n=v.useMemo(()=>ml.new({id:e,__demoMode:t}),[]);return hh(()=>n.dispose()),n}let gi=v.createContext(null);gi.displayName="ListboxDataContext";function Xo(e){let t=v.useContext(gi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Xo),n}return t}let J8=v.Fragment;function Q8(e,t){let n=v.useId(),r=Oc(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:l,invalid:u=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const g=p?"horizontal":"vertical";let N=wt(t),x=vx(s),[P=d?[]:void 0,C]=yx(o,a,x),M=Ih({id:n,__demoMode:h}),L=v.useRef({static:!1,hold:!1}),F=v.useRef(new Map),b=Hx(l),y=v.useCallback(_=>vt(E.mode,{[jn.Multi]:()=>P.some(G=>b(G,_)),[jn.Single]:()=>b(P,_)}),[P]),E=Dn({value:P,disabled:f,invalid:u,mode:d?jn.Multi:jn.Single,orientation:g,onChange:C,compare:b,isSelected:y,optionsPropsRef:L,listRef:F});Ae(()=>{M.state.dataRef.current=E},[E]);let T=tt(M,_=>_.listboxState),I=Fc.get(null),$=tt(I,v.useCallback(_=>I.selectors.isTop(_,n),[I,n])),[D,w]=tt(M,_=>[_.buttonElement,_.optionsElement]);y2($,[D,w],(_,G)=>{M.send({type:Nh.CloseListbox}),hp(G,Vc.Loose)||(_.preventDefault(),D==null||D.focus())});let O=Dn({open:T===Ue.Open,disabled:f,invalid:u,value:P}),[k,S]=jx({inherit:!0}),B={ref:N},j=v.useCallback(()=>{if(x!==void 0)return C==null?void 0:C(x)},[C,x]),U=ft();return v.createElement(S,{value:k,props:{htmlFor:D==null?void 0:D.id},slot:{open:T===Ue.Open,disabled:f}},v.createElement(x8,null,v.createElement(Oh.Provider,{value:M},v.createElement(gi.Provider,{value:E},v.createElement(ph,{value:vt(T,{[Ue.Open]:Ft.Open,[Ue.Closed]:Ft.Closed})},c!=null&&P!=null&&v.createElement(Ax,{disabled:f,data:{[c]:P},form:i,onReset:j}),U({ourProps:B,theirProps:m,slot:O,defaultTag:J8,name:"Listbox"}))))))}let e3="button";function t3(e,t){let n=v.useId(),r=_0(),o=Xo("Listbox.Button"),s=bl("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...l}=e,u=wt(t,g8(),s.actions.setButtonElement),f=y8(),[p,d,h]=tt(s,w=>[w.listboxState,w.buttonElement,w.optionsElement]),m=p===Ue.Open;x2(m,{trigger:d,action:v.useCallback(w=>{if(d!=null&&d.contains(w.target))return Js.Ignore;let O=w.target.closest('[role="option"]:not([data-disabled])');return bn(O)?Js.Select(O):h!=null&&h.contains(w.target)?Js.Ignore:Js.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let g=me(w=>{switch(w.key){case Be.Enter:wx(w.currentTarget);break;case Be.Space:case Be.ArrowDown:w.preventDefault(),s.actions.openListbox({focus:o.value?Pe.Nothing:Pe.First});break;case Be.ArrowUp:w.preventDefault(),s.actions.openListbox({focus:o.value?Pe.Nothing:Pe.Last});break}}),N=me(w=>{switch(w.key){case Be.Space:w.preventDefault();break}}),x=qx(w=>{var O;s.state.listboxState===Ue.Open?(qe.flushSync(()=>s.actions.closeListbox()),(O=s.state.buttonElement)==null||O.focus({preventScroll:!0})):(w.preventDefault(),s.actions.openListbox({focus:Pe.Nothing}))}),P=me(w=>w.preventDefault()),C=X0([i]),M=Bx(),{isFocusVisible:L,focusProps:F}=ox({autoFocus:a}),{isHovered:b,hoverProps:y}=rx({isDisabled:c}),{pressed:E,pressProps:T}=fx({disabled:c}),I=Dn({open:p===Ue.Open,active:E||p===Ue.Open,disabled:c,invalid:o.invalid,value:o.value,hover:b,focus:L,autofocus:a}),$=tt(s,w=>w.listboxState===Ue.Open),D=F0(f(),{ref:u,id:i,type:E2(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":$,"aria-labelledby":C,"aria-describedby":M,disabled:c||void 0,autoFocus:a,onKeyDown:g,onKeyUp:N,onKeyPress:P},x,F,y,T);return ft()({ourProps:D,theirProps:l,slot:I,defaultTag:e3,name:"Listbox.Button"})}let $h=v.createContext(!1),n3="div",r3=Ks.RenderStrategy|Ks.Static;function o3(e,t){let n=v.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,l=b8(o),[u,f]=v.useState(null);l&&(s=!0);let p=Xo("Listbox.Options"),d=bl("Listbox.Options"),[h,m,g,N]=tt(d,W=>[W.listboxState,W.buttonElement,W.optionsElement,W.__demoMode]),x=Hc(m),P=Hc(g),C=dl(),[M,L]=Tp(c,u,C!==null?(C&Ft.Open)===Ft.Open:h===Ue.Open);i2(M,m,d.actions.closeListbox);let F=N?!1:i&&h===Ue.Open;O2(F,P);let b=N?!1:i&&h===Ue.Open;s2(b,{allowed:v.useCallback(()=>[m,g],[m,g])});let y=tt(d,d.selectors.didButtonMove)?!1:M,E=tt(d,d.selectors.hasFrozenValue)&&!e.static,T=dh(E,p.value),I=v.useCallback(W=>p.compare(T,W),[p.compare,T]),$=tt(d,W=>{var ee;if(l==null||!((ee=l==null?void 0:l.to)!=null&&ee.includes("selection")))return null;let ve=W.options.findIndex(K=>I(K.dataRef.current.value));return ve===-1&&(ve=0),ve}),D=(()=>{if(l==null)return;if($===null)return{...l,inner:void 0};let W=Array.from(p.listRef.current.values());return{...l,inner:{listRef:{current:W},index:$}}})(),[w,O]=w8(D),k=v8(),S=wt(t,l?w:null,d.actions.setOptionsElement,f),B=rr();v.useEffect(()=>{let W=g;W&&h===Ue.Open&&(cx(W)||W==null||W.focus({preventScroll:!0}))},[h,g]);let j=me(W=>{var ee;switch(B.dispose(),W.key){case Be.Space:if(d.state.searchQuery!=="")return W.preventDefault(),W.stopPropagation(),d.actions.search(W.key);case Be.Enter:W.preventDefault(),W.stopPropagation(),d.actions.selectActiveOption();break;case vt(p.orientation,{vertical:Be.ArrowDown,horizontal:Be.ArrowRight}):return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Pe.Next});case vt(p.orientation,{vertical:Be.ArrowUp,horizontal:Be.ArrowLeft}):return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Pe.Previous});case Be.Home:case Be.PageUp:return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Pe.First});case Be.End:case Be.PageDown:return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Pe.Last});case Be.Escape:W.preventDefault(),W.stopPropagation(),qe.flushSync(()=>d.actions.closeListbox()),(ee=d.state.buttonElement)==null||ee.focus({preventScroll:!0});return;case Be.Tab:W.preventDefault(),W.stopPropagation(),qe.flushSync(()=>d.actions.closeListbox()),h2(d.state.buttonElement,W.shiftKey?Wc.Previous:Wc.Next);break;default:W.key.length===1&&(d.actions.search(W.key),B.setTimeout(()=>d.actions.clearSearch(),350));break}}),U=tt(d,W=>{var ee;return(ee=W.buttonElement)==null?void 0:ee.id}),_=Dn({open:h===Ue.Open}),G=F0(l?k():{},{id:r,ref:S,"aria-activedescendant":tt(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===jn.Multi?!0:void 0,"aria-labelledby":U,"aria-orientation":p.orientation,onKeyDown:j,role:"listbox",tabIndex:h===Ue.Open?0:void 0,style:{...a.style,...O,"--button-width":Gx(M,m,!0).width},...Pp(L)}),Q=ft(),q=v.useMemo(()=>p.mode===jn.Multi?p:{...p,isSelected:I},[p,I]);return v.createElement(L8,{enabled:s?e.static||M:!1,ownerDocument:x},v.createElement(gi.Provider,{value:q},Q({ourProps:G,theirProps:a,slot:_,defaultTag:n3,features:r3,visible:y,name:"Listbox.Options"})))}let s3="div";function i3(e,t){let n=v.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=v.useContext($h)===!0,a=Xo("Listbox.Option"),l=bl("Listbox.Option"),u=tt(l,E=>l.selectors.isActive(E,r)),f=a.isSelected(s),p=v.useRef(null),d=K8(p),h=or({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=wt(t,p,E=>{E?a.listRef.current.set(r,E):a.listRef.current.delete(r)}),g=tt(l,E=>l.selectors.shouldScrollIntoView(E,r));Ae(()=>{if(g)return ut().requestAnimationFrame(()=>{var E,T;(T=(E=p.current)==null?void 0:E.scrollIntoView)==null||T.call(E,{block:"nearest"})})},[g,p]),Ae(()=>{if(!c)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,c]);let N=me(E=>{if(o)return E.preventDefault();l.actions.selectOption(s)}),x=me(()=>{if(o)return l.actions.goToOption({focus:Pe.Nothing});l.actions.goToOption({focus:Pe.Specific,id:r})}),P=I2(),C=me(E=>P.update(E)),M=me(E=>{P.wasMoved(E)&&(o||u&&l.state.activationTrigger===bi.Pointer||l.actions.goToOption({focus:Pe.Specific,id:r},bi.Pointer))}),L=me(E=>{P.wasMoved(E)&&(o||u&&l.state.activationTrigger===bi.Pointer&&l.actions.goToOption({focus:Pe.Nothing}))}),F=Dn({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&c}),b=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:N,onFocus:x,onPointerEnter:C,onMouseEnter:C,onPointerMove:M,onMouseMove:M,onPointerLeave:L,onMouseLeave:L},y=ft();return!f&&c?null:y({ourProps:b,theirProps:i,slot:F,defaultTag:s3,name:"Listbox.Option"})}let a3=v.Fragment;function c3(e,t){let{options:n,placeholder:r,...o}=e,s={ref:wt(t)},i=Xo("ListboxSelectedOption"),c=Dn({}),a=i.value===void 0||i.value===null||i.mode===jn.Multi&&Array.isArray(i.value)&&i.value.length===0,l=ft();return v.createElement($h.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:v.createElement(v.Fragment,null,r&&a?r:n)},slot:c,defaultTag:a3,name:"ListboxSelectedOption"}))}let l3=et(Q8),u3=et(t3),f3=Wx,d3=et(o3),p3=et(i3),h3=et(c3),St=Object.assign(l3,{Button:u3,Label:f3,Options:d3,Option:p3,SelectedOption:h3});const m3=()=>A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[A.jsx("g",{clipPath:"url(#clip0_active)",children:A.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"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_active",children:A.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),b3=()=>A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[A.jsx("g",{clipPath:"url(#clip0_inactive)",children:A.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"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_inactive",children:A.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Jo=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return A.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>A.jsx("div",{className:"flex items-center justify-center",children:o>t-e?A.jsx(m3,{}):A.jsx(b3,{})},o))})};class Rt{}os(Rt,"FAST",3),os(Rt,"Medium",2),os(Rt,"SLOW",1),os(Rt,"NONE",0);const g3=Object.values({MAINNET:1,SEPOLIA:11155111}),xn=e=>{const t=typeof e=="string"?parseInt(e,10):e;return g3.includes(t)},y3={USDT:!0},kh=(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:!y3[t.toUpperCase()]:!0},v3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=Nt();return A.jsx("div",{className:`relative ${o}`,children:A.jsx(St,{value:t,onChange:n,disabled:r,children:({open:c})=>A.jsxs(A.Fragment,{children:[A.jsxs(St.Button,{className:`
|
|
139
|
+
*/var sE=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ec=sE.join(","),kp=typeof Element>"u",Ko=kp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ii=!kp&&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},Zo=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&&Zo(t.parentNode);return i},iE=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},aE=function(t,n,r){if(Zo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(ec));return n&&Ko.call(t,ec)&&o.unshift(t),o=o.filter(r),o},tc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Zo(i,!1))if(i.tagName==="SLOT"){var l=i.assignedElements(),a=l.length?l:i.children,c=tc(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=Ko.call(i,ec);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Zo(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=tc(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},Mp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Dp=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||iE(t))&&!Mp(t)?0:t.tabIndex},lE=function(t,n){var r=Dp(t);return r<0&&n&&!Mp(t)?0:r},cE=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Bp=function(t){return t.tagName==="INPUT"},uE=function(t){return Bp(t)&&t.type==="hidden"},fE=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},dE=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},pE=function(t){if(!t.name)return!0;var n=t.form||ii(t),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=dE(o,t.form);return!s||s===t},hE=function(t){return Bp(t)&&t.type==="radio"},mE=function(t){return hE(t)&&!pE(t)},bE=function(t){var n,r=t&&ii(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,l,a;for(s=!!((i=o)!==null&&i!==void 0&&(l=i.ownerDocument)!==null&&l!==void 0&&l.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var c,u,f;r=ii(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Lp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},gE=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=Ko.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(Ko.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var c=t.parentElement,u=ii(t);if(c&&!c.shadowRoot&&o(c)===!0)return Lp(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=a}if(bE(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Lp(t);return!1},yE=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 Ko.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},vE=function(t,n){return!(n.disabled||Zo(n)||uE(n)||gE(n,t)||fE(n)||yE(n))},Fp=function(t,n){return!(mE(n)||Dp(n)<0||!vE(t,n))},wE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Rp=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,l=i?o.scopeParent:o,a=lE(l,i),c=i?Rp(o.candidates):l;a===0?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:c})}),r.sort(cE).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},jp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=tc([t],n.includeContainer,{filter:Fp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:wE}):r=aE(t,n.includeContainer,Fp.bind(null,n)),Rp(r)};function zp(e,t,n){let{reference:r,floating:o}=e;const s=wn(t),i=Jl(t),l=Xl(i),a=Rn(t),c=s==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[l]/2-o[l]/2;let d;switch(a){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(Fr(t)){case"start":d[i]-=p*(n&&c?-1:1);break;case"end":d[i]+=p*(n&&c?-1:1);break}return d}const xE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=zp(c,r,a),p=r,d={},h=0;for(let m=0;m<l.length;m++){const{name:g,fn:N}=l[m],{x,y:P,data:C,reset:D}=await N({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:i,elements:{reference:e,floating:t}});u=x??u,f=P??f,d={...d,[g]:{...d[g],...C}},D&&h<=50&&(h++,typeof D=="object"&&(D.placement&&(p=D.placement),D.rects&&(c=D.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):D.rects),{x:u,y:f}=zp(c,p,a)),m=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}};async function ai(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=ir(t,e),h=$p(d),g=l[p?f==="floating"?"reference":"floating":f],N=si(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),C=await(s.isElement==null?void 0:s.isElement(P))?await(s.getScale==null?void 0:s.getScale(P))||{x:1,y:1}:{x:1,y:1},D=si(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:P,strategy:a}):x);return{top:(N.top-D.top+h.top)/C.y,bottom:(D.bottom-N.bottom+h.bottom)/C.y,left:(N.left-D.left+h.left)/C.x,right:(D.right-N.right+h.right)/C.x}}const EE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:a}=t,{element:c,padding:u=0}=ir(e,t)||{};if(c==null)return{};const f=$p(u),p={x:n,y:r},d=Jl(o),h=Xl(d),m=await i.getDimensions(c),g=d==="y",N=g?"top":"left",x=g?"bottom":"right",P=g?"clientHeight":"clientWidth",C=s.reference[h]+s.reference[d]-p[d]-s.floating[h],D=p[d]-s.reference[d],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let L=F?F[P]:0;(!L||!await(i.isElement==null?void 0:i.isElement(F)))&&(L=l.floating[P]||s.floating[h]);const b=C/2-D/2,v=L/2-m[h]/2-1,E=vn(f[N],v),$=vn(f[x],v),I=E,T=L-m[h]-$,B=L/2-m[h]/2+b,w=Yl(I,B,T),O=!a.arrow&&Fr(o)!=null&&B!==w&&s.reference[h]/2-(B<I?E:$)-m[h]/2<0,k=O?B<I?B-I:B-T:0;return{[d]:p[d]+k,data:{[d]:w,centerOffset:B-w-k,...O&&{alignmentOffset:k}},reset:O}}}),SE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=ir(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const N=Rn(o),x=wn(l),P=Rn(l)===l,C=await(a.isRTL==null?void 0:a.isRTL(c.floating)),D=p||(P||!m?[oi(l)]:Q2(l)),F=h!=="none";!p&&F&&D.push(...rE(l,m,h,C));const L=[l,...D],b=await ai(t,g),v=[];let E=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&v.push(b[N]),f){const B=J2(o,i,C);v.push(b[B[0]],b[B[1]])}if(E=[...E,{placement:o,overflows:v}],!v.every(B=>B<=0)){var $,I;const B=((($=s.flip)==null?void 0:$.index)||0)+1,w=L[B];if(w&&(!(f==="alignment"?x!==wn(w):!1)||E.every(S=>wn(S.placement)===x?S.overflows[0]>0:!0)))return{data:{index:B,overflows:E},reset:{placement:w}};let O=(I=E.filter(k=>k.overflows[0]<=0).sort((k,S)=>k.overflows[1]-S.overflows[1])[0])==null?void 0:I.placement;if(!O)switch(d){case"bestFit":{var T;const k=(T=E.filter(S=>{if(F){const M=wn(S.placement);return M===x||M==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(M=>M>0).reduce((M,j)=>M+j,0)]).sort((S,M)=>S[1]-M[1])[0])==null?void 0:T[0];k&&(O=k);break}case"initialPlacement":O=l;break}if(o!==O)return{reset:{placement:O}}}return{}}}},PE=new Set(["left","top"]);async function TE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Rn(n),l=Fr(n),a=wn(n)==="y",c=PE.has(i)?-1:1,u=s&&a?-1:1,f=ir(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof h=="number"&&(d=l==="end"?h*-1:h),a?{x:d*u,y:p*c}:{x:p*c,y:d*u}}const AE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,a=await TE(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},NE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:g=>{let{x:N,y:x}=g;return{x:N,y:x}}},...a}=ir(e,t),c={x:n,y:r},u=await ai(t,a),f=wn(Rn(o)),p=Cp(f);let d=c[p],h=c[f];if(s){const g=p==="y"?"top":"left",N=p==="y"?"bottom":"right",x=d+u[g],P=d-u[N];d=Yl(x,d,P)}if(i){const g=f==="y"?"top":"left",N=f==="y"?"bottom":"right",x=h+u[g],P=h-u[N];h=Yl(x,h,P)}const m=l.fn({...t,[p]:d,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},CE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:a=()=>{},...c}=ir(e,t),u=await ai(t,c),f=Rn(o),p=Fr(o),d=wn(o)==="y",{width:h,height:m}=s.floating;let g,N;f==="top"||f==="bottom"?(g=f,N=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(N=f,g=p==="end"?"top":"bottom");const x=m-u.top-u.bottom,P=h-u.left-u.right,C=vn(m-u[g],x),D=vn(h-u[N],P),F=!t.middlewareData.shift;let L=C,b=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(b=P),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=x),F&&!p){const E=ze(u.left,0),$=ze(u.right,0),I=ze(u.top,0),T=ze(u.bottom,0);d?b=h-2*(E!==0||$!==0?E+$:ze(u.left,u.right)):L=m-2*(I!==0||T!==0?I+T:ze(u.top,u.bottom))}await a({...t,availableWidth:b,availableHeight:L});const v=await i.getDimensions(l.floating);return h!==v.width||m!==v.height?{reset:{rects:!0}}:{}}}};function Up(e){const t=St(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=He(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=qo(n)!==s||qo(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function nc(e){return ye(e)?e:e.contextElement}function Rr(e){const t=nc(e);if(!He(t))return Xt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Up(t);let i=(s?qo(n.width):n.width)/r,l=(s?qo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const OE=Xt(0);function _p(e){const t=rt(e);return!ti()||!t.visualViewport?OE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function IE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==rt(e)?!1:t}function ar(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=nc(e);let i=Xt(1);t&&(r?ye(r)&&(i=Rr(r)):i=Rr(e));const l=IE(s,n,r)?_p(s):Xt(0);let a=(o.left+l.x)/i.x,c=(o.top+l.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const p=rt(s),d=r&&ye(r)?rt(r):r;let h=p,m=Zl(h);for(;m&&r&&d!==h;){const g=Rr(m),N=m.getBoundingClientRect(),x=St(m),P=N.left+(m.clientLeft+parseFloat(x.paddingLeft))*g.x,C=N.top+(m.clientTop+parseFloat(x.paddingTop))*g.y;a*=g.x,c*=g.y,u*=g.x,f*=g.y,a+=P,c+=C,h=rt(m),m=Zl(h)}}return si({width:u,height:f,x:a,y:c})}function li(e,t){const n=ni(e).scrollLeft;return t?t.left+n:ar(Yt(e)).left+n}function Wp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-li(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function $E(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Yt(r),l=t?ei(t.floating):!1;if(r===i||l&&s)return n;let a={scrollLeft:0,scrollTop:0},c=Xt(1);const u=Xt(0),f=He(r);if((f||!f&&!s)&&((Lr(r)!=="body"||Go(i))&&(a=ni(r)),He(r))){const d=ar(r);c=Rr(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=i&&!f&&!s?Wp(i,a):Xt(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-a.scrollTop*c.y+u.y+p.y}}function kE(e){return Array.from(e.getClientRects())}function ME(e){const t=Yt(e),n=ni(e),r=e.ownerDocument.body,o=ze(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ze(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+li(e);const l=-n.scrollTop;return St(r).direction==="rtl"&&(i+=ze(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Vp=25;function DE(e,t){const n=rt(e),r=Yt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,a=0;if(o){s=o.width,i=o.height;const u=ti();(!u||u&&t==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=li(r);if(c<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),d=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Vp&&(s-=h)}else c<=Vp&&(s+=c);return{width:s,height:i,x:l,y:a}}const BE=new Set(["absolute","fixed"]);function LE(e,t){const n=ar(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=He(e)?Rr(e):Xt(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,a=o*s.x,c=r*s.y;return{width:i,height:l,x:a,y:c}}function Hp(e,t,n){let r;if(t==="viewport")r=DE(e,n);else if(t==="document")r=ME(Yt(e));else if(ye(t))r=LE(t,n);else{const o=_p(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return si(r)}function Gp(e,t){const n=yn(e);return n===t||!ye(n)||gn(n)?!1:St(n).position==="fixed"||Gp(n,t)}function FE(e,t){const n=t.get(e);if(n)return n;let r=Fn(e,[],!1).filter(l=>ye(l)&&Lr(l)!=="body"),o=null;const s=St(e).position==="fixed";let i=s?yn(e):e;for(;ye(i)&&!gn(i);){const l=St(i),a=Kl(i);!a&&l.position==="fixed"&&(o=null),(s?!a&&!o:!a&&l.position==="static"&&!!o&&BE.has(o.position)||Go(i)&&!a&&Gp(e,i))?r=r.filter(u=>u!==i):o=l,i=yn(i)}return t.set(e,r),r}function RE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?ei(t)?[]:FE(t,this._c):[].concat(n),r],l=i[0],a=i.reduce((c,u)=>{const f=Hp(t,u,o);return c.top=ze(f.top,c.top),c.right=vn(f.right,c.right),c.bottom=vn(f.bottom,c.bottom),c.left=ze(f.left,c.left),c},Hp(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function jE(e){const{width:t,height:n}=Up(e);return{width:t,height:n}}function zE(e,t,n){const r=He(t),o=Yt(t),s=n==="fixed",i=ar(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=Xt(0);function c(){a.x=li(o)}if(r||!r&&!s)if((Lr(t)!=="body"||Go(o))&&(l=ni(t)),r){const d=ar(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?Wp(o,l):Xt(0),f=i.left+l.scrollLeft-a.x-u.x,p=i.top+l.scrollTop-a.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function rc(e){return St(e).position==="static"}function qp(e,t){if(!He(e)||St(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Yt(e)===n&&(n=n.ownerDocument.body),n}function Kp(e,t){const n=rt(e);if(ei(e))return n;if(!He(e)){let o=yn(e);for(;o&&!gn(o);){if(ye(o)&&!rc(o))return o;o=yn(o)}return n}let r=qp(e,t);for(;r&&U2(r)&&rc(r);)r=qp(r,t);return r&&gn(r)&&rc(r)&&!Kl(r)?n:r||G2(e)||n}const UE=async function(e){const t=this.getOffsetParent||Kp,n=this.getDimensions,r=await n(e.floating);return{reference:zE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _E(e){return St(e).direction==="rtl"}const WE={convertOffsetParentRelativeRectToViewportRelativeRect:$E,getDocumentElement:Yt,getClippingRect:RE,getOffsetParent:Kp,getElementRects:UE,getClientRects:kE,getDimensions:jE,getScale:Rr,isElement:ye,isRTL:_E};function Zp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function VE(e,t){let n=null,r;const o=Yt(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const c=e.getBoundingClientRect(),{left:u,top:f,width:p,height:d}=c;if(l||t(),!p||!d)return;const h=ri(f),m=ri(o.clientWidth-(u+p)),g=ri(o.clientHeight-(f+d)),N=ri(u),P={rootMargin:-h+"px "+-m+"px "+-g+"px "+-N+"px",threshold:ze(0,vn(1,a))||1};let C=!0;function D(F){const L=F[0].intersectionRatio;if(L!==a){if(!C)return i();L?i(!1,L):r=setTimeout(()=>{i(!1,1e-7)},1e3)}L===1&&!Zp(c,e.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(D,{...P,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,P)}n.observe(e)}return i(!0),s}function Yp(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=nc(e),u=o||s?[...c?Fn(c):[],...Fn(t)]:[];u.forEach(N=>{o&&N.addEventListener("scroll",n,{passive:!0}),s&&N.addEventListener("resize",n)});const f=c&&l?VE(c,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(N=>{let[x]=N;x&&x.target===c&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var P;(P=d)==null||P.observe(t)})),n()}),c&&!a&&d.observe(c),d.observe(t));let h,m=a?ar(e):null;a&&g();function g(){const N=ar(e);m&&!Zp(m,N)&&n(),m=N,h=requestAnimationFrame(g)}return n(),()=>{var N;u.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(N=d)==null||N.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const oc=ai,HE=AE,GE=NE,qE=SE,KE=CE,Xp=EE,ZE=(e,t,n)=>{const r=new Map,o={platform:WE,...n},s={...o.platform,_c:r};return xE(e,t,{...o,platform:s})};var YE=typeof document<"u",XE=function(){},ci=YE?y.useLayoutEffect:XE;function ui(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(!ui(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)&&!ui(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Jp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qp(e,t){const n=Jp(e);return Math.round(t*n)/n}function sc(e){const t=U.useRef(e);return ci(()=>{t.current=e}),t}function eh(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:a,open:c}=e,[u,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=U.useState(r);ui(p,r)||d(r);const[h,m]=U.useState(null),[g,N]=U.useState(null),x=U.useCallback(S=>{S!==F.current&&(F.current=S,m(S))},[]),P=U.useCallback(S=>{S!==L.current&&(L.current=S,N(S))},[]),C=s||h,D=i||g,F=U.useRef(null),L=U.useRef(null),b=U.useRef(u),v=a!=null,E=sc(a),$=sc(o),I=sc(c),T=U.useCallback(()=>{if(!F.current||!L.current)return;const S={placement:t,strategy:n,middleware:p};$.current&&(S.platform=$.current),ZE(F.current,L.current,S).then(M=>{const j={...M,isPositioned:I.current!==!1};B.current&&!ui(b.current,j)&&(b.current=j,Hr.flushSync(()=>{f(j)}))})},[p,t,n,$,I]);ci(()=>{c===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,f(S=>({...S,isPositioned:!1})))},[c]);const B=U.useRef(!1);ci(()=>(B.current=!0,()=>{B.current=!1}),[]),ci(()=>{if(C&&(F.current=C),D&&(L.current=D),C&&D){if(E.current)return E.current(C,D,T);T()}},[C,D,T,E,v]);const w=U.useMemo(()=>({reference:F,floating:L,setReference:x,setFloating:P}),[x,P]),O=U.useMemo(()=>({reference:C,floating:D}),[C,D]),k=U.useMemo(()=>{const S={position:n,left:0,top:0};if(!O.floating)return S;const M=Qp(O.floating,u.x),j=Qp(O.floating,u.y);return l?{...S,transform:"translate("+M+"px, "+j+"px)",...Jp(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:j}},[n,l,O.floating,u.x,u.y]);return U.useMemo(()=>({...u,update:T,refs:w,elements:O,floatingStyles:k}),[u,T,w,O,k])}const JE=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?Xp({element:r.current,padding:o}).fn(n):{}:r?Xp({element:r,padding:o}).fn(n):{}}}},ic=(e,t)=>({...HE(e),options:[e,t]}),th=(e,t)=>({...GE(e),options:[e,t]}),nh=(e,t)=>({...qE(e),options:[e,t]}),QE=(e,t)=>({...KE(e),options:[e,t]}),e8=(e,t)=>({...JE(e),options:[e,t]}),rh={...U},t8=rh.useInsertionEffect||(e=>e());function oh(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return t8(()=>{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 ac=typeof document<"u"?y.useLayoutEffect:y.useEffect;let sh=!1,n8=0;const ih=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+n8++;function r8(){const[e,t]=U.useState(()=>sh?ih():void 0);return ac(()=>{e==null&&t(ih())},[]),U.useEffect(()=>{sh=!0},[]),e}const o8=rh.useId||r8;let Yo;process.env.NODE_ENV!=="production"&&(Yo=new Set);function s8(){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=Yo)!=null&&e.has(o))){var s;(s=Yo)==null||s.add(o),console.warn(o)}}function i8(){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=Yo)!=null&&e.has(o))){var s;(s=Yo)==null||s.add(o),console.error(o)}}function a8(){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 l8=U.createContext(null),c8=U.createContext(null),u8=()=>{var e;return((e=U.useContext(l8))==null?void 0:e.id)||null},f8=()=>U.useContext(c8),d8="data-floating-ui-focusable";function p8(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=o8(),s=U.useRef({}),[i]=U.useState(()=>a8()),l=u8()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!ye(d)&&i8("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=oh((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:l}),n==null||n(d,h,m)}),f=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function h8(e){e===void 0&&(e={});const{nodeId:t}=e,n=p8({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=f8();ac(()=>{u&&(f.current=u)},[u]);const d=eh({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(P=>{const C=ye(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;a(C),d.refs.setReference(C)},[d.refs]),m=U.useCallback(P=>{(ye(P)||P===null)&&(f.current=P,i(P)),(ye(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!ye(P))&&d.refs.setReference(P)},[d.refs]),g=U.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),N=U.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=U.useMemo(()=>({...d,...r,refs:g,elements:N,nodeId:t}),[d,g,N,t,r]);return ac(()=>{r.dataRef.current.floatingContext=x;const P=p==null?void 0:p.nodesRef.current.find(C=>C.id===t);P&&(P.context=x)}),U.useMemo(()=>({...d,context:x,refs:g,elements:N}),[d,g,N,x])}const ah="active",lh="selected";function lc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[ah]:i,[lh]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[d8]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[ah,lh].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),i[c]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(c))==null?void 0:p.map(g=>g(...h)).find(g=>g!==void 0)}}}else i[c]=u}),i),{})}}function m8(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>lc(l,e,"reference"),t),s=U.useCallback(l=>lc(l,e,"floating"),n),i=U.useCallback(l=>lc(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function ch(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const b8=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:l=4,referenceOverflowThreshold:a=0,scrollRef:c,...u}=ir(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(c==null?void 0:c.current)||p,m=p.clientTop||h.clientTop,g=p.clientTop!==0,N=h.clientTop!==0,x=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||s8('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const P={...t,...await ic(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},C=await oc(ch(P,h.scrollHeight+m+p.clientTop),u),D=await oc(P,{...u,elementContext:"reference"}),F=ze(0,C.top),L=P.y+F,E=(h.scrollHeight>h.clientHeight?$=>$:qo)(ze(0,h.scrollHeight+(g&&x||N?m*2:0)-F-ze(0,C.bottom)));if(h.style.maxHeight=E+"px",h.scrollTop=F,o){const $=h.offsetHeight<d.offsetHeight*vn(l,n.current.length)-1||D.top>=-a||D.bottom>=-a;Hr.flushSync(()=>o($))}return r&&(r.current=await oc(ch({...P,y:L},h.offsetHeight+m+p.clientTop),u)),{y:L}}});function g8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:l}=t,a=oh(l),c=U.useRef(!1),u=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const g=m.deltaY,N=s.current.top>=-.5,x=s.current.bottom>=-.5,P=h.scrollHeight-h.clientHeight,C=g<0?-1:1,D=g<0?"max":"min";h.scrollHeight<=h.clientHeight||(!N&&g>0||!x&&g<0?(m.preventDefault(),Hr.flushSync(()=>{a(F=>F+Math[D](g,P*C))})):/firefox/i.test(K2())&&(h.scrollTop+=g))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{u.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=U.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!c.current)){if(u.current!==null){const h=d.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Hr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{u.current=d.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:p}:{},[o,p])}let jr=y.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});jr.displayName="FloatingContext";let cc=y.createContext(null);cc.displayName="PlacementContext";function y8(e){return y.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function v8(){return y.useContext(jr).setReference}function w8(){return y.useContext(jr).getReferenceProps}function x8(){let{getFloatingProps:e,slot:t}=y.useContext(jr);return y.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function E8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=y.useContext(cc),n=y.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Ne(()=>{t==null||t(n??null)},[t,n]);let r=y.useContext(jr);return y.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let uh=4;function S8({children:e,enabled:t=!0}){let[n,r]=y.useState(null),[o,s]=y.useState(0),i=y.useRef(null),[l,a]=y.useState(null);P8(l);let c=t&&n!==null&&l!==null,{to:u="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=T8(n,l),[m,g="center"]=u.split(" ");Ne(()=>{c&&s(0)},[c]);let{refs:N,floatingStyles:x,context:P}=h8({open:c,placement:m==="selection"?g==="center"?"bottom":`bottom-${g}`:g==="center"?`${m}`:`${m}-${g}`,strategy:"absolute",transform:!1,middleware:[ic({mainAxis:m==="selection"?0:f,crossAxis:p}),th({padding:d}),m!=="selection"&&nh({padding:d}),m==="selection"&&h?b8({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:uh,referenceOverflowThreshold:d,onFallbackChange($){var I,T;if(!$)return;let B=P.elements.floating;if(!B)return;let w=parseFloat(getComputedStyle(B).scrollPaddingBottom)||0,O=Math.min(uh,B.childElementCount),k=0,S=0;for(let M of(T=(I=P.elements.floating)==null?void 0:I.childNodes)!=null?T:[])if(bn(M)){let j=M.offsetTop,z=j+M.clientHeight+w,_=B.scrollTop,q=_+B.clientHeight;if(j>=_&&z<=q)O--;else{S=Math.max(0,Math.min(z,q)-Math.max(j,_)),k=M.clientHeight;break}}O>=1&&s(M=>{let j=k*O-S+w;return M>=j?M:j})}}):null,QE({padding:d,apply({availableWidth:$,availableHeight:I,elements:T}){Object.assign(T.floating.style,{overflow:"auto",maxWidth:`${$}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${I}px)`})}})].filter(Boolean),whileElementsMounted:Yp}),[C=m,D=g]=P.placement.split("-");m==="selection"&&(C="selection");let F=y.useMemo(()=>({anchor:[C,D].filter(Boolean).join(" ")}),[C,D]),L=g8(P,{overflowRef:i,onChange:s}),{getReferenceProps:b,getFloatingProps:v}=m8([L]),E=me($=>{a($),N.setFloating($)});return U.createElement(cc.Provider,{value:r},U.createElement(jr.Provider,{value:{setFloating:E,setReference:N.setReference,styles:x,getReferenceProps:b,getFloatingProps:v,slot:F}},e))}function P8(e){Ne(()=>{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 T8(e,t){var n,r,o;let s=uc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=uc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),l=uc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:l}}function uc(e,t,n=void 0){let r=rr(),o=me((a,c)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!c)return[n,null];let u=dh(a,c);return[u,f=>{let p=fh(a);{let d=p.map(h=>window.getComputedStyle(c).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[N,x]of p.entries()){let P=window.getComputedStyle(c).getPropertyValue(x);if(d[N]!==P){d[N]=P,m=!0;break}}if(!m)return;let g=dh(a,c);u!==g&&(f(g),u=g)})}return r.dispose}]}return[n,null]}),s=y.useMemo(()=>o(e,t)[0],[e,t]),[i=s,l]=y.useState();return Ne(()=>{let[a,c]=o(e,t);if(l(a),!!c)return c(l)},[e,t]),i}function fh(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,...fh(o)]:[r]}return[]}function dh(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 A8({children:e,freeze:t},n){let r=ph(t,e);return y.isValidElement(r)?y.cloneElement(r,{ref:n}):y.createElement(y.Fragment,null,r)}y.forwardRef(A8);function ph(e,t){let[n,r]=y.useState(t);return!e&&n!==t&&r(t),e?n:t}let fc=y.createContext(null);fc.displayName="OpenClosedContext";var Rt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Rt||{});function dc(){return y.useContext(fc)}function hh({value:e,children:t}){return y.createElement(fc.Provider,{value:e},t)}function N8(e){throw new Error("Unexpected object: "+e)}var Te=(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))(Te||{});function fi(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:N8(e)}}function mh(e){let t=me(e),n=y.useRef(!1);y.useEffect(()=>(n.current=!1,()=>{n.current=!0,L0(()=>{n.current&&t()})}),[t])}let C8=y.createContext(!1);function O8(){return y.useContext(C8)}function I8(e){let t=O8(),n=y.useContext(gh),[r,o]=y.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Kt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let l=e.createElement("div");return l.setAttribute("id","headlessui-portal-root"),e.body.appendChild(l)});return y.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),y.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let bh=y.Fragment,$8=tt(function(e,t){let{ownerDocument:n=null,...r}=e,o=y.useRef(null),s=xt(Lx(p=>{o.current=p}),t),i=Hl(o.current),l=n??i,a=I8(l),c=y.useContext(B8),u=rr(),f=dt();return mh(()=>{var p;a&&a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a))}),a?Ke.createPortal(y.createElement("div",{"data-headlessui-portal":"",ref:p=>{u.dispose(),c&&p&&u.add(c.register(p))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:bh,name:"Portal"})),a):null});function k8(e,t){let n=xt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=dt();return r?y.createElement($8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:bh,name:"Portal"})}let M8=y.Fragment,gh=y.createContext(null);function D8(e,t){let{target:n,...r}=e,o={ref:xt(t)},s=dt();return y.createElement(gh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:M8,name:"Popover.Group"}))}let B8=y.createContext(null),L8=tt(k8),F8=tt(D8),R8=Object.assign(L8,{Group:F8});const di={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function yh(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function j8(e,t,n){let r=ft();if(t.kind==="Tracked"){let o=function(){s!==yh(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 z8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function vh(){let e=z8(),[t,n]=U.useState(Kt.isHandoffComplete);return t&&Kt.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>Kt.handoff(),[]),e?!1:t}function U8(){let e=y.useRef(!1);return Ne(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function wh(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!_o((t=e.as)!=null?t:Eh)||y.Children.count(e.children)===1}let pi=y.createContext(null);pi.displayName="TransitionContext";var _8=(e=>(e.Visible="visible",e.Hidden="hidden",e))(_8||{});function W8(){let e=y.useContext(pi);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function V8(){let e=y.useContext(hi);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let hi=y.createContext(null);hi.displayName="NestingContext";function mi(e){return"children"in e?mi(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function xh(e,t){let n=or(e),r=y.useRef([]),o=U8(),s=rr(),i=me((d,h=Bn.Hidden)=>{let m=r.current.findIndex(({el:g})=>g===d);m!==-1&&(wt(h,{[Bn.Unmount](){r.current.splice(m,1)},[Bn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var g;!mi(r)&&o.current&&((g=n.current)==null||g.call(n))}))}),l=me(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,Bn.Unmount)}),a=y.useRef([]),c=y.useRef(Promise.resolve()),u=y.useRef({enter:[],leave:[]}),f=me((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([g])=>g!==d)),t==null||t.chains.current[h].push([d,new Promise(g=>{a.current.push(g)})]),t==null||t.chains.current[h].push([d,new Promise(g=>{Promise.all(u.current[h].map(([N,x])=>x)).then(()=>g())})]),h==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=me((d,h,m)=>{Promise.all(u.current[h].splice(0).map(([g,N])=>N)).then(()=>{var g;(g=a.current.shift())==null||g()}).then(()=>m(h))});return y.useMemo(()=>({children:r,register:l,unregister:i,onStart:f,onStop:p,wait:c,chains:u}),[l,i,r,f,p,u,c])}let Eh=y.Fragment,Sh=Ks.RenderStrategy;function H8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:l,afterLeave:a,enter:c,enterFrom:u,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...g}=e,[N,x]=y.useState(null),P=y.useRef(null),C=wh(e),D=xt(...C?[P,t,x]:t===null?[]:[t]),F=(n=g.unmount)==null||n?Bn.Unmount:Bn.Hidden,{show:L,appear:b,initial:v}=W8(),[E,$]=y.useState(L?"visible":"hidden"),I=V8(),{register:T,unregister:B}=I;Ne(()=>T(P),[T,P]),Ne(()=>{if(F===Bn.Hidden&&P.current){if(L&&E!=="visible"){$("visible");return}return wt(E,{hidden:()=>B(P),visible:()=>T(P)})}},[E,P,T,B,L,F]);let w=vh();Ne(()=>{if(C&&w&&E==="visible"&&P.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[P,E,w,C]);let O=v&&!b,k=b&&L&&v,S=y.useRef(!1),M=xh(()=>{S.current||($("hidden"),B(P))},I),j=me(te=>{S.current=!0;let be=te?"enter":"leave";M.onStart(P,be,de=>{de==="enter"?s==null||s():de==="leave"&&(l==null||l())})}),z=me(te=>{let be=te?"enter":"leave";S.current=!1,M.onStop(P,be,de=>{de==="enter"?i==null||i():de==="leave"&&(a==null||a())}),be==="leave"&&!mi(M)&&($("hidden"),B(P))});y.useEffect(()=>{C&&o||(j(L),z(L))},[L,C,o]);let _=!(!o||!C||!w||O),[,q]=Ap(_,N,L,{start:j,end:z}),Q=Ln({ref:D,className:((r=Il(g.className,k&&c,k&&u,q.enter&&c,q.enter&&q.closed&&u,q.enter&&!q.closed&&f,q.leave&&d,q.leave&&!q.closed&&h,q.leave&&q.closed&&m,!q.transition&&L&&p))==null?void 0:r.trim())||void 0,...Tp(q)}),K=0;E==="visible"&&(K|=Rt.Open),E==="hidden"&&(K|=Rt.Closed),L&&E==="hidden"&&(K|=Rt.Opening),!L&&E==="visible"&&(K|=Rt.Closing);let W=dt();return y.createElement(hi.Provider,{value:M},y.createElement(hh,{value:K},W({ourProps:Q,theirProps:g,defaultTag:Eh,features:Sh,visible:E==="visible",name:"Transition.Child"})))}function G8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=y.useRef(null),l=wh(e),a=xt(...l?[i,t]:t===null?[]:[t]);vh();let c=dc();if(n===void 0&&c!==null&&(n=(c&Rt.Open)===Rt.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=y.useState(n?"visible":"hidden"),p=xh(()=>{n||f("hidden")}),[d,h]=y.useState(!0),m=y.useRef([n]);Ne(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let g=y.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);Ne(()=>{n?f("visible"):!mi(p)&&i.current!==null&&f("hidden")},[n,p]);let N={unmount:o},x=me(()=>{var D;d&&h(!1),(D=e.beforeEnter)==null||D.call(e)}),P=me(()=>{var D;d&&h(!1),(D=e.beforeLeave)==null||D.call(e)}),C=dt();return y.createElement(hi.Provider,{value:p},y.createElement(pi.Provider,{value:g},C({ourProps:{...N,as:y.Fragment,children:y.createElement(Ph,{ref:a,...N,...s,beforeEnter:x,beforeLeave:P})},theirProps:{},defaultTag:y.Fragment,features:Sh,visible:u==="visible",name:"Transition"})))}function q8(e,t){let n=y.useContext(pi)!==null,r=dc()!==null;return y.createElement(y.Fragment,null,!n&&r?y.createElement(pc,{ref:t,...e}):y.createElement(Ph,{ref:t,...e}))}let pc=tt(G8),Ph=tt(H8),K8=tt(q8),hc=Object.assign(pc,{Child:K8,Root:pc}),Th=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Ah(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!bn(o))return r;let s=!1;for(let l of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))l.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Th.test(i)&&(i=i.replace(Th,"")),i}function Z8(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():Ah(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Ah(e).trim()}function Y8(e){let t=y.useRef(""),n=y.useRef("");return me(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=Z8(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var X8=Object.defineProperty,J8=(e,t,n)=>t in e?X8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nh=(e,t,n)=>(J8(e,typeof t!="symbol"?t+"":t,n),n),Ue=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ue||{}),jn=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(jn||{}),bi=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(bi||{}),Ch=(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))(Ch||{});function Oh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=bp(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let Q8={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?di.Tracked(yh(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:Te.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:di.Idle}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let l={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===Te.Nothing)return{...l,activeOptionIndex:null};if(t.focus===Te.Specific)return{...l,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===Te.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=fi(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...l,activeOptionIndex:p}}}}else if(t.focus===Te.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=fi(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...l,activeOptionIndex:p}}}}let a=Oh(e),c=fi(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...l,...a,activeOptionIndex:c}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var l;return!i.dataRef.current.disabled&&((l=i.dataRef.current.textValue)==null?void 0:l.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5(e){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==Te.Nothing&&(r=fi(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:Te.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,...Oh(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:di.Moved}}};class mc extends op{constructor(t){super(t),Nh(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return wt(s,{0:()=>r==null?void 0:r(n),1:()=>{let l=i.slice(),a=l.findIndex(c=>o(c,n));return a===-1?l.push(n):l.splice(a,1),r==null?void 0:r(l)}})},registerOption:Ll(()=>{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:Ll(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Ll(()=>{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})}}),Nh(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=Fl.get(null);this.disposables.add(r.on(lp.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(j8(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 mc({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:Te.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:di.Idle})}reduce(t,n){return wt(n.type,Q8,t,n)}}const Ih=y.createContext(null);function bc(e){let t=y.useContext(Ih);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=y.useMemo(()=>mc.new({id:e,__demoMode:t}),[]);return mh(()=>n.dispose()),n}let gi=y.createContext(null);gi.displayName="ListboxDataContext";function Xo(e){let t=y.useContext(gi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Xo),n}return t}let e3=y.Fragment;function t3(e,t){let n=y.useId(),r=Ol(),{value:o,defaultValue:s,form:i,name:l,onChange:a,by:c,invalid:u=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const g=p?"horizontal":"vertical";let N=xt(t),x=xx(s),[P=d?[]:void 0,C]=wx(o,a,x),D=$h({id:n,__demoMode:h}),F=y.useRef({static:!1,hold:!1}),L=y.useRef(new Map),b=qx(c),v=y.useCallback(_=>wt(E.mode,{[jn.Multi]:()=>P.some(q=>b(q,_)),[jn.Single]:()=>b(P,_)}),[P]),E=Dn({value:P,disabled:f,invalid:u,mode:d?jn.Multi:jn.Single,orientation:g,onChange:C,compare:b,isSelected:v,optionsPropsRef:F,listRef:L});Ne(()=>{D.state.dataRef.current=E},[E]);let $=nt(D,_=>_.listboxState),I=Fl.get(null),T=nt(I,y.useCallback(_=>I.selectors.isTop(_,n),[I,n])),[B,w]=nt(D,_=>[_.buttonElement,_.optionsElement]);w2(T,[B,w],(_,q)=>{D.send({type:Ch.CloseListbox}),mp(q,Vl.Loose)||(_.preventDefault(),B==null||B.focus())});let O=Dn({open:$===Ue.Open,disabled:f,invalid:u,value:P}),[k,S]=Ux({inherit:!0}),M={ref:N},j=y.useCallback(()=>{if(x!==void 0)return C==null?void 0:C(x)},[C,x]),z=dt();return y.createElement(S,{value:k,props:{htmlFor:B==null?void 0:B.id},slot:{open:$===Ue.Open,disabled:f}},y.createElement(S8,null,y.createElement(Ih.Provider,{value:D},y.createElement(gi.Provider,{value:E},y.createElement(hh,{value:wt($,{[Ue.Open]:Rt.Open,[Ue.Closed]:Rt.Closed})},l!=null&&P!=null&&y.createElement(Cx,{disabled:f,data:{[l]:P},form:i,onReset:j}),z({ourProps:M,theirProps:m,slot:O,defaultTag:e3,name:"Listbox"}))))))}let n3="button";function r3(e,t){let n=y.useId(),r=W0(),o=Xo("Listbox.Button"),s=bc("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:l=o.disabled||!1,autoFocus:a=!1,...c}=e,u=xt(t,v8(),s.actions.setButtonElement),f=w8(),[p,d,h]=nt(s,w=>[w.listboxState,w.buttonElement,w.optionsElement]),m=p===Ue.Open;S2(m,{trigger:d,action:y.useCallback(w=>{if(d!=null&&d.contains(w.target))return Js.Ignore;let O=w.target.closest('[role="option"]:not([data-disabled])');return bn(O)?Js.Select(O):h!=null&&h.contains(w.target)?Js.Ignore:Js.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let g=me(w=>{switch(w.key){case Be.Enter:Ex(w.currentTarget);break;case Be.Space:case Be.ArrowDown:w.preventDefault(),s.actions.openListbox({focus:o.value?Te.Nothing:Te.First});break;case Be.ArrowUp:w.preventDefault(),s.actions.openListbox({focus:o.value?Te.Nothing:Te.Last});break}}),N=me(w=>{switch(w.key){case Be.Space:w.preventDefault();break}}),x=Zx(w=>{var O;s.state.listboxState===Ue.Open?(Ke.flushSync(()=>s.actions.closeListbox()),(O=s.state.buttonElement)==null||O.focus({preventScroll:!0})):(w.preventDefault(),s.actions.openListbox({focus:Te.Nothing}))}),P=me(w=>w.preventDefault()),C=J0([i]),D=Fx(),{isFocusVisible:F,focusProps:L}=ix({autoFocus:a}),{isHovered:b,hoverProps:v}=sx({isDisabled:l}),{pressed:E,pressProps:$}=px({disabled:l}),I=Dn({open:p===Ue.Open,active:E||p===Ue.Open,disabled:l,invalid:o.invalid,value:o.value,hover:b,focus:F,autofocus:a}),T=nt(s,w=>w.listboxState===Ue.Open),B=R0(f(),{ref:u,id:i,type:P2(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":T,"aria-labelledby":C,"aria-describedby":D,disabled:l||void 0,autoFocus:a,onKeyDown:g,onKeyUp:N,onKeyPress:P},x,L,v,$);return dt()({ourProps:B,theirProps:c,slot:I,defaultTag:n3,name:"Listbox.Button"})}let kh=y.createContext(!1),o3="div",s3=Ks.RenderStrategy|Ks.Static;function i3(e,t){let n=y.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:l=!1,...a}=e,c=y8(o),[u,f]=y.useState(null);c&&(s=!0);let p=Xo("Listbox.Options"),d=bc("Listbox.Options"),[h,m,g,N]=nt(d,W=>[W.listboxState,W.buttonElement,W.optionsElement,W.__demoMode]),x=Hl(m),P=Hl(g),C=dc(),[D,F]=Ap(l,u,C!==null?(C&Rt.Open)===Rt.Open:h===Ue.Open);l2(D,m,d.actions.closeListbox);let L=N?!1:i&&h===Ue.Open;$2(L,P);let b=N?!1:i&&h===Ue.Open;a2(b,{allowed:y.useCallback(()=>[m,g],[m,g])});let v=nt(d,d.selectors.didButtonMove)?!1:D,E=nt(d,d.selectors.hasFrozenValue)&&!e.static,$=ph(E,p.value),I=y.useCallback(W=>p.compare($,W),[p.compare,$]),T=nt(d,W=>{var te;if(c==null||!((te=c==null?void 0:c.to)!=null&&te.includes("selection")))return null;let be=W.options.findIndex(de=>I(de.dataRef.current.value));return be===-1&&(be=0),be}),B=(()=>{if(c==null)return;if(T===null)return{...c,inner:void 0};let W=Array.from(p.listRef.current.values());return{...c,inner:{listRef:{current:W},index:T}}})(),[w,O]=E8(B),k=x8(),S=xt(t,c?w:null,d.actions.setOptionsElement,f),M=rr();y.useEffect(()=>{let W=g;W&&h===Ue.Open&&(ux(W)||W==null||W.focus({preventScroll:!0}))},[h,g]);let j=me(W=>{var te;switch(M.dispose(),W.key){case Be.Space:if(d.state.searchQuery!=="")return W.preventDefault(),W.stopPropagation(),d.actions.search(W.key);case Be.Enter:W.preventDefault(),W.stopPropagation(),d.actions.selectActiveOption();break;case wt(p.orientation,{vertical:Be.ArrowDown,horizontal:Be.ArrowRight}):return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Te.Next});case wt(p.orientation,{vertical:Be.ArrowUp,horizontal:Be.ArrowLeft}):return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Te.Previous});case Be.Home:case Be.PageUp:return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Te.First});case Be.End:case Be.PageDown:return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Te.Last});case Be.Escape:W.preventDefault(),W.stopPropagation(),Ke.flushSync(()=>d.actions.closeListbox()),(te=d.state.buttonElement)==null||te.focus({preventScroll:!0});return;case Be.Tab:W.preventDefault(),W.stopPropagation(),Ke.flushSync(()=>d.actions.closeListbox()),b2(d.state.buttonElement,W.shiftKey?Wl.Previous:Wl.Next);break;default:W.key.length===1&&(d.actions.search(W.key),M.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=nt(d,W=>{var te;return(te=W.buttonElement)==null?void 0:te.id}),_=Dn({open:h===Ue.Open}),q=R0(c?k():{},{id:r,ref:S,"aria-activedescendant":nt(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===jn.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:j,role:"listbox",tabIndex:h===Ue.Open?0:void 0,style:{...a.style,...O,"--button-width":Kx(D,m,!0).width},...Tp(F)}),Q=dt(),K=y.useMemo(()=>p.mode===jn.Multi?p:{...p,isSelected:I},[p,I]);return y.createElement(R8,{enabled:s?e.static||D:!1,ownerDocument:x},y.createElement(gi.Provider,{value:K},Q({ourProps:q,theirProps:a,slot:_,defaultTag:o3,features:s3,visible:v,name:"Listbox.Options"})))}let a3="div";function l3(e,t){let n=y.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,l=y.useContext(kh)===!0,a=Xo("Listbox.Option"),c=bc("Listbox.Option"),u=nt(c,E=>c.selectors.isActive(E,r)),f=a.isSelected(s),p=y.useRef(null),d=Y8(p),h=or({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=xt(t,p,E=>{E?a.listRef.current.set(r,E):a.listRef.current.delete(r)}),g=nt(c,E=>c.selectors.shouldScrollIntoView(E,r));Ne(()=>{if(g)return ft().requestAnimationFrame(()=>{var E,$;($=(E=p.current)==null?void 0:E.scrollIntoView)==null||$.call(E,{block:"nearest"})})},[g,p]),Ne(()=>{if(!l)return c.actions.registerOption(r,h),()=>c.actions.unregisterOption(r)},[h,r,l]);let N=me(E=>{if(o)return E.preventDefault();c.actions.selectOption(s)}),x=me(()=>{if(o)return c.actions.goToOption({focus:Te.Nothing});c.actions.goToOption({focus:Te.Specific,id:r})}),P=k2(),C=me(E=>P.update(E)),D=me(E=>{P.wasMoved(E)&&(o||u&&c.state.activationTrigger===bi.Pointer||c.actions.goToOption({focus:Te.Specific,id:r},bi.Pointer))}),F=me(E=>{P.wasMoved(E)&&(o||u&&c.state.activationTrigger===bi.Pointer&&c.actions.goToOption({focus:Te.Nothing}))}),L=Dn({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&l}),b=l?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:N,onFocus:x,onPointerEnter:C,onMouseEnter:C,onPointerMove:D,onMouseMove:D,onPointerLeave:F,onMouseLeave:F},v=dt();return!f&&l?null:v({ourProps:b,theirProps:i,slot:L,defaultTag:a3,name:"Listbox.Option"})}let c3=y.Fragment;function u3(e,t){let{options:n,placeholder:r,...o}=e,s={ref:xt(t)},i=Xo("ListboxSelectedOption"),l=Dn({}),a=i.value===void 0||i.value===null||i.mode===jn.Multi&&Array.isArray(i.value)&&i.value.length===0,c=dt();return y.createElement(kh.Provider,{value:!0},c({ourProps:s,theirProps:{...o,children:y.createElement(y.Fragment,null,r&&a?r:n)},slot:l,defaultTag:c3,name:"ListboxSelectedOption"}))}let f3=tt(t3),d3=tt(r3),p3=Hx,h3=tt(i3),m3=tt(l3),b3=tt(u3),Pt=Object.assign(f3,{Button:d3,Label:p3,Options:h3,Option:m3,SelectedOption:b3});const g3=()=>A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[A.jsx("g",{clipPath:"url(#clip0_active)",children:A.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"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_active",children:A.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),y3=()=>A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[A.jsx("g",{clipPath:"url(#clip0_inactive)",children:A.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"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_inactive",children:A.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Jo=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return A.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>A.jsx("div",{className:"flex items-center justify-center",children:o>t-e?A.jsx(g3,{}):A.jsx(y3,{})},o))})};class jt{}os(jt,"FAST",3),os(jt,"Medium",2),os(jt,"SLOW",1),os(jt,"NONE",0);const v3=Object.values({MAINNET:1,SEPOLIA:11155111}),xn=e=>{const t=typeof e=="string"?parseInt(e,10):e;return v3.includes(t)},w3={USDT:!0},Mh=(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:!w3[t.toUpperCase()]:!0},x3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=Ct();return A.jsx("div",{className:`relative ${o}`,children:A.jsx(Pt,{value:t,onChange:n,disabled:r,children:({open:l})=>A.jsxs(A.Fragment,{children:[A.jsxs(Pt.Button,{className:`
|
|
140
140
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
141
141
|
items-center justify-between flex px-3 rounded-lg
|
|
142
142
|
focus:outline-hidden
|
|
143
143
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
144
|
-
${
|
|
145
|
-
`,children:[A.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),A.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?A.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):A.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:A.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),A.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),A.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${
|
|
144
|
+
${l?"ring-1 ring-white":""}
|
|
145
|
+
`,children:[A.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),A.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?A.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):A.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:A.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),A.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),A.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:[A.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:A.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"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_12919_27745",children:A.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),A.jsx(hc,{as:y.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:A.jsx(Pt.Options,{className:`
|
|
146
146
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
147
147
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
148
148
|
focus:outline-hidden
|
|
149
|
-
`,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>A.jsx(
|
|
149
|
+
`,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>A.jsx(Pt.Option,{value:a,className:({active:c,selected:u})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-fill-btn-secondary":c?"bg-fill-input-secondary":""}`,children:({selected:c,active:u})=>A.jsx(A.Fragment,{children:A.jsxs("div",{className:"flex items-center justify-between",children:[A.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?A.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):A.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:A.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),A.jsx("div",{className:"flex flex-col",children:A.jsx("span",{className:`text-sm font-medium ${c||u?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),A.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:A.jsx(Jo,{className:"w-full justify-between",selectedLevel:xn(a.chainId)?jt.SLOW:jt.FAST,maxLevel:3})})]})})},a.chainId))})})]})})})},E3=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s,accountType:i})=>{const{t:l}=Ct(),a=c=>c.token||c.symbol;return A.jsx("div",{className:`relative ${o}`,children:A.jsx(Pt,{value:t,onChange:n,disabled:r,children:({open:c})=>A.jsxs(A.Fragment,{children:[A.jsxs(Pt.Button,{className:`
|
|
150
150
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
151
151
|
items-center justify-between flex px-3 rounded-lg
|
|
152
152
|
focus:outline-hidden
|
|
153
153
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
154
|
-
${
|
|
155
|
-
`,children:[A.jsx("span",{className:"text-sm leading-[18px] font-medium",children:
|
|
154
|
+
${c?"ring-1 ring-white":""}
|
|
155
|
+
`,children:[A.jsx("span",{className:"text-sm leading-[18px] font-medium",children:l("deposit.asset")}),A.jsxs("div",{className:"flex items-center space-x-2",children:[A.jsx("img",{src:t.iconUrl,alt:a(t),className:"w-4 h-4 rounded-full"}),A.jsx("span",{className:"text-sm text-white ml-1",children:a(t)}),A.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:[A.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:A.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"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_asset_selector",children:A.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),A.jsx(hc,{as:y.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:A.jsx(Pt.Options,{className:`
|
|
156
156
|
absolute z-50 mt-1 w-full max-h-[230px] overflow-y-auto rounded-lg
|
|
157
157
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
158
158
|
focus:outline-hidden
|
|
159
|
-
`,children:e.map(u=>A.jsx(
|
|
159
|
+
`,children:e.map(u=>A.jsx(Pt.Option,{value:u,className:({active:f,selected:p})=>`relative cursor-pointer select-none py-3 px-3 ${p?"bg-fill-btn-secondary":f?"bg-fill-input-secondary":""}`,children:({selected:f,active:p})=>A.jsxs("div",{className:"flex items-center space-x-3",children:[A.jsx("img",{src:u.iconUrl,alt:a(u),className:"w-5 h-5 rounded-full"}),A.jsxs("div",{className:"flex flex-col",children:[A.jsx("span",{className:`text-sm font-medium ${f||p?"text-text-primary":"text-text-tertiary"}`,children:a(u)}),s===hn&&i==="perpetual"&&u.token==="USDC"&&A.jsx("p",{className:"mt-2 text-xs text-text-tertiary whitespace-pre-line",children:l("deposit.defaultSpotNotice")})]})]})},a(u)))})})]})})})},Dh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=hn,txType:i="deposit",accountType:l})=>{const a=y.useCallback(g=>i==="withdraw"?s===hn?g.allowAaWithdraw!==!1:g.allowWithdraw!==!1:s===hn?g.allowAaDeposit!==!1:g.allowDeposit!==!1,[i,s]),c=y.useMemo(()=>{const g=new Set,N=[];for(const x of t)if(a(x))for(const P of x.tokenList||[]){const C=P.symbol||P.token;!C||!(i!=="withdraw"||P.withdrawEnable===!0&&P.pullOff!==!0)||g.has(C)||(g.add(C),N.push({token:C,symbol:C,iconUrl:P.iconUrl,decimals:P.decimals,tokenAddress:P.tokenAddress}))}return N},[t,a,i]),u=g=>{n(g.chainId)},f=g=>{const N=g.symbol||g.token;o(N);const x=[];for(const P of t){if(!a(P))continue;(P.tokenList||[]).some(D=>(D.symbol||D.token)===N)&&x.push(P.chainId)}!x.includes(e.chainId)&&x[0]!==void 0&&n(x[0])},p=y.useMemo(()=>{var x,P;const g=r||((x=c[0])==null?void 0:x.symbol)||((P=c[0])==null?void 0:P.token);if(!g)return[];const N=[];for(const C of t){if(!a(C))continue;const D=(C.tokenList||[]).find(F=>(F.symbol||F.token)===g?i==="withdraw"?F.withdrawEnable===!0&&F.pullOff!==!0:!0:!1);D&&N.push({...C,tokenList:[{token:D.token,symbol:D.symbol,iconUrl:D.iconUrl,decimals:D.decimals,tokenAddress:D.tokenAddress}]})}return N},[t,r,c,a,i]),d=y.useMemo(()=>p.find(g=>g.chainId===e.chainId)||p[0],[p,e.chainId]),h=y.useMemo(()=>c,[c]),m=y.useMemo(()=>{if(h.length!==0)return h.find(g=>g.token===r||g.symbol===r)||h[0]},[h,r]);return y.useEffect(()=>{if(h.length===0)return;if(!h.some(N=>(N.symbol||N.token)===r)){const N=h[0];o(N.symbol||N.token)}},[h,r,o]),y.useEffect(()=>{if(p.length===0)return;p.some(N=>N.chainId===e.chainId)||n(p[0].chainId)},[p,e.chainId,n]),A.jsxs("div",{className:"space-y-4",children:[h.length>0&&m&&A.jsx(E3,{tokens:h,selectedToken:m,onTokenChange:f,walletType:s,accountType:l}),A.jsx(x3,{chains:p,selectedChain:d,onChainChange:g=>{const N=t.find(x=>x.chainId===g.chainId);N&&u(N)},walletType:s,className:"w-full"})]})},S3=({options:e})=>A.jsx(A.Fragment,{children:e.map(t=>A.jsx(Pt.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})=>A.jsx("div",{className:"flex items-center justify-between",children:A.jsx("div",{className:"flex items-center space-x-3",children:A.jsx("div",{className:"flex flex-col",children:A.jsx("span",{className:`text-sm font-medium ${n||r?"text-text-primary":"text-text-tertiary"}`,children:t.label})})})})},t.value))}),Bh=({selectedAccount:e,onAccountChange:t,options:n,disabled:r=!1,className:o=""})=>{var d;const{t:s}=Ct(),i=y.useMemo(()=>[{value:"spot",label:s("account.spot")},{value:"perpetual",label:s("account.perp")}],[s]),l=n&&n.length>0?n:i,a=((d=l.find(h=>h.value===(e??"spot")))==null?void 0:d.label)||"",[c,u]=y.useState(e??"spot"),f=e??c,p=h=>{t==null||t(h),e||u(h)};return A.jsx("div",{className:`relative mb-4 ${o}`,children:A.jsx(Pt,{value:f,onChange:p,disabled:r,children:({open:h})=>A.jsxs(A.Fragment,{children:[A.jsxs(Pt.Button,{className:`
|
|
160
160
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
161
161
|
items-center justify-between flex px-3 rounded-lg
|
|
162
162
|
focus:outline-hidden
|
|
163
163
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
164
164
|
${h?"ring-1 ring-white":""}
|
|
165
|
-
`,children:[A.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("account.title")}),A.jsxs("div",{className:"flex items-center space-x-2",children:[A.jsx("span",{className:"text-sm text-white ml-1",children:a}),A.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${h?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[A.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:A.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"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_asset_selector",children:A.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),A.jsx(
|
|
165
|
+
`,children:[A.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("account.title")}),A.jsxs("div",{className:"flex items-center space-x-2",children:[A.jsx("span",{className:"text-sm text-white ml-1",children:a}),A.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${h?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[A.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:A.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"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_asset_selector",children:A.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),A.jsx(hc,{as:y.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:A.jsx(Pt.Options,{className:`
|
|
166
166
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
167
167
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
168
168
|
focus:outline-hidden
|
|
169
|
-
`,children:A.jsx(
|
|
169
|
+
`,children:A.jsx(S3,{options:l})})})]})})})};var yi={},P3=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()}},T3=P3,Lh={"text/plain":"Text","text/html":"Url",default:"Text"},A3="Copy to clipboard: #{key}, Enter";function N3(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function C3(e,t){var n,r,o,s,i,l,a=!1;t||(t={}),n=t.debug||!1;try{o=T3(),s=document.createRange(),i=document.getSelection(),l=document.createElement("span"),l.textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=Lh[t.format]||Lh.default;window.clipboardData.setData(f,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(l),s.selectNodeContents(l),i.addRange(s);var c=document.execCommand("copy");if(!c)throw new Error("copy command was unsuccessful");a=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(f){n&&console.error("unable to copy using clipboardData: ",f),n&&console.error("falling back to prompt"),r=N3("message"in t?t.message:A3),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),l&&document.body.removeChild(l),o()}return a}var O3=C3;function gc(e){"@babel/helpers - typeof";return gc=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},gc(e)}Object.defineProperty(yi,"__esModule",{value:!0}),yi.CopyToClipboard=void 0;var vi=Fh(y),I3=Fh(O3),$3=["text","onCopy","options","children"];function Fh(e){return e&&e.__esModule?e:{default:e}}function Rh(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 jh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Rh(Object(n),!0).forEach(function(r){vc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function k3(e,t){if(e==null)return{};var n=M3(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function M3(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function D3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B3(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function L3(e,t,n){return t&&B3(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function F3(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&&yc(e,t)}function yc(e,t){return yc=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},yc(e,t)}function R3(e){var t=z3();return function(){var r=wi(e),o;if(t){var s=wi(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return j3(this,o)}}function j3(e,t){if(t&&(gc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zh(e)}function zh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function z3(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function wi(e){return wi=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},wi(e)}function vc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Uh=function(e){F3(n,e);var t=R3(n);function n(){var r;D3(this,n);for(var o=arguments.length,s=new Array(o),i=0;i<o;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),vc(zh(r),"onClick",function(l){var a=r.props,c=a.text,u=a.onCopy,f=a.children,p=a.options,d=vi.default.Children.only(f),h=(0,I3.default)(c,p);u&&u(c,h),d&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(l)}),r}return L3(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=k3(o,$3),l=vi.default.Children.only(s);return vi.default.cloneElement(l,jh(jh({},i),{},{onClick:this.onClick}))}}]),n}(vi.default.PureComponent);yi.CopyToClipboard=Uh,vc(Uh,"defaultProps",{onCopy:void 0,options:void 0});var U3=yi,wc=U3.CopyToClipboard;wc.CopyToClipboard=wc;var _3=wc;const W3=qm(_3);var V3=Object.defineProperty,xi=Object.getOwnPropertySymbols,_h=Object.prototype.hasOwnProperty,Wh=Object.prototype.propertyIsEnumerable,Vh=(e,t,n)=>t in e?V3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xc=(e,t)=>{for(var n in t||(t={}))_h.call(t,n)&&Vh(e,n,t[n]);if(xi)for(var n of xi(t))Wh.call(t,n)&&Vh(e,n,t[n]);return e},Ec=(e,t)=>{var n={};for(var r in e)_h.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&xi)for(var r of xi(e))t.indexOf(r)<0&&Wh.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 cr;(e=>{const t=class de{constructor(a,l,u,f){if(this.version=a,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],a<de.MIN_VERSION||a>de.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(u);if(this.drawCodewords(d),f==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const g=this.getPenaltyScore();g<h&&(f=m,h=g),this.applyMask(m)}}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 de.encodeSegments(u,l)}static encodeBinary(a,l){const u=e.QrSegment.makeBytes(a);return de.encodeSegments([u],l)}static encodeSegments(a,l,u=1,f=40,p=-1,d=!0){if(!(de.MIN_VERSION<=u&&u<=f&&f<=de.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=u;;h++){const P=de.getNumDataCodewords(h,l)*8,C=i.getTotalBits(a,h);if(C<=P){m=C;break}if(h>=f)throw new RangeError("Data too long")}for(const P of[de.Ecc.MEDIUM,de.Ecc.QUARTILE,de.Ecc.HIGH])d&&m<=de.getNumDataCodewords(h,P)*8&&(l=P);let g=[];for(const P of a){n(P.mode.modeBits,4,g),n(P.numChars,P.mode.numCharCountBits(h),g);for(const C of P.getData())g.push(C)}o(g.length==m);const N=de.getNumDataCodewords(h,l)*8;o(g.length<=N),n(0,Math.min(4,N-g.length),g),n(0,(8-g.length%8)%8,g),o(g.length%8==0);for(let P=236;g.length<N;P^=253)n(P,8,g);let x=[];for(;x.length*8<g.length;)x.push(0);return g.forEach((P,C)=>x[C>>>3]|=P<<7-(C&7)),new de(h,l,x,p)}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 p=0;p<10;p++)u=u<<1^(u>>>9)*1335;const f=(l<<10|u)^21522;o(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(f,p));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const l=this.version<<12|a;o(l>>>18==0);for(let u=0;u<18;u++){const f=r(l,u),p=this.size-11+u%3,d=Math.floor(u/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,l){for(let u=-4;u<=4;u++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(u)),d=a+f,h=l+u;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=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!=de.getNumDataCodewords(l,u))throw new RangeError("Invalid argument");const f=de.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l],p=de.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l],d=Math.floor(de.getNumRawDataModules(l)/8),h=f-d%f,m=Math.floor(d/f);let g=[];const N=de.reedSolomonComputeDivisor(p);for(let P=0,C=0;P<f;P++){let M=a.slice(C,C+m-p+(P<h?0:1));C+=M.length;const L=de.reedSolomonComputeRemainder(M,N);P<h&&M.push(0),g.push(M.concat(L))}let x=[];for(let P=0;P<g[0].length;P++)g.forEach((C,M)=>{(P!=m-p||M>=h)&&x.push(C[P])});return o(x.length==d),x}drawCodewords(a){if(a.length!=Math.floor(de.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 p=0;p<2;p++){const d=u-p,m=(u+1&2)==0?this.size-1-f:f;!this.isFunction[m][d]&&l<a.length*8&&(this.modules[m][d]=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 p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[p][g]==d?(h++,h==5?a+=de.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*de.PENALTY_N3),d=this.modules[p][g],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*de.PENALTY_N3}for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[g][p]==d?(h++,h==5?a+=de.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*de.PENALTY_N3),d=this.modules[g][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*de.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let d=0;d<this.size-1;d++){const h=this.modules[p][d];h==this.modules[p][d+1]&&h==this.modules[p+1][d]&&h==this.modules[p+1][d+1]&&(a+=de.PENALTY_N2)}let l=0;for(const p of this.modules)l=p.reduce((d,h)=>d+(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*de.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<de.MIN_VERSION||a>de.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(de.getNumRawDataModules(a)/8)-de.ECC_CODEWORDS_PER_BLOCK[l.ordinal][a]*de.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 p=0;p<l.length;p++)l[p]=de.reedSolomonMultiply(l[p],u),p+1<l.length&&(l[p]^=l[p+1]);u=de.reedSolomonMultiply(u,2)}return l}static reedSolomonComputeRemainder(a,l){let u=l.map(f=>0);for(const f of a){const p=f^u.shift();u.push(0),l.forEach((d,h)=>u[h]^=de.reedSolomonMultiply(d,p))}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 Te{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 Te(Te.Mode.BYTE,a.length,l)}static makeNumeric(a){if(!Te.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 Te(Te.Mode.NUMERIC,a.length,l)}static makeAlphanumeric(a){if(!Te.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=Te.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u))*45;f+=Te.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u+1)),n(f,11,l)}return u<a.length&&n(Te.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u)),6,l),new Te(Te.Mode.ALPHANUMERIC,a.length,l)}static makeSegments(a){return a==""?[]:Te.isNumeric(a)?[Te.makeNumeric(a)]:Te.isAlphanumeric(a)?[Te.makeAlphanumeric(a)]:[Te.makeBytes(Te.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 Te(Te.Mode.ECI,0,l)}static isNumeric(a){return Te.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Te.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,l){let u=0;for(const f of a){const p=f.mode.numCharCountBits(l);if(f.numChars>=1<<p)return 1/0;u+=4+p+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})(cr||(cr={})),(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={}))})(cr||(cr={})),(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={}))})(cr||(cr={}));var zr=cr;/**
|
|
173
|
+
*/var lr;(e=>{const t=class ue{constructor(a,c,u,f){if(this.version=a,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],a<ue.MIN_VERSION||a>ue.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(u);if(this.drawCodewords(d),f==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const g=this.getPenaltyScore();g<h&&(f=m,h=g),this.applyMask(m)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,c){const u=e.QrSegment.makeSegments(a);return ue.encodeSegments(u,c)}static encodeBinary(a,c){const u=e.QrSegment.makeBytes(a);return ue.encodeSegments([u],c)}static encodeSegments(a,c,u=1,f=40,p=-1,d=!0){if(!(ue.MIN_VERSION<=u&&u<=f&&f<=ue.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=u;;h++){const P=ue.getNumDataCodewords(h,c)*8,C=i.getTotalBits(a,h);if(C<=P){m=C;break}if(h>=f)throw new RangeError("Data too long")}for(const P of[ue.Ecc.MEDIUM,ue.Ecc.QUARTILE,ue.Ecc.HIGH])d&&m<=ue.getNumDataCodewords(h,P)*8&&(c=P);let g=[];for(const P of a){n(P.mode.modeBits,4,g),n(P.numChars,P.mode.numCharCountBits(h),g);for(const C of P.getData())g.push(C)}o(g.length==m);const N=ue.getNumDataCodewords(h,c)*8;o(g.length<=N),n(0,Math.min(4,N-g.length),g),n(0,(8-g.length%8)%8,g),o(g.length%8==0);for(let P=236;g.length<N;P^=253)n(P,8,g);let x=[];for(;x.length*8<g.length;)x.push(0);return g.forEach((P,C)=>x[C>>>3]|=P<<7-(C&7)),new ue(h,c,x,p)}getModule(a,c){return 0<=a&&a<this.size&&0<=c&&c<this.size&&this.modules[c][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),c=a.length;for(let u=0;u<c;u++)for(let f=0;f<c;f++)u==0&&f==0||u==0&&f==c-1||u==c-1&&f==0||this.drawAlignmentPattern(a[u],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const c=this.errorCorrectionLevel.formatBits<<3|a;let u=c;for(let p=0;p<10;p++)u=u<<1^(u>>>9)*1335;const f=(c<<10|u)^21522;o(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(f,p));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const c=this.version<<12|a;o(c>>>18==0);for(let u=0;u<18;u++){const f=r(c,u),p=this.size-11+u%3,d=Math.floor(u/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,c){for(let u=-4;u<=4;u++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(u)),d=a+f,h=c+u;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=4)}}drawAlignmentPattern(a,c){for(let u=-2;u<=2;u++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,c+u,Math.max(Math.abs(f),Math.abs(u))!=1)}setFunctionModule(a,c,u){this.modules[c][a]=u,this.isFunction[c][a]=!0}addEccAndInterleave(a){const c=this.version,u=this.errorCorrectionLevel;if(a.length!=ue.getNumDataCodewords(c,u))throw new RangeError("Invalid argument");const f=ue.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][c],p=ue.ECC_CODEWORDS_PER_BLOCK[u.ordinal][c],d=Math.floor(ue.getNumRawDataModules(c)/8),h=f-d%f,m=Math.floor(d/f);let g=[];const N=ue.reedSolomonComputeDivisor(p);for(let P=0,C=0;P<f;P++){let D=a.slice(C,C+m-p+(P<h?0:1));C+=D.length;const F=ue.reedSolomonComputeRemainder(D,N);P<h&&D.push(0),g.push(D.concat(F))}let x=[];for(let P=0;P<g[0].length;P++)g.forEach((C,D)=>{(P!=m-p||D>=h)&&x.push(C[P])});return o(x.length==d),x}drawCodewords(a){if(a.length!=Math.floor(ue.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let f=0;f<this.size;f++)for(let p=0;p<2;p++){const d=u-p,m=(u+1&2)==0?this.size-1-f:f;!this.isFunction[m][d]&&c<a.length*8&&(this.modules[m][d]=r(a[c>>>3],7-(c&7)),c++)}}o(c==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let u=0;u<this.size;u++){let f;switch(a){case 0:f=(u+c)%2==0;break;case 1:f=c%2==0;break;case 2:f=u%3==0;break;case 3:f=(u+c)%3==0;break;case 4:f=(Math.floor(u/3)+Math.floor(c/2))%2==0;break;case 5:f=u*c%2+u*c%3==0;break;case 6:f=(u*c%2+u*c%3)%2==0;break;case 7:f=((u+c)%2+u*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][u]&&f&&(this.modules[c][u]=!this.modules[c][u])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[p][g]==d?(h++,h==5?a+=ue.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ue.PENALTY_N3),d=this.modules[p][g],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ue.PENALTY_N3}for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[g][p]==d?(h++,h==5?a+=ue.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ue.PENALTY_N3),d=this.modules[g][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ue.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let d=0;d<this.size-1;d++){const h=this.modules[p][d];h==this.modules[p][d+1]&&h==this.modules[p+1][d]&&h==this.modules[p+1][d+1]&&(a+=ue.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((d,h)=>d+(h?1:0),c);const u=this.size*this.size,f=Math.ceil(Math.abs(c*20-u*10)/u)-1;return o(0<=f&&f<=9),a+=f*ue.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let u=[6];for(let f=this.size-7;u.length<a;f-=c)u.splice(1,0,f);return u}}static getNumRawDataModules(a){if(a<ue.MIN_VERSION||a>ue.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*a+128)*a+64;if(a>=2){const u=Math.floor(a/7)+2;c-=(25*u-10)*u-55,a>=7&&(c-=36)}return o(208<=c&&c<=29648),c}static getNumDataCodewords(a,c){return Math.floor(ue.getNumRawDataModules(a)/8)-ue.ECC_CODEWORDS_PER_BLOCK[c.ordinal][a]*ue.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let c=[];for(let f=0;f<a-1;f++)c.push(0);c.push(1);let u=1;for(let f=0;f<a;f++){for(let p=0;p<c.length;p++)c[p]=ue.reedSolomonMultiply(c[p],u),p+1<c.length&&(c[p]^=c[p+1]);u=ue.reedSolomonMultiply(u,2)}return c}static reedSolomonComputeRemainder(a,c){let u=c.map(f=>0);for(const f of a){const p=f^u.shift();u.push(0),c.forEach((d,h)=>u[h]^=ue.reedSolomonMultiply(d,p))}return u}static reedSolomonMultiply(a,c){if(a>>>8||c>>>8)throw new RangeError("Byte out of range");let u=0;for(let f=7;f>=0;f--)u=u<<1^(u>>>7)*285,u^=(c>>>f&1)*a;return o(u>>>8==0),u}finderPenaltyCountPatterns(a){const c=a[1];o(c<=this.size*3);const u=c>0&&a[2]==c&&a[3]==c*3&&a[4]==c&&a[5]==c;return(u&&a[0]>=c*4&&a[6]>=c?1:0)+(u&&a[6]>=c*4&&a[0]>=c?1:0)}finderPenaltyTerminateAndCount(a,c,u){return a&&(this.finderPenaltyAddHistory(c,u),c=0),c+=this.size,this.finderPenaltyAddHistory(c,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(a,c){c[0]==0&&(a+=this.size),c.pop(),c.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(l,a,c){if(a<0||a>31||l>>>a)throw new RangeError("Value out of range");for(let u=a-1;u>=0;u--)c.push(l>>>u&1)}function r(l,a){return(l>>>a&1)!=0}function o(l){if(!l)throw new Error("Assertion error")}const s=class Ae{constructor(a,c,u){if(this.mode=a,this.numChars=c,this.bitData=u,c<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(a){let c=[];for(const u of a)n(u,8,c);return new Ae(Ae.Mode.BYTE,a.length,c)}static makeNumeric(a){if(!Ae.isNumeric(a))throw new RangeError("String contains non-numeric characters");let c=[];for(let u=0;u<a.length;){const f=Math.min(a.length-u,3);n(parseInt(a.substring(u,u+f),10),f*3+1,c),u+=f}return new Ae(Ae.Mode.NUMERIC,a.length,c)}static makeAlphanumeric(a){if(!Ae.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],u;for(u=0;u+2<=a.length;u+=2){let f=Ae.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u))*45;f+=Ae.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u+1)),n(f,11,c)}return u<a.length&&n(Ae.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u)),6,c),new Ae(Ae.Mode.ALPHANUMERIC,a.length,c)}static makeSegments(a){return a==""?[]:Ae.isNumeric(a)?[Ae.makeNumeric(a)]:Ae.isAlphanumeric(a)?[Ae.makeAlphanumeric(a)]:[Ae.makeBytes(Ae.toUtf8ByteArray(a))]}static makeEci(a){let c=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,c);else if(a<16384)n(2,2,c),n(a,14,c);else if(a<1e6)n(6,3,c),n(a,21,c);else throw new RangeError("ECI assignment value out of range");return new Ae(Ae.Mode.ECI,0,c)}static isNumeric(a){return Ae.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Ae.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,c){let u=0;for(const f of a){const p=f.mode.numCharCountBits(c);if(f.numChars>=1<<p)return 1/0;u+=4+p+f.bitData.length}return u}static toUtf8ByteArray(a){a=encodeURI(a);let c=[];for(let u=0;u<a.length;u++)a.charAt(u)!="%"?c.push(a.charCodeAt(u)):(c.push(parseInt(a.substring(u+1,u+3),16)),u+=2);return c}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(lr||(lr={})),(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={}))})(lr||(lr={})),(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={}))})(lr||(lr={}));var zr=lr;/**
|
|
174
174
|
* @license qrcode.react
|
|
175
175
|
* Copyright (c) Paul O'Shannessy
|
|
176
176
|
* SPDX-License-Identifier: ISC
|
|
177
|
-
*/var W3={L:zr.QrCode.Ecc.LOW,M:zr.QrCode.Ecc.MEDIUM,Q:zr.QrCode.Ecc.QUARTILE,H:zr.QrCode.Ecc.HIGH},Vh=128,Hh="L",Gh="#FFFFFF",qh="#000000",Kh=!1,Zh=1,V3=4,H3=0,G3=.1;function Yh(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 Xh(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 q3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*G3),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 p=null;if(r.excavate){let h=Math.floor(l),m=Math.floor(u),g=Math.ceil(c+l-h),N=Math.ceil(a+u-m);p={x:h,y:m,w:g,h:N}}const d=r.crossOrigin;return{x:l,y:u,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function K3(e,t){return t!=null?Math.max(Math.floor(t),0):e?V3:H3}function Jh({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=v.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,g)=>(m.push(...zr.QrSegment.makeSegments(g)),m),[]);return zr.QrCode.encodeSegments(h,W3[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:l,margin:u,numCells:f,calculatedImageSettings:p}=v.useMemo(()=>{let d=a.getModules();const h=K3(r,o),m=d.length+h*2,g=q3(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:g}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:l,numCells:f,calculatedImageSettings:p}}var Z3=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Y3=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Vh,level:i=Hh,bgColor:c=Gh,fgColor:a=qh,includeMargin:l=Kh,minVersion:u=Zh,boostLevel:f,marginSize:p,imageSettings:d}=r,m=El(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:g}=m,N=El(m,["style"]),x=d==null?void 0:d.src,P=v.useRef(null),C=v.useRef(null),M=v.useCallback(D=>{P.current=D,typeof n=="function"?n(D):n&&(n.current=D)},[n]),[L,F]=v.useState(!1),{margin:b,cells:y,numCells:E,calculatedImageSettings:T}=Jh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:p,imageSettings:d,size:s});v.useEffect(()=>{if(P.current!=null){const D=P.current,w=D.getContext("2d");if(!w)return;let O=y;const k=C.current,S=T!=null&&k!==null&&k.complete&&k.naturalHeight!==0&&k.naturalWidth!==0;S&&T.excavation!=null&&(O=Xh(y,T.excavation));const B=window.devicePixelRatio||1;D.height=D.width=s*B;const j=s/E*B;w.scale(j,j),w.fillStyle=c,w.fillRect(0,0,E,E),w.fillStyle=a,Z3?w.fill(new Path2D(Yh(O,b))):y.forEach(function(U,_){U.forEach(function(G,Q){G&&w.fillRect(Q+b,_+b,1,1)})}),T&&(w.globalAlpha=T.opacity),S&&w.drawImage(k,T.x+b,T.y+b,T.w,T.h)}}),v.useEffect(()=>{F(!1)},[x]);const I=xl({height:s,width:s},g);let $=null;return x!=null&&($=v.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{F(!0)},ref:C,crossOrigin:T==null?void 0:T.crossOrigin})),v.createElement(v.Fragment,null,v.createElement("canvas",xl({style:I,height:s,width:s,ref:M,role:"img"},N)),$)});Y3.displayName="QRCodeCanvas";var Qh=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Vh,level:i=Hh,bgColor:c=Gh,fgColor:a=qh,includeMargin:l=Kh,minVersion:u=Zh,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=El(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:g,cells:N,numCells:x,calculatedImageSettings:P}=Jh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:d,imageSettings:h,size:s});let C=N,M=null;h!=null&&P!=null&&(P.excavation!=null&&(C=Xh(N,P.excavation)),M=v.createElement("image",{href:h.src,height:P.h,width:P.w,x:P.x+g,y:P.y+g,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const L=Yh(C,g);return v.createElement("svg",xl({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},m),!!p&&v.createElement("title",null,p),v.createElement("path",{fill:c,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),v.createElement("path",{fill:a,d:L,shapeRendering:"crispEdges"}),M)});Qh.displayName="QRCodeSVG";function X3(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function J3(){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 em(){return/apple/i.test(navigator.vendor)}function Q3(){return X3().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function eS(){return J3().includes("jsdom/")}const tm="data-floating-ui-focusable",tS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Sl(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 Ur(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&qc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function _r(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Pl(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 nS(e){return e.matches("html,body")}function Xt(e){return(e==null?void 0:e.ownerDocument)||document}function nm(e){return Ve(e)&&e.matches(tS)}function rS(e){if(!e||eS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function oS(e){return e?e.hasAttribute(tm)?e:e.querySelector("["+tm+"]")||e:null}function Ei(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,...Ei(e,o.id,n)])}function sS(e){return"nativeEvent"in e}function Qo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var iS=typeof document<"u",aS=function(){},Jt=iS?v.useLayoutEffect:aS;const cS={...z};function Si(e){const t=z.useRef(e);return Jt(()=>{t.current=e}),t}const lS=cS.useInsertionEffect||(e=>e());function Qt(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return lS(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const rm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function om(e,t){const n=Rp(e,rm()),r=n.length;if(r===0)return;const o=Sl(Xt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function uS(e){return om(Xt(e).body,1)||e}function fS(e){return om(Xt(e).body,-1)||e}function Tl(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Ur(n,r)}function dS(e){Rp(e,rm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function sm(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 pS="data-floating-ui-focusable",im="active",am="selected",hS={...z};let cm=!1,mS=0;const lm=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+mS++;function bS(){const[e,t]=z.useState(()=>cm?lm():void 0);return Jt(()=>{e==null&&t(lm())},[]),z.useEffect(()=>{cm=!0},[]),e}const Al=hS.useId||bS;let Nl;process.env.NODE_ENV!=="production"&&(Nl=new Set);function gS(){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=Nl)!=null&&e.has(o))){var s;(s=Nl)==null||s.add(o),console.error(o)}}function yS(){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 vS=z.createContext(null),wS=z.createContext(null),Cl=()=>{var e;return((e=z.useContext(vS))==null?void 0:e.id)||null},Ol=()=>z.useContext(wS);function es(e){return"data-floating-ui-"+e}function Pt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const um=es("safe-polygon");function Il(e,t,n){if(n&&!Qo(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 xS(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:p=!0}=t,d=Ol(),h=Cl(),m=Si(l),g=Si(a),N=Si(n),x=Si(f),P=z.useRef(),C=z.useRef(-1),M=z.useRef(),L=z.useRef(-1),F=z.useRef(!0),b=z.useRef(!1),y=z.useRef(()=>{}),E=z.useRef(!1),T=Qt(()=>{var k;const S=(k=o.current.openEvent)==null?void 0:k.type;return(S==null?void 0:S.includes("mouse"))&&S!=="mousedown"});z.useEffect(()=>{if(!c)return;function k(S){let{open:B}=S;B||(Pt(C),Pt(L),F.current=!0,E.current=!1)}return s.on("openchange",k),()=>{s.off("openchange",k)}},[c,s]),z.useEffect(()=>{if(!c||!m.current||!n)return;function k(B){T()&&r(!1,B,"hover")}const S=Xt(i.floating).documentElement;return S.addEventListener("mouseleave",k),()=>{S.removeEventListener("mouseleave",k)}},[i.floating,n,r,c,m,T]);const I=z.useCallback(function(k,S,B){S===void 0&&(S=!0),B===void 0&&(B="hover");const j=Il(g.current,"close",P.current);j&&!M.current?(Pt(C),C.current=window.setTimeout(()=>r(!1,k,B),j)):S&&(Pt(C),r(!1,k,B))},[g,r]),$=Qt(()=>{y.current(),M.current=void 0}),D=Qt(()=>{if(b.current){const k=Xt(i.floating).body;k.style.pointerEvents="",k.removeAttribute(um),b.current=!1}}),w=Qt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);z.useEffect(()=>{if(!c)return;function k(_){if(Pt(C),F.current=!1,u&&!Qo(P.current)||$l(x.current)>0&&!Il(g.current,"open"))return;const G=Il(g.current,"open",P.current);G?C.current=window.setTimeout(()=>{N.current||r(!0,_,"hover")},G):n||r(!0,_,"hover")}function S(_){if(w()){D();return}y.current();const G=Xt(i.floating);if(Pt(L),E.current=!1,m.current&&o.current.floatingContext){n||Pt(C),M.current=m.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){D(),$(),w()||I(_,!0,"safe-polygon")}});const q=M.current;G.addEventListener("mousemove",q),y.current=()=>{G.removeEventListener("mousemove",q)};return}(P.current==="touch"?!Ur(i.floating,_.relatedTarget):!0)&&I(_)}function B(_){w()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){D(),$(),w()||I(_)}})(_))}function j(){Pt(C)}function U(_){w()||I(_,!1)}if(ye(i.domReference)){const _=i.domReference,G=i.floating;return n&&_.addEventListener("mouseleave",B),p&&_.addEventListener("mousemove",k,{once:!0}),_.addEventListener("mouseenter",k),_.addEventListener("mouseleave",S),G&&(G.addEventListener("mouseleave",B),G.addEventListener("mouseenter",j),G.addEventListener("mouseleave",U)),()=>{n&&_.removeEventListener("mouseleave",B),p&&_.removeEventListener("mousemove",k),_.removeEventListener("mouseenter",k),_.removeEventListener("mouseleave",S),G&&(G.removeEventListener("mouseleave",B),G.removeEventListener("mouseenter",j),G.removeEventListener("mouseleave",U))}}},[i,c,e,u,p,I,$,D,r,n,N,d,g,m,o,w,x]),Jt(()=>{var k;if(c&&n&&(k=m.current)!=null&&(k=k.__options)!=null&&k.blockPointerEvents&&T()){b.current=!0;const B=i.floating;if(ye(i.domReference)&&B){var S;const j=Xt(i.floating).body;j.setAttribute(um,"");const U=i.domReference,_=d==null||(S=d.nodesRef.current.find(G=>G.id===h))==null||(S=S.context)==null?void 0:S.elements.floating;return _&&(_.style.pointerEvents=""),j.style.pointerEvents="none",U.style.pointerEvents="auto",B.style.pointerEvents="auto",()=>{j.style.pointerEvents="",U.style.pointerEvents="",B.style.pointerEvents=""}}}},[c,n,h,i,d,m,T]),Jt(()=>{n||(P.current=void 0,E.current=!1,$(),D())},[n,$,D]),z.useEffect(()=>()=>{$(),Pt(C),Pt(L),D()},[c,i.domReference,$,D]);const O=z.useMemo(()=>{function k(S){P.current=S.pointerType}return{onPointerDown:k,onPointerEnter:k,onMouseMove(S){const{nativeEvent:B}=S;function j(){!F.current&&!N.current&&r(!0,B,"hover")}u&&!Qo(P.current)||n||$l(x.current)===0||E.current&&S.movementX**2+S.movementY**2<2||(Pt(L),P.current==="touch"?j():(E.current=!0,L.current=window.setTimeout(j,$l(x.current))))}}},[u,r,n,N,x]);return z.useMemo(()=>c?{reference:O}:{},[c,O])}const fm={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},dm=z.forwardRef(function(t,n){const[r,o]=z.useState();Jt(()=>{em()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[es("focus-guard")]:"",style:fm};return A.jsx("span",{...t,...s})}),pm=z.createContext(null),hm=es("portal");function ES(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Al(),o=PS(),[s,i]=z.useState(null),c=z.useRef(null);return Jt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Jt(()=>{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(hm,""),a.appendChild(l),c.current=l,i(l)},[t,r]),Jt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Gc(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(hm,""),a=l||a,a.appendChild(u),c.current=u,i(u)},[t,n,r,o]),s}function SS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=ES({id:n,root:r}),[i,c]=z.useState(null),a=z.useRef(null),l=z.useRef(null),u=z.useRef(null),f=z.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return z.useEffect(()=>{if(!s||!o||p)return;function m(g){s&&Tl(g)&&(g.type==="focusin"?sm:dS)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),z.useEffect(()=>{s&&(d||sm(s))},[d,s]),A.jsxs(pm.Provider,{value:z.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&A.jsx(dm,{"data-type":"outside",ref:a,onFocus:m=>{if(Tl(m,s)){var g;(g=u.current)==null||g.focus()}else{const N=i?i.domReference:null,x=fS(N);x==null||x.focus()}}}),h&&s&&A.jsx("span",{"aria-owns":s.id,style:fm}),s&&Hr.createPortal(t,s),h&&s&&A.jsx(dm,{"data-type":"outside",ref:l,onFocus:m=>{if(Tl(m,s)){var g;(g=f.current)==null||g.focus()}else{const N=i?i.domReference:null,x=uS(N);x==null||x.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const PS=()=>z.useContext(pm);function mm(e){return Ve(e.target)&&e.target.tagName==="BUTTON"}function TS(e){return Ve(e.target)&&e.target.tagName==="A"}function bm(e){return nm(e)}function AS(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,p=z.useRef(),d=z.useRef(!1),h=z.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const g=p.current;m.button===0&&c!=="click"&&(Qo(g,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const g=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}Qo(g,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!u||mm(m))&&(m.key===" "&&!bm(s)&&(m.preventDefault(),d.current=!0),!TS(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!u||mm(m)||bm(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,l,u,r,n,f,a]);return z.useMemo(()=>i?{reference:h}:{},[i,h])}const NS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},CS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},gm=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 OS(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:p=!1,bubbles:d,capture:h}=t,m=Ol(),g=Qt(typeof a=="function"?a:()=>!1),N=typeof a=="function"?g:a,x=z.useRef(!1),{escapeKey:P,outsidePress:C}=gm(d),{escapeKey:M,outsidePress:L}=gm(h),F=z.useRef(!1),b=Qt(D=>{var w;if(!n||!i||!c||D.key!=="Escape"||F.current)return;const O=(w=s.current.floatingContext)==null?void 0:w.nodeId,k=m?Ei(m.nodesRef.current,O):[];if(!P&&(D.stopPropagation(),k.length>0)){let S=!0;if(k.forEach(B=>{var j;if((j=B.context)!=null&&j.open&&!B.context.dataRef.current.__escapeKeyBubbles){S=!1;return}}),!S)return}r(!1,sS(D)?D.nativeEvent:D,"escape-key")}),y=Qt(D=>{var w;const O=()=>{var k;b(D),(k=_r(D))==null||k.removeEventListener("keydown",O)};(w=_r(D))==null||w.addEventListener("keydown",O)}),E=Qt(D=>{var w;const O=s.current.insideReactTree;s.current.insideReactTree=!1;const k=x.current;if(x.current=!1,l==="click"&&k||O||typeof N=="function"&&!N(D))return;const S=_r(D),B="["+es("inert")+"]",j=Xt(o.floating).querySelectorAll(B);let U=ye(S)?S:null;for(;U&&!gn(U);){const q=yn(U);if(gn(q)||!ye(q))break;U=q}if(j.length&&ye(S)&&!nS(S)&&!Ur(S,o.floating)&&Array.from(j).every(q=>!Ur(U,q)))return;if(Ve(S)&&$){const q=gn(S),W=Et(S),ee=/auto|scroll/,ve=q||ee.test(W.overflowX),K=q||ee.test(W.overflowY),oe=ve&&S.clientWidth>0&&S.scrollWidth>S.clientWidth,se=K&&S.clientHeight>0&&S.scrollHeight>S.clientHeight,Z=W.direction==="rtl",J=se&&(Z?D.offsetX<=S.offsetWidth-S.clientWidth:D.offsetX>S.clientWidth),ie=oe&&D.offsetY>S.clientHeight;if(J||ie)return}const _=(w=s.current.floatingContext)==null?void 0:w.nodeId,G=m&&Ei(m.nodesRef.current,_).some(q=>{var W;return Pl(D,(W=q.context)==null?void 0:W.elements.floating)});if(Pl(D,o.floating)||Pl(D,o.domReference)||G)return;const Q=m?Ei(m.nodesRef.current,_):[];if(Q.length>0){let q=!0;if(Q.forEach(W=>{var ee;if((ee=W.context)!=null&&ee.open&&!W.context.dataRef.current.__outsidePressBubbles){q=!1;return}}),!q)return}r(!1,D,"outside-press")}),T=Qt(D=>{var w;const O=()=>{var k;E(D),(k=_r(D))==null||k.removeEventListener(l,O)};(w=_r(D))==null||w.addEventListener(l,O)});z.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=P,s.current.__outsidePressBubbles=C;let D=-1;function w(j){r(!1,j,"ancestor-scroll")}function O(){window.clearTimeout(D),F.current=!0}function k(){D=window.setTimeout(()=>{F.current=!1},ti()?5:0)}const S=Xt(o.floating);c&&(S.addEventListener("keydown",M?y:b,M),S.addEventListener("compositionstart",O),S.addEventListener("compositionend",k)),N&&S.addEventListener(l,L?T:E,L);let B=[];return p&&(ye(o.domReference)&&(B=Fn(o.domReference)),ye(o.floating)&&(B=B.concat(Fn(o.floating))),!ye(o.reference)&&o.reference&&o.reference.contextElement&&(B=B.concat(Fn(o.reference.contextElement)))),B=B.filter(j=>{var U;return j!==((U=S.defaultView)==null?void 0:U.visualViewport)}),B.forEach(j=>{j.addEventListener("scroll",w,{passive:!0})}),()=>{c&&(S.removeEventListener("keydown",M?y:b,M),S.removeEventListener("compositionstart",O),S.removeEventListener("compositionend",k)),N&&S.removeEventListener(l,L?T:E,L),B.forEach(j=>{j.removeEventListener("scroll",w)}),window.clearTimeout(D)}},[s,o,c,N,l,n,r,p,i,P,C,b,M,y,E,L,T]),z.useEffect(()=>{s.current.insideReactTree=!1},[s,N,l]);const I=z.useMemo(()=>({onKeyDown:b,...u&&{[NS[f]]:D=>{r(!1,D.nativeEvent,"reference-press")},...f!=="click"&&{onClick(D){r(!1,D.nativeEvent,"reference-press")}}}}),[b,r,u,f]),$=z.useMemo(()=>({onKeyDown:b,onMouseDown(){x.current=!0},onMouseUp(){x.current=!0},[CS[l]]:()=>{s.current.insideReactTree=!0}}),[b,l,s]);return z.useMemo(()=>i?{reference:I,floating:$}:{},[i,I,$])}function IS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Al(),s=z.useRef({}),[i]=z.useState(()=>yS()),c=Cl()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!ye(d)&&gS("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]=z.useState(r.reference),u=Qt((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:l}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function $S(e){e===void 0&&(e={});const{nodeId:t}=e,n=IS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),u=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=Ol();Jt(()=>{u&&(f.current=u)},[u]);const d=Qp({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(P=>{const C=ye(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;a(C),d.refs.setReference(C)},[d.refs]),m=z.useCallback(P=>{(ye(P)||P===null)&&(f.current=P,i(P)),(ye(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!ye(P))&&d.refs.setReference(P)},[d.refs]),g=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),N=z.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=z.useMemo(()=>({...d,...r,refs:g,elements:N,nodeId:t}),[d,g,N,t,r]);return Jt(()=>{r.dataRef.current.floatingContext=x;const P=p==null?void 0:p.nodesRef.current.find(C=>C.id===t);P&&(P.context=x)}),z.useMemo(()=>({...d,context:x,refs:g,elements:N}),[d,g,N,x])}function kl(){return Q3()&&em()}function kS(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=z.useRef(!1),u=z.useRef(-1),f=z.useRef(!0);z.useEffect(()=>{if(!c)return;const d=nt(i.domReference);function h(){!n&&Ve(i.domReference)&&i.domReference===Sl(Xt(i.domReference))&&(l.current=!0)}function m(){f.current=!0}function g(){f.current=!1}return d.addEventListener("blur",h),kl()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",g,!0)),()=>{d.removeEventListener("blur",h),kl()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",g,!0))}},[i.domReference,n,c]),z.useEffect(()=>{if(!c)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(l.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,c]),z.useEffect(()=>()=>{Pt(u)},[]);const p=z.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(d){if(l.current)return;const h=_r(d.nativeEvent);if(a&&ye(h)){if(kl()&&!d.relatedTarget){if(!f.current&&!nm(h))return}else if(!rS(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){l.current=!1;const h=d.relatedTarget,m=d.nativeEvent,g=ye(h)&&h.hasAttribute(es("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var N;const x=Sl(i.domReference?i.domReference.ownerDocument:document);!h&&x===i.domReference||Ur((N=s.current.floatingContext)==null?void 0:N.refs.floating.current,x)||Ur(i.domReference,x)||g||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return z.useMemo(()=>c?{reference:p}:{},[c,p])}function Ml(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[im]:i,[am]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[pS]:""},...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&&[im,am].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 p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(l))==null?void 0:p.map(g=>g(...h)).find(g=>g!==void 0)}}}else i[l]=u}),i),{})}}function MS(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>Ml(c,e,"reference"),t),s=z.useCallback(c=>Ml(c,e,"floating"),n),i=z.useCallback(c=>Ml(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const DS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function BS(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=Al(),u=((n=s.domReference)==null?void 0:n.id)||l,f=z.useMemo(()=>{var x;return((x=oS(s.floating))==null?void 0:x.id)||i},[s.floating,i]),p=(r=DS.get(a))!=null?r:a,h=Cl()!=null,m=z.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,u,a]),g=z.useMemo(()=>{const x={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?x:{...x,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,a]),N=z.useCallback(x=>{let{active:P,selected:C}=x;const M={role:"option",...P&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...M,"aria-selected":C}}return{}},[f,a]);return z.useMemo(()=>c?{reference:m,floating:g,item:N}:{},[c,m,g,N])}const ym=v.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 A.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});ym.displayName="TooltipArrow";const En=({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]=v.useState(!1),f=v.useRef(null),{refs:p,floatingStyles:d,context:h}=$S({open:l&&!i,onOpenChange:u,placement:n,whileElementsMounted:Zp,middleware:[il(o?12:8),th({fallbackAxisSideDirection:"start",padding:8}),eh({padding:8}),...o?[JE({element:f})]:[]]}),m=xS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),g=kS(h,{enabled:a.includes("focus")}),N=AS(h,{enabled:a.includes("click")}),x=OS(h),P=BS(h,{role:"tooltip"}),{getReferenceProps:C,getFloatingProps:M}=MS([m,g,N,x,P]);return i?A.jsx(A.Fragment,{children:e}):A.jsxs(A.Fragment,{children:[A.jsx("div",{ref:p.setReference,...C(),style:{cursor:"help"},children:e}),l&&A.jsx(SS,{children:A.jsx("div",{className:"edgex-components",children:A.jsxs("div",{ref:p.setFloating,...M(),style:{...d,zIndex:101},className:`
|
|
177
|
+
*/var H3={L:zr.QrCode.Ecc.LOW,M:zr.QrCode.Ecc.MEDIUM,Q:zr.QrCode.Ecc.QUARTILE,H:zr.QrCode.Ecc.HIGH},Hh=128,Gh="L",qh="#FFFFFF",Kh="#000000",Zh=!1,Yh=1,G3=4,q3=0,K3=.1;function Xh(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,l){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${l-s}v1H${s+t}z`),s=null;return}if(l===r.length-1){if(!i)return;s===null?n.push(`M${l+t},${o+t} h1v1H${l+t}z`):n.push(`M${s+t},${o+t} h${l+1-s}v1H${s+t}z`);return}i&&s===null&&(s=l)})}),n.join("")}function Jh(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 Z3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*K3),i=o/t,l=(r.width||s)*i,a=(r.height||s)*i,c=r.x==null?e.length/2-l/2:r.x*i,u=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(c),m=Math.floor(u),g=Math.ceil(l+c-h),N=Math.ceil(a+u-m);p={x:h,y:m,w:g,h:N}}const d=r.crossOrigin;return{x:c,y:u,h:a,w:l,excavation:p,opacity:f,crossOrigin:d}}function Y3(e,t){return t!=null?Math.max(Math.floor(t),0):e?G3:q3}function Qh({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:l}){let a=y.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,g)=>(m.push(...zr.QrSegment.makeSegments(g)),m),[]);return zr.QrCode.encodeSegments(h,H3[t],n,void 0,void 0,l)},[e,t,n,l]);const{cells:c,margin:u,numCells:f,calculatedImageSettings:p}=y.useMemo(()=>{let d=a.getModules();const h=Y3(r,o),m=d.length+h*2,g=Z3(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:g}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:c,numCells:f,calculatedImageSettings:p}}var X3=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),J3=y.forwardRef(function(t,n){const r=t,{value:o,size:s=Hh,level:i=Gh,bgColor:l=qh,fgColor:a=Kh,includeMargin:c=Zh,minVersion:u=Yh,boostLevel:f,marginSize:p,imageSettings:d}=r,m=Ec(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:g}=m,N=Ec(m,["style"]),x=d==null?void 0:d.src,P=y.useRef(null),C=y.useRef(null),D=y.useCallback(B=>{P.current=B,typeof n=="function"?n(B):n&&(n.current=B)},[n]),[F,L]=y.useState(!1),{margin:b,cells:v,numCells:E,calculatedImageSettings:$}=Qh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:c,marginSize:p,imageSettings:d,size:s});y.useEffect(()=>{if(P.current!=null){const B=P.current,w=B.getContext("2d");if(!w)return;let O=v;const k=C.current,S=$!=null&&k!==null&&k.complete&&k.naturalHeight!==0&&k.naturalWidth!==0;S&&$.excavation!=null&&(O=Jh(v,$.excavation));const M=window.devicePixelRatio||1;B.height=B.width=s*M;const j=s/E*M;w.scale(j,j),w.fillStyle=l,w.fillRect(0,0,E,E),w.fillStyle=a,X3?w.fill(new Path2D(Xh(O,b))):v.forEach(function(z,_){z.forEach(function(q,Q){q&&w.fillRect(Q+b,_+b,1,1)})}),$&&(w.globalAlpha=$.opacity),S&&w.drawImage(k,$.x+b,$.y+b,$.w,$.h)}}),y.useEffect(()=>{L(!1)},[x]);const I=xc({height:s,width:s},g);let T=null;return x!=null&&(T=y.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{L(!0)},ref:C,crossOrigin:$==null?void 0:$.crossOrigin})),y.createElement(y.Fragment,null,y.createElement("canvas",xc({style:I,height:s,width:s,ref:D,role:"img"},N)),T)});J3.displayName="QRCodeCanvas";var em=y.forwardRef(function(t,n){const r=t,{value:o,size:s=Hh,level:i=Gh,bgColor:l=qh,fgColor:a=Kh,includeMargin:c=Zh,minVersion:u=Yh,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=Ec(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:g,cells:N,numCells:x,calculatedImageSettings:P}=Qh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:c,marginSize:d,imageSettings:h,size:s});let C=N,D=null;h!=null&&P!=null&&(P.excavation!=null&&(C=Jh(N,P.excavation)),D=y.createElement("image",{href:h.src,height:P.h,width:P.w,x:P.x+g,y:P.y+g,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const F=Xh(C,g);return y.createElement("svg",xc({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},m),!!p&&y.createElement("title",null,p),y.createElement("path",{fill:l,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),y.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),D)});em.displayName="QRCodeSVG";function Q3(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function eS(){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 tm(){return/apple/i.test(navigator.vendor)}function tS(){return Q3().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function nS(){return eS().includes("jsdom/")}const nm="data-floating-ui-focusable",rS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Sc(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 Ur(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&ql(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function _r(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Pc(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 oS(e){return e.matches("html,body")}function Jt(e){return(e==null?void 0:e.ownerDocument)||document}function rm(e){return He(e)&&e.matches(rS)}function sS(e){if(!e||nS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function iS(e){return e?e.hasAttribute(nm)?e:e.querySelector("["+nm+"]")||e:null}function Ei(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,...Ei(e,o.id,n)])}function aS(e){return"nativeEvent"in e}function Qo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var lS=typeof document<"u",cS=function(){},Qt=lS?y.useLayoutEffect:cS;const uS={...U};function Si(e){const t=U.useRef(e);return Qt(()=>{t.current=e}),t}const fS=uS.useInsertionEffect||(e=>e());function en(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return fS(()=>{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 om=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function sm(e,t){const n=jp(e,om()),r=n.length;if(r===0)return;const o=Sc(Jt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function dS(e){return sm(Jt(e).body,1)||e}function pS(e){return sm(Jt(e).body,-1)||e}function Tc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Ur(n,r)}function hS(e){jp(e,om()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function im(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 mS="data-floating-ui-focusable",am="active",lm="selected",bS={...U};let cm=!1,gS=0;const um=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+gS++;function yS(){const[e,t]=U.useState(()=>cm?um():void 0);return Qt(()=>{e==null&&t(um())},[]),U.useEffect(()=>{cm=!0},[]),e}const Ac=bS.useId||yS;let Nc;process.env.NODE_ENV!=="production"&&(Nc=new Set);function vS(){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=Nc)!=null&&e.has(o))){var s;(s=Nc)==null||s.add(o),console.error(o)}}function wS(){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 xS=U.createContext(null),ES=U.createContext(null),Cc=()=>{var e;return((e=U.useContext(xS))==null?void 0:e.id)||null},Oc=()=>U.useContext(ES);function es(e){return"data-floating-ui-"+e}function Tt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const fm=es("safe-polygon");function Ic(e,t,n){if(n&&!Qo(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 $c(e){return typeof e=="function"?e():e}function SS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:f=0,move:p=!0}=t,d=Oc(),h=Cc(),m=Si(c),g=Si(a),N=Si(n),x=Si(f),P=U.useRef(),C=U.useRef(-1),D=U.useRef(),F=U.useRef(-1),L=U.useRef(!0),b=U.useRef(!1),v=U.useRef(()=>{}),E=U.useRef(!1),$=en(()=>{var k;const S=(k=o.current.openEvent)==null?void 0:k.type;return(S==null?void 0:S.includes("mouse"))&&S!=="mousedown"});U.useEffect(()=>{if(!l)return;function k(S){let{open:M}=S;M||(Tt(C),Tt(F),L.current=!0,E.current=!1)}return s.on("openchange",k),()=>{s.off("openchange",k)}},[l,s]),U.useEffect(()=>{if(!l||!m.current||!n)return;function k(M){$()&&r(!1,M,"hover")}const S=Jt(i.floating).documentElement;return S.addEventListener("mouseleave",k),()=>{S.removeEventListener("mouseleave",k)}},[i.floating,n,r,l,m,$]);const I=U.useCallback(function(k,S,M){S===void 0&&(S=!0),M===void 0&&(M="hover");const j=Ic(g.current,"close",P.current);j&&!D.current?(Tt(C),C.current=window.setTimeout(()=>r(!1,k,M),j)):S&&(Tt(C),r(!1,k,M))},[g,r]),T=en(()=>{v.current(),D.current=void 0}),B=en(()=>{if(b.current){const k=Jt(i.floating).body;k.style.pointerEvents="",k.removeAttribute(fm),b.current=!1}}),w=en(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!l)return;function k(_){if(Tt(C),L.current=!1,u&&!Qo(P.current)||$c(x.current)>0&&!Ic(g.current,"open"))return;const q=Ic(g.current,"open",P.current);q?C.current=window.setTimeout(()=>{N.current||r(!0,_,"hover")},q):n||r(!0,_,"hover")}function S(_){if(w()){B();return}v.current();const q=Jt(i.floating);if(Tt(F),E.current=!1,m.current&&o.current.floatingContext){n||Tt(C),D.current=m.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){B(),T(),w()||I(_,!0,"safe-polygon")}});const K=D.current;q.addEventListener("mousemove",K),v.current=()=>{q.removeEventListener("mousemove",K)};return}(P.current==="touch"?!Ur(i.floating,_.relatedTarget):!0)&&I(_)}function M(_){w()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){B(),T(),w()||I(_)}})(_))}function j(){Tt(C)}function z(_){w()||I(_,!1)}if(ye(i.domReference)){const _=i.domReference,q=i.floating;return n&&_.addEventListener("mouseleave",M),p&&_.addEventListener("mousemove",k,{once:!0}),_.addEventListener("mouseenter",k),_.addEventListener("mouseleave",S),q&&(q.addEventListener("mouseleave",M),q.addEventListener("mouseenter",j),q.addEventListener("mouseleave",z)),()=>{n&&_.removeEventListener("mouseleave",M),p&&_.removeEventListener("mousemove",k),_.removeEventListener("mouseenter",k),_.removeEventListener("mouseleave",S),q&&(q.removeEventListener("mouseleave",M),q.removeEventListener("mouseenter",j),q.removeEventListener("mouseleave",z))}}},[i,l,e,u,p,I,T,B,r,n,N,d,g,m,o,w,x]),Qt(()=>{var k;if(l&&n&&(k=m.current)!=null&&(k=k.__options)!=null&&k.blockPointerEvents&&$()){b.current=!0;const M=i.floating;if(ye(i.domReference)&&M){var S;const j=Jt(i.floating).body;j.setAttribute(fm,"");const z=i.domReference,_=d==null||(S=d.nodesRef.current.find(q=>q.id===h))==null||(S=S.context)==null?void 0:S.elements.floating;return _&&(_.style.pointerEvents=""),j.style.pointerEvents="none",z.style.pointerEvents="auto",M.style.pointerEvents="auto",()=>{j.style.pointerEvents="",z.style.pointerEvents="",M.style.pointerEvents=""}}}},[l,n,h,i,d,m,$]),Qt(()=>{n||(P.current=void 0,E.current=!1,T(),B())},[n,T,B]),U.useEffect(()=>()=>{T(),Tt(C),Tt(F),B()},[l,i.domReference,T,B]);const O=U.useMemo(()=>{function k(S){P.current=S.pointerType}return{onPointerDown:k,onPointerEnter:k,onMouseMove(S){const{nativeEvent:M}=S;function j(){!L.current&&!N.current&&r(!0,M,"hover")}u&&!Qo(P.current)||n||$c(x.current)===0||E.current&&S.movementX**2+S.movementY**2<2||(Tt(F),P.current==="touch"?j():(E.current=!0,F.current=window.setTimeout(j,$c(x.current))))}}},[u,r,n,N,x]);return U.useMemo(()=>l?{reference:O}:{},[l,O])}const dm={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},pm=U.forwardRef(function(t,n){const[r,o]=U.useState();Qt(()=>{tm()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[es("focus-guard")]:"",style:dm};return A.jsx("span",{...t,...s})}),hm=U.createContext(null),mm=es("portal");function PS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Ac(),o=AS(),[s,i]=U.useState(null),l=U.useRef(null);return Qt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{l.current=null})},[s]),Qt(()=>{if(!r||l.current)return;const a=t?document.getElementById(t):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(mm,""),a.appendChild(c),l.current=c,i(c)},[t,r]),Qt(()=>{if(n===null||!r||l.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Gl(a)&&(a=a.current),a=a||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(mm,""),a=c||a,a.appendChild(u),l.current=u,i(u)},[t,n,r,o]),s}function TS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=PS({id:n,root:r}),[i,l]=U.useState(null),a=U.useRef(null),c=U.useRef(null),u=U.useRef(null),f=U.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||p)return;function m(g){s&&Tc(g)&&(g.type==="focusin"?im:hS)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),U.useEffect(()=>{s&&(d||im(s))},[d,s]),A.jsxs(hm.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:l}),[o,s]),children:[h&&s&&A.jsx(pm,{"data-type":"outside",ref:a,onFocus:m=>{if(Tc(m,s)){var g;(g=u.current)==null||g.focus()}else{const N=i?i.domReference:null,x=pS(N);x==null||x.focus()}}}),h&&s&&A.jsx("span",{"aria-owns":s.id,style:dm}),s&&Hr.createPortal(t,s),h&&s&&A.jsx(pm,{"data-type":"outside",ref:c,onFocus:m=>{if(Tc(m,s)){var g;(g=f.current)==null||g.focus()}else{const N=i?i.domReference:null,x=dS(N);x==null||x.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const AS=()=>U.useContext(hm);function bm(e){return He(e.target)&&e.target.tagName==="BUTTON"}function NS(e){return He(e.target)&&e.target.tagName==="A"}function gm(e){return rm(e)}function CS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:l="click",toggle:a=!0,ignoreMouse:c=!1,keyboardHandlers:u=!0,stickIfOpen:f=!0}=t,p=U.useRef(),d=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const g=p.current;m.button===0&&l!=="click"&&(Qo(g,!0)&&c||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const g=p.current;if(l==="mousedown"&&p.current){p.current=void 0;return}Qo(g,!0)&&c||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!u||bm(m))&&(m.key===" "&&!gm(s)&&(m.preventDefault(),d.current=!0),!NS(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!u||bm(m)||gm(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,l,c,u,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const OS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},IS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},ym=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 $S(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,m=Oc(),g=en(typeof a=="function"?a:()=>!1),N=typeof a=="function"?g:a,x=U.useRef(!1),{escapeKey:P,outsidePress:C}=ym(d),{escapeKey:D,outsidePress:F}=ym(h),L=U.useRef(!1),b=en(B=>{var w;if(!n||!i||!l||B.key!=="Escape"||L.current)return;const O=(w=s.current.floatingContext)==null?void 0:w.nodeId,k=m?Ei(m.nodesRef.current,O):[];if(!P&&(B.stopPropagation(),k.length>0)){let S=!0;if(k.forEach(M=>{var j;if((j=M.context)!=null&&j.open&&!M.context.dataRef.current.__escapeKeyBubbles){S=!1;return}}),!S)return}r(!1,aS(B)?B.nativeEvent:B,"escape-key")}),v=en(B=>{var w;const O=()=>{var k;b(B),(k=_r(B))==null||k.removeEventListener("keydown",O)};(w=_r(B))==null||w.addEventListener("keydown",O)}),E=en(B=>{var w;const O=s.current.insideReactTree;s.current.insideReactTree=!1;const k=x.current;if(x.current=!1,c==="click"&&k||O||typeof N=="function"&&!N(B))return;const S=_r(B),M="["+es("inert")+"]",j=Jt(o.floating).querySelectorAll(M);let z=ye(S)?S:null;for(;z&&!gn(z);){const K=yn(z);if(gn(K)||!ye(K))break;z=K}if(j.length&&ye(S)&&!oS(S)&&!Ur(S,o.floating)&&Array.from(j).every(K=>!Ur(z,K)))return;if(He(S)&&T){const K=gn(S),W=St(S),te=/auto|scroll/,be=K||te.test(W.overflowX),de=K||te.test(W.overflowY),Ee=be&&S.clientWidth>0&&S.scrollWidth>S.clientWidth,Z=de&&S.clientHeight>0&&S.scrollHeight>S.clientHeight,H=W.direction==="rtl",X=Z&&(H?B.offsetX<=S.offsetWidth-S.clientWidth:B.offsetX>S.clientWidth),ae=Ee&&B.offsetY>S.clientHeight;if(X||ae)return}const _=(w=s.current.floatingContext)==null?void 0:w.nodeId,q=m&&Ei(m.nodesRef.current,_).some(K=>{var W;return Pc(B,(W=K.context)==null?void 0:W.elements.floating)});if(Pc(B,o.floating)||Pc(B,o.domReference)||q)return;const Q=m?Ei(m.nodesRef.current,_):[];if(Q.length>0){let K=!0;if(Q.forEach(W=>{var te;if((te=W.context)!=null&&te.open&&!W.context.dataRef.current.__outsidePressBubbles){K=!1;return}}),!K)return}r(!1,B,"outside-press")}),$=en(B=>{var w;const O=()=>{var k;E(B),(k=_r(B))==null||k.removeEventListener(c,O)};(w=_r(B))==null||w.addEventListener(c,O)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=P,s.current.__outsidePressBubbles=C;let B=-1;function w(j){r(!1,j,"ancestor-scroll")}function O(){window.clearTimeout(B),L.current=!0}function k(){B=window.setTimeout(()=>{L.current=!1},ti()?5:0)}const S=Jt(o.floating);l&&(S.addEventListener("keydown",D?v:b,D),S.addEventListener("compositionstart",O),S.addEventListener("compositionend",k)),N&&S.addEventListener(c,F?$:E,F);let M=[];return p&&(ye(o.domReference)&&(M=Fn(o.domReference)),ye(o.floating)&&(M=M.concat(Fn(o.floating))),!ye(o.reference)&&o.reference&&o.reference.contextElement&&(M=M.concat(Fn(o.reference.contextElement)))),M=M.filter(j=>{var z;return j!==((z=S.defaultView)==null?void 0:z.visualViewport)}),M.forEach(j=>{j.addEventListener("scroll",w,{passive:!0})}),()=>{l&&(S.removeEventListener("keydown",D?v:b,D),S.removeEventListener("compositionstart",O),S.removeEventListener("compositionend",k)),N&&S.removeEventListener(c,F?$:E,F),M.forEach(j=>{j.removeEventListener("scroll",w)}),window.clearTimeout(B)}},[s,o,l,N,c,n,r,p,i,P,C,b,D,v,E,F,$]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,N,c]);const I=U.useMemo(()=>({onKeyDown:b,...u&&{[OS[f]]:B=>{r(!1,B.nativeEvent,"reference-press")},...f!=="click"&&{onClick(B){r(!1,B.nativeEvent,"reference-press")}}}}),[b,r,u,f]),T=U.useMemo(()=>({onKeyDown:b,onMouseDown(){x.current=!0},onMouseUp(){x.current=!0},[IS[c]]:()=>{s.current.insideReactTree=!0}}),[b,c,s]);return U.useMemo(()=>i?{reference:I,floating:T}:{},[i,I,T])}function kS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Ac(),s=U.useRef({}),[i]=U.useState(()=>wS()),l=Cc()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!ye(d)&&vS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=en((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:l}),n==null||n(d,h,m)}),f=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function MS(e){e===void 0&&(e={});const{nodeId:t}=e,n=kS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=Oc();Qt(()=>{u&&(f.current=u)},[u]);const d=eh({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(P=>{const C=ye(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;a(C),d.refs.setReference(C)},[d.refs]),m=U.useCallback(P=>{(ye(P)||P===null)&&(f.current=P,i(P)),(ye(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!ye(P))&&d.refs.setReference(P)},[d.refs]),g=U.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),N=U.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=U.useMemo(()=>({...d,...r,refs:g,elements:N,nodeId:t}),[d,g,N,t,r]);return Qt(()=>{r.dataRef.current.floatingContext=x;const P=p==null?void 0:p.nodesRef.current.find(C=>C.id===t);P&&(P.context=x)}),U.useMemo(()=>({...d,context:x,refs:g,elements:N}),[d,g,N,x])}function kc(){return tS()&&tm()}function DS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:l=!0,visibleOnly:a=!0}=t,c=U.useRef(!1),u=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!l)return;const d=rt(i.domReference);function h(){!n&&He(i.domReference)&&i.domReference===Sc(Jt(i.domReference))&&(c.current=!0)}function m(){f.current=!0}function g(){f.current=!1}return d.addEventListener("blur",h),kc()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",g,!0)),()=>{d.removeEventListener("blur",h),kc()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",g,!0))}},[i.domReference,n,l]),U.useEffect(()=>{if(!l)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(c.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,l]),U.useEffect(()=>()=>{Tt(u)},[]);const p=U.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(d){if(c.current)return;const h=_r(d.nativeEvent);if(a&&ye(h)){if(kc()&&!d.relatedTarget){if(!f.current&&!rm(h))return}else if(!sS(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){c.current=!1;const h=d.relatedTarget,m=d.nativeEvent,g=ye(h)&&h.hasAttribute(es("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var N;const x=Sc(i.domReference?i.domReference.ownerDocument:document);!h&&x===i.domReference||Ur((N=s.current.floatingContext)==null?void 0:N.refs.floating.current,x)||Ur(i.domReference,x)||g||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>l?{reference:p}:{},[l,p])}function Mc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[am]:i,[lm]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[mS]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[am,lm].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),i[c]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(c))==null?void 0:p.map(g=>g(...h)).find(g=>g!==void 0)}}}else i[c]=u}),i),{})}}function BS(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>Mc(l,e,"reference"),t),s=U.useCallback(l=>Mc(l,e,"floating"),n),i=U.useCallback(l=>Mc(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const LS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function FS(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:l=!0,role:a="dialog"}=t,c=Ac(),u=((n=s.domReference)==null?void 0:n.id)||c,f=U.useMemo(()=>{var x;return((x=iS(s.floating))==null?void 0:x.id)||i},[s.floating,i]),p=(r=LS.get(a))!=null?r:a,h=Cc()!=null,m=U.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,u,a]),g=U.useMemo(()=>{const x={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?x:{...x,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,a]),N=U.useCallback(x=>{let{active:P,selected:C}=x;const D={role:"option",...P&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...D,"aria-selected":C}}return{}},[f,a]);return U.useMemo(()=>l?{reference:m,floating:g,item:N}:{},[l,m,g,N])}const vm=y.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 A.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});vm.displayName="TooltipArrow";const En=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:l="max-w-xs",trigger:a=["hover","focus"]})=>{const[c,u]=y.useState(!1),f=y.useRef(null),{refs:p,floatingStyles:d,context:h}=MS({open:c&&!i,onOpenChange:u,placement:n,whileElementsMounted:Yp,middleware:[ic(o?12:8),nh({fallbackAxisSideDirection:"start",padding:8}),th({padding:8}),...o?[e8({element:f})]:[]]}),m=SS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),g=DS(h,{enabled:a.includes("focus")}),N=CS(h,{enabled:a.includes("click")}),x=$S(h),P=FS(h,{role:"tooltip"}),{getReferenceProps:C,getFloatingProps:D}=BS([m,g,N,x,P]);return i?A.jsx(A.Fragment,{children:e}):A.jsxs(A.Fragment,{children:[A.jsx("div",{ref:p.setReference,...C(),style:{cursor:"help"},children:e}),c&&A.jsx(TS,{children:A.jsx("div",{className:"edgex-components",children:A.jsxs("div",{ref:p.setFloating,...D(),style:{...d,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
|
|
181
181
|
rounded-lg shadow-lg
|
|
182
182
|
relative
|
|
183
|
-
${
|
|
183
|
+
${l}
|
|
184
184
|
${s}
|
|
185
|
-
`,children:[t,o&&A.jsx(
|
|
186
|
-
`)[0]:F},[l,t,e==null?void 0:e.chain,m,h]),x=(g==null?void 0:g.minDepositSize)||"10",P=v.useMemo(()=>{const C=g==null?void 0:g.depositFeeRate;if(C==null)return"";const M=String(C).trim();return M?`${M}%`:""},[g==null?void 0:g.depositFeeRate]);return A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&A.jsx("div",{className:"bg-white rounded-lg",children:A.jsx(Qh,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&A.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[A.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),A.jsx(U3,{onCopy:()=>{c&&c(n)},text:n,children:A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[A.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),A.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")]}),A.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[A.jsxs("div",{className:"flex items-start",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1",children:A.jsx("p",{className:"text-xs text-functional-orange-1",children:N})})]}),f&&A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),A.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:l("deposit.addressUpdatedNotice")})]})]}),A.jsxs("div",{className:"text-sm",children:[d&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[A.jsx("span",{className:"text-text-tertiary",children:l("deposit.arrivalTime")}),A.jsx(En,{content:A.jsxs("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[A.jsx("p",{children:l("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),A.jsx("p",{children:l("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed",children:l("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),P&&A.jsxs("div",{className:`flex justify-between items-center h-[18px] ${d?"mt-1":"mt-4"}`,children:[A.jsx("span",{className:"text-text-tertiary",children:l("withdraw.feeRate")}),A.jsx(En,{content:l("deposit.feeRateTooltip"),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:P})})]}),A.jsxs("div",{className:`flex justify-between items-center h-[18px] ${d||P?"mt-1":"mt-4"}`,children:[A.jsx("span",{className:"text-text-tertiary",children:l("deposit.minDeposit")}),A.jsxs("span",{className:"text-text-primary font-medium text-right",children:[x," ",t]})]}),f&&p!=="USDC"&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[A.jsx("span",{className:"text-text-tertiary",children:l("deposit.maxDeposit")}),A.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),A.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:()=>{i&&i({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t,accountType:r,accountId:o,key:s}),a()},children:l("deposit.title")})]})},ns=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return A.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},FS=(e,t)=>Number(e)>Number(t),jt=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"},Pi=(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 Pi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:jt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},RS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=jt(Math.max(0,s).toString());return A.jsxs("span",{className:"flex items-center gap-1",children:[jt(e),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${jt(e)} ${n}`},jS=(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)},zS=(e,t,n)=>{if(!kh(e,n))return!1;try{const r=new Le(t||"0"),o=new Le("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},US=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&kh(e,n))try{const i=new Le(o),c=new Le("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Le(o||"0");return i.isNaN()?o:i.decimalPlaces(6,Le.ROUND_DOWN).toString()}catch{return o}},vm={accountChains:[],defaultChainId:1,defaultAccountType:"",balances:{}};let rt=null;const wm=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(vm),a=v.useCallback(h=>{c(h),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(rt={openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d},()=>{rt=null}),[a,u,l,f,p,d]),n?A.jsx(Cm,{isOpen:n,isLoading:o,onClose:u,accountChains:i.accountChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});wm.displayName="DepositManager";const xm=e=>{if(!rt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}rt.openDeposit(e||vm)},Em=()=>{if(!rt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}rt.closeDeposit()},Sm=e=>{rt&&rt.updateDepositOptions(e)},Ti=e=>{if(!rt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}rt.setDepositLoading(e)},_S=()=>rt?rt.isOpen():!1,Pm=()=>rt?rt.isLoading():!1,WS=()=>({openDeposit:xm,closeDeposit:Em,updateDepositOptions:Sm,setDepositLoading:Ti,isOpen:_S,isLoading:Pm}),VS=e=>{const{t}=Nt(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return v.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const l=parseFloat(r||"0"),u=a,f=jS(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,p=(o==null?void 0:o.approveSpender)||(o==null?void 0:o.contractAddress),d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=l(),{writeContractAsync:m}=c(),g=a(),N=i({address:u,abi:Or,functionName:"allowance",args:[Nn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),x=N!=null&&N.isSuccess?N.data:void 0,P=v.useMemo(()=>{if(d)return!0;if(!N.isSuccess||x===void 0||x===0n)return!1;try{const M=B6(String(Number(s||"0")||0),Number(f));return x>=M}catch{return!1}},[d,N.isSuccess,x,s,f]),C=v.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!g||!u||!p)return;const L=Nn(u),F=Nn(p);if((x||0n)>0n){const E=await m({abi:Or,address:L,functionName:"approve",args:[F,0n]});await g.waitForTransactionReceipt({hash:E})}const y=await m({abi:Or,address:L,functionName:"approve",args:[F,pf]});await g.waitForTransactionReceipt({hash:y}),N!=null&&N.refetch&&await N.refetch()}catch(M){console.error("[useApprove] onApprove failed:",M)}},[r,n,u,p,x,N,m,g,h]);return{approve:P,onApprove:C}}const GS=({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 v.useEffect(()=>{o(Nn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},qS=({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=v.useMemo(()=>{const P="0x0000000000000000000000000000000000000000",C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(M=>{const L=M.tokenAddress;if(!L)return!1;const F=L.toLowerCase();return!(L===P||F===C)})},[r]),[c,a]=v.useState({}),l=v.useCallback((P,C)=>{a(M=>({...M,[P]:C}))},[]),u=(x=o==null?void 0:o.useBalance)==null?void 0:x.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=v.useState(0),d=v.useMemo(()=>i.map(P=>v.createElement(GS,{key:`${P.tokenAddress}-${f}`,token:P,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:l})),[i,e,s,n,o,l,f]),h=v.useMemo(()=>{const P=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},C=i.map(L=>{const F=c[Nn(L.tokenAddress)],b=F==null?void 0:F.balance,y=b==null?void 0:b.data;return{address:Nn(L.tokenAddress),value:(y==null?void 0:y.value)||BigInt(0),formatted:(y==null?void 0:y.formatted)||"0",decimals:(y==null?void 0:y.decimals)||L.decimals}}).filter(L=>L.address),M=C.reduce((L,F)=>({...L,[F.address]:{balance:F}}),{});return{balanceList:C,baseTokenBalance:P,combinedData:M}},[u,c,i]),m=v.useCallback(async()=>h,[h]),g=v.useMemo(()=>{const P=(u==null?void 0:u.isLoading)||!1,C=Object.values(c).some(M=>{var L;return(L=M.balance)==null?void 0:L.isLoading});return P||C},[u==null?void 0:u.isLoading,c]),N=v.useCallback(()=>p(P=>P+1),[]);return{multicallRun:m,multicallRefresh:N,multicallResult:h,validErcTokens:i,isLoading:g,queryComponents:d}},KS=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,accountId:o,accountKey:s,platformBalance:i,isLoading:c,wagmiHooks:a,onChainChange:l,onDeposit:u})=>{const{t:f}=Nt(),p=a.useAccount(),d=t.tokenList.find(Z=>Z.token===n||Z.symbol===n),h=t.chainId,m=v.useMemo(()=>{if(!((n||"").toUpperCase()==="USDC"))return!1;const J=Number((t==null?void 0:t.cctpResolvedMaxFee)??0);return Number.isFinite(J)?J!==0:!1},[t==null?void 0:t.cctpResolvedMaxFee,n]),[g,N]=v.useState(""),[x,P]=v.useState(()=>m?"fast":"standard");v.useEffect(()=>{N("")},[n,t.chainId]),v.useEffect(()=>{P(m?"fast":"standard")},[t.chainId,m]);const{multicallResult:C,queryComponents:M}=qS({account:e,chainId:t.chainId,contractAddress:(d==null?void 0:d.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:a}),L=v.useMemo(()=>{var J;if(!d)return"0";if(!d.tokenAddress||d.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return C.baseTokenBalance.formatted;const Z=C.combinedData[d.tokenAddress];return((J=Z==null?void 0:Z.balance)==null?void 0:J.formatted)||"0"},[d,C]),F="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",b="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",y=v.useMemo(()=>{var Z,J;return v5({chain:S5,transport:E5(t.rpcUrl||((Z=window==null?void 0:window.ENV)==null?void 0:Z.CHAIN_RPC_URL_42161)||((J=window==null?void 0:window.ENV)==null?void 0:J.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),E="1000000000000",{formatted:T}=P5({client:y,tokenAddress:F,holder:b,decimals:6,fallbackFormatted:E,pollingInterval:12e3}),[I,$]=v.useState(!1),{approve:D,onApprove:w}=HS({account:e,accountChainId:p.chainId,targetChainId:+t.chainId,tokenInfo:d,amount:g,wagmiHooks:a}),O=v.useCallback(async()=>{if(!I)try{$(!0),await w()}catch(Z){console.error("Approve failed:",Z)}finally{$(!1)}},[I,w]),k=v.useMemo(()=>+p.chainId!=+t.chainId,[p.chainId,t.chainId]),S=v.useCallback(async()=>{l&&l(h)},[l,h]);v.useEffect(()=>{k&&S()},[k,S]);const{showLayerZeroTip:B,layerZeroTipKey:j}=v.useMemo(()=>{const Z=+t.chainId==42161||+t.chainId==421614,J=(n==null?void 0:n.toUpperCase())==="USDT",ie=new Le(g||"0"),re=new Le("200000");let be=!1,Y;if(Z&&J&&g)if(ie.gte(re))be=!0,Y="deposit.layerZeroDepositTipGte200k";else{const fe=T;if(typeof fe=="string"&&fe.length>0){const Oe=new Le(fe);!Oe.isNaN()&&ie.gte(Oe)&&(be=!0,Y="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:be,layerZeroTipKey:Y}},[t.chainId,n,g,T]),U=v.useCallback(()=>US(+t.chainId,L||"0",n,r),[L,t==null?void 0:t.chainId,n,r]),_=v.useMemo(()=>r!=="spot"&&zS(+t.chainId,g,n),[r,t==null?void 0:t.chainId,g,n]),G=v.useMemo(()=>"deposit.maxDepositSplitTip",[]),Q=v.useMemo(()=>{const Z=Number((t==null?void 0:t.blockTime)??0),J=Number((t==null?void 0:t.txConfirm)??0);return!Number.isFinite(Z)||!Number.isFinite(J)?0:Z*J/60},[t==null?void 0:t.blockTime,t==null?void 0:t.txConfirm]),q=m&&x==="standard",W=q?20:Q,ee=v.useMemo(()=>{const Z=d==null?void 0:d.depositFeeRate;if(Z==null)return"";const J=String(Z).trim();return J?`${J}%`:""},[d==null?void 0:d.depositFeeRate]),ve=m&&x==="fast"&&!!ee,K=VS({isNetworkMismatch:k,depositAmount:g,approved:D,currentTokenBalance:L,selectedToken:n,showLayerZeroTip:B,minDeposit:d!=null&&d.minDepositSize?parseFloat(d.minDepositSize):10}),oe=Z=>{const J=Z.target.value,ie=U(),re=Pi(J,ie);if(re.isValid)N(re.formattedValue),re.errorType;else return re.errorType==="exceed_balance",void 0},se=v.useCallback(async()=>{Ti(!0);try{u&&u({amount:g,chainId:h,tokenAddress:(d==null?void 0:d.tokenAddress)||"",tokenSymbol:n,depositSpeed:x,accountType:r,accountId:o,key:s})}catch(Z){console.error("Deposit error:",Z),Ti(!1)}},[u,g,h,d==null?void 0:d.tokenAddress,x,r,o,s,n]);return A.jsxs(A.Fragment,{children:[M,m&&A.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 my-4",children:A.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[A.jsx("button",{type:"button",onClick:()=>P("fast"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),A.jsx("button",{type:"button",onClick:()=>P("standard"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),A.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[A.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:g,onChange:oe,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),A.jsx("button",{onClick:()=>{const Z=U();N(Z)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),A.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),A.jsxs("div",{className:"flex justify-between items-center",children:[A.jsx(En,{content:f("deposit.availableDesc"),children:A.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),A.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:RS(L||"0",g,n)})]})]}),!D&&FS(g||"0",0)&&A.jsxs("div",{className:"flex justify-center flex-col items-center",children:[A.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:f("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),A.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:f("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),A.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:O,disabled:I,children:I?A.jsx(ns,{size:"xs",inline:!0}):f("deposit.enableWithToken",{token:n})})]}),B&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(j||"deposit.layerZeroDepositTip")})]}),A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"})]}),_&&A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(G)})]}),_&&A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:!(_||B)&&A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:f("deposit.noPrivateKeyWalletWarning")})]}),A.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.arrivalTime")}),q?A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:W})}):A.jsx(En,{content:A.jsxs("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[A.jsx("p",{children:f("deposit.arrivaltimeTooltip1",{v:Q,v1:t==null?void 0:t.txConfirm})}),A.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:W})})})]}),ve&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("withdraw.feeRate")}),A.jsx(En,{content:f("deposit.feeRateTooltip"),placement:"top",children:A.jsx("span",{className:"text-sm text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:ee})})]}),A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.equity")}),A.jsx("span",{className:"text-sm text-text-primary font-medium",children:g?A.jsxs("span",{className:"flex items-center gap-1",children:[jt(i),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),jt((parseFloat(i)+parseFloat(g)).toString())," ",n]}):`${jt(i)} ${n}`})]})]}),A.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${K.disabled||c?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:se,disabled:K.disabled||c,children:[(c||k)&&A.jsx(ns,{size:"xs"}),K.text]})]})},Tm=e=>e.toLocaleUpperCase()===hn?hn:Us,rs=e=>Tm(e.wallet)===hn,Dl=e=>Tm(e.wallet)===Us,Ai=e=>e?e==="perp"?Re.PERPETUAL:e==="perp-v2"||e==="perp_v2"?Re.PERPETUALV2:e:"",Am="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBMSURBVHgBvVt7kBTHef/17N77fRwSiNeBBAGBpVNJERKyoqOSuByiVLAScOKqJKAYJU4F8XCVY8d/cLiSkKSS4pDtKJKRdFhxYoNskTKS4jixFguEICAdiDtAvJb3cRzcg7u9vX1M5/t6puexO7u3Byd+VDOzPT3dPd/39ffqPoFbhJSymS5NVJ6yr7V2YfRRidrlMJWIECKC28Bnv5dslqZskjCeEhA0nvSPJ0SU5hQ1IA/DQGTPqqIIbgMLvjzcbAjxoBRoFlLSeKJWqjEFDY0++p6oCRmFFO2Aufvo1rIIbgFiLI3pA/mD11BZC/fjC0WUSoTKRp58IS80vyZrEylzjTDlLYxHYwgZKUqHNka+Uth4TWtlbWowvkZArjWlqBEikz4SNsmkdZXqB7WDaVrfV1SEje3/WhZFgSiIATbhN8Ai/HigDXkYwYRPJkwaT47PeAJt+RjBhE8PDm+QEGvpW/VLkglMUFeuFja13HvBtHHu1SOp3nktHMa3CmHEqAygDlniWzB2iR8NUVhMaPNWPv5yeo0hZcv4j0cqSsiN7z8XbvPWLlgVXwMz3UJk9I4nLekWmqD6t9WTUEzw1vme8zNqc84wzI0ff6+yLe+s8j2kwTdj/KQ+F1rpA9fxzRMvpTePm9TnhGjd+2chNd78Z2ObiVZrbYJaT4Ur4TYhhbMoPM8z7h3dZD+RVhU1MURrx9bydTlnE1Rpq5w3qTTjDqB/BO2//f10H825GXcAMiXb+z8c6SPiNXuIK7XOt+oE/WbVI2wmKBpLr9632nrbeVWVh7RSthfL5OL2trq+zLmEc8zxXSpN8cEBlFZW49OEGR/A2rcqmiBxxzDQmWgiowlbcO2RpUfStd6XnnpNfOsdVk26NfVFxDcVE/z92CsIsimOMAv04sy5hDIrbLWzlO9f+OJnkDwVwcRygVD9NIhwCcYDTPTBfa/jo3//W/z1OzGcLnsYdwqxaBLJ3rS6l9Z/mpD21ZJk3d4yspZIewjrFW/nfVtdaXXkukxWXePEpm/W9rT/3c+88/GpIBpsBV1e4/uO997B97+5QtUvnGpg4bQQyh9ejvJHlqFk1uO4FcTP7MPQwR2Id/wXdh/vxc/Ll+Hk45txpzByLYXBUwm49HFhMUPYasiRcjw6NyTmTQ9hLpUpDRa5bsYkjp03ceB4Cv93Ig29iiz1IzNtgcMEezWsO9FW0+q0cCYgZSMs1cNXbN/0PA698yOnq+oSgWfmh+lKy6ZuGioeXoayR5YjXDcV+cDSfvO9rRjcs9W6HwHeoolfMqbi6G+8gXjlNNwJmCMS/R1xpONewrvCyuLrld4vfLZI/OXSYiK6kbffSz0mvrMzgTf3JLXb6qwatz/nN3fdNyLMmVHbHngZwJK/Qv/esGQ22AZ4wUxYOM3AvInupKrvmYaiHJYkkSIDe/mC8/tYt4k950yMpCROLmpF96zluBVMrhK4bwJQWWz9HiSh7hoETvbkNiQ3T41gpDul7r06Ah5isYROmWBg06oylnyMBcyIP/77GC5eM7M8J3jcVNt4t57YVqM8Ix09NNLlrG49PNiPliVzcg7WNNnArzVaE2TiV1UEtxuIEROStPTpuw9cTOPwFWX5MEJSf3DpfowFVcUCyz4DLF9goDKHKeq6CXx4ReK1gxJXBl0KsPT3HBzSXjy0+pH2b9t7B6ua764pH1Xqc4GZ8BdbhnD8vDLejoekepd+25IwZB2vAj3SBm9HZZU1qJuUWzW0EyHbPkxhgNRJMuX6xV6kTYv4rHLe7Eg5xGecf+CrGAuWLxDY8YcGnn04N/EZk6qAJXOo7Ze4rauKh84n7ElK+5+tr/mhJBeGChP9dojP4Hf/ZU0FpkxwAzW+Sm1grHtlW8IpgwNc6NGaMzub9dCivIMNkFT9x5Ekjl0jlZLMfp5KWSrnh0dS6In5OTRwV2FGnKX+208beH5RfsIHgZm16XOGUlMjfZbqMSU0BRQbTJc6eP0bFbdFfA3uY9Oqcrtf6bsSo4XFCF4Npgo4Q3ZWMyv67O26gE8OvJt3MJbyMzekYsCcu/yT/8UnJn55Nq3aeDFw9yJcnrcKheDlpSHMv9sfKw7Sitp5XOLf2iVeOiDxzicS/3tGKjswoUz4GDWjVmCyMPHT90YCl6ntXuKZJ0uoFGO8MJVsJHlKov2UYryt87zRmVJFpfUPfH03m89m3AbYMM8OkJxG+viPuwSpIP+H999dmPSz5FZm0OTVQxI7jppKrWXio8sSL7xvSb5X/XScTtr6QCpt73go/M+0wtbnnynFeGPF50vQ9rO4urd4bzqT0oyn/x9kBjwY1EEhEbDlmobUNRMNFLz9Hj37cUfax4Sh+vkoBCzRq3elSQWFFCO+8XNTEXk0vHqI2l0R2PSbhvKMfvBBUqkaSwyl4/loLJwbyqt6/uqlIew/lrTesvjlfOzC+8P4h+cqA9/jPtmT2n+MV4H2sixPSKtB+rGYGdAY1AEb4nyYUmPg6TkGSsJOBtCXrmUwY5gJuyhY6RmyKuMVuY0763wmtvZgrty0mMB1J6+P3l6DGbXyJ2nFxP4B046CYPufAto956pH54aRDx8cS7BrCX/+3yZiZ36BWDi3CB90JlVbw9BRsnQibrp7ICcD7pm9QK0CbyxQWiQw9y6Be8lXnlLhl/ogBjCYCV+iYS4RA05fN7E/BwOUwf0dQ3kyq39qEsFdJgRhcqXVnsHtM5mg30vF0q7Ho77fjbbI/8H9M/IzwJFWx4UUlPuR0h/xBmPKRJ2qtvJFbqCm7rnzOv6CwLw7u6GfW/k1NNYbaL4vhBWPhvH1Xw/jdxeEMK0q/9hmgGDwO/xuqjhYtTExdXDF97Mn5B5DE5+ZxYXvuS4I6ZQJ1wtxvFHnd1XFaHR00wzS9SOd3/kwpSEEK2nnJPWk9Y7lDdFNTV6/6/EnFxHhQ8QAgxhhTXSQXErTDPhQT13QvPidwVjwhDMNbj4meImvMRoT7FnZc/O4h1JitCysJqAmupVW0JnS0WEzzJNZdQRBZVSZAX25XjbP78uqS5E9unot6ZSe6ylVEil3Qqm0dOq9bUdIJ1eaA1l9aoPb5VE3QUwIIr5GEBNmk9BUl7HKMLUfDouY0OaY9Hsa+cDvmaZmmss33U8+DMTs5eYpWgB4FdBtX14GpI7syKqrrRGorXLF9XSsjKRfIiTcxSQovuO6IzddD6Ga3qmnBVeB/sCxtMHNxYQg4nNbb3svE5j4fF9V7joJbnGlufNcEgVAuhJsFqyCOqNJn+qzm0tbHkAki7IFakeAIZZ9FyG7O7I6ZUPLTAiFi/DPp6bg7ct1+Js5ZzBLxOFkV6jN8eFqbDxzL5bc04uv3ncJFWUGeQJp3JfsxNWSYEOsmcCupya0ZgIHYJnE57YMb3vNBKXWKChjI3uBknBCZCbhLFvVGU0hHxbOK4Klsz3a2u5o4bxRPKjOhMNoT2paOHvKJqKskzgKzkrKp49sR2LX+sCOudNYnKS5jIKiZAjRvmLMqRlBSbGdbEsIXIoVYWJFGlVFaQzFQigrNYkBEj8pfRYvVm5APkyu8hM1E5r42tPJ1/6Vt2P41rabTiDmfIN95Zq9327A1LvGlv0cDRe703hi9TXAE/x5DY7tNW5ktrYHdRCkfjS4r9ISi9hM4AUNw1ltZtUm1DNGcbFFfMa96U6MhiB1pJFJ/NHaT58cdlSFzgFJjzvE95vfGMR4o5X6tG2v7UVJrxOlYJiIGPaJtSw7cHMIuNHvLxevmjh1LqVKF3E4aa9eZogmMCPkESZuc7k75bzXcHEvKgIMcSaCiBpE/NHav3w8RFupwklHuEbQTkXQdXskhn0dCYwXLtL3/uhdysUr1WVaW2vuzpieQzT6xuSIVmxbMjspvjc7Z1NeaqgOkrT5k0pbTBq28zJFYQ8D7F75GbfhZcjvsCtaVhrCb/W9gkLgJWo+4o/Wvmp6GVy6+11KvRrWf7dXqY3bBfexvOWGuueATRtvNZrUDFGRSITr9IYMB2O93o5GaP+256VlWQOkyN283ptCVSXtEZdZlB6umoqNb0fV/oDGPy2difJBazcsNky2YjCNhvowrQ6BIaMaz878GIWCdTy7qkFJuELamzTn87+46iRytAoQvpMjQs5vDIlXvlZP9iCMWwEb+y//Y6/siCZFwLkiexVYgV26yJjV9cPJUcOaiGAV5FsFvPEuSrOj1jAt54qKEEm5QLp+DmKPrcfBCcvw36clPrjolhMz/kg94zY8m4oKQxGfwSpoSX9hq4DBUlwo8YPaGzTn6hkV/kgW7j37+VKmBREOv7+hR6mQseL9oyNYRu92RBPK39KpB+m4Qa4Kov+3MfH5zrsnzKvgLDypid7t6xE7tN03EDOFmTMw6QkMl04EGRHsOfARtrz6A1+7P/2DZ/D55kUqE1k6fBU1V/epVSXjlv7nVbB6xl51vRPgVXDhl90wkzpkzzg5Iv0nGr64uALrlldh2iirgaV+665BbH2LDbl7CiIYSvrPmcWhxVkMsGfhc0ljB7ejd8d6RXC2CXz1Hkm5cOIIus8ew9Bw3I4yXVRVVqqIo+6eWZj1wK869cyEkdP7kKDrmzfmYduE/C7peKL/3BBuHB9w4gAb3vBApxOdnP1j95fIRQtKxPyZxaguh2rC0TMT/v2jcTLeI94TENAqx3vEUfWo9ZBhrOj68dRtevAsblFDPrOi9ivN4QHVwijNLaV917pw4tB7iMf8rlxpeSV+5ZEnUdswKee7fEzlOx9VYvvHo8T044jrx/vRFx2y9qjc7K0vV09fLC0CSmQfUXfgDYQ9u15SCH+44R5XlGi9snO675yoyNHzuxjDThkTP5MBlTX1CBcVts23eldhmy3jhcv7exDvtdxOLbkW9AlnJ0wLUCnek9LSlnT3eGOOtvSfPHxl54yHMqaS93AuM6EJdwB9cUSeft2shfpLlE8fZsKMnP6fy7RpKvRuoC267uFcr+rQGzBe2GLuBLlutKvfsy5WUxEpRfoL0Z0zs+KtwHQ0e0VUmFtb8OljS12ZWLz3udBDtFY/9fF4jH2rixd3/2fjQxDmC4A3X595isHNnsE5xKv1u5S+WELdet+z+jSEuaVr5/TFQcRn5N0PICawUV4J648pxhs8oXX2GAp7/rxoLdnylfzHFBh/0HjmOh5DV1zdOXMt6X7r+7wuqvSnj634zQngpOW2qsyozu/LrHaUziQXcN0VGiPfpAQKgH1yroXKn2B8wJLeYscfWXjsRdkYMpItJB/jMh5Lfbgk3BJZGTzepKVnG4mmGyg1sUK19xxVtKNW4VcvfrWUqaIMIbeUGUZLLqn3zQ1jgIcRTyHHXnIe6GCvNRfhM+EyIkTjqbHHNJ4wifCl4dZchM8EMyKdxgZaFc1Ez0b4AgVtI6zUjtc7Us8M9BMbtpQbRmshhNcYEwO8sA90cWFD1mgX75+pcuFM626+3vafqb6YbCaF2Qw2nEI02sLgGY/sFmQ7xaC7hSna93zl9v5MteHpk80U9z9FdqKJyNtIdG8kdtRa+wqil3R3vwlB34WINFOHe3bNjuAW8P/4M203oLS1YgAAAABJRU5ErkJggg==",Nm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0WSURBVHgB1ZsNcFTVFYDPe7thd7NZsonIT6CwQWvAnwTaRNuxQoJ2SqpViW3RiiMgVq2dgcy0dnRqkwz9Ga0dNjOt2BYVi2hpVaSFBmyRRWBajUoIWIlYWERAhWE3xoT87O7rOfftDW/fu+9vEzrTb+bN7rvvvnd2z7n3nHN/ngR5kvh7US2AMkvKKHMBpFkgQRgUPAgJkvg9jtfjkj+yTy6cGgvVbI3BCFAUpRY/ZuExN/sZzh5EEo949tiHR0ySpBiMhG+ivAzQ/5qL/8UoT8rKU1CeDDF4IT95kpvKiY3hsFw0uFxRpBXDynZO3Ddlaaz/g3UtJfXJuJMbUOkkYzkeKwDcy8MjhkcLGiPu6I6bUZ48AnkSyiuAFvijQ3ng0ABM8YVDTYr6w0aEHJgG8piStcGrdpsqJqv4JhgFeVnWgpUhVMWPnjwJ5Tk0hK0Bul8JLFdAbs6jxdsR945vaCmavW6tthCVTy2wGWD05YFqhLU5pbegPOX8yYOXdPJ0WBqge1twlTJ6rVCIJ1AWDc051EjfUfmrwIG8gVQG9hw6DfHTvew8Mi4INeWlEPJ7wQFRNAKTBw3O5I2QKBqh0eyi0ADkcqTg0EZsGbXwP8AfaezwXbKSAmmtVT1SfOexbtj/YZJ910LKr5g4Fg1RAnac+RQ6LljKEoVaq3qzIviDLgeoiqjfw0G1PH4KozDafuc7GGQOAHTEwRoJOiANdfCylDReEpDcFtwLaqbhCsmLiVAq6fY2KPryP8ETusKyTtfJHmiPJ6Cnf4idH/l3J+zZvJF9r7luPlR84Sr2nQxRHSmFGZNCps+a/QNU2hFzWYvrAO7Eo/YycET8E/Q1f8JAs8OiEgXoF6U6Y7GOfN2O7J8GwZo2SJ15Dc6+c6/j+/wVj4Bv2v2m108kz0L7kQT7ZOeHD0H79q34+X5OvXGTJsP8O5ZBqKSUnZMhbpo92eCWGp9Cn7BFLIsUvmoJtrxyyAsyxJJfY694x7SKwR3lGCDxSnCxpMDT4BKufDkwlZ0PHn/WkRHGlC2CwOVPCK/19KdQ8Weg66Me9TxxBt7c3gYH33rD8pkVX7wSaq6tHzZExcTQcHygFkoKErH8BtTOEhgVmrE3tGwwvdyIRojyk2EDJNr8EUn2UCeKgAv0yufYGcHsPr2fH+g/C517YrB/90723SnV6JYqr64Fnz/AzicXj4Plvy9mrVRP07dRaQthVLEwQhIHeOU8Hnh46UN3+igjqAUXmCmRPXhsJV6fCqlTm4X3+mc8At7Sa3LKyM9v6TwJx870QTqjQNdbr8OWp5+AY+8dhHQqBW4gF/V+59vgCwTQPU2Bx/9WBAeO+gz1zofyCRY/JDVQ6/BjuR/ebdkGkO0B2dZ/BFxgpXwtop5A94bm5P6yTXtP2Pr5fPGPmwntvl8ayiPjMZivhvNK3U9MYkIGSqgXsAglezxNigKOMVO+kurGTKg4p2zM5EXsU2sE38UP5tShlk/KZ35+28twcN8+GE3eT39NWL6jBRxBKSdlTZR+EpEL1UDN01Irnv6+mnUle3UXZJboNDMDKC7yfTPlZ85+AL1v1oO35BpDYNUbwVsyJ+f6p9nUsuvt102VPzYUhBu/fh1UXFIOkydNgOMnP4aHV0Zh0cKbWJmW9Rv+AgffOzx83uurNDyPUk3qAVaQ0lo3q1mTQYHZZ5ALs3oOXVuBAb7ZGA/YiN+baGOzmhFwgJ3yM2ePwiAehJkRBk+ut3VbemZ8fjo8+fgvIBQ61+Ta1+xnhrhv2Xdyyjdt+YeqfB+WDfSi8q+AQY9RQ6Q4KyhY1zWBMGhzKKsi90I9ycoIy68XGiBMM64ydoVacEim/yikMc/PKdMonzN4Av3+AWMGlE7sZj3ELdFHf5yj5BMnP4HVa56De5fdllNOrF7zPGQq5kC6uoGdkwH0kPuwUhi1djvlc7ihkn3mdchVCQd1ON0tYxSuAhf0oRsZwsDK7hcon6M3An2nMk+oEtxALbxsUq62Hl65Cm66/jp2aCGjnPgsA5maBshUzgelbCacLZhueKbdCJfSRyfK51Dd1r9a16EpDQPo+mXMgyJWNzK3U93GPjlkhP7//NygfHI7voseGj7nRuDKV5/n3P1wF6OFXEzXocOGct4r0qh8JXQhK0vPuwcGC43D2rk2BlgbA9ewOGHRC2guyYAEVV4r/6/1+fTZ217P3BAxgAbQQsqnkS2HX+eKH35m4TRwCvl9LaqSn4fbMfDqe8Wj0d+h3y9k7odDhhj0jKWunkO40Fwm+XRRwLWD7nnmVXXiTkRC/Myw12yeXx9wRUbg6JXvz/YCvZEKsI4+TTVD5HpWr1nPBi6iXvHqzn+pv/PEu5BB18PJDBnnG638vxvXo2eF60kcCMumlyTn5QrGAidlTtc/zVzPpi3bDb2ip6dXDbzl1TgDdyHIu9fB/xPe7AK6oReQbycfz/w/tn6rgNufbenc/2t9vhYqoykIu15gpmQKuvpe8eyGTWrgvXYRZHpOg3fTT8Hz5ouYBd3CrssFiqEXWLkYu7GBFU0LzQM8nynVkSQXRJNCQjfEjRC47Ak2iNIqnxQ5GH982B1xI5ChtMovyLqmoWyZMpS0NIDY9TwndD3DgReDLQu8eKQr68HTuZXFAirzCAywL24+5cwXXvKJAzTgMosvMVGhBHF0QVIHWMCNYMh2pt6vxghNdkRG0Cu/EOvSwQ2R7tlvKqts4gShkqmVU84vDLyoZG3gzVD+PyYInld/y879xWmDHKsVLFI+KdItNCq2Cu47DwgKM3BUxnXYneACbcDlgVlrBA5XPocbIXVml+mzH1i2wFC29HsPwry5XzLk/Dzwput1y62YCaWwR0gYjIsP74LABcZZVIsFEwaNXN24IqprN7IWysSlShkU6x6QUx9dh34eR2QEvfKHy0u/gn66U/jsmkiJYfWKDaxwzueBFd/NKecxgf2mfVsNz6IBmIJBuS/2Bwj4PzNcp4m1mKhFZqFeYDe9wKE6dnXJ/wsNIENMLqn/LMYCsQNotlN1R7kZjtYIZsqnGNCHwTmV2MWeoyUUKIDq8tKcMu7fRTGBBV40DJPd9RpLPfWk6u4BamJFRzawQKznmRhYQgrd+1jWrwtmPamMgi7VsTMUrRcLiNNuuux6QFGzJCtN4BDaXMWzIy1kGNFEG1c+h7Ilv2bELOIudD1khLaNT+aUU9n8BUtzyijYpr71M3UCTvs70TgUCz6asRJO9cw2yNj7K5MRqg42HR0/N0bgcztOpqPpnvL7BBdo89aL0hJ1HOD3RsEF5wKzsSfo0SufGDz6G7CC/Hv72/vhhyvuNlxjgVeH1HMKU8+XDOUsE0J3VCW3gQhaoHcCVzgFWjpuvtKZ8gmzNWi2cw7ICyEldcmkokit4AIzI2gRKZ8gFzRgYgQ+3UBBl4KvFu2IV4+MqafeFY31pKHu9ruh4Y6FMK+q23AP+eVG96NXx5DrMQm+a/m2xXMjYZ+32Wks4FgZwUz5HJqm0McCgvz9oltvNKSj2sBrhkypJ64B+CQFrirug9smJWFmqQf/moz+WhG22uhmyx0MeUPKbxY/N85bPzG8KP/IM/39P7ptzIAkw3xwASmRFt4Lxn8DpAJ1gGWnfEZmAAcFA+Ad91XDpcrLZxjm+fe89wns7zoCp08eN32kNNgHM6d/Dm6sCMK0wBB4JXVbyvVVZXDR+AD4CwC2CXI+aqUUDIVTxnlgoXyiEf58biu7YXomsbUoKklsg6wreGBOJ16zV74Gu41ZBG1PeWqXumeA1o13vLAejusW7CdPvxiqr62HMvwkysIBtk2RPrWQy4mKN2o4SimtsN2YpUArbJRyNr2Jtya+EtyRz75QMoJorsgOMpx+i4oe2qBFO+T41sSut96A9u1qcL36hgYov1Rd+aKxxLyZ4w2K12K6UyGLk7VeLTSuaN1iuzWxA7Oe2cZiAYkd4bA0NLQj+2bIeWfMhAWxQNU6mo+yldf5YRI6j306bAgO+fnKzxXDFVPC7LsVp7ohNv4u9kaPpTyaL6LshxZwaJqBG4SnpTSnxAZ1NiNrti80DQscb87l5OuO3CD5p7QWz+1i3RKnRSgdtpXHty3y7enk52kgZ6f4LK2SlHUDC1CeBOf1/4ncjhbbKfpEW3CxpL49EoFRRCooSRZMvLWl8NLHcsYgaITFAKMvD9T3yOgFjdwxT8P5lafdByrC2StKbf4IyJ5mrHwnjBDawg5yUWsm+XFzyYKkMO1FI0RAfUtmxPKy0BinGZUvTrNvRnkSUBo+OvKo1dNbNy9Ltmm900UqhsYQ9KZixM29UkE4mRnoboV+b9RM8Xo0hnAtD9QWSIqPmipezzlD5C8vA1Eniue4MoAWtqFLhlp0T1Vo7Qhb3M99TTUp+yZ0pPs/3um94JqOUXpNlQ7aRhPJHtrXVOmgLJ+m1ztG6TXVWtq5wGQpAnmU2SgoT8bPPF9T/S+t/b7McgGVIAAAAABJRU5ErkJggg==",Cm=({isOpen:e,isLoading:t=!1,onClose:n,accountChains:r,defaultChainId:o,defaultSymbol:s,defaultAccountType:i,balances:c,wagmiHooks:a,onDeposit:l,onCopy:u,onChainChange:f,onTokenChange:p})=>{const{t:d}=Nt(),h=v.useMemo(()=>r.map(K=>({...K,key:Ai(K.key)})),[r]),m=v.useMemo(()=>Ai(i),[i]),g=v.useMemo(()=>h.some(K=>K.key===Re.PERPETUALV2),[h]),N=v.useMemo(()=>{var oe;if(!h||h.length===0)return m;const K=h.find(se=>se.key===m);return(K==null?void 0:K.key)||((oe=h[0])==null?void 0:oe.key)||m},[h,m]),[x,P]=v.useState(N),C=v.useCallback(K=>{var oe;return((oe=h.find(se=>se.key===K))==null?void 0:oe.chains)||[]},[h]),M=C(N),L=()=>{var re;if(!M||M.length===0)return{chainId:o||1,token:""};const K=o||((re=M[0])==null?void 0:re.chainId),oe=M.find(be=>be.chainId===K)||M[0],se=(oe==null?void 0:oe.tokenList)||[],Z=(s||"").toUpperCase();if(Z&&se.length>0){const be=se.find(Y=>(Y.token||Y.symbol||"").toUpperCase()===Z);if(be)return{chainId:oe.chainId,token:be.token||be.symbol||""}}if(Z)for(const be of M){const fe=((be==null?void 0:be.tokenList)||[]).find(ge=>(ge.token||ge.symbol||"").toUpperCase()===Z);if(fe)return{chainId:be.chainId,token:fe.token||fe.symbol||""}}const J=se.length>0?oe:M.find(be=>(be.tokenList||[]).length>0)||oe,ie=((J==null?void 0:J.tokenList)||[])[0];return{chainId:(J==null?void 0:J.chainId)||oe.chainId||1,token:(ie==null?void 0:ie.token)||(ie==null?void 0:ie.symbol)||""}},[{chainId:F,token:b}]=v.useState(()=>L()),[y,E]=v.useState(F),T=v.useMemo(()=>h.find(K=>K.key===x)||h[0],[h,x]),I=v.useMemo(()=>(T==null?void 0:T.chains)||[],[T]),$=v.useMemo(()=>{var J,ie;if(!T||!Dl(T.account)||!(x===Re.SPOT||x===Re.PERPETUALV2))return!1;const se=!!((J=T.walletOptions)!=null&&J.evm),Z=!!((ie=T.walletOptions)!=null&&ie.mpc);return se&&Z},[T,x]),D=v.useCallback(()=>{var K,oe;return(K=T==null?void 0:T.walletOptions)!=null&&K.evm?"evm":(oe=T==null?void 0:T.walletOptions)!=null&&oe.mpc||T!=null&&T.account&&rs(T.account)?"mpc":"evm"},[T]),[w,O]=v.useState(()=>$?null:D());v.useEffect(()=>{O($?null:D())},[x,$,D]);const k=v.useMemo(()=>{if(!T)return;if(!$)return T.account;if(!w)return;const K=T.walletOptions;return w==="mpc"?(K==null?void 0:K.mpc)||T.account:(K==null?void 0:K.evm)||T.account},[T,w,$]),S=v.useMemo(()=>k&&rs(k)?hn:Us,[k]),B=I.find(K=>K.chainId===y)||I[0],[j,U]=v.useState(b),_=v.useCallback(K=>{E(K),f==null||f(K)},[f]),G=v.useCallback(K=>{U(K),p==null||p(K)},[p]),Q=v.useMemo(()=>{const K=(j||"").toLowerCase();if(!K)return"0";const oe=(c==null?void 0:c[x])||(x===Re.PERPETUAL?c==null?void 0:c.perp:void 0),se=oe==null?void 0:oe[K];return typeof se=="string"&&se.length>0?se:"0"},[c,x,j]),[q,W]=v.useState(!1),ee=K=>{K.target===K.currentTarget?W(!0):W(!1)},ve=K=>{q&&K.target===K.currentTarget&&n(),W(!1)};return e?qe.createPortal(A.jsx("div",{className:"edgex-components",children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:A.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:ee,onMouseUp:ve,"aria-hidden":"true",children:A.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-2 border-solid border-line-divider-secondary",onClick:K=>{K.stopPropagation()},children:[A.jsxs("div",{className:"flex items-center justify-between mb-4",children:[A.jsx("h2",{className:"text-lg font-semibold text-white",children:d("deposit.title")}),A.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:A.jsx(x0,{className:"h-4 w-4"})})]}),A.jsx(Dh,{selectedAccount:x,options:h.map(K=>({value:K.key,label:K.key===Re.SPOT?d("account.spot"):K.key===Re.PERPETUAL?d(g?"account.perpetual-v1":"account.perp"):K.key===Re.PERPETUALV2?d("account.perpetual-v2"):K.key})),onAccountChange:K=>{var fe,ge;const oe=K||x;P(oe);const se=C(oe);if(!se||se.length===0)return;const Z=se.find(Oe=>Oe.chainId===y),J=Z?Z.chainId:se[0].chainId;E(J),f==null||f(J);const ie=se.find(Oe=>Oe.chainId===J),re=(ie==null?void 0:ie.tokenList)||[],Y=re.some(Oe=>(Oe.symbol||Oe.token)===j)?j:((fe=re[0])==null?void 0:fe.symbol)||((ge=re[0])==null?void 0:ge.token)||"";Y&&(U(Y),p==null||p(Y))},className:"w-full"}),A.jsx(Mh,{currentActiveChain:B,chainList:I,onChainChange:_,curSelectToken:j,onTokenChange:G,walletType:S,accountType:x}),$&&!w&&A.jsxs("div",{className:"mb-4",children:[A.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),A.jsx("button",{type:"button",onClick:()=>O("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:d("deposit.connectedWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Am,className:"w-12 h-5"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:d("deposit.connectedWalletDesc")})]})}),A.jsxs("div",{className:"flex items-center my-2",children:[A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),A.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:d("deposit.or")}),A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),A.jsx("button",{type:"button",onClick:()=>O("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:d("deposit.externalWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Nm,className:"w-12 h-5"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:d("deposit.externalWalletDesc")})]})})]}),(!$||w)&&A.jsxs(A.Fragment,{children:[k&&rs(k)&&A.jsx(LS,{address:k.smartWalletAddress,currentActiveChain:B,selectedToken:j,accountType:x,accountId:k.accountId,accountKey:T==null?void 0:T.key,onDeposit:l,onCopy:u,onClose:n}),k&&Dl(k)&&A.jsx(KS,{address:k.ethAddress,currentActiveChain:B,selectedToken:j,accountType:x,accountId:k.accountId,accountKey:T==null?void 0:T.key,platformBalance:Q,isLoading:t,wagmiHooks:a,onChainChange:_,onDeposit:l,onClose:n})]})]})})})}),document.body):null},ZS=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:l,onReceiverAddressChange:u,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=Nt(),h=v.useMemo(()=>{if(a==="spot"||!xn(r==null?void 0:r.chainId)){const L=new Le(e||"0").minus(s||"0");if(L.isNegative()||L.isZero())return"0";const F=Math.min(L.decimalPlaces()??0,18);return L.decimalPlaces(F,Le.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a]),m=v.useMemo(()=>o||"0",[o]),g=v.useMemo(()=>{const L=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Le(L||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]),N=v.useMemo(()=>g==="0",[g]),x=v.useMemo(()=>{const L=(t||"").toUpperCase();return L==="USDT"||L==="USDC"},[t]),P=L=>{const F=L.target.value,y=Pi(F,m||"0");if(y.isValid)l(y.formattedValue),y.errorType;else return y.errorType==="exceed_balance",void 0;f==null||f(y.formattedValue)},C=()=>{const L=m||"0",b=Pi(L,L).formattedValue;l(b),f==null||f(b)},M=()=>{const L=parseFloat(o||"0"),F=parseFloat(e||"0");if(F>0){const b=L-F,y=jt(Math.max(0,b).toString());return A.jsxs("span",{className:"flex items-center gap-1",children:[jt(o||"0"),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),y," ",t]})}return`${jt(o||"0")} ${t}`};return A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[A.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:P,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),A.jsx("button",{onClick:C,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),A.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),A.jsxs("div",{className:"flex justify-between items-center",children:[A.jsx(En,{content:d("withdraw.availableDesc"),children:A.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),A.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:M()})]})]}),i==="mpc"&&(a==="spot"||!xn(r==null?void 0:r.chainId))?A.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:A.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:L=>u==null?void 0:u(L.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"})}):null,A.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:xn(r==null?void 0:r.chainId)?A.jsxs(A.Fragment,{children:[A.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),A.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:d("withdraw.commonWithdraw")})]}):A.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),A.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[A.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[A.jsx(En,{content:A.jsxs("div",{children:[A.jsx("div",{children:d("withdraw.speedNote")}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:Rt.FAST,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:Rt.Medium,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:Rt.SLOW,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:A.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),A.jsx("div",{className:"flex items-center",children:A.jsx(Jo,{selectedLevel:xn(r==null?void 0:r.chainId)?Rt.SLOW:Rt.FAST,maxLevel:3})})]}),(a==="spot"||!xn(r==null?void 0:r.chainId))&&A.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[N||!x?A.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:N?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):A.jsx(En,{className:"w-[320px] font-normal flex items-center justify-center",content:A.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:A.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${d("withdraw.fee")}/${d("withdraw.feeRate")}`})}),A.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!N&&` / ${g}%`]})]}),A.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[A.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(xn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),A.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[jt(h)," ",t]})]})]})]})};let ot=null;const Bl={accountChains:[],defaultAccountType:""},Om=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(Bl),a=v.useCallback(h=>{c(h||Bl),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(ot={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{ot=null}),[a,u,l,f,p,d]),n?A.jsx(Dm,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},accountChains:i.accountChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});Om.displayName="WithdrawManager";const Im=e=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.openWithdraw(e||Bl)},$m=()=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.closeWithdraw()},km=e=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.updateWithdrawOptions(e)},Ni=e=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.setWithdrawLoading(e)},YS=()=>ot?ot.isOpen():!1,Mm=()=>ot?ot.isLoading():!1,XS=()=>({openWithdraw:Im,closeWithdraw:$m,updateWithdrawOptions:km,setWithdrawLoading:Ni,isOpen:YS,isLoading:Mm}),JS=({accountChains:e,defaultChainId:t,defaultSymbol:n,defaultAmount:r="",defaultAccountType:o,currentEquity:s,platformBalance:i="0",balances:c,fee:a="0.00",isLoading:l=!1,onWithdraw:u,onClose:f,onChainChange:p,onTokenChange:d,onAmountChanged:h,onAccountChange:m})=>{var be;const{t:g}=Nt(),N=v.useMemo(()=>e.map(Y=>({...Y,key:Ai(Y.key)})),[e]),x=v.useMemo(()=>Ai(o),[o]),P=v.useMemo(()=>N.some(Y=>Y.key===Re.PERPETUALV2),[N]),C=v.useMemo(()=>{var fe;if(!N||N.length===0)return x;const Y=N.find(ge=>ge.key===x);return(Y==null?void 0:Y.key)||((fe=N[0])==null?void 0:fe.key)||x},[N,x]),[M,L]=v.useState(C),F=v.useCallback(Y=>{var fe;return((fe=N.find(ge=>ge.key===Y))==null?void 0:fe.chains)||[]},[N]),b=v.useMemo(()=>N.find(Y=>Y.key===M)||N[0],[N,M]),y=v.useMemo(()=>(b==null?void 0:b.chains)||[],[b]),E=v.useMemo(()=>{var en,Ne;if(!b||!Dl(b.account)||!(M===Re.SPOT||M===Re.PERPETUALV2))return!1;const ge=!!((en=b.walletOptions)!=null&&en.evm),Oe=!!((Ne=b.walletOptions)!=null&&Ne.mpc);return ge&&Oe},[b,M]),T=v.useCallback(()=>{var Y,fe;return(Y=b==null?void 0:b.walletOptions)!=null&&Y.evm?"evm":(fe=b==null?void 0:b.walletOptions)!=null&&fe.mpc||b!=null&&b.account&&rs(b.account)?"mpc":"evm"},[b]),[I,$]=v.useState(()=>E?null:T());v.useEffect(()=>{$(E?null:T())},[M,E,T]);const D=v.useMemo(()=>{if(!b)return;if(!E)return b.account;if(!I)return;const Y=b.walletOptions;return I==="mpc"?(Y==null?void 0:Y.mpc)||b.account:(Y==null?void 0:Y.evm)||b.account},[b,E,I]),w=v.useMemo(()=>D&&rs(D)?"mpc":"evm",[D]),O=w==="mpc"?hn:Us,k=v.useMemo(()=>{if(!y||y.length===0)return{chainId:1,tokenSymbol:""};const Y=Ne=>{const je=Ne||[];if(!je.length)return"";const He="USDC".toUpperCase(),zn=je.find(Ut=>(Ut.token||Ut.symbol||"").toUpperCase()===He)||je[0];return zn.token||zn.symbol||""};if(n){const Ne=n==null?void 0:n.toUpperCase();for(const je of y){const lr=je.tokenList||[];let He;if(Ne&&(He=lr.find(zt=>(zt.token||zt.symbol||"").toUpperCase()===Ne)),He){const zt=He.token||He.symbol||n||"";return{chainId:je.chainId,tokenSymbol:zt}}}}if(t){const Ne=y.find(He=>He.chainId===t)||y[0],je=Ne.tokenList||[],lr=Y(je);return{chainId:Ne.chainId,tokenSymbol:lr}}const fe="USDC",ge=Ne=>Array.isArray(Ne.tokenList)&&Ne.tokenList.some(je=>(je.token||je.symbol||"").toUpperCase()===fe),Oe=y.find(ge)||y[0];if(!Oe)return{chainId:1,tokenSymbol:""};const en=Y(Oe.tokenList);return{chainId:Oe.chainId,tokenSymbol:en}},[y,t,n]),[S,B]=v.useState(()=>k.chainId),[j,U]=v.useState(()=>k.tokenSymbol),[_,G]=v.useState(r),[Q,q]=v.useState(""),W=v.useCallback(Y=>{B(Y),p==null||p(Y)},[p]),ee=v.useCallback(Y=>{U(Y),d==null||d(Y)},[d]),ve=v.useRef(!0),K=v.useRef(j),oe=v.useRef(S);v.useEffect(()=>{if(ve.current){ve.current=!1,K.current=j,oe.current=S;return}(K.current!==j||oe.current!==S)&&(G(""),K.current=j,oe.current=S)},[j,S]);const se=y&&y.length>0?y.find(Y=>Y.chainId===S)||y[0]:null,Z=(be=se==null?void 0:se.tokenList)==null?void 0:be.find(Y=>Y.token===j),J=v.useMemo(()=>{const Y=new Le(_||"0"),fe=new Le(a||"0"),ge=xn(S);return Z!=null&&Z.minWithdrawSize&&Y.lt(Z.minWithdrawSize)?{text:g("withdraw.minWithdrawParsed",{amount:Z.minWithdrawSize,token:Z.symbol||Z.token}),disabled:!0}:!_||Y.isZero()||!ge&&Y.isLessThan(fe)?{text:g("withdraw.confirmWithdraw"),disabled:!0}:w==="mpc"&&(!ge||M==="spot")&&!Q.trim()?{text:g("withdraw.invalidReceiverAddress"),disabled:!0}:{text:g("withdraw.confirmWithdraw"),disabled:!1}},[g,S,_,w,Q,a,M,Z]),ie=v.useMemo(()=>{const Y=(j||"").toLowerCase();if(!Y)return i||"0";const fe=(c==null?void 0:c[M])||(M===Re.PERPETUAL?c==null?void 0:c.perp:void 0),ge=fe==null?void 0:fe[Y];return typeof ge=="string"&&ge.length>0?ge:i||"0"},[c,M,j,i]),re=v.useCallback(async()=>{Ni(!0);try{if(u){const fe={amount:new Le(_||"0").toString(),chainId:S,tokenAddress:(Z==null?void 0:Z.tokenAddress)||"",coinId:(Z==null?void 0:Z.coinId)||"",tokenSymbol:j,accountType:M,selectedToken:Z};w==="mpc"&&(!xn(S)||M==="spot")&&(fe.receiverAddress=Q),u(fe)}}catch{Ni(!1)}},[u,M,Z,_,S,j,w,Q]);return!y||y.length===0?A.jsx("div",{className:"text-center py-8",children:A.jsx("p",{className:"text-gray-400",children:"No chains available"})}):se?A.jsxs(A.Fragment,{children:[A.jsx(Dh,{selectedAccount:M,options:N.map(Y=>({value:Y.key,label:Y.key===Re.SPOT?g("account.spot"):Y.key===Re.PERPETUAL?g(P?"account.perpetual-v1":"account.perp"):Y.key===Re.PERPETUALV2?g("account.perpetual-v2"):Y.key})),onAccountChange:Y=>{var zt,zn;const fe=Y||M;L(fe),m==null||m(fe);const ge=F(fe);if(!ge||ge.length===0)return;const Oe=ge.find(Ut=>Ut.chainId===S),en=Oe?Oe.chainId:ge[0].chainId;B(en),p==null||p(en);const Ne=ge.find(Ut=>Ut.chainId===en),je=(Ne==null?void 0:Ne.tokenList)||[],He=je.some(Ut=>(Ut.symbol||Ut.token)===j)?j:((zt=je[0])==null?void 0:zt.symbol)||((zn=je[0])==null?void 0:zn.token)||"";He&&(U(He),d==null||d(He))},className:"w-full"}),A.jsx(Mh,{currentActiveChain:se,chainList:y,onChainChange:W,curSelectToken:j,onTokenChange:ee,walletType:O,txType:"withdraw"}),E&&!I&&A.jsxs("div",{className:"mb-4",children:[A.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),A.jsx("button",{type:"button",onClick:()=>$("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:g("withdraw.connectedWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Am,className:"w-12 h-5",alt:"EVM"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:g("withdraw.connectedWalletDesc")})]})}),A.jsxs("div",{className:"flex items-center my-2",children:[A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),A.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:g("deposit.or")}),A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),A.jsx("button",{type:"button",onClick:()=>$("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:g("withdraw.externalWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Nm,className:"w-12 h-5",alt:"MPC"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:g("withdraw.externalWalletDesc")})]})})]}),(!E||I)&&A.jsxs(A.Fragment,{children:[A.jsx(ZS,{withdrawAmount:_,curSelectToken:j,tokenInfo:Z,curSelectTokenData:{balance:Z==null?void 0:Z.balance,allowance:Z==null?void 0:Z.allowance},currentActiveChain:se,currentEquity:s||0,decimals:(Z==null?void 0:Z.decimals)||6,platformBalance:ie,fee:a,walletType:w,accountType:M,receiverAddress:Q,onWithdrawAmountChange:G,onReceiverAddressChange:q,onAmountChanged:h}),A.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${J.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:re,disabled:J.disabled||l,children:[l&&A.jsx(ns,{size:"xs"}),J.text]})]})]}):A.jsx("div",{className:"text-center py-8",children:A.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Dm=({isOpen:e,isLoading:t=!1,defaultAccountType:n,onClose:r,config:o,accountChains:s,defaultChainId:i,defaultSymbol:c,defaultAmount:a="",currentEquity:l=5e3,platformBalance:u="0",balances:f,fee:p,wagmiHooks:d,onWithdraw:h,onChainChange:m,onTokenChange:g,onAmountChanged:N,onAccountChange:x})=>{const{t:P}=Nt(),[C,M]=v.useState(!1),L=b=>{b.target===b.currentTarget?M(!0):M(!1)},F=b=>{C&&b.target===b.currentTarget&&r(),M(!1)};return e?qe.createPortal(A.jsx("div",{className:"edgex-components",children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:A.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:L,onMouseUp:F,"aria-hidden":"true",children:A.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:b=>{b.stopPropagation()},children:[A.jsxs("div",{className:"flex items-center justify-between mb-4",children:[A.jsx("h2",{className:"text-lg font-semibold text-white",children:P("withdraw.withdraw")}),A.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:A.jsx(x0,{className:"h-4 w-4"})})]}),A.jsx(JS,{accountChains:s,defaultChainId:i,defaultSymbol:c,defaultAmount:a,defaultAccountType:n,currentEquity:l,platformBalance:u,balances:f,fee:p,isLoading:t,wagmiHooks:d,onWithdraw:h,onClose:r,onChainChange:m,onTokenChange:g,onAmountChanged:N,onAccountChange:x})]})})})}),document.body):null};le.ChromeLoader=ns,le.ComponentProvider=ib,le.DEFAULT_LOCALE=ss,le.Deposit=Cm,le.DepositManager=wm,le.LOCALE_NAMES=rb,le.LoadingSpinner=ns,le.SUPPORTED_LOCALES=Oi,le.Tooltip=En,le.Withdraw=Dm,le.WithdrawManager=Om,le.closeDeposit=Em,le.closeWithdraw=$m,le.formatThousands=cb,le.isDepositLoading=Pm,le.isWithdrawLoading=Mm,le.openDeposit=xm,le.openWithdraw=Im,le.setDepositLoading=Ti,le.setWithdrawLoading=Ni,le.updateDepositOptions=Sm,le.updateWithdrawOptions=km,le.useComponentConfig=ql,le.useDeposit=T5,le.useDepositManager=WS,le.useTranslation=Nt,le.useWithdraw=A5,le.useWithdrawManager=XS,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
|
|
185
|
+
`,children:[t,o&&A.jsx(vm,{ref:f,placement:h.placement||n})]})})})]})},ts="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=",Dc="DEPOSIT_MODE_FAST",wm="DEPOSIT_MODE_UNKNOWN",RS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,accountId:o,accountKey:s,onDeposit:i,onCopy:l,getUserBizConfig:a,saveUserBizConfig:c,onClose:u})=>{const{t:f}=Ct(),p=r===O5,d=!p,h=(t||"").toUpperCase(),m=y.useMemo(()=>{const M=Number(e==null?void 0:e.chainId),j=String((e==null?void 0:e.chain)||"").trim().toUpperCase();return M===33431||M===3343||j==="EDGE"},[e==null?void 0:e.chainId,e==null?void 0:e.chain]),g=y.useMemo(()=>{const M=Number((e==null?void 0:e.cctpResolvedMaxFee)??0);return Number.isFinite(M)?h==="USDC"&&!m&&M!==0:!1},[h,m,e==null?void 0:e.cctpResolvedMaxFee]),N=!(r===I5&&h==="USDC"),x=y.useMemo(()=>{if(!e)return!1;const M=Number(e.chainId);return!Number.isNaN(M)&&(M===42161||M===421614)},[e]),P=p,C=y.useMemo(()=>{var M;return(M=e==null?void 0:e.tokenList)==null?void 0:M.find(j=>j.token===t||j.symbol===t)},[e,t]),D=y.useMemo(()=>{const M=(t||"").toUpperCase();if(!P&&M==="USDC")return f("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const _=f(P?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return P&&(!x||M==="USDC")?String(_).split(`
|
|
186
|
+
`)[0]:_},[f,t,e==null?void 0:e.chain,P,x]),F=(C==null?void 0:C.minDepositSize)||"10",L=y.useMemo(()=>{const M=C==null?void 0:C.depositFeeRate;if(M==null)return"";const j=String(M).trim();return j?`${j}%`:""},[C==null?void 0:C.depositFeeRate]),[b,v]=y.useState("fast"),[E,$]=y.useState(""),[I,T]=y.useState(!1),B=y.useRef(!1),w=y.useMemo(()=>{const M=Number((e==null?void 0:e.blockTime)??0),j=Number((e==null?void 0:e.txConfirm)??0);return!Number.isFinite(M)||!Number.isFinite(j)?0:M*j/60},[e==null?void 0:e.blockTime,e==null?void 0:e.txConfirm]),k=g&&I&&b==="standard"?20:w;y.useEffect(()=>{if(B.current)return;B.current=!0;let M=!1;return T(!1),a?((async()=>{try{const z=await a();if(M)return;const _=z==null?void 0:z.depositMode;if(!(_===Dc||_===wm)){T(!1);return}v(_===Dc?"fast":"standard"),$((z==null?void 0:z.destinationPreference)||""),T(!0)}catch(z){console.error("[MPCDeposit] getUserBizConfig failed:",z),T(!1)}})(),()=>{M=!0}):()=>{M=!0}},[a]);const S=y.useCallback(async M=>{if(v(M),!c)return;const j=E||r||"";try{await c({depositMode:M==="fast"?Dc:wm,destinationPreference:j})}catch(z){console.error("[MPCDeposit] saveUserBizConfig failed:",z)}},[c,E,r]);return A.jsxs(A.Fragment,{children:[g&&I&&A.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 mt-4 mb-3",children:A.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[A.jsx("button",{type:"button",onClick:()=>{S("fast")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${b==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),A.jsx("button",{type:"button",onClick:()=>{S("standard")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${b==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),A.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&A.jsx("div",{className:"bg-white rounded-lg",children:A.jsx(em,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&A.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[A.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),A.jsx(W3,{onCopy:()=>{l&&l(n)},text:n,children:A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[A.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),A.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")]}),A.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[A.jsxs("div",{className:"flex items-start",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1",children:A.jsx("p",{className:"text-xs text-functional-orange-1",children:D})})]}),d&&A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),A.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:f("deposit.addressUpdatedNotice")})]})]}),A.jsxs("div",{className:"text-sm",children:[N&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[A.jsx("span",{className:"text-text-tertiary",children:f("deposit.arrivalTime")}),A.jsx(En,{content:A.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:A.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})}),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed",children:f("deposit.arrivalEstimated",{v:k})})})]}),L&&A.jsxs("div",{className:`flex justify-between items-center h-[18px] ${N?"mt-1":"mt-4"}`,children:[A.jsx("span",{className:"text-text-tertiary",children:f("withdraw.feeRate")}),A.jsx(En,{content:f("deposit.feeRateTooltip"),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:L})})]}),A.jsxs("div",{className:`flex justify-between items-center h-[18px] ${N||L?"mt-1":"mt-4"}`,children:[A.jsx("span",{className:"text-text-tertiary",children:f("deposit.minDeposit")}),A.jsxs("span",{className:"text-text-primary font-medium text-right",children:[F," ",t]})]}),d&&h!=="USDC"&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[A.jsx("span",{className:"text-text-tertiary",children:f("deposit.maxDeposit")}),A.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),A.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:()=>{i&&i({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t,depositSpeed:b,accountType:r,accountId:o,key:s}),u()},children:f("deposit.title")})]})},ns=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return A.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},jS=(e,t)=>Number(e)>Number(t),zt=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"},Pi=(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 Pi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:zt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},zS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=zt(Math.max(0,s).toString());return A.jsxs("span",{className:"flex items-center gap-1",children:[zt(e),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${zt(e)} ${n}`},US=(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)},_S=(e,t,n)=>{if(!Mh(e,n))return!1;try{const r=new Le(t||"0"),o=new Le("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},WS=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&Mh(e,n))try{const i=new Le(o),l=new Le("200000");i.gt(l)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Le(o||"0");return i.isNaN()?o:i.decimalPlaces(6,Le.ROUND_DOWN).toString()}catch{return o}},xm={accountChains:[],defaultChainId:1,defaultAccountType:"",balances:{}};let ot=null;const Em=y.forwardRef((e,t)=>{const[n,r]=y.useState(!1),[o,s]=y.useState(!1),[i,l]=y.useState(xm),a=y.useCallback(h=>{l(h),r(!0)},[]),c=y.useCallback(h=>{l(m=>({...m,...h}))},[]),u=y.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=y.useCallback(h=>{s(h)},[]),p=y.useCallback(()=>n,[n]),d=y.useCallback(()=>o,[o]);return y.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,c,f,p,d]),y.useEffect(()=>(ot={openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:f,isOpen:p,isLoading:d},()=>{ot=null}),[a,u,c,f,p,d]),n?A.jsx(Im,{isOpen:n,isLoading:o,onClose:u,accountChains:i.accountChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,getUserBizConfig:i.getUserBizConfig,saveUserBizConfig:i.saveUserBizConfig,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});Em.displayName="DepositManager";const Sm=e=>{if(!ot){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}ot.openDeposit(e||xm)},Pm=()=>{if(!ot){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}ot.closeDeposit()},Tm=e=>{ot&&ot.updateDepositOptions(e)},Ti=e=>{if(!ot){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}ot.setDepositLoading(e)},VS=()=>ot?ot.isOpen():!1,Am=()=>ot?ot.isLoading():!1,HS=()=>({openDeposit:Sm,closeDeposit:Pm,updateDepositOptions:Tm,setDepositLoading:Ti,isOpen:VS,isLoading:Am}),GS=e=>{const{t}=Ct(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:l,minDeposit:a=10}=e;return y.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const c=parseFloat(r||"0"),u=a,f=US(r,s||"0",o);return!r||c===0||!o?{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:c<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,l,a,t])};function qS(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:l,usePublicClient:a,useSwitchChain:c}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=(o==null?void 0:o.approveSpender)||(o==null?void 0:o.contractAddress),d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=c(),{writeContractAsync:m}=l(),g=a(),N=i({address:u,abi:Or,functionName:"allowance",args:[Nn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),x=N!=null&&N.isSuccess?N.data:void 0,P=y.useMemo(()=>{if(d)return!0;if(!N.isSuccess||x===void 0||x===0n)return!1;try{const D=F6(String(Number(s||"0")||0),Number(f));return x>=D}catch{return!1}},[d,N.isSuccess,x,s,f]),C=y.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!g||!u||!p)return;const F=Nn(u),L=Nn(p);if((x||0n)>0n){const E=await m({abi:Or,address:F,functionName:"approve",args:[L,0n]});await g.waitForTransactionReceipt({hash:E})}const v=await m({abi:Or,address:F,functionName:"approve",args:[L,hf]});await g.waitForTransactionReceipt({hash:v}),N!=null&&N.refetch&&await N.refetch()}catch(D){console.error("[useApprove] onApprove failed:",D)}},[r,n,u,p,x,N,m,g,h]);return{approve:P,onApprove:C}}const KS=({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 y.useEffect(()=>{o(Nn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},ZS=({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=y.useMemo(()=>{const P="0x0000000000000000000000000000000000000000",C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(D=>{const F=D.tokenAddress;if(!F)return!1;const L=F.toLowerCase();return!(F===P||L===C)})},[r]),[l,a]=y.useState({}),c=y.useCallback((P,C)=>{a(D=>({...D,[P]:C}))},[]),u=(x=o==null?void 0:o.useBalance)==null?void 0:x.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=y.useState(0),d=y.useMemo(()=>i.map(P=>y.createElement(KS,{key:`${P.tokenAddress}-${f}`,token:P,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:c})),[i,e,s,n,o,c,f]),h=y.useMemo(()=>{const P=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},C=i.map(F=>{const L=l[Nn(F.tokenAddress)],b=L==null?void 0:L.balance,v=b==null?void 0:b.data;return{address:Nn(F.tokenAddress),value:(v==null?void 0:v.value)||BigInt(0),formatted:(v==null?void 0:v.formatted)||"0",decimals:(v==null?void 0:v.decimals)||F.decimals}}).filter(F=>F.address),D=C.reduce((F,L)=>({...F,[L.address]:{balance:L}}),{});return{balanceList:C,baseTokenBalance:P,combinedData:D}},[u,l,i]),m=y.useCallback(async()=>h,[h]),g=y.useMemo(()=>{const P=(u==null?void 0:u.isLoading)||!1,C=Object.values(l).some(D=>{var F;return(F=D.balance)==null?void 0:F.isLoading});return P||C},[u==null?void 0:u.isLoading,l]),N=y.useCallback(()=>p(P=>P+1),[]);return{multicallRun:m,multicallRefresh:N,multicallResult:h,validErcTokens:i,isLoading:g,queryComponents:d}},YS=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,accountId:o,accountKey:s,platformBalance:i,isLoading:l,wagmiHooks:a,onChainChange:c,onDeposit:u})=>{const{t:f}=Ct(),p=a.useAccount(),d=t.tokenList.find(H=>H.token===n||H.symbol===n),h=t.chainId,m=y.useMemo(()=>{if(!((n||"").toUpperCase()==="USDC"))return!1;const X=Number((t==null?void 0:t.cctpResolvedMaxFee)??0);return Number.isFinite(X)?X!==0:!1},[t==null?void 0:t.cctpResolvedMaxFee,n]),[g,N]=y.useState(""),[x,P]=y.useState(()=>m?"fast":"standard");y.useEffect(()=>{N("")},[n,t.chainId]),y.useEffect(()=>{P(m?"fast":"standard")},[t.chainId,m]);const{multicallResult:C,queryComponents:D}=ZS({account:e,chainId:t.chainId,contractAddress:(d==null?void 0:d.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:a}),F=y.useMemo(()=>{var X;if(!d)return"0";if(!d.tokenAddress||d.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return C.baseTokenBalance.formatted;const H=C.combinedData[d.tokenAddress];return((X=H==null?void 0:H.balance)==null?void 0:X.formatted)||"0"},[d,C]),L="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",b="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",v=y.useMemo(()=>{var H,X;return x5({chain:T5,transport:P5(t.rpcUrl||((H=window==null?void 0:window.ENV)==null?void 0:H.CHAIN_RPC_URL_42161)||((X=window==null?void 0:window.ENV)==null?void 0:X.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),E="1000000000000",{formatted:$}=A5({client:v,tokenAddress:L,holder:b,decimals:6,fallbackFormatted:E,pollingInterval:12e3}),[I,T]=y.useState(!1),{approve:B,onApprove:w}=qS({account:e,accountChainId:p.chainId,targetChainId:+t.chainId,tokenInfo:d,amount:g,wagmiHooks:a}),O=y.useCallback(async()=>{if(!I)try{T(!0),await w()}catch(H){console.error("Approve failed:",H)}finally{T(!1)}},[I,w]),k=y.useMemo(()=>+p.chainId!=+t.chainId,[p.chainId,t.chainId]),S=y.useCallback(async()=>{c&&c(h)},[c,h]);y.useEffect(()=>{k&&S()},[k,S]);const{showLayerZeroTip:M,layerZeroTipKey:j}=y.useMemo(()=>{const H=+t.chainId==42161||+t.chainId==421614,X=(n==null?void 0:n.toUpperCase())==="USDT",ae=new Le(g||"0"),ee=new Le("200000");let ge=!1,J;if(H&&X&&g)if(ae.gte(ee))ge=!0,J="deposit.layerZeroDepositTipGte200k";else{const se=$;if(typeof se=="string"&&se.length>0){const Oe=new Le(se);!Oe.isNaN()&&ae.gte(Oe)&&(ge=!0,J="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:ge,layerZeroTipKey:J}},[t.chainId,n,g,$]),z=y.useCallback(()=>WS(+t.chainId,F||"0",n,r),[F,t==null?void 0:t.chainId,n,r]),_=y.useMemo(()=>r!=="spot"&&_S(+t.chainId,g,n),[r,t==null?void 0:t.chainId,g,n]),q=y.useMemo(()=>"deposit.maxDepositSplitTip",[]),Q=y.useMemo(()=>{const H=Number((t==null?void 0:t.blockTime)??0),X=Number((t==null?void 0:t.txConfirm)??0);return!Number.isFinite(H)||!Number.isFinite(X)?0:H*X/60},[t==null?void 0:t.blockTime,t==null?void 0:t.txConfirm]),W=m&&x==="standard"?20:Q,te=y.useMemo(()=>{const H=d==null?void 0:d.depositFeeRate;if(H==null)return"";const X=String(H).trim();return X?`${X}%`:""},[d==null?void 0:d.depositFeeRate]),be=m&&x==="fast"&&!!te,de=GS({isNetworkMismatch:k,depositAmount:g,approved:B,currentTokenBalance:F,selectedToken:n,showLayerZeroTip:M,minDeposit:d!=null&&d.minDepositSize?parseFloat(d.minDepositSize):10}),Ee=H=>{const X=H.target.value,ae=z(),ee=Pi(X,ae);if(ee.isValid)N(ee.formattedValue),ee.errorType;else return ee.errorType==="exceed_balance",void 0},Z=y.useCallback(async()=>{Ti(!0);try{u&&u({amount:g,chainId:h,tokenAddress:(d==null?void 0:d.tokenAddress)||"",tokenSymbol:n,depositSpeed:x,accountType:r,accountId:o,key:s})}catch(H){console.error("Deposit error:",H),Ti(!1)}},[u,g,h,d==null?void 0:d.tokenAddress,x,r,o,s,n]);return A.jsxs(A.Fragment,{children:[D,m&&A.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 my-4",children:A.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[A.jsx("button",{type:"button",onClick:()=>P("fast"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),A.jsx("button",{type:"button",onClick:()=>P("standard"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),A.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[A.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:g,onChange:Ee,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),A.jsx("button",{onClick:()=>{const H=z();N(H)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),A.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),A.jsxs("div",{className:"flex justify-between items-center",children:[A.jsx(En,{content:f("deposit.availableDesc"),children:A.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),A.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:zS(F||"0",g,n)})]})]}),!B&&jS(g||"0",0)&&A.jsxs("div",{className:"flex justify-center flex-col items-center",children:[A.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:f("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),A.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:f("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),A.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:O,disabled:I,children:I?A.jsx(ns,{size:"xs",inline:!0}):f("deposit.enableWithToken",{token:n})})]}),M&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(j||"deposit.layerZeroDepositTip")})]}),A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"})]}),_&&A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(q)})]}),_&&A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:!(_||M)&&A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:f("deposit.noPrivateKeyWalletWarning")})]}),A.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.arrivalTime")}),A.jsx(En,{content:A.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:A.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})}),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:W})})})]}),be&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("withdraw.feeRate")}),A.jsx(En,{content:f("deposit.feeRateTooltip"),placement:"top",children:A.jsx("span",{className:"text-sm text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:te})})]}),A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.equity")}),A.jsx("span",{className:"text-sm text-text-primary font-medium",children:g?A.jsxs("span",{className:"flex items-center gap-1",children:[zt(i),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),zt((parseFloat(i)+parseFloat(g)).toString())," ",n]}):`${zt(i)} ${n}`})]})]}),A.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${de.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Z,disabled:de.disabled||l,children:[(l||k)&&A.jsx(ns,{size:"xs"}),de.text]})]})},Nm=e=>e.toLocaleUpperCase()===hn?hn:Us,rs=e=>Nm(e.wallet)===hn,Bc=e=>Nm(e.wallet)===Us,Ai=e=>e?e==="perp"?Re.PERPETUAL:e==="perp-v2"||e==="perp_v2"?Re.PERPETUALV2:e:"",Cm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBMSURBVHgBvVt7kBTHef/17N77fRwSiNeBBAGBpVNJERKyoqOSuByiVLAScOKqJKAYJU4F8XCVY8d/cLiSkKSS4pDtKJKRdFhxYoNskTKS4jixFguEICAdiDtAvJb3cRzcg7u9vX1M5/t6puexO7u3Byd+VDOzPT3dPd/39ffqPoFbhJSymS5NVJ6yr7V2YfRRidrlMJWIECKC28Bnv5dslqZskjCeEhA0nvSPJ0SU5hQ1IA/DQGTPqqIIbgMLvjzcbAjxoBRoFlLSeKJWqjEFDY0++p6oCRmFFO2Aufvo1rIIbgFiLI3pA/mD11BZC/fjC0WUSoTKRp58IS80vyZrEylzjTDlLYxHYwgZKUqHNka+Uth4TWtlbWowvkZArjWlqBEikz4SNsmkdZXqB7WDaVrfV1SEje3/WhZFgSiIATbhN8Ai/HigDXkYwYRPJkwaT47PeAJt+RjBhE8PDm+QEGvpW/VLkglMUFeuFja13HvBtHHu1SOp3nktHMa3CmHEqAygDlniWzB2iR8NUVhMaPNWPv5yeo0hZcv4j0cqSsiN7z8XbvPWLlgVXwMz3UJk9I4nLekWmqD6t9WTUEzw1vme8zNqc84wzI0ff6+yLe+s8j2kwTdj/KQ+F1rpA9fxzRMvpTePm9TnhGjd+2chNd78Z2ObiVZrbYJaT4Ur4TYhhbMoPM8z7h3dZD+RVhU1MURrx9bydTlnE1Rpq5w3qTTjDqB/BO2//f10H825GXcAMiXb+z8c6SPiNXuIK7XOt+oE/WbVI2wmKBpLr9632nrbeVWVh7RSthfL5OL2trq+zLmEc8zxXSpN8cEBlFZW49OEGR/A2rcqmiBxxzDQmWgiowlbcO2RpUfStd6XnnpNfOsdVk26NfVFxDcVE/z92CsIsimOMAv04sy5hDIrbLWzlO9f+OJnkDwVwcRygVD9NIhwCcYDTPTBfa/jo3//W/z1OzGcLnsYdwqxaBLJ3rS6l9Z/mpD21ZJk3d4yspZIewjrFW/nfVtdaXXkukxWXePEpm/W9rT/3c+88/GpIBpsBV1e4/uO997B97+5QtUvnGpg4bQQyh9ejvJHlqFk1uO4FcTP7MPQwR2Id/wXdh/vxc/Ll+Hk45txpzByLYXBUwm49HFhMUPYasiRcjw6NyTmTQ9hLpUpDRa5bsYkjp03ceB4Cv93Ig29iiz1IzNtgcMEezWsO9FW0+q0cCYgZSMs1cNXbN/0PA698yOnq+oSgWfmh+lKy6ZuGioeXoayR5YjXDcV+cDSfvO9rRjcs9W6HwHeoolfMqbi6G+8gXjlNNwJmCMS/R1xpONewrvCyuLrld4vfLZI/OXSYiK6kbffSz0mvrMzgTf3JLXb6qwatz/nN3fdNyLMmVHbHngZwJK/Qv/esGQ22AZ4wUxYOM3AvInupKrvmYaiHJYkkSIDe/mC8/tYt4k950yMpCROLmpF96zluBVMrhK4bwJQWWz9HiSh7hoETvbkNiQ3T41gpDul7r06Ah5isYROmWBg06oylnyMBcyIP/77GC5eM7M8J3jcVNt4t57YVqM8Ix09NNLlrG49PNiPliVzcg7WNNnArzVaE2TiV1UEtxuIEROStPTpuw9cTOPwFWX5MEJSf3DpfowFVcUCyz4DLF9goDKHKeq6CXx4ReK1gxJXBl0KsPT3HBzSXjy0+pH2b9t7B6ua764pH1Xqc4GZ8BdbhnD8vDLejoekepd+25IwZB2vAj3SBm9HZZU1qJuUWzW0EyHbPkxhgNRJMuX6xV6kTYv4rHLe7Eg5xGecf+CrGAuWLxDY8YcGnn04N/EZk6qAJXOo7Ze4rauKh84n7ElK+5+tr/mhJBeGChP9dojP4Hf/ZU0FpkxwAzW+Sm1grHtlW8IpgwNc6NGaMzub9dCivIMNkFT9x5Ekjl0jlZLMfp5KWSrnh0dS6In5OTRwV2FGnKX+208beH5RfsIHgZm16XOGUlMjfZbqMSU0BRQbTJc6eP0bFbdFfA3uY9Oqcrtf6bsSo4XFCF4Npgo4Q3ZWMyv67O26gE8OvJt3MJbyMzekYsCcu/yT/8UnJn55Nq3aeDFw9yJcnrcKheDlpSHMv9sfKw7Sitp5XOLf2iVeOiDxzicS/3tGKjswoUz4GDWjVmCyMPHT90YCl6ntXuKZJ0uoFGO8MJVsJHlKov2UYryt87zRmVJFpfUPfH03m89m3AbYMM8OkJxG+viPuwSpIP+H999dmPSz5FZm0OTVQxI7jppKrWXio8sSL7xvSb5X/XScTtr6QCpt73go/M+0wtbnnynFeGPF50vQ9rO4urd4bzqT0oyn/x9kBjwY1EEhEbDlmobUNRMNFLz9Hj37cUfax4Sh+vkoBCzRq3elSQWFFCO+8XNTEXk0vHqI2l0R2PSbhvKMfvBBUqkaSwyl4/loLJwbyqt6/uqlIew/lrTesvjlfOzC+8P4h+cqA9/jPtmT2n+MV4H2sixPSKtB+rGYGdAY1AEb4nyYUmPg6TkGSsJOBtCXrmUwY5gJuyhY6RmyKuMVuY0763wmtvZgrty0mMB1J6+P3l6DGbXyJ2nFxP4B046CYPufAto956pH54aRDx8cS7BrCX/+3yZiZ36BWDi3CB90JlVbw9BRsnQibrp7ICcD7pm9QK0CbyxQWiQw9y6Be8lXnlLhl/ogBjCYCV+iYS4RA05fN7E/BwOUwf0dQ3kyq39qEsFdJgRhcqXVnsHtM5mg30vF0q7Ho77fjbbI/8H9M/IzwJFWx4UUlPuR0h/xBmPKRJ2qtvJFbqCm7rnzOv6CwLw7u6GfW/k1NNYbaL4vhBWPhvH1Xw/jdxeEMK0q/9hmgGDwO/xuqjhYtTExdXDF97Mn5B5DE5+ZxYXvuS4I6ZQJ1wtxvFHnd1XFaHR00wzS9SOd3/kwpSEEK2nnJPWk9Y7lDdFNTV6/6/EnFxHhQ8QAgxhhTXSQXErTDPhQT13QvPidwVjwhDMNbj4meImvMRoT7FnZc/O4h1JitCysJqAmupVW0JnS0WEzzJNZdQRBZVSZAX25XjbP78uqS5E9unot6ZSe6ylVEil3Qqm0dOq9bUdIJ1eaA1l9aoPb5VE3QUwIIr5GEBNmk9BUl7HKMLUfDouY0OaY9Hsa+cDvmaZmmss33U8+DMTs5eYpWgB4FdBtX14GpI7syKqrrRGorXLF9XSsjKRfIiTcxSQovuO6IzddD6Ga3qmnBVeB/sCxtMHNxYQg4nNbb3svE5j4fF9V7joJbnGlufNcEgVAuhJsFqyCOqNJn+qzm0tbHkAki7IFakeAIZZ9FyG7O7I6ZUPLTAiFi/DPp6bg7ct1+Js5ZzBLxOFkV6jN8eFqbDxzL5bc04uv3ncJFWUGeQJp3JfsxNWSYEOsmcCupya0ZgIHYJnE57YMb3vNBKXWKChjI3uBknBCZCbhLFvVGU0hHxbOK4Klsz3a2u5o4bxRPKjOhMNoT2paOHvKJqKskzgKzkrKp49sR2LX+sCOudNYnKS5jIKiZAjRvmLMqRlBSbGdbEsIXIoVYWJFGlVFaQzFQigrNYkBEj8pfRYvVm5APkyu8hM1E5r42tPJ1/6Vt2P41rabTiDmfIN95Zq9327A1LvGlv0cDRe703hi9TXAE/x5DY7tNW5ktrYHdRCkfjS4r9ISi9hM4AUNw1ltZtUm1DNGcbFFfMa96U6MhiB1pJFJ/NHaT58cdlSFzgFJjzvE95vfGMR4o5X6tG2v7UVJrxOlYJiIGPaJtSw7cHMIuNHvLxevmjh1LqVKF3E4aa9eZogmMCPkESZuc7k75bzXcHEvKgIMcSaCiBpE/NHav3w8RFupwklHuEbQTkXQdXskhn0dCYwXLtL3/uhdysUr1WVaW2vuzpieQzT6xuSIVmxbMjspvjc7Z1NeaqgOkrT5k0pbTBq28zJFYQ8D7F75GbfhZcjvsCtaVhrCb/W9gkLgJWo+4o/Wvmp6GVy6+11KvRrWf7dXqY3bBfexvOWGuueATRtvNZrUDFGRSITr9IYMB2O93o5GaP+256VlWQOkyN283ptCVSXtEZdZlB6umoqNb0fV/oDGPy2difJBazcsNky2YjCNhvowrQ6BIaMaz878GIWCdTy7qkFJuELamzTn87+46iRytAoQvpMjQs5vDIlXvlZP9iCMWwEb+y//Y6/siCZFwLkiexVYgV26yJjV9cPJUcOaiGAV5FsFvPEuSrOj1jAt54qKEEm5QLp+DmKPrcfBCcvw36clPrjolhMz/kg94zY8m4oKQxGfwSpoSX9hq4DBUlwo8YPaGzTn6hkV/kgW7j37+VKmBREOv7+hR6mQseL9oyNYRu92RBPK39KpB+m4Qa4Kov+3MfH5zrsnzKvgLDypid7t6xE7tN03EDOFmTMw6QkMl04EGRHsOfARtrz6A1+7P/2DZ/D55kUqE1k6fBU1V/epVSXjlv7nVbB6xl51vRPgVXDhl90wkzpkzzg5Iv0nGr64uALrlldh2iirgaV+665BbH2LDbl7CiIYSvrPmcWhxVkMsGfhc0ljB7ejd8d6RXC2CXz1Hkm5cOIIus8ew9Bw3I4yXVRVVqqIo+6eWZj1wK869cyEkdP7kKDrmzfmYduE/C7peKL/3BBuHB9w4gAb3vBApxOdnP1j95fIRQtKxPyZxaguh2rC0TMT/v2jcTLeI94TENAqx3vEUfWo9ZBhrOj68dRtevAsblFDPrOi9ivN4QHVwijNLaV917pw4tB7iMf8rlxpeSV+5ZEnUdswKee7fEzlOx9VYvvHo8T044jrx/vRFx2y9qjc7K0vV09fLC0CSmQfUXfgDYQ9u15SCH+44R5XlGi9snO675yoyNHzuxjDThkTP5MBlTX1CBcVts23eldhmy3jhcv7exDvtdxOLbkW9AlnJ0wLUCnek9LSlnT3eGOOtvSfPHxl54yHMqaS93AuM6EJdwB9cUSeft2shfpLlE8fZsKMnP6fy7RpKvRuoC267uFcr+rQGzBe2GLuBLlutKvfsy5WUxEpRfoL0Z0zs+KtwHQ0e0VUmFtb8OljS12ZWLz3udBDtFY/9fF4jH2rixd3/2fjQxDmC4A3X595isHNnsE5xKv1u5S+WELdet+z+jSEuaVr5/TFQcRn5N0PICawUV4J648pxhs8oXX2GAp7/rxoLdnylfzHFBh/0HjmOh5DV1zdOXMt6X7r+7wuqvSnj634zQngpOW2qsyozu/LrHaUziQXcN0VGiPfpAQKgH1yroXKn2B8wJLeYscfWXjsRdkYMpItJB/jMh5Lfbgk3BJZGTzepKVnG4mmGyg1sUK19xxVtKNW4VcvfrWUqaIMIbeUGUZLLqn3zQ1jgIcRTyHHXnIe6GCvNRfhM+EyIkTjqbHHNJ4wifCl4dZchM8EMyKdxgZaFc1Ez0b4AgVtI6zUjtc7Us8M9BMbtpQbRmshhNcYEwO8sA90cWFD1mgX75+pcuFM626+3vafqb6YbCaF2Qw2nEI02sLgGY/sFmQ7xaC7hSna93zl9v5MteHpk80U9z9FdqKJyNtIdG8kdtRa+wqil3R3vwlB34WINFOHe3bNjuAW8P/4M203oLS1YgAAAABJRU5ErkJggg==",Om="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0WSURBVHgB1ZsNcFTVFYDPe7thd7NZsonIT6CwQWvAnwTaRNuxQoJ2SqpViW3RiiMgVq2dgcy0dnRqkwz9Ga0dNjOt2BYVi2hpVaSFBmyRRWBajUoIWIlYWERAhWE3xoT87O7rOfftDW/fu+9vEzrTb+bN7rvvvnd2z7n3nHN/ngR5kvh7US2AMkvKKHMBpFkgQRgUPAgJkvg9jtfjkj+yTy6cGgvVbI3BCFAUpRY/ZuExN/sZzh5EEo949tiHR0ySpBiMhG+ivAzQ/5qL/8UoT8rKU1CeDDF4IT95kpvKiY3hsFw0uFxRpBXDynZO3Ddlaaz/g3UtJfXJuJMbUOkkYzkeKwDcy8MjhkcLGiPu6I6bUZ48AnkSyiuAFvijQ3ng0ABM8YVDTYr6w0aEHJgG8piStcGrdpsqJqv4JhgFeVnWgpUhVMWPnjwJ5Tk0hK0Bul8JLFdAbs6jxdsR945vaCmavW6tthCVTy2wGWD05YFqhLU5pbegPOX8yYOXdPJ0WBqge1twlTJ6rVCIJ1AWDc051EjfUfmrwIG8gVQG9hw6DfHTvew8Mi4INeWlEPJ7wQFRNAKTBw3O5I2QKBqh0eyi0ADkcqTg0EZsGbXwP8AfaezwXbKSAmmtVT1SfOexbtj/YZJ910LKr5g4Fg1RAnac+RQ6LljKEoVaq3qzIviDLgeoiqjfw0G1PH4KozDafuc7GGQOAHTEwRoJOiANdfCylDReEpDcFtwLaqbhCsmLiVAq6fY2KPryP8ETusKyTtfJHmiPJ6Cnf4idH/l3J+zZvJF9r7luPlR84Sr2nQxRHSmFGZNCps+a/QNU2hFzWYvrAO7Eo/YycET8E/Q1f8JAs8OiEgXoF6U6Y7GOfN2O7J8GwZo2SJ15Dc6+c6/j+/wVj4Bv2v2m108kz0L7kQT7ZOeHD0H79q34+X5OvXGTJsP8O5ZBqKSUnZMhbpo92eCWGp9Cn7BFLIsUvmoJtrxyyAsyxJJfY694x7SKwR3lGCDxSnCxpMDT4BKufDkwlZ0PHn/WkRHGlC2CwOVPCK/19KdQ8Weg66Me9TxxBt7c3gYH33rD8pkVX7wSaq6tHzZExcTQcHygFkoKErH8BtTOEhgVmrE3tGwwvdyIRojyk2EDJNr8EUn2UCeKgAv0yufYGcHsPr2fH+g/C517YrB/90723SnV6JYqr64Fnz/AzicXj4Plvy9mrVRP07dRaQthVLEwQhIHeOU8Hnh46UN3+igjqAUXmCmRPXhsJV6fCqlTm4X3+mc8At7Sa3LKyM9v6TwJx870QTqjQNdbr8OWp5+AY+8dhHQqBW4gF/V+59vgCwTQPU2Bx/9WBAeO+gz1zofyCRY/JDVQ6/BjuR/ebdkGkO0B2dZ/BFxgpXwtop5A94bm5P6yTXtP2Pr5fPGPmwntvl8ayiPjMZivhvNK3U9MYkIGSqgXsAglezxNigKOMVO+kurGTKg4p2zM5EXsU2sE38UP5tShlk/KZ35+28twcN8+GE3eT39NWL6jBRxBKSdlTZR+EpEL1UDN01Irnv6+mnUle3UXZJboNDMDKC7yfTPlZ85+AL1v1oO35BpDYNUbwVsyJ+f6p9nUsuvt102VPzYUhBu/fh1UXFIOkydNgOMnP4aHV0Zh0cKbWJmW9Rv+AgffOzx83uurNDyPUk3qAVaQ0lo3q1mTQYHZZ5ALs3oOXVuBAb7ZGA/YiN+baGOzmhFwgJ3yM2ePwiAehJkRBk+ut3VbemZ8fjo8+fgvIBQ61+Ta1+xnhrhv2Xdyyjdt+YeqfB+WDfSi8q+AQY9RQ6Q4KyhY1zWBMGhzKKsi90I9ycoIy68XGiBMM64ydoVacEim/yikMc/PKdMonzN4Av3+AWMGlE7sZj3ELdFHf5yj5BMnP4HVa56De5fdllNOrF7zPGQq5kC6uoGdkwH0kPuwUhi1djvlc7ihkn3mdchVCQd1ON0tYxSuAhf0oRsZwsDK7hcon6M3An2nMk+oEtxALbxsUq62Hl65Cm66/jp2aCGjnPgsA5maBshUzgelbCacLZhueKbdCJfSRyfK51Dd1r9a16EpDQPo+mXMgyJWNzK3U93GPjlkhP7//NygfHI7voseGj7nRuDKV5/n3P1wF6OFXEzXocOGct4r0qh8JXQhK0vPuwcGC43D2rk2BlgbA9ewOGHRC2guyYAEVV4r/6/1+fTZ217P3BAxgAbQQsqnkS2HX+eKH35m4TRwCvl9LaqSn4fbMfDqe8Wj0d+h3y9k7odDhhj0jKWunkO40Fwm+XRRwLWD7nnmVXXiTkRC/Myw12yeXx9wRUbg6JXvz/YCvZEKsI4+TTVD5HpWr1nPBi6iXvHqzn+pv/PEu5BB18PJDBnnG638vxvXo2eF60kcCMumlyTn5QrGAidlTtc/zVzPpi3bDb2ip6dXDbzl1TgDdyHIu9fB/xPe7AK6oReQbycfz/w/tn6rgNufbenc/2t9vhYqoykIu15gpmQKuvpe8eyGTWrgvXYRZHpOg3fTT8Hz5ouYBd3CrssFiqEXWLkYu7GBFU0LzQM8nynVkSQXRJNCQjfEjRC47Ak2iNIqnxQ5GH982B1xI5ChtMovyLqmoWyZMpS0NIDY9TwndD3DgReDLQu8eKQr68HTuZXFAirzCAywL24+5cwXXvKJAzTgMosvMVGhBHF0QVIHWMCNYMh2pt6vxghNdkRG0Cu/EOvSwQ2R7tlvKqts4gShkqmVU84vDLyoZG3gzVD+PyYInld/y879xWmDHKsVLFI+KdItNCq2Cu47DwgKM3BUxnXYneACbcDlgVlrBA5XPocbIXVml+mzH1i2wFC29HsPwry5XzLk/Dzwput1y62YCaWwR0gYjIsP74LABcZZVIsFEwaNXN24IqprN7IWysSlShkU6x6QUx9dh34eR2QEvfKHy0u/gn66U/jsmkiJYfWKDaxwzueBFd/NKecxgf2mfVsNz6IBmIJBuS/2Bwj4PzNcp4m1mKhFZqFeYDe9wKE6dnXJ/wsNIENMLqn/LMYCsQNotlN1R7kZjtYIZsqnGNCHwTmV2MWeoyUUKIDq8tKcMu7fRTGBBV40DJPd9RpLPfWk6u4BamJFRzawQKznmRhYQgrd+1jWrwtmPamMgi7VsTMUrRcLiNNuuux6QFGzJCtN4BDaXMWzIy1kGNFEG1c+h7Ilv2bELOIudD1khLaNT+aUU9n8BUtzyijYpr71M3UCTvs70TgUCz6asRJO9cw2yNj7K5MRqg42HR0/N0bgcztOpqPpnvL7BBdo89aL0hJ1HOD3RsEF5wKzsSfo0SufGDz6G7CC/Hv72/vhhyvuNlxjgVeH1HMKU8+XDOUsE0J3VCW3gQhaoHcCVzgFWjpuvtKZ8gmzNWi2cw7ICyEldcmkokit4AIzI2gRKZ8gFzRgYgQ+3UBBl4KvFu2IV4+MqafeFY31pKHu9ruh4Y6FMK+q23AP+eVG96NXx5DrMQm+a/m2xXMjYZ+32Wks4FgZwUz5HJqm0McCgvz9oltvNKSj2sBrhkypJ64B+CQFrirug9smJWFmqQf/moz+WhG22uhmyx0MeUPKbxY/N85bPzG8KP/IM/39P7ptzIAkw3xwASmRFt4Lxn8DpAJ1gGWnfEZmAAcFA+Ad91XDpcrLZxjm+fe89wns7zoCp08eN32kNNgHM6d/Dm6sCMK0wBB4JXVbyvVVZXDR+AD4CwC2CXI+aqUUDIVTxnlgoXyiEf58biu7YXomsbUoKklsg6wreGBOJ16zV74Gu41ZBG1PeWqXumeA1o13vLAejusW7CdPvxiqr62HMvwkysIBtk2RPrWQy4mKN2o4SimtsN2YpUArbJRyNr2Jtya+EtyRz75QMoJorsgOMpx+i4oe2qBFO+T41sSut96A9u1qcL36hgYov1Rd+aKxxLyZ4w2K12K6UyGLk7VeLTSuaN1iuzWxA7Oe2cZiAYkd4bA0NLQj+2bIeWfMhAWxQNU6mo+yldf5YRI6j306bAgO+fnKzxXDFVPC7LsVp7ohNv4u9kaPpTyaL6LshxZwaJqBG4SnpTSnxAZ1NiNrti80DQscb87l5OuO3CD5p7QWz+1i3RKnRSgdtpXHty3y7enk52kgZ6f4LK2SlHUDC1CeBOf1/4ncjhbbKfpEW3CxpL49EoFRRCooSRZMvLWl8NLHcsYgaITFAKMvD9T3yOgFjdwxT8P5lafdByrC2StKbf4IyJ5mrHwnjBDawg5yUWsm+XFzyYKkMO1FI0RAfUtmxPKy0BinGZUvTrNvRnkSUBo+OvKo1dNbNy9Ltmm900UqhsYQ9KZixM29UkE4mRnoboV+b9RM8Xo0hnAtD9QWSIqPmipezzlD5C8vA1Eniue4MoAWtqFLhlp0T1Vo7Qhb3M99TTUp+yZ0pPs/3um94JqOUXpNlQ7aRhPJHtrXVOmgLJ+m1ztG6TXVWtq5wGQpAnmU2SgoT8bPPF9T/S+t/b7McgGVIAAAAABJRU5ErkJggg==",Im=({isOpen:e,isLoading:t=!1,onClose:n,accountChains:r,defaultChainId:o,defaultSymbol:s,defaultAccountType:i,balances:l,wagmiHooks:a,onDeposit:c,onCopy:u,getUserBizConfig:f,saveUserBizConfig:p,onChainChange:d,onTokenChange:h})=>{const{t:m}=Ct(),g=y.useMemo(()=>r.map(Z=>({...Z,key:Ai(Z.key)})),[r]),N=y.useMemo(()=>Ai(i),[i]),x=y.useMemo(()=>g.some(Z=>Z.key===Re.PERPETUALV2),[g]),P=y.useMemo(()=>{var H;if(!g||g.length===0)return N;const Z=g.find(X=>X.key===N);return(Z==null?void 0:Z.key)||((H=g[0])==null?void 0:H.key)||N},[g,N]),[C,D]=y.useState(P),F=y.useCallback(Z=>{var H;return((H=g.find(X=>X.key===Z))==null?void 0:H.chains)||[]},[g]),L=F(P),b=()=>{var J;if(!L||L.length===0)return{chainId:o||1,token:""};const Z=o||((J=L[0])==null?void 0:J.chainId),H=L.find(se=>se.chainId===Z)||L[0],X=(H==null?void 0:H.tokenList)||[],ae=(s||"").toUpperCase();if(ae&&X.length>0){const se=X.find(pe=>(pe.token||pe.symbol||"").toUpperCase()===ae);if(se)return{chainId:H.chainId,token:se.token||se.symbol||""}}if(ae)for(const se of L){const Oe=((se==null?void 0:se.tokenList)||[]).find(_e=>(_e.token||_e.symbol||"").toUpperCase()===ae);if(Oe)return{chainId:se.chainId,token:Oe.token||Oe.symbol||""}}const ee=X.length>0?H:L.find(se=>(se.tokenList||[]).length>0)||H,ge=((ee==null?void 0:ee.tokenList)||[])[0];return{chainId:(ee==null?void 0:ee.chainId)||H.chainId||1,token:(ge==null?void 0:ge.token)||(ge==null?void 0:ge.symbol)||""}},[{chainId:v,token:E}]=y.useState(()=>b()),[$,I]=y.useState(v),T=y.useMemo(()=>g.find(Z=>Z.key===C)||g[0],[g,C]),B=y.useMemo(()=>(T==null?void 0:T.chains)||[],[T]),w=y.useMemo(()=>{var ee,ge;if(!T||!Bc(T.account)||!(C===Re.SPOT||C===Re.PERPETUALV2))return!1;const X=!!((ee=T.walletOptions)!=null&&ee.evm),ae=!!((ge=T.walletOptions)!=null&&ge.mpc);return X&&ae},[T,C]),O=y.useCallback(()=>{var Z,H;return(Z=T==null?void 0:T.walletOptions)!=null&&Z.evm?"evm":(H=T==null?void 0:T.walletOptions)!=null&&H.mpc||T!=null&&T.account&&rs(T.account)?"mpc":"evm"},[T]),[k,S]=y.useState(()=>w?null:O());y.useEffect(()=>{S(w?null:O())},[C,w,O]);const M=y.useMemo(()=>{if(!T)return;if(!w)return T.account;if(!k)return;const Z=T.walletOptions;return k==="mpc"?(Z==null?void 0:Z.mpc)||T.account:(Z==null?void 0:Z.evm)||T.account},[T,k,w]),j=y.useMemo(()=>M&&rs(M)?hn:Us,[M]),z=B.find(Z=>Z.chainId===$)||B[0],[_,q]=y.useState(E),Q=y.useCallback(Z=>{I(Z),d==null||d(Z)},[d]),K=y.useCallback(Z=>{q(Z),h==null||h(Z)},[h]),W=y.useMemo(()=>{const Z=(_||"").toLowerCase();if(!Z)return"0";const H=(l==null?void 0:l[C])||(C===Re.PERPETUAL?l==null?void 0:l.perp:void 0),X=H==null?void 0:H[Z];return typeof X=="string"&&X.length>0?X:"0"},[l,C,_]),[te,be]=y.useState(!1),de=Z=>{Z.target===Z.currentTarget?be(!0):be(!1)},Ee=Z=>{te&&Z.target===Z.currentTarget&&n(),be(!1)};return e?Ke.createPortal(A.jsx("div",{className:"edgex-components",children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:A.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:de,onMouseUp:Ee,"aria-hidden":"true",children:A.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-2 border-solid border-line-divider-secondary",onClick:Z=>{Z.stopPropagation()},children:[A.jsxs("div",{className:"flex items-center justify-between mb-4",children:[A.jsx("h2",{className:"text-lg font-semibold text-white",children:m("deposit.title")}),A.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:A.jsx(E0,{className:"h-4 w-4"})})]}),A.jsx(Bh,{selectedAccount:C,options:g.map(Z=>({value:Z.key,label:Z.key===Re.SPOT?m("account.spot"):Z.key===Re.PERPETUAL?m(x?"account.perpetual-v1":"account.perp"):Z.key===Re.PERPETUALV2?m("account.perpetual-v2"):Z.key})),onAccountChange:Z=>{var Oe,_e;const H=Z||C;D(H);const X=F(H);if(!X||X.length===0)return;const ae=X.find(we=>we.chainId===$),ee=ae?ae.chainId:X[0].chainId;I(ee),d==null||d(ee);const ge=X.find(we=>we.chainId===ee),J=(ge==null?void 0:ge.tokenList)||[],pe=J.some(we=>(we.symbol||we.token)===_)?_:((Oe=J[0])==null?void 0:Oe.symbol)||((_e=J[0])==null?void 0:_e.token)||"";pe&&(q(pe),h==null||h(pe))},className:"w-full"}),A.jsx(Dh,{currentActiveChain:z,chainList:B,onChainChange:Q,curSelectToken:_,onTokenChange:K,walletType:j,accountType:C}),w&&!k&&A.jsxs("div",{className:"mb-4",children:[A.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),A.jsx("button",{type:"button",onClick:()=>S("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:m("deposit.connectedWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Cm,className:"w-12 h-5"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:m("deposit.connectedWalletDesc")})]})}),A.jsxs("div",{className:"flex items-center my-2",children:[A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),A.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:m("deposit.or")}),A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),A.jsx("button",{type:"button",onClick:()=>S("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:m("deposit.externalWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Om,className:"w-12 h-5"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:m("deposit.externalWalletDesc")})]})})]}),(!w||k)&&A.jsxs(A.Fragment,{children:[M&&rs(M)&&A.jsx(RS,{address:M.smartWalletAddress,currentActiveChain:z,selectedToken:_,accountType:C,accountId:M.accountId,accountKey:T==null?void 0:T.key,onDeposit:c,onCopy:u,getUserBizConfig:f,saveUserBizConfig:p,onClose:n}),M&&Bc(M)&&A.jsx(YS,{address:M.ethAddress,currentActiveChain:z,selectedToken:_,accountType:C,accountId:M.accountId,accountKey:T==null?void 0:T.key,platformBalance:W,isLoading:t,wagmiHooks:a,onChainChange:Q,onDeposit:c,onClose:n})]})]})})})}),document.body):null},XS=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:l="",accountType:a="perpetual",onWithdrawAmountChange:c,onReceiverAddressChange:u,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=Ct(),h=y.useMemo(()=>{if(a==="spot"||!xn(r==null?void 0:r.chainId)){const F=new Le(e||"0").minus(s||"0");if(F.isNegative()||F.isZero())return"0";const L=Math.min(F.decimalPlaces()??0,18);return F.decimalPlaces(L,Le.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a]),m=y.useMemo(()=>o||"0",[o]),g=y.useMemo(()=>{const F=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Le(F||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]),N=y.useMemo(()=>g==="0",[g]),x=y.useMemo(()=>{const F=(t||"").toUpperCase();return F==="USDT"||F==="USDC"},[t]),P=F=>{const L=F.target.value,v=Pi(L,m||"0");if(v.isValid)c(v.formattedValue),v.errorType;else return v.errorType==="exceed_balance",void 0;f==null||f(v.formattedValue)},C=()=>{const F=m||"0",b=Pi(F,F).formattedValue;c(b),f==null||f(b)},D=()=>{const F=parseFloat(o||"0"),L=parseFloat(e||"0");if(L>0){const b=F-L,v=zt(Math.max(0,b).toString());return A.jsxs("span",{className:"flex items-center gap-1",children:[zt(o||"0"),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),v," ",t]})}return`${zt(o||"0")} ${t}`};return A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[A.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:P,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),A.jsx("button",{onClick:C,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),A.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),A.jsxs("div",{className:"flex justify-between items-center",children:[A.jsx(En,{content:d("withdraw.availableDesc"),children:A.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),A.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:D()})]})]}),i==="mpc"&&(a==="spot"||!xn(r==null?void 0:r.chainId))?A.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:A.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:l,onChange:F=>u==null?void 0:u(F.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"})}):null,A.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:xn(r==null?void 0:r.chainId)?A.jsxs(A.Fragment,{children:[A.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),A.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:d("withdraw.commonWithdraw")})]}):A.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),A.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[A.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[A.jsx(En,{content:A.jsxs("div",{children:[A.jsx("div",{children:d("withdraw.speedNote")}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:jt.FAST,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:jt.Medium,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:jt.SLOW,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:A.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),A.jsx("div",{className:"flex items-center",children:A.jsx(Jo,{selectedLevel:xn(r==null?void 0:r.chainId)?jt.SLOW:jt.FAST,maxLevel:3})})]}),(a==="spot"||!xn(r==null?void 0:r.chainId))&&A.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[N||!x?A.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:N?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):A.jsx(En,{className:"w-[320px] font-normal flex items-center justify-center",content:A.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:A.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${d("withdraw.fee")}/${d("withdraw.feeRate")}`})}),A.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!N&&` / ${g}%`]})]}),A.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[A.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(xn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),A.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[zt(h)," ",t]})]})]})]})};let st=null;const Lc={accountChains:[],defaultAccountType:""},$m=y.forwardRef((e,t)=>{const[n,r]=y.useState(!1),[o,s]=y.useState(!1),[i,l]=y.useState(Lc),a=y.useCallback(h=>{l(h||Lc),r(!0)},[]),c=y.useCallback(h=>{l(m=>({...m,...h}))},[]),u=y.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=y.useCallback(h=>{s(h)},[]),p=y.useCallback(()=>n,[n]),d=y.useCallback(()=>o,[o]);return y.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,c,f,p,d]),y.useEffect(()=>(st={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{st=null}),[a,u,c,f,p,d]),n?A.jsx(Lm,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},accountChains:i.accountChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});$m.displayName="WithdrawManager";const km=e=>{if(!st){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}st.openWithdraw(e||Lc)},Mm=()=>{if(!st){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}st.closeWithdraw()},Dm=e=>{if(!st){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}st.updateWithdrawOptions(e)},Ni=e=>{if(!st){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}st.setWithdrawLoading(e)},JS=()=>st?st.isOpen():!1,Bm=()=>st?st.isLoading():!1,QS=()=>({openWithdraw:km,closeWithdraw:Mm,updateWithdrawOptions:Dm,setWithdrawLoading:Ni,isOpen:JS,isLoading:Bm}),eP=({accountChains:e,defaultChainId:t,defaultSymbol:n,defaultAmount:r="",defaultAccountType:o,currentEquity:s,platformBalance:i="0",balances:l,fee:a="0.00",isLoading:c=!1,onWithdraw:u,onClose:f,onChainChange:p,onTokenChange:d,onAmountChanged:h,onAccountChange:m})=>{var ge;const{t:g}=Ct(),N=y.useMemo(()=>e.map(J=>({...J,key:Ai(J.key)})),[e]),x=y.useMemo(()=>Ai(o),[o]),P=y.useMemo(()=>N.some(J=>J.key===Re.PERPETUALV2),[N]),C=y.useMemo(()=>{var se;if(!N||N.length===0)return x;const J=N.find(pe=>pe.key===x);return(J==null?void 0:J.key)||((se=N[0])==null?void 0:se.key)||x},[N,x]),[D,F]=y.useState(C),L=y.useCallback(J=>{var se;return((se=N.find(pe=>pe.key===J))==null?void 0:se.chains)||[]},[N]),b=y.useMemo(()=>N.find(J=>J.key===D)||N[0],[N,D]),v=y.useMemo(()=>(b==null?void 0:b.chains)||[],[b]),E=y.useMemo(()=>{var _e,we;if(!b||!Bc(b.account)||!(D===Re.SPOT||D===Re.PERPETUALV2))return!1;const pe=!!((_e=b.walletOptions)!=null&&_e.evm),Oe=!!((we=b.walletOptions)!=null&&we.mpc);return pe&&Oe},[b,D]),$=y.useCallback(()=>{var J,se;return(J=b==null?void 0:b.walletOptions)!=null&&J.evm?"evm":(se=b==null?void 0:b.walletOptions)!=null&&se.mpc||b!=null&&b.account&&rs(b.account)?"mpc":"evm"},[b]),[I,T]=y.useState(()=>E?null:$());y.useEffect(()=>{T(E?null:$())},[D,E,$]);const B=y.useMemo(()=>{if(!b)return;if(!E)return b.account;if(!I)return;const J=b.walletOptions;return I==="mpc"?(J==null?void 0:J.mpc)||b.account:(J==null?void 0:J.evm)||b.account},[b,E,I]),w=y.useMemo(()=>B&&rs(B)?"mpc":"evm",[B]),O=w==="mpc"?hn:Us,k=y.useMemo(()=>{if(!v||v.length===0)return{chainId:1,tokenSymbol:""};const J=we=>{const je=we||[];if(!je.length)return"";const Ge="USDC".toUpperCase(),zn=je.find(_t=>(_t.token||_t.symbol||"").toUpperCase()===Ge)||je[0];return zn.token||zn.symbol||""};if(n){const we=n==null?void 0:n.toUpperCase();for(const je of v){const cr=je.tokenList||[];let Ge;if(we&&(Ge=cr.find(Ut=>(Ut.token||Ut.symbol||"").toUpperCase()===we)),Ge){const Ut=Ge.token||Ge.symbol||n||"";return{chainId:je.chainId,tokenSymbol:Ut}}}}if(t){const we=v.find(Ge=>Ge.chainId===t)||v[0],je=we.tokenList||[],cr=J(je);return{chainId:we.chainId,tokenSymbol:cr}}const se="USDC",pe=we=>Array.isArray(we.tokenList)&&we.tokenList.some(je=>(je.token||je.symbol||"").toUpperCase()===se),Oe=v.find(pe)||v[0];if(!Oe)return{chainId:1,tokenSymbol:""};const _e=J(Oe.tokenList);return{chainId:Oe.chainId,tokenSymbol:_e}},[v,t,n]),[S,M]=y.useState(()=>k.chainId),[j,z]=y.useState(()=>k.tokenSymbol),[_,q]=y.useState(r),[Q,K]=y.useState(""),W=y.useCallback(J=>{M(J),p==null||p(J)},[p]),te=y.useCallback(J=>{z(J),d==null||d(J)},[d]),be=y.useRef(!0),de=y.useRef(j),Ee=y.useRef(S);y.useEffect(()=>{if(be.current){be.current=!1,de.current=j,Ee.current=S;return}(de.current!==j||Ee.current!==S)&&(q(""),de.current=j,Ee.current=S)},[j,S]);const Z=v&&v.length>0?v.find(J=>J.chainId===S)||v[0]:null,H=(ge=Z==null?void 0:Z.tokenList)==null?void 0:ge.find(J=>J.token===j),X=y.useMemo(()=>{const J=new Le(_||"0"),se=new Le(a||"0"),pe=xn(S);return H!=null&&H.minWithdrawSize&&J.lt(H.minWithdrawSize)?{text:g("withdraw.minWithdrawParsed",{amount:H.minWithdrawSize,token:H.symbol||H.token}),disabled:!0}:!_||J.isZero()||!pe&&J.isLessThan(se)?{text:g("withdraw.confirmWithdraw"),disabled:!0}:w==="mpc"&&(!pe||D==="spot")&&!Q.trim()?{text:g("withdraw.invalidReceiverAddress"),disabled:!0}:{text:g("withdraw.confirmWithdraw"),disabled:!1}},[g,S,_,w,Q,a,D,H]),ae=y.useMemo(()=>{const J=(j||"").toLowerCase();if(!J)return i||"0";const se=(l==null?void 0:l[D])||(D===Re.PERPETUAL?l==null?void 0:l.perp:void 0),pe=se==null?void 0:se[J];return typeof pe=="string"&&pe.length>0?pe:i||"0"},[l,D,j,i]),ee=y.useCallback(async()=>{Ni(!0);try{if(u){const se={amount:new Le(_||"0").toString(),chainId:S,tokenAddress:(H==null?void 0:H.tokenAddress)||"",coinId:(H==null?void 0:H.coinId)||"",tokenSymbol:j,accountType:D,selectedToken:H};w==="mpc"&&(!xn(S)||D==="spot")&&(se.receiverAddress=Q),u(se)}}catch{Ni(!1)}},[u,D,H,_,S,j,w,Q]);return!v||v.length===0?A.jsx("div",{className:"text-center py-8",children:A.jsx("p",{className:"text-gray-400",children:"No chains available"})}):Z?A.jsxs(A.Fragment,{children:[A.jsx(Bh,{selectedAccount:D,options:N.map(J=>({value:J.key,label:J.key===Re.SPOT?g("account.spot"):J.key===Re.PERPETUAL?g(P?"account.perpetual-v1":"account.perp"):J.key===Re.PERPETUALV2?g("account.perpetual-v2"):J.key})),onAccountChange:J=>{var Ut,zn;const se=J||D;F(se),m==null||m(se);const pe=L(se);if(!pe||pe.length===0)return;const Oe=pe.find(_t=>_t.chainId===S),_e=Oe?Oe.chainId:pe[0].chainId;M(_e),p==null||p(_e);const we=pe.find(_t=>_t.chainId===_e),je=(we==null?void 0:we.tokenList)||[],Ge=je.some(_t=>(_t.symbol||_t.token)===j)?j:((Ut=je[0])==null?void 0:Ut.symbol)||((zn=je[0])==null?void 0:zn.token)||"";Ge&&(z(Ge),d==null||d(Ge))},className:"w-full"}),A.jsx(Dh,{currentActiveChain:Z,chainList:v,onChainChange:W,curSelectToken:j,onTokenChange:te,walletType:O,txType:"withdraw"}),E&&!I&&A.jsxs("div",{className:"mb-4",children:[A.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),A.jsx("button",{type:"button",onClick:()=>T("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:g("withdraw.connectedWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Cm,className:"w-12 h-5",alt:"EVM"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:g("withdraw.connectedWalletDesc")})]})}),A.jsxs("div",{className:"flex items-center my-2",children:[A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),A.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:g("deposit.or")}),A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),A.jsx("button",{type:"button",onClick:()=>T("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:g("withdraw.externalWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Om,className:"w-12 h-5",alt:"MPC"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:g("withdraw.externalWalletDesc")})]})})]}),(!E||I)&&A.jsxs(A.Fragment,{children:[A.jsx(XS,{withdrawAmount:_,curSelectToken:j,tokenInfo:H,curSelectTokenData:{balance:H==null?void 0:H.balance,allowance:H==null?void 0:H.allowance},currentActiveChain:Z,currentEquity:s||0,decimals:(H==null?void 0:H.decimals)||6,platformBalance:ae,fee:a,walletType:w,accountType:D,receiverAddress:Q,onWithdrawAmountChange:q,onReceiverAddressChange:K,onAmountChanged:h}),A.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${X.disabled||c?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:ee,disabled:X.disabled||c,children:[c&&A.jsx(ns,{size:"xs"}),X.text]})]})]}):A.jsx("div",{className:"text-center py-8",children:A.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Lm=({isOpen:e,isLoading:t=!1,defaultAccountType:n,onClose:r,config:o,accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a="",currentEquity:c=5e3,platformBalance:u="0",balances:f,fee:p,wagmiHooks:d,onWithdraw:h,onChainChange:m,onTokenChange:g,onAmountChanged:N,onAccountChange:x})=>{const{t:P}=Ct(),[C,D]=y.useState(!1),F=b=>{b.target===b.currentTarget?D(!0):D(!1)},L=b=>{C&&b.target===b.currentTarget&&r(),D(!1)};return e?Ke.createPortal(A.jsx("div",{className:"edgex-components",children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:F,onMouseUp:L,"aria-hidden":"true",children:A.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:b=>{b.stopPropagation()},children:[A.jsxs("div",{className:"flex items-center justify-between mb-4",children:[A.jsx("h2",{className:"text-lg font-semibold text-white",children:P("withdraw.withdraw")}),A.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:A.jsx(E0,{className:"h-4 w-4"})})]}),A.jsx(eP,{accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a,defaultAccountType:n,currentEquity:c,platformBalance:u,balances:f,fee:p,isLoading:t,wagmiHooks:d,onWithdraw:h,onClose:r,onChainChange:m,onTokenChange:g,onAmountChanged:N,onAccountChange:x})]})})})}),document.body):null};le.ChromeLoader=ns,le.ComponentProvider=lb,le.DEFAULT_LOCALE=ss,le.Deposit=Im,le.DepositManager=Em,le.LOCALE_NAMES=sb,le.LoadingSpinner=ns,le.SUPPORTED_LOCALES=Oi,le.Tooltip=En,le.Withdraw=Lm,le.WithdrawManager=$m,le.closeDeposit=Pm,le.closeWithdraw=Mm,le.formatThousands=ub,le.isDepositLoading=Am,le.isWithdrawLoading=Bm,le.openDeposit=Sm,le.openWithdraw=km,le.setDepositLoading=Ti,le.setWithdrawLoading=Ni,le.updateDepositOptions=Tm,le.updateWithdrawOptions=Dm,le.useComponentConfig=Kc,le.useDeposit=N5,le.useDepositManager=HS,le.useTranslation=Ct,le.useWithdraw=C5,le.useWithdrawManager=QS,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
|
|
187
187
|
//# sourceMappingURL=index.umd.js.map
|