@edgex-web/components 0.1.0-beta.30 → 0.1.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(Z,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],m):(Z=typeof globalThis<"u"?globalThis:Z||self,m(Z.EdgeXComponents={},Z.React,Z.ReactDOM))})(this,function(Z,m,Se){"use strict";var yh=Object.defineProperty;var xh=(Z,m,Se)=>m in Z?yh(Z,m,{enumerable:!0,configurable:!0,writable:!0,value:Se}):Z[m]=Se;var Ie=(Z,m,Se)=>xh(Z,typeof m!="symbol"?m+"":m,Se);function $o(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 R=$o(m),Vt=$o(Se);function sa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zn={exports:{}},zt={};/**
1
+ (function(re,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],S):(re=typeof globalThis<"u"?globalThis:re||self,S(re.EdgeXComponents={},re.React,re.ReactDOM))})(this,function(re,S,Be){"use strict";var DP=Object.defineProperty;var jP=(re,S,Be)=>S in re?DP(re,S,{enumerable:!0,configurable:!0,writable:!0,value:Be}):re[S]=Be;var Xe=(re,S,Be)=>jP(re,typeof S!="symbol"?S+"":S,Be);function su(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 _=su(S),Ar=su(Be);function X0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qs={exports:{}},Tr={};/**
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 Ao;function la(){if(Ao)return zt;Ao=1;var e=m,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,i={key:!0,ref:!0,__self:!0,__source:!0};function l(u,s,a){var c,d={},p=null,f=null;a!==void 0&&(p=""+a),s.key!==void 0&&(p=""+s.key),s.ref!==void 0&&(f=s.ref);for(c in s)r.call(s,c)&&!i.hasOwnProperty(c)&&(d[c]=s[c]);if(u&&u.defaultProps)for(c in s=u.defaultProps,s)d[c]===void 0&&(d[c]=s[c]);return{$$typeof:t,type:u,key:p,ref:f,props:d,_owner:o.current}}return zt.Fragment=n,zt.jsx=l,zt.jsxs=l,zt}var Ht={};/**
9
+ */var iu;function Q0(){if(iu)return Tr;iu=1;var e=S,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(c,a,u){var l,f={},p=null,d=null;u!==void 0&&(p=""+u),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(d=a.ref);for(l in a)r.call(a,l)&&!s.hasOwnProperty(l)&&(f[l]=a[l]);if(c&&c.defaultProps)for(l in a=c.defaultProps,a)f[l]===void 0&&(f[l]=a[l]);return{$$typeof:t,type:c,key:p,ref:d,props:f,_owner:o.current}}return Tr.Fragment=n,Tr.jsx=i,Tr.jsxs=i,Tr}var Cr={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,53 +14,53 @@
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 Mo;function aa(){return Mo||(Mo=1,process.env.NODE_ENV!=="production"&&function(){var e=m,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),g=Symbol.iterator,v="@@iterator";function E(A){if(A===null||typeof A!="object")return null;var U=g&&A[g]||A[v];return typeof U=="function"?U:null}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(A){{for(var U=arguments.length,K=new Array(U>1?U-1:0),X=1;X<U;X++)K[X-1]=arguments[X];N("error",A,K)}}function N(A,U,K){{var X=M.ReactDebugCurrentFrame,ie=X.getStackAddendum();ie!==""&&(U+="%s",K=K.concat([ie]));var ae=K.map(function(re){return String(re)});ae.unshift("Warning: "+U),Function.prototype.apply.call(console[A],console,ae)}}var F=!1,j=!1,k=!1,B=!1,h=!1,b;b=Symbol.for("react.module.reference");function y(A){return!!(typeof A=="string"||typeof A=="function"||A===r||A===i||h||A===o||A===a||A===c||B||A===f||F||j||k||typeof A=="object"&&A!==null&&(A.$$typeof===p||A.$$typeof===d||A.$$typeof===l||A.$$typeof===u||A.$$typeof===s||A.$$typeof===b||A.getModuleId!==void 0))}function $(A,U,K){var X=A.displayName;if(X)return X;var ie=U.displayName||U.name||"";return ie!==""?K+"("+ie+")":K}function D(A){return A.displayName||"Context"}function L(A){if(A==null)return null;if(typeof A.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof A=="function")return A.displayName||A.name||null;if(typeof A=="string")return A;switch(A){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case o:return"StrictMode";case a:return"Suspense";case c:return"SuspenseList"}if(typeof A=="object")switch(A.$$typeof){case u:var U=A;return D(U)+".Consumer";case l:var K=A;return D(K._context)+".Provider";case s:return $(A,A.render,"ForwardRef");case d:var X=A.displayName||null;return X!==null?X:L(A.type)||"Memo";case p:{var ie=A,ae=ie._payload,re=ie._init;try{return L(re(ae))}catch{return null}}}return null}var C=Object.assign,O=0,T,P,x,I,_,V,W;function Y(){}Y.__reactDisabledLog=!0;function q(){{if(O===0){T=console.log,P=console.info,x=console.warn,I=console.error,_=console.group,V=console.groupCollapsed,W=console.groupEnd;var A={configurable:!0,enumerable:!0,value:Y,writable:!0};Object.defineProperties(console,{info:A,log:A,warn:A,error:A,group:A,groupCollapsed:A,groupEnd:A})}O++}}function G(){{if(O--,O===0){var A={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:C({},A,{value:T}),info:C({},A,{value:P}),warn:C({},A,{value:x}),error:C({},A,{value:I}),group:C({},A,{value:_}),groupCollapsed:C({},A,{value:V}),groupEnd:C({},A,{value:W})})}O<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=M.ReactCurrentDispatcher,z;function J(A,U,K){{if(z===void 0)try{throw Error()}catch(ie){var X=ie.stack.trim().match(/\n( *(at )?)/);z=X&&X[1]||""}return`
18
- `+z+A}}var se=!1,he;{var $e=typeof WeakMap=="function"?WeakMap:Map;he=new $e}function it(A,U){if(!A||se)return"";{var K=he.get(A);if(K!==void 0)return K}var X;se=!0;var ie=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ae;ae=H.current,H.current=null,q();try{if(U){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(Ae){X=Ae}Reflect.construct(A,[],re)}else{try{re.call()}catch(Ae){X=Ae}A.call(re.prototype)}}else{try{throw Error()}catch(Ae){X=Ae}A()}}catch(Ae){if(Ae&&X&&typeof Ae.stack=="string"){for(var te=Ae.stack.split(`
19
- `),Oe=X.stack.split(`
20
- `),pe=te.length-1,me=Oe.length-1;pe>=1&&me>=0&&te[pe]!==Oe[me];)me--;for(;pe>=1&&me>=0;pe--,me--)if(te[pe]!==Oe[me]){if(pe!==1||me!==1)do if(pe--,me--,me<0||te[pe]!==Oe[me]){var He=`
21
- `+te[pe].replace(" at new "," at ");return A.displayName&&He.includes("<anonymous>")&&(He=He.replace("<anonymous>",A.displayName)),typeof A=="function"&&he.set(A,He),He}while(pe>=1&&me>=0);break}}}finally{se=!1,H.current=ae,G(),Error.prepareStackTrace=ie}var Ut=A?A.displayName||A.name:"",Dt=Ut?J(Ut):"";return typeof A=="function"&&he.set(A,Dt),Dt}function Ee(A,U,K){return it(A,!1)}function ge(A){var U=A.prototype;return!!(U&&U.isReactComponent)}function le(A,U,K){if(A==null)return"";if(typeof A=="function")return it(A,ge(A));if(typeof A=="string")return J(A);switch(A){case a:return J("Suspense");case c:return J("SuspenseList")}if(typeof A=="object")switch(A.$$typeof){case s:return Ee(A.render);case d:return le(A.type,U,K);case p:{var X=A,ie=X._payload,ae=X._init;try{return le(ae(ie),U,K)}catch{}}}return""}var an=Object.prototype.hasOwnProperty,Hl={},Gl=M.ReactDebugCurrentFrame;function Qn(A){if(A){var U=A._owner,K=le(A.type,A._source,U?U.type:null);Gl.setExtraStackFrame(K)}else Gl.setExtraStackFrame(null)}function Qm(A,U,K,X,ie){{var ae=Function.call.bind(an);for(var re in A)if(ae(A,re)){var te=void 0;try{if(typeof A[re]!="function"){var Oe=Error((X||"React class")+": "+K+" type `"+re+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof A[re]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Oe.name="Invariant Violation",Oe}te=A[re](U,re,X,K,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(pe){te=pe}te&&!(te instanceof Error)&&(Qn(ie),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",X||"React class",K,re,typeof te),Qn(null)),te instanceof Error&&!(te.message in Hl)&&(Hl[te.message]=!0,Qn(ie),w("Failed %s type: %s",K,te.message),Qn(null))}}}var Zm=Array.isArray;function To(A){return Zm(A)}function Jm(A){{var U=typeof Symbol=="function"&&Symbol.toStringTag,K=U&&A[Symbol.toStringTag]||A.constructor.name||"Object";return K}}function eh(A){try{return Yl(A),!1}catch{return!0}}function Yl(A){return""+A}function Kl(A){if(eh(A))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Jm(A)),Yl(A)}var ql=M.ReactCurrentOwner,th={key:!0,ref:!0,__self:!0,__source:!0},Xl,Ql;function nh(A){if(an.call(A,"ref")){var U=Object.getOwnPropertyDescriptor(A,"ref").get;if(U&&U.isReactWarning)return!1}return A.ref!==void 0}function rh(A){if(an.call(A,"key")){var U=Object.getOwnPropertyDescriptor(A,"key").get;if(U&&U.isReactWarning)return!1}return A.key!==void 0}function oh(A,U){typeof A.ref=="string"&&ql.current}function ih(A,U){{var K=function(){Xl||(Xl=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",U))};K.isReactWarning=!0,Object.defineProperty(A,"key",{get:K,configurable:!0})}}function sh(A,U){{var K=function(){Ql||(Ql=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",U))};K.isReactWarning=!0,Object.defineProperty(A,"ref",{get:K,configurable:!0})}}var lh=function(A,U,K,X,ie,ae,re){var te={$$typeof:t,type:A,key:U,ref:K,props:re,_owner:ae};return te._store={},Object.defineProperty(te._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(te,"_self",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.defineProperty(te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ie}),Object.freeze&&(Object.freeze(te.props),Object.freeze(te)),te};function ah(A,U,K,X,ie){{var ae,re={},te=null,Oe=null;K!==void 0&&(Kl(K),te=""+K),rh(U)&&(Kl(U.key),te=""+U.key),nh(U)&&(Oe=U.ref,oh(U,ie));for(ae in U)an.call(U,ae)&&!th.hasOwnProperty(ae)&&(re[ae]=U[ae]);if(A&&A.defaultProps){var pe=A.defaultProps;for(ae in pe)re[ae]===void 0&&(re[ae]=pe[ae])}if(te||Oe){var me=typeof A=="function"?A.displayName||A.name||"Unknown":A;te&&ih(re,me),Oe&&sh(re,me)}return lh(A,te,Oe,ie,X,ql.current,re)}}var No=M.ReactCurrentOwner,Zl=M.ReactDebugCurrentFrame;function Wt(A){if(A){var U=A._owner,K=le(A.type,A._source,U?U.type:null);Zl.setExtraStackFrame(K)}else Zl.setExtraStackFrame(null)}var Lo;Lo=!1;function Po(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function Jl(){{if(No.current){var A=L(No.current.type);if(A)return`
17
+ */var au;function J0(){return au||(au=1,process.env.NODE_ENV!=="production"&&function(){var e=S,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function v(R){if(R===null||typeof R!="object")return null;var q=h&&R[h]||R[m];return typeof q=="function"?q:null}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(R){{for(var q=arguments.length,Y=new Array(q>1?q-1:0),te=1;te<q;te++)Y[te-1]=arguments[te];$("error",R,Y)}}function $(R,q,Y){{var te=C.ReactDebugCurrentFrame,he=te.getStackAddendum();he!==""&&(q+="%s",Y=Y.concat([he]));var me=Y.map(function(le){return String(le)});me.unshift("Warning: "+q),Function.prototype.apply.call(console[R],console,me)}}var B=!1,k=!1,D=!1,j=!1,g=!1,w;w=Symbol.for("react.module.reference");function A(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||g||R===o||R===u||R===l||j||R===d||B||k||D||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===f||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===w||R.getModuleId!==void 0))}function I(R,q,Y){var te=R.displayName;if(te)return te;var he=q.displayName||q.name||"";return he!==""?Y+"("+he+")":Y}function N(R){return R.displayName||"Context"}function P(R){if(R==null)return null;if(typeof R.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var q=R;return N(q)+".Consumer";case i:var Y=R;return N(Y._context)+".Provider";case a:return I(R,R.render,"ForwardRef");case f:var te=R.displayName||null;return te!==null?te:P(R.type)||"Memo";case p:{var he=R,me=he._payload,le=he._init;try{return P(le(me))}catch{return null}}}return null}var E=Object.assign,x=0,T,O,y,L,F,U,z;function V(){}V.__reactDisabledLog=!0;function Z(){{if(x===0){T=console.log,O=console.info,y=console.warn,L=console.error,F=console.group,U=console.groupCollapsed,z=console.groupEnd;var R={configurable:!0,enumerable:!0,value:V,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}x++}}function W(){{if(x--,x===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:E({},R,{value:T}),info:E({},R,{value:O}),warn:E({},R,{value:y}),error:E({},R,{value:L}),group:E({},R,{value:F}),groupCollapsed:E({},R,{value:U}),groupEnd:E({},R,{value:z})})}x<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=C.ReactCurrentDispatcher,G;function X(R,q,Y){{if(G===void 0)try{throw Error()}catch(he){var te=he.stack.trim().match(/\n( *(at )?)/);G=te&&te[1]||""}return`
18
+ `+G+R}}var ee=!1,fe;{var xe=typeof WeakMap=="function"?WeakMap:Map;fe=new xe}function oe(R,q){if(!R||ee)return"";{var Y=fe.get(R);if(Y!==void 0)return Y}var te;ee=!0;var he=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var me;me=K.current,K.current=null,Z();try{if(q){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(qe){te=qe}Reflect.construct(R,[],le)}else{try{le.call()}catch(qe){te=qe}R.call(le.prototype)}}else{try{throw Error()}catch(qe){te=qe}R()}}catch(qe){if(qe&&te&&typeof qe.stack=="string"){for(var ae=qe.stack.split(`
19
+ `),De=te.stack.split(`
20
+ `),Se=ae.length-1,Pe=De.length-1;Se>=1&&Pe>=0&&ae[Se]!==De[Pe];)Pe--;for(;Se>=1&&Pe>=0;Se--,Pe--)if(ae[Se]!==De[Pe]){if(Se!==1||Pe!==1)do if(Se--,Pe--,Pe<0||ae[Se]!==De[Pe]){var ft=`
21
+ `+ae[Se].replace(" at new "," at ");return R.displayName&&ft.includes("<anonymous>")&&(ft=ft.replace("<anonymous>",R.displayName)),typeof R=="function"&&fe.set(R,ft),ft}while(Se>=1&&Pe>=0);break}}}finally{ee=!1,K.current=me,W(),Error.prepareStackTrace=he}var $r=R?R.displayName||R.name:"",Hn=$r?X($r):"";return typeof R=="function"&&fe.set(R,Hn),Hn}function ue(R,q,Y){return oe(R,!1)}function pe(R){var q=R.prototype;return!!(q&&q.isReactComponent)}function se(R,q,Y){if(R==null)return"";if(typeof R=="function")return oe(R,pe(R));if(typeof R=="string")return X(R);switch(R){case u:return X("Suspense");case l:return X("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return ue(R.render);case f:return se(R.type,q,Y);case p:{var te=R,he=te._payload,me=te._init;try{return se(me(he),q,Y)}catch{}}}return""}var Le=Object.prototype.hasOwnProperty,Er={},Sr=C.ReactDebugCurrentFrame;function No(R){if(R){var q=R._owner,Y=se(R.type,R._source,q?q.type:null);Sr.setExtraStackFrame(Y)}else Sr.setExtraStackFrame(null)}function Xs(R,q,Y,te,he){{var me=Function.call.bind(Le);for(var le in R)if(me(R,le)){var ae=void 0;try{if(typeof R[le]!="function"){var De=Error((te||"React class")+": "+Y+" type `"+le+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[le]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw De.name="Invariant Violation",De}ae=R[le](q,le,te,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ae=Se}ae&&!(ae instanceof Error)&&(No(he),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",te||"React class",Y,le,typeof ae),No(null)),ae instanceof Error&&!(ae.message in Er)&&(Er[ae.message]=!0,No(he),b("Failed %s type: %s",Y,ae.message),No(null))}}}var bP=Array.isArray;function Qc(R){return bP(R)}function yP(R){{var q=typeof Symbol=="function"&&Symbol.toStringTag,Y=q&&R[Symbol.toStringTag]||R.constructor.name||"Object";return Y}}function vP(R){try{return D0(R),!1}catch{return!0}}function D0(R){return""+R}function j0(R){if(vP(R))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",yP(R)),D0(R)}var _0=C.ReactCurrentOwner,wP={key:!0,ref:!0,__self:!0,__source:!0},U0,z0;function xP(R){if(Le.call(R,"ref")){var q=Object.getOwnPropertyDescriptor(R,"ref").get;if(q&&q.isReactWarning)return!1}return R.ref!==void 0}function EP(R){if(Le.call(R,"key")){var q=Object.getOwnPropertyDescriptor(R,"key").get;if(q&&q.isReactWarning)return!1}return R.key!==void 0}function SP(R,q){typeof R.ref=="string"&&_0.current}function PP(R,q){{var Y=function(){U0||(U0=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"key",{get:Y,configurable:!0})}}function $P(R,q){{var Y=function(){z0||(z0=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"ref",{get:Y,configurable:!0})}}var AP=function(R,q,Y,te,he,me,le){var ae={$$typeof:t,type:R,key:q,ref:Y,props:le,_owner:me};return ae._store={},Object.defineProperty(ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.defineProperty(ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:he}),Object.freeze&&(Object.freeze(ae.props),Object.freeze(ae)),ae};function TP(R,q,Y,te,he){{var me,le={},ae=null,De=null;Y!==void 0&&(j0(Y),ae=""+Y),EP(q)&&(j0(q.key),ae=""+q.key),xP(q)&&(De=q.ref,SP(q,he));for(me in q)Le.call(q,me)&&!wP.hasOwnProperty(me)&&(le[me]=q[me]);if(R&&R.defaultProps){var Se=R.defaultProps;for(me in Se)le[me]===void 0&&(le[me]=Se[me])}if(ae||De){var Pe=typeof R=="function"?R.displayName||R.name||"Unknown":R;ae&&PP(le,Pe),De&&$P(le,Pe)}return AP(R,ae,De,he,te,_0.current,le)}}var Jc=C.ReactCurrentOwner,W0=C.ReactDebugCurrentFrame;function Pr(R){if(R){var q=R._owner,Y=se(R.type,R._source,q?q.type:null);W0.setExtraStackFrame(Y)}else W0.setExtraStackFrame(null)}var eu;eu=!1;function tu(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function H0(){{if(Jc.current){var R=P(Jc.current.type);if(R)return`
22
22
 
23
- Check the render method of \``+A+"`."}return""}}function uh(A){return""}var ea={};function ch(A){{var U=Jl();if(!U){var K=typeof A=="string"?A:A.displayName||A.name;K&&(U=`
23
+ Check the render method of \``+R+"`."}return""}}function CP(R){return""}var V0={};function OP(R){{var q=H0();if(!q){var Y=typeof R=="string"?R:R.displayName||R.name;Y&&(q=`
24
24
 
25
- Check the top-level render call using <`+K+">.")}return U}}function ta(A,U){{if(!A._store||A._store.validated||A.key!=null)return;A._store.validated=!0;var K=ch(U);if(ea[K])return;ea[K]=!0;var X="";A&&A._owner&&A._owner!==No.current&&(X=" It was passed a child from "+L(A._owner.type)+"."),Wt(A),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',K,X),Wt(null)}}function na(A,U){{if(typeof A!="object")return;if(To(A))for(var K=0;K<A.length;K++){var X=A[K];Po(X)&&ta(X,U)}else if(Po(A))A._store&&(A._store.validated=!0);else if(A){var ie=E(A);if(typeof ie=="function"&&ie!==A.entries)for(var ae=ie.call(A),re;!(re=ae.next()).done;)Po(re.value)&&ta(re.value,U)}}}function fh(A){{var U=A.type;if(U==null||typeof U=="string")return;var K;if(typeof U=="function")K=U.propTypes;else if(typeof U=="object"&&(U.$$typeof===s||U.$$typeof===d))K=U.propTypes;else return;if(K){var X=L(U);Qm(K,A.props,"prop",X,A)}else if(U.PropTypes!==void 0&&!Lo){Lo=!0;var ie=L(U);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ie||"Unknown")}typeof U.getDefaultProps=="function"&&!U.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dh(A){{for(var U=Object.keys(A.props),K=0;K<U.length;K++){var X=U[K];if(X!=="children"&&X!=="key"){Wt(A),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",X),Wt(null);break}}A.ref!==null&&(Wt(A),w("Invalid attribute `ref` supplied to `React.Fragment`."),Wt(null))}}var ra={};function oa(A,U,K,X,ie,ae){{var re=y(A);if(!re){var te="";(A===void 0||typeof A=="object"&&A!==null&&Object.keys(A).length===0)&&(te+=" 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 Oe=uh();Oe?te+=Oe:te+=Jl();var pe;A===null?pe="null":To(A)?pe="array":A!==void 0&&A.$$typeof===t?(pe="<"+(L(A.type)||"Unknown")+" />",te=" Did you accidentally export a JSX literal instead of a component?"):pe=typeof A,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",pe,te)}var me=ah(A,U,K,ie,ae);if(me==null)return me;if(re){var He=U.children;if(He!==void 0)if(X)if(To(He)){for(var Ut=0;Ut<He.length;Ut++)na(He[Ut],A);Object.freeze&&Object.freeze(He)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else na(He,A)}if(an.call(U,"key")){var Dt=L(A),Ae=Object.keys(U).filter(function(bh){return bh!=="key"}),Do=Ae.length>0?"{key: someKey, "+Ae.join(": ..., ")+": ...}":"{key: someKey}";if(!ra[Dt+Do]){var vh=Ae.length>0?"{"+Ae.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+Y+">.")}return q}}function G0(R,q){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var Y=OP(q);if(V0[Y])return;V0[Y]=!0;var te="";R&&R._owner&&R._owner!==Jc.current&&(te=" It was passed a child from "+P(R._owner.type)+"."),Pr(R),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,te),Pr(null)}}function q0(R,q){{if(typeof R!="object")return;if(Qc(R))for(var Y=0;Y<R.length;Y++){var te=R[Y];tu(te)&&G0(te,q)}else if(tu(R))R._store&&(R._store.validated=!0);else if(R){var he=v(R);if(typeof he=="function"&&he!==R.entries)for(var me=he.call(R),le;!(le=me.next()).done;)tu(le.value)&&G0(le.value,q)}}}function NP(R){{var q=R.type;if(q==null||typeof q=="string")return;var Y;if(typeof q=="function")Y=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===f))Y=q.propTypes;else return;if(Y){var te=P(q);Xs(Y,R.props,"prop",te,R)}else if(q.PropTypes!==void 0&&!eu){eu=!0;var he=P(q);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",he||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function IP(R){{for(var q=Object.keys(R.props),Y=0;Y<q.length;Y++){var te=q[Y];if(te!=="children"&&te!=="key"){Pr(R),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",te),Pr(null);break}}R.ref!==null&&(Pr(R),b("Invalid attribute `ref` supplied to `React.Fragment`."),Pr(null))}}var Z0={};function K0(R,q,Y,te,he,me){{var le=A(R);if(!le){var ae="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(ae+=" 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 De=CP();De?ae+=De:ae+=H0();var Se;R===null?Se="null":Qc(R)?Se="array":R!==void 0&&R.$$typeof===t?(Se="<"+(P(R.type)||"Unknown")+" />",ae=" Did you accidentally export a JSX literal instead of a component?"):Se=typeof R,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Se,ae)}var Pe=TP(R,q,Y,he,me);if(Pe==null)return Pe;if(le){var ft=q.children;if(ft!==void 0)if(te)if(Qc(ft)){for(var $r=0;$r<ft.length;$r++)q0(ft[$r],R);Object.freeze&&Object.freeze(ft)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else q0(ft,R)}if(Le.call(q,"key")){var Hn=P(R),qe=Object.keys(q).filter(function(FP){return FP!=="key"}),nu=qe.length>0?"{key: someKey, "+qe.join(": ..., ")+": ...}":"{key: someKey}";if(!Z0[Hn+nu]){var RP=qe.length>0?"{"+qe.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,Do,Dt,vh,Dt),ra[Dt+Do]=!0}}return A===r?dh(me):fh(me),me}}function ph(A,U,K){return oa(A,U,K,!0)}function mh(A,U,K){return oa(A,U,K,!1)}var hh=mh,gh=ph;Ht.Fragment=r,Ht.jsx=hh,Ht.jsxs=gh}()),Ht}process.env.NODE_ENV==="production"?Zn.exports=la():Zn.exports=aa();var S=Zn.exports;const ua={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
- 充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"您可以在约 {{v}} 分钟 (达到 {{v1}} 个区块确认后) 提走已到账的资金",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以提取的最大金额。当 available 为0或负数时,不允许提现。",noPrivateKeyWalletWarning:"暂不支持无私钥钱包充值。若您是无私钥钱包,请勿进行充值。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不合法"}},ca={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
32
- If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"You can withdraw the arrived funds in approximately {{v}} minutes (after reaching {{v1}} block confirmations)",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"Max. amount you can withdraw. When the available amount shown is 0 or negative, you are not allowed to make withdrawals.",noPrivateKeyWalletWarning:"Deposits from wallets without private keys are not supported at the moment. If you are using such a wallet, please do not make a deposit.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositButton:"Deposit with LayerZero"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Invalid receiver address"}},fa={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
33
- 入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"{{v1}} ブロック確認後、おおよそ {{v}} 分以内に引き出し可能となります",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"出金可能な最大金額です。 available が0またはマイナスの場合、出金は行えません。",noPrivateKeyWalletWarning:"現在、秘密鍵のないウォレットからの入金はサポートされていません。該当ウォレットをご利用の場合は、入金しないでください。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"無効な受け取りアドレス"}},da={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
34
- Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Вы сможете вывести поступившие средства примерно через {{v}} минут (после {{v1}} подтверждений в блокчейне)",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма для вывода. Если доступная сумма равна 0 или меньше, вывод невозможен.",noPrivateKeyWalletWarning:"В настоящее время пополнение кошельков без приватных ключей не поддерживается. Если у вас такой кошелёк, пожалуйста, не выполняйте пополнение.",layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Неверный адрес получателя"}},pa={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
35
- 充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"您可以在約 {{v}} 分鐘 (達到 {{v1}} 個區塊確認後) 提走已到帳的資金",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以提取的最大金額。當 available 爲0或負數時,不允許提現。",noPrivateKeyWalletWarning:"暫不支援無私鑰錢包充值。若您使用的是無私鑰錢包,請勿進行充值。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不合法"}},Jn=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],Io={"en-US":ca,"ja-JP":fa,"ru-RU":da,"zh-CN":ua,"zh-TW":pa},un="en-US",ma={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},ha=e=>Jn.includes(e)?Io[e]:Io[un],ga=e=>Jn.includes(e),jo=m.createContext(null),va=({config:e,children:t})=>{const n=m.useMemo(()=>{const r=e.locale||un,o=ga(r)?r:un,i=ha(o);return{...e,currentLocale:o,translations:i}},[e]);return S.jsx(jo.Provider,{value:n,children:t})},Fo=()=>{const e=m.useContext(jo);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var ba=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,er=Math.ceil,je=Math.floor,Te="[BigNumber Error] ",Ro=Te+"Number primitive has more than 15 significant digits: ",Ge=1e14,Q=14,tr=9007199254740991,nr=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ht=1e7,ve=1e9;function ko(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},i=new w(1),l=20,u=4,s=-7,a=21,c=-1e7,d=1e7,p=!1,f=1,g=0,v={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz",M=!0;function w(h,b){var y,$,D,L,C,O,T,P,x=this;if(!(x instanceof w))return new w(h,b);if(b==null){if(h&&h._isBigNumber===!0){x.s=h.s,!h.c||h.e>d?x.c=x.e=null:h.e<c?x.c=[x.e=0]:(x.e=h.e,x.c=h.c.slice());return}if((O=typeof h=="number")&&h*0==0){if(x.s=1/h<0?(h=-h,-1):1,h===~~h){for(L=0,C=h;C>=10;C/=10,L++);L>d?x.c=x.e=null:(x.e=L,x.c=[h]);return}P=String(h)}else{if(!ba.test(P=String(h)))return r(x,P,O);x.s=P.charCodeAt(0)==45?(P=P.slice(1),-1):1}(L=P.indexOf("."))>-1&&(P=P.replace(".","")),(C=P.search(/e/i))>0?(L<0&&(L=C),L+=+P.slice(C+1),P=P.substring(0,C)):L<0&&(L=P.length)}else{if(ce(b,2,E.length,"Base"),b==10&&M)return x=new w(h),k(x,l+x.e+1,u);if(P=String(h),O=typeof h=="number"){if(h*0!=0)return r(x,P,O,b);if(x.s=1/h<0?(P=P.slice(1),-1):1,w.DEBUG&&P.replace(/^0\.0*|\./,"").length>15)throw Error(Ro+h)}else x.s=P.charCodeAt(0)===45?(P=P.slice(1),-1):1;for(y=E.slice(0,b),L=C=0,T=P.length;C<T;C++)if(y.indexOf($=P.charAt(C))<0){if($=="."){if(C>L){L=T;continue}}else if(!D&&(P==P.toUpperCase()&&(P=P.toLowerCase())||P==P.toLowerCase()&&(P=P.toUpperCase()))){D=!0,C=-1,L=0;continue}return r(x,String(h),O,b)}O=!1,P=n(P,b,10,x.s),(L=P.indexOf("."))>-1?P=P.replace(".",""):L=P.length}for(C=0;P.charCodeAt(C)===48;C++);for(T=P.length;P.charCodeAt(--T)===48;);if(P=P.slice(C,++T)){if(T-=C,O&&w.DEBUG&&T>15&&(h>tr||h!==je(h)))throw Error(Ro+x.s*h);if((L=L-C-1)>d)x.c=x.e=null;else if(L<c)x.c=[x.e=0];else{if(x.e=L,x.c=[],C=(L+1)%Q,L<0&&(C+=Q),C<T){for(C&&x.c.push(+P.slice(0,C)),T-=Q;C<T;)x.c.push(+P.slice(C,C+=Q));C=Q-(P=P.slice(C)).length}else C-=T;for(;C--;P+="0");x.c.push(+P)}}else x.c=[x.e=0]}w.clone=ko,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(h){var b,y;if(h!=null)if(typeof h=="object"){if(h.hasOwnProperty(b="DECIMAL_PLACES")&&(y=h[b],ce(y,0,ve,b),l=y),h.hasOwnProperty(b="ROUNDING_MODE")&&(y=h[b],ce(y,0,8,b),u=y),h.hasOwnProperty(b="EXPONENTIAL_AT")&&(y=h[b],y&&y.pop?(ce(y[0],-ve,0,b),ce(y[1],0,ve,b),s=y[0],a=y[1]):(ce(y,-ve,ve,b),s=-(a=y<0?-y:y))),h.hasOwnProperty(b="RANGE"))if(y=h[b],y&&y.pop)ce(y[0],-ve,-1,b),ce(y[1],1,ve,b),c=y[0],d=y[1];else if(ce(y,-ve,ve,b),y)c=-(d=y<0?-y:y);else throw Error(Te+b+" cannot be zero: "+y);if(h.hasOwnProperty(b="CRYPTO"))if(y=h[b],y===!!y)if(y)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=y;else throw p=!y,Error(Te+"crypto unavailable");else p=y;else throw Error(Te+b+" not true or false: "+y);if(h.hasOwnProperty(b="MODULO_MODE")&&(y=h[b],ce(y,0,9,b),f=y),h.hasOwnProperty(b="POW_PRECISION")&&(y=h[b],ce(y,0,ve,b),g=y),h.hasOwnProperty(b="FORMAT"))if(y=h[b],typeof y=="object")v=y;else throw Error(Te+b+" not an object: "+y);if(h.hasOwnProperty(b="ALPHABET"))if(y=h[b],typeof y=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(y))M=y.slice(0,10)=="0123456789",E=y;else throw Error(Te+b+" invalid: "+y)}else throw Error(Te+"Object expected: "+h);return{DECIMAL_PLACES:l,ROUNDING_MODE:u,EXPONENTIAL_AT:[s,a],RANGE:[c,d],CRYPTO:p,MODULO_MODE:f,POW_PRECISION:g,FORMAT:v,ALPHABET:E}},w.isBigNumber=function(h){if(!h||h._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var b,y,$=h.c,D=h.e,L=h.s;e:if({}.toString.call($)=="[object Array]"){if((L===1||L===-1)&&D>=-ve&&D<=ve&&D===je(D)){if($[0]===0){if(D===0&&$.length===1)return!0;break e}if(b=(D+1)%Q,b<1&&(b+=Q),String($[0]).length==b){for(b=0;b<$.length;b++)if(y=$[b],y<0||y>=Ge||y!==je(y))break e;if(y!==0)return!0}}}else if($===null&&D===null&&(L===null||L===1||L===-1))return!0;throw Error(Te+"Invalid BigNumber: "+h)},w.maximum=w.max=function(){return F(arguments,-1)},w.minimum=w.min=function(){return F(arguments,1)},w.random=function(){var h=9007199254740992,b=Math.random()*h&2097151?function(){return je(Math.random()*h)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(y){var $,D,L,C,O,T=0,P=[],x=new w(i);if(y==null?y=l:ce(y,0,ve),C=er(y/Q),p)if(crypto.getRandomValues){for($=crypto.getRandomValues(new Uint32Array(C*=2));T<C;)O=$[T]*131072+($[T+1]>>>11),O>=9e15?(D=crypto.getRandomValues(new Uint32Array(2)),$[T]=D[0],$[T+1]=D[1]):(P.push(O%1e14),T+=2);T=C/2}else if(crypto.randomBytes){for($=crypto.randomBytes(C*=7);T<C;)O=($[T]&31)*281474976710656+$[T+1]*1099511627776+$[T+2]*4294967296+$[T+3]*16777216+($[T+4]<<16)+($[T+5]<<8)+$[T+6],O>=9e15?crypto.randomBytes(7).copy($,T):(P.push(O%1e14),T+=7);T=C/7}else throw p=!1,Error(Te+"crypto unavailable");if(!p)for(;T<C;)O=b(),O<9e15&&(P[T++]=O%1e14);for(C=P[--T],y%=Q,C&&y&&(O=nr[Q-y],P[T]=je(C/O)*O);P[T]===0;P.pop(),T--);if(T<0)P=[L=0];else{for(L=-1;P[0]===0;P.splice(0,1),L-=Q);for(T=1,O=P[0];O>=10;O/=10,T++);T<Q&&(L-=Q-T)}return x.e=L,x.c=P,x}}(),w.sum=function(){for(var h=1,b=arguments,y=new w(b[0]);h<b.length;)y=y.plus(b[h++]);return y},n=function(){var h="0123456789";function b(y,$,D,L){for(var C,O=[0],T,P=0,x=y.length;P<x;){for(T=O.length;T--;O[T]*=$);for(O[0]+=L.indexOf(y.charAt(P++)),C=0;C<O.length;C++)O[C]>D-1&&(O[C+1]==null&&(O[C+1]=0),O[C+1]+=O[C]/D|0,O[C]%=D)}return O.reverse()}return function(y,$,D,L,C){var O,T,P,x,I,_,V,W,Y=y.indexOf("."),q=l,G=u;for(Y>=0&&(x=g,g=0,y=y.replace(".",""),W=new w($),_=W.pow(y.length-Y),g=x,W.c=b(st(Re(_.c),_.e,"0"),10,D,h),W.e=W.c.length),V=b(y,$,D,C?(O=E,h):(O=h,E)),P=x=V.length;V[--x]==0;V.pop());if(!V[0])return O.charAt(0);if(Y<0?--P:(_.c=V,_.e=P,_.s=L,_=t(_,W,q,G,D),V=_.c,I=_.r,P=_.e),T=P+q+1,Y=V[T],x=D/2,I=I||T<0||V[T+1]!=null,I=G<4?(Y!=null||I)&&(G==0||G==(_.s<0?3:2)):Y>x||Y==x&&(G==4||I||G==6&&V[T-1]&1||G==(_.s<0?8:7)),T<1||!V[0])y=I?st(O.charAt(1),-q,O.charAt(0)):O.charAt(0);else{if(V.length=T,I)for(--D;++V[--T]>D;)V[T]=0,T||(++P,V=[1].concat(V));for(x=V.length;!V[--x];);for(Y=0,y="";Y<=x;y+=O.charAt(V[Y++]));y=st(y,P,O.charAt(0))}return y}}(),t=function(){function h($,D,L){var C,O,T,P,x=0,I=$.length,_=D%ht,V=D/ht|0;for($=$.slice();I--;)T=$[I]%ht,P=$[I]/ht|0,C=V*T+P*_,O=_*T+C%ht*ht+x,x=(O/L|0)+(C/ht|0)+V*P,$[I]=O%L;return x&&($=[x].concat($)),$}function b($,D,L,C){var O,T;if(L!=C)T=L>C?1:-1;else for(O=T=0;O<L;O++)if($[O]!=D[O]){T=$[O]>D[O]?1:-1;break}return T}function y($,D,L,C){for(var O=0;L--;)$[L]-=O,O=$[L]<D[L]?1:0,$[L]=O*C+$[L]-D[L];for(;!$[0]&&$.length>1;$.splice(0,1));}return function($,D,L,C,O){var T,P,x,I,_,V,W,Y,q,G,H,z,J,se,he,$e,it,Ee=$.s==D.s?1:-1,ge=$.c,le=D.c;if(!ge||!ge[0]||!le||!le[0])return new w(!$.s||!D.s||(ge?le&&ge[0]==le[0]:!le)?NaN:ge&&ge[0]==0||!le?Ee*0:Ee/0);for(Y=new w(Ee),q=Y.c=[],P=$.e-D.e,Ee=L+P+1,O||(O=Ge,P=Fe($.e/Q)-Fe(D.e/Q),Ee=Ee/Q|0),x=0;le[x]==(ge[x]||0);x++);if(le[x]>(ge[x]||0)&&P--,Ee<0)q.push(1),I=!0;else{for(se=ge.length,$e=le.length,x=0,Ee+=2,_=je(O/(le[0]+1)),_>1&&(le=h(le,_,O),ge=h(ge,_,O),$e=le.length,se=ge.length),J=$e,G=ge.slice(0,$e),H=G.length;H<$e;G[H++]=0);it=le.slice(),it=[0].concat(it),he=le[0],le[1]>=O/2&&he++;do{if(_=0,T=b(le,G,$e,H),T<0){if(z=G[0],$e!=H&&(z=z*O+(G[1]||0)),_=je(z/he),_>1)for(_>=O&&(_=O-1),V=h(le,_,O),W=V.length,H=G.length;b(V,G,W,H)==1;)_--,y(V,$e<W?it:le,W,O),W=V.length,T=1;else _==0&&(T=_=1),V=le.slice(),W=V.length;if(W<H&&(V=[0].concat(V)),y(G,V,H,O),H=G.length,T==-1)for(;b(le,G,$e,H)<1;)_++,y(G,$e<H?it:le,H,O),H=G.length}else T===0&&(_++,G=[0]);q[x++]=_,G[0]?G[H++]=ge[J]||0:(G=[ge[J]],H=1)}while((J++<se||G[0]!=null)&&Ee--);I=G[0]!=null,q[0]||q.splice(0,1)}if(O==Ge){for(x=1,Ee=q[0];Ee>=10;Ee/=10,x++);k(Y,L+(Y.e=x+P*Q-1)+1,C,I)}else Y.e=P,Y.r=+I;return Y}}();function N(h,b,y,$){var D,L,C,O,T;if(y==null?y=u:ce(y,0,8),!h.c)return h.toString();if(D=h.c[0],C=h.e,b==null)T=Re(h.c),T=$==1||$==2&&(C<=s||C>=a)?fn(T,C):st(T,C,"0");else if(h=k(new w(h),b,y),L=h.e,T=Re(h.c),O=T.length,$==1||$==2&&(b<=L||L<=s)){for(;O<b;T+="0",O++);T=fn(T,L)}else if(b-=C+($===2&&L>C),T=st(T,L,"0"),L+1>O){if(--b>0)for(T+=".";b--;T+="0");}else if(b+=L-O,b>0)for(L+1==O&&(T+=".");b--;T+="0");return h.s<0&&D?"-"+T:T}function F(h,b){for(var y,$,D=1,L=new w(h[0]);D<h.length;D++)$=new w(h[D]),(!$.s||(y=Et(L,$))===b||y===0&&L.s===b)&&(L=$);return L}function j(h,b,y){for(var $=1,D=b.length;!b[--D];b.pop());for(D=b[0];D>=10;D/=10,$++);return(y=$+y*Q-1)>d?h.c=h.e=null:y<c?h.c=[h.e=0]:(h.e=y,h.c=b),h}r=function(){var h=/^(-?)0([xbo])(?=\w[\w.]*$)/i,b=/^([^.]+)\.$/,y=/^\.([^.]+)$/,$=/^-?(Infinity|NaN)$/,D=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(L,C,O,T){var P,x=O?C:C.replace(D,"");if($.test(x))L.s=isNaN(x)?null:x<0?-1:1;else{if(!O&&(x=x.replace(h,function(I,_,V){return P=(V=V.toLowerCase())=="x"?16:V=="b"?2:8,!T||T==P?_:I}),T&&(P=T,x=x.replace(b,"$1").replace(y,"0.$1")),C!=x))return new w(x,P);if(w.DEBUG)throw Error(Te+"Not a"+(T?" base "+T:"")+" number: "+C);L.s=null}L.c=L.e=null}}();function k(h,b,y,$){var D,L,C,O,T,P,x,I=h.c,_=nr;if(I){e:{for(D=1,O=I[0];O>=10;O/=10,D++);if(L=b-D,L<0)L+=Q,C=b,T=I[P=0],x=je(T/_[D-C-1]%10);else if(P=er((L+1)/Q),P>=I.length)if($){for(;I.length<=P;I.push(0));T=x=0,D=1,L%=Q,C=L-Q+1}else break e;else{for(T=O=I[P],D=1;O>=10;O/=10,D++);L%=Q,C=L-Q+D,x=C<0?0:je(T/_[D-C-1]%10)}if($=$||b<0||I[P+1]!=null||(C<0?T:T%_[D-C-1]),$=y<4?(x||$)&&(y==0||y==(h.s<0?3:2)):x>5||x==5&&(y==4||$||y==6&&(L>0?C>0?T/_[D-C]:0:I[P-1])%10&1||y==(h.s<0?8:7)),b<1||!I[0])return I.length=0,$?(b-=h.e+1,I[0]=_[(Q-b%Q)%Q],h.e=-b||0):I[0]=h.e=0,h;if(L==0?(I.length=P,O=1,P--):(I.length=P+1,O=_[Q-L],I[P]=C>0?je(T/_[D-C]%_[C])*O:0),$)for(;;)if(P==0){for(L=1,C=I[0];C>=10;C/=10,L++);for(C=I[0]+=O,O=1;C>=10;C/=10,O++);L!=O&&(h.e++,I[0]==Ge&&(I[0]=1));break}else{if(I[P]+=O,I[P]!=Ge)break;I[P--]=0,O=1}for(L=I.length;I[--L]===0;I.pop());}h.e>d?h.c=h.e=null:h.e<c&&(h.c=[h.e=0])}return h}function B(h){var b,y=h.e;return y===null?h.toString():(b=Re(h.c),b=y<=s||y>=a?fn(b,y):st(b,y,"0"),h.s<0?"-"+b:b)}return o.absoluteValue=o.abs=function(){var h=new w(this);return h.s<0&&(h.s=1),h},o.comparedTo=function(h,b){return Et(this,new w(h,b))},o.decimalPlaces=o.dp=function(h,b){var y,$,D,L=this;if(h!=null)return ce(h,0,ve),b==null?b=u:ce(b,0,8),k(new w(L),h+L.e+1,b);if(!(y=L.c))return null;if($=((D=y.length-1)-Fe(this.e/Q))*Q,D=y[D])for(;D%10==0;D/=10,$--);return $<0&&($=0),$},o.dividedBy=o.div=function(h,b){return t(this,new w(h,b),l,u)},o.dividedToIntegerBy=o.idiv=function(h,b){return t(this,new w(h,b),0,1)},o.exponentiatedBy=o.pow=function(h,b){var y,$,D,L,C,O,T,P,x,I=this;if(h=new w(h),h.c&&!h.isInteger())throw Error(Te+"Exponent not an integer: "+B(h));if(b!=null&&(b=new w(b)),O=h.e>14,!I.c||!I.c[0]||I.c[0]==1&&!I.e&&I.c.length==1||!h.c||!h.c[0])return x=new w(Math.pow(+B(I),O?h.s*(2-cn(h)):+B(h))),b?x.mod(b):x;if(T=h.s<0,b){if(b.c?!b.c[0]:!b.s)return new w(NaN);$=!T&&I.isInteger()&&b.isInteger(),$&&(I=I.mod(b))}else{if(h.e>9&&(I.e>0||I.e<-1||(I.e==0?I.c[0]>1||O&&I.c[1]>=24e7:I.c[0]<8e13||O&&I.c[0]<=9999975e7)))return L=I.s<0&&cn(h)?-0:0,I.e>-1&&(L=1/L),new w(T?1/L:L);g&&(L=er(g/Q+2))}for(O?(y=new w(.5),T&&(h.s=1),P=cn(h)):(D=Math.abs(+B(h)),P=D%2),x=new w(i);;){if(P){if(x=x.times(I),!x.c)break;L?x.c.length>L&&(x.c.length=L):$&&(x=x.mod(b))}if(D){if(D=je(D/2),D===0)break;P=D%2}else if(h=h.times(y),k(h,h.e+1,1),h.e>14)P=cn(h);else{if(D=+B(h),D===0)break;P=D%2}I=I.times(I),L?I.c&&I.c.length>L&&(I.c.length=L):$&&(I=I.mod(b))}return $?x:(T&&(x=i.div(x)),b?x.mod(b):L?k(x,g,u,C):x)},o.integerValue=function(h){var b=new w(this);return h==null?h=u:ce(h,0,8),k(b,b.e+1,h)},o.isEqualTo=o.eq=function(h,b){return Et(this,new w(h,b))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(h,b){return Et(this,new w(h,b))>0},o.isGreaterThanOrEqualTo=o.gte=function(h,b){return(b=Et(this,new w(h,b)))===1||b===0},o.isInteger=function(){return!!this.c&&Fe(this.e/Q)>this.c.length-2},o.isLessThan=o.lt=function(h,b){return Et(this,new w(h,b))<0},o.isLessThanOrEqualTo=o.lte=function(h,b){return(b=Et(this,new w(h,b)))===-1||b===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(h,b){var y,$,D,L,C=this,O=C.s;if(h=new w(h,b),b=h.s,!O||!b)return new w(NaN);if(O!=b)return h.s=-b,C.plus(h);var T=C.e/Q,P=h.e/Q,x=C.c,I=h.c;if(!T||!P){if(!x||!I)return x?(h.s=-b,h):new w(I?C:NaN);if(!x[0]||!I[0])return I[0]?(h.s=-b,h):new w(x[0]?C:u==3?-0:0)}if(T=Fe(T),P=Fe(P),x=x.slice(),O=T-P){for((L=O<0)?(O=-O,D=x):(P=T,D=I),D.reverse(),b=O;b--;D.push(0));D.reverse()}else for($=(L=(O=x.length)<(b=I.length))?O:b,O=b=0;b<$;b++)if(x[b]!=I[b]){L=x[b]<I[b];break}if(L&&(D=x,x=I,I=D,h.s=-h.s),b=($=I.length)-(y=x.length),b>0)for(;b--;x[y++]=0);for(b=Ge-1;$>O;){if(x[--$]<I[$]){for(y=$;y&&!x[--y];x[y]=b);--x[y],x[$]+=Ge}x[$]-=I[$]}for(;x[0]==0;x.splice(0,1),--P);return x[0]?j(h,x,P):(h.s=u==3?-1:1,h.c=[h.e=0],h)},o.modulo=o.mod=function(h,b){var y,$,D=this;return h=new w(h,b),!D.c||!h.s||h.c&&!h.c[0]?new w(NaN):!h.c||D.c&&!D.c[0]?new w(D):(f==9?($=h.s,h.s=1,y=t(D,h,0,3),h.s=$,y.s*=$):y=t(D,h,0,f),h=D.minus(y.times(h)),!h.c[0]&&f==1&&(h.s=D.s),h)},o.multipliedBy=o.times=function(h,b){var y,$,D,L,C,O,T,P,x,I,_,V,W,Y,q,G=this,H=G.c,z=(h=new w(h,b)).c;if(!H||!z||!H[0]||!z[0])return!G.s||!h.s||H&&!H[0]&&!z||z&&!z[0]&&!H?h.c=h.e=h.s=null:(h.s*=G.s,!H||!z?h.c=h.e=null:(h.c=[0],h.e=0)),h;for($=Fe(G.e/Q)+Fe(h.e/Q),h.s*=G.s,T=H.length,I=z.length,T<I&&(W=H,H=z,z=W,D=T,T=I,I=D),D=T+I,W=[];D--;W.push(0));for(Y=Ge,q=ht,D=I;--D>=0;){for(y=0,_=z[D]%q,V=z[D]/q|0,C=T,L=D+C;L>D;)P=H[--C]%q,x=H[C]/q|0,O=V*P+x*_,P=_*P+O%q*q+W[L]+y,y=(P/Y|0)+(O/q|0)+V*x,W[L--]=P%Y;W[L]=y}return y?++$:W.splice(0,1),j(h,W,$)},o.negated=function(){var h=new w(this);return h.s=-h.s||null,h},o.plus=function(h,b){var y,$=this,D=$.s;if(h=new w(h,b),b=h.s,!D||!b)return new w(NaN);if(D!=b)return h.s=-b,$.minus(h);var L=$.e/Q,C=h.e/Q,O=$.c,T=h.c;if(!L||!C){if(!O||!T)return new w(D/0);if(!O[0]||!T[0])return T[0]?h:new w(O[0]?$:D*0)}if(L=Fe(L),C=Fe(C),O=O.slice(),D=L-C){for(D>0?(C=L,y=T):(D=-D,y=O),y.reverse();D--;y.push(0));y.reverse()}for(D=O.length,b=T.length,D-b<0&&(y=T,T=O,O=y,b=D),D=0;b;)D=(O[--b]=O[b]+T[b]+D)/Ge|0,O[b]=Ge===O[b]?0:O[b]%Ge;return D&&(O=[D].concat(O),++C),j(h,O,C)},o.precision=o.sd=function(h,b){var y,$,D,L=this;if(h!=null&&h!==!!h)return ce(h,1,ve),b==null?b=u:ce(b,0,8),k(new w(L),h,b);if(!(y=L.c))return null;if(D=y.length-1,$=D*Q+1,D=y[D]){for(;D%10==0;D/=10,$--);for(D=y[0];D>=10;D/=10,$++);}return h&&L.e+1>$&&($=L.e+1),$},o.shiftedBy=function(h){return ce(h,-tr,tr),this.times("1e"+h)},o.squareRoot=o.sqrt=function(){var h,b,y,$,D,L=this,C=L.c,O=L.s,T=L.e,P=l+4,x=new w("0.5");if(O!==1||!C||!C[0])return new w(!O||O<0&&(!C||C[0])?NaN:C?L:1/0);if(O=Math.sqrt(+B(L)),O==0||O==1/0?(b=Re(C),(b.length+T)%2==0&&(b+="0"),O=Math.sqrt(+b),T=Fe((T+1)/2)-(T<0||T%2),O==1/0?b="5e"+T:(b=O.toExponential(),b=b.slice(0,b.indexOf("e")+1)+T),y=new w(b)):y=new w(O+""),y.c[0]){for(T=y.e,O=T+P,O<3&&(O=0);;)if(D=y,y=x.times(D.plus(t(L,D,P,1))),Re(D.c).slice(0,O)===(b=Re(y.c)).slice(0,O))if(y.e<T&&--O,b=b.slice(O-3,O+1),b=="9999"||!$&&b=="4999"){if(!$&&(k(D,D.e+l+2,0),D.times(D).eq(L))){y=D;break}P+=4,O+=4,$=1}else{(!+b||!+b.slice(1)&&b.charAt(0)=="5")&&(k(y,y.e+l+2,1),h=!y.times(y).eq(L));break}}return k(y,y.e+l+1,u,h)},o.toExponential=function(h,b){return h!=null&&(ce(h,0,ve),h++),N(this,h,b,1)},o.toFixed=function(h,b){return h!=null&&(ce(h,0,ve),h=h+this.e+1),N(this,h,b)},o.toFormat=function(h,b,y){var $,D=this;if(y==null)h!=null&&b&&typeof b=="object"?(y=b,b=null):h&&typeof h=="object"?(y=h,h=b=null):y=v;else if(typeof y!="object")throw Error(Te+"Argument not an object: "+y);if($=D.toFixed(h,b),D.c){var L,C=$.split("."),O=+y.groupSize,T=+y.secondaryGroupSize,P=y.groupSeparator||"",x=C[0],I=C[1],_=D.s<0,V=_?x.slice(1):x,W=V.length;if(T&&(L=O,O=T,T=L,W-=L),O>0&&W>0){for(L=W%O||O,x=V.substr(0,L);L<W;L+=O)x+=P+V.substr(L,O);T>0&&(x+=P+V.slice(L)),_&&(x="-"+x)}$=I?x+(y.decimalSeparator||"")+((T=+y.fractionGroupSize)?I.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(y.fractionGroupSeparator||"")):I):x}return(y.prefix||"")+$+(y.suffix||"")},o.toFraction=function(h){var b,y,$,D,L,C,O,T,P,x,I,_,V=this,W=V.c;if(h!=null&&(O=new w(h),!O.isInteger()&&(O.c||O.s!==1)||O.lt(i)))throw Error(Te+"Argument "+(O.isInteger()?"out of range: ":"not an integer: ")+B(O));if(!W)return new w(V);for(b=new w(i),P=y=new w(i),$=T=new w(i),_=Re(W),L=b.e=_.length-V.e-1,b.c[0]=nr[(C=L%Q)<0?Q+C:C],h=!h||O.comparedTo(b)>0?L>0?b:P:O,C=d,d=1/0,O=new w(_),T.c[0]=0;x=t(O,b,0,1),D=y.plus(x.times($)),D.comparedTo(h)!=1;)y=$,$=D,P=T.plus(x.times(D=P)),T=D,b=O.minus(x.times(D=b)),O=D;return D=t(h.minus(y),$,0,1),T=T.plus(D.times(P)),y=y.plus(D.times($)),T.s=P.s=V.s,L=L*2,I=t(P,$,L,u).minus(V).abs().comparedTo(t(T,y,L,u).minus(V).abs())<1?[P,$]:[T,y],d=C,I},o.toNumber=function(){return+B(this)},o.toPrecision=function(h,b){return h!=null&&ce(h,1,ve),N(this,h,b,2)},o.toString=function(h){var b,y=this,$=y.s,D=y.e;return D===null?$?(b="Infinity",$<0&&(b="-"+b)):b="NaN":(h==null?b=D<=s||D>=a?fn(Re(y.c),D):st(Re(y.c),D,"0"):h===10&&M?(y=k(new w(y),l+D+1,u),b=st(Re(y.c),y.e,"0")):(ce(h,2,E.length,"Base"),b=n(st(Re(y.c),D,"0"),10,h,$,!0)),$<0&&y.c[0]&&(b="-"+b)),b},o.valueOf=o.toJSON=function(){return B(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}function Fe(e){var t=e|0;return e>0||e===t?t:t-1}function Re(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=Q-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function Et(e,t){var n,r,o=e.c,i=t.c,l=e.s,u=t.s,s=e.e,a=t.e;if(!l||!u)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-u:l;if(l!=u)return l;if(n=l<0,r=s==a,!o||!i)return r?0:!o^n?1:-1;if(!r)return s>a^n?1:-1;for(u=(s=o.length)<(a=i.length)?s:a,l=0;l<u;l++)if(o[l]!=i[l])return o[l]>i[l]^n?1:-1;return s==a?0:s>a^n?1:-1}function ce(e,t,n,r){if(e<t||e>n||e!==je(e))throw Error(Te+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function cn(e){var t=e.c.length-1;return Fe(e.e/Q)==t&&e.c[t]%2!=0}function fn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function st(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 xe=ko();const ya=(e,t=6)=>{try{const n=new xe(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,xe.ROUND_DOWN),[o,i=""]=r.toString().split("."),l=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const u=(i||"").padEnd(t,"0");return`${l}.${u}`}return l}catch(n){return console.warn("formatThousands error:",n),"0"}},Ye=()=>{const{translations:e,currentLocale:t}=Fo();return{t:(i,l)=>{try{const u=i.split(".");let s=e;for(const c of u)if(s&&typeof s=="object"&&c in s)s=s[c];else return i;let a=typeof s=="string"?s:i;return l&&typeof a=="string"&&Object.keys(l).forEach(c=>{const d=`{{${c}}}`;a=a.replace(new RegExp(d,"g"),String(l[c]))}),a}catch(u){return console.warn(`Translation error for key "${i}":`,u),i}},translations:e,locale:t,getTranslationObject:i=>{try{const l=i.split(".");let u=e;for(const s of l)if(u&&typeof u=="object"&&s in u)u=u[s];else return{};return typeof u=="object"?u:{}}catch(l){return console.warn(`Translation object error for key "${i}":`,l),{}}},hasTranslation:i=>{try{const l=i.split(".");let u=e;for(const s of l)if(u&&typeof u=="object"&&s in u)u=u[s];else return!1;return typeof u=="string"}catch{return!1}}}},xa=()=>({openDeposit:m.useCallback(t=>{},[])}),wa=()=>({openWithdraw:m.useCallback(t=>{},[])});/**
30
+ <%s key={someKey} {...props} />`,nu,Hn,RP,Hn),Z0[Hn+nu]=!0}}return R===r?IP(Pe):NP(Pe),Pe}}function MP(R,q,Y){return K0(R,q,Y,!0)}function LP(R,q,Y){return K0(R,q,Y,!1)}var BP=LP,kP=MP;Cr.Fragment=r,Cr.jsx=BP,Cr.jsxs=kP}()),Cr}process.env.NODE_ENV==="production"?Qs.exports=Q0():Qs.exports=J0();var M=Qs.exports;const em={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
+ 充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"您可以在约 {{v}} 分钟 (达到 {{v1}} 个区块确认后) 提走已到账的资金",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以提取的最大金额。当 available 为0或负数时,不允许提现。",noPrivateKeyWalletWarning:"暂不支持无私钥钱包充值。若您是无私钥钱包,请勿进行充值。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不合法"}},tm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
32
+ If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"You can withdraw the arrived funds in approximately {{v}} minutes (after reaching {{v1}} block confirmations)",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"Max. amount you can withdraw. When the available amount shown is 0 or negative, you are not allowed to make withdrawals.",noPrivateKeyWalletWarning:"Deposits from wallets without private keys are not supported at the moment. If you are using such a wallet, please do not make a deposit.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Invalid receiver address"}},nm={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
33
+ 入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"{{v1}} ブロック確認後、おおよそ {{v}} 分以内に引き出し可能となります",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"出金可能な最大金額です。 available が0またはマイナスの場合、出金は行えません。",noPrivateKeyWalletWarning:"現在、秘密鍵のないウォレットからの入金はサポートされていません。該当ウォレットをご利用の場合は、入金しないでください。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"無効な受け取りアドレス"}},rm={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
34
+ Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Вы сможете вывести поступившие средства примерно через {{v}} минут (после {{v1}} подтверждений в блокчейне)",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма для вывода. Если доступная сумма равна 0 или меньше, вывод невозможен.",noPrivateKeyWalletWarning:"В настоящее время пополнение кошельков без приватных ключей не поддерживается. Если у вас такой кошелёк, пожалуйста, не выполняйте пополнение.",layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Неверный адрес получателя"}},om={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
35
+ 充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"您可以在約 {{v}} 分鐘 (達到 {{v1}} 個區塊確認後) 提走已到帳的資金",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以提取的最大金額。當 available 爲0或負數時,不允許提現。",noPrivateKeyWalletWarning:"暫不支援無私鑰錢包充值。若您使用的是無私鑰錢包,請勿進行充值。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不合法"}},Js=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],cu={"en-US":tm,"ja-JP":nm,"ru-RU":rm,"zh-CN":em,"zh-TW":om},Io="en-US",sm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},im=e=>Js.includes(e)?cu[e]:cu[Io],am=e=>Js.includes(e),uu=S.createContext(null),cm=({config:e,children:t})=>{const n=S.useMemo(()=>{const r=e.locale||Io,o=am(r)?r:Io,s=im(o);return{...e,currentLocale:o,translations:s}},[e]);return M.jsx(uu.Provider,{value:n,children:t})},lu=()=>{const e=S.useContext(uu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var um=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ei=Math.ceil,Qe=Math.floor,je="[BigNumber Error] ",fu=je+"Number primitive has more than 15 significant digits: ",dt=1e14,ne=14,ti=9007199254740991,ni=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],un=1e7,Te=1e9;function du(e){var t,n,r,o=b.prototype={constructor:b,toString:null,valueOf:null},s=new b(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},v="0123456789abcdefghijklmnopqrstuvwxyz",C=!0;function b(g,w){var A,I,N,P,E,x,T,O,y=this;if(!(y instanceof b))return new b(g,w);if(w==null){if(g&&g._isBigNumber===!0){y.s=g.s,!g.c||g.e>f?y.c=y.e=null:g.e<l?y.c=[y.e=0]:(y.e=g.e,y.c=g.c.slice());return}if((x=typeof g=="number")&&g*0==0){if(y.s=1/g<0?(g=-g,-1):1,g===~~g){for(P=0,E=g;E>=10;E/=10,P++);P>f?y.c=y.e=null:(y.e=P,y.c=[g]);return}O=String(g)}else{if(!um.test(O=String(g)))return r(y,O,x);y.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(P=O.indexOf("."))>-1&&(O=O.replace(".","")),(E=O.search(/e/i))>0?(P<0&&(P=E),P+=+O.slice(E+1),O=O.substring(0,E)):P<0&&(P=O.length)}else{if(ye(w,2,v.length,"Base"),w==10&&C)return y=new b(g),D(y,i+y.e+1,c);if(O=String(g),x=typeof g=="number"){if(g*0!=0)return r(y,O,x,w);if(y.s=1/g<0?(O=O.slice(1),-1):1,b.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(fu+g)}else y.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(A=v.slice(0,w),P=E=0,T=O.length;E<T;E++)if(A.indexOf(I=O.charAt(E))<0){if(I=="."){if(E>P){P=T;continue}}else if(!N&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){N=!0,E=-1,P=0;continue}return r(y,String(g),x,w)}x=!1,O=n(O,w,10,y.s),(P=O.indexOf("."))>-1?O=O.replace(".",""):P=O.length}for(E=0;O.charCodeAt(E)===48;E++);for(T=O.length;O.charCodeAt(--T)===48;);if(O=O.slice(E,++T)){if(T-=E,x&&b.DEBUG&&T>15&&(g>ti||g!==Qe(g)))throw Error(fu+y.s*g);if((P=P-E-1)>f)y.c=y.e=null;else if(P<l)y.c=[y.e=0];else{if(y.e=P,y.c=[],E=(P+1)%ne,P<0&&(E+=ne),E<T){for(E&&y.c.push(+O.slice(0,E)),T-=ne;E<T;)y.c.push(+O.slice(E,E+=ne));E=ne-(O=O.slice(E)).length}else E-=T;for(;E--;O+="0");y.c.push(+O)}}else y.c=[y.e=0]}b.clone=du,b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.EUCLID=9,b.config=b.set=function(g){var w,A;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(w="DECIMAL_PLACES")&&(A=g[w],ye(A,0,Te,w),i=A),g.hasOwnProperty(w="ROUNDING_MODE")&&(A=g[w],ye(A,0,8,w),c=A),g.hasOwnProperty(w="EXPONENTIAL_AT")&&(A=g[w],A&&A.pop?(ye(A[0],-Te,0,w),ye(A[1],0,Te,w),a=A[0],u=A[1]):(ye(A,-Te,Te,w),a=-(u=A<0?-A:A))),g.hasOwnProperty(w="RANGE"))if(A=g[w],A&&A.pop)ye(A[0],-Te,-1,w),ye(A[1],1,Te,w),l=A[0],f=A[1];else if(ye(A,-Te,Te,w),A)l=-(f=A<0?-A:A);else throw Error(je+w+" cannot be zero: "+A);if(g.hasOwnProperty(w="CRYPTO"))if(A=g[w],A===!!A)if(A)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=A;else throw p=!A,Error(je+"crypto unavailable");else p=A;else throw Error(je+w+" not true or false: "+A);if(g.hasOwnProperty(w="MODULO_MODE")&&(A=g[w],ye(A,0,9,w),d=A),g.hasOwnProperty(w="POW_PRECISION")&&(A=g[w],ye(A,0,Te,w),h=A),g.hasOwnProperty(w="FORMAT"))if(A=g[w],typeof A=="object")m=A;else throw Error(je+w+" not an object: "+A);if(g.hasOwnProperty(w="ALPHABET"))if(A=g[w],typeof A=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(A))C=A.slice(0,10)=="0123456789",v=A;else throw Error(je+w+" invalid: "+A)}else throw Error(je+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:v}},b.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!b.DEBUG)return!0;var w,A,I=g.c,N=g.e,P=g.s;e:if({}.toString.call(I)=="[object Array]"){if((P===1||P===-1)&&N>=-Te&&N<=Te&&N===Qe(N)){if(I[0]===0){if(N===0&&I.length===1)return!0;break e}if(w=(N+1)%ne,w<1&&(w+=ne),String(I[0]).length==w){for(w=0;w<I.length;w++)if(A=I[w],A<0||A>=dt||A!==Qe(A))break e;if(A!==0)return!0}}}else if(I===null&&N===null&&(P===null||P===1||P===-1))return!0;throw Error(je+"Invalid BigNumber: "+g)},b.maximum=b.max=function(){return B(arguments,-1)},b.minimum=b.min=function(){return B(arguments,1)},b.random=function(){var g=9007199254740992,w=Math.random()*g&2097151?function(){return Qe(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var I,N,P,E,x,T=0,O=[],y=new b(s);if(A==null?A=i:ye(A,0,Te),E=ei(A/ne),p)if(crypto.getRandomValues){for(I=crypto.getRandomValues(new Uint32Array(E*=2));T<E;)x=I[T]*131072+(I[T+1]>>>11),x>=9e15?(N=crypto.getRandomValues(new Uint32Array(2)),I[T]=N[0],I[T+1]=N[1]):(O.push(x%1e14),T+=2);T=E/2}else if(crypto.randomBytes){for(I=crypto.randomBytes(E*=7);T<E;)x=(I[T]&31)*281474976710656+I[T+1]*1099511627776+I[T+2]*4294967296+I[T+3]*16777216+(I[T+4]<<16)+(I[T+5]<<8)+I[T+6],x>=9e15?crypto.randomBytes(7).copy(I,T):(O.push(x%1e14),T+=7);T=E/7}else throw p=!1,Error(je+"crypto unavailable");if(!p)for(;T<E;)x=w(),x<9e15&&(O[T++]=x%1e14);for(E=O[--T],A%=ne,E&&A&&(x=ni[ne-A],O[T]=Qe(E/x)*x);O[T]===0;O.pop(),T--);if(T<0)O=[P=0];else{for(P=-1;O[0]===0;O.splice(0,1),P-=ne);for(T=1,x=O[0];x>=10;x/=10,T++);T<ne&&(P-=ne-T)}return y.e=P,y.c=O,y}}(),b.sum=function(){for(var g=1,w=arguments,A=new b(w[0]);g<w.length;)A=A.plus(w[g++]);return A},n=function(){var g="0123456789";function w(A,I,N,P){for(var E,x=[0],T,O=0,y=A.length;O<y;){for(T=x.length;T--;x[T]*=I);for(x[0]+=P.indexOf(A.charAt(O++)),E=0;E<x.length;E++)x[E]>N-1&&(x[E+1]==null&&(x[E+1]=0),x[E+1]+=x[E]/N|0,x[E]%=N)}return x.reverse()}return function(A,I,N,P,E){var x,T,O,y,L,F,U,z,V=A.indexOf("."),Z=i,W=c;for(V>=0&&(y=h,h=0,A=A.replace(".",""),z=new b(I),F=z.pow(A.length-V),h=y,z.c=w(_t(et(F.c),F.e,"0"),10,N,g),z.e=z.c.length),U=w(A,I,N,E?(x=v,g):(x=g,v)),O=y=U.length;U[--y]==0;U.pop());if(!U[0])return x.charAt(0);if(V<0?--O:(F.c=U,F.e=O,F.s=P,F=t(F,z,Z,W,N),U=F.c,L=F.r,O=F.e),T=O+Z+1,V=U[T],y=N/2,L=L||T<0||U[T+1]!=null,L=W<4?(V!=null||L)&&(W==0||W==(F.s<0?3:2)):V>y||V==y&&(W==4||L||W==6&&U[T-1]&1||W==(F.s<0?8:7)),T<1||!U[0])A=L?_t(x.charAt(1),-Z,x.charAt(0)):x.charAt(0);else{if(U.length=T,L)for(--N;++U[--T]>N;)U[T]=0,T||(++O,U=[1].concat(U));for(y=U.length;!U[--y];);for(V=0,A="";V<=y;A+=x.charAt(U[V++]));A=_t(A,O,x.charAt(0))}return A}}(),t=function(){function g(I,N,P){var E,x,T,O,y=0,L=I.length,F=N%un,U=N/un|0;for(I=I.slice();L--;)T=I[L]%un,O=I[L]/un|0,E=U*T+O*F,x=F*T+E%un*un+y,y=(x/P|0)+(E/un|0)+U*O,I[L]=x%P;return y&&(I=[y].concat(I)),I}function w(I,N,P,E){var x,T;if(P!=E)T=P>E?1:-1;else for(x=T=0;x<P;x++)if(I[x]!=N[x]){T=I[x]>N[x]?1:-1;break}return T}function A(I,N,P,E){for(var x=0;P--;)I[P]-=x,x=I[P]<N[P]?1:0,I[P]=x*E+I[P]-N[P];for(;!I[0]&&I.length>1;I.splice(0,1));}return function(I,N,P,E,x){var T,O,y,L,F,U,z,V,Z,W,K,G,X,ee,fe,xe,oe,ue=I.s==N.s?1:-1,pe=I.c,se=N.c;if(!pe||!pe[0]||!se||!se[0])return new b(!I.s||!N.s||(pe?se&&pe[0]==se[0]:!se)?NaN:pe&&pe[0]==0||!se?ue*0:ue/0);for(V=new b(ue),Z=V.c=[],O=I.e-N.e,ue=P+O+1,x||(x=dt,O=Je(I.e/ne)-Je(N.e/ne),ue=ue/ne|0),y=0;se[y]==(pe[y]||0);y++);if(se[y]>(pe[y]||0)&&O--,ue<0)Z.push(1),L=!0;else{for(ee=pe.length,xe=se.length,y=0,ue+=2,F=Qe(x/(se[0]+1)),F>1&&(se=g(se,F,x),pe=g(pe,F,x),xe=se.length,ee=pe.length),X=xe,W=pe.slice(0,xe),K=W.length;K<xe;W[K++]=0);oe=se.slice(),oe=[0].concat(oe),fe=se[0],se[1]>=x/2&&fe++;do{if(F=0,T=w(se,W,xe,K),T<0){if(G=W[0],xe!=K&&(G=G*x+(W[1]||0)),F=Qe(G/fe),F>1)for(F>=x&&(F=x-1),U=g(se,F,x),z=U.length,K=W.length;w(U,W,z,K)==1;)F--,A(U,xe<z?oe:se,z,x),z=U.length,T=1;else F==0&&(T=F=1),U=se.slice(),z=U.length;if(z<K&&(U=[0].concat(U)),A(W,U,K,x),K=W.length,T==-1)for(;w(se,W,xe,K)<1;)F++,A(W,xe<K?oe:se,K,x),K=W.length}else T===0&&(F++,W=[0]);Z[y++]=F,W[0]?W[K++]=pe[X]||0:(W=[pe[X]],K=1)}while((X++<ee||W[0]!=null)&&ue--);L=W[0]!=null,Z[0]||Z.splice(0,1)}if(x==dt){for(y=1,ue=Z[0];ue>=10;ue/=10,y++);D(V,P+(V.e=y+O*ne-1)+1,E,L)}else V.e=O,V.r=+L;return V}}();function $(g,w,A,I){var N,P,E,x,T;if(A==null?A=c:ye(A,0,8),!g.c)return g.toString();if(N=g.c[0],E=g.e,w==null)T=et(g.c),T=I==1||I==2&&(E<=a||E>=u)?Lo(T,E):_t(T,E,"0");else if(g=D(new b(g),w,A),P=g.e,T=et(g.c),x=T.length,I==1||I==2&&(w<=P||P<=a)){for(;x<w;T+="0",x++);T=Lo(T,P)}else if(w-=E+(I===2&&P>E),T=_t(T,P,"0"),P+1>x){if(--w>0)for(T+=".";w--;T+="0");}else if(w+=P-x,w>0)for(P+1==x&&(T+=".");w--;T+="0");return g.s<0&&N?"-"+T:T}function B(g,w){for(var A,I,N=1,P=new b(g[0]);N<g.length;N++)I=new b(g[N]),(!I.s||(A=En(P,I))===w||A===0&&P.s===w)&&(P=I);return P}function k(g,w,A){for(var I=1,N=w.length;!w[--N];w.pop());for(N=w[0];N>=10;N/=10,I++);return(A=I+A*ne-1)>f?g.c=g.e=null:A<l?g.c=[g.e=0]:(g.e=A,g.c=w),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,A=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(P,E,x,T){var O,y=x?E:E.replace(N,"");if(I.test(y))P.s=isNaN(y)?null:y<0?-1:1;else{if(!x&&(y=y.replace(g,function(L,F,U){return O=(U=U.toLowerCase())=="x"?16:U=="b"?2:8,!T||T==O?F:L}),T&&(O=T,y=y.replace(w,"$1").replace(A,"0.$1")),E!=y))return new b(y,O);if(b.DEBUG)throw Error(je+"Not a"+(T?" base "+T:"")+" number: "+E);P.s=null}P.c=P.e=null}}();function D(g,w,A,I){var N,P,E,x,T,O,y,L=g.c,F=ni;if(L){e:{for(N=1,x=L[0];x>=10;x/=10,N++);if(P=w-N,P<0)P+=ne,E=w,T=L[O=0],y=Qe(T/F[N-E-1]%10);else if(O=ei((P+1)/ne),O>=L.length)if(I){for(;L.length<=O;L.push(0));T=y=0,N=1,P%=ne,E=P-ne+1}else break e;else{for(T=x=L[O],N=1;x>=10;x/=10,N++);P%=ne,E=P-ne+N,y=E<0?0:Qe(T/F[N-E-1]%10)}if(I=I||w<0||L[O+1]!=null||(E<0?T:T%F[N-E-1]),I=A<4?(y||I)&&(A==0||A==(g.s<0?3:2)):y>5||y==5&&(A==4||I||A==6&&(P>0?E>0?T/F[N-E]:0:L[O-1])%10&1||A==(g.s<0?8:7)),w<1||!L[0])return L.length=0,I?(w-=g.e+1,L[0]=F[(ne-w%ne)%ne],g.e=-w||0):L[0]=g.e=0,g;if(P==0?(L.length=O,x=1,O--):(L.length=O+1,x=F[ne-P],L[O]=E>0?Qe(T/F[N-E]%F[E])*x:0),I)for(;;)if(O==0){for(P=1,E=L[0];E>=10;E/=10,P++);for(E=L[0]+=x,x=1;E>=10;E/=10,x++);P!=x&&(g.e++,L[0]==dt&&(L[0]=1));break}else{if(L[O]+=x,L[O]!=dt)break;L[O--]=0,x=1}for(P=L.length;L[--P]===0;L.pop());}g.e>f?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function j(g){var w,A=g.e;return A===null?g.toString():(w=et(g.c),w=A<=a||A>=u?Lo(w,A):_t(w,A,"0"),g.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var g=new b(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,w){return En(this,new b(g,w))},o.decimalPlaces=o.dp=function(g,w){var A,I,N,P=this;if(g!=null)return ye(g,0,Te),w==null?w=c:ye(w,0,8),D(new b(P),g+P.e+1,w);if(!(A=P.c))return null;if(I=((N=A.length-1)-Je(this.e/ne))*ne,N=A[N])for(;N%10==0;N/=10,I--);return I<0&&(I=0),I},o.dividedBy=o.div=function(g,w){return t(this,new b(g,w),i,c)},o.dividedToIntegerBy=o.idiv=function(g,w){return t(this,new b(g,w),0,1)},o.exponentiatedBy=o.pow=function(g,w){var A,I,N,P,E,x,T,O,y,L=this;if(g=new b(g),g.c&&!g.isInteger())throw Error(je+"Exponent not an integer: "+j(g));if(w!=null&&(w=new b(w)),x=g.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!g.c||!g.c[0])return y=new b(Math.pow(+j(L),x?g.s*(2-Mo(g)):+j(g))),w?y.mod(w):y;if(T=g.s<0,w){if(w.c?!w.c[0]:!w.s)return new b(NaN);I=!T&&L.isInteger()&&w.isInteger(),I&&(L=L.mod(w))}else{if(g.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||x&&L.c[1]>=24e7:L.c[0]<8e13||x&&L.c[0]<=9999975e7)))return P=L.s<0&&Mo(g)?-0:0,L.e>-1&&(P=1/P),new b(T?1/P:P);h&&(P=ei(h/ne+2))}for(x?(A=new b(.5),T&&(g.s=1),O=Mo(g)):(N=Math.abs(+j(g)),O=N%2),y=new b(s);;){if(O){if(y=y.times(L),!y.c)break;P?y.c.length>P&&(y.c.length=P):I&&(y=y.mod(w))}if(N){if(N=Qe(N/2),N===0)break;O=N%2}else if(g=g.times(A),D(g,g.e+1,1),g.e>14)O=Mo(g);else{if(N=+j(g),N===0)break;O=N%2}L=L.times(L),P?L.c&&L.c.length>P&&(L.c.length=P):I&&(L=L.mod(w))}return I?y:(T&&(y=s.div(y)),w?y.mod(w):P?D(y,h,c,E):y)},o.integerValue=function(g){var w=new b(this);return g==null?g=c:ye(g,0,8),D(w,w.e+1,g)},o.isEqualTo=o.eq=function(g,w){return En(this,new b(g,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,w){return En(this,new b(g,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,w){return(w=En(this,new b(g,w)))===1||w===0},o.isInteger=function(){return!!this.c&&Je(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(g,w){return En(this,new b(g,w))<0},o.isLessThanOrEqualTo=o.lte=function(g,w){return(w=En(this,new b(g,w)))===-1||w===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(g,w){var A,I,N,P,E=this,x=E.s;if(g=new b(g,w),w=g.s,!x||!w)return new b(NaN);if(x!=w)return g.s=-w,E.plus(g);var T=E.e/ne,O=g.e/ne,y=E.c,L=g.c;if(!T||!O){if(!y||!L)return y?(g.s=-w,g):new b(L?E:NaN);if(!y[0]||!L[0])return L[0]?(g.s=-w,g):new b(y[0]?E:c==3?-0:0)}if(T=Je(T),O=Je(O),y=y.slice(),x=T-O){for((P=x<0)?(x=-x,N=y):(O=T,N=L),N.reverse(),w=x;w--;N.push(0));N.reverse()}else for(I=(P=(x=y.length)<(w=L.length))?x:w,x=w=0;w<I;w++)if(y[w]!=L[w]){P=y[w]<L[w];break}if(P&&(N=y,y=L,L=N,g.s=-g.s),w=(I=L.length)-(A=y.length),w>0)for(;w--;y[A++]=0);for(w=dt-1;I>x;){if(y[--I]<L[I]){for(A=I;A&&!y[--A];y[A]=w);--y[A],y[I]+=dt}y[I]-=L[I]}for(;y[0]==0;y.splice(0,1),--O);return y[0]?k(g,y,O):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,w){var A,I,N=this;return g=new b(g,w),!N.c||!g.s||g.c&&!g.c[0]?new b(NaN):!g.c||N.c&&!N.c[0]?new b(N):(d==9?(I=g.s,g.s=1,A=t(N,g,0,3),g.s=I,A.s*=I):A=t(N,g,0,d),g=N.minus(A.times(g)),!g.c[0]&&d==1&&(g.s=N.s),g)},o.multipliedBy=o.times=function(g,w){var A,I,N,P,E,x,T,O,y,L,F,U,z,V,Z,W=this,K=W.c,G=(g=new b(g,w)).c;if(!K||!G||!K[0]||!G[0])return!W.s||!g.s||K&&!K[0]&&!G||G&&!G[0]&&!K?g.c=g.e=g.s=null:(g.s*=W.s,!K||!G?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(I=Je(W.e/ne)+Je(g.e/ne),g.s*=W.s,T=K.length,L=G.length,T<L&&(z=K,K=G,G=z,N=T,T=L,L=N),N=T+L,z=[];N--;z.push(0));for(V=dt,Z=un,N=L;--N>=0;){for(A=0,F=G[N]%Z,U=G[N]/Z|0,E=T,P=N+E;P>N;)O=K[--E]%Z,y=K[E]/Z|0,x=U*O+y*F,O=F*O+x%Z*Z+z[P]+A,A=(O/V|0)+(x/Z|0)+U*y,z[P--]=O%V;z[P]=A}return A?++I:z.splice(0,1),k(g,z,I)},o.negated=function(){var g=new b(this);return g.s=-g.s||null,g},o.plus=function(g,w){var A,I=this,N=I.s;if(g=new b(g,w),w=g.s,!N||!w)return new b(NaN);if(N!=w)return g.s=-w,I.minus(g);var P=I.e/ne,E=g.e/ne,x=I.c,T=g.c;if(!P||!E){if(!x||!T)return new b(N/0);if(!x[0]||!T[0])return T[0]?g:new b(x[0]?I:N*0)}if(P=Je(P),E=Je(E),x=x.slice(),N=P-E){for(N>0?(E=P,A=T):(N=-N,A=x),A.reverse();N--;A.push(0));A.reverse()}for(N=x.length,w=T.length,N-w<0&&(A=T,T=x,x=A,w=N),N=0;w;)N=(x[--w]=x[w]+T[w]+N)/dt|0,x[w]=dt===x[w]?0:x[w]%dt;return N&&(x=[N].concat(x),++E),k(g,x,E)},o.precision=o.sd=function(g,w){var A,I,N,P=this;if(g!=null&&g!==!!g)return ye(g,1,Te),w==null?w=c:ye(w,0,8),D(new b(P),g,w);if(!(A=P.c))return null;if(N=A.length-1,I=N*ne+1,N=A[N]){for(;N%10==0;N/=10,I--);for(N=A[0];N>=10;N/=10,I++);}return g&&P.e+1>I&&(I=P.e+1),I},o.shiftedBy=function(g){return ye(g,-ti,ti),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,w,A,I,N,P=this,E=P.c,x=P.s,T=P.e,O=i+4,y=new b("0.5");if(x!==1||!E||!E[0])return new b(!x||x<0&&(!E||E[0])?NaN:E?P:1/0);if(x=Math.sqrt(+j(P)),x==0||x==1/0?(w=et(E),(w.length+T)%2==0&&(w+="0"),x=Math.sqrt(+w),T=Je((T+1)/2)-(T<0||T%2),x==1/0?w="5e"+T:(w=x.toExponential(),w=w.slice(0,w.indexOf("e")+1)+T),A=new b(w)):A=new b(x+""),A.c[0]){for(T=A.e,x=T+O,x<3&&(x=0);;)if(N=A,A=y.times(N.plus(t(P,N,O,1))),et(N.c).slice(0,x)===(w=et(A.c)).slice(0,x))if(A.e<T&&--x,w=w.slice(x-3,x+1),w=="9999"||!I&&w=="4999"){if(!I&&(D(N,N.e+i+2,0),N.times(N).eq(P))){A=N;break}O+=4,x+=4,I=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(D(A,A.e+i+2,1),g=!A.times(A).eq(P));break}}return D(A,A.e+i+1,c,g)},o.toExponential=function(g,w){return g!=null&&(ye(g,0,Te),g++),$(this,g,w,1)},o.toFixed=function(g,w){return g!=null&&(ye(g,0,Te),g=g+this.e+1),$(this,g,w)},o.toFormat=function(g,w,A){var I,N=this;if(A==null)g!=null&&w&&typeof w=="object"?(A=w,w=null):g&&typeof g=="object"?(A=g,g=w=null):A=m;else if(typeof A!="object")throw Error(je+"Argument not an object: "+A);if(I=N.toFixed(g,w),N.c){var P,E=I.split("."),x=+A.groupSize,T=+A.secondaryGroupSize,O=A.groupSeparator||"",y=E[0],L=E[1],F=N.s<0,U=F?y.slice(1):y,z=U.length;if(T&&(P=x,x=T,T=P,z-=P),x>0&&z>0){for(P=z%x||x,y=U.substr(0,P);P<z;P+=x)y+=O+U.substr(P,x);T>0&&(y+=O+U.slice(P)),F&&(y="-"+y)}I=L?y+(A.decimalSeparator||"")+((T=+A.fractionGroupSize)?L.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):L):y}return(A.prefix||"")+I+(A.suffix||"")},o.toFraction=function(g){var w,A,I,N,P,E,x,T,O,y,L,F,U=this,z=U.c;if(g!=null&&(x=new b(g),!x.isInteger()&&(x.c||x.s!==1)||x.lt(s)))throw Error(je+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+j(x));if(!z)return new b(U);for(w=new b(s),O=A=new b(s),I=T=new b(s),F=et(z),P=w.e=F.length-U.e-1,w.c[0]=ni[(E=P%ne)<0?ne+E:E],g=!g||x.comparedTo(w)>0?P>0?w:O:x,E=f,f=1/0,x=new b(F),T.c[0]=0;y=t(x,w,0,1),N=A.plus(y.times(I)),N.comparedTo(g)!=1;)A=I,I=N,O=T.plus(y.times(N=O)),T=N,w=x.minus(y.times(N=w)),x=N;return N=t(g.minus(A),I,0,1),T=T.plus(N.times(O)),A=A.plus(N.times(I)),T.s=O.s=U.s,P=P*2,L=t(O,I,P,c).minus(U).abs().comparedTo(t(T,A,P,c).minus(U).abs())<1?[O,I]:[T,A],f=E,L},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,w){return g!=null&&ye(g,1,Te),$(this,g,w,2)},o.toString=function(g){var w,A=this,I=A.s,N=A.e;return N===null?I?(w="Infinity",I<0&&(w="-"+w)):w="NaN":(g==null?w=N<=a||N>=u?Lo(et(A.c),N):_t(et(A.c),N,"0"):g===10&&C?(A=D(new b(A),i+N+1,c),w=_t(et(A.c),A.e,"0")):(ye(g,2,v.length,"Base"),w=n(_t(et(A.c),N,"0"),10,g,I,!0)),I<0&&A.c[0]&&(w="-"+w)),w},o.valueOf=o.toJSON=function(){return j(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&b.set(e),b}function Je(e){var t=e|0;return e>0||e===t?t:t-1}function et(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ne-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function En(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,u=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==u,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>u^n?1:-1;for(c=(a=o.length)<(u=s.length)?a:u,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==u?0:a>u^n?1:-1}function ye(e,t,n,r){if(e<t||e>n||e!==Qe(e))throw Error(je+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Mo(e){var t=e.c.length-1;return Je(e.e/ne)==t&&e.c[t]%2!=0}function Lo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _t(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Ie=du();const lm=(e,t=6)=>{try{const n=new Ie(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Ie.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"}},pt=()=>{const{translations:e,currentLocale:t}=lu();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const l of c)if(a&&typeof a=="object"&&l in a)a=a[l];else return s;let u=typeof a=="string"?a:s;return i&&typeof u=="string"&&Object.keys(i).forEach(l=>{const f=`{{${l}}}`;u=u.replace(new RegExp(f,"g"),String(i[l]))}),u}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},fm=()=>({openDeposit:S.useCallback(t=>{},[])}),dm=()=>({openWithdraw:S.useCallback(t=>{},[])});/**
36
36
  * @license lucide-react v0.540.0 - ISC
37
37
  *
38
38
  * This source code is licensed under the ISC license.
39
39
  * See the LICENSE file in the root directory of this source tree.
40
- */const Ea=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Sa=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),_o=e=>{const t=Sa(e);return t.charAt(0).toUpperCase()+t.slice(1)},Bo=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Ca=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
40
+ */const pm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hm=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),pu=e=>{const t=hm(e);return t.charAt(0).toUpperCase()+t.slice(1)},hu=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),mm=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
41
41
  * @license lucide-react v0.540.0 - ISC
42
42
  *
43
43
  * This source code is licensed under the ISC license.
44
44
  * See the LICENSE file in the root directory of this source tree.
45
- */var Oa={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"};/**
45
+ */var gm={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
46
46
  * @license lucide-react v0.540.0 - ISC
47
47
  *
48
48
  * This source code is licensed under the ISC license.
49
49
  * See the LICENSE file in the root directory of this source tree.
50
- */const Ta=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:l,...u},s)=>m.createElement("svg",{ref:s,...Oa,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Bo("lucide",o),...!i&&!Ca(u)&&{"aria-hidden":"true"},...u},[...l.map(([a,c])=>m.createElement(a,c)),...Array.isArray(i)?i:[i]]));/**
50
+ */const bm=S.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>S.createElement("svg",{ref:a,...gm,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:hu("lucide",o),...!s&&!mm(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,l])=>S.createElement(u,l)),...Array.isArray(s)?s:[s]]));/**
51
51
  * @license lucide-react v0.540.0 - ISC
52
52
  *
53
53
  * This source code is licensed under the ISC license.
54
54
  * See the LICENSE file in the root directory of this source tree.
55
- */const Na=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(Ta,{ref:i,iconNode:t,className:Bo(`lucide-${Ea(_o(e))}`,`lucide-${e}`,r),...o}));return n.displayName=_o(e),n};/**
55
+ */const ym=(e,t)=>{const n=S.forwardRef(({className:r,...o},s)=>S.createElement(bm,{ref:s,iconNode:t,className:hu(`lucide-${pm(pu(e))}`,`lucide-${e}`,r),...o}));return n.displayName=pu(e),n};/**
56
56
  * @license lucide-react v0.540.0 - ISC
57
57
  *
58
58
  * This source code is licensed under the ISC license.
59
59
  * See the LICENSE file in the root directory of this source tree.
60
- */const Wo=Na("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class Uo{constructor(){Ie(this,"state");this.state={isLoading:!1,isApproving:!1,isDepositing:!1,error:null,txHash:null}}getState(){return{...this.state}}setState(t){this.state={...this.state,...t}}}class La extends Uo{constructor(n,r){super();Ie(this,"smartWallet");Ie(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n;return((n=this.smartWallet)==null?void 0:n.address)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){}async getBalance(n){return"0"}async approve(n,r){return""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{const o=`mpc_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`mpc_signature_${Date.now()}`}getAAWalletAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}}class Pa extends Uo{constructor(n,r,o,i="0",l="0"){super();Ie(this,"currentActiveAccount");Ie(this,"approved");Ie(this,"chainId");Ie(this,"balance");Ie(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=i,this.allowance=l}getWalletType(){return"evm"}getDisplayAddress(){var n;return((n=this.currentActiveAccount)==null?void 0:n.ethAddress)||""}isApprovalRequired(){return!0}getApprovalStatus(){return this.approved}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){this.setState({isLoading:!0,error:null});try{this.chainId=n,this.setState({isLoading:!1})}catch(r){throw this.setState({isLoading:!1,error:r instanceof Error?r.message:"Chain switch failed"}),r}}async getBalance(n){return this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{const o=`evm_approve_${Date.now()}`;return this.approved=!0,this.setState({isApproving:!1,txHash:o}),o}catch(o){throw this.setState({isApproving:!1,error:o instanceof Error?o.message:"Approval failed"}),o}}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{if(!this.approved)throw new Error("Token approval required");const o=`evm_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function Vo(e,t,n,r,o,i){switch(e==null?void 0:e.wallet){case"mpc":return new La(t,e);default:return new Pa(e,!1,r||1,o,i)}}const zo=typeof document<"u"?m.useLayoutEffect:()=>{};var rr;const Da=(rr=m.useInsertionEffect)!==null&&rr!==void 0?rr:zo;function $a(e){const t=m.useRef(null);return Da(()=>{t.current=e},[e]),m.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const gt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},St=e=>e&&"window"in e&&e.window===e?e:gt(e).defaultView||window;function Aa(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Ma(e){return Aa(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Ia=!1;function or(){return Ia}function Ho(e,t){if(!or())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:Ma(n)?n=n.host:n=n.parentNode}return!1}const ir=(e=document)=>{var t;if(!or())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 Go(e){return or()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function dn(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 sr(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 lt(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const lr=lt(function(){return sr(/^Mac/i)}),ja=lt(function(){return sr(/^iPhone/i)}),Fa=lt(function(){return sr(/^iPad/i)||lr()&&navigator.maxTouchPoints>1}),Ra=lt(function(){return ja()||Fa()});lt(function(){return lr()||Ra()}),lt(function(){return dn(/AppleWebKit/i)&&!ka()});const ka=lt(function(){return dn(/Chrome/i)}),_a=lt(function(){return dn(/Android/i)});lt(function(){return dn(/Firefox/i)});function Yo(){let e=m.useRef(new Map),t=m.useCallback((o,i,l,u)=>{let s=u!=null&&u.once?(...a)=>{e.current.delete(l),l(...a)}:l;e.current.set(l,{type:i,eventTarget:o,fn:s,options:u}),o.addEventListener(i,s,u)},[]),n=m.useCallback((o,i,l,u)=>{var s;let a=((s=e.current.get(l))===null||s===void 0?void 0:s.fn)||l;o.removeEventListener(i,a,u),e.current.delete(l)},[]),r=m.useCallback(()=>{e.current.forEach((o,i)=>{n(o.eventTarget,o.type,i,o.options)})},[n]);return m.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Ba(e){return e.mozInputSource===0&&e.isTrusted?!0:_a()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ko(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Wa(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function qo(e){let t=m.useRef({isFocused:!1,observer:null});zo(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=$a(r=>{e==null||e(r)});return m.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,i=l=>{if(t.current.isFocused=!1,o.disabled){let u=Ko(l);n(u)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var l;(l=t.current.observer)===null||l===void 0||l.disconnect();let u=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:u})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:u}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let Ua=!1,Gt=null,ar=new Set,Yt=new Map,Ct=!1,ur=!1;const Va={Tab:!0,Escape:!0};function cr(e,t){for(let n of ar)n(e,t)}function za(e){return!(e.metaKey||!lr()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function pn(e){Ct=!0,za(e)&&(Gt="keyboard",cr("keyboard",e))}function ke(e){Gt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ct=!0,cr("pointer",e))}function Xo(e){Ba(e)&&(Ct=!0,Gt="virtual")}function Qo(e){e.target===window||e.target===document||Ua||!e.isTrusted||(!Ct&&!ur&&(Gt="virtual",cr("virtual",e)),Ct=!1,ur=!1)}function Zo(){Ct=!1,ur=!0}function fr(e){if(typeof window>"u"||typeof document>"u"||Yt.get(St(e)))return;const t=St(e),n=gt(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ct=!0,r.apply(this,arguments)},n.addEventListener("keydown",pn,!0),n.addEventListener("keyup",pn,!0),n.addEventListener("click",Xo,!0),t.addEventListener("focus",Qo,!0),t.addEventListener("blur",Zo,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",ke,!0),n.addEventListener("pointermove",ke,!0),n.addEventListener("pointerup",ke,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",ke,!0),n.addEventListener("mousemove",ke,!0),n.addEventListener("mouseup",ke,!0)),t.addEventListener("beforeunload",()=>{Jo(e)},{once:!0}),Yt.set(t,{focus:r})}const Jo=(e,t)=>{const n=St(e),r=gt(e);t&&r.removeEventListener("DOMContentLoaded",t),Yt.has(n)&&(n.HTMLElement.prototype.focus=Yt.get(n).focus,r.removeEventListener("keydown",pn,!0),r.removeEventListener("keyup",pn,!0),r.removeEventListener("click",Xo,!0),n.removeEventListener("focus",Qo,!0),n.removeEventListener("blur",Zo,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",ke,!0),r.removeEventListener("pointermove",ke,!0),r.removeEventListener("pointerup",ke,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",ke,!0),r.removeEventListener("mousemove",ke,!0),r.removeEventListener("mouseup",ke,!0)),Yt.delete(n))};function Ha(e){const t=gt(e);let n;return t.readyState!=="loading"?fr(e):(n=()=>{fr(e)},t.addEventListener("DOMContentLoaded",n)),()=>Jo(e,n)}typeof document<"u"&&Ha();function ei(){return Gt!=="pointer"}const Ga=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ya(e,t,n){let r=gt(n==null?void 0:n.target);const o=typeof window<"u"?St(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?St(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?St(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?St(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Ga.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof l&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!Va[n.key])}function Ka(e,t,n){fr(),m.useEffect(()=>{let r=(o,i)=>{Ya(!!(n!=null&&n.isTextInput),o,i)&&e(ei())};return ar.add(r),()=>{ar.delete(r)}},t)}function qa(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const i=m.useCallback(s=>{if(s.target===s.currentTarget)return r&&r(s),o&&o(!1),!0},[r,o]),l=qo(i),u=m.useCallback(s=>{const a=gt(s.target),c=a?ir(a):ir();s.target===s.currentTarget&&c===Go(s.nativeEvent)&&(n&&n(s),o&&o(!0),l(s))},[o,n,l]);return{focusProps:{onFocus:!t&&(n||o||r)?u:void 0,onBlur:!t&&(r||o)?i:void 0}}}function Xa(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=m.useRef({isFocusWithin:!1}),{addGlobalListener:l,removeAllGlobalListeners:u}=Yo(),s=m.useCallback(d=>{d.currentTarget.contains(d.target)&&i.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(i.current.isFocusWithin=!1,u(),n&&n(d),o&&o(!1))},[n,o,i,u]),a=qo(s),c=m.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const p=gt(d.target),f=ir(p);if(!i.current.isFocusWithin&&f===Go(d.nativeEvent)){r&&r(d),o&&o(!0),i.current.isFocusWithin=!0,a(d);let g=d.currentTarget;l(p,"focus",v=>{if(i.current.isFocusWithin&&!Ho(g,v.target)){let E=new p.defaultView.FocusEvent("blur",{relatedTarget:v.target});Wa(E,g);let M=Ko(E);s(M)}},{capture:!0})}},[r,o,a,l,s]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:s}}}let mn=!1,hn=0;function dr(){mn=!0,setTimeout(()=>{mn=!1},50)}function ti(e){e.pointerType==="touch"&&dr()}function Qa(){if(!(typeof document>"u"))return hn===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",ti):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",dr)),hn++,()=>{hn--,!(hn>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",ti):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",dr))}}function Za(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[i,l]=m.useState(!1),u=m.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;m.useEffect(Qa,[]);let{addGlobalListener:s,removeAllGlobalListeners:a}=Yo(),{hoverProps:c,triggerHoverEnd:d}=m.useMemo(()=>{let p=(v,E)=>{if(u.pointerType=E,o||E==="touch"||u.isHovered||!v.currentTarget.contains(v.target))return;u.isHovered=!0;let M=v.currentTarget;u.target=M,s(gt(v.target),"pointerover",w=>{u.isHovered&&u.target&&!Ho(u.target,w.target)&&f(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:M,pointerType:E}),n&&n(!0),l(!0)},f=(v,E)=>{let M=u.target;u.pointerType="",u.target=null,!(E==="touch"||!u.isHovered||!M)&&(u.isHovered=!1,a(),r&&r({type:"hoverend",target:M,pointerType:E}),n&&n(!1),l(!1))},g={};return typeof PointerEvent<"u"?(g.onPointerEnter=v=>{mn&&v.pointerType==="mouse"||p(v,v.pointerType)},g.onPointerLeave=v=>{!o&&v.currentTarget.contains(v.target)&&f(v,v.pointerType)}):process.env.NODE_ENV==="test"&&(g.onTouchStart=()=>{u.ignoreEmulatedMouseEvents=!0},g.onMouseEnter=v=>{!u.ignoreEmulatedMouseEvents&&!mn&&p(v,"mouse"),u.ignoreEmulatedMouseEvents=!1},g.onMouseLeave=v=>{!o&&v.currentTarget.contains(v.target)&&f(v,"mouse")}),{hoverProps:g,triggerHoverEnd:f}},[t,n,r,o,u,s,a]);return m.useEffect(()=>{o&&d({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:c,isHovered:i}}function Ja(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=m.useRef({isFocused:!1,isFocusVisible:t||ei()}),[i,l]=m.useState(!1),[u,s]=m.useState(()=>o.current.isFocused&&o.current.isFocusVisible),a=m.useCallback(()=>s(o.current.isFocused&&o.current.isFocusVisible),[]),c=m.useCallback(f=>{o.current.isFocused=f,l(f),a()},[a]);Ka(f=>{o.current.isFocusVisible=f,a()},[],{isTextInput:n});let{focusProps:d}=qa({isDisabled:r,onFocusChange:c}),{focusWithinProps:p}=Xa({isDisabled:!r,onFocusWithinChange:c});return{isFocused:i,isFocusVisible:u,focusProps:r?p:d}}var eu=Object.defineProperty,tu=(e,t,n)=>t in e?eu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pr=(e,t,n)=>(tu(e,typeof t!="symbol"?t+"":t,n),n);let nu=class{constructor(){pr(this,"current",this.detect()),pr(this,"handoffState","pending"),pr(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"}},Qe=new nu;function Kt(e){var t,n;return Qe.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function ni(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Ke(){let e=[],t={addEventListener(n,r,o,i){return n.addEventListener(r,o,i),t.add(()=>n.removeEventListener(r,o,i))},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 ni(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let i=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:i})})},group(n){let r=Ke();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 $t(){let[e]=m.useState(Ke);return m.useEffect(()=>()=>e.dispose(),[e]),e}let ue=(e,t)=>{Qe.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function Ot(e){let t=m.useRef(e);return ue(()=>{t.current=e},[e]),t}let ne=function(e){let t=Ot(e);return m.useCallback((...n)=>t.current(...n),[t])};function ru(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 ou(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function iu({disabled:e=!1}={}){let t=m.useRef(null),[n,r]=m.useState(!1),o=$t(),i=ne(()=>{t.current=null,r(!1),o.dispose()}),l=ne(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let s=Kt(u.currentTarget);o.addEventListener(s,"pointerup",i,!1),o.addEventListener(s,"pointermove",a=>{if(t.current){let c=ru(a);r(ou(c,t.current.getBoundingClientRect()))}},!1),o.addEventListener(s,"pointercancel",i,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:l,onPointerUp:i,onClick:i}}}let su=m.createContext(void 0);function mr(){return m.useContext(su)}function hr(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function _e(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,_e),r}var gn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(gn||{}),vt=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(vt||{});function Me(){let e=au();return m.useCallback(t=>lu({mergeRefs:e,...t}),[e])}function lu({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:l,mergeRefs:u}){u=u??uu;let s=ri(t,e);if(i)return vn(s,n,r,l,u);let a=o??0;if(a&2){let{static:c=!1,...d}=s;if(c)return vn(d,n,r,l,u)}if(a&1){let{unmount:c=!0,...d}=s;return _e(c?0:1,{0(){return null},1(){return vn({...d,hidden:!0,style:{display:"none"}},n,r,l,u)}})}return vn(s,n,r,l,u)}function vn(e,t={},n,r,o){let{as:i=n,children:l,refName:u="ref",...s}=gr(e,["unmount","static"]),a=e.ref!==void 0?{[u]:e.ref}:{},c=typeof l=="function"?l(t):l;"className"in s&&s.className&&typeof s.className=="function"&&(s.className=s.className(t)),s["aria-labelledby"]&&s["aria-labelledby"]===s.id&&(s["aria-labelledby"]=void 0);let d={};if(t){let p=!1,f=[];for(let[g,v]of Object.entries(t))typeof v=="boolean"&&(p=!0),v===!0&&f.push(g.replace(/([A-Z])/g,E=>`-${E.toLowerCase()}`));if(p){d["data-headlessui-state"]=f.join(" ");for(let g of f)d[`data-${g}`]=""}}if(i===m.Fragment&&(Object.keys(bt(s)).length>0||Object.keys(bt(d)).length>0))if(!m.isValidElement(c)||Array.isArray(c)&&c.length>1){if(Object.keys(bt(s)).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(bt(s)).concat(Object.keys(bt(d))).map(p=>` - ${p}`).join(`
60
+ */const mu=ym("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class gu{constructor(){Xe(this,"state");this.state={isLoading:!1,isApproving:!1,isDepositing:!1,error:null,txHash:null}}getState(){return{...this.state}}setState(t){this.state={...this.state,...t}}}class vm extends gu{constructor(n,r){super();Xe(this,"smartWallet");Xe(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n;return((n=this.smartWallet)==null?void 0:n.address)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){}async getBalance(n){return"0"}async approve(n,r){return""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{const o=`mpc_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`mpc_signature_${Date.now()}`}getAAWalletAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}}class wm extends gu{constructor(n,r,o,s="0",i="0"){super();Xe(this,"currentActiveAccount");Xe(this,"approved");Xe(this,"chainId");Xe(this,"balance");Xe(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=i}getWalletType(){return"evm"}getDisplayAddress(){var n;return((n=this.currentActiveAccount)==null?void 0:n.ethAddress)||""}isApprovalRequired(){return!0}getApprovalStatus(){return this.approved}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){this.setState({isLoading:!0,error:null});try{this.chainId=n,this.setState({isLoading:!1})}catch(r){throw this.setState({isLoading:!1,error:r instanceof Error?r.message:"Chain switch failed"}),r}}async getBalance(n){return this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{const o=`evm_approve_${Date.now()}`;return this.approved=!0,this.setState({isApproving:!1,txHash:o}),o}catch(o){throw this.setState({isApproving:!1,error:o instanceof Error?o.message:"Approval failed"}),o}}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{if(!this.approved)throw new Error("Token approval required");const o=`evm_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function bu(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new vm(t,e);default:return new wm(e,!1,r||1,o,s)}}const yu=typeof document<"u"?S.useLayoutEffect:()=>{};var ri;const xm=(ri=S.useInsertionEffect)!==null&&ri!==void 0?ri:yu;function Em(e){const t=S.useRef(null);return xm(()=>{t.current=e},[e]),S.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const ln=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Sn=e=>e&&"window"in e&&e.window===e?e:ln(e).defaultView||window;function Sm(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Pm(e){return Sm(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let $m=!1;function oi(){return $m}function vu(e,t){if(!oi())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:Pm(n)?n=n.host:n=n.parentNode}return!1}const si=(e=document)=>{var t;if(!oi())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 wu(e){return oi()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Bo(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 ii(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Ut(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ai=Ut(function(){return ii(/^Mac/i)}),Am=Ut(function(){return ii(/^iPhone/i)}),Tm=Ut(function(){return ii(/^iPad/i)||ai()&&navigator.maxTouchPoints>1}),Cm=Ut(function(){return Am()||Tm()});Ut(function(){return ai()||Cm()}),Ut(function(){return Bo(/AppleWebKit/i)&&!Om()});const Om=Ut(function(){return Bo(/Chrome/i)}),Nm=Ut(function(){return Bo(/Android/i)});Ut(function(){return Bo(/Firefox/i)});function xu(){let e=S.useRef(new Map),t=S.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...u)=>{e.current.delete(i),i(...u)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=S.useCallback((o,s,i,c)=>{var a;let u=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,u,c),e.current.delete(i)},[]),r=S.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return S.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Im(e){return e.mozInputSource===0&&e.isTrusted?!0:Nm()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Eu(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Mm(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Su(e){let t=S.useRef({isFocused:!1,observer:null});yu(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Em(r=>{e==null||e(r)});return S.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=Eu(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 Lm=!1,Or=null,ci=new Set,Nr=new Map,Pn=!1,ui=!1;const Bm={Tab:!0,Escape:!0};function li(e,t){for(let n of ci)n(e,t)}function km(e){return!(e.metaKey||!ai()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ko(e){Pn=!0,km(e)&&(Or="keyboard",li("keyboard",e))}function tt(e){Or="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Pn=!0,li("pointer",e))}function Pu(e){Im(e)&&(Pn=!0,Or="virtual")}function $u(e){e.target===window||e.target===document||Lm||!e.isTrusted||(!Pn&&!ui&&(Or="virtual",li("virtual",e)),Pn=!1,ui=!1)}function Au(){Pn=!1,ui=!0}function fi(e){if(typeof window>"u"||typeof document>"u"||Nr.get(Sn(e)))return;const t=Sn(e),n=ln(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Pn=!0,r.apply(this,arguments)},n.addEventListener("keydown",ko,!0),n.addEventListener("keyup",ko,!0),n.addEventListener("click",Pu,!0),t.addEventListener("focus",$u,!0),t.addEventListener("blur",Au,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",tt,!0),n.addEventListener("pointermove",tt,!0),n.addEventListener("pointerup",tt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",tt,!0),n.addEventListener("mousemove",tt,!0),n.addEventListener("mouseup",tt,!0)),t.addEventListener("beforeunload",()=>{Tu(e)},{once:!0}),Nr.set(t,{focus:r})}const Tu=(e,t)=>{const n=Sn(e),r=ln(e);t&&r.removeEventListener("DOMContentLoaded",t),Nr.has(n)&&(n.HTMLElement.prototype.focus=Nr.get(n).focus,r.removeEventListener("keydown",ko,!0),r.removeEventListener("keyup",ko,!0),r.removeEventListener("click",Pu,!0),n.removeEventListener("focus",$u,!0),n.removeEventListener("blur",Au,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",tt,!0),r.removeEventListener("pointermove",tt,!0),r.removeEventListener("pointerup",tt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",tt,!0),r.removeEventListener("mousemove",tt,!0),r.removeEventListener("mouseup",tt,!0)),Nr.delete(n))};function Rm(e){const t=ln(e);let n;return t.readyState!=="loading"?fi(e):(n=()=>{fi(e)},t.addEventListener("DOMContentLoaded",n)),()=>Tu(e,n)}typeof document<"u"&&Rm();function Cu(){return Or!=="pointer"}const Fm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Dm(e,t,n){let r=ln(n==null?void 0:n.target);const o=typeof window<"u"?Sn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Sn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?Sn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?Sn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Fm.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!Bm[n.key])}function jm(e,t,n){fi(),S.useEffect(()=>{let r=(o,s)=>{Dm(!!(n!=null&&n.isTextInput),o,s)&&e(Cu())};return ci.add(r),()=>{ci.delete(r)}},t)}function _m(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=S.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=Su(s),c=S.useCallback(a=>{const u=ln(a.target),l=u?si(u):si();a.target===a.currentTarget&&l===wu(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 Um(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=S.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=xu(),a=S.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),u=Su(a),l=S.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=ln(f.target),d=si(p);if(!s.current.isFocusWithin&&d===wu(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,u(f);let h=f.currentTarget;i(p,"focus",m=>{if(s.current.isFocusWithin&&!vu(h,m.target)){let v=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});Mm(v,h);let C=Eu(v);a(C)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let Ro=!1,Fo=0;function di(){Ro=!0,setTimeout(()=>{Ro=!1},50)}function Ou(e){e.pointerType==="touch"&&di()}function zm(){if(!(typeof document>"u"))return Fo===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Ou):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",di)),Fo++,()=>{Fo--,!(Fo>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Ou):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",di))}}function Wm(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=S.useState(!1),c=S.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;S.useEffect(zm,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=xu(),{hoverProps:l,triggerHoverEnd:f}=S.useMemo(()=>{let p=(m,v)=>{if(c.pointerType=v,o||v==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let C=m.currentTarget;c.target=C,a(ln(m.target),"pointerover",b=>{c.isHovered&&c.target&&!vu(c.target,b.target)&&d(b,b.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:C,pointerType:v}),n&&n(!0),i(!0)},d=(m,v)=>{let C=c.target;c.pointerType="",c.target=null,!(v==="touch"||!c.isHovered||!C)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:C,pointerType:v}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Ro&&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&&!Ro&&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,u]);return S.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function Hm(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=S.useRef({isFocused:!1,isFocusVisible:t||Cu()}),[s,i]=S.useState(!1),[c,a]=S.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=S.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=S.useCallback(d=>{o.current.isFocused=d,i(d),u()},[u]);jm(d=>{o.current.isFocusVisible=d,u()},[],{isTextInput:n});let{focusProps:f}=_m({isDisabled:r,onFocusChange:l}),{focusWithinProps:p}=Um({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var Vm=Object.defineProperty,Gm=(e,t,n)=>t in e?Vm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pi=(e,t,n)=>(Gm(e,typeof t!="symbol"?t+"":t,n),n);let qm=class{constructor(){pi(this,"current",this.detect()),pi(this,"handoffState","pending"),pi(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"}},At=new qm;function Ir(e){var t,n;return At.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function Nu(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ht(){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 Nu(()=>{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=ht();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 Vn(){let[e]=S.useState(ht);return S.useEffect(()=>()=>e.dispose(),[e]),e}let ge=(e,t)=>{At.isServer?S.useEffect(e,t):S.useLayoutEffect(e,t)};function $n(e){let t=S.useRef(e);return ge(()=>{t.current=e},[e]),t}let ce=function(e){let t=$n(e);return S.useCallback((...n)=>t.current(...n),[t])};function Zm(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 Km(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ym({disabled:e=!1}={}){let t=S.useRef(null),[n,r]=S.useState(!1),o=Vn(),s=ce(()=>{t.current=null,r(!1),o.dispose()}),i=ce(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=Ir(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Zm(u);r(Km(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Xm=S.createContext(void 0);function hi(){return S.useContext(Xm)}function mi(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function nt(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,nt),r}var Do=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Do||{}),fn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(fn||{});function Ze(){let e=Jm();return S.useCallback(t=>Qm({mergeRefs:e,...t}),[e])}function Qm({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??eg;let a=Iu(t,e);if(s)return jo(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return jo(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return nt(l?0:1,{0(){return null},1(){return jo({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return jo(a,n,r,i,c)}function jo(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=gi(e,["unmount","static"]),u=e.ref!==void 0?{[c]:e.ref}:{},l=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let 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,v=>`-${v.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(s===S.Fragment&&(Object.keys(dn(a)).length>0||Object.keys(dn(f)).length>0))if(!S.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(dn(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(dn(a)).concat(Object.keys(dn(f))).map(p=>` - ${p}`).join(`
61
61
  `),"","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(`
62
62
  `)].join(`
63
- `))}else{let p=c.props,f=p==null?void 0:p.className,g=typeof f=="function"?(...M)=>hr(f(...M),s.className):hr(f,s.className),v=g?{className:g}:{},E=ri(c.props,bt(gr(s,["ref"])));for(let M in d)M in E&&delete d[M];return m.cloneElement(c,Object.assign({},E,d,a,{ref:o(cu(c),a.ref)},v))}return m.createElement(i,Object.assign({},gr(s,["ref"]),i!==m.Fragment&&a,i!==m.Fragment&&d),c)}function au(){let e=m.useRef([]),t=m.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 uu(...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 ri(...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 i;return(i=o==null?void 0:o.preventDefault)==null?void 0:i.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...i){let l=n[r];for(let u of l){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(o,...i)}}});return t}function oi(...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 i=n[r];for(let l of i)l==null||l(...o)}});return t}function Ne(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function bt(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function gr(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function cu(e){return m.version.split(".")[0]>="19"?e.props.ref:e.ref}function fu(e,t,n){let[r,o]=m.useState(n),i=e!==void 0,l=m.useRef(i),u=m.useRef(!1),s=m.useRef(!1);return i&&!l.current&&!u.current?(u.current=!0,l.current=i,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.")):!i&&l.current&&!s.current&&(s.current=!0,l.current=i,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.")),[i?e:r,ne(a=>(i||o(a),t==null?void 0:t(a)))]}function du(e){let[t]=m.useState(e);return t}function ii(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))li(n,si(t,r),o);return n}function si(e,t){return e?e+"["+t+"]":t}function li(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())li(e,si(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,""]):ii(n,t,e)}function pu(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let mu="span";var vr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(vr||{});function hu(e,t){var n;let{features:r=1,...o}=e,i={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 Me()({ourProps:i,theirProps:o,slot:{},defaultTag:mu,name:"Hidden"})}let ai=Ne(hu),gu=m.createContext(null);function vu({children:e}){let t=m.useContext(gu);if(!t)return m.createElement(m.Fragment,null,e);let{target:n}=t;return n?Se.createPortal(m.createElement(m.Fragment,null,e),n):null}function bu({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[i,l]=m.useState(null),u=$t();return m.useEffect(()=>{if(r&&i)return u.addEventListener(i,"reset",r)},[i,t,r]),m.createElement(vu,null,m.createElement(yu,{setForm:l,formId:t}),ii(e).map(([s,a])=>m.createElement(ai,{features:vr.Hidden,...bt({key:s,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:s,value:a,...o})})))}function yu({setForm:e,formId:t}){return m.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:m.createElement(ai,{features:vr.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let xu=m.createContext(void 0);function ui(){return m.useContext(xu)}function br(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function bn(e){return br(e)&&"tagName"in e}function at(e){return bn(e)&&"accessKey"in e}function At(e){return bn(e)&&"tabIndex"in e}function wu(e){return bn(e)&&"style"in e}function Eu(e){return at(e)&&e.nodeName==="IFRAME"}function ci(e){return at(e)&&e.nodeName==="INPUT"}function fi(e){return at(e)&&e.nodeName==="LABEL"}function Su(e){return at(e)&&e.nodeName==="FIELDSET"}function di(e){return at(e)&&e.nodeName==="LEGEND"}function Cu(e){return bn(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Ou(e){let t=e.parentElement,n=null;for(;t&&!Su(t);)di(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Tu(n)?!1:r}function Tu(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(di(t))return!1;t=t.previousElementSibling}return!0}let pi=Symbol();function Nu(e,t=!0){return Object.assign(e,{[pi]:t})}function Be(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let n=ne(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[pi]))?void 0:n}let yr=m.createContext(null);yr.displayName="DescriptionContext";function mi(){let e=m.useContext(yr);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,mi),t}return e}function Lu(){var e,t;return(t=(e=m.useContext(yr))==null?void 0:e.value)!=null?t:void 0}let Pu="p";function Du(e,t){let n=m.useId(),r=mr(),{id:o=`headlessui-description-${n}`,...i}=e,l=mi(),u=Be(t);ue(()=>l.register(o),[o,l.register]);let s=r||!1,a=m.useMemo(()=>({...l.slot,disabled:s}),[l.slot,s]),c={ref:u,...l.props,id:o};return Me()({ourProps:c,theirProps:i,slot:a,defaultTag:Pu,name:l.name||"Description"})}let $u=Ne(Du);Object.assign($u,{});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 yn=m.createContext(null);yn.displayName="LabelContext";function hi(){let e=m.useContext(yn);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,hi),t}return e}function gi(e){var t,n,r;let o=(n=(t=m.useContext(yn))==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 Au({inherit:e=!1}={}){let t=gi(),[n,r]=m.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,m.useMemo(()=>function(i){let l=ne(s=>(r(a=>[...a,s]),()=>r(a=>{let c=a.slice(),d=c.indexOf(s);return d!==-1&&c.splice(d,1),c}))),u=m.useMemo(()=>({register:l,slot:i.slot,name:i.name,props:i.props,value:i.value}),[l,i.slot,i.name,i.props,i.value]);return m.createElement(yn.Provider,{value:u},i.children)},[r])]}let Mu="label";function Iu(e,t){var n;let r=m.useId(),o=hi(),i=ui(),l=mr(),{id:u=`headlessui-label-${r}`,htmlFor:s=i??((n=o.props)==null?void 0:n.htmlFor),passive:a=!1,...c}=e,d=Be(t);ue(()=>o.register(u),[u,o.register]);let p=ne(E=>{let M=E.currentTarget;if(!(E.target!==E.currentTarget&&Cu(E.target))&&(fi(M)&&E.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(E),fi(M))){let w=document.getElementById(M.htmlFor);if(w){let N=w.getAttribute("disabled");if(N==="true"||N==="")return;let F=w.getAttribute("aria-disabled");if(F==="true"||F==="")return;(ci(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),f=l||!1,g=m.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),v={ref:d,...o.props,id:u,htmlFor:s,onClick:p};return a&&("onClick"in v&&(delete v.htmlFor,delete v.onClick),"onClick"in c&&delete c.onClick),Me()({ourProps:v,theirProps:c,slot:g,defaultTag:s?Mu:"div",name:o.name||"Label"})}let ju=Ne(Iu),Fu=Object.assign(ju,{});function Ru(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 ku(e=Ru){return m.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 _u(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Bu(e,t=!1){let[n,r]=m.useReducer(()=>({}),{}),o=m.useMemo(()=>_u(e),[e,n]);return ue(()=>{if(!e)return;let i=new ResizeObserver(r);return i.observe(e),()=>{i.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let vi=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 Wu=Object.defineProperty,Uu=(e,t,n)=>t in e?Wu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vu=(e,t,n)=>(Uu(e,t+"",n),n),bi=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},We=(e,t,n)=>(bi(e,t,"read from private field"),n?n.call(e):t.get(e)),xr=(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)},yi=(e,t,n,r)=>(bi(e,t,"write to private field"),t.set(e,n),n),Ze,qt,Xt;let xi=class{constructor(t){xr(this,Ze,{}),xr(this,qt,new vi(()=>new Set)),xr(this,Xt,new Set),Vu(this,"disposables",Ke()),yi(this,Ze,t),Qe.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return We(this,Ze)}subscribe(t,n){if(Qe.isServer)return()=>{};let r={selector:t,callback:n,current:t(We(this,Ze))};return We(this,Xt).add(r),this.disposables.add(()=>{We(this,Xt).delete(r)})}on(t,n){return Qe.isServer?()=>{}:(We(this,qt).get(t).add(n),this.disposables.add(()=>{We(this,qt).get(t).delete(n)}))}send(t){let n=this.reduce(We(this,Ze),t);if(n!==We(this,Ze)){yi(this,Ze,n);for(let r of We(this,Xt)){let o=r.selector(We(this,Ze));wi(r.current,o)||(r.current=o,r.callback(o))}for(let r of We(this,qt).get(t.type))r(We(this,Ze),t)}}};Ze=new WeakMap,qt=new WeakMap,Xt=new WeakMap;function wi(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:wr(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:wr(e.entries(),t.entries()):Ei(e)&&Ei(t)?wr(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function wr(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 Ei(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Er(e){let[t,n]=e(),r=Ke();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var zu=Object.defineProperty,Hu=(e,t,n)=>t in e?zu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Si=(e,t,n)=>(Hu(e,typeof t!="symbol"?t+"":t,n),n),Ci=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Ci||{});let Gu={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let i=e.stack.slice();return i.splice(o,1),i.push(n),r=i,{...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}}},Yu=class ia extends xi{constructor(){super(...arguments),Si(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Si(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new ia({stack:[]})}reduce(t,n){return _e(n.type,Gu,t,n)}};const Sr=new vi(()=>Yu.new());var Cr={exports:{}},Or={};/**
63
+ `))}else{let p=l.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...C)=>mi(d(...C),a.className):mi(d,a.className),m=h?{className:h}:{},v=Iu(l.props,dn(gi(a,["ref"])));for(let C in f)C in v&&delete f[C];return S.cloneElement(l,Object.assign({},v,f,u,{ref:o(tg(l),u.ref)},m))}return S.createElement(s,Object.assign({},gi(a,["ref"]),s!==S.Fragment&&u,s!==S.Fragment&&f),l)}function Jm(){let e=S.useRef([]),t=S.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 eg(...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 Iu(...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 Mu(...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 _e(e){var t;return Object.assign(S.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function dn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function gi(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function tg(e){return S.version.split(".")[0]>="19"?e.props.ref:e.ref}function ng(e,t,n){let[r,o]=S.useState(n),s=e!==void 0,i=S.useRef(s),c=S.useRef(!1),a=S.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,ce(u=>(s||o(u),t==null?void 0:t(u)))]}function rg(e){let[t]=S.useState(e);return t}function Lu(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))ku(n,Bu(t,r),o);return n}function Bu(e,t){return e?e+"["+t+"]":t}function ku(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())ku(e,Bu(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,""]):Lu(n,t,e)}function og(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let sg="span";var bi=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(bi||{});function ig(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 Ze()({ourProps:s,theirProps:o,slot:{},defaultTag:sg,name:"Hidden"})}let Ru=_e(ig),ag=S.createContext(null);function cg({children:e}){let t=S.useContext(ag);if(!t)return S.createElement(S.Fragment,null,e);let{target:n}=t;return n?Be.createPortal(S.createElement(S.Fragment,null,e),n):null}function ug({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=S.useState(null),c=Vn();return S.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),S.createElement(cg,null,S.createElement(lg,{setForm:i,formId:t}),Lu(e).map(([a,u])=>S.createElement(Ru,{features:bi.Hidden,...dn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function lg({setForm:e,formId:t}){return S.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:S.createElement(Ru,{features:bi.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let fg=S.createContext(void 0);function Fu(){return S.useContext(fg)}function yi(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function _o(e){return yi(e)&&"tagName"in e}function zt(e){return _o(e)&&"accessKey"in e}function Gn(e){return _o(e)&&"tabIndex"in e}function dg(e){return _o(e)&&"style"in e}function pg(e){return zt(e)&&e.nodeName==="IFRAME"}function Du(e){return zt(e)&&e.nodeName==="INPUT"}function ju(e){return zt(e)&&e.nodeName==="LABEL"}function hg(e){return zt(e)&&e.nodeName==="FIELDSET"}function _u(e){return zt(e)&&e.nodeName==="LEGEND"}function mg(e){return _o(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function gg(e){let t=e.parentElement,n=null;for(;t&&!hg(t);)_u(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&bg(n)?!1:r}function bg(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(_u(t))return!1;t=t.previousElementSibling}return!0}let Uu=Symbol();function yg(e,t=!0){return Object.assign(e,{[Uu]:t})}function rt(...e){let t=S.useRef(e);S.useEffect(()=>{t.current=e},[e]);let n=ce(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[Uu]))?void 0:n}let vi=S.createContext(null);vi.displayName="DescriptionContext";function zu(){let e=S.useContext(vi);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,zu),t}return e}function vg(){var e,t;return(t=(e=S.useContext(vi))==null?void 0:e.value)!=null?t:void 0}let wg="p";function xg(e,t){let n=S.useId(),r=hi(),{id:o=`headlessui-description-${n}`,...s}=e,i=zu(),c=rt(t);ge(()=>i.register(o),[o,i.register]);let a=r||!1,u=S.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),l={ref:c,...i.props,id:o};return Ze()({ourProps:l,theirProps:s,slot:u,defaultTag:wg,name:i.name||"Description"})}let Eg=_e(xg);Object.assign(Eg,{});var Ce=(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))(Ce||{});let Uo=S.createContext(null);Uo.displayName="LabelContext";function Wu(){let e=S.useContext(Uo);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Wu),t}return e}function Hu(e){var t,n,r;let o=(n=(t=S.useContext(Uo))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function Sg({inherit:e=!1}={}){let t=Hu(),[n,r]=S.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,S.useMemo(()=>function(s){let i=ce(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=S.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 S.createElement(Uo.Provider,{value:c},s.children)},[r])]}let Pg="label";function $g(e,t){var n;let r=S.useId(),o=Wu(),s=Fu(),i=hi(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=rt(t);ge(()=>o.register(c),[c,o.register]);let p=ce(v=>{let C=v.currentTarget;if(!(v.target!==v.currentTarget&&mg(v.target))&&(ju(C)&&v.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(v),ju(C))){let b=document.getElementById(C.htmlFor);if(b){let $=b.getAttribute("disabled");if($==="true"||$==="")return;let B=b.getAttribute("aria-disabled");if(B==="true"||B==="")return;(Du(b)&&(b.type==="file"||b.type==="radio"||b.type==="checkbox")||b.role==="radio"||b.role==="checkbox"||b.role==="switch")&&b.click(),b.focus({preventScroll:!0})}}}),d=i||!1,h=S.useMemo(()=>({...o.slot,disabled:d}),[o.slot,d]),m={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return u&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in l&&delete l.onClick),Ze()({ourProps:m,theirProps:l,slot:h,defaultTag:a?Pg:"div",name:o.name||"Label"})}let Ag=_e($g),Tg=Object.assign(Ag,{});function Cg(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function Og(e=Cg){return S.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 Ng(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ig(e,t=!1){let[n,r]=S.useReducer(()=>({}),{}),o=S.useMemo(()=>Ng(e),[e,n]);return ge(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let Vu=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 Mg=Object.defineProperty,Lg=(e,t,n)=>t in e?Mg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bg=(e,t,n)=>(Lg(e,t+"",n),n),Gu=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ot=(e,t,n)=>(Gu(e,t,"read from private field"),n?n.call(e):t.get(e)),wi=(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)},qu=(e,t,n,r)=>(Gu(e,t,"write to private field"),t.set(e,n),n),Tt,Mr,Lr;let Zu=class{constructor(t){wi(this,Tt,{}),wi(this,Mr,new Vu(()=>new Set)),wi(this,Lr,new Set),Bg(this,"disposables",ht()),qu(this,Tt,t),At.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return ot(this,Tt)}subscribe(t,n){if(At.isServer)return()=>{};let r={selector:t,callback:n,current:t(ot(this,Tt))};return ot(this,Lr).add(r),this.disposables.add(()=>{ot(this,Lr).delete(r)})}on(t,n){return At.isServer?()=>{}:(ot(this,Mr).get(t).add(n),this.disposables.add(()=>{ot(this,Mr).get(t).delete(n)}))}send(t){let n=this.reduce(ot(this,Tt),t);if(n!==ot(this,Tt)){qu(this,Tt,n);for(let r of ot(this,Lr)){let o=r.selector(ot(this,Tt));Ku(r.current,o)||(r.current=o,r.callback(o))}for(let r of ot(this,Mr).get(t.type))r(ot(this,Tt),t)}}};Tt=new WeakMap,Mr=new WeakMap,Lr=new WeakMap;function Ku(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:xi(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:xi(e.entries(),t.entries()):Yu(e)&&Yu(t)?xi(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function xi(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 Yu(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Ei(e){let[t,n]=e(),r=ht();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var kg=Object.defineProperty,Rg=(e,t,n)=>t in e?kg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xu=(e,t,n)=>(Rg(e,typeof t!="symbol"?t+"":t,n),n),Qu=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Qu||{});let Fg={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}}},Dg=class Y0 extends Zu{constructor(){super(...arguments),Xu(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Xu(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Y0({stack:[]})}reduce(t,n){return nt(n.type,Fg,t,n)}};const Si=new Vu(()=>Dg.new());var Pi={exports:{}},$i={};/**
64
64
  * @license React
65
65
  * use-sync-external-store-with-selector.production.js
66
66
  *
@@ -68,7 +68,7 @@ React keys must be passed directly to JSX without using spread:
68
68
  *
69
69
  * This source code is licensed under the MIT license found in the
70
70
  * LICENSE file in the root directory of this source tree.
71
- */var Oi;function Ku(){if(Oi)return Or;Oi=1;var e=m;function t(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,i=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Or.useSyncExternalStoreWithSelector=function(s,a,c,d,p){var f=o(null);if(f.current===null){var g={hasValue:!1,value:null};f.current=g}else g=f.current;f=l(function(){function E(j){if(!M){if(M=!0,w=j,j=d(j),p!==void 0&&g.hasValue){var k=g.value;if(p(k,j))return N=k}return N=j}if(k=N,n(w,j))return k;var B=d(j);return p!==void 0&&p(k,B)?(w=j,k):(w=j,N=B)}var M=!1,w,N,F=c===void 0?null:c;return[function(){return E(a())},F===null?void 0:function(){return E(F())}]},[a,c,d,p]);var v=r(s,f[0],f[1]);return i(function(){g.hasValue=!0,g.value=v},[v]),u(v),v},Or}var Tr={};/**
71
+ */var Ju;function jg(){if(Ju)return $i;Ju=1;var e=S;function t(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;return $i.useSyncExternalStoreWithSelector=function(a,u,l,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 v(k){if(!C){if(C=!0,b=k,k=f(k),p!==void 0&&h.hasValue){var D=h.value;if(p(D,k))return $=D}return $=k}if(D=$,n(b,k))return D;var j=f(k);return p!==void 0&&p(D,j)?(b=k,D):(b=k,$=j)}var C=!1,b,$,B=l===void 0?null:l;return[function(){return v(u())},B===null?void 0:function(){return v(B())}]},[u,l,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},$i}var Ai={};/**
72
72
  * @license React
73
73
  * use-sync-external-store-with-selector.development.js
74
74
  *
@@ -76,45 +76,87 @@ React keys must be passed directly to JSX without using spread:
76
76
  *
77
77
  * This source code is licensed under the MIT license found in the
78
78
  * LICENSE file in the root directory of this source tree.
79
- */var Ti;function qu(){return Ti||(Ti=1,process.env.NODE_ENV!=="production"&&function(){function e(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=m,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,i=t.useEffect,l=t.useMemo,u=t.useDebugValue;Tr.useSyncExternalStoreWithSelector=function(s,a,c,d,p){var f=o(null);if(f.current===null){var g={hasValue:!1,value:null};f.current=g}else g=f.current;f=l(function(){function E(j){if(!M){if(M=!0,w=j,j=d(j),p!==void 0&&g.hasValue){var k=g.value;if(p(k,j))return N=k}return N=j}if(k=N,n(w,j))return k;var B=d(j);return p!==void 0&&p(k,B)?(w=j,k):(w=j,N=B)}var M=!1,w,N,F=c===void 0?null:c;return[function(){return E(a())},F===null?void 0:function(){return E(F())}]},[a,c,d,p]);var v=r(s,f[0],f[1]);return i(function(){g.hasValue=!0,g.value=v},[v]),u(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Tr}process.env.NODE_ENV==="production"?Cr.exports=Ku():Cr.exports=qu();var Xu=Cr.exports;function Ue(e,t,n=wi){return Xu.useSyncExternalStoreWithSelector(ne(r=>e.subscribe(Qu,r)),ne(()=>e.state),ne(()=>e.state),ne(t),n)}function Qu(e){return e}function Ni(e,t){let n=m.useId(),r=Sr.get(t),[o,i]=Ue(r,m.useCallback(l=>[r.selectors.isTop(l,n),r.selectors.inStack(l,n)],[r,n]));return ue(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?i?o:!0:!1}let Nr=new Map,Qt=new Map;function Li(e){var t;let n=(t=Qt.get(e))!=null?t:0;return Qt.set(e,n+1),n!==0?()=>Pi(e):(Nr.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Pi(e))}function Pi(e){var t;let n=(t=Qt.get(e))!=null?t:1;if(n===1?Qt.delete(e):Qt.set(e,n-1),n!==1)return;let r=Nr.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Nr.delete(e))}function Zu(e,{allowed:t,disallowed:n}={}){let r=Ni(e,"inert-others");ue(()=>{var o,i;if(!r)return;let l=Ke();for(let s of(o=n==null?void 0:n())!=null?o:[])s&&l.add(Li(s));let u=(i=t==null?void 0:t())!=null?i:[];for(let s of u){if(!s)continue;let a=Kt(s);if(!a)continue;let c=s.parentElement;for(;c&&c!==a.body;){for(let d of c.children)u.some(p=>d.contains(p))||l.add(Li(d));c=c.parentElement}}return l.dispose},[r,t,n])}function Ju(e,t,n){let r=Ot(o=>{let i=o.getBoundingClientRect();i.x===0&&i.y===0&&i.width===0&&i.height===0&&n()});m.useEffect(()=>{if(!e)return;let o=t===null?null:at(t)?t:t.current;if(!o)return;let i=Ke();if(typeof ResizeObserver<"u"){let l=new ResizeObserver(()=>r.current(o));l.observe(o),i.add(()=>l.disconnect())}if(typeof IntersectionObserver<"u"){let l=new IntersectionObserver(()=>r.current(o));l.observe(o),i.add(()=>l.disconnect())}return()=>i.dispose()},[t,r,e])}let Lr=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),ec=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Pr=(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))(Pr||{}),tc=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(tc||{}),nc=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(nc||{});function Di(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Lr)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function rc(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(ec)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Dr=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Dr||{});function $i(e,t=0){var n;return e===((n=Kt(e))==null?void 0:n.body)?!1:_e(t,{0(){return e.matches(Lr)},1(){let r=e;for(;r!==null;){if(r.matches(Lr))return!0;r=r.parentElement}return!1}})}var oc=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(oc||{});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 ic=["textarea","input"].join(",");function sc(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,ic))!=null?n:!1}function Ai(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),i=t(r);if(o===null||i===null)return 0;let l=o.compareDocumentPosition(i);return l&Node.DOCUMENT_POSITION_FOLLOWING?-1:l&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function lc(e,t){return ac(Di(),t,{relativeTo:e})}function ac(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,l=Array.isArray(e)?n?Ai(e):e:t&64?rc(e):Di(e);o.length>0&&l.length>1&&(l=l.filter(f=>!o.some(g=>g!=null&&"current"in g?(g==null?void 0:g.current)===f:g===f))),r=r??i.activeElement;let u=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,l.indexOf(r))-1;if(t&4)return Math.max(0,l.indexOf(r))+1;if(t&8)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=t&32?{preventScroll:!0}:{},c=0,d=l.length,p;do{if(c>=d||c+d<=0)return 0;let f=s+c;if(t&16)f=(f+d)%d;else{if(f<0)return 3;if(f>=d)return 1}p=l[f],p==null||p.focus(a),c+=u}while(p!==i.activeElement);return t&6&&sc(p)&&p.select(),2}function Mi(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function uc(){return/Android/gi.test(window.navigator.userAgent)}function Ii(){return Mi()||uc()}function Mt(e,t,n,r){let o=Ot(n);m.useEffect(()=>{if(!e)return;function i(l){o.current(l)}return document.addEventListener(t,i,r),()=>document.removeEventListener(t,i,r)},[e,t,r])}function cc(e,t,n,r){let o=Ot(n);m.useEffect(()=>{if(!e)return;function i(l){o.current(l)}return window.addEventListener(t,i,r),()=>window.removeEventListener(t,i,r)},[e,t,r])}const ji=30;function fc(e,t,n){let r=Ot(n),o=m.useCallback(function(u,s){if(u.defaultPrevented)return;let a=s(u);if(a===null||!a.getRootNode().contains(a)||!a.isConnected)return;let c=function d(p){return typeof p=="function"?d(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let d of c)if(d!==null&&(d.contains(a)||u.composed&&u.composedPath().includes(d)))return;return!$i(a,Dr.Loose)&&a.tabIndex!==-1&&u.preventDefault(),r.current(u,a)},[r,t]),i=m.useRef(null);Mt(e,"pointerdown",u=>{var s,a;Ii()||(i.current=((a=(s=u.composedPath)==null?void 0:s.call(u))==null?void 0:a[0])||u.target)},!0),Mt(e,"pointerup",u=>{if(Ii()||!i.current)return;let s=i.current;return i.current=null,o(u,()=>s)},!0);let l=m.useRef({x:0,y:0});Mt(e,"touchstart",u=>{l.current.x=u.touches[0].clientX,l.current.y=u.touches[0].clientY},!0),Mt(e,"touchend",u=>{let s={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(s.x-l.current.x)>=ji||Math.abs(s.y-l.current.y)>=ji))return o(u,()=>At(u.target)?u.target:null)},!0),cc(e,"blur",u=>o(u,()=>Eu(window.document.activeElement)?window.document.activeElement:null),!0)}function $r(...e){return m.useMemo(()=>Kt(...e),[...e])}var dc=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(dc||{});const xn={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},pc=200,Fi=5;function mc(e,{trigger:t,action:n,close:r,select:o}){let i=m.useRef(null),l=m.useRef(null),u=m.useRef(null);Mt(e&&t!==null,"pointerdown",s=>{br(s==null?void 0:s.target)&&t!=null&&t.contains(s.target)&&(l.current=s.x,u.current=s.y,i.current=s.timeStamp)}),Mt(e&&t!==null,"pointerup",s=>{var a,c;let d=i.current;if(d===null||(i.current=null,!At(s.target))||Math.abs(s.x-((a=l.current)!=null?a:s.x))<Fi&&Math.abs(s.y-((c=u.current)!=null?c:s.y))<Fi)return;let p=n(s);switch(p.kind){case 0:return;case 1:{s.timeStamp-d>pc&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function hc(e,t){return m.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 gc(e){return m.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function vc(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...i){let l=t[o].call(n,...i);l&&(n=l,r.forEach(u=>u()))}}}function bc(){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),i=Math.max(0,e-o);n.style(r,"paddingRight",`${i}px`)}}}function yc(){return Mi()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(i=>i()).some(i=>i.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let u=Ke();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let i=(o=window.scrollY)!=null?o:window.pageYOffset,l=null;t.addEventListener(e,"click",u=>{if(At(u.target))try{let s=u.target.closest("a");if(!s)return;let{hash:a}=new URL(s.href),c=e.querySelector(a);At(c)&&!r(c)&&(l=c)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(At(u.target)&&wu(u.target))if(r(u.target)){let s=u.target;for(;s.parentElement&&r(s.parentElement);)s=s.parentElement;t.style(s,"overscrollBehavior","contain")}else t.style(u.target,"touchAction","none")}),t.addEventListener(e,"touchmove",u=>{if(At(u.target)){if(ci(u.target))return;if(r(u.target)){let s=u.target;for(;s.parentElement&&s.dataset.headlessuiPortal!==""&&!(s.scrollHeight>s.clientHeight||s.scrollWidth>s.clientWidth);)s=s.parentElement;s.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),t.add(()=>{var u;let s=(u=window.scrollY)!=null?u:window.pageYOffset;i!==s&&window.scrollTo(0,i),l&&l.isConnected&&(l.scrollIntoView({block:"nearest"}),l=null)})})}}:{}}function xc(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function wc(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Tt=vc(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Ke(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:wc(n)},o=[yc(),bc(),xc()];o.forEach(({before:i})=>i==null?void 0:i(r)),o.forEach(({after:i})=>i==null?void 0:i(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Tt.subscribe(()=>{let e=Tt.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)&&Tt.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Tt.dispatch("TEARDOWN",n)}});function Ec(e,t,n=()=>({containers:[]})){let r=gc(Tt),o=t?r.get(t):void 0,i=o?o.count>0:!1;return ue(()=>{if(!(!t||!e))return Tt.dispatch("PUSH",t,n),()=>Tt.dispatch("POP",t,n)},[e,t]),i}function Sc(e,t,n=()=>[document.body]){let r=Ni(e,"scroll-lock");Ec(r,t,o=>{var i;return{containers:[...(i=o.containers)!=null?i:[],n]}})}function Ri(e){return[e.screenX,e.screenY]}function Cc(){let e=m.useRef([-1,-1]);return{wasMoved(t){let n=Ri(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Ri(t)}}}function Oc(e=0){let[t,n]=m.useState(e),r=m.useCallback(s=>n(s),[t]),o=m.useCallback(s=>n(a=>a|s),[t]),i=m.useCallback(s=>(t&s)===s,[t]),l=m.useCallback(s=>n(a=>a&~s),[n]),u=m.useCallback(s=>n(a=>a^s),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:i,removeFlag:l,toggleFlag:u}}var ki,_i;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((ki=process==null?void 0:process.env)==null?void 0:ki.NODE_ENV)==="test"&&typeof((_i=Element==null?void 0:Element.prototype)==null?void 0:_i.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
80
- `)),[]});var Tc=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Tc||{});function Bi(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Wi(e,t,n,r){let[o,i]=m.useState(n),{hasFlag:l,addFlag:u,removeFlag:s}=Oc(e&&o?3:0),a=m.useRef(!1),c=m.useRef(!1),d=$t();return ue(()=>{var p;if(e){if(n&&i(!0),!t){n&&u(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),Nc(t,{inFlight:a,prepare(){c.current?c.current=!1:c.current=a.current,a.current=!0,!c.current&&(n?(u(3),s(4)):(u(4),s(2)))},run(){c.current?n?(s(3),u(4)):(s(4),u(3)):n?s(1):u(1)},done(){var f;c.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(a.current=!1,s(7),n||i(!1),(f=r==null?void 0:r.end)==null||f.call(r,n))}})}},[e,n,t,d]),e?[o,{closed:l(1),enter:l(2),leave:l(4),transition:l(2)||l(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Nc(e,{prepare:t,run:n,done:r,inFlight:o}){let i=Ke();return Pc(e,{prepare:t,inFlight:o}),i.nextFrame(()=>{n(),i.requestAnimationFrame(()=>{i.add(Lc(e,r))})}),i.dispose}function Lc(e,t){var n,r;let o=Ke();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!0});let l=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(u=>u instanceof CSSTransition))!=null?r:[];return l.length===0?(t(),o.dispose):(Promise.allSettled(l.map(u=>u.finished)).then(()=>{i||t()}),o.dispose)}function Pc(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 wn(){return typeof window<"u"}function It(e){return Ar(e)?(e.nodeName||"").toLowerCase():"#document"}function Le(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Je(e){var t;return(t=(Ar(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ar(e){return wn()?e instanceof Node||e instanceof Le(e).Node:!1}function oe(e){return wn()?e instanceof Element||e instanceof Le(e).Element:!1}function Ce(e){return wn()?e instanceof HTMLElement||e instanceof Le(e).HTMLElement:!1}function Mr(e){return!wn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Le(e).ShadowRoot}const Dc=new Set(["inline","contents"]);function Zt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Dc.has(o)}const $c=new Set(["table","td","th"]);function Ac(e){return $c.has(It(e))}const Mc=[":popover-open",":modal"];function En(e){return Mc.some(t=>{try{return e.matches(t)}catch{return!1}})}const Ic=["transform","translate","scale","rotate","perspective"],jc=["transform","translate","scale","rotate","perspective","filter"],Fc=["paint","layout","strict","content"];function Ir(e){const t=Sn(),n=oe(e)?Ve(e):e;return Ic.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)||jc.some(r=>(n.willChange||"").includes(r))||Fc.some(r=>(n.contain||"").includes(r))}function Rc(e){let t=ct(e);for(;Ce(t)&&!ut(t);){if(Ir(t))return t;if(En(t))return null;t=ct(t)}return null}function Sn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const kc=new Set(["html","body","#document"]);function ut(e){return kc.has(It(e))}function Ve(e){return Le(e).getComputedStyle(e)}function Cn(e){return oe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ct(e){if(It(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Mr(e)&&e.host||Je(e);return Mr(t)?t.host:t}function Ui(e){const t=ct(e);return ut(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ce(t)&&Zt(t)?t:Ui(t)}function yt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ui(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=Le(o);if(i){const u=jr(l);return t.concat(l,l.visualViewport||[],Zt(o)?o:[],u&&n?yt(u):[])}return t.concat(o,yt(o,[],n))}function jr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _c(){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 ft=Math.min,we=Math.max,Jt=Math.round,On=Math.floor,et=e=>({x:e,y:e}),Bc={left:"right",right:"left",bottom:"top",top:"bottom"},Wc={start:"end",end:"start"};function Fr(e,t,n){return we(e,ft(t,n))}function Nt(e,t){return typeof e=="function"?e(t):e}function xt(e){return e.split("-")[0]}function jt(e){return e.split("-")[1]}function Vi(e){return e==="x"?"y":"x"}function Rr(e){return e==="y"?"height":"width"}const Uc=new Set(["top","bottom"]);function dt(e){return Uc.has(xt(e))?"y":"x"}function kr(e){return Vi(dt(e))}function Vc(e,t,n){n===void 0&&(n=!1);const r=jt(e),o=kr(e),i=Rr(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=Tn(l)),[l,Tn(l)]}function zc(e){const t=Tn(e);return[_r(e),t,_r(t)]}function _r(e){return e.replace(/start|end/g,t=>Wc[t])}const zi=["left","right"],Hi=["right","left"],Hc=["top","bottom"],Gc=["bottom","top"];function Yc(e,t,n){switch(e){case"top":case"bottom":return n?t?Hi:zi:t?zi:Hi;case"left":case"right":return t?Hc:Gc;default:return[]}}function Kc(e,t,n,r){const o=jt(e);let i=Yc(xt(e),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(_r)))),i}function Tn(e){return e.replace(/left|right|bottom|top/g,t=>Bc[t])}function qc(e){return{top:0,right:0,bottom:0,left:0,...e}}function Gi(e){return typeof e!="number"?qc(e):{top:e,right:e,bottom:e,left:e}}function Nn(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}}/*!
79
+ */var el;function _g(){return el||(el=1,process.env.NODE_ENV!=="production"&&function(){function e(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=S,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Ai.useSyncExternalStoreWithSelector=function(a,u,l,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 v(k){if(!C){if(C=!0,b=k,k=f(k),p!==void 0&&h.hasValue){var D=h.value;if(p(D,k))return $=D}return $=k}if(D=$,n(b,k))return D;var j=f(k);return p!==void 0&&p(D,j)?(b=k,D):(b=k,$=j)}var C=!1,b,$,B=l===void 0?null:l;return[function(){return v(u())},B===null?void 0:function(){return v(B())}]},[u,l,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())}()),Ai}process.env.NODE_ENV==="production"?Pi.exports=jg():Pi.exports=_g();var Ug=Pi.exports;function st(e,t,n=Ku){return Ug.useSyncExternalStoreWithSelector(ce(r=>e.subscribe(zg,r)),ce(()=>e.state),ce(()=>e.state),ce(t),n)}function zg(e){return e}function tl(e,t){let n=S.useId(),r=Si.get(t),[o,s]=st(r,S.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return ge(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Ti=new Map,Br=new Map;function nl(e){var t;let n=(t=Br.get(e))!=null?t:0;return Br.set(e,n+1),n!==0?()=>rl(e):(Ti.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>rl(e))}function rl(e){var t;let n=(t=Br.get(e))!=null?t:1;if(n===1?Br.delete(e):Br.set(e,n-1),n!==1)return;let r=Ti.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Ti.delete(e))}function Wg(e,{allowed:t,disallowed:n}={}){let r=tl(e,"inert-others");ge(()=>{var o,s;if(!r)return;let i=ht();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(nl(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=Ir(a);if(!u)continue;let l=a.parentElement;for(;l&&l!==u.body;){for(let f of l.children)c.some(p=>f.contains(p))||i.add(nl(f));l=l.parentElement}}return i.dispose},[r,t,n])}function Hg(e,t,n){let r=$n(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});S.useEffect(()=>{if(!e)return;let o=t===null?null:zt(t)?t:t.current;if(!o)return;let s=ht();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 Ci=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),Vg=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Oi=(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))(Oi||{}),Gg=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Gg||{}),qg=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(qg||{});function ol(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ci)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Zg(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Vg)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ni=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ni||{});function sl(e,t=0){var n;return e===((n=Ir(e))==null?void 0:n.body)?!1:nt(t,{0(){return e.matches(Ci)},1(){let r=e;for(;r!==null;){if(r.matches(Ci))return!0;r=r.parentElement}return!1}})}var Kg=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Kg||{});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 Yg=["textarea","input"].join(",");function Xg(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Yg))!=null?n:!1}function il(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 Qg(e,t){return Jg(ol(),t,{relativeTo:e})}function Jg(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?il(e):e:t&64?Zg(e):ol(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.activeElement;let c=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},l=0,f=i.length,p;do{if(l>=f||l+f<=0)return 0;let d=a+l;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(u),l+=c}while(p!==s.activeElement);return t&6&&Xg(p)&&p.select(),2}function al(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function eb(){return/Android/gi.test(window.navigator.userAgent)}function cl(){return al()||eb()}function qn(e,t,n,r){let o=$n(n);S.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 tb(e,t,n,r){let o=$n(n);S.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 ul=30;function nb(e,t,n){let r=$n(n),o=S.useCallback(function(c,a){if(c.defaultPrevented)return;let u=a(c);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let l=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of l)if(f!==null&&(f.contains(u)||c.composed&&c.composedPath().includes(f)))return;return!sl(u,Ni.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=S.useRef(null);qn(e,"pointerdown",c=>{var a,u;cl()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),qn(e,"pointerup",c=>{if(cl()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=S.useRef({x:0,y:0});qn(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),qn(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=ul||Math.abs(a.y-i.current.y)>=ul))return o(c,()=>Gn(c.target)?c.target:null)},!0),tb(e,"blur",c=>o(c,()=>pg(window.document.activeElement)?window.document.activeElement:null),!0)}function Ii(...e){return S.useMemo(()=>Ir(...e),[...e])}var rb=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(rb||{});const zo={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},ob=200,ll=5;function sb(e,{trigger:t,action:n,close:r,select:o}){let s=S.useRef(null),i=S.useRef(null),c=S.useRef(null);qn(e&&t!==null,"pointerdown",a=>{yi(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),qn(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!Gn(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<ll&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<ll)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>ob&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function ib(e,t){return S.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 ab(e){return S.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function cb(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 ub(){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 lb(){return al()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=ht();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(Gn(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);Gn(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(Gn(c.target)&&dg(c.target))if(r(c.target)){let a=c.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(Gn(c.target)){if(Du(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 fb(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function db(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let An=cb(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:ht(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:db(n)},o=[lb(),ub(),fb()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});An.subscribe(()=>{let e=An.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)&&An.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&An.dispatch("TEARDOWN",n)}});function pb(e,t,n=()=>({containers:[]})){let r=ab(An),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ge(()=>{if(!(!t||!e))return An.dispatch("PUSH",t,n),()=>An.dispatch("POP",t,n)},[e,t]),s}function hb(e,t,n=()=>[document.body]){let r=tl(e,"scroll-lock");pb(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function fl(e){return[e.screenX,e.screenY]}function mb(){let e=S.useRef([-1,-1]);return{wasMoved(t){let n=fl(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=fl(t)}}}function gb(e=0){let[t,n]=S.useState(e),r=S.useCallback(a=>n(a),[t]),o=S.useCallback(a=>n(u=>u|a),[t]),s=S.useCallback(a=>(t&a)===a,[t]),i=S.useCallback(a=>n(u=>u&~a),[n]),c=S.useCallback(a=>n(u=>u^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var dl,pl;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((dl=process==null?void 0:process.env)==null?void 0:dl.NODE_ENV)==="test"&&typeof((pl=Element==null?void 0:Element.prototype)==null?void 0:pl.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
80
+ `)),[]});var bb=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(bb||{});function hl(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function ml(e,t,n,r){let[o,s]=S.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=gb(e&&o?3:0),u=S.useRef(!1),l=S.useRef(!1),f=Vn();return ge(()=>{var p;if(e){if(n&&s(!0),!t){n&&c(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),yb(t,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){l.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var d;l.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(u.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 yb(e,{prepare:t,run:n,done:r,inFlight:o}){let s=ht();return wb(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(vb(e,r))})}),s.dispose}function vb(e,t){var n,r;let o=ht();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(c=>c instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(c=>c.finished)).then(()=>{s||t()}),o.dispose)}function wb(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function Wo(){return typeof window<"u"}function Zn(e){return Mi(e)?(e.nodeName||"").toLowerCase():"#document"}function Ue(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ct(e){var t;return(t=(Mi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mi(e){return Wo()?e instanceof Node||e instanceof Ue(e).Node:!1}function de(e){return Wo()?e instanceof Element||e instanceof Ue(e).Element:!1}function ke(e){return Wo()?e instanceof HTMLElement||e instanceof Ue(e).HTMLElement:!1}function Li(e){return!Wo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ue(e).ShadowRoot}const xb=new Set(["inline","contents"]);function kr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=it(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!xb.has(o)}const Eb=new Set(["table","td","th"]);function Sb(e){return Eb.has(Zn(e))}const Pb=[":popover-open",":modal"];function Ho(e){return Pb.some(t=>{try{return e.matches(t)}catch{return!1}})}const $b=["transform","translate","scale","rotate","perspective"],Ab=["transform","translate","scale","rotate","perspective","filter"],Tb=["paint","layout","strict","content"];function Bi(e){const t=Vo(),n=de(e)?it(e):e;return $b.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Ab.some(r=>(n.willChange||"").includes(r))||Tb.some(r=>(n.contain||"").includes(r))}function Cb(e){let t=Ht(e);for(;ke(t)&&!Wt(t);){if(Bi(t))return t;if(Ho(t))return null;t=Ht(t)}return null}function Vo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ob=new Set(["html","body","#document"]);function Wt(e){return Ob.has(Zn(e))}function it(e){return Ue(e).getComputedStyle(e)}function Go(e){return de(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ht(e){if(Zn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Li(e)&&e.host||Ct(e);return Li(t)?t.host:t}function gl(e){const t=Ht(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:ke(t)&&kr(t)?t:gl(t)}function pn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=gl(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ue(o);if(s){const c=ki(i);return t.concat(i,i.visualViewport||[],kr(o)?o:[],c&&n?pn(c):[])}return t.concat(o,pn(o,[],n))}function ki(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Nb(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const Vt=Math.min,Me=Math.max,Rr=Math.round,qo=Math.floor,Ot=e=>({x:e,y:e}),Ib={left:"right",right:"left",bottom:"top",top:"bottom"},Mb={start:"end",end:"start"};function Ri(e,t,n){return Me(e,Vt(t,n))}function Tn(e,t){return typeof e=="function"?e(t):e}function hn(e){return e.split("-")[0]}function Kn(e){return e.split("-")[1]}function bl(e){return e==="x"?"y":"x"}function Fi(e){return e==="y"?"height":"width"}const Lb=new Set(["top","bottom"]);function Gt(e){return Lb.has(hn(e))?"y":"x"}function Di(e){return bl(Gt(e))}function Bb(e,t,n){n===void 0&&(n=!1);const r=Kn(e),o=Di(e),s=Fi(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Zo(i)),[i,Zo(i)]}function kb(e){const t=Zo(e);return[ji(e),t,ji(t)]}function ji(e){return e.replace(/start|end/g,t=>Mb[t])}const yl=["left","right"],vl=["right","left"],Rb=["top","bottom"],Fb=["bottom","top"];function Db(e,t,n){switch(e){case"top":case"bottom":return n?t?vl:yl:t?yl:vl;case"left":case"right":return t?Rb:Fb;default:return[]}}function jb(e,t,n,r){const o=Kn(e);let s=Db(hn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ji)))),s}function Zo(e){return e.replace(/left|right|bottom|top/g,t=>Ib[t])}function _b(e){return{top:0,right:0,bottom:0,left:0,...e}}function wl(e){return typeof e!="number"?_b(e):{top:e,right:e,bottom:e,left:e}}function Ko(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
81
81
  * tabbable 6.2.0
82
82
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
83
- */var Xc=["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])"],Br=Xc.join(","),Yi=typeof Element>"u",en=Yi?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ln=!Yi&&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},Pn=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",l=i||n&&t&&e(t.parentNode);return l},Qc=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Zc=function(t,n,r){if(Pn(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Br));return n&&en.call(t,Br)&&o.unshift(t),o=o.filter(r),o},Jc=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!Pn(l,!1))if(l.tagName==="SLOT"){var u=l.assignedElements(),s=u.length?u:l.children,a=e(s,!0,r);r.flatten?o.push.apply(o,a):o.push({scopeParent:l,candidates:a})}else{var c=en.call(l,Br);c&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var d=l.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(l),p=!Pn(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(d&&p){var f=e(d===!0?l.children:d.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else i.unshift.apply(i,l.children)}}return o},Ki=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},qi=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Qc(t))&&!Ki(t)?0:t.tabIndex},ef=function(t,n){var r=qi(t);return r<0&&n&&!Ki(t)?0:r},tf=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Xi=function(t){return t.tagName==="INPUT"},nf=function(t){return Xi(t)&&t.type==="hidden"},rf=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},of=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},sf=function(t){if(!t.name)return!0;var n=t.form||Ln(t),r=function(u){return n.querySelectorAll('input[type="radio"][name="'+u+'"]')},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(l){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",l.message),!1}var i=of(o,t.form);return!i||i===t},lf=function(t){return Xi(t)&&t.type==="radio"},af=function(t){return lf(t)&&!sf(t)},uf=function(t){var n,r=t&&Ln(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var l,u,s;for(i=!!((l=o)!==null&&l!==void 0&&(u=l.ownerDocument)!==null&&u!==void 0&&u.contains(o)||t!=null&&(s=t.ownerDocument)!==null&&s!==void 0&&s.contains(t));!i&&o;){var a,c,d;r=Ln(o),o=(a=r)===null||a===void 0?void 0:a.host,i=!!((c=o)!==null&&c!==void 0&&(d=c.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},Qi=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},cf=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=en.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(en.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var u=t;t;){var s=t.parentElement,a=Ln(t);if(s&&!s.shadowRoot&&o(s)===!0)return Qi(t);t.assignedSlot?t=t.assignedSlot:!s&&a!==t.ownerDocument?t=a.host:t=s}t=u}if(uf(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Qi(t);return!1},ff=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 en.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},df=function(t,n){return!(n.disabled||Pn(n)||nf(n)||cf(n,t)||rf(n)||ff(n))},Zi=function(t,n){return!(af(n)||qi(n)<0||!df(t,n))},pf=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},mf=function e(t){var n=[],r=[];return t.forEach(function(o,i){var l=!!o.scopeParent,u=l?o.scopeParent:o,s=ef(u,l),a=l?e(o.candidates):u;s===0?l?n.push.apply(n,a):n.push(u):r.push({documentOrder:i,tabIndex:s,item:o,isScope:l,content:a})}),r.sort(tf).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},Ji=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Jc([t],n.includeContainer,{filter:Zi.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:pf}):r=Zc(t,n.includeContainer,Zi.bind(null,n)),mf(r)};function es(e,t,n){let{reference:r,floating:o}=e;const i=dt(t),l=kr(t),u=Rr(l),s=xt(t),a=i==="y",c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[u]/2-o[u]/2;let f;switch(s){case"top":f={x:c,y:r.y-o.height};break;case"bottom":f={x:c,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(jt(t)){case"start":f[l]-=p*(n&&a?-1:1);break;case"end":f[l]+=p*(n&&a?-1:1);break}return f}const hf=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),s=await(l.isRTL==null?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=es(a,r,s),p=r,f={},g=0;for(let v=0;v<u.length;v++){const{name:E,fn:M}=u[v],{x:w,y:N,data:F,reset:j}=await M({x:c,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:a,platform:l,elements:{reference:e,floating:t}});c=w??c,d=N??d,f={...f,[E]:{...f[E],...F}},j&&g<=50&&(g++,typeof j=="object"&&(j.placement&&(p=j.placement),j.rects&&(a=j.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):j.rects),{x:c,y:d}=es(a,p,s)),v=-1)}return{x:c,y:d,placement:p,strategy:o,middlewareData:f}};async function Dn(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:l,elements:u,strategy:s}=e,{boundary:a="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Nt(t,e),g=Gi(f),E=u[p?d==="floating"?"reference":"floating":d],M=Nn(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(E)))==null||n?E:E.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:a,rootBoundary:c,strategy:s})),w=d==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),F=await(i.isElement==null?void 0:i.isElement(N))?await(i.getScale==null?void 0:i.getScale(N))||{x:1,y:1}:{x:1,y:1},j=Nn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:w,offsetParent:N,strategy:s}):w);return{top:(M.top-j.top+g.top)/F.y,bottom:(j.bottom-M.bottom+g.bottom)/F.y,left:(M.left-j.left+g.left)/F.x,right:(j.right-M.right+g.right)/F.x}}const gf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:u,middlewareData:s}=t,{element:a,padding:c=0}=Nt(e,t)||{};if(a==null)return{};const d=Gi(c),p={x:n,y:r},f=kr(o),g=Rr(f),v=await l.getDimensions(a),E=f==="y",M=E?"top":"left",w=E?"bottom":"right",N=E?"clientHeight":"clientWidth",F=i.reference[g]+i.reference[f]-p[f]-i.floating[g],j=p[f]-i.reference[f],k=await(l.getOffsetParent==null?void 0:l.getOffsetParent(a));let B=k?k[N]:0;(!B||!await(l.isElement==null?void 0:l.isElement(k)))&&(B=u.floating[N]||i.floating[g]);const h=F/2-j/2,b=B/2-v[g]/2-1,y=ft(d[M],b),$=ft(d[w],b),D=y,L=B-v[g]-$,C=B/2-v[g]/2+h,O=Fr(D,C,L),T=!s.arrow&&jt(o)!=null&&C!==O&&i.reference[g]/2-(C<D?y:$)-v[g]/2<0,P=T?C<D?C-D:C-L:0;return{[f]:p[f]+P,data:{[f]:O,centerOffset:C-O-P,...T&&{alignmentOffset:P}},reset:T}}}),vf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:u,platform:s,elements:a}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...E}=Nt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const M=xt(o),w=dt(u),N=xt(u)===u,F=await(s.isRTL==null?void 0:s.isRTL(a.floating)),j=p||(N||!v?[Tn(u)]:zc(u)),k=g!=="none";!p&&k&&j.push(...Kc(u,v,g,F));const B=[u,...j],h=await Dn(t,E),b=[];let y=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&b.push(h[M]),d){const C=Vc(o,l,F);b.push(h[C[0]],h[C[1]])}if(y=[...y,{placement:o,overflows:b}],!b.every(C=>C<=0)){var $,D;const C=((($=i.flip)==null?void 0:$.index)||0)+1,O=B[C];if(O&&(!(d==="alignment"?w!==dt(O):!1)||y.every(x=>dt(x.placement)===w?x.overflows[0]>0:!0)))return{data:{index:C,overflows:y},reset:{placement:O}};let T=(D=y.filter(P=>P.overflows[0]<=0).sort((P,x)=>P.overflows[1]-x.overflows[1])[0])==null?void 0:D.placement;if(!T)switch(f){case"bestFit":{var L;const P=(L=y.filter(x=>{if(k){const I=dt(x.placement);return I===w||I==="y"}return!0}).map(x=>[x.placement,x.overflows.filter(I=>I>0).reduce((I,_)=>I+_,0)]).sort((x,I)=>x[1]-I[1])[0])==null?void 0:L[0];P&&(T=P);break}case"initialPlacement":T=u;break}if(o!==T)return{reset:{placement:T}}}return{}}}},bf=new Set(["left","top"]);async function yf(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=xt(n),u=jt(n),s=dt(n)==="y",a=bf.has(l)?-1:1,c=i&&s?-1:1,d=Nt(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return u&&typeof g=="number"&&(f=u==="end"?g*-1:g),s?{x:f*c,y:p*a}:{x:p*a,y:f*c}}const xf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:u}=t,s=await yf(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}},wf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:u={fn:E=>{let{x:M,y:w}=E;return{x:M,y:w}}},...s}=Nt(e,t),a={x:n,y:r},c=await Dn(t,s),d=dt(xt(o)),p=Vi(d);let f=a[p],g=a[d];if(i){const E=p==="y"?"top":"left",M=p==="y"?"bottom":"right",w=f+c[E],N=f-c[M];f=Fr(w,f,N)}if(l){const E=d==="y"?"top":"left",M=d==="y"?"bottom":"right",w=g+c[E],N=g-c[M];g=Fr(w,g,N)}const v=u.fn({...t,[p]:f,[d]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[p]:i,[d]:l}}}}}},Ef=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:l,elements:u}=t,{apply:s=()=>{},...a}=Nt(e,t),c=await Dn(t,a),d=xt(o),p=jt(o),f=dt(o)==="y",{width:g,height:v}=i.floating;let E,M;d==="top"||d==="bottom"?(E=d,M=p===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(M=d,E=p==="end"?"top":"bottom");const w=v-c.top-c.bottom,N=g-c.left-c.right,F=ft(v-c[E],w),j=ft(g-c[M],N),k=!t.middlewareData.shift;let B=F,h=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(h=N),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(B=w),k&&!p){const y=we(c.left,0),$=we(c.right,0),D=we(c.top,0),L=we(c.bottom,0);f?h=g-2*(y!==0||$!==0?y+$:we(c.left,c.right)):B=v-2*(D!==0||L!==0?D+L:we(c.top,c.bottom))}await s({...t,availableWidth:h,availableHeight:B});const b=await l.getDimensions(u.floating);return g!==b.width||v!==b.height?{reset:{rects:!0}}:{}}}};function ts(e){const t=Ve(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ce(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=Jt(n)!==i||Jt(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function Wr(e){return oe(e)?e:e.contextElement}function Ft(e){const t=Wr(e);if(!Ce(t))return et(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ts(t);let l=(i?Jt(n.width):n.width)/r,u=(i?Jt(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const Sf=et(0);function ns(e){const t=Le(e);return!Sn()||!t.visualViewport?Sf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Cf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Le(e)?!1:t}function Lt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Wr(e);let l=et(1);t&&(r?oe(r)&&(l=Ft(r)):l=Ft(e));const u=Cf(i,n,r)?ns(i):et(0);let s=(o.left+u.x)/l.x,a=(o.top+u.y)/l.y,c=o.width/l.x,d=o.height/l.y;if(i){const p=Le(i),f=r&&oe(r)?Le(r):r;let g=p,v=jr(g);for(;v&&r&&f!==g;){const E=Ft(v),M=v.getBoundingClientRect(),w=Ve(v),N=M.left+(v.clientLeft+parseFloat(w.paddingLeft))*E.x,F=M.top+(v.clientTop+parseFloat(w.paddingTop))*E.y;s*=E.x,a*=E.y,c*=E.x,d*=E.y,s+=N,a+=F,g=Le(v),v=jr(g)}}return Nn({width:c,height:d,x:s,y:a})}function $n(e,t){const n=Cn(e).scrollLeft;return t?t.left+n:Lt(Je(e)).left+n}function rs(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-$n(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Of(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",l=Je(r),u=t?En(t.floating):!1;if(r===l||u&&i)return n;let s={scrollLeft:0,scrollTop:0},a=et(1);const c=et(0),d=Ce(r);if((d||!d&&!i)&&((It(r)!=="body"||Zt(l))&&(s=Cn(r)),Ce(r))){const f=Lt(r);a=Ft(r),c.x=f.x+r.clientLeft,c.y=f.y+r.clientTop}const p=l&&!d&&!i?rs(l,s):et(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-s.scrollLeft*a.x+c.x+p.x,y:n.y*a.y-s.scrollTop*a.y+c.y+p.y}}function Tf(e){return Array.from(e.getClientRects())}function Nf(e){const t=Je(e),n=Cn(e),r=e.ownerDocument.body,o=we(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=we(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+$n(e);const u=-n.scrollTop;return Ve(r).direction==="rtl"&&(l+=we(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}const os=25;function Lf(e,t){const n=Le(e),r=Je(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,s=0;if(o){i=o.width,l=o.height;const c=Sn();(!c||c&&t==="fixed")&&(u=o.offsetLeft,s=o.offsetTop)}const a=$n(r);if(a<=0){const c=r.ownerDocument,d=c.body,p=getComputedStyle(d),f=c.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-d.clientWidth-f);g<=os&&(i-=g)}else a<=os&&(i+=a);return{width:i,height:l,x:u,y:s}}const Pf=new Set(["absolute","fixed"]);function Df(e,t){const n=Lt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ce(e)?Ft(e):et(1),l=e.clientWidth*i.x,u=e.clientHeight*i.y,s=o*i.x,a=r*i.y;return{width:l,height:u,x:s,y:a}}function is(e,t,n){let r;if(t==="viewport")r=Lf(e,n);else if(t==="document")r=Nf(Je(e));else if(oe(t))r=Df(t,n);else{const o=ns(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Nn(r)}function ss(e,t){const n=ct(e);return n===t||!oe(n)||ut(n)?!1:Ve(n).position==="fixed"||ss(n,t)}function $f(e,t){const n=t.get(e);if(n)return n;let r=yt(e,[],!1).filter(u=>oe(u)&&It(u)!=="body"),o=null;const i=Ve(e).position==="fixed";let l=i?ct(e):e;for(;oe(l)&&!ut(l);){const u=Ve(l),s=Ir(l);!s&&u.position==="fixed"&&(o=null),(i?!s&&!o:!s&&u.position==="static"&&!!o&&Pf.has(o.position)||Zt(l)&&!s&&ss(e,l))?r=r.filter(c=>c!==l):o=u,l=ct(l)}return t.set(e,r),r}function Af(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?En(t)?[]:$f(t,this._c):[].concat(n),r],u=l[0],s=l.reduce((a,c)=>{const d=is(t,c,o);return a.top=we(d.top,a.top),a.right=ft(d.right,a.right),a.bottom=ft(d.bottom,a.bottom),a.left=we(d.left,a.left),a},is(t,u,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Mf(e){const{width:t,height:n}=ts(e);return{width:t,height:n}}function If(e,t,n){const r=Ce(t),o=Je(t),i=n==="fixed",l=Lt(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const s=et(0);function a(){s.x=$n(o)}if(r||!r&&!i)if((It(t)!=="body"||Zt(o))&&(u=Cn(t)),r){const f=Lt(t,!0,i,t);s.x=f.x+t.clientLeft,s.y=f.y+t.clientTop}else o&&a();i&&!r&&o&&a();const c=o&&!r&&!i?rs(o,u):et(0),d=l.left+u.scrollLeft-s.x-c.x,p=l.top+u.scrollTop-s.y-c.y;return{x:d,y:p,width:l.width,height:l.height}}function Ur(e){return Ve(e).position==="static"}function ls(e,t){if(!Ce(e)||Ve(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Je(e)===n&&(n=n.ownerDocument.body),n}function as(e,t){const n=Le(e);if(En(e))return n;if(!Ce(e)){let o=ct(e);for(;o&&!ut(o);){if(oe(o)&&!Ur(o))return o;o=ct(o)}return n}let r=ls(e,t);for(;r&&Ac(r)&&Ur(r);)r=ls(r,t);return r&&ut(r)&&Ur(r)&&!Ir(r)?n:r||Rc(e)||n}const jf=async function(e){const t=this.getOffsetParent||as,n=this.getDimensions,r=await n(e.floating);return{reference:If(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ff(e){return Ve(e).direction==="rtl"}const Rf={convertOffsetParentRelativeRectToViewportRelativeRect:Of,getDocumentElement:Je,getClippingRect:Af,getOffsetParent:as,getElementRects:jf,getClientRects:Tf,getDimensions:Mf,getScale:Ft,isElement:oe,isRTL:Ff};function us(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kf(e,t){let n=null,r;const o=Je(e);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,s){u===void 0&&(u=!1),s===void 0&&(s=1),i();const a=e.getBoundingClientRect(),{left:c,top:d,width:p,height:f}=a;if(u||t(),!p||!f)return;const g=On(d),v=On(o.clientWidth-(c+p)),E=On(o.clientHeight-(d+f)),M=On(c),N={rootMargin:-g+"px "+-v+"px "+-E+"px "+-M+"px",threshold:we(0,ft(1,s))||1};let F=!0;function j(k){const B=k[0].intersectionRatio;if(B!==s){if(!F)return l();B?l(!1,B):r=setTimeout(()=>{l(!1,1e-7)},1e3)}B===1&&!us(a,e.getBoundingClientRect())&&l(),F=!1}try{n=new IntersectionObserver(j,{...N,root:o.ownerDocument})}catch{n=new IntersectionObserver(j,N)}n.observe(e)}return l(!0),i}function cs(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:s=!1}=r,a=Wr(e),c=o||i?[...a?yt(a):[],...yt(t)]:[];c.forEach(M=>{o&&M.addEventListener("scroll",n,{passive:!0}),i&&M.addEventListener("resize",n)});const d=a&&u?kf(a,n):null;let p=-1,f=null;l&&(f=new ResizeObserver(M=>{let[w]=M;w&&w.target===a&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var N;(N=f)==null||N.observe(t)})),n()}),a&&!s&&f.observe(a),f.observe(t));let g,v=s?Lt(e):null;s&&E();function E(){const M=Lt(e);v&&!us(v,M)&&n(),v=M,g=requestAnimationFrame(E)}return n(),()=>{var M;c.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(M=f)==null||M.disconnect(),f=null,s&&cancelAnimationFrame(g)}}const Vr=Dn,_f=xf,Bf=wf,Wf=vf,Uf=Ef,fs=gf,Vf=(e,t,n)=>{const r=new Map,o={platform:Rf,...n},i={...o.platform,_c:r};return hf(e,t,{...o,platform:i})};var zf=typeof document<"u",Hf=function(){},An=zf?m.useLayoutEffect:Hf;function Mn(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(!Mn(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 i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Mn(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function ds(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ps(e,t){const n=ds(e);return Math.round(t*n)/n}function zr(e){const t=R.useRef(e);return An(()=>{t.current=e}),t}function ms(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:l}={},transform:u=!0,whileElementsMounted:s,open:a}=e,[c,d]=R.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=R.useState(r);Mn(p,r)||f(r);const[g,v]=R.useState(null),[E,M]=R.useState(null),w=R.useCallback(x=>{x!==k.current&&(k.current=x,v(x))},[]),N=R.useCallback(x=>{x!==B.current&&(B.current=x,M(x))},[]),F=i||g,j=l||E,k=R.useRef(null),B=R.useRef(null),h=R.useRef(c),b=s!=null,y=zr(s),$=zr(o),D=zr(a),L=R.useCallback(()=>{if(!k.current||!B.current)return;const x={placement:t,strategy:n,middleware:p};$.current&&(x.platform=$.current),Vf(k.current,B.current,x).then(I=>{const _={...I,isPositioned:D.current!==!1};C.current&&!Mn(h.current,_)&&(h.current=_,Vt.flushSync(()=>{d(_)}))})},[p,t,n,$,D]);An(()=>{a===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,d(x=>({...x,isPositioned:!1})))},[a]);const C=R.useRef(!1);An(()=>(C.current=!0,()=>{C.current=!1}),[]),An(()=>{if(F&&(k.current=F),j&&(B.current=j),F&&j){if(y.current)return y.current(F,j,L);L()}},[F,j,L,y,b]);const O=R.useMemo(()=>({reference:k,floating:B,setReference:w,setFloating:N}),[w,N]),T=R.useMemo(()=>({reference:F,floating:j}),[F,j]),P=R.useMemo(()=>{const x={position:n,left:0,top:0};if(!T.floating)return x;const I=ps(T.floating,c.x),_=ps(T.floating,c.y);return u?{...x,transform:"translate("+I+"px, "+_+"px)",...ds(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:_}},[n,u,T.floating,c.x,c.y]);return R.useMemo(()=>({...c,update:L,refs:O,elements:T,floatingStyles:P}),[c,L,O,T,P])}const Gf=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?fs({element:r.current,padding:o}).fn(n):{}:r?fs({element:r,padding:o}).fn(n):{}}}},Hr=(e,t)=>({..._f(e),options:[e,t]}),hs=(e,t)=>({...Bf(e),options:[e,t]}),gs=(e,t)=>({...Wf(e),options:[e,t]}),Yf=(e,t)=>({...Uf(e),options:[e,t]}),Kf=(e,t)=>({...Gf(e),options:[e,t]}),vs={...R},qf=vs.useInsertionEffect||(e=>e());function bs(e){const t=R.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return qf(()=>{t.current=e}),R.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 Gr=typeof document<"u"?m.useLayoutEffect:m.useEffect;let ys=!1,Xf=0;const xs=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Xf++;function Qf(){const[e,t]=R.useState(()=>ys?xs():void 0);return Gr(()=>{e==null&&t(xs())},[]),R.useEffect(()=>{ys=!0},[]),e}const Zf=vs.useId||Qf;let tn;process.env.NODE_ENV!=="production"&&(tn=new Set);function Jf(){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=tn)!=null&&e.has(o))){var i;(i=tn)==null||i.add(o),console.warn(o)}}function ed(){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=tn)!=null&&e.has(o))){var i;(i=tn)==null||i.add(o),console.error(o)}}function td(){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 nd=R.createContext(null),rd=R.createContext(null),od=()=>{var e;return((e=R.useContext(nd))==null?void 0:e.id)||null},id=()=>R.useContext(rd),sd="data-floating-ui-focusable";function ld(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Zf(),i=R.useRef({}),[l]=R.useState(()=>td()),u=od()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!oe(f)&&ed("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,a]=R.useState(r.reference),c=bs((f,g,v)=>{i.current.openEvent=f?g:void 0,l.emit("openchange",{open:f,event:g,reason:v,nested:u}),n==null||n(f,g,v)}),d=R.useMemo(()=>({setPositionReference:a}),[]),p=R.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return R.useMemo(()=>({dataRef:i,open:t,onOpenChange:c,elements:p,events:l,floatingId:o,refs:d}),[t,c,p,l,o,d])}function ad(e){e===void 0&&(e={});const{nodeId:t}=e,n=ld({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,l]=R.useState(null),[u,s]=R.useState(null),c=(o==null?void 0:o.domReference)||i,d=R.useRef(null),p=id();Gr(()=>{c&&(d.current=c)},[c]);const f=ms({...e,elements:{...o,...u&&{reference:u}}}),g=R.useCallback(N=>{const F=oe(N)?{getBoundingClientRect:()=>N.getBoundingClientRect(),contextElement:N}:N;s(F),f.refs.setReference(F)},[f.refs]),v=R.useCallback(N=>{(oe(N)||N===null)&&(d.current=N,l(N)),(oe(f.refs.reference.current)||f.refs.reference.current===null||N!==null&&!oe(N))&&f.refs.setReference(N)},[f.refs]),E=R.useMemo(()=>({...f.refs,setReference:v,setPositionReference:g,domReference:d}),[f.refs,v,g]),M=R.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),w=R.useMemo(()=>({...f,...r,refs:E,elements:M,nodeId:t}),[f,E,M,t,r]);return Gr(()=>{r.dataRef.current.floatingContext=w;const N=p==null?void 0:p.nodesRef.current.find(F=>F.id===t);N&&(N.context=w)}),R.useMemo(()=>({...f,context:w,refs:E,elements:M}),[f,E,M,w])}const ws="active",Es="selected";function Yr(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[ws]:l,[Es]:u,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1,[sd]:""},...i,...t.map(l=>{const u=l?l[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((l,u)=>(u&&Object.entries(u).forEach(s=>{let[a,c]=s;if(!(o&&[ws,Es].includes(a)))if(a.indexOf("on")===0){if(r.has(a)||r.set(a,[]),typeof c=="function"){var d;(d=r.get(a))==null||d.push(c),l[a]=function(){for(var p,f=arguments.length,g=new Array(f),v=0;v<f;v++)g[v]=arguments[v];return(p=r.get(a))==null?void 0:p.map(E=>E(...g)).find(E=>E!==void 0)}}}else l[a]=c}),l),{})}}function ud(e){e===void 0&&(e=[]);const t=e.map(u=>u==null?void 0:u.reference),n=e.map(u=>u==null?void 0:u.floating),r=e.map(u=>u==null?void 0:u.item),o=R.useCallback(u=>Yr(u,e,"reference"),t),i=R.useCallback(u=>Yr(u,e,"floating"),n),l=R.useCallback(u=>Yr(u,e,"item"),r);return R.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:l}),[o,i,l])}function Ss(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const cd=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:i=0,index:l=0,minItemsVisible:u=4,referenceOverflowThreshold:s=0,scrollRef:a,...c}=Nt(e,t),{rects:d,elements:{floating:p}}=t,f=n.current[l],g=(a==null?void 0:a.current)||p,v=p.clientTop||g.clientTop,E=p.clientTop!==0,M=g.clientTop!==0,w=p===g;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Jf('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const N={...t,...await Hr(-f.offsetTop-p.clientTop-d.reference.height/2-f.offsetHeight/2-i).fn(t)},F=await Vr(Ss(N,g.scrollHeight+v+p.clientTop),c),j=await Vr(N,{...c,elementContext:"reference"}),k=we(0,F.top),B=N.y+k,y=(g.scrollHeight>g.clientHeight?$=>$:Jt)(we(0,g.scrollHeight+(E&&w||M?v*2:0)-k-we(0,F.bottom)));if(g.style.maxHeight=y+"px",g.scrollTop=k,o){const $=g.offsetHeight<f.offsetHeight*ft(u,n.current.length)-1||j.top>=-s||j.bottom>=-s;Vt.flushSync(()=>o($))}return r&&(r.current=await Vr(Ss({...N,y:B},g.offsetHeight+v+p.clientTop),c)),{y:B}}});function fd(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:l,onChange:u}=t,s=bs(u),a=R.useRef(!1),c=R.useRef(null),d=R.useRef(null);R.useEffect(()=>{if(!o)return;function f(v){if(v.ctrlKey||!g||i.current==null)return;const E=v.deltaY,M=i.current.top>=-.5,w=i.current.bottom>=-.5,N=g.scrollHeight-g.clientHeight,F=E<0?-1:1,j=E<0?"max":"min";g.scrollHeight<=g.clientHeight||(!M&&E>0||!w&&E<0?(v.preventDefault(),Vt.flushSync(()=>{s(k=>k+Math[j](E,N*F))})):/firefox/i.test(_c())&&(g.scrollTop+=E))}const g=(l==null?void 0:l.current)||r.floating;if(n&&g)return g.addEventListener("wheel",f),requestAnimationFrame(()=>{c.current=g.scrollTop,i.current!=null&&(d.current={...i.current})}),()=>{c.current=null,d.current=null,g.removeEventListener("wheel",f)}},[o,n,r.floating,i,l,s]);const p=R.useMemo(()=>({onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const f=(l==null?void 0:l.current)||r.floating;if(!(!i.current||!f||!a.current)){if(c.current!==null){const g=f.scrollTop-c.current;(i.current.bottom<-.5&&g<-1||i.current.top<-.5&&g>1)&&Vt.flushSync(()=>s(v=>v+g))}requestAnimationFrame(()=>{c.current=f.scrollTop})}}}),[r.floating,s,i,l]);return R.useMemo(()=>o?{floating:p}:{},[o,p])}let Rt=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Rt.displayName="FloatingContext";let Kr=m.createContext(null);Kr.displayName="PlacementContext";function dd(e){return m.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function pd(){return m.useContext(Rt).setReference}function md(){return m.useContext(Rt).getReferenceProps}function hd(){let{getFloatingProps:e,slot:t}=m.useContext(Rt);return m.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function gd(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=m.useContext(Kr),n=m.useMemo(()=>e,[JSON.stringify(e,(o,i)=>{var l;return(l=i==null?void 0:i.outerHTML)!=null?l:i})]);ue(()=>{t==null||t(n??null)},[t,n]);let r=m.useContext(Rt);return m.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Cs=4;function vd({children:e,enabled:t=!0}){let[n,r]=m.useState(null),[o,i]=m.useState(0),l=m.useRef(null),[u,s]=m.useState(null);bd(u);let a=t&&n!==null&&u!==null,{to:c="bottom",gap:d=0,offset:p=0,padding:f=0,inner:g}=yd(n,u),[v,E="center"]=c.split(" ");ue(()=>{a&&i(0)},[a]);let{refs:M,floatingStyles:w,context:N}=ad({open:a,placement:v==="selection"?E==="center"?"bottom":`bottom-${E}`:E==="center"?`${v}`:`${v}-${E}`,strategy:"absolute",transform:!1,middleware:[Hr({mainAxis:v==="selection"?0:d,crossAxis:p}),hs({padding:f}),v!=="selection"&&gs({padding:f}),v==="selection"&&g?cd({...g,padding:f,overflowRef:l,offset:o,minItemsVisible:Cs,referenceOverflowThreshold:f,onFallbackChange($){var D,L;if(!$)return;let C=N.elements.floating;if(!C)return;let O=parseFloat(getComputedStyle(C).scrollPaddingBottom)||0,T=Math.min(Cs,C.childElementCount),P=0,x=0;for(let I of(L=(D=N.elements.floating)==null?void 0:D.childNodes)!=null?L:[])if(at(I)){let _=I.offsetTop,V=_+I.clientHeight+O,W=C.scrollTop,Y=W+C.clientHeight;if(_>=W&&V<=Y)T--;else{x=Math.max(0,Math.min(V,Y)-Math.max(_,W)),P=I.clientHeight;break}}T>=1&&i(I=>{let _=P*T-x+O;return I>=_?I:_})}}):null,Yf({padding:f,apply({availableWidth:$,availableHeight:D,elements:L}){Object.assign(L.floating.style,{overflow:"auto",maxWidth:`${$}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${D}px)`})}})].filter(Boolean),whileElementsMounted:cs}),[F=v,j=E]=N.placement.split("-");v==="selection"&&(F="selection");let k=m.useMemo(()=>({anchor:[F,j].filter(Boolean).join(" ")}),[F,j]),B=fd(N,{overflowRef:l,onChange:i}),{getReferenceProps:h,getFloatingProps:b}=ud([B]),y=ne($=>{s($),M.setFloating($)});return R.createElement(Kr.Provider,{value:r},R.createElement(Rt.Provider,{value:{setFloating:y,setReference:M.setReference,styles:w,getReferenceProps:h,getFloatingProps:b,slot:k}},e))}function bd(e){ue(()=>{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 yd(e,t){var n,r,o;let i=qr((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),l=qr((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=qr((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:i,offset:l,padding:u}}function qr(e,t,n=void 0){let r=$t(),o=ne((s,a)=>{if(s==null)return[n,null];if(typeof s=="number")return[s,null];if(typeof s=="string"){if(!a)return[n,null];let c=Ts(s,a);return[c,d=>{let p=Os(s);{let f=p.map(g=>window.getComputedStyle(a).getPropertyValue(g));r.requestAnimationFrame(function g(){r.nextFrame(g);let v=!1;for(let[M,w]of p.entries()){let N=window.getComputedStyle(a).getPropertyValue(w);if(f[M]!==N){f[M]=N,v=!0;break}}if(!v)return;let E=Ts(s,a);c!==E&&(d(E),c=E)})}return r.dispose}]}return[n,null]}),i=m.useMemo(()=>o(e,t)[0],[e,t]),[l=i,u]=m.useState();return ue(()=>{let[s,a]=o(e,t);if(u(s),!!a)return a(u)},[e,t]),l}function Os(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,...Os(o)]:[r]}return[]}function Ts(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 xd(e,t){let[n,r]=m.useState(t);return!e&&n!==t&&r(t),e?n:t}let Xr=m.createContext(null);Xr.displayName="OpenClosedContext";var qe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(qe||{});function Qr(){return m.useContext(Xr)}function Ns({value:e,children:t}){return m.createElement(Xr.Provider,{value:e},t)}function wd(e){throw new Error("Unexpected object: "+e)}var fe=(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))(fe||{});function In(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 i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{o===-1&&(o=n.length);for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:wd(e)}}var Ls=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Ls||{});function Ps(e){let t=ne(e),n=m.useRef(!1);m.useEffect(()=>(n.current=!1,()=>{n.current=!0,ni(()=>{n.current&&t()})}),[t])}function Ed(){let e=typeof document>"u";return"useSyncExternalStore"in R?(t=>t.useSyncExternalStore)(R)(()=>()=>{},()=>!1,()=>!e):!1}function Zr(){let e=Ed(),[t,n]=R.useState(Qe.isHandoffComplete);return t&&Qe.isHandoffComplete===!1&&n(!1),R.useEffect(()=>{t!==!0&&n(!0)},[t]),R.useEffect(()=>Qe.handoff(),[]),e?!1:t}let Sd=m.createContext(!1);function Cd(){return m.useContext(Sd)}function Od(e){let t=Cd(),n=m.useContext($s),[r,o]=m.useState(()=>{var i;if(!t&&n!==null)return(i=n.current)!=null?i:null;if(Qe.isServer)return null;let l=e==null?void 0:e.getElementById("headlessui-portal-root");if(l)return l;if(e===null)return null;let u=e.createElement("div");return u.setAttribute("id","headlessui-portal-root"),e.body.appendChild(u)});return m.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),m.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Ds=m.Fragment,Td=Ne(function(e,t){let{ownerDocument:n=null,...r}=e,o=m.useRef(null),i=Be(Nu(f=>{o.current=f}),t),l=$r(o),u=n??l,s=Od(u),[a]=m.useState(()=>{var f;return Qe.isServer?null:(f=u==null?void 0:u.createElement("div"))!=null?f:null}),c=m.useContext(Dd),d=Zr();ue(()=>{!s||!a||s.contains(a)||(a.setAttribute("data-headlessui-portal",""),s.appendChild(a))},[s,a]),ue(()=>{if(a&&c)return c.register(a)},[c,a]),Ps(()=>{var f;!s||!a||(br(a)&&s.contains(a)&&s.removeChild(a),s.childNodes.length<=0&&((f=s.parentElement)==null||f.removeChild(s)))});let p=Me();return d?!s||!a?null:Se.createPortal(p({ourProps:{ref:i},theirProps:r,slot:{},defaultTag:Ds,name:"Portal"}),a):null});function Nd(e,t){let n=Be(t),{enabled:r=!0,ownerDocument:o,...i}=e,l=Me();return r?m.createElement(Td,{...i,ownerDocument:o,ref:n}):l({ourProps:{ref:n},theirProps:i,slot:{},defaultTag:Ds,name:"Portal"})}let Ld=m.Fragment,$s=m.createContext(null);function Pd(e,t){let{target:n,...r}=e,o={ref:Be(t)},i=Me();return m.createElement($s.Provider,{value:n},i({ourProps:o,theirProps:r,defaultTag:Ld,name:"Popover.Group"}))}let Dd=m.createContext(null),$d=Ne(Nd),Ad=Ne(Pd),Md=Object.assign($d,{Group:Ad});function Id(){let e=m.useRef(!1);return ue(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function As(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Is)!==m.Fragment||m.Children.count(e.children)===1}let jn=m.createContext(null);jn.displayName="TransitionContext";var jd=(e=>(e.Visible="visible",e.Hidden="hidden",e))(jd||{});function Fd(){let e=m.useContext(jn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Rd(){let e=m.useContext(Fn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Fn=m.createContext(null);Fn.displayName="NestingContext";function Rn(e){return"children"in e?Rn(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Ms(e,t){let n=Ot(e),r=m.useRef([]),o=Id(),i=$t(),l=ne((f,g=vt.Hidden)=>{let v=r.current.findIndex(({el:E})=>E===f);v!==-1&&(_e(g,{[vt.Unmount](){r.current.splice(v,1)},[vt.Hidden](){r.current[v].state="hidden"}}),i.microTask(()=>{var E;!Rn(r)&&o.current&&((E=n.current)==null||E.call(n))}))}),u=ne(f=>{let g=r.current.find(({el:v})=>v===f);return g?g.state!=="visible"&&(g.state="visible"):r.current.push({el:f,state:"visible"}),()=>l(f,vt.Unmount)}),s=m.useRef([]),a=m.useRef(Promise.resolve()),c=m.useRef({enter:[],leave:[]}),d=ne((f,g,v)=>{s.current.splice(0),t&&(t.chains.current[g]=t.chains.current[g].filter(([E])=>E!==f)),t==null||t.chains.current[g].push([f,new Promise(E=>{s.current.push(E)})]),t==null||t.chains.current[g].push([f,new Promise(E=>{Promise.all(c.current[g].map(([M,w])=>w)).then(()=>E())})]),g==="enter"?a.current=a.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(g)):v(g)}),p=ne((f,g,v)=>{Promise.all(c.current[g].splice(0).map(([E,M])=>M)).then(()=>{var E;(E=s.current.shift())==null||E()}).then(()=>v(g))});return m.useMemo(()=>({children:r,register:u,unregister:l,onStart:d,onStop:p,wait:a,chains:c}),[u,l,r,d,p,c,a])}let Is=m.Fragment,js=gn.RenderStrategy;function kd(e,t){var n,r;let{transition:o=!0,beforeEnter:i,afterEnter:l,beforeLeave:u,afterLeave:s,enter:a,enterFrom:c,enterTo:d,entered:p,leave:f,leaveFrom:g,leaveTo:v,...E}=e,[M,w]=m.useState(null),N=m.useRef(null),F=As(e),j=Be(...F?[N,t,w]:t===null?[]:[t]),k=(n=E.unmount)==null||n?vt.Unmount:vt.Hidden,{show:B,appear:h,initial:b}=Fd(),[y,$]=m.useState(B?"visible":"hidden"),D=Rd(),{register:L,unregister:C}=D;ue(()=>L(N),[L,N]),ue(()=>{if(k===vt.Hidden&&N.current){if(B&&y!=="visible"){$("visible");return}return _e(y,{hidden:()=>C(N),visible:()=>L(N)})}},[y,N,L,C,B,k]);let O=Zr();ue(()=>{if(F&&O&&y==="visible"&&N.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[N,y,O,F]);let T=b&&!h,P=h&&B&&b,x=m.useRef(!1),I=Ms(()=>{x.current||($("hidden"),C(N))},D),_=ne(z=>{x.current=!0;let J=z?"enter":"leave";I.onStart(N,J,se=>{se==="enter"?i==null||i():se==="leave"&&(u==null||u())})}),V=ne(z=>{let J=z?"enter":"leave";x.current=!1,I.onStop(N,J,se=>{se==="enter"?l==null||l():se==="leave"&&(s==null||s())}),J==="leave"&&!Rn(I)&&($("hidden"),C(N))});m.useEffect(()=>{F&&o||(_(B),V(B))},[B,F,o]);let W=!(!o||!F||!O||T),[,Y]=Wi(W,M,B,{start:_,end:V}),q=bt({ref:j,className:((r=hr(E.className,P&&a,P&&c,Y.enter&&a,Y.enter&&Y.closed&&c,Y.enter&&!Y.closed&&d,Y.leave&&f,Y.leave&&!Y.closed&&g,Y.leave&&Y.closed&&v,!Y.transition&&B&&p))==null?void 0:r.trim())||void 0,...Bi(Y)}),G=0;y==="visible"&&(G|=qe.Open),y==="hidden"&&(G|=qe.Closed),B&&y==="hidden"&&(G|=qe.Opening),!B&&y==="visible"&&(G|=qe.Closing);let H=Me();return m.createElement(Fn.Provider,{value:I},m.createElement(Ns,{value:G},H({ourProps:q,theirProps:E,defaultTag:Is,features:js,visible:y==="visible",name:"Transition.Child"})))}function _d(e,t){let{show:n,appear:r=!1,unmount:o=!0,...i}=e,l=m.useRef(null),u=As(e),s=Be(...u?[l,t]:t===null?[]:[t]);Zr();let a=Qr();if(n===void 0&&a!==null&&(n=(a&qe.Open)===qe.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,d]=m.useState(n?"visible":"hidden"),p=Ms(()=>{n||d("hidden")}),[f,g]=m.useState(!0),v=m.useRef([n]);ue(()=>{f!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),g(!1))},[v,n]);let E=m.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);ue(()=>{n?d("visible"):!Rn(p)&&l.current!==null&&d("hidden")},[n,p]);let M={unmount:o},w=ne(()=>{var j;f&&g(!1),(j=e.beforeEnter)==null||j.call(e)}),N=ne(()=>{var j;f&&g(!1),(j=e.beforeLeave)==null||j.call(e)}),F=Me();return m.createElement(Fn.Provider,{value:p},m.createElement(jn.Provider,{value:E},F({ourProps:{...M,as:m.Fragment,children:m.createElement(Fs,{ref:s,...M,...i,beforeEnter:w,beforeLeave:N})},theirProps:{},defaultTag:m.Fragment,features:js,visible:c==="visible",name:"Transition"})))}function Bd(e,t){let n=m.useContext(jn)!==null,r=Qr()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(Jr,{ref:t,...e}):m.createElement(Fs,{ref:t,...e}))}let Jr=Ne(_d),Fs=Ne(kd),Wd=Ne(Bd),Rs=Object.assign(Jr,{Child:Wd,Root:Jr});function Ud(e,t){let n=m.useRef({left:0,top:0});if(ue(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let ks=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function _s(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!at(o))return r;let i=!1;for(let u of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),i=!0;let l=i?(n=o.innerText)!=null?n:"":r;return ks.test(l)&&(l=l.replace(ks,"")),l}function Vd(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 i=document.getElementById(o);if(i){let l=i.getAttribute("aria-label");return typeof l=="string"?l.trim():_s(i).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return _s(e).trim()}function zd(e){let t=m.useRef(""),n=m.useRef("");return ne(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let i=Vd(r).trim().toLowerCase();return t.current=o,n.current=i,i})}var Hd=Object.defineProperty,Gd=(e,t,n)=>t in e?Hd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bs=(e,t,n)=>(Gd(e,typeof t!="symbol"?t+"":t,n),n),ye=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ye||{}),tt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(tt||{}),kn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(kn||{}),Ws=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(Ws||{});function Us(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Ai(t(e.options.slice()),i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let Yd={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:fe.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(i=>r(i.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,i,l;if(e.dataRef.current.disabled||e.listboxState===1)return e;let u={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===fe.Nothing)return{...u,activeOptionIndex:null};if(t.focus===fe.Specific)return{...u,activeOptionIndex:e.options.findIndex(c=>c.id===t.id)};if(t.focus===fe.Previous){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=In(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(p!==null){let f=e.options[p].dataRef.current.domRef;if(((r=d.current)==null?void 0:r.previousElementSibling)===f.current||((o=f.current)==null?void 0:o.previousElementSibling)===null)return{...u,activeOptionIndex:p}}}}else if(t.focus===fe.Next){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=In(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(p!==null){let f=e.options[p].dataRef.current.domRef;if(((i=d.current)==null?void 0:i.nextElementSibling)===f.current||((l=f.current)==null?void 0:l.nextElementSibling)===null)return{...u,activeOptionIndex:p}}}}let s=Us(e),a=In(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...u,...s,activeOptionIndex:a}},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(l=>{var u;return!l.dataRef.current.disabled&&((u=l.dataRef.current.textValue)==null?void 0:u.startsWith(r))}),i=o?e.options.indexOf(o):-1;return i===-1||i===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:i,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==fe.Nothing&&(r=In(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 i=n.findIndex(l=>o==null?void 0:o(l.dataRef.current.value));i!==-1&&(r=i)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:fe.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[i,l]of n.entries())if(o.has(l.id)&&(r.push(i),o.delete(l.id),o.size===0))break;if(r.length>0){n=n.slice();for(let i of r.reverse())n.splice(i,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...Us(e),pendingShouldSort:!1}:e};class eo extends xi{constructor(t){super(t),Bs(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:i,value:l}=this.state.dataRef.current;return _e(i,{0:()=>r==null?void 0:r(n),1:()=>{let u=l.slice(),s=u.findIndex(a=>o(a,n));return s===-1?u.push(n):u.splice(s,1),r==null?void 0:r(u)}})},registerOption:Er(()=>{let n=[],r=new Set;return[(o,i)=>{r.has(i)||(r.add(i),n.push({id:o,dataRef:i}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:Er(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Er(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:fe.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),Bs(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,i=n.options;return o===null||(r=i[o])==null?void 0:r.id},isActive(n,r){var o;let i=n.activeOptionIndex,l=n.options;return i!==null?((o=l[i])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=Sr.get(null);this.disposables.add(r.on(Ci.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new eo({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:fe.Nothing},__demoMode:n})}reduce(t,n){return _e(n.type,Yd,t,n)}}const Vs=m.createContext(null);function to(e){let t=m.useContext(Vs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,zs),n}return t}function zs({id:e,__demoMode:t=!1}){let n=m.useMemo(()=>eo.new({id:e,__demoMode:t}),[]);return Ps(()=>n.dispose()),n}let _n=m.createContext(null);_n.displayName="ListboxDataContext";function nn(e){let t=m.useContext(_n);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,nn),n}return t}let Kd=m.Fragment;function qd(e,t){let n=m.useId(),r=mr(),{value:o,defaultValue:i,form:l,name:u,onChange:s,by:a,invalid:c=!1,disabled:d=r||!1,horizontal:p=!1,multiple:f=!1,__demoMode:g=!1,...v}=e;const E=p?"horizontal":"vertical";let M=Be(t),w=du(i),[N=f?[]:void 0,F]=fu(o,s,w),j=zs({id:n,__demoMode:g}),k=m.useRef({static:!1,hold:!1}),B=m.useRef(new Map),h=ku(a),b=m.useCallback(W=>_e(y.mode,{[tt.Multi]:()=>N.some(Y=>h(Y,W)),[tt.Single]:()=>h(N,W)}),[N]),y=m.useMemo(()=>({value:N,disabled:d,invalid:c,mode:f?tt.Multi:tt.Single,orientation:E,onChange:F,compare:h,isSelected:b,optionsPropsRef:k,listRef:B}),[N,d,c,f,E,F,h,b,k,B]);ue(()=>{j.state.dataRef.current=y},[y]);let $=Ue(j,W=>W.listboxState),D=Sr.get(null),L=Ue(D,m.useCallback(W=>D.selectors.isTop(W,n),[D,n])),[C,O]=Ue(j,W=>[W.buttonElement,W.optionsElement]);fc(L,[C,O],(W,Y)=>{j.send({type:Ws.CloseListbox}),$i(Y,Dr.Loose)||(W.preventDefault(),C==null||C.focus())});let T=m.useMemo(()=>({open:$===ye.Open,disabled:d,invalid:c,value:N}),[$,d,c,N]),[P,x]=Au({inherit:!0}),I={ref:M},_=m.useCallback(()=>{if(w!==void 0)return F==null?void 0:F(w)},[F,w]),V=Me();return m.createElement(x,{value:P,props:{htmlFor:C==null?void 0:C.id},slot:{open:$===ye.Open,disabled:d}},m.createElement(vd,null,m.createElement(Vs.Provider,{value:j},m.createElement(_n.Provider,{value:y},m.createElement(Ns,{value:_e($,{[ye.Open]:qe.Open,[ye.Closed]:qe.Closed})},u!=null&&N!=null&&m.createElement(bu,{disabled:d,data:{[u]:N},form:l,onReset:_}),V({ourProps:I,theirProps:v,slot:T,defaultTag:Kd,name:"Listbox"}))))))}let Xd="button";function Qd(e,t){let n=m.useId(),r=ui(),o=nn("Listbox.Button"),i=to("Listbox.Button"),{id:l=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:s=!1,...a}=e,c=Be(t,pd(),i.actions.setButtonElement),d=md(),[p,f,g]=Ue(i,x=>[x.listboxState,x.buttonElement,x.optionsElement]),v=p===ye.Open;mc(v,{trigger:f,action:m.useCallback(x=>{if(f!=null&&f.contains(x.target))return xn.Ignore;let I=x.target.closest('[role="option"]:not([data-disabled])');return at(I)?xn.Select(I):g!=null&&g.contains(x.target)?xn.Ignore:xn.Close},[f,g]),close:i.actions.closeListbox,select:i.actions.selectActiveOption});let E=ne(x=>{switch(x.key){case be.Enter:pu(x.currentTarget);break;case be.Space:case be.ArrowDown:x.preventDefault(),i.actions.openListbox({focus:o.value?fe.Nothing:fe.First});break;case be.ArrowUp:x.preventDefault(),i.actions.openListbox({focus:o.value?fe.Nothing:fe.Last});break}}),M=ne(x=>{switch(x.key){case be.Space:x.preventDefault();break}}),w=ne(x=>{var I;if(x.button===Ls.Left){if(Ou(x.currentTarget))return x.preventDefault();i.state.listboxState===ye.Open?(Se.flushSync(()=>i.actions.closeListbox()),(I=i.state.buttonElement)==null||I.focus({preventScroll:!0})):(x.preventDefault(),i.actions.openListbox({focus:fe.Nothing}))}}),N=m.useRef(null),F=ne(x=>{N.current=x.pointerType,x.pointerType==="mouse"&&w(x)}),j=ne(x=>{N.current!=="mouse"&&w(x)}),k=ne(x=>x.preventDefault()),B=gi([l]),h=Lu(),{isFocusVisible:b,focusProps:y}=Ja({autoFocus:s}),{isHovered:$,hoverProps:D}=Za({isDisabled:u}),{pressed:L,pressProps:C}=iu({disabled:u}),O=m.useMemo(()=>({open:p===ye.Open,active:L||p===ye.Open,disabled:u,invalid:o.invalid,value:o.value,hover:$,focus:b,autofocus:s}),[p,o.value,u,$,b,L,o.invalid,s]),T=Ue(i,x=>x.listboxState===ye.Open),P=oi(d(),{ref:c,id:l,type:hc(e,f),"aria-haspopup":"listbox","aria-controls":g==null?void 0:g.id,"aria-expanded":T,"aria-labelledby":B,"aria-describedby":h,disabled:u||void 0,autoFocus:s,onKeyDown:E,onKeyUp:M,onKeyPress:k,onPointerDown:F,onClick:j},y,D,C);return Me()({ourProps:P,theirProps:a,slot:O,defaultTag:Xd,name:"Listbox.Button"})}let Hs=m.createContext(!1),Zd="div",Jd=gn.RenderStrategy|gn.Static;function ep(e,t){let n=m.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:i=!1,modal:l=!0,transition:u=!1,...s}=e,a=dd(o),[c,d]=m.useState(null);a&&(i=!0);let p=nn("Listbox.Options"),f=to("Listbox.Options"),[g,v,E,M]=Ue(f,z=>[z.listboxState,z.buttonElement,z.optionsElement,z.__demoMode]),w=$r(v),N=$r(E),F=Qr(),[j,k]=Wi(u,c,F!==null?(F&qe.Open)===qe.Open:g===ye.Open);Ju(j,v,f.actions.closeListbox);let B=M?!1:l&&g===ye.Open;Sc(B,N);let h=M?!1:l&&g===ye.Open;Zu(h,{allowed:m.useCallback(()=>[v,E],[v,E])});let b=g!==ye.Open,y=Ud(b,v)?!1:j,$=j&&g===ye.Closed,D=xd($,p.value),L=ne(z=>p.compare(D,z)),C=Ue(f,z=>{var J;if(a==null||!((J=a==null?void 0:a.to)!=null&&J.includes("selection")))return null;let se=z.options.findIndex(he=>L(he.dataRef.current.value));return se===-1&&(se=0),se}),O=(()=>{if(a==null)return;if(C===null)return{...a,inner:void 0};let z=Array.from(p.listRef.current.values());return{...a,inner:{listRef:{current:z},index:C}}})(),[T,P]=gd(O),x=hd(),I=Be(t,a?T:null,f.actions.setOptionsElement,d),_=$t();m.useEffect(()=>{var z;let J=E;J&&g===ye.Open&&J!==((z=Kt(J))==null?void 0:z.activeElement)&&(J==null||J.focus({preventScroll:!0}))},[g,E]);let V=ne(z=>{var J,se;switch(_.dispose(),z.key){case be.Space:if(f.state.searchQuery!=="")return z.preventDefault(),z.stopPropagation(),f.actions.search(z.key);case be.Enter:if(z.preventDefault(),z.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:he}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(he.current.value)}p.mode===tt.Single&&(Se.flushSync(()=>f.actions.closeListbox()),(J=f.state.buttonElement)==null||J.focus({preventScroll:!0}));break;case _e(p.orientation,{vertical:be.ArrowDown,horizontal:be.ArrowRight}):return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:fe.Next});case _e(p.orientation,{vertical:be.ArrowUp,horizontal:be.ArrowLeft}):return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:fe.Previous});case be.Home:case be.PageUp:return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:fe.First});case be.End:case be.PageDown:return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:fe.Last});case be.Escape:z.preventDefault(),z.stopPropagation(),Se.flushSync(()=>f.actions.closeListbox()),(se=f.state.buttonElement)==null||se.focus({preventScroll:!0});return;case be.Tab:z.preventDefault(),z.stopPropagation(),Se.flushSync(()=>f.actions.closeListbox()),lc(f.state.buttonElement,z.shiftKey?Pr.Previous:Pr.Next);break;default:z.key.length===1&&(f.actions.search(z.key),_.setTimeout(()=>f.actions.clearSearch(),350));break}}),W=Ue(f,z=>{var J;return(J=z.buttonElement)==null?void 0:J.id}),Y=m.useMemo(()=>({open:g===ye.Open}),[g]),q=oi(a?x():{},{id:r,ref:I,"aria-activedescendant":Ue(f,f.selectors.activeDescendantId),"aria-multiselectable":p.mode===tt.Multi?!0:void 0,"aria-labelledby":W,"aria-orientation":p.orientation,onKeyDown:V,role:"listbox",tabIndex:g===ye.Open?0:void 0,style:{...s.style,...P,"--button-width":Bu(v,!0).width},...Bi(k)}),G=Me(),H=m.useMemo(()=>p.mode===tt.Multi?p:{...p,isSelected:L},[p,L]);return m.createElement(Md,{enabled:i?e.static||j:!1,ownerDocument:w},m.createElement(_n.Provider,{value:H},G({ourProps:q,theirProps:s,slot:Y,defaultTag:Zd,features:Jd,visible:y,name:"Listbox.Options"})))}let tp="div";function np(e,t){let n=m.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:i,...l}=e,u=m.useContext(Hs)===!0,s=nn("Listbox.Option"),a=to("Listbox.Option"),c=Ue(a,y=>a.selectors.isActive(y,r)),d=s.isSelected(i),p=m.useRef(null),f=zd(p),g=Ot({disabled:o,value:i,domRef:p,get textValue(){return f()}}),v=Be(t,p,y=>{y?s.listRef.current.set(r,y):s.listRef.current.delete(r)}),E=Ue(a,y=>a.selectors.shouldScrollIntoView(y,r));ue(()=>{if(E)return Ke().requestAnimationFrame(()=>{var y,$;($=(y=p.current)==null?void 0:y.scrollIntoView)==null||$.call(y,{block:"nearest"})})},[E,p]),ue(()=>{if(!u)return a.actions.registerOption(r,g),()=>a.actions.unregisterOption(r)},[g,r,u]);let M=ne(y=>{var $;if(o)return y.preventDefault();a.actions.onChange(i),s.mode===tt.Single&&(Se.flushSync(()=>a.actions.closeListbox()),($=a.state.buttonElement)==null||$.focus({preventScroll:!0}))}),w=ne(()=>{if(o)return a.actions.goToOption({focus:fe.Nothing});a.actions.goToOption({focus:fe.Specific,id:r})}),N=Cc(),F=ne(y=>N.update(y)),j=ne(y=>{N.wasMoved(y)&&(o||c&&a.state.activationTrigger===kn.Pointer||a.actions.goToOption({focus:fe.Specific,id:r},kn.Pointer))}),k=ne(y=>{N.wasMoved(y)&&(o||c&&a.state.activationTrigger===kn.Pointer&&a.actions.goToOption({focus:fe.Nothing}))}),B=m.useMemo(()=>({active:c,focus:c,selected:d,disabled:o,selectedOption:d&&u}),[c,d,o,u]),h=u?{}:{id:r,ref:v,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:M,onFocus:w,onPointerEnter:F,onMouseEnter:F,onPointerMove:j,onMouseMove:j,onPointerLeave:k,onMouseLeave:k},b=Me();return!d&&u?null:b({ourProps:h,theirProps:l,slot:B,defaultTag:tp,name:"Listbox.Option"})}let rp=m.Fragment;function op(e,t){let{options:n,placeholder:r,...o}=e,i={ref:Be(t)},l=nn("ListboxSelectedOption"),u=m.useMemo(()=>({}),[]),s=l.value===void 0||l.value===null||l.mode===tt.Multi&&Array.isArray(l.value)&&l.value.length===0,a=Me();return m.createElement(Hs.Provider,{value:!0},a({ourProps:i,theirProps:{...o,children:m.createElement(m.Fragment,null,r&&s?r:n)},slot:u,defaultTag:rp,name:"ListboxSelectedOption"}))}let ip=Ne(qd),sp=Ne(Qd),lp=Fu,ap=Ne(ep),up=Ne(np),cp=Ne(op),wt=Object.assign(ip,{Button:sp,Label:lp,Options:ap,Option:up,SelectedOption:cp});function fp({title:e,titleId:t,...n},r){return R.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"}))}const Gs=R.forwardRef(fp),dp=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>{const{t:i}=Ye();return S.jsx("div",{className:`relative ${o}`,children:S.jsx(wt,{value:t,onChange:n,disabled:r,children:({open:l})=>S.jsxs(S.Fragment,{children:[S.jsxs(wt.Button,{className:`
83
+ */var Ub=["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])"],_i=Ub.join(","),xl=typeof Element>"u",Fr=xl?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Yo=!xl&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Xo=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&e(t.parentNode);return i},zb=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Wb=function(t,n,r){if(Xo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(_i));return n&&Fr.call(t,_i)&&o.unshift(t),o=o.filter(r),o},Hb=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Xo(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,u=e(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{var l=Fr.call(i,_i);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Xo(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=e(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},El=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Sl=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||zb(t))&&!El(t)?0:t.tabIndex},Vb=function(t,n){var r=Sl(t);return r<0&&n&&!El(t)?0:r},Gb=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Pl=function(t){return t.tagName==="INPUT"},qb=function(t){return Pl(t)&&t.type==="hidden"},Zb=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Kb=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Yb=function(t){if(!t.name)return!0;var n=t.form||Yo(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Kb(o,t.form);return!s||s===t},Xb=function(t){return Pl(t)&&t.type==="radio"},Qb=function(t){return Xb(t)&&!Yb(t)},Jb=function(t){var n,r=t&&Yo(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var u,l,f;r=Yo(o),o=(u=r)===null||u===void 0?void 0:u.host,s=!!((l=o)!==null&&l!==void 0&&(f=l.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},$l=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},ey=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=Fr.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(Fr.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var a=t.parentElement,u=Yo(t);if(a&&!a.shadowRoot&&o(a)===!0)return $l(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(Jb(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return $l(t);return!1},ty=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 Fr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},ny=function(t,n){return!(n.disabled||Xo(n)||qb(n)||ey(n,t)||Zb(n)||ty(n))},Al=function(t,n){return!(Qb(n)||Sl(n)<0||!ny(t,n))},ry=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},oy=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=Vb(c,i),u=i?e(o.candidates):c;a===0?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:u})}),r.sort(Gb).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Tl=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Hb([t],n.includeContainer,{filter:Al.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ry}):r=Wb(t,n.includeContainer,Al.bind(null,n)),oy(r)};function Cl(e,t,n){let{reference:r,floating:o}=e;const s=Gt(t),i=Di(t),c=Fi(i),a=hn(t),u=s==="y",l=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:l,y:r.y-o.height};break;case"bottom":d={x:l,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(Kn(t)){case"start":d[i]-=p*(n&&u?-1:1);break;case"end":d[i]+=p*(n&&u?-1:1);break}return d}const sy=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:f}=Cl(u,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:v,fn:C}=c[m],{x:b,y:$,data:B,reset:k}=await C({x:l,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});l=b??l,f=$??f,d={...d,[v]:{...d[v],...B}},k&&h<=50&&(h++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(u=k.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:l,y:f}=Cl(u,p,a)),m=-1)}return{x:l,y:f,placement:p,strategy:o,middlewareData:d}};async function Qo(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Tn(t,e),h=wl(d),v=c[p?f==="floating"?"reference":"floating":f],C=Ko(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:l,strategy:a})),b=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,$=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),B=await(s.isElement==null?void 0:s.isElement($))?await(s.getScale==null?void 0:s.getScale($))||{x:1,y:1}:{x:1,y:1},k=Ko(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:$,strategy:a}):b);return{top:(C.top-k.top+h.top)/B.y,bottom:(k.bottom-C.bottom+h.bottom)/B.y,left:(C.left-k.left+h.left)/B.x,right:(k.right-C.right+h.right)/B.x}}const iy=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:u,padding:l=0}=Tn(e,t)||{};if(u==null)return{};const f=wl(l),p={x:n,y:r},d=Di(o),h=Fi(d),m=await i.getDimensions(u),v=d==="y",C=v?"top":"left",b=v?"bottom":"right",$=v?"clientHeight":"clientWidth",B=s.reference[h]+s.reference[d]-p[d]-s.floating[h],k=p[d]-s.reference[d],D=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=D?D[$]:0;(!j||!await(i.isElement==null?void 0:i.isElement(D)))&&(j=c.floating[$]||s.floating[h]);const g=B/2-k/2,w=j/2-m[h]/2-1,A=Vt(f[C],w),I=Vt(f[b],w),N=A,P=j-m[h]-I,E=j/2-m[h]/2+g,x=Ri(N,E,P),T=!a.arrow&&Kn(o)!=null&&E!==x&&s.reference[h]/2-(E<N?A:I)-m[h]/2<0,O=T?E<N?E-N:E-P:0;return{[d]:p[d]+O,data:{[d]:x,centerOffset:E-x-O,...T&&{alignmentOffset:O}},reset:T}}}),ay=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...v}=Tn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=hn(o),b=Gt(c),$=hn(c)===c,B=await(a.isRTL==null?void 0:a.isRTL(u.floating)),k=p||($||!m?[Zo(c)]:kb(c)),D=h!=="none";!p&&D&&k.push(...jb(c,m,h,B));const j=[c,...k],g=await Qo(t,v),w=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&w.push(g[C]),f){const E=Bb(o,i,B);w.push(g[E[0]],g[E[1]])}if(A=[...A,{placement:o,overflows:w}],!w.every(E=>E<=0)){var I,N;const E=(((I=s.flip)==null?void 0:I.index)||0)+1,x=j[E];if(x&&(!(f==="alignment"?b!==Gt(x):!1)||A.every(y=>Gt(y.placement)===b?y.overflows[0]>0:!0)))return{data:{index:E,overflows:A},reset:{placement:x}};let T=(N=A.filter(O=>O.overflows[0]<=0).sort((O,y)=>O.overflows[1]-y.overflows[1])[0])==null?void 0:N.placement;if(!T)switch(d){case"bestFit":{var P;const O=(P=A.filter(y=>{if(D){const L=Gt(y.placement);return L===b||L==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(L=>L>0).reduce((L,F)=>L+F,0)]).sort((y,L)=>y[1]-L[1])[0])==null?void 0:P[0];O&&(T=O);break}case"initialPlacement":T=c;break}if(o!==T)return{reset:{placement:T}}}return{}}}},cy=new Set(["left","top"]);async function uy(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=hn(n),c=Kn(n),a=Gt(n)==="y",u=cy.has(i)?-1:1,l=s&&a?-1:1,f=Tn(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*l,y:p*u}:{x:p*u,y:d*l}}const ly=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 uy(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}}}}},fy=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:v=>{let{x:C,y:b}=v;return{x:C,y:b}}},...a}=Tn(e,t),u={x:n,y:r},l=await Qo(t,a),f=Gt(hn(o)),p=bl(f);let d=u[p],h=u[f];if(s){const v=p==="y"?"top":"left",C=p==="y"?"bottom":"right",b=d+l[v],$=d-l[C];d=Ri(b,d,$)}if(i){const v=f==="y"?"top":"left",C=f==="y"?"bottom":"right",b=h+l[v],$=h-l[C];h=Ri(b,h,$)}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}}}}}},dy=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...u}=Tn(e,t),l=await Qo(t,u),f=hn(o),p=Kn(o),d=Gt(o)==="y",{width:h,height:m}=s.floating;let v,C;f==="top"||f==="bottom"?(v=f,C=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(C=f,v=p==="end"?"top":"bottom");const b=m-l.top-l.bottom,$=h-l.left-l.right,B=Vt(m-l[v],b),k=Vt(h-l[C],$),D=!t.middlewareData.shift;let j=B,g=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=$),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=b),D&&!p){const A=Me(l.left,0),I=Me(l.right,0),N=Me(l.top,0),P=Me(l.bottom,0);d?g=h-2*(A!==0||I!==0?A+I:Me(l.left,l.right)):j=m-2*(N!==0||P!==0?N+P:Me(l.top,l.bottom))}await a({...t,availableWidth:g,availableHeight:j});const w=await i.getDimensions(c.floating);return h!==w.width||m!==w.height?{reset:{rects:!0}}:{}}}};function Ol(e){const t=it(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ke(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Rr(n)!==s||Rr(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Ui(e){return de(e)?e:e.contextElement}function Yn(e){const t=Ui(e);if(!ke(t))return Ot(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Ol(t);let i=(s?Rr(n.width):n.width)/r,c=(s?Rr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const py=Ot(0);function Nl(e){const t=Ue(e);return!Vo()||!t.visualViewport?py:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ue(e)?!1:t}function Cn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ui(e);let i=Ot(1);t&&(r?de(r)&&(i=Yn(r)):i=Yn(e));const c=hy(s,n,r)?Nl(s):Ot(0);let a=(o.left+c.x)/i.x,u=(o.top+c.y)/i.y,l=o.width/i.x,f=o.height/i.y;if(s){const p=Ue(s),d=r&&de(r)?Ue(r):r;let h=p,m=ki(h);for(;m&&r&&d!==h;){const v=Yn(m),C=m.getBoundingClientRect(),b=it(m),$=C.left+(m.clientLeft+parseFloat(b.paddingLeft))*v.x,B=C.top+(m.clientTop+parseFloat(b.paddingTop))*v.y;a*=v.x,u*=v.y,l*=v.x,f*=v.y,a+=$,u+=B,h=Ue(m),m=ki(h)}}return Ko({width:l,height:f,x:a,y:u})}function Jo(e,t){const n=Go(e).scrollLeft;return t?t.left+n:Cn(Ct(e)).left+n}function Il(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function my(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Ct(r),c=t?Ho(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Ot(1);const l=Ot(0),f=ke(r);if((f||!f&&!s)&&((Zn(r)!=="body"||kr(i))&&(a=Go(r)),ke(r))){const d=Cn(r);u=Yn(r),l.x=d.x+r.clientLeft,l.y=d.y+r.clientTop}const p=i&&!f&&!s?Il(i,a):Ot(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+p.x,y:n.y*u.y-a.scrollTop*u.y+l.y+p.y}}function gy(e){return Array.from(e.getClientRects())}function by(e){const t=Ct(e),n=Go(e),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Jo(e);const c=-n.scrollTop;return it(r).direction==="rtl"&&(i+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Ml=25;function yy(e,t){const n=Ue(e),r=Ct(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const l=Vo();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Jo(r);if(u<=0){const l=r.ownerDocument,f=l.body,p=getComputedStyle(f),d=l.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Ml&&(s-=h)}else u<=Ml&&(s+=u);return{width:s,height:i,x:c,y:a}}const vy=new Set(["absolute","fixed"]);function wy(e,t){const n=Cn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=ke(e)?Yn(e):Ot(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,u=r*s.y;return{width:i,height:c,x:a,y:u}}function Ll(e,t,n){let r;if(t==="viewport")r=yy(e,n);else if(t==="document")r=by(Ct(e));else if(de(t))r=wy(t,n);else{const o=Nl(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ko(r)}function Bl(e,t){const n=Ht(e);return n===t||!de(n)||Wt(n)?!1:it(n).position==="fixed"||Bl(n,t)}function xy(e,t){const n=t.get(e);if(n)return n;let r=pn(e,[],!1).filter(c=>de(c)&&Zn(c)!=="body"),o=null;const s=it(e).position==="fixed";let i=s?Ht(e):e;for(;de(i)&&!Wt(i);){const c=it(i),a=Bi(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&vy.has(o.position)||kr(i)&&!a&&Bl(e,i))?r=r.filter(l=>l!==i):o=c,i=Ht(i)}return t.set(e,r),r}function Ey(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ho(t)?[]:xy(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=Ll(t,l,o);return u.top=Me(f.top,u.top),u.right=Vt(f.right,u.right),u.bottom=Vt(f.bottom,u.bottom),u.left=Me(f.left,u.left),u},Ll(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Sy(e){const{width:t,height:n}=Ol(e);return{width:t,height:n}}function Py(e,t,n){const r=ke(t),o=Ct(t),s=n==="fixed",i=Cn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ot(0);function u(){a.x=Jo(o)}if(r||!r&&!s)if((Zn(t)!=="body"||kr(o))&&(c=Go(t)),r){const d=Cn(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?Il(o,c):Ot(0),f=i.left+c.scrollLeft-a.x-l.x,p=i.top+c.scrollTop-a.y-l.y;return{x:f,y:p,width:i.width,height:i.height}}function zi(e){return it(e).position==="static"}function kl(e,t){if(!ke(e)||it(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ct(e)===n&&(n=n.ownerDocument.body),n}function Rl(e,t){const n=Ue(e);if(Ho(e))return n;if(!ke(e)){let o=Ht(e);for(;o&&!Wt(o);){if(de(o)&&!zi(o))return o;o=Ht(o)}return n}let r=kl(e,t);for(;r&&Sb(r)&&zi(r);)r=kl(r,t);return r&&Wt(r)&&zi(r)&&!Bi(r)?n:r||Cb(e)||n}const $y=async function(e){const t=this.getOffsetParent||Rl,n=this.getDimensions,r=await n(e.floating);return{reference:Py(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ay(e){return it(e).direction==="rtl"}const Ty={convertOffsetParentRelativeRectToViewportRelativeRect:my,getDocumentElement:Ct,getClippingRect:Ey,getOffsetParent:Rl,getElementRects:$y,getClientRects:gy,getDimensions:Sy,getScale:Yn,isElement:de,isRTL:Ay};function Fl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Cy(e,t){let n=null,r;const o=Ct(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=e.getBoundingClientRect(),{left:l,top:f,width:p,height:d}=u;if(c||t(),!p||!d)return;const h=qo(f),m=qo(o.clientWidth-(l+p)),v=qo(o.clientHeight-(f+d)),C=qo(l),$={rootMargin:-h+"px "+-m+"px "+-v+"px "+-C+"px",threshold:Me(0,Vt(1,a))||1};let B=!0;function k(D){const j=D[0].intersectionRatio;if(j!==a){if(!B)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!Fl(u,e.getBoundingClientRect())&&i(),B=!1}try{n=new IntersectionObserver(k,{...$,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,$)}n.observe(e)}return i(!0),s}function Dl(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Ui(e),l=o||s?[...u?pn(u):[],...pn(t)]:[];l.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const f=u&&c?Cy(u,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(C=>{let[b]=C;b&&b.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var $;($=d)==null||$.observe(t)})),n()}),u&&!a&&d.observe(u),d.observe(t));let h,m=a?Cn(e):null;a&&v();function v(){const C=Cn(e);m&&!Fl(m,C)&&n(),m=C,h=requestAnimationFrame(v)}return n(),()=>{var C;l.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),f==null||f(),(C=d)==null||C.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const Wi=Qo,Oy=ly,Ny=fy,Iy=ay,My=dy,jl=iy,Ly=(e,t,n)=>{const r=new Map,o={platform:Ty,...n},s={...o.platform,_c:r};return sy(e,t,{...o,platform:s})};var By=typeof document<"u",ky=function(){},es=By?S.useLayoutEffect:ky;function ts(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ts(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!ts(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function _l(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ul(e,t){const n=_l(e);return Math.round(t*n)/n}function Hi(e){const t=_.useRef(e);return es(()=>{t.current=e}),t}function zl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:u}=e,[l,f]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=_.useState(r);ts(p,r)||d(r);const[h,m]=_.useState(null),[v,C]=_.useState(null),b=_.useCallback(y=>{y!==D.current&&(D.current=y,m(y))},[]),$=_.useCallback(y=>{y!==j.current&&(j.current=y,C(y))},[]),B=s||h,k=i||v,D=_.useRef(null),j=_.useRef(null),g=_.useRef(l),w=a!=null,A=Hi(a),I=Hi(o),N=Hi(u),P=_.useCallback(()=>{if(!D.current||!j.current)return;const y={placement:t,strategy:n,middleware:p};I.current&&(y.platform=I.current),Ly(D.current,j.current,y).then(L=>{const F={...L,isPositioned:N.current!==!1};E.current&&!ts(g.current,F)&&(g.current=F,Ar.flushSync(()=>{f(F)}))})},[p,t,n,I,N]);es(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(y=>({...y,isPositioned:!1})))},[u]);const E=_.useRef(!1);es(()=>(E.current=!0,()=>{E.current=!1}),[]),es(()=>{if(B&&(D.current=B),k&&(j.current=k),B&&k){if(A.current)return A.current(B,k,P);P()}},[B,k,P,A,w]);const x=_.useMemo(()=>({reference:D,floating:j,setReference:b,setFloating:$}),[b,$]),T=_.useMemo(()=>({reference:B,floating:k}),[B,k]),O=_.useMemo(()=>{const y={position:n,left:0,top:0};if(!T.floating)return y;const L=Ul(T.floating,l.x),F=Ul(T.floating,l.y);return c?{...y,transform:"translate("+L+"px, "+F+"px)",..._l(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:F}},[n,c,T.floating,l.x,l.y]);return _.useMemo(()=>({...l,update:P,refs:x,elements:T,floatingStyles:O}),[l,P,x,T,O])}const Ry=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?jl({element:r.current,padding:o}).fn(n):{}:r?jl({element:r,padding:o}).fn(n):{}}}},Vi=(e,t)=>({...Oy(e),options:[e,t]}),Wl=(e,t)=>({...Ny(e),options:[e,t]}),Hl=(e,t)=>({...Iy(e),options:[e,t]}),Fy=(e,t)=>({...My(e),options:[e,t]}),Dy=(e,t)=>({...Ry(e),options:[e,t]}),Vl={..._},jy=Vl.useInsertionEffect||(e=>e());function Gl(e){const t=_.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return jy(()=>{t.current=e}),_.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 Gi=typeof document<"u"?S.useLayoutEffect:S.useEffect;let ql=!1,_y=0;const Zl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_y++;function Uy(){const[e,t]=_.useState(()=>ql?Zl():void 0);return Gi(()=>{e==null&&t(Zl())},[]),_.useEffect(()=>{ql=!0},[]),e}const zy=Vl.useId||Uy;let Dr;process.env.NODE_ENV!=="production"&&(Dr=new Set);function Wy(){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=Dr)!=null&&e.has(o))){var s;(s=Dr)==null||s.add(o),console.warn(o)}}function Hy(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Dr)!=null&&e.has(o))){var s;(s=Dr)==null||s.add(o),console.error(o)}}function Vy(){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 Gy=_.createContext(null),qy=_.createContext(null),Zy=()=>{var e;return((e=_.useContext(Gy))==null?void 0:e.id)||null},Ky=()=>_.useContext(qy),Yy="data-floating-ui-focusable";function Xy(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=zy(),s=_.useRef({}),[i]=_.useState(()=>Vy()),c=Zy()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!de(d)&&Hy("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=_.useState(r.reference),l=Gl((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=_.useMemo(()=>({setPositionReference:u}),[]),p=_.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return _.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function Qy(e){e===void 0&&(e={});const{nodeId:t}=e,n=Xy({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=_.useState(null),[c,a]=_.useState(null),l=(o==null?void 0:o.domReference)||s,f=_.useRef(null),p=Ky();Gi(()=>{l&&(f.current=l)},[l]);const d=zl({...e,elements:{...o,...c&&{reference:c}}}),h=_.useCallback($=>{const B=de($)?{getBoundingClientRect:()=>$.getBoundingClientRect(),contextElement:$}:$;a(B),d.refs.setReference(B)},[d.refs]),m=_.useCallback($=>{(de($)||$===null)&&(f.current=$,i($)),(de(d.refs.reference.current)||d.refs.reference.current===null||$!==null&&!de($))&&d.refs.setReference($)},[d.refs]),v=_.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),C=_.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),b=_.useMemo(()=>({...d,...r,refs:v,elements:C,nodeId:t}),[d,v,C,t,r]);return Gi(()=>{r.dataRef.current.floatingContext=b;const $=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);$&&($.context=b)}),_.useMemo(()=>({...d,context:b,refs:v,elements:C}),[d,v,C,b])}const Kl="active",Yl="selected";function qi(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Kl]:i,[Yl]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Yy]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[Kl,Yl].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(u))==null?void 0:p.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function Jy(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=_.useCallback(c=>qi(c,e,"reference"),t),s=_.useCallback(c=>qi(c,e,"floating"),n),i=_.useCallback(c=>qi(c,e,"item"),r);return _.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Xl(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const ev=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:u,...l}=Tn(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(u==null?void 0:u.current)||p,m=p.clientTop||h.clientTop,v=p.clientTop!==0,C=h.clientTop!==0,b=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Wy('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const $={...t,...await Vi(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},B=await Wi(Xl($,h.scrollHeight+m+p.clientTop),l),k=await Wi($,{...l,elementContext:"reference"}),D=Me(0,B.top),j=$.y+D,A=(h.scrollHeight>h.clientHeight?I=>I:Rr)(Me(0,h.scrollHeight+(v&&b||C?m*2:0)-D-Me(0,B.bottom)));if(h.style.maxHeight=A+"px",h.scrollTop=D,o){const I=h.offsetHeight<d.offsetHeight*Vt(c,n.current.length)-1||k.top>=-a||k.bottom>=-a;Ar.flushSync(()=>o(I))}return r&&(r.current=await Wi(Xl({...$,y:j},h.offsetHeight+m+p.clientTop),l)),{y:j}}});function tv(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Gl(c),u=_.useRef(!1),l=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const v=m.deltaY,C=s.current.top>=-.5,b=s.current.bottom>=-.5,$=h.scrollHeight-h.clientHeight,B=v<0?-1:1,k=v<0?"max":"min";h.scrollHeight<=h.clientHeight||(!C&&v>0||!b&&v<0?(m.preventDefault(),Ar.flushSync(()=>{a(D=>D+Math[k](v,$*B))})):/firefox/i.test(Nb())&&(h.scrollTop+=v))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{l.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{l.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=_.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!u.current)){if(l.current!==null){const h=d.scrollTop-l.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Ar.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=d.scrollTop})}}}),[r.floating,a,s,i]);return _.useMemo(()=>o?{floating:p}:{},[o,p])}let Xn=S.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Xn.displayName="FloatingContext";let Zi=S.createContext(null);Zi.displayName="PlacementContext";function nv(e){return S.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function rv(){return S.useContext(Xn).setReference}function ov(){return S.useContext(Xn).getReferenceProps}function sv(){let{getFloatingProps:e,slot:t}=S.useContext(Xn);return S.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function iv(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=S.useContext(Zi),n=S.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);ge(()=>{t==null||t(n??null)},[t,n]);let r=S.useContext(Xn);return S.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Ql=4;function av({children:e,enabled:t=!0}){let[n,r]=S.useState(null),[o,s]=S.useState(0),i=S.useRef(null),[c,a]=S.useState(null);cv(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=uv(n,c),[m,v="center"]=l.split(" ");ge(()=>{u&&s(0)},[u]);let{refs:C,floatingStyles:b,context:$}=Qy({open:u,placement:m==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${m}`:`${m}-${v}`,strategy:"absolute",transform:!1,middleware:[Vi({mainAxis:m==="selection"?0:f,crossAxis:p}),Wl({padding:d}),m!=="selection"&&Hl({padding:d}),m==="selection"&&h?ev({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:Ql,referenceOverflowThreshold:d,onFallbackChange(I){var N,P;if(!I)return;let E=$.elements.floating;if(!E)return;let x=parseFloat(getComputedStyle(E).scrollPaddingBottom)||0,T=Math.min(Ql,E.childElementCount),O=0,y=0;for(let L of(P=(N=$.elements.floating)==null?void 0:N.childNodes)!=null?P:[])if(zt(L)){let F=L.offsetTop,U=F+L.clientHeight+x,z=E.scrollTop,V=z+E.clientHeight;if(F>=z&&U<=V)T--;else{y=Math.max(0,Math.min(U,V)-Math.max(F,z)),O=L.clientHeight;break}}T>=1&&s(L=>{let F=O*T-y+x;return L>=F?L:F})}}):null,Fy({padding:d,apply({availableWidth:I,availableHeight:N,elements:P}){Object.assign(P.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${N}px)`})}})].filter(Boolean),whileElementsMounted:Dl}),[B=m,k=v]=$.placement.split("-");m==="selection"&&(B="selection");let D=S.useMemo(()=>({anchor:[B,k].filter(Boolean).join(" ")}),[B,k]),j=tv($,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:w}=Jy([j]),A=ce(I=>{a(I),C.setFloating(I)});return _.createElement(Zi.Provider,{value:r},_.createElement(Xn.Provider,{value:{setFloating:A,setReference:C.setReference,styles:b,getReferenceProps:g,getFloatingProps:w,slot:D}},e))}function cv(e){ge(()=>{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 uv(e,t){var n,r,o;let s=Ki((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Ki((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Ki((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Ki(e,t,n=void 0){let r=Vn(),o=ce((a,u)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!u)return[n,null];let l=ef(a,u);return[l,f=>{let p=Jl(a);{let d=p.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[C,b]of p.entries()){let $=window.getComputedStyle(u).getPropertyValue(b);if(d[C]!==$){d[C]=$,m=!0;break}}if(!m)return;let v=ef(a,u);l!==v&&(f(v),l=v)})}return r.dispose}]}return[n,null]}),s=S.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=S.useState();return ge(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function Jl(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,...Jl(o)]:[r]}return[]}function ef(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 lv(e,t){let[n,r]=S.useState(t);return!e&&n!==t&&r(t),e?n:t}let Yi=S.createContext(null);Yi.displayName="OpenClosedContext";var mt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(mt||{});function Xi(){return S.useContext(Yi)}function tf({value:e,children:t}){return S.createElement(Yi.Provider,{value:e},t)}function fv(e){throw new Error("Unexpected object: "+e)}var ve=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ve||{});function ns(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:fv(e)}}var nf=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(nf||{});function rf(e){let t=ce(e),n=S.useRef(!1);S.useEffect(()=>(n.current=!1,()=>{n.current=!0,Nu(()=>{n.current&&t()})}),[t])}function dv(){let e=typeof document>"u";return"useSyncExternalStore"in _?(t=>t.useSyncExternalStore)(_)(()=>()=>{},()=>!1,()=>!e):!1}function Qi(){let e=dv(),[t,n]=_.useState(At.isHandoffComplete);return t&&At.isHandoffComplete===!1&&n(!1),_.useEffect(()=>{t!==!0&&n(!0)},[t]),_.useEffect(()=>At.handoff(),[]),e?!1:t}let pv=S.createContext(!1);function hv(){return S.useContext(pv)}function mv(e){let t=hv(),n=S.useContext(sf),[r,o]=S.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(At.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 S.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),S.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let of=S.Fragment,gv=_e(function(e,t){let{ownerDocument:n=null,...r}=e,o=S.useRef(null),s=rt(yg(d=>{o.current=d}),t),i=Ii(o),c=n??i,a=mv(c),[u]=S.useState(()=>{var d;return At.isServer?null:(d=c==null?void 0:c.createElement("div"))!=null?d:null}),l=S.useContext(wv),f=Qi();ge(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),ge(()=>{if(u&&l)return l.register(u)},[l,u]),rf(()=>{var d;!a||!u||(yi(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))});let p=Ze();return f?!a||!u?null:Be.createPortal(p({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:of,name:"Portal"}),u):null});function bv(e,t){let n=rt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ze();return r?S.createElement(gv,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:of,name:"Portal"})}let yv=S.Fragment,sf=S.createContext(null);function vv(e,t){let{target:n,...r}=e,o={ref:rt(t)},s=Ze();return S.createElement(sf.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:yv,name:"Popover.Group"}))}let wv=S.createContext(null),xv=_e(bv),Ev=_e(vv),Sv=Object.assign(xv,{Group:Ev});function Pv(){let e=S.useRef(!1);return ge(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function af(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:uf)!==S.Fragment||S.Children.count(e.children)===1}let rs=S.createContext(null);rs.displayName="TransitionContext";var $v=(e=>(e.Visible="visible",e.Hidden="hidden",e))($v||{});function Av(){let e=S.useContext(rs);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Tv(){let e=S.useContext(os);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let os=S.createContext(null);os.displayName="NestingContext";function ss(e){return"children"in e?ss(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function cf(e,t){let n=$n(e),r=S.useRef([]),o=Pv(),s=Vn(),i=ce((d,h=fn.Hidden)=>{let m=r.current.findIndex(({el:v})=>v===d);m!==-1&&(nt(h,{[fn.Unmount](){r.current.splice(m,1)},[fn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var v;!ss(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),c=ce(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,fn.Unmount)}),a=S.useRef([]),u=S.useRef(Promise.resolve()),l=S.useRef({enter:[],leave:[]}),f=ce((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([v])=>v!==d)),t==null||t.chains.current[h].push([d,new Promise(v=>{a.current.push(v)})]),t==null||t.chains.current[h].push([d,new Promise(v=>{Promise.all(l.current[h].map(([C,b])=>b)).then(()=>v())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=ce((d,h,m)=>{Promise.all(l.current[h].splice(0).map(([v,C])=>C)).then(()=>{var v;(v=a.current.shift())==null||v()}).then(()=>m(h))});return S.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:u,chains:l}),[c,i,r,f,p,l,u])}let uf=S.Fragment,lf=Do.RenderStrategy;function Cv(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...v}=e,[C,b]=S.useState(null),$=S.useRef(null),B=af(e),k=rt(...B?[$,t,b]:t===null?[]:[t]),D=(n=v.unmount)==null||n?fn.Unmount:fn.Hidden,{show:j,appear:g,initial:w}=Av(),[A,I]=S.useState(j?"visible":"hidden"),N=Tv(),{register:P,unregister:E}=N;ge(()=>P($),[P,$]),ge(()=>{if(D===fn.Hidden&&$.current){if(j&&A!=="visible"){I("visible");return}return nt(A,{hidden:()=>E($),visible:()=>P($)})}},[A,$,P,E,j,D]);let x=Qi();ge(()=>{if(B&&x&&A==="visible"&&$.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[$,A,x,B]);let T=w&&!g,O=g&&j&&w,y=S.useRef(!1),L=cf(()=>{y.current||(I("hidden"),E($))},N),F=ce(G=>{y.current=!0;let X=G?"enter":"leave";L.onStart($,X,ee=>{ee==="enter"?s==null||s():ee==="leave"&&(c==null||c())})}),U=ce(G=>{let X=G?"enter":"leave";y.current=!1,L.onStop($,X,ee=>{ee==="enter"?i==null||i():ee==="leave"&&(a==null||a())}),X==="leave"&&!ss(L)&&(I("hidden"),E($))});S.useEffect(()=>{B&&o||(F(j),U(j))},[j,B,o]);let z=!(!o||!B||!x||T),[,V]=ml(z,C,j,{start:F,end:U}),Z=dn({ref:k,className:((r=mi(v.className,O&&u,O&&l,V.enter&&u,V.enter&&V.closed&&l,V.enter&&!V.closed&&f,V.leave&&d,V.leave&&!V.closed&&h,V.leave&&V.closed&&m,!V.transition&&j&&p))==null?void 0:r.trim())||void 0,...hl(V)}),W=0;A==="visible"&&(W|=mt.Open),A==="hidden"&&(W|=mt.Closed),j&&A==="hidden"&&(W|=mt.Opening),!j&&A==="visible"&&(W|=mt.Closing);let K=Ze();return S.createElement(os.Provider,{value:L},S.createElement(tf,{value:W},K({ourProps:Z,theirProps:v,defaultTag:uf,features:lf,visible:A==="visible",name:"Transition.Child"})))}function Ov(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=S.useRef(null),c=af(e),a=rt(...c?[i,t]:t===null?[]:[t]);Qi();let u=Xi();if(n===void 0&&u!==null&&(n=(u&mt.Open)===mt.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=S.useState(n?"visible":"hidden"),p=cf(()=>{n||f("hidden")}),[d,h]=S.useState(!0),m=S.useRef([n]);ge(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let v=S.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);ge(()=>{n?f("visible"):!ss(p)&&i.current!==null&&f("hidden")},[n,p]);let C={unmount:o},b=ce(()=>{var k;d&&h(!1),(k=e.beforeEnter)==null||k.call(e)}),$=ce(()=>{var k;d&&h(!1),(k=e.beforeLeave)==null||k.call(e)}),B=Ze();return S.createElement(os.Provider,{value:p},S.createElement(rs.Provider,{value:v},B({ourProps:{...C,as:S.Fragment,children:S.createElement(ff,{ref:a,...C,...s,beforeEnter:b,beforeLeave:$})},theirProps:{},defaultTag:S.Fragment,features:lf,visible:l==="visible",name:"Transition"})))}function Nv(e,t){let n=S.useContext(rs)!==null,r=Xi()!==null;return S.createElement(S.Fragment,null,!n&&r?S.createElement(Ji,{ref:t,...e}):S.createElement(ff,{ref:t,...e}))}let Ji=_e(Ov),ff=_e(Cv),Iv=_e(Nv),df=Object.assign(Ji,{Child:Iv,Root:Ji});function Mv(e,t){let n=S.useRef({left:0,top:0});if(ge(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let pf=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function hf(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!zt(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return pf.test(i)&&(i=i.replace(pf,"")),i}function Lv(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():hf(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return hf(e).trim()}function Bv(e){let t=S.useRef(""),n=S.useRef("");return ce(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=Lv(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var kv=Object.defineProperty,Rv=(e,t,n)=>t in e?kv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mf=(e,t,n)=>(Rv(e,typeof t!="symbol"?t+"":t,n),n),Oe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Oe||{}),Nt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Nt||{}),is=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(is||{}),gf=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(gf||{});function bf(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=il(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 Fv={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ve.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ve.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ve.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===ve.Previous){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=ns(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===ve.Next){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=ns(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=bf(e),u=ns(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});return{...c,...a,activeOptionIndex:u}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ve.Nothing&&(r=ns(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ve.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...bf(e),pendingShouldSort:!1}:e};class ea extends Zu{constructor(t){super(t),mf(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return nt(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(u=>o(u,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:Ei(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:Ei(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Ei(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ve.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),mf(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=Si.get(null);this.disposables.add(r.on(Qu.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new ea({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ve.Nothing},__demoMode:n})}reduce(t,n){return nt(n.type,Fv,t,n)}}const yf=S.createContext(null);function ta(e){let t=S.useContext(yf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,vf),n}return t}function vf({id:e,__demoMode:t=!1}){let n=S.useMemo(()=>ea.new({id:e,__demoMode:t}),[]);return rf(()=>n.dispose()),n}let as=S.createContext(null);as.displayName="ListboxDataContext";function jr(e){let t=S.useContext(as);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,jr),n}return t}let Dv=S.Fragment;function jv(e,t){let n=S.useId(),r=hi(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const v=p?"horizontal":"vertical";let C=rt(t),b=rg(s),[$=d?[]:void 0,B]=ng(o,a,b),k=vf({id:n,__demoMode:h}),D=S.useRef({static:!1,hold:!1}),j=S.useRef(new Map),g=Og(u),w=S.useCallback(z=>nt(A.mode,{[Nt.Multi]:()=>$.some(V=>g(V,z)),[Nt.Single]:()=>g($,z)}),[$]),A=S.useMemo(()=>({value:$,disabled:f,invalid:l,mode:d?Nt.Multi:Nt.Single,orientation:v,onChange:B,compare:g,isSelected:w,optionsPropsRef:D,listRef:j}),[$,f,l,d,v,B,g,w,D,j]);ge(()=>{k.state.dataRef.current=A},[A]);let I=st(k,z=>z.listboxState),N=Si.get(null),P=st(N,S.useCallback(z=>N.selectors.isTop(z,n),[N,n])),[E,x]=st(k,z=>[z.buttonElement,z.optionsElement]);nb(P,[E,x],(z,V)=>{k.send({type:gf.CloseListbox}),sl(V,Ni.Loose)||(z.preventDefault(),E==null||E.focus())});let T=S.useMemo(()=>({open:I===Oe.Open,disabled:f,invalid:l,value:$}),[I,f,l,$]),[O,y]=Sg({inherit:!0}),L={ref:C},F=S.useCallback(()=>{if(b!==void 0)return B==null?void 0:B(b)},[B,b]),U=Ze();return S.createElement(y,{value:O,props:{htmlFor:E==null?void 0:E.id},slot:{open:I===Oe.Open,disabled:f}},S.createElement(av,null,S.createElement(yf.Provider,{value:k},S.createElement(as.Provider,{value:A},S.createElement(tf,{value:nt(I,{[Oe.Open]:mt.Open,[Oe.Closed]:mt.Closed})},c!=null&&$!=null&&S.createElement(ug,{disabled:f,data:{[c]:$},form:i,onReset:F}),U({ourProps:L,theirProps:m,slot:T,defaultTag:Dv,name:"Listbox"}))))))}let _v="button";function Uv(e,t){let n=S.useId(),r=Fu(),o=jr("Listbox.Button"),s=ta("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=rt(t,rv(),s.actions.setButtonElement),f=ov(),[p,d,h]=st(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),m=p===Oe.Open;sb(m,{trigger:d,action:S.useCallback(y=>{if(d!=null&&d.contains(y.target))return zo.Ignore;let L=y.target.closest('[role="option"]:not([data-disabled])');return zt(L)?zo.Select(L):h!=null&&h.contains(y.target)?zo.Ignore:zo.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let v=ce(y=>{switch(y.key){case Ce.Enter:og(y.currentTarget);break;case Ce.Space:case Ce.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ce.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),C=ce(y=>{switch(y.key){case Ce.Space:y.preventDefault();break}}),b=ce(y=>{var L;if(y.button===nf.Left){if(gg(y.currentTarget))return y.preventDefault();s.state.listboxState===Oe.Open?(Be.flushSync(()=>s.actions.closeListbox()),(L=s.state.buttonElement)==null||L.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),$=S.useRef(null),B=ce(y=>{$.current=y.pointerType,y.pointerType==="mouse"&&b(y)}),k=ce(y=>{$.current!=="mouse"&&b(y)}),D=ce(y=>y.preventDefault()),j=Hu([i]),g=vg(),{isFocusVisible:w,focusProps:A}=Hm({autoFocus:a}),{isHovered:I,hoverProps:N}=Wm({isDisabled:c}),{pressed:P,pressProps:E}=Ym({disabled:c}),x=S.useMemo(()=>({open:p===Oe.Open,active:P||p===Oe.Open,disabled:c,invalid:o.invalid,value:o.value,hover:I,focus:w,autofocus:a}),[p,o.value,c,I,w,P,o.invalid,a]),T=st(s,y=>y.listboxState===Oe.Open),O=Mu(f(),{ref:l,id:i,type:ib(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":T,"aria-labelledby":j,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:v,onKeyUp:C,onKeyPress:D,onPointerDown:B,onClick:k},A,N,E);return Ze()({ourProps:O,theirProps:u,slot:x,defaultTag:_v,name:"Listbox.Button"})}let wf=S.createContext(!1),zv="div",Wv=Do.RenderStrategy|Do.Static;function Hv(e,t){let n=S.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=nv(o),[l,f]=S.useState(null);u&&(s=!0);let p=jr("Listbox.Options"),d=ta("Listbox.Options"),[h,m,v,C]=st(d,G=>[G.listboxState,G.buttonElement,G.optionsElement,G.__demoMode]),b=Ii(m),$=Ii(v),B=Xi(),[k,D]=ml(c,l,B!==null?(B&mt.Open)===mt.Open:h===Oe.Open);Hg(k,m,d.actions.closeListbox);let j=C?!1:i&&h===Oe.Open;hb(j,$);let g=C?!1:i&&h===Oe.Open;Wg(g,{allowed:S.useCallback(()=>[m,v],[m,v])});let w=h!==Oe.Open,A=Mv(w,m)?!1:k,I=k&&h===Oe.Closed,N=lv(I,p.value),P=ce(G=>p.compare(N,G)),E=st(d,G=>{var X;if(u==null||!((X=u==null?void 0:u.to)!=null&&X.includes("selection")))return null;let ee=G.options.findIndex(fe=>P(fe.dataRef.current.value));return ee===-1&&(ee=0),ee}),x=(()=>{if(u==null)return;if(E===null)return{...u,inner:void 0};let G=Array.from(p.listRef.current.values());return{...u,inner:{listRef:{current:G},index:E}}})(),[T,O]=iv(x),y=sv(),L=rt(t,u?T:null,d.actions.setOptionsElement,f),F=Vn();S.useEffect(()=>{var G;let X=v;X&&h===Oe.Open&&X!==((G=Ir(X))==null?void 0:G.activeElement)&&(X==null||X.focus({preventScroll:!0}))},[h,v]);let U=ce(G=>{var X,ee;switch(F.dispose(),G.key){case Ce.Space:if(d.state.searchQuery!=="")return G.preventDefault(),G.stopPropagation(),d.actions.search(G.key);case Ce.Enter:if(G.preventDefault(),G.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:fe}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(fe.current.value)}p.mode===Nt.Single&&(Be.flushSync(()=>d.actions.closeListbox()),(X=d.state.buttonElement)==null||X.focus({preventScroll:!0}));break;case nt(p.orientation,{vertical:Ce.ArrowDown,horizontal:Ce.ArrowRight}):return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Next});case nt(p.orientation,{vertical:Ce.ArrowUp,horizontal:Ce.ArrowLeft}):return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Previous});case Ce.Home:case Ce.PageUp:return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.First});case Ce.End:case Ce.PageDown:return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Last});case Ce.Escape:G.preventDefault(),G.stopPropagation(),Be.flushSync(()=>d.actions.closeListbox()),(ee=d.state.buttonElement)==null||ee.focus({preventScroll:!0});return;case Ce.Tab:G.preventDefault(),G.stopPropagation(),Be.flushSync(()=>d.actions.closeListbox()),Qg(d.state.buttonElement,G.shiftKey?Oi.Previous:Oi.Next);break;default:G.key.length===1&&(d.actions.search(G.key),F.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=st(d,G=>{var X;return(X=G.buttonElement)==null?void 0:X.id}),V=S.useMemo(()=>({open:h===Oe.Open}),[h]),Z=Mu(u?y():{},{id:r,ref:L,"aria-activedescendant":st(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Nt.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:U,role:"listbox",tabIndex:h===Oe.Open?0:void 0,style:{...a.style,...O,"--button-width":Ig(m,!0).width},...hl(D)}),W=Ze(),K=S.useMemo(()=>p.mode===Nt.Multi?p:{...p,isSelected:P},[p,P]);return S.createElement(Sv,{enabled:s?e.static||k:!1,ownerDocument:b},S.createElement(as.Provider,{value:K},W({ourProps:Z,theirProps:a,slot:V,defaultTag:zv,features:Wv,visible:A,name:"Listbox.Options"})))}let Vv="div";function Gv(e,t){let n=S.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=S.useContext(wf)===!0,a=jr("Listbox.Option"),u=ta("Listbox.Option"),l=st(u,A=>u.selectors.isActive(A,r)),f=a.isSelected(s),p=S.useRef(null),d=Bv(p),h=$n({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=rt(t,p,A=>{A?a.listRef.current.set(r,A):a.listRef.current.delete(r)}),v=st(u,A=>u.selectors.shouldScrollIntoView(A,r));ge(()=>{if(v)return ht().requestAnimationFrame(()=>{var A,I;(I=(A=p.current)==null?void 0:A.scrollIntoView)==null||I.call(A,{block:"nearest"})})},[v,p]),ge(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let C=ce(A=>{var I;if(o)return A.preventDefault();u.actions.onChange(s),a.mode===Nt.Single&&(Be.flushSync(()=>u.actions.closeListbox()),(I=u.state.buttonElement)==null||I.focus({preventScroll:!0}))}),b=ce(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),$=mb(),B=ce(A=>$.update(A)),k=ce(A=>{$.wasMoved(A)&&(o||l&&u.state.activationTrigger===is.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},is.Pointer))}),D=ce(A=>{$.wasMoved(A)&&(o||l&&u.state.activationTrigger===is.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),j=S.useMemo(()=>({active:l,focus:l,selected:f,disabled:o,selectedOption:f&&c}),[l,f,o,c]),g=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:C,onFocus:b,onPointerEnter:B,onMouseEnter:B,onPointerMove:k,onMouseMove:k,onPointerLeave:D,onMouseLeave:D},w=Ze();return!f&&c?null:w({ourProps:g,theirProps:i,slot:j,defaultTag:Vv,name:"Listbox.Option"})}let qv=S.Fragment;function Zv(e,t){let{options:n,placeholder:r,...o}=e,s={ref:rt(t)},i=jr("ListboxSelectedOption"),c=S.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Nt.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Ze();return S.createElement(wf.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:S.createElement(S.Fragment,null,r&&a?r:n)},slot:c,defaultTag:qv,name:"ListboxSelectedOption"}))}let Kv=_e(jv),Yv=_e(Uv),Xv=Tg,Qv=_e(Hv),Jv=_e(Gv),e1=_e(Zv),mn=Object.assign(Kv,{Button:Yv,Label:Xv,Options:Qv,Option:Jv,SelectedOption:e1});function t1({title:e,titleId:t,...n},r){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?_.createElement("title",{id:t},e):null,_.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"}))}const xf=_.forwardRef(t1),n1=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>{const{t:s}=pt();return M.jsx("div",{className:`relative ${o}`,children:M.jsx(mn,{value:t,onChange:n,disabled:r,children:({open:i})=>M.jsxs(M.Fragment,{children:[M.jsxs(mn.Button,{className:`
84
84
  relative w-full h-9 text-text-primary bg-fill-input-primary
85
85
  items-center justify-between flex px-3 rounded-lg
86
86
  focus:outline-none
87
87
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
88
- ${l?"ring-1 ring-white":""}
89
- `,children:[S.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.asset")}),S.jsxs("div",{className:"flex items-center",children:[t.iconUrl?S.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):S.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:S.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),S.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),S.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:[S.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:S.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"})}),S.jsx("defs",{children:S.jsx("clipPath",{id:"clip0_12919_27745",children:S.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),S.jsx(Rs,{as:m.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:S.jsx(wt.Options,{className:`
88
+ ${i?"ring-1 ring-white":""}
89
+ `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("deposit.asset")}),M.jsxs("div",{className:"flex items-center",children:[t.iconUrl?M.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${i?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(df,{as:S.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:M.jsx(mn.Options,{className:`
90
90
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
91
91
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
92
92
  focus:outline-none
93
- `,children:e.map(u=>S.jsx(wt.Option,{value:u,className:({active:s,selected:a})=>`relative cursor-pointer select-none py-3 px-3 ${a?"bg-fill-btn-secondary":s?"bg-fill-input-secondary":""}`,children:({selected:s,active:a})=>S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center space-x-3",children:[u.iconUrl?S.jsx("img",{src:u.iconUrl,alt:u.token,className:"w-5 h-5 rounded-full"}):S.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:S.jsx("span",{className:"text-xs text-white font-bold",children:u.token.charAt(0)})}),S.jsx("div",{className:"flex flex-col",children:S.jsx("span",{className:`text-sm font-medium ${s||a?"text-text-primary":"text-text-tertiary"}`,children:u.symbol||u.token})})]}),s&&S.jsx(Gs,{className:"w-4 h-4 text-blue-400"})]})},u.tokenAddress))})})]})})})},pp=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:i="mpc"})=>{const{t:l}=Ye();return S.jsx("div",{className:`relative ${o}`,children:S.jsx(wt,{value:t,onChange:n,disabled:r,children:({open:u})=>S.jsxs(S.Fragment,{children:[S.jsxs(wt.Button,{className:`
93
+ `,children:e.map(c=>M.jsx(mn.Option,{value:c,className:({active:a,selected:u})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-fill-btn-secondary":a?"bg-fill-input-secondary":""}`,children:({selected:a,active:u})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[c.iconUrl?M.jsx("img",{src:c.iconUrl,alt:c.token,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:c.token.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${a||u?"text-text-primary":"text-text-tertiary"}`,children:c.symbol||c.token})})]}),a&&M.jsx(xf,{className:"w-4 h-4 text-blue-400"})]})},c.tokenAddress))})})]})})})},r1=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=pt();return M.jsx("div",{className:`relative ${o}`,children:M.jsx(mn,{value:t,onChange:n,disabled:r,children:({open:c})=>M.jsxs(M.Fragment,{children:[M.jsxs(mn.Button,{className:`
94
94
  relative w-full h-9 text-text-primary bg-fill-input-primary
95
95
  items-center justify-between flex px-3 rounded-lg
96
96
  focus:outline-none
97
97
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
98
- ${u?"ring-1 ring-white":""}
99
- `,children:[S.jsx("span",{className:"text-sm leading-[18px] font-medium",children:l("deposit.chain")}),S.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?S.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):S.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:S.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),S.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),S.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${u?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[S.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:S.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"})}),S.jsx("defs",{children:S.jsx("clipPath",{id:"clip0_12919_27745",children:S.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),S.jsx(Rs,{as:m.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:S.jsx(wt.Options,{className:`
98
+ ${c?"ring-1 ring-white":""}
99
+ `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),M.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?M.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${c?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(df,{as:S.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:M.jsx(mn.Options,{className:`
100
100
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
101
101
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
102
102
  focus:outline-none
103
- `,children:e.filter(s=>s[i==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(s=>S.jsx(wt.Option,{value:s,className:({active:a,selected:c})=>`relative cursor-pointer select-none py-3 px-3 ${c?"bg-fill-btn-secondary":a?"bg-fill-input-secondary":""}`,children:({selected:a,active:c})=>S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center space-x-3",children:[s.chainIconUrl?S.jsx("img",{src:s.chainIconUrl,alt:s.chain,className:"w-5 h-5 rounded-full"}):S.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:S.jsx("span",{className:"text-xs text-white font-bold",children:s.chain.charAt(0)})}),S.jsx("div",{className:"flex flex-col",children:S.jsx("span",{className:`text-sm font-medium ${a||c?"text-text-primary":"text-text-tertiary"}`,children:s.chain})})]}),a&&S.jsx(Gs,{className:"w-4 h-4 text-blue-400"})]})},s.chainId))})})]})})})},no=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:i="mpc"})=>{const l=m.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),u=f=>{if(n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(v=>v.token===r||v.symbol===r)){const v=f.tokenList[0];o(v.symbol||v.token)}},s=f=>{o(f.symbol||f.token)},a=m.useMemo(()=>t.map(f=>f),[t]),c=m.useMemo(()=>a.find(f=>f.chainId===e.chainId)||a[0],[a,e.chainId]),d=m.useMemo(()=>l.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[l]),p=m.useMemo(()=>{if(d.length!==0)return d.find(f=>f.token===r||f.symbol===r)||d[0]},[d,r]);return S.jsxs("div",{className:"space-y-4",children:[S.jsx(pp,{chains:a,selectedChain:c,onChainChange:f=>{const g=t.find(v=>v.chainId===f.chainId);g&&u(g)},walletType:i,className:"w-full"}),d.length>0?p&&S.jsx(dp,{tokens:d,selectedToken:p,onTokenChange:s,className:"w-full"}):S.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:S.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})},mp=(e,t)=>Number(e)>Number(t),Xe=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 i=r[1]||"";return i.length>6&&(i=i.substring(0,6)),i=i.replace(/0+$/,""),i?(i.length===1&&(i+="0"),o+"."+i):o+".00"},ro=(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 s=o[0]+"."+o[1].substring(0,6);return ro(s,t)}const i=parseFloat(e),l=parseFloat(t);return!isNaN(i)&&!isNaN(l)&&i>l?{isValid:!0,formattedValue:Xe(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},hp=(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)},Bn={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},gp=[Bn.ETHEREUM,Bn.SEPOLIA,Bn.ARBITRUM,Bn.ARBITRUM_SEPOLIA],vp=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!gp.includes(t)}return!0},Ys=(e,t,n)=>{const r=typeof e=="string"?parseInt(e,10):e,o=r===42161||r===421614,i=(t==null?void 0:t.toUpperCase())==="USDT";if(!o||!i)return!1;try{const l=new xe(n||"0"),u=new xe("200000");return l.isNaN()||u.isNaN()?!1:l.gte(u)}catch{return!1}},bp=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],oo={wallet:"mpc",ethAddress:"",accountId:"",l2Key:""},io={address:""},so={multiChain:{minDeposit:10}};var Wn={},yp=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()}},xp=yp,Ks={"text/plain":"Text","text/html":"Url",default:"Text"},wp="Copy to clipboard: #{key}, Enter";function Ep(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function Sp(e,t){var n,r,o,i,l,u,s=!1;t||(t={}),n=t.debug||!1;try{o=xp(),i=document.createRange(),l=document.getSelection(),u=document.createElement("span"),u.textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(c){if(c.stopPropagation(),t.format)if(c.preventDefault(),typeof c.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=Ks[t.format]||Ks.default;window.clipboardData.setData(d,e)}else c.clipboardData.clearData(),c.clipboardData.setData(t.format,e);t.onCopy&&(c.preventDefault(),t.onCopy(c.clipboardData))}),document.body.appendChild(u),i.selectNodeContents(u),l.addRange(i);var a=document.execCommand("copy");if(!a)throw new Error("copy command was unsuccessful");s=!0}catch(c){n&&console.error("unable to copy using execCommand: ",c),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(d){n&&console.error("unable to copy using clipboardData: ",d),n&&console.error("falling back to prompt"),r=Ep("message"in t?t.message:wp),window.prompt(r,e)}}finally{l&&(typeof l.removeRange=="function"?l.removeRange(i):l.removeAllRanges()),u&&document.body.removeChild(u),o()}return s}var Cp=Sp;function lo(e){"@babel/helpers - typeof";return lo=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},lo(e)}Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.CopyToClipboard=void 0;var Un=qs(m),Op=qs(Cp),Tp=["text","onCopy","options","children"];function qs(e){return e&&e.__esModule?e:{default:e}}function Xs(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 Qs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xs(Object(n),!0).forEach(function(r){uo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xs(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Np(e,t){if(e==null)return{};var n=Lp(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Lp(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Pp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dp(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 $p(e,t,n){return t&&Dp(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ap(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&&ao(e,t)}function ao(e,t){return ao=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},ao(e,t)}function Mp(e){var t=jp();return function(){var r=Vn(e),o;if(t){var i=Vn(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Ip(this,o)}}function Ip(e,t){if(t&&(lo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Zs(e)}function Zs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jp(){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 Vn(e){return Vn=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Vn(e)}function uo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Js=function(e){Ap(n,e);var t=Mp(n);function n(){var r;Pp(this,n);for(var o=arguments.length,i=new Array(o),l=0;l<o;l++)i[l]=arguments[l];return r=t.call.apply(t,[this].concat(i)),uo(Zs(r),"onClick",function(u){var s=r.props,a=s.text,c=s.onCopy,d=s.children,p=s.options,f=Un.default.Children.only(d),g=(0,Op.default)(a,p);c&&c(a,g),f&&f.props&&typeof f.props.onClick=="function"&&f.props.onClick(u)}),r}return $p(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var i=o.children,l=Np(o,Tp),u=Un.default.Children.only(i);return Un.default.cloneElement(u,Qs(Qs({},l),{},{onClick:this.onClick}))}}]),n}(Un.default.PureComponent);Wn.CopyToClipboard=Js,uo(Js,"defaultProps",{onCopy:void 0,options:void 0});var Fp=Wn,co=Fp.CopyToClipboard;co.CopyToClipboard=co;var Rp=co;const kp=sa(Rp);var _p=Object.defineProperty,zn=Object.getOwnPropertySymbols,el=Object.prototype.hasOwnProperty,tl=Object.prototype.propertyIsEnumerable,nl=(e,t,n)=>t in e?_p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fo=(e,t)=>{for(var n in t||(t={}))el.call(t,n)&&nl(e,n,t[n]);if(zn)for(var n of zn(t))tl.call(t,n)&&nl(e,n,t[n]);return e},po=(e,t)=>{var n={};for(var r in e)el.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&zn)for(var r of zn(e))t.indexOf(r)<0&&tl.call(e,r)&&(n[r]=e[r]);return n};/**
103
+ `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>M.jsx(mn.Option,{value:a,className:({active:u,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":u?"bg-fill-input-secondary":""}`,children:({selected:u,active:l})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?M.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${u||l?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),u&&M.jsx(xf,{className:"w-4 h-4 text-blue-400"})]})},a.chainId))})})]})})})},na=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s="mpc"})=>{const i=S.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),c=d=>{if(n(d.chainId),d.tokenList&&d.tokenList.length>0&&!d.tokenList.some(m=>m.token===r||m.symbol===r)){const m=d.tokenList[0];o(m.symbol||m.token)}},a=d=>{o(d.symbol||d.token)},u=S.useMemo(()=>t.map(d=>d),[t]),l=S.useMemo(()=>u.find(d=>d.chainId===e.chainId)||u[0],[u,e.chainId]),f=S.useMemo(()=>i.map(d=>({token:d.token,symbol:d.symbol,iconUrl:d.iconUrl,decimals:d.decimals,tokenAddress:d.tokenAddress})),[i]),p=S.useMemo(()=>{if(f.length!==0)return f.find(d=>d.token===r||d.symbol===r)||f[0]},[f,r]);return M.jsxs("div",{className:"space-y-4",children:[M.jsx(r1,{chains:u,selectedChain:l,onChainChange:d=>{const h=t.find(m=>m.chainId===d.chainId);h&&c(h)},walletType:s,className:"w-full"}),f.length>0?p&&M.jsx(n1,{tokens:f,selectedToken:p,onTokenChange:a,className:"w-full"}):M.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:M.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})},o1=(e,t)=>Number(e)>Number(t),gt=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"},ra=(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 ra(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:gt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},s1=(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)},cs={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},i1=[cs.ETHEREUM,cs.SEPOLIA,cs.ARBITRUM,cs.ARBITRUM_SEPOLIA],a1=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!i1.includes(t)}return!0},c1=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],oa={wallet:"mpc",ethAddress:"",accountId:"",l2Key:""},sa={address:""},ia={multiChain:{minDeposit:10}};var us={},u1=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()}},l1=u1,Ef={"text/plain":"Text","text/html":"Url",default:"Text"},f1="Copy to clipboard: #{key}, Enter";function d1(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function p1(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=l1(),s=document.createRange(),i=document.getSelection(),c=document.createElement("span"),c.textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=Ef[t.format]||Ef.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");a=!0}catch(l){n&&console.error("unable to copy using execCommand: ",l),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(f){n&&console.error("unable to copy using clipboardData: ",f),n&&console.error("falling back to prompt"),r=d1("message"in t?t.message:f1),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var h1=p1;function aa(e){"@babel/helpers - typeof";return aa=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},aa(e)}Object.defineProperty(us,"__esModule",{value:!0}),us.CopyToClipboard=void 0;var ls=Sf(S),m1=Sf(h1),g1=["text","onCopy","options","children"];function Sf(e){return e&&e.__esModule?e:{default:e}}function Pf(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 $f(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pf(Object(n),!0).forEach(function(r){ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pf(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function b1(e,t){if(e==null)return{};var n=y1(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 y1(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 v1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w1(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 x1(e,t,n){return t&&w1(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function E1(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&&ca(e,t)}function ca(e,t){return ca=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},ca(e,t)}function S1(e){var t=$1();return function(){var r=fs(e),o;if(t){var s=fs(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return P1(this,o)}}function P1(e,t){if(t&&(aa(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Af(e)}function Af(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $1(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function fs(e){return fs=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},fs(e)}function ua(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Tf=function(e){E1(n,e);var t=S1(n);function n(){var r;v1(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)),ua(Af(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,f=a.children,p=a.options,d=ls.default.Children.only(f),h=(0,m1.default)(u,p);l&&l(u,h),d&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(c)}),r}return x1(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=b1(o,g1),c=ls.default.Children.only(s);return ls.default.cloneElement(c,$f($f({},i),{},{onClick:this.onClick}))}}]),n}(ls.default.PureComponent);us.CopyToClipboard=Tf,ua(Tf,"defaultProps",{onCopy:void 0,options:void 0});var A1=us,la=A1.CopyToClipboard;la.CopyToClipboard=la;var T1=la;const C1=X0(T1);var O1=Object.defineProperty,ds=Object.getOwnPropertySymbols,Cf=Object.prototype.hasOwnProperty,Of=Object.prototype.propertyIsEnumerable,Nf=(e,t,n)=>t in e?O1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fa=(e,t)=>{for(var n in t||(t={}))Cf.call(t,n)&&Nf(e,n,t[n]);if(ds)for(var n of ds(t))Of.call(t,n)&&Nf(e,n,t[n]);return e},da=(e,t)=>{var n={};for(var r in e)Cf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ds)for(var r of ds(e))t.indexOf(r)<0&&Of.call(e,r)&&(n[r]=e[r]);return n};/**
104
104
  * @license QR Code generator library (TypeScript)
105
105
  * Copyright (c) Project Nayuki.
106
106
  * SPDX-License-Identifier: MIT
107
- */var Pt;(e=>{const t=class ee{constructor(s,a,c,d){if(this.version=s,this.errorCorrectionLevel=a,this.modules=[],this.isFunction=[],s<ee.MIN_VERSION||s>ee.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=s*4+17;let p=[];for(let g=0;g<this.size;g++)p.push(!1);for(let g=0;g<this.size;g++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(c);if(this.drawCodewords(f),d==-1){let g=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const E=this.getPenaltyScore();E<g&&(d=v,g=E),this.applyMask(v)}}o(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(s,a){const c=e.QrSegment.makeSegments(s);return ee.encodeSegments(c,a)}static encodeBinary(s,a){const c=e.QrSegment.makeBytes(s);return ee.encodeSegments([c],a)}static encodeSegments(s,a,c=1,d=40,p=-1,f=!0){if(!(ee.MIN_VERSION<=c&&c<=d&&d<=ee.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let g,v;for(g=c;;g++){const N=ee.getNumDataCodewords(g,a)*8,F=l.getTotalBits(s,g);if(F<=N){v=F;break}if(g>=d)throw new RangeError("Data too long")}for(const N of[ee.Ecc.MEDIUM,ee.Ecc.QUARTILE,ee.Ecc.HIGH])f&&v<=ee.getNumDataCodewords(g,N)*8&&(a=N);let E=[];for(const N of s){n(N.mode.modeBits,4,E),n(N.numChars,N.mode.numCharCountBits(g),E);for(const F of N.getData())E.push(F)}o(E.length==v);const M=ee.getNumDataCodewords(g,a)*8;o(E.length<=M),n(0,Math.min(4,M-E.length),E),n(0,(8-E.length%8)%8,E),o(E.length%8==0);for(let N=236;E.length<M;N^=253)n(N,8,E);let w=[];for(;w.length*8<E.length;)w.push(0);return E.forEach((N,F)=>w[F>>>3]|=N<<7-(F&7)),new ee(g,a,w,p)}getModule(s,a){return 0<=s&&s<this.size&&0<=a&&a<this.size&&this.modules[a][s]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const s=this.getAlignmentPatternPositions(),a=s.length;for(let c=0;c<a;c++)for(let d=0;d<a;d++)c==0&&d==0||c==0&&d==a-1||c==a-1&&d==0||this.drawAlignmentPattern(s[c],s[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(s){const a=this.errorCorrectionLevel.formatBits<<3|s;let c=a;for(let p=0;p<10;p++)c=c<<1^(c>>>9)*1335;const d=(a<<10|c)^21522;o(d>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(d,p));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(d,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(d,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(d,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let s=this.version;for(let c=0;c<12;c++)s=s<<1^(s>>>11)*7973;const a=this.version<<12|s;o(a>>>18==0);for(let c=0;c<18;c++){const d=r(a,c),p=this.size-11+c%3,f=Math.floor(c/3);this.setFunctionModule(p,f,d),this.setFunctionModule(f,p,d)}}drawFinderPattern(s,a){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){const p=Math.max(Math.abs(d),Math.abs(c)),f=s+d,g=a+c;0<=f&&f<this.size&&0<=g&&g<this.size&&this.setFunctionModule(f,g,p!=2&&p!=4)}}drawAlignmentPattern(s,a){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(s+d,a+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(s,a,c){this.modules[a][s]=c,this.isFunction[a][s]=!0}addEccAndInterleave(s){const a=this.version,c=this.errorCorrectionLevel;if(s.length!=ee.getNumDataCodewords(a,c))throw new RangeError("Invalid argument");const d=ee.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][a],p=ee.ECC_CODEWORDS_PER_BLOCK[c.ordinal][a],f=Math.floor(ee.getNumRawDataModules(a)/8),g=d-f%d,v=Math.floor(f/d);let E=[];const M=ee.reedSolomonComputeDivisor(p);for(let N=0,F=0;N<d;N++){let j=s.slice(F,F+v-p+(N<g?0:1));F+=j.length;const k=ee.reedSolomonComputeRemainder(j,M);N<g&&j.push(0),E.push(j.concat(k))}let w=[];for(let N=0;N<E[0].length;N++)E.forEach((F,j)=>{(N!=v-p||j>=g)&&w.push(F[N])});return o(w.length==f),w}drawCodewords(s){if(s.length!=Math.floor(ee.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let a=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let d=0;d<this.size;d++)for(let p=0;p<2;p++){const f=c-p,v=(c+1&2)==0?this.size-1-d:d;!this.isFunction[v][f]&&a<s.length*8&&(this.modules[v][f]=r(s[a>>>3],7-(a&7)),a++)}}o(a==s.length*8)}applyMask(s){if(s<0||s>7)throw new RangeError("Mask value out of range");for(let a=0;a<this.size;a++)for(let c=0;c<this.size;c++){let d;switch(s){case 0:d=(c+a)%2==0;break;case 1:d=a%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+a)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(a/2))%2==0;break;case 5:d=c*a%2+c*a%3==0;break;case 6:d=(c*a%2+c*a%3)%2==0;break;case 7:d=((c+a)%2+c*a%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[a][c]&&d&&(this.modules[a][c]=!this.modules[a][c])}}getPenaltyScore(){let s=0;for(let p=0;p<this.size;p++){let f=!1,g=0,v=[0,0,0,0,0,0,0];for(let E=0;E<this.size;E++)this.modules[p][E]==f?(g++,g==5?s+=ee.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),f||(s+=this.finderPenaltyCountPatterns(v)*ee.PENALTY_N3),f=this.modules[p][E],g=1);s+=this.finderPenaltyTerminateAndCount(f,g,v)*ee.PENALTY_N3}for(let p=0;p<this.size;p++){let f=!1,g=0,v=[0,0,0,0,0,0,0];for(let E=0;E<this.size;E++)this.modules[E][p]==f?(g++,g==5?s+=ee.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),f||(s+=this.finderPenaltyCountPatterns(v)*ee.PENALTY_N3),f=this.modules[E][p],g=1);s+=this.finderPenaltyTerminateAndCount(f,g,v)*ee.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let f=0;f<this.size-1;f++){const g=this.modules[p][f];g==this.modules[p][f+1]&&g==this.modules[p+1][f]&&g==this.modules[p+1][f+1]&&(s+=ee.PENALTY_N2)}let a=0;for(const p of this.modules)a=p.reduce((f,g)=>f+(g?1:0),a);const c=this.size*this.size,d=Math.ceil(Math.abs(a*20-c*10)/c)-1;return o(0<=d&&d<=9),s+=d*ee.PENALTY_N4,o(0<=s&&s<=2568888),s}getAlignmentPatternPositions(){if(this.version==1)return[];{const s=Math.floor(this.version/7)+2,a=this.version==32?26:Math.ceil((this.version*4+4)/(s*2-2))*2;let c=[6];for(let d=this.size-7;c.length<s;d-=a)c.splice(1,0,d);return c}}static getNumRawDataModules(s){if(s<ee.MIN_VERSION||s>ee.MAX_VERSION)throw new RangeError("Version number out of range");let a=(16*s+128)*s+64;if(s>=2){const c=Math.floor(s/7)+2;a-=(25*c-10)*c-55,s>=7&&(a-=36)}return o(208<=a&&a<=29648),a}static getNumDataCodewords(s,a){return Math.floor(ee.getNumRawDataModules(s)/8)-ee.ECC_CODEWORDS_PER_BLOCK[a.ordinal][s]*ee.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][s]}static reedSolomonComputeDivisor(s){if(s<1||s>255)throw new RangeError("Degree out of range");let a=[];for(let d=0;d<s-1;d++)a.push(0);a.push(1);let c=1;for(let d=0;d<s;d++){for(let p=0;p<a.length;p++)a[p]=ee.reedSolomonMultiply(a[p],c),p+1<a.length&&(a[p]^=a[p+1]);c=ee.reedSolomonMultiply(c,2)}return a}static reedSolomonComputeRemainder(s,a){let c=a.map(d=>0);for(const d of s){const p=d^c.shift();c.push(0),a.forEach((f,g)=>c[g]^=ee.reedSolomonMultiply(f,p))}return c}static reedSolomonMultiply(s,a){if(s>>>8||a>>>8)throw new RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285,c^=(a>>>d&1)*s;return o(c>>>8==0),c}finderPenaltyCountPatterns(s){const a=s[1];o(a<=this.size*3);const c=a>0&&s[2]==a&&s[3]==a*3&&s[4]==a&&s[5]==a;return(c&&s[0]>=a*4&&s[6]>=a?1:0)+(c&&s[6]>=a*4&&s[0]>=a?1:0)}finderPenaltyTerminateAndCount(s,a,c){return s&&(this.finderPenaltyAddHistory(a,c),a=0),a+=this.size,this.finderPenaltyAddHistory(a,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(s,a){a[0]==0&&(s+=this.size),a.pop(),a.unshift(s)}};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(u,s,a){if(s<0||s>31||u>>>s)throw new RangeError("Value out of range");for(let c=s-1;c>=0;c--)a.push(u>>>c&1)}function r(u,s){return(u>>>s&1)!=0}function o(u){if(!u)throw new Error("Assertion error")}const i=class de{constructor(s,a,c){if(this.mode=s,this.numChars=a,this.bitData=c,a<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(s){let a=[];for(const c of s)n(c,8,a);return new de(de.Mode.BYTE,s.length,a)}static makeNumeric(s){if(!de.isNumeric(s))throw new RangeError("String contains non-numeric characters");let a=[];for(let c=0;c<s.length;){const d=Math.min(s.length-c,3);n(parseInt(s.substring(c,c+d),10),d*3+1,a),c+=d}return new de(de.Mode.NUMERIC,s.length,a)}static makeAlphanumeric(s){if(!de.isAlphanumeric(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");let a=[],c;for(c=0;c+2<=s.length;c+=2){let d=de.ALPHANUMERIC_CHARSET.indexOf(s.charAt(c))*45;d+=de.ALPHANUMERIC_CHARSET.indexOf(s.charAt(c+1)),n(d,11,a)}return c<s.length&&n(de.ALPHANUMERIC_CHARSET.indexOf(s.charAt(c)),6,a),new de(de.Mode.ALPHANUMERIC,s.length,a)}static makeSegments(s){return s==""?[]:de.isNumeric(s)?[de.makeNumeric(s)]:de.isAlphanumeric(s)?[de.makeAlphanumeric(s)]:[de.makeBytes(de.toUtf8ByteArray(s))]}static makeEci(s){let a=[];if(s<0)throw new RangeError("ECI assignment value out of range");if(s<128)n(s,8,a);else if(s<16384)n(2,2,a),n(s,14,a);else if(s<1e6)n(6,3,a),n(s,21,a);else throw new RangeError("ECI assignment value out of range");return new de(de.Mode.ECI,0,a)}static isNumeric(s){return de.NUMERIC_REGEX.test(s)}static isAlphanumeric(s){return de.ALPHANUMERIC_REGEX.test(s)}getData(){return this.bitData.slice()}static getTotalBits(s,a){let c=0;for(const d of s){const p=d.mode.numCharCountBits(a);if(d.numChars>=1<<p)return 1/0;c+=4+p+d.bitData.length}return c}static toUtf8ByteArray(s){s=encodeURI(s);let a=[];for(let c=0;c<s.length;c++)s.charAt(c)!="%"?a.push(s.charCodeAt(c)):(a.push(parseInt(s.substring(c+1,c+3),16)),c+=2);return a}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let l=i;e.QrSegment=i})(Pt||(Pt={})),(e=>{(t=>{const n=class{constructor(o,i){this.ordinal=o,this.formatBits=i}};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={}))})(Pt||(Pt={})),(e=>{(t=>{const n=class{constructor(o,i){this.modeBits=o,this.numBitsCharCount=i}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={}))})(Pt||(Pt={}));var kt=Pt;/**
107
+ */var On;(e=>{const t=class ie{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<ie.MIN_VERSION||a>ie.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(l);if(this.drawCodewords(d),f==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const v=this.getPenaltyScore();v<h&&(f=m,h=v),this.applyMask(m)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,u){const l=e.QrSegment.makeSegments(a);return ie.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return ie.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,p=-1,d=!0){if(!(ie.MIN_VERSION<=l&&l<=f&&f<=ie.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const $=ie.getNumDataCodewords(h,u)*8,B=i.getTotalBits(a,h);if(B<=$){m=B;break}if(h>=f)throw new RangeError("Data too long")}for(const $ of[ie.Ecc.MEDIUM,ie.Ecc.QUARTILE,ie.Ecc.HIGH])d&&m<=ie.getNumDataCodewords(h,$)*8&&(u=$);let v=[];for(const $ of a){n($.mode.modeBits,4,v),n($.numChars,$.mode.numCharCountBits(h),v);for(const B of $.getData())v.push(B)}o(v.length==m);const C=ie.getNumDataCodewords(h,u)*8;o(v.length<=C),n(0,Math.min(4,C-v.length),v),n(0,(8-v.length%8)%8,v),o(v.length%8==0);for(let $=236;v.length<C;$^=253)n($,8,v);let b=[];for(;b.length*8<v.length;)b.push(0);return v.forEach(($,B)=>b[B>>>3]|=$<<7-(B&7)),new ie(h,u,b,p)}getModule(a,u){return 0<=a&&a<this.size&&0<=u&&u<this.size&&this.modules[u][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),u=a.length;for(let l=0;l<u;l++)for(let f=0;f<u;f++)l==0&&f==0||l==0&&f==u-1||l==u-1&&f==0||this.drawAlignmentPattern(a[l],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let l=u;for(let p=0;p<10;p++)l=l<<1^(l>>>9)*1335;const f=(u<<10|l)^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 l=0;l<12;l++)a=a<<1^(a>>>11)*7973;const u=this.version<<12|a;o(u>>>18==0);for(let l=0;l<18;l++){const f=r(u,l),p=this.size-11+l%3,d=Math.floor(l/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,u){for(let l=-4;l<=4;l++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(l)),d=a+f,h=u+l;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=4)}}drawAlignmentPattern(a,u){for(let l=-2;l<=2;l++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,u+l,Math.max(Math.abs(f),Math.abs(l))!=1)}setFunctionModule(a,u,l){this.modules[u][a]=l,this.isFunction[u][a]=!0}addEccAndInterleave(a){const u=this.version,l=this.errorCorrectionLevel;if(a.length!=ie.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=ie.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],p=ie.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],d=Math.floor(ie.getNumRawDataModules(u)/8),h=f-d%f,m=Math.floor(d/f);let v=[];const C=ie.reedSolomonComputeDivisor(p);for(let $=0,B=0;$<f;$++){let k=a.slice(B,B+m-p+($<h?0:1));B+=k.length;const D=ie.reedSolomonComputeRemainder(k,C);$<h&&k.push(0),v.push(k.concat(D))}let b=[];for(let $=0;$<v[0].length;$++)v.forEach((B,k)=>{($!=m-p||k>=h)&&b.push(B[$])});return o(b.length==d),b}drawCodewords(a){if(a.length!=Math.floor(ie.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let f=0;f<this.size;f++)for(let p=0;p<2;p++){const d=l-p,m=(l+1&2)==0?this.size-1-f:f;!this.isFunction[m][d]&&u<a.length*8&&(this.modules[m][d]=r(a[u>>>3],7-(u&7)),u++)}}o(u==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let l=0;l<this.size;l++){let f;switch(a){case 0:f=(l+u)%2==0;break;case 1:f=u%2==0;break;case 2:f=l%3==0;break;case 3:f=(l+u)%3==0;break;case 4:f=(Math.floor(l/3)+Math.floor(u/2))%2==0;break;case 5:f=l*u%2+l*u%3==0;break;case 6:f=(l*u%2+l*u%3)%2==0;break;case 7:f=((l+u)%2+l*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][l]&&f&&(this.modules[u][l]=!this.modules[u][l])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[p][v]==d?(h++,h==5?a+=ie.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),d=this.modules[p][v],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ie.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 v=0;v<this.size;v++)this.modules[v][p]==d?(h++,h==5?a+=ie.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),d=this.modules[v][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ie.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+=ie.PENALTY_N2)}let u=0;for(const p of this.modules)u=p.reduce((d,h)=>d+(h?1:0),u);const l=this.size*this.size,f=Math.ceil(Math.abs(u*20-l*10)/l)-1;return o(0<=f&&f<=9),a+=f*ie.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let l=[6];for(let f=this.size-7;l.length<a;f-=u)l.splice(1,0,f);return l}}static getNumRawDataModules(a){if(a<ie.MIN_VERSION||a>ie.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*a+128)*a+64;if(a>=2){const l=Math.floor(a/7)+2;u-=(25*l-10)*l-55,a>=7&&(u-=36)}return o(208<=u&&u<=29648),u}static getNumDataCodewords(a,u){return Math.floor(ie.getNumRawDataModules(a)/8)-ie.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*ie.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let u=[];for(let f=0;f<a-1;f++)u.push(0);u.push(1);let l=1;for(let f=0;f<a;f++){for(let p=0;p<u.length;p++)u[p]=ie.reedSolomonMultiply(u[p],l),p+1<u.length&&(u[p]^=u[p+1]);l=ie.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(a,u){let l=u.map(f=>0);for(const f of a){const p=f^l.shift();l.push(0),u.forEach((d,h)=>l[h]^=ie.reedSolomonMultiply(d,p))}return l}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let f=7;f>=0;f--)l=l<<1^(l>>>7)*285,l^=(u>>>f&1)*a;return o(l>>>8==0),l}finderPenaltyCountPatterns(a){const u=a[1];o(u<=this.size*3);const l=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(l&&a[0]>=u*4&&a[6]>=u?1:0)+(l&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,l){return a&&(this.finderPenaltyAddHistory(u,l),u=0),u+=this.size,this.finderPenaltyAddHistory(u,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(c,a,u){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let l=a-1;l>=0;l--)u.push(c>>>l&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class Ee{constructor(a,u,l){if(this.mode=a,this.numChars=u,this.bitData=l,u<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(a){let u=[];for(const l of a)n(l,8,u);return new Ee(Ee.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!Ee.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<a.length;){const f=Math.min(a.length-l,3);n(parseInt(a.substring(l,l+f),10),f*3+1,u),l+=f}return new Ee(Ee.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!Ee.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],l;for(l=0;l+2<=a.length;l+=2){let f=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;f+=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(f,11,u)}return l<a.length&&n(Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new Ee(Ee.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:Ee.isNumeric(a)?[Ee.makeNumeric(a)]:Ee.isAlphanumeric(a)?[Ee.makeAlphanumeric(a)]:[Ee.makeBytes(Ee.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,u);else if(a<16384)n(2,2,u),n(a,14,u);else if(a<1e6)n(6,3,u),n(a,21,u);else throw new RangeError("ECI assignment value out of range");return new Ee(Ee.Mode.ECI,0,u)}static isNumeric(a){return Ee.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Ee.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const f of a){const p=f.mode.numCharCountBits(u);if(f.numChars>=1<<p)return 1/0;l+=4+p+f.bitData.length}return l}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let l=0;l<a.length;l++)a.charAt(l)!="%"?u.push(a.charCodeAt(l)):(u.push(parseInt(a.substring(l+1,l+3),16)),l+=2);return u}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(On||(On={})),(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={}))})(On||(On={})),(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={}))})(On||(On={}));var Qn=On;/**
108
108
  * @license qrcode.react
109
109
  * Copyright (c) Paul O'Shannessy
110
110
  * SPDX-License-Identifier: ISC
111
- */var Bp={L:kt.QrCode.Ecc.LOW,M:kt.QrCode.Ecc.MEDIUM,Q:kt.QrCode.Ecc.QUARTILE,H:kt.QrCode.Ecc.HIGH},rl=128,ol="L",il="#FFFFFF",sl="#000000",ll=!1,al=1,Wp=4,Up=0,Vp=.1;function ul(e,t=0){const n=[];return e.forEach(function(r,o){let i=null;r.forEach(function(l,u){if(!l&&i!==null){n.push(`M${i+t} ${o+t}h${u-i}v1H${i+t}z`),i=null;return}if(u===r.length-1){if(!l)return;i===null?n.push(`M${u+t},${o+t} h1v1H${u+t}z`):n.push(`M${i+t},${o+t} h${u+1-i}v1H${i+t}z`);return}l&&i===null&&(i=u)})}),n.join("")}function cl(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,i)=>i<t.x||i>=t.x+t.w?o:!1))}function zp(e,t,n,r){if(r==null)return null;const o=e.length+n*2,i=Math.floor(t*Vp),l=o/t,u=(r.width||i)*l,s=(r.height||i)*l,a=r.x==null?e.length/2-u/2:r.x*l,c=r.y==null?e.length/2-s/2:r.y*l,d=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let g=Math.floor(a),v=Math.floor(c),E=Math.ceil(u+a-g),M=Math.ceil(s+c-v);p={x:g,y:v,w:E,h:M}}const f=r.crossOrigin;return{x:a,y:c,h:s,w:u,excavation:p,opacity:d,crossOrigin:f}}function Hp(e,t){return t!=null?Math.max(Math.floor(t),0):e?Wp:Up}function fl({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:i,size:l,boostLevel:u}){let s=m.useMemo(()=>{const g=(Array.isArray(e)?e:[e]).reduce((v,E)=>(v.push(...kt.QrSegment.makeSegments(E)),v),[]);return kt.QrCode.encodeSegments(g,Bp[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:a,margin:c,numCells:d,calculatedImageSettings:p}=m.useMemo(()=>{let f=s.getModules();const g=Hp(r,o),v=f.length+g*2,E=zp(f,l,g,i);return{cells:f,margin:g,numCells:v,calculatedImageSettings:E}},[s,l,i,r,o]);return{qrcode:s,margin:c,cells:a,numCells:d,calculatedImageSettings:p}}var Gp=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Yp=m.forwardRef(function(t,n){const r=t,{value:o,size:i=rl,level:l=ol,bgColor:u=il,fgColor:s=sl,includeMargin:a=ll,minVersion:c=al,boostLevel:d,marginSize:p,imageSettings:f}=r,v=po(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:E}=v,M=po(v,["style"]),w=f==null?void 0:f.src,N=m.useRef(null),F=m.useRef(null),j=m.useCallback(C=>{N.current=C,typeof n=="function"?n(C):n&&(n.current=C)},[n]),[k,B]=m.useState(!1),{margin:h,cells:b,numCells:y,calculatedImageSettings:$}=fl({value:o,level:l,minVersion:c,boostLevel:d,includeMargin:a,marginSize:p,imageSettings:f,size:i});m.useEffect(()=>{if(N.current!=null){const C=N.current,O=C.getContext("2d");if(!O)return;let T=b;const P=F.current,x=$!=null&&P!==null&&P.complete&&P.naturalHeight!==0&&P.naturalWidth!==0;x&&$.excavation!=null&&(T=cl(b,$.excavation));const I=window.devicePixelRatio||1;C.height=C.width=i*I;const _=i/y*I;O.scale(_,_),O.fillStyle=u,O.fillRect(0,0,y,y),O.fillStyle=s,Gp?O.fill(new Path2D(ul(T,h))):b.forEach(function(V,W){V.forEach(function(Y,q){Y&&O.fillRect(q+h,W+h,1,1)})}),$&&(O.globalAlpha=$.opacity),x&&O.drawImage(P,$.x+h,$.y+h,$.w,$.h)}}),m.useEffect(()=>{B(!1)},[w]);const D=fo({height:i,width:i},E);let L=null;return w!=null&&(L=m.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{B(!0)},ref:F,crossOrigin:$==null?void 0:$.crossOrigin})),m.createElement(m.Fragment,null,m.createElement("canvas",fo({style:D,height:i,width:i,ref:j,role:"img"},M)),L)});Yp.displayName="QRCodeCanvas";var dl=m.forwardRef(function(t,n){const r=t,{value:o,size:i=rl,level:l=ol,bgColor:u=il,fgColor:s=sl,includeMargin:a=ll,minVersion:c=al,boostLevel:d,title:p,marginSize:f,imageSettings:g}=r,v=po(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:E,cells:M,numCells:w,calculatedImageSettings:N}=fl({value:o,level:l,minVersion:c,boostLevel:d,includeMargin:a,marginSize:f,imageSettings:g,size:i});let F=M,j=null;g!=null&&N!=null&&(N.excavation!=null&&(F=cl(M,N.excavation)),j=m.createElement("image",{href:g.src,height:N.h,width:N.w,x:N.x+E,y:N.y+E,preserveAspectRatio:"none",opacity:N.opacity,crossOrigin:N.crossOrigin}));const k=ul(F,E);return m.createElement("svg",fo({height:i,width:i,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},v),!!p&&m.createElement("title",null,p),m.createElement("path",{fill:u,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),m.createElement("path",{fill:s,d:k,shapeRendering:"crispEdges"}),j)});dl.displayName="QRCodeSVG";function Kp(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function qp(){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 pl(){return/apple/i.test(navigator.vendor)}function Xp(){return Kp().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function Qp(){return qp().includes("jsdom/")}const ml="data-floating-ui-focusable",Zp="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function mo(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 _t(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Mr(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Bt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ho(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 Jp(e){return e.matches("html,body")}function nt(e){return(e==null?void 0:e.ownerDocument)||document}function hl(e){return Ce(e)&&e.matches(Zp)}function em(e){if(!e||Qp())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function tm(e){return e?e.hasAttribute(ml)?e:e.querySelector("["+ml+"]")||e:null}function Hn(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...Hn(e,o.id,n)])}function nm(e){return"nativeEvent"in e}function rn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var rm=typeof document<"u",om=function(){},rt=rm?m.useLayoutEffect:om;const im={...R};function Gn(e){const t=R.useRef(e);return rt(()=>{t.current=e}),t}const sm=im.useInsertionEffect||(e=>e());function ot(e){const t=R.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return sm(()=>{t.current=e}),R.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 gl=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function vl(e,t){const n=Ji(e,gl()),r=n.length;if(r===0)return;const o=mo(nt(e)),i=n.indexOf(o),l=i===-1?t===1?0:r-1:i+t;return n[l]}function lm(e){return vl(nt(e).body,1)||e}function am(e){return vl(nt(e).body,-1)||e}function go(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!_t(n,r)}function um(e){Ji(e,gl()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function bl(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 cm="data-floating-ui-focusable",yl="active",xl="selected",fm={...R};let wl=!1,dm=0;const El=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+dm++;function pm(){const[e,t]=R.useState(()=>wl?El():void 0);return rt(()=>{e==null&&t(El())},[]),R.useEffect(()=>{wl=!0},[]),e}const vo=fm.useId||pm;let bo;process.env.NODE_ENV!=="production"&&(bo=new Set);function mm(){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=bo)!=null&&e.has(o))){var i;(i=bo)==null||i.add(o),console.error(o)}}function hm(){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 gm=R.createContext(null),vm=R.createContext(null),yo=()=>{var e;return((e=R.useContext(gm))==null?void 0:e.id)||null},xo=()=>R.useContext(vm);function on(e){return"data-floating-ui-"+e}function ze(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Sl=on("safe-polygon");function wo(e,t,n){if(n&&!rn(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 Eo(e){return typeof e=="function"?e():e}function bm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:l}=e,{enabled:u=!0,delay:s=0,handleClose:a=null,mouseOnly:c=!1,restMs:d=0,move:p=!0}=t,f=xo(),g=yo(),v=Gn(a),E=Gn(s),M=Gn(n),w=Gn(d),N=R.useRef(),F=R.useRef(-1),j=R.useRef(),k=R.useRef(-1),B=R.useRef(!0),h=R.useRef(!1),b=R.useRef(()=>{}),y=R.useRef(!1),$=ot(()=>{var P;const x=(P=o.current.openEvent)==null?void 0:P.type;return(x==null?void 0:x.includes("mouse"))&&x!=="mousedown"});R.useEffect(()=>{if(!u)return;function P(x){let{open:I}=x;I||(ze(F),ze(k),B.current=!0,y.current=!1)}return i.on("openchange",P),()=>{i.off("openchange",P)}},[u,i]),R.useEffect(()=>{if(!u||!v.current||!n)return;function P(I){$()&&r(!1,I,"hover")}const x=nt(l.floating).documentElement;return x.addEventListener("mouseleave",P),()=>{x.removeEventListener("mouseleave",P)}},[l.floating,n,r,u,v,$]);const D=R.useCallback(function(P,x,I){x===void 0&&(x=!0),I===void 0&&(I="hover");const _=wo(E.current,"close",N.current);_&&!j.current?(ze(F),F.current=window.setTimeout(()=>r(!1,P,I),_)):x&&(ze(F),r(!1,P,I))},[E,r]),L=ot(()=>{b.current(),j.current=void 0}),C=ot(()=>{if(h.current){const P=nt(l.floating).body;P.style.pointerEvents="",P.removeAttribute(Sl),h.current=!1}}),O=ot(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);R.useEffect(()=>{if(!u)return;function P(W){if(ze(F),B.current=!1,c&&!rn(N.current)||Eo(w.current)>0&&!wo(E.current,"open"))return;const Y=wo(E.current,"open",N.current);Y?F.current=window.setTimeout(()=>{M.current||r(!0,W,"hover")},Y):n||r(!0,W,"hover")}function x(W){if(O()){C();return}b.current();const Y=nt(l.floating);if(ze(k),y.current=!1,v.current&&o.current.floatingContext){n||ze(F),j.current=v.current({...o.current.floatingContext,tree:f,x:W.clientX,y:W.clientY,onClose(){C(),L(),O()||D(W,!0,"safe-polygon")}});const G=j.current;Y.addEventListener("mousemove",G),b.current=()=>{Y.removeEventListener("mousemove",G)};return}(N.current==="touch"?!_t(l.floating,W.relatedTarget):!0)&&D(W)}function I(W){O()||o.current.floatingContext&&(v.current==null||v.current({...o.current.floatingContext,tree:f,x:W.clientX,y:W.clientY,onClose(){C(),L(),O()||D(W)}})(W))}function _(){ze(F)}function V(W){O()||D(W,!1)}if(oe(l.domReference)){const W=l.domReference,Y=l.floating;return n&&W.addEventListener("mouseleave",I),p&&W.addEventListener("mousemove",P,{once:!0}),W.addEventListener("mouseenter",P),W.addEventListener("mouseleave",x),Y&&(Y.addEventListener("mouseleave",I),Y.addEventListener("mouseenter",_),Y.addEventListener("mouseleave",V)),()=>{n&&W.removeEventListener("mouseleave",I),p&&W.removeEventListener("mousemove",P),W.removeEventListener("mouseenter",P),W.removeEventListener("mouseleave",x),Y&&(Y.removeEventListener("mouseleave",I),Y.removeEventListener("mouseenter",_),Y.removeEventListener("mouseleave",V))}}},[l,u,e,c,p,D,L,C,r,n,M,f,E,v,o,O,w]),rt(()=>{var P;if(u&&n&&(P=v.current)!=null&&(P=P.__options)!=null&&P.blockPointerEvents&&$()){h.current=!0;const I=l.floating;if(oe(l.domReference)&&I){var x;const _=nt(l.floating).body;_.setAttribute(Sl,"");const V=l.domReference,W=f==null||(x=f.nodesRef.current.find(Y=>Y.id===g))==null||(x=x.context)==null?void 0:x.elements.floating;return W&&(W.style.pointerEvents=""),_.style.pointerEvents="none",V.style.pointerEvents="auto",I.style.pointerEvents="auto",()=>{_.style.pointerEvents="",V.style.pointerEvents="",I.style.pointerEvents=""}}}},[u,n,g,l,f,v,$]),rt(()=>{n||(N.current=void 0,y.current=!1,L(),C())},[n,L,C]),R.useEffect(()=>()=>{L(),ze(F),ze(k),C()},[u,l.domReference,L,C]);const T=R.useMemo(()=>{function P(x){N.current=x.pointerType}return{onPointerDown:P,onPointerEnter:P,onMouseMove(x){const{nativeEvent:I}=x;function _(){!B.current&&!M.current&&r(!0,I,"hover")}c&&!rn(N.current)||n||Eo(w.current)===0||y.current&&x.movementX**2+x.movementY**2<2||(ze(k),N.current==="touch"?_():(y.current=!0,k.current=window.setTimeout(_,Eo(w.current))))}}},[c,r,n,M,w]);return R.useMemo(()=>u?{reference:T}:{},[u,T])}const Cl={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},Ol=R.forwardRef(function(t,n){const[r,o]=R.useState();rt(()=>{pl()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[on("focus-guard")]:"",style:Cl};return S.jsx("span",{...t,...i})}),Tl=R.createContext(null),Nl=on("portal");function ym(e){e===void 0&&(e={});const{id:t,root:n}=e,r=vo(),o=wm(),[i,l]=R.useState(null),u=R.useRef(null);return rt(()=>()=>{i==null||i.remove(),queueMicrotask(()=>{u.current=null})},[i]),rt(()=>{if(!r||u.current)return;const s=t?document.getElementById(t):null;if(!s)return;const a=document.createElement("div");a.id=r,a.setAttribute(Nl,""),s.appendChild(a),u.current=a,l(a)},[t,r]),rt(()=>{if(n===null||!r||u.current)return;let s=n||(o==null?void 0:o.portalNode);s&&!Ar(s)&&(s=s.current),s=s||document.body;let a=null;t&&(a=document.createElement("div"),a.id=t,s.appendChild(a));const c=document.createElement("div");c.id=r,c.setAttribute(Nl,""),s=a||s,s.appendChild(c),u.current=c,l(c)},[t,n,r,o]),i}function xm(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=ym({id:n,root:r}),[l,u]=R.useState(null),s=R.useRef(null),a=R.useRef(null),c=R.useRef(null),d=R.useRef(null),p=l==null?void 0:l.modal,f=l==null?void 0:l.open,g=!!l&&!l.modal&&l.open&&o&&!!(r||i);return R.useEffect(()=>{if(!i||!o||p)return;function v(E){i&&go(E)&&(E.type==="focusin"?bl:um)(i)}return i.addEventListener("focusin",v,!0),i.addEventListener("focusout",v,!0),()=>{i.removeEventListener("focusin",v,!0),i.removeEventListener("focusout",v,!0)}},[i,o,p]),R.useEffect(()=>{i&&(f||bl(i))},[f,i]),S.jsxs(Tl.Provider,{value:R.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:s,afterOutsideRef:a,beforeInsideRef:c,afterInsideRef:d,portalNode:i,setFocusManagerState:u}),[o,i]),children:[g&&i&&S.jsx(Ol,{"data-type":"outside",ref:s,onFocus:v=>{if(go(v,i)){var E;(E=c.current)==null||E.focus()}else{const M=l?l.domReference:null,w=am(M);w==null||w.focus()}}}),g&&i&&S.jsx("span",{"aria-owns":i.id,style:Cl}),i&&Vt.createPortal(t,i),g&&i&&S.jsx(Ol,{"data-type":"outside",ref:a,onFocus:v=>{if(go(v,i)){var E;(E=d.current)==null||E.focus()}else{const M=l?l.domReference:null,w=lm(M);w==null||w.focus(),l!=null&&l.closeOnFocusOut&&(l==null||l.onOpenChange(!1,v.nativeEvent,"focus-out"))}}})]})}const wm=()=>R.useContext(Tl);function Ll(e){return Ce(e.target)&&e.target.tagName==="BUTTON"}function Em(e){return Ce(e.target)&&e.target.tagName==="A"}function Pl(e){return hl(e)}function Sm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:l=!0,event:u="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:c=!0,stickIfOpen:d=!0}=t,p=R.useRef(),f=R.useRef(!1),g=R.useMemo(()=>({onPointerDown(v){p.current=v.pointerType},onMouseDown(v){const E=p.current;v.button===0&&u!=="click"&&(rn(E,!0)&&a||(n&&s&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="mousedown")?r(!1,v.nativeEvent,"click"):(v.preventDefault(),r(!0,v.nativeEvent,"click"))))},onClick(v){const E=p.current;if(u==="mousedown"&&p.current){p.current=void 0;return}rn(E,!0)&&a||(n&&s&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="click")?r(!1,v.nativeEvent,"click"):r(!0,v.nativeEvent,"click"))},onKeyDown(v){p.current=void 0,!(v.defaultPrevented||!c||Ll(v))&&(v.key===" "&&!Pl(i)&&(v.preventDefault(),f.current=!0),!Em(v)&&v.key==="Enter"&&r(!(n&&s),v.nativeEvent,"click"))},onKeyUp(v){v.defaultPrevented||!c||Ll(v)||Pl(i)||v.key===" "&&f.current&&(f.current=!1,r(!(n&&s),v.nativeEvent,"click"))}}),[o,i,u,a,c,r,n,d,s]);return R.useMemo(()=>l?{reference:g}:{},[l,g])}const Cm={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Om={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Dl=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 Tm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:l=!0,escapeKey:u=!0,outsidePress:s=!0,outsidePressEvent:a="pointerdown",referencePress:c=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:g}=t,v=xo(),E=ot(typeof s=="function"?s:()=>!1),M=typeof s=="function"?E:s,w=R.useRef(!1),{escapeKey:N,outsidePress:F}=Dl(f),{escapeKey:j,outsidePress:k}=Dl(g),B=R.useRef(!1),h=ot(C=>{var O;if(!n||!l||!u||C.key!=="Escape"||B.current)return;const T=(O=i.current.floatingContext)==null?void 0:O.nodeId,P=v?Hn(v.nodesRef.current,T):[];if(!N&&(C.stopPropagation(),P.length>0)){let x=!0;if(P.forEach(I=>{var _;if((_=I.context)!=null&&_.open&&!I.context.dataRef.current.__escapeKeyBubbles){x=!1;return}}),!x)return}r(!1,nm(C)?C.nativeEvent:C,"escape-key")}),b=ot(C=>{var O;const T=()=>{var P;h(C),(P=Bt(C))==null||P.removeEventListener("keydown",T)};(O=Bt(C))==null||O.addEventListener("keydown",T)}),y=ot(C=>{var O;const T=i.current.insideReactTree;i.current.insideReactTree=!1;const P=w.current;if(w.current=!1,a==="click"&&P||T||typeof M=="function"&&!M(C))return;const x=Bt(C),I="["+on("inert")+"]",_=nt(o.floating).querySelectorAll(I);let V=oe(x)?x:null;for(;V&&!ut(V);){const G=ct(V);if(ut(G)||!oe(G))break;V=G}if(_.length&&oe(x)&&!Jp(x)&&!_t(x,o.floating)&&Array.from(_).every(G=>!_t(V,G)))return;if(Ce(x)&&L){const G=ut(x),H=Ve(x),z=/auto|scroll/,J=G||z.test(H.overflowX),se=G||z.test(H.overflowY),he=J&&x.clientWidth>0&&x.scrollWidth>x.clientWidth,$e=se&&x.clientHeight>0&&x.scrollHeight>x.clientHeight,it=H.direction==="rtl",Ee=$e&&(it?C.offsetX<=x.offsetWidth-x.clientWidth:C.offsetX>x.clientWidth),ge=he&&C.offsetY>x.clientHeight;if(Ee||ge)return}const W=(O=i.current.floatingContext)==null?void 0:O.nodeId,Y=v&&Hn(v.nodesRef.current,W).some(G=>{var H;return ho(C,(H=G.context)==null?void 0:H.elements.floating)});if(ho(C,o.floating)||ho(C,o.domReference)||Y)return;const q=v?Hn(v.nodesRef.current,W):[];if(q.length>0){let G=!0;if(q.forEach(H=>{var z;if((z=H.context)!=null&&z.open&&!H.context.dataRef.current.__outsidePressBubbles){G=!1;return}}),!G)return}r(!1,C,"outside-press")}),$=ot(C=>{var O;const T=()=>{var P;y(C),(P=Bt(C))==null||P.removeEventListener(a,T)};(O=Bt(C))==null||O.addEventListener(a,T)});R.useEffect(()=>{if(!n||!l)return;i.current.__escapeKeyBubbles=N,i.current.__outsidePressBubbles=F;let C=-1;function O(_){r(!1,_,"ancestor-scroll")}function T(){window.clearTimeout(C),B.current=!0}function P(){C=window.setTimeout(()=>{B.current=!1},Sn()?5:0)}const x=nt(o.floating);u&&(x.addEventListener("keydown",j?b:h,j),x.addEventListener("compositionstart",T),x.addEventListener("compositionend",P)),M&&x.addEventListener(a,k?$:y,k);let I=[];return p&&(oe(o.domReference)&&(I=yt(o.domReference)),oe(o.floating)&&(I=I.concat(yt(o.floating))),!oe(o.reference)&&o.reference&&o.reference.contextElement&&(I=I.concat(yt(o.reference.contextElement)))),I=I.filter(_=>{var V;return _!==((V=x.defaultView)==null?void 0:V.visualViewport)}),I.forEach(_=>{_.addEventListener("scroll",O,{passive:!0})}),()=>{u&&(x.removeEventListener("keydown",j?b:h,j),x.removeEventListener("compositionstart",T),x.removeEventListener("compositionend",P)),M&&x.removeEventListener(a,k?$:y,k),I.forEach(_=>{_.removeEventListener("scroll",O)}),window.clearTimeout(C)}},[i,o,u,M,a,n,r,p,l,N,F,h,j,b,y,k,$]),R.useEffect(()=>{i.current.insideReactTree=!1},[i,M,a]);const D=R.useMemo(()=>({onKeyDown:h,...c&&{[Cm[d]]:C=>{r(!1,C.nativeEvent,"reference-press")},...d!=="click"&&{onClick(C){r(!1,C.nativeEvent,"reference-press")}}}}),[h,r,c,d]),L=R.useMemo(()=>({onKeyDown:h,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[Om[a]]:()=>{i.current.insideReactTree=!0}}),[h,a,i]);return R.useMemo(()=>l?{reference:D,floating:L}:{},[l,D,L])}function Nm(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=vo(),i=R.useRef({}),[l]=R.useState(()=>hm()),u=yo()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!oe(f)&&mm("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,a]=R.useState(r.reference),c=ot((f,g,v)=>{i.current.openEvent=f?g:void 0,l.emit("openchange",{open:f,event:g,reason:v,nested:u}),n==null||n(f,g,v)}),d=R.useMemo(()=>({setPositionReference:a}),[]),p=R.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return R.useMemo(()=>({dataRef:i,open:t,onOpenChange:c,elements:p,events:l,floatingId:o,refs:d}),[t,c,p,l,o,d])}function Lm(e){e===void 0&&(e={});const{nodeId:t}=e,n=Nm({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,l]=R.useState(null),[u,s]=R.useState(null),c=(o==null?void 0:o.domReference)||i,d=R.useRef(null),p=xo();rt(()=>{c&&(d.current=c)},[c]);const f=ms({...e,elements:{...o,...u&&{reference:u}}}),g=R.useCallback(N=>{const F=oe(N)?{getBoundingClientRect:()=>N.getBoundingClientRect(),getClientRects:()=>N.getClientRects(),contextElement:N}:N;s(F),f.refs.setReference(F)},[f.refs]),v=R.useCallback(N=>{(oe(N)||N===null)&&(d.current=N,l(N)),(oe(f.refs.reference.current)||f.refs.reference.current===null||N!==null&&!oe(N))&&f.refs.setReference(N)},[f.refs]),E=R.useMemo(()=>({...f.refs,setReference:v,setPositionReference:g,domReference:d}),[f.refs,v,g]),M=R.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),w=R.useMemo(()=>({...f,...r,refs:E,elements:M,nodeId:t}),[f,E,M,t,r]);return rt(()=>{r.dataRef.current.floatingContext=w;const N=p==null?void 0:p.nodesRef.current.find(F=>F.id===t);N&&(N.context=w)}),R.useMemo(()=>({...f,context:w,refs:E,elements:M}),[f,E,M,w])}function So(){return Xp()&&pl()}function Pm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:l}=e,{enabled:u=!0,visibleOnly:s=!0}=t,a=R.useRef(!1),c=R.useRef(-1),d=R.useRef(!0);R.useEffect(()=>{if(!u)return;const f=Le(l.domReference);function g(){!n&&Ce(l.domReference)&&l.domReference===mo(nt(l.domReference))&&(a.current=!0)}function v(){d.current=!0}function E(){d.current=!1}return f.addEventListener("blur",g),So()&&(f.addEventListener("keydown",v,!0),f.addEventListener("pointerdown",E,!0)),()=>{f.removeEventListener("blur",g),So()&&(f.removeEventListener("keydown",v,!0),f.removeEventListener("pointerdown",E,!0))}},[l.domReference,n,u]),R.useEffect(()=>{if(!u)return;function f(g){let{reason:v}=g;(v==="reference-press"||v==="escape-key")&&(a.current=!0)}return o.on("openchange",f),()=>{o.off("openchange",f)}},[o,u]),R.useEffect(()=>()=>{ze(c)},[]);const p=R.useMemo(()=>({onMouseLeave(){a.current=!1},onFocus(f){if(a.current)return;const g=Bt(f.nativeEvent);if(s&&oe(g)){if(So()&&!f.relatedTarget){if(!d.current&&!hl(g))return}else if(!em(g))return}r(!0,f.nativeEvent,"focus")},onBlur(f){a.current=!1;const g=f.relatedTarget,v=f.nativeEvent,E=oe(g)&&g.hasAttribute(on("focus-guard"))&&g.getAttribute("data-type")==="outside";c.current=window.setTimeout(()=>{var M;const w=mo(l.domReference?l.domReference.ownerDocument:document);!g&&w===l.domReference||_t((M=i.current.floatingContext)==null?void 0:M.refs.floating.current,w)||_t(l.domReference,w)||E||r(!1,v,"focus")})}}),[i,l.domReference,r,s]);return R.useMemo(()=>u?{reference:p}:{},[u,p])}function Co(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[yl]:l,[xl]:u,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1,[cm]:""},...i,...t.map(l=>{const u=l?l[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((l,u)=>(u&&Object.entries(u).forEach(s=>{let[a,c]=s;if(!(o&&[yl,xl].includes(a)))if(a.indexOf("on")===0){if(r.has(a)||r.set(a,[]),typeof c=="function"){var d;(d=r.get(a))==null||d.push(c),l[a]=function(){for(var p,f=arguments.length,g=new Array(f),v=0;v<f;v++)g[v]=arguments[v];return(p=r.get(a))==null?void 0:p.map(E=>E(...g)).find(E=>E!==void 0)}}}else l[a]=c}),l),{})}}function Dm(e){e===void 0&&(e=[]);const t=e.map(u=>u==null?void 0:u.reference),n=e.map(u=>u==null?void 0:u.floating),r=e.map(u=>u==null?void 0:u.item),o=R.useCallback(u=>Co(u,e,"reference"),t),i=R.useCallback(u=>Co(u,e,"floating"),n),l=R.useCallback(u=>Co(u,e,"item"),r);return R.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:l}),[o,i,l])}const $m=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Am(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:i,floatingId:l}=e,{enabled:u=!0,role:s="dialog"}=t,a=vo(),c=((n=i.domReference)==null?void 0:n.id)||a,d=R.useMemo(()=>{var w;return((w=tm(i.floating))==null?void 0:w.id)||l},[i.floating,l]),p=(r=$m.get(s))!=null?r:s,g=yo()!=null,v=R.useMemo(()=>p==="tooltip"||s==="label"?{["aria-"+(s==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?d:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:c},...p==="menu"&&g&&{role:"menuitem"},...s==="select"&&{"aria-autocomplete":"none"},...s==="combobox"&&{"aria-autocomplete":"list"}},[p,d,g,o,c,s]),E=R.useMemo(()=>{const w={id:d,...p&&{role:p}};return p==="tooltip"||s==="label"?w:{...w,...p==="menu"&&{"aria-labelledby":c}}},[p,d,c,s]),M=R.useCallback(w=>{let{active:N,selected:F}=w;const j={role:"option",...N&&{id:d+"-fui-option"}};switch(s){case"select":case"combobox":return{...j,"aria-selected":F}}return{}},[d,s]);return R.useMemo(()=>u?{reference:v,floating:E,item:M}:{},[u,v,E,M])}const $l=m.forwardRef(({placement:e,className:t=""},n)=>{const o=(i=>{switch(i.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 S.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});$l.displayName="TooltipArrow";const sn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:i="",disabled:l=!1,maxWidth:u="max-w-xs",trigger:s=["hover","focus"]})=>{const[a,c]=m.useState(!1),d=m.useRef(null),{refs:p,floatingStyles:f,context:g}=Lm({open:a&&!l,onOpenChange:c,placement:n,whileElementsMounted:cs,middleware:[Hr(o?12:8),gs({fallbackAxisSideDirection:"start",padding:8}),hs({padding:8}),...o?[Kf({element:d})]:[]]}),v=bm(g,{enabled:s.includes("hover"),delay:{open:r,close:150}}),E=Pm(g,{enabled:s.includes("focus")}),M=Sm(g,{enabled:s.includes("click")}),w=Tm(g),N=Am(g,{role:"tooltip"}),{getReferenceProps:F,getFloatingProps:j}=Dm([v,E,M,w,N]);return l?S.jsx(S.Fragment,{children:e}):S.jsxs(S.Fragment,{children:[S.jsx("div",{ref:p.setReference,...F(),children:e}),a&&S.jsx(xm,{children:S.jsxs("div",{ref:p.setFloating,...j(),style:f,className:`
111
+ */var N1={L:Qn.QrCode.Ecc.LOW,M:Qn.QrCode.Ecc.MEDIUM,Q:Qn.QrCode.Ecc.QUARTILE,H:Qn.QrCode.Ecc.HIGH},If=128,Mf="L",Lf="#FFFFFF",Bf="#000000",kf=!1,Rf=1,I1=4,M1=0,L1=.1;function Ff(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 Df(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 B1(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*L1),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,u=r.x==null?e.length/2-c/2:r.x*i,l=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(u),m=Math.floor(l),v=Math.ceil(c+u-h),C=Math.ceil(a+l-m);p={x:h,y:m,w:v,h:C}}const d=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function k1(e,t){return t!=null?Math.max(Math.floor(t),0):e?I1:M1}function jf({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=S.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,v)=>(m.push(...Qn.QrSegment.makeSegments(v)),m),[]);return Qn.QrCode.encodeSegments(h,N1[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:p}=S.useMemo(()=>{let d=a.getModules();const h=k1(r,o),m=d.length+h*2,v=B1(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:v}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:p}}var R1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),F1=S.forwardRef(function(t,n){const r=t,{value:o,size:s=If,level:i=Mf,bgColor:c=Lf,fgColor:a=Bf,includeMargin:u=kf,minVersion:l=Rf,boostLevel:f,marginSize:p,imageSettings:d}=r,m=da(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=m,C=da(m,["style"]),b=d==null?void 0:d.src,$=S.useRef(null),B=S.useRef(null),k=S.useCallback(E=>{$.current=E,typeof n=="function"?n(E):n&&(n.current=E)},[n]),[D,j]=S.useState(!1),{margin:g,cells:w,numCells:A,calculatedImageSettings:I}=jf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:d,size:s});S.useEffect(()=>{if($.current!=null){const E=$.current,x=E.getContext("2d");if(!x)return;let T=w;const O=B.current,y=I!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;y&&I.excavation!=null&&(T=Df(w,I.excavation));const L=window.devicePixelRatio||1;E.height=E.width=s*L;const F=s/A*L;x.scale(F,F),x.fillStyle=c,x.fillRect(0,0,A,A),x.fillStyle=a,R1?x.fill(new Path2D(Ff(T,g))):w.forEach(function(U,z){U.forEach(function(V,Z){V&&x.fillRect(Z+g,z+g,1,1)})}),I&&(x.globalAlpha=I.opacity),y&&x.drawImage(O,I.x+g,I.y+g,I.w,I.h)}}),S.useEffect(()=>{j(!1)},[b]);const N=fa({height:s,width:s},v);let P=null;return b!=null&&(P=S.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{j(!0)},ref:B,crossOrigin:I==null?void 0:I.crossOrigin})),S.createElement(S.Fragment,null,S.createElement("canvas",fa({style:N,height:s,width:s,ref:k,role:"img"},C)),P)});F1.displayName="QRCodeCanvas";var _f=S.forwardRef(function(t,n){const r=t,{value:o,size:s=If,level:i=Mf,bgColor:c=Lf,fgColor:a=Bf,includeMargin:u=kf,minVersion:l=Rf,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=da(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:C,numCells:b,calculatedImageSettings:$}=jf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:h,size:s});let B=C,k=null;h!=null&&$!=null&&($.excavation!=null&&(B=Df(C,$.excavation)),k=S.createElement("image",{href:h.src,height:$.h,width:$.w,x:$.x+v,y:$.y+v,preserveAspectRatio:"none",opacity:$.opacity,crossOrigin:$.crossOrigin}));const D=Ff(B,v);return S.createElement("svg",fa({height:s,width:s,viewBox:`0 0 ${b} ${b}`,ref:n,role:"img"},m),!!p&&S.createElement("title",null,p),S.createElement("path",{fill:c,d:`M0,0 h${b}v${b}H0z`,shapeRendering:"crispEdges"}),S.createElement("path",{fill:a,d:D,shapeRendering:"crispEdges"}),k)});_f.displayName="QRCodeSVG";function D1(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function j1(){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 Uf(){return/apple/i.test(navigator.vendor)}function _1(){return D1().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function U1(){return j1().includes("jsdom/")}const zf="data-floating-ui-focusable",z1="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function pa(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 Jn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Li(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function er(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ha(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 W1(e){return e.matches("html,body")}function It(e){return(e==null?void 0:e.ownerDocument)||document}function Wf(e){return ke(e)&&e.matches(z1)}function H1(e){if(!e||U1())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function V1(e){return e?e.hasAttribute(zf)?e:e.querySelector("["+zf+"]")||e:null}function ps(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...ps(e,o.id,n)])}function G1(e){return"nativeEvent"in e}function _r(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var q1=typeof document<"u",Z1=function(){},Mt=q1?S.useLayoutEffect:Z1;const K1={..._};function hs(e){const t=_.useRef(e);return Mt(()=>{t.current=e}),t}const Y1=K1.useInsertionEffect||(e=>e());function Lt(e){const t=_.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Y1(()=>{t.current=e}),_.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 Hf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Vf(e,t){const n=Tl(e,Hf()),r=n.length;if(r===0)return;const o=pa(It(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function X1(e){return Vf(It(e).body,1)||e}function Q1(e){return Vf(It(e).body,-1)||e}function ma(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Jn(n,r)}function J1(e){Tl(e,Hf()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Gf(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 ew="data-floating-ui-focusable",qf="active",Zf="selected",tw={..._};let Kf=!1,nw=0;const Yf=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+nw++;function rw(){const[e,t]=_.useState(()=>Kf?Yf():void 0);return Mt(()=>{e==null&&t(Yf())},[]),_.useEffect(()=>{Kf=!0},[]),e}const ga=tw.useId||rw;let ba;process.env.NODE_ENV!=="production"&&(ba=new Set);function ow(){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=ba)!=null&&e.has(o))){var s;(s=ba)==null||s.add(o),console.error(o)}}function sw(){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 iw=_.createContext(null),aw=_.createContext(null),ya=()=>{var e;return((e=_.useContext(iw))==null?void 0:e.id)||null},va=()=>_.useContext(aw);function Ur(e){return"data-floating-ui-"+e}function at(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Xf=Ur("safe-polygon");function wa(e,t,n){if(n&&!_r(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function xa(e){return typeof e=="function"?e():e}function cw(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:u=null,mouseOnly:l=!1,restMs:f=0,move:p=!0}=t,d=va(),h=ya(),m=hs(u),v=hs(a),C=hs(n),b=hs(f),$=_.useRef(),B=_.useRef(-1),k=_.useRef(),D=_.useRef(-1),j=_.useRef(!0),g=_.useRef(!1),w=_.useRef(()=>{}),A=_.useRef(!1),I=Lt(()=>{var O;const y=(O=o.current.openEvent)==null?void 0:O.type;return(y==null?void 0:y.includes("mouse"))&&y!=="mousedown"});_.useEffect(()=>{if(!c)return;function O(y){let{open:L}=y;L||(at(B),at(D),j.current=!0,A.current=!1)}return s.on("openchange",O),()=>{s.off("openchange",O)}},[c,s]),_.useEffect(()=>{if(!c||!m.current||!n)return;function O(L){I()&&r(!1,L,"hover")}const y=It(i.floating).documentElement;return y.addEventListener("mouseleave",O),()=>{y.removeEventListener("mouseleave",O)}},[i.floating,n,r,c,m,I]);const N=_.useCallback(function(O,y,L){y===void 0&&(y=!0),L===void 0&&(L="hover");const F=wa(v.current,"close",$.current);F&&!k.current?(at(B),B.current=window.setTimeout(()=>r(!1,O,L),F)):y&&(at(B),r(!1,O,L))},[v,r]),P=Lt(()=>{w.current(),k.current=void 0}),E=Lt(()=>{if(g.current){const O=It(i.floating).body;O.style.pointerEvents="",O.removeAttribute(Xf),g.current=!1}}),x=Lt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);_.useEffect(()=>{if(!c)return;function O(z){if(at(B),j.current=!1,l&&!_r($.current)||xa(b.current)>0&&!wa(v.current,"open"))return;const V=wa(v.current,"open",$.current);V?B.current=window.setTimeout(()=>{C.current||r(!0,z,"hover")},V):n||r(!0,z,"hover")}function y(z){if(x()){E();return}w.current();const V=It(i.floating);if(at(D),A.current=!1,m.current&&o.current.floatingContext){n||at(B),k.current=m.current({...o.current.floatingContext,tree:d,x:z.clientX,y:z.clientY,onClose(){E(),P(),x()||N(z,!0,"safe-polygon")}});const W=k.current;V.addEventListener("mousemove",W),w.current=()=>{V.removeEventListener("mousemove",W)};return}($.current==="touch"?!Jn(i.floating,z.relatedTarget):!0)&&N(z)}function L(z){x()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:z.clientX,y:z.clientY,onClose(){E(),P(),x()||N(z)}})(z))}function F(){at(B)}function U(z){x()||N(z,!1)}if(de(i.domReference)){const z=i.domReference,V=i.floating;return n&&z.addEventListener("mouseleave",L),p&&z.addEventListener("mousemove",O,{once:!0}),z.addEventListener("mouseenter",O),z.addEventListener("mouseleave",y),V&&(V.addEventListener("mouseleave",L),V.addEventListener("mouseenter",F),V.addEventListener("mouseleave",U)),()=>{n&&z.removeEventListener("mouseleave",L),p&&z.removeEventListener("mousemove",O),z.removeEventListener("mouseenter",O),z.removeEventListener("mouseleave",y),V&&(V.removeEventListener("mouseleave",L),V.removeEventListener("mouseenter",F),V.removeEventListener("mouseleave",U))}}},[i,c,e,l,p,N,P,E,r,n,C,d,v,m,o,x,b]),Mt(()=>{var O;if(c&&n&&(O=m.current)!=null&&(O=O.__options)!=null&&O.blockPointerEvents&&I()){g.current=!0;const L=i.floating;if(de(i.domReference)&&L){var y;const F=It(i.floating).body;F.setAttribute(Xf,"");const U=i.domReference,z=d==null||(y=d.nodesRef.current.find(V=>V.id===h))==null||(y=y.context)==null?void 0:y.elements.floating;return z&&(z.style.pointerEvents=""),F.style.pointerEvents="none",U.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{F.style.pointerEvents="",U.style.pointerEvents="",L.style.pointerEvents=""}}}},[c,n,h,i,d,m,I]),Mt(()=>{n||($.current=void 0,A.current=!1,P(),E())},[n,P,E]),_.useEffect(()=>()=>{P(),at(B),at(D),E()},[c,i.domReference,P,E]);const T=_.useMemo(()=>{function O(y){$.current=y.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(y){const{nativeEvent:L}=y;function F(){!j.current&&!C.current&&r(!0,L,"hover")}l&&!_r($.current)||n||xa(b.current)===0||A.current&&y.movementX**2+y.movementY**2<2||(at(D),$.current==="touch"?F():(A.current=!0,D.current=window.setTimeout(F,xa(b.current))))}}},[l,r,n,C,b]);return _.useMemo(()=>c?{reference:T}:{},[c,T])}const Qf={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},Jf=_.forwardRef(function(t,n){const[r,o]=_.useState();Mt(()=>{Uf()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ur("focus-guard")]:"",style:Qf};return M.jsx("span",{...t,...s})}),ed=_.createContext(null),td=Ur("portal");function uw(e){e===void 0&&(e={});const{id:t,root:n}=e,r=ga(),o=fw(),[s,i]=_.useState(null),c=_.useRef(null);return Mt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Mt(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const u=document.createElement("div");u.id=r,u.setAttribute(td,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Mt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Mi(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const l=document.createElement("div");l.id=r,l.setAttribute(td,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function lw(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=uw({id:n,root:r}),[i,c]=_.useState(null),a=_.useRef(null),u=_.useRef(null),l=_.useRef(null),f=_.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 _.useEffect(()=>{if(!s||!o||p)return;function m(v){s&&ma(v)&&(v.type==="focusin"?Gf:J1)(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]),_.useEffect(()=>{s&&(d||Gf(s))},[d,s]),M.jsxs(ed.Provider,{value:_.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&M.jsx(Jf,{"data-type":"outside",ref:a,onFocus:m=>{if(ma(m,s)){var v;(v=l.current)==null||v.focus()}else{const C=i?i.domReference:null,b=Q1(C);b==null||b.focus()}}}),h&&s&&M.jsx("span",{"aria-owns":s.id,style:Qf}),s&&Ar.createPortal(t,s),h&&s&&M.jsx(Jf,{"data-type":"outside",ref:u,onFocus:m=>{if(ma(m,s)){var v;(v=f.current)==null||v.focus()}else{const C=i?i.domReference:null,b=X1(C);b==null||b.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const fw=()=>_.useContext(ed);function nd(e){return ke(e.target)&&e.target.tagName==="BUTTON"}function dw(e){return ke(e.target)&&e.target.tagName==="A"}function rd(e){return Wf(e)}function pw(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:u=!1,keyboardHandlers:l=!0,stickIfOpen:f=!0}=t,p=_.useRef(),d=_.useRef(!1),h=_.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const v=p.current;m.button===0&&c!=="click"&&(_r(v,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const v=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}_r(v,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!l||nd(m))&&(m.key===" "&&!rd(s)&&(m.preventDefault(),d.current=!0),!dw(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||nd(m)||rd(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return _.useMemo(()=>i?{reference:h}:{},[i,h])}const hw={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},mw={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},od=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 gw(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:l=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,m=va(),v=Lt(typeof a=="function"?a:()=>!1),C=typeof a=="function"?v:a,b=_.useRef(!1),{escapeKey:$,outsidePress:B}=od(d),{escapeKey:k,outsidePress:D}=od(h),j=_.useRef(!1),g=Lt(E=>{var x;if(!n||!i||!c||E.key!=="Escape"||j.current)return;const T=(x=s.current.floatingContext)==null?void 0:x.nodeId,O=m?ps(m.nodesRef.current,T):[];if(!$&&(E.stopPropagation(),O.length>0)){let y=!0;if(O.forEach(L=>{var F;if((F=L.context)!=null&&F.open&&!L.context.dataRef.current.__escapeKeyBubbles){y=!1;return}}),!y)return}r(!1,G1(E)?E.nativeEvent:E,"escape-key")}),w=Lt(E=>{var x;const T=()=>{var O;g(E),(O=er(E))==null||O.removeEventListener("keydown",T)};(x=er(E))==null||x.addEventListener("keydown",T)}),A=Lt(E=>{var x;const T=s.current.insideReactTree;s.current.insideReactTree=!1;const O=b.current;if(b.current=!1,u==="click"&&O||T||typeof C=="function"&&!C(E))return;const y=er(E),L="["+Ur("inert")+"]",F=It(o.floating).querySelectorAll(L);let U=de(y)?y:null;for(;U&&!Wt(U);){const W=Ht(U);if(Wt(W)||!de(W))break;U=W}if(F.length&&de(y)&&!W1(y)&&!Jn(y,o.floating)&&Array.from(F).every(W=>!Jn(U,W)))return;if(ke(y)&&P){const W=Wt(y),K=it(y),G=/auto|scroll/,X=W||G.test(K.overflowX),ee=W||G.test(K.overflowY),fe=X&&y.clientWidth>0&&y.scrollWidth>y.clientWidth,xe=ee&&y.clientHeight>0&&y.scrollHeight>y.clientHeight,oe=K.direction==="rtl",ue=xe&&(oe?E.offsetX<=y.offsetWidth-y.clientWidth:E.offsetX>y.clientWidth),pe=fe&&E.offsetY>y.clientHeight;if(ue||pe)return}const z=(x=s.current.floatingContext)==null?void 0:x.nodeId,V=m&&ps(m.nodesRef.current,z).some(W=>{var K;return ha(E,(K=W.context)==null?void 0:K.elements.floating)});if(ha(E,o.floating)||ha(E,o.domReference)||V)return;const Z=m?ps(m.nodesRef.current,z):[];if(Z.length>0){let W=!0;if(Z.forEach(K=>{var G;if((G=K.context)!=null&&G.open&&!K.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}r(!1,E,"outside-press")}),I=Lt(E=>{var x;const T=()=>{var O;A(E),(O=er(E))==null||O.removeEventListener(u,T)};(x=er(E))==null||x.addEventListener(u,T)});_.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=$,s.current.__outsidePressBubbles=B;let E=-1;function x(F){r(!1,F,"ancestor-scroll")}function T(){window.clearTimeout(E),j.current=!0}function O(){E=window.setTimeout(()=>{j.current=!1},Vo()?5:0)}const y=It(o.floating);c&&(y.addEventListener("keydown",k?w:g,k),y.addEventListener("compositionstart",T),y.addEventListener("compositionend",O)),C&&y.addEventListener(u,D?I:A,D);let L=[];return p&&(de(o.domReference)&&(L=pn(o.domReference)),de(o.floating)&&(L=L.concat(pn(o.floating))),!de(o.reference)&&o.reference&&o.reference.contextElement&&(L=L.concat(pn(o.reference.contextElement)))),L=L.filter(F=>{var U;return F!==((U=y.defaultView)==null?void 0:U.visualViewport)}),L.forEach(F=>{F.addEventListener("scroll",x,{passive:!0})}),()=>{c&&(y.removeEventListener("keydown",k?w:g,k),y.removeEventListener("compositionstart",T),y.removeEventListener("compositionend",O)),C&&y.removeEventListener(u,D?I:A,D),L.forEach(F=>{F.removeEventListener("scroll",x)}),window.clearTimeout(E)}},[s,o,c,C,u,n,r,p,i,$,B,g,k,w,A,D,I]),_.useEffect(()=>{s.current.insideReactTree=!1},[s,C,u]);const N=_.useMemo(()=>({onKeyDown:g,...l&&{[hw[f]]:E=>{r(!1,E.nativeEvent,"reference-press")},...f!=="click"&&{onClick(E){r(!1,E.nativeEvent,"reference-press")}}}}),[g,r,l,f]),P=_.useMemo(()=>({onKeyDown:g,onMouseDown(){b.current=!0},onMouseUp(){b.current=!0},[mw[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return _.useMemo(()=>i?{reference:N,floating:P}:{},[i,N,P])}function bw(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=ga(),s=_.useRef({}),[i]=_.useState(()=>sw()),c=ya()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!de(d)&&ow("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=_.useState(r.reference),l=Lt((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=_.useMemo(()=>({setPositionReference:u}),[]),p=_.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return _.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function yw(e){e===void 0&&(e={});const{nodeId:t}=e,n=bw({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=_.useState(null),[c,a]=_.useState(null),l=(o==null?void 0:o.domReference)||s,f=_.useRef(null),p=va();Mt(()=>{l&&(f.current=l)},[l]);const d=zl({...e,elements:{...o,...c&&{reference:c}}}),h=_.useCallback($=>{const B=de($)?{getBoundingClientRect:()=>$.getBoundingClientRect(),getClientRects:()=>$.getClientRects(),contextElement:$}:$;a(B),d.refs.setReference(B)},[d.refs]),m=_.useCallback($=>{(de($)||$===null)&&(f.current=$,i($)),(de(d.refs.reference.current)||d.refs.reference.current===null||$!==null&&!de($))&&d.refs.setReference($)},[d.refs]),v=_.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),C=_.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),b=_.useMemo(()=>({...d,...r,refs:v,elements:C,nodeId:t}),[d,v,C,t,r]);return Mt(()=>{r.dataRef.current.floatingContext=b;const $=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);$&&($.context=b)}),_.useMemo(()=>({...d,context:b,refs:v,elements:C}),[d,v,C,b])}function Ea(){return _1()&&Uf()}function vw(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,u=_.useRef(!1),l=_.useRef(-1),f=_.useRef(!0);_.useEffect(()=>{if(!c)return;const d=Ue(i.domReference);function h(){!n&&ke(i.domReference)&&i.domReference===pa(It(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function v(){f.current=!1}return d.addEventListener("blur",h),Ea()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",v,!0)),()=>{d.removeEventListener("blur",h),Ea()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",v,!0))}},[i.domReference,n,c]),_.useEffect(()=>{if(!c)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(u.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,c]),_.useEffect(()=>()=>{at(l)},[]);const p=_.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(d){if(u.current)return;const h=er(d.nativeEvent);if(a&&de(h)){if(Ea()&&!d.relatedTarget){if(!f.current&&!Wf(h))return}else if(!H1(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){u.current=!1;const h=d.relatedTarget,m=d.nativeEvent,v=de(h)&&h.hasAttribute(Ur("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var C;const b=pa(i.domReference?i.domReference.ownerDocument:document);!h&&b===i.domReference||Jn((C=s.current.floatingContext)==null?void 0:C.refs.floating.current,b)||Jn(i.domReference,b)||v||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return _.useMemo(()=>c?{reference:p}:{},[c,p])}function Sa(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[qf]:i,[Zf]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[ew]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[qf,Zf].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(u))==null?void 0:p.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function ww(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=_.useCallback(c=>Sa(c,e,"reference"),t),s=_.useCallback(c=>Sa(c,e,"floating"),n),i=_.useCallback(c=>Sa(c,e,"item"),r);return _.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const xw=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Ew(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,u=ga(),l=((n=s.domReference)==null?void 0:n.id)||u,f=_.useMemo(()=>{var b;return((b=V1(s.floating))==null?void 0:b.id)||i},[s.floating,i]),p=(r=xw.get(a))!=null?r:a,h=ya()!=null,m=_.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:l},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,l,a]),v=_.useMemo(()=>{const b={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?b:{...b,...p==="menu"&&{"aria-labelledby":l}}},[p,f,l,a]),C=_.useCallback(b=>{let{active:$,selected:B}=b;const k={role:"option",...$&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...k,"aria-selected":B}}return{}},[f,a]);return _.useMemo(()=>c?{reference:m,floating:v,item:C}:{},[c,m,v,C])}const sd=S.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return M.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});sd.displayName="TooltipArrow";const zr=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[u,l]=S.useState(!1),f=S.useRef(null),{refs:p,floatingStyles:d,context:h}=yw({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:Dl,middleware:[Vi(o?12:8),Hl({fallbackAxisSideDirection:"start",padding:8}),Wl({padding:8}),...o?[Dy({element:f})]:[]]}),m=cw(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),v=vw(h,{enabled:a.includes("focus")}),C=pw(h,{enabled:a.includes("click")}),b=gw(h),$=Ew(h,{role:"tooltip"}),{getReferenceProps:B,getFloatingProps:k}=ww([m,v,C,b,$]);return i?M.jsx(M.Fragment,{children:e}):M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:p.setReference,...B(),children:e}),u&&M.jsx(lw,{children:M.jsxs("div",{ref:p.setFloating,...k(),style:d,className:`
112
112
  z-50 px-3 py-2
113
113
  bg-fill-page-secondary
114
114
  text-text-primary text-sm font-medium
115
115
  rounded-lg shadow-lg
116
116
  relative
117
- ${u}
118
- ${i}
119
- `,children:[t,o&&S.jsx($l,{ref:d,placement:g.placement||n})]})})]})},Yn="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=",Mm=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var u;const{t:i}=Ye(),l=m.useMemo(()=>vp(n||{}),[n]);return S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"flex justify-center mt-4 mb-3",children:(e==null?void 0:e.getDisplayAddress())&&S.jsx("div",{className:"bg-white rounded-lg",children:S.jsx(dl,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),(e==null?void 0:e.getDisplayAddress())&&S.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[S.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),S.jsx(kp,{onCopy:()=>{const s=(e==null?void 0:e.getDisplayAddress())||"";o&&o(s)},text:e==null?void 0:e.getDisplayAddress(),children:S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[S.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),S.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")]}),S.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[S.jsxs("div",{className:"flex items-start",children:[S.jsx("div",{className:"w-5",children:S.jsx("img",{src:Yn,className:"w-4 h-4",alt:"Warning"})}),S.jsx("div",{className:"flex-1",children:S.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:n==null?void 0:n.chain})})})]}),l&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),S.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),S.jsxs("div",{className:"text-sm",children:[S.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[S.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),S.jsx(sn,{content:S.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[S.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60,v1:n==null?void 0:n.txConfirm})}),S.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:S.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:i("deposit.arrivalEstimated",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60})})})]}),S.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[S.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),S.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((u=r==null?void 0:r.multiChain)==null?void 0:u.minDeposit)||10," ",t]})]}),S.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[S.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),S.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]})]})},Im=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:i,onCopy:l,onClose:u})=>{var v;const{t:s}=Ye(),[a,c]=m.useState(()=>{var E;return!e||e.length===0?1:t||((E=e[0])==null?void 0:E.chainId)||1}),[d,p]=m.useState(()=>{var N;if(!e||e.length===0)return"";const E=t||((N=e[0])==null?void 0:N.chainId),M=e.find(F=>F.chainId===E);if(!M||!M.tokenList||M.tokenList.length===0)return"";const w=M.tokenList.find(F=>F.tokenAddress===n)||M.tokenList[0];return(w==null?void 0:w.token)||""}),f=e&&e.length>0?e.find(E=>E.chainId===a)||e[0]:null,g=(v=f==null?void 0:f.tokenList)==null?void 0:v.find(E=>E.token===d);return!e||e.length===0?S.jsx("div",{className:"text-center py-8",children:S.jsx("p",{className:"text-gray-400",children:"No chains available"})}):f?S.jsxs(S.Fragment,{children:[S.jsx(no,{currentActiveChain:f,chainList:e,onChainChange:c,curSelectToken:d,onTokenChange:p,walletType:"mpc"}),S.jsx(Mm,{walletAdapter:r,curSelectToken:d,currentActiveChain:f,metadata:o,onCopy:l}),S.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:a,tokenAddress:(g==null?void 0:g.tokenAddress)||"",tokenSymbol:d}),u()},children:s("deposit.title")})]}):S.jsx("div",{className:"text-center py-8",children:S.jsx("p",{className:"text-gray-400",children:"Loading..."})})},jm=Object.values({MAINNET:1,SEPOLIA:11155111}),pt=e=>{const t=typeof e=="string"?parseInt(e,10):e;return jm.includes(t)},Fm={USDT:!0},Oo=(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:!Fm[t.toUpperCase()]:!0},ln=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const i=t?`loading-${t}`:"",l=o?"loading-inline":"";return S.jsx("span",{className:`loading loading-${e} loading-spinner ${i} ${l} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},Rm=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:i,amount:l,decimals:u,tokenBalance:s,platformBalance:a="0",onDepositAmountChange:c,onApproved:d})=>{const{t:p}=Ye(),[f,g]=m.useState(!1);m.useEffect(()=>{r&&f&&g(!1)},[r,f]);const v=m.useCallback(async()=>{if(!f)try{g(!0),await d()}catch(j){g(!1),console.error("Approve failed:",j)}},[d,f]),E=m.useCallback(()=>{let j=s||"0";if(Oo(o==null?void 0:o.chainId,t))try{const k=new xe(j),B=new xe("200000");k.gt(B)&&(j="200000")}catch(k){console.warn("Error calculating max amount limit:",k)}return j},[s,o==null?void 0:o.chainId,t]),M=m.useMemo(()=>{if(!Oo(o==null?void 0:o.chainId,t))return!1;try{const j=new xe(e||"0"),k=new xe("200000");return j.isNaN()||k.isNaN()?!1:j.gte(k)}catch{return!1}},[o,e,t]);m.useMemo(()=>{if(!Oo(o==null?void 0:o.chainId,t))return!1;try{const j=new xe(s||"0"),k=new xe("200000");return j.gt(k)}catch{return!1}},[o==null?void 0:o.chainId,s,t]);const w=m.useMemo(()=>Ys(o==null?void 0:o.chainId,t,e),[o==null?void 0:o.chainId,t,e]),N=j=>{const k=j.target.value,B=E(),h=ro(k,B);if(h.isValid)c(h.formattedValue),h.errorType;else return h.errorType==="exceed_balance",void 0},F=()=>{const j=parseFloat(s||"0"),k=parseFloat(e||"0");if(k>0){const B=j-k,h=Xe(Math.max(0,B).toString());return S.jsxs("span",{className:"flex items-center gap-1",children:[Xe(s||"0"),S.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),h," ",t]})}return`${Xe(s||"0")} ${t}`};return S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[S.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[S.jsx("input",{type:"text",placeholder:p("deposit.amount"),value:e,onChange:N,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),S.jsx("button",{onClick:()=>{const j=E();c(j)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:p("deposit.max")})]}),S.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),S.jsxs("div",{className:"flex justify-between items-center",children:[S.jsx(sn,{content:p("deposit.availableDesc"),children:S.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:p("deposit.available")})}),S.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:F()})]})]}),!r&&mp(e||"0",0)&&S.jsxs("div",{className:"flex justify-center flex-col items-center",children:[S.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:p("deposit.enableSystemProWithToken",{token:t,network:o==null?void 0:o.chain})}),S.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:p("deposit.enableTokenDesc",{token:t,network:o==null?void 0:o.chain})}),S.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:v,disabled:f,children:f?S.jsx(ln,{size:"xs",inline:!0}):p("deposit.enableWithToken",{token:t})})]}),w&&S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"flex mb-4",children:[S.jsx("div",{className:"w-5",children:S.jsx("img",{src:Yn,className:"w-4 h-4",alt:"Warning"})}),S.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:p("deposit.layerZeroDepositTip")})]}),S.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),M&&S.jsxs("div",{className:"flex mb-4",children:[S.jsx("div",{className:"w-5",children:S.jsx("img",{src:Yn,className:"w-4 h-4",alt:"Warning"})}),S.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:p("deposit.depositTipFor25w")})]}),M&&S.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),S.jsxs("div",{className:"flex mb-4",children:[S.jsx("div",{className:"w-5",children:!(M||w)&&S.jsx("img",{src:Yn,className:"w-4 h-4",alt:"Warning"})}),S.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:p("deposit.noPrivateKeyWalletWarning")})]}),S.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:S.jsxs("div",{className:"flex justify-between items-center",children:[S.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:p("deposit.equity")}),S.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?S.jsxs("span",{className:"flex items-center gap-1",children:[Xe(a),S.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Xe((parseFloat(a)+parseFloat(e)).toString())," ",t]}):`${Xe(a)} ${t}`})]})})]})},km=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:i})=>{var s,a;const l=(s=o==null?void 0:o.useBalance)==null?void 0:s.call(o,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(o!=null&&o.useBalance)}}),u=(a=o==null?void 0:o.useReadContract)==null?void 0:a.call(o,{address:e.tokenAddress,abi:[{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"allowance",args:[t,r],chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!r&&!!(o!=null&&o.useReadContract)}});return m.useEffect(()=>{i(e.tokenAddress,{balance:l,allowance:u})},[l,u,e.tokenAddress,i]),null},Al=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var g;const i=m.useMemo(()=>r.filter(v=>v.tokenAddress&&v.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[l,u]=m.useState({}),s=m.useCallback((v,E)=>{u(M=>({...M,[v]:E}))},[]),a=(g=o==null?void 0:o.useBalance)==null?void 0:g.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),c=m.useMemo(()=>i.map(v=>m.createElement(km,{key:v.tokenAddress,token:v,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:s})),[i,e,t,n,o,s]),d=m.useMemo(()=>{if(!(o!=null&&o.useBalance))return{balanceList:[],allowanceList:[],baseTokenBalance:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},combinedData:{}};const v=a!=null&&a.data?{value:a.data.value,formatted:a.data.formatted,decimals:a.data.decimals,symbol:a.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},E=i.map(N=>{const F=l[N.tokenAddress],j=F==null?void 0:F.balance,k=j==null?void 0:j.data;return{address:N.tokenAddress,value:(k==null?void 0:k.value)||BigInt(0),formatted:(k==null?void 0:k.formatted)||"0",decimals:(k==null?void 0:k.decimals)||N.decimals}}).filter(N=>N.address),M=i.map(N=>{const F=l[N.tokenAddress],j=F==null?void 0:F.allowance,k=j==null?void 0:j.data,B=BigInt(k?k.toString():0);return{address:N.tokenAddress,value:B,formatted:(B/BigInt(10)**BigInt(N.decimals)).toString(),decimals:N.decimals}}).filter(N=>N.address),w=E.reduce((N,F)=>{const j=M.find(k=>k.address===F.address);return{...N,[F.address]:{balance:F,allowance:j||{address:F.address,value:BigInt(0),formatted:"0",decimals:F.decimals}}}},{});return{balanceList:E,allowanceList:M,baseTokenBalance:v,combinedData:w}},[a,l,i,o==null?void 0:o.useBalance]),p=m.useCallback(async()=>d,[d]),f=m.useMemo(()=>{const v=(a==null?void 0:a.isLoading)||!1,E=Object.values(l).some(M=>{var w,N;return((w=M.balance)==null?void 0:w.isLoading)||((N=M.allowance)==null?void 0:N.isLoading)});return v||E},[a==null?void 0:a.isLoading,l]);return{multicallRun:p,multicallResult:d,validErcTokens:i,isLoading:f,queryComponents:c}};let Pe=null;const _m={symbol:"USDT"},Ml=m.forwardRef((e,t)=>{const[n,r]=m.useState(!1),[o,i]=m.useState(!1),[l,u]=m.useState({chains:[]}),s=m.useCallback(g=>{u(g),r(!0)},[]),a=m.useCallback(g=>{u(v=>({...v,...g}))},[]),c=m.useCallback(()=>{r(!1),i(!1),l.onClose&&l.onClose()},[l.onClose]),d=m.useCallback(g=>{i(g)},[]),p=m.useCallback(()=>n,[n]),f=m.useCallback(()=>o,[o]);return m.useImperativeHandle(t,()=>({openDeposit:s,closeDeposit:c,updateDepositOptions:a,setDepositLoading:d,isOpen:p,isLoading:f}),[s,c,a,d,p,f]),m.useEffect(()=>(Pe={openDeposit:s,closeDeposit:c,updateDepositOptions:a,setDepositLoading:d,isOpen:p,isLoading:f},()=>{Pe=null}),[s,c,a,d,p,f]),S.jsx(kl,{isOpen:n,isLoading:o,onClose:c,config:l.config||_m,currentActiveAccount:l.currentActiveAccount||oo,smartWallet:l.smartWallet||io,chains:l.chains||bp,defaultChainId:l.defaultChainId,defaultTokenAddress:l.defaultTokenAddress,defaultAmount:l.defaultAmount,metadata:l.metadata||so,currentEquity:l.currentEquity??5e3,platformBalance:l.platformBalance||"0",wagmiHooks:l.wagmiHooks,approved:l.approved,onApproved:l.onApproved,onDeposit:l.onDeposit,onCopy:l.onCopy,onChainChange:l.onChainChange,onTokenChange:l.onTokenChange})});Ml.displayName="DepositManager";const Il=e=>{if(!Pe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Pe.openDeposit(e||{chains:[]})},jl=()=>{if(!Pe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Pe.closeDeposit()},Fl=e=>{Pe&&Pe.updateDepositOptions(e)},Kn=e=>{if(!Pe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Pe.setDepositLoading(e)},Bm=()=>Pe?Pe.isOpen():!1,Rl=()=>Pe?Pe.isLoading():!1,Wm=()=>({openDeposit:Il,closeDeposit:jl,updateDepositOptions:Fl,setDepositLoading:Kn,isOpen:Bm,isLoading:Rl}),Um=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:i,currentEquity:l,platformBalance:u="0",isLoading:s=!1,wagmiHooks:a,approved:c,onApproved:d,onDeposit:p,onClose:f,onChainChange:g,onTokenChange:v})=>{var G;const{t:E}=Ye(),M=a==null?void 0:a.useAccount(),[w,N]=m.useState(()=>{var H;return!e||e.length===0?1:t||((H=e[0])==null?void 0:H.chainId)||1}),[F,j]=m.useState(()=>{var se;if(!e||e.length===0)return"";const H=t||((se=e[0])==null?void 0:se.chainId),z=e.find(he=>he.chainId===H);if(!z||!z.tokenList||z.tokenList.length===0)return"";const J=z.tokenList.find(he=>he.tokenAddress===n)||z.tokenList[0];return(J==null?void 0:J.token)||""}),[k,B]=m.useState(r),h=m.useCallback(H=>{N(H),g==null||g(H)},[g]),b=m.useCallback(H=>{j(H),v==null||v(H)},[v]),y=m.useRef(!0),$=m.useRef(F),D=m.useRef(w);m.useEffect(()=>{if(y.current){y.current=!1,$.current=F,D.current=w;return}($.current!==F||D.current!==w)&&(B(""),$.current=F,D.current=w)},[F,w]);const L=e&&e.length>0?e.find(H=>H.chainId===w)||e[0]:null,C=(G=L==null?void 0:L.tokenList)==null?void 0:G.find(H=>H.token===F),O=o==null?void 0:o.getDisplayAddress(),{multicallResult:T,queryComponents:P}=Al({account:O,chainId:w,contractAddress:void 0,tokens:(L==null?void 0:L.tokenList)||[],wagmiHooks:a}),x=m.useMemo(()=>{var z;if(!C)return;if(!C.tokenAddress||C.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return T.baseTokenBalance.formatted;const H=T.combinedData[C.tokenAddress];return((z=H==null?void 0:H.balance)==null?void 0:z.formatted)||"0"},[C,T]),I=c??!1,_=m.useMemo(()=>+M.chainId!=+w,[M.chainId,w]),V=m.useMemo(()=>Ys(w,F,k),[w,F,k]),W=m.useMemo(()=>{if(_)return{text:E("deposit.switchNetwork"),disabled:!1,isNetworkSwitch:!0};const H=parseFloat(k||"0"),z=10,se=hp(k,x||"0",I);return!k||H===0||!I?{text:E(V?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:H<z?{text:E("deposit.minDepositParsed",{amount:z,token:F}),disabled:!0,isNetworkSwitch:!1}:{text:E(V?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!se,isNetworkSwitch:!1}},[k,F,x,I,_,V,E]),Y=m.useCallback(async()=>{h&&h(w)},[h,w]),q=m.useCallback(async()=>{Kn(!0);try{p&&p({amount:k,chainId:w,tokenAddress:(C==null?void 0:C.tokenAddress)||"",tokenSymbol:F})}catch(H){console.error("Deposit error:",H),Kn(!1)}},[p,k,w,C==null?void 0:C.tokenAddress,F]);return!(a!=null&&a.useBalance)||!(a!=null&&a.useReadContract)||!(a!=null&&a.useAccount)?S.jsxs("div",{className:"p-6 text-center",children:[S.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),S.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?S.jsx("div",{className:"text-center py-8",children:S.jsx("p",{className:"text-gray-400",children:"No chains available"})}):L?S.jsxs(S.Fragment,{children:[P,S.jsx(no,{currentActiveChain:L,chainList:e,onChainChange:h,curSelectToken:F,onTokenChange:b,walletType:"evm"}),S.jsx(Rm,{depositAmount:k,curSelectToken:F,curSelectTokenData:{balance:C==null?void 0:C.balance,allowance:C==null?void 0:C.allowance},approved:I,currentActiveChain:L,currentEquity:l||0,amount:k,decimals:(C==null?void 0:C.decimals)||6,tokenBalance:x,platformBalance:u,onDepositAmountChange:B,onApproved:async()=>{d&&await d()}}),S.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${W.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:W.isNetworkSwitch?Y:q,disabled:W.disabled||s,children:[s&&S.jsx(ln,{size:"xs"}),W.text]})]}):S.jsx("div",{className:"text-center py-8",children:S.jsx("p",{className:"text-gray-400",children:"Loading..."})})},kl=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oo,smartWallet:i=io,chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a="",metadata:c=so,currentEquity:d=5e3,platformBalance:p="0",wagmiHooks:f,approved:g,onApproved:v,onDeposit:E,onCopy:M,onChainChange:w,onTokenChange:N})=>{const{t:F}=Ye(),j=m.useMemo(()=>{var B;return o?Vo(o,i,!1,(B=l[0])==null?void 0:B.chainId,"0","0"):null},[o,i,l]),k=(j==null?void 0:j.getWalletType())==="mpc";return e?Se.createPortal(S.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:S.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{n()},"aria-hidden":"true",children:S.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:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsx("h2",{className:"text-lg font-semibold text-white",children:F("deposit.title")}),S.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:S.jsx(Wo,{className:"h-4 w-4"})})]}),k?S.jsx(Im,{chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a,walletAdapter:j,metadata:c,currentEquity:d,onDeposit:E,onCopy:M,onClose:n}):S.jsx(Um,{chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a,walletAdapter:j,metadata:c,currentEquity:d,platformBalance:p,isLoading:t,wagmiHooks:f,approved:g,onApproved:v,onDeposit:E,onClose:n,onChainChange:w,onTokenChange:N})]})})}),document.body):null};m.createContext(null);const Vm=()=>S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[S.jsx("g",{clipPath:"url(#clip0_active)",children:S.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"})}),S.jsx("defs",{children:S.jsx("clipPath",{id:"clip0_active",children:S.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),zm=()=>S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[S.jsx("g",{clipPath:"url(#clip0_inactive)",children:S.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"})}),S.jsx("defs",{children:S.jsx("clipPath",{id:"clip0_inactive",children:S.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),qn=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,i)=>i+1);return S.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>S.jsx("div",{className:"flex items-center justify-center",children:o<=e?S.jsx(Vm,{}):S.jsx(zm,{})},o))})};class mt{}Ie(mt,"FAST",3),Ie(mt,"Medium",2),Ie(mt,"SLOW",1),Ie(mt,"NONE",0);const Hm=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",fee:o="0.00",walletType:i="evm",receiverAddress:l="",onWithdrawAmountChange:u,onReceiverAddressChange:s,onAmountChanged:a})=>{const{t:c}=Ye(),d=m.useMemo(()=>{if(!pt(n==null?void 0:n.chainId)){const E=new xe(e||"0").minus(o||"0").decimalPlaces(2,xe.ROUND_DOWN);return E.isNegative()?"0.00":E.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),p=m.useMemo(()=>r||"0",[r]),f=E=>{const M=E.target.value,N=ro(M,p||"0");if(N.isValid)u(N.formattedValue),N.errorType;else return N.errorType==="exceed_balance",void 0;a==null||a(N.formattedValue)},g=()=>{u(p),a==null||a(p)},v=()=>{const E=parseFloat(r||"0"),M=parseFloat(e||"0");if(M>0){const w=E-M,N=Xe(Math.max(0,w).toString());return S.jsxs("span",{className:"flex items-center gap-1",children:[Xe(r||"0"),S.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),N," ",t]})}return`${Xe(r||"0")} ${t}`};return S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[S.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[S.jsx("input",{type:"text",placeholder:c("deposit.amount"),value:e,onChange:f,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),S.jsx("button",{onClick:g,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:c("deposit.max")})]}),S.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),S.jsxs("div",{className:"flex justify-between items-center",children:[S.jsx(sn,{content:c("deposit.availableDesc"),children:S.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:c("deposit.available")})}),S.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:v()})]})]}),i==="mpc"&&!pt(n==null?void 0:n.chainId)&&S.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:S.jsx("input",{type:"text",placeholder:c("withdraw.receiverAddress"),value:l,onChange:E=>s==null?void 0:s(E.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),S.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:pt(n==null?void 0:n.chainId)?S.jsxs(S.Fragment,{children:[S.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:c("withdraw.noticeDesc")}),S.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:c("withdraw.commonWithdraw")})]}):S.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:c("withdraw.crossChainTips")})}),S.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("span",{className:"text-text-tertiary text-xs",children:c("withdraw.speed")}),S.jsx("div",{className:"flex items-center",children:S.jsx(sn,{content:S.jsxs("div",{children:[S.jsx("div",{children:c("withdraw.speedNote")}),S.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[S.jsx(qn,{selectedLevel:mt.FAST,maxLevel:3}),S.jsx("span",{children:c("withdraw.speedNoteSpeed1")})]}),S.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[S.jsx(qn,{selectedLevel:mt.Medium,maxLevel:3}),S.jsx("span",{children:c("withdraw.speedNoteSpeed2")})]}),S.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[S.jsx(qn,{selectedLevel:mt.SLOW,maxLevel:3}),S.jsx("span",{children:c("withdraw.speedNoteSpeed3")})]})]}),children:S.jsx(qn,{selectedLevel:pt(n==null?void 0:n.chainId)?mt.SLOW:mt.FAST,maxLevel:3})})})]}),!pt(n==null?void 0:n.chainId)&&S.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[S.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:c("withdraw.fee")}),S.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),S.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[S.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:c(pt(n==null?void 0:n.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),S.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Xe(d)," ",t]})]})]})]})},Gm=[],Ym={};let De=null;const _l=m.forwardRef((e,t)=>{const[n,r]=m.useState(!1),[o,i]=m.useState(!1),[l,u]=m.useState({chains:[]}),s=m.useCallback(g=>{u(g||{chains:[]}),r(!0)},[]),a=m.useCallback(g=>{u(v=>({...v,...g}))},[]),c=m.useCallback(()=>{r(!1),i(!1),l.onClose&&l.onClose()},[l.onClose]),d=m.useCallback(g=>{i(g)},[]),p=m.useCallback(()=>n,[n]),f=m.useCallback(()=>o,[o]);return m.useImperativeHandle(t,()=>({openWithdraw:s,closeWithdraw:c,updateWithdrawOptions:a,setWithdrawLoading:d,isOpen:p,isLoading:f}),[s,c,a,d,p,f]),m.useEffect(()=>(De={openWithdraw:s,closeWithdraw:c,updateWithdrawOptions:a,setWithdrawLoading:d,isOpen:p,isLoading:f},()=>{De=null}),[s,c,a,d,p,f]),S.jsx(zl,{isOpen:n,isLoading:o,onClose:c,config:l.config||{symbol:"USDT"},currentActiveAccount:l.currentActiveAccount,smartWallet:l.smartWallet,chains:l.chains||Gm,defaultChainId:l.defaultChainId,defaultTokenAddress:l.defaultTokenAddress,defaultAmount:l.defaultAmount,metadata:l.metadata||Ym,currentEquity:l.currentEquity??5e3,platformBalance:l.platformBalance||"0",fee:l.fee,wagmiHooks:l.wagmiHooks,onWithdraw:l.onWithdraw,onChainChange:l.onChainChange,onTokenChange:l.onTokenChange,onAmountChanged:l.onAmountChanged})});_l.displayName="WithdrawManager";const Bl=e=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.openWithdraw(e||{chains:[]})},Wl=()=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.closeWithdraw()},Ul=e=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.updateWithdrawOptions(e)},Xn=e=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.setWithdrawLoading(e)},Km=()=>De?De.isOpen():!1,Vl=()=>De?De.isLoading():!1,qm=()=>({openWithdraw:Bl,closeWithdraw:Wl,updateWithdrawOptions:Ul,setWithdrawLoading:Xn,isOpen:Km,isLoading:Vl}),Xm=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:i,currentEquity:l,platformBalance:u="0",fee:s="0.00",isLoading:a=!1,wagmiHooks:c,onWithdraw:d,onClose:p,onChainChange:f,onTokenChange:g,onAmountChanged:v})=>{var Y;const{t:E}=Ye(),[M,w]=m.useState(()=>{var q;return!e||e.length===0?1:t||((q=e[0])==null?void 0:q.chainId)||1}),[N,F]=m.useState(()=>{var z;if(!e||e.length===0)return"";const q=t||((z=e[0])==null?void 0:z.chainId),G=e.find(J=>J.chainId===q);if(!G||!G.tokenList||G.tokenList.length===0)return"";const H=G.tokenList.find(J=>J.tokenAddress===n)||G.tokenList[0];return(H==null?void 0:H.token)||""}),[j,k]=m.useState(r),[B,h]=m.useState(""),b=(o==null?void 0:o.getWalletType())||"evm",y=m.useCallback(q=>{w(q),f==null||f(q)},[f]),$=m.useCallback(q=>{F(q),g==null||g(q)},[g]),D=m.useRef(!0),L=m.useRef(N),C=m.useRef(M);m.useEffect(()=>{if(D.current){D.current=!1,L.current=N,C.current=M;return}(L.current!==N||C.current!==M)&&(k(""),L.current=N,C.current=M)},[N,M]);const O=e&&e.length>0?e.find(q=>q.chainId===M)||e[0]:null,T=(Y=O==null?void 0:O.tokenList)==null?void 0:Y.find(q=>q.token===N),P=o==null?void 0:o.getDisplayAddress(),{multicallResult:x,queryComponents:I}=Al({account:P,chainId:M,contractAddress:void 0,tokens:(O==null?void 0:O.tokenList)||[],wagmiHooks:c}),_=m.useMemo(()=>{var G;if(!T)return;if(!T.tokenAddress||T.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return x.baseTokenBalance.formatted;const q=x.combinedData[T.tokenAddress];return((G=q==null?void 0:q.balance)==null?void 0:G.formatted)||"0"},[T,x]),V=m.useMemo(()=>{const q=new xe(j||"0"),G=new xe(s||"0"),H=pt(M);return!j||q.isZero()||!H&&q.isLessThan(G)?{text:E("withdraw.confirmWithdraw"),disabled:!0}:b==="mpc"&&!H&&!B.trim()?{text:E("withdraw.invalidReceiverAddress"),disabled:!0}:{text:E("withdraw.confirmWithdraw"),disabled:!1}},[E,M,j,b,B,s]),W=m.useCallback(async()=>{Xn(!0);try{if(d){const q=new xe(j||"0"),G=new xe(s||"0"),z={amount:(pt(M)?q:q.minus(G)).toString(),chainId:M,tokenAddress:(T==null?void 0:T.tokenAddress)||"",tokenSymbol:N};b==="mpc"&&!pt(M)&&(z.receiverAddress=B),d(z)}}catch{Xn(!1)}},[d,j,s,M,T==null?void 0:T.tokenAddress,N,b,B]);return!(c!=null&&c.useBalance)||!(c!=null&&c.useReadContract)||!(c!=null&&c.useAccount)?S.jsxs("div",{className:"p-6 text-center",children:[S.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),S.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?S.jsx("div",{className:"text-center py-8",children:S.jsx("p",{className:"text-gray-400",children:"No chains available"})}):O?S.jsxs(S.Fragment,{children:[I,S.jsx(no,{currentActiveChain:O,chainList:e,onChainChange:y,curSelectToken:N,onTokenChange:$,walletType:"evm"}),S.jsx(Hm,{withdrawAmount:j,curSelectToken:N,curSelectTokenData:{balance:T==null?void 0:T.balance,allowance:T==null?void 0:T.allowance},currentActiveChain:O,currentEquity:l||0,amount:j,decimals:(T==null?void 0:T.decimals)||6,tokenBalance:_,platformBalance:u,fee:s,walletType:b,receiverAddress:B,onWithdrawAmountChange:k,onReceiverAddressChange:h,onAmountChanged:v}),S.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${V.disabled||a?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:W,disabled:V.disabled||a,children:[a&&S.jsx(ln,{size:"xs"}),V.text]})]}):S.jsx("div",{className:"text-center py-8",children:S.jsx("p",{className:"text-gray-400",children:"Loading..."})})},zl=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oo,smartWallet:i=io,chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a="",metadata:c=so,currentEquity:d=5e3,platformBalance:p="0",fee:f,wagmiHooks:g,onWithdraw:v,onChainChange:E,onTokenChange:M,onAmountChanged:w})=>{const{t:N}=Ye(),F=m.useMemo(()=>{var j;return o?Vo(o,i,!1,(j=l[0])==null?void 0:j.chainId,"0","0"):null},[o,i,l]);return e?Se.createPortal(S.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:S.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{n()},"aria-hidden":"true",children:S.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:j=>{j.stopPropagation()},children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsx("h2",{className:"text-lg font-semibold text-white",children:N("withdraw.withdraw")}),S.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:S.jsx(Wo,{className:"h-4 w-4"})})]}),S.jsx(Xm,{chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a,walletAdapter:F,metadata:c,currentEquity:d,platformBalance:p,fee:f,isLoading:t,wagmiHooks:g,onWithdraw:v,onClose:n,onChainChange:E,onTokenChange:M,onAmountChanged:w})]})})}),document.body):null};Z.ChromeLoader=ln,Z.ComponentProvider=va,Z.DEFAULT_LOCALE=un,Z.Deposit=kl,Z.DepositManager=Ml,Z.LOCALE_NAMES=ma,Z.LoadingSpinner=ln,Z.SUPPORTED_LOCALES=Jn,Z.Tooltip=sn,Z.Withdraw=zl,Z.WithdrawManager=_l,Z.closeDeposit=jl,Z.closeWithdraw=Wl,Z.formatThousands=ya,Z.isDepositLoading=Rl,Z.isWithdrawLoading=Vl,Z.openDeposit=Il,Z.openWithdraw=Bl,Z.setDepositLoading=Kn,Z.setWithdrawLoading=Xn,Z.updateDepositOptions=Fl,Z.updateWithdrawOptions=Ul,Z.useComponentConfig=Fo,Z.useDeposit=xa,Z.useDepositManager=Wm,Z.useTranslation=Ye,Z.useWithdraw=wa,Z.useWithdrawManager=qm,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})});
117
+ ${c}
118
+ ${s}
119
+ `,children:[t,o&&M.jsx(sd,{ref:f,placement:h.placement||n})]})})]})},ms="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",Sw=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var c;const{t:s}=pt(),i=S.useMemo(()=>a1(n||{}),[n]);return M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"flex justify-center mt-4 mb-3",children:(e==null?void 0:e.getDisplayAddress())&&M.jsx("div",{className:"bg-white rounded-lg",children:M.jsx(_f,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),(e==null?void 0:e.getDisplayAddress())&&M.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[M.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),M.jsx(C1,{onCopy:()=>{const a=(e==null?void 0:e.getDisplayAddress())||"";o&&o(a)},text:e==null?void 0:e.getDisplayAddress(),children:M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[M.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),M.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),M.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[M.jsxs("div",{className:"flex items-start",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1",children:M.jsx("p",{className:"text-xs text-functional-orange-1",children:s("deposit.depositAllTip",{coin:t,v:n==null?void 0:n.chain})})})]}),i&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:s("deposit.depositTipFor25w")})]})]}),M.jsxs("div",{className:"text-sm",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[M.jsx("span",{className:"text-text-tertiary",children:s("deposit.arrivalTime")}),M.jsx(zr,{content:M.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[M.jsx("p",{children:s("deposit.arrivaltimeTooltip1",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60,v1:n==null?void 0:n.txConfirm})}),M.jsx("p",{children:s("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:M.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:s("deposit.arrivalEstimated",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60})})})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:s("deposit.minDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((c=r==null?void 0:r.multiChain)==null?void 0:c.minDeposit)||10," ",t]})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:s("deposit.maxDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]})]})},Pw=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onCopy:i,onClose:c})=>{var m;const{t:a}=pt(),[u,l]=S.useState(()=>{var v;return!e||e.length===0?1:t||((v=e[0])==null?void 0:v.chainId)||1}),[f,p]=S.useState(()=>{var $;if(!e||e.length===0)return"";const v=t||(($=e[0])==null?void 0:$.chainId),C=e.find(B=>B.chainId===v);if(!C||!C.tokenList||C.tokenList.length===0)return"";const b=C.tokenList.find(B=>B.tokenAddress===n)||C.tokenList[0];return(b==null?void 0:b.token)||""}),d=e&&e.length>0?e.find(v=>v.chainId===u)||e[0]:null,h=(m=d==null?void 0:d.tokenList)==null?void 0:m.find(v=>v.token===f);return!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):d?M.jsxs(M.Fragment,{children:[M.jsx(na,{currentActiveChain:d,chainList:e,onChainChange:l,curSelectToken:f,onTokenChange:p,walletType:"mpc"}),M.jsx(Sw,{walletAdapter:r,curSelectToken:f,currentActiveChain:d,metadata:o,onCopy:i}),M.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{s&&s({amount:"",chainId:u,tokenAddress:(h==null?void 0:h.tokenAddress)||"",tokenSymbol:f}),c()},children:a("deposit.title")})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},$w="1.0.8";let Ke=class ru extends Error{constructor(t,n={}){var i;const r=n.cause instanceof ru?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof ru&&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@${$w}`].join(`
120
+ `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function qt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const id=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ad=/^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)?$/,cd=/^\(.+?\).*?$/,ud=/^tuple(?<array>(\[(\d*)\])*)$/;function Pa(e){let t=e.type;if(ud.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+=Pa(s),o<n-1&&(t+=", ")}const r=qt(ud,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Pa({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Wr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Pa(o),r!==n-1&&(t+=", ")}return t}function gs(e){var t;return e.type==="function"?`function ${e.name}(${Wr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Wr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Wr(e.inputs)})`:e.type==="error"?`error ${e.name}(${Wr(e.inputs)})`:e.type==="constructor"?`constructor(${Wr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const ld=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Aw(e){return ld.test(e)}function Tw(e){return qt(ld,e)}const fd=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Cw(e){return fd.test(e)}function Ow(e){return qt(fd,e)}const dd=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Nw(e){return dd.test(e)}function Iw(e){return qt(dd,e)}const pd=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function $a(e){return pd.test(e)}function Mw(e){return qt(pd,e)}const hd=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Lw(e){return hd.test(e)}function Bw(e){return qt(hd,e)}const md=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function kw(e){return md.test(e)}function Rw(e){return qt(md,e)}const Fw=/^receive\(\) external payable$/;function Dw(e){return Fw.test(e)}const jw=new Set(["indexed"]),Aa=new Set(["calldata","memory","storage"]);class _w extends Ke{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Uw extends Ke{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class zw extends Ke{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Ww extends Ke{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Hw extends Ke{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Vw extends Ke{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Gw extends Ke{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class qw extends Ke{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class tr extends Ke{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Zw extends Ke{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Kw extends Ke{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Yw extends Ke{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Xw extends Ke{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Qw(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 Ta=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 Ca(e,t={}){if(Nw(e))return Jw(e,t);if(Cw(e))return ex(e,t);if(Aw(e))return tx(e,t);if(Lw(e))return nx(e,t);if(kw(e))return rx(e);if(Dw(e))return{type:"receive",stateMutability:"payable"};throw new Zw({signature:e})}function Jw(e,t={}){const n=Iw(e);if(!n)throw new tr({signature:e,type:"function"});const r=bt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Nn(r[c],{modifiers:Aa,structs:t,type:"function"}));const i=[];if(n.returns){const c=bt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(Nn(c[u],{modifiers:Aa,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function ex(e,t={}){const n=Ow(e);if(!n)throw new tr({signature:e,type:"event"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Nn(r[i],{modifiers:jw,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function tx(e,t={}){const n=Tw(e);if(!n)throw new tr({signature:e,type:"error"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Nn(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function nx(e,t={}){const n=Bw(e);if(!n)throw new tr({signature:e,type:"constructor"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Nn(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function rx(e){const t=Rw(e);if(!t)throw new tr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const ox=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,sx=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ix=/^u?int$/;function Nn(e,t){var f,p;const n=Qw(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Ta.has(n))return Ta.get(n);const r=cd.test(e),o=qt(r?sx:ox,e);if(!o)throw new Ww({param:e});if(o.name&&cx(o.name))throw new Hw({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,u={};if(r){a="tuple";const d=bt(o.type),h=[],m=d.length;for(let v=0;v<m;v++)h.push(Nn(d[v],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(ix.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!gd(a))throw new zw({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 Vw({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Aa.has(o.modifier)&&!ux(a,!!o.array))throw new Gw({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return Ta.set(n,l),l}function bt(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?bt(c,[...t,n.trim()]):bt(c,t,`${n}${i}`,r);case"(":return bt(c,t,`${n}${i}`,r+1);case")":return bt(c,t,`${n}${i}`,r-1);default:return bt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Xw({current:n,depth:r});return t.push(n.trim()),t}function gd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||id.test(e)||ad.test(e)}const ax=/^(?: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 cx(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||id.test(e)||ad.test(e)||ax.test(e)}function ux(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function bd(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!$a(c))continue;const a=Mw(c);if(!a)throw new tr({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],f=u.length;for(let p=0;p<f;p++){const h=u[p].trim();if(!h)continue;const m=Nn(h,{type:"struct"});l.push(m)}if(!l.length)throw new Kw({signature:c});t[a.name]=l}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=yd(a,t)}return r}const lx=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function yd(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(cd.test(i.type))r.push(i);else{const a=qt(lx,i.type);if(!(a!=null&&a.type))throw new qw({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Yw({type:l});r.push({...i,type:`tuple${u??""}`,components:yd(t[l]??[],t,new Set([...n,l]))})}else if(gd(l))r.push(i);else throw new Uw({type:l})}}return r}function vd(e){const t=bd(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];$a(s)||n.push(Ca(s,t))}return n}function wd(e){let t;if(typeof e=="string")t=Ca(e);else{const n=bd(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!$a(s)){t=Ca(s,n);break}}}if(!t)throw new _w({signature:e});return t}function J(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function yt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Sx(e.type);return`${e.name}(${bs(e.inputs,{includeName:t})})`}function bs(e,{includeName:t=!1}={}){return e?e.map(n=>fx(n,{includeName:t})).join(t?", ":","):""}function fx(e,{includeName:t}){return e.type.startsWith("tuple")?`(${bs(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function vt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return vt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const xd="2.34.0";let Hr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${xd}`},H=class ou extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof ou?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof ou&&n.cause.docsPath||n.docsPath,s=(c=Hr.getDocsUrl)==null?void 0:c.call(Hr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Hr.version?[`Version: ${Hr.version}`]:[]].join(`
121
+ `);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=xd}walk(t){return Ed(this,t)}};function Ed(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Ed(e.cause,t):t?null:e}class dx extends H{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
122
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Sd extends H{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
123
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Pd extends H{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
124
+ `),{metaMessages:[`Params: (${bs(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class Vr extends H{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class px extends H{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
125
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class hx extends H{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${we(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class mx extends H{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
126
+ `),{name:"AbiEncodingLengthMismatchError"})}}class gx extends H{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
127
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class $d extends H{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
128
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Ad extends H{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
129
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class bx extends H{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Td extends H{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
130
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Cd extends H{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
131
+ `),{docsPath:n,name:"AbiEventNotFoundError"})}}class nr extends H{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
132
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Od extends H{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
133
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class yx extends H{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
134
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class vx extends H{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${yt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${yt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let wx=class extends H{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Gr extends H{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
135
+ `),{metaMessages:[`Params: (${bs(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 ys extends H{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${yt(t,{includeName:!0})}".`].join(`
136
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class xx extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
137
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Ex extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
138
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Nd=class extends H{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
139
+ `),{name:"InvalidArrayError"})}};class Sx extends H{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
140
+ `),{name:"InvalidDefinitionTypeError"})}}class Px extends H{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Id=class extends H{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Md=class extends H{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Ld extends H{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function rr(e,{dir:t,size:n=32}={}){return typeof e=="string"?gn(e,{dir:t,size:n}):$x(e,{dir:t,size:n})}function gn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Md({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function $x(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Md({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 Bd=class extends H{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class Ax extends H{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class Tx extends H{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Cx=class extends H{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function In(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 wt(e,{size:t}){if(we(e)>t)throw new Cx({givenSize:we(e),maxSize:t})}function Bt(e,t={}){const{signed:n}=t;t.size&&wt(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function Ox(e,t={}){let n=e;if(t.size&&(wt(n,{size:t.size}),n=In(n)),In(n)==="0x00")return!1;if(In(n)==="0x01")return!0;throw new Tx(n)}function Zt(e,t={}){return Number(Bt(e,t))}const Nx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Kt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Q(e,t):typeof e=="string"?qr(e,t):typeof e=="boolean"?kd(e,t):$e(e,t)}function kd(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Nx[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(wt(r,{size:t.size}),rr(r,{dir:"right",size:t.size})):r}function Q(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new Bd({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?rr(c,{size:r}):c}const Ix=new TextEncoder;function qr(e,t={}){const n=Ix.encode(e);return $e(n,t)}const Mx=new TextEncoder;function or(e,t={}){return typeof e=="number"||typeof e=="bigint"?Bx(e,t):typeof e=="boolean"?Lx(e,t):vt(e)?xt(e,t):Mn(e,t)}function Lx(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{size:t.size})):n}const Yt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Rd(e){if(e>=Yt.zero&&e<=Yt.nine)return e-Yt.zero;if(e>=Yt.A&&e<=Yt.F)return e-(Yt.A-10);if(e>=Yt.a&&e<=Yt.f)return e-(Yt.a-10)}function xt(e,t={}){let n=e;t.size&&(wt(n,{size:t.size}),n=rr(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const a=Rd(r.charCodeAt(c++)),u=Rd(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new H(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function Bx(e,t){const n=Q(e,t);return xt(n)}function Mn(e,t={}){const n=Mx.encode(e);return typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{dir:"right",size:t.size})):n}const vs=BigInt(2**32-1),Fd=BigInt(32);function kx(e,t=!1){return t?{h:Number(e&vs),l:Number(e>>Fd&vs)}:{h:Number(e>>Fd&vs)|0,l:Number(e&vs)|0}}function Rx(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}=kx(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Fx=(e,t,n)=>e<<n|t>>>32-n,Dx=(e,t,n)=>t<<n|e>>>32-n,jx=(e,t,n)=>t<<n-32|e>>>64-n,_x=(e,t,n)=>e<<n-32|t>>>64-n,sr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ws(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Xt(e,...t){if(!ws(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 Dd(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Zr(e.outputLen),Zr(e.blockLen)}function ir(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function jd(e,t){Xt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ux(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ar(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Oa(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function kt(e,t){return e<<32-t|e>>>t}const zx=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Wx(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Hx(e){for(let t=0;t<e.length;t++)e[t]=Wx(e[t]);return e}const _d=zx?e=>e:Hx,Ud=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Vx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function cr(e){if(Xt(e),Ud)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Vx[e[n]];return t}const Qt={_0:48,_9:57,A:65,F:70,a:97,f:102};function zd(e){if(e>=Qt._0&&e<=Qt._9)return e-Qt._0;if(e>=Qt.A&&e<=Qt.F)return e-(Qt.A-10);if(e>=Qt.a&&e<=Qt.f)return e-(Qt.a-10)}function xs(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Ud)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=zd(e.charCodeAt(s)),c=zd(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 Gx(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Es(e){return typeof e=="string"&&(e=Gx(e)),Xt(e),e}function bn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Xt(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class Na{}function Wd(e){const t=r=>e().update(Es(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Hd(e=32){if(sr&&typeof sr.getRandomValues=="function")return sr.getRandomValues(new Uint8Array(e));if(sr&&typeof sr.randomBytes=="function")return Uint8Array.from(sr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const qx=BigInt(0),Kr=BigInt(1),Zx=BigInt(2),Kx=BigInt(7),Yx=BigInt(256),Xx=BigInt(113),Vd=[],Gd=[],qd=[];for(let e=0,t=Kr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Vd.push(2*(5*r+n)),Gd.push((e+1)*(e+2)/2%64);let o=qx;for(let s=0;s<7;s++)t=(t<<Kr^(t>>Kx)*Xx)%Yx,t&Zx&&(o^=Kr<<(Kr<<BigInt(s))-Kr);qd.push(o)}const Zd=Rx(qd,!0),Qx=Zd[0],Jx=Zd[1],Kd=(e,t,n)=>n>32?jx(e,t,n):Fx(e,t,n),Yd=(e,t,n)=>n>32?_x(e,t,n):Dx(e,t,n);function eE(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,a=(i+2)%10,u=n[a],l=n[a+1],f=Kd(u,l,1)^n[c],p=Yd(u,l,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=Gd[i],a=Kd(o,s,c),u=Yd(o,s,c),l=Vd[i];o=e[l],s=e[l+1],e[l]=a,e[l+1]=u}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Qx[r],e[1]^=Jx[r]}ar(n)}class Ia extends Na{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,Zr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ux(this.state)}clone(){return this._cloneInto()}keccak(){_d(this.state32),eE(this.state32,this.rounds),_d(this.state32),this.posOut=0,this.pos=0}update(t){ir(this),t=Es(t),Xt(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){ir(this,!1),Xt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Zr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(jd(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ar(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Ia(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 tE=(e,t,n)=>Wd(()=>new Ia(t,e,n)),Xd=tE(1,136,256/8);function Ne(e,t){const n=t||"hex",r=Xd(vt(e,{strict:!1})?or(e):e);return n==="bytes"?r:Kt(r)}const nE=e=>Ne(or(e));function rE(e){return nE(e)}function oE(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 H("Unable to normalize signature.");return o}const sE=e=>{const t=typeof e=="string"?e:gs(e);return oE(t)};function Qd(e){return rE(sE(e))}const Ss=Qd;let yn=class extends H{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},Ma=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 La=new Ma(8192);function Ps(e,t){if(La.has(`${e}.${t}`))return La.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ne(Mn(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 La.set(`${e}.${t}`,s),s}function iE(e,t){if(!ct(e,{strict:!1}))throw new yn({address:e});return Ps(e,t)}const aE=/^0x[a-fA-F0-9]{40}$/,Ba=new Ma(8192);function ct(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ba.has(r))return Ba.get(r);const o=aE.test(e)?e.toLowerCase()===e?!0:n?Ps(e)===e:!0:!1;return Ba.set(r,o),o}function Et(e){return typeof e[0]=="string"?ur(e):cE(e)}function cE(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function ur(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function lr(e,t,n,{strict:r}={}){return vt(e,{strict:!1})?np(e,t,n,{strict:r}):tp(e,t,n,{strict:r})}function Jd(e,t){if(typeof t=="number"&&t>0&&t>we(e)-1)throw new Id({offset:t,position:"start",size:we(e)})}function ep(e,t,n){if(typeof t=="number"&&typeof n=="number"&&we(e)!==n-t)throw new Id({offset:n,position:"end",size:we(e)})}function tp(e,t,n,{strict:r}={}){Jd(e,t);const o=e.slice(t,n);return r&&ep(o,t,n),o}function np(e,t,n,{strict:r}={}){Jd(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&ep(o,t,n),o}const uE=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,rp=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Jt(e,t){if(e.length!==t.length)throw new mx({expectedLength:e.length,givenLength:t.length});const n=lE({params:e,values:t}),r=Ra(n);return r.length===0?"0x":r}function lE({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(ka({param:e[r],value:t[r]}));return n}function ka({param:e,value:t}){const n=Fa(e.type);if(n){const[r,o]=n;return dE(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return bE(t,{param:e});if(e.type==="address")return fE(t);if(e.type==="bool")return hE(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=rp.exec(e.type)??[];return mE(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return pE(t,{param:e});if(e.type==="string")return gE(t);throw new xx(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Ra(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=we(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Q(t+o,{size:32})),r.push(c),o+=we(c)):n.push(c)}return Et([...n,...r])}function fE(e){if(!ct(e))throw new yn({address:e});return{dynamic:!1,encoded:gn(e.toLowerCase())}}function dE(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Nd(e);if(!r&&e.length!==t)throw new px({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=ka({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=Ra(s);if(r){const c=Q(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Et([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Et(s.map(({encoded:i})=>i))}}function pE(e,{param:t}){const[,n]=t.type.split("bytes"),r=we(e);if(!n){let o=e;return r%32!==0&&(o=gn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Et([gn(Q(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new hx({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:gn(e,{dir:"right"})}}function hE(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:gn(kd(e))}}function mE(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 Bd({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Q(e,{size:32,signed:t})}}function gE(e){const t=qr(e),n=Math.ceil(we(t)/32),r=[];for(let o=0;o<n;o++)r.push(gn(lr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Et([gn(Q(we(t),{size:32})),...r])}}function bE(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=ka({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Ra(r):Et(r.map(({encoded:o})=>o))}}function Fa(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Yr=e=>lr(Qd(e),0,4);function Ln(e){const{abi:t,args:n=[],name:r}=e,o=vt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Yr(c)===r:c.type==="event"?Ss(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((u,l)=>{const f="inputs"in c&&c.inputs[l];return f?Da(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=op(c.inputs,i.inputs,n);if(u)throw new vx({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Da(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ct(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>Da(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=>Da(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function op(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 op(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ct(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ct(n[r],{strict:!1}):!1)return i}}const sp="/docs/contract/encodeEventTopics";function Xr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=Ln({abi:t,name:n});if(!u)throw new Cd(n,{docsPath:sp});o=u}if(o.type!=="event")throw new Cd(void 0,{docsPath:sp});const s=yt(o),i=Ss(s);let c=[];if(r&&"inputs"in o){const u=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(f=>r[f.name]))??[]:[];l.length>0&&(c=(u==null?void 0:u.map((f,p)=>Array.isArray(l[p])?l[p].map((d,h)=>ip({param:f,value:l[p][h]})):typeof l[p]<"u"&&l[p]!==null?ip({param:f,value:l[p]}):null))??[])}return[i,...c]}function ip({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ne(or(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Px(e.type);return Jt([e],[t])}function $s(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 ap(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=$s(e,{method:"eth_newFilter"}),l=s?Xr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?Q(i):i,toBlock:typeof a=="bigint"?Q(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function St(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const cp="/docs/contract/encodeFunctionData";function yE(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Ln({abi:t,args:n,name:r});if(!s)throw new nr(r,{docsPath:cp});o=s}if(o.type!=="function")throw new nr(void 0,{docsPath:cp});return{abi:[o],functionName:Yr(yt(o))}}function Rt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:yE(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Jt(o.inputs,t??[]):void 0;return ur([s,i??"0x"])}const up={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."},lp={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},vE={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class fp extends H{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class dp extends H{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class wE extends H{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const xE={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 wE({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new dp({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new fp({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 fp({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 ja(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(xE);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function EE(e,t={}){typeof t.size<"u"&&wt(e,{size:t.size});const n=$e(e,t);return Bt(n,t)}function SE(e,t={}){let n=e;if(typeof t.size<"u"&&(wt(n,{size:t.size}),n=In(n)),n.length>1||n[0]>1)throw new Ax(n);return!!n[0]}function en(e,t={}){typeof t.size<"u"&&wt(e,{size:t.size});const n=$e(e,t);return Zt(n,t)}function PE(e,t={}){let n=e;return typeof t.size<"u"&&(wt(n,{size:t.size}),n=In(n,{dir:"right"})),new TextDecoder().decode(n)}function Qr(e,t){const n=typeof t=="string"?xt(t):t,r=ja(n);if(we(n)===0&&e.length>0)throw new Vr;if(we(t)&&we(t)<32)throw new Pd({data:typeof t=="string"?t:$e(t),params:e,size:we(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=fr(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function fr(e,t,{staticPosition:n}){const r=Fa(t.type);if(r){const[o,s]=r;return AE(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return NE(e,t,{staticPosition:n});if(t.type==="address")return $E(e);if(t.type==="bool")return TE(e);if(t.type.startsWith("bytes"))return CE(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return OE(e,t);if(t.type==="string")return IE(e,{staticPosition:n});throw new Ex(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const pp=32,_a=32;function $E(e){const t=e.readBytes(32);return[Ps($e(tp(t,-20))),32]}function AE(e,t,{length:n,staticPosition:r}){if(!n){const i=en(e.readBytes(_a)),c=r+i,a=c+pp;e.setPosition(c);const u=en(e.readBytes(pp)),l=Jr(t);let f=0;const p=[];for(let d=0;d<u;++d){e.setPosition(a+(l?d*32:f));const[h,m]=fr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(Jr(t)){const i=en(e.readBytes(_a)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=fr(e,t,{staticPosition:c});a.push(l)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=fr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function TE(e){return[SE(e.readBytes(32),{size:32}),32]}function CE(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=en(e.readBytes(32));e.setPosition(n+i);const c=en(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[$e(a),32]}return[$e(e.readBytes(Number.parseInt(o),32)),32]}function OE(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?EE(o,{signed:n}):en(o,{signed:n}),32]}function NE(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Jr(t)){const i=en(e.readBytes(_a)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=fr(e,u,{staticPosition:c});s+=f,o[r?a:u==null?void 0:u.name]=l}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,u]=fr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function IE(e,{staticPosition:t}){const n=en(e.readBytes(32)),r=t+n;e.setPosition(r);const o=en(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=PE(In(s));return e.setPosition(t+32),[i,32]}function Jr(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(Jr);const n=Fa(e.type);return!!(n&&Jr({...e,type:n[1]}))}function hp(e){const{abi:t,data:n}=e,r=lr(n,0,4);if(r==="0x")throw new Vr;const s=[...t||[],lp,vE].find(i=>i.type==="error"&&r===Yr(yt(i)));if(!s)throw new Ad(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Qr(s.inputs,lr(n,4)):void 0,errorName:s.name}}const Ae=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function mp({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"?Ae(t[s]):t[s]}`).join(", ")})`}const ME={gwei:9,wei:18},LE={ether:-9,wei:9};function gp(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 bp(e,t="wei"){return gp(e,ME[t])}function Pt(e,t="wei"){return gp(e,LE[t])}class BE extends H{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class kE extends H{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function yp(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
141
+ `,"")}function RE(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
142
+ `;return r.nonce&&(o+=` nonce: ${r.nonce}
143
+ `),r.balance&&(o+=` balance: ${r.balance}
144
+ `),r.code&&(o+=` code: ${r.code}
145
+ `),r.state&&(o+=` state:
146
+ `,o+=yp(r.state)),r.stateDiff&&(o+=` stateDiff:
147
+ `,o+=yp(r.stateDiff)),o},` State Override:
148
+ `).slice(0,-1)}function As(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(`
149
+ `)}class FE extends H{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
150
+ `),{name:"FeeConflictError"})}}class DE extends H{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",As(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 vp extends H{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}}class wp extends H{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class jE extends H{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const _E=e=>e,eo=e=>e;class xp extends H{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p,stateOverride:d}){var v;const h=n?St(n):void 0;let m=As({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${bp(p)} ${((v=o==null?void 0:o.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Pt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Pt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Pt(u)} gwei`,nonce:l});d&&(m+=`
151
+ ${RE(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 UE extends H{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=Ln({abi:n,args:r,name:i}),u=a?mp({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?yt(a,{includeName:!0}):void 0,f=As({address:o&&_E(o),function:l,args:u&&u!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${u}`,sender:c});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=c}}class Ua extends H{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=hp({abi:t,data:n});const{abiItem:l,errorName:f,args:p}=i;if(f==="Error")a=p[0];else if(f==="Panic"){const[d]=p;a=up[d]}else{const d=l?yt(l,{includeName:!0}):void 0,h=l&&p?mp({abiItem:l,args:p,includeFunctionName:!1,includeName:!1}):void 0;c=[d?`Error: ${d}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(l){s=l}else o&&(a=o);let u;s instanceof Ad&&(u=s.signature,c=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(a&&a!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,a||u].join(`
152
+ `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.raw=n,this.reason=a,this.signature=u}}class zE extends H{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class WE extends H{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Ts extends H{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class Bn extends H{constructor({body:t,cause:n,details:r,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${eo(i)}`,t&&`Request body: ${Ae(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 za extends H{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${eo(r)}`,`Request body: ${Ae(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data}}class Ep extends H{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${eo(n)}`,`Request body: ${Ae(t)}`],name:"TimeoutError"})}}const HE=-1;class ze extends H{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof za?t.code:n??HE}}class Ye extends ze{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class to extends ze{constructor(t){super(t,{code:to.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class no extends ze{constructor(t){super(t,{code:no.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ro extends ze{constructor(t,{method:n}={}){super(t,{code:ro.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class oo extends ze{constructor(t){super(t,{code:oo.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
153
+ `)})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class kn extends ze{constructor(t){super(t,{code:kn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Rn extends ze{constructor(t){super(t,{code:Rn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
154
+ `)})}}Object.defineProperty(Rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class so extends ze{constructor(t){super(t,{code:so.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class io extends ze{constructor(t){super(t,{code:io.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class ao extends ze{constructor(t){super(t,{code:ao.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Fn extends ze{constructor(t,{method:n}={}){super(t,{code:Fn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class dr extends ze{constructor(t){super(t,{code:dr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class co extends ze{constructor(t){super(t,{code:co.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class pr extends Ye{constructor(t){super(t,{code:pr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(pr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class uo extends Ye{constructor(t){super(t,{code:uo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class lo extends Ye{constructor(t,{method:n}={}){super(t,{code:lo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class fo extends Ye{constructor(t){super(t,{code:fo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class po extends Ye{constructor(t){super(t,{code:po.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ho extends Ye{constructor(t){super(t,{code:ho.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class mo extends Ye{constructor(t){super(t,{code:mo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class go extends Ye{constructor(t){super(t,{code:go.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class bo extends Ye{constructor(t){super(t,{code:bo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class yo extends Ye{constructor(t){super(t,{code:yo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class vo extends Ye{constructor(t){super(t,{code:vo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class wo extends Ye{constructor(t){super(t,{code:wo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class xo extends Ye{constructor(t){super(t,{code:xo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class VE extends ze{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const GE=3;function hr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Ts?e:e instanceof H?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:p}=c,d=e instanceof Vr?new zE({functionName:s}):[GE,kn.code].includes(a)&&(u||l||f||p)?new Ua({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof za?l:p??f}):e;return new UE(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function qE(e){const t=Ne(`0x${e.substring(4)}`).substring(26);return Ps(`0x${t}`)}async function ZE({hash:e,signature:t}){const n=vt(e)?e:Kt(e),{secp256k1:r}=await Promise.resolve().then(()=>jS);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:f,yParity:p}=t,d=Number(p??f),h=Sp(d);return new r.Signature(Bt(u),Bt(l)).addRecoveryBit(h)}const i=vt(t)?t:Kt(t);if(we(i)!==65)throw new Error("invalid signature length");const c=Zt(`0x${i.slice(130)}`),a=Sp(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Sp(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 Pp({hash:e,signature:t}){return qE(await ZE({hash:e,signature:t}))}function KE(e,t="hex"){const n=$p(e),r=ja(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function $p(e){return Array.isArray(e)?YE(e.map(t=>$p(t))):XE(e)}function YE(e){const t=e.reduce((o,s)=>o+s.length,0),n=Ap(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 XE(e){const t=typeof e=="string"?xt(e):e,n=Ap(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 Ap(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new H("Length is too large.")}function QE(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ne(ur(["0x05",KE([t?Q(t):"0x",o,n?Q(n):"0x"])]));return r==="bytes"?xt(s):s}async function JE(e){const{authorization:t,signature:n}=e;return Pp({hash:QE(t),signature:n??t})}class e2 extends H{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p}){var h;const d=As({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${bp(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Pt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Pt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Pt(u)} gwei`,nonce:l});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 mr extends H{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(mr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(mr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Cs extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Pt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Cs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Wa extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Pt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Wa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Ha extends H{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Ha,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Va extends H{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
155
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Va,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Ga extends H{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Ga,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class qa extends H{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
156
+ `),{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(qa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Za extends H{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Za,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Ka extends H{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Ka,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Ya extends H{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Ya,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Os extends H{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Pt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Pt(r)} gwei`:""}).`].join(`
157
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Os,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Ns extends H{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Xa(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof H?e.walk(o=>(o==null?void 0:o.code)===mr.code):e;return r instanceof H?new mr({cause:e,message:r.details}):mr.nodeMessage.test(n)?new mr({cause:e,message:e.details}):Cs.nodeMessage.test(n)?new Cs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Wa.nodeMessage.test(n)?new Wa({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ha.nodeMessage.test(n)?new Ha({cause:e,nonce:t==null?void 0:t.nonce}):Va.nodeMessage.test(n)?new Va({cause:e,nonce:t==null?void 0:t.nonce}):Ga.nodeMessage.test(n)?new Ga({cause:e,nonce:t==null?void 0:t.nonce}):qa.nodeMessage.test(n)?new qa({cause:e}):Za.nodeMessage.test(n)?new Za({cause:e,gas:t==null?void 0:t.gas}):Ka.nodeMessage.test(n)?new Ka({cause:e,gas:t==null?void 0:t.gas}):Ya.nodeMessage.test(n)?new Ya({cause:e}):Os.nodeMessage.test(n)?new Os({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Ns({cause:e})}function t2(e,{docsPath:t,...n}){const r=(()=>{const o=Xa(e,n);return o instanceof Ns?e:o})();return new e2(r,{docsPath:t,...n})}function Qa(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 n2={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Is(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=r2(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>$e(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=Q(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=Q(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=Q(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=Q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=Q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=Q(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=n2[e.type]),typeof e.value<"u"&&(t.value=Q(e.value)),t}function r2(e){return e.map(t=>({address:t.address,r:t.r?Q(BigInt(t.r)):t.r,s:t.s?Q(BigInt(t.s)):t.s,chainId:Q(t.chainId),nonce:Q(t.nonce),...typeof t.yParity<"u"?{yParity:Q(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Q(t.v)}:{}}))}function Tp(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Ld({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Ld({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function o2(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=Q(t)),n!==void 0&&(i.nonce=Q(n)),r!==void 0&&(i.state=Tp(r)),o!==void 0){if(i.state)throw new kE;i.stateDiff=Tp(o)}return i}function Ja(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ct(n,{strict:!1}))throw new yn({address:n});if(t[n])throw new BE({address:n});t[n]=o2(r)}return t}const s2=2n**256n-1n;function Eo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?St(t):void 0;if(i&&!ct(i.address))throw new yn({address:i.address});if(s&&!ct(s))throw new yn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new FE;if(r&&r>s2)throw new Cs({maxFeePerGas:r});if(o&&r&&o>r)throw new Os({maxFeePerGas:r,maxPriorityFeePerGas:o})}class i2 extends H{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class ec extends H{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class a2 extends H{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Pt(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Cp extends H{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Op={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Np(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Zt(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Zt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Op[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(t.authorizationList=c2(e.authorizationList)),t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof t.v=="bigint"){if(t.v===0n||t.v===27n)return 0;if(t.v===1n||t.v===28n)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),t.type==="legacy"&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),t.type==="eip2930"&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t.type==="eip1559"&&delete t.maxFeePerBlobGas,t}function c2(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 Ip(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Np(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Ft(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var u,l,f;const s=o??!1,i=n!==void 0?Q(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new Cp({blockHash:t,blockNumber:n});return(((f=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:f.format)||Ip)(c)}async function tc(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function u2(e,t){return Mp(e,t)}async function Mp(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof c=="function"){const u=n||await J(e,Ft,"getBlock")({}),l=await c({block:u,client:e,request:o});if(l===null)throw new Error;return l}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Bt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):J(e,Ft,"getBlock")({}),J(e,tc,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new ec;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function l2(e,t){return nc(e,t)}async function nc(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 i2;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await J(e,Ft,"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:u,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new ec;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Mp(e,{block:l,chain:r,request:o}),m=u(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??u(await J(e,tc,"getGasPrice")({}))}}async function Lp(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?Q(r):n]},{dedupe:!!r});return Zt(o)}function Bp(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=>xt(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 kp(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>xt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>xt(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 f2(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),a=r?4:0,u=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+u,c,r)}function d2(e,t,n){return e&t^~e&n}function p2(e,t,n){return e&t^e&n^t&n}class h2 extends Na{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=Oa(this.buffer)}update(t){ir(this),t=Es(t),Xt(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=Oa(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ir(this),jd(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,ar(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;f2(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Oa(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)c.setUint32(4*f,l[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const vn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),m2=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),wn=new Uint32Array(64);class g2 extends h2{constructor(t=32){super(64,t,8,!1),this.A=vn[0]|0,this.B=vn[1]|0,this.C=vn[2]|0,this.D=vn[3]|0,this.E=vn[4]|0,this.F=vn[5]|0,this.G=vn[6]|0,this.H=vn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)wn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=wn[f-15],d=wn[f-2],h=kt(p,7)^kt(p,18)^p>>>3,m=kt(d,17)^kt(d,19)^d>>>10;wn[f]=m+wn[f-7]+h+wn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:u,H:l}=this;for(let f=0;f<64;f++){const p=kt(c,6)^kt(c,11)^kt(c,25),d=l+p+d2(c,a,u)+m2[f]+wn[f]|0,m=(kt(r,2)^kt(r,13)^kt(r,22))+p2(r,o,s)|0;l=u,u=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,u=u+this.G|0,l=l+this.H|0,this.set(r,o,s,i,c,a,u,l)}roundClean(){ar(wn)}destroy(){this.set(0,0,0,0,0,0,0,0),ar(this.buffer)}}const Rp=Wd(()=>new g2),b2=Rp;function y2(e,t){return b2(vt(e,{strict:!1})?or(e):e)}function v2(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=y2(t);return o.set([n],0),r==="bytes"?o:$e(o)}function w2(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(v2({commitment:s,to:r,version:n}));return o}const Fp=6,Dp=32,rc=4096,jp=Dp*rc,_p=jp*Fp-1-1*rc*Fp;class x2 extends H{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class E2 extends H{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function S2(e){const t=typeof e.data=="string"?xt(e.data):e.data,n=we(t);if(!n)throw new E2;if(n>_p)throw new x2({maxSize:_p,size:n});const r=[];let o=!0,s=0;for(;o;){const i=ja(new Uint8Array(jp));let c=0;for(;c<rc;){const a=t.slice(s,s+(Dp-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 P2(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??S2({data:t}),s=e.commitments??Bp({blobs:o,kzg:n,to:r}),i=e.proofs??kp({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function $2(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 DE({transaction:e})}async function Up(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Zt(t)}const A2=["blobVersionedHashes","chainId","fees","gas","nonce","type"],zp=new Map;async function Wp(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=A2,type:l}=t,f=n&&St(n),p={...t,...f?{from:f==null?void 0:f.address}:{}};let d;async function h(){return d||(d=await J(e,Ft,"getBlock")({blockTag:"latest"}),d)}let m;async function v(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await J(e,Up,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&f)if(a){const C=await v();p.nonce=await a.consume({address:f.address,chainId:C,client:e})}else p.nonce=await J(e,Lp,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const C=Bp({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const b=w2({commitments:C,to:"hex"});p.blobVersionedHashes=b}if(u.includes("sidecars")){const b=kp({blobs:r,commitments:C,kzg:i}),$=P2({blobs:r,commitments:C,proofs:b,to:"hex"});p.sidecars=$}}if(u.includes("chainId")&&(p.chainId=await v()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{p.type=$2(p)}catch{let C=zp.get(e.uid);if(typeof C>"u"){const b=await h();C=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",zp.set(e.uid,C)}p.type=C?"eip1559":"legacy"}if(u.includes("fees"))if(p.type!=="legacy"&&p.type!=="eip2930"){if(typeof p.maxFeePerGas>"u"||typeof p.maxPriorityFeePerGas>"u"){const C=await h(),{maxFeePerGas:b,maxPriorityFeePerGas:$}=await nc(e,{block:C,chain:o,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<$)throw new a2({maxPriorityFeePerGas:$});p.maxPriorityFeePerGas=$,p.maxFeePerGas=b}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new ec;if(typeof t.gasPrice>"u"){const C=await h(),{gasPrice:b}=await nc(e,{block:C,chain:o,request:p,type:"legacy"});p.gasPrice=b}}return u.includes("gas")&&typeof s>"u"&&(p.gas=await J(e,oc,"estimateGas")({...p,account:f&&{address:f.address,type:"json-rpc"}})),Eo(p),delete p.parameters,p}async function Hp(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?Q(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function oc(e,t){var o,s,i;const{account:n=e.account}=t,r=n?St(n):void 0;try{let E=function(T){const{block:O,request:y,rpcStateOverride:L}=T;return e.request({method:"eth_estimateGas",params:L?[y,O??e.experimental_blockTag??"latest",L]:O?[y,O]:[y]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:f,blockTag:p,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:C,maxPriorityFeePerGas:b,nonce:$,value:B,stateOverride:k,...D}=await Wp(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?Q(f):void 0)||p,w=Ja(k),A=await(async()=>{if(D.to)return D.to;if(a&&a.length>0)return await JE({authorization:a[0]}).catch(()=>{throw new H("`to` is required. Could not infer from `authorizationList`")})})();Eo(t);const I=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,P=(I||Is)({...Qa(D,{format:I}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:C,maxPriorityFeePerGas:b,nonce:$,to:A,value:B});let x=BigInt(await E({block:g,request:P,rpcStateOverride:w}));if(a){const T=await Hp(e,{address:P.from}),O=await Promise.all(a.map(async y=>{const{address:L}=y,F=await E({block:g,request:{authorizationList:void 0,data:d,from:r==null?void 0:r.address,to:L,value:Q(T)},rpcStateOverride:w}).catch(()=>100000n);return 2n*BigInt(F)}));x+=O.reduce((y,L)=>y+L,0n)}return x}catch(c){throw t2(c,{...t,account:r,chain:e.chain})}}async function T2(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Rt({abi:n,args:o,functionName:s});try{return await J(e,oc,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?St(c.account):void 0;throw hr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function Ms(e,t){if(!ct(e,{strict:!1}))throw new yn({address:e});if(!ct(t,{strict:!1}))throw new yn({address:t});return e.toLowerCase()===t.toLowerCase()}const Vp="/docs/contract/decodeEventLog";function sc(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new bx({docsPath:Vp});const a=t.find(m=>m.type==="event"&&i===Ss(yt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Td(i,{docsPath:Vp});const{name:u,inputs:l}=a,f=l==null?void 0:l.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=l.map((m,v)=>[m,v]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[v,C]=d[m],b=c[m];if(!b)throw new ys({abiItem:a,param:v});p[f?C:v.name||C]=C2({param:v,value:b})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Qr(h,n);if(m)if(f)for(let v=0;v<l.length;v++)p[v]=p[v]??m.shift();else for(let v=0;v<h.length;v++)p[h[v].name]=m[v]}catch(m){if(s)throw m instanceof Pd||m instanceof dp?new Gr({abiItem:a,data:n,params:h,size:we(n)}):m}else if(s)throw new Gr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(p).length>0?p:void 0}}function C2({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Qr([e],t)||[])[0]}function ic(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var c;try{const a=t.find(l=>l.type==="event"&&i.topics[0]===Ss(l));if(!a)return null;const u=sc({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!O2({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof Td)return null;if(a instanceof Gr||a instanceof ys){if(o)return null;u=a.abiItem.name,l=(c=a.abiItem.inputs)==null?void 0:c.some(f=>!("name"in f&&f.name))}return{...i,args:l?[]:{},eventName:u}}}).filter(Boolean)}function O2(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?Ms(i,c):s.type==="string"||s.type==="bytes"?Ne(or(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(u=>o(c,u,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const c=n.find(u=>u.name===s);return c?(Array.isArray(i)?i:[i]).some(u=>o(c,u,t[s])):!1}):!1}function tn(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function ac(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const u=a??!1,l=i??(s?[s]:void 0);let f=[];l&&(f=[l.flatMap(m=>Xr({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"?Q(r):r,toBlock:typeof o=="bigint"?Q(o):o}]});const d=p.map(h=>tn(h));return l?ic({abi:l,args:c,logs:d,strict:u}):d}async function Gp(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?Ln({abi:n,name:i}):void 0,f=l?void 0:n.filter(p=>p.type==="event");return J(e,ac,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const cc="/docs/contract/decodeFunctionResult";function Dn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Ln({abi:t,args:n,name:r});if(!c)throw new nr(r,{docsPath:cc});s=c}if(s.type!=="function")throw new nr(void 0,{docsPath:cc});if(!s.outputs)throw new Od(s.name,{docsPath:cc});const i=Qr(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 uc=BigInt(0),lc=BigInt(1);function Ls(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function jn(e,t,n=""){const r=ws(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",a=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return e}function Bs(e){const t=e.toString(16);return t.length&1?"0"+t:t}function qp(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?uc:BigInt("0x"+e)}function ks(e){return qp(cr(e))}function Zp(e){return Xt(e),qp(cr(Uint8Array.from(e).reverse()))}function fc(e,t){return xs(e.toString(16).padStart(t*2,"0"))}function Kp(e,t){return fc(e,t).reverse()}function We(e,t,n){let r;if(typeof t=="string")try{r=xs(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(ws(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const dc=e=>typeof e=="bigint"&&uc<=e;function N2(e,t,n){return dc(e)&&dc(t)&&dc(n)&&t<=e&&e<n}function I2(e,t,n,r){if(!N2(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Yp(e){let t;for(t=0;e>uc;e>>=lc,t+=1);return t}const So=e=>(lc<<BigInt(e))-lc;function M2(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=d=>new Uint8Array(d),o=d=>Uint8Array.of(d);let s=r(e),i=r(e),c=0;const a=()=>{s.fill(1),i.fill(0),c=0},u=(...d)=>n(i,s,...d),l=(d=r(0))=>{i=u(o(0),d),s=u(),d.length!==0&&(i=u(o(1),d),s=u())},f=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){s=u();const m=s.slice();h.push(m),d+=s.length}return bn(...h)};return(d,h)=>{a(),l(d);let m;for(;!(m=h(f()));)l();return a(),m}}function pc(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,i){const c=e[o];if(i&&c===void 0)return;const a=typeof c;if(a!==s||c===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${a}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}function Xp(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 L2="0.1.1";function B2(){return L2}class be extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof be){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof be&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
158
+ `);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@${B2()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return Qp(this,t)}}function Qp(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Qp(e.cause,t):t?null:e}const k2="#__bigint";function R2(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+k2:o,n)}function F2(e,t){if(th(e)>t)throw new q2({givenSize:th(e),maxSize:t})}const nn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Jp(e){if(e>=nn.zero&&e<=nn.nine)return e-nn.zero;if(e>=nn.A&&e<=nn.F)return e-(nn.A-10);if(e>=nn.a&&e<=nn.f)return e-(nn.a-10)}function D2(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Z2({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 hc(e,t){if(ut(e)>t)throw new J2({givenSize:ut(e),maxSize:t})}function j2(e,t){if(typeof t=="number"&&t>0&&t>ut(e)-1)throw new ah({offset:t,position:"start",size:ut(e)})}function _2(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ut(e)!==n-t)throw new ah({offset:n,position:"end",size:ut(e)})}function eh(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 e6({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const U2=new TextEncoder;function z2(e){return e instanceof Uint8Array?e:typeof e=="string"?H2(e):W2(e)}function W2(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function H2(e,t={}){const{size:n}=t;let r=e;n&&(hc(e,n),r=Un(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const u=Jp(o.charCodeAt(a++)),l=Jp(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new be(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=u*16+l}return i}function V2(e,t={}){const{size:n}=t,r=U2.encode(e);return typeof n=="number"?(F2(r,n),G2(r,n)):r}function G2(e,t){return D2(e,{dir:"right",size:t})}function th(e){return e.length}let q2=class extends be{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Z2=class extends be{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const K2=new TextEncoder,Y2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function X2(e,t={}){const{strict:n=!1}=t;if(!e)throw new sh(e);if(typeof e!="string")throw new sh(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new ih(e);if(!e.startsWith("0x"))throw new ih(e)}function Dt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function nh(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(hc(n,t.size),_n(n,t.size)):n}function rh(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Y2[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(hc(r,t.size),Un(r,t.size)):r}function Re(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const u=typeof e=="bigint"?"n":"";throw new oh({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${e}${u}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?_n(a,r):a}function mc(e,t={}){return rh(K2.encode(e),t)}function _n(e,t){return eh(e,{dir:"left",size:t})}function Un(e,t){return eh(e,{dir:"right",size:t})}function gc(e,t,n,r={}){const{strict:o}=r;j2(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&_2(s,t,n),s}function ut(e){return Math.ceil((e.length-2)/2)}function Q2(e,t={}){const{strict:n=!1}=t;try{return X2(e,{strict:n}),!0}catch{return!1}}class oh extends be{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class sh extends be{constructor(t){super(`Value \`${typeof t=="object"?R2(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 ih extends be{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class J2 extends be{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class ah extends be{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class e6 extends be{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function t6(e){return{address:e.address,amount:Re(e.amount),index:Re(e.index),validatorIndex:Re(e.validatorIndex)}}function ch(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Re(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Re(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Re(e.gasLimit)},...typeof e.number=="bigint"&&{number:Re(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Re(e.prevRandao)},...typeof e.time=="bigint"&&{time:Re(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(t6)}}}const bc=[{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"}],yc=[{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"}]}],uh=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],lh=[...uh,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],n6=[...uh,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],fh=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],dh=[{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"}]}],ph=[{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"}],r6=[{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"}]}],o6="0x82ad56cb",hh="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",s6="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",i6="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class vc extends H{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class mh extends H{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const wc="/docs/contract/encodeDeployData";function xc(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 dx({docsPath:wc});if(!("inputs"in o))throw new Sd({docsPath:wc});if(!o.inputs||o.inputs.length===0)throw new Sd({docsPath:wc});const s=Jt(o.inputs,n);return ur([r,s])}function gr({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 vc({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new vc({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function gh(e,{docsPath:t,...n}){const r=(()=>{const o=Xa(e,n);return o instanceof Ns?e:o})();return new xp(r,{docsPath:t,...n})}function bh(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Ec=new Map;function yh({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const f=l.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<l.length;d++){const{resolve:h}=l[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<l.length;d++){const{reject:h}=l[d];h==null||h(p)}})},i=()=>Ec.delete(t),c=()=>a().map(({args:l})=>l),a=()=>Ec.get(t)||[],u=l=>Ec.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:p,reject:d}=bh();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:p,reject:d}),f):(u({args:l,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Po(e,t){var P,E,x,T;const{account:n=e.account,authorizationList:r,batch:o=!!((P=e.batch)!=null&&P.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:u,code:l,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:C,maxPriorityFeePerGas:b,nonce:$,to:B,value:k,stateOverride:D,...j}=t,g=n?St(n):void 0;if(l&&(p||d))throw new H("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&B)throw new H("Cannot provide both `code` & `to` as parameters.");const w=l&&f,A=p&&d&&B&&f,I=w||A,N=w?u6({code:l,data:f}):A?l6({data:f,factory:p,factoryData:d,to:B}):f;try{Eo(t);const y=(typeof s=="bigint"?Q(s):void 0)||i,L=u?ch(u):void 0,F=Ja(D),U=(T=(x=(E=e.chain)==null?void 0:E.formatters)==null?void 0:x.transactionRequest)==null?void 0:T.format,V=(U||Is)({...Qa(j,{format:U}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:N,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:C,maxPriorityFeePerGas:b,nonce:$,to:I?void 0:B,value:k});if(o&&a6({request:V})&&!F&&!L)try{return await c6(e,{...V,blockNumber:s,blockTag:i})}catch(K){if(!(K instanceof mh)&&!(K instanceof vc))throw K}const Z=(()=>{const K=[V,y];return F&&L?[...K,F,L]:F?[...K,F]:L?[...K,{},L]:K})(),W=await e.request({method:"eth_call",params:Z});return W==="0x"?{data:void 0}:{data:W}}catch(O){const y=f6(O),{offchainLookup:L,offchainLookupSignature:F}=await Promise.resolve().then(()=>h5);if(e.ccipRead!==!1&&(y==null?void 0:y.slice(0,10))===F&&B)return{data:await L(e,{data:y,to:B})};throw I&&(y==null?void 0:y.slice(0,10))==="0x101bb98d"?new WE({factory:p}):gh(O,{...t,account:g,chain:e.chain})}}function a6({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(o6)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function c6(e,t){var m;const{batchSize:n=1024,wait:r=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:i,multicallAddress:c,to:a}=t;let u=c;if(!u){if(!e.chain)throw new mh;u=gr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?Q(o):void 0)||s,{schedule:p}=yh({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(v){return v.reduce((b,{data:$})=>b+($.length-2),0)>n*2},fn:async v=>{const C=v.map(B=>({allowFailure:!0,callData:B.data,target:B.to})),b=Rt({abi:bc,args:[C],functionName:"aggregate3"}),$=await e.request({method:"eth_call",params:[{data:b,to:u},f]});return Dn({abi:bc,args:[C],functionName:"aggregate3",data:$||"0x"})}}),[{returnData:d,success:h}]=await p({data:i,to:a});if(!h)throw new Ts({data:d});return d==="0x"?{data:void 0}:{data:d}}function u6(e){const{code:t,data:n}=e;return xc({abi:vd(["constructor(bytes, bytes)"]),bytecode:hh,args:[t,n]})}function l6(e){const{data:t,factory:n,factoryData:r,to:o}=e;return xc({abi:vd(["constructor(address, bytes, address, bytes)"]),bytecode:s6,args:[o,t,n,r]})}function f6(e){var n;if(!(e instanceof H))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function rn(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Rt({abi:n,args:o,functionName:s});try{const{data:a}=await J(e,Po,"call")({...i,data:c,to:r});return Dn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw hr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function d6(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?St(c.account):e.account,u=Rt({abi:n,args:o,functionName:i});try{const{data:l}=await J(e,Po,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Dn({abi:n,args:o,functionName:i,data:l||"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(l){throw hr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const Sc=new Map,vh=new Map;let p6=0;function xn(e,t,n){const r=++p6,o=()=>Sc.get(e)||[],s=()=>{const l=o();Sc.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(p=>p.id===r))return;const f=vh.get(e);if(l.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(Sc.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[l])==null||h.call(d,...f)};const u=n(a);return typeof u=="function"&&vh.set(e,u),i}async function Pc(e){return new Promise(t=>setTimeout(t,e))}function $o(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await Pc(a);const u=async()=>{o&&(await e({unpoll:s}),await Pc(r),u())};u()})(),s}const h6=new Map,m6=new Map;function g6(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,h6),r=t(e,m6);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function b6(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=g6(t),o=r.response.get();if(o&&n>0&&new Date().getTime()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const y6=e=>`blockNumber.${e}`;async function Ao(e,{cacheTime:t=e.cacheTime}={}){const n=await b6(()=>e.request({method:"eth_blockNumber"}),{cacheKey:y6(e.uid),cacheTime:t});return BigInt(n)}async function Rs(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>tn(s));return!("abi"in t)||!t.abi?o:ic({abi:t.abi,logs:o,strict:n})}async function Fs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function v6(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:u,poll:l,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof l<"u"?l:typeof c=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const v=p??!1,C=Ae(["watchContractEvent",r,o,s,e.uid,i,f,v,c]);return xn(C,{onLogs:u,onError:a},b=>{let $;c!==void 0&&($=c-1n);let B,k=!1;const D=$o(async()=>{var j;if(!k){try{B=await J(e,ap,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:v,fromBlock:c})}catch{}k=!0;return}try{let g;if(B)g=await J(e,Rs,"getFilterChanges")({filter:B});else{const w=await J(e,Ao,"getBlockNumber")({});$&&$<w?g=await J(e,Gp,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:$+1n,toBlock:w,strict:v}):g=[],$=w}if(g.length===0)return;if(s)b.onLogs(g);else for(const w of g)b.onLogs([w])}catch(g){B&&g instanceof Rn&&(k=!1),(j=b.onError)==null||j.call(b,g)}},{emitOnBegin:!0,interval:f});return async()=>{B&&await J(e,Fs,"uninstallFilter")({filter:B}),D()}})})():(()=>{const v=p??!1,C=Ae(["watchContractEvent",r,o,s,e.uid,i,f,v]);let b=!0,$=()=>b=!1;return xn(C,{onLogs:u,onError:a},B=>((async()=>{try{const k=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),D=i?Xr({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await k.subscribe({params:["logs",{address:r,topics:D}],onData(g){var A;if(!b)return;const w=g.result;try{const{eventName:I,args:N}=sc({abi:n,data:w.data,topics:w.topics,strict:p}),P=tn(w,{args:N,eventName:I});B.onLogs([P])}catch(I){let N,P;if(I instanceof Gr||I instanceof ys){if(p)return;N=I.abiItem.name,P=(A=I.abiItem.inputs)==null?void 0:A.some(x=>!("name"in x&&x.name))}const E=tn(w,{args:P?[]:{},eventName:N});B.onLogs([E])}},onError(g){var w;(w=B.onError)==null||w.call(B,g)}});$=j,b||$()}catch(k){a==null||a(k)}})(),()=>$()))})()}async function w6(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function $c(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:u})=>{const l=typeof t=="function"?t({count:c,error:u}):t;l&&await Pc(l),i({count:c+1})};try{const u=await e();o(u)}catch(u){if(c<n&&await r({count:c,error:u}))return a({error:u});s(u)}};i()})}const x6={"0x0":"reverted","0x1":"success"};function E6(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(n=>tn(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Zt(e.transactionIndex):null,status:e.status?x6[e.status]:null,type:e.type?Op[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const Ac=256;let Ds=Ac,js;function wh(e=11){if(!js||Ds+e>Ac*2){js="",Ds=0;for(let t=0;t<Ac;t++)js+=(256+Math.random()*256|0).toString(16).substring(1)}return js.substring(Ds,Ds+++e)}function S6(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(a/2),500),4e3),l=e.pollingInterval??u,f=e.cacheTime??l,p=e.account?St(e.account):void 0,{config:d,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),v={...d,...m},C={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:v,type:i,uid:wh(),...c?{experimental_blockTag:c}:{}};function b($){return B=>{const k=B($);for(const j in C)delete k[j];const D={...$,...k};return Object.assign(D,{extend:b(D)})}}return Object.assign(C,{extend:b(C)})}const _s=new Ma(8192);function P6(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(_s.get(n))return _s.get(n);const r=e().finally(()=>_s.delete(n));return _s.set(n,r),r}function $6(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:u}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(u))throw new Fn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Fn(new Error("method not supported"),{method:u});const l=o?qr(`${a}.${Ae(n)}`):void 0;return P6(()=>$c(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case to.code:throw new to(d);case no.code:throw new no(d);case ro.code:throw new ro(d,{method:n.method});case oo.code:throw new oo(d);case kn.code:throw new kn(d);case Rn.code:throw new Rn(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case Fn.code:throw new Fn(d,{method:n.method});case dr.code:throw new dr(d);case co.code:throw new co(d);case pr.code:throw new pr(d);case uo.code:throw new uo(d);case lo.code:throw new lo(d);case fo.code:throw new fo(d);case po.code:throw new po(d);case ho.code:throw new ho(d);case mo.code:throw new mo(d);case go.code:throw new go(d);case bo.code:throw new bo(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 5e3:throw new pr(d);default:throw p instanceof H?p:new VE(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Bn){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)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>A6(p)}),{enabled:o,id:l})}}function A6(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===dr.code||e.code===kn.code:e instanceof Bn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function T6({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=wh();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:$6(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class C6 extends H{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function O6(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 N6(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const xh=N6();function I6(e,t={}){return{async request(n){var f;const{body:r,onRequest:o=t.onRequest,onResponse:s=t.onResponse,timeout:i=t.timeout??1e4}=n,c={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:a,method:u,signal:l}=c;try{const p=await O6(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Ae(r.map($=>({jsonrpc:"2.0",id:$.id??xh.take(),...$}))):Ae({jsonrpc:"2.0",id:r.id??xh.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},v=new Request(e,m),C=await(o==null?void 0:o(v,m))??{...m,url:e};return await fetch(C.url??e,C)},{errorInstance:new Ep({body:r,url:e}),timeout:i,signal:!0});s&&await s(p);let d;if((f=p.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))d=await p.json();else{d=await p.text();try{d=JSON.parse(d||"{}")}catch(h){if(p.ok)throw h;d={error:d}}}if(!p.ok)throw new Bn({body:r,details:Ae(d.error)||p.statusText,headers:p.headers,status:p.status,url:e});return d}catch(p){throw p instanceof Bn||p instanceof Ep?p:new Bn({body:r,cause:p,url:e})}}}}function M6(e,t={}){const{batch:n,fetchOptions:r,key:o="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:a,retryDelay:u,raw:l}=t;return({chain:f,retryCount:p,timeout:d})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},v=t.retryCount??p,C=d??t.timeout??1e4,b=f==null?void 0:f.rpcUrls.default.http[0];if(!b)throw new C6;const $=I6(b,{fetchOptions:r,onRequest:c,onResponse:a,timeout:C});return T6({key:o,methods:s,name:i,async request({method:B,params:k}){const D={method:B,params:k},{schedule:j}=yh({id:b,wait:m,shouldSplitBatch(I){return I.length>h},fn:I=>$.request({body:I}),sort:(I,N)=>I.id-N.id}),g=async I=>n?j(I):[await $.request({body:I})],[{error:w,result:A}]=await g(D);if(l)return{error:w,result:A};if(w)throw new za({body:D,error:w,url:b});return A},retryCount:v,retryDelay:u,timeout:C,type:"http"},{fetchOptions:r,url:b})}}function Tc(e,t){var r,o,s,i,c,a;if(!(e instanceof H))return!1;const n=e.walk(u=>u instanceof Ua);return n instanceof Ua?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((o=n.data)==null?void 0:o.errorName)==="ResolverWildcardNotSupported"||((s=n.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=n.data)==null?void 0:i.errorName)==="ResolverError"||((c=n.data)==null?void 0:c.errorName)==="HttpError"||(a=n.reason)!=null&&a.includes("Wildcard on non-extended resolvers is not supported")||t==="reverse"&&n.reason===up[50]):!1}function L6(e){const{abi:t,data:n}=e,r=lr(n,0,4),o=t.find(s=>s.type==="function"&&r===Yr(yt(s)));if(!o)throw new yx(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Qr(o.inputs,lr(n,4)):void 0}}const Cc="/docs/contract/encodeErrorResult";function Eh(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Ln({abi:t,args:r,name:n});if(!a)throw new $d(n,{docsPath:Cc});o=a}if(o.type!=="error")throw new $d(void 0,{docsPath:Cc});const s=yt(o),i=Yr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new gx(o.name,{docsPath:Cc});c=Jt(o.inputs,r)}return ur([i,c])}const Oc="/docs/contract/encodeFunctionResult";function B6(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Ln({abi:t,name:n});if(!i)throw new nr(n,{docsPath:Oc});o=i}if(o.type!=="function")throw new nr(void 0,{docsPath:Oc});if(!o.outputs)throw new Od(o.name,{docsPath:Oc});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Nd(r)})();return Jt(o.outputs,s)}const Us="x-batch-gateway:true";async function Sh(e){const{data:t,ccipRequest:n}=e,{args:[r]}=L6({abi:yc,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(Us)?await Sh({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=k6(a)}})),B6({abi:yc,functionName:"query",result:[o,s]})}function k6(e){return e.name==="HttpRequestError"&&e.status?Eh({abi:yc,errorName:"HttpError",args:[e.status,e.shortMessage]}):Eh({abi:[lp],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Ph(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return vt(t)?t:null}function zs(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=Ph(n[r]),s=o?or(o):Ne(Mn(n[r]),"bytes");t=Ne(Et([t,s]),"bytes")}return $e(t)}function R6(e){return`[${e.slice(2)}]`}function F6(e){const t=new Uint8Array(32).fill(0);return e?Ph(e)||Ne(Mn(e)):$e(t)}function Ws(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Mn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Mn(o[s]);i.byteLength>255&&(i=Mn(R6(F6(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 D6(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return gr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f=Rt({abi:dh,functionName:"addr",...o!=null?{args:[zs(s),BigInt(o)]}:{args:[zs(s)]}}),p={address:u,abi:lh,functionName:"resolve",args:[Kt(Ws(s)),f,i??[Us]],blockNumber:n,blockTag:r},h=await J(e,rn,"readContract")(p);if(h[0]==="0x")return null;const m=Dn({abi:dh,args:o!=null?[zs(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||In(m)==="0x00"?null:m}catch(f){if(c)throw f;if(Tc(f,"resolve"))return null;throw f}}class j6 extends H{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class To extends H{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Nc extends H{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class _6 extends H{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const U6=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,z6=/^(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>\/.*)?$/,W6=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,H6=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function V6(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function $h(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Ah({uri:e,gatewayUrls:t}){const n=W6.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=$h(t==null?void 0:t.ipfs,"https://ipfs.io"),o=$h(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(U6),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||z6.test(e);if(e.startsWith("http")&&!l&&!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((l||f)&&a)return{uri:`${r}/${l?"ipns":"ipfs"}/${a}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${u||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(H6,"");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 Nc({uri:e})}function Th(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new j6({data:e});return e.image||e.image_url||e.image_data}async function G6({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Ic({gatewayUrls:e,uri:Th(n)})}catch{throw new Nc({uri:t})}}async function Ic({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Ah({uri:t,gatewayUrls:e});if(r||await V6(n))return n;throw new Nc({uri:t})}function q6(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 To({reason:"Only EIP-155 supported"});if(!i)throw new To({reason:"Chain ID not found"});if(!a)throw new To({reason:"Contract address not found"});if(!o)throw new To({reason:"Token ID not found"});if(!c)throw new To({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function Z6(e,{nft:t}){if(t.namespace==="erc721")return rn(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return rn(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new _6({namespace:t.namespace})}async function K6(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Y6(e,{gatewayUrls:t,record:n}):Ic({uri:n,gatewayUrls:t})}async function Y6(e,{gatewayUrls:t,record:n}){const r=q6(n),o=await Z6(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Ah({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=c?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return Ic({uri:Th(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),G6({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Ch(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return gr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f={address:u,abi:lh,functionName:"resolve",args:[Kt(Ws(s)),Rt({abi:fh,functionName:"text",args:[zs(s),o]}),i??[Us]],blockNumber:n,blockTag:r},d=await J(e,rn,"readContract")(f);if(d[0]==="0x")return null;const h=Dn({abi:fh,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(Tc(f,"resolve"))return null;throw f}}async function X6(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await J(e,Ch,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await K6(e,{record:a,gatewayUrls:r})}catch{return null}}async function Q6(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:s,universalResolverAddress:i}){let c=i;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=gr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:n6,functionName:"reverse",args:[Kt(Ws(a))],blockNumber:n,blockTag:r},l=J(e,rn,"readContract"),[f,p]=o?await l({...u,args:[...u.args,o]}):await l(u);return t.toLowerCase()!==p.toLowerCase()?null:f}catch(u){if(s)throw u;if(Tc(u,"reverse"))return null;throw u}}async function J6(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 gr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await J(e,rn,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Kt(Ws(o))],blockNumber:n,blockTag:r});return a}async function Oh(e,t){var v,C,b;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?St(n):void 0;try{Eo(t);const B=(typeof r=="bigint"?Q(r):void 0)||o,k=(b=(C=(v=e.chain)==null?void 0:v.formatters)==null?void 0:C.transactionRequest)==null?void 0:b.format,j=(k||Is)({...Qa(h,{format:k}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d}),g=await e.request({method:"eth_createAccessList",params:[j,B]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch($){throw gh($,{...t,account:m,chain:e.chain})}}async function e5(e){const t=$s(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Nh(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=$s(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(d=>Xr({abi:[d],eventName:d.name,args:n}))],r&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?Q(s):s,toBlock:typeof c=="bigint"?Q(c):c,...l.length?{topics:l}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:u(f),strict:!!i,toBlock:c,type:"event"}}async function Ih(e){const t=$s(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function t5(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function n5(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?Q(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),Zt(s)}async function Mh(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?Q(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class r5 extends H{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function o5(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await J(e,rn,"readContract")({abi:s5,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:u,salt:l},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new r5({address:n}):i}}const s5=[{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 i5(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 a5(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?Q(n):void 0,i=await e.request({method:"eth_feeHistory",params:[Q(t),s||r,o]},{dedupe:!!s});return i5(i)}async function c5(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>tn(s));return t.abi?ic({abi:t.abi,logs:o,strict:n}):o}class u5 extends H{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${eo(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class l5 extends H{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${eo(n)}`,`Response: ${Ae(t)}`],name:"OffchainLookupResponseMalformedError"})}}class f5 extends H{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const d5="0x556f1830",Lh={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 p5(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=hp({data:r,abi:[Lh]}),[i,c,a,u,l]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Bh;try{if(!Ms(o,i))throw new f5({sender:i,to:o});const d=c.includes(Us)?await Sh({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await Po(e,{blockNumber:t,blockTag:n,data:Et([u,Jt([{type:"bytes"},{type:"bytes"}],[d,l])]),to:o});return h}catch(d){throw new u5({callbackSelector:u,cause:d,data:r,extraData:l,sender:i,urls:c})}}async function Bh({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,u=c==="POST"?{"Content-Type":"application/json"}:{};try{const l=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:u,method:c});let f;if((o=l.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await l.json()).data:f=await l.text(),!l.ok){r=new Bn({body:a,details:f!=null&&f.error?Ae(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!vt(f)){r=new l5({result:f,url:i});continue}return f}catch(l){r=new Bn({body:a,details:l.message,url:i})}}throw r}const h5=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Bh,offchainLookup:p5,offchainLookupAbiItem:Lh,offchainLookupSignature:d5},Symbol.toStringTag,{value:"Module"}));function m5(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class g5 extends H{constructor({domain:t}){super(`Invalid domain "${Ae(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class b5 extends H{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class y5 extends H{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function v5(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:P5({domain:t}),...e.types};S5({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(w5({domain:t,types:o})),r!=="EIP712Domain"&&s.push(kh({data:n,primaryType:r,types:o})),Ne(Et(s))}function w5({domain:e,types:t}){return kh({data:e,primaryType:"EIP712Domain",types:t})}function kh({data:e,primaryType:t,types:n}){const r=Rh({data:e,primaryType:t,types:n});return Ne(r)}function Rh({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[x5({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Dh({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Jt(r,o)}function x5({primaryType:e,types:t}){const n=Kt(E5({primaryType:e,types:t}));return Ne(n)}function E5({primaryType:e,types:t}){let n="";const r=Fh({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 Fh({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])Fh({primaryType:s.type,types:t},n);return n}function Dh({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ne(Rh({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Ne(r)];if(n==="string")return[{type:"bytes32"},Ne(Kt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Dh({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ne(Jt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function S5(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:u,type:l}=a,f=c[u],p=l.match(rp);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,v,C]=p;Q(f,{signed:v==="int",size:Number.parseInt(C)/8})}if(l==="address"&&typeof f=="string"&&!ct(f))throw new yn({address:f});const d=l.match(uE);if(d){const[m,v]=d;if(v&&we(f)!==Number.parseInt(v))throw new wx({expectedSize:Number.parseInt(v),givenSize:we(f)})}const h=o[l];h&&($5(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new g5({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new b5({primaryType:r,types:o})}function P5({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 $5(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new y5({type:e})}const A5=`Ethereum Signed Message:
159
+ `;function T5(e){const t=typeof e=="string"?qr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=qr(`${A5}${we(t)}`);return Et([n,t])}function jh(e,t){return Ne(T5(e),t)}const _h="0x6492649264926492649264926492649264926492649264926492649264926492";function C5(e){return np(e,-32)===_h}function O5(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=ur([Jt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),_h]);return o==="hex"?s:xt(s)}function N5(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function I5(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Zt(e.nonce):void 0,storageProof:e.storageProof?N5(e.storageProof):void 0}}async function M5(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?Q(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return I5(c)}async function L5(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?Q(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Mc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,f,p;const i=r||"latest",c=n!==void 0?Q(n):void 0;let a=null;if(o?a=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?a=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Q(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,Q(s)]},{dedupe:!!c}),!a)throw new vp({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((p=(f=(l=e.chain)==null?void 0:l.formatters)==null?void 0:f.transaction)==null?void 0:p.format)||Np)(a)}async function B5(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([J(e,Ao,"getBlockNumber")({}),t?J(e,Mc,"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 Hs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new wp({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||E6)(n)}async function k5(e,t){var C;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof((C=e.batch)==null?void 0:C.multicall)=="object"&&e.batch.multicall.batchSize||1024);let f=c;if(!f){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");f=gr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const p=[[]];let d=0,h=0;for(let b=0;b<u.length;b++){const{abi:$,address:B,args:k,functionName:D}=u[b];try{const j=Rt({abi:$,args:k,functionName:D});h+=(j.length-2)/2,l>0&&h>l&&p[d].length>0&&(d++,h=(j.length-2)/2,p[d]=[]),p[d]=[...p[d],{allowFailure:!0,callData:j,target:B}]}catch(j){const g=hr(j,{abi:$,address:B,args:k,docsPath:"/docs/contract/multicall",functionName:D,sender:n});if(!r)throw g;p[d]=[...p[d],{allowFailure:!0,callData:"0x",target:B}]}}const m=await Promise.allSettled(p.map(b=>J(e,rn,"readContract")({abi:bc,account:n,address:f,args:[b],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),v=[];for(let b=0;b<m.length;b++){const $=m[b];if($.status==="rejected"){if(!r)throw $.reason;for(let k=0;k<p[b].length;k++)v.push({status:"failure",error:$.reason,result:void 0});continue}const B=$.value;for(let k=0;k<B.length;k++){const{returnData:D,success:j}=B[k],{callData:g}=p[b][k],{abi:w,address:A,functionName:I,args:N}=u[v.length];try{if(g==="0x")throw new Vr;if(!j)throw new Ts({data:D});const P=Dn({abi:w,args:N,data:D,functionName:I});v.push(r?{result:P,status:"success"}:P)}catch(P){const E=hr(P,{abi:w,address:A,args:N,docsPath:"/docs/contract/multicall",functionName:I});if(!r)throw E;v.push({error:E,result:void 0,status:"failure"})}}}if(v.length!==u.length)throw new H("multicall results mismatch");return v}async function Lc(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?ch(p.blockOverrides):void 0,h=p.calls.map(v=>{const C=v,b=C.account?St(C.account):void 0,$=C.abi?Rt(C):C.data,B={...C,data:C.dataSuffix?Et([$||"0x",C.dataSuffix]):$,from:C.from??(b==null?void 0:b.address)};return Eo(B),Is(B)}),m=p.stateOverrides?Ja(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?Q(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((p,d)=>({...Ip(p),calls:p.calls.map((h,m)=>{var A,I;const{abi:v,args:C,functionName:b,to:$}=o[d].calls[m],B=((A=h.error)==null?void 0:A.data)??h.returnData,k=BigInt(h.gasUsed),D=(I=h.logs)==null?void 0:I.map(N=>tn(N)),j=h.status==="0x1"?"success":"failure",g=v&&j==="success"&&B!=="0x"?Dn({abi:v,data:B,functionName:b}):null,w=(()=>{var P;if(j==="success")return;let N;if(((P=h.error)==null?void 0:P.data)==="0x"?N=new Vr:h.error&&(N=new Ts(h.error)),!!N)return hr(N,{abi:v??[],address:$??"0x",args:C,functionName:b??"<unknown>"})})();return{data:B,gasUsed:k,logs:D,status:j,...j==="success"?{result:g}:{error:w}}})}))}catch(a){const u=a,l=Xa(u,{});throw l instanceof Ns?u:l}}function Uh(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Xd(z2(e));return n==="Bytes"?r:rh(r)}class R5 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 Bc={checksum:new R5(8192)}.checksum,F5=/^0x[a-fA-F0-9]{40}$/;function Vs(e,t={}){const{strict:n=!0}=t;if(!F5.test(e))throw new zh({address:e,cause:new j5});if(n){if(e.toLowerCase()===e)return;if(D5(e)!==e)throw new zh({address:e,cause:new _5})}}function D5(e){if(Bc.has(e))return Bc.get(e);Vs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Uh(V2(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 Bc.set(e,o),o}function kc(e,t={}){const{strict:n=!0}=t??{};try{return Vs(e,{strict:n}),!0}catch{return!1}}class zh extends be{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class j5 extends be{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class _5 extends be{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function Rc(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new be("Unable to normalize signature.");return o}function Fc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return kc(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)=>Fc(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=>Fc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Wh(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 Wh(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")?kc(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?kc(n[r],{strict:!1}):!1)return i}}function Hh(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?wd(e):e;return{...r,...n?{hash:br(r)}:{}}}function U5(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Q2(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?Vh(u)===gc(t,0,4):u.type==="event"?br(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new Dc({name:t});if(i.length===1)return{...i[0],...o?{hash:br(i[0])}:{}};let c;for(const u of i){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:br(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in u&&u.inputs[p];return d?Fc(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=Wh(u.inputs,c.inputs,r);if(f)throw new W5({abiItem:u,type:f[0]},{abiItem:c,type:f[1]})}c=u}}const a=(()=>{if(c)return c;const[u,...l]=i;return{...u,overloads:l}})();if(!a)throw new Dc({name:t});return{...a,...o?{hash:br(a)}:{}}}function Vh(e){return gc(br(e),0,4)}function z5(e){const t=typeof e=="string"?e:gs(e);return Rc(t)}function br(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:Uh(mc(z5(e)))}class W5 extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Rc(gs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Rc(gs(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 Dc extends be{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}const H5=/^(.*)\[([0-9]*)\]$/,V5=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Gh=/^(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 G5({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(jc({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function jc({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=eS(r.type);if(o){const[s,i]=o;return Z5(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return J5(n,{checksumAddress:e,parameter:r});if(r.type==="address")return q5(n,{checksum:e});if(r.type==="bool")return Y5(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Gh.exec(r.type)??[];return X5(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return K5(n,{type:r.type});if(r.type==="string")return Q5(n);throw new Yh(r.type)}function _c(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=ut(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Re(t+o,{size:32})),r.push(c),o+=ut(c)):n.push(c)}return Dt(...n,...r)}function q5(e,t){const{checksum:n=!1}=t;return Vs(e,{strict:n}),{dynamic:!1,encoded:_n(e.toLowerCase())}}function Z5(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new nS(e);if(!s&&e.length!==r)throw new tS({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=jc({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=_c(c);if(s){const u=Re(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Dt(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Dt(...c.map(({encoded:a})=>a))}}function K5(e,{type:t}){const[,n]=t.split("bytes"),r=ut(e);if(!n){let o=e;return r%32!==0&&(o=Un(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Dt(_n(Re(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new Zh({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Un(e)}}function Y5(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:_n(nh(e))}}function X5(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 oh({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 Q5(e){const t=mc(e),n=Math.ceil(ut(t)/32),r=[];for(let o=0;o<n;o++)r.push(Un(gc(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Dt(Un(Re(ut(t),{size:32})),...r)}}function J5(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,u=jc({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?_c(s):Dt(...s.map(({encoded:i})=>i))}}function eS(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function qh(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Kh({expectedLength:e.length,givenLength:t.length});const o=G5({checksumAddress:r,parameters:e,values:t}),s=_c(o);return s.length===0?"0x":s}function Uc(e,t){if(e.length!==t.length)throw new Kh({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(Uc.encode(o,s))}return Dt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Vs(a),_n(a.toLowerCase(),o?32:0)}if(n==="string")return mc(r);if(n==="bytes")return r;if(n==="bool")return _n(nh(r),o?32:1);const s=n.match(Gh);if(s){const[a,u,l="256"]=s,f=Number.parseInt(l)/8;return Re(r,{size:o?32:f,signed:u==="int"})}const i=n.match(V5);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new Zh({expectedSize:Number.parseInt(u),value:r});return Un(r,o?32:0)}const c=n.match(H5);if(c&&Array.isArray(r)){const[a,u]=c,l=[];for(let f=0;f<r.length;f++)l.push(t(u,r[f],!0));return l.length===0?"0x":Dt(...l)}throw new Yh(n)}e.encode=t})(Uc||(Uc={}));class tS extends be{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class Zh extends be{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 Kh extends be{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
160
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class nS extends be{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class Yh extends be{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function rS(e,t){var o;const{bytecode:n,args:r}=t;return Dt(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?qh(e.inputs,r):"0x")}function oS(e){return Hh(e)}function sS(e,...t){const{overloads:n}=e,r=n?iS([e,...n],e.name,{args:t[0]}):e,o=aS(r),s=t.length>0?qh(r.inputs,t[0]):void 0;return s?Dt(o,s):o}function yr(e,t={}){return Hh(e,t)}function iS(e,t,n){const r=U5(e,t,n);if(r.type!=="function")throw new Dc({name:t,type:"function"});return r}function aS(e){return Vh(e)}const cS="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",jt="0x0000000000000000000000000000000000000000",uS="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function lS(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?St(t.account):void 0;if(i&&!u)throw new H("`account` is required when `traceAssetChanges` is true");const l=u?rS(oS("constructor(bytes, bytes)"),{bytecode:hh,args:[uS,sS(yr("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async y=>{if(!y.data&&!y.abi)return;const{accessList:L}=await Oh(e,{account:u.address,...y,data:y.abi?Rt(y):y.data});return L.map(({address:F,storageKeys:U})=>U.length>0?F:null)})).then(y=>y.flat().filter(Boolean)):[],p=await Lc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((y,L)=>({abi:[yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]}]:[],{calls:[...o,{}].map(y=>({...y,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((y,L)=>({abi:[yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]},{calls:f.map((y,L)=>({to:y,abi:[yr("function decimals() returns (uint256)")],functionName:"decimals",from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]},{calls:f.map((y,L)=>({to:y,abi:[yr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]},{calls:f.map((y,L)=>({to:y,abi:[yr("function symbol() returns (string)")],functionName:"symbol",from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,v,C,b,$,B]=i?p:[],{calls:k,...D}=d,j=k.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],w=(m==null?void 0:m.calls)??[],A=[...g,...w].map(y=>y.status==="success"?Bt(y.data):null),I=(v==null?void 0:v.calls)??[],N=(C==null?void 0:C.calls)??[],P=[...I,...N].map(y=>y.status==="success"?Bt(y.data):null),E=((b==null?void 0:b.calls)??[]).map(y=>y.status==="success"?y.result:null),x=((B==null?void 0:B.calls)??[]).map(y=>y.status==="success"?y.result:null),T=(($==null?void 0:$.calls)??[]).map(y=>y.status==="success"?y.result:null),O=[];for(const[y,L]of P.entries()){const F=A[y];if(typeof L!="bigint"||typeof F!="bigint")continue;const U=E[y-1],z=x[y-1],V=T[y-1],Z=y===0?{address:cS,decimals:18,symbol:"ETH"}:{address:f[y-1],decimals:V||U?Number(U??1):void 0,symbol:z??void 0};O.some(W=>W.token.address===Z.address)||O.push({token:Z,value:{pre:F,post:L,diff:L-F}})}return{assetChanges:O,block:D,results:j}}class Xh extends Na{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Dd(t);const r=Es(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),ar(s)}update(t){return ir(this),this.iHash.update(t),this}digestInto(t){ir(this),Xt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Qh=(e,t,n)=>new Xh(e,t).update(n).digest();Qh.create=(e,t)=>new Xh(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const He=BigInt(0),Fe=BigInt(1),zn=BigInt(2),Jh=BigInt(3),e0=BigInt(4),t0=BigInt(5),fS=BigInt(7),n0=BigInt(8),dS=BigInt(9),r0=BigInt(16);function $t(e,t){const n=e%t;return n>=He?n:t+n}function lt(e,t,n){let r=e;for(;t-- >He;)r*=r,r%=n;return r}function o0(e,t){if(e===He)throw new Error("invert: expected non-zero number");if(t<=He)throw new Error("invert: expected positive modulus, got "+t);let n=$t(e,t),r=t,o=He,s=Fe;for(;n!==He;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Fe)throw new Error("invert: does not exist");return $t(o,t)}function zc(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function s0(e,t){const n=(e.ORDER+Fe)/e0,r=e.pow(t,n);return zc(e,r,t),r}function pS(e,t){const n=(e.ORDER-t0)/n0,r=e.mul(t,zn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,zn),o),c=e.mul(s,e.sub(i,e.ONE));return zc(e,c,t),c}function hS(e){const t=Co(e),n=i0(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+fS)/r0;return(c,a)=>{let u=c.pow(a,i),l=c.mul(u,r);const f=c.mul(u,o),p=c.mul(u,s),d=c.eql(c.sqr(l),a),h=c.eql(c.sqr(f),a);u=c.cmov(u,l,d),l=c.cmov(p,f,h);const m=c.eql(c.sqr(l),a),v=c.cmov(u,l,m);return zc(c,v,a),v}}function i0(e){if(e<Jh)throw new Error("sqrt is not defined for small field");let t=e-Fe,n=0;for(;t%zn===He;)t/=zn,n++;let r=zn;const o=Co(e);for(;c0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return s0;let s=o.pow(r,t);const i=(t+Fe)/zn;return function(a,u){if(a.is0(u))return u;if(c0(a,u)!==1)throw new Error("Cannot find square root");let l=n,f=a.mul(a.ONE,s),p=a.pow(u,t),d=a.pow(u,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===l)throw new Error("Cannot find square root");const v=Fe<<BigInt(l-h-1),C=a.pow(f,v);l=h,f=a.sqr(C),p=a.mul(p,f),d=a.mul(d,C)}return d}}function mS(e){return e%e0===Jh?s0:e%n0===t0?pS:e%r0===dS?hS(e):i0(e)}const gS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function bS(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=gS.reduce((r,o)=>(r[o]="function",r),t);return pc(e,n),e}function yS(e,t,n){if(n<He)throw new Error("invalid exponent, negatives unsupported");if(n===He)return e.ONE;if(n===Fe)return t;let r=e.ONE,o=t;for(;n>He;)n&Fe&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Fe;return r}function a0(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 c0(e,t){const n=(e.ORDER-Fe)/zn,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 u0(e,t){t!==void 0&&Zr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Co(e,t,n=!1,r={}){if(e<=He)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,i=!1,c;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const p=t;p.BITS&&(o=p.BITS),p.sqrt&&(s=p.sqrt),typeof p.isLE=="boolean"&&(n=p.isLE),typeof p.modFromBytes=="boolean"&&(i=p.modFromBytes),c=p.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:u}=u0(e,o);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const f=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:u,MASK:So(a),ZERO:He,ONE:Fe,allowedLengths:c,create:p=>$t(p,e),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return He<=p&&p<e},is0:p=>p===He,isValidNot0:p=>!f.is0(p)&&f.isValid(p),isOdd:p=>(p&Fe)===Fe,neg:p=>$t(-p,e),eql:(p,d)=>p===d,sqr:p=>$t(p*p,e),add:(p,d)=>$t(p+d,e),sub:(p,d)=>$t(p-d,e),mul:(p,d)=>$t(p*d,e),pow:(p,d)=>yS(f,p,d),div:(p,d)=>$t(p*o0(d,e),e),sqrN:p=>p*p,addN:(p,d)=>p+d,subN:(p,d)=>p-d,mulN:(p,d)=>p*d,inv:p=>o0(p,e),sqrt:s||(p=>(l||(l=mS(e)),l(f,p))),toBytes:p=>n?Kp(p,u):fc(p,u),fromBytes:(p,d=!0)=>{if(c){if(!c.includes(p.length)||p.length>u)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+p.length);const m=new Uint8Array(u);m.set(p,n?0:m.length-p.length),p=m}if(p.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+p.length);let h=n?Zp(p):ks(p);if(i&&(h=$t(h,e)),!d&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:p=>a0(f,p),cmov:(p,d,h)=>h?d:p});return Object.freeze(f)}function l0(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function f0(e){const t=l0(e);return t+Math.ceil(t/2)}function vS(e,t,n=!1){const r=e.length,o=l0(t),s=f0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Zp(e):ks(e),c=$t(i,t-Fe)+Fe;return n?Kp(c,o):fc(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vr=BigInt(0),Wn=BigInt(1);function Gs(e,t){const n=t.negate();return e?n:t}function Wc(e,t){const n=a0(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function d0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Hc(e,t){d0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=So(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function p0(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=Wn);const u=t*r,l=u+Math.abs(c)-1,f=c===0,p=c<0,d=t%2!==0;return{nextN:a,offset:l,isZero:f,isNeg:p,isNegF:d,offsetF:u}}function wS(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 xS(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 Vc=new WeakMap,h0=new WeakMap;function Gc(e){return h0.get(e)||1}function m0(e){if(e!==vr)throw new Error("invalid wNAF")}class ES{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>vr;)n&Wn&&(r=r.add(o)),o=o.double(),n>>=Wn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Hc(n,this.bits),s=[];let i=t,c=i;for(let a=0;a<r;a++){c=i,s.push(c);for(let u=1;u<o;u++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE;const i=Hc(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:f,isNegF:p,offsetF:d}=p0(r,c,i);r=a,l?s=s.add(Gs(p,n[d])):o=o.add(Gs(f,n[u]))}return m0(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Hc(t,this.bits);for(let i=0;i<s.windows&&r!==vr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=p0(r,i,s);if(r=c,!u){const f=n[a];o=o.add(l?f.negate():f)}}return m0(r),o}getPrecomputes(t,n,r){let o=Vc.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Vc.set(n,o))),o}cached(t,n,r){const o=Gc(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Gc(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){d0(n,this.bits),h0.set(t,n),Vc.delete(t)}hasCache(t){return Gc(t)!==1}}function SS(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>vr||r>vr;)n&Wn&&(s=s.add(o)),r&Wn&&(i=i.add(o)),o=o.double(),n>>=Wn,r>>=Wn;return{p1:s,p2:i}}function PS(e,t,n,r){wS(n,e),xS(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=Yp(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=So(a),l=new Array(Number(u)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){l.fill(i);for(let m=0;m<s;m++){const v=r[m],C=Number(v>>BigInt(d)&u);l[C]=l[C].add(n[m])}let h=i;for(let m=l.length-1,v=i;m>0;m--)v=v.add(l[m]),h=h.add(v);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function g0(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return bS(t),t}else return Co(e,{isLE:n})}function $S(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const a of["p","n","h"]){const u=t[a];if(!(typeof u=="bigint"&&u>vr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=g0(t.p,n.Fp,r),s=g0(t.n,n.Fn,r),c=["Gx","Gy","a","b"];for(const a of c)if(!o.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const b0=(e,t)=>(e+(e>=0?t:-t)/y0)/t;function AS(e,t,n){const[[r,o],[s,i]]=t,c=b0(i*e,n),a=b0(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const f=u<sn,p=l<sn;f&&(u=-u),p&&(l=-l);const d=So(Math.ceil(Yp(n)/2))+wr;if(u<sn||u>=d||l<sn||l>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:p,k2:l}}function qc(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Zc(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Ls(n.lowS,"lowS"),Ls(n.prehash,"prehash"),n.format!==void 0&&qc(n.format),n}class TS extends Error{constructor(t=""){super(t)}}const on={Err:TS,_tlv:{encode:(e,t)=>{const{Err:n}=on;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=Bs(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Bs(o.length/2|128):"";return Bs(e)+s+o+t},decode(e,t){const{Err:n}=on;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+a);if(u.length!==a)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const l of u)i=i<<8|l;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=on;if(e<sn)throw new t("integer: negative integers are not allowed");let n=Bs(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=on;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ks(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=on,o=We("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:u,l}=r.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=on,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},sn=BigInt(0),wr=BigInt(1),y0=BigInt(2),qs=BigInt(3),CS=BigInt(4);function xr(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=We("private key",t);try{r=e.fromBytes(o)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function OS(e,t={}){const n=$S("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;pc(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:a}=t;if(a&&(!r.is0(s.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=w0(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(N,P,E){const{x,y:T}=P.toAffine(),O=r.toBytes(x);if(Ls(E,"isCompressed"),E){l();const y=!r.isOdd(T);return bn(v0(y),O)}else return bn(Uint8Array.of(4),O,r.toBytes(T))}function p(N){jn(N,void 0,"Point");const{publicKey:P,publicKeyUncompressed:E}=u,x=N.length,T=N[0],O=N.subarray(1);if(x===P&&(T===2||T===3)){const y=r.fromBytes(O);if(!r.isValid(y))throw new Error("bad point: is not on curve, wrong x");const L=m(y);let F;try{F=r.sqrt(L)}catch(V){const Z=V instanceof Error?": "+V.message:"";throw new Error("bad point: is not on curve, sqrt error"+Z)}l();const U=r.isOdd(F);return(T&1)===1!==U&&(F=r.neg(F)),{x:y,y:F}}else if(x===E&&T===4){const y=r.BYTES,L=r.fromBytes(O.subarray(0,y)),F=r.fromBytes(O.subarray(y,y*2));if(!v(L,F))throw new Error("bad point: is not on curve");return{x:L,y:F}}else throw new Error(`bad point: got length ${x}, expected compressed=${P} or uncompressed=${E}`)}const d=t.toBytes||f,h=t.fromBytes||p;function m(N){const P=r.sqr(N),E=r.mul(P,N);return r.add(r.add(E,r.mul(N,s.a)),s.b)}function v(N,P){const E=r.sqr(P),x=m(N);return r.eql(E,x)}if(!v(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const C=r.mul(r.pow(s.a,qs),CS),b=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(C,b)))throw new Error("bad curve params: a or b");function $(N,P,E=!1){if(!r.isValid(P)||E&&r.is0(P))throw new Error(`bad point coordinate ${N}`);return P}function B(N){if(!(N instanceof w))throw new Error("ProjectivePoint expected")}function k(N){if(!a||!a.basises)throw new Error("no endo");return AS(N,a.basises,o.ORDER)}const D=Xp((N,P)=>{const{X:E,Y:x,Z:T}=N;if(r.eql(T,r.ONE))return{x:E,y:x};const O=N.is0();P==null&&(P=O?r.ONE:r.inv(T));const y=r.mul(E,P),L=r.mul(x,P),F=r.mul(T,P);if(O)return{x:r.ZERO,y:r.ZERO};if(!r.eql(F,r.ONE))throw new Error("invZ was invalid");return{x:y,y:L}}),j=Xp(N=>{if(N.is0()){if(t.allowInfinityPoint&&!r.is0(N.Y))return;throw new Error("bad point: ZERO")}const{x:P,y:E}=N.toAffine();if(!r.isValid(P)||!r.isValid(E))throw new Error("bad point: x or y not field elements");if(!v(P,E))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function g(N,P,E,x,T){return E=new w(r.mul(E.X,N),E.Y,E.Z),P=Gs(x,P),E=Gs(T,E),P.add(E)}class w{constructor(P,E,x){this.X=$("x",P),this.Y=$("y",E,!0),this.Z=$("z",x),Object.freeze(this)}static CURVE(){return s}static fromAffine(P){const{x:E,y:x}=P||{};if(!P||!r.isValid(E)||!r.isValid(x))throw new Error("invalid affine point");if(P instanceof w)throw new Error("projective point not allowed");return r.is0(E)&&r.is0(x)?w.ZERO:new w(E,x,r.ONE)}static fromBytes(P){const E=w.fromAffine(h(jn(P,void 0,"point")));return E.assertValidity(),E}static fromHex(P){return w.fromBytes(We("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,E=!0){return I.createCache(this,P),E||this.multiply(qs),this}assertValidity(){j(this)}hasEvenY(){const{y:P}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(P)}equals(P){B(P);const{X:E,Y:x,Z:T}=this,{X:O,Y:y,Z:L}=P,F=r.eql(r.mul(E,L),r.mul(O,T)),U=r.eql(r.mul(x,L),r.mul(y,T));return F&&U}negate(){return new w(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:E}=s,x=r.mul(E,qs),{X:T,Y:O,Z:y}=this;let L=r.ZERO,F=r.ZERO,U=r.ZERO,z=r.mul(T,T),V=r.mul(O,O),Z=r.mul(y,y),W=r.mul(T,O);return W=r.add(W,W),U=r.mul(T,y),U=r.add(U,U),L=r.mul(P,U),F=r.mul(x,Z),F=r.add(L,F),L=r.sub(V,F),F=r.add(V,F),F=r.mul(L,F),L=r.mul(W,L),U=r.mul(x,U),Z=r.mul(P,Z),W=r.sub(z,Z),W=r.mul(P,W),W=r.add(W,U),U=r.add(z,z),z=r.add(U,z),z=r.add(z,Z),z=r.mul(z,W),F=r.add(F,z),Z=r.mul(O,y),Z=r.add(Z,Z),z=r.mul(Z,W),L=r.sub(L,z),U=r.mul(Z,V),U=r.add(U,U),U=r.add(U,U),new w(L,F,U)}add(P){B(P);const{X:E,Y:x,Z:T}=this,{X:O,Y:y,Z:L}=P;let F=r.ZERO,U=r.ZERO,z=r.ZERO;const V=s.a,Z=r.mul(s.b,qs);let W=r.mul(E,O),K=r.mul(x,y),G=r.mul(T,L),X=r.add(E,x),ee=r.add(O,y);X=r.mul(X,ee),ee=r.add(W,K),X=r.sub(X,ee),ee=r.add(E,T);let fe=r.add(O,L);return ee=r.mul(ee,fe),fe=r.add(W,G),ee=r.sub(ee,fe),fe=r.add(x,T),F=r.add(y,L),fe=r.mul(fe,F),F=r.add(K,G),fe=r.sub(fe,F),z=r.mul(V,ee),F=r.mul(Z,G),z=r.add(F,z),F=r.sub(K,z),z=r.add(K,z),U=r.mul(F,z),K=r.add(W,W),K=r.add(K,W),G=r.mul(V,G),ee=r.mul(Z,ee),K=r.add(K,G),G=r.sub(W,G),G=r.mul(V,G),ee=r.add(ee,G),W=r.mul(K,ee),U=r.add(U,W),W=r.mul(fe,ee),F=r.mul(X,F),F=r.sub(F,W),W=r.mul(X,K),z=r.mul(fe,z),z=r.add(z,W),new w(F,U,z)}subtract(P){return this.add(P.negate())}is0(){return this.equals(w.ZERO)}multiply(P){const{endo:E}=t;if(!o.isValidNot0(P))throw new Error("invalid scalar: out of range");let x,T;const O=y=>I.cached(this,y,L=>Wc(w,L));if(E){const{k1neg:y,k1:L,k2neg:F,k2:U}=k(P),{p:z,f:V}=O(L),{p:Z,f:W}=O(U);T=V.add(W),x=g(E.beta,z,Z,y,F)}else{const{p:y,f:L}=O(P);x=y,T=L}return Wc(w,[x,T])[0]}multiplyUnsafe(P){const{endo:E}=t,x=this;if(!o.isValid(P))throw new Error("invalid scalar: out of range");if(P===sn||x.is0())return w.ZERO;if(P===wr)return x;if(I.hasCache(this))return this.multiply(P);if(E){const{k1neg:T,k1:O,k2neg:y,k2:L}=k(P),{p1:F,p2:U}=SS(w,x,O,L);return g(E.beta,F,U,T,y)}else return I.unsafe(x,P)}multiplyAndAddUnsafe(P,E,x){const T=this.multiplyUnsafe(E).add(P.multiplyUnsafe(x));return T.is0()?void 0:T}toAffine(P){return D(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return i===wr?!0:P?P(w,this):I.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:P}=t;return i===wr?this:P?P(w,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(P=!0){return Ls(P,"isCompressed"),this.assertValidity(),d(w,this,P)}toHex(P=!0){return cr(this.toBytes(P))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(P=!0){return this.toBytes(P)}_setWindowSize(P){this.precompute(P)}static normalizeZ(P){return Wc(w,P)}static msm(P,E){return PS(w,o,P,E)}static fromPrivateKey(P){return w.BASE.multiply(xr(o,P))}}w.BASE=new w(s.Gx,s.Gy,r.ONE),w.ZERO=new w(r.ZERO,r.ONE,r.ZERO),w.Fp=r,w.Fn=o;const A=o.BITS,I=new ES(w,t.endo?Math.ceil(A/2):A);return w.BASE.precompute(8),w}function v0(e){return Uint8Array.of(e?2:3)}function w0(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function NS(e,t={}){const{Fn:n}=e,r=t.randomBytes||Hd,o=Object.assign(w0(e.Fp,n),{seed:f0(n.ORDER)});function s(d){try{return!!xr(n,d)}catch{return!1}}function i(d,h){const{publicKey:m,publicKeyUncompressed:v}=o;try{const C=d.length;return h===!0&&C!==m||h===!1&&C!==v?!1:!!e.fromBytes(d)}catch{return!1}}function c(d=r(o.seed)){return vS(jn(d,o.seed,"seed"),n.ORDER)}function a(d,h=!0){return e.BASE.multiply(xr(n,d)).toBytes(h)}function u(d){const h=c(d);return{secretKey:h,publicKey:a(h)}}function l(d){if(typeof d=="bigint")return!1;if(d instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:v}=o;if(n.allowedLengths||h===m)return;const C=We("key",d).length;return C===m||C===v}function f(d,h,m=!0){if(l(d)===!0)throw new Error("first arg must be private key");if(l(h)===!1)throw new Error("second arg must be public key");const v=xr(n,d);return e.fromHex(h).multiply(v).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:f,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:d=>xr(n,d),precompute(d=8,h=e.BASE){return h.precompute(d,!1)}},lengths:o})}function IS(e,t,n={}){Dd(t),pc(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Hd,o=n.hmac||((E,...x)=>Qh(t,E,bn(...x))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d}=NS(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function v(E){const x=c>>wr;return E>x}function C(E,x){if(!i.isValidNot0(x))throw new Error(`invalid signature ${E}: out of range 1..Point.Fn.ORDER`);return x}function b(E,x){qc(x);const T=d.signature,O=x==="compact"?T:x==="recovered"?T+1:void 0;return jn(E,O,`${x} signature`)}class ${constructor(x,T,O){this.r=C("r",x),this.s=C("s",T),O!=null&&(this.recovery=O),Object.freeze(this)}static fromBytes(x,T=m){b(x,T);let O;if(T==="der"){const{r:U,s:z}=on.toSig(jn(x));return new $(U,z)}T==="recovered"&&(O=x[0],T="compact",x=x.subarray(1));const y=i.BYTES,L=x.subarray(0,y),F=x.subarray(y,y*2);return new $(i.fromBytes(L),i.fromBytes(F),O)}static fromHex(x,T){return this.fromBytes(xs(x),T)}addRecoveryBit(x){return new $(this.r,this.s,x)}recoverPublicKey(x){const T=s.ORDER,{r:O,s:y,recovery:L}=this;if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");if(c*y0<T&&L>1)throw new Error("recovery id is ambiguous for h>1 curve");const U=L===2||L===3?O+c:O;if(!s.isValid(U))throw new Error("recovery id 2 or 3 invalid");const z=s.toBytes(U),V=e.fromBytes(bn(v0((L&1)===0),z)),Z=i.inv(U),W=k(We("msgHash",x)),K=i.create(-W*Z),G=i.create(y*Z),X=e.BASE.multiplyUnsafe(K).add(V.multiplyUnsafe(G));if(X.is0())throw new Error("point at infinify");return X.assertValidity(),X}hasHighS(){return v(this.s)}toBytes(x=m){if(qc(x),x==="der")return xs(on.hexFromSig(this));const T=i.toBytes(this.r),O=i.toBytes(this.s);if(x==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return bn(Uint8Array.of(this.recovery),T,O)}return bn(T,O)}toHex(x){return cr(this.toBytes(x))}assertValidity(){}static fromCompact(x){return $.fromBytes(We("sig",x),"compact")}static fromDER(x){return $.fromBytes(We("sig",x),"der")}normalizeS(){return this.hasHighS()?new $(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return cr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return cr(this.toBytes("compact"))}}const B=n.bits2int||function(x){if(x.length>8192)throw new Error("input is too large");const T=ks(x),O=x.length*8-a;return O>0?T>>BigInt(O):T},k=n.bits2int_modN||function(x){return i.create(B(x))},D=So(a);function j(E){return I2("num < 2^"+a,E,sn,D),i.toBytes(E)}function g(E,x){return jn(E,void 0,"message"),x?jn(t(E),void 0,"prehashed message"):E}function w(E,x,T){if(["recovered","canonical"].some(K=>K in T))throw new Error("sign() legacy options not supported");const{lowS:O,prehash:y,extraEntropy:L}=Zc(T,h);E=g(E,y);const F=k(E),U=xr(i,x),z=[j(U),j(F)];if(L!=null&&L!==!1){const K=L===!0?r(d.secretKey):L;z.push(We("extraEntropy",K))}const V=bn(...z),Z=F;function W(K){const G=B(K);if(!i.isValidNot0(G))return;const X=i.inv(G),ee=e.BASE.multiply(G).toAffine(),fe=i.create(ee.x);if(fe===sn)return;const xe=i.create(X*i.create(Z+fe*U));if(xe===sn)return;let oe=(ee.x===fe?0:2)|Number(ee.y&wr),ue=xe;return O&&v(xe)&&(ue=i.neg(xe),oe^=1),new $(fe,ue,oe)}return{seed:V,k2sig:W}}function A(E,x,T={}){E=We("message",E);const{seed:O,k2sig:y}=w(E,x,T);return M2(t.outputLen,i.BYTES,o)(O,y)}function I(E){let x;const T=typeof E=="string"||ws(E),O=!T&&E!==null&&typeof E=="object"&&typeof E.r=="bigint"&&typeof E.s=="bigint";if(!T&&!O)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(O)x=new $(E.r,E.s);else if(T){try{x=$.fromBytes(We("sig",E),"der")}catch(y){if(!(y instanceof on.Err))throw y}if(!x)try{x=$.fromBytes(We("sig",E),"compact")}catch{return!1}}return x||!1}function N(E,x,T,O={}){const{lowS:y,prehash:L,format:F}=Zc(O,h);if(T=We("publicKey",T),x=g(We("message",x),L),"strict"in O)throw new Error("options.strict was renamed to lowS");const U=F===void 0?I(E):$.fromBytes(We("sig",E),F);if(U===!1)return!1;try{const z=e.fromBytes(T);if(y&&U.hasHighS())return!1;const{r:V,s:Z}=U,W=k(x),K=i.inv(Z),G=i.create(W*K),X=i.create(V*K),ee=e.BASE.multiplyUnsafe(G).add(z.multiplyUnsafe(X));return ee.is0()?!1:i.create(ee.x)===V}catch{return!1}}function P(E,x,T={}){const{prehash:O}=Zc(T,h);return x=g(x,O),$.fromBytes(E,"recovered").recoverPublicKey(x).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d,Point:e,sign:A,verify:N,recoverPublicKey:P,Signature:$,hash:t})}function MS(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const o=Co(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:o,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function LS(e){const{CURVE:t,curveOpts:n}=MS(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function BS(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,u0(n.Fn.ORDER,n.Fn.BITS))})}function kS(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=LS(e),s=OS(t,n),i=IS(s,r,o);return BS(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function RS(e,t){const n=r=>kS({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Kc={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},FS={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},x0=BigInt(2);function DS(e){const t=Kc.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=lt(l,n,t)*l%t,p=lt(f,n,t)*l%t,d=lt(p,x0,t)*u%t,h=lt(d,o,t)*d%t,m=lt(h,s,t)*h%t,v=lt(m,c,t)*m%t,C=lt(v,a,t)*v%t,b=lt(C,c,t)*m%t,$=lt(b,n,t)*l%t,B=lt($,i,t)*h%t,k=lt(B,r,t)*u%t,D=lt(k,x0,t);if(!Yc.eql(Yc.sqr(D),e))throw new Error("Cannot find square root");return D}const Yc=Co(Kc.p,{sqrt:DS}),E0=RS({...Kc,Fp:Yc,lowS:!0,endo:FS},Rp),jS=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:E0},Symbol.toStringTag,{value:"Module"}));function _S({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 E0.Signature(Bt(e),Bt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:xt(i)}async function Xc(e,t){var f,p,d;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(d=(p=(f=e.chain)==null?void 0:f.contracts)==null?void 0:p.universalSignatureVerifier)==null?void 0:d.address,...a}=t,u=vt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?_S(i):$e(i),l=await(async()=>!r&&!o||C5(u)?u:O5({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Rt({abi:ph,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:xc({abi:ph,args:[n,s,l],bytecode:i6}),...a},{data:m}=await J(e,Po,"call")(h);return Ox(m??"0x0")}catch(h){try{if(Ms(iE(n),await Pp({hash:s,signature:i})))return!0}catch{}if(h instanceof xp)return!1;throw h}}async function US(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=jh(n);return Xc(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function zS(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=v5({message:i,primaryType:c,types:a,domain:u});return Xc(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function S0(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=Ae(["watchBlockNumber",e.uid,t,n,i]);return xn(f,{onBlockNumber:r,onError:o},p=>$o(async()=>{var d;try{const h=await J(e,Ao,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(!a||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Ae(["watchBlockNumber",e.uid,t,n]);return xn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const C=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return C?C.value:e.transport}return e.transport})(),{unsubscribe:v}=await m.subscribe({params:["newHeads"],onData(C){var $;if(!d)return;const b=Bt(($=C.result)==null?void 0:$.number);p.onBlockNumber(b,a),a=b},onError(C){var b;(b=p.onError)==null||b.call(p,C)}});h=v,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function WS(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:k})=>~~(1<<k)*200,timeout:a=18e4}=t,u=Ae(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var k;return t.pollingInterval?t.pollingInterval:(k=e.chain)!=null&&k.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,v;const{promise:C,resolve:b,reject:$}=bh(),B=a?setTimeout(()=>{v(),m(),$(new jE({hash:o}))},a):void 0;return m=xn(u,{onReplaced:s,resolve:b,reject:$},async k=>{if(d=await J(e,Hs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(B),k.resolve(d),m();return}v=J(e,S0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(D){const j=w=>{clearTimeout(B),v(),w(),m()};let g=D;if(!h)try{if(d){if(r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>k.resolve(d));return}if(n&&!f&&(h=!0,await $c(async()=>{f=await J(e,Mc,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await J(e,Hs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>k.resolve(d))}catch(w){if(w instanceof vp||w instanceof wp){if(!f){h=!1;return}try{p=f,h=!0;const A=await $c(()=>J(e,Ft,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:P})=>P instanceof Cp});h=!1;const I=A.transactions.find(({from:P,nonce:E})=>P===p.from&&E===p.nonce);if(!I||(d=await J(e,Hs,"getTransactionReceipt")({hash:I.hash}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r)))return;let N="replaced";I.to===p.to&&I.value===p.value&&I.input===p.input?N="repriced":I.from===I.to&&I.value===0n&&(N="cancelled"),j(()=>{var P;(P=k.onReplaced)==null||P.call(k,{reason:N,replacedTransaction:p,transaction:I,transactionReceipt:d}),k.resolve(d)})}catch(A){j(()=>k.reject(A))}}else j(()=>k.reject(w))}}})}),C}function HS(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const u=typeof c<"u"?c:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),l=i??!1;let f;return u?(()=>{const h=Ae(["watchBlocks",e.uid,t,n,r,l,a]);return xn(h,{onBlock:o,onError:s},m=>$o(async()=>{var v;try{const C=await J(e,Ft,"getBlock")({blockTag:t,includeTransactions:l});if(C.number!==null&&(f==null?void 0:f.number)!=null){if(C.number===f.number)return;if(C.number-f.number>1&&n)for(let b=(f==null?void 0:f.number)+1n;b<C.number;b++){const $=await J(e,Ft,"getBlock")({blockNumber:b,includeTransactions:l});m.onBlock($,f),f=$}}((f==null?void 0:f.number)==null||t==="pending"&&(C==null?void 0:C.number)==null||C.number!==null&&C.number>f.number)&&(m.onBlock(C,f),f=C)}catch(C){(v=m.onError)==null||v.call(m,C)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,v=()=>h=!1;return(async()=>{try{r&&J(e,Ft,"getBlock")({blockTag:t,includeTransactions:l}).then($=>{h&&m&&(o($,void 0),m=!1)}).catch(s);const C=(()=>{if(e.transport.type==="fallback"){const $=e.transport.transports.find(B=>B.config.type==="webSocket"||B.config.type==="ipc");return $?$.value:e.transport}return e.transport})(),{unsubscribe:b}=await C.subscribe({params:["newHeads"],async onData($){var k;if(!h)return;const B=await J(e,Ft,"getBlock")({blockNumber:(k=$.result)==null?void 0:k.number,includeTransactions:l}).catch(()=>{});h&&(o(B,f),m=!1,f=B)},onError($){s==null||s($)}});v=b,h||v()}catch(C){s==null||s(C)}})(),()=>v()})()}function VS(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:u,pollingInterval:l=e.pollingInterval,strict:f}){const p=typeof u<"u"?u:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),d=f??!1;return p?(()=>{const v=Ae(["watchEvent",t,n,r,e.uid,o,l,i]);return xn(v,{onLogs:a,onError:c},C=>{let b;i!==void 0&&(b=i-1n);let $,B=!1;const k=$o(async()=>{var D;if(!B){try{$=await J(e,Nh,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}B=!0;return}try{let j;if($)j=await J(e,Rs,"getFilterChanges")({filter:$});else{const g=await J(e,Ao,"getBlockNumber")({});b&&b!==g?j=await J(e,ac,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:b+1n,toBlock:g}):j=[],b=g}if(j.length===0)return;if(r)C.onLogs(j);else for(const g of j)C.onLogs([g])}catch(j){$&&j instanceof Rn&&(B=!1),(D=C.onError)==null||D.call(C,j)}},{emitOnBegin:!0,interval:l});return async()=>{$&&await J(e,Fs,"uninstallFilter")({filter:$}),k()}})})():(()=>{let v=!0,C=()=>v=!1;return(async()=>{try{const b=(()=>{if(e.transport.type==="fallback"){const D=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return D?D.value:e.transport}return e.transport})(),$=s??(o?[o]:void 0);let B=[];$&&(B=[$.flatMap(j=>Xr({abi:[j],eventName:j.name,args:n}))],o&&(B=B[0]));const{unsubscribe:k}=await b.subscribe({params:["logs",{address:t,topics:B}],onData(D){var g;if(!v)return;const j=D.result;try{const{eventName:w,args:A}=sc({abi:$??[],data:j.data,topics:j.topics,strict:d}),I=tn(j,{args:A,eventName:w});a([I])}catch(w){let A,I;if(w instanceof Gr||w instanceof ys){if(f)return;A=w.abiItem.name,I=(g=w.abiItem.inputs)==null?void 0:g.some(P=>!("name"in P&&P.name))}const N=tn(j,{args:I?[]:{},eventName:A});a([N])}},onError(D){c==null||c(D)}});C=k,v||C()}catch(b){c==null||c(b)}})(),()=>C()})()}function GS(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=Ae(["watchPendingTransactions",e.uid,t,s]);return xn(u,{onTransactions:r,onError:n},l=>{let f;const p=$o(async()=>{var d;try{if(!f)try{f=await J(e,Ih,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await J(e,Rs,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)l.onTransactions(h);else for(const m of h)l.onTransactions([m])}catch(h){(d=l.onError)==null||d.call(l,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await J(e,Fs,"uninstallFilter")({filter:f}),p()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!u)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});l=f,u||l()}catch(f){n==null||n(f)}})(),()=>l()})()}function qS(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(ZS))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((p=e.match(KS))==null?void 0:p.groups)??{},l=(d=e.split("Resources:")[1])==null?void 0:d.split(`
161
+ - `).slice(1);return{...r,...u,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const ZS=/^(?:(?<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)?/,KS=/(?: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 YS(e){const{address:t,domain:n,message:r,nonce:o,scheme:s,time:i=new Date}=e;if(n&&r.domain!==n||o&&r.nonce!==o||s&&r.scheme!==s||r.expirationTime&&i>=r.expirationTime||r.notBefore&&i<r.notBefore)return!1;try{if(!r.address||!ct(r.address,{strict:!1})||t&&!Ms(r.address,t))return!1}catch{return!1}return!0}async function XS(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=qS(o);if(!l.address||!YS({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const p=jh(o);return Xc(e,{address:l.address,hash:p,signature:c,...u})}function QS(e){return{call:t=>Po(e,t),createAccessList:t=>Oh(e,t),createBlockFilter:()=>e5(e),createContractEventFilter:t=>ap(e,t),createEventFilter:t=>Nh(e,t),createPendingTransactionFilter:()=>Ih(e),estimateContractGas:t=>T2(e,t),estimateGas:t=>oc(e,t),getBalance:t=>Hp(e,t),getBlobBaseFee:()=>t5(e),getBlock:t=>Ft(e,t),getBlockNumber:t=>Ao(e,t),getBlockTransactionCount:t=>n5(e,t),getBytecode:t=>Mh(e,t),getChainId:()=>Up(e),getCode:t=>Mh(e,t),getContractEvents:t=>Gp(e,t),getEip712Domain:t=>o5(e,t),getEnsAddress:t=>D6(e,t),getEnsAvatar:t=>X6(e,t),getEnsName:t=>Q6(e,t),getEnsResolver:t=>J6(e,t),getEnsText:t=>Ch(e,t),getFeeHistory:t=>a5(e,t),estimateFeesPerGas:t=>l2(e,t),getFilterChanges:t=>Rs(e,t),getFilterLogs:t=>c5(e,t),getGasPrice:()=>tc(e),getLogs:t=>ac(e,t),getProof:t=>M5(e,t),estimateMaxPriorityFeePerGas:t=>u2(e,t),getStorageAt:t=>L5(e,t),getTransaction:t=>Mc(e,t),getTransactionConfirmations:t=>B5(e,t),getTransactionCount:t=>Lp(e,t),getTransactionReceipt:t=>Hs(e,t),multicall:t=>k5(e,t),prepareTransactionRequest:t=>Wp(e,t),readContract:t=>rn(e,t),sendRawTransaction:t=>w6(e,t),simulate:t=>Lc(e,t),simulateBlocks:t=>Lc(e,t),simulateCalls:t=>lS(e,t),simulateContract:t=>d6(e,t),verifyMessage:t=>US(e,t),verifySiweMessage:t=>XS(e,t),verifyTypedData:t=>zS(e,t),uninstallFilter:t=>Fs(e,t),waitForTransactionReceipt:t=>WS(e,t),watchBlocks:t=>HS(e,t),watchBlockNumber:t=>S0(e,t),watchContractEvent:t=>v6(e,t),watchEvent:t=>VS(e,t),watchPendingTransactions:t=>GS(e,t)}}function JS(e){const{key:t="public",name:n="Public Client"}=e;return S6({...e,key:t,name:n,type:"publicClient"}).extend(QS)}const eP=m5({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}}}),tP=Object.values({MAINNET:1,SEPOLIA:11155111}),an=e=>{const t=typeof e=="string"?parseInt(e,10):e;return tP.includes(t)},nP={USDT:!0},P0=(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:!nP[t.toUpperCase()]:!0},Oo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return M.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},rP=({depositAmount:e,curSelectToken:t,approved:n,currentActiveChain:r,tokenBalance:o,platformBalance:s="0",showLayerZeroTip:i=!1,layerZeroTipKey:c,onDepositAmountChange:a,onApproved:u})=>{const{t:l}=pt(),[f,p]=S.useState(!1);S.useEffect(()=>{n&&f&&p(!1)},[n,f]);const d=S.useCallback(async()=>{if(!f)try{p(!0),await u()}catch(b){p(!1),console.error("Approve failed:",b)}},[u,f]),h=S.useCallback(()=>{let b=o||"0";if(P0(r==null?void 0:r.chainId,t))try{const $=new Ie(b),B=new Ie("200000");$.gt(B)&&(b="200000")}catch($){console.warn("Error calculating max amount limit:",$)}return b},[o,r==null?void 0:r.chainId,t]),m=S.useMemo(()=>{if(!P0(r==null?void 0:r.chainId,t))return!1;try{const b=new Ie(e||"0"),$=new Ie("200000");return b.isNaN()||$.isNaN()?!1:b.gte($)}catch{return!1}},[r,e,t]),v=b=>{const $=b.target.value,B=h(),k=ra($,B);if(k.isValid)a(k.formattedValue),k.errorType;else return k.errorType==="exceed_balance",void 0},C=()=>{const b=parseFloat(o||"0"),$=parseFloat(e||"0");if($>0){const B=b-$,k=gt(Math.max(0,B).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[gt(o||"0"),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),k," ",t]})}return`${gt(o||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:e,onChange:v,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:()=>{const b=h();a(b)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx(zr,{content:l("deposit.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:C()})]})]}),!n&&o1(e||"0",0)&&M.jsxs("div",{className:"flex justify-center flex-col items-center",children:[M.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:l("deposit.enableSystemProWithToken",{token:t,network:r==null?void 0:r.chain})}),M.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:l("deposit.enableTokenDesc",{token:t,network:r==null?void 0:r.chain})}),M.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:d,disabled:f,children:f?M.jsx(Oo,{size:"xs",inline:!0}):l("deposit.enableWithToken",{token:t})})]}),i&&M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(c||"deposit.layerZeroDepositTip")})]}),M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),m&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.depositTipFor25w")})]}),m&&M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:!(m||i)&&M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.noPrivateKeyWalletWarning")})]}),M.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:l("deposit.equity")}),M.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?M.jsxs("span",{className:"flex items-center gap-1",children:[gt(s),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),gt((parseFloat(s)+parseFloat(e)).toString())," ",t]}):`${gt(s)} ${t}`})]})})]})},oP=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:s})=>{var a,u;const i=(a=o==null?void 0:o.useBalance)==null?void 0:a.call(o,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(o!=null&&o.useBalance)}}),c=(u=o==null?void 0:o.useReadContract)==null?void 0:u.call(o,{address:e.tokenAddress,abi:[{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"allowance",args:[t,r],chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!r&&!!(o!=null&&o.useReadContract)}});return S.useEffect(()=>{s(e.tokenAddress,{balance:i,allowance:c})},[i,c,e.tokenAddress,s]),null},$0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var h;const s=S.useMemo(()=>r.filter(m=>m.tokenAddress&&m.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=S.useState({}),a=S.useCallback((m,v)=>{c(C=>({...C,[m]:v}))},[]),u=(h=o==null?void 0:o.useBalance)==null?void 0:h.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),l=S.useMemo(()=>s.map(m=>S.createElement(oP,{key:m.tokenAddress,token:m,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a]),f=S.useMemo(()=>{if(!(o!=null&&o.useBalance))return{balanceList:[],allowanceList:[],baseTokenBalance:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},combinedData:{}};const m=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"},v=s.map($=>{const B=i[$.tokenAddress],k=B==null?void 0:B.balance,D=k==null?void 0:k.data;return{address:$.tokenAddress,value:(D==null?void 0:D.value)||BigInt(0),formatted:(D==null?void 0:D.formatted)||"0",decimals:(D==null?void 0:D.decimals)||$.decimals}}).filter($=>$.address),C=s.map($=>{const B=i[$.tokenAddress],k=B==null?void 0:B.allowance,D=k==null?void 0:k.data,j=BigInt(D?D.toString():0);return{address:$.tokenAddress,value:j,formatted:(j/BigInt(10)**BigInt($.decimals)).toString(),decimals:$.decimals}}).filter($=>$.address),b=v.reduce(($,B)=>{const k=C.find(D=>D.address===B.address);return{...$,[B.address]:{balance:B,allowance:k||{address:B.address,value:BigInt(0),formatted:"0",decimals:B.decimals}}}},{});return{balanceList:v,allowanceList:C,baseTokenBalance:m,combinedData:b}},[u,i,s,o==null?void 0:o.useBalance]),p=S.useCallback(async()=>f,[f]),d=S.useMemo(()=>{const m=(u==null?void 0:u.isLoading)||!1,v=Object.values(i).some(C=>{var b,$;return((b=C.balance)==null?void 0:b.isLoading)||(($=C.allowance)==null?void 0:$.isLoading)});return m||v},[u==null?void 0:u.isLoading,i]);return{multicallRun:p,multicallResult:f,validErcTokens:s,isLoading:d,queryComponents:l}};let Ve=null;const sP={symbol:"USDT"},A0=S.forwardRef((e,t)=>{const[n,r]=S.useState(!1),[o,s]=S.useState(!1),[i,c]=S.useState({chains:[]}),a=S.useCallback(h=>{c(h),r(!0)},[]),u=S.useCallback(h=>{c(m=>({...m,...h}))},[]),l=S.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=S.useCallback(h=>{s(h)},[]),p=S.useCallback(()=>n,[n]),d=S.useCallback(()=>o,[o]);return S.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),S.useEffect(()=>(Ve={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{Ve=null}),[a,l,u,f,p,d]),M.jsx(I0,{isOpen:n,isLoading:o,onClose:l,config:i.config||sP,currentActiveAccount:i.currentActiveAccount||oa,smartWallet:i.smartWallet||sa,chains:i.chains||c1,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||ia,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",wagmiHooks:i.wagmiHooks,approved:i.approved,onApproved:i.onApproved,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange})});A0.displayName="DepositManager";const T0=e=>{if(!Ve){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ve.openDeposit(e||{chains:[]})},C0=()=>{if(!Ve){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ve.closeDeposit()},O0=e=>{Ve&&Ve.updateDepositOptions(e)},Zs=e=>{if(!Ve){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ve.setDepositLoading(e)},iP=()=>Ve?Ve.isOpen():!1,N0=()=>Ve?Ve.isLoading():!1,aP=()=>({openDeposit:T0,closeDeposit:C0,updateDepositOptions:O0,setDepositLoading:Zs,isOpen:iP,isLoading:N0}),cP=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:i,platformBalance:c="0",isLoading:a=!1,wagmiHooks:u,approved:l,onApproved:f,onDeposit:p,onClose:d,onChainChange:h,onTokenChange:m})=>{var xe;const{t:v}=pt(),C=u==null?void 0:u.useAccount(),[b,$]=S.useState(()=>{var oe;return!e||e.length===0?1:t||((oe=e[0])==null?void 0:oe.chainId)||1}),[B,k]=S.useState(()=>{var se;if(!e||e.length===0)return"";const oe=t||((se=e[0])==null?void 0:se.chainId),ue=e.find(Le=>Le.chainId===oe);if(!ue||!ue.tokenList||ue.tokenList.length===0)return"";const pe=ue.tokenList.find(Le=>Le.tokenAddress===n)||ue.tokenList[0];return(pe==null?void 0:pe.token)||""}),[D,j]=S.useState(r),g=S.useCallback(oe=>{$(oe),h==null||h(oe)},[h]),w=S.useCallback(oe=>{k(oe),m==null||m(oe)},[m]),A=S.useRef(!0),I=S.useRef(B),N=S.useRef(b);S.useEffect(()=>{if(A.current){A.current=!1,I.current=B,N.current=b;return}(I.current!==B||N.current!==b)&&(j(""),I.current=B,N.current=b)},[B,b]);const P=e&&e.length>0?e.find(oe=>oe.chainId===b)||e[0]:null,E=(xe=P==null?void 0:P.tokenList)==null?void 0:xe.find(oe=>oe.token===B),x=o==null?void 0:o.getDisplayAddress(),{multicallResult:T,queryComponents:O}=$0({account:x,chainId:b,contractAddress:void 0,tokens:(P==null?void 0:P.tokenList)||[],wagmiHooks:u}),y=S.useMemo(()=>{var ue;if(!E)return;if(!E.tokenAddress||E.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return T.baseTokenBalance.formatted;const oe=T.combinedData[E.tokenAddress];return((ue=oe==null?void 0:oe.balance)==null?void 0:ue.formatted)||"0"},[E,T]),L="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",F="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",U=S.useMemo(()=>JS({chain:eP,transport:M6()}),[]),[z,V]=S.useState("0");S.useEffect(()=>{const oe=+b==42161,ue=(B==null?void 0:B.toUpperCase())==="USDT";if(!(oe&&ue)){V("0");return}let pe=!1;return(async()=>{try{const se=await U.readContract({address:L,abi:r6,functionName:"balanceOf",args:[F]});if(!pe){const Le=new Ie(se.toString()).div(1e6).toString();V(Le)}}catch(se){pe||(console.warn("Failed to read pool USDT balance via viem:",se),V("0"))}})(),()=>{pe=!0}},[U,B,b]);const Z=l??!1,W=S.useMemo(()=>+C.chainId!=+b,[C.chainId,b]),{showLayerZeroTip:K,layerZeroTipKey:G}=S.useMemo(()=>{const oe=+b==42161||+b==421614,ue=(B==null?void 0:B.toUpperCase())==="USDT",pe=new Ie(D||"0"),se=new Ie("200000");let Le=!1,Er;if(oe&&ue&&D)if(pe.gte(se))Le=!0,Er="deposit.layerZeroDepositTipGte200k";else{const Sr=z;if(typeof Sr=="string"&&Sr.length>0){const Xs=new Ie(Sr);!Xs.isNaN()&&pe.gte(Xs)&&(Le=!0,Er="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:Le,layerZeroTipKey:Er}},[b,B,D,z]),X=S.useMemo(()=>{if(W)return{text:v("deposit.switchNetwork"),disabled:!1,isNetworkSwitch:!0};const oe=parseFloat(D||"0"),ue=10,se=s1(D,y||"0",Z);return!D||oe===0||!Z?{text:v(K?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:oe<ue?{text:v("deposit.minDepositParsed",{amount:ue,token:B}),disabled:!0,isNetworkSwitch:!1}:{text:v(K?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!se,isNetworkSwitch:!1}},[D,B,y,Z,W,K,v]),ee=S.useCallback(async()=>{g&&g(b)},[g,b]),fe=S.useCallback(async()=>{Zs(!0);try{p&&p({amount:D,chainId:b,tokenAddress:(E==null?void 0:E.tokenAddress)||"",tokenSymbol:B})}catch(oe){console.error("Deposit error:",oe),Zs(!1)}},[p,D,b,E==null?void 0:E.tokenAddress,B]);return!(u!=null&&u.useBalance)||!(u!=null&&u.useReadContract)||!(u!=null&&u.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):P?M.jsxs(M.Fragment,{children:[O,M.jsx(na,{currentActiveChain:P,chainList:e,onChainChange:g,curSelectToken:B,onTokenChange:w,walletType:"evm"}),M.jsx(rP,{depositAmount:D,curSelectToken:B,curSelectTokenData:{balance:E==null?void 0:E.balance,allowance:E==null?void 0:E.allowance},approved:Z,currentActiveChain:P,tokenBalance:y,platformBalance:c,showLayerZeroTip:K,layerZeroTipKey:G,onDepositAmountChange:j,onApproved:async()=>{f&&await f()}}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${X.disabled||a?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:X.isNetworkSwitch?ee:fe,disabled:X.disabled||a,children:[a&&M.jsx(Oo,{size:"xs"}),X.text]})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},I0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oa,smartWallet:s=sa,chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u="",metadata:l=ia,currentEquity:f=5e3,platformBalance:p="0",wagmiHooks:d,approved:h,onApproved:m,onDeposit:v,onCopy:C,onChainChange:b,onTokenChange:$})=>{const{t:B}=pt(),k=S.useMemo(()=>{var j;return o?bu(o,s,!1,(j=i[0])==null?void 0:j.chainId,"0","0"):null},[o,s,i]),D=(k==null?void 0:k.getWalletType())==="mpc";return e?Be.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{n()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:j=>{j.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:B("deposit.title")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(mu,{className:"h-4 w-4"})})]}),D?M.jsx(Pw,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:k,metadata:l,currentEquity:f,onDeposit:v,onCopy:C,onClose:n}):M.jsx(cP,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:k,metadata:l,currentEquity:f,platformBalance:p,isLoading:t,wagmiHooks:d,approved:h,onApproved:m,onDeposit:v,onClose:n,onChainChange:b,onTokenChange:$})]})})}),document.body):null};S.createContext(null);const uP=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_active)",children:M.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_active",children:M.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),lP=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_inactive)",children:M.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_inactive",children:M.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Ks=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return M.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>M.jsx("div",{className:"flex items-center justify-center",children:o<=e?M.jsx(uP,{}):M.jsx(lP,{})},o))})};class cn{}Xe(cn,"FAST",3),Xe(cn,"Medium",2),Xe(cn,"SLOW",1),Xe(cn,"NONE",0);const fP=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",fee:o="0.00",walletType:s="evm",receiverAddress:i="",onWithdrawAmountChange:c,onReceiverAddressChange:a,onAmountChanged:u})=>{const{t:l}=pt(),f=S.useMemo(()=>{if(!an(n==null?void 0:n.chainId)){const v=new Ie(e||"0").minus(o||"0").decimalPlaces(2,Ie.ROUND_DOWN);return v.isNegative()?"0.00":v.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),p=S.useMemo(()=>r||"0",[r]),d=v=>{const C=v.target.value,$=ra(C,p||"0");if($.isValid)c($.formattedValue),$.errorType;else return $.errorType==="exceed_balance",void 0;u==null||u($.formattedValue)},h=()=>{c(p),u==null||u(p)},m=()=>{const v=parseFloat(r||"0"),C=parseFloat(e||"0");if(C>0){const b=v-C,$=gt(Math.max(0,b).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[gt(r||"0"),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),$," ",t]})}return`${gt(r||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:e,onChange:d,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:h,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx(zr,{content:l("deposit.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:m()})]})]}),s==="mpc"&&!an(n==null?void 0:n.chainId)&&M.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:M.jsx("input",{type:"text",placeholder:l("withdraw.receiverAddress"),value:i,onChange:v=>a==null?void 0:a(v.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),M.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:an(n==null?void 0:n.chainId)?M.jsxs(M.Fragment,{children:[M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.noticeDesc")}),M.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:l("withdraw.commonWithdraw")})]}):M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.crossChainTips")})}),M.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsx("span",{className:"text-text-tertiary text-xs",children:l("withdraw.speed")}),M.jsx("div",{className:"flex items-center",children:M.jsx(zr,{content:M.jsxs("div",{children:[M.jsx("div",{children:l("withdraw.speedNote")}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ks,{selectedLevel:cn.FAST,maxLevel:3}),M.jsx("span",{children:l("withdraw.speedNoteSpeed1")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ks,{selectedLevel:cn.Medium,maxLevel:3}),M.jsx("span",{children:l("withdraw.speedNoteSpeed2")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ks,{selectedLevel:cn.SLOW,maxLevel:3}),M.jsx("span",{children:l("withdraw.speedNoteSpeed3")})]})]}),children:M.jsx(Ks,{selectedLevel:an(n==null?void 0:n.chainId)?cn.SLOW:cn.FAST,maxLevel:3})})})]}),!an(n==null?void 0:n.chainId)&&M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l("withdraw.fee")}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l(an(n==null?void 0:n.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[gt(f)," ",t]})]})]})]})},dP=[],pP={};let Ge=null;const M0=S.forwardRef((e,t)=>{const[n,r]=S.useState(!1),[o,s]=S.useState(!1),[i,c]=S.useState({chains:[]}),a=S.useCallback(h=>{c(h||{chains:[]}),r(!0)},[]),u=S.useCallback(h=>{c(m=>({...m,...h}))},[]),l=S.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=S.useCallback(h=>{s(h)},[]),p=S.useCallback(()=>n,[n]),d=S.useCallback(()=>o,[o]);return S.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),S.useEffect(()=>(Ge={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ge=null}),[a,l,u,f,p,d]),M.jsx(F0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,smartWallet:i.smartWallet,chains:i.chains||dP,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||pP,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged})});M0.displayName="WithdrawManager";const L0=e=>{if(!Ge){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ge.openWithdraw(e||{chains:[]})},B0=()=>{if(!Ge){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ge.closeWithdraw()},k0=e=>{if(!Ge){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ge.updateWithdrawOptions(e)},Ys=e=>{if(!Ge){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ge.setWithdrawLoading(e)},hP=()=>Ge?Ge.isOpen():!1,R0=()=>Ge?Ge.isLoading():!1,mP=()=>({openWithdraw:L0,closeWithdraw:B0,updateWithdrawOptions:k0,setWithdrawLoading:Ys,isOpen:hP,isLoading:R0}),gP=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:i,platformBalance:c="0",fee:a="0.00",isLoading:u=!1,wagmiHooks:l,onWithdraw:f,onClose:p,onChainChange:d,onTokenChange:h,onAmountChanged:m})=>{var V;const{t:v}=pt(),[C,b]=S.useState(()=>{var Z;return!e||e.length===0?1:t||((Z=e[0])==null?void 0:Z.chainId)||1}),[$,B]=S.useState(()=>{var G;if(!e||e.length===0)return"";const Z=t||((G=e[0])==null?void 0:G.chainId),W=e.find(X=>X.chainId===Z);if(!W||!W.tokenList||W.tokenList.length===0)return"";const K=W.tokenList.find(X=>X.tokenAddress===n)||W.tokenList[0];return(K==null?void 0:K.token)||""}),[k,D]=S.useState(r),[j,g]=S.useState(""),w=(o==null?void 0:o.getWalletType())||"evm",A=S.useCallback(Z=>{b(Z),d==null||d(Z)},[d]),I=S.useCallback(Z=>{B(Z),h==null||h(Z)},[h]),N=S.useRef(!0),P=S.useRef($),E=S.useRef(C);S.useEffect(()=>{if(N.current){N.current=!1,P.current=$,E.current=C;return}(P.current!==$||E.current!==C)&&(D(""),P.current=$,E.current=C)},[$,C]);const x=e&&e.length>0?e.find(Z=>Z.chainId===C)||e[0]:null,T=(V=x==null?void 0:x.tokenList)==null?void 0:V.find(Z=>Z.token===$),O=o==null?void 0:o.getDisplayAddress(),{multicallResult:y,queryComponents:L}=$0({account:O,chainId:C,contractAddress:void 0,tokens:(x==null?void 0:x.tokenList)||[],wagmiHooks:l}),F=S.useMemo(()=>{var W;if(!T)return;if(!T.tokenAddress||T.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return y.baseTokenBalance.formatted;const Z=y.combinedData[T.tokenAddress];return((W=Z==null?void 0:Z.balance)==null?void 0:W.formatted)||"0"},[T,y]),U=S.useMemo(()=>{const Z=new Ie(k||"0"),W=new Ie(a||"0"),K=an(C);return!k||Z.isZero()||!K&&Z.isLessThan(W)?{text:v("withdraw.confirmWithdraw"),disabled:!0}:w==="mpc"&&!K&&!j.trim()?{text:v("withdraw.invalidReceiverAddress"),disabled:!0}:{text:v("withdraw.confirmWithdraw"),disabled:!1}},[v,C,k,w,j,a]),z=S.useCallback(async()=>{Ys(!0);try{if(f){const Z=new Ie(k||"0"),W=new Ie(a||"0"),G={amount:(an(C)?Z:Z.minus(W)).toString(),chainId:C,tokenAddress:(T==null?void 0:T.tokenAddress)||"",tokenSymbol:$};w==="mpc"&&!an(C)&&(G.receiverAddress=j),f(G)}}catch{Ys(!1)}},[f,k,a,C,T==null?void 0:T.tokenAddress,$,w,j]);return!(l!=null&&l.useBalance)||!(l!=null&&l.useReadContract)||!(l!=null&&l.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):x?M.jsxs(M.Fragment,{children:[L,M.jsx(na,{currentActiveChain:x,chainList:e,onChainChange:A,curSelectToken:$,onTokenChange:I,walletType:"evm"}),M.jsx(fP,{withdrawAmount:k,curSelectToken:$,curSelectTokenData:{balance:T==null?void 0:T.balance,allowance:T==null?void 0:T.allowance},currentActiveChain:x,currentEquity:i||0,amount:k,decimals:(T==null?void 0:T.decimals)||6,tokenBalance:F,platformBalance:c,fee:a,walletType:w,receiverAddress:j,onWithdrawAmountChange:D,onReceiverAddressChange:g,onAmountChanged:m}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${U.disabled||u?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:U.disabled||u,children:[u&&M.jsx(Oo,{size:"xs"}),U.text]})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},F0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oa,smartWallet:s=sa,chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u="",metadata:l=ia,currentEquity:f=5e3,platformBalance:p="0",fee:d,wagmiHooks:h,onWithdraw:m,onChainChange:v,onTokenChange:C,onAmountChanged:b})=>{const{t:$}=pt(),B=S.useMemo(()=>{var k;return o?bu(o,s,!1,(k=i[0])==null?void 0:k.chainId,"0","0"):null},[o,s,i]);return e?Be.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{n()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:k=>{k.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:$("withdraw.withdraw")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(mu,{className:"h-4 w-4"})})]}),M.jsx(gP,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:B,metadata:l,currentEquity:f,platformBalance:p,fee:d,isLoading:t,wagmiHooks:h,onWithdraw:m,onClose:n,onChainChange:v,onTokenChange:C,onAmountChanged:b})]})})}),document.body):null};re.ChromeLoader=Oo,re.ComponentProvider=cm,re.DEFAULT_LOCALE=Io,re.Deposit=I0,re.DepositManager=A0,re.LOCALE_NAMES=sm,re.LoadingSpinner=Oo,re.SUPPORTED_LOCALES=Js,re.Tooltip=zr,re.Withdraw=F0,re.WithdrawManager=M0,re.closeDeposit=C0,re.closeWithdraw=B0,re.formatThousands=lm,re.isDepositLoading=N0,re.isWithdrawLoading=R0,re.openDeposit=T0,re.openWithdraw=L0,re.setDepositLoading=Zs,re.setWithdrawLoading=Ys,re.updateDepositOptions=O0,re.updateWithdrawOptions=k0,re.useComponentConfig=lu,re.useDeposit=fm,re.useDepositManager=aP,re.useTranslation=pt,re.useWithdraw=dm,re.useWithdrawManager=mP,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
120
162
  //# sourceMappingURL=index.umd.js.map