@edgex-web/components 0.1.0-beta.5 → 0.1.0-beta.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/ccip-Br3uuoBk.mjs +150 -0
  2. package/dist/ccip-Br3uuoBk.mjs.map +1 -0
  3. package/dist/components/Deposit/index.d.ts +1 -10
  4. package/dist/components/Deposit/index.d.ts.map +1 -1
  5. package/dist/components/Deposit/src/DepositManager.d.ts +2 -0
  6. package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -1
  7. package/dist/components/Deposit/src/components/evm/hooks/index.d.ts +3 -0
  8. package/dist/components/Deposit/src/components/evm/hooks/index.d.ts.map +1 -0
  9. package/dist/components/Deposit/src/components/evm/hooks/useApprove.d.ts +4 -0
  10. package/dist/components/Deposit/src/components/evm/hooks/useApprove.d.ts.map +1 -0
  11. package/dist/components/Deposit/src/components/evm/hooks/useDepositButtonState.d.ts +14 -0
  12. package/dist/components/Deposit/src/components/evm/hooks/useDepositButtonState.d.ts.map +1 -0
  13. package/dist/components/Deposit/src/components/evm/index.d.ts +6 -0
  14. package/dist/components/Deposit/src/components/evm/index.d.ts.map +1 -0
  15. package/dist/components/Deposit/src/components/evm/types/approve.d.ts +15 -0
  16. package/dist/components/Deposit/src/components/evm/types/approve.d.ts.map +1 -0
  17. package/dist/components/Deposit/src/components/evm/types/index.d.ts +15 -0
  18. package/dist/components/Deposit/src/components/evm/types/index.d.ts.map +1 -0
  19. package/dist/components/Deposit/src/components/evm/utils/format.d.ts +12 -0
  20. package/dist/components/Deposit/src/components/evm/utils/format.d.ts.map +1 -0
  21. package/dist/components/Deposit/src/components/evm/utils/index.d.ts +8 -0
  22. package/dist/components/Deposit/src/components/evm/utils/index.d.ts.map +1 -0
  23. package/dist/components/Deposit/src/components/mpc/index.d.ts +6 -0
  24. package/dist/components/Deposit/src/components/mpc/index.d.ts.map +1 -0
  25. package/dist/components/Deposit/src/components/mpc/types/index.d.ts +16 -0
  26. package/dist/components/Deposit/src/components/mpc/types/index.d.ts.map +1 -0
  27. package/dist/components/Deposit/src/constants/index.d.ts +4 -0
  28. package/dist/components/Deposit/src/constants/index.d.ts.map +1 -0
  29. package/dist/components/Deposit/src/hooks/useErc20BalanceOfWatcher.d.ts +14 -0
  30. package/dist/components/Deposit/src/hooks/useErc20BalanceOfWatcher.d.ts.map +1 -0
  31. package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts +68 -0
  32. package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts.map +1 -0
  33. package/dist/components/Deposit/src/index.d.ts +2 -2
  34. package/dist/components/Deposit/src/index.d.ts.map +1 -1
  35. package/dist/components/Deposit/src/utils.d.ts +57 -36
  36. package/dist/components/Deposit/src/utils.d.ts.map +1 -1
  37. package/dist/components/Deposit/types/index.d.ts +35 -34
  38. package/dist/components/Deposit/types/index.d.ts.map +1 -1
  39. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +19 -0
  40. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts.map +1 -0
  41. package/dist/components/LoadingSpinner/index.d.ts +4 -0
  42. package/dist/components/LoadingSpinner/index.d.ts.map +1 -0
  43. package/dist/components/Provider/index.d.ts +6 -1
  44. package/dist/components/Provider/index.d.ts.map +1 -1
  45. package/dist/components/Tabs/index.d.ts +6 -0
  46. package/dist/components/Tabs/index.d.ts.map +1 -0
  47. package/dist/components/Tabs/src/Tab.d.ts +5 -0
  48. package/dist/components/Tabs/src/Tab.d.ts.map +1 -0
  49. package/dist/components/Tabs/src/Tabs.d.ts +5 -0
  50. package/dist/components/Tabs/src/Tabs.d.ts.map +1 -0
  51. package/dist/components/Tabs/src/TabsList.d.ts +5 -0
  52. package/dist/components/Tabs/src/TabsList.d.ts.map +1 -0
  53. package/dist/components/Tabs/src/TabsPanel.d.ts +5 -0
  54. package/dist/components/Tabs/src/TabsPanel.d.ts.map +1 -0
  55. package/dist/components/Tabs/src/context.d.ts +16 -0
  56. package/dist/components/Tabs/src/context.d.ts.map +1 -0
  57. package/dist/components/Tabs/src/index.d.ts +6 -0
  58. package/dist/components/Tabs/src/index.d.ts.map +1 -0
  59. package/dist/components/Tabs/types/index.d.ts +28 -0
  60. package/dist/components/Tabs/types/index.d.ts.map +1 -0
  61. package/dist/components/Tooltip/index.d.ts +3 -0
  62. package/dist/components/Tooltip/index.d.ts.map +1 -0
  63. package/dist/components/Tooltip/src/Tooltip.d.ts +5 -0
  64. package/dist/components/Tooltip/src/Tooltip.d.ts.map +1 -0
  65. package/dist/components/Tooltip/src/TooltipArrow.d.ts +5 -0
  66. package/dist/components/Tooltip/src/TooltipArrow.d.ts.map +1 -0
  67. package/dist/components/Tooltip/src/index.d.ts +3 -0
  68. package/dist/components/Tooltip/src/index.d.ts.map +1 -0
  69. package/dist/components/Tooltip/types/index.d.ts +52 -0
  70. package/dist/components/Tooltip/types/index.d.ts.map +1 -0
  71. package/dist/components/Withdraw/constants/index.d.ts +7 -0
  72. package/dist/components/Withdraw/constants/index.d.ts.map +1 -0
  73. package/dist/components/Withdraw/index.d.ts +6 -10
  74. package/dist/components/Withdraw/index.d.ts.map +1 -1
  75. package/dist/components/Withdraw/src/Speed.d.ts +10 -0
  76. package/dist/components/Withdraw/src/Speed.d.ts.map +1 -0
  77. package/dist/components/Withdraw/src/WithdrawManager.d.ts +12 -0
  78. package/dist/components/Withdraw/src/WithdrawManager.d.ts.map +1 -0
  79. package/dist/components/Withdraw/src/constants.d.ts +24 -0
  80. package/dist/components/Withdraw/src/constants.d.ts.map +1 -0
  81. package/dist/components/Withdraw/src/evm/WalletView.d.ts +25 -0
  82. package/dist/components/Withdraw/src/evm/WalletView.d.ts.map +1 -0
  83. package/dist/components/Withdraw/src/evm/index.d.ts +35 -0
  84. package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -0
  85. package/dist/components/Withdraw/src/index.d.ts +5 -0
  86. package/dist/components/Withdraw/src/index.d.ts.map +1 -0
  87. package/dist/components/Withdraw/types/index.d.ts +74 -0
  88. package/dist/components/Withdraw/types/index.d.ts.map +1 -0
  89. package/dist/components/shared/components/SpeedLevel/ActiveSpeed.d.ts +5 -0
  90. package/dist/components/shared/components/SpeedLevel/ActiveSpeed.d.ts.map +1 -0
  91. package/dist/components/shared/components/SpeedLevel/InactiveSpeed.d.ts +5 -0
  92. package/dist/components/shared/components/SpeedLevel/InactiveSpeed.d.ts.map +1 -0
  93. package/dist/components/shared/components/SpeedLevel/index.d.ts +6 -0
  94. package/dist/components/shared/components/SpeedLevel/index.d.ts.map +1 -0
  95. package/dist/components/shared/components/SpeedLevel/types/index.d.ts +6 -0
  96. package/dist/components/shared/components/SpeedLevel/types/index.d.ts.map +1 -0
  97. package/dist/components/shared/components/selector/AssetTabs.d.ts +5 -0
  98. package/dist/components/shared/components/selector/AssetTabs.d.ts.map +1 -0
  99. package/dist/components/shared/components/selector/Chain.d.ts +5 -0
  100. package/dist/components/shared/components/selector/Chain.d.ts.map +1 -0
  101. package/dist/components/shared/components/selector/index.d.ts +5 -0
  102. package/dist/components/shared/components/selector/index.d.ts.map +1 -0
  103. package/dist/components/shared/components/selector/types/index.d.ts +38 -0
  104. package/dist/components/shared/components/selector/types/index.d.ts.map +1 -0
  105. package/dist/components/shared/constants/index.d.ts +3 -0
  106. package/dist/components/shared/constants/index.d.ts.map +1 -0
  107. package/dist/components/shared/hooks/index.d.ts +1 -0
  108. package/dist/components/shared/hooks/index.d.ts.map +1 -0
  109. package/dist/components/shared/types/index.d.ts +10 -0
  110. package/dist/components/shared/types/index.d.ts.map +1 -0
  111. package/dist/components/shared/utils/index.d.ts +23 -0
  112. package/dist/components/shared/utils/index.d.ts.map +1 -0
  113. package/dist/hooks/index.d.ts +2 -0
  114. package/dist/hooks/index.d.ts.map +1 -1
  115. package/dist/hooks/usePoolBalance.d.ts +19 -0
  116. package/dist/hooks/usePoolBalance.d.ts.map +1 -0
  117. package/dist/hooks/useTranslation.d.ts +147 -0
  118. package/dist/hooks/useTranslation.d.ts.map +1 -0
  119. package/dist/index-BHtDUYOi.mjs +20228 -0
  120. package/dist/index-BHtDUYOi.mjs.map +1 -0
  121. package/dist/index.d.ts +10 -3
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.esm.js +30 -6970
  124. package/dist/index.esm.js.map +1 -1
  125. package/dist/index.umd.js +84 -55
  126. package/dist/index.umd.js.map +1 -1
  127. package/dist/locales/en-US.d.ts +56 -0
  128. package/dist/locales/en-US.d.ts.map +1 -0
  129. package/dist/locales/index.d.ts +16 -0
  130. package/dist/locales/index.d.ts.map +1 -0
  131. package/dist/locales/ja-JP.d.ts +56 -0
  132. package/dist/locales/ja-JP.d.ts.map +1 -0
  133. package/dist/locales/ru-RU.d.ts +56 -0
  134. package/dist/locales/ru-RU.d.ts.map +1 -0
  135. package/dist/locales/zh-CN.d.ts +57 -0
  136. package/dist/locales/zh-CN.d.ts.map +1 -0
  137. package/dist/locales/zh-TW.d.ts +56 -0
  138. package/dist/locales/zh-TW.d.ts.map +1 -0
  139. package/dist/style.css +1 -0
  140. package/dist/types/index.d.ts +12 -1
  141. package/dist/types/index.d.ts.map +1 -1
  142. package/dist/utils/index.d.ts +14 -0
  143. package/dist/utils/index.d.ts.map +1 -0
  144. package/package.json +14 -5
  145. package/dist/components/Deposit/src/Deposit.d.ts +0 -15
  146. package/dist/components/Deposit/src/Deposit.d.ts.map +0 -1
  147. package/dist/components/Deposit/src/WalletProvider.d.ts +0 -23
  148. package/dist/components/Deposit/src/WalletProvider.d.ts.map +0 -1
  149. package/dist/components/Deposit/src/components.d.ts +0 -89
  150. package/dist/components/Deposit/src/components.d.ts.map +0 -1
  151. package/dist/components/Deposit/src/evm/WalletView.d.ts +0 -17
  152. package/dist/components/Deposit/src/evm/WalletView.d.ts.map +0 -1
  153. package/dist/components/Deposit/src/evm/index.d.ts +0 -18
  154. package/dist/components/Deposit/src/evm/index.d.ts.map +0 -1
  155. package/dist/components/Deposit/src/mpc/WalletView.d.ts +0 -12
  156. package/dist/components/Deposit/src/mpc/WalletView.d.ts.map +0 -1
  157. package/dist/components/Deposit/src/mpc/index.d.ts +0 -18
  158. package/dist/components/Deposit/src/mpc/index.d.ts.map +0 -1
  159. package/dist/components/Deposit/src/selector/Asset.d.ts +0 -19
  160. package/dist/components/Deposit/src/selector/Asset.d.ts.map +0 -1
  161. package/dist/components/Deposit/src/selector/Chain.d.ts +0 -15
  162. package/dist/components/Deposit/src/selector/Chain.d.ts.map +0 -1
  163. package/dist/components/Deposit/src/selector/index.d.ts +0 -13
  164. package/dist/components/Deposit/src/selector/index.d.ts.map +0 -1
  165. package/dist/components/Deposit/src/walletAdapters.d.ts +0 -67
  166. package/dist/components/Deposit/src/walletAdapters.d.ts.map +0 -1
  167. package/dist/components/Deposit/types/wallet-hooks.d.ts +0 -78
  168. package/dist/components/Deposit/types/wallet-hooks.d.ts.map +0 -1
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(fe,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],h):(fe=typeof globalThis<"u"?globalThis:fe||self,h(fe.EdgeXComponents={},fe.React,fe.ReactDOM))})(this,function(fe,h,we){"use strict";var td=Object.defineProperty;var nd=(fe,h,we)=>h in fe?td(fe,h,{enumerable:!0,configurable:!0,writable:!0,value:we}):fe[h]=we;var Ye=(fe,h,we)=>nd(fe,typeof h!="symbol"?h+"":h,we);function Er(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 D=Er(h),It=Er(we);function gs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fn={exports:{}},Et={};/**
1
+ (function(ie,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],x):(ie=typeof globalThis<"u"?globalThis:ie||self,x(ie.EdgeXComponents={},ie.React,ie.ReactDOM))})(this,function(ie,x,Le){"use strict";var ZP=Object.defineProperty;var KP=(ie,x,Le)=>x in ie?ZP(ie,x,{enumerable:!0,configurable:!0,writable:!0,value:Le}):ie[x]=Le;var Lo=(ie,x,Le)=>KP(ie,typeof x!="symbol"?x+"":x,Le);function du(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const z=du(x),Nr=du(Le);function im(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oi={exports:{}},Ir={};/**
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 wr;function bs(){if(wr)return Et;wr=1;var e=h,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 c(u,i,l){var a,d={},f=null,p=null;l!==void 0&&(f=""+l),i.key!==void 0&&(f=""+i.key),i.ref!==void 0&&(p=i.ref);for(a in i)r.call(i,a)&&!s.hasOwnProperty(a)&&(d[a]=i[a]);if(u&&u.defaultProps)for(a in i=u.defaultProps,i)d[a]===void 0&&(d[a]=i[a]);return{$$typeof:t,type:u,key:f,ref:p,props:d,_owner:o.current}}return Et.Fragment=n,Et.jsx=c,Et.jsxs=c,Et}var wt={};/**
9
+ */var pu;function am(){if(pu)return Ir;pu=1;var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(c,a,u){var l,d={},f=null,p=null;u!==void 0&&(f=""+u),a.key!==void 0&&(f=""+a.key),a.ref!==void 0&&(p=a.ref);for(l in a)r.call(a,l)&&!s.hasOwnProperty(l)&&(d[l]=a[l]);if(c&&c.defaultProps)for(l in a=c.defaultProps,a)d[l]===void 0&&(d[l]=a[l]);return{$$typeof:t,type:c,key:f,ref:p,props:d,_owner:o.current}}return Ir.Fragment=n,Ir.jsx=i,Ir.jsxs=i,Ir}var kr={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,48 +14,95 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var xr;function ys(){return xr||(xr=1,process.env.NODE_ENV!=="production"&&function(){var e=h,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"),c=Symbol.for("react.provider"),u=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),a=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),m=Symbol.iterator,g="@@iterator";function b(v){if(v===null||typeof v!="object")return null;var T=m&&v[m]||v[g];return typeof T=="function"?T:null}var x=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(v){{for(var T=arguments.length,_=new Array(T>1?T-1:0),z=1;z<T;z++)_[z-1]=arguments[z];y("error",v,_)}}function y(v,T,_){{var z=x.ReactDebugCurrentFrame,le=z.getStackAddendum();le!==""&&(T+="%s",_=_.concat([le]));var ae=_.map(function(re){return String(re)});ae.unshift("Warning: "+T),Function.prototype.apply.call(console[v],console,ae)}}var S=!1,E=!1,F=!1,j=!1,K=!1,ee;ee=Symbol.for("react.module.reference");function L(v){return!!(typeof v=="string"||typeof v=="function"||v===r||v===s||K||v===o||v===l||v===a||j||v===p||S||E||F||typeof v=="object"&&v!==null&&(v.$$typeof===f||v.$$typeof===d||v.$$typeof===c||v.$$typeof===u||v.$$typeof===i||v.$$typeof===ee||v.getModuleId!==void 0))}function N(v,T,_){var z=v.displayName;if(z)return z;var le=T.displayName||T.name||"";return le!==""?_+"("+le+")":_}function oe(v){return v.displayName||"Context"}function H(v){if(v==null)return null;if(typeof v.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof v=="function")return v.displayName||v.name||null;if(typeof v=="string")return v;switch(v){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case a:return"SuspenseList"}if(typeof v=="object")switch(v.$$typeof){case u:var T=v;return oe(T)+".Consumer";case c:var _=v;return oe(_._context)+".Provider";case i:return N(v,v.render,"ForwardRef");case d:var z=v.displayName||null;return z!==null?z:H(v.type)||"Memo";case f:{var le=v,ae=le._payload,re=le._init;try{return H(re(ae))}catch{return null}}}return null}var W=Object.assign,X=0,G,J,P,U,C,A,k;function I(){}I.__reactDisabledLog=!0;function B(){{if(X===0){G=console.log,J=console.info,P=console.warn,U=console.error,C=console.group,A=console.groupCollapsed,k=console.groupEnd;var v={configurable:!0,enumerable:!0,value:I,writable:!0};Object.defineProperties(console,{info:v,log:v,warn:v,error:v,group:v,groupCollapsed:v,groupEnd:v})}X++}}function q(){{if(X--,X===0){var v={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},v,{value:G}),info:W({},v,{value:J}),warn:W({},v,{value:P}),error:W({},v,{value:U}),group:W({},v,{value:C}),groupCollapsed:W({},v,{value:A}),groupEnd:W({},v,{value:k})})}X<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Y=x.ReactCurrentDispatcher,$;function R(v,T,_){{if($===void 0)try{throw Error()}catch(le){var z=le.stack.trim().match(/\n( *(at )?)/);$=z&&z[1]||""}return`
18
- `+$+v}}var V=!1,Q;{var ye=typeof WeakMap=="function"?WeakMap:Map;Q=new ye}function M(v,T){if(!v||V)return"";{var _=Q.get(v);if(_!==void 0)return _}var z;V=!0;var le=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ae;ae=Y.current,Y.current=null,B();try{if(T){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(Ce){z=Ce}Reflect.construct(v,[],re)}else{try{re.call()}catch(Ce){z=Ce}v.call(re.prototype)}}else{try{throw Error()}catch(Ce){z=Ce}v()}}catch(Ce){if(Ce&&z&&typeof Ce.stack=="string"){for(var te=Ce.stack.split(`
19
- `),Ee=z.stack.split(`
20
- `),pe=te.length-1,he=Ee.length-1;pe>=1&&he>=0&&te[pe]!==Ee[he];)he--;for(;pe>=1&&he>=0;pe--,he--)if(te[pe]!==Ee[he]){if(pe!==1||he!==1)do if(pe--,he--,he<0||te[pe]!==Ee[he]){var Le=`
21
- `+te[pe].replace(" at new "," at ");return v.displayName&&Le.includes("<anonymous>")&&(Le=Le.replace("<anonymous>",v.displayName)),typeof v=="function"&&Q.set(v,Le),Le}while(pe>=1&&he>=0);break}}}finally{V=!1,Y.current=ae,q(),Error.prepareStackTrace=le}var yt=v?v.displayName||v.name:"",lt=yt?R(yt):"";return typeof v=="function"&&Q.set(v,lt),lt}function _e(v,T,_){return M(v,!1)}function gt(v){var T=v.prototype;return!!(T&&T.isReactComponent)}function st(v,T,_){if(v==null)return"";if(typeof v=="function")return M(v,gt(v));if(typeof v=="string")return R(v);switch(v){case l:return R("Suspense");case a:return R("SuspenseList")}if(typeof v=="object")switch(v.$$typeof){case i:return _e(v.render);case d:return st(v.type,T,_);case f:{var z=v,le=z._payload,ae=z._init;try{return st(ae(le),T,_)}catch{}}}return""}var Ft=Object.prototype.hasOwnProperty,ns={},rs=x.ReactDebugCurrentFrame;function cn(v){if(v){var T=v._owner,_=st(v.type,v._source,T?T.type:null);rs.setExtraStackFrame(_)}else rs.setExtraStackFrame(null)}function Df(v,T,_,z,le){{var ae=Function.call.bind(Ft);for(var re in v)if(ae(v,re)){var te=void 0;try{if(typeof v[re]!="function"){var Ee=Error((z||"React class")+": "+_+" type `"+re+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof v[re]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ee.name="Invariant Violation",Ee}te=v[re](T,re,z,_,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(pe){te=pe}te&&!(te instanceof Error)&&(cn(le),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).",z||"React class",_,re,typeof te),cn(null)),te instanceof Error&&!(te.message in ns)&&(ns[te.message]=!0,cn(le),w("Failed %s type: %s",_,te.message),cn(null))}}}var Ff=Array.isArray;function mr(v){return Ff(v)}function If(v){{var T=typeof Symbol=="function"&&Symbol.toStringTag,_=T&&v[Symbol.toStringTag]||v.constructor.name||"Object";return _}}function kf(v){try{return os(v),!1}catch{return!0}}function os(v){return""+v}function is(v){if(kf(v))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",If(v)),os(v)}var ss=x.ReactCurrentOwner,Nf={key:!0,ref:!0,__self:!0,__source:!0},ls,as;function jf(v){if(Ft.call(v,"ref")){var T=Object.getOwnPropertyDescriptor(v,"ref").get;if(T&&T.isReactWarning)return!1}return v.ref!==void 0}function Rf(v){if(Ft.call(v,"key")){var T=Object.getOwnPropertyDescriptor(v,"key").get;if(T&&T.isReactWarning)return!1}return v.key!==void 0}function Wf(v,T){typeof v.ref=="string"&&ss.current}function Bf(v,T){{var _=function(){ls||(ls=!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)",T))};_.isReactWarning=!0,Object.defineProperty(v,"key",{get:_,configurable:!0})}}function Hf(v,T){{var _=function(){as||(as=!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)",T))};_.isReactWarning=!0,Object.defineProperty(v,"ref",{get:_,configurable:!0})}}var Uf=function(v,T,_,z,le,ae,re){var te={$$typeof:t,type:v,key:T,ref:_,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:z}),Object.defineProperty(te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:le}),Object.freeze&&(Object.freeze(te.props),Object.freeze(te)),te};function Vf(v,T,_,z,le){{var ae,re={},te=null,Ee=null;_!==void 0&&(is(_),te=""+_),Rf(T)&&(is(T.key),te=""+T.key),jf(T)&&(Ee=T.ref,Wf(T,le));for(ae in T)Ft.call(T,ae)&&!Nf.hasOwnProperty(ae)&&(re[ae]=T[ae]);if(v&&v.defaultProps){var pe=v.defaultProps;for(ae in pe)re[ae]===void 0&&(re[ae]=pe[ae])}if(te||Ee){var he=typeof v=="function"?v.displayName||v.name||"Unknown":v;te&&Bf(re,he),Ee&&Hf(re,he)}return Uf(v,te,Ee,le,z,ss.current,re)}}var vr=x.ReactCurrentOwner,us=x.ReactDebugCurrentFrame;function bt(v){if(v){var T=v._owner,_=st(v.type,v._source,T?T.type:null);us.setExtraStackFrame(_)}else us.setExtraStackFrame(null)}var gr;gr=!1;function br(v){return typeof v=="object"&&v!==null&&v.$$typeof===t}function cs(){{if(vr.current){var v=H(vr.current.type);if(v)return`
17
+ */var hu;function cm(){return hu||(hu=1,process.env.NODE_ENV!=="production"&&function(){var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function w(R){if(R===null||typeof R!="object")return null;var q=h&&R[h]||R[m];return typeof q=="function"?q:null}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(R){{for(var q=arguments.length,X=new Array(q>1?q-1:0),oe=1;oe<q;oe++)X[oe-1]=arguments[oe];A("error",R,X)}}function A(R,q,X){{var oe=T.ReactDebugCurrentFrame,he=oe.getStackAddendum();he!==""&&(q+="%s",X=X.concat([he]));var ge=X.map(function(fe){return String(fe)});ge.unshift("Warning: "+q),Function.prototype.apply.call(console[R],console,ge)}}var M=!1,L=!1,F=!1,j=!1,g=!1,v;v=Symbol.for("react.module.reference");function $(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||g||R===o||R===u||R===l||j||R===p||M||L||F||typeof R=="object"&&R!==null&&(R.$$typeof===f||R.$$typeof===d||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===v||R.getModuleId!==void 0))}function I(R,q,X){var oe=R.displayName;if(oe)return oe;var he=q.displayName||q.name||"";return he!==""?X+"("+he+")":X}function N(R){return R.displayName||"Context"}function P(R){if(R==null)return null;if(typeof R.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var q=R;return N(q)+".Consumer";case i:var X=R;return N(X._context)+".Provider";case a:return I(R,R.render,"ForwardRef");case d:var oe=R.displayName||null;return oe!==null?oe:P(R.type)||"Memo";case f:{var he=R,ge=he._payload,fe=he._init;try{return P(fe(ge))}catch{return null}}}return null}var S=Object.assign,E=0,C,O,b,k,D,U,_;function H(){}H.__reactDisabledLog=!0;function K(){{if(E===0){C=console.log,O=console.info,b=console.warn,k=console.error,D=console.group,U=console.groupCollapsed,_=console.groupEnd;var R={configurable:!0,enumerable:!0,value:H,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}E++}}function W(){{if(E--,E===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},R,{value:C}),info:S({},R,{value:O}),warn:S({},R,{value:b}),error:S({},R,{value:k}),group:S({},R,{value:D}),groupCollapsed:S({},R,{value:U}),groupEnd:S({},R,{value:_})})}E<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Z=T.ReactCurrentDispatcher,G;function J(R,q,X){{if(G===void 0)try{throw Error()}catch(he){var oe=he.stack.trim().match(/\n( *(at )?)/);G=oe&&oe[1]||""}return`
18
+ `+G+R}}var ne=!1,le;{var Se=typeof WeakMap=="function"?WeakMap:Map;le=new Se}function Me(R,q){if(!R||ne)return"";{var X=le.get(R);if(X!==void 0)return X}var oe;ne=!0;var he=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=Z.current,Z.current=null,K();try{if(q){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(Ke){oe=Ke}Reflect.construct(R,[],fe)}else{try{fe.call()}catch(Ke){oe=Ke}R.call(fe.prototype)}}else{try{throw Error()}catch(Ke){oe=Ke}R()}}catch(Ke){if(Ke&&oe&&typeof Ke.stack=="string"){for(var ce=Ke.stack.split(`
19
+ `),je=oe.stack.split(`
20
+ `),Pe=ce.length-1,Ae=je.length-1;Pe>=1&&Ae>=0&&ce[Pe]!==je[Ae];)Ae--;for(;Pe>=1&&Ae>=0;Pe--,Ae--)if(ce[Pe]!==je[Ae]){if(Pe!==1||Ae!==1)do if(Pe--,Ae--,Ae<0||ce[Pe]!==je[Ae]){var pt=`
21
+ `+ce[Pe].replace(" at new "," at ");return R.displayName&&pt.includes("<anonymous>")&&(pt=pt.replace("<anonymous>",R.displayName)),typeof R=="function"&&le.set(R,pt),pt}while(Pe>=1&&Ae>=0);break}}}finally{ne=!1,Z.current=ge,W(),Error.prepareStackTrace=he}var Or=R?R.displayName||R.name:"",Kn=Or?J(Or):"";return typeof R=="function"&&le.set(R,Kn),Kn}function Y(R,q,X){return Me(R,!1)}function ee(R){var q=R.prototype;return!!(q&&q.isReactComponent)}function Q(R,q,X){if(R==null)return"";if(typeof R=="function")return Me(R,ee(R));if(typeof R=="string")return J(R);switch(R){case u:return J("Suspense");case l:return J("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return Y(R.render);case d:return Q(R.type,q,X);case f:{var oe=R,he=oe._payload,ge=oe._init;try{return Q(ge(he),q,X)}catch{}}}return""}var me=Object.prototype.hasOwnProperty,de={},qn=T.ReactDebugCurrentFrame;function Je(R){if(R){var q=R._owner,X=Q(R.type,R._source,q?q.type:null);qn.setExtraStackFrame(X)}else qn.setExtraStackFrame(null)}function Zn(R,q,X,oe,he){{var ge=Function.call.bind(me);for(var fe in R)if(ge(R,fe)){var ce=void 0;try{if(typeof R[fe]!="function"){var je=Error((oe||"React class")+": "+X+" type `"+fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw je.name="Invariant Violation",je}ce=R[fe](q,fe,oe,X,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Pe){ce=Pe}ce&&!(ce instanceof Error)&&(Je(he),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",oe||"React class",X,fe,typeof ce),Je(null)),ce instanceof Error&&!(ce.message in de)&&(de[ce.message]=!0,Je(he),y("Failed %s type: %s",X,ce.message),Je(null))}}}var ri=Array.isArray;function su(R){return ri(R)}function CP(R){{var q=typeof Symbol=="function"&&Symbol.toStringTag,X=q&&R[Symbol.toStringTag]||R.constructor.name||"Object";return X}}function OP(R){try{return q0(R),!1}catch{return!0}}function q0(R){return""+R}function Z0(R){if(OP(R))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",CP(R)),q0(R)}var K0=T.ReactCurrentOwner,NP={key:!0,ref:!0,__self:!0,__source:!0},Y0,X0;function IP(R){if(me.call(R,"ref")){var q=Object.getOwnPropertyDescriptor(R,"ref").get;if(q&&q.isReactWarning)return!1}return R.ref!==void 0}function kP(R){if(me.call(R,"key")){var q=Object.getOwnPropertyDescriptor(R,"key").get;if(q&&q.isReactWarning)return!1}return R.key!==void 0}function BP(R,q){typeof R.ref=="string"&&K0.current}function MP(R,q){{var X=function(){Y0||(Y0=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};X.isReactWarning=!0,Object.defineProperty(R,"key",{get:X,configurable:!0})}}function LP(R,q){{var X=function(){X0||(X0=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};X.isReactWarning=!0,Object.defineProperty(R,"ref",{get:X,configurable:!0})}}var RP=function(R,q,X,oe,he,ge,fe){var ce={$$typeof:t,type:R,key:q,ref:X,props:fe,_owner:ge};return ce._store={},Object.defineProperty(ce._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ce,"_self",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.defineProperty(ce,"_source",{configurable:!1,enumerable:!1,writable:!1,value:he}),Object.freeze&&(Object.freeze(ce.props),Object.freeze(ce)),ce};function DP(R,q,X,oe,he){{var ge,fe={},ce=null,je=null;X!==void 0&&(Z0(X),ce=""+X),kP(q)&&(Z0(q.key),ce=""+q.key),IP(q)&&(je=q.ref,BP(q,he));for(ge in q)me.call(q,ge)&&!NP.hasOwnProperty(ge)&&(fe[ge]=q[ge]);if(R&&R.defaultProps){var Pe=R.defaultProps;for(ge in Pe)fe[ge]===void 0&&(fe[ge]=Pe[ge])}if(ce||je){var Ae=typeof R=="function"?R.displayName||R.name||"Unknown":R;ce&&MP(fe,Ae),je&&LP(fe,Ae)}return RP(R,ce,je,he,oe,K0.current,fe)}}var iu=T.ReactCurrentOwner,Q0=T.ReactDebugCurrentFrame;function Cr(R){if(R){var q=R._owner,X=Q(R.type,R._source,q?q.type:null);Q0.setExtraStackFrame(X)}else Q0.setExtraStackFrame(null)}var au;au=!1;function cu(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function J0(){{if(iu.current){var R=P(iu.current.type);if(R)return`
22
22
 
23
- Check the render method of \``+v+"`."}return""}}function zf(v){return""}var fs={};function Yf(v){{var T=cs();if(!T){var _=typeof v=="string"?v:v.displayName||v.name;_&&(T=`
23
+ Check the render method of \``+R+"`."}return""}}function FP(R){return""}var em={};function jP(R){{var q=J0();if(!q){var X=typeof R=="string"?R:R.displayName||R.name;X&&(q=`
24
24
 
25
- Check the top-level render call using <`+_+">.")}return T}}function ds(v,T){{if(!v._store||v._store.validated||v.key!=null)return;v._store.validated=!0;var _=Yf(T);if(fs[_])return;fs[_]=!0;var z="";v&&v._owner&&v._owner!==vr.current&&(z=" It was passed a child from "+H(v._owner.type)+"."),bt(v),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',_,z),bt(null)}}function ps(v,T){{if(typeof v!="object")return;if(mr(v))for(var _=0;_<v.length;_++){var z=v[_];br(z)&&ds(z,T)}else if(br(v))v._store&&(v._store.validated=!0);else if(v){var le=b(v);if(typeof le=="function"&&le!==v.entries)for(var ae=le.call(v),re;!(re=ae.next()).done;)br(re.value)&&ds(re.value,T)}}}function Gf(v){{var T=v.type;if(T==null||typeof T=="string")return;var _;if(typeof T=="function")_=T.propTypes;else if(typeof T=="object"&&(T.$$typeof===i||T.$$typeof===d))_=T.propTypes;else return;if(_){var z=H(T);Df(_,v.props,"prop",z,v)}else if(T.PropTypes!==void 0&&!gr){gr=!0;var le=H(T);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",le||"Unknown")}typeof T.getDefaultProps=="function"&&!T.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function qf(v){{for(var T=Object.keys(v.props),_=0;_<T.length;_++){var z=T[_];if(z!=="children"&&z!=="key"){bt(v),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",z),bt(null);break}}v.ref!==null&&(bt(v),w("Invalid attribute `ref` supplied to `React.Fragment`."),bt(null))}}var hs={};function ms(v,T,_,z,le,ae){{var re=L(v);if(!re){var te="";(v===void 0||typeof v=="object"&&v!==null&&Object.keys(v).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 Ee=zf();Ee?te+=Ee:te+=cs();var pe;v===null?pe="null":mr(v)?pe="array":v!==void 0&&v.$$typeof===t?(pe="<"+(H(v.type)||"Unknown")+" />",te=" Did you accidentally export a JSX literal instead of a component?"):pe=typeof v,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 he=Vf(v,T,_,le,ae);if(he==null)return he;if(re){var Le=T.children;if(Le!==void 0)if(z)if(mr(Le)){for(var yt=0;yt<Le.length;yt++)ps(Le[yt],v);Object.freeze&&Object.freeze(Le)}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 ps(Le,v)}if(Ft.call(T,"key")){var lt=H(v),Ce=Object.keys(T).filter(function(ed){return ed!=="key"}),yr=Ce.length>0?"{key: someKey, "+Ce.join(": ..., ")+": ...}":"{key: someKey}";if(!hs[lt+yr]){var Zf=Ce.length>0?"{"+Ce.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+X+">.")}return q}}function tm(R,q){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var X=jP(q);if(em[X])return;em[X]=!0;var oe="";R&&R._owner&&R._owner!==iu.current&&(oe=" It was passed a child from "+P(R._owner.type)+"."),Cr(R),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',X,oe),Cr(null)}}function nm(R,q){{if(typeof R!="object")return;if(su(R))for(var X=0;X<R.length;X++){var oe=R[X];cu(oe)&&tm(oe,q)}else if(cu(R))R._store&&(R._store.validated=!0);else if(R){var he=w(R);if(typeof he=="function"&&he!==R.entries)for(var ge=he.call(R),fe;!(fe=ge.next()).done;)cu(fe.value)&&tm(fe.value,q)}}}function _P(R){{var q=R.type;if(q==null||typeof q=="string")return;var X;if(typeof q=="function")X=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===d))X=q.propTypes;else return;if(X){var oe=P(q);Zn(X,R.props,"prop",oe,R)}else if(q.PropTypes!==void 0&&!au){au=!0;var he=P(q);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",he||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function UP(R){{for(var q=Object.keys(R.props),X=0;X<q.length;X++){var oe=q[X];if(oe!=="children"&&oe!=="key"){Cr(R),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",oe),Cr(null);break}}R.ref!==null&&(Cr(R),y("Invalid attribute `ref` supplied to `React.Fragment`."),Cr(null))}}var rm={};function om(R,q,X,oe,he,ge){{var fe=$(R);if(!fe){var ce="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(ce+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var je=FP();je?ce+=je:ce+=J0();var Pe;R===null?Pe="null":su(R)?Pe="array":R!==void 0&&R.$$typeof===t?(Pe="<"+(P(R.type)||"Unknown")+" />",ce=" Did you accidentally export a JSX literal instead of a component?"):Pe=typeof R,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Pe,ce)}var Ae=DP(R,q,X,he,ge);if(Ae==null)return Ae;if(fe){var pt=q.children;if(pt!==void 0)if(oe)if(su(pt)){for(var Or=0;Or<pt.length;Or++)nm(pt[Or],R);Object.freeze&&Object.freeze(pt)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else nm(pt,R)}if(me.call(q,"key")){var Kn=P(R),Ke=Object.keys(q).filter(function(qP){return qP!=="key"}),uu=Ke.length>0?"{key: someKey, "+Ke.join(": ..., ")+": ...}":"{key: someKey}";if(!rm[Kn+uu]){var GP=Ke.length>0?"{"+Ke.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,yr,lt,Zf,lt),hs[lt+yr]=!0}}return v===r?qf(he):Gf(he),he}}function Kf(v,T,_){return ms(v,T,_,!0)}function Qf(v,T,_){return ms(v,T,_,!1)}var Xf=Qf,Jf=Kf;wt.Fragment=r,wt.jsx=Xf,wt.jsxs=Jf}()),wt}process.env.NODE_ENV==="production"?fn.exports=bs():fn.exports=ys();var O=fn.exports;const Es=h.createContext(null),ws=({config:e,children:t})=>O.jsx(Es.Provider,{value:e,children:t}),Cr={emit:(e,t)=>{console.log("Event emitted:",e,t)}},xs=()=>({openDeposit:h.useCallback(t=>{Cr.emit("deposit:open",t)},[])}),Cs=()=>({openWithdraw:h.useCallback(t=>{Cr.emit("withdraw:open",t)},[])});/**
30
+ <%s key={someKey} {...props} />`,uu,Kn,GP,Kn),rm[Kn+uu]=!0}}return R===r?UP(Ae):_P(Ae),Ae}}function zP(R,q,X){return om(R,q,X,!0)}function HP(R,q,X){return om(R,q,X,!1)}var WP=HP,VP=zP;kr.Fragment=r,kr.jsx=WP,kr.jsxs=VP}()),kr}process.env.NODE_ENV==="production"?oi.exports=am():oi.exports=cm();var B=oi.exports;const um={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
+ 充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。"}},lm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
32
+ If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",crossChainPoolBalance:"Cross-chain pool balance",poolBalance:"Pool balance",poolBalanceInsufficientTip:"The withdrawal amount exceeds the fund pool balance, and the withdrawal cannot be processed. Please select an option with a sufficient fund pool balance."}},fm={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
33
+ 入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"}},dm={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
34
+ Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:"Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.",layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."}},pm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
35
+ 充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"}},si=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],mu={"en-US":lm,"ja-JP":fm,"ru-RU":dm,"zh-CN":um,"zh-TW":pm},Ro="en-US",hm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},mm=e=>si.includes(e)?mu[e]:mu[Ro],gm=e=>si.includes(e),gu=x.createContext(null),bm=({config:e,children:t})=>{const n=x.useMemo(()=>{const r=e.locale||Ro,o=gm(r)?r:Ro,s=mm(o);return{...e,currentLocale:o,translations:s}},[e]);return B.jsx(gu.Provider,{value:n,children:t})},bu=()=>{const e=x.useContext(gu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var ym=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ii=Math.ceil,et=Math.floor,_e="[BigNumber Error] ",yu=_e+"Number primitive has more than 15 significant digits: ",ht=1e14,se=14,ai=9007199254740991,ci=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ln=1e7,Oe=1e9;function wu(e){var t,n,r,o=y.prototype={constructor:y,toString:null,valueOf:null},s=new y(1),i=20,c=4,a=-7,u=21,l=-1e7,d=1e7,f=!1,p=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},w="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function y(g,v){var $,I,N,P,S,E,C,O,b=this;if(!(b instanceof y))return new y(g,v);if(v==null){if(g&&g._isBigNumber===!0){b.s=g.s,!g.c||g.e>d?b.c=b.e=null:g.e<l?b.c=[b.e=0]:(b.e=g.e,b.c=g.c.slice());return}if((E=typeof g=="number")&&g*0==0){if(b.s=1/g<0?(g=-g,-1):1,g===~~g){for(P=0,S=g;S>=10;S/=10,P++);P>d?b.c=b.e=null:(b.e=P,b.c=[g]);return}O=String(g)}else{if(!ym.test(O=String(g)))return r(b,O,E);b.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(P=O.indexOf("."))>-1&&(O=O.replace(".","")),(S=O.search(/e/i))>0?(P<0&&(P=S),P+=+O.slice(S+1),O=O.substring(0,S)):P<0&&(P=O.length)}else{if(we(v,2,w.length,"Base"),v==10&&T)return b=new y(g),F(b,i+b.e+1,c);if(O=String(g),E=typeof g=="number"){if(g*0!=0)return r(b,O,E,v);if(b.s=1/g<0?(O=O.slice(1),-1):1,y.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(yu+g)}else b.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for($=w.slice(0,v),P=S=0,C=O.length;S<C;S++)if($.indexOf(I=O.charAt(S))<0){if(I=="."){if(S>P){P=C;continue}}else if(!N&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){N=!0,S=-1,P=0;continue}return r(b,String(g),E,v)}E=!1,O=n(O,v,10,b.s),(P=O.indexOf("."))>-1?O=O.replace(".",""):P=O.length}for(S=0;O.charCodeAt(S)===48;S++);for(C=O.length;O.charCodeAt(--C)===48;);if(O=O.slice(S,++C)){if(C-=S,E&&y.DEBUG&&C>15&&(g>ai||g!==et(g)))throw Error(yu+b.s*g);if((P=P-S-1)>d)b.c=b.e=null;else if(P<l)b.c=[b.e=0];else{if(b.e=P,b.c=[],S=(P+1)%se,P<0&&(S+=se),S<C){for(S&&b.c.push(+O.slice(0,S)),C-=se;S<C;)b.c.push(+O.slice(S,S+=se));S=se-(O=O.slice(S)).length}else S-=C;for(;S--;O+="0");b.c.push(+O)}}else b.c=[b.e=0]}y.clone=wu,y.ROUND_UP=0,y.ROUND_DOWN=1,y.ROUND_CEIL=2,y.ROUND_FLOOR=3,y.ROUND_HALF_UP=4,y.ROUND_HALF_DOWN=5,y.ROUND_HALF_EVEN=6,y.ROUND_HALF_CEIL=7,y.ROUND_HALF_FLOOR=8,y.EUCLID=9,y.config=y.set=function(g){var v,$;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(v="DECIMAL_PLACES")&&($=g[v],we($,0,Oe,v),i=$),g.hasOwnProperty(v="ROUNDING_MODE")&&($=g[v],we($,0,8,v),c=$),g.hasOwnProperty(v="EXPONENTIAL_AT")&&($=g[v],$&&$.pop?(we($[0],-Oe,0,v),we($[1],0,Oe,v),a=$[0],u=$[1]):(we($,-Oe,Oe,v),a=-(u=$<0?-$:$))),g.hasOwnProperty(v="RANGE"))if($=g[v],$&&$.pop)we($[0],-Oe,-1,v),we($[1],1,Oe,v),l=$[0],d=$[1];else if(we($,-Oe,Oe,v),$)l=-(d=$<0?-$:$);else throw Error(_e+v+" cannot be zero: "+$);if(g.hasOwnProperty(v="CRYPTO"))if($=g[v],$===!!$)if($)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=$;else throw f=!$,Error(_e+"crypto unavailable");else f=$;else throw Error(_e+v+" not true or false: "+$);if(g.hasOwnProperty(v="MODULO_MODE")&&($=g[v],we($,0,9,v),p=$),g.hasOwnProperty(v="POW_PRECISION")&&($=g[v],we($,0,Oe,v),h=$),g.hasOwnProperty(v="FORMAT"))if($=g[v],typeof $=="object")m=$;else throw Error(_e+v+" not an object: "+$);if(g.hasOwnProperty(v="ALPHABET"))if($=g[v],typeof $=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test($))T=$.slice(0,10)=="0123456789",w=$;else throw Error(_e+v+" invalid: "+$)}else throw Error(_e+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:h,FORMAT:m,ALPHABET:w}},y.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!y.DEBUG)return!0;var v,$,I=g.c,N=g.e,P=g.s;e:if({}.toString.call(I)=="[object Array]"){if((P===1||P===-1)&&N>=-Oe&&N<=Oe&&N===et(N)){if(I[0]===0){if(N===0&&I.length===1)return!0;break e}if(v=(N+1)%se,v<1&&(v+=se),String(I[0]).length==v){for(v=0;v<I.length;v++)if($=I[v],$<0||$>=ht||$!==et($))break e;if($!==0)return!0}}}else if(I===null&&N===null&&(P===null||P===1||P===-1))return!0;throw Error(_e+"Invalid BigNumber: "+g)},y.maximum=y.max=function(){return M(arguments,-1)},y.minimum=y.min=function(){return M(arguments,1)},y.random=function(){var g=9007199254740992,v=Math.random()*g&2097151?function(){return et(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function($){var I,N,P,S,E,C=0,O=[],b=new y(s);if($==null?$=i:we($,0,Oe),S=ii($/se),f)if(crypto.getRandomValues){for(I=crypto.getRandomValues(new Uint32Array(S*=2));C<S;)E=I[C]*131072+(I[C+1]>>>11),E>=9e15?(N=crypto.getRandomValues(new Uint32Array(2)),I[C]=N[0],I[C+1]=N[1]):(O.push(E%1e14),C+=2);C=S/2}else if(crypto.randomBytes){for(I=crypto.randomBytes(S*=7);C<S;)E=(I[C]&31)*281474976710656+I[C+1]*1099511627776+I[C+2]*4294967296+I[C+3]*16777216+(I[C+4]<<16)+(I[C+5]<<8)+I[C+6],E>=9e15?crypto.randomBytes(7).copy(I,C):(O.push(E%1e14),C+=7);C=S/7}else throw f=!1,Error(_e+"crypto unavailable");if(!f)for(;C<S;)E=v(),E<9e15&&(O[C++]=E%1e14);for(S=O[--C],$%=se,S&&$&&(E=ci[se-$],O[C]=et(S/E)*E);O[C]===0;O.pop(),C--);if(C<0)O=[P=0];else{for(P=-1;O[0]===0;O.splice(0,1),P-=se);for(C=1,E=O[0];E>=10;E/=10,C++);C<se&&(P-=se-C)}return b.e=P,b.c=O,b}}(),y.sum=function(){for(var g=1,v=arguments,$=new y(v[0]);g<v.length;)$=$.plus(v[g++]);return $},n=function(){var g="0123456789";function v($,I,N,P){for(var S,E=[0],C,O=0,b=$.length;O<b;){for(C=E.length;C--;E[C]*=I);for(E[0]+=P.indexOf($.charAt(O++)),S=0;S<E.length;S++)E[S]>N-1&&(E[S+1]==null&&(E[S+1]=0),E[S+1]+=E[S]/N|0,E[S]%=N)}return E.reverse()}return function($,I,N,P,S){var E,C,O,b,k,D,U,_,H=$.indexOf("."),K=i,W=c;for(H>=0&&(b=h,h=0,$=$.replace(".",""),_=new y(I),D=_.pow($.length-H),h=b,_.c=v(zt(nt(D.c),D.e,"0"),10,N,g),_.e=_.c.length),U=v($,I,N,S?(E=w,g):(E=g,w)),O=b=U.length;U[--b]==0;U.pop());if(!U[0])return E.charAt(0);if(H<0?--O:(D.c=U,D.e=O,D.s=P,D=t(D,_,K,W,N),U=D.c,k=D.r,O=D.e),C=O+K+1,H=U[C],b=N/2,k=k||C<0||U[C+1]!=null,k=W<4?(H!=null||k)&&(W==0||W==(D.s<0?3:2)):H>b||H==b&&(W==4||k||W==6&&U[C-1]&1||W==(D.s<0?8:7)),C<1||!U[0])$=k?zt(E.charAt(1),-K,E.charAt(0)):E.charAt(0);else{if(U.length=C,k)for(--N;++U[--C]>N;)U[C]=0,C||(++O,U=[1].concat(U));for(b=U.length;!U[--b];);for(H=0,$="";H<=b;$+=E.charAt(U[H++]));$=zt($,O,E.charAt(0))}return $}}(),t=function(){function g(I,N,P){var S,E,C,O,b=0,k=I.length,D=N%ln,U=N/ln|0;for(I=I.slice();k--;)C=I[k]%ln,O=I[k]/ln|0,S=U*C+O*D,E=D*C+S%ln*ln+b,b=(E/P|0)+(S/ln|0)+U*O,I[k]=E%P;return b&&(I=[b].concat(I)),I}function v(I,N,P,S){var E,C;if(P!=S)C=P>S?1:-1;else for(E=C=0;E<P;E++)if(I[E]!=N[E]){C=I[E]>N[E]?1:-1;break}return C}function $(I,N,P,S){for(var E=0;P--;)I[P]-=E,E=I[P]<N[P]?1:0,I[P]=E*S+I[P]-N[P];for(;!I[0]&&I.length>1;I.splice(0,1));}return function(I,N,P,S,E){var C,O,b,k,D,U,_,H,K,W,Z,G,J,ne,le,Se,Me,Y=I.s==N.s?1:-1,ee=I.c,Q=N.c;if(!ee||!ee[0]||!Q||!Q[0])return new y(!I.s||!N.s||(ee?Q&&ee[0]==Q[0]:!Q)?NaN:ee&&ee[0]==0||!Q?Y*0:Y/0);for(H=new y(Y),K=H.c=[],O=I.e-N.e,Y=P+O+1,E||(E=ht,O=tt(I.e/se)-tt(N.e/se),Y=Y/se|0),b=0;Q[b]==(ee[b]||0);b++);if(Q[b]>(ee[b]||0)&&O--,Y<0)K.push(1),k=!0;else{for(ne=ee.length,Se=Q.length,b=0,Y+=2,D=et(E/(Q[0]+1)),D>1&&(Q=g(Q,D,E),ee=g(ee,D,E),Se=Q.length,ne=ee.length),J=Se,W=ee.slice(0,Se),Z=W.length;Z<Se;W[Z++]=0);Me=Q.slice(),Me=[0].concat(Me),le=Q[0],Q[1]>=E/2&&le++;do{if(D=0,C=v(Q,W,Se,Z),C<0){if(G=W[0],Se!=Z&&(G=G*E+(W[1]||0)),D=et(G/le),D>1)for(D>=E&&(D=E-1),U=g(Q,D,E),_=U.length,Z=W.length;v(U,W,_,Z)==1;)D--,$(U,Se<_?Me:Q,_,E),_=U.length,C=1;else D==0&&(C=D=1),U=Q.slice(),_=U.length;if(_<Z&&(U=[0].concat(U)),$(W,U,Z,E),Z=W.length,C==-1)for(;v(Q,W,Se,Z)<1;)D++,$(W,Se<Z?Me:Q,Z,E),Z=W.length}else C===0&&(D++,W=[0]);K[b++]=D,W[0]?W[Z++]=ee[J]||0:(W=[ee[J]],Z=1)}while((J++<ne||W[0]!=null)&&Y--);k=W[0]!=null,K[0]||K.splice(0,1)}if(E==ht){for(b=1,Y=K[0];Y>=10;Y/=10,b++);F(H,P+(H.e=b+O*se-1)+1,S,k)}else H.e=O,H.r=+k;return H}}();function A(g,v,$,I){var N,P,S,E,C;if($==null?$=c:we($,0,8),!g.c)return g.toString();if(N=g.c[0],S=g.e,v==null)C=nt(g.c),C=I==1||I==2&&(S<=a||S>=u)?Fo(C,S):zt(C,S,"0");else if(g=F(new y(g),v,$),P=g.e,C=nt(g.c),E=C.length,I==1||I==2&&(v<=P||P<=a)){for(;E<v;C+="0",E++);C=Fo(C,P)}else if(v-=S+(I===2&&P>S),C=zt(C,P,"0"),P+1>E){if(--v>0)for(C+=".";v--;C+="0");}else if(v+=P-E,v>0)for(P+1==E&&(C+=".");v--;C+="0");return g.s<0&&N?"-"+C:C}function M(g,v){for(var $,I,N=1,P=new y(g[0]);N<g.length;N++)I=new y(g[N]),(!I.s||($=En(P,I))===v||$===0&&P.s===v)&&(P=I);return P}function L(g,v,$){for(var I=1,N=v.length;!v[--N];v.pop());for(N=v[0];N>=10;N/=10,I++);return($=I+$*se-1)>d?g.c=g.e=null:$<l?g.c=[g.e=0]:(g.e=$,g.c=v),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,$=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(P,S,E,C){var O,b=E?S:S.replace(N,"");if(I.test(b))P.s=isNaN(b)?null:b<0?-1:1;else{if(!E&&(b=b.replace(g,function(k,D,U){return O=(U=U.toLowerCase())=="x"?16:U=="b"?2:8,!C||C==O?D:k}),C&&(O=C,b=b.replace(v,"$1").replace($,"0.$1")),S!=b))return new y(b,O);if(y.DEBUG)throw Error(_e+"Not a"+(C?" base "+C:"")+" number: "+S);P.s=null}P.c=P.e=null}}();function F(g,v,$,I){var N,P,S,E,C,O,b,k=g.c,D=ci;if(k){e:{for(N=1,E=k[0];E>=10;E/=10,N++);if(P=v-N,P<0)P+=se,S=v,C=k[O=0],b=et(C/D[N-S-1]%10);else if(O=ii((P+1)/se),O>=k.length)if(I){for(;k.length<=O;k.push(0));C=b=0,N=1,P%=se,S=P-se+1}else break e;else{for(C=E=k[O],N=1;E>=10;E/=10,N++);P%=se,S=P-se+N,b=S<0?0:et(C/D[N-S-1]%10)}if(I=I||v<0||k[O+1]!=null||(S<0?C:C%D[N-S-1]),I=$<4?(b||I)&&($==0||$==(g.s<0?3:2)):b>5||b==5&&($==4||I||$==6&&(P>0?S>0?C/D[N-S]:0:k[O-1])%10&1||$==(g.s<0?8:7)),v<1||!k[0])return k.length=0,I?(v-=g.e+1,k[0]=D[(se-v%se)%se],g.e=-v||0):k[0]=g.e=0,g;if(P==0?(k.length=O,E=1,O--):(k.length=O+1,E=D[se-P],k[O]=S>0?et(C/D[N-S]%D[S])*E:0),I)for(;;)if(O==0){for(P=1,S=k[0];S>=10;S/=10,P++);for(S=k[0]+=E,E=1;S>=10;S/=10,E++);P!=E&&(g.e++,k[0]==ht&&(k[0]=1));break}else{if(k[O]+=E,k[O]!=ht)break;k[O--]=0,E=1}for(P=k.length;k[--P]===0;k.pop());}g.e>d?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function j(g){var v,$=g.e;return $===null?g.toString():(v=nt(g.c),v=$<=a||$>=u?Fo(v,$):zt(v,$,"0"),g.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var g=new y(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,v){return En(this,new y(g,v))},o.decimalPlaces=o.dp=function(g,v){var $,I,N,P=this;if(g!=null)return we(g,0,Oe),v==null?v=c:we(v,0,8),F(new y(P),g+P.e+1,v);if(!($=P.c))return null;if(I=((N=$.length-1)-tt(this.e/se))*se,N=$[N])for(;N%10==0;N/=10,I--);return I<0&&(I=0),I},o.dividedBy=o.div=function(g,v){return t(this,new y(g,v),i,c)},o.dividedToIntegerBy=o.idiv=function(g,v){return t(this,new y(g,v),0,1)},o.exponentiatedBy=o.pow=function(g,v){var $,I,N,P,S,E,C,O,b,k=this;if(g=new y(g),g.c&&!g.isInteger())throw Error(_e+"Exponent not an integer: "+j(g));if(v!=null&&(v=new y(v)),E=g.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!g.c||!g.c[0])return b=new y(Math.pow(+j(k),E?g.s*(2-Do(g)):+j(g))),v?b.mod(v):b;if(C=g.s<0,v){if(v.c?!v.c[0]:!v.s)return new y(NaN);I=!C&&k.isInteger()&&v.isInteger(),I&&(k=k.mod(v))}else{if(g.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||E&&k.c[1]>=24e7:k.c[0]<8e13||E&&k.c[0]<=9999975e7)))return P=k.s<0&&Do(g)?-0:0,k.e>-1&&(P=1/P),new y(C?1/P:P);h&&(P=ii(h/se+2))}for(E?($=new y(.5),C&&(g.s=1),O=Do(g)):(N=Math.abs(+j(g)),O=N%2),b=new y(s);;){if(O){if(b=b.times(k),!b.c)break;P?b.c.length>P&&(b.c.length=P):I&&(b=b.mod(v))}if(N){if(N=et(N/2),N===0)break;O=N%2}else if(g=g.times($),F(g,g.e+1,1),g.e>14)O=Do(g);else{if(N=+j(g),N===0)break;O=N%2}k=k.times(k),P?k.c&&k.c.length>P&&(k.c.length=P):I&&(k=k.mod(v))}return I?b:(C&&(b=s.div(b)),v?b.mod(v):P?F(b,h,c,S):b)},o.integerValue=function(g){var v=new y(this);return g==null?g=c:we(g,0,8),F(v,v.e+1,g)},o.isEqualTo=o.eq=function(g,v){return En(this,new y(g,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,v){return En(this,new y(g,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,v){return(v=En(this,new y(g,v)))===1||v===0},o.isInteger=function(){return!!this.c&&tt(this.e/se)>this.c.length-2},o.isLessThan=o.lt=function(g,v){return En(this,new y(g,v))<0},o.isLessThanOrEqualTo=o.lte=function(g,v){return(v=En(this,new y(g,v)))===-1||v===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(g,v){var $,I,N,P,S=this,E=S.s;if(g=new y(g,v),v=g.s,!E||!v)return new y(NaN);if(E!=v)return g.s=-v,S.plus(g);var C=S.e/se,O=g.e/se,b=S.c,k=g.c;if(!C||!O){if(!b||!k)return b?(g.s=-v,g):new y(k?S:NaN);if(!b[0]||!k[0])return k[0]?(g.s=-v,g):new y(b[0]?S:c==3?-0:0)}if(C=tt(C),O=tt(O),b=b.slice(),E=C-O){for((P=E<0)?(E=-E,N=b):(O=C,N=k),N.reverse(),v=E;v--;N.push(0));N.reverse()}else for(I=(P=(E=b.length)<(v=k.length))?E:v,E=v=0;v<I;v++)if(b[v]!=k[v]){P=b[v]<k[v];break}if(P&&(N=b,b=k,k=N,g.s=-g.s),v=(I=k.length)-($=b.length),v>0)for(;v--;b[$++]=0);for(v=ht-1;I>E;){if(b[--I]<k[I]){for($=I;$&&!b[--$];b[$]=v);--b[$],b[I]+=ht}b[I]-=k[I]}for(;b[0]==0;b.splice(0,1),--O);return b[0]?L(g,b,O):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,v){var $,I,N=this;return g=new y(g,v),!N.c||!g.s||g.c&&!g.c[0]?new y(NaN):!g.c||N.c&&!N.c[0]?new y(N):(p==9?(I=g.s,g.s=1,$=t(N,g,0,3),g.s=I,$.s*=I):$=t(N,g,0,p),g=N.minus($.times(g)),!g.c[0]&&p==1&&(g.s=N.s),g)},o.multipliedBy=o.times=function(g,v){var $,I,N,P,S,E,C,O,b,k,D,U,_,H,K,W=this,Z=W.c,G=(g=new y(g,v)).c;if(!Z||!G||!Z[0]||!G[0])return!W.s||!g.s||Z&&!Z[0]&&!G||G&&!G[0]&&!Z?g.c=g.e=g.s=null:(g.s*=W.s,!Z||!G?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(I=tt(W.e/se)+tt(g.e/se),g.s*=W.s,C=Z.length,k=G.length,C<k&&(_=Z,Z=G,G=_,N=C,C=k,k=N),N=C+k,_=[];N--;_.push(0));for(H=ht,K=ln,N=k;--N>=0;){for($=0,D=G[N]%K,U=G[N]/K|0,S=C,P=N+S;P>N;)O=Z[--S]%K,b=Z[S]/K|0,E=U*O+b*D,O=D*O+E%K*K+_[P]+$,$=(O/H|0)+(E/K|0)+U*b,_[P--]=O%H;_[P]=$}return $?++I:_.splice(0,1),L(g,_,I)},o.negated=function(){var g=new y(this);return g.s=-g.s||null,g},o.plus=function(g,v){var $,I=this,N=I.s;if(g=new y(g,v),v=g.s,!N||!v)return new y(NaN);if(N!=v)return g.s=-v,I.minus(g);var P=I.e/se,S=g.e/se,E=I.c,C=g.c;if(!P||!S){if(!E||!C)return new y(N/0);if(!E[0]||!C[0])return C[0]?g:new y(E[0]?I:N*0)}if(P=tt(P),S=tt(S),E=E.slice(),N=P-S){for(N>0?(S=P,$=C):(N=-N,$=E),$.reverse();N--;$.push(0));$.reverse()}for(N=E.length,v=C.length,N-v<0&&($=C,C=E,E=$,v=N),N=0;v;)N=(E[--v]=E[v]+C[v]+N)/ht|0,E[v]=ht===E[v]?0:E[v]%ht;return N&&(E=[N].concat(E),++S),L(g,E,S)},o.precision=o.sd=function(g,v){var $,I,N,P=this;if(g!=null&&g!==!!g)return we(g,1,Oe),v==null?v=c:we(v,0,8),F(new y(P),g,v);if(!($=P.c))return null;if(N=$.length-1,I=N*se+1,N=$[N]){for(;N%10==0;N/=10,I--);for(N=$[0];N>=10;N/=10,I++);}return g&&P.e+1>I&&(I=P.e+1),I},o.shiftedBy=function(g){return we(g,-ai,ai),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,v,$,I,N,P=this,S=P.c,E=P.s,C=P.e,O=i+4,b=new y("0.5");if(E!==1||!S||!S[0])return new y(!E||E<0&&(!S||S[0])?NaN:S?P:1/0);if(E=Math.sqrt(+j(P)),E==0||E==1/0?(v=nt(S),(v.length+C)%2==0&&(v+="0"),E=Math.sqrt(+v),C=tt((C+1)/2)-(C<0||C%2),E==1/0?v="5e"+C:(v=E.toExponential(),v=v.slice(0,v.indexOf("e")+1)+C),$=new y(v)):$=new y(E+""),$.c[0]){for(C=$.e,E=C+O,E<3&&(E=0);;)if(N=$,$=b.times(N.plus(t(P,N,O,1))),nt(N.c).slice(0,E)===(v=nt($.c)).slice(0,E))if($.e<C&&--E,v=v.slice(E-3,E+1),v=="9999"||!I&&v=="4999"){if(!I&&(F(N,N.e+i+2,0),N.times(N).eq(P))){$=N;break}O+=4,E+=4,I=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(F($,$.e+i+2,1),g=!$.times($).eq(P));break}}return F($,$.e+i+1,c,g)},o.toExponential=function(g,v){return g!=null&&(we(g,0,Oe),g++),A(this,g,v,1)},o.toFixed=function(g,v){return g!=null&&(we(g,0,Oe),g=g+this.e+1),A(this,g,v)},o.toFormat=function(g,v,$){var I,N=this;if($==null)g!=null&&v&&typeof v=="object"?($=v,v=null):g&&typeof g=="object"?($=g,g=v=null):$=m;else if(typeof $!="object")throw Error(_e+"Argument not an object: "+$);if(I=N.toFixed(g,v),N.c){var P,S=I.split("."),E=+$.groupSize,C=+$.secondaryGroupSize,O=$.groupSeparator||"",b=S[0],k=S[1],D=N.s<0,U=D?b.slice(1):b,_=U.length;if(C&&(P=E,E=C,C=P,_-=P),E>0&&_>0){for(P=_%E||E,b=U.substr(0,P);P<_;P+=E)b+=O+U.substr(P,E);C>0&&(b+=O+U.slice(P)),D&&(b="-"+b)}I=k?b+($.decimalSeparator||"")+((C=+$.fractionGroupSize)?k.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+($.fractionGroupSeparator||"")):k):b}return($.prefix||"")+I+($.suffix||"")},o.toFraction=function(g){var v,$,I,N,P,S,E,C,O,b,k,D,U=this,_=U.c;if(g!=null&&(E=new y(g),!E.isInteger()&&(E.c||E.s!==1)||E.lt(s)))throw Error(_e+"Argument "+(E.isInteger()?"out of range: ":"not an integer: ")+j(E));if(!_)return new y(U);for(v=new y(s),O=$=new y(s),I=C=new y(s),D=nt(_),P=v.e=D.length-U.e-1,v.c[0]=ci[(S=P%se)<0?se+S:S],g=!g||E.comparedTo(v)>0?P>0?v:O:E,S=d,d=1/0,E=new y(D),C.c[0]=0;b=t(E,v,0,1),N=$.plus(b.times(I)),N.comparedTo(g)!=1;)$=I,I=N,O=C.plus(b.times(N=O)),C=N,v=E.minus(b.times(N=v)),E=N;return N=t(g.minus($),I,0,1),C=C.plus(N.times(O)),$=$.plus(N.times(I)),C.s=O.s=U.s,P=P*2,k=t(O,I,P,c).minus(U).abs().comparedTo(t(C,$,P,c).minus(U).abs())<1?[O,I]:[C,$],d=S,k},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,v){return g!=null&&we(g,1,Oe),A(this,g,v,2)},o.toString=function(g){var v,$=this,I=$.s,N=$.e;return N===null?I?(v="Infinity",I<0&&(v="-"+v)):v="NaN":(g==null?v=N<=a||N>=u?Fo(nt($.c),N):zt(nt($.c),N,"0"):g===10&&T?($=F(new y($),i+N+1,c),v=zt(nt($.c),$.e,"0")):(we(g,2,w.length,"Base"),v=n(zt(nt($.c),N,"0"),10,g,I,!0)),I<0&&$.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return j(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&y.set(e),y}function tt(e){var t=e|0;return e>0||e===t?t:t-1}function nt(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=se-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function En(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,u=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==u,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>u^n?1:-1;for(c=(a=o.length)<(u=s.length)?a:u,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==u?0:a>u^n?1:-1}function we(e,t,n,r){if(e<t||e>n||e!==et(e))throw Error(_e+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Do(e){var t=e.c.length-1;return tt(e.e/se)==t&&e.c[t]%2!=0}function Fo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function zt(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var $e=wu();const wm=(e,t=6)=>{try{const n=new $e(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,$e.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},Ht=()=>{const{translations:e,currentLocale:t}=bu();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const l of c)if(a&&typeof a=="object"&&l in a)a=a[l];else return s;let u=typeof a=="string"?a:s;return i&&typeof u=="string"&&Object.keys(i).forEach(l=>{const d=`{{${l}}}`;u=u.replace(new RegExp(d,"g"),String(i[l]))}),u}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},vm="1.0.8";let Ye=class lu extends Error{constructor(t,n={}){var i;const r=n.cause instanceof lu?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof lu&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${vm}`].join(`
36
+ `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Wt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const vu=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,xu=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Eu=/^\(.+?\).*?$/,Su=/^tuple(?<array>(\[(\d*)\])*)$/;function ui(e){let t=e.type;if(Su.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o<n;o++){const s=e.components[o];t+=ui(s),o<n-1&&(t+=", ")}const r=Wt(Su,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,ui({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Br(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=ui(o),r!==n-1&&(t+=", ")}return t}function jo(e){var t;return e.type==="function"?`function ${e.name}(${Br(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Br(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Br(e.inputs)})`:e.type==="error"?`error ${e.name}(${Br(e.inputs)})`:e.type==="constructor"?`constructor(${Br(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Pu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function xm(e){return Pu.test(e)}function Em(e){return Wt(Pu,e)}const $u=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Sm(e){return $u.test(e)}function Pm(e){return Wt($u,e)}const Au=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function $m(e){return Au.test(e)}function Am(e){return Wt(Au,e)}const Tu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function li(e){return Tu.test(e)}function Tm(e){return Wt(Tu,e)}const Cu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Cm(e){return Cu.test(e)}function Om(e){return Wt(Cu,e)}const Ou=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Nm(e){return Ou.test(e)}function Im(e){return Wt(Ou,e)}const km=/^receive\(\) external payable$/;function Bm(e){return km.test(e)}const Mm=new Set(["indexed"]),fi=new Set(["calldata","memory","storage"]);class Lm extends Ye{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Rm extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Dm extends Ye{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Fm extends Ye{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class jm extends Ye{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class _m extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Um extends Ye{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class zm extends Ye{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class Yn extends Ye{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Hm extends Ye{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Wm extends Ye{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Vm extends Ye{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Gm extends Ye{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function qm(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const di=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function pi(e,t={}){if($m(e))return Zm(e,t);if(Sm(e))return Km(e,t);if(xm(e))return Ym(e,t);if(Cm(e))return Xm(e,t);if(Nm(e))return Qm(e);if(Bm(e))return{type:"receive",stateMutability:"payable"};throw new Hm({signature:e})}function Zm(e,t={}){const n=Am(e);if(!n)throw new Yn({signature:e,type:"function"});const r=mt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Sn(r[c],{modifiers:fi,structs:t,type:"function"}));const i=[];if(n.returns){const c=mt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(Sn(c[u],{modifiers:fi,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Km(e,t={}){const n=Pm(e);if(!n)throw new Yn({signature:e,type:"event"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Sn(r[i],{modifiers:Mm,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Ym(e,t={}){const n=Em(e);if(!n)throw new Yn({signature:e,type:"error"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Sn(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Xm(e,t={}){const n=Om(e);if(!n)throw new Yn({signature:e,type:"constructor"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Sn(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Qm(e){const t=Im(e);if(!t)throw new Yn({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Jm=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,eg=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,tg=/^u?int$/;function Sn(e,t){var d,f;const n=qm(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(di.has(n))return di.get(n);const r=Eu.test(e),o=Wt(r?eg:Jm,e);if(!o)throw new Fm({param:e});if(o.name&&rg(o.name))throw new jm({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,u={};if(r){a="tuple";const p=mt(o.type),h=[],m=p.length;for(let w=0;w<m;w++)h.push(Sn(p[w],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(tg.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!Nu(a))throw new Dm({type:a});if(o.modifier){if(!((f=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&f.call(d,o.modifier)))throw new _m({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(fi.has(o.modifier)&&!og(a,!!o.array))throw new Um({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return di.set(n,l),l}function mt(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?mt(c,[...t,n.trim()]):mt(c,t,`${n}${i}`,r);case"(":return mt(c,t,`${n}${i}`,r+1);case")":return mt(c,t,`${n}${i}`,r-1);default:return mt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Gm({current:n,depth:r});return t.push(n.trim()),t}function Nu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||vu.test(e)||xu.test(e)}const ng=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function rg(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||vu.test(e)||xu.test(e)||ng.test(e)}function og(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Iu(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!li(c))continue;const a=Tm(c);if(!a)throw new Yn({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],d=u.length;for(let f=0;f<d;f++){const h=u[f].trim();if(!h)continue;const m=Sn(h,{type:"struct"});l.push(m)}if(!l.length)throw new Wm({signature:c});t[a.name]=l}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=ku(a,t)}return r}const sg=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function ku(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(Eu.test(i.type))r.push(i);else{const a=Wt(sg,i.type);if(!(a!=null&&a.type))throw new zm({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Vm({type:l});r.push({...i,type:`tuple${u??""}`,components:ku(t[l]??[],t,new Set([...n,l]))})}else if(Nu(l))r.push(i);else throw new Rm({type:l})}}return r}function Bu(e){const t=Iu(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];li(s)||n.push(pi(s,t))}return n}function Mu(e){let t;if(typeof e=="string")t=pi(e);else{const n=Iu(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!li(s)){t=pi(s,n);break}}}if(!t)throw new Lm({signature:e});return t}function re(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function gt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new yg(e.type);return`${e.name}(${_o(e.inputs,{includeName:t})})`}function _o(e,{includeName:t=!1}={}){return e?e.map(n=>ig(n,{includeName:t})).join(t?", ":","):""}function ig(e,{includeName:t}){return e.type.startsWith("tuple")?`(${_o(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function bt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function xe(e){return bt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Lu="2.34.0";let Mr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Lu}`},V=class fu extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof fu?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof fu&&n.cause.docsPath||n.docsPath,s=(c=Mr.getDocsUrl)==null?void 0:c.call(Mr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Mr.version?[`Version: ${Mr.version}`]:[]].join(`
37
+ `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Lu}walk(t){return Ru(this,t)}};function Ru(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Ru(e.cause,t):t?null:e}class ag extends V{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
38
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Du extends V{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
39
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Fu extends V{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
40
+ `),{metaMessages:[`Params: (${_o(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class Lr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class cg extends V{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
41
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class ug extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${xe(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class lg extends V{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
42
+ `),{name:"AbiEncodingLengthMismatchError"})}}class fg extends V{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
43
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class ju extends V{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
44
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class _u extends V{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
45
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class dg extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Uu extends V{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
46
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class zu extends V{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
47
+ `),{docsPath:n,name:"AbiEventNotFoundError"})}}class Xn extends V{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
48
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Hu extends V{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
49
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class pg extends V{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
50
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class hg extends V{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${gt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${gt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let mg=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Rr extends V{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
51
+ `),{metaMessages:[`Params: (${_o(r,{includeName:!0})})`,`Data: ${n} (${o} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=n,this.params=r,this.size=o}}class Uo extends V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${gt(t,{includeName:!0})}".`].join(`
52
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class gg extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
53
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class bg extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
54
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Wu=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
55
+ `),{name:"InvalidArrayError"})}};class yg extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
56
+ `),{name:"InvalidDefinitionTypeError"})}}class wg extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Vu=class extends V{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Gu=class extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class qu extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function Qn(e,{dir:t,size:n=32}={}){return typeof e=="string"?fn(e,{dir:t,size:n}):vg(e,{dir:t,size:n})}function fn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Gu({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function vg(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Gu({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let o=0;o<n;o++){const s=t==="right";r[s?o:n-o-1]=e[s?o:e.length-o-1]}return r}let Zu=class extends V{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class xg extends V{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class Eg extends V{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Sg=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Pn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function yt(e,{size:t}){if(xe(e)>t)throw new Sg({givenSize:xe(e),maxSize:t})}function Ct(e,t={}){const{signed:n}=t;t.size&&yt(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function Pg(e,t={}){let n=e;if(t.size&&(yt(n,{size:t.size}),n=Pn(n)),Pn(n)==="0x00")return!1;if(Pn(n)==="0x01")return!0;throw new Eg(n)}function Vt(e,t={}){return Number(Ct(e,t))}const $g=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Gt(e,t={}){return typeof e=="number"||typeof e=="bigint"?te(e,t):typeof e=="string"?Dr(e,t):typeof e=="boolean"?Ku(e,t):Te(e,t)}function Ku(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(yt(n,{size:t.size}),Qn(n,{size:t.size})):n}function Te(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=$g[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(yt(r,{size:t.size}),Qn(r,{dir:"right",size:t.size})):r}function te(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new Zu({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Qn(c,{size:r}):c}const Ag=new TextEncoder;function Dr(e,t={}){const n=Ag.encode(e);return Te(n,t)}const Tg=new TextEncoder;function Jn(e,t={}){return typeof e=="number"||typeof e=="bigint"?Og(e,t):typeof e=="boolean"?Cg(e,t):bt(e)?wt(e,t):$n(e,t)}function Cg(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(yt(n,{size:t.size}),Qn(n,{size:t.size})):n}const qt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Yu(e){if(e>=qt.zero&&e<=qt.nine)return e-qt.zero;if(e>=qt.A&&e<=qt.F)return e-(qt.A-10);if(e>=qt.a&&e<=qt.f)return e-(qt.a-10)}function wt(e,t={}){let n=e;t.size&&(yt(n,{size:t.size}),n=Qn(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const a=Yu(r.charCodeAt(c++)),u=Yu(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new V(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function Og(e,t){const n=te(e,t);return wt(n)}function $n(e,t={}){const n=Tg.encode(e);return typeof t.size=="number"?(yt(n,{size:t.size}),Qn(n,{dir:"right",size:t.size})):n}const zo=BigInt(2**32-1),Xu=BigInt(32);function Ng(e,t=!1){return t?{h:Number(e&zo),l:Number(e>>Xu&zo)}:{h:Number(e>>Xu&zo)|0,l:Number(e&zo)|0}}function Ig(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}=Ng(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const kg=(e,t,n)=>e<<n|t>>>32-n,Bg=(e,t,n)=>t<<n|e>>>32-n,Mg=(e,t,n)=>t<<n-32|e>>>64-n,Lg=(e,t,n)=>e<<n-32|t>>>64-n,er=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ho(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Fr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Zt(e,...t){if(!Ho(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Qu(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Fr(e.outputLen),Fr(e.blockLen)}function tr(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ju(e,t){Zt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Rg(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function nr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function hi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ot(e,t){return e<<32-t|e>>>t}const Dg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Fg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function jg(e){for(let t=0;t<e.length;t++)e[t]=Fg(e[t]);return e}const el=Dg?e=>e:jg,tl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",_g=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function rr(e){if(Zt(e),tl)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=_g[e[n]];return t}const Kt={_0:48,_9:57,A:65,F:70,a:97,f:102};function nl(e){if(e>=Kt._0&&e<=Kt._9)return e-Kt._0;if(e>=Kt.A&&e<=Kt.F)return e-(Kt.A-10);if(e>=Kt.a&&e<=Kt.f)return e-(Kt.a-10)}function Wo(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(tl)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const i=nl(e.charCodeAt(s)),c=nl(e.charCodeAt(s+1));if(i===void 0||c===void 0){const a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[o]=i*16+c}return r}function Ug(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Vo(e){return typeof e=="string"&&(e=Ug(e)),Zt(e),e}function dn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Zt(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class mi{}function rl(e){const t=r=>e().update(Vo(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ol(e=32){if(er&&typeof er.getRandomValues=="function")return er.getRandomValues(new Uint8Array(e));if(er&&typeof er.randomBytes=="function")return Uint8Array.from(er.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const zg=BigInt(0),jr=BigInt(1),Hg=BigInt(2),Wg=BigInt(7),Vg=BigInt(256),Gg=BigInt(113),sl=[],il=[],al=[];for(let e=0,t=jr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],sl.push(2*(5*r+n)),il.push((e+1)*(e+2)/2%64);let o=zg;for(let s=0;s<7;s++)t=(t<<jr^(t>>Wg)*Gg)%Vg,t&Hg&&(o^=jr<<(jr<<BigInt(s))-jr);al.push(o)}const cl=Ig(al,!0),qg=cl[0],Zg=cl[1],ul=(e,t,n)=>n>32?Mg(e,t,n):kg(e,t,n),ll=(e,t,n)=>n>32?Lg(e,t,n):Bg(e,t,n);function Kg(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,a=(i+2)%10,u=n[a],l=n[a+1],d=ul(u,l,1)^n[c],f=ll(u,l,1)^n[c+1];for(let p=0;p<50;p+=10)e[i+p]^=d,e[i+p+1]^=f}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=il[i],a=ul(o,s,c),u=ll(o,s,c),l=sl[i];o=e[l],s=e[l+1],e[l]=a,e[l+1]=u}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=qg[r],e[1]^=Zg[r]}nr(n)}class gi extends mi{constructor(t,n,r,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,Fr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Rg(this.state)}clone(){return this._cloneInto()}keccak(){el(this.state32),Kg(this.state32,this.rounds),el(this.state32),this.posOut=0,this.pos=0}update(t){tr(this),t=Vo(t),Zt(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){tr(this,!1),Zt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Fr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ju(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,nr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new gi(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const Yg=(e,t,n)=>rl(()=>new gi(t,e,n)),fl=Yg(1,136,256/8);function ke(e,t){const n=t||"hex",r=fl(bt(e,{strict:!1})?Jn(e):e);return n==="bytes"?r:Gt(r)}const Xg=e=>ke(Jn(e));function Qg(e){return Xg(e)}function Jg(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new V("Unable to normalize signature.");return o}const eb=e=>{const t=typeof e=="string"?e:jo(e);return Jg(t)};function dl(e){return Qg(eb(e))}const Go=dl;let pn=class extends V{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},bi=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const yi=new bi(8192);function qo(e,t){if(yi.has(`${e}.${t}`))return yi.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=ke($n(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return yi.set(`${e}.${t}`,s),s}function An(e,t){if(!rt(e,{strict:!1}))throw new pn({address:e});return qo(e,t)}const tb=/^0x[a-fA-F0-9]{40}$/,wi=new bi(8192);function rt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(wi.has(r))return wi.get(r);const o=tb.test(e)?e.toLowerCase()===e?!0:n?qo(e)===e:!0:!1;return wi.set(r,o),o}function vt(e){return typeof e[0]=="string"?or(e):nb(e)}function nb(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function or(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function sr(e,t,n,{strict:r}={}){return bt(e,{strict:!1})?gl(e,t,n,{strict:r}):ml(e,t,n,{strict:r})}function pl(e,t){if(typeof t=="number"&&t>0&&t>xe(e)-1)throw new Vu({offset:t,position:"start",size:xe(e)})}function hl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&xe(e)!==n-t)throw new Vu({offset:n,position:"end",size:xe(e)})}function ml(e,t,n,{strict:r}={}){pl(e,t);const o=e.slice(t,n);return r&&hl(o,t,n),o}function gl(e,t,n,{strict:r}={}){pl(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&hl(o,t,n),o}const rb=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,bl=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Yt(e,t){if(e.length!==t.length)throw new lg({expectedLength:e.length,givenLength:t.length});const n=ob({params:e,values:t}),r=xi(n);return r.length===0?"0x":r}function ob({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(vi({param:e[r],value:t[r]}));return n}function vi({param:e,value:t}){const n=Ei(e.type);if(n){const[r,o]=n;return ib(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return fb(t,{param:e});if(e.type==="address")return sb(t);if(e.type==="bool")return cb(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=bl.exec(e.type)??[];return ub(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return ab(t,{param:e});if(e.type==="string")return lb(t);throw new gg(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function xi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=xe(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(te(t+o,{size:32})),r.push(c),o+=xe(c)):n.push(c)}return vt([...n,...r])}function sb(e){if(!rt(e))throw new pn({address:e});return{dynamic:!1,encoded:fn(e.toLowerCase())}}function ib(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Wu(e);if(!r&&e.length!==t)throw new cg({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=vi({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=xi(s);if(r){const c=te(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?vt([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:vt(s.map(({encoded:i})=>i))}}function ab(e,{param:t}){const[,n]=t.type.split("bytes"),r=xe(e);if(!n){let o=e;return r%32!==0&&(o=fn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:vt([fn(te(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new ug({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:fn(e,{dir:"right"})}}function cb(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:fn(Ku(e))}}function ub(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new Zu({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:te(e,{size:32,signed:t})}}function lb(e){const t=Dr(e),n=Math.ceil(xe(t)/32),r=[];for(let o=0;o<n;o++)r.push(fn(sr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:vt([fn(te(xe(t),{size:32})),...r])}}function fb(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,c=vi({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?xi(r):vt(r.map(({encoded:o})=>o))}}function Ei(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const _r=e=>sr(dl(e),0,4);function Tn(e){const{abi:t,args:n=[],name:r}=e,o=bt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?_r(c)===r:c.type==="event"?Go(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((u,l)=>{const d="inputs"in c&&c.inputs[l];return d?Si(u,d):!1})){if(i&&"inputs"in i&&i.inputs){const u=yl(c.inputs,i.inputs,n);if(u)throw new hg({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Si(e,t){const n=typeof e,r=t.type;switch(r){case"address":return rt(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>Si(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>Si(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function yl(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return yl(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?rt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?rt(n[r],{strict:!1}):!1)return i}}const wl="/docs/contract/encodeEventTopics";function Ur(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=Tn({abi:t,name:n});if(!u)throw new zu(n,{docsPath:wl});o=u}if(o.type!=="event")throw new zu(void 0,{docsPath:wl});const s=gt(o),i=Go(s);let c=[];if(r&&"inputs"in o){const u=(a=o.inputs)==null?void 0:a.filter(d=>"indexed"in d&&d.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(d=>r[d.name]))??[]:[];l.length>0&&(c=(u==null?void 0:u.map((d,f)=>Array.isArray(l[f])?l[f].map((p,h)=>vl({param:d,value:l[f][h]})):typeof l[f]<"u"&&l[f]!==null?vl({param:d,value:l[f]}):null))??[])}return[i,...c]}function vl({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return ke(Jn(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new wg(e.type);return Yt([e],[t])}function Zo(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:c,transport:a})=>{c==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function xl(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=Zo(e,{method:"eth_newFilter"}),l=s?Ur({abi:r,args:o,eventName:s}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?te(i):i,toBlock:typeof a=="bigint"?te(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:d,request:u(d),strict:!!c,type:"event"}}function xt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const El="/docs/contract/encodeFunctionData";function db(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Tn({abi:t,args:n,name:r});if(!s)throw new Xn(r,{docsPath:El});o=s}if(o.type!=="function")throw new Xn(void 0,{docsPath:El});return{abi:[o],functionName:_r(gt(o))}}function Nt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:db(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Yt(o.inputs,t??[]):void 0;return or([s,i??"0x"])}const Sl={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Pl={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},pb={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class $l extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class Al extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class hb extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const mb={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new hb({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Al({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new $l({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 $l({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Pi(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(mb);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function gb(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=Te(e,t);return Ct(n,t)}function bb(e,t={}){let n=e;if(typeof t.size<"u"&&(yt(n,{size:t.size}),n=Pn(n)),n.length>1||n[0]>1)throw new xg(n);return!!n[0]}function Xt(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=Te(e,t);return Vt(n,t)}function yb(e,t={}){let n=e;return typeof t.size<"u"&&(yt(n,{size:t.size}),n=Pn(n,{dir:"right"})),new TextDecoder().decode(n)}function zr(e,t){const n=typeof t=="string"?wt(t):t,r=Pi(n);if(xe(n)===0&&e.length>0)throw new Lr;if(xe(t)&&xe(t)<32)throw new Fu({data:typeof t=="string"?t:Te(t),params:e,size:xe(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=ir(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function ir(e,t,{staticPosition:n}){const r=Ei(t.type);if(r){const[o,s]=r;return vb(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return Pb(e,t,{staticPosition:n});if(t.type==="address")return wb(e);if(t.type==="bool")return xb(e);if(t.type.startsWith("bytes"))return Eb(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Sb(e,t);if(t.type==="string")return $b(e,{staticPosition:n});throw new bg(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Tl=32,$i=32;function wb(e){const t=e.readBytes(32);return[qo(Te(ml(t,-20))),32]}function vb(e,t,{length:n,staticPosition:r}){if(!n){const i=Xt(e.readBytes($i)),c=r+i,a=c+Tl;e.setPosition(c);const u=Xt(e.readBytes(Tl)),l=Hr(t);let d=0;const f=[];for(let p=0;p<u;++p){e.setPosition(a+(l?p*32:d));const[h,m]=ir(e,t,{staticPosition:a});d+=m,f.push(h)}return e.setPosition(r+32),[f,32]}if(Hr(t)){const i=Xt(e.readBytes($i)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=ir(e,t,{staticPosition:c});a.push(l)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=ir(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function xb(e){return[bb(e.readBytes(32),{size:32}),32]}function Eb(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Xt(e.readBytes(32));e.setPosition(n+i);const c=Xt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Te(a),32]}return[Te(e.readBytes(Number.parseInt(o),32)),32]}function Sb(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?gb(o,{signed:n}):Xt(o,{signed:n}),32]}function Pb(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Hr(t)){const i=Xt(e.readBytes($i)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,d]=ir(e,u,{staticPosition:c});s+=d,o[r?a:u==null?void 0:u.name]=l}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,u]=ir(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function $b(e,{staticPosition:t}){const n=Xt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Xt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=yb(Pn(s));return e.setPosition(t+32),[i,32]}function Hr(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(Hr);const n=Ei(e.type);return!!(n&&Hr({...e,type:n[1]}))}function Cl(e){const{abi:t,data:n}=e,r=sr(n,0,4);if(r==="0x")throw new Lr;const s=[...t||[],Pl,pb].find(i=>i.type==="error"&&r===_r(gt(i)));if(!s)throw new _u(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?zr(s.inputs,sr(n,4)):void 0,errorName:s.name}}const Ce=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Ol({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((o,s)=>`${r&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Ce(t[s]):t[s]}`).join(", ")})`}const Ab={gwei:9,wei:18},Tb={ether:-9,wei:9};function Ai(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 Nl(e,t="wei"){return Ai(e,Ab[t])}function Et(e,t="wei"){return Ai(e,Tb[t])}class Cb extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Ob extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Il(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
57
+ `,"")}function Nb(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
58
+ `;return r.nonce&&(o+=` nonce: ${r.nonce}
59
+ `),r.balance&&(o+=` balance: ${r.balance}
60
+ `),r.code&&(o+=` code: ${r.code}
61
+ `),r.state&&(o+=` state:
62
+ `,o+=Il(r.state)),r.stateDiff&&(o+=` stateDiff:
63
+ `,o+=Il(r.stateDiff)),o},` State Override:
64
+ `).slice(0,-1)}function Ko(e){const t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
65
+ `)}class Ib extends V{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
66
+ `),{name:"FeeConflictError"})}}class kb extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Ko(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class kl extends V{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}}class Bl extends V{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class Bb extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Mb=e=>e,Wr=e=>e;class Ml extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:d,value:f,stateOverride:p}){var w;const h=n?xt(n):void 0;let m=Ko({from:h==null?void 0:h.address,to:d,value:typeof f<"u"&&`${Nl(f)} ${((w=o==null?void 0:o.nativeCurrency)==null?void 0:w.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Et(u)} gwei`,nonce:l});p&&(m+=`
67
+ ${Nb(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Lb extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=Tn({abi:n,args:r,name:i}),u=a?Ol({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?gt(a,{includeName:!0}):void 0,d=Ko({address:o&&Mb(o),function:l,args:u&&u!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${u}`,sender:c});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=c}}class Ti extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=Cl({abi:t,data:n});const{abiItem:l,errorName:d,args:f}=i;if(d==="Error")a=f[0];else if(d==="Panic"){const[p]=f;a=Sl[p]}else{const p=l?gt(l,{includeName:!0}):void 0,h=l&&f?Ol({abiItem:l,args:f,includeFunctionName:!1,includeName:!1}):void 0;c=[p?`Error: ${p}`:"",h&&h!=="()"?` ${[...Array((d==null?void 0:d.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(l){s=l}else o&&(a=o);let u;s instanceof _u&&(u=s.signature,c=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(a&&a!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,a||u].join(`
68
+ `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.raw=n,this.reason=a,this.signature=u}}class Rb extends V{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class Db extends V{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Yo extends V{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class Cn extends V{constructor({body:t,cause:n,details:r,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${Wr(i)}`,t&&`Request body: ${Ce(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=o,this.status=s,this.url=i}}class Ci extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Wr(r)}`,`Request body: ${Ce(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data}}class Ll extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Wr(n)}`,`Request body: ${Ce(t)}`],name:"TimeoutError"})}}const Fb=-1;class Ue extends V{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof Ci?t.code:n??Fb}}class Xe extends Ue{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Vr extends Ue{constructor(t){super(t,{code:Vr.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Vr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Gr extends Ue{constructor(t){super(t,{code:Gr.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class qr extends Ue{constructor(t,{method:n}={}){super(t,{code:qr.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Zr extends Ue{constructor(t){super(t,{code:Zr.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
69
+ `)})}}Object.defineProperty(Zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class On extends Ue{constructor(t){super(t,{code:On.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(On,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Nn extends Ue{constructor(t){super(t,{code:Nn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
70
+ `)})}}Object.defineProperty(Nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Kr extends Ue{constructor(t){super(t,{code:Kr.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Kr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Yr extends Ue{constructor(t){super(t,{code:Yr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Yr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Xr extends Ue{constructor(t){super(t,{code:Xr.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Xr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class In extends Ue{constructor(t,{method:n}={}){super(t,{code:In.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class ar extends Ue{constructor(t){super(t,{code:ar.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Qr extends Ue{constructor(t){super(t,{code:Qr.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class cr extends Xe{constructor(t){super(t,{code:cr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(cr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Jr extends Xe{constructor(t){super(t,{code:Jr.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class eo extends Xe{constructor(t,{method:n}={}){super(t,{code:eo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class to extends Xe{constructor(t){super(t,{code:to.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class no extends Xe{constructor(t){super(t,{code:no.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ro extends Xe{constructor(t){super(t,{code:ro.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class oo extends Xe{constructor(t){super(t,{code:oo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class so extends Xe{constructor(t){super(t,{code:so.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class io extends Xe{constructor(t){super(t,{code:io.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class ao extends Xe{constructor(t){super(t,{code:ao.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class co extends Xe{constructor(t){super(t,{code:co.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class uo extends Xe{constructor(t){super(t,{code:uo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class lo extends Xe{constructor(t){super(t,{code:lo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class jb extends Ue{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const _b=3;function ur(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Yo?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:d,shortMessage:f}=c,p=e instanceof Lr?new Rb({functionName:s}):[_b,On.code].includes(a)&&(u||l||d||f)?new Ti({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof Ci?l:f??d}):e;return new Lb(p,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function Ub(e){const t=ke(`0x${e.substring(4)}`).substring(26);return qo(`0x${t}`)}async function zb({hash:e,signature:t}){const n=bt(e)?e:Gt(e),{secp256k1:r}=await Promise.resolve().then(()=>Iv);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:d,yParity:f}=t,p=Number(f??d),h=Rl(p);return new r.Signature(Ct(u),Ct(l)).addRecoveryBit(h)}const i=bt(t)?t:Gt(t);if(xe(i)!==65)throw new Error("invalid signature length");const c=Vt(`0x${i.slice(130)}`),a=Rl(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Rl(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function Dl({hash:e,signature:t}){return Ub(await zb({hash:e,signature:t}))}function Hb(e,t="hex"){const n=Fl(e),r=Pi(new Uint8Array(n.length));return n.encode(r),t==="hex"?Te(r.bytes):r.bytes}function Fl(e){return Array.isArray(e)?Wb(e.map(t=>Fl(t))):Vb(e)}function Wb(e){const t=e.reduce((o,s)=>o+s.length,0),n=jl(t);return{length:t<=55?1+t:1+n+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+n),n===1?o.pushUint8(t):n===2?o.pushUint16(t):n===3?o.pushUint24(t):o.pushUint32(t));for(const{encode:s}of e)s(o)}}}function Vb(e){const t=typeof e=="string"?wt(e):e,n=jl(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(o){t.length===1&&t[0]<128?o.pushBytes(t):t.length<=55?(o.pushByte(128+t.length),o.pushBytes(t)):(o.pushByte(183+n),n===1?o.pushUint8(t.length):n===2?o.pushUint16(t.length):n===3?o.pushUint24(t.length):o.pushUint32(t.length),o.pushBytes(t))}}}function jl(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new V("Length is too large.")}function Gb(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=ke(or(["0x05",Hb([t?te(t):"0x",o,n?te(n):"0x"])]));return r==="bytes"?wt(s):s}async function qb(e){const{authorization:t,signature:n}=e;return Dl({hash:Gb(t),signature:n??t})}class Zb extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:d,value:f}){var h;const p=Ko({from:n==null?void 0:n.address,to:d,value:typeof f<"u"&&`${Nl(f)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Et(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",p].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class lr extends V{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(lr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(lr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Xo extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Xo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Oi extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Oi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Ni extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Ni,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ii extends V{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
71
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Ii,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class ki extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(ki,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Bi extends V{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
72
+ `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Bi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Mi extends V{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Mi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Li extends V{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Li,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Ri extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Ri,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Qo extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Et(r)} gwei`:""}).`].join(`
73
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Qo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Jo extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Di(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===lr.code):e;return r instanceof V?new lr({cause:e,message:r.details}):lr.nodeMessage.test(n)?new lr({cause:e,message:e.details}):Xo.nodeMessage.test(n)?new Xo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Oi.nodeMessage.test(n)?new Oi({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ni.nodeMessage.test(n)?new Ni({cause:e,nonce:t==null?void 0:t.nonce}):Ii.nodeMessage.test(n)?new Ii({cause:e,nonce:t==null?void 0:t.nonce}):ki.nodeMessage.test(n)?new ki({cause:e,nonce:t==null?void 0:t.nonce}):Bi.nodeMessage.test(n)?new Bi({cause:e}):Mi.nodeMessage.test(n)?new Mi({cause:e,gas:t==null?void 0:t.gas}):Li.nodeMessage.test(n)?new Li({cause:e,gas:t==null?void 0:t.gas}):Ri.nodeMessage.test(n)?new Ri({cause:e}):Qo.nodeMessage.test(n)?new Qo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Jo({cause:e})}function Kb(e,{docsPath:t,...n}){const r=(()=>{const o=Di(e,n);return o instanceof Jo?e:o})();return new Zb(r,{docsPath:t,...n})}function Fi(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const c of i)c in e&&(n[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&r(s[c])}const o=t(e||{});return r(o),n}const Yb={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function es(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=Xb(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>Te(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=te(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=te(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=te(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=te(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=te(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=te(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=Yb[e.type]),typeof e.value<"u"&&(t.value=te(e.value)),t}function Xb(e){return e.map(t=>({address:t.address,r:t.r?te(BigInt(t.r)):t.r,s:t.s?te(BigInt(t.s)):t.s,chainId:te(t.chainId),nonce:te(t.nonce),...typeof t.yParity<"u"?{yParity:te(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:te(t.v)}:{}}))}function _l(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new qu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new qu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Qb(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=te(t)),n!==void 0&&(i.nonce=te(n)),r!==void 0&&(i.state=_l(r)),o!==void 0){if(i.state)throw new Ob;i.stateDiff=_l(o)}return i}function ji(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!rt(n,{strict:!1}))throw new pn({address:n});if(t[n])throw new Cb({address:n});t[n]=Qb(r)}return t}const Ul=2n**256n-1n;function fo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?xt(t):void 0;if(i&&!rt(i.address))throw new pn({address:i.address});if(s&&!rt(s))throw new pn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new Ib;if(r&&r>Ul)throw new Xo({maxFeePerGas:r});if(o&&r&&o>r)throw new Qo({maxFeePerGas:r,maxPriorityFeePerGas:o})}class Jb extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class _i extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class ey extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Et(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class zl extends V{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Hl={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Wl(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Vt(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Vt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Hl[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(t.authorizationList=ty(e.authorizationList)),t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof t.v=="bigint"){if(t.v===0n||t.v===27n)return 0;if(t.v===1n||t.v===28n)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),t.type==="legacy"&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),t.type==="eip2930"&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t.type==="eip1559"&&delete t.maxFeePerBlobGas,t}function ty(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function Vl(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Wl(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function It(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var u,l,d;const s=o??!1,i=n!==void 0?te(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new zl({blockHash:t,blockNumber:n});return(((d=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:d.format)||Vl)(c)}async function Ui(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function ny(e,t){return Gl(e,t)}async function Gl(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof c=="function"){const u=n||await re(e,It,"getBlock")({}),l=await c({block:u,client:e,request:o});if(l===null)throw new Error;return l}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Ct(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):re(e,It,"getBlock")({}),re(e,Ui,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new _i;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function ry(e,t){return zi(e,t)}async function zi(e,t){var f,p;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new Jb;const a=10**(((f=i.toString().split(".")[1])==null?void 0:f.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await re(e,It,"getBlock")({});if(typeof((p=r==null?void 0:r.fees)==null?void 0:p.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new _i;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Gl(e,{block:l,chain:r,request:o}),m=u(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??u(await re(e,Ui,"getGasPrice")({}))}}async function ql(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?te(r):n]},{dedupe:!!r});return Vt(o)}function Zl(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>wt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>Te(s))}function Kl(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>wt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>wt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>Te(i))}function oy(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),a=r?4:0,u=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+u,c,r)}function sy(e,t,n){return e&t^~e&n}function iy(e,t,n){return e&t^e&n^t&n}class ay extends mi{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=hi(this.buffer)}update(t){tr(this),t=Vo(t),Zt(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=hi(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){tr(this),Ju(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,nr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let d=i;d<o;d++)n[d]=0;oy(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=hi(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)c.setUint32(4*d,l[d],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const hn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),cy=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),mn=new Uint32Array(64);class uy extends ay{constructor(t=32){super(64,t,8,!1),this.A=hn[0]|0,this.B=hn[1]|0,this.C=hn[2]|0,this.D=hn[3]|0,this.E=hn[4]|0,this.F=hn[5]|0,this.G=hn[6]|0,this.H=hn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,n){for(let d=0;d<16;d++,n+=4)mn[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=mn[d-15],p=mn[d-2],h=Ot(f,7)^Ot(f,18)^f>>>3,m=Ot(p,17)^Ot(p,19)^p>>>10;mn[d]=m+mn[d-7]+h+mn[d-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Ot(c,6)^Ot(c,11)^Ot(c,25),p=l+f+sy(c,a,u)+cy[d]+mn[d]|0,m=(Ot(r,2)^Ot(r,13)^Ot(r,22))+iy(r,o,s)|0;l=u,u=a,a=c,c=i+p|0,i=s,s=o,o=r,r=p+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,o,s,i,c,a,u,l)}roundClean(){nr(mn)}destroy(){this.set(0,0,0,0,0,0,0,0),nr(this.buffer)}}const Yl=rl(()=>new uy),ly=Yl;function fy(e,t){return ly(bt(e,{strict:!1})?Jn(e):e)}function dy(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=fy(t);return o.set([n],0),r==="bytes"?o:Te(o)}function py(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(dy({commitment:s,to:r,version:n}));return o}const Xl=6,Ql=32,Hi=4096,Jl=Ql*Hi,ef=Jl*Xl-1-1*Hi*Xl;class hy extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class my extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function gy(e){const t=typeof e.data=="string"?wt(e.data):e.data,n=xe(t);if(!n)throw new my;if(n>ef)throw new hy({maxSize:ef,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Pi(new Uint8Array(Jl));let c=0;for(;c<Hi;){const a=t.slice(s,s+(Ql-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}c++,s+=31}r.push(i)}return r.map(i=>Te(i.bytes))}function by(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??gy({data:t}),s=e.commitments??Zl({blobs:o,kzg:n,to:r}),i=e.proofs??Kl({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function yy(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new kb({transaction:e})}async function tf(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Vt(t)}const wy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],nf=new Map;async function rf(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=wy,type:l}=t,d=n&&xt(n),f={...t,...d?{from:d==null?void 0:d.address}:{}};let p;async function h(){return p||(p=await re(e,It,"getBlock")({blockTag:"latest"}),p)}let m;async function w(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await re(e,tf,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&d)if(a){const T=await w();f.nonce=await a.consume({address:d.address,chainId:T,client:e})}else f.nonce=await re(e,ql,"getTransactionCount")({address:d.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const T=Zl({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const y=py({commitments:T,to:"hex"});f.blobVersionedHashes=y}if(u.includes("sidecars")){const y=Kl({blobs:r,commitments:T,kzg:i}),A=by({blobs:r,commitments:T,proofs:y,to:"hex"});f.sidecars=A}}if(u.includes("chainId")&&(f.chainId=await w()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{f.type=yy(f)}catch{let T=nf.get(e.uid);if(typeof T>"u"){const y=await h();T=typeof(y==null?void 0:y.baseFeePerGas)=="bigint",nf.set(e.uid,T)}f.type=T?"eip1559":"legacy"}if(u.includes("fees"))if(f.type!=="legacy"&&f.type!=="eip2930"){if(typeof f.maxFeePerGas>"u"||typeof f.maxPriorityFeePerGas>"u"){const T=await h(),{maxFeePerGas:y,maxPriorityFeePerGas:A}=await zi(e,{block:T,chain:o,request:f});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<A)throw new ey({maxPriorityFeePerGas:A});f.maxPriorityFeePerGas=A,f.maxFeePerGas=y}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new _i;if(typeof t.gasPrice>"u"){const T=await h(),{gasPrice:y}=await zi(e,{block:T,chain:o,request:f,type:"legacy"});f.gasPrice=y}}return u.includes("gas")&&typeof s>"u"&&(f.gas=await re(e,Wi,"estimateGas")({...f,account:d&&{address:d.address,type:"json-rpc"}})),fo(f),delete f.parameters,f}async function of(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?te(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Wi(e,t){var o,s,i;const{account:n=e.account}=t,r=n?xt(n):void 0;try{let S=function(C){const{block:O,request:b,rpcStateOverride:k}=C;return e.request({method:"eth_estimateGas",params:k?[b,O??e.experimental_blockTag??"latest",k]:O?[b,O]:[b]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:d,blockTag:f,data:p,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:T,maxPriorityFeePerGas:y,nonce:A,value:M,stateOverride:L,...F}=await rf(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof d=="bigint"?te(d):void 0)||f,v=ji(L),$=await(async()=>{if(F.to)return F.to;if(a&&a.length>0)return await qb({authorization:a[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})();fo(t);const I=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,P=(I||es)({...Fi(F,{format:I}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:p,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:T,maxPriorityFeePerGas:y,nonce:A,to:$,value:M});let E=BigInt(await S({block:g,request:P,rpcStateOverride:v}));if(a){const C=await of(e,{address:P.from}),O=await Promise.all(a.map(async b=>{const{address:k}=b,D=await S({block:g,request:{authorizationList:void 0,data:p,from:r==null?void 0:r.address,to:k,value:te(C)},rpcStateOverride:v}).catch(()=>100000n);return 2n*BigInt(D)}));E+=O.reduce((b,k)=>b+k,0n)}return E}catch(c){throw Kb(c,{...t,account:r,chain:e.chain})}}async function vy(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Nt({abi:n,args:o,functionName:s});try{return await re(e,Wi,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?xt(c.account):void 0;throw ur(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function ts(e,t){if(!rt(e,{strict:!1}))throw new pn({address:e});if(!rt(t,{strict:!1}))throw new pn({address:t});return e.toLowerCase()===t.toLowerCase()}const sf="/docs/contract/decodeEventLog";function Vi(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new dg({docsPath:sf});const a=t.find(m=>m.type==="event"&&i===Go(gt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Uu(i,{docsPath:sf});const{name:u,inputs:l}=a,d=l==null?void 0:l.some(m=>!("name"in m&&m.name)),f=d?[]:{},p=l.map((m,w)=>[m,w]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<p.length;m++){const[w,T]=p[m],y=c[m];if(!y)throw new Uo({abiItem:a,param:w});f[d?T:w.name||T]=xy({param:w,value:y})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=zr(h,n);if(m)if(d)for(let w=0;w<l.length;w++)f[w]=f[w]??m.shift();else for(let w=0;w<h.length;w++)f[h[w].name]=m[w]}catch(m){if(s)throw m instanceof Fu||m instanceof Al?new Rr({abiItem:a,data:n,params:h,size:xe(n)}):m}else if(s)throw new Rr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(f).length>0?f:void 0}}function xy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(zr([e],t)||[])[0]}function Gi(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var c;try{const a=t.find(l=>l.type==="event"&&i.topics[0]===Go(l));if(!a)return null;const u=Vi({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!Ey({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof Uu)return null;if(a instanceof Rr||a instanceof Uo){if(o)return null;u=a.abiItem.name,l=(c=a.abiItem.inputs)==null?void 0:c.some(d=>!("name"in d&&d.name))}return{...i,args:l?[]:{},eventName:u}}}).filter(Boolean)}function Ey(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?ts(i,c):s.type==="string"||s.type==="bytes"?ke(Jn(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(u=>o(c,u,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const c=n.find(u=>u.name===s);return c?(Array.isArray(i)?i:[i]).some(u=>o(c,u,t[s])):!1}):!1}function Qt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function qi(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const u=a??!1,l=i??(s?[s]:void 0);let d=[];l&&(d=[l.flatMap(m=>Ur({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(d=d[0]));let f;n?f=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:n}]}):f=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof r=="bigint"?te(r):r,toBlock:typeof o=="bigint"?te(o):o}]});const p=f.map(h=>Qt(h));return l?Gi({abi:l,args:c,logs:p,strict:u}):p}async function af(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?Tn({abi:n,name:i}):void 0,d=l?void 0:n.filter(f=>f.type==="event");return re(e,qi,"getLogs")({address:r,args:o,blockHash:s,event:l,events:d,fromBlock:c,toBlock:a,strict:u})}const Zi="/docs/contract/decodeFunctionResult";function kn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Tn({abi:t,args:n,name:r});if(!c)throw new Xn(r,{docsPath:Zi});s=c}if(s.type!=="function")throw new Xn(void 0,{docsPath:Zi});if(!s.outputs)throw new Hu(s.name,{docsPath:Zi});const i=zr(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ki=BigInt(0),Yi=BigInt(1);function ns(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function Bn(e,t,n=""){const r=Ho(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",a=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return e}function rs(e){const t=e.toString(16);return t.length&1?"0"+t:t}function cf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Ki:BigInt("0x"+e)}function os(e){return cf(rr(e))}function uf(e){return Zt(e),cf(rr(Uint8Array.from(e).reverse()))}function Xi(e,t){return Wo(e.toString(16).padStart(t*2,"0"))}function lf(e,t){return Xi(e,t).reverse()}function ze(e,t,n){let r;if(typeof t=="string")try{r=Wo(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(Ho(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const Qi=e=>typeof e=="bigint"&&Ki<=e;function Sy(e,t,n){return Qi(e)&&Qi(t)&&Qi(n)&&t<=e&&e<n}function Py(e,t,n,r){if(!Sy(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function ff(e){let t;for(t=0;e>Ki;e>>=Yi,t+=1);return t}const po=e=>(Yi<<BigInt(e))-Yi;function $y(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=p=>new Uint8Array(p),o=p=>Uint8Array.of(p);let s=r(e),i=r(e),c=0;const a=()=>{s.fill(1),i.fill(0),c=0},u=(...p)=>n(i,s,...p),l=(p=r(0))=>{i=u(o(0),p),s=u(),p.length!==0&&(i=u(o(1),p),s=u())},d=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const h=[];for(;p<t;){s=u();const m=s.slice();h.push(m),p+=s.length}return dn(...h)};return(p,h)=>{a(),l(p);let m;for(;!(m=h(d()));)l();return a(),m}}function Ji(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,i){const c=e[o];if(i&&c===void 0)return;const a=typeof c;if(a!==s||c===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${a}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}function df(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const Ay="0.1.1";function Ty(){return Ay}class be extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof be){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof be&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
74
+ `);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Ty()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return pf(this,t)}}function pf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?pf(e.cause,t):t?null:e}const Cy="#__bigint";function Oy(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+Cy:o,n)}function Ny(e,t){if(gf(e)>t)throw new _y({givenSize:gf(e),maxSize:t})}const Jt={zero:48,nine:57,A:65,F:70,a:97,f:102};function hf(e){if(e>=Jt.zero&&e<=Jt.nine)return e-Jt.zero;if(e>=Jt.A&&e<=Jt.F)return e-(Jt.A-10);if(e>=Jt.a&&e<=Jt.f)return e-(Jt.a-10)}function Iy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Uy({size:e.length,targetSize:r,type:"Bytes"});const o=new Uint8Array(r);for(let s=0;s<r;s++){const i=n==="right";o[i?s:r-s-1]=e[i?s:e.length-s-1]}return o}function ea(e,t){if(ot(e)>t)throw new Gy({givenSize:ot(e),maxSize:t})}function ky(e,t){if(typeof t=="number"&&t>0&&t>ot(e)-1)throw new Ef({offset:t,position:"start",size:ot(e)})}function By(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ot(e)!==n-t)throw new Ef({offset:n,position:"end",size:ot(e)})}function mf(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const o=e.replace("0x","");if(o.length>r*2)throw new qy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const My=new TextEncoder;function Ly(e){return e instanceof Uint8Array?e:typeof e=="string"?Dy(e):Ry(e)}function Ry(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Dy(e,t={}){const{size:n}=t;let r=e;n&&(ea(e,n),r=Ln(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const u=hf(o.charCodeAt(a++)),l=hf(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new be(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=u*16+l}return i}function Fy(e,t={}){const{size:n}=t,r=My.encode(e);return typeof n=="number"?(Ny(r,n),jy(r,n)):r}function jy(e,t){return Iy(e,{dir:"right",size:t})}function gf(e){return e.length}let _y=class extends be{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Uy=class extends be{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const zy=new TextEncoder,Hy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Wy(e,t={}){const{strict:n=!1}=t;if(!e)throw new vf(e);if(typeof e!="string")throw new vf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new xf(e);if(!e.startsWith("0x"))throw new xf(e)}function kt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function bf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(ea(n,t.size),Mn(n,t.size)):n}function yf(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Hy[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(ea(r,t.size),Ln(r,t.size)):r}function Re(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const u=typeof e=="bigint"?"n":"";throw new wf({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${e}${u}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Mn(a,r):a}function ta(e,t={}){return yf(zy.encode(e),t)}function Mn(e,t){return mf(e,{dir:"left",size:t})}function Ln(e,t){return mf(e,{dir:"right",size:t})}function na(e,t,n,r={}){const{strict:o}=r;ky(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&By(s,t,n),s}function ot(e){return Math.ceil((e.length-2)/2)}function Vy(e,t={}){const{strict:n=!1}=t;try{return Wy(e,{strict:n}),!0}catch{return!1}}class wf extends be{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class vf extends be{constructor(t){super(`Value \`${typeof t=="object"?Oy(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class xf extends be{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class Gy extends be{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class Ef extends be{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class qy extends be{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function Zy(e){return{address:e.address,amount:Re(e.amount),index:Re(e.index),validatorIndex:Re(e.validatorIndex)}}function Sf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Re(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Re(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Re(e.gasLimit)},...typeof e.number=="bigint"&&{number:Re(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Re(e.prevRandao)},...typeof e.time=="bigint"&&{time:Re(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Zy)}}}const ra=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],oa=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],Pf=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],$f=[...Pf,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Ky=[...Pf,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Af=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Tf=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],Cf=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],fr=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],Yy="0x82ad56cb",Of="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Xy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Qy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class sa extends V{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class Nf extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const ia="/docs/contract/encodeDeployData";function aa(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new ag({docsPath:ia});if(!("inputs"in o))throw new Du({docsPath:ia});if(!o.inputs||o.inputs.length===0)throw new Du({docsPath:ia});const s=Yt(o.inputs,n);return or([r,s])}function dr({blockNumber:e,chain:t,contract:n}){var o;const r=(o=t==null?void 0:t.contracts)==null?void 0:o[n];if(!r)throw new sa({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new sa({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function If(e,{docsPath:t,...n}){const r=(()=>{const o=Di(e,n);return o instanceof Jo?e:o})();return new Ml(r,{docsPath:t,...n})}function kf(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const ca=new Map;function Bf({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const d=l.map(({args:f})=>f);d.length!==0&&e(d).then(f=>{o&&Array.isArray(f)&&f.sort(o);for(let p=0;p<l.length;p++){const{resolve:h}=l[p];h==null||h([f[p],f])}}).catch(f=>{for(let p=0;p<l.length;p++){const{reject:h}=l[p];h==null||h(f)}})},i=()=>ca.delete(t),c=()=>a().map(({args:l})=>l),a=()=>ca.get(t)||[],u=l=>ca.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:d,resolve:f,reject:p}=kf();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:f,reject:p}),d):(u({args:l,resolve:f,reject:p}),setTimeout(s,r),d)}}}async function ho(e,t){var P,S,E,C;const{account:n=e.account,authorizationList:r,batch:o=!!((P=e.batch)!=null&&P.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:u,code:l,data:d,factory:f,factoryData:p,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:T,maxPriorityFeePerGas:y,nonce:A,to:M,value:L,stateOverride:F,...j}=t,g=n?xt(n):void 0;if(l&&(f||p))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&M)throw new V("Cannot provide both `code` & `to` as parameters.");const v=l&&d,$=f&&p&&M&&d,I=v||$,N=v?t1({code:l,data:d}):$?n1({data:d,factory:f,factoryData:p,to:M}):d;try{fo(t);const b=(typeof s=="bigint"?te(s):void 0)||i,k=u?Sf(u):void 0,D=ji(F),U=(C=(E=(S=e.chain)==null?void 0:S.formatters)==null?void 0:E.transactionRequest)==null?void 0:C.format,H=(U||es)({...Fi(j,{format:U}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:N,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:T,maxPriorityFeePerGas:y,nonce:A,to:I?void 0:M,value:L});if(o&&Jy({request:H})&&!D&&!k)try{return await e1(e,{...H,blockNumber:s,blockTag:i})}catch(Z){if(!(Z instanceof Nf)&&!(Z instanceof sa))throw Z}const K=(()=>{const Z=[H,b];return D&&k?[...Z,D,k]:D?[...Z,D]:k?[...Z,{},k]:Z})(),W=await e.request({method:"eth_call",params:K});return W==="0x"?{data:void 0}:{data:W}}catch(O){const b=r1(O),{offchainLookup:k,offchainLookupSignature:D}=await Promise.resolve().then(()=>sw);if(e.ccipRead!==!1&&(b==null?void 0:b.slice(0,10))===D&&M)return{data:await k(e,{data:b,to:M})};throw I&&(b==null?void 0:b.slice(0,10))==="0x101bb98d"?new Db({factory:f}):If(O,{...t,account:g,chain:e.chain})}}function Jy({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Yy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function e1(e,t){var m;const{batchSize:n=1024,wait:r=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:i,multicallAddress:c,to:a}=t;let u=c;if(!u){if(!e.chain)throw new Nf;u=dr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const d=(typeof o=="bigint"?te(o):void 0)||s,{schedule:f}=Bf({id:`${e.uid}.${d}`,wait:r,shouldSplitBatch(w){return w.reduce((y,{data:A})=>y+(A.length-2),0)>n*2},fn:async w=>{const T=w.map(M=>({allowFailure:!0,callData:M.data,target:M.to})),y=Nt({abi:ra,args:[T],functionName:"aggregate3"}),A=await e.request({method:"eth_call",params:[{data:y,to:u},d]});return kn({abi:ra,args:[T],functionName:"aggregate3",data:A||"0x"})}}),[{returnData:p,success:h}]=await f({data:i,to:a});if(!h)throw new Yo({data:p});return p==="0x"?{data:void 0}:{data:p}}function t1(e){const{code:t,data:n}=e;return aa({abi:Bu(["constructor(bytes, bytes)"]),bytecode:Of,args:[t,n]})}function n1(e){const{data:t,factory:n,factoryData:r,to:o}=e;return aa({abi:Bu(["constructor(address, bytes, address, bytes)"]),bytecode:Xy,args:[o,t,n,r]})}function r1(e){var n;if(!(e instanceof V))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function en(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Nt({abi:n,args:o,functionName:s});try{const{data:a}=await re(e,ho,"call")({...i,data:c,to:r});return kn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw ur(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function o1(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?xt(c.account):e.account,u=Nt({abi:n,args:o,functionName:i});try{const{data:l}=await re(e,ho,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),d=kn({abi:n,args:o,functionName:i,data:l||"0x"}),f=n.filter(p=>"name"in p&&p.name===t.functionName);return{result:d,request:{abi:f,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(l){throw ur(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const ua=new Map,Mf=new Map;let s1=0;function gn(e,t,n){const r=++s1,o=()=>ua.get(e)||[],s=()=>{const l=o();ua.set(e,l.filter(d=>d.id!==r))},i=()=>{const l=o();if(!l.some(f=>f.id===r))return;const d=Mf.get(e);if(l.length===1&&d){const f=d();f instanceof Promise&&f.catch(()=>{})}s()},c=o();if(ua.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...d)=>{var p,h;const f=o();if(f.length!==0)for(const m of f)(h=(p=m.fns)[l])==null||h.call(p,...d)};const u=n(a);return typeof u=="function"&&Mf.set(e,u),i}async function la(e){return new Promise(t=>setTimeout(t,e))}function mo(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await la(a);const u=async()=>{o&&(await e({unpoll:s}),await la(r),u())};u()})(),s}const i1=new Map,a1=new Map;function c1(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,i1),r=t(e,a1);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function u1(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=c1(t),o=r.response.get();if(o&&n>0&&new Date().getTime()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const l1=e=>`blockNumber.${e}`;async function go(e,{cacheTime:t=e.cacheTime}={}){const n=await u1(()=>e.request({method:"eth_blockNumber"}),{cacheKey:l1(e.uid),cacheTime:t});return BigInt(n)}async function ss(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Qt(s));return!("abi"in t)||!t.abi?o:Gi({abi:t.abi,logs:o,strict:n})}async function is(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function f1(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:u,poll:l,pollingInterval:d=e.pollingInterval,strict:f}=t;return(typeof l<"u"?l:typeof c=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const w=f??!1,T=Ce(["watchContractEvent",r,o,s,e.uid,i,d,w,c]);return gn(T,{onLogs:u,onError:a},y=>{let A;c!==void 0&&(A=c-1n);let M,L=!1;const F=mo(async()=>{var j;if(!L){try{M=await re(e,xl,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:w,fromBlock:c})}catch{}L=!0;return}try{let g;if(M)g=await re(e,ss,"getFilterChanges")({filter:M});else{const v=await re(e,go,"getBlockNumber")({});A&&A<v?g=await re(e,af,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:A+1n,toBlock:v,strict:w}):g=[],A=v}if(g.length===0)return;if(s)y.onLogs(g);else for(const v of g)y.onLogs([v])}catch(g){M&&g instanceof Nn&&(L=!1),(j=y.onError)==null||j.call(y,g)}},{emitOnBegin:!0,interval:d});return async()=>{M&&await re(e,is,"uninstallFilter")({filter:M}),F()}})})():(()=>{const w=f??!1,T=Ce(["watchContractEvent",r,o,s,e.uid,i,d,w]);let y=!0,A=()=>y=!1;return gn(T,{onLogs:u,onError:a},M=>((async()=>{try{const L=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(v=>v.config.type==="webSocket"||v.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),F=i?Ur({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await L.subscribe({params:["logs",{address:r,topics:F}],onData(g){var $;if(!y)return;const v=g.result;try{const{eventName:I,args:N}=Vi({abi:n,data:v.data,topics:v.topics,strict:f}),P=Qt(v,{args:N,eventName:I});M.onLogs([P])}catch(I){let N,P;if(I instanceof Rr||I instanceof Uo){if(f)return;N=I.abiItem.name,P=($=I.abiItem.inputs)==null?void 0:$.some(E=>!("name"in E&&E.name))}const S=Qt(v,{args:P?[]:{},eventName:N});M.onLogs([S])}},onError(g){var v;(v=M.onError)==null||v.call(M,g)}});A=j,y||A()}catch(L){a==null||a(L)}})(),()=>A()))})()}async function d1(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function fa(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:u})=>{const l=typeof t=="function"?t({count:c,error:u}):t;l&&await la(l),i({count:c+1})};try{const u=await e();o(u)}catch(u){if(c<n&&await r({count:c,error:u}))return a({error:u});s(u)}};i()})}const p1={"0x0":"reverted","0x1":"success"};function h1(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(n=>Qt(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Vt(e.transactionIndex):null,status:e.status?p1[e.status]:null,type:e.type?Hl[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const da=256;let as=da,cs;function Lf(e=11){if(!cs||as+e>da*2){cs="",as=0;for(let t=0;t<da;t++)cs+=(256+Math.random()*256|0).toString(16).substring(1)}return cs.substring(as,as+++e)}function m1(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(a/2),500),4e3),l=e.pollingInterval??u,d=e.cacheTime??l,f=e.account?xt(e.account):void 0,{config:p,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),w={...p,...m},T={account:f,batch:t,cacheTime:d,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:w,type:i,uid:Lf(),...c?{experimental_blockTag:c}:{}};function y(A){return M=>{const L=M(A);for(const j in T)delete L[j];const F={...A,...L};return Object.assign(F,{extend:y(F)})}}return Object.assign(T,{extend:y(T)})}const us=new bi(8192);function g1(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(us.get(n))return us.get(n);const r=e().finally(()=>us.delete(n));return us.set(n,r),r}function b1(e,t={}){return async(n,r={})=>{var d;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:u}=n;if((d=s==null?void 0:s.exclude)!=null&&d.includes(u))throw new In(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new In(new Error("method not supported"),{method:u});const l=o?Dr(`${a}.${Ce(n)}`):void 0;return g1(()=>fa(async()=>{try{return await e(n)}catch(f){const p=f;switch(p.code){case Vr.code:throw new Vr(p);case Gr.code:throw new Gr(p);case qr.code:throw new qr(p,{method:n.method});case Zr.code:throw new Zr(p);case On.code:throw new On(p);case Nn.code:throw new Nn(p);case Kr.code:throw new Kr(p);case Yr.code:throw new Yr(p);case Xr.code:throw new Xr(p);case In.code:throw new In(p,{method:n.method});case ar.code:throw new ar(p);case Qr.code:throw new Qr(p);case cr.code:throw new cr(p);case Jr.code:throw new Jr(p);case eo.code:throw new eo(p);case to.code:throw new to(p);case no.code:throw new no(p);case ro.code:throw new ro(p);case oo.code:throw new oo(p);case so.code:throw new so(p);case io.code:throw new io(p);case ao.code:throw new ao(p);case co.code:throw new co(p);case uo.code:throw new uo(p);case lo.code:throw new lo(p);case 5e3:throw new cr(p);default:throw f instanceof V?f:new jb(p)}}},{delay:({count:f,error:p})=>{var h;if(p&&p instanceof Cn){const m=(h=p==null?void 0:p.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m)*1e3}return~~(1<<f)*i},retryCount:c,shouldRetry:({error:f})=>y1(f)}),{enabled:o,id:l})}}function y1(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===ar.code||e.code===On.code:e instanceof Cn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function w1({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=Lf();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:b1(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class v1 extends V{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function x1(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const c=new AbortController;n>0&&(i=setTimeout(()=>{r&&c.abort()},n)),o(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&s(t),s(c)}finally{clearTimeout(i)}})()})}function E1(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Rf=E1();function S1(e,t={}){return{async request(n){var d;const{body:r,onRequest:o=t.onRequest,onResponse:s=t.onResponse,timeout:i=t.timeout??1e4}=n,c={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:a,method:u,signal:l}=c;try{const f=await x1(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Ce(r.map(A=>({jsonrpc:"2.0",id:A.id??Rf.take(),...A}))):Ce({jsonrpc:"2.0",id:r.id??Rf.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},w=new Request(e,m),T=await(o==null?void 0:o(w,m))??{...m,url:e};return await fetch(T.url??e,T)},{errorInstance:new Ll({body:r,url:e}),timeout:i,signal:!0});s&&await s(f);let p;if((d=f.headers.get("Content-Type"))!=null&&d.startsWith("application/json"))p=await f.json();else{p=await f.text();try{p=JSON.parse(p||"{}")}catch(h){if(f.ok)throw h;p={error:p}}}if(!f.ok)throw new Cn({body:r,details:Ce(p.error)||f.statusText,headers:f.headers,status:f.status,url:e});return p}catch(f){throw f instanceof Cn||f instanceof Ll?f:new Cn({body:r,cause:f,url:e})}}}}function pa(e,t={}){const{batch:n,fetchOptions:r,key:o="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:a,retryDelay:u,raw:l}=t;return({chain:d,retryCount:f,timeout:p})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},w=t.retryCount??f,T=p??t.timeout??1e4,y=e||(d==null?void 0:d.rpcUrls.default.http[0]);if(!y)throw new v1;const A=S1(y,{fetchOptions:r,onRequest:c,onResponse:a,timeout:T});return w1({key:o,methods:s,name:i,async request({method:M,params:L}){const F={method:M,params:L},{schedule:j}=Bf({id:y,wait:m,shouldSplitBatch(I){return I.length>h},fn:I=>A.request({body:I}),sort:(I,N)=>I.id-N.id}),g=async I=>n?j(I):[await A.request({body:I})],[{error:v,result:$}]=await g(F);if(l)return{error:v,result:$};if(v)throw new Ci({body:F,error:v,url:y});return $},retryCount:w,retryDelay:u,timeout:T,type:"http"},{fetchOptions:r,url:y})}}function ha(e,t){var r,o,s,i,c,a;if(!(e instanceof V))return!1;const n=e.walk(u=>u instanceof Ti);return n instanceof Ti?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((o=n.data)==null?void 0:o.errorName)==="ResolverWildcardNotSupported"||((s=n.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=n.data)==null?void 0:i.errorName)==="ResolverError"||((c=n.data)==null?void 0:c.errorName)==="HttpError"||(a=n.reason)!=null&&a.includes("Wildcard on non-extended resolvers is not supported")||t==="reverse"&&n.reason===Sl[50]):!1}function P1(e){const{abi:t,data:n}=e,r=sr(n,0,4),o=t.find(s=>s.type==="function"&&r===_r(gt(s)));if(!o)throw new pg(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?zr(o.inputs,sr(n,4)):void 0}}const ma="/docs/contract/encodeErrorResult";function Df(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Tn({abi:t,args:r,name:n});if(!a)throw new ju(n,{docsPath:ma});o=a}if(o.type!=="error")throw new ju(void 0,{docsPath:ma});const s=gt(o),i=_r(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new fg(o.name,{docsPath:ma});c=Yt(o.inputs,r)}return or([i,c])}const ga="/docs/contract/encodeFunctionResult";function $1(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Tn({abi:t,name:n});if(!i)throw new Xn(n,{docsPath:ga});o=i}if(o.type!=="function")throw new Xn(void 0,{docsPath:ga});if(!o.outputs)throw new Hu(o.name,{docsPath:ga});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Wu(r)})();return Yt(o.outputs,s)}const ls="x-batch-gateway:true";async function Ff(e){const{data:t,ccipRequest:n}=e,{args:[r]}=P1({abi:oa,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(ls)?await Ff({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=A1(a)}})),$1({abi:oa,functionName:"query",result:[o,s]})}function A1(e){return e.name==="HttpRequestError"&&e.status?Df({abi:oa,errorName:"HttpError",args:[e.status,e.shortMessage]}):Df({abi:[Pl],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function jf(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return bt(t)?t:null}function fs(e){let t=new Uint8Array(32).fill(0);if(!e)return Te(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=jf(n[r]),s=o?Jn(o):ke($n(n[r]),"bytes");t=ke(vt([t,s]),"bytes")}return Te(t)}function T1(e){return`[${e.slice(2)}]`}function C1(e){const t=new Uint8Array(32).fill(0);return e?jf(e)||ke($n(e)):Te(t)}function ds(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array($n(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=$n(o[s]);i.byteLength>255&&(i=$n(T1(C1(o[s])))),n[r]=i.length,n.set(i,r+1),r+=i.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function O1(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return dr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(d=>s.endsWith(d)))return null;try{const d=Nt({abi:Tf,functionName:"addr",...o!=null?{args:[fs(s),BigInt(o)]}:{args:[fs(s)]}}),f={address:u,abi:$f,functionName:"resolve",args:[Gt(ds(s)),d,i??[ls]],blockNumber:n,blockTag:r},h=await re(e,en,"readContract")(f);if(h[0]==="0x")return null;const m=kn({abi:Tf,args:o!=null?[fs(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||Pn(m)==="0x00"?null:m}catch(d){if(c)throw d;if(ha(d,"resolve"))return null;throw d}}class N1 extends V{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class bo extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class ba extends V{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class I1 extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const k1=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,B1=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,M1=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,L1=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function R1(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function _f(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Uf({uri:e,gatewayUrls:t}){const n=M1.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=_f(t==null?void 0:t.ipfs,"https://ipfs.io"),o=_f(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(k1),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",d=i==="ipfs:/"||c==="ipfs/"||B1.test(e);if(e.startsWith("http")&&!l&&!d){let p=e;return t!=null&&t.arweave&&(p=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:p,isOnChain:!1,isEncoded:!1}}if((l||d)&&a)return{uri:`${r}/${l?"ipns":"ipfs"}/${a}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${u||""}`,isOnChain:!1,isEncoded:!1};let f=e.replace(L1,"");if(f.startsWith("<svg")&&(f=`data:image/svg+xml;base64,${btoa(f)}`),f.startsWith("data:")||f.startsWith("{"))return{uri:f,isOnChain:!0,isEncoded:!1};throw new ba({uri:e})}function zf(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new N1({data:e});return e.image||e.image_url||e.image_data}async function D1({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await ya({gatewayUrls:e,uri:zf(n)})}catch{throw new ba({uri:t})}}async function ya({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Uf({uri:t,gatewayUrls:e});if(r||await R1(n))return n;throw new ba({uri:t})}function F1(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new bo({reason:"Only EIP-155 supported"});if(!i)throw new bo({reason:"Chain ID not found"});if(!a)throw new bo({reason:"Contract address not found"});if(!o)throw new bo({reason:"Token ID not found"});if(!c)throw new bo({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function j1(e,{nft:t}){if(t.namespace==="erc721")return en(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return en(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new I1({namespace:t.namespace})}async function _1(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?U1(e,{gatewayUrls:t,record:n}):ya({uri:n,gatewayUrls:t})}async function U1(e,{gatewayUrls:t,record:n}){const r=F1(n),o=await j1(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Uf({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=c?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return ya({uri:zf(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),D1({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Hf(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return dr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(d=>s.endsWith(d)))return null;try{const d={address:u,abi:$f,functionName:"resolve",args:[Gt(ds(s)),Nt({abi:Af,functionName:"text",args:[fs(s),o]}),i??[ls]],blockNumber:n,blockTag:r},p=await re(e,en,"readContract")(d);if(p[0]==="0x")return null;const h=kn({abi:Af,functionName:"text",data:p[0]});return h===""?null:h}catch(d){if(c)throw d;if(ha(d,"resolve"))return null;throw d}}async function z1(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await re(e,Hf,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await _1(e,{record:a,gatewayUrls:r})}catch{return null}}async function H1(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:s,universalResolverAddress:i}){let c=i;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=dr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:Ky,functionName:"reverse",args:[Gt(ds(a))],blockNumber:n,blockTag:r},l=re(e,en,"readContract"),[d,f]=o?await l({...u,args:[...u.args,o]}):await l(u);return t.toLowerCase()!==f.toLowerCase()?null:d}catch(u){if(s)throw u;if(ha(u,"reverse"))return null;throw u}}async function W1(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return dr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await re(e,en,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Gt(ds(o))],blockNumber:n,blockTag:r});return a}async function Wf(e,t){var w,T,y;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:p,...h}=t,m=n?xt(n):void 0;try{fo(t);const M=(typeof r=="bigint"?te(r):void 0)||o,L=(y=(T=(w=e.chain)==null?void 0:w.formatters)==null?void 0:T.transactionRequest)==null?void 0:y.format,j=(L||es)({...Fi(h,{format:L}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:p}),g=await e.request({method:"eth_createAccessList",params:[j,M]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch(A){throw If(A,{...t,account:m,chain:e.chain})}}async function V1(e){const t=Zo(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Vf(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=Zo(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(p=>Ur({abi:[p],eventName:p.name,args:n}))],r&&(l=l[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?te(s):s,toBlock:typeof c=="bigint"?te(c):c,...l.length?{topics:l}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:d,request:u(d),strict:!!i,toBlock:c,type:"event"}}async function Gf(e){const t=Zo(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function G1(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function q1(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?te(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),Vt(s)}async function qf(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?te(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class Z1 extends V{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function K1(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,d]=await re(e,en,"readContract")({abi:Y1,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:u,salt:l},extensions:d,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Z1({address:n}):i}}const Y1=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function X1(e){var t;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:(t=e.reward)==null?void 0:t.map(n=>n.map(r=>BigInt(r)))}}async function Q1(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?te(n):void 0,i=await e.request({method:"eth_feeHistory",params:[te(t),s||r,o]},{dedupe:!!s});return X1(i)}async function J1(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Qt(s));return t.abi?Gi({abi:t.abi,logs:o,strict:n}):o}class ew extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${Wr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class tw extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Wr(n)}`,`Response: ${Ce(t)}`],name:"OffchainLookupResponseMalformedError"})}}class nw extends V{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const rw="0x556f1830",Zf={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function ow(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Cl({data:r,abi:[Zf]}),[i,c,a,u,l]=s,{ccipRead:d}=e,f=d&&typeof(d==null?void 0:d.request)=="function"?d.request:Kf;try{if(!ts(o,i))throw new nw({sender:i,to:o});const p=c.includes(ls)?await Ff({data:a,ccipRequest:f}):await f({data:a,sender:i,urls:c}),{data:h}=await ho(e,{blockNumber:t,blockTag:n,data:vt([u,Yt([{type:"bytes"},{type:"bytes"}],[p,l])]),to:o});return h}catch(p){throw new ew({callbackSelector:u,cause:p,data:r,extraData:l,sender:i,urls:c})}}async function Kf({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,u=c==="POST"?{"Content-Type":"application/json"}:{};try{const l=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:u,method:c});let d;if((o=l.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?d=(await l.json()).data:d=await l.text(),!l.ok){r=new Cn({body:a,details:d!=null&&d.error?Ce(d.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!bt(d)){r=new tw({result:d,url:i});continue}return d}catch(l){r=new Cn({body:a,details:l.message,url:i})}}throw r}const sw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Kf,offchainLookup:ow,offchainLookupAbiItem:Zf,offchainLookupSignature:rw},Symbol.toStringTag,{value:"Module"}));function Yf(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class iw extends V{constructor({domain:t}){super(`Invalid domain "${Ce(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class aw extends V{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class cw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function uw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:hw({domain:t}),...e.types};pw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(lw({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Xf({data:n,primaryType:r,types:o})),ke(vt(s))}function lw({domain:e,types:t}){return Xf({data:e,primaryType:"EIP712Domain",types:t})}function Xf({data:e,primaryType:t,types:n}){const r=Qf({data:e,primaryType:t,types:n});return ke(r)}function Qf({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[fw({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=ed({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Yt(r,o)}function fw({primaryType:e,types:t}){const n=Gt(dw({primaryType:e,types:t}));return ke(n)}function dw({primaryType:e,types:t}){let n="";const r=Jf({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const s of o)n+=`${s}(${t[s].map(({name:i,type:c})=>`${c} ${i}`).join(",")})`;return n}function Jf({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),o=r==null?void 0:r[0];if(n.has(o)||t[o]===void 0)return n;n.add(o);for(const s of t[o])Jf({primaryType:s.type,types:t},n);return n}function ed({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},ke(Qf({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},ke(r)];if(n==="string")return[{type:"bytes32"},ke(Gt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>ed({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},ke(Yt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function pw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:u,type:l}=a,d=c[u],f=l.match(bl);if(f&&(typeof d=="number"||typeof d=="bigint")){const[m,w,T]=f;te(d,{signed:w==="int",size:Number.parseInt(T)/8})}if(l==="address"&&typeof d=="string"&&!rt(d))throw new pn({address:d});const p=l.match(rb);if(p){const[m,w]=p;if(w&&xe(d)!==Number.parseInt(w))throw new mg({expectedSize:Number.parseInt(w),givenSize:xe(d)})}const h=o[l];h&&(mw(l),s(h,d))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new iw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new aw({primaryType:r,types:o})}function hw({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function mw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new cw({type:e})}const gw=`Ethereum Signed Message:
75
+ `;function bw(e){const t=typeof e=="string"?Dr(e):typeof e.raw=="string"?e.raw:Te(e.raw),n=Dr(`${gw}${xe(t)}`);return vt([n,t])}function td(e,t){return ke(bw(e),t)}const nd="0x6492649264926492649264926492649264926492649264926492649264926492";function yw(e){return gl(e,-32)===nd}function ww(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=or([Yt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),nd]);return o==="hex"?s:wt(s)}class vw extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function xw(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new vw({value:e});let[n,r="0"]=e.split(".");const o=n.startsWith("-");if(o&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),t===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>t){const[s,i,c]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${c}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function Ew(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function Sw(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Vt(e.nonce):void 0,storageProof:e.storageProof?Ew(e.storageProof):void 0}}async function Pw(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?te(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return Sw(c)}async function $w(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?te(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function wa(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,d,f;const i=r||"latest",c=n!==void 0?te(n):void 0;let a=null;if(o?a=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?a=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,te(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,te(s)]},{dedupe:!!c}),!a)throw new kl({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((f=(d=(l=e.chain)==null?void 0:l.formatters)==null?void 0:d.transaction)==null?void 0:f.format)||Wl)(a)}async function Aw(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([re(e,go,"getBlockNumber")({}),t?re(e,wa,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function ps(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Bl({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||h1)(n)}async function Tw(e,t){var T;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof((T=e.batch)==null?void 0:T.multicall)=="object"&&e.batch.multicall.batchSize||1024);let d=c;if(!d){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");d=dr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const f=[[]];let p=0,h=0;for(let y=0;y<u.length;y++){const{abi:A,address:M,args:L,functionName:F}=u[y];try{const j=Nt({abi:A,args:L,functionName:F});h+=(j.length-2)/2,l>0&&h>l&&f[p].length>0&&(p++,h=(j.length-2)/2,f[p]=[]),f[p]=[...f[p],{allowFailure:!0,callData:j,target:M}]}catch(j){const g=ur(j,{abi:A,address:M,args:L,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!r)throw g;f[p]=[...f[p],{allowFailure:!0,callData:"0x",target:M}]}}const m=await Promise.allSettled(f.map(y=>re(e,en,"readContract")({abi:ra,account:n,address:d,args:[y],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),w=[];for(let y=0;y<m.length;y++){const A=m[y];if(A.status==="rejected"){if(!r)throw A.reason;for(let L=0;L<f[y].length;L++)w.push({status:"failure",error:A.reason,result:void 0});continue}const M=A.value;for(let L=0;L<M.length;L++){const{returnData:F,success:j}=M[L],{callData:g}=f[y][L],{abi:v,address:$,functionName:I,args:N}=u[w.length];try{if(g==="0x")throw new Lr;if(!j)throw new Yo({data:F});const P=kn({abi:v,args:N,data:F,functionName:I});w.push(r?{result:P,status:"success"}:P)}catch(P){const S=ur(P,{abi:v,address:$,args:N,docsPath:"/docs/contract/multicall",functionName:I});if(!r)throw S;w.push({error:S,result:void 0,status:"failure"})}}}if(w.length!==u.length)throw new V("multicall results mismatch");return w}async function va(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const f of o){const p=f.blockOverrides?Sf(f.blockOverrides):void 0,h=f.calls.map(w=>{const T=w,y=T.account?xt(T.account):void 0,A=T.abi?Nt(T):T.data,M={...T,data:T.dataSuffix?vt([A||"0x",T.dataSuffix]):A,from:T.from??(y==null?void 0:y.address)};return fo(M),es(M)}),m=f.stateOverrides?ji(f.stateOverrides):void 0;a.push({blockOverrides:p,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?te(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((f,p)=>({...Vl(f),calls:f.calls.map((h,m)=>{var $,I;const{abi:w,args:T,functionName:y,to:A}=o[p].calls[m],M=(($=h.error)==null?void 0:$.data)??h.returnData,L=BigInt(h.gasUsed),F=(I=h.logs)==null?void 0:I.map(N=>Qt(N)),j=h.status==="0x1"?"success":"failure",g=w&&j==="success"&&M!=="0x"?kn({abi:w,data:M,functionName:y}):null,v=(()=>{var P;if(j==="success")return;let N;if(((P=h.error)==null?void 0:P.data)==="0x"?N=new Lr:h.error&&(N=new Yo(h.error)),!!N)return ur(N,{abi:w??[],address:A??"0x",args:T,functionName:y??"<unknown>"})})();return{data:M,gasUsed:L,logs:F,status:j,...j==="success"?{result:g}:{error:v}}})}))}catch(a){const u=a,l=Di(u,{});throw l instanceof Jo?u:l}}function rd(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=fl(Ly(e));return n==="Bytes"?r:yf(r)}class Cw extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const xa={checksum:new Cw(8192)}.checksum,Ow=/^0x[a-fA-F0-9]{40}$/;function hs(e,t={}){const{strict:n=!0}=t;if(!Ow.test(e))throw new od({address:e,cause:new Iw});if(n){if(e.toLowerCase()===e)return;if(Nw(e)!==e)throw new od({address:e,cause:new kw})}}function Nw(e){if(xa.has(e))return xa.get(e);hs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=rd(Fy(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const o=`0x${r.join("")}`;return xa.set(e,o),o}function Ea(e,t={}){const{strict:n=!0}=t??{};try{return hs(e,{strict:n}),!0}catch{return!1}}class od extends be{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class Iw extends be{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class kw extends be{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function Sa(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new be("Unable to normalize signature.");return o}function Pa(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Ea(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>Pa(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>Pa(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function sd(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return sd(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?Ea(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Ea(n[r],{strict:!1}):!1)return i}}function id(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Mu(e):e;return{...r,...n?{hash:pr(r)}:{}}}function Bw(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Vy(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?ad(u)===na(t,0,4):u.type==="event"?pr(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new $a({name:t});if(i.length===1)return{...i[0],...o?{hash:pr(i[0])}:{}};let c;for(const u of i){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:pr(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((d,f)=>{const p="inputs"in u&&u.inputs[f];return p?Pa(d,p):!1})){if(c&&"inputs"in c&&c.inputs){const d=sd(u.inputs,c.inputs,r);if(d)throw new Lw({abiItem:u,type:d[0]},{abiItem:c,type:d[1]})}c=u}}const a=(()=>{if(c)return c;const[u,...l]=i;return{...u,overloads:l}})();if(!a)throw new $a({name:t});return{...a,...o?{hash:pr(a)}:{}}}function ad(e){return na(pr(e),0,4)}function Mw(e){const t=typeof e=="string"?e:jo(e);return Sa(t)}function pr(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:rd(ta(Mw(e)))}class Lw extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Sa(jo(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Sa(jo(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class $a extends be{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}const Rw=/^(.*)\[([0-9]*)\]$/,Dw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,cd=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Fw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Aa({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Aa({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Gw(r.type);if(o){const[s,i]=o;return _w(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Vw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return jw(n,{checksum:e});if(r.type==="bool")return zw(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=cd.exec(r.type)??[];return Hw(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Uw(n,{type:r.type});if(r.type==="string")return Ww(n);throw new dd(r.type)}function Ta(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=ot(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Re(t+o,{size:32})),r.push(c),o+=ot(c)):n.push(c)}return kt(...n,...r)}function jw(e,t){const{checksum:n=!1}=t;return hs(e,{strict:n}),{dynamic:!1,encoded:Mn(e.toLowerCase())}}function _w(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new Zw(e);if(!s&&e.length!==r)throw new qw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=Aa({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=Ta(c);if(s){const u=Re(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?kt(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:kt(...c.map(({encoded:a})=>a))}}function Uw(e,{type:t}){const[,n]=t.split("bytes"),r=ot(e);if(!n){let o=e;return r%32!==0&&(o=Ln(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:kt(Mn(Re(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new ld({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Ln(e)}}function zw(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Mn(bf(e))}}function Hw(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new wf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Re(e,{size:32,signed:t})}}function Ww(e){const t=ta(e),n=Math.ceil(ot(t)/32),r=[];for(let o=0;o<n;o++)r.push(Ln(na(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:kt(Ln(Re(ot(t),{size:32})),...r)}}function Vw(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,u=Aa({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Ta(s):kt(...s.map(({encoded:i})=>i))}}function Gw(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function ud(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new fd({expectedLength:e.length,givenLength:t.length});const o=Fw({checksumAddress:r,parameters:e,values:t}),s=Ta(o);return s.length===0?"0x":s}function Ca(e,t){if(e.length!==t.length)throw new fd({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r];n.push(Ca.encode(o,s))}return kt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return hs(a),Mn(a.toLowerCase(),o?32:0)}if(n==="string")return ta(r);if(n==="bytes")return r;if(n==="bool")return Mn(bf(r),o?32:1);const s=n.match(cd);if(s){const[a,u,l="256"]=s,d=Number.parseInt(l)/8;return Re(r,{size:o?32:d,signed:u==="int"})}const i=n.match(Dw);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new ld({expectedSize:Number.parseInt(u),value:r});return Ln(r,o?32:0)}const c=n.match(Rw);if(c&&Array.isArray(r)){const[a,u]=c,l=[];for(let d=0;d<r.length;d++)l.push(t(u,r[d],!0));return l.length===0?"0x":kt(...l)}throw new dd(n)}e.encode=t})(Ca||(Ca={}));class qw extends be{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class ld extends be{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ot(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class fd extends be{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
76
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Zw extends be{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class dd extends be{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function Kw(e,t){var o;const{bytecode:n,args:r}=t;return kt(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?ud(e.inputs,r):"0x")}function Yw(e){return id(e)}function Xw(e,...t){const{overloads:n}=e,r=n?Qw([e,...n],e.name,{args:t[0]}):e,o=Jw(r),s=t.length>0?ud(r.inputs,t[0]):void 0;return s?kt(o,s):o}function hr(e,t={}){return id(e,t)}function Qw(e,t,n){const r=Bw(e,t,n);if(r.type!=="function")throw new $a({name:t,type:"function"});return r}function Jw(e){return ad(e)}const ev="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Bt="0x0000000000000000000000000000000000000000",tv="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function nv(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?xt(t.account):void 0;if(i&&!u)throw new V("`account` is required when `traceAssetChanges` is true");const l=u?Kw(Yw("constructor(bytes, bytes)"),{bytecode:Of,args:[tv,Xw(hr("function getBalance(address)"),[u.address])]}):void 0,d=i?await Promise.all(t.calls.map(async b=>{if(!b.data&&!b.abi)return;const{accessList:k}=await Wf(e,{account:u.address,...b,data:b.abi?Nt(b):b.data});return k.map(({address:D,storageKeys:U})=>U.length>0?D:null)})).then(b=>b.flat().filter(Boolean)):[],f=await va(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:d.map((b,k)=>({abi:[hr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]}]:[],{calls:[...o,{}].map(b=>({...b,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:d.map((b,k)=>({abi:[hr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]},{calls:d.map((b,k)=>({to:b,abi:[hr("function decimals() returns (uint256)")],functionName:"decimals",from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]},{calls:d.map((b,k)=>({to:b,abi:[hr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]},{calls:d.map((b,k)=>({to:b,abi:[hr("function symbol() returns (string)")],functionName:"symbol",from:Bt,nonce:k})),stateOverrides:[{address:Bt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),p=i?f[2]:f[0],[h,m,,w,T,y,A,M]=i?f:[],{calls:L,...F}=p,j=L.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],v=(m==null?void 0:m.calls)??[],$=[...g,...v].map(b=>b.status==="success"?Ct(b.data):null),I=(w==null?void 0:w.calls)??[],N=(T==null?void 0:T.calls)??[],P=[...I,...N].map(b=>b.status==="success"?Ct(b.data):null),S=((y==null?void 0:y.calls)??[]).map(b=>b.status==="success"?b.result:null),E=((M==null?void 0:M.calls)??[]).map(b=>b.status==="success"?b.result:null),C=((A==null?void 0:A.calls)??[]).map(b=>b.status==="success"?b.result:null),O=[];for(const[b,k]of P.entries()){const D=$[b];if(typeof k!="bigint"||typeof D!="bigint")continue;const U=S[b-1],_=E[b-1],H=C[b-1],K=b===0?{address:ev,decimals:18,symbol:"ETH"}:{address:d[b-1],decimals:H||U?Number(U??1):void 0,symbol:_??void 0};O.some(W=>W.token.address===K.address)||O.push({token:K,value:{pre:D,post:k,diff:k-D}})}return{assetChanges:O,block:F,results:j}}class pd extends mi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Qu(t);const r=Vo(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),nr(s)}update(t){return tr(this),this.iHash.update(t),this}digestInto(t){tr(this),Zt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const hd=(e,t,n)=>new pd(e,t).update(n).digest();hd.create=(e,t)=>new pd(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const He=BigInt(0),De=BigInt(1),Rn=BigInt(2),md=BigInt(3),gd=BigInt(4),bd=BigInt(5),rv=BigInt(7),yd=BigInt(8),ov=BigInt(9),wd=BigInt(16);function St(e,t){const n=e%t;return n>=He?n:t+n}function st(e,t,n){let r=e;for(;t-- >He;)r*=r,r%=n;return r}function vd(e,t){if(e===He)throw new Error("invert: expected non-zero number");if(t<=He)throw new Error("invert: expected positive modulus, got "+t);let n=St(e,t),r=t,o=He,s=De;for(;n!==He;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==De)throw new Error("invert: does not exist");return St(o,t)}function Oa(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function xd(e,t){const n=(e.ORDER+De)/gd,r=e.pow(t,n);return Oa(e,r,t),r}function sv(e,t){const n=(e.ORDER-bd)/yd,r=e.mul(t,Rn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Rn),o),c=e.mul(s,e.sub(i,e.ONE));return Oa(e,c,t),c}function iv(e){const t=yo(e),n=Ed(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+rv)/wd;return(c,a)=>{let u=c.pow(a,i),l=c.mul(u,r);const d=c.mul(u,o),f=c.mul(u,s),p=c.eql(c.sqr(l),a),h=c.eql(c.sqr(d),a);u=c.cmov(u,l,p),l=c.cmov(f,d,h);const m=c.eql(c.sqr(l),a),w=c.cmov(u,l,m);return Oa(c,w,a),w}}function Ed(e){if(e<md)throw new Error("sqrt is not defined for small field");let t=e-De,n=0;for(;t%Rn===He;)t/=Rn,n++;let r=Rn;const o=yo(e);for(;Pd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return xd;let s=o.pow(r,t);const i=(t+De)/Rn;return function(a,u){if(a.is0(u))return u;if(Pd(a,u)!==1)throw new Error("Cannot find square root");let l=n,d=a.mul(a.ONE,s),f=a.pow(u,t),p=a.pow(u,i);for(;!a.eql(f,a.ONE);){if(a.is0(f))return a.ZERO;let h=1,m=a.sqr(f);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===l)throw new Error("Cannot find square root");const w=De<<BigInt(l-h-1),T=a.pow(d,w);l=h,d=a.sqr(T),f=a.mul(f,d),p=a.mul(p,T)}return p}}function av(e){return e%gd===md?xd:e%yd===bd?sv:e%wd===ov?iv(e):Ed(e)}const cv=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function uv(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=cv.reduce((r,o)=>(r[o]="function",r),t);return Ji(e,n),e}function lv(e,t,n){if(n<He)throw new Error("invalid exponent, negatives unsupported");if(n===He)return e.ONE;if(n===De)return t;let r=e.ONE,o=t;for(;n>He;)n&De&&(r=e.mul(r,o)),o=e.sqr(o),n>>=De;return r}function Sd(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,a)=>e.is0(c)?i:(r[a]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,a)=>e.is0(c)?i:(r[a]=e.mul(i,r[a]),e.mul(i,c)),s),r}function Pd(e,t){const n=(e.ORDER-De)/Rn,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function $d(e,t){t!==void 0&&Fr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function yo(e,t,n=!1,r={}){if(e<=He)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,i=!1,c;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const f=t;f.BITS&&(o=f.BITS),f.sqrt&&(s=f.sqrt),typeof f.isLE=="boolean"&&(n=f.isLE),typeof f.modFromBytes=="boolean"&&(i=f.modFromBytes),c=f.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:u}=$d(e,o);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const d=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:u,MASK:po(a),ZERO:He,ONE:De,allowedLengths:c,create:f=>St(f,e),isValid:f=>{if(typeof f!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof f);return He<=f&&f<e},is0:f=>f===He,isValidNot0:f=>!d.is0(f)&&d.isValid(f),isOdd:f=>(f&De)===De,neg:f=>St(-f,e),eql:(f,p)=>f===p,sqr:f=>St(f*f,e),add:(f,p)=>St(f+p,e),sub:(f,p)=>St(f-p,e),mul:(f,p)=>St(f*p,e),pow:(f,p)=>lv(d,f,p),div:(f,p)=>St(f*vd(p,e),e),sqrN:f=>f*f,addN:(f,p)=>f+p,subN:(f,p)=>f-p,mulN:(f,p)=>f*p,inv:f=>vd(f,e),sqrt:s||(f=>(l||(l=av(e)),l(d,f))),toBytes:f=>n?lf(f,u):Xi(f,u),fromBytes:(f,p=!0)=>{if(c){if(!c.includes(f.length)||f.length>u)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+f.length);const m=new Uint8Array(u);m.set(f,n?0:m.length-f.length),f=m}if(f.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+f.length);let h=n?uf(f):os(f);if(i&&(h=St(h,e)),!p&&!d.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:f=>Sd(d,f),cmov:(f,p,h)=>h?p:f});return Object.freeze(d)}function Ad(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Td(e){const t=Ad(e);return t+Math.ceil(t/2)}function fv(e,t,n=!1){const r=e.length,o=Ad(t),s=Td(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?uf(e):os(e),c=St(i,t-De)+De;return n?lf(c,o):Xi(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const mr=BigInt(0),Dn=BigInt(1);function ms(e,t){const n=t.negate();return e?n:t}function Na(e,t){const n=Sd(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function Cd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ia(e,t){Cd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=po(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Od(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=Dn);const u=t*r,l=u+Math.abs(c)-1,d=c===0,f=c<0,p=t%2!==0;return{nextN:a,offset:l,isZero:d,isNeg:f,isNegF:p,offsetF:u}}function dv(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function pv(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const ka=new WeakMap,Nd=new WeakMap;function Ba(e){return Nd.get(e)||1}function Id(e){if(e!==mr)throw new Error("invalid wNAF")}class hv{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>mr;)n&Dn&&(r=r.add(o)),o=o.double(),n>>=Dn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Ia(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=Ia(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:d,isNegF:f,offsetF:p}=Od(r,c,i);r=a,l?s=s.add(ms(f,n[p])):o=o.add(ms(d,n[u]))}return Id(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Ia(t,this.bits);for(let i=0;i<s.windows&&r!==mr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=Od(r,i,s);if(r=c,!u){const d=n[a];o=o.add(l?d.negate():d)}}return Id(r),o}getPrecomputes(t,n,r){let o=ka.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),ka.set(n,o))),o}cached(t,n,r){const o=Ba(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Ba(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){Cd(n,this.bits),Nd.set(t,n),ka.delete(t)}hasCache(t){return Ba(t)!==1}}function mv(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>mr||r>mr;)n&Dn&&(s=s.add(o)),r&Dn&&(i=i.add(o)),o=o.double(),n>>=Dn,r>>=Dn;return{p1:s,p2:i}}function gv(e,t,n,r){dv(n,e),pv(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,c=ff(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=po(a),l=new Array(Number(u)+1).fill(i),d=Math.floor((t.BITS-1)/a)*a;let f=i;for(let p=d;p>=0;p-=a){l.fill(i);for(let m=0;m<s;m++){const w=r[m],T=Number(w>>BigInt(p)&u);l[T]=l[T].add(n[m])}let h=i;for(let m=l.length-1,w=i;m>0;m--)w=w.add(l[m]),h=h.add(w);if(f=f.add(h),p!==0)for(let m=0;m<a;m++)f=f.double()}return f}function kd(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return uv(t),t}else return yo(e,{isLE:n})}function bv(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const a of["p","n","h"]){const u=t[a];if(!(typeof u=="bigint"&&u>mr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=kd(t.p,n.Fp,r),s=kd(t.n,n.Fn,r),c=["Gx","Gy","a","b"];for(const a of c)if(!o.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Bd=(e,t)=>(e+(e>=0?t:-t)/Md)/t;function yv(e,t,n){const[[r,o],[s,i]]=t,c=Bd(i*e,n),a=Bd(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const d=u<nn,f=l<nn;d&&(u=-u),f&&(l=-l);const p=po(Math.ceil(ff(n)/2))+gr;if(u<nn||u>=p||l<nn||l>=p)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}function Ma(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function La(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return ns(n.lowS,"lowS"),ns(n.prehash,"prehash"),n.format!==void 0&&Ma(n.format),n}class wv extends Error{constructor(t=""){super(t)}}const tn={Err:wv,_tlv:{encode:(e,t)=>{const{Err:n}=tn;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=rs(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?rs(o.length/2|128):"";return rs(e)+s+o+t},decode(e,t){const{Err:n}=tn;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+a);if(u.length!==a)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const l of u)i=i<<8|l;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=tn;if(e<nn)throw new t("integer: negative integers are not allowed");let n=rs(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=tn;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return os(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=tn,o=ze("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:u,l}=r.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=tn,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},nn=BigInt(0),gr=BigInt(1),Md=BigInt(2),gs=BigInt(3),vv=BigInt(4);function br(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=ze("private key",t);try{r=e.fromBytes(o)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function xv(e,t={}){const n=bv("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;Ji(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:a}=t;if(a&&(!r.is0(s.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=Rd(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(N,P,S){const{x:E,y:C}=P.toAffine(),O=r.toBytes(E);if(ns(S,"isCompressed"),S){l();const b=!r.isOdd(C);return dn(Ld(b),O)}else return dn(Uint8Array.of(4),O,r.toBytes(C))}function f(N){Bn(N,void 0,"Point");const{publicKey:P,publicKeyUncompressed:S}=u,E=N.length,C=N[0],O=N.subarray(1);if(E===P&&(C===2||C===3)){const b=r.fromBytes(O);if(!r.isValid(b))throw new Error("bad point: is not on curve, wrong x");const k=m(b);let D;try{D=r.sqrt(k)}catch(H){const K=H instanceof Error?": "+H.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}l();const U=r.isOdd(D);return(C&1)===1!==U&&(D=r.neg(D)),{x:b,y:D}}else if(E===S&&C===4){const b=r.BYTES,k=r.fromBytes(O.subarray(0,b)),D=r.fromBytes(O.subarray(b,b*2));if(!w(k,D))throw new Error("bad point: is not on curve");return{x:k,y:D}}else throw new Error(`bad point: got length ${E}, expected compressed=${P} or uncompressed=${S}`)}const p=t.toBytes||d,h=t.fromBytes||f;function m(N){const P=r.sqr(N),S=r.mul(P,N);return r.add(r.add(S,r.mul(N,s.a)),s.b)}function w(N,P){const S=r.sqr(P),E=m(N);return r.eql(S,E)}if(!w(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const T=r.mul(r.pow(s.a,gs),vv),y=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(T,y)))throw new Error("bad curve params: a or b");function A(N,P,S=!1){if(!r.isValid(P)||S&&r.is0(P))throw new Error(`bad point coordinate ${N}`);return P}function M(N){if(!(N instanceof v))throw new Error("ProjectivePoint expected")}function L(N){if(!a||!a.basises)throw new Error("no endo");return yv(N,a.basises,o.ORDER)}const F=df((N,P)=>{const{X:S,Y:E,Z:C}=N;if(r.eql(C,r.ONE))return{x:S,y:E};const O=N.is0();P==null&&(P=O?r.ONE:r.inv(C));const b=r.mul(S,P),k=r.mul(E,P),D=r.mul(C,P);if(O)return{x:r.ZERO,y:r.ZERO};if(!r.eql(D,r.ONE))throw new Error("invZ was invalid");return{x:b,y:k}}),j=df(N=>{if(N.is0()){if(t.allowInfinityPoint&&!r.is0(N.Y))return;throw new Error("bad point: ZERO")}const{x:P,y:S}=N.toAffine();if(!r.isValid(P)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!w(P,S))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function g(N,P,S,E,C){return S=new v(r.mul(S.X,N),S.Y,S.Z),P=ms(E,P),S=ms(C,S),P.add(S)}class v{constructor(P,S,E){this.X=A("x",P),this.Y=A("y",S,!0),this.Z=A("z",E),Object.freeze(this)}static CURVE(){return s}static fromAffine(P){const{x:S,y:E}=P||{};if(!P||!r.isValid(S)||!r.isValid(E))throw new Error("invalid affine point");if(P instanceof v)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(E)?v.ZERO:new v(S,E,r.ONE)}static fromBytes(P){const S=v.fromAffine(h(Bn(P,void 0,"point")));return S.assertValidity(),S}static fromHex(P){return v.fromBytes(ze("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,S=!0){return I.createCache(this,P),S||this.multiply(gs),this}assertValidity(){j(this)}hasEvenY(){const{y:P}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(P)}equals(P){M(P);const{X:S,Y:E,Z:C}=this,{X:O,Y:b,Z:k}=P,D=r.eql(r.mul(S,k),r.mul(O,C)),U=r.eql(r.mul(E,k),r.mul(b,C));return D&&U}negate(){return new v(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:S}=s,E=r.mul(S,gs),{X:C,Y:O,Z:b}=this;let k=r.ZERO,D=r.ZERO,U=r.ZERO,_=r.mul(C,C),H=r.mul(O,O),K=r.mul(b,b),W=r.mul(C,O);return W=r.add(W,W),U=r.mul(C,b),U=r.add(U,U),k=r.mul(P,U),D=r.mul(E,K),D=r.add(k,D),k=r.sub(H,D),D=r.add(H,D),D=r.mul(k,D),k=r.mul(W,k),U=r.mul(E,U),K=r.mul(P,K),W=r.sub(_,K),W=r.mul(P,W),W=r.add(W,U),U=r.add(_,_),_=r.add(U,_),_=r.add(_,K),_=r.mul(_,W),D=r.add(D,_),K=r.mul(O,b),K=r.add(K,K),_=r.mul(K,W),k=r.sub(k,_),U=r.mul(K,H),U=r.add(U,U),U=r.add(U,U),new v(k,D,U)}add(P){M(P);const{X:S,Y:E,Z:C}=this,{X:O,Y:b,Z:k}=P;let D=r.ZERO,U=r.ZERO,_=r.ZERO;const H=s.a,K=r.mul(s.b,gs);let W=r.mul(S,O),Z=r.mul(E,b),G=r.mul(C,k),J=r.add(S,E),ne=r.add(O,b);J=r.mul(J,ne),ne=r.add(W,Z),J=r.sub(J,ne),ne=r.add(S,C);let le=r.add(O,k);return ne=r.mul(ne,le),le=r.add(W,G),ne=r.sub(ne,le),le=r.add(E,C),D=r.add(b,k),le=r.mul(le,D),D=r.add(Z,G),le=r.sub(le,D),_=r.mul(H,ne),D=r.mul(K,G),_=r.add(D,_),D=r.sub(Z,_),_=r.add(Z,_),U=r.mul(D,_),Z=r.add(W,W),Z=r.add(Z,W),G=r.mul(H,G),ne=r.mul(K,ne),Z=r.add(Z,G),G=r.sub(W,G),G=r.mul(H,G),ne=r.add(ne,G),W=r.mul(Z,ne),U=r.add(U,W),W=r.mul(le,ne),D=r.mul(J,D),D=r.sub(D,W),W=r.mul(J,Z),_=r.mul(le,_),_=r.add(_,W),new v(D,U,_)}subtract(P){return this.add(P.negate())}is0(){return this.equals(v.ZERO)}multiply(P){const{endo:S}=t;if(!o.isValidNot0(P))throw new Error("invalid scalar: out of range");let E,C;const O=b=>I.cached(this,b,k=>Na(v,k));if(S){const{k1neg:b,k1:k,k2neg:D,k2:U}=L(P),{p:_,f:H}=O(k),{p:K,f:W}=O(U);C=H.add(W),E=g(S.beta,_,K,b,D)}else{const{p:b,f:k}=O(P);E=b,C=k}return Na(v,[E,C])[0]}multiplyUnsafe(P){const{endo:S}=t,E=this;if(!o.isValid(P))throw new Error("invalid scalar: out of range");if(P===nn||E.is0())return v.ZERO;if(P===gr)return E;if(I.hasCache(this))return this.multiply(P);if(S){const{k1neg:C,k1:O,k2neg:b,k2:k}=L(P),{p1:D,p2:U}=mv(v,E,O,k);return g(S.beta,D,U,C,b)}else return I.unsafe(E,P)}multiplyAndAddUnsafe(P,S,E){const C=this.multiplyUnsafe(S).add(P.multiplyUnsafe(E));return C.is0()?void 0:C}toAffine(P){return F(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return i===gr?!0:P?P(v,this):I.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:P}=t;return i===gr?this:P?P(v,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(P=!0){return ns(P,"isCompressed"),this.assertValidity(),p(v,this,P)}toHex(P=!0){return rr(this.toBytes(P))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(P=!0){return this.toBytes(P)}_setWindowSize(P){this.precompute(P)}static normalizeZ(P){return Na(v,P)}static msm(P,S){return gv(v,o,P,S)}static fromPrivateKey(P){return v.BASE.multiply(br(o,P))}}v.BASE=new v(s.Gx,s.Gy,r.ONE),v.ZERO=new v(r.ZERO,r.ONE,r.ZERO),v.Fp=r,v.Fn=o;const $=o.BITS,I=new hv(v,t.endo?Math.ceil($/2):$);return v.BASE.precompute(8),v}function Ld(e){return Uint8Array.of(e?2:3)}function Rd(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Ev(e,t={}){const{Fn:n}=e,r=t.randomBytes||ol,o=Object.assign(Rd(e.Fp,n),{seed:Td(n.ORDER)});function s(p){try{return!!br(n,p)}catch{return!1}}function i(p,h){const{publicKey:m,publicKeyUncompressed:w}=o;try{const T=p.length;return h===!0&&T!==m||h===!1&&T!==w?!1:!!e.fromBytes(p)}catch{return!1}}function c(p=r(o.seed)){return fv(Bn(p,o.seed,"seed"),n.ORDER)}function a(p,h=!0){return e.BASE.multiply(br(n,p)).toBytes(h)}function u(p){const h=c(p);return{secretKey:h,publicKey:a(h)}}function l(p){if(typeof p=="bigint")return!1;if(p instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:w}=o;if(n.allowedLengths||h===m)return;const T=ze("key",p).length;return T===m||T===w}function d(p,h,m=!0){if(l(p)===!0)throw new Error("first arg must be private key");if(l(h)===!1)throw new Error("second arg must be public key");const w=br(n,p);return e.fromHex(h).multiply(w).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:d,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:p=>br(n,p),precompute(p=8,h=e.BASE){return h.precompute(p,!1)}},lengths:o})}function Sv(e,t,n={}){Qu(t),Ji(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||ol,o=n.hmac||((S,...E)=>hd(t,S,dn(...E))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:p}=Ev(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function w(S){const E=c>>gr;return S>E}function T(S,E){if(!i.isValidNot0(E))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return E}function y(S,E){Ma(E);const C=p.signature,O=E==="compact"?C:E==="recovered"?C+1:void 0;return Bn(S,O,`${E} signature`)}class A{constructor(E,C,O){this.r=T("r",E),this.s=T("s",C),O!=null&&(this.recovery=O),Object.freeze(this)}static fromBytes(E,C=m){y(E,C);let O;if(C==="der"){const{r:U,s:_}=tn.toSig(Bn(E));return new A(U,_)}C==="recovered"&&(O=E[0],C="compact",E=E.subarray(1));const b=i.BYTES,k=E.subarray(0,b),D=E.subarray(b,b*2);return new A(i.fromBytes(k),i.fromBytes(D),O)}static fromHex(E,C){return this.fromBytes(Wo(E),C)}addRecoveryBit(E){return new A(this.r,this.s,E)}recoverPublicKey(E){const C=s.ORDER,{r:O,s:b,recovery:k}=this;if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");if(c*Md<C&&k>1)throw new Error("recovery id is ambiguous for h>1 curve");const U=k===2||k===3?O+c:O;if(!s.isValid(U))throw new Error("recovery id 2 or 3 invalid");const _=s.toBytes(U),H=e.fromBytes(dn(Ld((k&1)===0),_)),K=i.inv(U),W=L(ze("msgHash",E)),Z=i.create(-W*K),G=i.create(b*K),J=e.BASE.multiplyUnsafe(Z).add(H.multiplyUnsafe(G));if(J.is0())throw new Error("point at infinify");return J.assertValidity(),J}hasHighS(){return w(this.s)}toBytes(E=m){if(Ma(E),E==="der")return Wo(tn.hexFromSig(this));const C=i.toBytes(this.r),O=i.toBytes(this.s);if(E==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return dn(Uint8Array.of(this.recovery),C,O)}return dn(C,O)}toHex(E){return rr(this.toBytes(E))}assertValidity(){}static fromCompact(E){return A.fromBytes(ze("sig",E),"compact")}static fromDER(E){return A.fromBytes(ze("sig",E),"der")}normalizeS(){return this.hasHighS()?new A(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return rr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return rr(this.toBytes("compact"))}}const M=n.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");const C=os(E),O=E.length*8-a;return O>0?C>>BigInt(O):C},L=n.bits2int_modN||function(E){return i.create(M(E))},F=po(a);function j(S){return Py("num < 2^"+a,S,nn,F),i.toBytes(S)}function g(S,E){return Bn(S,void 0,"message"),E?Bn(t(S),void 0,"prehashed message"):S}function v(S,E,C){if(["recovered","canonical"].some(Z=>Z in C))throw new Error("sign() legacy options not supported");const{lowS:O,prehash:b,extraEntropy:k}=La(C,h);S=g(S,b);const D=L(S),U=br(i,E),_=[j(U),j(D)];if(k!=null&&k!==!1){const Z=k===!0?r(p.secretKey):k;_.push(ze("extraEntropy",Z))}const H=dn(..._),K=D;function W(Z){const G=M(Z);if(!i.isValidNot0(G))return;const J=i.inv(G),ne=e.BASE.multiply(G).toAffine(),le=i.create(ne.x);if(le===nn)return;const Se=i.create(J*i.create(K+le*U));if(Se===nn)return;let Me=(ne.x===le?0:2)|Number(ne.y&gr),Y=Se;return O&&w(Se)&&(Y=i.neg(Se),Me^=1),new A(le,Y,Me)}return{seed:H,k2sig:W}}function $(S,E,C={}){S=ze("message",S);const{seed:O,k2sig:b}=v(S,E,C);return $y(t.outputLen,i.BYTES,o)(O,b)}function I(S){let E;const C=typeof S=="string"||Ho(S),O=!C&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!C&&!O)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(O)E=new A(S.r,S.s);else if(C){try{E=A.fromBytes(ze("sig",S),"der")}catch(b){if(!(b instanceof tn.Err))throw b}if(!E)try{E=A.fromBytes(ze("sig",S),"compact")}catch{return!1}}return E||!1}function N(S,E,C,O={}){const{lowS:b,prehash:k,format:D}=La(O,h);if(C=ze("publicKey",C),E=g(ze("message",E),k),"strict"in O)throw new Error("options.strict was renamed to lowS");const U=D===void 0?I(S):A.fromBytes(ze("sig",S),D);if(U===!1)return!1;try{const _=e.fromBytes(C);if(b&&U.hasHighS())return!1;const{r:H,s:K}=U,W=L(E),Z=i.inv(K),G=i.create(W*Z),J=i.create(H*Z),ne=e.BASE.multiplyUnsafe(G).add(_.multiplyUnsafe(J));return ne.is0()?!1:i.create(ne.x)===H}catch{return!1}}function P(S,E,C={}){const{prehash:O}=La(C,h);return E=g(E,O),A.fromBytes(S,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:p,Point:e,sign:$,verify:N,recoverPublicKey:P,Signature:A,hash:t})}function Pv(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const o=yo(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:o,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function $v(e){const{CURVE:t,curveOpts:n}=Pv(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function Av(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,$d(n.Fn.ORDER,n.Fn.BITS))})}function Tv(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=$v(e),s=xv(t,n),i=Sv(s,r,o);return Av(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Cv(e,t){const n=r=>Tv({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ra={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Ov={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Dd=BigInt(2);function Nv(e){const t=Ra.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=e*e*e%t,l=u*u*e%t,d=st(l,n,t)*l%t,f=st(d,n,t)*l%t,p=st(f,Dd,t)*u%t,h=st(p,o,t)*p%t,m=st(h,s,t)*h%t,w=st(m,c,t)*m%t,T=st(w,a,t)*w%t,y=st(T,c,t)*m%t,A=st(y,n,t)*l%t,M=st(A,i,t)*h%t,L=st(M,r,t)*u%t,F=st(L,Dd,t);if(!Da.eql(Da.sqr(F),e))throw new Error("Cannot find square root");return F}const Da=yo(Ra.p,{sqrt:Nv}),Fd=Cv({...Ra,Fp:Da,lowS:!0,endo:Ov},Yl),Iv=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Fd},Symbol.toStringTag,{value:"Module"}));function kv({r:e,s:t,to:n="hex",v:r,yParity:o}){const s=(()=>{if(o===0||o===1)return o;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new Fd.Signature(Ct(e),Ct(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:wt(i)}async function Fa(e,t){var d,f,p;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(p=(f=(d=e.chain)==null?void 0:d.contracts)==null?void 0:f.universalSignatureVerifier)==null?void 0:p.address,...a}=t,u=bt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?kv(i):Te(i),l=await(async()=>!r&&!o||yw(u)?u:ww({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Nt({abi:Cf,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:aa({abi:Cf,args:[n,s,l],bytecode:Qy}),...a},{data:m}=await re(e,ho,"call")(h);return Pg(m??"0x0")}catch(h){try{if(ts(An(n),await Dl({hash:s,signature:i})))return!0}catch{}if(h instanceof Ml)return!1;throw h}}async function Bv(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=td(n);return Fa(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function Mv(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,d=uw({message:i,primaryType:c,types:a,domain:u});return Fa(e,{address:n,factory:r,factoryData:o,hash:d,signature:s,...l})}function jd(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return c?(()=>{const d=Ce(["watchBlockNumber",e.uid,t,n,i]);return gn(d,{onBlockNumber:r,onError:o},f=>mo(async()=>{var p;try{const h=await re(e,go,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)f.onBlockNumber(m,a),a=m}(!a||h>a)&&(f.onBlockNumber(h,a),a=h)}catch(h){(p=f.onError)==null||p.call(f,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const d=Ce(["watchBlockNumber",e.uid,t,n]);return gn(d,{onBlockNumber:r,onError:o},f=>{let p=!0,h=()=>p=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(y=>y.config.type==="webSocket"||y.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),{unsubscribe:w}=await m.subscribe({params:["newHeads"],onData(T){var A;if(!p)return;const y=Ct((A=T.result)==null?void 0:A.number);f.onBlockNumber(y,a),a=y},onError(T){var y;(y=f.onError)==null||y.call(f,T)}});h=w,p||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function Lv(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:L})=>~~(1<<L)*200,timeout:a=18e4}=t,u=Ce(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var L;return t.pollingInterval?t.pollingInterval:(L=e.chain)!=null&&L.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let d,f,p,h=!1,m,w;const{promise:T,resolve:y,reject:A}=kf(),M=a?setTimeout(()=>{w(),m(),A(new Bb({hash:o}))},a):void 0;return m=gn(u,{onReplaced:s,resolve:y,reject:A},async L=>{if(p=await re(e,ps,"getTransactionReceipt")({hash:o}).catch(()=>{}),p&&r<=1){clearTimeout(M),L.resolve(p),m();return}w=re(e,jd,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(F){const j=v=>{clearTimeout(M),w(),v(),m()};let g=F;if(!h)try{if(p){if(r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;j(()=>L.resolve(p));return}if(n&&!d&&(h=!0,await fa(async()=>{d=await re(e,wa,"getTransaction")({hash:o}),d.blockNumber&&(g=d.blockNumber)},{delay:c,retryCount:i}),h=!1),p=await re(e,ps,"getTransactionReceipt")({hash:o}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;j(()=>L.resolve(p))}catch(v){if(v instanceof kl||v instanceof Bl){if(!d){h=!1;return}try{f=d,h=!0;const $=await fa(()=>re(e,It,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:P})=>P instanceof zl});h=!1;const I=$.transactions.find(({from:P,nonce:S})=>P===f.from&&S===f.nonce);if(!I||(p=await re(e,ps,"getTransactionReceipt")({hash:I.hash}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r)))return;let N="replaced";I.to===f.to&&I.value===f.value&&I.input===f.input?N="repriced":I.from===I.to&&I.value===0n&&(N="cancelled"),j(()=>{var P;(P=L.onReplaced)==null||P.call(L,{reason:N,replacedTransaction:f,transaction:I,transactionReceipt:p}),L.resolve(p)})}catch($){j(()=>L.reject($))}}else j(()=>L.reject(v))}}})}),T}function Rv(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const u=typeof c<"u"?c:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),l=i??!1;let d;return u?(()=>{const h=Ce(["watchBlocks",e.uid,t,n,r,l,a]);return gn(h,{onBlock:o,onError:s},m=>mo(async()=>{var w;try{const T=await re(e,It,"getBlock")({blockTag:t,includeTransactions:l});if(T.number!==null&&(d==null?void 0:d.number)!=null){if(T.number===d.number)return;if(T.number-d.number>1&&n)for(let y=(d==null?void 0:d.number)+1n;y<T.number;y++){const A=await re(e,It,"getBlock")({blockNumber:y,includeTransactions:l});m.onBlock(A,d),d=A}}((d==null?void 0:d.number)==null||t==="pending"&&(T==null?void 0:T.number)==null||T.number!==null&&T.number>d.number)&&(m.onBlock(T,d),d=T)}catch(T){(w=m.onError)==null||w.call(m,T)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,w=()=>h=!1;return(async()=>{try{r&&re(e,It,"getBlock")({blockTag:t,includeTransactions:l}).then(A=>{h&&m&&(o(A,void 0),m=!1)}).catch(s);const T=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(M=>M.config.type==="webSocket"||M.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),{unsubscribe:y}=await T.subscribe({params:["newHeads"],async onData(A){var L;if(!h)return;const M=await re(e,It,"getBlock")({blockNumber:(L=A.result)==null?void 0:L.number,includeTransactions:l}).catch(()=>{});h&&(o(M,d),m=!1,d=M)},onError(A){s==null||s(A)}});w=y,h||w()}catch(T){s==null||s(T)}})(),()=>w()})()}function Dv(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:u,pollingInterval:l=e.pollingInterval,strict:d}){const f=typeof u<"u"?u:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),p=d??!1;return f?(()=>{const w=Ce(["watchEvent",t,n,r,e.uid,o,l,i]);return gn(w,{onLogs:a,onError:c},T=>{let y;i!==void 0&&(y=i-1n);let A,M=!1;const L=mo(async()=>{var F;if(!M){try{A=await re(e,Vf,"createEventFilter")({address:t,args:n,event:o,events:s,strict:p,fromBlock:i})}catch{}M=!0;return}try{let j;if(A)j=await re(e,ss,"getFilterChanges")({filter:A});else{const g=await re(e,go,"getBlockNumber")({});y&&y!==g?j=await re(e,qi,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:y+1n,toBlock:g}):j=[],y=g}if(j.length===0)return;if(r)T.onLogs(j);else for(const g of j)T.onLogs([g])}catch(j){A&&j instanceof Nn&&(M=!1),(F=T.onError)==null||F.call(T,j)}},{emitOnBegin:!0,interval:l});return async()=>{A&&await re(e,is,"uninstallFilter")({filter:A}),L()}})})():(()=>{let w=!0,T=()=>w=!1;return(async()=>{try{const y=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),A=s??(o?[o]:void 0);let M=[];A&&(M=[A.flatMap(j=>Ur({abi:[j],eventName:j.name,args:n}))],o&&(M=M[0]));const{unsubscribe:L}=await y.subscribe({params:["logs",{address:t,topics:M}],onData(F){var g;if(!w)return;const j=F.result;try{const{eventName:v,args:$}=Vi({abi:A??[],data:j.data,topics:j.topics,strict:p}),I=Qt(j,{args:$,eventName:v});a([I])}catch(v){let $,I;if(v instanceof Rr||v instanceof Uo){if(d)return;$=v.abiItem.name,I=(g=v.abiItem.inputs)==null?void 0:g.some(P=>!("name"in P&&P.name))}const N=Qt(j,{args:I?[]:{},eventName:$});a([N])}},onError(F){c==null||c(F)}});T=L,w||T()}catch(y){c==null||c(y)}})(),()=>T()})()}function Fv(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=Ce(["watchPendingTransactions",e.uid,t,s]);return gn(u,{onTransactions:r,onError:n},l=>{let d;const f=mo(async()=>{var p;try{if(!d)try{d=await re(e,Gf,"createPendingTransactionFilter")({});return}catch(m){throw f(),m}const h=await re(e,ss,"getFilterChanges")({filter:d});if(h.length===0)return;if(t)l.onTransactions(h);else for(const m of h)l.onTransactions([m])}catch(h){(p=l.onError)==null||p.call(l,h)}},{emitOnBegin:!0,interval:s});return async()=>{d&&await re(e,is,"uninstallFilter")({filter:d}),f()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(f){if(!u)return;const p=f.result;r([p])},onError(f){n==null||n(f)}});l=d,u||l()}catch(d){n==null||n(d)}})(),()=>l()})()}function jv(e){var d,f,p;const{scheme:t,statement:n,...r}=((d=e.match(_v))==null?void 0:d.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((f=e.match(Uv))==null?void 0:f.groups)??{},l=(p=e.split("Resources:")[1])==null?void 0:p.split(`
77
+ - `).slice(1);return{...r,...u,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const _v=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,Uv=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function zv(e){const{address:t,domain:n,message:r,nonce:o,scheme:s,time:i=new Date}=e;if(n&&r.domain!==n||o&&r.nonce!==o||s&&r.scheme!==s||r.expirationTime&&i>=r.expirationTime||r.notBefore&&i<r.notBefore)return!1;try{if(!r.address||!rt(r.address,{strict:!1})||t&&!ts(r.address,t))return!1}catch{return!1}return!0}async function Hv(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=jv(o);if(!l.address||!zv({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const f=td(o);return Fa(e,{address:l.address,hash:f,signature:c,...u})}function Wv(e){return{call:t=>ho(e,t),createAccessList:t=>Wf(e,t),createBlockFilter:()=>V1(e),createContractEventFilter:t=>xl(e,t),createEventFilter:t=>Vf(e,t),createPendingTransactionFilter:()=>Gf(e),estimateContractGas:t=>vy(e,t),estimateGas:t=>Wi(e,t),getBalance:t=>of(e,t),getBlobBaseFee:()=>G1(e),getBlock:t=>It(e,t),getBlockNumber:t=>go(e,t),getBlockTransactionCount:t=>q1(e,t),getBytecode:t=>qf(e,t),getChainId:()=>tf(e),getCode:t=>qf(e,t),getContractEvents:t=>af(e,t),getEip712Domain:t=>K1(e,t),getEnsAddress:t=>O1(e,t),getEnsAvatar:t=>z1(e,t),getEnsName:t=>H1(e,t),getEnsResolver:t=>W1(e,t),getEnsText:t=>Hf(e,t),getFeeHistory:t=>Q1(e,t),estimateFeesPerGas:t=>ry(e,t),getFilterChanges:t=>ss(e,t),getFilterLogs:t=>J1(e,t),getGasPrice:()=>Ui(e),getLogs:t=>qi(e,t),getProof:t=>Pw(e,t),estimateMaxPriorityFeePerGas:t=>ny(e,t),getStorageAt:t=>$w(e,t),getTransaction:t=>wa(e,t),getTransactionConfirmations:t=>Aw(e,t),getTransactionCount:t=>ql(e,t),getTransactionReceipt:t=>ps(e,t),multicall:t=>Tw(e,t),prepareTransactionRequest:t=>rf(e,t),readContract:t=>en(e,t),sendRawTransaction:t=>d1(e,t),simulate:t=>va(e,t),simulateBlocks:t=>va(e,t),simulateCalls:t=>nv(e,t),simulateContract:t=>o1(e,t),verifyMessage:t=>Bv(e,t),verifySiweMessage:t=>Hv(e,t),verifyTypedData:t=>Mv(e,t),uninstallFilter:t=>is(e,t),waitForTransactionReceipt:t=>Lv(e,t),watchBlocks:t=>Rv(e,t),watchBlockNumber:t=>jd(e,t),watchContractEvent:t=>f1(e,t),watchEvent:t=>Dv(e,t),watchPendingTransactions:t=>Fv(e,t)}}function ja(e){const{key:t="public",name:n="Public Client"}=e;return m1({...e,key:t,name:n,type:"publicClient"}).extend(Wv)}const _a=Yf({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),_d=Yf({id:56,name:"BNB Smart Chain",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://56.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}});function bs({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=x.useState(null),[a,u]=x.useState(o);return x.useEffect(()=>{let l,d;const f=async()=>{try{const p=await e.readContract({address:t,abi:fr,functionName:"balanceOf",args:[n]});c(p),u(Ai(p,r))}catch{u(o)}};f();try{l=e.watchContractEvent({address:t,abi:fr,eventName:"Transfer",args:{to:n},onLogs:()=>{f()},poll:!0,pollingInterval:s}),d=e.watchContractEvent({address:t,abi:fr,eventName:"Transfer",args:{from:n},onLogs:()=>{f()},poll:!0,pollingInterval:s})}catch{}return()=>{l==null||l(),d==null||d()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const Vv="0x55d398326f99059fF775485246999027B3197955",Gv="0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",qv="0xaf88d065e77c8cC2239327C5EDb3A432268e5831",Zv="0x0520b0a951658db92b8a2dd9f146bb8223638740",Kv="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",Yv="0x81144d6E7084928830f9694a201E8c1ce6eD0cb2";function Ud(e,t,n=[]){if(e&&typeof e=="string")return e;if(t&&typeof t=="string")return t;if(n&&n.length>0)return n[0]}function Xv(e={}){const{bscRpcUrl:t,arbitrumRpcUrl:n,pollingInterval:r=12e3}=e,o=x.useMemo(()=>{var u,l,d;return ja({chain:_d,transport:pa(Ud(t,typeof window<"u"?(u=window==null?void 0:window.ENV)==null?void 0:u.CHAIN_RPC_URL_56:void 0,((d=(l=_d.rpcUrls)==null?void 0:l.default)==null?void 0:d.http)||[]))})},[t]),s=x.useMemo(()=>{var u,l,d;return ja({chain:_a,transport:pa(Ud(n,typeof window<"u"?(u=window==null?void 0:window.ENV)==null?void 0:u.CHAIN_RPC_URL_42161:void 0,((d=(l=_a.rpcUrls)==null?void 0:l.default)==null?void 0:d.http)||[]))})},[n]),{formatted:i="0"}=bs({client:o,tokenAddress:Vv,holder:Zv,decimals:18,fallbackFormatted:"0",pollingInterval:r}),{formatted:c="0"}=bs({client:s,tokenAddress:Gv,holder:Kv,decimals:6,fallbackFormatted:"0",pollingInterval:r}),{formatted:a="0"}=bs({client:s,tokenAddress:qv,holder:Yv,decimals:6,fallbackFormatted:"0",pollingInterval:r});return{BNB_USDT_BALANCE:i,ARB_USDT_BALANCE:c,ARB_USDC_BALANCE:a}}const Qv=()=>({openDeposit:x.useCallback(t=>{},[])}),Jv=()=>({openWithdraw:x.useCallback(t=>{},[])}),Fn="MPC",Ua="EVM";/**
31
78
  * @license lucide-react v0.540.0 - ISC
32
79
  *
33
80
  * This source code is licensed under the ISC license.
34
81
  * See the LICENSE file in the root directory of this source tree.
35
- */const Ss=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Os=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Sr=e=>{const t=Os(e);return t.charAt(0).toUpperCase()+t.slice(1)},Or=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Ts=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
82
+ */const ex=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),tx=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),zd=e=>{const t=tx(e);return t.charAt(0).toUpperCase()+t.slice(1)},Hd=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),nx=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
36
83
  * @license lucide-react v0.540.0 - ISC
37
84
  *
38
85
  * This source code is licensed under the ISC license.
39
86
  * See the LICENSE file in the root directory of this source tree.
40
- */var $s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
87
+ */var rx={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
41
88
  * @license lucide-react v0.540.0 - ISC
42
89
  *
43
90
  * This source code is licensed under the ISC license.
44
91
  * See the LICENSE file in the root directory of this source tree.
45
- */const Ps=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...u},i)=>h.createElement("svg",{ref:i,...$s,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Or("lucide",o),...!s&&!Ts(u)&&{"aria-hidden":"true"},...u},[...c.map(([l,a])=>h.createElement(l,a)),...Array.isArray(s)?s:[s]]));/**
92
+ */const ox=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>x.createElement("svg",{ref:a,...rx,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Hd("lucide",o),...!s&&!nx(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,l])=>x.createElement(u,l)),...Array.isArray(s)?s:[s]]));/**
46
93
  * @license lucide-react v0.540.0 - ISC
47
94
  *
48
95
  * This source code is licensed under the ISC license.
49
96
  * See the LICENSE file in the root directory of this source tree.
50
- */const As=(e,t)=>{const n=h.forwardRef(({className:r,...o},s)=>h.createElement(Ps,{ref:s,iconNode:t,className:Or(`lucide-${Ss(Sr(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Sr(e),n};/**
97
+ */const sx=(e,t)=>{const n=x.forwardRef(({className:r,...o},s)=>x.createElement(ox,{ref:s,iconNode:t,className:Hd(`lucide-${ex(zd(e))}`,`lucide-${e}`,r),...o}));return n.displayName=zd(e),n};/**
51
98
  * @license lucide-react v0.540.0 - ISC
52
99
  *
53
100
  * This source code is licensed under the ISC license.
54
101
  * See the LICENSE file in the root directory of this source tree.
55
- */const Ms=As("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class Tr{constructor(){Ye(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 _s extends Tr{constructor(n,r){super();Ye(this,"smartWallet");Ye(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{console.log("Connecting MPC wallet..."),this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){console.log("Disconnecting MPC wallet...")}async switchChain(n){console.log(`MPC wallet switching to chain ${n}`)}async getBalance(n){return console.log(`Getting MPC wallet balance for token ${n}`),"0"}async approve(n,r){return console.log(`MPC wallet approve not needed for ${n}`),""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{console.log(`MPC deposit ${n} of ${r} to ${this.getDisplayAddress()}`);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 console.log(`MPC signing message: ${n}`),`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 Ls extends Tr{constructor(n,r,o,s="0",c="0"){super();Ye(this,"currentActiveAccount");Ye(this,"approved");Ye(this,"chainId");Ye(this,"balance");Ye(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=c}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{console.log("Connecting EVM wallet..."),this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){console.log("Disconnecting EVM wallet...")}async switchChain(n){this.setState({isLoading:!0,error:null});try{console.log(`Switching EVM wallet to chain ${n}`),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 console.log(`Getting EVM wallet balance for token ${n}`),this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{console.log(`Approving ${r} of ${n}`);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");console.log(`EVM deposit ${n} of ${r}`);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 console.log(`EVM signing message: ${n}`),`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function Ds(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new _s(t,e);default:return new Ls(e,!1,r||1,o,s)}}const $r=typeof document<"u"?h.useLayoutEffect:()=>{};var dn;const Fs=(dn=h.useInsertionEffect)!==null&&dn!==void 0?dn:$r;function Is(e){const t=h.useRef(null);return Fs(()=>{t.current=e},[e]),h.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const Ge=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Ze=e=>e&&"window"in e&&e.window===e?e:Ge(e).defaultView||window;function ks(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Ns(e){return ks(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let js=!1;function pn(){return js}function Pr(e,t){if(!pn())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:Ns(n)?n=n.host:n=n.parentNode}return!1}const hn=(e=document)=>{var t;if(!pn())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 Ar(e){return pn()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function kt(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 mn(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 Ue(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const vn=Ue(function(){return mn(/^Mac/i)}),Rs=Ue(function(){return mn(/^iPhone/i)}),Ws=Ue(function(){return mn(/^iPad/i)||vn()&&navigator.maxTouchPoints>1}),Bs=Ue(function(){return Rs()||Ws()});Ue(function(){return vn()||Bs()}),Ue(function(){return kt(/AppleWebKit/i)&&!Hs()});const Hs=Ue(function(){return kt(/Chrome/i)}),Us=Ue(function(){return kt(/Android/i)});Ue(function(){return kt(/Firefox/i)});function Mr(){let e=h.useRef(new Map),t=h.useCallback((o,s,c,u)=>{let i=u!=null&&u.once?(...l)=>{e.current.delete(c),c(...l)}:c;e.current.set(c,{type:s,eventTarget:o,fn:i,options:u}),o.addEventListener(s,i,u)},[]),n=h.useCallback((o,s,c,u)=>{var i;let l=((i=e.current.get(c))===null||i===void 0?void 0:i.fn)||c;o.removeEventListener(s,l,u),e.current.delete(c)},[]),r=h.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return h.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Vs(e){return e.mozInputSource===0&&e.isTrusted?!0:Us()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function _r(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function zs(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Lr(e){let t=h.useRef({isFocused:!1,observer:null});$r(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Is(r=>{e==null||e(r)});return h.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=c=>{if(t.current.isFocused=!1,o.disabled){let u=_r(c);n(u)}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 c;(c=t.current.observer)===null||c===void 0||c.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 Ys=!1,xt=null,gn=new Set,Ct=new Map,et=!1,bn=!1;const Gs={Tab:!0,Escape:!0};function yn(e,t){for(let n of gn)n(e,t)}function qs(e){return!(e.metaKey||!vn()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Nt(e){et=!0,qs(e)&&(xt="keyboard",yn("keyboard",e))}function Te(e){xt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(et=!0,yn("pointer",e))}function Dr(e){Vs(e)&&(et=!0,xt="virtual")}function Fr(e){e.target===window||e.target===document||Ys||!e.isTrusted||(!et&&!bn&&(xt="virtual",yn("virtual",e)),et=!1,bn=!1)}function Ir(){et=!1,bn=!0}function En(e){if(typeof window>"u"||typeof document>"u"||Ct.get(Ze(e)))return;const t=Ze(e),n=Ge(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){et=!0,r.apply(this,arguments)},n.addEventListener("keydown",Nt,!0),n.addEventListener("keyup",Nt,!0),n.addEventListener("click",Dr,!0),t.addEventListener("focus",Fr,!0),t.addEventListener("blur",Ir,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Te,!0),n.addEventListener("pointermove",Te,!0),n.addEventListener("pointerup",Te,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Te,!0),n.addEventListener("mousemove",Te,!0),n.addEventListener("mouseup",Te,!0)),t.addEventListener("beforeunload",()=>{kr(e)},{once:!0}),Ct.set(t,{focus:r})}const kr=(e,t)=>{const n=Ze(e),r=Ge(e);t&&r.removeEventListener("DOMContentLoaded",t),Ct.has(n)&&(n.HTMLElement.prototype.focus=Ct.get(n).focus,r.removeEventListener("keydown",Nt,!0),r.removeEventListener("keyup",Nt,!0),r.removeEventListener("click",Dr,!0),n.removeEventListener("focus",Fr,!0),n.removeEventListener("blur",Ir,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Te,!0),r.removeEventListener("pointermove",Te,!0),r.removeEventListener("pointerup",Te,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Te,!0),r.removeEventListener("mousemove",Te,!0),r.removeEventListener("mouseup",Te,!0)),Ct.delete(n))};function Ks(e){const t=Ge(e);let n;return t.readyState!=="loading"?En(e):(n=()=>{En(e)},t.addEventListener("DOMContentLoaded",n)),()=>kr(e,n)}typeof document<"u"&&Ks();function Nr(){return xt!=="pointer"}const Qs=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Xs(e,t,n){let r=Ge(n==null?void 0:n.target);const o=typeof window<"u"?Ze(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Ze(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,c=typeof window<"u"?Ze(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?Ze(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Qs.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof c&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!Gs[n.key])}function Js(e,t,n){En(),h.useEffect(()=>{let r=(o,s)=>{Xs(!!(n!=null&&n.isTextInput),o,s)&&e(Nr())};return gn.add(r),()=>{gn.delete(r)}},t)}function Zs(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=h.useCallback(i=>{if(i.target===i.currentTarget)return r&&r(i),o&&o(!1),!0},[r,o]),c=Lr(s),u=h.useCallback(i=>{const l=Ge(i.target),a=l?hn(l):hn();i.target===i.currentTarget&&a===Ar(i.nativeEvent)&&(n&&n(i),o&&o(!0),c(i))},[o,n,c]);return{focusProps:{onFocus:!t&&(n||o||r)?u:void 0,onBlur:!t&&(r||o)?s:void 0}}}function el(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=h.useRef({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:u}=Mr(),i=h.useCallback(d=>{d.currentTarget.contains(d.target)&&s.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(s.current.isFocusWithin=!1,u(),n&&n(d),o&&o(!1))},[n,o,s,u]),l=Lr(i),a=h.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const f=Ge(d.target),p=hn(f);if(!s.current.isFocusWithin&&p===Ar(d.nativeEvent)){r&&r(d),o&&o(!0),s.current.isFocusWithin=!0,l(d);let m=d.currentTarget;c(f,"focus",g=>{if(s.current.isFocusWithin&&!Pr(m,g.target)){let b=new f.defaultView.FocusEvent("blur",{relatedTarget:g.target});zs(b,m);let x=_r(b);i(x)}},{capture:!0})}},[r,o,l,c,i]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:a,onBlur:i}}}let jt=!1,Rt=0;function wn(){jt=!0,setTimeout(()=>{jt=!1},50)}function jr(e){e.pointerType==="touch"&&wn()}function tl(){if(!(typeof document>"u"))return Rt===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",jr):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",wn)),Rt++,()=>{Rt--,!(Rt>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",jr):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",wn))}}function nl(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,c]=h.useState(!1),u=h.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;h.useEffect(tl,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=Mr(),{hoverProps:a,triggerHoverEnd:d}=h.useMemo(()=>{let f=(g,b)=>{if(u.pointerType=b,o||b==="touch"||u.isHovered||!g.currentTarget.contains(g.target))return;u.isHovered=!0;let x=g.currentTarget;u.target=x,i(Ge(g.target),"pointerover",w=>{u.isHovered&&u.target&&!Pr(u.target,w.target)&&p(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:x,pointerType:b}),n&&n(!0),c(!0)},p=(g,b)=>{let x=u.target;u.pointerType="",u.target=null,!(b==="touch"||!u.isHovered||!x)&&(u.isHovered=!1,l(),r&&r({type:"hoverend",target:x,pointerType:b}),n&&n(!1),c(!1))},m={};return typeof PointerEvent<"u"?(m.onPointerEnter=g=>{jt&&g.pointerType==="mouse"||f(g,g.pointerType)},m.onPointerLeave=g=>{!o&&g.currentTarget.contains(g.target)&&p(g,g.pointerType)}):process.env.NODE_ENV==="test"&&(m.onTouchStart=()=>{u.ignoreEmulatedMouseEvents=!0},m.onMouseEnter=g=>{!u.ignoreEmulatedMouseEvents&&!jt&&f(g,"mouse"),u.ignoreEmulatedMouseEvents=!1},m.onMouseLeave=g=>{!o&&g.currentTarget.contains(g.target)&&p(g,"mouse")}),{hoverProps:m,triggerHoverEnd:p}},[t,n,r,o,u,i,l]);return h.useEffect(()=>{o&&d({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:a,isHovered:s}}function rl(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=h.useRef({isFocused:!1,isFocusVisible:t||Nr()}),[s,c]=h.useState(!1),[u,i]=h.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=h.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),a=h.useCallback(p=>{o.current.isFocused=p,c(p),l()},[l]);Js(p=>{o.current.isFocusVisible=p,l()},[],{isTextInput:n});let{focusProps:d}=Zs({isDisabled:r,onFocusChange:a}),{focusWithinProps:f}=el({isDisabled:!r,onFocusWithinChange:a});return{isFocused:s,isFocusVisible:u,focusProps:r?f:d}}var ol=Object.defineProperty,il=(e,t,n)=>t in e?ol(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xn=(e,t,n)=>(il(e,typeof t!="symbol"?t+"":t,n),n);let sl=class{constructor(){xn(this,"current",this.detect()),xn(this,"handoffState","pending"),xn(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"}},ke=new sl;function St(e){var t,n;return ke.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 Rr(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function De(){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 Rr(()=>{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=De();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 at(){let[e]=h.useState(De);return h.useEffect(()=>()=>e.dispose(),[e]),e}let ue=(e,t)=>{ke.isServer?h.useEffect(e,t):h.useLayoutEffect(e,t)};function tt(e){let t=h.useRef(e);return ue(()=>{t.current=e},[e]),t}let ne=function(e){let t=tt(e);return h.useCallback((...n)=>t.current(...n),[t])};function ll(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 al(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function ul({disabled:e=!1}={}){let t=h.useRef(null),[n,r]=h.useState(!1),o=at(),s=ne(()=>{t.current=null,r(!1),o.dispose()}),c=ne(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let i=St(u.currentTarget);o.addEventListener(i,"pointerup",s,!1),o.addEventListener(i,"pointermove",l=>{if(t.current){let a=ll(l);r(al(a,t.current.getBoundingClientRect()))}},!1),o.addEventListener(i,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:c,onPointerUp:s,onClick:s}}}let cl=h.createContext(void 0);function Cn(){return h.useContext(cl)}function Sn(...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 Wt=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Wt||{}),qe=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(qe||{});function Se(){let e=dl();return h.useCallback(t=>fl({mergeRefs:e,...t}),[e])}function fl({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:c,mergeRefs:u}){u=u??pl;let i=Wr(t,e);if(s)return Bt(i,n,r,c,u);let l=o??0;if(l&2){let{static:a=!1,...d}=i;if(a)return Bt(d,n,r,c,u)}if(l&1){let{unmount:a=!0,...d}=i;return $e(a?0:1,{0(){return null},1(){return Bt({...d,hidden:!0,style:{display:"none"}},n,r,c,u)}})}return Bt(i,n,r,c,u)}function Bt(e,t={},n,r,o){let{as:s=n,children:c,refName:u="ref",...i}=On(e,["unmount","static"]),l=e.ref!==void 0?{[u]:e.ref}:{},a=typeof c=="function"?c(t):c;"className"in i&&i.className&&typeof i.className=="function"&&(i.className=i.className(t)),i["aria-labelledby"]&&i["aria-labelledby"]===i.id&&(i["aria-labelledby"]=void 0);let d={};if(t){let f=!1,p=[];for(let[m,g]of Object.entries(t))typeof g=="boolean"&&(f=!0),g===!0&&p.push(m.replace(/([A-Z])/g,b=>`-${b.toLowerCase()}`));if(f){d["data-headlessui-state"]=p.join(" ");for(let m of p)d[`data-${m}`]=""}}if(s===h.Fragment&&(Object.keys(Ke(i)).length>0||Object.keys(Ke(d)).length>0))if(!h.isValidElement(a)||Array.isArray(a)&&a.length>1){if(Object.keys(Ke(i)).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(Ke(i)).concat(Object.keys(Ke(d))).map(f=>` - ${f}`).join(`
102
+ */const Wd=sx("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ix=({tokens:e,selectedToken:t,onTokenChange:n})=>B.jsx("div",{className:"bg-fill-input-primary flex rounded-lg p-1",children:e.map(r=>B.jsxs("button",{className:`flex-1 font-medium rounded-md flex items-center justify-center text-sm h-[30px] ${t.token===r.token?"bg-fill-btn-primary text-text-black-static":"text-text-primary"}`,onClick:()=>n(r),children:[B.jsx("img",{src:r.iconUrl,alt:r.token,className:"w-4 h-4 rounded-full"}),B.jsx("span",{className:"ml-1",children:r.token||r.symbol})]},r.token))}),Vd=typeof document<"u"?x.useLayoutEffect:()=>{};var za;const ax=(za=x.useInsertionEffect)!==null&&za!==void 0?za:Vd;function cx(e){const t=x.useRef(null);return ax(()=>{t.current=e},[e]),x.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const bn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},jn=e=>e&&"window"in e&&e.window===e?e:bn(e).defaultView||window;function ux(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function lx(e){return ux(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let fx=!1;function Ha(){return fx}function Gd(e,t){if(!Ha())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:lx(n)?n=n.host:n=n.parentNode}return!1}const Wa=(e=document)=>{var t;if(!Ha())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function qd(e){return Ha()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function ys(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function Va(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function rn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ga=rn(function(){return Va(/^Mac/i)}),dx=rn(function(){return Va(/^iPhone/i)}),px=rn(function(){return Va(/^iPad/i)||Ga()&&navigator.maxTouchPoints>1}),hx=rn(function(){return dx()||px()});rn(function(){return Ga()||hx()}),rn(function(){return ys(/AppleWebKit/i)&&!mx()});const mx=rn(function(){return ys(/Chrome/i)}),gx=rn(function(){return ys(/Android/i)});rn(function(){return ys(/Firefox/i)});function Zd(){let e=x.useRef(new Map),t=x.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...u)=>{e.current.delete(i),i(...u)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=x.useCallback((o,s,i,c)=>{var a;let u=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,u,c),e.current.delete(i)},[]),r=x.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return x.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function bx(e){return e.mozInputSource===0&&e.isTrusted?!0:gx()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Kd(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function yx(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Yd(e){let t=x.useRef({isFocused:!1,observer:null});Vd(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=cx(r=>{e==null||e(r)});return x.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=Kd(i);n(c)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let wx=!1,wo=null,qa=new Set,vo=new Map,_n=!1,Za=!1;const vx={Tab:!0,Escape:!0};function Ka(e,t){for(let n of qa)n(e,t)}function xx(e){return!(e.metaKey||!Ga()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ws(e){_n=!0,xx(e)&&(wo="keyboard",Ka("keyboard",e))}function it(e){wo="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(_n=!0,Ka("pointer",e))}function Xd(e){bx(e)&&(_n=!0,wo="virtual")}function Qd(e){e.target===window||e.target===document||wx||!e.isTrusted||(!_n&&!Za&&(wo="virtual",Ka("virtual",e)),_n=!1,Za=!1)}function Jd(){_n=!1,Za=!0}function Ya(e){if(typeof window>"u"||typeof document>"u"||vo.get(jn(e)))return;const t=jn(e),n=bn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){_n=!0,r.apply(this,arguments)},n.addEventListener("keydown",ws,!0),n.addEventListener("keyup",ws,!0),n.addEventListener("click",Xd,!0),t.addEventListener("focus",Qd,!0),t.addEventListener("blur",Jd,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",it,!0),n.addEventListener("pointermove",it,!0),n.addEventListener("pointerup",it,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",it,!0),n.addEventListener("mousemove",it,!0),n.addEventListener("mouseup",it,!0)),t.addEventListener("beforeunload",()=>{ep(e)},{once:!0}),vo.set(t,{focus:r})}const ep=(e,t)=>{const n=jn(e),r=bn(e);t&&r.removeEventListener("DOMContentLoaded",t),vo.has(n)&&(n.HTMLElement.prototype.focus=vo.get(n).focus,r.removeEventListener("keydown",ws,!0),r.removeEventListener("keyup",ws,!0),r.removeEventListener("click",Xd,!0),n.removeEventListener("focus",Qd,!0),n.removeEventListener("blur",Jd,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",it,!0),r.removeEventListener("pointermove",it,!0),r.removeEventListener("pointerup",it,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",it,!0),r.removeEventListener("mousemove",it,!0),r.removeEventListener("mouseup",it,!0)),vo.delete(n))};function Ex(e){const t=bn(e);let n;return t.readyState!=="loading"?Ya(e):(n=()=>{Ya(e)},t.addEventListener("DOMContentLoaded",n)),()=>ep(e,n)}typeof document<"u"&&Ex();function tp(){return wo!=="pointer"}const Sx=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Px(e,t,n){let r=bn(n==null?void 0:n.target);const o=typeof window<"u"?jn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?jn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?jn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?jn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Sx.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!vx[n.key])}function $x(e,t,n){Ya(),x.useEffect(()=>{let r=(o,s)=>{Px(!!(n!=null&&n.isTextInput),o,s)&&e(tp())};return qa.add(r),()=>{qa.delete(r)}},t)}function Ax(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=x.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=Yd(s),c=x.useCallback(a=>{const u=bn(a.target),l=u?Wa(u):Wa();a.target===a.currentTarget&&l===qd(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function Tx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=x.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=Zd(),a=x.useCallback(d=>{d.currentTarget.contains(d.target)&&s.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(d),o&&o(!1))},[n,o,s,c]),u=Yd(a),l=x.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const f=bn(d.target),p=Wa(f);if(!s.current.isFocusWithin&&p===qd(d.nativeEvent)){r&&r(d),o&&o(!0),s.current.isFocusWithin=!0,u(d);let h=d.currentTarget;i(f,"focus",m=>{if(s.current.isFocusWithin&&!Gd(h,m.target)){let w=new f.defaultView.FocusEvent("blur",{relatedTarget:m.target});yx(w,h);let T=Kd(w);a(T)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let vs=!1,xs=0;function Xa(){vs=!0,setTimeout(()=>{vs=!1},50)}function np(e){e.pointerType==="touch"&&Xa()}function Cx(){if(!(typeof document>"u"))return xs===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",np):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Xa)),xs++,()=>{xs--,!(xs>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",np):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Xa))}}function Ox(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=x.useState(!1),c=x.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;x.useEffect(Cx,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=Zd(),{hoverProps:l,triggerHoverEnd:d}=x.useMemo(()=>{let f=(m,w)=>{if(c.pointerType=w,o||w==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let T=m.currentTarget;c.target=T,a(bn(m.target),"pointerover",y=>{c.isHovered&&c.target&&!Gd(c.target,y.target)&&p(y,y.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:T,pointerType:w}),n&&n(!0),i(!0)},p=(m,w)=>{let T=c.target;c.pointerType="",c.target=null,!(w==="touch"||!c.isHovered||!T)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:T,pointerType:w}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{vs&&m.pointerType==="mouse"||f(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&p(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!vs&&f(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&p(m,"mouse")}),{hoverProps:h,triggerHoverEnd:p}},[t,n,r,o,c,a,u]);return x.useEffect(()=>{o&&d({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function Nx(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=x.useRef({isFocused:!1,isFocusVisible:t||tp()}),[s,i]=x.useState(!1),[c,a]=x.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=x.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=x.useCallback(p=>{o.current.isFocused=p,i(p),u()},[u]);$x(p=>{o.current.isFocusVisible=p,u()},[],{isTextInput:n});let{focusProps:d}=Ax({isDisabled:r,onFocusChange:l}),{focusWithinProps:f}=Tx({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?f:d}}var Ix=Object.defineProperty,kx=(e,t,n)=>t in e?Ix(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qa=(e,t,n)=>(kx(e,typeof t!="symbol"?t+"":t,n),n);let Bx=class{constructor(){Qa(this,"current",this.detect()),Qa(this,"handoffState","pending"),Qa(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Mt=new Bx;function xo(e){var t,n;return Mt.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function rp(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Pt(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return rp(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Pt();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function yr(){let[e]=x.useState(Pt);return x.useEffect(()=>()=>e.dispose(),[e]),e}let ye=(e,t)=>{Mt.isServer?x.useEffect(e,t):x.useLayoutEffect(e,t)};function Un(e){let t=x.useRef(e);return ye(()=>{t.current=e},[e]),t}let ue=function(e){let t=Un(e);return x.useCallback((...n)=>t.current(...n),[t])};function Mx(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Lx(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Rx({disabled:e=!1}={}){let t=x.useRef(null),[n,r]=x.useState(!1),o=yr(),s=ue(()=>{t.current=null,r(!1),o.dispose()}),i=ue(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=xo(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Mx(u);r(Lx(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Dx=x.createContext(void 0);function Ja(){return x.useContext(Dx)}function ec(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function at(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,at),r}var Es=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Es||{}),yn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(yn||{});function Qe(){let e=jx();return x.useCallback(t=>Fx({mergeRefs:e,...t}),[e])}function Fx({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??_x;let a=op(t,e);if(s)return Ss(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...d}=a;if(l)return Ss(d,n,r,i,c)}if(u&1){let{unmount:l=!0,...d}=a;return at(l?0:1,{0(){return null},1(){return Ss({...d,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return Ss(a,n,r,i,c)}function Ss(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=tc(e,["unmount","static"]),u=e.ref!==void 0?{[c]:e.ref}:{},l=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let d={};if(t){let f=!1,p=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(f=!0),m===!0&&p.push(h.replace(/([A-Z])/g,w=>`-${w.toLowerCase()}`));if(f){d["data-headlessui-state"]=p.join(" ");for(let h of p)d[`data-${h}`]=""}}if(s===x.Fragment&&(Object.keys(wn(a)).length>0||Object.keys(wn(d)).length>0))if(!x.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(wn(a)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(wn(a)).concat(Object.keys(wn(d))).map(f=>` - ${f}`).join(`
56
103
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(f=>` - ${f}`).join(`
57
104
  `)].join(`
58
- `))}else{let f=a.props,p=f==null?void 0:f.className,m=typeof p=="function"?(...x)=>Sn(p(...x),i.className):Sn(p,i.className),g=m?{className:m}:{},b=Wr(a.props,Ke(On(i,["ref"])));for(let x in d)x in b&&delete d[x];return h.cloneElement(a,Object.assign({},b,d,l,{ref:o(hl(a),l.ref)},g))}return h.createElement(s,Object.assign({},On(i,["ref"]),s!==h.Fragment&&l,s!==h.Fragment&&d),a)}function dl(){let e=h.useRef([]),t=h.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 pl(...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 Wr(...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 c=n[r];for(let u of c){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(o,...s)}}});return t}function Br(...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 c of s)c==null||c(...o)}});return t}function xe(e){var t;return Object.assign(h.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Ke(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function On(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function hl(e){return h.version.split(".")[0]>="19"?e.props.ref:e.ref}function ml(e,t,n){let[r,o]=h.useState(n),s=e!==void 0,c=h.useRef(s),u=h.useRef(!1),i=h.useRef(!1);return s&&!c.current&&!u.current?(u.current=!0,c.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&&c.current&&!i.current&&(i.current=!0,c.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,ne(l=>(s||o(l),t==null?void 0:t(l)))]}function vl(e){let[t]=h.useState(e);return t}function Hr(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Vr(n,Ur(t,r),o);return n}function Ur(e,t){return e?e+"["+t+"]":t}function Vr(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Vr(e,Ur(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,""]):Hr(n,t,e)}function gl(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 bl="span";var Tn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Tn||{});function yl(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 Se()({ourProps:s,theirProps:o,slot:{},defaultTag:bl,name:"Hidden"})}let zr=xe(yl),El=h.createContext(null);function wl({children:e}){let t=h.useContext(El);if(!t)return h.createElement(h.Fragment,null,e);let{target:n}=t;return n?we.createPortal(h.createElement(h.Fragment,null,e),n):null}function xl({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,c]=h.useState(null),u=at();return h.useEffect(()=>{if(r&&s)return u.addEventListener(s,"reset",r)},[s,t,r]),h.createElement(wl,null,h.createElement(Cl,{setForm:c,formId:t}),Hr(e).map(([i,l])=>h.createElement(zr,{features:Tn.Hidden,...Ke({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function Cl({setForm:e,formId:t}){return h.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:h.createElement(zr,{features:Tn.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Sl=h.createContext(void 0);function Yr(){return h.useContext(Sl)}function $n(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ht(e){return $n(e)&&"tagName"in e}function Ve(e){return Ht(e)&&"accessKey"in e}function ut(e){return Ht(e)&&"tabIndex"in e}function Ol(e){return Ht(e)&&"style"in e}function Tl(e){return Ve(e)&&e.nodeName==="IFRAME"}function Gr(e){return Ve(e)&&e.nodeName==="INPUT"}function qr(e){return Ve(e)&&e.nodeName==="LABEL"}function $l(e){return Ve(e)&&e.nodeName==="FIELDSET"}function Kr(e){return Ve(e)&&e.nodeName==="LEGEND"}function Pl(e){return Ht(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Al(e){let t=e.parentElement,n=null;for(;t&&!$l(t);)Kr(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Ml(n)?!1:r}function Ml(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Kr(t))return!1;t=t.previousElementSibling}return!0}let Qr=Symbol();function _l(e,t=!0){return Object.assign(e,{[Qr]:t})}function Pe(...e){let t=h.useRef(e);h.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[Qr]))?void 0:n}let Pn=h.createContext(null);Pn.displayName="DescriptionContext";function Xr(){let e=h.useContext(Pn);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,Xr),t}return e}function Ll(){var e,t;return(t=(e=h.useContext(Pn))==null?void 0:e.value)!=null?t:void 0}let Dl="p";function Fl(e,t){let n=h.useId(),r=Cn(),{id:o=`headlessui-description-${n}`,...s}=e,c=Xr(),u=Pe(t);ue(()=>c.register(o),[o,c.register]);let i=r||!1,l=h.useMemo(()=>({...c.slot,disabled:i}),[c.slot,i]),a={ref:u,...c.props,id:o};return Se()({ourProps:a,theirProps:s,slot:l,defaultTag:Dl,name:c.name||"Description"})}let Il=xe(Fl);Object.assign(Il,{});var me=(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))(me||{});let Ut=h.createContext(null);Ut.displayName="LabelContext";function Jr(){let e=h.useContext(Ut);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,Jr),t}return e}function Zr(e){var t,n,r;let o=(n=(t=h.useContext(Ut))==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 kl({inherit:e=!1}={}){let t=Zr(),[n,r]=h.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,h.useMemo(()=>function(s){let c=ne(i=>(r(l=>[...l,i]),()=>r(l=>{let a=l.slice(),d=a.indexOf(i);return d!==-1&&a.splice(d,1),a}))),u=h.useMemo(()=>({register:c,slot:s.slot,name:s.name,props:s.props,value:s.value}),[c,s.slot,s.name,s.props,s.value]);return h.createElement(Ut.Provider,{value:u},s.children)},[r])]}let Nl="label";function jl(e,t){var n;let r=h.useId(),o=Jr(),s=Yr(),c=Cn(),{id:u=`headlessui-label-${r}`,htmlFor:i=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...a}=e,d=Pe(t);ue(()=>o.register(u),[u,o.register]);let f=ne(b=>{let x=b.currentTarget;if(!(b.target!==b.currentTarget&&Pl(b.target))&&(qr(x)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),qr(x))){let w=document.getElementById(x.htmlFor);if(w){let y=w.getAttribute("disabled");if(y==="true"||y==="")return;let S=w.getAttribute("aria-disabled");if(S==="true"||S==="")return;(Gr(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})}}}),p=c||!1,m=h.useMemo(()=>({...o.slot,disabled:p}),[o.slot,p]),g={ref:d,...o.props,id:u,htmlFor:i,onClick:f};return l&&("onClick"in g&&(delete g.htmlFor,delete g.onClick),"onClick"in a&&delete a.onClick),Se()({ourProps:g,theirProps:a,slot:m,defaultTag:i?Nl:"div",name:o.name||"Label"})}let Rl=xe(jl),Wl=Object.assign(Rl,{});function Bl(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 Hl(e=Bl){return h.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 Ul(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Vl(e,t=!1){let[n,r]=h.useReducer(()=>({}),{}),o=h.useMemo(()=>Ul(e),[e,n]);return ue(()=>{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 eo=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 zl=Object.defineProperty,Yl=(e,t,n)=>t in e?zl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gl=(e,t,n)=>(Yl(e,t+"",n),n),to=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ae=(e,t,n)=>(to(e,t,"read from private field"),n?n.call(e):t.get(e)),An=(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)},no=(e,t,n,r)=>(to(e,t,"write to private field"),t.set(e,n),n),Ne,Ot,Tt;let ro=class{constructor(t){An(this,Ne,{}),An(this,Ot,new eo(()=>new Set)),An(this,Tt,new Set),Gl(this,"disposables",De()),no(this,Ne,t),ke.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Ae(this,Ne)}subscribe(t,n){if(ke.isServer)return()=>{};let r={selector:t,callback:n,current:t(Ae(this,Ne))};return Ae(this,Tt).add(r),this.disposables.add(()=>{Ae(this,Tt).delete(r)})}on(t,n){return ke.isServer?()=>{}:(Ae(this,Ot).get(t).add(n),this.disposables.add(()=>{Ae(this,Ot).get(t).delete(n)}))}send(t){let n=this.reduce(Ae(this,Ne),t);if(n!==Ae(this,Ne)){no(this,Ne,n);for(let r of Ae(this,Tt)){let o=r.selector(Ae(this,Ne));oo(r.current,o)||(r.current=o,r.callback(o))}for(let r of Ae(this,Ot).get(t.type))r(Ae(this,Ne),t)}}};Ne=new WeakMap,Ot=new WeakMap,Tt=new WeakMap;function oo(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:Mn(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Mn(e.entries(),t.entries()):io(e)&&io(t)?Mn(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Mn(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 io(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function _n(e){let[t,n]=e(),r=De();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var ql=Object.defineProperty,Kl=(e,t,n)=>t in e?ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,so=(e,t,n)=>(Kl(e,typeof t!="symbol"?t+"":t,n),n),lo=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(lo||{});let Ql={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}}},Xl=class vs extends ro{constructor(){super(...arguments),so(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),so(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new vs({stack:[]})}reduce(t,n){return $e(n.type,Ql,t,n)}};const Ln=new eo(()=>Xl.new());var Dn={exports:{}},Fn={};/**
105
+ `))}else{let f=l.props,p=f==null?void 0:f.className,h=typeof p=="function"?(...T)=>ec(p(...T),a.className):ec(p,a.className),m=h?{className:h}:{},w=op(l.props,wn(tc(a,["ref"])));for(let T in d)T in w&&delete d[T];return x.cloneElement(l,Object.assign({},w,d,u,{ref:o(Ux(l),u.ref)},m))}return x.createElement(s,Object.assign({},tc(a,["ref"]),s!==x.Fragment&&u,s!==x.Fragment&&d),l)}function jx(){let e=x.useRef([]),t=x.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function _x(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function op(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let i=n[r];for(let c of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;c(o,...s)}}});return t}function sp(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let i of s)i==null||i(...o)}});return t}function We(e){var t;return Object.assign(x.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function wn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function tc(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Ux(e){return x.version.split(".")[0]>="19"?e.props.ref:e.ref}function zx(e,t,n){let[r,o]=x.useState(n),s=e!==void 0,i=x.useRef(s),c=x.useRef(!1),a=x.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,ue(u=>(s||o(u),t==null?void 0:t(u)))]}function Hx(e){let[t]=x.useState(e);return t}function ip(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))cp(n,ap(t,r),o);return n}function ap(e,t){return e?e+"["+t+"]":t}function cp(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())cp(e,ap(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):ip(n,t,e)}function Wx(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let Vx="span";var nc=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(nc||{});function Gx(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Qe()({ourProps:s,theirProps:o,slot:{},defaultTag:Vx,name:"Hidden"})}let up=We(Gx),qx=x.createContext(null);function Zx({children:e}){let t=x.useContext(qx);if(!t)return x.createElement(x.Fragment,null,e);let{target:n}=t;return n?Le.createPortal(x.createElement(x.Fragment,null,e),n):null}function Kx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=x.useState(null),c=yr();return x.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),x.createElement(Zx,null,x.createElement(Yx,{setForm:i,formId:t}),ip(e).map(([a,u])=>x.createElement(up,{features:nc.Hidden,...wn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function Yx({setForm:e,formId:t}){return x.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:x.createElement(up,{features:nc.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Xx=x.createContext(void 0);function lp(){return x.useContext(Xx)}function rc(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ps(e){return rc(e)&&"tagName"in e}function on(e){return Ps(e)&&"accessKey"in e}function wr(e){return Ps(e)&&"tabIndex"in e}function Qx(e){return Ps(e)&&"style"in e}function Jx(e){return on(e)&&e.nodeName==="IFRAME"}function fp(e){return on(e)&&e.nodeName==="INPUT"}function dp(e){return on(e)&&e.nodeName==="LABEL"}function eE(e){return on(e)&&e.nodeName==="FIELDSET"}function pp(e){return on(e)&&e.nodeName==="LEGEND"}function tE(e){return Ps(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function nE(e){let t=e.parentElement,n=null;for(;t&&!eE(t);)pp(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&rE(n)?!1:r}function rE(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(pp(t))return!1;t=t.previousElementSibling}return!0}let hp=Symbol();function oE(e,t=!0){return Object.assign(e,{[hp]:t})}function ct(...e){let t=x.useRef(e);x.useEffect(()=>{t.current=e},[e]);let n=ue(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[hp]))?void 0:n}let oc=x.createContext(null);oc.displayName="DescriptionContext";function mp(){let e=x.useContext(oc);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,mp),t}return e}function sE(){var e,t;return(t=(e=x.useContext(oc))==null?void 0:e.value)!=null?t:void 0}let iE="p";function aE(e,t){let n=x.useId(),r=Ja(),{id:o=`headlessui-description-${n}`,...s}=e,i=mp(),c=ct(t);ye(()=>i.register(o),[o,i.register]);let a=r||!1,u=x.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),l={ref:c,...i.props,id:o};return Qe()({ourProps:l,theirProps:s,slot:u,defaultTag:iE,name:i.name||"Description"})}let cE=We(aE);Object.assign(cE,{});var Ne=(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))(Ne||{});let $s=x.createContext(null);$s.displayName="LabelContext";function gp(){let e=x.useContext($s);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,gp),t}return e}function bp(e){var t,n,r;let o=(n=(t=x.useContext($s))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function uE({inherit:e=!1}={}){let t=bp(),[n,r]=x.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,x.useMemo(()=>function(s){let i=ue(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),d=l.indexOf(a);return d!==-1&&l.splice(d,1),l}))),c=x.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return x.createElement($s.Provider,{value:c},s.children)},[r])]}let lE="label";function fE(e,t){var n;let r=x.useId(),o=gp(),s=lp(),i=Ja(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,d=ct(t);ye(()=>o.register(c),[c,o.register]);let f=ue(w=>{let T=w.currentTarget;if(!(w.target!==w.currentTarget&&tE(w.target))&&(dp(T)&&w.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(w),dp(T))){let y=document.getElementById(T.htmlFor);if(y){let A=y.getAttribute("disabled");if(A==="true"||A==="")return;let M=y.getAttribute("aria-disabled");if(M==="true"||M==="")return;(fp(y)&&(y.type==="file"||y.type==="radio"||y.type==="checkbox")||y.role==="radio"||y.role==="checkbox"||y.role==="switch")&&y.click(),y.focus({preventScroll:!0})}}}),p=i||!1,h=x.useMemo(()=>({...o.slot,disabled:p}),[o.slot,p]),m={ref:d,...o.props,id:c,htmlFor:a,onClick:f};return u&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in l&&delete l.onClick),Qe()({ourProps:m,theirProps:l,slot:h,defaultTag:a?lE:"div",name:o.name||"Label"})}let dE=We(fE),pE=Object.assign(dE,{});function hE(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function mE(e=hE){return x.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function gE(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function bE(e,t=!1){let[n,r]=x.useReducer(()=>({}),{}),o=x.useMemo(()=>gE(e),[e,n]);return ye(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let yp=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var yE=Object.defineProperty,wE=(e,t,n)=>t in e?yE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vE=(e,t,n)=>(wE(e,t+"",n),n),wp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ut=(e,t,n)=>(wp(e,t,"read from private field"),n?n.call(e):t.get(e)),sc=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},vp=(e,t,n,r)=>(wp(e,t,"write to private field"),t.set(e,n),n),Lt,Eo,So;let xp=class{constructor(t){sc(this,Lt,{}),sc(this,Eo,new yp(()=>new Set)),sc(this,So,new Set),vE(this,"disposables",Pt()),vp(this,Lt,t),Mt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return ut(this,Lt)}subscribe(t,n){if(Mt.isServer)return()=>{};let r={selector:t,callback:n,current:t(ut(this,Lt))};return ut(this,So).add(r),this.disposables.add(()=>{ut(this,So).delete(r)})}on(t,n){return Mt.isServer?()=>{}:(ut(this,Eo).get(t).add(n),this.disposables.add(()=>{ut(this,Eo).get(t).delete(n)}))}send(t){let n=this.reduce(ut(this,Lt),t);if(n!==ut(this,Lt)){vp(this,Lt,n);for(let r of ut(this,So)){let o=r.selector(ut(this,Lt));Ep(r.current,o)||(r.current=o,r.callback(o))}for(let r of ut(this,Eo).get(t.type))r(ut(this,Lt),t)}}};Lt=new WeakMap,Eo=new WeakMap,So=new WeakMap;function Ep(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:ic(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:ic(e.entries(),t.entries()):Sp(e)&&Sp(t)?ic(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function ic(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function Sp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function ac(e){let[t,n]=e(),r=Pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var xE=Object.defineProperty,EE=(e,t,n)=>t in e?xE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pp=(e,t,n)=>(EE(e,typeof t!="symbol"?t+"":t,n),n),$p=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))($p||{});let SE={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let s=e.stack.slice();return s.splice(o,1),s.push(n),r=s,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},PE=class sm extends xp{constructor(){super(...arguments),Pp(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Pp(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new sm({stack:[]})}reduce(t,n){return at(n.type,SE,t,n)}};const cc=new yp(()=>PE.new());var uc={exports:{}},lc={};/**
59
106
  * @license React
60
107
  * use-sync-external-store-with-selector.production.js
61
108
  *
@@ -63,7 +110,7 @@ React keys must be passed directly to JSX without using spread:
63
110
  *
64
111
  * This source code is licensed under the MIT license found in the
65
112
  * LICENSE file in the root directory of this source tree.
66
- */var ao;function Jl(){if(ao)return Fn;ao=1;var e=h;function t(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,c=e.useMemo,u=e.useDebugValue;return Fn.useSyncExternalStoreWithSelector=function(i,l,a,d,f){var p=o(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=c(function(){function b(E){if(!x){if(x=!0,w=E,E=d(E),f!==void 0&&m.hasValue){var F=m.value;if(f(F,E))return y=F}return y=E}if(F=y,n(w,E))return F;var j=d(E);return f!==void 0&&f(F,j)?(w=E,F):(w=E,y=j)}var x=!1,w,y,S=a===void 0?null:a;return[function(){return b(l())},S===null?void 0:function(){return b(S())}]},[l,a,d,f]);var g=r(i,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=g},[g]),u(g),g},Fn}var In={};/**
113
+ */var Ap;function $E(){if(Ap)return lc;Ap=1;var e=x;function t(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;return lc.useSyncExternalStoreWithSelector=function(a,u,l,d,f){var p=o(null);if(p.current===null){var h={hasValue:!1,value:null};p.current=h}else h=p.current;p=i(function(){function w(L){if(!T){if(T=!0,y=L,L=d(L),f!==void 0&&h.hasValue){var F=h.value;if(f(F,L))return A=F}return A=L}if(F=A,n(y,L))return F;var j=d(L);return f!==void 0&&f(F,j)?(y=L,F):(y=L,A=j)}var T=!1,y,A,M=l===void 0?null:l;return[function(){return w(u())},M===null?void 0:function(){return w(M())}]},[u,l,d,f]);var m=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},lc}var fc={};/**
67
114
  * @license React
68
115
  * use-sync-external-store-with-selector.development.js
69
116
  *
@@ -71,53 +118,35 @@ React keys must be passed directly to JSX without using spread:
71
118
  *
72
119
  * This source code is licensed under the MIT license found in the
73
120
  * LICENSE file in the root directory of this source tree.
74
- */var uo;function Zl(){return uo||(uo=1,process.env.NODE_ENV!=="production"&&function(){function e(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,u=t.useDebugValue;In.useSyncExternalStoreWithSelector=function(i,l,a,d,f){var p=o(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=c(function(){function b(E){if(!x){if(x=!0,w=E,E=d(E),f!==void 0&&m.hasValue){var F=m.value;if(f(F,E))return y=F}return y=E}if(F=y,n(w,E))return F;var j=d(E);return f!==void 0&&f(F,j)?(w=E,F):(w=E,y=j)}var x=!1,w,y,S=a===void 0?null:a;return[function(){return b(l())},S===null?void 0:function(){return b(S())}]},[l,a,d,f]);var g=r(i,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=g},[g]),u(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),In}process.env.NODE_ENV==="production"?Dn.exports=Jl():Dn.exports=Zl();var ea=Dn.exports;function Me(e,t,n=oo){return ea.useSyncExternalStoreWithSelector(ne(r=>e.subscribe(ta,r)),ne(()=>e.state),ne(()=>e.state),ne(t),n)}function ta(e){return e}function co(e,t){let n=h.useId(),r=Ln.get(t),[o,s]=Me(r,h.useCallback(c=>[r.selectors.isTop(c,n),r.selectors.inStack(c,n)],[r,n]));return ue(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let kn=new Map,$t=new Map;function fo(e){var t;let n=(t=$t.get(e))!=null?t:0;return $t.set(e,n+1),n!==0?()=>po(e):(kn.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>po(e))}function po(e){var t;let n=(t=$t.get(e))!=null?t:1;if(n===1?$t.delete(e):$t.set(e,n-1),n!==1)return;let r=kn.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,kn.delete(e))}function na(e,{allowed:t,disallowed:n}={}){let r=co(e,"inert-others");ue(()=>{var o,s;if(!r)return;let c=De();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&c.add(fo(i));let u=(s=t==null?void 0:t())!=null?s:[];for(let i of u){if(!i)continue;let l=St(i);if(!l)continue;let a=i.parentElement;for(;a&&a!==l.body;){for(let d of a.children)u.some(f=>d.contains(f))||c.add(fo(d));a=a.parentElement}}return c.dispose},[r,t,n])}function ra(e,t,n){let r=tt(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});h.useEffect(()=>{if(!e)return;let o=t===null?null:Ve(t)?t:t.current;if(!o)return;let s=De();if(typeof ResizeObserver<"u"){let c=new ResizeObserver(()=>r.current(o));c.observe(o),s.add(()=>c.disconnect())}if(typeof IntersectionObserver<"u"){let c=new IntersectionObserver(()=>r.current(o));c.observe(o),s.add(()=>c.disconnect())}return()=>s.dispose()},[t,r,e])}let Nn=["[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(","),oa=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var jn=(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))(jn||{}),ia=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(ia||{}),sa=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(sa||{});function ho(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Nn)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function la(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(oa)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Rn=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Rn||{});function mo(e,t=0){var n;return e===((n=St(e))==null?void 0:n.body)?!1:$e(t,{0(){return e.matches(Nn)},1(){let r=e;for(;r!==null;){if(r.matches(Nn))return!0;r=r.parentElement}return!1}})}var aa=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(aa||{});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 ua=["textarea","input"].join(",");function ca(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,ua))!=null?n:!1}function vo(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 c=o.compareDocumentPosition(s);return c&Node.DOCUMENT_POSITION_FOLLOWING?-1:c&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function fa(e,t){return da(ho(),t,{relativeTo:e})}function da(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,c=Array.isArray(e)?n?vo(e):e:t&64?la(e):ho(e);o.length>0&&c.length>1&&(c=c.filter(p=>!o.some(m=>m!=null&&"current"in m?(m==null?void 0:m.current)===p:m===p))),r=r??s.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")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,c.indexOf(r))-1;if(t&4)return Math.max(0,c.indexOf(r))+1;if(t&8)return c.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},a=0,d=c.length,f;do{if(a>=d||a+d<=0)return 0;let p=i+a;if(t&16)p=(p+d)%d;else{if(p<0)return 3;if(p>=d)return 1}f=c[p],f==null||f.focus(l),a+=u}while(f!==s.activeElement);return t&6&&ca(f)&&f.select(),2}function go(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function pa(){return/Android/gi.test(window.navigator.userAgent)}function bo(){return go()||pa()}function ct(e,t,n,r){let o=tt(n);h.useEffect(()=>{if(!e)return;function s(c){o.current(c)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function ha(e,t,n,r){let o=tt(n);h.useEffect(()=>{if(!e)return;function s(c){o.current(c)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const yo=30;function ma(e,t,n){let r=tt(n),o=h.useCallback(function(u,i){if(u.defaultPrevented)return;let l=i(u);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let a=function d(f){return typeof f=="function"?d(f()):Array.isArray(f)||f instanceof Set?f:[f]}(t);for(let d of a)if(d!==null&&(d.contains(l)||u.composed&&u.composedPath().includes(d)))return;return!mo(l,Rn.Loose)&&l.tabIndex!==-1&&u.preventDefault(),r.current(u,l)},[r,t]),s=h.useRef(null);ct(e,"pointerdown",u=>{var i,l;bo()||(s.current=((l=(i=u.composedPath)==null?void 0:i.call(u))==null?void 0:l[0])||u.target)},!0),ct(e,"pointerup",u=>{if(bo()||!s.current)return;let i=s.current;return s.current=null,o(u,()=>i)},!0);let c=h.useRef({x:0,y:0});ct(e,"touchstart",u=>{c.current.x=u.touches[0].clientX,c.current.y=u.touches[0].clientY},!0),ct(e,"touchend",u=>{let i={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(i.x-c.current.x)>=yo||Math.abs(i.y-c.current.y)>=yo))return o(u,()=>ut(u.target)?u.target:null)},!0),ha(e,"blur",u=>o(u,()=>Tl(window.document.activeElement)?window.document.activeElement:null),!0)}function Wn(...e){return h.useMemo(()=>St(...e),[...e])}var va=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(va||{});const Vt={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},ga=200,Eo=5;function ba(e,{trigger:t,action:n,close:r,select:o}){let s=h.useRef(null),c=h.useRef(null),u=h.useRef(null);ct(e&&t!==null,"pointerdown",i=>{$n(i==null?void 0:i.target)&&t!=null&&t.contains(i.target)&&(c.current=i.x,u.current=i.y,s.current=i.timeStamp)}),ct(e&&t!==null,"pointerup",i=>{var l,a;let d=s.current;if(d===null||(s.current=null,!ut(i.target))||Math.abs(i.x-((l=c.current)!=null?l:i.x))<Eo&&Math.abs(i.y-((a=u.current)!=null?a:i.y))<Eo)return;let f=n(i);switch(f.kind){case 0:return;case 1:{i.timeStamp-d>ga&&(o(f.target),r());break}case 2:{r();break}}},{capture:!0})}function ya(e,t){return h.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 Ea(e){return h.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function wa(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 c=t[o].call(n,...s);c&&(n=c,r.forEach(u=>u()))}}}function xa(){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 Ca(){return go()?{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 u=De();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,c=null;t.addEventListener(e,"click",u=>{if(ut(u.target))try{let i=u.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),a=e.querySelector(l);ut(a)&&!r(a)&&(c=a)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(ut(u.target)&&Ol(u.target))if(r(u.target)){let i=u.target;for(;i.parentElement&&r(i.parentElement);)i=i.parentElement;t.style(i,"overscrollBehavior","contain")}else t.style(u.target,"touchAction","none")}),t.addEventListener(e,"touchmove",u=>{if(ut(u.target)){if(Gr(u.target))return;if(r(u.target)){let i=u.target;for(;i.parentElement&&i.dataset.headlessuiPortal!==""&&!(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth);)i=i.parentElement;i.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),t.add(()=>{var u;let i=(u=window.scrollY)!=null?u:window.pageYOffset;s!==i&&window.scrollTo(0,s),c&&c.isConnected&&(c.scrollIntoView({block:"nearest"}),c=null)})})}}:{}}function Sa(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Oa(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let nt=wa(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:De(),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:Oa(n)},o=[Ca(),xa(),Sa()];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)}});nt.subscribe(()=>{let e=nt.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)&&nt.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&nt.dispatch("TEARDOWN",n)}});function Ta(e,t,n=()=>({containers:[]})){let r=Ea(nt),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ue(()=>{if(!(!t||!e))return nt.dispatch("PUSH",t,n),()=>nt.dispatch("POP",t,n)},[e,t]),s}function $a(e,t,n=()=>[document.body]){let r=co(e,"scroll-lock");Ta(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function wo(e){return[e.screenX,e.screenY]}function Pa(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=wo(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=wo(t)}}}function Aa(e=0){let[t,n]=h.useState(e),r=h.useCallback(i=>n(i),[t]),o=h.useCallback(i=>n(l=>l|i),[t]),s=h.useCallback(i=>(t&i)===i,[t]),c=h.useCallback(i=>n(l=>l&~i),[n]),u=h.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:c,toggleFlag:u}}var xo,Co;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((xo=process==null?void 0:process.env)==null?void 0:xo.NODE_ENV)==="test"&&typeof((Co=Element==null?void 0:Element.prototype)==null?void 0:Co.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(`
75
- `)),[]});var Ma=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Ma||{});function So(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Oo(e,t,n,r){let[o,s]=h.useState(n),{hasFlag:c,addFlag:u,removeFlag:i}=Aa(e&&o?3:0),l=h.useRef(!1),a=h.useRef(!1),d=at();return ue(()=>{var f;if(e){if(n&&s(!0),!t){n&&u(3);return}return(f=r==null?void 0:r.start)==null||f.call(r,n),_a(t,{inFlight:l,prepare(){a.current?a.current=!1:a.current=l.current,l.current=!0,!a.current&&(n?(u(3),i(4)):(u(4),i(2)))},run(){a.current?n?(i(3),u(4)):(i(4),u(3)):n?i(1):u(1)},done(){var p;a.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,i(7),n||s(!1),(p=r==null?void 0:r.end)==null||p.call(r,n))}})}},[e,n,t,d]),e?[o,{closed:c(1),enter:c(2),leave:c(4),transition:c(2)||c(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function _a(e,{prepare:t,run:n,done:r,inFlight:o}){let s=De();return Da(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(La(e,r))})}),s.dispose}function La(e,t){var n,r;let o=De();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let c=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(u=>u instanceof CSSTransition))!=null?r:[];return c.length===0?(t(),o.dispose):(Promise.allSettled(c.map(u=>u.finished)).then(()=>{s||t()}),o.dispose)}function Da(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 zt(){return typeof window<"u"}function ft(e){return To(e)?(e.nodeName||"").toLowerCase():"#document"}function Oe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function je(e){var t;return(t=(To(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function To(e){return zt()?e instanceof Node||e instanceof Oe(e).Node:!1}function ge(e){return zt()?e instanceof Element||e instanceof Oe(e).Element:!1}function Re(e){return zt()?e instanceof HTMLElement||e instanceof Oe(e).HTMLElement:!1}function $o(e){return!zt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Oe(e).ShadowRoot}const Fa=new Set(["inline","contents"]);function Pt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Fe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Fa.has(o)}const Ia=new Set(["table","td","th"]);function ka(e){return Ia.has(ft(e))}const Na=[":popover-open",":modal"];function Yt(e){return Na.some(t=>{try{return e.matches(t)}catch{return!1}})}const ja=["transform","translate","scale","rotate","perspective"],Ra=["transform","translate","scale","rotate","perspective","filter"],Wa=["paint","layout","strict","content"];function Bn(e){const t=Hn(),n=ge(e)?Fe(e):e;return ja.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)||Ra.some(r=>(n.willChange||"").includes(r))||Wa.some(r=>(n.contain||"").includes(r))}function Ba(e){let t=Qe(e);for(;Re(t)&&!dt(t);){if(Bn(t))return t;if(Yt(t))return null;t=Qe(t)}return null}function Hn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ha=new Set(["html","body","#document"]);function dt(e){return Ha.has(ft(e))}function Fe(e){return Oe(e).getComputedStyle(e)}function Gt(e){return ge(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qe(e){if(ft(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$o(e)&&e.host||je(e);return $o(t)?t.host:t}function Po(e){const t=Qe(e);return dt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Re(t)&&Pt(t)?t:Po(t)}function At(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Po(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=Oe(o);if(s){const u=Un(c);return t.concat(c,c.visualViewport||[],Pt(o)?o:[],u&&n?At(u):[])}return t.concat(o,At(o,[],n))}function Un(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ua(){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 rt=Math.min,be=Math.max,Mt=Math.round,qt=Math.floor,We=e=>({x:e,y:e}),Va={left:"right",right:"left",bottom:"top",top:"bottom"},za={start:"end",end:"start"};function Ao(e,t,n){return be(e,rt(t,n))}function pt(e,t){return typeof e=="function"?e(t):e}function Xe(e){return e.split("-")[0]}function _t(e){return e.split("-")[1]}function Mo(e){return e==="x"?"y":"x"}function _o(e){return e==="y"?"height":"width"}const Ya=new Set(["top","bottom"]);function ze(e){return Ya.has(Xe(e))?"y":"x"}function Lo(e){return Mo(ze(e))}function Ga(e,t,n){n===void 0&&(n=!1);const r=_t(e),o=Lo(e),s=_o(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=Kt(c)),[c,Kt(c)]}function qa(e){const t=Kt(e);return[Vn(e),t,Vn(t)]}function Vn(e){return e.replace(/start|end/g,t=>za[t])}const Do=["left","right"],Fo=["right","left"],Ka=["top","bottom"],Qa=["bottom","top"];function Xa(e,t,n){switch(e){case"top":case"bottom":return n?t?Fo:Do:t?Do:Fo;case"left":case"right":return t?Ka:Qa;default:return[]}}function Ja(e,t,n,r){const o=_t(e);let s=Xa(Xe(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(Vn)))),s}function Kt(e){return e.replace(/left|right|bottom|top/g,t=>Va[t])}function Za(e){return{top:0,right:0,bottom:0,left:0,...e}}function eu(e){return typeof e!="number"?Za(e):{top:e,right:e,bottom:e,left:e}}function Qt(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}}function Io(e,t,n){let{reference:r,floating:o}=e;const s=ze(t),c=Lo(t),u=_o(c),i=Xe(t),l=s==="y",a=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[u]/2-o[u]/2;let p;switch(i){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(_t(t)){case"start":p[c]-=f*(n&&l?-1:1);break;case"end":p[c]+=f*(n&&l?-1:1);break}return p}const tu=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:c}=n,u=s.filter(Boolean),i=await(c.isRTL==null?void 0:c.isRTL(t));let l=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:d}=Io(l,r,i),f=r,p={},m=0;for(let g=0;g<u.length;g++){const{name:b,fn:x}=u[g],{x:w,y,data:S,reset:E}=await x({x:a,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:l,platform:c,elements:{reference:e,floating:t}});a=w??a,d=y??d,p={...p,[b]:{...p[b],...S}},E&&m<=50&&(m++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(l=E.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:a,y:d}=Io(l,f,i)),g=-1)}return{x:a,y:d,placement:f,strategy:o,middlewareData:p}};async function Xt(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:c,elements:u,strategy:i}=e,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=pt(t,e),m=eu(p),b=u[f?d==="floating"?"reference":"floating":d],x=Qt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(u.floating)),boundary:l,rootBoundary:a,strategy:i})),w=d==="floating"?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u.floating)),S=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},E=Qt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:w,offsetParent:y,strategy:i}):w);return{top:(x.top-E.top+m.top)/S.y,bottom:(E.bottom-x.bottom+m.bottom)/S.y,left:(x.left-E.left+m.left)/S.x,right:(E.right-x.right+m.right)/S.x}}const nu=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:c,initialPlacement:u,platform:i,elements:l}=t,{mainAxis:a=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...b}=pt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=Xe(o),w=ze(u),y=Xe(u)===u,S=await(i.isRTL==null?void 0:i.isRTL(l.floating)),E=f||(y||!g?[Kt(u)]:qa(u)),F=m!=="none";!f&&F&&E.push(...Ja(u,g,m,S));const j=[u,...E],K=await Xt(t,b),ee=[];let L=((r=s.flip)==null?void 0:r.overflows)||[];if(a&&ee.push(K[x]),d){const W=Ga(o,c,S);ee.push(K[W[0]],K[W[1]])}if(L=[...L,{placement:o,overflows:ee}],!ee.every(W=>W<=0)){var N,oe;const W=(((N=s.flip)==null?void 0:N.index)||0)+1,X=j[W];if(X&&(!(d==="alignment"?w!==ze(X):!1)||L.every(P=>ze(P.placement)===w?P.overflows[0]>0:!0)))return{data:{index:W,overflows:L},reset:{placement:X}};let G=(oe=L.filter(J=>J.overflows[0]<=0).sort((J,P)=>J.overflows[1]-P.overflows[1])[0])==null?void 0:oe.placement;if(!G)switch(p){case"bestFit":{var H;const J=(H=L.filter(P=>{if(F){const U=ze(P.placement);return U===w||U==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(U=>U>0).reduce((U,C)=>U+C,0)]).sort((P,U)=>P[1]-U[1])[0])==null?void 0:H[0];J&&(G=J);break}case"initialPlacement":G=u;break}if(o!==G)return{reset:{placement:G}}}return{}}}},ru=new Set(["left","top"]);async function ou(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=Xe(n),u=_t(n),i=ze(n)==="y",l=ru.has(c)?-1:1,a=s&&i?-1:1,d=pt(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return u&&typeof m=="number"&&(p=u==="end"?m*-1:m),i?{x:p*a,y:f*l}:{x:f*l,y:p*a}}const iu=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:c,middlewareData:u}=t,i=await ou(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:o+i.x,y:s+i.y,data:{...i,placement:c}}}}},su=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:c=!1,limiter:u={fn:b=>{let{x,y:w}=b;return{x,y:w}}},...i}=pt(e,t),l={x:n,y:r},a=await Xt(t,i),d=ze(Xe(o)),f=Mo(d);let p=l[f],m=l[d];if(s){const b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",w=p+a[b],y=p-a[x];p=Ao(w,p,y)}if(c){const b=d==="y"?"top":"left",x=d==="y"?"bottom":"right",w=m+a[b],y=m-a[x];m=Ao(w,m,y)}const g=u.fn({...t,[f]:p,[d]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[f]:s,[d]:c}}}}}},lu=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:c,elements:u}=t,{apply:i=()=>{},...l}=pt(e,t),a=await Xt(t,l),d=Xe(o),f=_t(o),p=ze(o)==="y",{width:m,height:g}=s.floating;let b,x;d==="top"||d==="bottom"?(b=d,x=f===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(x=d,b=f==="end"?"top":"bottom");const w=g-a.top-a.bottom,y=m-a.left-a.right,S=rt(g-a[b],w),E=rt(m-a[x],y),F=!t.middlewareData.shift;let j=S,K=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(K=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=w),F&&!f){const L=be(a.left,0),N=be(a.right,0),oe=be(a.top,0),H=be(a.bottom,0);p?K=m-2*(L!==0||N!==0?L+N:be(a.left,a.right)):j=g-2*(oe!==0||H!==0?oe+H:be(a.top,a.bottom))}await i({...t,availableWidth:K,availableHeight:j});const ee=await c.getDimensions(u.floating);return m!==ee.width||g!==ee.height?{reset:{rects:!0}}:{}}}};function ko(e){const t=Fe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Re(e),s=o?e.offsetWidth:n,c=o?e.offsetHeight:r,u=Mt(n)!==s||Mt(r)!==c;return u&&(n=s,r=c),{width:n,height:r,$:u}}function zn(e){return ge(e)?e:e.contextElement}function ht(e){const t=zn(e);if(!Re(t))return We(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=ko(t);let c=(s?Mt(n.width):n.width)/r,u=(s?Mt(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const au=We(0);function No(e){const t=Oe(e);return!Hn()||!t.visualViewport?au:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function uu(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Oe(e)?!1:t}function ot(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=zn(e);let c=We(1);t&&(r?ge(r)&&(c=ht(r)):c=ht(e));const u=uu(s,n,r)?No(s):We(0);let i=(o.left+u.x)/c.x,l=(o.top+u.y)/c.y,a=o.width/c.x,d=o.height/c.y;if(s){const f=Oe(s),p=r&&ge(r)?Oe(r):r;let m=f,g=Un(m);for(;g&&r&&p!==m;){const b=ht(g),x=g.getBoundingClientRect(),w=Fe(g),y=x.left+(g.clientLeft+parseFloat(w.paddingLeft))*b.x,S=x.top+(g.clientTop+parseFloat(w.paddingTop))*b.y;i*=b.x,l*=b.y,a*=b.x,d*=b.y,i+=y,l+=S,m=Oe(g),g=Un(m)}}return Qt({width:a,height:d,x:i,y:l})}function Jt(e,t){const n=Gt(e).scrollLeft;return t?t.left+n:ot(je(e)).left+n}function jo(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function cu(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=je(r),u=t?Yt(t.floating):!1;if(r===c||u&&s)return n;let i={scrollLeft:0,scrollTop:0},l=We(1);const a=We(0),d=Re(r);if((d||!d&&!s)&&((ft(r)!=="body"||Pt(c))&&(i=Gt(r)),Re(r))){const p=ot(r);l=ht(r),a.x=p.x+r.clientLeft,a.y=p.y+r.clientTop}const f=c&&!d&&!s?jo(c,i):We(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-i.scrollLeft*l.x+a.x+f.x,y:n.y*l.y-i.scrollTop*l.y+a.y+f.y}}function fu(e){return Array.from(e.getClientRects())}function du(e){const t=je(e),n=Gt(e),r=e.ownerDocument.body,o=be(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=be(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Jt(e);const u=-n.scrollTop;return Fe(r).direction==="rtl"&&(c+=be(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:u}}const Ro=25;function pu(e,t){const n=Oe(e),r=je(e),o=n.visualViewport;let s=r.clientWidth,c=r.clientHeight,u=0,i=0;if(o){s=o.width,c=o.height;const a=Hn();(!a||a&&t==="fixed")&&(u=o.offsetLeft,i=o.offsetTop)}const l=Jt(r);if(l<=0){const a=r.ownerDocument,d=a.body,f=getComputedStyle(d),p=a.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-p);m<=Ro&&(s-=m)}else l<=Ro&&(s+=l);return{width:s,height:c,x:u,y:i}}const hu=new Set(["absolute","fixed"]);function mu(e,t){const n=ot(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Re(e)?ht(e):We(1),c=e.clientWidth*s.x,u=e.clientHeight*s.y,i=o*s.x,l=r*s.y;return{width:c,height:u,x:i,y:l}}function Wo(e,t,n){let r;if(t==="viewport")r=pu(e,n);else if(t==="document")r=du(je(e));else if(ge(t))r=mu(t,n);else{const o=No(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Qt(r)}function Bo(e,t){const n=Qe(e);return n===t||!ge(n)||dt(n)?!1:Fe(n).position==="fixed"||Bo(n,t)}function vu(e,t){const n=t.get(e);if(n)return n;let r=At(e,[],!1).filter(u=>ge(u)&&ft(u)!=="body"),o=null;const s=Fe(e).position==="fixed";let c=s?Qe(e):e;for(;ge(c)&&!dt(c);){const u=Fe(c),i=Bn(c);!i&&u.position==="fixed"&&(o=null),(s?!i&&!o:!i&&u.position==="static"&&!!o&&hu.has(o.position)||Pt(c)&&!i&&Bo(e,c))?r=r.filter(a=>a!==c):o=u,c=Qe(c)}return t.set(e,r),r}function gu(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Yt(t)?[]:vu(t,this._c):[].concat(n),r],u=c[0],i=c.reduce((l,a)=>{const d=Wo(t,a,o);return l.top=be(d.top,l.top),l.right=rt(d.right,l.right),l.bottom=rt(d.bottom,l.bottom),l.left=be(d.left,l.left),l},Wo(t,u,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function bu(e){const{width:t,height:n}=ko(e);return{width:t,height:n}}function yu(e,t,n){const r=Re(t),o=je(t),s=n==="fixed",c=ot(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const i=We(0);function l(){i.x=Jt(o)}if(r||!r&&!s)if((ft(t)!=="body"||Pt(o))&&(u=Gt(t)),r){const p=ot(t,!0,s,t);i.x=p.x+t.clientLeft,i.y=p.y+t.clientTop}else o&&l();s&&!r&&o&&l();const a=o&&!r&&!s?jo(o,u):We(0),d=c.left+u.scrollLeft-i.x-a.x,f=c.top+u.scrollTop-i.y-a.y;return{x:d,y:f,width:c.width,height:c.height}}function Yn(e){return Fe(e).position==="static"}function Ho(e,t){if(!Re(e)||Fe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return je(e)===n&&(n=n.ownerDocument.body),n}function Uo(e,t){const n=Oe(e);if(Yt(e))return n;if(!Re(e)){let o=Qe(e);for(;o&&!dt(o);){if(ge(o)&&!Yn(o))return o;o=Qe(o)}return n}let r=Ho(e,t);for(;r&&ka(r)&&Yn(r);)r=Ho(r,t);return r&&dt(r)&&Yn(r)&&!Bn(r)?n:r||Ba(e)||n}const Eu=async function(e){const t=this.getOffsetParent||Uo,n=this.getDimensions,r=await n(e.floating);return{reference:yu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wu(e){return Fe(e).direction==="rtl"}const xu={convertOffsetParentRelativeRectToViewportRelativeRect:cu,getDocumentElement:je,getClippingRect:gu,getOffsetParent:Uo,getElementRects:Eu,getClientRects:fu,getDimensions:bu,getScale:ht,isElement:ge,isRTL:wu};function Vo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Cu(e,t){let n=null,r;const o=je(e);function s(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function c(u,i){u===void 0&&(u=!1),i===void 0&&(i=1),s();const l=e.getBoundingClientRect(),{left:a,top:d,width:f,height:p}=l;if(u||t(),!f||!p)return;const m=qt(d),g=qt(o.clientWidth-(a+f)),b=qt(o.clientHeight-(d+p)),x=qt(a),y={rootMargin:-m+"px "+-g+"px "+-b+"px "+-x+"px",threshold:be(0,rt(1,i))||1};let S=!0;function E(F){const j=F[0].intersectionRatio;if(j!==i){if(!S)return c();j?c(!1,j):r=setTimeout(()=>{c(!1,1e-7)},1e3)}j===1&&!Vo(l,e.getBoundingClientRect())&&c(),S=!1}try{n=new IntersectionObserver(E,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,y)}n.observe(e)}return c(!0),s}function Su(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:i=!1}=r,l=zn(e),a=o||s?[...l?At(l):[],...At(t)]:[];a.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const d=l&&u?Cu(l,n):null;let f=-1,p=null;c&&(p=new ResizeObserver(x=>{let[w]=x;w&&w.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var y;(y=p)==null||y.observe(t)})),n()}),l&&!i&&p.observe(l),p.observe(t));let m,g=i?ot(e):null;i&&b();function b(){const x=ot(e);g&&!Vo(g,x)&&n(),g=x,m=requestAnimationFrame(b)}return n(),()=>{var x;a.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),d==null||d(),(x=p)==null||x.disconnect(),p=null,i&&cancelAnimationFrame(m)}}const Gn=Xt,Ou=iu,Tu=su,$u=nu,Pu=lu,Au=(e,t,n)=>{const r=new Map,o={platform:xu,...n},s={...o.platform,_c:r};return tu(e,t,{...o,platform:s})};var Mu=typeof document<"u",_u=function(){},Zt=Mu?h.useLayoutEffect:_u;function en(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(!en(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)&&!en(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function zo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yo(e,t){const n=zo(e);return Math.round(t*n)/n}function qn(e){const t=D.useRef(e);return Zt(()=>{t.current=e}),t}function Lu(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:c}={},transform:u=!0,whileElementsMounted:i,open:l}=e,[a,d]=D.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=D.useState(r);en(f,r)||p(r);const[m,g]=D.useState(null),[b,x]=D.useState(null),w=D.useCallback(P=>{P!==F.current&&(F.current=P,g(P))},[]),y=D.useCallback(P=>{P!==j.current&&(j.current=P,x(P))},[]),S=s||m,E=c||b,F=D.useRef(null),j=D.useRef(null),K=D.useRef(a),ee=i!=null,L=qn(i),N=qn(o),oe=qn(l),H=D.useCallback(()=>{if(!F.current||!j.current)return;const P={placement:t,strategy:n,middleware:f};N.current&&(P.platform=N.current),Au(F.current,j.current,P).then(U=>{const C={...U,isPositioned:oe.current!==!1};W.current&&!en(K.current,C)&&(K.current=C,It.flushSync(()=>{d(C)}))})},[f,t,n,N,oe]);Zt(()=>{l===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,d(P=>({...P,isPositioned:!1})))},[l]);const W=D.useRef(!1);Zt(()=>(W.current=!0,()=>{W.current=!1}),[]),Zt(()=>{if(S&&(F.current=S),E&&(j.current=E),S&&E){if(L.current)return L.current(S,E,H);H()}},[S,E,H,L,ee]);const X=D.useMemo(()=>({reference:F,floating:j,setReference:w,setFloating:y}),[w,y]),G=D.useMemo(()=>({reference:S,floating:E}),[S,E]),J=D.useMemo(()=>{const P={position:n,left:0,top:0};if(!G.floating)return P;const U=Yo(G.floating,a.x),C=Yo(G.floating,a.y);return u?{...P,transform:"translate("+U+"px, "+C+"px)",...zo(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:C}},[n,u,G.floating,a.x,a.y]);return D.useMemo(()=>({...a,update:H,refs:X,elements:G,floatingStyles:J}),[a,H,X,G,J])}const Go=(e,t)=>({...Ou(e),options:[e,t]}),Du=(e,t)=>({...Tu(e),options:[e,t]}),Fu=(e,t)=>({...$u(e),options:[e,t]}),Iu=(e,t)=>({...Pu(e),options:[e,t]}),qo={...D},ku=qo.useInsertionEffect||(e=>e());function Ko(e){const t=D.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return ku(()=>{t.current=e}),D.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 Kn=typeof document<"u"?h.useLayoutEffect:h.useEffect;let Qo=!1,Nu=0;const Xo=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Nu++;function ju(){const[e,t]=D.useState(()=>Qo?Xo():void 0);return Kn(()=>{e==null&&t(Xo())},[]),D.useEffect(()=>{Qo=!0},[]),e}const Ru=qo.useId||ju;let Lt;process.env.NODE_ENV!=="production"&&(Lt=new Set);function Wu(){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=Lt)!=null&&e.has(o))){var s;(s=Lt)==null||s.add(o),console.warn(o)}}function Bu(){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=Lt)!=null&&e.has(o))){var s;(s=Lt)==null||s.add(o),console.error(o)}}function Hu(){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 Uu=D.createContext(null),Vu=D.createContext(null),zu=()=>{var e;return((e=D.useContext(Uu))==null?void 0:e.id)||null},Yu=()=>D.useContext(Vu),Gu="data-floating-ui-focusable";function qu(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Ru(),s=D.useRef({}),[c]=D.useState(()=>Hu()),u=zu()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!ge(p)&&Bu("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[i,l]=D.useState(r.reference),a=Ko((p,m,g)=>{s.current.openEvent=p?m:void 0,c.emit("openchange",{open:p,event:m,reason:g,nested:u}),n==null||n(p,m,g)}),d=D.useMemo(()=>({setPositionReference:l}),[]),f=D.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return D.useMemo(()=>({dataRef:s,open:t,onOpenChange:a,elements:f,events:c,floatingId:o,refs:d}),[t,a,f,c,o,d])}function Ku(e){e===void 0&&(e={});const{nodeId:t}=e,n=qu({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,c]=D.useState(null),[u,i]=D.useState(null),a=(o==null?void 0:o.domReference)||s,d=D.useRef(null),f=Yu();Kn(()=>{a&&(d.current=a)},[a]);const p=Lu({...e,elements:{...o,...u&&{reference:u}}}),m=D.useCallback(y=>{const S=ge(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),contextElement:y}:y;i(S),p.refs.setReference(S)},[p.refs]),g=D.useCallback(y=>{(ge(y)||y===null)&&(d.current=y,c(y)),(ge(p.refs.reference.current)||p.refs.reference.current===null||y!==null&&!ge(y))&&p.refs.setReference(y)},[p.refs]),b=D.useMemo(()=>({...p.refs,setReference:g,setPositionReference:m,domReference:d}),[p.refs,g,m]),x=D.useMemo(()=>({...p.elements,domReference:a}),[p.elements,a]),w=D.useMemo(()=>({...p,...r,refs:b,elements:x,nodeId:t}),[p,b,x,t,r]);return Kn(()=>{r.dataRef.current.floatingContext=w;const y=f==null?void 0:f.nodesRef.current.find(S=>S.id===t);y&&(y.context=w)}),D.useMemo(()=>({...p,context:w,refs:b,elements:x}),[p,b,x,w])}const Jo="active",Zo="selected";function Qn(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Jo]:c,[Zo]:u,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[Gu]:""},...s,...t.map(c=>{const u=c?c[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((c,u)=>(u&&Object.entries(u).forEach(i=>{let[l,a]=i;if(!(o&&[Jo,Zo].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof a=="function"){var d;(d=r.get(l))==null||d.push(a),c[l]=function(){for(var f,p=arguments.length,m=new Array(p),g=0;g<p;g++)m[g]=arguments[g];return(f=r.get(l))==null?void 0:f.map(b=>b(...m)).find(b=>b!==void 0)}}}else c[l]=a}),c),{})}}function Qu(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=D.useCallback(u=>Qn(u,e,"reference"),t),s=D.useCallback(u=>Qn(u,e,"floating"),n),c=D.useCallback(u=>Qn(u,e,"item"),r);return D.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:c}),[o,s,c])}function ei(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Xu=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:c=0,minItemsVisible:u=4,referenceOverflowThreshold:i=0,scrollRef:l,...a}=pt(e,t),{rects:d,elements:{floating:f}}=t,p=n.current[c],m=(l==null?void 0:l.current)||f,g=f.clientTop||m.clientTop,b=f.clientTop!==0,x=m.clientTop!==0,w=f===m;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Wu('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const y={...t,...await Go(-p.offsetTop-f.clientTop-d.reference.height/2-p.offsetHeight/2-s).fn(t)},S=await Gn(ei(y,m.scrollHeight+g+f.clientTop),a),E=await Gn(y,{...a,elementContext:"reference"}),F=be(0,S.top),j=y.y+F,L=(m.scrollHeight>m.clientHeight?N=>N:Mt)(be(0,m.scrollHeight+(b&&w||x?g*2:0)-F-be(0,S.bottom)));if(m.style.maxHeight=L+"px",m.scrollTop=F,o){const N=m.offsetHeight<p.offsetHeight*rt(u,n.current.length)-1||E.top>=-i||E.bottom>=-i;It.flushSync(()=>o(N))}return r&&(r.current=await Gn(ei({...y,y:j},m.offsetHeight+g+f.clientTop),a)),{y:j}}});function Ju(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:c,onChange:u}=t,i=Ko(u),l=D.useRef(!1),a=D.useRef(null),d=D.useRef(null);D.useEffect(()=>{if(!o)return;function p(g){if(g.ctrlKey||!m||s.current==null)return;const b=g.deltaY,x=s.current.top>=-.5,w=s.current.bottom>=-.5,y=m.scrollHeight-m.clientHeight,S=b<0?-1:1,E=b<0?"max":"min";m.scrollHeight<=m.clientHeight||(!x&&b>0||!w&&b<0?(g.preventDefault(),It.flushSync(()=>{i(F=>F+Math[E](b,y*S))})):/firefox/i.test(Ua())&&(m.scrollTop+=b))}const m=(c==null?void 0:c.current)||r.floating;if(n&&m)return m.addEventListener("wheel",p),requestAnimationFrame(()=>{a.current=m.scrollTop,s.current!=null&&(d.current={...s.current})}),()=>{a.current=null,d.current=null,m.removeEventListener("wheel",p)}},[o,n,r.floating,s,c,i]);const f=D.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const p=(c==null?void 0:c.current)||r.floating;if(!(!s.current||!p||!l.current)){if(a.current!==null){const m=p.scrollTop-a.current;(s.current.bottom<-.5&&m<-1||s.current.top<-.5&&m>1)&&It.flushSync(()=>i(g=>g+m))}requestAnimationFrame(()=>{a.current=p.scrollTop})}}}),[r.floating,i,s,c]);return D.useMemo(()=>o?{floating:f}:{},[o,f])}let mt=h.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});mt.displayName="FloatingContext";let Xn=h.createContext(null);Xn.displayName="PlacementContext";function Zu(e){return h.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function ec(){return h.useContext(mt).setReference}function tc(){return h.useContext(mt).getReferenceProps}function nc(){let{getFloatingProps:e,slot:t}=h.useContext(mt);return h.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function rc(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=h.useContext(Xn),n=h.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var c;return(c=s==null?void 0:s.outerHTML)!=null?c:s})]);ue(()=>{t==null||t(n??null)},[t,n]);let r=h.useContext(mt);return h.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let ti=4;function oc({children:e,enabled:t=!0}){let[n,r]=h.useState(null),[o,s]=h.useState(0),c=h.useRef(null),[u,i]=h.useState(null);ic(u);let l=t&&n!==null&&u!==null,{to:a="bottom",gap:d=0,offset:f=0,padding:p=0,inner:m}=sc(n,u),[g,b="center"]=a.split(" ");ue(()=>{l&&s(0)},[l]);let{refs:x,floatingStyles:w,context:y}=Ku({open:l,placement:g==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${g}`:`${g}-${b}`,strategy:"absolute",transform:!1,middleware:[Go({mainAxis:g==="selection"?0:d,crossAxis:f}),Du({padding:p}),g!=="selection"&&Fu({padding:p}),g==="selection"&&m?Xu({...m,padding:p,overflowRef:c,offset:o,minItemsVisible:ti,referenceOverflowThreshold:p,onFallbackChange(N){var oe,H;if(!N)return;let W=y.elements.floating;if(!W)return;let X=parseFloat(getComputedStyle(W).scrollPaddingBottom)||0,G=Math.min(ti,W.childElementCount),J=0,P=0;for(let U of(H=(oe=y.elements.floating)==null?void 0:oe.childNodes)!=null?H:[])if(Ve(U)){let C=U.offsetTop,A=C+U.clientHeight+X,k=W.scrollTop,I=k+W.clientHeight;if(C>=k&&A<=I)G--;else{P=Math.max(0,Math.min(A,I)-Math.max(C,k)),J=U.clientHeight;break}}G>=1&&s(U=>{let C=J*G-P+X;return U>=C?U:C})}}):null,Iu({padding:p,apply({availableWidth:N,availableHeight:oe,elements:H}){Object.assign(H.floating.style,{overflow:"auto",maxWidth:`${N}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${oe}px)`})}})].filter(Boolean),whileElementsMounted:Su}),[S=g,E=b]=y.placement.split("-");g==="selection"&&(S="selection");let F=h.useMemo(()=>({anchor:[S,E].filter(Boolean).join(" ")}),[S,E]),j=Ju(y,{overflowRef:c,onChange:s}),{getReferenceProps:K,getFloatingProps:ee}=Qu([j]),L=ne(N=>{i(N),x.setFloating(N)});return D.createElement(Xn.Provider,{value:r},D.createElement(mt.Provider,{value:{setFloating:L,setReference:x.setReference,styles:w,getReferenceProps:K,getFloatingProps:ee,slot:F}},e))}function ic(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 sc(e,t){var n,r,o;let s=Jn((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),c=Jn((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=Jn((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:c,padding:u}}function Jn(e,t,n=void 0){let r=at(),o=ne((i,l)=>{if(i==null)return[n,null];if(typeof i=="number")return[i,null];if(typeof i=="string"){if(!l)return[n,null];let a=ri(i,l);return[a,d=>{let f=ni(i);{let p=f.map(m=>window.getComputedStyle(l).getPropertyValue(m));r.requestAnimationFrame(function m(){r.nextFrame(m);let g=!1;for(let[x,w]of f.entries()){let y=window.getComputedStyle(l).getPropertyValue(w);if(p[x]!==y){p[x]=y,g=!0;break}}if(!g)return;let b=ri(i,l);a!==b&&(d(b),a=b)})}return r.dispose}]}return[n,null]}),s=h.useMemo(()=>o(e,t)[0],[e,t]),[c=s,u]=h.useState();return ue(()=>{let[i,l]=o(e,t);if(u(i),!!l)return l(u)},[e,t]),c}function ni(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,...ni(o)]:[r]}return[]}function ri(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 lc(e,t){let[n,r]=h.useState(t);return!e&&n!==t&&r(t),e?n:t}let Zn=h.createContext(null);Zn.displayName="OpenClosedContext";var Ie=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ie||{});function er(){return h.useContext(Zn)}function oi({value:e,children:t}){return h.createElement(Zn.Provider,{value:e},t)}function ac(e){throw new Error("Unexpected object: "+e)}var ce=(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))(ce||{});function tn(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:ac(e)}}var ii=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(ii||{});function si(e){let t=ne(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,Rr(()=>{n.current&&t()})}),[t])}function uc(){let e=typeof document>"u";return"useSyncExternalStore"in D?(t=>t.useSyncExternalStore)(D)(()=>()=>{},()=>!1,()=>!e):!1}function tr(){let e=uc(),[t,n]=D.useState(ke.isHandoffComplete);return t&&ke.isHandoffComplete===!1&&n(!1),D.useEffect(()=>{t!==!0&&n(!0)},[t]),D.useEffect(()=>ke.handoff(),[]),e?!1:t}let cc=h.createContext(!1);function fc(){return h.useContext(cc)}function dc(e){let t=fc(),n=h.useContext(ai),[r,o]=h.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(ke.isServer)return null;let c=e==null?void 0:e.getElementById("headlessui-portal-root");if(c)return c;if(e===null)return null;let u=e.createElement("div");return u.setAttribute("id","headlessui-portal-root"),e.body.appendChild(u)});return h.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),h.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let li=h.Fragment,pc=xe(function(e,t){let{ownerDocument:n=null,...r}=e,o=h.useRef(null),s=Pe(_l(p=>{o.current=p}),t),c=Wn(o),u=n??c,i=dc(u),[l]=h.useState(()=>{var p;return ke.isServer?null:(p=u==null?void 0:u.createElement("div"))!=null?p:null}),a=h.useContext(gc),d=tr();ue(()=>{!i||!l||i.contains(l)||(l.setAttribute("data-headlessui-portal",""),i.appendChild(l))},[i,l]),ue(()=>{if(l&&a)return a.register(l)},[a,l]),si(()=>{var p;!i||!l||($n(l)&&i.contains(l)&&i.removeChild(l),i.childNodes.length<=0&&((p=i.parentElement)==null||p.removeChild(i)))});let f=Se();return d?!i||!l?null:we.createPortal(f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:li,name:"Portal"}),l):null});function hc(e,t){let n=Pe(t),{enabled:r=!0,ownerDocument:o,...s}=e,c=Se();return r?h.createElement(pc,{...s,ownerDocument:o,ref:n}):c({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:li,name:"Portal"})}let mc=h.Fragment,ai=h.createContext(null);function vc(e,t){let{target:n,...r}=e,o={ref:Pe(t)},s=Se();return h.createElement(ai.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:mc,name:"Popover.Group"}))}let gc=h.createContext(null),bc=xe(hc),yc=xe(vc),Ec=Object.assign(bc,{Group:yc});function wc(){let e=h.useRef(!1);return ue(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ui(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:fi)!==h.Fragment||h.Children.count(e.children)===1}let nn=h.createContext(null);nn.displayName="TransitionContext";var xc=(e=>(e.Visible="visible",e.Hidden="hidden",e))(xc||{});function Cc(){let e=h.useContext(nn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Sc(){let e=h.useContext(rn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let rn=h.createContext(null);rn.displayName="NestingContext";function on(e){return"children"in e?on(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function ci(e,t){let n=tt(e),r=h.useRef([]),o=wc(),s=at(),c=ne((p,m=qe.Hidden)=>{let g=r.current.findIndex(({el:b})=>b===p);g!==-1&&($e(m,{[qe.Unmount](){r.current.splice(g,1)},[qe.Hidden](){r.current[g].state="hidden"}}),s.microTask(()=>{var b;!on(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),u=ne(p=>{let m=r.current.find(({el:g})=>g===p);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:p,state:"visible"}),()=>c(p,qe.Unmount)}),i=h.useRef([]),l=h.useRef(Promise.resolve()),a=h.useRef({enter:[],leave:[]}),d=ne((p,m,g)=>{i.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([b])=>b!==p)),t==null||t.chains.current[m].push([p,new Promise(b=>{i.current.push(b)})]),t==null||t.chains.current[m].push([p,new Promise(b=>{Promise.all(a.current[m].map(([x,w])=>w)).then(()=>b())})]),m==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(m)):g(m)}),f=ne((p,m,g)=>{Promise.all(a.current[m].splice(0).map(([b,x])=>x)).then(()=>{var b;(b=i.current.shift())==null||b()}).then(()=>g(m))});return h.useMemo(()=>({children:r,register:u,unregister:c,onStart:d,onStop:f,wait:l,chains:a}),[u,c,r,d,f,a,l])}let fi=h.Fragment,di=Wt.RenderStrategy;function Oc(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:u,afterLeave:i,enter:l,enterFrom:a,enterTo:d,entered:f,leave:p,leaveFrom:m,leaveTo:g,...b}=e,[x,w]=h.useState(null),y=h.useRef(null),S=ui(e),E=Pe(...S?[y,t,w]:t===null?[]:[t]),F=(n=b.unmount)==null||n?qe.Unmount:qe.Hidden,{show:j,appear:K,initial:ee}=Cc(),[L,N]=h.useState(j?"visible":"hidden"),oe=Sc(),{register:H,unregister:W}=oe;ue(()=>H(y),[H,y]),ue(()=>{if(F===qe.Hidden&&y.current){if(j&&L!=="visible"){N("visible");return}return $e(L,{hidden:()=>W(y),visible:()=>H(y)})}},[L,y,H,W,j,F]);let X=tr();ue(()=>{if(S&&X&&L==="visible"&&y.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[y,L,X,S]);let G=ee&&!K,J=K&&j&&ee,P=h.useRef(!1),U=ci(()=>{P.current||(N("hidden"),W(y))},oe),C=ne($=>{P.current=!0;let R=$?"enter":"leave";U.onStart(y,R,V=>{V==="enter"?s==null||s():V==="leave"&&(u==null||u())})}),A=ne($=>{let R=$?"enter":"leave";P.current=!1,U.onStop(y,R,V=>{V==="enter"?c==null||c():V==="leave"&&(i==null||i())}),R==="leave"&&!on(U)&&(N("hidden"),W(y))});h.useEffect(()=>{S&&o||(C(j),A(j))},[j,S,o]);let k=!(!o||!S||!X||G),[,I]=Oo(k,x,j,{start:C,end:A}),B=Ke({ref:E,className:((r=Sn(b.className,J&&l,J&&a,I.enter&&l,I.enter&&I.closed&&a,I.enter&&!I.closed&&d,I.leave&&p,I.leave&&!I.closed&&m,I.leave&&I.closed&&g,!I.transition&&j&&f))==null?void 0:r.trim())||void 0,...So(I)}),q=0;L==="visible"&&(q|=Ie.Open),L==="hidden"&&(q|=Ie.Closed),j&&L==="hidden"&&(q|=Ie.Opening),!j&&L==="visible"&&(q|=Ie.Closing);let Y=Se();return h.createElement(rn.Provider,{value:U},h.createElement(oi,{value:q},Y({ourProps:B,theirProps:b,defaultTag:fi,features:di,visible:L==="visible",name:"Transition.Child"})))}function Tc(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,c=h.useRef(null),u=ui(e),i=Pe(...u?[c,t]:t===null?[]:[t]);tr();let l=er();if(n===void 0&&l!==null&&(n=(l&Ie.Open)===Ie.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[a,d]=h.useState(n?"visible":"hidden"),f=ci(()=>{n||d("hidden")}),[p,m]=h.useState(!0),g=h.useRef([n]);ue(()=>{p!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),m(!1))},[g,n]);let b=h.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);ue(()=>{n?d("visible"):!on(f)&&c.current!==null&&d("hidden")},[n,f]);let x={unmount:o},w=ne(()=>{var E;p&&m(!1),(E=e.beforeEnter)==null||E.call(e)}),y=ne(()=>{var E;p&&m(!1),(E=e.beforeLeave)==null||E.call(e)}),S=Se();return h.createElement(rn.Provider,{value:f},h.createElement(nn.Provider,{value:b},S({ourProps:{...x,as:h.Fragment,children:h.createElement(pi,{ref:i,...x,...s,beforeEnter:w,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:di,visible:a==="visible",name:"Transition"})))}function $c(e,t){let n=h.useContext(nn)!==null,r=er()!==null;return h.createElement(h.Fragment,null,!n&&r?h.createElement(nr,{ref:t,...e}):h.createElement(pi,{ref:t,...e}))}let nr=xe(Tc),pi=xe(Oc),Pc=xe($c),hi=Object.assign(nr,{Child:Pc,Root:nr});function Ac(e,t){let n=h.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 mi=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function vi(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!Ve(o))return r;let s=!1;for(let u of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),s=!0;let c=s?(n=o.innerText)!=null?n:"":r;return mi.test(c)&&(c=c.replace(mi,"")),c}function Mc(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 c=s.getAttribute("aria-label");return typeof c=="string"?c.trim():vi(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return vi(e).trim()}function _c(e){let t=h.useRef(""),n=h.useRef("");return ne(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=Mc(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var Lc=Object.defineProperty,Dc=(e,t,n)=>t in e?Lc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gi=(e,t,n)=>(Dc(e,typeof t!="symbol"?t+"":t,n),n),ve=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ve||{}),Be=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Be||{}),sn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(sn||{}),bi=(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))(bi||{});function yi(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=vo(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 Fc={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ce.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,c;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===ce.Nothing)return{...u,activeOptionIndex:null};if(t.focus===ce.Specific)return{...u,activeOptionIndex:e.options.findIndex(a=>a.id===t.id)};if(t.focus===ce.Previous){let a=e.activeOptionIndex;if(a!==null){let d=e.options[a].dataRef.current.domRef,f=tn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(f!==null){let p=e.options[f].dataRef.current.domRef;if(((r=d.current)==null?void 0:r.previousElementSibling)===p.current||((o=p.current)==null?void 0:o.previousElementSibling)===null)return{...u,activeOptionIndex:f}}}}else if(t.focus===ce.Next){let a=e.activeOptionIndex;if(a!==null){let d=e.options[a].dataRef.current.domRef,f=tn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(f!==null){let p=e.options[f].dataRef.current.domRef;if(((s=d.current)==null?void 0:s.nextElementSibling)===p.current||((c=p.current)==null?void 0:c.nextElementSibling)===null)return{...u,activeOptionIndex:f}}}}let i=yi(e),l=tn(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:a=>a.id,resolveDisabled:a=>a.dataRef.current.disabled});return{...u,...i,activeOptionIndex:l}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(c=>{var u;return!c.dataRef.current.disabled&&((u=c.dataRef.current.textValue)==null?void 0:u.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!==ce.Nothing&&(r=tn(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(c=>o==null?void 0:o(c.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ce.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,c]of n.entries())if(o.has(c.id)&&(r.push(s),o.delete(c.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,...yi(e),pendingShouldSort:!1}:e};class rr extends ro{constructor(t){super(t),gi(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:c}=this.state.dataRef.current;return $e(s,{0:()=>r==null?void 0:r(n),1:()=>{let u=c.slice(),i=u.findIndex(l=>o(l,n));return i===-1?u.push(n):u.splice(i,1),r==null?void 0:r(u)}})},registerOption:_n(()=>{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:_n(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:_n(()=>{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:ce.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})}}),gi(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,c=n.options;return s!==null?((o=c[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=Ln.get(null);this.disposables.add(r.on(lo.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 rr({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ce.Nothing},__demoMode:n})}reduce(t,n){return $e(n.type,Fc,t,n)}}const Ei=h.createContext(null);function or(e){let t=h.useContext(Ei);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,wi),n}return t}function wi({id:e,__demoMode:t=!1}){let n=h.useMemo(()=>rr.new({id:e,__demoMode:t}),[]);return si(()=>n.dispose()),n}let ln=h.createContext(null);ln.displayName="ListboxDataContext";function Dt(e){let t=h.useContext(ln);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Dt),n}return t}let Ic=h.Fragment;function kc(e,t){let n=h.useId(),r=Cn(),{value:o,defaultValue:s,form:c,name:u,onChange:i,by:l,invalid:a=!1,disabled:d=r||!1,horizontal:f=!1,multiple:p=!1,__demoMode:m=!1,...g}=e;const b=f?"horizontal":"vertical";let x=Pe(t),w=vl(s),[y=p?[]:void 0,S]=ml(o,i,w),E=wi({id:n,__demoMode:m}),F=h.useRef({static:!1,hold:!1}),j=h.useRef(new Map),K=Hl(l),ee=h.useCallback(k=>$e(L.mode,{[Be.Multi]:()=>y.some(I=>K(I,k)),[Be.Single]:()=>K(y,k)}),[y]),L=h.useMemo(()=>({value:y,disabled:d,invalid:a,mode:p?Be.Multi:Be.Single,orientation:b,onChange:S,compare:K,isSelected:ee,optionsPropsRef:F,listRef:j}),[y,d,a,p,b,S,K,ee,F,j]);ue(()=>{E.state.dataRef.current=L},[L]);let N=Me(E,k=>k.listboxState),oe=Ln.get(null),H=Me(oe,h.useCallback(k=>oe.selectors.isTop(k,n),[oe,n])),[W,X]=Me(E,k=>[k.buttonElement,k.optionsElement]);ma(H,[W,X],(k,I)=>{E.send({type:bi.CloseListbox}),mo(I,Rn.Loose)||(k.preventDefault(),W==null||W.focus())});let G=h.useMemo(()=>({open:N===ve.Open,disabled:d,invalid:a,value:y}),[N,d,a,y]),[J,P]=kl({inherit:!0}),U={ref:x},C=h.useCallback(()=>{if(w!==void 0)return S==null?void 0:S(w)},[S,w]),A=Se();return h.createElement(P,{value:J,props:{htmlFor:W==null?void 0:W.id},slot:{open:N===ve.Open,disabled:d}},h.createElement(oc,null,h.createElement(Ei.Provider,{value:E},h.createElement(ln.Provider,{value:L},h.createElement(oi,{value:$e(N,{[ve.Open]:Ie.Open,[ve.Closed]:Ie.Closed})},u!=null&&y!=null&&h.createElement(xl,{disabled:d,data:{[u]:y},form:c,onReset:C}),A({ourProps:U,theirProps:g,slot:G,defaultTag:Ic,name:"Listbox"}))))))}let Nc="button";function jc(e,t){let n=h.useId(),r=Yr(),o=Dt("Listbox.Button"),s=or("Listbox.Button"),{id:c=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:i=!1,...l}=e,a=Pe(t,ec(),s.actions.setButtonElement),d=tc(),[f,p,m]=Me(s,P=>[P.listboxState,P.buttonElement,P.optionsElement]),g=f===ve.Open;ba(g,{trigger:p,action:h.useCallback(P=>{if(p!=null&&p.contains(P.target))return Vt.Ignore;let U=P.target.closest('[role="option"]:not([data-disabled])');return Ve(U)?Vt.Select(U):m!=null&&m.contains(P.target)?Vt.Ignore:Vt.Close},[p,m]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let b=ne(P=>{switch(P.key){case me.Enter:gl(P.currentTarget);break;case me.Space:case me.ArrowDown:P.preventDefault(),s.actions.openListbox({focus:o.value?ce.Nothing:ce.First});break;case me.ArrowUp:P.preventDefault(),s.actions.openListbox({focus:o.value?ce.Nothing:ce.Last});break}}),x=ne(P=>{switch(P.key){case me.Space:P.preventDefault();break}}),w=ne(P=>{var U;if(P.button===ii.Left){if(Al(P.currentTarget))return P.preventDefault();s.state.listboxState===ve.Open?(we.flushSync(()=>s.actions.closeListbox()),(U=s.state.buttonElement)==null||U.focus({preventScroll:!0})):(P.preventDefault(),s.actions.openListbox({focus:ce.Nothing}))}}),y=h.useRef(null),S=ne(P=>{y.current=P.pointerType,P.pointerType==="mouse"&&w(P)}),E=ne(P=>{y.current!=="mouse"&&w(P)}),F=ne(P=>P.preventDefault()),j=Zr([c]),K=Ll(),{isFocusVisible:ee,focusProps:L}=rl({autoFocus:i}),{isHovered:N,hoverProps:oe}=nl({isDisabled:u}),{pressed:H,pressProps:W}=ul({disabled:u}),X=h.useMemo(()=>({open:f===ve.Open,active:H||f===ve.Open,disabled:u,invalid:o.invalid,value:o.value,hover:N,focus:ee,autofocus:i}),[f,o.value,u,N,ee,H,o.invalid,i]),G=Me(s,P=>P.listboxState===ve.Open),J=Br(d(),{ref:a,id:c,type:ya(e,p),"aria-haspopup":"listbox","aria-controls":m==null?void 0:m.id,"aria-expanded":G,"aria-labelledby":j,"aria-describedby":K,disabled:u||void 0,autoFocus:i,onKeyDown:b,onKeyUp:x,onKeyPress:F,onPointerDown:S,onClick:E},L,oe,W);return Se()({ourProps:J,theirProps:l,slot:X,defaultTag:Nc,name:"Listbox.Button"})}let xi=h.createContext(!1),Rc="div",Wc=Wt.RenderStrategy|Wt.Static;function Bc(e,t){let n=h.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:c=!0,transition:u=!1,...i}=e,l=Zu(o),[a,d]=h.useState(null);l&&(s=!0);let f=Dt("Listbox.Options"),p=or("Listbox.Options"),[m,g,b,x]=Me(p,$=>[$.listboxState,$.buttonElement,$.optionsElement,$.__demoMode]),w=Wn(g),y=Wn(b),S=er(),[E,F]=Oo(u,a,S!==null?(S&Ie.Open)===Ie.Open:m===ve.Open);ra(E,g,p.actions.closeListbox);let j=x?!1:c&&m===ve.Open;$a(j,y);let K=x?!1:c&&m===ve.Open;na(K,{allowed:h.useCallback(()=>[g,b],[g,b])});let ee=m!==ve.Open,L=Ac(ee,g)?!1:E,N=E&&m===ve.Closed,oe=lc(N,f.value),H=ne($=>f.compare(oe,$)),W=Me(p,$=>{var R;if(l==null||!((R=l==null?void 0:l.to)!=null&&R.includes("selection")))return null;let V=$.options.findIndex(Q=>H(Q.dataRef.current.value));return V===-1&&(V=0),V}),X=(()=>{if(l==null)return;if(W===null)return{...l,inner:void 0};let $=Array.from(f.listRef.current.values());return{...l,inner:{listRef:{current:$},index:W}}})(),[G,J]=rc(X),P=nc(),U=Pe(t,l?G:null,p.actions.setOptionsElement,d),C=at();h.useEffect(()=>{var $;let R=b;R&&m===ve.Open&&R!==(($=St(R))==null?void 0:$.activeElement)&&(R==null||R.focus({preventScroll:!0}))},[m,b]);let A=ne($=>{var R,V;switch(C.dispose(),$.key){case me.Space:if(p.state.searchQuery!=="")return $.preventDefault(),$.stopPropagation(),p.actions.search($.key);case me.Enter:if($.preventDefault(),$.stopPropagation(),p.state.activeOptionIndex!==null){let{dataRef:Q}=p.state.options[p.state.activeOptionIndex];p.actions.onChange(Q.current.value)}f.mode===Be.Single&&(we.flushSync(()=>p.actions.closeListbox()),(R=p.state.buttonElement)==null||R.focus({preventScroll:!0}));break;case $e(f.orientation,{vertical:me.ArrowDown,horizontal:me.ArrowRight}):return $.preventDefault(),$.stopPropagation(),p.actions.goToOption({focus:ce.Next});case $e(f.orientation,{vertical:me.ArrowUp,horizontal:me.ArrowLeft}):return $.preventDefault(),$.stopPropagation(),p.actions.goToOption({focus:ce.Previous});case me.Home:case me.PageUp:return $.preventDefault(),$.stopPropagation(),p.actions.goToOption({focus:ce.First});case me.End:case me.PageDown:return $.preventDefault(),$.stopPropagation(),p.actions.goToOption({focus:ce.Last});case me.Escape:$.preventDefault(),$.stopPropagation(),we.flushSync(()=>p.actions.closeListbox()),(V=p.state.buttonElement)==null||V.focus({preventScroll:!0});return;case me.Tab:$.preventDefault(),$.stopPropagation(),we.flushSync(()=>p.actions.closeListbox()),fa(p.state.buttonElement,$.shiftKey?jn.Previous:jn.Next);break;default:$.key.length===1&&(p.actions.search($.key),C.setTimeout(()=>p.actions.clearSearch(),350));break}}),k=Me(p,$=>{var R;return(R=$.buttonElement)==null?void 0:R.id}),I=h.useMemo(()=>({open:m===ve.Open}),[m]),B=Br(l?P():{},{id:r,ref:U,"aria-activedescendant":Me(p,p.selectors.activeDescendantId),"aria-multiselectable":f.mode===Be.Multi?!0:void 0,"aria-labelledby":k,"aria-orientation":f.orientation,onKeyDown:A,role:"listbox",tabIndex:m===ve.Open?0:void 0,style:{...i.style,...J,"--button-width":Vl(g,!0).width},...So(F)}),q=Se(),Y=h.useMemo(()=>f.mode===Be.Multi?f:{...f,isSelected:H},[f,H]);return h.createElement(Ec,{enabled:s?e.static||E:!1,ownerDocument:w},h.createElement(ln.Provider,{value:Y},q({ourProps:B,theirProps:i,slot:I,defaultTag:Rc,features:Wc,visible:L,name:"Listbox.Options"})))}let Hc="div";function Uc(e,t){let n=h.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...c}=e,u=h.useContext(xi)===!0,i=Dt("Listbox.Option"),l=or("Listbox.Option"),a=Me(l,L=>l.selectors.isActive(L,r)),d=i.isSelected(s),f=h.useRef(null),p=_c(f),m=tt({disabled:o,value:s,domRef:f,get textValue(){return p()}}),g=Pe(t,f,L=>{L?i.listRef.current.set(r,L):i.listRef.current.delete(r)}),b=Me(l,L=>l.selectors.shouldScrollIntoView(L,r));ue(()=>{if(b)return De().requestAnimationFrame(()=>{var L,N;(N=(L=f.current)==null?void 0:L.scrollIntoView)==null||N.call(L,{block:"nearest"})})},[b,f]),ue(()=>{if(!u)return l.actions.registerOption(r,m),()=>l.actions.unregisterOption(r)},[m,r,u]);let x=ne(L=>{var N;if(o)return L.preventDefault();l.actions.onChange(s),i.mode===Be.Single&&(we.flushSync(()=>l.actions.closeListbox()),(N=l.state.buttonElement)==null||N.focus({preventScroll:!0}))}),w=ne(()=>{if(o)return l.actions.goToOption({focus:ce.Nothing});l.actions.goToOption({focus:ce.Specific,id:r})}),y=Pa(),S=ne(L=>y.update(L)),E=ne(L=>{y.wasMoved(L)&&(o||a&&l.state.activationTrigger===sn.Pointer||l.actions.goToOption({focus:ce.Specific,id:r},sn.Pointer))}),F=ne(L=>{y.wasMoved(L)&&(o||a&&l.state.activationTrigger===sn.Pointer&&l.actions.goToOption({focus:ce.Nothing}))}),j=h.useMemo(()=>({active:a,focus:a,selected:d,disabled:o,selectedOption:d&&u}),[a,d,o,u]),K=u?{}:{id:r,ref:g,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:x,onFocus:w,onPointerEnter:S,onMouseEnter:S,onPointerMove:E,onMouseMove:E,onPointerLeave:F,onMouseLeave:F},ee=Se();return!d&&u?null:ee({ourProps:K,theirProps:c,slot:j,defaultTag:Hc,name:"Listbox.Option"})}let Vc=h.Fragment;function zc(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Pe(t)},c=Dt("ListboxSelectedOption"),u=h.useMemo(()=>({}),[]),i=c.value===void 0||c.value===null||c.mode===Be.Multi&&Array.isArray(c.value)&&c.value.length===0,l=Se();return h.createElement(xi.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:h.createElement(h.Fragment,null,r&&i?r:n)},slot:u,defaultTag:Vc,name:"ListboxSelectedOption"}))}let Yc=xe(kc),Gc=xe(jc),qc=Wl,Kc=xe(Bc),Qc=xe(Uc),Xc=xe(zc),Je=Object.assign(Yc,{Button:Gc,Label:qc,Options:Kc,Option:Qc,SelectedOption:Xc});function Jc({title:e,titleId:t,...n},r){return D.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?D.createElement("title",{id:t},e):null,D.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 Ci=D.forwardRef(Jc);function Zc({title:e,titleId:t,...n},r){return D.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?D.createElement("title",{id:t},e):null,D.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const Si=D.forwardRef(Zc),ef=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>O.jsx("div",{className:`relative ${o}`,children:O.jsx(Je,{value:t,onChange:n,disabled:r,children:({open:s})=>O.jsxs(O.Fragment,{children:[O.jsxs(Je.Button,{className:`
76
- relative w-full h-9 text-text-primary bg-fill-input-primary
121
+ */var Tp;function AE(){return Tp||(Tp=1,process.env.NODE_ENV!=="production"&&function(){function e(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=x,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;fc.useSyncExternalStoreWithSelector=function(a,u,l,d,f){var p=o(null);if(p.current===null){var h={hasValue:!1,value:null};p.current=h}else h=p.current;p=i(function(){function w(L){if(!T){if(T=!0,y=L,L=d(L),f!==void 0&&h.hasValue){var F=h.value;if(f(F,L))return A=F}return A=L}if(F=A,n(y,L))return F;var j=d(L);return f!==void 0&&f(F,j)?(y=L,F):(y=L,A=j)}var T=!1,y,A,M=l===void 0?null:l;return[function(){return w(u())},M===null?void 0:function(){return w(M())}]},[u,l,d,f]);var m=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),fc}process.env.NODE_ENV==="production"?uc.exports=$E():uc.exports=AE();var TE=uc.exports;function lt(e,t,n=Ep){return TE.useSyncExternalStoreWithSelector(ue(r=>e.subscribe(CE,r)),ue(()=>e.state),ue(()=>e.state),ue(t),n)}function CE(e){return e}function Cp(e,t){let n=x.useId(),r=cc.get(t),[o,s]=lt(r,x.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return ye(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let dc=new Map,Po=new Map;function Op(e){var t;let n=(t=Po.get(e))!=null?t:0;return Po.set(e,n+1),n!==0?()=>Np(e):(dc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Np(e))}function Np(e){var t;let n=(t=Po.get(e))!=null?t:1;if(n===1?Po.delete(e):Po.set(e,n-1),n!==1)return;let r=dc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,dc.delete(e))}function OE(e,{allowed:t,disallowed:n}={}){let r=Cp(e,"inert-others");ye(()=>{var o,s;if(!r)return;let i=Pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(Op(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=xo(a);if(!u)continue;let l=a.parentElement;for(;l&&l!==u.body;){for(let d of l.children)c.some(f=>d.contains(f))||i.add(Op(d));l=l.parentElement}}return i.dispose},[r,t,n])}function NE(e,t,n){let r=Un(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});x.useEffect(()=>{if(!e)return;let o=t===null?null:on(t)?t:t.current;if(!o)return;let s=Pt();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let pc=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),IE=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var hc=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(hc||{}),kE=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(kE||{}),BE=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(BE||{});function Ip(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(pc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function ME(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(IE)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var mc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(mc||{});function kp(e,t=0){var n;return e===((n=xo(e))==null?void 0:n.body)?!1:at(t,{0(){return e.matches(pc)},1(){let r=e;for(;r!==null;){if(r.matches(pc))return!0;r=r.parentElement}return!1}})}var LE=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(LE||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let RE=["textarea","input"].join(",");function DE(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,RE))!=null?n:!1}function Bp(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let i=o.compareDocumentPosition(s);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function FE(e,t){return jE(Ip(),t,{relativeTo:e})}function jE(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?Bp(e):e:t&64?ME(e):Ip(e);o.length>0&&i.length>1&&(i=i.filter(p=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===p:h===p))),r=r??s.activeElement;let c=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},l=0,d=i.length,f;do{if(l>=d||l+d<=0)return 0;let p=a+l;if(t&16)p=(p+d)%d;else{if(p<0)return 3;if(p>=d)return 1}f=i[p],f==null||f.focus(u),l+=c}while(f!==s.activeElement);return t&6&&DE(f)&&f.select(),2}function Mp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function _E(){return/Android/gi.test(window.navigator.userAgent)}function Lp(){return Mp()||_E()}function vr(e,t,n,r){let o=Un(n);x.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function UE(e,t,n,r){let o=Un(n);x.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Rp=30;function zE(e,t,n){let r=Un(n),o=x.useCallback(function(c,a){if(c.defaultPrevented)return;let u=a(c);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let l=function d(f){return typeof f=="function"?d(f()):Array.isArray(f)||f instanceof Set?f:[f]}(t);for(let d of l)if(d!==null&&(d.contains(u)||c.composed&&c.composedPath().includes(d)))return;return!kp(u,mc.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=x.useRef(null);vr(e,"pointerdown",c=>{var a,u;Lp()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),vr(e,"pointerup",c=>{if(Lp()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=x.useRef({x:0,y:0});vr(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),vr(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Rp||Math.abs(a.y-i.current.y)>=Rp))return o(c,()=>wr(c.target)?c.target:null)},!0),UE(e,"blur",c=>o(c,()=>Jx(window.document.activeElement)?window.document.activeElement:null),!0)}function gc(...e){return x.useMemo(()=>xo(...e),[...e])}var HE=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(HE||{});const As={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},WE=200,Dp=5;function VE(e,{trigger:t,action:n,close:r,select:o}){let s=x.useRef(null),i=x.useRef(null),c=x.useRef(null);vr(e&&t!==null,"pointerdown",a=>{rc(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),vr(e&&t!==null,"pointerup",a=>{var u,l;let d=s.current;if(d===null||(s.current=null,!wr(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<Dp&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<Dp)return;let f=n(a);switch(f.kind){case 0:return;case 1:{a.timeStamp-d>WE&&(o(f.target),r());break}case 2:{r();break}}},{capture:!0})}function GE(e,t){return x.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function qE(e){return x.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function ZE(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(c=>c()))}}}function KE(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function YE(){return Mp()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=Pt();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",c=>{if(wr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);wr(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(wr(c.target)&&Qx(c.target))if(r(c.target)){let a=c.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(wr(c.target)){if(fp(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function XE(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function QE(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let zn=ZE(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Pt(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:QE(n)},o=[YE(),KE(),XE()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});zn.subscribe(()=>{let e=zn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&zn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&zn.dispatch("TEARDOWN",n)}});function JE(e,t,n=()=>({containers:[]})){let r=qE(zn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ye(()=>{if(!(!t||!e))return zn.dispatch("PUSH",t,n),()=>zn.dispatch("POP",t,n)},[e,t]),s}function e2(e,t,n=()=>[document.body]){let r=Cp(e,"scroll-lock");JE(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Fp(e){return[e.screenX,e.screenY]}function t2(){let e=x.useRef([-1,-1]);return{wasMoved(t){let n=Fp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Fp(t)}}}function n2(e=0){let[t,n]=x.useState(e),r=x.useCallback(a=>n(a),[t]),o=x.useCallback(a=>n(u=>u|a),[t]),s=x.useCallback(a=>(t&a)===a,[t]),i=x.useCallback(a=>n(u=>u&~a),[n]),c=x.useCallback(a=>n(u=>u^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var jp,_p;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((jp=process==null?void 0:process.env)==null?void 0:jp.NODE_ENV)==="test"&&typeof((_p=Element==null?void 0:Element.prototype)==null?void 0:_p.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
122
+ `)),[]});var r2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(r2||{});function Up(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function zp(e,t,n,r){let[o,s]=x.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=n2(e&&o?3:0),u=x.useRef(!1),l=x.useRef(!1),d=yr();return ye(()=>{var f;if(e){if(n&&s(!0),!t){n&&c(3);return}return(f=r==null?void 0:r.start)==null||f.call(r,n),o2(t,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){l.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var p;l.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(u.current=!1,a(7),n||s(!1),(p=r==null?void 0:r.end)==null||p.call(r,n))}})}},[e,n,t,d]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function o2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Pt();return i2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(s2(e,r))})}),s.dispose}function s2(e,t){var n,r;let o=Pt();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(c=>c instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(c=>c.finished)).then(()=>{s||t()}),o.dispose)}function i2(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function Ts(){return typeof window<"u"}function xr(e){return bc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ve(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(bc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bc(e){return Ts()?e instanceof Node||e instanceof Ve(e).Node:!1}function pe(e){return Ts()?e instanceof Element||e instanceof Ve(e).Element:!1}function Fe(e){return Ts()?e instanceof HTMLElement||e instanceof Ve(e).HTMLElement:!1}function yc(e){return!Ts()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ve(e).ShadowRoot}const a2=new Set(["inline","contents"]);function $o(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ft(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!a2.has(o)}const c2=new Set(["table","td","th"]);function u2(e){return c2.has(xr(e))}const l2=[":popover-open",":modal"];function Cs(e){return l2.some(t=>{try{return e.matches(t)}catch{return!1}})}const f2=["transform","translate","scale","rotate","perspective"],d2=["transform","translate","scale","rotate","perspective","filter"],p2=["paint","layout","strict","content"];function wc(e){const t=Os(),n=pe(e)?ft(e):e;return f2.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||d2.some(r=>(n.willChange||"").includes(r))||p2.some(r=>(n.contain||"").includes(r))}function h2(e){let t=an(e);for(;Fe(t)&&!sn(t);){if(wc(t))return t;if(Cs(t))return null;t=an(t)}return null}function Os(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const m2=new Set(["html","body","#document"]);function sn(e){return m2.has(xr(e))}function ft(e){return Ve(e).getComputedStyle(e)}function Ns(e){return pe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function an(e){if(xr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yc(e)&&e.host||Rt(e);return yc(t)?t.host:t}function Hp(e){const t=an(e);return sn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Fe(t)&&$o(t)?t:Hp(t)}function vn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Hp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ve(o);if(s){const c=vc(i);return t.concat(i,i.visualViewport||[],$o(o)?o:[],c&&n?vn(c):[])}return t.concat(o,vn(o,[],n))}function vc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function g2(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const cn=Math.min,Be=Math.max,Ao=Math.round,Is=Math.floor,Dt=e=>({x:e,y:e}),b2={left:"right",right:"left",bottom:"top",top:"bottom"},y2={start:"end",end:"start"};function xc(e,t,n){return Be(e,cn(t,n))}function Hn(e,t){return typeof e=="function"?e(t):e}function xn(e){return e.split("-")[0]}function Er(e){return e.split("-")[1]}function Wp(e){return e==="x"?"y":"x"}function Ec(e){return e==="y"?"height":"width"}const w2=new Set(["top","bottom"]);function un(e){return w2.has(xn(e))?"y":"x"}function Sc(e){return Wp(un(e))}function v2(e,t,n){n===void 0&&(n=!1);const r=Er(e),o=Sc(e),s=Ec(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=ks(i)),[i,ks(i)]}function x2(e){const t=ks(e);return[Pc(e),t,Pc(t)]}function Pc(e){return e.replace(/start|end/g,t=>y2[t])}const Vp=["left","right"],Gp=["right","left"],E2=["top","bottom"],S2=["bottom","top"];function P2(e,t,n){switch(e){case"top":case"bottom":return n?t?Gp:Vp:t?Vp:Gp;case"left":case"right":return t?E2:S2;default:return[]}}function $2(e,t,n,r){const o=Er(e);let s=P2(xn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Pc)))),s}function ks(e){return e.replace(/left|right|bottom|top/g,t=>b2[t])}function A2(e){return{top:0,right:0,bottom:0,left:0,...e}}function qp(e){return typeof e!="number"?A2(e):{top:e,right:e,bottom:e,left:e}}function Bs(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
123
+ * tabbable 6.2.0
124
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
125
+ */var T2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],$c=T2.join(","),Zp=typeof Element>"u",To=Zp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ms=!Zp&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Ls=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&e(t.parentNode);return i},C2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},O2=function(t,n,r){if(Ls(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll($c));return n&&To.call(t,$c)&&o.unshift(t),o=o.filter(r),o},N2=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Ls(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,u=e(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{var l=To.call(i,$c);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),f=!Ls(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&f){var p=e(d===!0?i.children:d.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:i,candidates:p})}else s.unshift.apply(s,i.children)}}return o},Kp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Yp=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||C2(t))&&!Kp(t)?0:t.tabIndex},I2=function(t,n){var r=Yp(t);return r<0&&n&&!Kp(t)?0:r},k2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Xp=function(t){return t.tagName==="INPUT"},B2=function(t){return Xp(t)&&t.type==="hidden"},M2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},L2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},R2=function(t){if(!t.name)return!0;var n=t.form||Ms(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=L2(o,t.form);return!s||s===t},D2=function(t){return Xp(t)&&t.type==="radio"},F2=function(t){return D2(t)&&!R2(t)},j2=function(t){var n,r=t&&Ms(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var u,l,d;r=Ms(o),o=(u=r)===null||u===void 0?void 0:u.host,s=!!((l=o)!==null&&l!==void 0&&(d=l.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return s},Qp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},_2=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=To.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(To.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var a=t.parentElement,u=Ms(t);if(a&&!a.shadowRoot&&o(a)===!0)return Qp(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(j2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Qp(t);return!1},U2=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return To.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},z2=function(t,n){return!(n.disabled||Ls(n)||B2(n)||_2(n,t)||M2(n)||U2(n))},Jp=function(t,n){return!(F2(n)||Yp(n)<0||!z2(t,n))},H2=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},W2=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=I2(c,i),u=i?e(o.candidates):c;a===0?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:u})}),r.sort(k2).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},eh=function(t,n){n=n||{};var r;return n.getShadowRoot?r=N2([t],n.includeContainer,{filter:Jp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:H2}):r=O2(t,n.includeContainer,Jp.bind(null,n)),W2(r)};function th(e,t,n){let{reference:r,floating:o}=e;const s=un(t),i=Sc(t),c=Ec(i),a=xn(t),u=s==="y",l=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:l,y:r.y-o.height};break;case"bottom":p={x:l,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Er(t)){case"start":p[i]-=f*(n&&u?-1:1);break;case"end":p[i]+=f*(n&&u?-1:1);break}return p}const V2=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:d}=th(u,r,a),f=r,p={},h=0;for(let m=0;m<c.length;m++){const{name:w,fn:T}=c[m],{x:y,y:A,data:M,reset:L}=await T({x:l,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:u,platform:i,elements:{reference:e,floating:t}});l=y??l,d=A??d,p={...p,[w]:{...p[w],...M}},L&&h<=50&&(h++,typeof L=="object"&&(L.placement&&(f=L.placement),L.rects&&(u=L.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:l,y:d}=th(u,f,a)),m=-1)}return{x:l,y:d,placement:f,strategy:o,middlewareData:p}};async function Rs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=Hn(t,e),h=qp(p),w=c[f?d==="floating"?"reference":"floating":d],T=Bs(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:l,strategy:a})),y=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),M=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},L=Bs(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:A,strategy:a}):y);return{top:(T.top-L.top+h.top)/M.y,bottom:(L.bottom-T.bottom+h.bottom)/M.y,left:(T.left-L.left+h.left)/M.x,right:(L.right-T.right+h.right)/M.x}}const G2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:u,padding:l=0}=Hn(e,t)||{};if(u==null)return{};const d=qp(l),f={x:n,y:r},p=Sc(o),h=Ec(p),m=await i.getDimensions(u),w=p==="y",T=w?"top":"left",y=w?"bottom":"right",A=w?"clientHeight":"clientWidth",M=s.reference[h]+s.reference[p]-f[p]-s.floating[h],L=f[p]-s.reference[p],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=F?F[A]:0;(!j||!await(i.isElement==null?void 0:i.isElement(F)))&&(j=c.floating[A]||s.floating[h]);const g=M/2-L/2,v=j/2-m[h]/2-1,$=cn(d[T],v),I=cn(d[y],v),N=$,P=j-m[h]-I,S=j/2-m[h]/2+g,E=xc(N,S,P),C=!a.arrow&&Er(o)!=null&&S!==E&&s.reference[h]/2-(S<N?$:I)-m[h]/2<0,O=C?S<N?S-N:S-P:0;return{[p]:f[p]+O,data:{[p]:E,centerOffset:S-E-O,...C&&{alignmentOffset:O}},reset:C}}}),q2=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...w}=Hn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const T=xn(o),y=un(c),A=xn(c)===c,M=await(a.isRTL==null?void 0:a.isRTL(u.floating)),L=f||(A||!m?[ks(c)]:x2(c)),F=h!=="none";!f&&F&&L.push(...$2(c,m,h,M));const j=[c,...L],g=await Rs(t,w),v=[];let $=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&v.push(g[T]),d){const S=v2(o,i,M);v.push(g[S[0]],g[S[1]])}if($=[...$,{placement:o,overflows:v}],!v.every(S=>S<=0)){var I,N;const S=(((I=s.flip)==null?void 0:I.index)||0)+1,E=j[S];if(E&&(!(d==="alignment"?y!==un(E):!1)||$.every(b=>un(b.placement)===y?b.overflows[0]>0:!0)))return{data:{index:S,overflows:$},reset:{placement:E}};let C=(N=$.filter(O=>O.overflows[0]<=0).sort((O,b)=>O.overflows[1]-b.overflows[1])[0])==null?void 0:N.placement;if(!C)switch(p){case"bestFit":{var P;const O=(P=$.filter(b=>{if(F){const k=un(b.placement);return k===y||k==="y"}return!0}).map(b=>[b.placement,b.overflows.filter(k=>k>0).reduce((k,D)=>k+D,0)]).sort((b,k)=>b[1]-k[1])[0])==null?void 0:P[0];O&&(C=O);break}case"initialPlacement":C=c;break}if(o!==C)return{reset:{placement:C}}}return{}}}},Z2=new Set(["left","top"]);async function K2(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=xn(n),c=Er(n),a=un(n)==="y",u=Z2.has(i)?-1:1,l=s&&a?-1:1,d=Hn(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof h=="number"&&(p=c==="end"?h*-1:h),a?{x:p*l,y:f*u}:{x:f*u,y:p*l}}const Y2=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await K2(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},X2=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:T,y}=w;return{x:T,y}}},...a}=Hn(e,t),u={x:n,y:r},l=await Rs(t,a),d=un(xn(o)),f=Wp(d);let p=u[f],h=u[d];if(s){const w=f==="y"?"top":"left",T=f==="y"?"bottom":"right",y=p+l[w],A=p-l[T];p=xc(y,p,A)}if(i){const w=d==="y"?"top":"left",T=d==="y"?"bottom":"right",y=h+l[w],A=h-l[T];h=xc(y,h,A)}const m=c.fn({...t,[f]:p,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:s,[d]:i}}}}}},Q2=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...u}=Hn(e,t),l=await Rs(t,u),d=xn(o),f=Er(o),p=un(o)==="y",{width:h,height:m}=s.floating;let w,T;d==="top"||d==="bottom"?(w=d,T=f===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(T=d,w=f==="end"?"top":"bottom");const y=m-l.top-l.bottom,A=h-l.left-l.right,M=cn(m-l[w],y),L=cn(h-l[T],A),F=!t.middlewareData.shift;let j=M,g=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=A),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=y),F&&!f){const $=Be(l.left,0),I=Be(l.right,0),N=Be(l.top,0),P=Be(l.bottom,0);p?g=h-2*($!==0||I!==0?$+I:Be(l.left,l.right)):j=m-2*(N!==0||P!==0?N+P:Be(l.top,l.bottom))}await a({...t,availableWidth:g,availableHeight:j});const v=await i.getDimensions(c.floating);return h!==v.width||m!==v.height?{reset:{rects:!0}}:{}}}};function nh(e){const t=ft(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Fe(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Ao(n)!==s||Ao(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Ac(e){return pe(e)?e:e.contextElement}function Sr(e){const t=Ac(e);if(!Fe(t))return Dt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=nh(t);let i=(s?Ao(n.width):n.width)/r,c=(s?Ao(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const J2=Dt(0);function rh(e){const t=Ve(e);return!Os()||!t.visualViewport?J2:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function e6(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ve(e)?!1:t}function Wn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ac(e);let i=Dt(1);t&&(r?pe(r)&&(i=Sr(r)):i=Sr(e));const c=e6(s,n,r)?rh(s):Dt(0);let a=(o.left+c.x)/i.x,u=(o.top+c.y)/i.y,l=o.width/i.x,d=o.height/i.y;if(s){const f=Ve(s),p=r&&pe(r)?Ve(r):r;let h=f,m=vc(h);for(;m&&r&&p!==h;){const w=Sr(m),T=m.getBoundingClientRect(),y=ft(m),A=T.left+(m.clientLeft+parseFloat(y.paddingLeft))*w.x,M=T.top+(m.clientTop+parseFloat(y.paddingTop))*w.y;a*=w.x,u*=w.y,l*=w.x,d*=w.y,a+=A,u+=M,h=Ve(m),m=vc(h)}}return Bs({width:l,height:d,x:a,y:u})}function Ds(e,t){const n=Ns(e).scrollLeft;return t?t.left+n:Wn(Rt(e)).left+n}function oh(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ds(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function t6(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Rt(r),c=t?Cs(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Dt(1);const l=Dt(0),d=Fe(r);if((d||!d&&!s)&&((xr(r)!=="body"||$o(i))&&(a=Ns(r)),Fe(r))){const p=Wn(r);u=Sr(r),l.x=p.x+r.clientLeft,l.y=p.y+r.clientTop}const f=i&&!d&&!s?oh(i,a):Dt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+f.x,y:n.y*u.y-a.scrollTop*u.y+l.y+f.y}}function n6(e){return Array.from(e.getClientRects())}function r6(e){const t=Rt(e),n=Ns(e),r=e.ownerDocument.body,o=Be(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Be(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ds(e);const c=-n.scrollTop;return ft(r).direction==="rtl"&&(i+=Be(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const sh=25;function o6(e,t){const n=Ve(e),r=Rt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const l=Os();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Ds(r);if(u<=0){const l=r.ownerDocument,d=l.body,f=getComputedStyle(d),p=l.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,h=Math.abs(r.clientWidth-d.clientWidth-p);h<=sh&&(s-=h)}else u<=sh&&(s+=u);return{width:s,height:i,x:c,y:a}}const s6=new Set(["absolute","fixed"]);function i6(e,t){const n=Wn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Fe(e)?Sr(e):Dt(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,u=r*s.y;return{width:i,height:c,x:a,y:u}}function ih(e,t,n){let r;if(t==="viewport")r=o6(e,n);else if(t==="document")r=r6(Rt(e));else if(pe(t))r=i6(t,n);else{const o=rh(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Bs(r)}function ah(e,t){const n=an(e);return n===t||!pe(n)||sn(n)?!1:ft(n).position==="fixed"||ah(n,t)}function a6(e,t){const n=t.get(e);if(n)return n;let r=vn(e,[],!1).filter(c=>pe(c)&&xr(c)!=="body"),o=null;const s=ft(e).position==="fixed";let i=s?an(e):e;for(;pe(i)&&!sn(i);){const c=ft(i),a=wc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&s6.has(o.position)||$o(i)&&!a&&ah(e,i))?r=r.filter(l=>l!==i):o=c,i=an(i)}return t.set(e,r),r}function c6(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Cs(t)?[]:a6(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const d=ih(t,l,o);return u.top=Be(d.top,u.top),u.right=cn(d.right,u.right),u.bottom=cn(d.bottom,u.bottom),u.left=Be(d.left,u.left),u},ih(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function u6(e){const{width:t,height:n}=nh(e);return{width:t,height:n}}function l6(e,t,n){const r=Fe(t),o=Rt(t),s=n==="fixed",i=Wn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Dt(0);function u(){a.x=Ds(o)}if(r||!r&&!s)if((xr(t)!=="body"||$o(o))&&(c=Ns(t)),r){const p=Wn(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?oh(o,c):Dt(0),d=i.left+c.scrollLeft-a.x-l.x,f=i.top+c.scrollTop-a.y-l.y;return{x:d,y:f,width:i.width,height:i.height}}function Tc(e){return ft(e).position==="static"}function ch(e,t){if(!Fe(e)||ft(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function uh(e,t){const n=Ve(e);if(Cs(e))return n;if(!Fe(e)){let o=an(e);for(;o&&!sn(o);){if(pe(o)&&!Tc(o))return o;o=an(o)}return n}let r=ch(e,t);for(;r&&u2(r)&&Tc(r);)r=ch(r,t);return r&&sn(r)&&Tc(r)&&!wc(r)?n:r||h2(e)||n}const f6=async function(e){const t=this.getOffsetParent||uh,n=this.getDimensions,r=await n(e.floating);return{reference:l6(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function d6(e){return ft(e).direction==="rtl"}const p6={convertOffsetParentRelativeRectToViewportRelativeRect:t6,getDocumentElement:Rt,getClippingRect:c6,getOffsetParent:uh,getElementRects:f6,getClientRects:n6,getDimensions:u6,getScale:Sr,isElement:pe,isRTL:d6};function lh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function h6(e,t){let n=null,r;const o=Rt(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=e.getBoundingClientRect(),{left:l,top:d,width:f,height:p}=u;if(c||t(),!f||!p)return;const h=Is(d),m=Is(o.clientWidth-(l+f)),w=Is(o.clientHeight-(d+p)),T=Is(l),A={rootMargin:-h+"px "+-m+"px "+-w+"px "+-T+"px",threshold:Be(0,cn(1,a))||1};let M=!0;function L(F){const j=F[0].intersectionRatio;if(j!==a){if(!M)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!lh(u,e.getBoundingClientRect())&&i(),M=!1}try{n=new IntersectionObserver(L,{...A,root:o.ownerDocument})}catch{n=new IntersectionObserver(L,A)}n.observe(e)}return i(!0),s}function fh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Ac(e),l=o||s?[...u?vn(u):[],...vn(t)]:[];l.forEach(T=>{o&&T.addEventListener("scroll",n,{passive:!0}),s&&T.addEventListener("resize",n)});const d=u&&c?h6(u,n):null;let f=-1,p=null;i&&(p=new ResizeObserver(T=>{let[y]=T;y&&y.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var A;(A=p)==null||A.observe(t)})),n()}),u&&!a&&p.observe(u),p.observe(t));let h,m=a?Wn(e):null;a&&w();function w(){const T=Wn(e);m&&!lh(m,T)&&n(),m=T,h=requestAnimationFrame(w)}return n(),()=>{var T;l.forEach(y=>{o&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),d==null||d(),(T=p)==null||T.disconnect(),p=null,a&&cancelAnimationFrame(h)}}const Cc=Rs,m6=Y2,g6=X2,b6=q2,y6=Q2,dh=G2,w6=(e,t,n)=>{const r=new Map,o={platform:p6,...n},s={...o.platform,_c:r};return V2(e,t,{...o,platform:s})};var v6=typeof document<"u",x6=function(){},Fs=v6?x.useLayoutEffect:x6;function js(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!js(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!js(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function ph(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hh(e,t){const n=ph(e);return Math.round(t*n)/n}function Oc(e){const t=z.useRef(e);return Fs(()=>{t.current=e}),t}function mh(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:u}=e,[l,d]=z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=z.useState(r);js(f,r)||p(r);const[h,m]=z.useState(null),[w,T]=z.useState(null),y=z.useCallback(b=>{b!==F.current&&(F.current=b,m(b))},[]),A=z.useCallback(b=>{b!==j.current&&(j.current=b,T(b))},[]),M=s||h,L=i||w,F=z.useRef(null),j=z.useRef(null),g=z.useRef(l),v=a!=null,$=Oc(a),I=Oc(o),N=Oc(u),P=z.useCallback(()=>{if(!F.current||!j.current)return;const b={placement:t,strategy:n,middleware:f};I.current&&(b.platform=I.current),w6(F.current,j.current,b).then(k=>{const D={...k,isPositioned:N.current!==!1};S.current&&!js(g.current,D)&&(g.current=D,Nr.flushSync(()=>{d(D)}))})},[f,t,n,I,N]);Fs(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,d(b=>({...b,isPositioned:!1})))},[u]);const S=z.useRef(!1);Fs(()=>(S.current=!0,()=>{S.current=!1}),[]),Fs(()=>{if(M&&(F.current=M),L&&(j.current=L),M&&L){if($.current)return $.current(M,L,P);P()}},[M,L,P,$,v]);const E=z.useMemo(()=>({reference:F,floating:j,setReference:y,setFloating:A}),[y,A]),C=z.useMemo(()=>({reference:M,floating:L}),[M,L]),O=z.useMemo(()=>{const b={position:n,left:0,top:0};if(!C.floating)return b;const k=hh(C.floating,l.x),D=hh(C.floating,l.y);return c?{...b,transform:"translate("+k+"px, "+D+"px)",...ph(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:D}},[n,c,C.floating,l.x,l.y]);return z.useMemo(()=>({...l,update:P,refs:E,elements:C,floatingStyles:O}),[l,P,E,C,O])}const E6=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?dh({element:r.current,padding:o}).fn(n):{}:r?dh({element:r,padding:o}).fn(n):{}}}},Nc=(e,t)=>({...m6(e),options:[e,t]}),gh=(e,t)=>({...g6(e),options:[e,t]}),bh=(e,t)=>({...b6(e),options:[e,t]}),S6=(e,t)=>({...y6(e),options:[e,t]}),P6=(e,t)=>({...E6(e),options:[e,t]}),yh={...z},$6=yh.useInsertionEffect||(e=>e());function wh(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return $6(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var Ic=typeof document<"u"?x.useLayoutEffect:x.useEffect;let vh=!1,A6=0;const xh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+A6++;function T6(){const[e,t]=z.useState(()=>vh?xh():void 0);return Ic(()=>{e==null&&t(xh())},[]),z.useEffect(()=>{vh=!0},[]),e}const C6=yh.useId||T6;let Co;process.env.NODE_ENV!=="production"&&(Co=new Set);function O6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Co)!=null&&e.has(o))){var s;(s=Co)==null||s.add(o),console.warn(o)}}function N6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Co)!=null&&e.has(o))){var s;(s=Co)==null||s.add(o),console.error(o)}}function I6(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const k6=z.createContext(null),B6=z.createContext(null),M6=()=>{var e;return((e=z.useContext(k6))==null?void 0:e.id)||null},L6=()=>z.useContext(B6),R6="data-floating-ui-focusable";function D6(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=C6(),s=z.useRef({}),[i]=z.useState(()=>I6()),c=M6()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!pe(p)&&N6("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=z.useState(r.reference),l=wh((p,h,m)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:m,nested:c}),n==null||n(p,h,m)}),d=z.useMemo(()=>({setPositionReference:u}),[]),f=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:f,events:i,floatingId:o,refs:d}),[t,l,f,i,o,d])}function F6(e){e===void 0&&(e={});const{nodeId:t}=e,n=D6({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),l=(o==null?void 0:o.domReference)||s,d=z.useRef(null),f=L6();Ic(()=>{l&&(d.current=l)},[l]);const p=mh({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(A=>{const M=pe(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),contextElement:A}:A;a(M),p.refs.setReference(M)},[p.refs]),m=z.useCallback(A=>{(pe(A)||A===null)&&(d.current=A,i(A)),(pe(p.refs.reference.current)||p.refs.reference.current===null||A!==null&&!pe(A))&&p.refs.setReference(A)},[p.refs]),w=z.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:d}),[p.refs,m,h]),T=z.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),y=z.useMemo(()=>({...p,...r,refs:w,elements:T,nodeId:t}),[p,w,T,t,r]);return Ic(()=>{r.dataRef.current.floatingContext=y;const A=f==null?void 0:f.nodesRef.current.find(M=>M.id===t);A&&(A.context=y)}),z.useMemo(()=>({...p,context:y,refs:w,elements:T}),[p,w,T,y])}const Eh="active",Sh="selected";function kc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Eh]:i,[Sh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[R6]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[Eh,Sh].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var d;(d=r.get(u))==null||d.push(l),i[u]=function(){for(var f,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(f=r.get(u))==null?void 0:f.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function j6(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>kc(c,e,"reference"),t),s=z.useCallback(c=>kc(c,e,"floating"),n),i=z.useCallback(c=>kc(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Ph(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const _6=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:u,...l}=Hn(e,t),{rects:d,elements:{floating:f}}=t,p=n.current[i],h=(u==null?void 0:u.current)||f,m=f.clientTop||h.clientTop,w=f.clientTop!==0,T=h.clientTop!==0,y=f===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||O6('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const A={...t,...await Nc(-p.offsetTop-f.clientTop-d.reference.height/2-p.offsetHeight/2-s).fn(t)},M=await Cc(Ph(A,h.scrollHeight+m+f.clientTop),l),L=await Cc(A,{...l,elementContext:"reference"}),F=Be(0,M.top),j=A.y+F,$=(h.scrollHeight>h.clientHeight?I=>I:Ao)(Be(0,h.scrollHeight+(w&&y||T?m*2:0)-F-Be(0,M.bottom)));if(h.style.maxHeight=$+"px",h.scrollTop=F,o){const I=h.offsetHeight<p.offsetHeight*cn(c,n.current.length)-1||L.top>=-a||L.bottom>=-a;Nr.flushSync(()=>o(I))}return r&&(r.current=await Cc(Ph({...A,y:j},h.offsetHeight+m+f.clientTop),l)),{y:j}}});function U6(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=wh(c),u=z.useRef(!1),l=z.useRef(null),d=z.useRef(null);z.useEffect(()=>{if(!o)return;function p(m){if(m.ctrlKey||!h||s.current==null)return;const w=m.deltaY,T=s.current.top>=-.5,y=s.current.bottom>=-.5,A=h.scrollHeight-h.clientHeight,M=w<0?-1:1,L=w<0?"max":"min";h.scrollHeight<=h.clientHeight||(!T&&w>0||!y&&w<0?(m.preventDefault(),Nr.flushSync(()=>{a(F=>F+Math[L](w,A*M))})):/firefox/i.test(g2())&&(h.scrollTop+=w))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",p),requestAnimationFrame(()=>{l.current=h.scrollTop,s.current!=null&&(d.current={...s.current})}),()=>{l.current=null,d.current=null,h.removeEventListener("wheel",p)}},[o,n,r.floating,s,i,a]);const f=z.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const p=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!p||!u.current)){if(l.current!==null){const h=p.scrollTop-l.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Nr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=p.scrollTop})}}}),[r.floating,a,s,i]);return z.useMemo(()=>o?{floating:f}:{},[o,f])}let Pr=x.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Pr.displayName="FloatingContext";let Bc=x.createContext(null);Bc.displayName="PlacementContext";function z6(e){return x.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function H6(){return x.useContext(Pr).setReference}function W6(){return x.useContext(Pr).getReferenceProps}function V6(){let{getFloatingProps:e,slot:t}=x.useContext(Pr);return x.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function G6(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=x.useContext(Bc),n=x.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);ye(()=>{t==null||t(n??null)},[t,n]);let r=x.useContext(Pr);return x.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let $h=4;function q6({children:e,enabled:t=!0}){let[n,r]=x.useState(null),[o,s]=x.useState(0),i=x.useRef(null),[c,a]=x.useState(null);Z6(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:d=0,offset:f=0,padding:p=0,inner:h}=K6(n,c),[m,w="center"]=l.split(" ");ye(()=>{u&&s(0)},[u]);let{refs:T,floatingStyles:y,context:A}=F6({open:u,placement:m==="selection"?w==="center"?"bottom":`bottom-${w}`:w==="center"?`${m}`:`${m}-${w}`,strategy:"absolute",transform:!1,middleware:[Nc({mainAxis:m==="selection"?0:d,crossAxis:f}),gh({padding:p}),m!=="selection"&&bh({padding:p}),m==="selection"&&h?_6({...h,padding:p,overflowRef:i,offset:o,minItemsVisible:$h,referenceOverflowThreshold:p,onFallbackChange(I){var N,P;if(!I)return;let S=A.elements.floating;if(!S)return;let E=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,C=Math.min($h,S.childElementCount),O=0,b=0;for(let k of(P=(N=A.elements.floating)==null?void 0:N.childNodes)!=null?P:[])if(on(k)){let D=k.offsetTop,U=D+k.clientHeight+E,_=S.scrollTop,H=_+S.clientHeight;if(D>=_&&U<=H)C--;else{b=Math.max(0,Math.min(U,H)-Math.max(D,_)),O=k.clientHeight;break}}C>=1&&s(k=>{let D=O*C-b+E;return k>=D?k:D})}}):null,S6({padding:p,apply({availableWidth:I,availableHeight:N,elements:P}){Object.assign(P.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${N}px)`})}})].filter(Boolean),whileElementsMounted:fh}),[M=m,L=w]=A.placement.split("-");m==="selection"&&(M="selection");let F=x.useMemo(()=>({anchor:[M,L].filter(Boolean).join(" ")}),[M,L]),j=U6(A,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:v}=j6([j]),$=ue(I=>{a(I),T.setFloating(I)});return z.createElement(Bc.Provider,{value:r},z.createElement(Pr.Provider,{value:{setFloating:$,setReference:T.setReference,styles:y,getReferenceProps:g,getFloatingProps:v,slot:F}},e))}function Z6(e){ye(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function K6(e,t){var n,r,o;let s=Mc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Mc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Mc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Mc(e,t,n=void 0){let r=yr(),o=ue((a,u)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!u)return[n,null];let l=Th(a,u);return[l,d=>{let f=Ah(a);{let p=f.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[T,y]of f.entries()){let A=window.getComputedStyle(u).getPropertyValue(y);if(p[T]!==A){p[T]=A,m=!0;break}}if(!m)return;let w=Th(a,u);l!==w&&(d(w),l=w)})}return r.dispose}]}return[n,null]}),s=x.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=x.useState();return ye(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function Ah(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,...Ah(o)]:[r]}return[]}function Th(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function Y6(e,t){let[n,r]=x.useState(t);return!e&&n!==t&&r(t),e?n:t}let Lc=x.createContext(null);Lc.displayName="OpenClosedContext";var $t=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))($t||{});function Rc(){return x.useContext(Lc)}function Ch({value:e,children:t}){return x.createElement(Lc.Provider,{value:e},t)}function X6(e){throw new Error("Unexpected object: "+e)}var ve=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ve||{});function _s(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:X6(e)}}var Oh=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Oh||{});function Nh(e){let t=ue(e),n=x.useRef(!1);x.useEffect(()=>(n.current=!1,()=>{n.current=!0,rp(()=>{n.current&&t()})}),[t])}function Q6(){let e=typeof document>"u";return"useSyncExternalStore"in z?(t=>t.useSyncExternalStore)(z)(()=>()=>{},()=>!1,()=>!e):!1}function Dc(){let e=Q6(),[t,n]=z.useState(Mt.isHandoffComplete);return t&&Mt.isHandoffComplete===!1&&n(!1),z.useEffect(()=>{t!==!0&&n(!0)},[t]),z.useEffect(()=>Mt.handoff(),[]),e?!1:t}let J6=x.createContext(!1);function eS(){return x.useContext(J6)}function tS(e){let t=eS(),n=x.useContext(kh),[r,o]=x.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Mt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return x.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),x.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Ih=x.Fragment,nS=We(function(e,t){let{ownerDocument:n=null,...r}=e,o=x.useRef(null),s=ct(oE(p=>{o.current=p}),t),i=gc(o),c=n??i,a=tS(c),[u]=x.useState(()=>{var p;return Mt.isServer?null:(p=c==null?void 0:c.createElement("div"))!=null?p:null}),l=x.useContext(iS),d=Dc();ye(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),ye(()=>{if(u&&l)return l.register(u)},[l,u]),Nh(()=>{var p;!a||!u||(rc(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a)))});let f=Qe();return d?!a||!u?null:Le.createPortal(f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Ih,name:"Portal"}),u):null});function rS(e,t){let n=ct(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Qe();return r?x.createElement(nS,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Ih,name:"Portal"})}let oS=x.Fragment,kh=x.createContext(null);function sS(e,t){let{target:n,...r}=e,o={ref:ct(t)},s=Qe();return x.createElement(kh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:oS,name:"Popover.Group"}))}let iS=x.createContext(null),aS=We(rS),cS=We(sS),uS=Object.assign(aS,{Group:cS});function lS(){let e=x.useRef(!1);return ye(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Bh(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Lh)!==x.Fragment||x.Children.count(e.children)===1}let Us=x.createContext(null);Us.displayName="TransitionContext";var fS=(e=>(e.Visible="visible",e.Hidden="hidden",e))(fS||{});function dS(){let e=x.useContext(Us);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function pS(){let e=x.useContext(zs);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let zs=x.createContext(null);zs.displayName="NestingContext";function Hs(e){return"children"in e?Hs(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Mh(e,t){let n=Un(e),r=x.useRef([]),o=lS(),s=yr(),i=ue((p,h=yn.Hidden)=>{let m=r.current.findIndex(({el:w})=>w===p);m!==-1&&(at(h,{[yn.Unmount](){r.current.splice(m,1)},[yn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var w;!Hs(r)&&o.current&&((w=n.current)==null||w.call(n))}))}),c=ue(p=>{let h=r.current.find(({el:m})=>m===p);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:p,state:"visible"}),()=>i(p,yn.Unmount)}),a=x.useRef([]),u=x.useRef(Promise.resolve()),l=x.useRef({enter:[],leave:[]}),d=ue((p,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([w])=>w!==p)),t==null||t.chains.current[h].push([p,new Promise(w=>{a.current.push(w)})]),t==null||t.chains.current[h].push([p,new Promise(w=>{Promise.all(l.current[h].map(([T,y])=>y)).then(()=>w())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),f=ue((p,h,m)=>{Promise.all(l.current[h].splice(0).map(([w,T])=>T)).then(()=>{var w;(w=a.current.shift())==null||w()}).then(()=>m(h))});return x.useMemo(()=>({children:r,register:c,unregister:i,onStart:d,onStop:f,wait:u,chains:l}),[c,i,r,d,f,l,u])}let Lh=x.Fragment,Rh=Es.RenderStrategy;function hS(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:d,entered:f,leave:p,leaveFrom:h,leaveTo:m,...w}=e,[T,y]=x.useState(null),A=x.useRef(null),M=Bh(e),L=ct(...M?[A,t,y]:t===null?[]:[t]),F=(n=w.unmount)==null||n?yn.Unmount:yn.Hidden,{show:j,appear:g,initial:v}=dS(),[$,I]=x.useState(j?"visible":"hidden"),N=pS(),{register:P,unregister:S}=N;ye(()=>P(A),[P,A]),ye(()=>{if(F===yn.Hidden&&A.current){if(j&&$!=="visible"){I("visible");return}return at($,{hidden:()=>S(A),visible:()=>P(A)})}},[$,A,P,S,j,F]);let E=Dc();ye(()=>{if(M&&E&&$==="visible"&&A.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[A,$,E,M]);let C=v&&!g,O=g&&j&&v,b=x.useRef(!1),k=Mh(()=>{b.current||(I("hidden"),S(A))},N),D=ue(G=>{b.current=!0;let J=G?"enter":"leave";k.onStart(A,J,ne=>{ne==="enter"?s==null||s():ne==="leave"&&(c==null||c())})}),U=ue(G=>{let J=G?"enter":"leave";b.current=!1,k.onStop(A,J,ne=>{ne==="enter"?i==null||i():ne==="leave"&&(a==null||a())}),J==="leave"&&!Hs(k)&&(I("hidden"),S(A))});x.useEffect(()=>{M&&o||(D(j),U(j))},[j,M,o]);let _=!(!o||!M||!E||C),[,H]=zp(_,T,j,{start:D,end:U}),K=wn({ref:L,className:((r=ec(w.className,O&&u,O&&l,H.enter&&u,H.enter&&H.closed&&l,H.enter&&!H.closed&&d,H.leave&&p,H.leave&&!H.closed&&h,H.leave&&H.closed&&m,!H.transition&&j&&f))==null?void 0:r.trim())||void 0,...Up(H)}),W=0;$==="visible"&&(W|=$t.Open),$==="hidden"&&(W|=$t.Closed),j&&$==="hidden"&&(W|=$t.Opening),!j&&$==="visible"&&(W|=$t.Closing);let Z=Qe();return x.createElement(zs.Provider,{value:k},x.createElement(Ch,{value:W},Z({ourProps:K,theirProps:w,defaultTag:Lh,features:Rh,visible:$==="visible",name:"Transition.Child"})))}function mS(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=x.useRef(null),c=Bh(e),a=ct(...c?[i,t]:t===null?[]:[t]);Dc();let u=Rc();if(n===void 0&&u!==null&&(n=(u&$t.Open)===$t.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,d]=x.useState(n?"visible":"hidden"),f=Mh(()=>{n||d("hidden")}),[p,h]=x.useState(!0),m=x.useRef([n]);ye(()=>{p!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let w=x.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);ye(()=>{n?d("visible"):!Hs(f)&&i.current!==null&&d("hidden")},[n,f]);let T={unmount:o},y=ue(()=>{var L;p&&h(!1),(L=e.beforeEnter)==null||L.call(e)}),A=ue(()=>{var L;p&&h(!1),(L=e.beforeLeave)==null||L.call(e)}),M=Qe();return x.createElement(zs.Provider,{value:f},x.createElement(Us.Provider,{value:w},M({ourProps:{...T,as:x.Fragment,children:x.createElement(Dh,{ref:a,...T,...s,beforeEnter:y,beforeLeave:A})},theirProps:{},defaultTag:x.Fragment,features:Rh,visible:l==="visible",name:"Transition"})))}function gS(e,t){let n=x.useContext(Us)!==null,r=Rc()!==null;return x.createElement(x.Fragment,null,!n&&r?x.createElement(Fc,{ref:t,...e}):x.createElement(Dh,{ref:t,...e}))}let Fc=We(mS),Dh=We(hS),bS=We(gS),yS=Object.assign(Fc,{Child:bS,Root:Fc});function wS(e,t){let n=x.useRef({left:0,top:0});if(ye(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Fh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function jh(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!on(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Fh.test(i)&&(i=i.replace(Fh,"")),i}function vS(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let i=s.getAttribute("aria-label");return typeof i=="string"?i.trim():jh(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return jh(e).trim()}function xS(e){let t=x.useRef(""),n=x.useRef("");return ue(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=vS(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var ES=Object.defineProperty,SS=(e,t,n)=>t in e?ES(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_h=(e,t,n)=>(SS(e,typeof t!="symbol"?t+"":t,n),n),Ie=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ie||{}),Ft=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ft||{}),Ws=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ws||{}),Uh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(Uh||{});function zh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Bp(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let PS={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ve.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ve.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ve.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===ve.Previous){let l=e.activeOptionIndex;if(l!==null){let d=e.options[l].dataRef.current.domRef,f=_s(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(f!==null){let p=e.options[f].dataRef.current.domRef;if(((r=d.current)==null?void 0:r.previousElementSibling)===p.current||((o=p.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:f}}}}else if(t.focus===ve.Next){let l=e.activeOptionIndex;if(l!==null){let d=e.options[l].dataRef.current.domRef,f=_s(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(f!==null){let p=e.options[f].dataRef.current.domRef;if(((s=d.current)==null?void 0:s.nextElementSibling)===p.current||((i=p.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:f}}}}let a=zh(e),u=_s(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});return{...c,...a,activeOptionIndex:u}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ve.Nothing&&(r=_s(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ve.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...zh(e),pendingShouldSort:!1}:e};class jc extends xp{constructor(t){super(t),_h(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return at(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(u=>o(u,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:ac(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:ac(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:ac(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ve.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),_h(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=cc.get(null);this.disposables.add(r.on($p.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new jc({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ve.Nothing},__demoMode:n})}reduce(t,n){return at(n.type,PS,t,n)}}const Hh=x.createContext(null);function _c(e){let t=x.useContext(Hh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Wh),n}return t}function Wh({id:e,__demoMode:t=!1}){let n=x.useMemo(()=>jc.new({id:e,__demoMode:t}),[]);return Nh(()=>n.dispose()),n}let Vs=x.createContext(null);Vs.displayName="ListboxDataContext";function Oo(e){let t=x.useContext(Vs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Oo),n}return t}let $S=x.Fragment;function AS(e,t){let n=x.useId(),r=Ja(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:d=r||!1,horizontal:f=!1,multiple:p=!1,__demoMode:h=!1,...m}=e;const w=f?"horizontal":"vertical";let T=ct(t),y=Hx(s),[A=p?[]:void 0,M]=zx(o,a,y),L=Wh({id:n,__demoMode:h}),F=x.useRef({static:!1,hold:!1}),j=x.useRef(new Map),g=mE(u),v=x.useCallback(_=>at($.mode,{[Ft.Multi]:()=>A.some(H=>g(H,_)),[Ft.Single]:()=>g(A,_)}),[A]),$=x.useMemo(()=>({value:A,disabled:d,invalid:l,mode:p?Ft.Multi:Ft.Single,orientation:w,onChange:M,compare:g,isSelected:v,optionsPropsRef:F,listRef:j}),[A,d,l,p,w,M,g,v,F,j]);ye(()=>{L.state.dataRef.current=$},[$]);let I=lt(L,_=>_.listboxState),N=cc.get(null),P=lt(N,x.useCallback(_=>N.selectors.isTop(_,n),[N,n])),[S,E]=lt(L,_=>[_.buttonElement,_.optionsElement]);zE(P,[S,E],(_,H)=>{L.send({type:Uh.CloseListbox}),kp(H,mc.Loose)||(_.preventDefault(),S==null||S.focus())});let C=x.useMemo(()=>({open:I===Ie.Open,disabled:d,invalid:l,value:A}),[I,d,l,A]),[O,b]=uE({inherit:!0}),k={ref:T},D=x.useCallback(()=>{if(y!==void 0)return M==null?void 0:M(y)},[M,y]),U=Qe();return x.createElement(b,{value:O,props:{htmlFor:S==null?void 0:S.id},slot:{open:I===Ie.Open,disabled:d}},x.createElement(q6,null,x.createElement(Hh.Provider,{value:L},x.createElement(Vs.Provider,{value:$},x.createElement(Ch,{value:at(I,{[Ie.Open]:$t.Open,[Ie.Closed]:$t.Closed})},c!=null&&A!=null&&x.createElement(Kx,{disabled:d,data:{[c]:A},form:i,onReset:D}),U({ourProps:k,theirProps:m,slot:C,defaultTag:$S,name:"Listbox"}))))))}let TS="button";function CS(e,t){let n=x.useId(),r=lp(),o=Oo("Listbox.Button"),s=_c("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=ct(t,H6(),s.actions.setButtonElement),d=W6(),[f,p,h]=lt(s,b=>[b.listboxState,b.buttonElement,b.optionsElement]),m=f===Ie.Open;VE(m,{trigger:p,action:x.useCallback(b=>{if(p!=null&&p.contains(b.target))return As.Ignore;let k=b.target.closest('[role="option"]:not([data-disabled])');return on(k)?As.Select(k):h!=null&&h.contains(b.target)?As.Ignore:As.Close},[p,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let w=ue(b=>{switch(b.key){case Ne.Enter:Wx(b.currentTarget);break;case Ne.Space:case Ne.ArrowDown:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ne.ArrowUp:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),T=ue(b=>{switch(b.key){case Ne.Space:b.preventDefault();break}}),y=ue(b=>{var k;if(b.button===Oh.Left){if(nE(b.currentTarget))return b.preventDefault();s.state.listboxState===Ie.Open?(Le.flushSync(()=>s.actions.closeListbox()),(k=s.state.buttonElement)==null||k.focus({preventScroll:!0})):(b.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),A=x.useRef(null),M=ue(b=>{A.current=b.pointerType,b.pointerType==="mouse"&&y(b)}),L=ue(b=>{A.current!=="mouse"&&y(b)}),F=ue(b=>b.preventDefault()),j=bp([i]),g=sE(),{isFocusVisible:v,focusProps:$}=Nx({autoFocus:a}),{isHovered:I,hoverProps:N}=Ox({isDisabled:c}),{pressed:P,pressProps:S}=Rx({disabled:c}),E=x.useMemo(()=>({open:f===Ie.Open,active:P||f===Ie.Open,disabled:c,invalid:o.invalid,value:o.value,hover:I,focus:v,autofocus:a}),[f,o.value,c,I,v,P,o.invalid,a]),C=lt(s,b=>b.listboxState===Ie.Open),O=sp(d(),{ref:l,id:i,type:GE(e,p),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":C,"aria-labelledby":j,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:w,onKeyUp:T,onKeyPress:F,onPointerDown:M,onClick:L},$,N,S);return Qe()({ourProps:O,theirProps:u,slot:E,defaultTag:TS,name:"Listbox.Button"})}let Vh=x.createContext(!1),OS="div",NS=Es.RenderStrategy|Es.Static;function IS(e,t){let n=x.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=z6(o),[l,d]=x.useState(null);u&&(s=!0);let f=Oo("Listbox.Options"),p=_c("Listbox.Options"),[h,m,w,T]=lt(p,G=>[G.listboxState,G.buttonElement,G.optionsElement,G.__demoMode]),y=gc(m),A=gc(w),M=Rc(),[L,F]=zp(c,l,M!==null?(M&$t.Open)===$t.Open:h===Ie.Open);NE(L,m,p.actions.closeListbox);let j=T?!1:i&&h===Ie.Open;e2(j,A);let g=T?!1:i&&h===Ie.Open;OE(g,{allowed:x.useCallback(()=>[m,w],[m,w])});let v=h!==Ie.Open,$=wS(v,m)?!1:L,I=L&&h===Ie.Closed,N=Y6(I,f.value),P=ue(G=>f.compare(N,G)),S=lt(p,G=>{var J;if(u==null||!((J=u==null?void 0:u.to)!=null&&J.includes("selection")))return null;let ne=G.options.findIndex(le=>P(le.dataRef.current.value));return ne===-1&&(ne=0),ne}),E=(()=>{if(u==null)return;if(S===null)return{...u,inner:void 0};let G=Array.from(f.listRef.current.values());return{...u,inner:{listRef:{current:G},index:S}}})(),[C,O]=G6(E),b=V6(),k=ct(t,u?C:null,p.actions.setOptionsElement,d),D=yr();x.useEffect(()=>{var G;let J=w;J&&h===Ie.Open&&J!==((G=xo(J))==null?void 0:G.activeElement)&&(J==null||J.focus({preventScroll:!0}))},[h,w]);let U=ue(G=>{var J,ne;switch(D.dispose(),G.key){case Ne.Space:if(p.state.searchQuery!=="")return G.preventDefault(),G.stopPropagation(),p.actions.search(G.key);case Ne.Enter:if(G.preventDefault(),G.stopPropagation(),p.state.activeOptionIndex!==null){let{dataRef:le}=p.state.options[p.state.activeOptionIndex];p.actions.onChange(le.current.value)}f.mode===Ft.Single&&(Le.flushSync(()=>p.actions.closeListbox()),(J=p.state.buttonElement)==null||J.focus({preventScroll:!0}));break;case at(f.orientation,{vertical:Ne.ArrowDown,horizontal:Ne.ArrowRight}):return G.preventDefault(),G.stopPropagation(),p.actions.goToOption({focus:ve.Next});case at(f.orientation,{vertical:Ne.ArrowUp,horizontal:Ne.ArrowLeft}):return G.preventDefault(),G.stopPropagation(),p.actions.goToOption({focus:ve.Previous});case Ne.Home:case Ne.PageUp:return G.preventDefault(),G.stopPropagation(),p.actions.goToOption({focus:ve.First});case Ne.End:case Ne.PageDown:return G.preventDefault(),G.stopPropagation(),p.actions.goToOption({focus:ve.Last});case Ne.Escape:G.preventDefault(),G.stopPropagation(),Le.flushSync(()=>p.actions.closeListbox()),(ne=p.state.buttonElement)==null||ne.focus({preventScroll:!0});return;case Ne.Tab:G.preventDefault(),G.stopPropagation(),Le.flushSync(()=>p.actions.closeListbox()),FE(p.state.buttonElement,G.shiftKey?hc.Previous:hc.Next);break;default:G.key.length===1&&(p.actions.search(G.key),D.setTimeout(()=>p.actions.clearSearch(),350));break}}),_=lt(p,G=>{var J;return(J=G.buttonElement)==null?void 0:J.id}),H=x.useMemo(()=>({open:h===Ie.Open}),[h]),K=sp(u?b():{},{id:r,ref:k,"aria-activedescendant":lt(p,p.selectors.activeDescendantId),"aria-multiselectable":f.mode===Ft.Multi?!0:void 0,"aria-labelledby":_,"aria-orientation":f.orientation,onKeyDown:U,role:"listbox",tabIndex:h===Ie.Open?0:void 0,style:{...a.style,...O,"--button-width":bE(m,!0).width},...Up(F)}),W=Qe(),Z=x.useMemo(()=>f.mode===Ft.Multi?f:{...f,isSelected:P},[f,P]);return x.createElement(uS,{enabled:s?e.static||L:!1,ownerDocument:y},x.createElement(Vs.Provider,{value:Z},W({ourProps:K,theirProps:a,slot:H,defaultTag:OS,features:NS,visible:$,name:"Listbox.Options"})))}let kS="div";function BS(e,t){let n=x.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=x.useContext(Vh)===!0,a=Oo("Listbox.Option"),u=_c("Listbox.Option"),l=lt(u,$=>u.selectors.isActive($,r)),d=a.isSelected(s),f=x.useRef(null),p=xS(f),h=Un({disabled:o,value:s,domRef:f,get textValue(){return p()}}),m=ct(t,f,$=>{$?a.listRef.current.set(r,$):a.listRef.current.delete(r)}),w=lt(u,$=>u.selectors.shouldScrollIntoView($,r));ye(()=>{if(w)return Pt().requestAnimationFrame(()=>{var $,I;(I=($=f.current)==null?void 0:$.scrollIntoView)==null||I.call($,{block:"nearest"})})},[w,f]),ye(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let T=ue($=>{var I;if(o)return $.preventDefault();u.actions.onChange(s),a.mode===Ft.Single&&(Le.flushSync(()=>u.actions.closeListbox()),(I=u.state.buttonElement)==null||I.focus({preventScroll:!0}))}),y=ue(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),A=t2(),M=ue($=>A.update($)),L=ue($=>{A.wasMoved($)&&(o||l&&u.state.activationTrigger===Ws.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},Ws.Pointer))}),F=ue($=>{A.wasMoved($)&&(o||l&&u.state.activationTrigger===Ws.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),j=x.useMemo(()=>({active:l,focus:l,selected:d,disabled:o,selectedOption:d&&c}),[l,d,o,c]),g=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:T,onFocus:y,onPointerEnter:M,onMouseEnter:M,onPointerMove:L,onMouseMove:L,onPointerLeave:F,onMouseLeave:F},v=Qe();return!d&&c?null:v({ourProps:g,theirProps:i,slot:j,defaultTag:kS,name:"Listbox.Option"})}let MS=x.Fragment;function LS(e,t){let{options:n,placeholder:r,...o}=e,s={ref:ct(t)},i=Oo("ListboxSelectedOption"),c=x.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Ft.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Qe();return x.createElement(Vh.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:x.createElement(x.Fragment,null,r&&a?r:n)},slot:c,defaultTag:MS,name:"ListboxSelectedOption"}))}let RS=We(AS),DS=We(CS),FS=pE,jS=We(IS),_S=We(BS),US=We(LS),Gs=Object.assign(RS,{Button:DS,Label:FS,Options:jS,Option:_S,SelectedOption:US});const zS=()=>B.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[B.jsx("g",{clipPath:"url(#clip0_active)",children:B.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),B.jsx("defs",{children:B.jsx("clipPath",{id:"clip0_active",children:B.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),HS=()=>B.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[B.jsx("g",{clipPath:"url(#clip0_inactive)",children:B.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),B.jsx("defs",{children:B.jsx("clipPath",{id:"clip0_inactive",children:B.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),No=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return B.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>B.jsx("div",{className:"flex items-center justify-center",children:o>t-e?B.jsx(zS,{}):B.jsx(HS,{})},o))})};class At{}Lo(At,"FAST",3),Lo(At,"Medium",2),Lo(At,"SLOW",1),Lo(At,"NONE",0);const WS=Object.values({MAINNET:1,SEPOLIA:11155111}),Ge=e=>{const t=typeof e=="string"?parseInt(e,10):e;return WS.includes(t)},VS={USDT:!0},Gh=(e,t)=>{const n=typeof e=="string"?parseInt(e,10):e;return n===1||n===11155111?!1:(n===42161||n===421614)&&t?t.toUpperCase()==="ETH"?!1:!VS[t.toUpperCase()]:!0},GS=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,chainPoolBalances:o,className:s="",walletType:i="mpc"})=>{const{t:c}=Ht();return B.jsx("div",{className:`relative ${s}`,children:B.jsx(Gs,{value:t,onChange:n,disabled:r,children:({open:a})=>B.jsxs(B.Fragment,{children:[B.jsxs(Gs.Button,{className:`
126
+ relative w-full h-9 text-text-primary bg-fill-input-primary
77
127
  items-center justify-between flex px-3 rounded-lg
78
- focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
128
+ focus:outline-none
79
129
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
80
- ${s?"ring-2 ring-blue-500":""}
81
- `,children:[O.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Asset"}),O.jsxs("div",{className:"flex items-center",children:[t.iconUrl?O.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):O.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:O.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),O.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),O.jsx(Si,{className:`w-4 h-4 ml-2 text-gray-400 transition-transform duration-200 ${s?"rotate-180":""}`})]})]}),O.jsx(hi,{as:h.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:O.jsx(Je.Options,{className:`
130
+ ${a?"ring-1 ring-white":""}
131
+ `,children:[B.jsx("span",{className:"text-sm leading-[18px] font-medium",children:c("deposit.chain")}),B.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?B.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):B.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:B.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),B.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),B.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${a?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[B.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:B.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),B.jsx("defs",{children:B.jsx("clipPath",{id:"clip0_12919_27745",children:B.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),B.jsx(yS,{as:x.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:B.jsx(Gs.Options,{className:`
82
132
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
83
133
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
84
134
  focus:outline-none
85
- `,children:e.map(c=>O.jsx(Je.Option,{value:c,className:({active:u,selected:i})=>`relative cursor-pointer select-none py-3 px-3 ${i?"bg-fill-btn-secondary":u?"bg-fill-input-secondary":""}`,children:({selected:u,active:i})=>O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center space-x-3",children:[c.iconUrl?O.jsx("img",{src:c.iconUrl,alt:c.token,className:"w-5 h-5 rounded-full"}):O.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:O.jsx("span",{className:"text-xs text-white font-bold",children:c.token.charAt(0)})}),O.jsx("div",{className:"flex flex-col",children:O.jsx("span",{className:`text-sm font-medium ${u||i?"text-text-primary":"text-text-tertiary"}`,children:c.symbol||c.token})})]}),u&&O.jsx(Ci,{className:"w-4 h-4 text-blue-400"})]})},c.tokenAddress))})})]})})}),tf=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o=""})=>(h.useEffect(()=>{console.log("🔗 ChainSelector: selectedChain updated",t)},[t]),O.jsx("div",{className:`relative ${o}`,children:O.jsx(Je,{value:t,onChange:n,disabled:r,children:({open:s})=>O.jsxs(O.Fragment,{children:[O.jsxs(Je.Button,{className:`
86
- relative w-full h-9 text-text-primary bg-fill-input-primary
87
- items-center justify-between flex px-3 rounded-lg
88
- focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
89
- ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
90
- ${s?"ring-2 ring-blue-500":""}
91
- `,children:[O.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Chain"}),O.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?O.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):O.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:O.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),O.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),O.jsx(Si,{className:`w-4 h-4 ml-2 text-gray-400 transition-transform duration-200 ${s?"rotate-180":""}`})]})]}),O.jsx(hi,{as:h.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:O.jsx(Je.Options,{className:`
92
- absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
93
- bg-fill-input-primary border border-line-divider-secondary shadow-lg
94
- focus:outline-none
95
- `,children:e.filter(c=>c.allowDeposit!==!1).map(c=>O.jsx(Je.Option,{value:c,className:({active:u,selected:i})=>`relative cursor-pointer select-none py-3 px-3 ${i?"bg-fill-btn-secondary":u?"bg-fill-input-secondary":""}`,children:({selected:u,active:i})=>O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center space-x-3",children:[c.chainIconUrl?O.jsx("img",{src:c.chainIconUrl,alt:c.chain,className:"w-5 h-5 rounded-full"}):O.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:O.jsx("span",{className:"text-xs text-white font-bold",children:c.chain.charAt(0)})}),O.jsx("div",{className:"flex flex-col",children:O.jsx("span",{className:`text-sm font-medium ${u||i?"text-text-primary":"text-text-tertiary"}`,children:c.chain})})]}),u&&O.jsx(Ci,{className:"w-4 h-4 text-blue-400"})]})},c.chainId))})})]})})})),nf=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o})=>{h.useEffect(()=>{var f;console.log("🔍 MPCChainTokenSelector: Props updated",{curSelectToken:r,currentActiveChain:e==null?void 0:e.chain,availableTokens:((f=e==null?void 0:e.tokenList)==null?void 0:f.length)||0})},[r,e]);const s=h.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),c=f=>{var p;if(console.log("🔗 MPCChainTokenSelector: Chain change triggered",{chain:f.chain,availableTokens:((p=f.tokenList)==null?void 0:p.length)||0}),n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(g=>g.token===r||g.symbol===r)){const g=f.tokenList[0];console.log("🔄 MPCChainTokenSelector: Auto-selecting first token",g.token),o(g.symbol||g.token)}},u=f=>{console.log("🔄 MPCChainTokenSelector: Token change triggered",f.token),o(f.symbol||f.token)},i=h.useMemo(()=>t.map(f=>f),[t]),l=h.useMemo(()=>i.find(f=>f.chainId===e.chainId)||i[0],[i,e.chainId]),a=h.useMemo(()=>s.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[s]),d=h.useMemo(()=>a.find(f=>f.token===r||f.symbol===r)||a[0],[a,r]);return O.jsxs("div",{className:"space-y-4",children:[O.jsx(tf,{chains:i,selectedChain:l,onChainChange:f=>{const p=t.find(m=>m.chainId===f.chainId);p&&c(p)},className:"w-full"}),O.jsx(ef,{tokens:a,selectedToken:d,onTokenChange:u,className:"w-full"})]})};var rf=Object.defineProperty,an=Object.getOwnPropertySymbols,Oi=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable,$i=(e,t,n)=>t in e?rf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ir=(e,t)=>{for(var n in t||(t={}))Oi.call(t,n)&&$i(e,n,t[n]);if(an)for(var n of an(t))Ti.call(t,n)&&$i(e,n,t[n]);return e},sr=(e,t)=>{var n={};for(var r in e)Oi.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&an)for(var r of an(e))t.indexOf(r)<0&&Ti.call(e,r)&&(n[r]=e[r]);return n};/**
135
+ `,children:e.filter(u=>u[i==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(u=>B.jsx(Gs.Option,{value:u,className:({active:l,selected:d})=>`relative cursor-pointer select-none py-3 px-3 ${d?"bg-fill-btn-secondary":l?"bg-fill-input-secondary":""}`,children:({selected:l,active:d})=>B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"flex items-center justify-between",children:[B.jsxs("div",{className:"flex items-center space-x-3",children:[u.chainIconUrl?B.jsx("img",{src:u.chainIconUrl,alt:u.chain,className:"w-5 h-5 rounded-full"}):B.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:B.jsx("span",{className:"text-xs text-white font-bold",children:u.chain.charAt(0)})}),B.jsx("div",{className:"flex flex-col",children:B.jsx("span",{className:`text-sm font-medium ${l||d?"text-text-primary":"text-text-tertiary"}`,children:u.chain})})]}),B.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:B.jsx(No,{className:"w-full justify-between",selectedLevel:Ge(u.chainId)?At.SLOW:At.FAST,maxLevel:3})})]}),o&&Object.keys(o).length>0&&B.jsxs("div",{className:"flex items-center justify-between pl-8 mt-2",children:[B.jsx("div",{className:"text-text-secondary text-xs",children:Ge(u.chainId)?c("withdraw.poolBalance"):c("withdraw.crossChainPoolBalance")}),B.jsxs("div",{className:"text-xs text-text-primary",children:["$",o[+u.chainId]]})]})]})},u.chainId))})})]})})})},qh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,chainPoolBalances:s,walletType:i=Fn,txType:c="deposit"})=>{const a=x.useCallback(w=>c==="withdraw"?i===Fn?w.allowAaWithdraw!==!1:w.allowWithdraw!==!1:i===Fn?w.allowAaDeposit!==!1:w.allowDeposit!==!1,[c,i]),u=x.useMemo(()=>{const w=new Set,T=[];for(const y of t)if(a(y))for(const A of y.tokenList||[]){const M=A.symbol||A.token;!M||!(c!=="withdraw"||A.withdrawEnable===!0&&A.pullOff===!1)||w.has(M)||(w.add(M),T.push({token:M,symbol:M,iconUrl:A.iconUrl,decimals:A.decimals,tokenAddress:A.tokenAddress}))}return T},[t,a,c]),l=w=>{n(w.chainId)},d=w=>{const T=w.symbol||w.token;o(T);const y=[];for(const A of t){if(!a(A))continue;(A.tokenList||[]).some(L=>(L.symbol||L.token)===T)&&y.push(A.chainId)}!y.includes(e.chainId)&&y[0]!==void 0&&n(y[0])},f=x.useMemo(()=>{var y,A;const w=r||((y=u[0])==null?void 0:y.symbol)||((A=u[0])==null?void 0:A.token);if(!w)return[];const T=[];for(const M of t){if(!a(M))continue;const L=(M.tokenList||[]).find(F=>(F.symbol||F.token)===w?c==="withdraw"?F.withdrawEnable===!0&&F.pullOff===!1:!0:!1);L&&T.push({...M,tokenList:[{token:L.token,symbol:L.symbol,iconUrl:L.iconUrl,decimals:L.decimals,tokenAddress:L.tokenAddress}]})}return T},[t,r,u,a,c]),p=x.useMemo(()=>f.find(w=>w.chainId===e.chainId)||f[0],[f,e.chainId]),h=x.useMemo(()=>u,[u]),m=x.useMemo(()=>{if(h.length!==0)return h.find(w=>w.token===r||w.symbol===r)||h[0]},[h,r]);return x.useEffect(()=>{if(h.length===0)return;if(!h.some(T=>(T.symbol||T.token)===r)){const T=h[0];o(T.symbol||T.token)}},[h,r,o]),x.useEffect(()=>{if(f.length===0)return;f.some(T=>T.chainId===e.chainId)||n(f[0].chainId)},[f,e.chainId,n]),B.jsxs("div",{className:"space-y-4",children:[h.length>0&&m&&B.jsx(ix,{tokens:h,selectedToken:m,onTokenChange:d}),B.jsx(GS,{chains:f,selectedChain:p,chainPoolBalances:s,onChainChange:w=>{const T=t.find(y=>y.chainId===w.chainId);T&&l(T)},walletType:i,className:"w-full"})]})};var qs={},qS=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()}},ZS=qS,Zh={"text/plain":"Text","text/html":"Url",default:"Text"},KS="Copy to clipboard: #{key}, Enter";function YS(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function XS(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=ZS(),s=document.createRange(),i=document.getSelection(),c=document.createElement("span"),c.textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=Zh[t.format]||Zh.default;window.clipboardData.setData(d,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");a=!0}catch(l){n&&console.error("unable to copy using execCommand: ",l),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(d){n&&console.error("unable to copy using clipboardData: ",d),n&&console.error("falling back to prompt"),r=YS("message"in t?t.message:KS),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var QS=XS;function Uc(e){"@babel/helpers - typeof";return Uc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uc(e)}Object.defineProperty(qs,"__esModule",{value:!0}),qs.CopyToClipboard=void 0;var Zs=Kh(x),JS=Kh(QS),e5=["text","onCopy","options","children"];function Kh(e){return e&&e.__esModule?e:{default:e}}function Yh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Xh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yh(Object(n),!0).forEach(function(r){Hc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function t5(e,t){if(e==null)return{};var n=n5(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 n5(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 r5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o5(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 s5(e,t,n){return t&&o5(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function i5(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zc(e,t)}function zc(e,t){return zc=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},zc(e,t)}function a5(e){var t=u5();return function(){var r=Ks(e),o;if(t){var s=Ks(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return c5(this,o)}}function c5(e,t){if(t&&(Uc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qh(e)}function Qh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u5(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ks(e){return Ks=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Ks(e)}function Hc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jh=function(e){i5(n,e);var t=a5(n);function n(){var r;r5(this,n);for(var o=arguments.length,s=new Array(o),i=0;i<o;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),Hc(Qh(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,d=a.children,f=a.options,p=Zs.default.Children.only(d),h=(0,JS.default)(u,f);l&&l(u,h),p&&p.props&&typeof p.props.onClick=="function"&&p.props.onClick(c)}),r}return s5(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=t5(o,e5),c=Zs.default.Children.only(s);return Zs.default.cloneElement(c,Xh(Xh({},i),{},{onClick:this.onClick}))}}]),n}(Zs.default.PureComponent);qs.CopyToClipboard=Jh,Hc(Jh,"defaultProps",{onCopy:void 0,options:void 0});var l5=qs,Wc=l5.CopyToClipboard;Wc.CopyToClipboard=Wc;var f5=Wc;const d5=im(f5);var p5=Object.defineProperty,Ys=Object.getOwnPropertySymbols,e0=Object.prototype.hasOwnProperty,t0=Object.prototype.propertyIsEnumerable,n0=(e,t,n)=>t in e?p5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vc=(e,t)=>{for(var n in t||(t={}))e0.call(t,n)&&n0(e,n,t[n]);if(Ys)for(var n of Ys(t))t0.call(t,n)&&n0(e,n,t[n]);return e},Gc=(e,t)=>{var n={};for(var r in e)e0.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ys)for(var r of Ys(e))t.indexOf(r)<0&&t0.call(e,r)&&(n[r]=e[r]);return n};/**
96
136
  * @license QR Code generator library (TypeScript)
97
137
  * Copyright (c) Project Nayuki.
98
138
  * SPDX-License-Identifier: MIT
99
- */var it;(e=>{const t=class Z{constructor(i,l,a,d){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<Z.MIN_VERSION||i>Z.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=i*4+17;let f=[];for(let m=0;m<this.size;m++)f.push(!1);for(let m=0;m<this.size;m++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(a);if(this.drawCodewords(p),d==-1){let m=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const b=this.getPenaltyScore();b<m&&(d=g,m=b),this.applyMask(g)}}o(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(i,l){const a=e.QrSegment.makeSegments(i);return Z.encodeSegments(a,l)}static encodeBinary(i,l){const a=e.QrSegment.makeBytes(i);return Z.encodeSegments([a],l)}static encodeSegments(i,l,a=1,d=40,f=-1,p=!0){if(!(Z.MIN_VERSION<=a&&a<=d&&d<=Z.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let m,g;for(m=a;;m++){const y=Z.getNumDataCodewords(m,l)*8,S=c.getTotalBits(i,m);if(S<=y){g=S;break}if(m>=d)throw new RangeError("Data too long")}for(const y of[Z.Ecc.MEDIUM,Z.Ecc.QUARTILE,Z.Ecc.HIGH])p&&g<=Z.getNumDataCodewords(m,y)*8&&(l=y);let b=[];for(const y of i){n(y.mode.modeBits,4,b),n(y.numChars,y.mode.numCharCountBits(m),b);for(const S of y.getData())b.push(S)}o(b.length==g);const x=Z.getNumDataCodewords(m,l)*8;o(b.length<=x),n(0,Math.min(4,x-b.length),b),n(0,(8-b.length%8)%8,b),o(b.length%8==0);for(let y=236;b.length<x;y^=253)n(y,8,b);let w=[];for(;w.length*8<b.length;)w.push(0);return b.forEach((y,S)=>w[S>>>3]|=y<<7-(S&7)),new Z(m,l,w,f)}getModule(i,l){return 0<=i&&i<this.size&&0<=l&&l<this.size&&this.modules[l][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),l=i.length;for(let a=0;a<l;a++)for(let d=0;d<l;d++)a==0&&d==0||a==0&&d==l-1||a==l-1&&d==0||this.drawAlignmentPattern(i[a],i[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let a=l;for(let f=0;f<10;f++)a=a<<1^(a>>>9)*1335;const d=(l<<10|a)^21522;o(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,r(d,f));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,r(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,r(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,r(d,f));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let a=0;a<12;a++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;o(l>>>18==0);for(let a=0;a<18;a++){const d=r(l,a),f=this.size-11+a%3,p=Math.floor(a/3);this.setFunctionModule(f,p,d),this.setFunctionModule(p,f,d)}}drawFinderPattern(i,l){for(let a=-4;a<=4;a++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(a)),p=i+d,m=l+a;0<=p&&p<this.size&&0<=m&&m<this.size&&this.setFunctionModule(p,m,f!=2&&f!=4)}}drawAlignmentPattern(i,l){for(let a=-2;a<=2;a++)for(let d=-2;d<=2;d++)this.setFunctionModule(i+d,l+a,Math.max(Math.abs(d),Math.abs(a))!=1)}setFunctionModule(i,l,a){this.modules[l][i]=a,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,a=this.errorCorrectionLevel;if(i.length!=Z.getNumDataCodewords(l,a))throw new RangeError("Invalid argument");const d=Z.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][l],f=Z.ECC_CODEWORDS_PER_BLOCK[a.ordinal][l],p=Math.floor(Z.getNumRawDataModules(l)/8),m=d-p%d,g=Math.floor(p/d);let b=[];const x=Z.reedSolomonComputeDivisor(f);for(let y=0,S=0;y<d;y++){let E=i.slice(S,S+g-f+(y<m?0:1));S+=E.length;const F=Z.reedSolomonComputeRemainder(E,x);y<m&&E.push(0),b.push(E.concat(F))}let w=[];for(let y=0;y<b[0].length;y++)b.forEach((S,E)=>{(y!=g-f||E>=m)&&w.push(S[y])});return o(w.length==p),w}drawCodewords(i){if(i.length!=Math.floor(Z.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let a=this.size-1;a>=1;a-=2){a==6&&(a=5);for(let d=0;d<this.size;d++)for(let f=0;f<2;f++){const p=a-f,g=(a+1&2)==0?this.size-1-d:d;!this.isFunction[g][p]&&l<i.length*8&&(this.modules[g][p]=r(i[l>>>3],7-(l&7)),l++)}}o(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let a=0;a<this.size;a++){let d;switch(i){case 0:d=(a+l)%2==0;break;case 1:d=l%2==0;break;case 2:d=a%3==0;break;case 3:d=(a+l)%3==0;break;case 4:d=(Math.floor(a/3)+Math.floor(l/2))%2==0;break;case 5:d=a*l%2+a*l%3==0;break;case 6:d=(a*l%2+a*l%3)%2==0;break;case 7:d=((a+l)%2+a*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][a]&&d&&(this.modules[l][a]=!this.modules[l][a])}}getPenaltyScore(){let i=0;for(let f=0;f<this.size;f++){let p=!1,m=0,g=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[f][b]==p?(m++,m==5?i+=Z.PENALTY_N1:m>5&&i++):(this.finderPenaltyAddHistory(m,g),p||(i+=this.finderPenaltyCountPatterns(g)*Z.PENALTY_N3),p=this.modules[f][b],m=1);i+=this.finderPenaltyTerminateAndCount(p,m,g)*Z.PENALTY_N3}for(let f=0;f<this.size;f++){let p=!1,m=0,g=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[b][f]==p?(m++,m==5?i+=Z.PENALTY_N1:m>5&&i++):(this.finderPenaltyAddHistory(m,g),p||(i+=this.finderPenaltyCountPatterns(g)*Z.PENALTY_N3),p=this.modules[b][f],m=1);i+=this.finderPenaltyTerminateAndCount(p,m,g)*Z.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let p=0;p<this.size-1;p++){const m=this.modules[f][p];m==this.modules[f][p+1]&&m==this.modules[f+1][p]&&m==this.modules[f+1][p+1]&&(i+=Z.PENALTY_N2)}let l=0;for(const f of this.modules)l=f.reduce((p,m)=>p+(m?1:0),l);const a=this.size*this.size,d=Math.ceil(Math.abs(l*20-a*10)/a)-1;return o(0<=d&&d<=9),i+=d*Z.PENALTY_N4,o(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let a=[6];for(let d=this.size-7;a.length<i;d-=l)a.splice(1,0,d);return a}}static getNumRawDataModules(i){if(i<Z.MIN_VERSION||i>Z.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const a=Math.floor(i/7)+2;l-=(25*a-10)*a-55,i>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(Z.getNumRawDataModules(i)/8)-Z.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*Z.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let l=[];for(let d=0;d<i-1;d++)l.push(0);l.push(1);let a=1;for(let d=0;d<i;d++){for(let f=0;f<l.length;f++)l[f]=Z.reedSolomonMultiply(l[f],a),f+1<l.length&&(l[f]^=l[f+1]);a=Z.reedSolomonMultiply(a,2)}return l}static reedSolomonComputeRemainder(i,l){let a=l.map(d=>0);for(const d of i){const f=d^a.shift();a.push(0),l.forEach((p,m)=>a[m]^=Z.reedSolomonMultiply(p,f))}return a}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let a=0;for(let d=7;d>=0;d--)a=a<<1^(a>>>7)*285,a^=(l>>>d&1)*i;return o(a>>>8==0),a}finderPenaltyCountPatterns(i){const l=i[1];o(l<=this.size*3);const a=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(a&&i[0]>=l*4&&i[6]>=l?1:0)+(a&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,a){return i&&(this.finderPenaltyAddHistory(l,a),l=0),l+=this.size,this.finderPenaltyAddHistory(l,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(i,l){l[0]==0&&(i+=this.size),l.pop(),l.unshift(i)}};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,i,l){if(i<0||i>31||u>>>i)throw new RangeError("Value out of range");for(let a=i-1;a>=0;a--)l.push(u>>>a&1)}function r(u,i){return(u>>>i&1)!=0}function o(u){if(!u)throw new Error("Assertion error")}const s=class de{constructor(i,l,a){if(this.mode=i,this.numChars=l,this.bitData=a,l<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}static makeBytes(i){let l=[];for(const a of i)n(a,8,l);return new de(de.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!de.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];for(let a=0;a<i.length;){const d=Math.min(i.length-a,3);n(parseInt(i.substring(a,a+d),10),d*3+1,l),a+=d}return new de(de.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!de.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],a;for(a=0;a+2<=i.length;a+=2){let d=de.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a))*45;d+=de.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a+1)),n(d,11,l)}return a<i.length&&n(de.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a)),6,l),new de(de.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:de.isNumeric(i)?[de.makeNumeric(i)]:de.isAlphanumeric(i)?[de.makeAlphanumeric(i)]:[de.makeBytes(de.toUtf8ByteArray(i))]}static makeEci(i){let l=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)n(i,8,l);else if(i<16384)n(2,2,l),n(i,14,l);else if(i<1e6)n(6,3,l),n(i,21,l);else throw new RangeError("ECI assignment value out of range");return new de(de.Mode.ECI,0,l)}static isNumeric(i){return de.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return de.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let a=0;for(const d of i){const f=d.mode.numCharCountBits(l);if(d.numChars>=1<<f)return 1/0;a+=4+f+d.bitData.length}return a}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let a=0;a<i.length;a++)i.charAt(a)!="%"?l.push(i.charCodeAt(a)):(l.push(parseInt(i.substring(a+1,a+3),16)),a+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let c=s;e.QrSegment=s})(it||(it={})),(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={}))})(it||(it={})),(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={}))})(it||(it={}));var vt=it;/**
139
+ */var Vn;(e=>{const t=class ae{constructor(a,u,l,d){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<ae.MIN_VERSION||a>ae.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let f=[];for(let h=0;h<this.size;h++)f.push(!1);for(let h=0;h<this.size;h++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(l);if(this.drawCodewords(p),d==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const w=this.getPenaltyScore();w<h&&(d=m,h=w),this.applyMask(m)}}o(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(a,u){const l=e.QrSegment.makeSegments(a);return ae.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return ae.encodeSegments([l],u)}static encodeSegments(a,u,l=1,d=40,f=-1,p=!0){if(!(ae.MIN_VERSION<=l&&l<=d&&d<=ae.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const A=ae.getNumDataCodewords(h,u)*8,M=i.getTotalBits(a,h);if(M<=A){m=M;break}if(h>=d)throw new RangeError("Data too long")}for(const A of[ae.Ecc.MEDIUM,ae.Ecc.QUARTILE,ae.Ecc.HIGH])p&&m<=ae.getNumDataCodewords(h,A)*8&&(u=A);let w=[];for(const A of a){n(A.mode.modeBits,4,w),n(A.numChars,A.mode.numCharCountBits(h),w);for(const M of A.getData())w.push(M)}o(w.length==m);const T=ae.getNumDataCodewords(h,u)*8;o(w.length<=T),n(0,Math.min(4,T-w.length),w),n(0,(8-w.length%8)%8,w),o(w.length%8==0);for(let A=236;w.length<T;A^=253)n(A,8,w);let y=[];for(;y.length*8<w.length;)y.push(0);return w.forEach((A,M)=>y[M>>>3]|=A<<7-(M&7)),new ae(h,u,y,f)}getModule(a,u){return 0<=a&&a<this.size&&0<=u&&u<this.size&&this.modules[u][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),u=a.length;for(let l=0;l<u;l++)for(let d=0;d<u;d++)l==0&&d==0||l==0&&d==u-1||l==u-1&&d==0||this.drawAlignmentPattern(a[l],a[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let l=u;for(let f=0;f<10;f++)l=l<<1^(l>>>9)*1335;const d=(u<<10|l)^21522;o(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,r(d,f));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,r(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,r(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,r(d,f));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let l=0;l<12;l++)a=a<<1^(a>>>11)*7973;const u=this.version<<12|a;o(u>>>18==0);for(let l=0;l<18;l++){const d=r(u,l),f=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(f,p,d),this.setFunctionModule(p,f,d)}}drawFinderPattern(a,u){for(let l=-4;l<=4;l++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(l)),p=a+d,h=u+l;0<=p&&p<this.size&&0<=h&&h<this.size&&this.setFunctionModule(p,h,f!=2&&f!=4)}}drawAlignmentPattern(a,u){for(let l=-2;l<=2;l++)for(let d=-2;d<=2;d++)this.setFunctionModule(a+d,u+l,Math.max(Math.abs(d),Math.abs(l))!=1)}setFunctionModule(a,u,l){this.modules[u][a]=l,this.isFunction[u][a]=!0}addEccAndInterleave(a){const u=this.version,l=this.errorCorrectionLevel;if(a.length!=ae.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const d=ae.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],f=ae.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],p=Math.floor(ae.getNumRawDataModules(u)/8),h=d-p%d,m=Math.floor(p/d);let w=[];const T=ae.reedSolomonComputeDivisor(f);for(let A=0,M=0;A<d;A++){let L=a.slice(M,M+m-f+(A<h?0:1));M+=L.length;const F=ae.reedSolomonComputeRemainder(L,T);A<h&&L.push(0),w.push(L.concat(F))}let y=[];for(let A=0;A<w[0].length;A++)w.forEach((M,L)=>{(A!=m-f||L>=h)&&y.push(M[A])});return o(y.length==p),y}drawCodewords(a){if(a.length!=Math.floor(ae.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let d=0;d<this.size;d++)for(let f=0;f<2;f++){const p=l-f,m=(l+1&2)==0?this.size-1-d:d;!this.isFunction[m][p]&&u<a.length*8&&(this.modules[m][p]=r(a[u>>>3],7-(u&7)),u++)}}o(u==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let l=0;l<this.size;l++){let d;switch(a){case 0:d=(l+u)%2==0;break;case 1:d=u%2==0;break;case 2:d=l%3==0;break;case 3:d=(l+u)%3==0;break;case 4:d=(Math.floor(l/3)+Math.floor(u/2))%2==0;break;case 5:d=l*u%2+l*u%3==0;break;case 6:d=(l*u%2+l*u%3)%2==0;break;case 7:d=((l+u)%2+l*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][l]&&d&&(this.modules[u][l]=!this.modules[u][l])}}getPenaltyScore(){let a=0;for(let f=0;f<this.size;f++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[f][w]==p?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*ae.PENALTY_N3),p=this.modules[f][w],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*ae.PENALTY_N3}for(let f=0;f<this.size;f++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][f]==p?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*ae.PENALTY_N3),p=this.modules[w][f],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*ae.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let p=0;p<this.size-1;p++){const h=this.modules[f][p];h==this.modules[f][p+1]&&h==this.modules[f+1][p]&&h==this.modules[f+1][p+1]&&(a+=ae.PENALTY_N2)}let u=0;for(const f of this.modules)u=f.reduce((p,h)=>p+(h?1:0),u);const l=this.size*this.size,d=Math.ceil(Math.abs(u*20-l*10)/l)-1;return o(0<=d&&d<=9),a+=d*ae.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let l=[6];for(let d=this.size-7;l.length<a;d-=u)l.splice(1,0,d);return l}}static getNumRawDataModules(a){if(a<ae.MIN_VERSION||a>ae.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*a+128)*a+64;if(a>=2){const l=Math.floor(a/7)+2;u-=(25*l-10)*l-55,a>=7&&(u-=36)}return o(208<=u&&u<=29648),u}static getNumDataCodewords(a,u){return Math.floor(ae.getNumRawDataModules(a)/8)-ae.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*ae.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let u=[];for(let d=0;d<a-1;d++)u.push(0);u.push(1);let l=1;for(let d=0;d<a;d++){for(let f=0;f<u.length;f++)u[f]=ae.reedSolomonMultiply(u[f],l),f+1<u.length&&(u[f]^=u[f+1]);l=ae.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(a,u){let l=u.map(d=>0);for(const d of a){const f=d^l.shift();l.push(0),u.forEach((p,h)=>l[h]^=ae.reedSolomonMultiply(p,f))}return l}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let d=7;d>=0;d--)l=l<<1^(l>>>7)*285,l^=(u>>>d&1)*a;return o(l>>>8==0),l}finderPenaltyCountPatterns(a){const u=a[1];o(u<=this.size*3);const l=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(l&&a[0]>=u*4&&a[6]>=u?1:0)+(l&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,l){return a&&(this.finderPenaltyAddHistory(u,l),u=0),u+=this.size,this.finderPenaltyAddHistory(u,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(c,a,u){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let l=a-1;l>=0;l--)u.push(c>>>l&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class Ee{constructor(a,u,l){if(this.mode=a,this.numChars=u,this.bitData=l,u<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(a){let u=[];for(const l of a)n(l,8,u);return new Ee(Ee.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!Ee.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<a.length;){const d=Math.min(a.length-l,3);n(parseInt(a.substring(l,l+d),10),d*3+1,u),l+=d}return new Ee(Ee.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!Ee.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],l;for(l=0;l+2<=a.length;l+=2){let d=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;d+=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(d,11,u)}return l<a.length&&n(Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new Ee(Ee.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:Ee.isNumeric(a)?[Ee.makeNumeric(a)]:Ee.isAlphanumeric(a)?[Ee.makeAlphanumeric(a)]:[Ee.makeBytes(Ee.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,u);else if(a<16384)n(2,2,u),n(a,14,u);else if(a<1e6)n(6,3,u),n(a,21,u);else throw new RangeError("ECI assignment value out of range");return new Ee(Ee.Mode.ECI,0,u)}static isNumeric(a){return Ee.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Ee.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const d of a){const f=d.mode.numCharCountBits(u);if(d.numChars>=1<<f)return 1/0;l+=4+f+d.bitData.length}return l}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let l=0;l<a.length;l++)a.charAt(l)!="%"?u.push(a.charCodeAt(l)):(u.push(parseInt(a.substring(l+1,l+3),16)),l+=2);return u}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(Vn||(Vn={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(Vn||(Vn={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(Vn||(Vn={}));var $r=Vn;/**
100
140
  * @license qrcode.react
101
141
  * Copyright (c) Paul O'Shannessy
102
142
  * SPDX-License-Identifier: ISC
103
- */var of={L:vt.QrCode.Ecc.LOW,M:vt.QrCode.Ecc.MEDIUM,Q:vt.QrCode.Ecc.QUARTILE,H:vt.QrCode.Ecc.HIGH},Pi=128,Ai="L",Mi="#FFFFFF",_i="#000000",Li=!1,Di=1,sf=4,lf=0,af=.1;function Fi(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(c,u){if(!c&&s!==null){n.push(`M${s+t} ${o+t}h${u-s}v1H${s+t}z`),s=null;return}if(u===r.length-1){if(!c)return;s===null?n.push(`M${u+t},${o+t} h1v1H${u+t}z`):n.push(`M${s+t},${o+t} h${u+1-s}v1H${s+t}z`);return}c&&s===null&&(s=u)})}),n.join("")}function Ii(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 uf(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*af),c=o/t,u=(r.width||s)*c,i=(r.height||s)*c,l=r.x==null?e.length/2-u/2:r.x*c,a=r.y==null?e.length/2-i/2:r.y*c,d=r.opacity==null?1:r.opacity;let f=null;if(r.excavate){let m=Math.floor(l),g=Math.floor(a),b=Math.ceil(u+l-m),x=Math.ceil(i+a-g);f={x:m,y:g,w:b,h:x}}const p=r.crossOrigin;return{x:l,y:a,h:i,w:u,excavation:f,opacity:d,crossOrigin:p}}function cf(e,t){return t!=null?Math.max(Math.floor(t),0):e?sf:lf}function ki({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:c,boostLevel:u}){let i=h.useMemo(()=>{const m=(Array.isArray(e)?e:[e]).reduce((g,b)=>(g.push(...vt.QrSegment.makeSegments(b)),g),[]);return vt.QrCode.encodeSegments(m,of[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:l,margin:a,numCells:d,calculatedImageSettings:f}=h.useMemo(()=>{let p=i.getModules();const m=cf(r,o),g=p.length+m*2,b=uf(p,c,m,s);return{cells:p,margin:m,numCells:g,calculatedImageSettings:b}},[i,c,s,r,o]);return{qrcode:i,margin:a,cells:l,numCells:d,calculatedImageSettings:f}}var ff=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),df=h.forwardRef(function(t,n){const r=t,{value:o,size:s=Pi,level:c=Ai,bgColor:u=Mi,fgColor:i=_i,includeMargin:l=Li,minVersion:a=Di,boostLevel:d,marginSize:f,imageSettings:p}=r,g=sr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:b}=g,x=sr(g,["style"]),w=p==null?void 0:p.src,y=h.useRef(null),S=h.useRef(null),E=h.useCallback(W=>{y.current=W,typeof n=="function"?n(W):n&&(n.current=W)},[n]),[F,j]=h.useState(!1),{margin:K,cells:ee,numCells:L,calculatedImageSettings:N}=ki({value:o,level:c,minVersion:a,boostLevel:d,includeMargin:l,marginSize:f,imageSettings:p,size:s});h.useEffect(()=>{if(y.current!=null){const W=y.current,X=W.getContext("2d");if(!X)return;let G=ee;const J=S.current,P=N!=null&&J!==null&&J.complete&&J.naturalHeight!==0&&J.naturalWidth!==0;P&&N.excavation!=null&&(G=Ii(ee,N.excavation));const U=window.devicePixelRatio||1;W.height=W.width=s*U;const C=s/L*U;X.scale(C,C),X.fillStyle=u,X.fillRect(0,0,L,L),X.fillStyle=i,ff?X.fill(new Path2D(Fi(G,K))):ee.forEach(function(A,k){A.forEach(function(I,B){I&&X.fillRect(B+K,k+K,1,1)})}),N&&(X.globalAlpha=N.opacity),P&&X.drawImage(J,N.x+K,N.y+K,N.w,N.h)}}),h.useEffect(()=>{j(!1)},[w]);const oe=ir({height:s,width:s},b);let H=null;return w!=null&&(H=h.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{j(!0)},ref:S,crossOrigin:N==null?void 0:N.crossOrigin})),h.createElement(h.Fragment,null,h.createElement("canvas",ir({style:oe,height:s,width:s,ref:E,role:"img"},x)),H)});df.displayName="QRCodeCanvas";var Ni=h.forwardRef(function(t,n){const r=t,{value:o,size:s=Pi,level:c=Ai,bgColor:u=Mi,fgColor:i=_i,includeMargin:l=Li,minVersion:a=Di,boostLevel:d,title:f,marginSize:p,imageSettings:m}=r,g=sr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:x,numCells:w,calculatedImageSettings:y}=ki({value:o,level:c,minVersion:a,boostLevel:d,includeMargin:l,marginSize:p,imageSettings:m,size:s});let S=x,E=null;m!=null&&y!=null&&(y.excavation!=null&&(S=Ii(x,y.excavation)),E=h.createElement("image",{href:m.src,height:y.h,width:y.w,x:y.x+b,y:y.y+b,preserveAspectRatio:"none",opacity:y.opacity,crossOrigin:y.crossOrigin}));const F=Fi(S,b);return h.createElement("svg",ir({height:s,width:s,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},g),!!f&&h.createElement("title",null,f),h.createElement("path",{fill:u,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),h.createElement("path",{fill:i,d:F,shapeRendering:"crispEdges"}),E)});Ni.displayName="QRCodeSVG";const pf=({value:e,size:t,level:n,bgColor:r,fgColor:o,includeMargin:s=!0})=>O.jsx(Ni,{value:e,size:t,level:n,bgColor:r,fgColor:o,marginSize:s?4:0}),hf=({text:e,onCopy:t,children:n})=>O.jsx("div",{onClick:()=>{navigator.clipboard.writeText(e).then(t)},style:{cursor:"pointer"},children:n}),mf=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r})=>{var o;return O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"flex justify-center mt-4 mb-3",children:O.jsx("div",{className:"bg-white rounded-lg",children:O.jsx(pf,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",includeMargin:!1})})}),O.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[O.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),O.jsx(hf,{text:(e==null?void 0:e.getDisplayAddress())||"",onCopy:()=>console.log("Copied!"),children:O.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[O.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),O.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),O.jsxs("div",{className:"flex items-start",children:[O.jsx("div",{className:"w-5",children:O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:O.jsx("path",{d:"M8.00016 14.6667C11.6821 14.6667 14.6668 11.6819 14.6668 8C14.6668 4.31809 11.6821 1.33333 8.00016 1.33333C4.31826 1.33333 1.3335 4.31809 1.3335 8C1.3335 11.6819 4.31826 14.6667 8.00016 14.6667Z",fill:"#FF8F34",stroke:"#FF8F34",strokeWidth:"1.33333",strokeLinejoin:"round"})})}),O.jsxs("div",{className:"flex-1",children:[O.jsxs("p",{className:"text-xs text-functional-orange-1",children:["Only ",t," (",n==null?void 0:n.chain,") is supported for deposits to this address."]}),O.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),O.jsx("div",{className:"flex items-start pl-5 pt-2 text-functional-orange-1 text-xs",children:"When the deposit amount exceeds 250,000, there may be a delay in arrival. It is recommended to use the Ethereum network for deposits."}),O.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"}),O.jsxs("div",{className:"text-sm",children:[O.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[O.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),O.jsxs("span",{className:"text-text-primary font-medium text-right underline decoration-dotted underline-offset-1",children:["≈"," ",Math.ceil(((n==null?void 0:n.blockTime)||12)*((n==null?void 0:n.txConfirm)||12)/60)," ","minutes"]})]}),O.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[O.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),O.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((o=r==null?void 0:r.multiChain)==null?void 0:o.minDeposit)||10," ",t]})]}),O.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[O.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),O.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},vf=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onClose:s})=>{const[c,u]=h.useState(()=>{var d;return!e||e.length===0?1:t||((d=e[0])==null?void 0:d.chainId)||1}),[i,l]=h.useState(()=>{var m;if(!e||e.length===0)return"";const d=t||((m=e[0])==null?void 0:m.chainId),f=e.find(g=>g.chainId===d);if(!f||!f.tokenList||f.tokenList.length===0)return"";const p=f.tokenList.find(g=>g.tokenAddress===n)||f.tokenList[0];return(p==null?void 0:p.token)||""}),a=e&&e.length>0?e.find(d=>d.chainId===c)||e[0]:null;return!e||e.length===0?O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"No chains available"})}):a?O.jsxs(O.Fragment,{children:[O.jsx(nf,{currentActiveChain:a,chainList:e,onChainChange:u,curSelectToken:i,onTokenChange:l}),O.jsx(mf,{walletAdapter:r,curSelectToken:i,currentActiveChain:a,metadata:o}),O.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()},children:"Deposit"})]}):O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"Loading..."})})},gf=[{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}],ji={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Ri={address:"0x1234567890123456789012345678901234567890"},Wi={multiChain:{minDeposit:10}},Bi=({isOpen:e,onClose:t,config:n,isWalletConnected:r=!0,currentActiveAccount:o=ji,smartWallet:s=Ri,chains:c,defaultChainId:u,defaultTokenAddress:i,defaultAmount:l="",metadata:a=Wi,currentEquity:d=5e3,onDepositComplete:f})=>{const p=h.useMemo(()=>{var m;return o?Ds(o,s,!1,(m=c[0])==null?void 0:m.chainId,"0","0"):null},[o,s,c]);return e?we.createPortal(O.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:O.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-50 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{console.log("🔍 Backdrop clicked"),t()},"aria-hidden":"true",children:O.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:m=>{m.stopPropagation()},children:[O.jsxs("div",{className:"flex items-center justify-between mb-4",children:[O.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),O.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:O.jsx(Ms,{className:"h-4 w-4"})})]}),O.jsx(vf,{chains:c,defaultChainId:u,defaultTokenAddress:i,defaultAmount:l,walletAdapter:p,metadata:a,currentEquity:d,onDepositComplete:f,onClose:t})]})})}),document.body):null};var lr={exports:{}},un={exports:{}},ie={};/** @license React v16.13.1
104
- * react-is.production.min.js
105
- *
106
- * Copyright (c) Facebook, Inc. and its affiliates.
107
- *
108
- * This source code is licensed under the MIT license found in the
109
- * LICENSE file in the root directory of this source tree.
110
- */var Hi;function bf(){if(Hi)return ie;Hi=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,i=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,a=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function y(E){if(typeof E=="object"&&E!==null){var F=E.$$typeof;switch(F){case t:switch(E=E.type,E){case i:case l:case r:case s:case o:case d:return E;default:switch(E=E&&E.$$typeof,E){case u:case a:case m:case p:case c:return E;default:return F}}case n:return F}}}function S(E){return y(E)===l}return ie.AsyncMode=i,ie.ConcurrentMode=l,ie.ContextConsumer=u,ie.ContextProvider=c,ie.Element=t,ie.ForwardRef=a,ie.Fragment=r,ie.Lazy=m,ie.Memo=p,ie.Portal=n,ie.Profiler=s,ie.StrictMode=o,ie.Suspense=d,ie.isAsyncMode=function(E){return S(E)||y(E)===i},ie.isConcurrentMode=S,ie.isContextConsumer=function(E){return y(E)===u},ie.isContextProvider=function(E){return y(E)===c},ie.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},ie.isForwardRef=function(E){return y(E)===a},ie.isFragment=function(E){return y(E)===r},ie.isLazy=function(E){return y(E)===m},ie.isMemo=function(E){return y(E)===p},ie.isPortal=function(E){return y(E)===n},ie.isProfiler=function(E){return y(E)===s},ie.isStrictMode=function(E){return y(E)===o},ie.isSuspense=function(E){return y(E)===d},ie.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===l||E===s||E===o||E===d||E===f||typeof E=="object"&&E!==null&&(E.$$typeof===m||E.$$typeof===p||E.$$typeof===c||E.$$typeof===u||E.$$typeof===a||E.$$typeof===b||E.$$typeof===x||E.$$typeof===w||E.$$typeof===g)},ie.typeOf=y,ie}var se={};/** @license React v16.13.1
111
- * react-is.development.js
112
- *
113
- * Copyright (c) Facebook, Inc. and its affiliates.
114
- *
115
- * This source code is licensed under the MIT license found in the
116
- * LICENSE file in the root directory of this source tree.
117
- */var Ui;function yf(){return Ui||(Ui=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,i=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,a=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function y(M){return typeof M=="string"||typeof M=="function"||M===r||M===l||M===s||M===o||M===d||M===f||typeof M=="object"&&M!==null&&(M.$$typeof===m||M.$$typeof===p||M.$$typeof===c||M.$$typeof===u||M.$$typeof===a||M.$$typeof===b||M.$$typeof===x||M.$$typeof===w||M.$$typeof===g)}function S(M){if(typeof M=="object"&&M!==null){var _e=M.$$typeof;switch(_e){case t:var gt=M.type;switch(gt){case i:case l:case r:case s:case o:case d:return gt;default:var st=gt&&gt.$$typeof;switch(st){case u:case a:case m:case p:case c:return st;default:return _e}}case n:return _e}}}var E=i,F=l,j=u,K=c,ee=t,L=a,N=r,oe=m,H=p,W=n,X=s,G=o,J=d,P=!1;function U(M){return P||(P=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(M)||S(M)===i}function C(M){return S(M)===l}function A(M){return S(M)===u}function k(M){return S(M)===c}function I(M){return typeof M=="object"&&M!==null&&M.$$typeof===t}function B(M){return S(M)===a}function q(M){return S(M)===r}function Y(M){return S(M)===m}function $(M){return S(M)===p}function R(M){return S(M)===n}function V(M){return S(M)===s}function Q(M){return S(M)===o}function ye(M){return S(M)===d}se.AsyncMode=E,se.ConcurrentMode=F,se.ContextConsumer=j,se.ContextProvider=K,se.Element=ee,se.ForwardRef=L,se.Fragment=N,se.Lazy=oe,se.Memo=H,se.Portal=W,se.Profiler=X,se.StrictMode=G,se.Suspense=J,se.isAsyncMode=U,se.isConcurrentMode=C,se.isContextConsumer=A,se.isContextProvider=k,se.isElement=I,se.isForwardRef=B,se.isFragment=q,se.isLazy=Y,se.isMemo=$,se.isPortal=R,se.isProfiler=V,se.isStrictMode=Q,se.isSuspense=ye,se.isValidElementType=y,se.typeOf=S}()),se}var Vi;function zi(){return Vi||(Vi=1,process.env.NODE_ENV==="production"?un.exports=bf():un.exports=yf()),un.exports}/*
118
- object-assign
119
- (c) Sindre Sorhus
120
- @license MIT
121
- */var ar,Yi;function Ef(){if(Yi)return ar;Yi=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function o(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var c={},u=0;u<10;u++)c["_"+String.fromCharCode(u)]=u;var i=Object.getOwnPropertyNames(c).map(function(a){return c[a]});if(i.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(a){l[a]=a}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ar=o()?Object.assign:function(s,c){for(var u,i=r(s),l,a=1;a<arguments.length;a++){u=Object(arguments[a]);for(var d in u)t.call(u,d)&&(i[d]=u[d]);if(e){l=e(u);for(var f=0;f<l.length;f++)n.call(u,l[f])&&(i[l[f]]=u[l[f]])}}return i},ar}var ur,Gi;function cr(){if(Gi)return ur;Gi=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ur=e,ur}var fr,qi;function Ki(){return qi||(qi=1,fr=Function.call.bind(Object.prototype.hasOwnProperty)),fr}var dr,Qi;function wf(){if(Qi)return dr;Qi=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=cr(),n={},r=Ki();e=function(s){var c="Warning: "+s;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}}}function o(s,c,u,i,l){if(process.env.NODE_ENV!=="production"){for(var a in s)if(r(s,a)){var d;try{if(typeof s[a]!="function"){var f=Error((i||"React class")+": "+u+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}d=s[a](c,a,i,u,null,t)}catch(m){d=m}if(d&&!(d instanceof Error)&&e((i||"React class")+": type specification of "+u+" `"+a+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in n)){n[d.message]=!0;var p=l?l():"";e("Failed "+u+" type: "+d.message+(p??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},dr=o,dr}var pr,Xi;function xf(){if(Xi)return pr;Xi=1;var e=zi(),t=Ef(),n=cr(),r=Ki(),o=wf(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(u){var i="Warning: "+u;typeof console<"u"&&console.error(i);try{throw new Error(i)}catch{}});function c(){return null}return pr=function(u,i){var l=typeof Symbol=="function"&&Symbol.iterator,a="@@iterator";function d(C){var A=C&&(l&&C[l]||C[a]);if(typeof A=="function")return A}var f="<<anonymous>>",p={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:w(),arrayOf:y,element:S(),elementType:E(),instanceOf:F,node:L(),objectOf:K,oneOf:j,oneOfType:ee,shape:oe,exact:H};function m(C,A){return C===A?C!==0||1/C===1/A:C!==C&&A!==A}function g(C,A){this.message=C,this.data=A&&typeof A=="object"?A:{},this.stack=""}g.prototype=Error.prototype;function b(C){if(process.env.NODE_ENV!=="production")var A={},k=0;function I(q,Y,$,R,V,Q,ye){if(R=R||f,Q=Q||$,ye!==n){if(i){var M=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw M.name="Invariant Violation",M}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var _e=R+":"+$;!A[_e]&&k<3&&(s("You are manually calling a React.PropTypes validation function for the `"+Q+"` prop on `"+R+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),A[_e]=!0,k++)}}return Y[$]==null?q?Y[$]===null?new g("The "+V+" `"+Q+"` is marked as required "+("in `"+R+"`, but its value is `null`.")):new g("The "+V+" `"+Q+"` is marked as required in "+("`"+R+"`, but its value is `undefined`.")):null:C(Y,$,R,V,Q)}var B=I.bind(null,!1);return B.isRequired=I.bind(null,!0),B}function x(C){function A(k,I,B,q,Y,$){var R=k[I],V=G(R);if(V!==C){var Q=J(R);return new g("Invalid "+q+" `"+Y+"` of type "+("`"+Q+"` supplied to `"+B+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(A)}function w(){return b(c)}function y(C){function A(k,I,B,q,Y){if(typeof C!="function")return new g("Property `"+Y+"` of component `"+B+"` has invalid PropType notation inside arrayOf.");var $=k[I];if(!Array.isArray($)){var R=G($);return new g("Invalid "+q+" `"+Y+"` of type "+("`"+R+"` supplied to `"+B+"`, expected an array."))}for(var V=0;V<$.length;V++){var Q=C($,V,B,q,Y+"["+V+"]",n);if(Q instanceof Error)return Q}return null}return b(A)}function S(){function C(A,k,I,B,q){var Y=A[k];if(!u(Y)){var $=G(Y);return new g("Invalid "+B+" `"+q+"` of type "+("`"+$+"` supplied to `"+I+"`, expected a single ReactElement."))}return null}return b(C)}function E(){function C(A,k,I,B,q){var Y=A[k];if(!e.isValidElementType(Y)){var $=G(Y);return new g("Invalid "+B+" `"+q+"` of type "+("`"+$+"` supplied to `"+I+"`, expected a single ReactElement type."))}return null}return b(C)}function F(C){function A(k,I,B,q,Y){if(!(k[I]instanceof C)){var $=C.name||f,R=U(k[I]);return new g("Invalid "+q+" `"+Y+"` of type "+("`"+R+"` supplied to `"+B+"`, expected ")+("instance of `"+$+"`."))}return null}return b(A)}function j(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),c;function A(k,I,B,q,Y){for(var $=k[I],R=0;R<C.length;R++)if(m($,C[R]))return null;var V=JSON.stringify(C,function(ye,M){var _e=J(M);return _e==="symbol"?String(M):M});return new g("Invalid "+q+" `"+Y+"` of value `"+String($)+"` "+("supplied to `"+B+"`, expected one of "+V+"."))}return b(A)}function K(C){function A(k,I,B,q,Y){if(typeof C!="function")return new g("Property `"+Y+"` of component `"+B+"` has invalid PropType notation inside objectOf.");var $=k[I],R=G($);if(R!=="object")return new g("Invalid "+q+" `"+Y+"` of type "+("`"+R+"` supplied to `"+B+"`, expected an object."));for(var V in $)if(r($,V)){var Q=C($,V,B,q,Y+"."+V,n);if(Q instanceof Error)return Q}return null}return b(A)}function ee(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),c;for(var A=0;A<C.length;A++){var k=C[A];if(typeof k!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+P(k)+" at index "+A+"."),c}function I(B,q,Y,$,R){for(var V=[],Q=0;Q<C.length;Q++){var ye=C[Q],M=ye(B,q,Y,$,R,n);if(M==null)return null;M.data&&r(M.data,"expectedType")&&V.push(M.data.expectedType)}var _e=V.length>0?", expected one of type ["+V.join(", ")+"]":"";return new g("Invalid "+$+" `"+R+"` supplied to "+("`"+Y+"`"+_e+"."))}return b(I)}function L(){function C(A,k,I,B,q){return W(A[k])?null:new g("Invalid "+B+" `"+q+"` supplied to "+("`"+I+"`, expected a ReactNode."))}return b(C)}function N(C,A,k,I,B){return new g((C||"React class")+": "+A+" type `"+k+"."+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+B+"`.")}function oe(C){function A(k,I,B,q,Y){var $=k[I],R=G($);if(R!=="object")return new g("Invalid "+q+" `"+Y+"` of type `"+R+"` "+("supplied to `"+B+"`, expected `object`."));for(var V in C){var Q=C[V];if(typeof Q!="function")return N(B,q,Y,V,J(Q));var ye=Q($,V,B,q,Y+"."+V,n);if(ye)return ye}return null}return b(A)}function H(C){function A(k,I,B,q,Y){var $=k[I],R=G($);if(R!=="object")return new g("Invalid "+q+" `"+Y+"` of type `"+R+"` "+("supplied to `"+B+"`, expected `object`."));var V=t({},k[I],C);for(var Q in V){var ye=C[Q];if(r(C,Q)&&typeof ye!="function")return N(B,q,Y,Q,J(ye));if(!ye)return new g("Invalid "+q+" `"+Y+"` key `"+Q+"` supplied to `"+B+"`.\nBad object: "+JSON.stringify(k[I],null," ")+`
122
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var M=ye($,Q,B,q,Y+"."+Q,n);if(M)return M}return null}return b(A)}function W(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(W);if(C===null||u(C))return!0;var A=d(C);if(A){var k=A.call(C),I;if(A!==C.entries){for(;!(I=k.next()).done;)if(!W(I.value))return!1}else for(;!(I=k.next()).done;){var B=I.value;if(B&&!W(B[1]))return!1}}else return!1;return!0;default:return!1}}function X(C,A){return C==="symbol"?!0:A?A["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&A instanceof Symbol:!1}function G(C){var A=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":X(A,C)?"symbol":A}function J(C){if(typeof C>"u"||C===null)return""+C;var A=G(C);if(A==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return A}function P(C){var A=J(C);switch(A){case"array":case"object":return"an "+A;case"boolean":case"date":case"regexp":return"a "+A;default:return A}}function U(C){return!C.constructor||!C.constructor.name?f:C.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p},pr}var hr,Ji;function Cf(){if(Ji)return hr;Ji=1;var e=cr();function t(){}function n(){}return n.resetWarningCache=t,hr=function(){function r(c,u,i,l,a,d){if(d!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}r.isRequired=r;function o(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},hr}if(process.env.NODE_ENV!=="production"){var Sf=zi(),Of=!0;lr.exports=xf()(Sf.isElement,Of)}else lr.exports=Cf()();var Tf=lr.exports;const $f=gs(Tf);let He=null;const Pf={symbol:"USDT"},Zi=h.forwardRef((e,t)=>{const[n,r]=h.useState(!1),[o,s]=h.useState({chains:[]}),c=h.useCallback(a=>{s(a),r(!0)},[]),u=h.useCallback(a=>{console.log("🔄 DepositManager: Updating options",a),s(d=>{const f={...d,...a};return console.log("🔄 DepositManager: New options state",f),f})},[]),i=h.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=h.useCallback(()=>n,[n]);return h.useImperativeHandle(t,()=>({openDeposit:c,closeDeposit:i,updateDepositOptions:u,isOpen:l}),[c,i,u,l]),h.useEffect(()=>(He={openDeposit:c,closeDeposit:i,updateDepositOptions:u,isOpen:l},()=>{He=null}),[c,i,u,l]),h.useCallback(a=>{console.log("🔄 DepositManager: Token change triggered",a),s(d=>{const f={...d,curSelectToken:a};return console.log("🔄 DepositManager: Updated internal state",f),f}),o.onTokenChange&&o.onTokenChange(a)},[o.onTokenChange]),h.useCallback(a=>{console.log("🔄 DepositManager: Chain change triggered",a),o.onChainChange&&(console.log("🔄 DepositManager: Calling parent onChainChange",a),o.onChainChange(a))},[o.onChainChange]),h.useCallback(a=>{console.log("🔄 DepositManager: Amount change triggered",a),s(d=>{const f={...d,depositAmount:a};return console.log("🔄 DepositManager: Updated internal state",f),f}),o.onDepositAmountChange&&o.onDepositAmountChange(a)},[o.onDepositAmountChange]),h.useEffect(()=>{console.log("🔍 DepositManager: Current options",{curSelectToken:o.curSelectToken,currentActiveChain:o.currentActiveChain,depositAmount:o.depositAmount})},[o.curSelectToken,o.currentActiveChain,o.depositAmount]),O.jsx(Bi,{isOpen:n,onClose:i,config:o.config||Pf,isWalletConnected:o.isWalletConnected??!0,currentActiveAccount:o.currentActiveAccount||ji,smartWallet:o.smartWallet||Ri,chains:o.chains||gf,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||Wi,currentEquity:o.currentEquity??5e3,onDepositComplete:o.onDepositComplete})});Zi.displayName="DepositManager";const es=e=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.openDeposit(e||{chains:[]})},ts=()=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.closeDeposit()},Af=e=>{if(console.log("🌍 Global updateDepositOptions called with:",e),!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}console.log("🌍 Global updateDepositOptions: calling instance method"),He.updateDepositOptions(e)},Mf=()=>He?He.isOpen():!1,_f=()=>({openDeposit:es,closeDeposit:ts,updateDepositOptions:Af,isOpen:Mf});$f.node,h.createContext(null);const Lf=({isOpen:e,onClose:t,config:n})=>e?O.jsx("div",{className:"withdraw-modal",children:O.jsx("div",{className:"modal-overlay",onClick:t,children:O.jsxs("div",{className:"modal-content",onClick:r=>r.stopPropagation(),children:[O.jsxs("h2",{children:["Withdraw ",n.symbol]}),O.jsxs("p",{children:["Symbol: ",n.symbol]}),O.jsx("button",{onClick:t,children:"Close"})]})})}):null;fe.ComponentProvider=ws,fe.Deposit=Bi,fe.DepositManager=Zi,fe.Withdraw=Lf,fe.closeDeposit=ts,fe.openDeposit=es,fe.useDeposit=xs,fe.useDepositManager=_f,fe.useWithdraw=Cs,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})});
143
+ */var h5={L:$r.QrCode.Ecc.LOW,M:$r.QrCode.Ecc.MEDIUM,Q:$r.QrCode.Ecc.QUARTILE,H:$r.QrCode.Ecc.HIGH},r0=128,o0="L",s0="#FFFFFF",i0="#000000",a0=!1,c0=1,m5=4,g5=0,b5=.1;function u0(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,c){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===r.length-1){if(!i)return;s===null?n.push(`M${c+t},${o+t} h1v1H${c+t}z`):n.push(`M${s+t},${o+t} h${c+1-s}v1H${s+t}z`);return}i&&s===null&&(s=c)})}),n.join("")}function l0(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,s)=>s<t.x||s>=t.x+t.w?o:!1))}function y5(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*b5),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,u=r.x==null?e.length/2-c/2:r.x*i,l=r.y==null?e.length/2-a/2:r.y*i,d=r.opacity==null?1:r.opacity;let f=null;if(r.excavate){let h=Math.floor(u),m=Math.floor(l),w=Math.ceil(c+u-h),T=Math.ceil(a+l-m);f={x:h,y:m,w,h:T}}const p=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:f,opacity:d,crossOrigin:p}}function w5(e,t){return t!=null?Math.max(Math.floor(t),0):e?m5:g5}function f0({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=x.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,w)=>(m.push(...$r.QrSegment.makeSegments(w)),m),[]);return $r.QrCode.encodeSegments(h,h5[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:d,calculatedImageSettings:f}=x.useMemo(()=>{let p=a.getModules();const h=w5(r,o),m=p.length+h*2,w=y5(p,i,h,s);return{cells:p,margin:h,numCells:m,calculatedImageSettings:w}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:d,calculatedImageSettings:f}}var v5=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),x5=x.forwardRef(function(t,n){const r=t,{value:o,size:s=r0,level:i=o0,bgColor:c=s0,fgColor:a=i0,includeMargin:u=a0,minVersion:l=c0,boostLevel:d,marginSize:f,imageSettings:p}=r,m=Gc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=m,T=Gc(m,["style"]),y=p==null?void 0:p.src,A=x.useRef(null),M=x.useRef(null),L=x.useCallback(S=>{A.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[F,j]=x.useState(!1),{margin:g,cells:v,numCells:$,calculatedImageSettings:I}=f0({value:o,level:i,minVersion:l,boostLevel:d,includeMargin:u,marginSize:f,imageSettings:p,size:s});x.useEffect(()=>{if(A.current!=null){const S=A.current,E=S.getContext("2d");if(!E)return;let C=v;const O=M.current,b=I!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;b&&I.excavation!=null&&(C=l0(v,I.excavation));const k=window.devicePixelRatio||1;S.height=S.width=s*k;const D=s/$*k;E.scale(D,D),E.fillStyle=c,E.fillRect(0,0,$,$),E.fillStyle=a,v5?E.fill(new Path2D(u0(C,g))):v.forEach(function(U,_){U.forEach(function(H,K){H&&E.fillRect(K+g,_+g,1,1)})}),I&&(E.globalAlpha=I.opacity),b&&E.drawImage(O,I.x+g,I.y+g,I.w,I.h)}}),x.useEffect(()=>{j(!1)},[y]);const N=Vc({height:s,width:s},w);let P=null;return y!=null&&(P=x.createElement("img",{src:y,key:y,style:{display:"none"},onLoad:()=>{j(!0)},ref:M,crossOrigin:I==null?void 0:I.crossOrigin})),x.createElement(x.Fragment,null,x.createElement("canvas",Vc({style:N,height:s,width:s,ref:L,role:"img"},T)),P)});x5.displayName="QRCodeCanvas";var d0=x.forwardRef(function(t,n){const r=t,{value:o,size:s=r0,level:i=o0,bgColor:c=s0,fgColor:a=i0,includeMargin:u=a0,minVersion:l=c0,boostLevel:d,title:f,marginSize:p,imageSettings:h}=r,m=Gc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:T,numCells:y,calculatedImageSettings:A}=f0({value:o,level:i,minVersion:l,boostLevel:d,includeMargin:u,marginSize:p,imageSettings:h,size:s});let M=T,L=null;h!=null&&A!=null&&(A.excavation!=null&&(M=l0(T,A.excavation)),L=x.createElement("image",{href:h.src,height:A.h,width:A.w,x:A.x+w,y:A.y+w,preserveAspectRatio:"none",opacity:A.opacity,crossOrigin:A.crossOrigin}));const F=u0(M,w);return x.createElement("svg",Vc({height:s,width:s,viewBox:`0 0 ${y} ${y}`,ref:n,role:"img"},m),!!f&&x.createElement("title",null,f),x.createElement("path",{fill:c,d:`M0,0 h${y}v${y}H0z`,shapeRendering:"crispEdges"}),x.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),L)});d0.displayName="QRCodeSVG";function E5(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function S5(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function p0(){return/apple/i.test(navigator.vendor)}function P5(){return E5().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function $5(){return S5().includes("jsdom/")}const h0="data-floating-ui-focusable",A5="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function qc(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Ar(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&yc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Tr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Zc(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function T5(e){return e.matches("html,body")}function jt(e){return(e==null?void 0:e.ownerDocument)||document}function m0(e){return Fe(e)&&e.matches(A5)}function C5(e){if(!e||$5())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function O5(e){return e?e.hasAttribute(h0)?e:e.querySelector("["+h0+"]")||e:null}function Xs(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...Xs(e,o.id,n)])}function N5(e){return"nativeEvent"in e}function Io(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var I5=typeof document<"u",k5=function(){},_t=I5?x.useLayoutEffect:k5;const B5={...z};function Qs(e){const t=z.useRef(e);return _t(()=>{t.current=e}),t}const M5=B5.useInsertionEffect||(e=>e());function Ut(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return M5(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const g0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function b0(e,t){const n=eh(e,g0()),r=n.length;if(r===0)return;const o=qc(jt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function L5(e){return b0(jt(e).body,1)||e}function R5(e){return b0(jt(e).body,-1)||e}function Kc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Ar(n,r)}function D5(e){eh(e,g0()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function y0(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const F5="data-floating-ui-focusable",w0="active",v0="selected",j5={...z};let x0=!1,_5=0;const E0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_5++;function U5(){const[e,t]=z.useState(()=>x0?E0():void 0);return _t(()=>{e==null&&t(E0())},[]),z.useEffect(()=>{x0=!0},[]),e}const Yc=j5.useId||U5;let Xc;process.env.NODE_ENV!=="production"&&(Xc=new Set);function z5(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Xc)!=null&&e.has(o))){var s;(s=Xc)==null||s.add(o),console.error(o)}}function H5(){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 W5=z.createContext(null),V5=z.createContext(null),Qc=()=>{var e;return((e=z.useContext(W5))==null?void 0:e.id)||null},Jc=()=>z.useContext(V5);function ko(e){return"data-floating-ui-"+e}function dt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const S0=ko("safe-polygon");function eu(e,t,n){if(n&&!Io(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function tu(e){return typeof e=="function"?e():e}function G5(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:u=null,mouseOnly:l=!1,restMs:d=0,move:f=!0}=t,p=Jc(),h=Qc(),m=Qs(u),w=Qs(a),T=Qs(n),y=Qs(d),A=z.useRef(),M=z.useRef(-1),L=z.useRef(),F=z.useRef(-1),j=z.useRef(!0),g=z.useRef(!1),v=z.useRef(()=>{}),$=z.useRef(!1),I=Ut(()=>{var O;const b=(O=o.current.openEvent)==null?void 0:O.type;return(b==null?void 0:b.includes("mouse"))&&b!=="mousedown"});z.useEffect(()=>{if(!c)return;function O(b){let{open:k}=b;k||(dt(M),dt(F),j.current=!0,$.current=!1)}return s.on("openchange",O),()=>{s.off("openchange",O)}},[c,s]),z.useEffect(()=>{if(!c||!m.current||!n)return;function O(k){I()&&r(!1,k,"hover")}const b=jt(i.floating).documentElement;return b.addEventListener("mouseleave",O),()=>{b.removeEventListener("mouseleave",O)}},[i.floating,n,r,c,m,I]);const N=z.useCallback(function(O,b,k){b===void 0&&(b=!0),k===void 0&&(k="hover");const D=eu(w.current,"close",A.current);D&&!L.current?(dt(M),M.current=window.setTimeout(()=>r(!1,O,k),D)):b&&(dt(M),r(!1,O,k))},[w,r]),P=Ut(()=>{v.current(),L.current=void 0}),S=Ut(()=>{if(g.current){const O=jt(i.floating).body;O.style.pointerEvents="",O.removeAttribute(S0),g.current=!1}}),E=Ut(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);z.useEffect(()=>{if(!c)return;function O(_){if(dt(M),j.current=!1,l&&!Io(A.current)||tu(y.current)>0&&!eu(w.current,"open"))return;const H=eu(w.current,"open",A.current);H?M.current=window.setTimeout(()=>{T.current||r(!0,_,"hover")},H):n||r(!0,_,"hover")}function b(_){if(E()){S();return}v.current();const H=jt(i.floating);if(dt(F),$.current=!1,m.current&&o.current.floatingContext){n||dt(M),L.current=m.current({...o.current.floatingContext,tree:p,x:_.clientX,y:_.clientY,onClose(){S(),P(),E()||N(_,!0,"safe-polygon")}});const W=L.current;H.addEventListener("mousemove",W),v.current=()=>{H.removeEventListener("mousemove",W)};return}(A.current==="touch"?!Ar(i.floating,_.relatedTarget):!0)&&N(_)}function k(_){E()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:p,x:_.clientX,y:_.clientY,onClose(){S(),P(),E()||N(_)}})(_))}function D(){dt(M)}function U(_){E()||N(_,!1)}if(pe(i.domReference)){const _=i.domReference,H=i.floating;return n&&_.addEventListener("mouseleave",k),f&&_.addEventListener("mousemove",O,{once:!0}),_.addEventListener("mouseenter",O),_.addEventListener("mouseleave",b),H&&(H.addEventListener("mouseleave",k),H.addEventListener("mouseenter",D),H.addEventListener("mouseleave",U)),()=>{n&&_.removeEventListener("mouseleave",k),f&&_.removeEventListener("mousemove",O),_.removeEventListener("mouseenter",O),_.removeEventListener("mouseleave",b),H&&(H.removeEventListener("mouseleave",k),H.removeEventListener("mouseenter",D),H.removeEventListener("mouseleave",U))}}},[i,c,e,l,f,N,P,S,r,n,T,p,w,m,o,E,y]),_t(()=>{var O;if(c&&n&&(O=m.current)!=null&&(O=O.__options)!=null&&O.blockPointerEvents&&I()){g.current=!0;const k=i.floating;if(pe(i.domReference)&&k){var b;const D=jt(i.floating).body;D.setAttribute(S0,"");const U=i.domReference,_=p==null||(b=p.nodesRef.current.find(H=>H.id===h))==null||(b=b.context)==null?void 0:b.elements.floating;return _&&(_.style.pointerEvents=""),D.style.pointerEvents="none",U.style.pointerEvents="auto",k.style.pointerEvents="auto",()=>{D.style.pointerEvents="",U.style.pointerEvents="",k.style.pointerEvents=""}}}},[c,n,h,i,p,m,I]),_t(()=>{n||(A.current=void 0,$.current=!1,P(),S())},[n,P,S]),z.useEffect(()=>()=>{P(),dt(M),dt(F),S()},[c,i.domReference,P,S]);const C=z.useMemo(()=>{function O(b){A.current=b.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(b){const{nativeEvent:k}=b;function D(){!j.current&&!T.current&&r(!0,k,"hover")}l&&!Io(A.current)||n||tu(y.current)===0||$.current&&b.movementX**2+b.movementY**2<2||(dt(F),A.current==="touch"?D():($.current=!0,F.current=window.setTimeout(D,tu(y.current))))}}},[l,r,n,T,y]);return z.useMemo(()=>c?{reference:C}:{},[c,C])}const P0={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},$0=z.forwardRef(function(t,n){const[r,o]=z.useState();_t(()=>{p0()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[ko("focus-guard")]:"",style:P0};return B.jsx("span",{...t,...s})}),A0=z.createContext(null),T0=ko("portal");function q5(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Yc(),o=K5(),[s,i]=z.useState(null),c=z.useRef(null);return _t(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),_t(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const u=document.createElement("div");u.id=r,u.setAttribute(T0,""),a.appendChild(u),c.current=u,i(u)},[t,r]),_t(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!bc(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const l=document.createElement("div");l.id=r,l.setAttribute(T0,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function Z5(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=q5({id:n,root:r}),[i,c]=z.useState(null),a=z.useRef(null),u=z.useRef(null),l=z.useRef(null),d=z.useRef(null),f=i==null?void 0:i.modal,p=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return z.useEffect(()=>{if(!s||!o||f)return;function m(w){s&&Kc(w)&&(w.type==="focusin"?y0:D5)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,f]),z.useEffect(()=>{s&&(p||y0(s))},[p,s]),B.jsxs(A0.Provider,{value:z.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:d,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&B.jsx($0,{"data-type":"outside",ref:a,onFocus:m=>{if(Kc(m,s)){var w;(w=l.current)==null||w.focus()}else{const T=i?i.domReference:null,y=R5(T);y==null||y.focus()}}}),h&&s&&B.jsx("span",{"aria-owns":s.id,style:P0}),s&&Nr.createPortal(t,s),h&&s&&B.jsx($0,{"data-type":"outside",ref:u,onFocus:m=>{if(Kc(m,s)){var w;(w=d.current)==null||w.focus()}else{const T=i?i.domReference:null,y=L5(T);y==null||y.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const K5=()=>z.useContext(A0);function C0(e){return Fe(e.target)&&e.target.tagName==="BUTTON"}function Y5(e){return Fe(e.target)&&e.target.tagName==="A"}function O0(e){return m0(e)}function X5(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:u=!1,keyboardHandlers:l=!0,stickIfOpen:d=!0}=t,f=z.useRef(),p=z.useRef(!1),h=z.useMemo(()=>({onPointerDown(m){f.current=m.pointerType},onMouseDown(m){const w=f.current;m.button===0&&c!=="click"&&(Io(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const w=f.current;if(c==="mousedown"&&f.current){f.current=void 0;return}Io(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){f.current=void 0,!(m.defaultPrevented||!l||C0(m))&&(m.key===" "&&!O0(s)&&(m.preventDefault(),p.current=!0),!Y5(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||C0(m)||O0(s)||m.key===" "&&p.current&&(p.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,d,a]);return z.useMemo(()=>i?{reference:h}:{},[i,h])}const Q5={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},J5={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},N0=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function eP(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:l=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:p,capture:h}=t,m=Jc(),w=Ut(typeof a=="function"?a:()=>!1),T=typeof a=="function"?w:a,y=z.useRef(!1),{escapeKey:A,outsidePress:M}=N0(p),{escapeKey:L,outsidePress:F}=N0(h),j=z.useRef(!1),g=Ut(S=>{var E;if(!n||!i||!c||S.key!=="Escape"||j.current)return;const C=(E=s.current.floatingContext)==null?void 0:E.nodeId,O=m?Xs(m.nodesRef.current,C):[];if(!A&&(S.stopPropagation(),O.length>0)){let b=!0;if(O.forEach(k=>{var D;if((D=k.context)!=null&&D.open&&!k.context.dataRef.current.__escapeKeyBubbles){b=!1;return}}),!b)return}r(!1,N5(S)?S.nativeEvent:S,"escape-key")}),v=Ut(S=>{var E;const C=()=>{var O;g(S),(O=Tr(S))==null||O.removeEventListener("keydown",C)};(E=Tr(S))==null||E.addEventListener("keydown",C)}),$=Ut(S=>{var E;const C=s.current.insideReactTree;s.current.insideReactTree=!1;const O=y.current;if(y.current=!1,u==="click"&&O||C||typeof T=="function"&&!T(S))return;const b=Tr(S),k="["+ko("inert")+"]",D=jt(o.floating).querySelectorAll(k);let U=pe(b)?b:null;for(;U&&!sn(U);){const W=an(U);if(sn(W)||!pe(W))break;U=W}if(D.length&&pe(b)&&!T5(b)&&!Ar(b,o.floating)&&Array.from(D).every(W=>!Ar(U,W)))return;if(Fe(b)&&P){const W=sn(b),Z=ft(b),G=/auto|scroll/,J=W||G.test(Z.overflowX),ne=W||G.test(Z.overflowY),le=J&&b.clientWidth>0&&b.scrollWidth>b.clientWidth,Se=ne&&b.clientHeight>0&&b.scrollHeight>b.clientHeight,Me=Z.direction==="rtl",Y=Se&&(Me?S.offsetX<=b.offsetWidth-b.clientWidth:S.offsetX>b.clientWidth),ee=le&&S.offsetY>b.clientHeight;if(Y||ee)return}const _=(E=s.current.floatingContext)==null?void 0:E.nodeId,H=m&&Xs(m.nodesRef.current,_).some(W=>{var Z;return Zc(S,(Z=W.context)==null?void 0:Z.elements.floating)});if(Zc(S,o.floating)||Zc(S,o.domReference)||H)return;const K=m?Xs(m.nodesRef.current,_):[];if(K.length>0){let W=!0;if(K.forEach(Z=>{var G;if((G=Z.context)!=null&&G.open&&!Z.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}r(!1,S,"outside-press")}),I=Ut(S=>{var E;const C=()=>{var O;$(S),(O=Tr(S))==null||O.removeEventListener(u,C)};(E=Tr(S))==null||E.addEventListener(u,C)});z.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=A,s.current.__outsidePressBubbles=M;let S=-1;function E(D){r(!1,D,"ancestor-scroll")}function C(){window.clearTimeout(S),j.current=!0}function O(){S=window.setTimeout(()=>{j.current=!1},Os()?5:0)}const b=jt(o.floating);c&&(b.addEventListener("keydown",L?v:g,L),b.addEventListener("compositionstart",C),b.addEventListener("compositionend",O)),T&&b.addEventListener(u,F?I:$,F);let k=[];return f&&(pe(o.domReference)&&(k=vn(o.domReference)),pe(o.floating)&&(k=k.concat(vn(o.floating))),!pe(o.reference)&&o.reference&&o.reference.contextElement&&(k=k.concat(vn(o.reference.contextElement)))),k=k.filter(D=>{var U;return D!==((U=b.defaultView)==null?void 0:U.visualViewport)}),k.forEach(D=>{D.addEventListener("scroll",E,{passive:!0})}),()=>{c&&(b.removeEventListener("keydown",L?v:g,L),b.removeEventListener("compositionstart",C),b.removeEventListener("compositionend",O)),T&&b.removeEventListener(u,F?I:$,F),k.forEach(D=>{D.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,o,c,T,u,n,r,f,i,A,M,g,L,v,$,F,I]),z.useEffect(()=>{s.current.insideReactTree=!1},[s,T,u]);const N=z.useMemo(()=>({onKeyDown:g,...l&&{[Q5[d]]:S=>{r(!1,S.nativeEvent,"reference-press")},...d!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,l,d]),P=z.useMemo(()=>({onKeyDown:g,onMouseDown(){y.current=!0},onMouseUp(){y.current=!0},[J5[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return z.useMemo(()=>i?{reference:N,floating:P}:{},[i,N,P])}function tP(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Yc(),s=z.useRef({}),[i]=z.useState(()=>H5()),c=Qc()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!pe(p)&&z5("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=z.useState(r.reference),l=Ut((p,h,m)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:m,nested:c}),n==null||n(p,h,m)}),d=z.useMemo(()=>({setPositionReference:u}),[]),f=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:f,events:i,floatingId:o,refs:d}),[t,l,f,i,o,d])}function nP(e){e===void 0&&(e={});const{nodeId:t}=e,n=tP({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),l=(o==null?void 0:o.domReference)||s,d=z.useRef(null),f=Jc();_t(()=>{l&&(d.current=l)},[l]);const p=mh({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(A=>{const M=pe(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),getClientRects:()=>A.getClientRects(),contextElement:A}:A;a(M),p.refs.setReference(M)},[p.refs]),m=z.useCallback(A=>{(pe(A)||A===null)&&(d.current=A,i(A)),(pe(p.refs.reference.current)||p.refs.reference.current===null||A!==null&&!pe(A))&&p.refs.setReference(A)},[p.refs]),w=z.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:d}),[p.refs,m,h]),T=z.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),y=z.useMemo(()=>({...p,...r,refs:w,elements:T,nodeId:t}),[p,w,T,t,r]);return _t(()=>{r.dataRef.current.floatingContext=y;const A=f==null?void 0:f.nodesRef.current.find(M=>M.id===t);A&&(A.context=y)}),z.useMemo(()=>({...p,context:y,refs:w,elements:T}),[p,w,T,y])}function nu(){return P5()&&p0()}function rP(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,u=z.useRef(!1),l=z.useRef(-1),d=z.useRef(!0);z.useEffect(()=>{if(!c)return;const p=Ve(i.domReference);function h(){!n&&Fe(i.domReference)&&i.domReference===qc(jt(i.domReference))&&(u.current=!0)}function m(){d.current=!0}function w(){d.current=!1}return p.addEventListener("blur",h),nu()&&(p.addEventListener("keydown",m,!0),p.addEventListener("pointerdown",w,!0)),()=>{p.removeEventListener("blur",h),nu()&&(p.removeEventListener("keydown",m,!0),p.removeEventListener("pointerdown",w,!0))}},[i.domReference,n,c]),z.useEffect(()=>{if(!c)return;function p(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(u.current=!0)}return o.on("openchange",p),()=>{o.off("openchange",p)}},[o,c]),z.useEffect(()=>()=>{dt(l)},[]);const f=z.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(p){if(u.current)return;const h=Tr(p.nativeEvent);if(a&&pe(h)){if(nu()&&!p.relatedTarget){if(!d.current&&!m0(h))return}else if(!C5(h))return}r(!0,p.nativeEvent,"focus")},onBlur(p){u.current=!1;const h=p.relatedTarget,m=p.nativeEvent,w=pe(h)&&h.hasAttribute(ko("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var T;const y=qc(i.domReference?i.domReference.ownerDocument:document);!h&&y===i.domReference||Ar((T=s.current.floatingContext)==null?void 0:T.refs.floating.current,y)||Ar(i.domReference,y)||w||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return z.useMemo(()=>c?{reference:f}:{},[c,f])}function ru(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[w0]:i,[v0]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[F5]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[w0,v0].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var d;(d=r.get(u))==null||d.push(l),i[u]=function(){for(var f,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(f=r.get(u))==null?void 0:f.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function oP(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>ru(c,e,"reference"),t),s=z.useCallback(c=>ru(c,e,"floating"),n),i=z.useCallback(c=>ru(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const sP=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function iP(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,u=Yc(),l=((n=s.domReference)==null?void 0:n.id)||u,d=z.useMemo(()=>{var y;return((y=O5(s.floating))==null?void 0:y.id)||i},[s.floating,i]),f=(r=sP.get(a))!=null?r:a,h=Qc()!=null,m=z.useMemo(()=>f==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":o?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:l},...f==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[f,d,h,o,l,a]),w=z.useMemo(()=>{const y={id:d,...f&&{role:f}};return f==="tooltip"||a==="label"?y:{...y,...f==="menu"&&{"aria-labelledby":l}}},[f,d,l,a]),T=z.useCallback(y=>{let{active:A,selected:M}=y;const L={role:"option",...A&&{id:d+"-fui-option"}};switch(a){case"select":case"combobox":return{...L,"aria-selected":M}}return{}},[d,a]);return z.useMemo(()=>c?{reference:m,floating:w,item:T}:{},[c,m,w,T])}const I0=x.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return B.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});I0.displayName="TooltipArrow";const Gn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[u,l]=x.useState(!1),d=x.useRef(null),{refs:f,floatingStyles:p,context:h}=nP({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:fh,middleware:[Nc(o?12:8),bh({fallbackAxisSideDirection:"start",padding:8}),gh({padding:8}),...o?[P6({element:d})]:[]]}),m=G5(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),w=rP(h,{enabled:a.includes("focus")}),T=X5(h,{enabled:a.includes("click")}),y=eP(h),A=iP(h,{role:"tooltip"}),{getReferenceProps:M,getFloatingProps:L}=oP([m,w,T,y,A]);return i?B.jsx(B.Fragment,{children:e}):B.jsxs(B.Fragment,{children:[B.jsx("div",{ref:f.setReference,...M(),children:e}),u&&B.jsx(Z5,{children:B.jsxs("div",{ref:f.setFloating,...L(),style:p,className:`
144
+ z-50 px-3 py-2
145
+ bg-fill-page-secondary
146
+ text-text-primary text-sm font-medium
147
+ rounded-lg shadow-lg
148
+ relative
149
+ ${c}
150
+ ${s}
151
+ `,children:[t,o&&B.jsx(I0,{ref:d,placement:h.placement||n})]})})]})},Bo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",aP=(e,t)=>Number(e)>Number(t),Tt=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},ou=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return ou(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Tt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},Js={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},cP=[Js.ETHEREUM,Js.SEPOLIA,Js.ARBITRUM,Js.ARBITRUM_SEPOLIA],uP=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!cP.includes(t)}return!0},lP=({currentActiveChain:e,selectedToken:t,address:n,onDeposit:r,onCopy:o,onClose:s})=>{const{t:i}=Ht(),c=x.useMemo(()=>uP(e||{}),[e]);return B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&B.jsx("div",{className:"bg-white rounded-lg",children:B.jsx(d0,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&B.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[B.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),B.jsx(d5,{onCopy:()=>{o&&o(n)},text:n,children:B.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[B.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),B.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),B.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[B.jsxs("div",{className:"flex items-start",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1",children:B.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),c&&B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),B.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),B.jsxs("div",{className:"text-sm",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[B.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),B.jsx(Gn,{content:B.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[B.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),B.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:B.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:i("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),B.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[B.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),B.jsxs("span",{className:"text-text-primary font-medium text-right",children:["10 ",t]})]}),B.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[B.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),B.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),B.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{r&&r({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),s()},children:i("deposit.title")})]})},Mo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return B.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},fP=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Tt(Math.max(0,s).toString());return B.jsxs("span",{className:"flex items-center gap-1",children:[Tt(e),B.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Tt(e)} ${n}`},dP=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},pP=(e,t,n)=>{if(!Gh(e,n))return!1;try{const r=new $e(t||"0"),o=new $e("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},hP=(e,t,n)=>{let r=t||"0";if(Gh(e,n))try{const o=new $e(r),s=new $e("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}return r},k0={chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,platformBalance:"0"};let qe=null;const B0=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState(k0),a=x.useCallback(h=>{c(h),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),d=x.useCallback(h=>{s(h)},[]),f=x.useCallback(()=>n,[n]),p=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:d,isOpen:f,isLoading:p}),[a,l,u,d,f,p]),x.useEffect(()=>(qe={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:d,isOpen:f,isLoading:p},()=>{qe=null}),[a,l,u,d,f,p]),B.jsx(_0,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,defaultChainId:i.defaultChainId,platformBalance:i.platformBalance,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}})});B0.displayName="DepositManager";const M0=e=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.openDeposit(e||k0)},L0=()=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.closeDeposit()},R0=e=>{qe&&qe.updateDepositOptions(e)},ei=e=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.setDepositLoading(e)},mP=()=>qe?qe.isOpen():!1,D0=()=>qe?qe.isLoading():!1,gP=()=>({openDeposit:M0,closeDeposit:L0,updateDepositOptions:R0,setDepositLoading:ei,isOpen:mP,isLoading:D0}),bP=e=>{const{t}=Ht(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return x.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=dP(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<a?{text:t("deposit.minDepositParsed",{amount:a,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!l,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function yP(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,d=(o==null?void 0:o.decimals)??18,f=o==null?void 0:o.contractAddress,p=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),w=a(),T=i({address:l,abi:fr,functionName:"allowance",args:[An(t||""),f],chainId:r,query:{enabled:!!(!p&&t&&r&&l&&f)}}),y=T!=null&&T.isSuccess?T.data:void 0,A=x.useMemo(()=>{if(p)return!0;if(!T.isSuccess||y===void 0||y===0n)return!1;try{const L=xw(String(Number(s||"0")||0),Number(d));return y>=L}catch{return!1}},[p,T.isSuccess,y,s,d]),M=x.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!w||!l||!f)return;const F=An(l),j=An(f);if((y||0n)>0n){const $=await m({abi:fr,address:F,functionName:"approve",args:[j,0n]});await w.waitForTransactionReceipt({hash:$})}const v=await m({abi:fr,address:F,functionName:"approve",args:[j,Ul]});await w.waitForTransactionReceipt({hash:v}),T!=null&&T.refetch&&await T.refetch()}catch(L){console.error("[useApprove] onApprove failed:",L)}},[r,n,l,f,y,T,m,w,h]);return{approve:A,onApprove:M}}const wP=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return x.useEffect(()=>{o(An(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},F0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var T;const s=x.useMemo(()=>r.filter(y=>y.tokenAddress&&y.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=x.useState({}),a=x.useCallback((y,A)=>{c(M=>({...M,[y]:A}))},[]),u=(T=o==null?void 0:o.useBalance)==null?void 0:T.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),[l,d]=x.useState(0),f=x.useMemo(()=>s.map(y=>x.createElement(wP,{key:`${y.tokenAddress}-${l}`,token:y,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a,l]),p=x.useMemo(()=>{const y=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},A=s.map(L=>{const F=i[An(L.tokenAddress)],j=F==null?void 0:F.balance,g=j==null?void 0:j.data;return{address:An(L.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||L.decimals}}).filter(L=>L.address),M=A.reduce((L,F)=>({...L,[F.address]:{balance:F}}),{});return{balanceList:A,baseTokenBalance:y,combinedData:M}},[u,i,s]),h=x.useCallback(async()=>p,[p]),m=x.useMemo(()=>{const y=(u==null?void 0:u.isLoading)||!1,A=Object.values(i).some(M=>{var L;return(L=M.balance)==null?void 0:L.isLoading});return y||A},[u==null?void 0:u.isLoading,i]),w=x.useCallback(()=>d(y=>y+1),[]);return{multicallRun:h,multicallRefresh:w,multicallResult:p,validErcTokens:s,isLoading:m,queryComponents:f}},vP=({address:e,currentActiveChain:t,selectedToken:n,platformBalance:r,isLoading:o,wagmiHooks:s,onChainChange:i,onDeposit:c})=>{const{t:a}=Ht(),u=s.useAccount(),l=t.tokenList.find(D=>D.token===n),d=t.chainId,[f,p]=x.useState("");x.useEffect(()=>{p("")},[n,t.chainId]);const{multicallResult:h,queryComponents:m}=F0({account:e,chainId:t.chainId,contractAddress:(l==null?void 0:l.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:s}),w=x.useMemo(()=>{var U;if(!l)return"0";if(!l.tokenAddress||l.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return h.baseTokenBalance.formatted;const D=h.combinedData[l.tokenAddress];return((U=D==null?void 0:D.balance)==null?void 0:U.formatted)||"0"},[l,h]),T="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",y="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",A=x.useMemo(()=>{var D,U;return ja({chain:_a,transport:pa(t.rpcUrl||((D=window==null?void 0:window.ENV)==null?void 0:D.CHAIN_RPC_URL_42161)||((U=window==null?void 0:window.ENV)==null?void 0:U.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),M="1000000000000",{formatted:L}=bs({client:A,tokenAddress:T,holder:y,decimals:6,fallbackFormatted:M,pollingInterval:12e3}),[F,j]=x.useState(!1),{approve:g,onApprove:v}=yP({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:l,amount:f,wagmiHooks:s}),$=x.useCallback(async()=>{if(!F)try{j(!0),await v()}catch(D){console.error("Approve failed:",D)}finally{j(!1)}},[F,v]),I=x.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),N=x.useCallback(async()=>{i&&i(d)},[i,d]);x.useEffect(()=>{I&&N()},[I,N]);const{showLayerZeroTip:P,layerZeroTipKey:S}=x.useMemo(()=>{const D=+t.chainId==42161||+t.chainId==421614,U=(n==null?void 0:n.toUpperCase())==="USDT",_=new $e(f||"0"),H=new $e("200000");let K=!1,W;if(D&&U&&f)if(_.gte(H))K=!0,W="deposit.layerZeroDepositTipGte200k";else{const Z=L;if(typeof Z=="string"&&Z.length>0){const J=new $e(Z);!J.isNaN()&&_.gte(J)&&(K=!0,W="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:K,layerZeroTipKey:W}},[t.chainId,n,f,L]),E=x.useCallback(()=>hP(+t.chainId,w||"0",n),[w,t==null?void 0:t.chainId,n]),C=x.useMemo(()=>pP(+t.chainId,f,n),[t==null?void 0:t.chainId,f,n]),O=bP({isNetworkMismatch:I,depositAmount:f,approved:g,currentTokenBalance:w,selectedToken:n,showLayerZeroTip:P,minDeposit:10}),b=D=>{const U=D.target.value,_=E(),H=ou(U,_);if(H.isValid)p(H.formattedValue),H.errorType;else return H.errorType==="exceed_balance",void 0},k=x.useCallback(async()=>{ei(!0);try{c&&c({amount:f,chainId:d,tokenAddress:(l==null?void 0:l.tokenAddress)||"",tokenSymbol:n})}catch(D){console.error("Deposit error:",D),ei(!1)}},[c,f,d,l==null?void 0:l.tokenAddress,n]);return B.jsxs(B.Fragment,{children:[m,B.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[B.jsx("input",{type:"text",placeholder:a("deposit.amount"),value:f,onChange:b,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),B.jsx("button",{onClick:()=>{const D=E();p(D)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:a("deposit.max")})]}),B.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),B.jsxs("div",{className:"flex justify-between items-center",children:[B.jsx(Gn,{content:a("deposit.availableDesc"),children:B.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:a("deposit.available")})}),B.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:fP(w||"0",f,n)})]})]}),!g&&aP(f||"0",0)&&B.jsxs("div",{className:"flex justify-center flex-col items-center",children:[B.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:a("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),B.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:a("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),B.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:$,disabled:F,children:F?B.jsx(Mo,{size:"xs",inline:!0}):a("deposit.enableWithToken",{token:n})})]}),P&&B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a(S||"deposit.layerZeroDepositTip")})]}),B.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),C&&B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.depositTipFor25w")})]}),C&&B.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:!(C||P)&&B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.noPrivateKeyWalletWarning")})]}),B.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[B.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.arrivalTime")}),B.jsx(Gn,{content:B.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[B.jsx("p",{children:a("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),B.jsx("p",{children:a("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:B.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:a("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),B.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[B.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.equity")}),B.jsx("span",{className:"text-sm text-text-primary font-medium",children:f?B.jsxs("span",{className:"flex items-center gap-1",children:[Tt(r),B.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Tt((parseFloat(r)+parseFloat(f)).toString())," ",n]}):`${Tt(r)} ${n}`})]})]}),B.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${O.disabled||o?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:k,disabled:O.disabled||o,children:[(o||I)&&B.jsx(Mo,{size:"xs"}),O.text]})]})},j0=e=>e.toLocaleUpperCase()===Fn?Fn:Ua,ti=e=>j0(e.wallet)===Fn,xP=e=>j0(e.wallet)===Ua,_0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,defaultChainId:s,platformBalance:i="0",wagmiHooks:c,onDeposit:a,onCopy:u,onChainChange:l,onTokenChange:d})=>{const{t:f}=Ht(),[p,h]=x.useState(()=>{var M;return!o||o.length===0?1:s||((M=o[0])==null?void 0:M.chainId)||1}),m=o.find(M=>M.chainId===p)||o[0],[w,T]=x.useState(()=>{var j;if(!o||o.length===0)return"";const M=s||((j=o[0])==null?void 0:j.chainId),L=o.find(g=>g.chainId===M);if(!L||!L.tokenList||L.tokenList.length===0)return"";const F=L.tokenList[0];return(F==null?void 0:F.token)||""}),y=x.useCallback(M=>{h(M),l==null||l(M)},[l]),A=x.useCallback(M=>{T(M),d==null||d(M)},[d]);return e?Le.createPortal(B.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:B.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:B.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:M=>{M.stopPropagation()},children:[B.jsxs("div",{className:"flex items-center justify-between mb-4",children:[B.jsx("h2",{className:"text-lg font-semibold text-white",children:f("deposit.title")}),B.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:B.jsx(Wd,{className:"h-4 w-4"})})]}),B.jsx(qh,{currentActiveChain:m,chainList:o,onChainChange:y,curSelectToken:w,onTokenChange:A,walletType:ti(r)?Fn:Ua}),ti(r)&&B.jsx(lP,{address:r.smartWalletAddress,currentActiveChain:m,selectedToken:w,onDeposit:a,onCopy:u,onClose:n}),xP(r)&&B.jsx(vP,{address:r.ethAddress,currentActiveChain:m,selectedToken:w,platformBalance:i,isLoading:t,wagmiHooks:c,onChainChange:y,onDeposit:a,onClose:n})]})})}),document.body):null},EP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",onWithdrawAmountChange:a,onReceiverAddressChange:u,onAmountChanged:l,showPoolBalanceInsufficientTip:d=!1})=>{const{t:f}=Ht(),p=x.useMemo(()=>{if(!Ge(r==null?void 0:r.chainId)){const A=new $e(e||"0").minus(s||"0").decimalPlaces(2,$e.ROUND_DOWN);return A.isNegative()?"0.00":A.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId]),h=x.useMemo(()=>o||"0",[o]),m=x.useMemo(()=>{const A=(n==null?void 0:n.feeRate)||(r==null?void 0:r.feeRate)||0;try{return new $e(A||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,r==null?void 0:r.feeRate]),w=A=>{const M=A.target.value,F=ou(M,h||"0");if(F.isValid)a(F.formattedValue),F.errorType;else return F.errorType==="exceed_balance",void 0;l==null||l(F.formattedValue)},T=()=>{a(h),l==null||l(h)},y=()=>{const A=parseFloat(o||"0"),M=parseFloat(e||"0");if(M>0){const L=A-M,F=Tt(Math.max(0,L).toString());return B.jsxs("span",{className:"flex items-center gap-1",children:[Tt(o||"0"),B.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),F," ",t]})}return`${Tt(o||"0")} ${t}`};return B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[B.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:e,onChange:w,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),B.jsx("button",{onClick:T,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),B.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),B.jsxs("div",{className:"flex justify-between items-center",children:[B.jsx(Gn,{content:f("withdraw.availableDesc"),children:B.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),B.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:y()})]})]}),i==="mpc"&&!Ge(r==null?void 0:r.chainId)&&B.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:B.jsx("input",{type:"text",placeholder:f("withdraw.receiverAddress"),value:c,onChange:A=>u==null?void 0:u(A.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),B.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Ge(r==null?void 0:r.chainId)?B.jsxs(B.Fragment,{children:[B.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.noticeDesc")}),B.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:f("withdraw.commonWithdraw")})]}):B.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.crossChainTips")})}),d&&B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:Bo,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f("withdraw.poolBalanceInsufficientTip")})]}),B.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[B.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[B.jsx(Gn,{content:B.jsxs("div",{children:[B.jsx("div",{children:f("withdraw.speedNote")}),B.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[B.jsx(No,{selectedLevel:At.FAST,maxLevel:3}),B.jsx("span",{children:f("withdraw.speedNoteSpeed1")})]}),B.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[B.jsx(No,{selectedLevel:At.Medium,maxLevel:3}),B.jsx("span",{children:f("withdraw.speedNoteSpeed2")})]}),B.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[B.jsx(No,{selectedLevel:At.SLOW,maxLevel:3}),B.jsx("span",{children:f("withdraw.speedNoteSpeed3")})]})]}),children:B.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:f("withdraw.speed")})}),B.jsx("div",{className:"flex items-center",children:B.jsx(No,{selectedLevel:Ge(r==null?void 0:r.chainId)?At.SLOW:At.FAST,maxLevel:3})})]}),!Ge(r==null?void 0:r.chainId)&&B.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[B.jsx(Gn,{content:f("withdraw.feeCalculationTip"),children:B.jsxs("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:[f("withdraw.fee"),"/",f("withdraw.feeRate")]})}),B.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t," / ",m,"%"]})]}),B.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[B.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:f(Ge(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),B.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Tt(p)," ",t]})]})]})]})},SP=[],PP={};let Ze=null;const U0=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=x.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),d=x.useCallback(h=>{s(h)},[]),f=x.useCallback(()=>n,[n]),p=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:d,isOpen:f,isLoading:p}),[a,l,u,d,f,p]),x.useEffect(()=>(Ze={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:d,isOpen:f,isLoading:p},()=>{Ze=null}),[a,l,u,d,f,p]),B.jsx(G0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||SP,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||PP,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged})});U0.displayName="WithdrawManager";const z0=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},H0=()=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.closeWithdraw()},W0=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.updateWithdrawOptions(e)},ni=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.setWithdrawLoading(e)},$P=()=>Ze?Ze.isOpen():!1,V0=()=>Ze?Ze.isLoading():!1,AP=()=>({openWithdraw:z0,closeWithdraw:H0,updateWithdrawOptions:W0,setWithdrawLoading:ni,isOpen:$P,isLoading:V0}),TP=({address:e,walletType:t,chains:n,defaultChainId:r,defaultTokenAddress:o,defaultAmount:s="",metadata:i,currentEquity:c,platformBalance:a="0",fee:u="0.00",isLoading:l=!1,wagmiHooks:d,onWithdraw:f,onClose:p,onChainChange:h,onTokenChange:m,onAmountChanged:w})=>{var Me;const{t:T}=Ht(),y=x.useMemo(()=>{const Y=[56,97],ee=me=>n==null?void 0:n.find(de=>Number(de==null?void 0:de.chainId)===me),Q=ee(Y[0])||ee(Y[1]);return Q==null?void 0:Q.rpcUrl},[n]),A=x.useMemo(()=>{const Y=[42161,421614],ee=me=>n==null?void 0:n.find(de=>Number(de==null?void 0:de.chainId)===me),Q=ee(Y[0])||ee(Y[1]);return Q==null?void 0:Q.rpcUrl},[n]),M=x.useMemo(()=>{var qn,Je;const Y="USDC";if(!n||n.length===0)return{chainId:1,tokenSymbol:""};const ee=Zn=>Array.isArray(Zn.tokenList)&&Zn.tokenList.some(ri=>(ri.token||ri.symbol||"").toUpperCase()===Y),Q=n.find(ee)||n[0];if(!Q||!Array.isArray(Q.tokenList)||Q.tokenList.length===0)return{chainId:(Q==null?void 0:Q.chainId)||1,tokenSymbol:""};const me=Q.tokenList.find(Zn=>(Zn.token||Zn.symbol||"").toUpperCase()===Y),de=(me==null?void 0:me.token)||(me==null?void 0:me.symbol)||((qn=Q.tokenList[0])==null?void 0:qn.token)||((Je=Q.tokenList[0])==null?void 0:Je.symbol)||"";return{chainId:Q.chainId,tokenSymbol:de}},[n]),{ARB_USDC_BALANCE:L,ARB_USDT_BALANCE:F,BNB_USDT_BALANCE:j}=Xv({bscRpcUrl:y,arbitrumRpcUrl:A}),[g,v]=x.useState(()=>M.chainId),[$,I]=x.useState(()=>M.tokenSymbol),[N,P]=x.useState(s),[S,E]=x.useState(""),C=x.useCallback(Y=>{v(Y),h==null||h(Y)},[h]),O=x.useCallback(Y=>{I(Y),m==null||m(Y)},[m]),b=x.useRef(!0),k=x.useRef($),D=x.useRef(g);x.useEffect(()=>{if(b.current){b.current=!1,k.current=$,D.current=g;return}(k.current!==$||D.current!==g)&&(P(""),k.current=$,D.current=g)},[$,g]);const U=n&&n.length>0?n.find(Y=>Y.chainId===g)||n[0]:null,_=(Me=U==null?void 0:U.tokenList)==null?void 0:Me.find(Y=>Y.token===$),{multicallResult:H,queryComponents:K}=F0({account:e,chainId:g,contractAddress:void 0,tokens:(U==null?void 0:U.tokenList)||[],wagmiHooks:d}),W=x.useMemo(()=>{var ee;if(!_)return;if(!_.tokenAddress||_.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return H.baseTokenBalance.formatted;const Y=H.combinedData[_.tokenAddress];return((ee=Y==null?void 0:Y.balance)==null?void 0:ee.formatted)||"0"},[_,H]),Z=Y=>{if(!Y)return"0";const ee=Y.indexOf(".");return ee>=0?Y.slice(0,ee):Y},G=x.useMemo(()=>{const Y=($||"").toUpperCase(),ee=Number(g),Q=me=>{const de=Z(me);try{const Je=new $e(de||"0").minus(1e4);return Je.isGreaterThan(0)?Je.toFixed(0):"0"}catch{return"0"}};if(Ge(ee))return"∞";if(ee===42161||ee===421614){if(Y==="USDT")return Q(F);if(Y==="USDC")return Q(L)}return(ee===56||ee===97)&&Y==="USDT"?Q(j):"0"},[g,$,L,F,j]),J=x.useMemo(()=>{if(Ge(g))return!1;try{const Y=new $e(N||"0"),ee=new $e((G||"0").toString());return Y.isGreaterThan(ee)}catch{return!1}},[g,N,G]),ne=x.useMemo(()=>{const Y={},ee=($||"").toUpperCase(),Q=me=>{const de=Z(me);try{const Je=new $e(de||"0").minus(1e4);return Je.isGreaterThan(0)?Je.toFixed(0):"0"}catch{return"0"}};return(n||[]).forEach(me=>{const de=Number(me==null?void 0:me.chainId);if(de){if(Ge(de)){Y[de]="∞";return}if(de===42161||de===421614){ee==="USDT"?Y[de]=Q(F):ee==="USDC"?Y[de]=Q(L):Y[de]="0";return}if(de===56||de===97){ee==="USDT"?Y[de]=Q(j):Y[de]="0";return}Y[de]="0"}}),Y},[n,$,L,F,j]),le=x.useMemo(()=>{const Y=new $e(N||"0"),ee=new $e(u||"0"),Q=Ge(g);let me=!1;if(!Q)try{const de=new $e((G||"0").toString());me=Y.isGreaterThan(de)}catch{me=!1}return!N||Y.isZero()||!Q&&Y.isLessThan(ee)||!Q&&me?{text:T("withdraw.confirmWithdraw"),disabled:!0}:t==="mpc"&&!Q&&!S.trim()?{text:T("withdraw.invalidReceiverAddress"),disabled:!0}:{text:T("withdraw.confirmWithdraw"),disabled:!1}},[T,g,N,t,S,u,G]),Se=x.useCallback(async()=>{ni(!0);try{if(f){const ee={amount:new $e(N||"0").toString(),chainId:g,tokenAddress:(_==null?void 0:_.tokenAddress)||"",tokenSymbol:$};t==="mpc"&&!Ge(g)&&(ee.receiverAddress=S),f(ee)}}catch{ni(!1)}},[f,N,g,_==null?void 0:_.tokenAddress,$,t,S]);return!n||n.length===0?B.jsx("div",{className:"text-center py-8",children:B.jsx("p",{className:"text-gray-400",children:"No chains available"})}):U?B.jsxs(B.Fragment,{children:[K,B.jsx(qh,{currentActiveChain:U,chainList:n,chainPoolBalances:ne,onChainChange:C,curSelectToken:$,onTokenChange:O,walletType:"EVM",txType:"withdraw"}),B.jsxs("div",{className:"p-3 my-4 bg-fill-input-primary rounded-lg flex items-center justify-between h-[38px]",children:[B.jsx("div",{className:"text-text-secondary text-sm",children:Ge(g)?T("withdraw.poolBalance"):T("withdraw.crossChainPoolBalance")}),B.jsxs("div",{className:"text-text-primary text-sm font-medium",children:[G," ",$]})]}),B.jsx(EP,{withdrawAmount:N,curSelectToken:$,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:U,currentEquity:c||0,amount:N,decimals:(_==null?void 0:_.decimals)||6,tokenBalance:W,platformBalance:a,fee:u,walletType:t,receiverAddress:S,onWithdrawAmountChange:P,onReceiverAddressChange:E,onAmountChanged:w,showPoolBalanceInsufficientTip:J,poolBalanceMap:ne}),B.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${le.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Se,disabled:le.disabled||l,children:[l&&B.jsx(Mo,{size:"xs"}),le.text]})]}):B.jsx("div",{className:"text-center py-8",children:B.jsx("p",{className:"text-gray-400",children:"Loading..."})})},G0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o,chains:s,defaultChainId:i,defaultTokenAddress:c,defaultAmount:a="",metadata:u,currentEquity:l=5e3,platformBalance:d="0",fee:f,wagmiHooks:p,onWithdraw:h,onChainChange:m,onTokenChange:w,onAmountChanged:T})=>{const{t:y}=Ht();return e?Le.createPortal(B.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:B.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:B.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:A=>{A.stopPropagation()},children:[B.jsxs("div",{className:"flex items-center justify-between mb-4",children:[B.jsx("h2",{className:"text-lg font-semibold text-white",children:y("withdraw.withdraw")}),B.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:B.jsx(Wd,{className:"h-4 w-4"})})]}),B.jsx(TP,{chains:s,address:ti(o)?o.smartWalletAddress:o.ethAddress,walletType:ti(o)?"mpc":"evm",defaultChainId:i,defaultTokenAddress:c,defaultAmount:a,metadata:u,currentEquity:l,platformBalance:d,fee:f,isLoading:t,wagmiHooks:p,onWithdraw:h,onClose:n,onChainChange:m,onTokenChange:w,onAmountChanged:T})]})})}),document.body):null};ie.ChromeLoader=Mo,ie.ComponentProvider=bm,ie.DEFAULT_LOCALE=Ro,ie.Deposit=_0,ie.DepositManager=B0,ie.LOCALE_NAMES=hm,ie.LoadingSpinner=Mo,ie.SUPPORTED_LOCALES=si,ie.Tooltip=Gn,ie.Withdraw=G0,ie.WithdrawManager=U0,ie.closeDeposit=L0,ie.closeWithdraw=H0,ie.formatThousands=wm,ie.isDepositLoading=D0,ie.isWithdrawLoading=V0,ie.openDeposit=M0,ie.openWithdraw=z0,ie.setDepositLoading=ei,ie.setWithdrawLoading=ni,ie.updateDepositOptions=R0,ie.updateWithdrawOptions=W0,ie.useComponentConfig=bu,ie.useDeposit=Qv,ie.useDepositManager=gP,ie.useTranslation=Ht,ie.useWithdraw=Jv,ie.useWithdrawManager=AP,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})});
123
152
  //# sourceMappingURL=index.umd.js.map