@dcl/landing-site 0.0.1-23617073172.commit-1b94d0b

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 (135) hide show
  1. package/JumpIn.svg +7 -0
  2. package/assets/AnimatedBackground-BzCdmJe0.js +79 -0
  3. package/assets/FooterLanding-CAnbewff.js +1 -0
  4. package/assets/RoobertPRO-Bold-BLoSpx-h.otf +0 -0
  5. package/assets/RoobertPRO-Bold-zQ2qeH97.ttf +0 -0
  6. package/assets/add-B0mw33H-.js +15 -0
  7. package/assets/all-wallets-BKHVM3IF.js +6 -0
  8. package/assets/app-store-CYXevwgU.js +17 -0
  9. package/assets/apple-Gd4xIQWy.js +18 -0
  10. package/assets/arrow-bottom-C7OkmDGe.js +8 -0
  11. package/assets/arrow-bottom-circle-Djk9mHtO.js +11 -0
  12. package/assets/arrow-left-DSS-zc-_.js +8 -0
  13. package/assets/arrow-right-DtUjd1ud.js +8 -0
  14. package/assets/arrow-top-CVSFupFw.js +8 -0
  15. package/assets/auto-track-Cahm-Wf4.js +1 -0
  16. package/assets/bank-uNxVYn_m.js +14 -0
  17. package/assets/basic-BRmrmnBW.js +2128 -0
  18. package/assets/brotli_wasm_bg-NfWIZley.wasm +0 -0
  19. package/assets/browser-DWAkL3dn.js +14 -0
  20. package/assets/card-Bp_2Mxaj.js +14 -0
  21. package/assets/checkmark-CHLyENIp.js +11 -0
  22. package/assets/checkmark-bold-BBUQnsxn.js +8 -0
  23. package/assets/chevron-bottom-DqNuv8rq.js +8 -0
  24. package/assets/chevron-left-CX2lEPlF.js +8 -0
  25. package/assets/chevron-right-B2_IRqRJ.js +8 -0
  26. package/assets/chevron-top-Dek9HHwn.js +8 -0
  27. package/assets/chrome-store-BXGFuMtX.js +61 -0
  28. package/assets/clock-BZs881t-.js +8 -0
  29. package/assets/close-BLQm0ppo.js +8 -0
  30. package/assets/coinPlaceholder-CHTPQw0s.js +8 -0
  31. package/assets/compass-zymgTugJ.js +8 -0
  32. package/assets/copy-CC3ClT6b.js +15 -0
  33. package/assets/core-BbKmbY3L.js +907 -0
  34. package/assets/create-submenu-DEFVbrc5.png +0 -0
  35. package/assets/cursor-B9b2acRY.js +3 -0
  36. package/assets/cursor-transparent-W7EqHDYV.js +12 -0
  37. package/assets/custom-welcome-background-BxlFQma9.webp +0 -0
  38. package/assets/desktop-Cjdg0-Vl.js +9 -0
  39. package/assets/disconnect-Bg6F594y.js +8 -0
  40. package/assets/discord-hrp0SVCw.js +17 -0
  41. package/assets/etherscan-BZWr5RaD.js +6 -0
  42. package/assets/exclamation-triangle-Beu3xgJK.js +4 -0
  43. package/assets/explore-submenu-KVl6Dc-h.png +0 -0
  44. package/assets/extension-BpNSOEp3.js +8 -0
  45. package/assets/external-link-DnPe_xUI.js +8 -0
  46. package/assets/facebook-BTiklAat.js +26 -0
  47. package/assets/farcaster-CwDPkeLP.js +12 -0
  48. package/assets/filters-DPMHc-EZ.js +8 -0
  49. package/assets/github-CsIjVMC3.js +18 -0
  50. package/assets/google-Dq9F1MP7.js +18 -0
  51. package/assets/governance-submenu-CXxLX9nT.png +0 -0
  52. package/assets/help-circle-BztJcfSv.js +12 -0
  53. package/assets/id-Bj8Qa65f.js +12 -0
  54. package/assets/image-DyjQ2xnU.js +4 -0
  55. package/assets/index-0yNEkc8s.js +1 -0
  56. package/assets/index-8I_N421M.js +2 -0
  57. package/assets/index-BLrxeEjH.js +601 -0
  58. package/assets/index-BNrN3W5h.js +1 -0
  59. package/assets/index-BR4K2jzd.js +1 -0
  60. package/assets/index-BrKSltIn.js +1 -0
  61. package/assets/index-C-tFO0qB.js +2 -0
  62. package/assets/index-CBYpkhnB.js +395 -0
  63. package/assets/index-CEsga2rN.js +1 -0
  64. package/assets/index-CKuqw-nv.js +1 -0
  65. package/assets/index-Ch0OF5I1.js +7 -0
  66. package/assets/index-D6ZMQedT.js +1 -0
  67. package/assets/index-D90HGkMV.js +5 -0
  68. package/assets/index-DlTEcUUv.js +1 -0
  69. package/assets/index-VU0JrGQ3.js +1 -0
  70. package/assets/index-q5EOHO-4.js +1 -0
  71. package/assets/index-srlQH2fM.js +1 -0
  72. package/assets/index.es-4KXFYWf6.js +38 -0
  73. package/assets/index.umd-CIiTi8qb.js +1 -0
  74. package/assets/info-circle-M0yLnFSM.js +12 -0
  75. package/assets/info-p3EiU3hQ.js +3 -0
  76. package/assets/inherits_browser-BlmhoU4v.js +1 -0
  77. package/assets/is-plan-event-enabled-DeNtQvA5.js +1 -0
  78. package/assets/learn-submenu-Xs1jOwfy.png +0 -0
  79. package/assets/lightbulb-CJC6tDE9.js +3 -0
  80. package/assets/logo-pattern-D4X-bvlg.webp +0 -0
  81. package/assets/mail-DSO2W3iY.js +8 -0
  82. package/assets/man-default1-BEO13leF.png +0 -0
  83. package/assets/marketplace-submenu-CjxTqNhj.png +0 -0
  84. package/assets/mobile-fR1glIQ4.js +9 -0
  85. package/assets/more-DlbbY_6F.js +11 -0
  86. package/assets/network-placeholder-B8KzPhQY.js +14 -0
  87. package/assets/nftPlaceholder-BhwV6AWB.js +8 -0
  88. package/assets/off-DvzvX-Zr.js +8 -0
  89. package/assets/play-store-D2xrZam7.js +32 -0
  90. package/assets/plus-BNWFugCs.js +13 -0
  91. package/assets/qr-code-BhcOp34-.js +6 -0
  92. package/assets/recycle-horizontal-R8jOnIoo.js +9 -0
  93. package/assets/refresh-BXmKUFff.js +8 -0
  94. package/assets/reown-logo-mM_wmpSd.js +12 -0
  95. package/assets/search-gm3-bH1R.js +8 -0
  96. package/assets/send-Btky8Jae.js +15 -0
  97. package/assets/swapHorizontal-Biy93Zfl.js +8 -0
  98. package/assets/swapHorizontalBold-DV7_ZVCc.js +8 -0
  99. package/assets/swapHorizontalMedium-Cjt4byad.js +16 -0
  100. package/assets/swapHorizontalRoundedBold-DPjEaS5s.js +8 -0
  101. package/assets/swapVertical-C40pQqwB.js +8 -0
  102. package/assets/swiper-react-BALcxKpm.js +1 -0
  103. package/assets/swiper-react-BPTn8INI.css +1 -0
  104. package/assets/telegram-BLyaResm.js +16 -0
  105. package/assets/three-dots-OxU7Emnn.js +5 -0
  106. package/assets/twitch-CTJYfvIb.js +18 -0
  107. package/assets/twitterIcon-CkrscVcH.js +6 -0
  108. package/assets/vendor-mui-40jyI-Tp.js +197 -0
  109. package/assets/vendor-react-DJXYd7Dm.js +40 -0
  110. package/assets/vendor-web3-CarjtzLo.js +74 -0
  111. package/assets/verify-Do4TVEUh.js +8 -0
  112. package/assets/verify-filled-Dn6k7QuV.js +8 -0
  113. package/assets/w3m-modal-CQYCTo4E.js +642 -0
  114. package/assets/wallet-C_-8vEun.js +8 -0
  115. package/assets/wallet-placeholder-BUaaPYTt.js +14 -0
  116. package/assets/walletconnect-DaUEigG8.js +30 -0
  117. package/assets/warning-circle-BGToh6Re.js +12 -0
  118. package/assets/x-DI0y4W5T.js +12 -0
  119. package/avatar_face.png +0 -0
  120. package/catch_the_vibe/alan.mp4 +0 -0
  121. package/catch_the_vibe/alan.png +0 -0
  122. package/catch_the_vibe/roustan.mp4 +0 -0
  123. package/catch_the_vibe/roustan.png +0 -0
  124. package/come_hang_out_background.png +0 -0
  125. package/index.html +31 -0
  126. package/jump_into_background.png +0 -0
  127. package/landing_hero.png +0 -0
  128. package/package.json +21 -0
  129. package/persona.png +0 -0
  130. package/video_landing.mp4 +0 -0
  131. package/weekly-rituals/career-mondays.webp +0 -0
  132. package/weekly-rituals/play-with-friends.webp +0 -0
  133. package/weekly-rituals/takeover-tuesdays.webp +0 -0
  134. package/weekly-rituals/trivia-thursdays.webp +0 -0
  135. package/weekly-rituals/watch-party.webp +0 -0
@@ -0,0 +1,74 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Ch0OF5I1.js","assets/vendor-mui-40jyI-Tp.js","assets/vendor-react-DJXYd7Dm.js","assets/inherits_browser-BlmhoU4v.js","assets/index-BLrxeEjH.js","assets/index.es-4KXFYWf6.js"])))=>i.map(i=>d[i]);
2
+ import{r as Ae,j as uv}from"./vendor-react-DJXYd7Dm.js";import{g as Fp}from"./vendor-mui-40jyI-Tp.js";function Ks(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return i=>{const s=typeof i=="function"?i(r):i,o={...r,...s};return Object.assign(o,{extend:n(o)})}}return Object.assign(t,{extend:n(t)})}const Dp="2.44.2";let Ec={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Dp}`},F=class Su extends Error{constructor(t,n={}){const r=n.cause instanceof Su?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof Su&&n.cause.docsPath||n.docsPath,s=Ec.getDocsUrl?.({...n,docsPath:i}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Ec.version?[`Version: ${Ec.version}`]:[]].join(`
3
+ `);super(o,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=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Dp}walk(t){return zp(this,t)}};function zp(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?zp(e.cause,t):t?null:e}let pd=class extends F{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},lv=class extends F{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 dv extends F{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let fv=class extends F{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Qe(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return Qe(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function Ft(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let i=0;i<n.length-1&&n[t==="left"?i:n.length-i-1].toString()==="0";i++)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}let Hp=class extends F{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},qp=class extends F{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 Kf extends F{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 Me(e,{dir:t,size:n=32}={}){return typeof e=="string"?er(e,{dir:t,size:n}):hv(e,{dir:t,size:n})}function er(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new qp({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function hv(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new qp({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let i=0;i<n;i++){const s=t==="right";r[s?i:n-i-1]=e[s?i:e.length-i-1]}return r}const pv=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ht(e,t={}){return typeof e=="number"||typeof e=="bigint"?q(e,t):typeof e=="string"?Ir(e,t):typeof e=="boolean"?md(e,t):je(e,t)}function md(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?($t(n,{size:t.size}),Me(n,{size:t.size})):n}function je(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=pv[e[i]];const r=`0x${n}`;return typeof t.size=="number"?($t(r,{size:t.size}),Me(r,{dir:"right",size:t.size})):r}function q(e,t={}){const{signed:n,size:r}=t,i=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 o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const c=typeof e=="bigint"?"n":"";throw new pd({max:s?`${s}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?Me(a,{size:r}):a}const mv=new TextEncoder;function Ir(e,t={}){const n=mv.encode(e);return je(n,t)}const yv=new TextEncoder;function ji(e,t={}){return typeof e=="number"||typeof e=="bigint"?gv(e,t):typeof e=="boolean"?bv(e,t):Qe(e)?ct(e,t):Cn(e,t)}function bv(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?($t(n,{size:t.size}),Me(n,{size:t.size})):n}const cn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Zf(e){if(e>=cn.zero&&e<=cn.nine)return e-cn.zero;if(e>=cn.A&&e<=cn.F)return e-(cn.A-10);if(e>=cn.a&&e<=cn.f)return e-(cn.a-10)}function ct(e,t={}){let n=e;t.size&&($t(n,{size:t.size}),n=Me(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,s=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const c=Zf(r.charCodeAt(a++)),u=Zf(r.charCodeAt(a++));if(c===void 0||u===void 0)throw new F(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);s[o]=c*16+u}return s}function gv(e,t){const n=q(e,t);return ct(n)}function Cn(e,t={}){const n=yv.encode(e);return typeof t.size=="number"?($t(n,{size:t.size}),Me(n,{dir:"right",size:t.size})):n}function $t(e,{size:t}){if(we(e)>t)throw new fv({givenSize:we(e),maxSize:t})}function Le(e,t={}){const{signed:n}=t;t.size&&$t(e,{size:t.size});const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function wv(e,t={}){let n=e;if(t.size&&($t(n,{size:t.size}),n=Ft(n)),Ft(n)==="0x00")return!1;if(Ft(n)==="0x01")return!0;throw new dv(n)}function pt(e,t={}){const n=Le(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new pd({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}function Yf(e,t={}){let n=ct(e);return t.size&&($t(n,{size:t.size}),n=Ft(n,{dir:"right"})),new TextDecoder().decode(n)}const Gp={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function yd(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?pt(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?pt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Gp[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=vv(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function vv(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 Vp(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:yd(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}function sn(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const Wp={"0x0":"reverted","0x1":"success"};function bd(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>sn(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?pt(e.transactionIndex):null,status:e.status?Wp[e.status]:null,type:e.type?Gp[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const xv={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Zs(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Ev(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>je(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=q(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=q(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=q(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=q(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=xv[e.type]),typeof e.value<"u"&&(n.value=q(e.value)),n}function Ev(e){return e.map(t=>({address:t.address,r:t.r?q(BigInt(t.r)):t.r,s:t.s?q(BigInt(t.s)):t.s,chainId:q(t.chainId),nonce:q(t.nonce),...typeof t.yParity<"u"?{yParity:q(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:q(t.v)}:{}}))}const _v=2n**256n-1n;function Xe(e){return typeof e[0]=="string"?Mn(e):Sv(e)}function Sv(e){let t=0;for(const i of e)t+=i.length;const n=new Uint8Array(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}function Mn(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}let Qf=class extends F{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},Kp=class extends F{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},Iv=class extends F{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const Av={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 Iv({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Kp({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Qf({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 Qf({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 gd(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Av);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function Pv(e,t="hex"){const n=Zp(e),r=gd(new Uint8Array(n.length));return n.encode(r),t==="hex"?je(r.bytes):r.bytes}function Zp(e){return Array.isArray(e)?kv(e.map(t=>Zp(t))):Cv(e)}function kv(e){const t=e.reduce((i,s)=>i+s.length,0),n=Yp(t);return{length:t<=55?1+t:1+n+t,encode(i){t<=55?i.pushByte(192+t):(i.pushByte(247+n),n===1?i.pushUint8(t):n===2?i.pushUint16(t):n===3?i.pushUint24(t):i.pushUint32(t));for(const{encode:s}of e)s(i)}}}function Cv(e){const t=typeof e=="string"?ct(e):e,n=Yp(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(i){t.length===1&&t[0]<128?i.pushBytes(t):t.length<=55?(i.pushByte(128+t.length),i.pushBytes(t)):(i.pushByte(183+n),n===1?i.pushUint8(t.length):n===2?i.pushUint16(t.length):n===3?i.pushUint24(t.length):i.pushUint32(t.length),i.pushBytes(t))}}}function Yp(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 F("Length is too large.")}const Bv={gwei:9,wei:18},Ov={ether:-9,wei:9};function Qp(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[i,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${i||"0"}${s?`.${s}`:""}`}function wd(e,t="wei"){return Qp(e,Bv[t])}function rt(e,t="wei"){return Qp(e,Ov[t])}function Fi(e){const t=Object.entries(e).map(([r,i])=>i===void 0||i===!1?null:[r,i]).filter(Boolean),n=t.reduce((r,[i])=>Math.max(r,i.length),0);return t.map(([r,i])=>` ${`${r}:`.padEnd(n+1)} ${i}`).join(`
4
+ `)}class Tv extends F{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Fi(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 $v extends F{constructor(t,{account:n,docsPath:r,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:d,value:f}){const h=Fi({chain:i&&`${i?.name} (id: ${i?.id})`,from:n?.address,to:d,value:typeof f<"u"&&`${wd(f)} ${i?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${rt(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${rt(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${rt(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",h].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Jp extends F{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:i,index:s}){let o="Transaction";r&&s!==void 0&&(o=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(o=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(o=`Transaction at block number "${n}" at index "${s}"`),i&&(o=`Transaction with hash "${i}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}}class Xp extends F{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 Nv extends F{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class Mv extends F{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}function em(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=>ct(s)):e.blobs,i=[];for(const s of r)i.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?i:i.map(s=>je(s))}function tm(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(o=>ct(o)):e.blobs,i=typeof e.commitments[0]=="string"?e.commitments.map(o=>ct(o)):e.commitments,s=[];for(let o=0;o<r.length;o++){const a=r[o],c=i[o];s.push(Uint8Array.from(t.computeBlobKzgProof(a,c)))}return n==="bytes"?s:s.map(o=>je(o))}const Vr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Lv(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ps(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Ar(e,...t){if(!Lv(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 Rv(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");ps(e.outputLen),ps(e.blockLen)}function mi(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 nm(e,t){Ar(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Uv(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function rr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function _c(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Gt(e,t){return e<<32-t|e>>>t}const jv=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Fv(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Dv(e){for(let t=0;t<e.length;t++)e[t]=Fv(e[t]);return e}const Jf=jv?e=>e:Dv;function zv(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ta(e){return typeof e=="string"&&(e=zv(e)),Ar(e),e}function Hv(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];Ar(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}let vd=class{};function $a(e){const t=r=>e().update(Ta(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function qv(e=32){if(Vr&&typeof Vr.getRandomValues=="function")return Vr.getRandomValues(new Uint8Array(e));if(Vr&&typeof Vr.randomBytes=="function")return Uint8Array.from(Vr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}function Gv(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}function Vv(e,t,n){return e&t^~e&n}function Wv(e,t,n){return e&t^e&n^t&n}let rm=class extends vd{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=_c(this.buffer)}update(t){mi(this),t=Ta(t),Ar(t);const{view:n,buffer:r,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=_c(t);for(;i<=s-o;o+=i)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){mi(this),nm(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,rr(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;Gv(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=_c(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.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:i,finished:s,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=a,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const jn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),tt=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),nt=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),xo=BigInt(2**32-1),Xf=BigInt(32);function Kv(e,t=!1){return t?{h:Number(e&xo),l:Number(e>>Xf&xo)}:{h:Number(e>>Xf&xo)|0,l:Number(e&xo)|0}}function im(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let s=0;s<n;s++){const{h:o,l:a}=Kv(e[s],t);[r[s],i[s]]=[o,a]}return[r,i]}const e0=(e,t,n)=>e>>>n,t0=(e,t,n)=>e<<32-n|t>>>n,Wr=(e,t,n)=>e>>>n|t<<32-n,Kr=(e,t,n)=>e<<32-n|t>>>n,Eo=(e,t,n)=>e<<64-n|t>>>n-32,_o=(e,t,n)=>e>>>n-32|t<<64-n,Zv=(e,t,n)=>e<<n|t>>>32-n,Yv=(e,t,n)=>t<<n|e>>>32-n,Qv=(e,t,n)=>t<<n-32|e>>>64-n,Jv=(e,t,n)=>e<<n-32|t>>>64-n;function un(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}const Xv=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),e2=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,t2=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),n2=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,r2=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),i2=(e,t,n,r,i,s)=>t+n+r+i+s+(e/2**32|0)|0,s2=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]),Fn=new Uint32Array(64);let o2=class extends rm{constructor(t=32){super(64,t,8,!1),this.A=jn[0]|0,this.B=jn[1]|0,this.C=jn[2]|0,this.D=jn[3]|0,this.E=jn[4]|0,this.F=jn[5]|0,this.G=jn[6]|0,this.H=jn[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:o,G:a,H:c}=this;return[t,n,r,i,s,o,a,c]}set(t,n,r,i,s,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Fn[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=Fn[d-15],h=Fn[d-2],g=Gt(f,7)^Gt(f,18)^f>>>3,y=Gt(h,17)^Gt(h,19)^h>>>10;Fn[d]=y+Fn[d-7]+g+Fn[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Gt(a,6)^Gt(a,11)^Gt(a,25),h=l+f+Vv(a,c,u)+s2[d]+Fn[d]|0,y=(Gt(r,2)^Gt(r,13)^Gt(r,22))+Wv(r,i,s)|0;l=u,u=c,c=a,a=o+h|0,o=s,s=i,i=r,r=h+y|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,i,s,o,a,c,u,l)}roundClean(){rr(Fn)}destroy(){this.set(0,0,0,0,0,0,0,0),rr(this.buffer)}};const sm=im(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),a2=sm[0],c2=sm[1],Dn=new Uint32Array(80),zn=new Uint32Array(80);class om extends rm{constructor(t=64){super(128,t,16,!1),this.Ah=nt[0]|0,this.Al=nt[1]|0,this.Bh=nt[2]|0,this.Bl=nt[3]|0,this.Ch=nt[4]|0,this.Cl=nt[5]|0,this.Dh=nt[6]|0,this.Dl=nt[7]|0,this.Eh=nt[8]|0,this.El=nt[9]|0,this.Fh=nt[10]|0,this.Fl=nt[11]|0,this.Gh=nt[12]|0,this.Gl=nt[13]|0,this.Hh=nt[14]|0,this.Hl=nt[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:d,Fl:f,Gh:h,Gl:g,Hh:y,Hl:m}=this;return[t,n,r,i,s,o,a,c,u,l,d,f,h,g,y,m]}set(t,n,r,i,s,o,a,c,u,l,d,f,h,g,y,m){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=d|0,this.Fl=f|0,this.Gh=h|0,this.Gl=g|0,this.Hh=y|0,this.Hl=m|0}process(t,n){for(let x=0;x<16;x++,n+=4)Dn[x]=t.getUint32(n),zn[x]=t.getUint32(n+=4);for(let x=16;x<80;x++){const E=Dn[x-15]|0,v=zn[x-15]|0,I=Wr(E,v,1)^Wr(E,v,8)^e0(E,v,7),A=Kr(E,v,1)^Kr(E,v,8)^t0(E,v,7),B=Dn[x-2]|0,T=zn[x-2]|0,M=Wr(B,T,19)^Eo(B,T,61)^e0(B,T,6),j=Kr(B,T,19)^_o(B,T,61)^t0(B,T,6),k=t2(A,j,zn[x-7],zn[x-16]),L=n2(k,I,M,Dn[x-7],Dn[x-16]);Dn[x]=L|0,zn[x]=k|0}let{Ah:r,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:d,El:f,Fh:h,Fl:g,Gh:y,Gl:m,Hh:w,Hl:S}=this;for(let x=0;x<80;x++){const E=Wr(d,f,14)^Wr(d,f,18)^Eo(d,f,41),v=Kr(d,f,14)^Kr(d,f,18)^_o(d,f,41),I=d&h^~d&y,A=f&g^~f&m,B=r2(S,v,A,c2[x],zn[x]),T=i2(B,w,E,I,a2[x],Dn[x]),M=B|0,j=Wr(r,i,28)^Eo(r,i,34)^Eo(r,i,39),k=Kr(r,i,28)^_o(r,i,34)^_o(r,i,39),L=r&s^r&a^s&a,$=i&o^i&c^o&c;w=y|0,S=m|0,y=h|0,m=g|0,h=d|0,g=f|0,{h:d,l:f}=un(u|0,l|0,T|0,M|0),u=a|0,l=c|0,a=s|0,c=o|0,s=r|0,o=i|0;const C=Xv(M,k,$);r=e2(C,T,j,L),i=C|0}({h:r,l:i}=un(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:o}=un(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=un(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=un(this.Dh|0,this.Dl|0,u|0,l|0),{h:d,l:f}=un(this.Eh|0,this.El|0,d|0,f|0),{h,l:g}=un(this.Fh|0,this.Fl|0,h|0,g|0),{h:y,l:m}=un(this.Gh|0,this.Gl|0,y|0,m|0),{h:w,l:S}=un(this.Hh|0,this.Hl|0,w|0,S|0),this.set(r,i,s,o,a,c,u,l,d,f,h,g,y,m,w,S)}roundClean(){rr(Dn,zn)}destroy(){rr(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class u2 extends om{constructor(){super(48),this.Ah=tt[0]|0,this.Al=tt[1]|0,this.Bh=tt[2]|0,this.Bl=tt[3]|0,this.Ch=tt[4]|0,this.Cl=tt[5]|0,this.Dh=tt[6]|0,this.Dl=tt[7]|0,this.Eh=tt[8]|0,this.El=tt[9]|0,this.Fh=tt[10]|0,this.Fl=tt[11]|0,this.Gh=tt[12]|0,this.Gl=tt[13]|0,this.Hh=tt[14]|0,this.Hl=tt[15]|0}}const xd=$a(()=>new o2),l2=$a(()=>new om),d2=$a(()=>new u2),f2=xd;function h2(e,t){return f2(Qe(e,{strict:!1})?ji(e):e)}function p2(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),i=h2(t);return i.set([n],0),r==="bytes"?i:je(i)}function m2(e){const{commitments:t,version:n}=e,r=e.to??(typeof t[0]=="string"?"hex":"bytes"),i=[];for(const s of t)i.push(p2({commitment:s,to:r,version:n}));return i}const n0=6,am=32,Ed=4096,cm=am*Ed,r0=cm*n0-1-1*Ed*n0;class y2 extends F{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class b2 extends F{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function g2(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?ct(e.data):e.data,r=we(n);if(!r)throw new b2;if(r>r0)throw new y2({maxSize:r0,size:r});const i=[];let s=!0,o=0;for(;s;){const a=gd(new Uint8Array(cm));let c=0;for(;c<Ed;){const u=n.slice(o,o+(am-1));if(a.pushByte(0),a.pushBytes(u),u.length<31){a.pushByte(128),s=!1;break}c++,o+=31}i.push(a)}return t==="bytes"?i.map(a=>a.bytes):i.map(a=>je(a.bytes))}function w2(e){const{data:t,kzg:n,to:r}=e,i=e.blobs??g2({data:t,to:r}),s=e.commitments??em({blobs:i,kzg:n,to:r}),o=e.proofs??tm({blobs:i,commitments:s,kzg:n,to:r}),a=[];for(let c=0;c<i.length;c++)a.push({blob:i[c],commitment:s[c],proof:o[c]});return a}let Tn=class extends F{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"})}};class Iu extends F{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 um extends F{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}let hr=class extends F{constructor({cause:t,message:n}={}){const r=n?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(hr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(hr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class ta extends F{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${rt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(ta,"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 Au extends F{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${rt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Au,"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 Pu extends F{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(Pu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class ku extends F{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(`
5
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(ku,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Cu extends F{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Cu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Bu extends F{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
6
+ `),{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(Bu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ou extends F{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(Ou,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Tu extends F{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(Tu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class $u extends F{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty($u,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class na extends F{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${rt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${rt(r)} gwei`:""}).`].join(`
7
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(na,"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 Ys extends F{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}let Qs=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 v2=BigInt(0),Xi=BigInt(1),x2=BigInt(2),E2=BigInt(7),_2=BigInt(256),S2=BigInt(113),lm=[],dm=[],fm=[];for(let e=0,t=Xi,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],lm.push(2*(5*r+n)),dm.push((e+1)*(e+2)/2%64);let i=v2;for(let s=0;s<7;s++)t=(t<<Xi^(t>>E2)*S2)%_2,t&x2&&(i^=Xi<<(Xi<<BigInt(s))-Xi);fm.push(i)}const hm=im(fm,!0),I2=hm[0],A2=hm[1],i0=(e,t,n)=>n>32?Qv(e,t,n):Zv(e,t,n),s0=(e,t,n)=>n>32?Jv(e,t,n):Yv(e,t,n);function P2(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],l=n[c+1],d=i0(u,l,1)^n[a],f=s0(u,l,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=d,e[o+h+1]^=f}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=dm[o],c=i0(i,s,a),u=s0(i,s,a),l=lm[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=I2[r],e[1]^=A2[r]}rr(n)}let k2=class pm extends vd{constructor(t,n,r,i=!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=i,this.rounds=s,ps(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Uv(this.state)}clone(){return this._cloneInto()}keccak(){Jf(this.state32),P2(this.state32,this.rounds),Jf(this.state32),this.posOut=0,this.pos=0}update(t){mi(this),t=Ta(t),Ar(t);const{blockLen:n,state:r}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);for(let a=0;a<o;a++)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:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){mi(this,!1),Ar(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ps(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(nm(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,rr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new pm(n,r,i,o,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=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const C2=(e,t,n)=>$a(()=>new k2(t,e,n)),mm=C2(1,136,256/8);function pe(e,t){const n=t||"hex",r=mm(Qe(e,{strict:!1})?ji(e):e);return n==="bytes"?r:ht(r)}const Sc=new Qs(8192);function Na(e,t){if(Sc.has(`${e}.${t}`))return Sc.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=pe(Cn(n),"bytes"),i=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(r[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return Sc.set(`${e}.${t}`,s),s}function Je(e,t){if(!et(e,{strict:!1}))throw new Tn({address:e});return Na(e,t)}const B2=/^0x[a-fA-F0-9]{40}$/,Ic=new Qs(8192);function et(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ic.has(r))return Ic.get(r);const i=B2.test(e)?e.toLowerCase()===e?!0:n?Na(e)===e:!0:!1;return Ic.set(r,i),i}function Pr(e,t,n,{strict:r}={}){return Qe(e,{strict:!1})?Nu(e,t,n,{strict:r}):gm(e,t,n,{strict:r})}function ym(e,t){if(typeof t=="number"&&t>0&&t>we(e)-1)throw new Hp({offset:t,position:"start",size:we(e)})}function bm(e,t,n){if(typeof t=="number"&&typeof n=="number"&&we(e)!==n-t)throw new Hp({offset:n,position:"end",size:we(e)})}function gm(e,t,n,{strict:r}={}){ym(e,t);const i=e.slice(t,n);return r&&bm(i,t,n),i}function Nu(e,t,n,{strict:r}={}){ym(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&bm(i,t,n),i}function O2(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 Tv({transaction:e})}function Di({blockNumber:e,chain:t,contract:n}){const r=t?.contracts?.[n];if(!r)throw new Iu({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Iu({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function We(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}class Ma extends F{constructor({docsPath:t}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
8
+ `),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}const T2={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."},wm={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},$2={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function Dt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new G2(e.type);return`${e.name}(${La(e.inputs,{includeName:t})})`}function La(e,{includeName:t=!1}={}){return e?e.map(n=>N2(n,{includeName:t})).join(t?", ":","):""}function N2(e,{includeName:t}){return e.type.startsWith("tuple")?`(${La(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}class M2 extends F{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(`
9
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class o0 extends F{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(`
10
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class vm extends F{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
11
+ `),{metaMessages:[`Params: (${La(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 Js extends F{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class L2 extends F{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
12
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class R2 extends F{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${we(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class xm extends F{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
13
+ `),{name:"AbiEncodingLengthMismatchError"})}}class U2 extends F{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(`
14
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class a0 extends F{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(`
15
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Em extends F{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(`
16
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class j2 extends F{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class F2 extends F{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(`
17
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class c0 extends F{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(`
18
+ `),{docsPath:n,name:"AbiEventNotFoundError"})}}class yi extends F{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(`
19
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class _m extends F{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(`
20
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class D2 extends F{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(`
21
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class z2 extends F{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Dt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Dt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let Sm=class extends F{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class ra extends F{constructor({abiItem:t,data:n,params:r,size:i}){super([`Data size of ${i} bytes is too small for non-indexed event parameters.`].join(`
22
+ `),{metaMessages:[`Params: (${La(r,{includeName:!0})})`,`Data: ${n} (${i} 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=i}}class _d extends F{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Dt(t,{includeName:!0})}".`].join(`
23
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class H2 extends F{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
24
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class q2 extends F{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
25
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Im=class extends F{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
26
+ `),{name:"InvalidArrayError"})}};class G2 extends F{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
27
+ `),{name:"InvalidDefinitionTypeError"})}}class V2 extends F{constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}const W2=e=>pe(ji(e));function K2(e){return W2(e)}const Z2="1.2.3";let bt=class Mu extends Error{constructor(t,n={}){const r=n.cause instanceof Mu?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof Mu&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${Z2}`].join(`
28
+ `);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=i,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Ln(e,t){return e.exec(t)?.groups}const Am=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Pm=/^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)?$/,km=/^\(.+?\).*?$/,u0=/^tuple(?<array>(\[(\d*)\])*)$/;function Lu(e){let t=e.type;if(u0.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let i=0;i<n;i++){const s=e.components[i];t+=Lu(s),i<n-1&&(t+=", ")}const r=Ln(u0,e.type);return t+=`)${r?.array||""}`,Lu({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function ti(e){let t="";const n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=Lu(i),r!==n-1&&(t+=", ")}return t}function ia(e){return e.type==="function"?`function ${e.name}(${ti(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${ti(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${ti(e.inputs)})`:e.type==="error"?`error ${e.name}(${ti(e.inputs)})`:e.type==="constructor"?`constructor(${ti(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Cm=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Y2(e){return Cm.test(e)}function Q2(e){return Ln(Cm,e)}const Bm=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function J2(e){return Bm.test(e)}function X2(e){return Ln(Bm,e)}const Om=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function e6(e){return Om.test(e)}function t6(e){return Ln(Om,e)}const Tm=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Ra(e){return Tm.test(e)}function n6(e){return Ln(Tm,e)}const $m=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function r6(e){return $m.test(e)}function i6(e){return Ln($m,e)}const Nm=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function s6(e){return Nm.test(e)}function o6(e){return Ln(Nm,e)}const a6=/^receive\(\) external payable$/;function c6(e){return a6.test(e)}const l0=new Set(["memory","indexed","storage","calldata"]),u6=new Set(["indexed"]),Ru=new Set(["calldata","memory","storage"]);class l6 extends bt{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 d6 extends bt{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 f6 extends bt{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 h6 extends bt{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class p6 extends bt{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class m6 extends bt{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 y6 extends bt{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 b6 extends bt{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 g6 extends bt{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 zi extends bt{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class w6 extends bt{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class v6 extends bt{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 x6 extends bt{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 E6 extends bt{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 _6(e,t,n){let r="";if(n)for(const i of Object.entries(n)){if(!i)continue;let s="";for(const o of i[1])s+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${i[0]}{${s}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const Ac=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 Uu(e,t={}){if(e6(e))return S6(e,t);if(J2(e))return I6(e,t);if(Y2(e))return A6(e,t);if(r6(e))return P6(e,t);if(s6(e))return k6(e);if(c6(e))return{type:"receive",stateMutability:"payable"};throw new w6({signature:e})}function S6(e,t={}){const n=t6(e);if(!n)throw new zi({signature:e,type:"function"});const r=vt(n.parameters),i=[],s=r.length;for(let a=0;a<s;a++)i.push($n(r[a],{modifiers:Ru,structs:t,type:"function"}));const o=[];if(n.returns){const a=vt(n.returns),c=a.length;for(let u=0;u<c;u++)o.push($n(a[u],{modifiers:Ru,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:i,outputs:o}}function I6(e,t={}){const n=X2(e);if(!n)throw new zi({signature:e,type:"event"});const r=vt(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push($n(r[o],{modifiers:u6,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:i}}function A6(e,t={}){const n=Q2(e);if(!n)throw new zi({signature:e,type:"error"});const r=vt(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push($n(r[o],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:i}}function P6(e,t={}){const n=i6(e);if(!n)throw new zi({signature:e,type:"constructor"});const r=vt(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push($n(r[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:i}}function k6(e){const t=o6(e);if(!t)throw new zi({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const C6=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,B6=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,O6=/^u?int$/;function $n(e,t){const n=_6(e,t?.type,t?.structs);if(Ac.has(n))return Ac.get(n);const r=km.test(e),i=Ln(r?B6:C6,e);if(!i)throw new p6({param:e});if(i.name&&$6(i.name))throw new m6({param:e,name:i.name});const s=i.name?{name:i.name}:{},o=i.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{};let c,u={};if(r){c="tuple";const d=vt(i.type),f=[],h=d.length;for(let g=0;g<h;g++)f.push($n(d[g],{structs:a}));u={components:f}}else if(i.type in a)c="tuple",u={components:a[i.type]};else if(O6.test(i.type))c=`${i.type}256`;else if(i.type==="address payable")c="address";else if(c=i.type,t?.type!=="struct"&&!Mm(c))throw new f6({type:c});if(i.modifier){if(!t?.modifiers?.has?.(i.modifier))throw new y6({param:e,type:t?.type,modifier:i.modifier});if(Ru.has(i.modifier)&&!N6(c,!!i.array))throw new b6({param:e,type:t?.type,modifier:i.modifier})}const l={type:`${c}${i.array??""}`,...s,...o,...u};return Ac.set(n,l),l}function vt(e,t=[],n="",r=0){const i=e.trim().length;for(let s=0;s<i;s++){const o=e[s],a=e.slice(s+1);switch(o){case",":return r===0?vt(a,[...t,n.trim()]):vt(a,t,`${n}${o}`,r);case"(":return vt(a,t,`${n}${o}`,r+1);case")":return vt(a,t,`${n}${o}`,r-1);default:return vt(a,t,`${n}${o}`,r)}}if(n==="")return t;if(r!==0)throw new E6({current:n,depth:r});return t.push(n.trim()),t}function Mm(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Am.test(e)||Pm.test(e)}const T6=/^(?: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 $6(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Am.test(e)||Pm.test(e)||T6.test(e)}function N6(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Sd(e){const t={},n=e.length;for(let o=0;o<n;o++){const a=e[o];if(!Ra(a))continue;const c=n6(a);if(!c)throw new zi({signature:a,type:"struct"});const u=c.properties.split(";"),l=[],d=u.length;for(let f=0;f<d;f++){const g=u[f].trim();if(!g)continue;const y=$n(g,{type:"struct"});l.push(y)}if(!l.length)throw new v6({signature:a});t[c.name]=l}const r={},i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,c]=i[o];r[a]=Lm(c,t)}return r}const M6=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Lm(e=[],t={},n=new Set){const r=[],i=e.length;for(let s=0;s<i;s++){const o=e[s];if(km.test(o.type))r.push(o);else{const c=Ln(M6,o.type);if(!c?.type)throw new g6({abiParameter:o});const{array:u,type:l}=c;if(l in t){if(n.has(l))throw new x6({type:l});r.push({...o,type:`tuple${u??""}`,components:Lm(t[l],t,new Set([...n,l]))})}else if(Mm(l))r.push(o);else throw new d6({type:l})}}return r}function Id(e){const t=Sd(e),n=[],r=e.length;for(let i=0;i<r;i++){const s=e[i];Ra(s)||n.push(Uu(s,t))}return n}function d0(e){let t;if(typeof e=="string")t=Uu(e);else{const n=Sd(e),r=e.length;for(let i=0;i<r;i++){const s=e[i];if(!Ra(s)){t=Uu(s,n);break}}}if(!t)throw new l6({signature:e});return t}function f0(e){const t=[];if(typeof e=="string"){const n=vt(e),r=n.length;for(let i=0;i<r;i++)t.push($n(n[i],{modifiers:l0}))}else{const n=Sd(e),r=e.length;for(let i=0;i<r;i++){const s=e[i];if(Ra(s))continue;const o=vt(s),a=o.length;for(let c=0;c<a;c++)t.push($n(o[c],{modifiers:l0,structs:n}))}}if(t.length===0)throw new h6({params:e});return t}function L6(e){let t=!0,n="",r=0,i="",s=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function",""].includes(i))i="";else if(i+=a,a===")"){s=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}i+=a,n+=a}}if(!s)throw new F("Unable to normalize signature.");return i}const R6=e=>{const t=typeof e=="string"?e:ia(e);return L6(t)};function Rm(e){return K2(R6(e))}const Xs=e=>Pr(Rm(e),0,4);function U6(e,t={}){typeof t.size<"u"&&$t(e,{size:t.size});const n=je(e,t);return Le(n,t)}function j6(e,t={}){let n=e;if(typeof t.size<"u"&&($t(n,{size:t.size}),n=Ft(n)),n.length>1||n[0]>1)throw new lv(n);return!!n[0]}function Bn(e,t={}){typeof t.size<"u"&&$t(e,{size:t.size});const n=je(e,t);return pt(n,t)}function F6(e,t={}){let n=e;return typeof t.size<"u"&&($t(n,{size:t.size}),n=Ft(n,{dir:"right"})),new TextDecoder().decode(n)}const D6=/^(.*)\[([0-9]*)\]$/,Um=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ad=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function mt(e,t){if(e.length!==t.length)throw new xm({expectedLength:e.length,givenLength:t.length});const n=z6({params:e,values:t}),r=kd(n);return r.length===0?"0x":r}function z6({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Pd({param:e[r],value:t[r]}));return n}function Pd({param:e,value:t}){const n=Cd(e.type);if(n){const[r,i]=n;return q6(t,{length:r,param:{...e,type:i}})}if(e.type==="tuple")return Z6(t,{param:e});if(e.type==="address")return H6(t);if(e.type==="bool")return V6(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,i="256"]=Ad.exec(e.type)??[];return W6(t,{signed:r,size:Number(i)})}if(e.type.startsWith("bytes"))return G6(t,{param:e});if(e.type==="string")return K6(t);throw new H2(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function kd(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?t+=32:t+=we(a)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(q(t+i,{size:32})),r.push(a),i+=we(a)):n.push(a)}return Xe([...n,...r])}function H6(e){if(!et(e))throw new Tn({address:e});return{dynamic:!1,encoded:er(e.toLowerCase())}}function q6(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Im(e);if(!r&&e.length!==t)throw new L2({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let i=!1;const s=[];for(let o=0;o<e.length;o++){const a=Pd({param:n,value:e[o]});a.dynamic&&(i=!0),s.push(a)}if(r||i){const o=kd(s);if(r){const a=q(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Xe([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Xe(s.map(({encoded:o})=>o))}}function G6(e,{param:t}){const[,n]=t.type.split("bytes"),r=we(e);if(!n){let i=e;return r%32!==0&&(i=er(i,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Xe([er(q(r,{size:32})),i])}}if(r!==Number.parseInt(n,10))throw new R2({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:er(e,{dir:"right"})}}function V6(e){if(typeof e!="boolean")throw new F(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:er(md(e))}}function W6(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new pd({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:q(e,{size:32,signed:t})}}function K6(e){const t=Ir(e),n=Math.ceil(we(t)/32),r=[];for(let i=0;i<n;i++)r.push(er(Pr(t,i*32,(i+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Xe([er(q(we(t),{size:32})),...r])}}function Z6(e,{param:t}){let n=!1;const r=[];for(let i=0;i<t.components.length;i++){const s=t.components[i],o=Array.isArray(e)?i:s.name,a=Pd({param:s,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?kd(r):Xe(r.map(({encoded:i})=>i))}}function Cd(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Ur(e,t){const n=typeof t=="string"?ct(t):t,r=gd(n);if(we(n)===0&&e.length>0)throw new Js;if(we(t)&&we(t)<32)throw new vm({data:typeof t=="string"?t:je(t),params:e,size:we(t)});let i=0;const s=[];for(let o=0;o<e.length;++o){const a=e[o];r.setPosition(i);const[c,u]=ai(r,a,{staticPosition:0});i+=u,s.push(c)}return s}function ai(e,t,{staticPosition:n}){const r=Cd(t.type);if(r){const[i,s]=r;return Q6(e,{...t,type:s},{length:i,staticPosition:n})}if(t.type==="tuple")return t5(e,t,{staticPosition:n});if(t.type==="address")return Y6(e);if(t.type==="bool")return J6(e);if(t.type.startsWith("bytes"))return X6(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return e5(e,t);if(t.type==="string")return n5(e,{staticPosition:n});throw new q2(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const h0=32,ju=32;function Y6(e){const t=e.readBytes(32);return[Na(je(gm(t,-20))),32]}function Q6(e,t,{length:n,staticPosition:r}){if(!n){const o=Bn(e.readBytes(ju)),a=r+o,c=a+h0;e.setPosition(a);const u=Bn(e.readBytes(h0)),l=ms(t);let d=0;const f=[];for(let h=0;h<u;++h){e.setPosition(c+(l?h*32:d));const[g,y]=ai(e,t,{staticPosition:c});d+=y,f.push(g)}return e.setPosition(r+32),[f,32]}if(ms(t)){const o=Bn(e.readBytes(ju)),a=r+o,c=[];for(let u=0;u<n;++u){e.setPosition(a+u*32);const[l]=ai(e,t,{staticPosition:a});c.push(l)}return e.setPosition(r+32),[c,32]}let i=0;const s=[];for(let o=0;o<n;++o){const[a,c]=ai(e,t,{staticPosition:r+i});i+=c,s.push(a)}return[s,i]}function J6(e){return[j6(e.readBytes(32),{size:32}),32]}function X6(e,t,{staticPosition:n}){const[r,i]=t.type.split("bytes");if(!i){const o=Bn(e.readBytes(32));e.setPosition(n+o);const a=Bn(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[je(c),32]}return[je(e.readBytes(Number.parseInt(i,10),32)),32]}function e5(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),i=e.readBytes(32);return[r>48?U6(i,{signed:n}):Bn(i,{signed:n}),32]}function t5(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:o})=>!o),i=r?[]:{};let s=0;if(ms(t)){const o=Bn(e.readBytes(ju)),a=n+o;for(let c=0;c<t.components.length;++c){const u=t.components[c];e.setPosition(a+s);const[l,d]=ai(e,u,{staticPosition:a});s+=d,i[r?c:u?.name]=l}return e.setPosition(n+32),[i,32]}for(let o=0;o<t.components.length;++o){const a=t.components[o],[c,u]=ai(e,a,{staticPosition:n});i[r?o:a?.name]=c,s+=u}return[i,s]}function n5(e,{staticPosition:t}){const n=Bn(e.readBytes(32)),r=t+n;e.setPosition(r);const i=Bn(e.readBytes(32));if(i===0)return e.setPosition(t+32),["",32];const s=e.readBytes(i,32),o=F6(Ft(s));return e.setPosition(t+32),[o,32]}function ms(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(ms);const n=Cd(e.type);return!!(n&&ms({...e,type:n[1]}))}function Bd(e){const{abi:t,data:n}=e,r=Pr(n,0,4);if(r==="0x")throw new Js;const s=[...t||[],wm,$2].find(o=>o.type==="error"&&r===Xs(Dt(o)));if(!s)throw new Em(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Ur(s.inputs,Pr(n,4)):void 0,errorName:s.name}}const Oe=(e,t,n)=>JSON.stringify(e,(r,i)=>typeof i=="bigint"?i.toString():i,n);function jm({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((i,s)=>`${r&&i.name?`${i.name}: `:""}${typeof t[s]=="object"?Oe(t[s]):t[s]}`).join(", ")})`}const Ua=Rm;function jr(e){const{abi:t,args:n=[],name:r}=e,i=Qe(r,{strict:!1}),s=t.filter(a=>i?a.type==="function"?Xs(a)===r:a.type==="event"?Ua(a)===r:!1:"name"in a&&a.name===r);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((u,l)=>{const d="inputs"in a&&a.inputs[l];return d?Fu(u,d):!1})){if(o&&"inputs"in o&&o.inputs){const u=Fm(a.inputs,o.inputs,n);if(u)throw new z2({abiItem:a,type:u[0]},{abiItem:o,type:u[1]})}o=a}}return o||s[0]}function Fu(e,t){const n=typeof e,r=t.type;switch(r){case"address":return et(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((i,s)=>n==="object"&&Fu(Object.values(e)[s],i)):/^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(i=>Fu(i,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Fm(e,t,n){for(const r in e){const i=e[r],s=t[r];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Fm(i.components,s.components,n[r]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?et(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?et(n[r],{strict:!1}):!1)return o}}class r5 extends F{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class i5 extends F{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function p0(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
29
+ `,"")}function s5(e){return e.reduce((t,{address:n,...r})=>{let i=`${t} ${n}:
30
+ `;return r.nonce&&(i+=` nonce: ${r.nonce}
31
+ `),r.balance&&(i+=` balance: ${r.balance}
32
+ `),r.code&&(i+=` code: ${r.code}
33
+ `),r.state&&(i+=` state:
34
+ `,i+=p0(r.state)),r.stateDiff&&(i+=` stateDiff:
35
+ `,i+=p0(r.stateDiff)),i},` State Override:
36
+ `).slice(0,-1)}const o5=e=>e,eo=e=>e;class Dm extends F{constructor(t,{account:n,docsPath:r,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:d,value:f,stateOverride:h}){const g=n?We(n):void 0;let y=Fi({from:g?.address,to:d,value:typeof f<"u"&&`${wd(f)} ${i?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${rt(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${rt(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${rt(u)} gwei`,nonce:l});h&&(y+=`
37
+ ${s5(h)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",y].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Od extends F{constructor(t,{abi:n,args:r,contractAddress:i,docsPath:s,functionName:o,sender:a}){const c=jr({abi:n,args:r,name:o}),u=c?jm({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=c?Dt(c,{includeName:!0}):void 0,d=Fi({address:i&&o5(i),function:l,args:u&&u!=="()"&&`${[...Array(o?.length??0).keys()].map(()=>" ").join("")}${u}`,sender:a});super(t.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{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=i,this.functionName=o,this.sender=a}}class sa extends F{constructor({abi:t,data:n,functionName:r,message:i}){let s,o,a,c;if(n&&n!=="0x")try{o=Bd({abi:t,data:n});const{abiItem:l,errorName:d,args:f}=o;if(d==="Error")c=f[0];else if(d==="Panic"){const[h]=f;c=T2[h]}else{const h=l?Dt(l,{includeName:!0}):void 0,g=l&&f?jm({abiItem:l,args:f,includeFunctionName:!1,includeName:!1}):void 0;a=[h?`Error: ${h}`:"",g&&g!=="()"?` ${[...Array(d?.length??0).keys()].map(()=>" ").join("")}${g}`:""]}}catch(l){s=l}else i&&(c=i);let u;s instanceof Em&&(u=s.signature,a=[`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(c&&c!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,c||u].join(`
38
+ `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:a,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=o,this.raw=n,this.reason=c,this.signature=u}}class zm extends F{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 a5 extends F{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 ja extends F{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 wr extends F{constructor({body:t,cause:n,details:r,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${eo(o)}`,t&&`Request body: ${Oe(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=i,this.status=s,this.url=o}}class Td extends F{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${eo(r)}`,`Request body: ${Oe(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class m0 extends F{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${eo(n)}`,`Request body: ${Oe(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const c5=-1;class gt extends F{constructor(t,{code:n,docsPath:r,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:t,docsPath:r,metaMessages:i||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 Td?t.code:n??c5}}class _t extends gt{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class ys extends gt{constructor(t){super(t,{code:ys.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(ys,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class bs extends gt{constructor(t){super(t,{code:bs.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(bs,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class gs extends gt{constructor(t,{method:n}={}){super(t,{code:gs.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(gs,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ws extends gt{constructor(t){super(t,{code:ws.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
39
+ `)})}}Object.defineProperty(ws,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class kr extends gt{constructor(t){super(t,{code:kr.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(kr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class ir extends gt{constructor(t){super(t,{code:ir.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
40
+ `)})}}Object.defineProperty(ir,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class vs extends gt{constructor(t){super(t,{code:vs.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(vs,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class tr extends gt{constructor(t){super(t,{code:tr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(tr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class bi extends gt{constructor(t){super(t,{code:bi.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(bi,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class pr extends gt{constructor(t,{method:n}={}){super(t,{code:pr.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(pr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class gi extends gt{constructor(t){super(t,{code:gi.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(gi,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class xs extends gt{constructor(t){super(t,{code:xs.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(xs,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class he extends _t{constructor(t){super(t,{code:he.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(he,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Es extends _t{constructor(t){super(t,{code:Es.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Es,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class _s extends _t{constructor(t,{method:n}={}){super(t,{code:_s.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(_s,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Ss extends _t{constructor(t){super(t,{code:Ss.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Ss,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Is extends _t{constructor(t){super(t,{code:Is.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Is,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Tt extends _t{constructor(t){super(t,{code:Tt.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Tt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class As extends _t{constructor(t){super(t,{code:As.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(As,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Ps extends _t{constructor(t){super(t,{code:Ps.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Ps,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class ks extends _t{constructor(t){super(t,{code:ks.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(ks,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class Cs extends _t{constructor(t){super(t,{code:Cs.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(Cs,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Bs extends _t{constructor(t){super(t,{code:Bs.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Bs,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Os extends _t{constructor(t){super(t,{code:Os.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Os,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Ts extends _t{constructor(t){super(t,{code:Ts.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Ts,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class u5 extends gt{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function Fa(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof F?e.walk(i=>i?.code===hr.code):e;return r instanceof F?new hr({cause:e,message:r.details}):hr.nodeMessage.test(n)?new hr({cause:e,message:e.details}):ta.nodeMessage.test(n)?new ta({cause:e,maxFeePerGas:t?.maxFeePerGas}):Au.nodeMessage.test(n)?new Au({cause:e,maxFeePerGas:t?.maxFeePerGas}):Pu.nodeMessage.test(n)?new Pu({cause:e,nonce:t?.nonce}):ku.nodeMessage.test(n)?new ku({cause:e,nonce:t?.nonce}):Cu.nodeMessage.test(n)?new Cu({cause:e,nonce:t?.nonce}):Bu.nodeMessage.test(n)?new Bu({cause:e}):Ou.nodeMessage.test(n)?new Ou({cause:e,gas:t?.gas}):Tu.nodeMessage.test(n)?new Tu({cause:e,gas:t?.gas}):$u.nodeMessage.test(n)?new $u({cause:e}):na.nodeMessage.test(n)?new na({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new Ys({cause:e})}function Hm(e,{docsPath:t,...n}){const r=(()=>{const i=Fa(e,n);return i instanceof Ys?e:i})();return new Dm(r,{docsPath:t,...n})}function Da(e,{format:t}){if(!t)return{};const n={};function r(s){const o=Object.keys(s);for(const a of o)a in e&&(n[a]=e[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&r(s[a])}const i=t(e||{});return r(i),n}function Hi(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:i}=e,s=t?We(t):void 0;if(s&&!et(s.address))throw new Tn({address:s.address});if(i&&!et(i))throw new Tn({address:i});if(n&&n>_v)throw new ta({maxFeePerGas:n});if(r&&n&&r>n)throw new na({maxFeePerGas:n,maxPriorityFeePerGas:r})}const zO=Ks({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),HO=Ks({id:137,name:"Polygon",blockTime:2e3,nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),qO=Ks({id:80002,name:"Polygon Amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://amoy.polygonscan.com",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3127388}},testnet:!0}),GO=Ks({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://11155111.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:8928790}},testnet:!0});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const $d=BigInt(0),Du=BigInt(1);function to(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Nd(e){if(!to(e))throw new Error("Uint8Array expected")}function $s(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function So(e){const t=e.toString(16);return t.length&1?"0"+t:t}function qm(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?$d:BigInt("0x"+e)}const Gm=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",l5=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ns(e){if(Nd(e),Gm)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=l5[e[n]];return t}const ln={_0:48,_9:57,A:65,F:70,a:97,f:102};function y0(e){if(e>=ln._0&&e<=ln._9)return e-ln._0;if(e>=ln.A&&e<=ln.F)return e-(ln.A-10);if(e>=ln.a&&e<=ln.f)return e-(ln.a-10)}function oa(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Gm)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 i=0,s=0;i<n;i++,s+=2){const o=y0(e.charCodeAt(s)),a=y0(e.charCodeAt(s+1));if(o===void 0||a===void 0){const c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}r[i]=o*16+a}return r}function vr(e){return qm(Ns(e))}function Vm(e){return Nd(e),qm(Ns(Uint8Array.from(e).reverse()))}function no(e,t){return oa(e.toString(16).padStart(t*2,"0"))}function Wm(e,t){return no(e,t).reverse()}function kt(e,t,n){let r;if(typeof t=="string")try{r=oa(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(to(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function aa(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];Nd(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}const Pc=e=>typeof e=="bigint"&&$d<=e;function Md(e,t,n){return Pc(e)&&Pc(t)&&Pc(n)&&t<=e&&e<n}function ci(e,t,n,r){if(!Md(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function d5(e){let t;for(t=0;e>$d;e>>=Du,t+=1);return t}const za=e=>(Du<<BigInt(e))-Du,kc=e=>new Uint8Array(e),b0=e=>Uint8Array.from(e);function f5(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=kc(e),i=kc(e),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},a=(...d)=>n(i,r,...d),c=(d=kc(0))=>{i=a(b0([0]),d),r=a(),d.length!==0&&(i=a(b0([1]),d),r=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const f=[];for(;d<t;){r=a();const h=r.slice();f.push(h),d+=r.length}return aa(...f)};return(d,f)=>{o(),c(d);let h;for(;!(h=f(u()));)c();return o(),h}}const h5={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||to(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Ha(e,t,n={}){const r=(i,s,o)=>{const a=h5[s];if(typeof a!="function")throw new Error("invalid validator function");const c=e[i];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(t))r(i,s,!1);for(const[i,s]of Object.entries(n))r(i,s,!0);return e}function g0(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const s=e(n,...r);return t.set(n,s),s}}const p5="0.1.1";function m5(){return p5}let ee=class bn extends Error{static setStaticOptions(t){bn.prototype.docsOrigin=t.docsOrigin,bn.prototype.showVersion=t.showVersion,bn.prototype.version=t.version}constructor(t,n={}){const r=(()=>{if(n.cause instanceof bn){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:n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof bn&&n.cause.docsPath||n.docsPath,s=n.docsOrigin??bn.prototype.docsOrigin,o=`${s}${i??""}`,a=!!(n.version??bn.prototype.showVersion),c=n.version??bn.prototype.version,u=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||i||a?["",r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0,a?`Version: ${c}`:void 0]:[]].filter(l=>typeof l=="string").join(`
41
+ `);super(u,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=o,this.docsOrigin=s,this.docsPath=i,this.shortMessage=t,this.showVersion=a,this.version=c}walk(t){return Km(this,t)}};Object.defineProperty(ee,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${m5()}`}});ee.setStaticOptions(ee.defaultStaticOptions);function Km(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Km(e.cause,t):t?null:e}function ro(e,t){if(ni(e)>t)throw new j5({givenSize:ni(e),maxSize:t})}const dn={zero:48,nine:57,A:65,F:70,a:97,f:102};function w0(e){if(e>=dn.zero&&e<=dn.nine)return e-dn.zero;if(e>=dn.A&&e<=dn.F)return e-(dn.A-10);if(e>=dn.a&&e<=dn.f)return e-(dn.a-10)}function y5(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new F5({size:e.length,targetSize:r,type:"Bytes"});const i=new Uint8Array(r);for(let s=0;s<r;s++){const o=n==="right";i[o?s:r-s-1]=e[o?s:e.length-s-1]}return i}function Zm(e,t={}){const{dir:n="left"}=t;let r=e,i=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)i++;return r=n==="left"?r.slice(i):r.slice(0,r.length-i),r}function qa(e,t){if(Et(e)>t)throw new I5({givenSize:Et(e),maxSize:t})}function b5(e,t){if(typeof t=="number"&&t>0&&t>Et(e)-1)throw new ny({offset:t,position:"start",size:Et(e)})}function g5(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Et(e)!==n-t)throw new ny({offset:n,position:"end",size:Et(e)})}function Ym(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const i=e.replace("0x","");if(i.length>r*2)throw new A5({size:Math.ceil(i.length/2),targetSize:r,type:"Hex"});return`0x${i[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const w5="#__bigint";function Qm(e,t,n){return JSON.stringify(e,(r,i)=>typeof i=="bigint"?i.toString()+w5:i,n)}const v5=new TextEncoder,x5=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function E5(e,t={}){const{strict:n=!1}=t;if(!e)throw new v0(e);if(typeof e!="string")throw new v0(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new x0(e);if(!e.startsWith("0x"))throw new x0(e)}function zt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function _5(e){return e instanceof Uint8Array?Ht(e):Array.isArray(e)?Ht(new Uint8Array(e)):e}function Jm(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(qa(n,t.size),Cr(n,t.size)):n}function Ht(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=x5[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(qa(r,t.size),Br(r,t.size)):r}function ot(e,t={}){const{signed:n,size:r}=t,i=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 o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const u=typeof e=="bigint"?"n":"";throw new ty({max:s?`${s}${u}`:void 0,min:`${o}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&i<0?BigInt.asUintN(r*8,BigInt(i)):i).toString(16)}`;return r?Cr(c,r):c}function Ld(e,t={}){return Ht(v5.encode(e),t)}function Cr(e,t){return Ym(e,{dir:"left",size:t})}function Br(e,t){return Ym(e,{dir:"right",size:t})}function rn(e,t,n,r={}){const{strict:i}=r;b5(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return i&&g5(s,t,n),s}function Et(e){return Math.ceil((e.length-2)/2)}function Xm(e,t={}){const{signed:n}=t;t.size&&qa(e,t.size);const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n)-1n,o=s>>1n;return r<=o?r:r-s-1n}function ey(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:Xm(e,t))}function S5(e,t={}){const{strict:n=!1}=t;try{return E5(e,{strict:n}),!0}catch{return!1}}let ty=class extends ee{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number \`${s}\` is not in safe${i?` ${i*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"})}},v0=class extends ee{constructor(t){super(`Value \`${typeof t=="object"?Qm(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"})}},x0=class extends ee{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"})}},I5=class extends ee{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"})}},ny=class extends ee{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"})}},A5=class extends ee{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"})}};const P5=new TextDecoder,k5=new TextEncoder;function C5(e){return e instanceof Uint8Array?e:typeof e=="string"?ry(e):B5(e)}function B5(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function ry(e,t={}){const{size:n}=t;let r=e;n&&(qa(e,n),r=Br(e,n));let i=r.slice(2);i.length%2&&(i=`0${i}`);const s=i.length/2,o=new Uint8Array(s);for(let a=0,c=0;a<s;a++){const u=w0(i.charCodeAt(c++)),l=w0(i.charCodeAt(c++));if(u===void 0||l===void 0)throw new ee(`Invalid byte sequence ("${i[c-2]}${i[c-1]}" in "${i}").`);o[a]=u<<4|l}return o}function O5(e,t={}){const{size:n}=t,r=k5.encode(e);return typeof n=="number"?(ro(r,n),T5(r,n)):r}function T5(e,t){return y5(e,{dir:"right",size:t})}function ni(e){return e.length}function $5(e,t,n,r={}){return e.slice(t,n)}function N5(e,t={}){const{size:n}=t;typeof n<"u"&&ro(e,n);const r=Ht(e,t);return Xm(r,t)}function M5(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(ro(r,n),r=iy(r)),r.length>1||r[0]>1)throw new U5(r);return!!r[0]}function On(e,t={}){const{size:n}=t;typeof n<"u"&&ro(e,n);const r=Ht(e,t);return ey(r,t)}function L5(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(ro(r,n),r=R5(r)),P5.decode(r)}function iy(e){return Zm(e,{dir:"left"})}function R5(e){return Zm(e,{dir:"right"})}class U5 extends ee{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let j5=class extends ee{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"})}},F5=class extends ee{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"})}};function sy(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=mm(C5(e));return n==="Bytes"?r:Ht(r)}const D5={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 q5({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new H5({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new E0({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 E0({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 z5(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(D5);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class E0 extends ee{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class H5 extends ee{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class q5 extends ee{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}let G5=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 V5={checksum:new G5(8192)},Cc=V5.checksum,W5=/^0x[a-fA-F0-9]{40}$/;function Ga(e,t={}){const{strict:n=!0}=t;if(!W5.test(e))throw new _0({address:e,cause:new K5});if(n){if(e.toLowerCase()===e)return;if(oy(e)!==e)throw new _0({address:e,cause:new Z5})}}function oy(e){if(Cc.has(e))return Cc.get(e);Ga(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=sy(O5(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 i=`0x${r.join("")}`;return Cc.set(e,i),i}function zu(e,t={}){const{strict:n=!0}=t??{};try{return Ga(e,{strict:n}),!0}catch{return!1}}class _0 extends ee{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 K5 extends ee{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 Z5 extends ee{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ft=BigInt(0),at=BigInt(1),mr=BigInt(2),Y5=BigInt(3),ay=BigInt(4),cy=BigInt(5),uy=BigInt(8);function ut(e,t){const n=e%t;return n>=ft?n:t+n}function St(e,t,n){let r=e;for(;t-- >ft;)r*=r,r%=n;return r}function Hu(e,t){if(e===ft)throw new Error("invert: expected non-zero number");if(t<=ft)throw new Error("invert: expected positive modulus, got "+t);let n=ut(e,t),r=t,i=ft,s=at;for(;n!==ft;){const a=r/n,c=r%n,u=i-s*a;r=n,n=c,i=s,s=u}if(r!==at)throw new Error("invert: does not exist");return ut(i,t)}function ly(e,t){const n=(e.ORDER+at)/ay,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Q5(e,t){const n=(e.ORDER-cy)/uy,r=e.mul(t,mr),i=e.pow(r,n),s=e.mul(t,i),o=e.mul(e.mul(s,mr),i),a=e.mul(s,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function J5(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-at,n=0;for(;t%mr===ft;)t/=mr,n++;let r=mr;const i=qi(e);for(;S0(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return ly;let s=i.pow(r,t);const o=(t+at)/mr;return function(c,u){if(c.is0(u))return u;if(S0(c,u)!==1)throw new Error("Cannot find square root");let l=n,d=c.mul(c.ONE,s),f=c.pow(u,t),h=c.pow(u,o);for(;!c.eql(f,c.ONE);){if(c.is0(f))return c.ZERO;let g=1,y=c.sqr(f);for(;!c.eql(y,c.ONE);)if(g++,y=c.sqr(y),g===l)throw new Error("Cannot find square root");const m=at<<BigInt(l-g-1),w=c.pow(d,m);l=g,d=c.sqr(w),f=c.mul(f,d),h=c.mul(h,w)}return h}}function X5(e){return e%ay===Y5?ly:e%uy===cy?Q5:J5(e)}const ex=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function tx(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=ex.reduce((r,i)=>(r[i]="function",r),t);return Ha(e,n)}function nx(e,t,n){if(n<ft)throw new Error("invalid exponent, negatives unsupported");if(n===ft)return e.ONE;if(n===at)return t;let r=e.ONE,i=t;for(;n>ft;)n&at&&(r=e.mul(r,i)),i=e.sqr(i),n>>=at;return r}function dy(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),s=e.inv(i);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),s),r}function S0(e,t){const n=(e.ORDER-at)/mr,r=e.pow(t,n),i=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function fy(e,t){t!==void 0&&ps(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function qi(e,t,n=!1,r={}){if(e<=ft)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:s}=fy(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:i,BYTES:s,MASK:za(i),ZERO:ft,ONE:at,create:c=>ut(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return ft<=c&&c<e},is0:c=>c===ft,isOdd:c=>(c&at)===at,neg:c=>ut(-c,e),eql:(c,u)=>c===u,sqr:c=>ut(c*c,e),add:(c,u)=>ut(c+u,e),sub:(c,u)=>ut(c-u,e),mul:(c,u)=>ut(c*u,e),pow:(c,u)=>nx(a,c,u),div:(c,u)=>ut(c*Hu(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Hu(c,e),sqrt:r.sqrt||(c=>(o||(o=X5(e)),o(a,c))),toBytes:c=>n?Wm(c,s):no(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return n?Vm(c):vr(c)},invertBatch:c=>dy(a,c),cmov:(c,u,l)=>l?u:c});return Object.freeze(a)}function hy(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 py(e){const t=hy(e);return t+Math.ceil(t/2)}function rx(e,t,n=!1){const r=e.length,i=hy(t),s=py(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=n?Vm(e):vr(e),a=ut(o,t-at)+at;return n?Wm(a,i):no(a,i)}let my=class extends vd{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Rv(t);const r=Ta(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 i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),rr(s)}update(t){return mi(this),this.iHash.update(t),this}digestInto(t){mi(this),Ar(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:i,destroyed:s,blockLen:o,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=a,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 yy=(e,t,n)=>new my(e,t).update(n).digest();yy.create=(e,t)=>new my(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const I0=BigInt(0),qu=BigInt(1);function Bc(e,t){const n=t.negate();return e?n:t}function by(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Oc(e,t){by(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,s=za(e),o=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:i,shiftBy:o}}function A0(e,t,n){const{windowSize:r,mask:i,maxNumber:s,shiftBy:o}=n;let a=Number(e&i),c=e>>o;a>r&&(a-=s,c+=qu);const u=t*r,l=u+Math.abs(a)-1,d=a===0,f=a<0,h=t%2!==0;return{nextN:c,offset:l,isZero:d,isNeg:f,isNegF:h,offsetF:u}}function ix(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 sx(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 Tc=new WeakMap,gy=new WeakMap;function $c(e){return gy.get(e)||1}function ox(e,t){return{constTimeNegate:Bc,hasPrecomputes(n){return $c(n)!==1},unsafeLadder(n,r,i=e.ZERO){let s=n;for(;r>I0;)r&qu&&(i=i.add(s)),s=s.double(),r>>=qu;return i},precomputeWindow(n,r){const{windows:i,windowSize:s}=Oc(r,t),o=[];let a=n,c=a;for(let u=0;u<i;u++){c=a,o.push(c);for(let l=1;l<s;l++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,i){let s=e.ZERO,o=e.BASE;const a=Oc(n,t);for(let c=0;c<a.windows;c++){const{nextN:u,offset:l,isZero:d,isNeg:f,isNegF:h,offsetF:g}=A0(i,c,a);i=u,d?o=o.add(Bc(h,r[g])):s=s.add(Bc(f,r[l]))}return{p:s,f:o}},wNAFUnsafe(n,r,i,s=e.ZERO){const o=Oc(n,t);for(let a=0;a<o.windows&&i!==I0;a++){const{nextN:c,offset:u,isZero:l,isNeg:d}=A0(i,a,o);if(i=c,!l){const f=r[u];s=s.add(d?f.negate():f)}}return s},getPrecomputes(n,r,i){let s=Tc.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&Tc.set(r,i(s))),s},wNAFCached(n,r,i){const s=$c(n);return this.wNAF(s,this.getPrecomputes(s,n,i),r)},wNAFCachedUnsafe(n,r,i,s){const o=$c(n);return o===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,n,i),r,s)},setWindowSize(n,r){by(r,t),gy.set(n,r),Tc.delete(n)}}}function ax(e,t,n,r){ix(n,e),sx(r,t);const i=n.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=d5(BigInt(i));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const u=za(c),l=new Array(Number(u)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let f=o;for(let h=d;h>=0;h-=c){l.fill(o);for(let y=0;y<s;y++){const m=r[y],w=Number(m>>BigInt(h)&u);l[w]=l[w].add(n[y])}let g=o;for(let y=l.length-1,m=o;y>0;y--)m=m.add(l[y]),g=g.add(m);if(f=f.add(g),h!==0)for(let y=0;y<c;y++)f=f.double()}return f}function wy(e){return tx(e.Fp),Ha(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...fy(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function P0(e){e.lowS!==void 0&&$s("lowS",e.lowS),e.prehash!==void 0&&$s("prehash",e.prehash)}function cx(e){const t=wy(e);Ha(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}let ux=class extends Error{constructor(t=""){super(t)}};const wn={Err:ux,_tlv:{encode:(e,t)=>{const{Err:n}=wn;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,i=So(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?So(i.length/2|128):"";return So(e)+s+i+t},decode(e,t){const{Err:n}=wn;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 i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const c=i&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+c);if(u.length!==c)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)o=o<<8|l;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=wn;if(e<Sn)throw new t("integer: negative integers are not allowed");let n=So(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}=wn;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 vr(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=wn,i=kt("signature",e),{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,s),{v:u,l}=r.decode(2,c);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=wn,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),s=r+i;return t.encode(48,s)}};function Nc(e,t){return Ns(no(e,t))}const Sn=BigInt(0),De=BigInt(1);BigInt(2);const Mc=BigInt(3),lx=BigInt(4);function dx(e){const t=cx(e),{Fp:n}=t,r=qi(t.n,t.nBitLength),i=t.toBytes||((x,E,v)=>{const I=E.toAffine();return aa(Uint8Array.from([4]),n.toBytes(I.x),n.toBytes(I.y))}),s=t.fromBytes||(x=>{const E=x.subarray(1),v=n.fromBytes(E.subarray(0,n.BYTES)),I=n.fromBytes(E.subarray(n.BYTES,2*n.BYTES));return{x:v,y:I}});function o(x){const{a:E,b:v}=t,I=n.sqr(x),A=n.mul(I,x);return n.add(n.add(A,n.mul(x,E)),v)}function a(x,E){const v=n.sqr(E),I=o(x);return n.eql(v,I)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,Mc),lx),u=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,u)))throw new Error("bad curve params: a or b");function l(x){return Md(x,De,t.n)}function d(x){const{allowedPrivateKeyLengths:E,nByteLength:v,wrapPrivateKey:I,n:A}=t;if(E&&typeof x!="bigint"){if(to(x)&&(x=Ns(x)),typeof x!="string"||!E.includes(x.length))throw new Error("invalid private key");x=x.padStart(v*2,"0")}let B;try{B=typeof x=="bigint"?x:vr(kt("private key",x,v))}catch{throw new Error("invalid private key, expected hex or "+v+" bytes, got "+typeof x)}return I&&(B=ut(B,A)),ci("private key",B,De,A),B}function f(x){if(!(x instanceof y))throw new Error("ProjectivePoint expected")}const h=g0((x,E)=>{const{px:v,py:I,pz:A}=x;if(n.eql(A,n.ONE))return{x:v,y:I};const B=x.is0();E==null&&(E=B?n.ONE:n.inv(A));const T=n.mul(v,E),M=n.mul(I,E),j=n.mul(A,E);if(B)return{x:n.ZERO,y:n.ZERO};if(!n.eql(j,n.ONE))throw new Error("invZ was invalid");return{x:T,y:M}}),g=g0(x=>{if(x.is0()){if(t.allowInfinityPoint&&!n.is0(x.py))return;throw new Error("bad point: ZERO")}const{x:E,y:v}=x.toAffine();if(!n.isValid(E)||!n.isValid(v))throw new Error("bad point: x or y not FE");if(!a(E,v))throw new Error("bad point: equation left != right");if(!x.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(E,v,I){if(E==null||!n.isValid(E))throw new Error("x required");if(v==null||!n.isValid(v)||n.is0(v))throw new Error("y required");if(I==null||!n.isValid(I))throw new Error("z required");this.px=E,this.py=v,this.pz=I,Object.freeze(this)}static fromAffine(E){const{x:v,y:I}=E||{};if(!E||!n.isValid(v)||!n.isValid(I))throw new Error("invalid affine point");if(E instanceof y)throw new Error("projective point not allowed");const A=B=>n.eql(B,n.ZERO);return A(v)&&A(I)?y.ZERO:new y(v,I,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(E){const v=dy(n,E.map(I=>I.pz));return E.map((I,A)=>I.toAffine(v[A])).map(y.fromAffine)}static fromHex(E){const v=y.fromAffine(s(kt("pointHex",E)));return v.assertValidity(),v}static fromPrivateKey(E){return y.BASE.multiply(d(E))}static msm(E,v){return ax(y,r,E,v)}_setWindowSize(E){S.setWindowSize(this,E)}assertValidity(){g(this)}hasEvenY(){const{y:E}=this.toAffine();if(n.isOdd)return!n.isOdd(E);throw new Error("Field doesn't support isOdd")}equals(E){f(E);const{px:v,py:I,pz:A}=this,{px:B,py:T,pz:M}=E,j=n.eql(n.mul(v,M),n.mul(B,A)),k=n.eql(n.mul(I,M),n.mul(T,A));return j&&k}negate(){return new y(this.px,n.neg(this.py),this.pz)}double(){const{a:E,b:v}=t,I=n.mul(v,Mc),{px:A,py:B,pz:T}=this;let M=n.ZERO,j=n.ZERO,k=n.ZERO,L=n.mul(A,A),$=n.mul(B,B),C=n.mul(T,T),O=n.mul(A,B);return O=n.add(O,O),k=n.mul(A,T),k=n.add(k,k),M=n.mul(E,k),j=n.mul(I,C),j=n.add(M,j),M=n.sub($,j),j=n.add($,j),j=n.mul(M,j),M=n.mul(O,M),k=n.mul(I,k),C=n.mul(E,C),O=n.sub(L,C),O=n.mul(E,O),O=n.add(O,k),k=n.add(L,L),L=n.add(k,L),L=n.add(L,C),L=n.mul(L,O),j=n.add(j,L),C=n.mul(B,T),C=n.add(C,C),L=n.mul(C,O),M=n.sub(M,L),k=n.mul(C,$),k=n.add(k,k),k=n.add(k,k),new y(M,j,k)}add(E){f(E);const{px:v,py:I,pz:A}=this,{px:B,py:T,pz:M}=E;let j=n.ZERO,k=n.ZERO,L=n.ZERO;const $=t.a,C=n.mul(t.b,Mc);let O=n.mul(v,B),R=n.mul(I,T),U=n.mul(A,M),H=n.add(v,I),V=n.add(B,T);H=n.mul(H,V),V=n.add(O,R),H=n.sub(H,V),V=n.add(v,A);let K=n.add(B,M);return V=n.mul(V,K),K=n.add(O,U),V=n.sub(V,K),K=n.add(I,A),j=n.add(T,M),K=n.mul(K,j),j=n.add(R,U),K=n.sub(K,j),L=n.mul($,V),j=n.mul(C,U),L=n.add(j,L),j=n.sub(R,L),L=n.add(R,L),k=n.mul(j,L),R=n.add(O,O),R=n.add(R,O),U=n.mul($,U),V=n.mul(C,V),R=n.add(R,U),U=n.sub(O,U),U=n.mul($,U),V=n.add(V,U),O=n.mul(R,V),k=n.add(k,O),O=n.mul(K,V),j=n.mul(H,j),j=n.sub(j,O),O=n.mul(H,R),L=n.mul(K,L),L=n.add(L,O),new y(j,k,L)}subtract(E){return this.add(E.negate())}is0(){return this.equals(y.ZERO)}wNAF(E){return S.wNAFCached(this,E,y.normalizeZ)}multiplyUnsafe(E){const{endo:v,n:I}=t;ci("scalar",E,Sn,I);const A=y.ZERO;if(E===Sn)return A;if(this.is0()||E===De)return this;if(!v||S.hasPrecomputes(this))return S.wNAFCachedUnsafe(this,E,y.normalizeZ);let{k1neg:B,k1:T,k2neg:M,k2:j}=v.splitScalar(E),k=A,L=A,$=this;for(;T>Sn||j>Sn;)T&De&&(k=k.add($)),j&De&&(L=L.add($)),$=$.double(),T>>=De,j>>=De;return B&&(k=k.negate()),M&&(L=L.negate()),L=new y(n.mul(L.px,v.beta),L.py,L.pz),k.add(L)}multiply(E){const{endo:v,n:I}=t;ci("scalar",E,De,I);let A,B;if(v){const{k1neg:T,k1:M,k2neg:j,k2:k}=v.splitScalar(E);let{p:L,f:$}=this.wNAF(M),{p:C,f:O}=this.wNAF(k);L=S.constTimeNegate(T,L),C=S.constTimeNegate(j,C),C=new y(n.mul(C.px,v.beta),C.py,C.pz),A=L.add(C),B=$.add(O)}else{const{p:T,f:M}=this.wNAF(E);A=T,B=M}return y.normalizeZ([A,B])[0]}multiplyAndAddUnsafe(E,v,I){const A=y.BASE,B=(M,j)=>j===Sn||j===De||!M.equals(A)?M.multiplyUnsafe(j):M.multiply(j),T=B(this,v).add(B(E,I));return T.is0()?void 0:T}toAffine(E){return h(this,E)}isTorsionFree(){const{h:E,isTorsionFree:v}=t;if(E===De)return!0;if(v)return v(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:E,clearCofactor:v}=t;return E===De?this:v?v(y,this):this.multiplyUnsafe(t.h)}toRawBytes(E=!0){return $s("isCompressed",E),this.assertValidity(),i(y,this,E)}toHex(E=!0){return $s("isCompressed",E),Ns(this.toRawBytes(E))}}y.BASE=new y(t.Gx,t.Gy,n.ONE),y.ZERO=new y(n.ZERO,n.ONE,n.ZERO);const{endo:m,nBitLength:w}=t,S=ox(y,m?Math.ceil(w/2):w);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:l}}function fx(e){const t=wy(e);return Ha(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function hx(e){const t=fx(e),{Fp:n,n:r,nByteLength:i,nBitLength:s}=t,o=n.BYTES+1,a=2*n.BYTES+1;function c(C){return ut(C,r)}function u(C){return Hu(C,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:h}=dx({...t,toBytes(C,O,R){const U=O.toAffine(),H=n.toBytes(U.x),V=aa;return $s("isCompressed",R),R?V(Uint8Array.from([O.hasEvenY()?2:3]),H):V(Uint8Array.from([4]),H,n.toBytes(U.y))},fromBytes(C){const O=C.length,R=C[0],U=C.subarray(1);if(O===o&&(R===2||R===3)){const H=vr(U);if(!Md(H,De,n.ORDER))throw new Error("Point is not on curve");const V=f(H);let K;try{K=n.sqrt(V)}catch(Y){const X=Y instanceof Error?": "+Y.message:"";throw new Error("Point is not on curve"+X)}const Q=(K&De)===De;return(R&1)===1!==Q&&(K=n.neg(K)),{x:H,y:K}}else if(O===a&&R===4){const H=n.fromBytes(U.subarray(0,n.BYTES)),V=n.fromBytes(U.subarray(n.BYTES,2*n.BYTES));return{x:H,y:V}}else{const H=o,V=a;throw new Error("invalid Point, expected length of "+H+", or uncompressed "+V+", got "+O)}}});function g(C){const O=r>>De;return C>O}function y(C){return g(C)?c(-C):C}const m=(C,O,R)=>vr(C.slice(O,R));class w{constructor(O,R,U){ci("r",O,De,r),ci("s",R,De,r),this.r=O,this.s=R,U!=null&&(this.recovery=U),Object.freeze(this)}static fromCompact(O){const R=i;return O=kt("compactSignature",O,R*2),new w(m(O,0,R),m(O,R,2*R))}static fromDER(O){const{r:R,s:U}=wn.toSig(kt("DER",O));return new w(R,U)}assertValidity(){}addRecoveryBit(O){return new w(this.r,this.s,O)}recoverPublicKey(O){const{r:R,s:U,recovery:H}=this,V=A(kt("msgHash",O));if(H==null||![0,1,2,3].includes(H))throw new Error("recovery id invalid");const K=H===2||H===3?R+t.n:R;if(K>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const Q=H&1?"03":"02",te=l.fromHex(Q+Nc(K,n.BYTES)),Y=u(K),X=c(-V*Y),ue=c(U*Y),Ue=l.BASE.multiplyAndAddUnsafe(te,X,ue);if(!Ue)throw new Error("point at infinify");return Ue.assertValidity(),Ue}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return oa(this.toDERHex())}toDERHex(){return wn.hexFromSig(this)}toCompactRawBytes(){return oa(this.toCompactHex())}toCompactHex(){const O=i;return Nc(this.r,O)+Nc(this.s,O)}}const S={isValidPrivateKey(C){try{return d(C),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const C=py(t.n);return rx(t.randomBytes(C),t.n)},precompute(C=8,O=l.BASE){return O._setWindowSize(C),O.multiply(BigInt(3)),O}};function x(C,O=!0){return l.fromPrivateKey(C).toRawBytes(O)}function E(C){if(typeof C=="bigint")return!1;if(C instanceof l)return!0;const R=kt("key",C).length,U=n.BYTES,H=U+1,V=2*U+1;if(!(t.allowedPrivateKeyLengths||i===H))return R===H||R===V}function v(C,O,R=!0){if(E(C)===!0)throw new Error("first arg must be private key");if(E(O)===!1)throw new Error("second arg must be public key");return l.fromHex(O).multiply(d(C)).toRawBytes(R)}const I=t.bits2int||function(C){if(C.length>8192)throw new Error("input is too large");const O=vr(C),R=C.length*8-s;return R>0?O>>BigInt(R):O},A=t.bits2int_modN||function(C){return c(I(C))},B=za(s);function T(C){return ci("num < 2^"+s,C,Sn,B),no(C,i)}function M(C,O,R=j){if(["recovered","canonical"].some(be=>be in R))throw new Error("sign() legacy options not supported");const{hash:U,randomBytes:H}=t;let{lowS:V,prehash:K,extraEntropy:Q}=R;V==null&&(V=!0),C=kt("msgHash",C),P0(R),K&&(C=kt("prehashed msgHash",U(C)));const te=A(C),Y=d(O),X=[T(Y),T(te)];if(Q!=null&&Q!==!1){const be=Q===!0?H(n.BYTES):Q;X.push(kt("extraEntropy",be))}const ue=aa(...X),Ue=te;function xe(be){const Ke=I(be);if(!h(Ke))return;const Ee=u(Ke),ye=l.BASE.multiply(Ke).toAffine(),_e=c(ye.x);if(_e===Sn)return;const Pe=c(Ee*c(Ue+_e*Y));if(Pe===Sn)return;let it=(ye.x===_e?0:2)|Number(ye.y&De),an=Pe;return V&&g(Pe)&&(an=y(Pe),it^=1),new w(_e,an,it)}return{seed:ue,k2sig:xe}}const j={lowS:t.lowS,prehash:!1},k={lowS:t.lowS,prehash:!1};function L(C,O,R=j){const{seed:U,k2sig:H}=M(C,O,R),V=t;return f5(V.hash.outputLen,V.nByteLength,V.hmac)(U,H)}l.BASE._setWindowSize(8);function $(C,O,R,U=k){const H=C;O=kt("msgHash",O),R=kt("publicKey",R);const{lowS:V,prehash:K,format:Q}=U;if(P0(U),"strict"in U)throw new Error("options.strict was renamed to lowS");if(Q!==void 0&&Q!=="compact"&&Q!=="der")throw new Error("format must be compact or der");const te=typeof H=="string"||to(H),Y=!te&&!Q&&typeof H=="object"&&H!==null&&typeof H.r=="bigint"&&typeof H.s=="bigint";if(!te&&!Y)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let X,ue;try{if(Y&&(X=new w(H.r,H.s)),te){try{Q!=="compact"&&(X=w.fromDER(H))}catch(it){if(!(it instanceof wn.Err))throw it}!X&&Q!=="der"&&(X=w.fromCompact(H))}ue=l.fromHex(R)}catch{return!1}if(!X||V&&X.hasHighS())return!1;K&&(O=t.hash(O));const{r:Ue,s:xe}=X,be=A(O),Ke=u(xe),Ee=c(be*Ke),ye=c(Ue*Ke),_e=l.BASE.multiplyAndAddUnsafe(ue,Ee,ye)?.toAffine();return _e?c(_e.x)===Ue:!1}return{CURVE:t,getPublicKey:x,getSharedSecret:v,sign:L,verify:$,ProjectivePoint:l,Signature:w,utils:S}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function px(e){return{hash:e,hmac:(t,...n)=>yy(e,t,Hv(...n)),randomBytes:qv}}function Va(e,t){const n=r=>hx({...e,...px(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vy=qi(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),mx=vy.create(BigInt("-3")),yx=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),bx=Va({a:mx,b:yx,Fp:vy,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},xd),xy=qi(BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff")),gx=xy.create(BigInt("-3")),wx=BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef");Va({a:gx,b:wx,Fp:xy,n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"),h:BigInt(1),lowS:!1},d2);const Ey=qi(BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),vx=Ey.create(BigInt("-3")),xx=BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00");Va({a:vx,b:xx,Fp:Ey,n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650"),h:BigInt(1),lowS:!1,allowedPrivateKeyLengths:[130,131,132]},l2);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const k0=bx;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _y=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),C0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ex=BigInt(0),_x=BigInt(1),Gu=BigInt(2),B0=(e,t)=>(e+t/Gu)/t;function Sx(e){const t=_y,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=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,h=St(f,Gu,t)*u%t,g=St(h,i,t)*h%t,y=St(g,s,t)*g%t,m=St(y,a,t)*y%t,w=St(m,c,t)*m%t,S=St(w,a,t)*y%t,x=St(S,n,t)*l%t,E=St(x,o,t)*g%t,v=St(E,r,t)*u%t,I=St(v,Gu,t);if(!Vu.eql(Vu.sqr(I),e))throw new Error("Cannot find square root");return I}const Vu=qi(_y,void 0,void 0,{sqrt:Sx}),Rd=Va({a:Ex,b:BigInt(7),Fp:Vu,n:C0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=C0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-_x*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,o=BigInt("0x100000000000000000000000000000000"),a=B0(s*e,t),c=B0(-r*e,t);let u=ut(e-a*n-c*i,t),l=ut(-a*r-c*s,t);const d=u>o,f=l>o;if(d&&(u=t-u),f&&(l=t-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}}},xd),Ix=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Rd},Symbol.toStringTag,{value:"Module"})),Ax=/^(.*)\[([0-9]*)\]$/,Px=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Sy=/^(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)?$/,O0=2n**256n-1n;function Iy(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Lc({signature:e});if(typeof e.s>"u")throw new Lc({signature:e});if(n&&typeof e.yParity>"u")throw new Lc({signature:e});if(e.r<0n||e.r>O0)throw new Nx({value:e.r});if(e.s<0n||e.s>O0)throw new Mx({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new jd({value:e.yParity})}function kx(e){return Ay(Ht(e))}function Ay(e){if(e.length!==130&&e.length!==132)throw new $x({signature:e});const t=BigInt(rn(e,0,32)),n=BigInt(rn(e,32,64)),r=(()=>{const i=+`0x${e.slice(130)}`;if(!Number.isNaN(i))try{return Ud(i)}catch{throw new jd({value:i})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function Cx(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return Bx(e)}function Bx(e){const t=typeof e=="string"?Ay(e):e instanceof Uint8Array?kx(e):typeof e.r=="string"?Tx(e):e.v?Ox(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return Iy(t),t}function Ox(e){return{r:e.r,s:e.s,yParity:Ud(e.v)}}function Tx(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=Ud(n)),typeof r!="number")throw new jd({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function Ud(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new Lx({value:e})}let $x=class extends ee{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Et(_5(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},Lc=class extends ee{constructor({signature:t}){super(`Signature \`${Qm(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}},Nx=class extends ee{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}},Mx=class extends ee{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}},jd=class extends ee{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},Lx=class extends ee{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}};function ui(e,t,n){const{checksumAddress:r,staticPosition:i}=n,s=zd(t.type);if(s){const[o,a]=s;return Ux(e,{...t,type:a},{checksumAddress:r,length:o,staticPosition:i})}if(t.type==="tuple")return zx(e,t,{checksumAddress:r,staticPosition:i});if(t.type==="address")return Rx(e,{checksum:r});if(t.type==="bool")return jx(e);if(t.type.startsWith("bytes"))return Fx(e,t,{staticPosition:i});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Dx(e,t);if(t.type==="string")return Hx(e,{staticPosition:i});throw new qd(t.type)}const T0=32,Wu=32;function Rx(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?oy(s):s)(Ht($5(r,-20))),32]}function Ux(e,t,n){const{checksumAddress:r,length:i,staticPosition:s}=n;if(!i){const c=On(e.readBytes(Wu)),u=s+c,l=u+T0;e.setPosition(u);const d=On(e.readBytes(T0)),f=Ms(t);let h=0;const g=[];for(let y=0;y<d;++y){e.setPosition(l+(f?y*32:h));const[m,w]=ui(e,t,{checksumAddress:r,staticPosition:l});h+=w,g.push(m)}return e.setPosition(s+32),[g,32]}if(Ms(t)){const c=On(e.readBytes(Wu)),u=s+c,l=[];for(let d=0;d<i;++d){e.setPosition(u+d*32);const[f]=ui(e,t,{checksumAddress:r,staticPosition:u});l.push(f)}return e.setPosition(s+32),[l,32]}let o=0;const a=[];for(let c=0;c<i;++c){const[u,l]=ui(e,t,{checksumAddress:r,staticPosition:s+o});o+=l,a.push(u)}return[a,o]}function jx(e){return[M5(e.readBytes(32),{size:32}),32]}function Fx(e,t,{staticPosition:n}){const[r,i]=t.type.split("bytes");if(!i){const o=On(e.readBytes(32));e.setPosition(n+o);const a=On(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Ht(c),32]}return[Ht(e.readBytes(Number.parseInt(i,10),32)),32]}function Dx(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),i=e.readBytes(32);return[r>48?N5(i,{signed:n}):On(i,{signed:n}),32]}function zx(e,t,n){const{checksumAddress:r,staticPosition:i}=n,s=t.components.length===0||t.components.some(({name:c})=>!c),o=s?[]:{};let a=0;if(Ms(t)){const c=On(e.readBytes(Wu)),u=i+c;for(let l=0;l<t.components.length;++l){const d=t.components[l];e.setPosition(u+a);const[f,h]=ui(e,d,{checksumAddress:r,staticPosition:u});a+=h,o[s?l:d?.name]=f}return e.setPosition(i+32),[o,32]}for(let c=0;c<t.components.length;++c){const u=t.components[c],[l,d]=ui(e,u,{checksumAddress:r,staticPosition:i});o[s?c:u?.name]=l,a+=d}return[o,a]}function Hx(e,{staticPosition:t}){const n=On(e.readBytes(32)),r=t+n;e.setPosition(r);const i=On(e.readBytes(32));if(i===0)return e.setPosition(t+32),["",32];const s=e.readBytes(i,32),o=L5(iy(s));return e.setPosition(t+32),[o,32]}function qx({checksumAddress:e,parameters:t,values:n}){const r=[];for(let i=0;i<t.length;i++)r.push(Fd({checksumAddress:e,parameter:t[i],value:n[i]}));return r}function Fd({checksumAddress:e=!1,parameter:t,value:n}){const r=t,i=zd(r.type);if(i){const[s,o]=i;return Vx(n,{checksumAddress:e,length:s,parameter:{...r,type:o}})}if(r.type==="tuple")return Qx(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Gx(n,{checksum:e});if(r.type==="bool")return Kx(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,o="256"]=Sy.exec(r.type)??[];return Zx(n,{signed:s,size:Number(o)})}if(r.type.startsWith("bytes"))return Wx(n,{type:r.type});if(r.type==="string")return Yx(n);throw new qd(r.type)}function Dd(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?t+=32:t+=Et(a)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(ot(t+i,{size:32})),r.push(a),i+=Et(a)):n.push(a)}return zt(...n,...r)}function Gx(e,t){const{checksum:n=!1}=t;return Ga(e,{strict:n}),{dynamic:!1,encoded:Cr(e.toLowerCase())}}function Vx(e,t){const{checksumAddress:n,length:r,parameter:i}=t,s=r===null;if(!Array.isArray(e))throw new nE(e);if(!s&&e.length!==r)throw new tE({expectedLength:r,givenLength:e.length,type:`${i.type}[${r}]`});let o=!1;const a=[];for(let c=0;c<e.length;c++){const u=Fd({checksumAddress:n,parameter:i,value:e[c]});u.dynamic&&(o=!0),a.push(u)}if(s||o){const c=Dd(a);if(s){const u=ot(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?zt(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:zt(...a.map(({encoded:c})=>c))}}function Wx(e,{type:t}){const[,n]=t.split("bytes"),r=Et(e);if(!n){let i=e;return r%32!==0&&(i=Br(i,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:zt(Cr(ot(r,{size:32})),i)}}if(r!==Number.parseInt(n,10))throw new ky({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Br(e)}}function Kx(e){if(typeof e!="boolean")throw new ee(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Cr(Jm(e))}}function Zx(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new ty({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:ot(e,{size:32,signed:t})}}function Yx(e){const t=Ld(e),n=Math.ceil(Et(t)/32),r=[];for(let i=0;i<n;i++)r.push(Br(rn(t,i*32,(i+1)*32)));return{dynamic:!0,encoded:zt(Br(ot(Et(t),{size:32})),...r)}}function Qx(e,t){const{checksumAddress:n,parameter:r}=t;let i=!1;const s=[];for(let o=0;o<r.components.length;o++){const a=r.components[o],c=Array.isArray(e)?o:a.name,u=Fd({checksumAddress:n,parameter:a,value:e[c]});s.push(u),u.dynamic&&(i=!0)}return{dynamic:i,encoded:i?Dd(s):zt(...s.map(({encoded:o})=>o))}}function zd(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Ms(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Ms);const n=zd(e.type);return!!(n&&Ms({...e,type:n[1]}))}function Jx(e,t,n={}){const{as:r="Array",checksumAddress:i=!1}=n,s=typeof t=="string"?ry(t):t,o=z5(s);if(ni(s)===0&&e.length>0)throw new eE;if(ni(s)&&ni(s)<32)throw new Xx({data:typeof t=="string"?t:Ht(t),parameters:e,size:ni(s)});let a=0;const c=r==="Array"?[]:{};for(let u=0;u<e.length;++u){const l=e[u];o.setPosition(a);const[d,f]=ui(o,l,{checksumAddress:i,staticPosition:0});a+=f,r==="Array"?c.push(d):c[l.name??u]=d}return c}function Hd(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Cy({expectedLength:e.length,givenLength:t.length});const i=qx({checksumAddress:r,parameters:e,values:t}),s=Dd(i);return s.length===0?"0x":s}function Ku(e,t){if(e.length!==t.length)throw new Cy({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const i=e[r],s=t[r];n.push(Ku.encode(i,s))}return zt(...n)}(function(e){function t(n,r,i=!1){if(n==="address"){const c=r;return Ga(c),Cr(c.toLowerCase(),i?32:0)}if(n==="string")return Ld(r);if(n==="bytes")return r;if(n==="bool")return Cr(Jm(r),i?32:1);const s=n.match(Sy);if(s){const[c,u,l="256"]=s,d=Number.parseInt(l,10)/8;return ot(r,{size:i?32:d,signed:u==="int"})}const o=n.match(Px);if(o){const[c,u]=o;if(Number.parseInt(u,10)!==(r.length-2)/2)throw new ky({expectedSize:Number.parseInt(u,10),value:r});return Br(r,i?32:0)}const a=n.match(Ax);if(a&&Array.isArray(r)){const[c,u]=a,l=[];for(let d=0;d<r.length;d++)l.push(t(u,r[d],!0));return l.length===0?"0x":zt(...l)}throw new qd(n)}e.encode=t})(Ku||(Ku={}));function Py(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?f0(e):e}class Xx extends ee{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${ti(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class eE extends ee{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class tE extends ee{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 ky extends ee{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Et(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Cy extends ee{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
42
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class nE extends ee{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class qd extends ee{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 rE(e,t={}){return typeof e.chainId=="string"?iE(e):{...e,...t.signature}}function iE(e){const{address:t,chainId:n,nonce:r}=e,i=Cx(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...i}}async function Ls(e,{address:t,blockNumber:n,blockTag:r="latest"}){const i=n!==void 0?q(n):void 0,s=await e.request({method:"eth_getCode",params:[t,i||r]},{dedupe:!!i});if(s!=="0x")return s}const By="0x6492649264926492649264926492649264926492649264926492649264926492";function sE(e){if(rn(e,-32)!==By)throw new cE(e)}function oE(e){const{data:t,signature:n,to:r}=e;return zt(Hd(Py("address, bytes, bytes"),[r,t,n]),By)}function aE(e){try{return sE(e),!0}catch{return!1}}let cE=class extends ee{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}};const uE="0x8010801080108010801080108010801080108010801080108010801080108010",lE=Py("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function Oy(e){if(typeof e=="string"){if(rn(e,-32)!==uE)throw new hE(e)}else Iy(e.authorization)}function dE(e){Oy(e);const t=ey(rn(e,-64,-32)),n=rn(e,-t-64,-64),r=rn(e,0,-t-64),[i,s,o]=Jx(lE,n);return{authorization:rE({address:i.delegation,chainId:Number(i.chainId),nonce:i.nonce,yParity:i.yParity,r:i.r,s:i.s}),signature:r,...o&&o!=="0x"?{data:o,to:s}:{}}}function fE(e){try{return Oy(e),!0}catch{return!1}}class hE extends ee{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}}const ca=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],Zu=[{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"}]}],Ty=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],$y=[...Ty,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],pE=[...Ty,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],$0=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],N0=[{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"}]}],Ny=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],M0=[{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"}],mE=[{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"}]}],My="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",yE="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",bE="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Gd="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033",Rc="/docs/contract/encodeDeployData";function Vd(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const i=t.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new M2({docsPath:Rc});if(!("inputs"in i))throw new o0({docsPath:Rc});if(!i.inputs||i.inputs.length===0)throw new o0({docsPath:Rc});const s=mt(i.inputs,n);return Mn([r,s])}const L0="/docs/contract/encodeFunctionData";function gE(e){const{abi:t,args:n,functionName:r}=e;let i=t[0];if(r){const s=jr({abi:t,args:n,name:r});if(!s)throw new yi(r,{docsPath:L0});i=s}if(i.type!=="function")throw new yi(void 0,{docsPath:L0});return{abi:[i],functionName:Xs(Dt(i))}}function Re(e){const{args:t}=e,{abi:n,functionName:r}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:gE(e),i=n[0],s=r,o="inputs"in i&&i.inputs?mt(i.inputs,t??[]):void 0;return Mn([s,o??"0x"])}function Fr(e,t){if(!et(e,{strict:!1}))throw new Tn({address:e});if(!et(t,{strict:!1}))throw new Tn({address:t});return e.toLowerCase()===t.toLowerCase()}function wE(e){const t=pe(`0x${e.substring(4)}`).substring(26);return Na(`0x${t}`)}const vE="modulepreload",xE=function(e){return"https://cdn.decentraland.org/@dcl/landing-site/0.0.1-23617073172.commit-1b94d0b/"+e},R0={},Dr=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=s?.nonce||s?.getAttribute("nonce");i=Promise.all(n.map(a=>{if(a=xE(a),a in R0)return;R0[a]=!0;const c=a.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const l=document.createElement("link");if(l.rel=c?"stylesheet":vE,c||(l.as="script",l.crossOrigin=""),l.href=a,o&&l.setAttribute("nonce",o),document.head.appendChild(l),c)return new Promise((d,f)=>{l.addEventListener("load",d),l.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${a}`)))})}))}return i.then(()=>t()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};async function EE({hash:e,signature:t}){const n=Qe(e)?e:ht(e),{secp256k1:r}=await Dr(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>Ix);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:d,yParity:f}=t,h=Number(f??d),g=U0(h);return new r.Signature(Le(u),Le(l)).addRecoveryBit(g)}const o=Qe(t)?t:ht(t);if(we(o)!==65)throw new Error("invalid signature length");const a=pt(`0x${o.slice(130)}`),c=U0(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function U0(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 Ly({hash:e,signature:t}){return wE(await EE({hash:e,signature:t}))}function _E(e){const{chainId:t,nonce:n,to:r}=e,i=e.contractAddress??e.address,s=pe(Mn(["0x05",Pv([t?q(t):"0x",i,n?q(n):"0x"])]));return r==="bytes"?ct(s):s}async function Ry(e){const{authorization:t,signature:n}=e;return Ly({hash:_E(t),signature:n??t})}async function SE({address:e,authorization:t,signature:n}){return Fr(Je(e),await Ry({authorization:t,signature:n}))}function Z(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const i=e[n];return typeof i=="function"?i:s=>t(e,s)}function IE({r:e,s:t,to:n="hex",v:r,yParity:i}){const s=(()=>{if(i===0||i===1)return i;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),o=`0x${new Rd.Signature(Le(e),Le(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?o:ct(o)}function AE(e){return{address:e.address,amount:ot(e.amount),index:ot(e.index),validatorIndex:ot(e.validatorIndex)}}function Uy(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:ot(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:ot(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:ot(e.gasLimit)},...typeof e.number=="bigint"&&{number:ot(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:ot(e.prevRandao)},...typeof e.time=="bigint"&&{time:ot(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(AE)}}}const PE="0x82ad56cb",Uc="/docs/contract/decodeFunctionResult";function zr(e){const{abi:t,args:n,functionName:r,data:i}=e;let s=t[0];if(r){const a=jr({abi:t,args:n,name:r});if(!a)throw new yi(r,{docsPath:Uc});s=a}if(s.type!=="function")throw new yi(void 0,{docsPath:Uc});if(!s.outputs)throw new _m(s.name,{docsPath:Uc});const o=Ur(s.outputs,i);if(o&&o.length>1)return o;if(o&&o.length===1)return o[0]}function Wd(){let e=()=>{},t=()=>{};return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}const jc=new Map;function jy({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:i}){const s=async()=>{const l=c();o();const d=l.map(({args:f})=>f);d.length!==0&&e(d).then(f=>{i&&Array.isArray(f)&&f.sort(i);for(let h=0;h<l.length;h++){const{resolve:g}=l[h];g?.([f[h],f])}}).catch(f=>{for(let h=0;h<l.length;h++){const{reject:g}=l[h];g?.(f)}})},o=()=>jc.delete(t),a=()=>c().map(({args:l})=>l),c=()=>jc.get(t)||[],u=l=>jc.set(t,[...c(),l]);return{flush:o,async schedule(l){const{promise:d,resolve:f,reject:h}=Wd();return n?.([...a(),l])&&s(),c().length>0?(u({args:l,resolve:f,reject:h}),d):(u({args:l,resolve:f,reject:h}),setTimeout(s,r),d)}}}function j0(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Kf({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Kf({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function kE(e){const{balance:t,nonce:n,state:r,stateDiff:i,code:s}=e,o={};if(s!==void 0&&(o.code=s),t!==void 0&&(o.balance=q(t)),n!==void 0&&(o.nonce=q(n)),r!==void 0&&(o.state=j0(r)),i!==void 0){if(o.state)throw new i5;o.stateDiff=j0(i)}return o}function Wa(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!et(n,{strict:!1}))throw new Tn({address:n});if(t[n])throw new r5({address:n});t[n]=kE(r)}return t}async function io(e,t){const{account:n=e.account,authorizationList:r,batch:i=!!e.batch?.multicall,blockNumber:s,blockTag:o=e.experimental_blockTag??"latest",accessList:a,blobs:c,blockOverrides:u,code:l,data:d,factory:f,factoryData:h,gas:g,gasPrice:y,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:S,nonce:x,to:E,value:v,stateOverride:I,...A}=t,B=n?We(n):void 0;if(l&&(f||h))throw new F("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&E)throw new F("Cannot provide both `code` & `to` as parameters.");const T=l&&d,M=f&&h&&E&&d,j=T||M,k=T?Fy({code:l,data:d}):M?OE({data:d,factory:f,factoryData:h,to:E}):d;try{Hi(t);const $=(typeof s=="bigint"?q(s):void 0)||o,C=u?Uy(u):void 0,O=Wa(I),R=e.chain?.formatters?.transactionRequest?.format,H=(R||Zs)({...Da(A,{format:R}),accessList:a,account:B,authorizationList:r,blobs:c,data:k,gas:g,gasPrice:y,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:S,nonce:x,to:j?void 0:E,value:v},"call");if(i&&CE({request:H})&&!O&&!C)try{return await BE(e,{...H,blockNumber:s,blockTag:o})}catch(Q){if(!(Q instanceof um)&&!(Q instanceof Iu))throw Q}const V=(()=>{const Q=[H,$];return O&&C?[...Q,O,C]:O?[...Q,O]:C?[...Q,{},C]:Q})(),K=await e.request({method:"eth_call",params:V});return K==="0x"?{data:void 0}:{data:K}}catch(L){const $=TE(L),{offchainLookup:C,offchainLookupSignature:O}=await Dr(async()=>{const{offchainLookup:R,offchainLookupSignature:U}=await Promise.resolve().then(()=>c8);return{offchainLookup:R,offchainLookupSignature:U}},void 0);if(e.ccipRead!==!1&&$?.slice(0,10)===O&&E)return{data:await C(e,{data:$,to:E})};throw j&&$?.slice(0,10)==="0x101bb98d"?new a5({factory:f}):Hm(L,{...t,account:B,chain:e.chain})}}function CE({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(PE)||!n||Object.values(r).filter(i=>typeof i<"u").length>0)}async function BE(e,t){const{batchSize:n=1024,deployless:r=!1,wait:i=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:o=e.experimental_blockTag??"latest",data:a,to:c}=t,u=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Di({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new um})(),d=(typeof s=="bigint"?q(s):void 0)||o,{schedule:f}=jy({id:`${e.uid}.${d}`,wait:i,shouldSplitBatch(y){return y.reduce((w,{data:S})=>w+(S.length-2),0)>n*2},fn:async y=>{const m=y.map(x=>({allowFailure:!0,callData:x.data,target:x.to})),w=Re({abi:ca,args:[m],functionName:"aggregate3"}),S=await e.request({method:"eth_call",params:[{...u===null?{data:Fy({code:Gd,data:w})}:{to:u,data:w}},d]});return zr({abi:ca,args:[m],functionName:"aggregate3",data:S||"0x"})}}),[{returnData:h,success:g}]=await f({data:a,to:c});if(!g)throw new ja({data:h});return h==="0x"?{data:void 0}:{data:h}}function Fy(e){const{code:t,data:n}=e;return Vd({abi:Id(["constructor(bytes, bytes)"]),bytecode:My,args:[t,n]})}function OE(e){const{data:t,factory:n,factoryData:r,to:i}=e;return Vd({abi:Id(["constructor(address, bytes, address, bytes)"]),bytecode:yE,args:[i,t,n,r]})}function TE(e){if(!(e instanceof F))return;const t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}const $E=3;function wi(e,{abi:t,address:n,args:r,docsPath:i,functionName:s,sender:o}){const a=e instanceof ja?e:e instanceof F?e.walk(g=>"data"in g)||e.walk():{},{code:c,data:u,details:l,message:d,shortMessage:f}=a,h=e instanceof Js?new zm({functionName:s}):[$E,kr.code].includes(c)&&(u||l||d||f)||c===ir.code&&l==="execution reverted"&&u?new sa({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:a instanceof Td?l:f??d}):e;return new Od(h,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:s,sender:o})}async function yt(e,t){const{abi:n,address:r,args:i,functionName:s,...o}=t,a=Re({abi:n,args:i,functionName:s});try{const{data:c}=await Z(e,io,"call")({...o,data:a,to:r});return zr({abi:n,args:i,functionName:s,data:c||"0x"})}catch(c){throw wi(c,{abi:n,address:r,args:i,docsPath:"/docs/contract/readContract",functionName:s})}}async function Ka(e,t){const{address:n,chain:r=e.chain,hash:i,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??r?.contracts?.erc6492Verifier?.address,multicallAddress:o=t.multicallAddress??r?.contracts?.multicall3?.address}=t;if(r?.verifyHash)return await r.verifyHash(e,t);const a=(()=>{const c=t.signature;return Qe(c)?c:typeof c=="object"&&"r"in c&&"s"in c?IE(c):je(c)})();try{return fE(a)?await NE(e,{...t,multicallAddress:o,signature:a}):await ME(e,{...t,verifierAddress:s,signature:a})}catch(c){try{if(Fr(Je(n),await Ly({hash:i,signature:a})))return!0}catch{}if(c instanceof Or)return!1;throw c}}async function NE(e,t){const{address:n,blockNumber:r,blockTag:i,hash:s,multicallAddress:o}=t,{authorization:a,data:c,signature:u,to:l}=dE(t.signature);if(await Ls(e,{address:n,blockNumber:r,blockTag:i})===Mn(["0xef0100",a.address]))return await LE(e,{address:n,blockNumber:r,blockTag:i,hash:s,signature:u});const f={address:a.address,chainId:Number(a.chainId),nonce:Number(a.nonce),r:q(a.r,{size:32}),s:q(a.s,{size:32}),yParity:a.yParity};if(!await SE({address:n,authorization:f}))throw new Or;const g=await Z(e,yt,"readContract")({...o?{address:o}:{code:Gd},authorizationList:[f],abi:ca,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:l??n,callData:c}]:[],{allowFailure:!0,target:n,callData:Re({abi:Ny,functionName:"isValidSignature",args:[s,u]})}]]});if(g[g.length-1]?.returnData?.startsWith("0x1626ba7e"))return!0;throw new Or}async function ME(e,t){const{address:n,factory:r,factoryData:i,hash:s,signature:o,verifierAddress:a,...c}=t,u=await(async()=>!r&&!i||aE(o)?o:oE({data:i,signature:o,to:r}))(),l=a?{to:a,data:Re({abi:M0,functionName:"isValidSig",args:[n,s,u]}),...c}:{data:Vd({abi:M0,args:[n,s,u],bytecode:bE}),...c},{data:d}=await Z(e,io,"call")(l).catch(f=>{throw f instanceof Dm?new Or:f});if(wv(d??"0x0"))return!0;throw new Or}async function LE(e,t){const{address:n,blockNumber:r,blockTag:i,hash:s,signature:o}=t;if((await Z(e,yt,"readContract")({address:n,abi:Ny,args:[s,o],blockNumber:r,blockTag:i,functionName:"isValidSignature"}).catch(c=>{throw c instanceof Od?new Or:c})).startsWith("0x1626ba7e"))return!0;throw new Or}class Or extends Error{}var Fe={},Za={};Za.byteLength=jE;Za.toByteArray=DE;Za.fromByteArray=qE;var tn=[],Ct=[],RE=typeof Uint8Array<"u"?Uint8Array:Array,Fc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Zr=0,UE=Fc.length;Zr<UE;++Zr)tn[Zr]=Fc[Zr],Ct[Fc.charCodeAt(Zr)]=Zr;Ct[45]=62;Ct[95]=63;function Dy(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function jE(e){var t=Dy(e),n=t[0],r=t[1];return(n+r)*3/4-r}function FE(e,t,n){return(t+n)*3/4-n}function DE(e){var t,n=Dy(e),r=n[0],i=n[1],s=new RE(FE(e,r,i)),o=0,a=i>0?r-4:r,c;for(c=0;c<a;c+=4)t=Ct[e.charCodeAt(c)]<<18|Ct[e.charCodeAt(c+1)]<<12|Ct[e.charCodeAt(c+2)]<<6|Ct[e.charCodeAt(c+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=Ct[e.charCodeAt(c)]<<2|Ct[e.charCodeAt(c+1)]>>4,s[o++]=t&255),i===1&&(t=Ct[e.charCodeAt(c)]<<10|Ct[e.charCodeAt(c+1)]<<4|Ct[e.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function zE(e){return tn[e>>18&63]+tn[e>>12&63]+tn[e>>6&63]+tn[e&63]}function HE(e,t,n){for(var r,i=[],s=t;s<n;s+=3)r=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(zE(r));return i.join("")}function qE(e){for(var t,n=e.length,r=n%3,i=[],s=16383,o=0,a=n-r;o<a;o+=s)i.push(HE(e,o,o+s>a?a:o+s));return r===1?(t=e[n-1],i.push(tn[t>>2]+tn[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(tn[t>>10]+tn[t>>4&63]+tn[t<<2&63]+"=")),i.join("")}var Kd={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Kd.read=function(e,t,n,r,i){var s,o,a=i*8-r-1,c=(1<<a)-1,u=c>>1,l=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=s*256+e[t+d],d+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=o*256+e[t+d],d+=f,l-=8);if(s===0)s=1-u;else{if(s===c)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-u}return(h?-1:1)*o*Math.pow(2,s-r)};Kd.write=function(e,t,n,r,i,s){var o,a,c,u=s*8-i-1,l=(1<<u)-1,d=l>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,g=r?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*Math.pow(2,1-d),t*c>=2&&(o++,c/=2),o+d>=l?(a=0,o=l):o+d>=1?(a=(t*c-1)*Math.pow(2,i),o=o+d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+h]=a&255,h+=g,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[n+h]=o&255,h+=g,o/=256,u-=8);e[n+h-g]|=y*128};/*!
43
+ * The buffer module from node.js, for the browser.
44
+ *
45
+ * @author Feross Aboukhadijeh <https://feross.org>
46
+ * @license MIT
47
+ */(function(e){const t=Za,n=Kd,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i;const{Uint8Array:s,ArrayBuffer:o,SharedArrayBuffer:a}=globalThis;l.TYPED_ARRAY_SUPPORT=c(),!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{const _=new s(1),p={foo:function(){return 42}};return Object.setPrototypeOf(p,s.prototype),Object.setPrototypeOf(_,p),_.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function u(_){if(_>i)throw new RangeError('The value "'+_+'" is invalid for option "size"');const p=new s(_);return Object.setPrototypeOf(p,l.prototype),p}function l(_,p,b){if(typeof _=="number"){if(typeof p=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(_)}return d(_,p,b)}l.poolSize=8192;function d(_,p,b){if(typeof _=="string")return y(_,p);if(o.isView(_))return w(_);if(_==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _);if(qt(_,o)||_&&qt(_.buffer,o)||typeof a<"u"&&(qt(_,a)||_&&qt(_.buffer,a)))return S(_,p,b);if(typeof _=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const P=_.valueOf&&_.valueOf();if(P!=null&&P!==_)return l.from(P,p,b);const N=x(_);if(N)return N;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof _[Symbol.toPrimitive]=="function")return l.from(_[Symbol.toPrimitive]("string"),p,b);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _)}l.from=function(_,p,b){return d(_,p,b)},Object.setPrototypeOf(l.prototype,s.prototype),Object.setPrototypeOf(l,s);function f(_){if(typeof _!="number")throw new TypeError('"size" argument must be of type number');if(_<0)throw new RangeError('The value "'+_+'" is invalid for option "size"')}function h(_,p,b){return f(_),_<=0?u(_):p!==void 0?typeof b=="string"?u(_).fill(p,b):u(_).fill(p):u(_)}l.alloc=function(_,p,b){return h(_,p,b)};function g(_){return f(_),u(_<0?0:E(_)|0)}l.allocUnsafe=function(_){return g(_)},l.allocUnsafeSlow=function(_){return g(_)};function y(_,p){if((typeof p!="string"||p==="")&&(p="utf8"),!l.isEncoding(p))throw new TypeError("Unknown encoding: "+p);const b=I(_,p)|0;let P=u(b);const N=P.write(_,p);return N!==b&&(P=P.slice(0,N)),P}function m(_){const p=_.length<0?0:E(_.length)|0,b=u(p);for(let P=0;P<p;P+=1)b[P]=_[P]&255;return b}function w(_){if(qt(_,s)){const p=new s(_);return S(p.buffer,p.byteOffset,p.byteLength)}return m(_)}function S(_,p,b){if(p<0||_.byteLength<p)throw new RangeError('"offset" is outside of buffer bounds');if(_.byteLength<p+(b||0))throw new RangeError('"length" is outside of buffer bounds');let P;return p===void 0&&b===void 0?P=new s(_):b===void 0?P=new s(_,p):P=new s(_,p,b),Object.setPrototypeOf(P,l.prototype),P}function x(_){if(l.isBuffer(_)){const p=E(_.length)|0,b=u(p);return b.length===0||_.copy(b,0,0,p),b}if(_.length!==void 0)return typeof _.length!="number"||xc(_.length)?u(0):m(_);if(_.type==="Buffer"&&Array.isArray(_.data))return m(_.data)}function E(_){if(_>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return _|0}function v(_){return+_!=_&&(_=0),l.alloc(+_)}l.isBuffer=function(p){return p!=null&&p._isBuffer===!0&&p!==l.prototype},l.compare=function(p,b){if(qt(p,s)&&(p=l.from(p,p.offset,p.byteLength)),qt(b,s)&&(b=l.from(b,b.offset,b.byteLength)),!l.isBuffer(p)||!l.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(p===b)return 0;let P=p.length,N=b.length;for(let D=0,z=Math.min(P,N);D<z;++D)if(p[D]!==b[D]){P=p[D],N=b[D];break}return P<N?-1:N<P?1:0},l.isEncoding=function(p){switch(String(p).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(p,b){if(!Array.isArray(p))throw new TypeError('"list" argument must be an Array of Buffers');if(p.length===0)return l.alloc(0);let P;if(b===void 0)for(b=0,P=0;P<p.length;++P)b+=p[P].length;const N=l.allocUnsafe(b);let D=0;for(P=0;P<p.length;++P){let z=p[P];if(qt(z,s))D+z.length>N.length?(l.isBuffer(z)||(z=l.from(z)),z.copy(N,D)):s.prototype.set.call(N,z,D);else if(l.isBuffer(z))z.copy(N,D);else throw new TypeError('"list" argument must be an Array of Buffers');D+=z.length}return N};function I(_,p){if(l.isBuffer(_))return _.length;if(o.isView(_)||qt(_,o))return _.byteLength;if(typeof _!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof _);const b=_.length,P=arguments.length>2&&arguments[2]===!0;if(!P&&b===0)return 0;let N=!1;for(;;)switch(p){case"ascii":case"latin1":case"binary":return b;case"utf8":case"utf-8":return vc(_).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b*2;case"hex":return b>>>1;case"base64":return Wf(_).length;default:if(N)return P?-1:vc(_).length;p=(""+p).toLowerCase(),N=!0}}l.byteLength=I;function A(_,p,b){let P=!1;if((p===void 0||p<0)&&(p=0),p>this.length||((b===void 0||b>this.length)&&(b=this.length),b<=0)||(b>>>=0,p>>>=0,b<=p))return"";for(_||(_="utf8");;)switch(_){case"hex":return Q(this,p,b);case"utf8":case"utf-8":return R(this,p,b);case"ascii":return V(this,p,b);case"latin1":case"binary":return K(this,p,b);case"base64":return O(this,p,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return te(this,p,b);default:if(P)throw new TypeError("Unknown encoding: "+_);_=(_+"").toLowerCase(),P=!0}}l.prototype._isBuffer=!0;function B(_,p,b){const P=_[p];_[p]=_[b],_[b]=P}l.prototype.swap16=function(){const p=this.length;if(p%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let b=0;b<p;b+=2)B(this,b,b+1);return this},l.prototype.swap32=function(){const p=this.length;if(p%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let b=0;b<p;b+=4)B(this,b,b+3),B(this,b+1,b+2);return this},l.prototype.swap64=function(){const p=this.length;if(p%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let b=0;b<p;b+=8)B(this,b,b+7),B(this,b+1,b+6),B(this,b+2,b+5),B(this,b+3,b+4);return this},l.prototype.toString=function(){const p=this.length;return p===0?"":arguments.length===0?R(this,0,p):A.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(p){if(!l.isBuffer(p))throw new TypeError("Argument must be a Buffer");return this===p?!0:l.compare(this,p)===0},l.prototype.inspect=function(){let p="";const b=e.INSPECT_MAX_BYTES;return p=this.toString("hex",0,b).replace(/(.{2})/g,"$1 ").trim(),this.length>b&&(p+=" ... "),"<Buffer "+p+">"},r&&(l.prototype[r]=l.prototype.inspect),l.prototype.compare=function(p,b,P,N,D){if(qt(p,s)&&(p=l.from(p,p.offset,p.byteLength)),!l.isBuffer(p))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof p);if(b===void 0&&(b=0),P===void 0&&(P=p?p.length:0),N===void 0&&(N=0),D===void 0&&(D=this.length),b<0||P>p.length||N<0||D>this.length)throw new RangeError("out of range index");if(N>=D&&b>=P)return 0;if(N>=D)return-1;if(b>=P)return 1;if(b>>>=0,P>>>=0,N>>>=0,D>>>=0,this===p)return 0;let z=D-N,ne=P-b;const Se=Math.min(z,ne),ge=this.slice(N,D),Ie=p.slice(b,P);for(let le=0;le<Se;++le)if(ge[le]!==Ie[le]){z=ge[le],ne=Ie[le];break}return z<ne?-1:ne<z?1:0};function T(_,p,b,P,N){if(_.length===0)return-1;if(typeof b=="string"?(P=b,b=0):b>2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b=+b,xc(b)&&(b=N?0:_.length-1),b<0&&(b=_.length+b),b>=_.length){if(N)return-1;b=_.length-1}else if(b<0)if(N)b=0;else return-1;if(typeof p=="string"&&(p=l.from(p,P)),l.isBuffer(p))return p.length===0?-1:M(_,p,b,P,N);if(typeof p=="number")return p=p&255,typeof s.prototype.indexOf=="function"?N?s.prototype.indexOf.call(_,p,b):s.prototype.lastIndexOf.call(_,p,b):M(_,[p],b,P,N);throw new TypeError("val must be string, number or Buffer")}function M(_,p,b,P,N){let D=1,z=_.length,ne=p.length;if(P!==void 0&&(P=String(P).toLowerCase(),P==="ucs2"||P==="ucs-2"||P==="utf16le"||P==="utf-16le")){if(_.length<2||p.length<2)return-1;D=2,z/=2,ne/=2,b/=2}function Se(Ie,le){return D===1?Ie[le]:Ie.readUInt16BE(le*D)}let ge;if(N){let Ie=-1;for(ge=b;ge<z;ge++)if(Se(_,ge)===Se(p,Ie===-1?0:ge-Ie)){if(Ie===-1&&(Ie=ge),ge-Ie+1===ne)return Ie*D}else Ie!==-1&&(ge-=ge-Ie),Ie=-1}else for(b+ne>z&&(b=z-ne),ge=b;ge>=0;ge--){let Ie=!0;for(let le=0;le<ne;le++)if(Se(_,ge+le)!==Se(p,le)){Ie=!1;break}if(Ie)return ge}return-1}l.prototype.includes=function(p,b,P){return this.indexOf(p,b,P)!==-1},l.prototype.indexOf=function(p,b,P){return T(this,p,b,P,!0)},l.prototype.lastIndexOf=function(p,b,P){return T(this,p,b,P,!1)};function j(_,p,b,P){b=Number(b)||0;const N=_.length-b;P?(P=Number(P),P>N&&(P=N)):P=N;const D=p.length;P>D/2&&(P=D/2);let z;for(z=0;z<P;++z){const ne=parseInt(p.substr(z*2,2),16);if(xc(ne))return z;_[b+z]=ne}return z}function k(_,p,b,P){return vo(vc(p,_.length-b),_,b,P)}function L(_,p,b,P){return vo(sv(p),_,b,P)}function $(_,p,b,P){return vo(Wf(p),_,b,P)}function C(_,p,b,P){return vo(ov(p,_.length-b),_,b,P)}l.prototype.write=function(p,b,P,N){if(b===void 0)N="utf8",P=this.length,b=0;else if(P===void 0&&typeof b=="string")N=b,P=this.length,b=0;else if(isFinite(b))b=b>>>0,isFinite(P)?(P=P>>>0,N===void 0&&(N="utf8")):(N=P,P=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const D=this.length-b;if((P===void 0||P>D)&&(P=D),p.length>0&&(P<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");let z=!1;for(;;)switch(N){case"hex":return j(this,p,b,P);case"utf8":case"utf-8":return k(this,p,b,P);case"ascii":case"latin1":case"binary":return L(this,p,b,P);case"base64":return $(this,p,b,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,p,b,P);default:if(z)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),z=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(_,p,b){return p===0&&b===_.length?t.fromByteArray(_):t.fromByteArray(_.slice(p,b))}function R(_,p,b){b=Math.min(_.length,b);const P=[];let N=p;for(;N<b;){const D=_[N];let z=null,ne=D>239?4:D>223?3:D>191?2:1;if(N+ne<=b){let Se,ge,Ie,le;switch(ne){case 1:D<128&&(z=D);break;case 2:Se=_[N+1],(Se&192)===128&&(le=(D&31)<<6|Se&63,le>127&&(z=le));break;case 3:Se=_[N+1],ge=_[N+2],(Se&192)===128&&(ge&192)===128&&(le=(D&15)<<12|(Se&63)<<6|ge&63,le>2047&&(le<55296||le>57343)&&(z=le));break;case 4:Se=_[N+1],ge=_[N+2],Ie=_[N+3],(Se&192)===128&&(ge&192)===128&&(Ie&192)===128&&(le=(D&15)<<18|(Se&63)<<12|(ge&63)<<6|Ie&63,le>65535&&le<1114112&&(z=le))}}z===null?(z=65533,ne=1):z>65535&&(z-=65536,P.push(z>>>10&1023|55296),z=56320|z&1023),P.push(z),N+=ne}return H(P)}const U=4096;function H(_){const p=_.length;if(p<=U)return String.fromCharCode.apply(String,_);let b="",P=0;for(;P<p;)b+=String.fromCharCode.apply(String,_.slice(P,P+=U));return b}function V(_,p,b){let P="";b=Math.min(_.length,b);for(let N=p;N<b;++N)P+=String.fromCharCode(_[N]&127);return P}function K(_,p,b){let P="";b=Math.min(_.length,b);for(let N=p;N<b;++N)P+=String.fromCharCode(_[N]);return P}function Q(_,p,b){const P=_.length;(!p||p<0)&&(p=0),(!b||b<0||b>P)&&(b=P);let N="";for(let D=p;D<b;++D)N+=av[_[D]];return N}function te(_,p,b){const P=_.slice(p,b);let N="";for(let D=0;D<P.length-1;D+=2)N+=String.fromCharCode(P[D]+P[D+1]*256);return N}l.prototype.slice=function(p,b){const P=this.length;p=~~p,b=b===void 0?P:~~b,p<0?(p+=P,p<0&&(p=0)):p>P&&(p=P),b<0?(b+=P,b<0&&(b=0)):b>P&&(b=P),b<p&&(b=p);const N=this.subarray(p,b);return Object.setPrototypeOf(N,l.prototype),N};function Y(_,p,b){if(_%1!==0||_<0)throw new RangeError("offset is not uint");if(_+p>b)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(p,b,P){p=p>>>0,b=b>>>0,P||Y(p,b,this.length);let N=this[p],D=1,z=0;for(;++z<b&&(D*=256);)N+=this[p+z]*D;return N},l.prototype.readUintBE=l.prototype.readUIntBE=function(p,b,P){p=p>>>0,b=b>>>0,P||Y(p,b,this.length);let N=this[p+--b],D=1;for(;b>0&&(D*=256);)N+=this[p+--b]*D;return N},l.prototype.readUint8=l.prototype.readUInt8=function(p,b){return p=p>>>0,b||Y(p,1,this.length),this[p]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(p,b){return p=p>>>0,b||Y(p,2,this.length),this[p]|this[p+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(p,b){return p=p>>>0,b||Y(p,2,this.length),this[p]<<8|this[p+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(p,b){return p=p>>>0,b||Y(p,4,this.length),(this[p]|this[p+1]<<8|this[p+2]<<16)+this[p+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(p,b){return p=p>>>0,b||Y(p,4,this.length),this[p]*16777216+(this[p+1]<<16|this[p+2]<<8|this[p+3])},l.prototype.readBigUInt64LE=Un(function(p){p=p>>>0,an(p,"offset");const b=this[p],P=this[p+7];(b===void 0||P===void 0)&&Ji(p,this.length-8);const N=b+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24,D=this[++p]+this[++p]*2**8+this[++p]*2**16+P*2**24;return BigInt(N)+(BigInt(D)<<BigInt(32))}),l.prototype.readBigUInt64BE=Un(function(p){p=p>>>0,an(p,"offset");const b=this[p],P=this[p+7];(b===void 0||P===void 0)&&Ji(p,this.length-8);const N=b*2**24+this[++p]*2**16+this[++p]*2**8+this[++p],D=this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+P;return(BigInt(N)<<BigInt(32))+BigInt(D)}),l.prototype.readIntLE=function(p,b,P){p=p>>>0,b=b>>>0,P||Y(p,b,this.length);let N=this[p],D=1,z=0;for(;++z<b&&(D*=256);)N+=this[p+z]*D;return D*=128,N>=D&&(N-=Math.pow(2,8*b)),N},l.prototype.readIntBE=function(p,b,P){p=p>>>0,b=b>>>0,P||Y(p,b,this.length);let N=b,D=1,z=this[p+--N];for(;N>0&&(D*=256);)z+=this[p+--N]*D;return D*=128,z>=D&&(z-=Math.pow(2,8*b)),z},l.prototype.readInt8=function(p,b){return p=p>>>0,b||Y(p,1,this.length),this[p]&128?(255-this[p]+1)*-1:this[p]},l.prototype.readInt16LE=function(p,b){p=p>>>0,b||Y(p,2,this.length);const P=this[p]|this[p+1]<<8;return P&32768?P|4294901760:P},l.prototype.readInt16BE=function(p,b){p=p>>>0,b||Y(p,2,this.length);const P=this[p+1]|this[p]<<8;return P&32768?P|4294901760:P},l.prototype.readInt32LE=function(p,b){return p=p>>>0,b||Y(p,4,this.length),this[p]|this[p+1]<<8|this[p+2]<<16|this[p+3]<<24},l.prototype.readInt32BE=function(p,b){return p=p>>>0,b||Y(p,4,this.length),this[p]<<24|this[p+1]<<16|this[p+2]<<8|this[p+3]},l.prototype.readBigInt64LE=Un(function(p){p=p>>>0,an(p,"offset");const b=this[p],P=this[p+7];(b===void 0||P===void 0)&&Ji(p,this.length-8);const N=this[p+4]+this[p+5]*2**8+this[p+6]*2**16+(P<<24);return(BigInt(N)<<BigInt(32))+BigInt(b+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24)}),l.prototype.readBigInt64BE=Un(function(p){p=p>>>0,an(p,"offset");const b=this[p],P=this[p+7];(b===void 0||P===void 0)&&Ji(p,this.length-8);const N=(b<<24)+this[++p]*2**16+this[++p]*2**8+this[++p];return(BigInt(N)<<BigInt(32))+BigInt(this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+P)}),l.prototype.readFloatLE=function(p,b){return p=p>>>0,b||Y(p,4,this.length),n.read(this,p,!0,23,4)},l.prototype.readFloatBE=function(p,b){return p=p>>>0,b||Y(p,4,this.length),n.read(this,p,!1,23,4)},l.prototype.readDoubleLE=function(p,b){return p=p>>>0,b||Y(p,8,this.length),n.read(this,p,!0,52,8)},l.prototype.readDoubleBE=function(p,b){return p=p>>>0,b||Y(p,8,this.length),n.read(this,p,!1,52,8)};function X(_,p,b,P,N,D){if(!l.isBuffer(_))throw new TypeError('"buffer" argument must be a Buffer instance');if(p>N||p<D)throw new RangeError('"value" argument is out of bounds');if(b+P>_.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(p,b,P,N){if(p=+p,b=b>>>0,P=P>>>0,!N){const ne=Math.pow(2,8*P)-1;X(this,p,b,P,ne,0)}let D=1,z=0;for(this[b]=p&255;++z<P&&(D*=256);)this[b+z]=p/D&255;return b+P},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(p,b,P,N){if(p=+p,b=b>>>0,P=P>>>0,!N){const ne=Math.pow(2,8*P)-1;X(this,p,b,P,ne,0)}let D=P-1,z=1;for(this[b+D]=p&255;--D>=0&&(z*=256);)this[b+D]=p/z&255;return b+P},l.prototype.writeUint8=l.prototype.writeUInt8=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,1,255,0),this[b]=p&255,b+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,2,65535,0),this[b]=p&255,this[b+1]=p>>>8,b+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,2,65535,0),this[b]=p>>>8,this[b+1]=p&255,b+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,4,4294967295,0),this[b+3]=p>>>24,this[b+2]=p>>>16,this[b+1]=p>>>8,this[b]=p&255,b+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,4,4294967295,0),this[b]=p>>>24,this[b+1]=p>>>16,this[b+2]=p>>>8,this[b+3]=p&255,b+4};function ue(_,p,b,P,N){it(p,P,N,_,b,7);let D=Number(p&BigInt(4294967295));_[b++]=D,D=D>>8,_[b++]=D,D=D>>8,_[b++]=D,D=D>>8,_[b++]=D;let z=Number(p>>BigInt(32)&BigInt(4294967295));return _[b++]=z,z=z>>8,_[b++]=z,z=z>>8,_[b++]=z,z=z>>8,_[b++]=z,b}function Ue(_,p,b,P,N){it(p,P,N,_,b,7);let D=Number(p&BigInt(4294967295));_[b+7]=D,D=D>>8,_[b+6]=D,D=D>>8,_[b+5]=D,D=D>>8,_[b+4]=D;let z=Number(p>>BigInt(32)&BigInt(4294967295));return _[b+3]=z,z=z>>8,_[b+2]=z,z=z>>8,_[b+1]=z,z=z>>8,_[b]=z,b+8}l.prototype.writeBigUInt64LE=Un(function(p,b=0){return ue(this,p,b,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Un(function(p,b=0){return Ue(this,p,b,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(p,b,P,N){if(p=+p,b=b>>>0,!N){const Se=Math.pow(2,8*P-1);X(this,p,b,P,Se-1,-Se)}let D=0,z=1,ne=0;for(this[b]=p&255;++D<P&&(z*=256);)p<0&&ne===0&&this[b+D-1]!==0&&(ne=1),this[b+D]=(p/z>>0)-ne&255;return b+P},l.prototype.writeIntBE=function(p,b,P,N){if(p=+p,b=b>>>0,!N){const Se=Math.pow(2,8*P-1);X(this,p,b,P,Se-1,-Se)}let D=P-1,z=1,ne=0;for(this[b+D]=p&255;--D>=0&&(z*=256);)p<0&&ne===0&&this[b+D+1]!==0&&(ne=1),this[b+D]=(p/z>>0)-ne&255;return b+P},l.prototype.writeInt8=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,1,127,-128),p<0&&(p=255+p+1),this[b]=p&255,b+1},l.prototype.writeInt16LE=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,2,32767,-32768),this[b]=p&255,this[b+1]=p>>>8,b+2},l.prototype.writeInt16BE=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,2,32767,-32768),this[b]=p>>>8,this[b+1]=p&255,b+2},l.prototype.writeInt32LE=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,4,2147483647,-2147483648),this[b]=p&255,this[b+1]=p>>>8,this[b+2]=p>>>16,this[b+3]=p>>>24,b+4},l.prototype.writeInt32BE=function(p,b,P){return p=+p,b=b>>>0,P||X(this,p,b,4,2147483647,-2147483648),p<0&&(p=4294967295+p+1),this[b]=p>>>24,this[b+1]=p>>>16,this[b+2]=p>>>8,this[b+3]=p&255,b+4},l.prototype.writeBigInt64LE=Un(function(p,b=0){return ue(this,p,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Un(function(p,b=0){return Ue(this,p,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function xe(_,p,b,P,N,D){if(b+P>_.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("Index out of range")}function be(_,p,b,P,N){return p=+p,b=b>>>0,N||xe(_,p,b,4),n.write(_,p,b,P,23,4),b+4}l.prototype.writeFloatLE=function(p,b,P){return be(this,p,b,!0,P)},l.prototype.writeFloatBE=function(p,b,P){return be(this,p,b,!1,P)};function Ke(_,p,b,P,N){return p=+p,b=b>>>0,N||xe(_,p,b,8),n.write(_,p,b,P,52,8),b+8}l.prototype.writeDoubleLE=function(p,b,P){return Ke(this,p,b,!0,P)},l.prototype.writeDoubleBE=function(p,b,P){return Ke(this,p,b,!1,P)},l.prototype.copy=function(p,b,P,N){if(!l.isBuffer(p))throw new TypeError("argument should be a Buffer");if(P||(P=0),!N&&N!==0&&(N=this.length),b>=p.length&&(b=p.length),b||(b=0),N>0&&N<P&&(N=P),N===P||p.length===0||this.length===0)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(P<0||P>=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),p.length-b<N-P&&(N=p.length-b+P);const D=N-P;return this===p&&typeof s.prototype.copyWithin=="function"?this.copyWithin(b,P,N):s.prototype.set.call(p,this.subarray(P,N),b),D},l.prototype.fill=function(p,b,P,N){if(typeof p=="string"){if(typeof b=="string"?(N=b,b=0,P=this.length):typeof P=="string"&&(N=P,P=this.length),N!==void 0&&typeof N!="string")throw new TypeError("encoding must be a string");if(typeof N=="string"&&!l.isEncoding(N))throw new TypeError("Unknown encoding: "+N);if(p.length===1){const z=p.charCodeAt(0);(N==="utf8"&&z<128||N==="latin1")&&(p=z)}}else typeof p=="number"?p=p&255:typeof p=="boolean"&&(p=Number(p));if(b<0||this.length<b||this.length<P)throw new RangeError("Out of range index");if(P<=b)return this;b=b>>>0,P=P===void 0?this.length:P>>>0,p||(p=0);let D;if(typeof p=="number")for(D=b;D<P;++D)this[D]=p;else{const z=l.isBuffer(p)?p:l.from(p,N),ne=z.length;if(ne===0)throw new TypeError('The value "'+p+'" is invalid for argument "value"');for(D=0;D<P-b;++D)this[D+b]=z[D%ne]}return this};const Ee={};function ye(_,p,b){Ee[_]=class extends b{constructor(){super(),Object.defineProperty(this,"message",{value:p.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${_}]`,this.stack,delete this.name}get code(){return _}set code(N){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:N,writable:!0})}toString(){return`${this.name} [${_}]: ${this.message}`}}}ye("ERR_BUFFER_OUT_OF_BOUNDS",function(_){return _?`${_} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ye("ERR_INVALID_ARG_TYPE",function(_,p){return`The "${_}" argument must be of type number. Received type ${typeof p}`},TypeError),ye("ERR_OUT_OF_RANGE",function(_,p,b){let P=`The value of "${_}" is out of range.`,N=b;return Number.isInteger(b)&&Math.abs(b)>2**32?N=_e(String(b)):typeof b=="bigint"&&(N=String(b),(b>BigInt(2)**BigInt(32)||b<-(BigInt(2)**BigInt(32)))&&(N=_e(N)),N+="n"),P+=` It must be ${p}. Received ${N}`,P},RangeError);function _e(_){let p="",b=_.length;const P=_[0]==="-"?1:0;for(;b>=P+4;b-=3)p=`_${_.slice(b-3,b)}${p}`;return`${_.slice(0,b)}${p}`}function Pe(_,p,b){an(p,"offset"),(_[p]===void 0||_[p+b]===void 0)&&Ji(p,_.length-(b+1))}function it(_,p,b,P,N,D){if(_>b||_<p){const z=typeof p=="bigint"?"n":"";let ne;throw p===0||p===BigInt(0)?ne=`>= 0${z} and < 2${z} ** ${(D+1)*8}${z}`:ne=`>= -(2${z} ** ${(D+1)*8-1}${z}) and < 2 ** ${(D+1)*8-1}${z}`,new Ee.ERR_OUT_OF_RANGE("value",ne,_)}Pe(P,N,D)}function an(_,p){if(typeof _!="number")throw new Ee.ERR_INVALID_ARG_TYPE(p,"number",_)}function Ji(_,p,b){throw Math.floor(_)!==_?(an(_,b),new Ee.ERR_OUT_OF_RANGE("offset","an integer",_)):p<0?new Ee.ERR_BUFFER_OUT_OF_BOUNDS:new Ee.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${p}`,_)}const rv=/[^+/0-9A-Za-z-_]/g;function iv(_){if(_=_.split("=")[0],_=_.trim().replace(rv,""),_.length<2)return"";for(;_.length%4!==0;)_=_+"=";return _}function vc(_,p){p=p||1/0;let b;const P=_.length;let N=null;const D=[];for(let z=0;z<P;++z){if(b=_.charCodeAt(z),b>55295&&b<57344){if(!N){if(b>56319){(p-=3)>-1&&D.push(239,191,189);continue}else if(z+1===P){(p-=3)>-1&&D.push(239,191,189);continue}N=b;continue}if(b<56320){(p-=3)>-1&&D.push(239,191,189),N=b;continue}b=(N-55296<<10|b-56320)+65536}else N&&(p-=3)>-1&&D.push(239,191,189);if(N=null,b<128){if((p-=1)<0)break;D.push(b)}else if(b<2048){if((p-=2)<0)break;D.push(b>>6|192,b&63|128)}else if(b<65536){if((p-=3)<0)break;D.push(b>>12|224,b>>6&63|128,b&63|128)}else if(b<1114112){if((p-=4)<0)break;D.push(b>>18|240,b>>12&63|128,b>>6&63|128,b&63|128)}else throw new Error("Invalid code point")}return D}function sv(_){const p=[];for(let b=0;b<_.length;++b)p.push(_.charCodeAt(b)&255);return p}function ov(_,p){let b,P,N;const D=[];for(let z=0;z<_.length&&!((p-=2)<0);++z)b=_.charCodeAt(z),P=b>>8,N=b%256,D.push(N),D.push(P);return D}function Wf(_){return t.toByteArray(iv(_))}function vo(_,p,b,P){let N;for(N=0;N<P&&!(N+b>=p.length||N>=_.length);++N)p[N+b]=_[N];return N}function qt(_,p){return _ instanceof p||_!=null&&_.constructor!=null&&_.constructor.name!=null&&_.constructor.name===p.name}function xc(_){return _!==_}const av=function(){const _="0123456789abcdef",p=new Array(256);for(let b=0;b<16;++b){const P=b*16;for(let N=0;N<16;++N)p[P+N]=_[b]+_[N]}return p}();function Un(_){return typeof BigInt>"u"?cv:_}function cv(){throw new Error("BigInt not supported")}})(Fe);const ce=Fe.Buffer,GE=Fe.Blob,VE=Fe.BlobOptions,WE=Fe.Buffer,KE=Fe.File,ZE=Fe.FileOptions,YE=Fe.INSPECT_MAX_BYTES,QE=Fe.SlowBuffer,JE=Fe.TranscodeEncoding,XE=Fe.atob,e3=Fe.btoa,t3=Fe.constants,n3=Fe.isAscii,r3=Fe.isUtf8,i3=Fe.kMaxLength,s3=Fe.kStringMaxLength,o3=Fe.resolveObjectURL,a3=Fe.transcode,dT=Object.freeze(Object.defineProperty({__proto__:null,Blob:GE,BlobOptions:VE,Buffer:WE,File:KE,FileOptions:ZE,INSPECT_MAX_BYTES:YE,SlowBuffer:QE,TranscodeEncoding:JE,atob:XE,btoa:e3,constants:t3,default:ce,isAscii:n3,isUtf8:r3,kMaxLength:i3,kStringMaxLength:s3,resolveObjectURL:o3,transcode:a3},Symbol.toStringTag,{value:"Module"}));function Zd(e){if(!(e instanceof F))return!1;const t=e.walk(n=>n instanceof sa);return t instanceof sa?t.data?.errorName==="HttpError"||t.data?.errorName==="ResolverError"||t.data?.errorName==="ResolverNotContract"||t.data?.errorName==="ResolverNotFound"||t.data?.errorName==="ReverseAddressMismatch"||t.data?.errorName==="UnsupportedResolverProfile":!1}function Yd(e){const{abi:t,data:n}=e,r=Pr(n,0,4),i=t.find(s=>s.type==="function"&&r===Xs(Dt(s)));if(!i)throw new D2(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:i.name,args:"inputs"in i&&i.inputs&&i.inputs.length>0?Ur(i.inputs,Pr(n,4)):void 0}}const Dc="/docs/contract/encodeErrorResult";function F0(e){const{abi:t,errorName:n,args:r}=e;let i=t[0];if(n){const c=jr({abi:t,args:r,name:n});if(!c)throw new a0(n,{docsPath:Dc});i=c}if(i.type!=="error")throw new a0(void 0,{docsPath:Dc});const s=Dt(i),o=Xs(s);let a="0x";if(r&&r.length>0){if(!i.inputs)throw new U2(i.name,{docsPath:Dc});a=mt(i.inputs,r)}return Mn([o,a])}const zc="/docs/contract/encodeFunctionResult";function c3(e){const{abi:t,functionName:n,result:r}=e;let i=t[0];if(n){const o=jr({abi:t,name:n});if(!o)throw new yi(n,{docsPath:zc});i=o}if(i.type!=="function")throw new yi(void 0,{docsPath:zc});if(!i.outputs)throw new _m(i.name,{docsPath:zc});const s=(()=>{if(i.outputs.length===0)return[];if(i.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Im(r)})();return mt(i.outputs,s)}const so="x-batch-gateway:true";async function zy(e){const{data:t,ccipRequest:n}=e,{args:[r]}=Yd({abi:Zu,data:t}),i=[],s=[];return await Promise.all(r.map(async(o,a)=>{try{s[a]=o.urls.includes(so)?await zy({data:o.data,ccipRequest:n}):await n(o),i[a]=!1}catch(c){i[a]=!0,s[a]=u3(c)}})),c3({abi:Zu,functionName:"query",result:[i,s]})}function u3(e){return e.name==="HttpRequestError"&&e.status?F0({abi:Zu,errorName:"HttpError",args:[e.status,e.shortMessage]}):F0({abi:[wm],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Hy(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Qe(t)?t:null}function Yu(e){let t=new Uint8Array(32).fill(0);if(!e)return je(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const i=Hy(n[r]),s=i?ji(i):pe(Cn(n[r]),"bytes");t=pe(Xe([t,s]),"bytes")}return je(t)}function l3(e){return`[${e.slice(2)}]`}function d3(e){const t=new Uint8Array(32).fill(0);return e?Hy(e)||pe(Cn(e)):je(t)}function Qd(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Cn(t).byteLength+2);let r=0;const i=t.split(".");for(let s=0;s<i.length;s++){let o=Cn(i[s]);o.byteLength>255&&(o=Cn(l3(d3(i[s])))),n[r]=o.length,n.set(o,r+1),r+=o.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function f3(e,t){const{blockNumber:n,blockTag:r,coinType:i,name:s,gatewayUrls:o,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Di({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),l=c?.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;const d=i!=null?[Yu(s),BigInt(i)]:[Yu(s)];try{const f=Re({abi:N0,functionName:"addr",args:d}),h={address:u,abi:$y,functionName:"resolveWithGateways",args:[ht(Qd(s)),f,o??[so]],blockNumber:n,blockTag:r},y=await Z(e,yt,"readContract")(h);if(y[0]==="0x")return null;const m=zr({abi:N0,args:d,functionName:"addr",data:y[0]});return m==="0x"||Ft(m)==="0x00"?null:m}catch(f){if(a)throw f;if(Zd(f))return null;throw f}}class h3 extends F{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 es extends F{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Jd extends F{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 p3 extends F{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const m3=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,y3=/^(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>\/.*)?$/,b3=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,g3=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function w3(e){try{const t=await fetch(e,{method:"HEAD"});return t.status===200?t.headers.get("content-type")?.startsWith("image/"):!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function D0(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function qy({uri:e,gatewayUrls:t}){const n=b3.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=D0(t?.ipfs,"https://ipfs.io"),i=D0(t?.arweave,"https://arweave.net"),s=e.match(m3),{protocol:o,subpath:a,target:c,subtarget:u=""}=s?.groups||{},l=o==="ipns:/"||a==="ipns/",d=o==="ipfs:/"||a==="ipfs/"||y3.test(e);if(e.startsWith("http")&&!l&&!d){let h=e;return t?.arweave&&(h=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:h,isOnChain:!1,isEncoded:!1}}if((l||d)&&c)return{uri:`${r}/${l?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&c)return{uri:`${i}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let f=e.replace(g3,"");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 Jd({uri:e})}function Gy(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new h3({data:e});return e.image||e.image_url||e.image_data}async function v3({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(i=>i.json());return await Xd({gatewayUrls:e,uri:Gy(n)})}catch{throw new Jd({uri:t})}}async function Xd({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=qy({uri:t,gatewayUrls:e});if(r||await w3(n))return n;throw new Jd({uri:t})}function x3(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,i]=t.split("/"),[s,o]=n.split(":"),[a,c]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new es({reason:"Only EIP-155 supported"});if(!o)throw new es({reason:"Chain ID not found"});if(!c)throw new es({reason:"Contract address not found"});if(!i)throw new es({reason:"Token ID not found"});if(!a)throw new es({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o,10),namespace:a.toLowerCase(),contractAddress:c,tokenID:i}}async function E3(e,{nft:t}){if(t.namespace==="erc721")return yt(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 yt(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 p3({namespace:t.namespace})}async function _3(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?S3(e,{gatewayUrls:t,record:n}):Xd({uri:n,gatewayUrls:t})}async function S3(e,{gatewayUrls:t,record:n}){const r=x3(n),i=await E3(e,{nft:r}),{uri:s,isOnChain:o,isEncoded:a}=qy({uri:i,gatewayUrls:t});if(o&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=a?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return Xd({uri:Gy(l),gatewayUrls:t})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),v3({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,c)})}async function Vy(e,t){const{blockNumber:n,blockTag:r,key:i,name:s,gatewayUrls:o,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Di({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),l=c?.ensTlds;if(l&&!l.some(d=>s.endsWith(d)))return null;try{const d={address:u,abi:$y,args:[ht(Qd(s)),Re({abi:$0,functionName:"text",args:[Yu(s),i]}),o??[so]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},h=await Z(e,yt,"readContract")(d);if(h[0]==="0x")return null;const g=zr({abi:$0,functionName:"text",data:h[0]});return g===""?null:g}catch(d){if(a)throw d;if(Zd(d))return null;throw d}}async function I3(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:i,gatewayUrls:s,strict:o,universalResolverAddress:a}){const c=await Z(e,Vy,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:i,universalResolverAddress:a,gatewayUrls:s,strict:o});if(!c)return null;try{return await _3(e,{record:c,gatewayUrls:r})}catch{return null}}async function A3(e,t){const{address:n,blockNumber:r,blockTag:i,coinType:s=60n,gatewayUrls:o,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Di({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const l={address:u,abi:pE,args:[n,s,o??[so]],functionName:"reverseWithGateways",blockNumber:r,blockTag:i},d=Z(e,yt,"readContract"),[f]=await d(l);return f||null}catch(l){if(a)throw l;if(Zd(l))return null;throw l}}async function P3(e,t){const{blockNumber:n,blockTag:r,name:i}=t,{chain:s}=e,o=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return Di({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),a=s?.ensTlds;if(a&&!a.some(u=>i.endsWith(u)))throw new Error(`${i} is not a valid ENS TLD (${a?.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[c]=await Z(e,yt,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[ht(Qd(i))],blockNumber:n,blockTag:r});return c}async function Wy(e,t){const{account:n=e.account,blockNumber:r,blockTag:i="latest",blobs:s,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:h,...g}=t,y=n?We(n):void 0;try{Hi(t);const w=(typeof r=="bigint"?q(r):void 0)||i,S=e.chain?.formatters?.transactionRequest?.format,E=(S||Zs)({...Da(g,{format:S}),account:y,blobs:s,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:h},"createAccessList"),v=await e.request({method:"eth_createAccessList",params:[E,w]});return{accessList:v.accessList,gasUsed:BigInt(v.gasUsed)}}catch(m){throw Hm(m,{...t,account:y,chain:e.chain})}}function Ya(e,{method:t}){const n={};return e.transport.type==="fallback"&&e.transport.onResponse?.(({method:r,response:i,status:s,transport:o})=>{s==="success"&&t===r&&(n[i]=o.request)}),r=>n[r]||e.request}async function k3(e){const t=Ya(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}class C3 extends F{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}const z0="/docs/contract/encodeEventTopics";function oo(e){const{abi:t,eventName:n,args:r}=e;let i=t[0];if(n){const c=jr({abi:t,name:n});if(!c)throw new c0(n,{docsPath:z0});i=c}if(i.type!=="event")throw new c0(void 0,{docsPath:z0});const s=Dt(i),o=Ua(s);let a=[];if(r&&"inputs"in i){const c=i.inputs?.filter(l=>"indexed"in l&&l.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?c?.map(l=>r[l.name])??[]:[];u.length>0&&(a=c?.map((l,d)=>Array.isArray(u[d])?u[d].map((f,h)=>H0({param:l,value:u[d][h]})):typeof u[d]<"u"&&u[d]!==null?H0({param:l,value:u[d]}):null)??[])}return[o,...a]}function H0({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return pe(ji(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new C3(e.type);return mt([e],[t])}async function Ky(e,t){const{address:n,abi:r,args:i,eventName:s,fromBlock:o,strict:a,toBlock:c}=t,u=Ya(e,{method:"eth_newFilter"}),l=s?oo({abi:r,args:i,eventName:s}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof o=="bigint"?q(o):o,toBlock:typeof c=="bigint"?q(c):c,topics:l}]});return{abi:r,args:i,eventName:s,id:d,request:u(d),strict:!!a,type:"event"}}async function Zy(e,{address:t,args:n,event:r,events:i,fromBlock:s,strict:o,toBlock:a}={}){const c=i??(r?[r]:void 0),u=Ya(e,{method:"eth_newFilter"});let l=[];c&&(l=[c.flatMap(h=>oo({abi:[h],eventName:h.name,args:n}))],r&&(l=l[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?q(s):s,toBlock:typeof a=="bigint"?q(a):a,...l.length?{topics:l}:{}}]});return{abi:c,args:n,eventName:r?r.name:void 0,fromBlock:s,id:d,request:u(d),strict:!!o,toBlock:a,type:"event"}}async function Yy(e){const t=Ya(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}class B3 extends F{constructor(t,{account:n,docsPath:r,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:d,value:f}){const h=Fi({from:n?.address,to:d,value:typeof f<"u"&&`${wd(f)} ${i?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${rt(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${rt(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${rt(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",h].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}function O3(e,{docsPath:t,...n}){const r=(()=>{const i=Fa(e,n);return i instanceof Ys?e:i})();return new B3(r,{docsPath:t,...n})}class Qy extends F{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class ef extends F{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class T3 extends F{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${rt(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Jy extends F{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"})}}async function Ut(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:i}={}){const s=i??!1,o=n!==void 0?q(n):void 0;let a=null;if(t?a=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):a=await e.request({method:"eth_getBlockByNumber",params:[o||r,s]},{dedupe:!!o}),!a)throw new Jy({blockHash:t,blockNumber:n});return(e.chain?.formatters?.block?.format||Vp)(a,"getBlock")}async function tf(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function $3(e,t){return Xy(e,t)}async function Xy(e,t){const{block:n,chain:r=e.chain,request:i}=t||{};try{const s=r?.fees?.maxPriorityFeePerGas??r?.fees?.defaultPriorityFee;if(typeof s=="function"){const a=n||await Z(e,Ut,"getBlock")({}),c=await s({block:a,client:e,request:i});if(c===null)throw new Error;return c}if(typeof s<"u")return s;const o=await e.request({method:"eth_maxPriorityFeePerGas"});return Le(o)}catch{const[s,o]=await Promise.all([n?Promise.resolve(n):Z(e,Ut,"getBlock")({}),Z(e,tf,"getGasPrice")({})]);if(typeof s.baseFeePerGas!="bigint")throw new ef;const a=o-s.baseFeePerGas;return a<0n?0n:a}}async function eb(e,t){return Qu(e,t)}async function Qu(e,t){const{block:n,chain:r=e.chain,request:i,type:s="eip1559"}=t||{},o=await(async()=>typeof r?.fees?.baseFeeMultiplier=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:i}):r?.fees?.baseFeeMultiplier??1.2)();if(o<1)throw new Qy;const c=10**(o.toString().split(".")[1]?.length??0),u=f=>f*BigInt(Math.ceil(o*c))/BigInt(c),l=n||await Z(e,Ut,"getBlock")({});if(typeof r?.fees?.estimateFeesPerGas=="function"){const f=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:i,type:s});if(f!==null)return f}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new ef;const f=typeof i?.maxPriorityFeePerGas=="bigint"?i.maxPriorityFeePerGas:await Xy(e,{block:l,chain:r,request:i}),h=u(l.baseFeePerGas);return{maxFeePerGas:i?.maxFeePerGas??h+f,maxPriorityFeePerGas:f}}return{gasPrice:i?.gasPrice??u(await Z(e,tf,"getGasPrice")({}))}}async function nf(e,{address:t,blockTag:n="latest",blockNumber:r}){const i=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?q(r):n]},{dedupe:!!r});return pt(i)}function N3(e,{docsPath:t,...n}){const r=(()=>{const i=Fa(e,n);return i instanceof Ys?e:i})();return new $v(r,{docsPath:t,...n})}async function Gi(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return pt(t)}async function tb(e,t){const{account:n=e.account,accessList:r,authorizationList:i,chain:s=e.chain,blobVersionedHashes:o,blobs:a,data:c,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:g,nonceManager:y,to:m,type:w,value:S,...x}=t,E=await(async()=>{if(!n||!y||typeof g<"u")return g;const B=We(n),T=s?s.id:await Z(e,Gi,"getChainId")({});return await y.consume({address:B.address,chainId:T,client:e})})();Hi(t);const v=s?.formatters?.transactionRequest?.format,A=(v||Zs)({...Da(x,{format:v}),account:n?We(n):void 0,accessList:r,authorizationList:i,blobs:a,blobVersionedHashes:o,data:c,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:E,to:m,type:w,value:S},"fillTransaction");try{const B=await e.request({method:"eth_fillTransaction",params:[A]}),M=(s?.formatters?.transaction?.format||yd)(B.tx);delete M.blockHash,delete M.blockNumber,delete M.r,delete M.s,delete M.transactionIndex,delete M.v,delete M.yParity,M.data=M.input,M.gas&&(M.gas=t.gas??M.gas),M.gasPrice&&(M.gasPrice=t.gasPrice??M.gasPrice),M.maxFeePerBlobGas&&(M.maxFeePerBlobGas=t.maxFeePerBlobGas??M.maxFeePerBlobGas),M.maxFeePerGas&&(M.maxFeePerGas=t.maxFeePerGas??M.maxFeePerGas),M.maxPriorityFeePerGas&&(M.maxPriorityFeePerGas=t.maxPriorityFeePerGas??M.maxPriorityFeePerGas),M.nonce&&(M.nonce=t.nonce??M.nonce);const j=await(async()=>{if(typeof s?.fees?.baseFeeMultiplier=="function"){const C=await Z(e,Ut,"getBlock")({});return s.fees.baseFeeMultiplier({block:C,client:e,request:t})}return s?.fees?.baseFeeMultiplier??1.2})();if(j<1)throw new Qy;const L=10**(j.toString().split(".")[1]?.length??0),$=C=>C*BigInt(Math.ceil(j*L))/BigInt(L);return M.maxFeePerGas&&!t.maxFeePerGas&&(M.maxFeePerGas=$(M.maxFeePerGas)),M.gasPrice&&!t.gasPrice&&(M.gasPrice=$(M.gasPrice)),{raw:B.raw,transaction:{from:A.from,...M}}}catch(B){throw N3(B,{...t,chain:e.chain})}}const M3=["blobVersionedHashes","chainId","fees","gas","nonce","type"],q0=new Map,Hc=new Qs(128);async function nb(e,t){let n=t;n.account??=e.account,n.parameters??=M3;const{account:r,chain:i=e.chain,nonceManager:s,parameters:o}=n,a=(()=>{if(typeof i?.prepareTransactionRequest=="function")return{fn:i.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(i?.prepareTransactionRequest))return{fn:i.prepareTransactionRequest[0],runAt:i.prepareTransactionRequest[1].runAt}})();let c;async function u(){return c||(typeof n.chainId<"u"?n.chainId:i?i.id:(c=await Z(e,Gi,"getChainId")({}),c))}const l=r&&We(r);let d=n.nonce;if(o.includes("nonce")&&typeof d>"u"&&l&&s){const E=await u();d=await s.consume({address:l.address,chainId:E,client:e})}a?.fn&&a.runAt?.includes("beforeFillTransaction")&&(n=await a.fn({...n,chain:i},{phase:"beforeFillTransaction"}),d??=n.nonce);const h=((o.includes("blobVersionedHashes")||o.includes("sidecars"))&&n.kzg&&n.blobs||Hc.get(e.uid)===!1||!["fees","gas"].some(v=>o.includes(v))?!1:!!(o.includes("chainId")&&typeof n.chainId!="number"||o.includes("nonce")&&typeof d!="number"||o.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||o.includes("gas")&&typeof n.gas!="bigint"))?await Z(e,tb,"fillTransaction")({...n,nonce:d}).then(E=>{const{chainId:v,from:I,gas:A,gasPrice:B,nonce:T,maxFeePerBlobGas:M,maxFeePerGas:j,maxPriorityFeePerGas:k,type:L,...$}=E.transaction;return Hc.set(e.uid,!0),{...n,...I?{from:I}:{},...L?{type:L}:{},...typeof v<"u"?{chainId:v}:{},...typeof A<"u"?{gas:A}:{},...typeof B<"u"?{gasPrice:B}:{},...typeof T<"u"?{nonce:T}:{},...typeof M<"u"?{maxFeePerBlobGas:M}:{},...typeof j<"u"?{maxFeePerGas:j}:{},...typeof k<"u"?{maxPriorityFeePerGas:k}:{},..."nonceKey"in $&&typeof $.nonceKey<"u"?{nonceKey:$.nonceKey}:{}}}).catch(E=>{const v=E;return v.name!=="TransactionExecutionError"||v.walk?.(A=>{const B=A;return B.name==="MethodNotFoundRpcError"||B.name==="MethodNotSupportedRpcError"})&&Hc.set(e.uid,!1),n}):n;d??=h.nonce,n={...h,...l?{from:l?.address}:{},...d?{nonce:d}:{}};const{blobs:g,gas:y,kzg:m,type:w}=n;a?.fn&&a.runAt?.includes("beforeFillParameters")&&(n=await a.fn({...n,chain:i},{phase:"beforeFillParameters"}));let S;async function x(){return S||(S=await Z(e,Ut,"getBlock")({blockTag:"latest"}),S)}if(o.includes("nonce")&&typeof d>"u"&&l&&!s&&(n.nonce=await Z(e,nf,"getTransactionCount")({address:l.address,blockTag:"pending"})),(o.includes("blobVersionedHashes")||o.includes("sidecars"))&&g&&m){const E=em({blobs:g,kzg:m});if(o.includes("blobVersionedHashes")){const v=m2({commitments:E,to:"hex"});n.blobVersionedHashes=v}if(o.includes("sidecars")){const v=tm({blobs:g,commitments:E,kzg:m}),I=w2({blobs:g,commitments:E,proofs:v,to:"hex"});n.sidecars=I}}if(o.includes("chainId")&&(n.chainId=await u()),(o.includes("fees")||o.includes("type"))&&typeof w>"u")try{n.type=O2(n)}catch{let E=q0.get(e.uid);typeof E>"u"&&(E=typeof(await x())?.baseFeePerGas=="bigint",q0.set(e.uid,E)),n.type=E?"eip1559":"legacy"}if(o.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const E=await x(),{maxFeePerGas:v,maxPriorityFeePerGas:I}=await Qu(e,{block:E,chain:i,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<I)throw new T3({maxPriorityFeePerGas:I});n.maxPriorityFeePerGas=I,n.maxFeePerGas=v}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new ef;if(typeof n.gasPrice>"u"){const E=await x(),{gasPrice:v}=await Qu(e,{block:E,chain:i,request:n,type:"legacy"});n.gasPrice=v}}return o.includes("gas")&&typeof y>"u"&&(n.gas=await Z(e,rf,"estimateGas")({...n,account:l,prepare:l?.type==="local"?[]:["blobVersionedHashes"]})),a?.fn&&a.runAt?.includes("afterFillParameters")&&(n=await a.fn({...n,chain:i},{phase:"afterFillParameters"})),Hi(n),delete n.parameters,n}async function rf(e,t){const{account:n=e.account,prepare:r=!0}=t,i=n?We(n):void 0,s=(()=>{if(Array.isArray(r))return r;if(i?.type!=="local")return["blobVersionedHashes"]})();try{const o=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await Ry({authorization:t.authorizationList[0]}).catch(()=>{throw new F("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:a,authorizationList:c,blobs:u,blobVersionedHashes:l,blockNumber:d,blockTag:f,data:h,gas:g,gasPrice:y,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:S,nonce:x,value:E,stateOverride:v,...I}=r?await nb(e,{...t,parameters:s,to:o}):t;if(g&&t.gas!==g)return g;const B=(typeof d=="bigint"?q(d):void 0)||f,T=Wa(v);Hi(t);const M=e.chain?.formatters?.transactionRequest?.format,k=(M||Zs)({...Da(I,{format:M}),account:i,accessList:a,authorizationList:c,blobs:u,blobVersionedHashes:l,data:h,gasPrice:y,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:S,nonce:x,to:o,value:E},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:T?[k,B??e.experimental_blockTag??"latest",T]:B?[k,B]:[k]}))}catch(o){throw O3(o,{...t,account:i,chain:e.chain})}}async function L3(e,t){const{abi:n,address:r,args:i,functionName:s,dataSuffix:o,...a}=t,c=Re({abi:n,args:i,functionName:s});try{return await Z(e,rf,"estimateGas")({data:`${c}${o?o.replace("0x",""):""}`,to:r,...a})}catch(u){const l=a.account?We(a.account):void 0;throw wi(u,{abi:n,address:r,args:i,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l?.address})}}async function R3(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const i=typeof n=="bigint"?q(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,i||r]});return BigInt(s)}async function U3(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}const j3=new Map,F3=new Map;function D3(e){const t=(i,s)=>({clear:()=>s.delete(i),get:()=>s.get(i),set:o=>s.set(i,o)}),n=t(e,j3),r=t(e,F3);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function z3(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=D3(t),i=r.response.get();if(i&&n>0&&Date.now()-i.created.getTime()<n)return i.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const o=await s;return r.response.set({created:new Date,data:o}),o}finally{r.promise.clear()}}const H3=e=>`blockNumber.${e}`;async function ao(e,{cacheTime:t=e.cacheTime}={}){const n=await z3(()=>e.request({method:"eth_blockNumber"}),{cacheKey:H3(e.uid),cacheTime:t});return BigInt(n)}async function q3(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const i=n!==void 0?q(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[i||r]},{dedupe:!!i}),pt(s)}const G0="/docs/contract/decodeEventLog";function ua(e){const{abi:t,data:n,strict:r,topics:i}=e,s=r??!0,[o,...a]=i;if(!o)throw new j2({docsPath:G0});const c=t.find(y=>y.type==="event"&&o===Ua(Dt(y)));if(!(c&&"name"in c)||c.type!=="event")throw new F2(o,{docsPath:G0});const{name:u,inputs:l}=c,d=l?.some(y=>!("name"in y&&y.name)),f=d?[]:{},h=l.map((y,m)=>[y,m]).filter(([y])=>"indexed"in y&&y.indexed);for(let y=0;y<h.length;y++){const[m,w]=h[y],S=a[y];if(!S)throw new _d({abiItem:c,param:m});f[d?w:m.name||w]=G3({param:m,value:S})}const g=l.filter(y=>!("indexed"in y&&y.indexed));if(g.length>0){if(n&&n!=="0x")try{const y=Ur(g,n);if(y)if(d)for(let m=0;m<l.length;m++)f[m]=f[m]??y.shift();else for(let m=0;m<g.length;m++)f[g[m].name]=y[m]}catch(y){if(s)throw y instanceof vm||y instanceof Kp?new ra({abiItem:c,data:n,params:g,size:we(n)}):y}else if(s)throw new ra({abiItem:c,data:"0x",params:g,size:0})}return{eventName:u,args:Object.values(f).length>0?f:void 0}}function G3({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Ur([e],t)||[])[0]}function sf(e){const{abi:t,args:n,logs:r,strict:i=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(o=>{const a=t.filter(l=>l.type==="event"&&o.topics[0]===Ua(l));if(a.length===0)return null;let c,u;for(const l of a)try{c=ua({...o,abi:[l],strict:!0}),u=l;break}catch{}if(!c&&!i){u=a[0];try{c=ua({...o,abi:[u],strict:!1})}catch{const l=u.inputs?.some(d=>!("name"in d&&d.name));return{...o,args:l?[]:{},eventName:u.name}}}return!c||!u||s&&!s.includes(c.eventName)||!V3({args:c.args,inputs:u.inputs,matchArgs:n})?null:{...c,...o}}).filter(Boolean)}function V3(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function i(s,o,a){try{return s.type==="address"?Fr(o,a):s.type==="string"||s.type==="bytes"?pe(ji(o))===a:o===a}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,o)=>{if(s==null)return!0;const a=n[o];return a?(Array.isArray(s)?s:[s]).some(u=>i(a,u,t[o])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,o])=>{if(o==null)return!0;const a=n.find(u=>u.name===s);return a?(Array.isArray(o)?o:[o]).some(u=>i(a,u,t[s])):!1}):!1}async function of(e,{address:t,blockHash:n,fromBlock:r,toBlock:i,event:s,events:o,args:a,strict:c}={}){const u=c??!1,l=o??(s?[s]:void 0);let d=[];l&&(d=[l.flatMap(y=>oo({abi:[y],eventName:y.name,args:o?void 0:a}))],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"?q(r):r,toBlock:typeof i=="bigint"?q(i):i}]});const h=f.map(g=>sn(g));return l?sf({abi:l,args:a,logs:h,strict:u}):h}async function rb(e,t){const{abi:n,address:r,args:i,blockHash:s,eventName:o,fromBlock:a,toBlock:c,strict:u}=t,l=o?jr({abi:n,name:o}):void 0,d=l?void 0:n.filter(f=>f.type==="event");return Z(e,of,"getLogs")({address:r,args:i,blockHash:s,event:l,events:d,fromBlock:a,toBlock:c,strict:u})}class W3 extends F{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 K3(e,t){const{address:n,factory:r,factoryData:i}=t;try{const[s,o,a,c,u,l,d]=await Z(e,yt,"readContract")({abi:Z3,address:n,functionName:"eip712Domain",factory:r,factoryData:i});return{domain:{name:o,version:a,chainId:Number(c),verifyingContract:u,salt:l},extensions:d,fields:s}}catch(s){const o=s;throw o.name==="ContractFunctionExecutionError"&&o.cause.name==="ContractFunctionZeroDataError"?new W3({address:n}):o}}const Z3=[{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 Y3(e){return{baseFeePerGas:e.baseFeePerGas.map(t=>BigInt(t)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map(t=>t.map(n=>BigInt(n)))}}async function Q3(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:i}){const s=typeof n=="bigint"?q(n):void 0,o=await e.request({method:"eth_feeHistory",params:[q(t),s||r,i]},{dedupe:!!s});return Y3(o)}async function Qa(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 i=r.map(s=>sn(s));return!("abi"in t)||!t.abi?i:sf({abi:t.abi,logs:i,strict:n})}async function J3(e,{filter:t}){const n=t.strict??!1,i=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>sn(s));return t.abi?sf({abi:t.abi,logs:i,strict:n}):i}function X3(e,t){if(e.length!==t.length)throw new xm({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const i=e[r],s=t[r];n.push(ib(i,s))}return Mn(n)}function ib(e,t,n=!1){if(e==="address"){const o=t;if(!et(o))throw new Tn({address:o});return Me(o.toLowerCase(),{size:n?32:null})}if(e==="string")return Ir(t);if(e==="bytes")return t;if(e==="bool")return Me(md(t),{size:n?32:1});const r=e.match(Ad);if(r){const[o,a,c="256"]=r,u=Number.parseInt(c,10)/8;return q(t,{size:n?32:u,signed:a==="int"})}const i=e.match(Um);if(i){const[o,a]=i;if(Number.parseInt(a,10)!==(t.length-2)/2)throw new Sm({expectedSize:Number.parseInt(a,10),givenSize:(t.length-2)/2});return Me(t,{dir:"right",size:n?32:null})}const s=e.match(D6);if(s&&Array.isArray(t)){const[o,a]=s,c=[];for(let u=0;u<t.length;u++)c.push(ib(a,t[u],!0));return c.length===0?"0x":Mn(c)}throw new V2(e)}const Io=new Qs(8192);function e8(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Io.get(n))return Io.get(n);const r=e().finally(()=>Io.delete(n));return Io.set(n,r),r}async function la(e){return new Promise(t=>setTimeout(t,e))}function Rs(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const c=async({error:u})=>{const l=typeof t=="function"?t({count:a,error:u}):t;l&&await la(l),o({count:a+1})};try{const u=await e();i(u)}catch(u){if(a<n&&await r({count:a,error:u}))return c({error:u});s(u)}};o()})}function t8(e,t={}){return async(n,r={})=>{const{dedupe:i=!1,methods:s,retryDelay:o=150,retryCount:a=3,uid:c}={...t,...r},{method:u}=n;if(s?.exclude?.includes(u))throw new pr(new Error("method not supported"),{method:u});if(s?.include&&!s.include.includes(u))throw new pr(new Error("method not supported"),{method:u});const l=i?Ir(`${c}.${Oe(n)}`):void 0;return e8(()=>Rs(async()=>{try{return await e(n)}catch(d){const f=d;switch(f.code){case ys.code:throw new ys(f);case bs.code:throw new bs(f);case gs.code:throw new gs(f,{method:n.method});case ws.code:throw new ws(f);case kr.code:throw new kr(f);case ir.code:throw new ir(f);case vs.code:throw new vs(f);case tr.code:throw new tr(f);case bi.code:throw new bi(f);case pr.code:throw new pr(f,{method:n.method});case gi.code:throw new gi(f);case xs.code:throw new xs(f);case he.code:throw new he(f);case Es.code:throw new Es(f);case _s.code:throw new _s(f);case Ss.code:throw new Ss(f);case Is.code:throw new Is(f);case Tt.code:throw new Tt(f);case As.code:throw new As(f);case Ps.code:throw new Ps(f);case ks.code:throw new ks(f);case Cs.code:throw new Cs(f);case Bs.code:throw new Bs(f);case Os.code:throw new Os(f);case Ts.code:throw new Ts(f);case 5e3:throw new he(f);default:throw d instanceof F?d:new u5(f)}}},{delay:({count:d,error:f})=>{if(f&&f instanceof wr){const h=f?.headers?.get("Retry-After");if(h?.match(/\d/))return Number.parseInt(h,10)*1e3}return~~(1<<d)*o},retryCount:a,shouldRetry:({error:d})=>n8(d)}),{enabled:i,id:l})}}function n8(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===gi.code||e.code===kr.code:e instanceof wr&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class r8 extends F{constructor({callbackSelector:t,cause:n,data:r,extraData:i,sender:s,urls:o}){super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],n.metaMessages?.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map(a=>` ${eo(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class i8 extends F{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${eo(n)}`,`Response: ${Oe(t)}`],name:"OffchainLookupResponseMalformedError"})}}class s8 extends F{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 o8="0x556f1830",sb={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 a8(e,{blockNumber:t,blockTag:n,data:r,to:i}){const{args:s}=Bd({data:r,abi:[sb]}),[o,a,c,u,l]=s,{ccipRead:d}=e,f=d&&typeof d?.request=="function"?d.request:ob;try{if(!Fr(i,o))throw new s8({sender:o,to:i});const h=a.includes(so)?await zy({data:c,ccipRequest:f}):await f({data:c,sender:o,urls:a}),{data:g}=await io(e,{blockNumber:t,blockTag:n,data:Xe([u,mt([{type:"bytes"},{type:"bytes"}],[h,l])]),to:i});return g}catch(h){throw new r8({callbackSelector:u,cause:h,data:r,extraData:l,sender:o,urls:a})}}async function ob({data:e,sender:t,urls:n}){let r=new Error("An unknown error occurred.");for(let i=0;i<n.length;i++){const s=n[i],o=s.includes("{data}")?"GET":"POST",a=o==="POST"?{data:e,sender:t}:void 0,c=o==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(s.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:c,method:o});let l;if(u.headers.get("Content-Type")?.startsWith("application/json")?l=(await u.json()).data:l=await u.text(),!u.ok){r=new wr({body:a,details:l?.error?Oe(l.error):u.statusText,headers:u.headers,status:u.status,url:s});continue}if(!Qe(l)){r=new i8({result:l,url:s});continue}return l}catch(u){r=new wr({body:a,details:u.message,url:s})}}throw r}const c8=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:ob,offchainLookup:a8,offchainLookupAbiItem:sb,offchainLookupSignature:o8},Symbol.toStringTag,{value:"Module"}));function u8(e){const{source:t}=e,n=new Map,r=new Qs(8192),i=new Map,s=({address:o,chainId:a})=>`${o}.${a}`;return{async consume({address:o,chainId:a,client:c}){const u=s({address:o,chainId:a}),l=this.get({address:o,chainId:a,client:c});this.increment({address:o,chainId:a});const d=await l;return await t.set({address:o,chainId:a},d),r.set(u,d),d},async increment({address:o,chainId:a}){const c=s({address:o,chainId:a}),u=n.get(c)??0;n.set(c,u+1)},async get({address:o,chainId:a,client:c}){const u=s({address:o,chainId:a});let l=i.get(u);return l||(l=(async()=>{try{const f=await t.get({address:o,chainId:a,client:c}),h=r.get(u)??0;return h>0&&f<=h?h+1:(r.delete(u),f)}finally{this.reset({address:o,chainId:a})}})(),i.set(u,l)),(n.get(u)??0)+await l},reset({address:o,chainId:a}){const c=s({address:o,chainId:a});n.delete(c),i.delete(c)}}}function ab(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((i,s)=>{(async()=>{let o;try{const a=new AbortController;n>0&&(o=setTimeout(()=>{r?a.abort():s(t)},n)),i(await e({signal:a?.signal||null}))}catch(a){a?.name==="AbortError"&&s(t),s(a)}finally{clearTimeout(o)}})()})}function l8(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const V0=l8();function d8(e,t={}){const{url:n,headers:r}=f8(e);return{async request(i){const{body:s,fetchFn:o=t.fetchFn??fetch,onRequest:a=t.onRequest,onResponse:c=t.onResponse,timeout:u=t.timeout??1e4}=i,l={...t.fetchOptions??{},...i.fetchOptions??{}},{headers:d,method:f,signal:h}=l;try{const g=await ab(async({signal:m})=>{const w={...l,body:Array.isArray(s)?Oe(s.map(v=>({jsonrpc:"2.0",id:v.id??V0.take(),...v}))):Oe({jsonrpc:"2.0",id:s.id??V0.take(),...s}),headers:{...r,"Content-Type":"application/json",...d},method:f||"POST",signal:h||(u>0?m:null)},S=new Request(n,w),x=await a?.(S,w)??{...w,url:n};return await o(x.url??n,x)},{errorInstance:new m0({body:s,url:n}),timeout:u,signal:!0});c&&await c(g);let y;if(g.headers.get("Content-Type")?.startsWith("application/json"))y=await g.json();else{y=await g.text();try{y=JSON.parse(y||"{}")}catch(m){if(g.ok)throw m;y={error:y}}}if(!g.ok)throw new wr({body:s,details:Oe(y.error)||g.statusText,headers:g.headers,status:g.status,url:n});return y}catch(g){throw g instanceof wr||g instanceof m0?g:new wr({body:s,cause:g,url:n})}}}}function f8(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const h8=`Ethereum Signed Message:
48
+ `;function p8(e){const t=typeof e=="string"?Ir(e):typeof e.raw=="string"?e.raw:je(e.raw),n=Ir(`${h8}${we(t)}`);return Xe([n,t])}function Ja(e,t){return pe(p8(e),t)}class m8 extends F{constructor({domain:t}){super(`Invalid domain "${Oe(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class y8 extends F{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 b8 extends F{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function g8(e){const{domain:t,message:n,primaryType:r,types:i}=e,s=(o,a)=>{for(const c of o){const{name:u,type:l}=c,d=a[u],f=l.match(Ad);if(f&&(typeof d=="number"||typeof d=="bigint")){const[y,m,w]=f;q(d,{signed:m==="int",size:Number.parseInt(w,10)/8})}if(l==="address"&&typeof d=="string"&&!et(d))throw new Tn({address:d});const h=l.match(Um);if(h){const[y,m]=h;if(m&&we(d)!==Number.parseInt(m,10))throw new Sm({expectedSize:Number.parseInt(m,10),givenSize:we(d)})}const g=i[l];g&&(v8(l),s(g,d))}};if(i.EIP712Domain&&t){if(typeof t!="object")throw new m8({domain:t});s(i.EIP712Domain,t)}if(r!=="EIP712Domain")if(i[r])s(i[r],n);else throw new y8({primaryType:r,types:i})}function w8({domain:e}){return[typeof e?.name=="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},(typeof e?.chainId=="number"||typeof e?.chainId=="bigint")&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function v8(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new b8({type:e})}function co(e){const{domain:t={},message:n,primaryType:r}=e,i={EIP712Domain:w8({domain:t}),...e.types};g8({domain:t,message:n,primaryType:r,types:i});const s=["0x1901"];return t&&s.push(x8({domain:t,types:i})),r!=="EIP712Domain"&&s.push(cb({data:n,primaryType:r,types:i})),pe(Xe(s))}function x8({domain:e,types:t}){return cb({data:e,primaryType:"EIP712Domain",types:t})}function cb({data:e,primaryType:t,types:n}){const r=ub({data:e,primaryType:t,types:n});return pe(r)}function ub({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],i=[E8({primaryType:t,types:n})];for(const s of n[t]){const[o,a]=db({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(o),i.push(a)}return mt(r,i)}function E8({primaryType:e,types:t}){const n=ht(_8({primaryType:e,types:t}));return pe(n)}function _8({primaryType:e,types:t}){let n="";const r=lb({primaryType:e,types:t});r.delete(e);const i=[e,...Array.from(r).sort()];for(const s of i)n+=`${s}(${t[s].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return n}function lb({primaryType:e,types:t},n=new Set){const i=e.match(/^\w*/u)?.[0];if(n.has(i)||t[i]===void 0)return n;n.add(i);for(const s of t[i])lb({primaryType:s.type,types:t},n);return n}function db({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},pe(ub({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},pe(r)];if(n==="string")return[{type:"bytes32"},pe(ht(r))];if(n.lastIndexOf("]")===n.length-1){const i=n.slice(0,n.lastIndexOf("[")),s=r.map(o=>db({name:t,type:i,types:e,value:o}));return[{type:"bytes32"},pe(mt(s.map(([o])=>o),s.map(([,o])=>o)))]}return[{type:n},r]}const S8="0x6492649264926492649264926492649264926492649264926492649264926492";function qc(e){const{address:t,data:n,signature:r,to:i="hex"}=e,s=Mn([mt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),S8]);return i==="hex"?s:ct(s)}function I8(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function A8(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?pt(e.nonce):void 0,storageProof:e.storageProof?I8(e.storageProof):void 0}}async function P8(e,{address:t,blockNumber:n,blockTag:r,storageKeys:i}){const s=r??"latest",o=n!==void 0?q(n):void 0,a=await e.request({method:"eth_getProof",params:[t,i,o||s]});return A8(a)}async function k8(e,{address:t,blockNumber:n,blockTag:r="latest",slot:i}){const s=n!==void 0?q(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,i,s||r]})}async function af(e,{blockHash:t,blockNumber:n,blockTag:r,hash:i,index:s,sender:o,nonce:a}){const c=r||"latest",u=n!==void 0?q(n):void 0;let l=null;if(i?l=await e.request({method:"eth_getTransactionByHash",params:[i]},{dedupe:!0}):t?l=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,q(s)]},{dedupe:!0}):(u||c)&&typeof s=="number"?l=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[u||c,q(s)]},{dedupe:!!u}):o&&typeof a=="number"&&(l=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[o,q(a)]},{dedupe:!0})),!l)throw new Jp({blockHash:t,blockNumber:n,blockTag:c,hash:i,index:s});return(e.chain?.formatters?.transaction?.format||yd)(l,"getTransaction")}async function C8(e,{hash:t,transactionReceipt:n}){const[r,i]=await Promise.all([Z(e,ao,"getBlockNumber")({}),t?Z(e,af,"getTransaction")({hash:t}):void 0]),s=n?.blockNumber||i?.blockNumber;return s?r-s+1n:0n}async function Zo(e,{hash:t}){const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Xp({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||bd)(n,"getTransactionReceipt")}async function B8(e,t){const{account:n,authorizationList:r,allowFailure:i=!0,blockNumber:s,blockOverrides:o,blockTag:a,stateOverride:c}=t,u=t.contracts,{batchSize:l=t.batchSize??1024,deployless:d=t.deployless??!1}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},f=(()=>{if(t.multicallAddress)return t.multicallAddress;if(d)return null;if(e.chain)return Di({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),h=[[]];let g=0,y=0;for(let S=0;S<u.length;S++){const{abi:x,address:E,args:v,functionName:I}=u[S];try{const A=Re({abi:x,args:v,functionName:I});y+=(A.length-2)/2,l>0&&y>l&&h[g].length>0&&(g++,y=(A.length-2)/2,h[g]=[]),h[g]=[...h[g],{allowFailure:!0,callData:A,target:E}]}catch(A){const B=wi(A,{abi:x,address:E,args:v,docsPath:"/docs/contract/multicall",functionName:I,sender:n});if(!i)throw B;h[g]=[...h[g],{allowFailure:!0,callData:"0x",target:E}]}}const m=await Promise.allSettled(h.map(S=>Z(e,yt,"readContract")({...f===null?{code:Gd}:{address:f},abi:ca,account:n,args:[S],authorizationList:r,blockNumber:s,blockOverrides:o,blockTag:a,functionName:"aggregate3",stateOverride:c}))),w=[];for(let S=0;S<m.length;S++){const x=m[S];if(x.status==="rejected"){if(!i)throw x.reason;for(let v=0;v<h[S].length;v++)w.push({status:"failure",error:x.reason,result:void 0});continue}const E=x.value;for(let v=0;v<E.length;v++){const{returnData:I,success:A}=E[v],{callData:B}=h[S][v],{abi:T,address:M,functionName:j,args:k}=u[w.length];try{if(B==="0x")throw new Js;if(!A)throw new ja({data:I});const L=zr({abi:T,args:k,data:I,functionName:j});w.push(i?{result:L,status:"success"}:L)}catch(L){const $=wi(L,{abi:T,address:M,args:k,docsPath:"/docs/contract/multicall",functionName:j});if(!i)throw $;w.push({error:$,result:void 0,status:"failure"})}}}if(w.length!==u.length)throw new F("multicall results mismatch");return w}async function Ju(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:i,returnFullTransactions:s,traceTransfers:o,validation:a}=t;try{const c=[];for(const f of i){const h=f.blockOverrides?Uy(f.blockOverrides):void 0,g=f.calls.map(m=>{const w=m,S=w.account?We(w.account):void 0,x=w.abi?Re(w):w.data,E={...w,account:S,data:w.dataSuffix?Xe([x||"0x",w.dataSuffix]):x,from:w.from??S?.address};return Hi(E),Zs(E)}),y=f.stateOverrides?Wa(f.stateOverrides):void 0;c.push({blockOverrides:h,calls:g,stateOverrides:y})}const l=(typeof n=="bigint"?q(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:s,traceTransfers:o,validation:a},l]})).map((f,h)=>({...Vp(f),calls:f.calls.map((g,y)=>{const{abi:m,args:w,functionName:S,to:x}=i[h].calls[y],E=g.error?.data??g.returnData,v=BigInt(g.gasUsed),I=g.logs?.map(M=>sn(M)),A=g.status==="0x1"?"success":"failure",B=m&&A==="success"&&E!=="0x"?zr({abi:m,data:E,functionName:S}):null,T=(()=>{if(A==="success")return;let M;if(g.error?.data==="0x"?M=new Js:g.error&&(M=new ja(g.error)),!!M)return wi(M,{abi:m??[],address:x??"0x",args:w,functionName:S??"<unknown>"})})();return{data:E,gasUsed:v,logs:I,status:A,...A==="success"?{result:B}:{error:T}}})}))}catch(c){const u=c,l=Fa(u,{});throw l instanceof Ys?u:l}}function Xu(e){let t=!0,n="",r=0,i="",s=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function","error",""].includes(i))i="";else if(i+=a,a===")"){s=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}i+=a,n+=a}}if(!s)throw new ee("Unable to normalize signature.");return i}function el(e,t){const n=typeof e,r=t.type;switch(r){case"address":return zu(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((i,s)=>el(Object.values(e)[s],i)):/^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(i=>el(i,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function fb(e,t,n){for(const r in e){const i=e[r],s=t[r];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return fb(i.components,s.components,n[r]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?zu(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?zu(n[r],{strict:!1}):!1)return o}}function hb(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?d0(e):e;return{...r,...n?{hash:ri(r)}:{}}}function Xa(e,t,n){const{args:r=[],prepare:i=!0}=n??{},s=S5(t,{strict:!1}),o=e.filter(u=>s?u.type==="function"||u.type==="error"?pb(u)===rn(t,0,4):u.type==="event"?ri(u)===t:!1:"name"in u&&u.name===t);if(o.length===0)throw new da({name:t});if(o.length===1)return{...o[0],...i?{hash:ri(o[0])}:{}};let a;for(const u of o){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...i?{hash:ri(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((d,f)=>{const h="inputs"in u&&u.inputs[f];return h?el(d,h):!1})){if(a&&"inputs"in a&&a.inputs){const d=fb(u.inputs,a.inputs,r);if(d)throw new T8({abiItem:u,type:d[0]},{abiItem:a,type:d[1]})}a=u}}const c=(()=>{if(a)return a;const[u,...l]=o;return{...u,overloads:l}})();if(!c)throw new da({name:t});return{...c,...i?{hash:ri(c)}:{}}}function pb(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Xa(n,r)}return e[0]})();return rn(ri(t),0,4)}function O8(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,i]=e;return Xa(r,i)}return e[0]})(),n=typeof t=="string"?t:ia(t);return Xu(n)}function ri(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Xa(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:sy(Ld(O8(t)))}class T8 extends ee{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Xu(ia(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Xu(ia(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 da extends ee{constructor({name:t,data:n,type:r="item"}){const i=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${i} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function $8(...e){const[t,n]=(()=>{if(Array.isArray(e[0])){const[s,o]=e;return[M8(s),o]}return e})(),{bytecode:r,args:i}=n;return zt(r,t.inputs?.length&&i?.length?Hd(t.inputs,i):"0x")}function N8(e){return hb(e)}function M8(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new da({name:"constructor"});return t}function L8(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[u,l,d]=e;return[W0(u,l,{args:d}),d]}const[a,c]=e;return[a,c]})(),{overloads:r}=t,i=r?W0([t,...r],t.name,{args:n}):t,s=R8(i),o=n.length>0?Hd(i.inputs,n):void 0;return o?zt(s,o):s}function Yr(e,t={}){return hb(e,t)}function W0(e,t,n){const r=Xa(e,t,n);if(r.type!=="function")throw new da({name:t,type:"function"});return r}function R8(e){return pb(e)}const U8="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Vt="0x0000000000000000000000000000000000000000",j8="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function F8(e,t){const{blockNumber:n,blockTag:r,calls:i,stateOverrides:s,traceAssetChanges:o,traceTransfers:a,validation:c}=t,u=t.account?We(t.account):void 0;if(o&&!u)throw new F("`account` is required when `traceAssetChanges` is true");const l=u?$8(N8("constructor(bytes, bytes)"),{bytecode:My,args:[j8,L8(Yr("function getBalance(address)"),[u.address])]}):void 0,d=o?await Promise.all(t.calls.map(async U=>{if(!U.data&&!U.abi)return;const{accessList:H}=await Wy(e,{account:u.address,...U,data:U.abi?Re(U):U.data});return H.map(({address:V,storageKeys:K})=>K.length>0?V:null)})).then(U=>U.flat().filter(Boolean)):[],f=await Ju(e,{blockNumber:n,blockTag:r,blocks:[...o?[{calls:[{data:l}],stateOverrides:s},{calls:d.map((U,H)=>({abi:[Yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:U,from:Vt,nonce:H})),stateOverrides:[{address:Vt,nonce:0}]}]:[],{calls:[...i,{}].map(U=>({...U,from:u?.address})),stateOverrides:s},...o?[{calls:[{data:l}]},{calls:d.map((U,H)=>({abi:[Yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:U,from:Vt,nonce:H})),stateOverrides:[{address:Vt,nonce:0}]},{calls:d.map((U,H)=>({to:U,abi:[Yr("function decimals() returns (uint256)")],functionName:"decimals",from:Vt,nonce:H})),stateOverrides:[{address:Vt,nonce:0}]},{calls:d.map((U,H)=>({to:U,abi:[Yr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Vt,nonce:H})),stateOverrides:[{address:Vt,nonce:0}]},{calls:d.map((U,H)=>({to:U,abi:[Yr("function symbol() returns (string)")],functionName:"symbol",from:Vt,nonce:H})),stateOverrides:[{address:Vt,nonce:0}]}]:[]],traceTransfers:a,validation:c}),h=o?f[2]:f[0],[g,y,,m,w,S,x,E]=o?f:[],{calls:v,...I}=h,A=v.slice(0,-1)??[],B=g?.calls??[],T=y?.calls??[],M=[...B,...T].map(U=>U.status==="success"?Le(U.data):null),j=m?.calls??[],k=w?.calls??[],L=[...j,...k].map(U=>U.status==="success"?Le(U.data):null),$=(S?.calls??[]).map(U=>U.status==="success"?U.result:null),C=(E?.calls??[]).map(U=>U.status==="success"?U.result:null),O=(x?.calls??[]).map(U=>U.status==="success"?U.result:null),R=[];for(const[U,H]of L.entries()){const V=M[U];if(typeof H!="bigint"||typeof V!="bigint")continue;const K=$[U-1],Q=C[U-1],te=O[U-1],Y=U===0?{address:U8,decimals:18,symbol:"ETH"}:{address:d[U-1],decimals:te||K?Number(K??1):void 0,symbol:Q??void 0};R.some(X=>X.token.address===Y.address)||R.push({token:Y,value:{pre:V,post:H,diff:H-V}})}return{assetChanges:R,block:I,results:A}}async function D8(e,t){const{abi:n,address:r,args:i,dataSuffix:s,functionName:o,...a}=t,c=a.account?We(a.account):e.account,u=Re({abi:n,args:i,functionName:o});try{const{data:l}=await Z(e,io,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...a,account:c}),d=zr({abi:n,args:i,functionName:o,data:l||"0x"}),f=n.filter(h=>"name"in h&&h.name===t.functionName);return{result:d,request:{abi:f,address:r,args:i,dataSuffix:s,functionName:o,...a,account:c}}}catch(l){throw wi(l,{abi:n,address:r,args:i,docsPath:"/docs/contract/simulateContract",functionName:o,sender:c?.address})}}async function ec(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}async function z8(e,{address:t,message:n,factory:r,factoryData:i,signature:s,...o}){const a=Ja(n);return Z(e,Ka,"verifyHash")({address:t,factory:r,factoryData:i,hash:a,signature:s,...o})}async function H8(e,t){const{address:n,factory:r,factoryData:i,signature:s,message:o,primaryType:a,types:c,domain:u,...l}=t,d=co({message:o,primaryType:a,types:c,domain:u});return Z(e,Ka,"verifyHash")({address:n,factory:r,factoryData:i,hash:d,signature:s,...l})}const Gc=new Map,K0=new Map;let q8=0;function on(e,t,n){const r=++q8,i=()=>Gc.get(e)||[],s=()=>{const l=i();Gc.set(e,l.filter(d=>d.id!==r))},o=()=>{const l=i();if(!l.some(f=>f.id===r))return;const d=K0.get(e);if(l.length===1&&d){const f=d();f instanceof Promise&&f.catch(()=>{})}s()},a=i();if(Gc.set(e,[...a,{id:r,fns:t}]),a&&a.length>0)return o;const c={};for(const l in t)c[l]=(...d)=>{const f=i();if(f.length!==0)for(const h of f)h.fns[l]?.(...d)};const u=n(c);return typeof u=="function"&&K0.set(e,u),o}function Hr(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let i=!0;const s=()=>i=!1;return(async()=>{let a;t&&(a=await e({unpoll:s}));const c=await n?.(a)??r;await la(c);const u=async()=>{i&&(await e({unpoll:s}),await la(r),u())};u()})(),s}function mb(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:i,poll:s,pollingInterval:o=e.pollingInterval}){const a=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 c;return a?(()=>{const d=Oe(["watchBlockNumber",e.uid,t,n,o]);return on(d,{onBlockNumber:r,onError:i},f=>Hr(async()=>{try{const h=await Z(e,ao,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(h===c)return;if(h-c>1&&n)for(let g=c+1n;g<h;g++)f.onBlockNumber(g,c),c=g}(c===void 0||h>c)&&(f.onBlockNumber(h,c),c=h)}catch(h){f.onError?.(h)}},{emitOnBegin:t,interval:o}))})():(()=>{const d=Oe(["watchBlockNumber",e.uid,t,n]);return on(d,{onBlockNumber:r,onError:i},f=>{let h=!0,g=()=>h=!1;return(async()=>{try{const y=(()=>{if(e.transport.type==="fallback"){const w=e.transport.transports.find(S=>S.config.type==="webSocket"||S.config.type==="ipc");return w?w.value:e.transport}return e.transport})(),{unsubscribe:m}=await y.subscribe({params:["newHeads"],onData(w){if(!h)return;const S=Le(w.result?.number);f.onBlockNumber(S,c),c=S},onError(w){f.onError?.(w)}});g=m,h||g()}catch(y){i?.(y)}})(),()=>g()})})()}async function G8(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:i,onReplaced:s,retryCount:o=6,retryDelay:a=({count:v})=>~~(1<<v)*200,timeout:c=18e4}=t,u=Oe(["waitForTransactionReceipt",e.uid,i]),l=t.pollingInterval?t.pollingInterval:e.chain?.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval;let d,f,h,g=!1,y,m;const{promise:w,resolve:S,reject:x}=Wd(),E=c?setTimeout(()=>{m?.(),y?.(),x(new Mv({hash:i}))},c):void 0;return y=on(u,{onReplaced:s,resolve:S,reject:x},async v=>{if(h=await Z(e,Zo,"getTransactionReceipt")({hash:i}).catch(()=>{}),h&&r<=1){clearTimeout(E),v.resolve(h),y?.();return}m=Z(e,mb,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(I){const A=T=>{clearTimeout(E),m?.(),T(),y?.()};let B=I;if(!g)try{if(h){if(r>1&&(!h.blockNumber||B-h.blockNumber+1n<r))return;A(()=>v.resolve(h));return}if(n&&!d&&(g=!0,await Rs(async()=>{d=await Z(e,af,"getTransaction")({hash:i}),d.blockNumber&&(B=d.blockNumber)},{delay:a,retryCount:o}),g=!1),h=await Z(e,Zo,"getTransactionReceipt")({hash:i}),r>1&&(!h.blockNumber||B-h.blockNumber+1n<r))return;A(()=>v.resolve(h))}catch(T){if(T instanceof Jp||T instanceof Xp){if(!d){g=!1;return}try{f=d,g=!0;const M=await Rs(()=>Z(e,Ut,"getBlock")({blockNumber:B,includeTransactions:!0}),{delay:a,retryCount:o,shouldRetry:({error:L})=>L instanceof Jy});g=!1;const j=M.transactions.find(({from:L,nonce:$})=>L===f.from&&$===f.nonce);if(!j||(h=await Z(e,Zo,"getTransactionReceipt")({hash:j.hash}),r>1&&(!h.blockNumber||B-h.blockNumber+1n<r)))return;let k="replaced";j.to===f.to&&j.value===f.value&&j.input===f.input?k="repriced":j.from===j.to&&j.value===0n&&(k="cancelled"),A(()=>{v.onReplaced?.({reason:k,replacedTransaction:f,transaction:j,transactionReceipt:h}),v.resolve(h)})}catch(M){A(()=>v.reject(M))}}else A(()=>v.reject(T))}}})}),w}function V8(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:i,onError:s,includeTransactions:o,poll:a,pollingInterval:c=e.pollingInterval}){const u=typeof a<"u"?a:!(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=o??!1;let d;return u?(()=>{const g=Oe(["watchBlocks",e.uid,t,n,r,l,c]);return on(g,{onBlock:i,onError:s},y=>Hr(async()=>{try{const m=await Z(e,Ut,"getBlock")({blockTag:t,includeTransactions:l});if(m.number!==null&&d?.number!=null){if(m.number===d.number)return;if(m.number-d.number>1&&n)for(let w=d?.number+1n;w<m.number;w++){const S=await Z(e,Ut,"getBlock")({blockNumber:w,includeTransactions:l});y.onBlock(S,d),d=S}}(d?.number==null||t==="pending"&&m?.number==null||m.number!==null&&m.number>d.number)&&(y.onBlock(m,d),d=m)}catch(m){y.onError?.(m)}},{emitOnBegin:r,interval:c}))})():(()=>{let g=!0,y=!0,m=()=>g=!1;return(async()=>{try{r&&Z(e,Ut,"getBlock")({blockTag:t,includeTransactions:l}).then(x=>{g&&y&&(i(x,void 0),y=!1)}).catch(s);const w=(()=>{if(e.transport.type==="fallback"){const x=e.transport.transports.find(E=>E.config.type==="webSocket"||E.config.type==="ipc");return x?x.value:e.transport}return e.transport})(),{unsubscribe:S}=await w.subscribe({params:["newHeads"],async onData(x){if(!g)return;const E=await Z(e,Ut,"getBlock")({blockNumber:x.result?.number,includeTransactions:l}).catch(()=>{});g&&(i(E,d),y=!1,d=E)},onError(x){s?.(x)}});m=S,g||m()}catch(w){s?.(w)}})(),()=>m()})()}function W8(e,t){const{abi:n,address:r,args:i,batch:s=!0,eventName:o,fromBlock:a,onError:c,onLogs:u,poll:l,pollingInterval:d=e.pollingInterval,strict:f}=t;return(typeof l<"u"?l:typeof a=="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 m=f??!1,w=Oe(["watchContractEvent",r,i,s,e.uid,o,d,m,a]);return on(w,{onLogs:u,onError:c},S=>{let x;a!==void 0&&(x=a-1n);let E,v=!1;const I=Hr(async()=>{if(!v){try{E=await Z(e,Ky,"createContractEventFilter")({abi:n,address:r,args:i,eventName:o,strict:m,fromBlock:a})}catch{}v=!0;return}try{let A;if(E)A=await Z(e,Qa,"getFilterChanges")({filter:E});else{const B=await Z(e,ao,"getBlockNumber")({});x&&x<B?A=await Z(e,rb,"getContractEvents")({abi:n,address:r,args:i,eventName:o,fromBlock:x+1n,toBlock:B,strict:m}):A=[],x=B}if(A.length===0)return;if(s)S.onLogs(A);else for(const B of A)S.onLogs([B])}catch(A){E&&A instanceof ir&&(v=!1),S.onError?.(A)}},{emitOnBegin:!0,interval:d});return async()=>{E&&await Z(e,ec,"uninstallFilter")({filter:E}),I()}})})():(()=>{const m=f??!1,w=Oe(["watchContractEvent",r,i,s,e.uid,o,d,m]);let S=!0,x=()=>S=!1;return on(w,{onLogs:u,onError:c},E=>((async()=>{try{const v=(()=>{if(e.transport.type==="fallback"){const B=e.transport.transports.find(T=>T.config.type==="webSocket"||T.config.type==="ipc");return B?B.value:e.transport}return e.transport})(),I=o?oo({abi:n,eventName:o,args:i}):[],{unsubscribe:A}=await v.subscribe({params:["logs",{address:r,topics:I}],onData(B){if(!S)return;const T=B.result;try{const{eventName:M,args:j}=ua({abi:n,data:T.data,topics:T.topics,strict:f}),k=sn(T,{args:j,eventName:M});E.onLogs([k])}catch(M){let j,k;if(M instanceof ra||M instanceof _d){if(f)return;j=M.abiItem.name,k=M.abiItem.inputs?.some($=>!("name"in $&&$.name))}const L=sn(T,{args:k?[]:{},eventName:j});E.onLogs([L])}},onError(B){E.onError?.(B)}});x=A,S||x()}catch(v){c?.(v)}})(),()=>x()))})()}function K8(e,{address:t,args:n,batch:r=!0,event:i,events:s,fromBlock:o,onError:a,onLogs:c,poll:u,pollingInterval:l=e.pollingInterval,strict:d}){const f=typeof u<"u"?u:typeof o=="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")),h=d??!1;return f?(()=>{const m=Oe(["watchEvent",t,n,r,e.uid,i,l,o]);return on(m,{onLogs:c,onError:a},w=>{let S;o!==void 0&&(S=o-1n);let x,E=!1;const v=Hr(async()=>{if(!E){try{x=await Z(e,Zy,"createEventFilter")({address:t,args:n,event:i,events:s,strict:h,fromBlock:o})}catch{}E=!0;return}try{let I;if(x)I=await Z(e,Qa,"getFilterChanges")({filter:x});else{const A=await Z(e,ao,"getBlockNumber")({});S&&S!==A?I=await Z(e,of,"getLogs")({address:t,args:n,event:i,events:s,fromBlock:S+1n,toBlock:A}):I=[],S=A}if(I.length===0)return;if(r)w.onLogs(I);else for(const A of I)w.onLogs([A])}catch(I){x&&I instanceof ir&&(E=!1),w.onError?.(I)}},{emitOnBegin:!0,interval:l});return async()=>{x&&await Z(e,ec,"uninstallFilter")({filter:x}),v()}})})():(()=>{let m=!0,w=()=>m=!1;return(async()=>{try{const S=(()=>{if(e.transport.type==="fallback"){const I=e.transport.transports.find(A=>A.config.type==="webSocket"||A.config.type==="ipc");return I?I.value:e.transport}return e.transport})(),x=s??(i?[i]:void 0);let E=[];x&&(E=[x.flatMap(A=>oo({abi:[A],eventName:A.name,args:n}))],i&&(E=E[0]));const{unsubscribe:v}=await S.subscribe({params:["logs",{address:t,topics:E}],onData(I){if(!m)return;const A=I.result;try{const{eventName:B,args:T}=ua({abi:x??[],data:A.data,topics:A.topics,strict:h}),M=sn(A,{args:T,eventName:B});c([M])}catch(B){let T,M;if(B instanceof ra||B instanceof _d){if(d)return;T=B.abiItem.name,M=B.abiItem.inputs?.some(k=>!("name"in k&&k.name))}const j=sn(A,{args:M?[]:{},eventName:T});c([j])}},onError(I){a?.(I)}});w=v,m||w()}catch(S){a?.(S)}})(),()=>w()})()}function Z8(e,{batch:t=!0,onError:n,onTransactions:r,poll:i,pollingInterval:s=e.pollingInterval}){return(typeof i<"u"?i:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=Oe(["watchPendingTransactions",e.uid,t,s]);return on(u,{onTransactions:r,onError:n},l=>{let d;const f=Hr(async()=>{try{if(!d)try{d=await Z(e,Yy,"createPendingTransactionFilter")({});return}catch(g){throw f(),g}const h=await Z(e,Qa,"getFilterChanges")({filter:d});if(h.length===0)return;if(t)l.onTransactions(h);else for(const g of h)l.onTransactions([g])}catch(h){l.onError?.(h)}},{emitOnBegin:!0,interval:s});return async()=>{d&&await Z(e,ec,"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 h=f.result;r([h])},onError(f){n?.(f)}});l=d,u||l()}catch(d){n?.(d)}})(),()=>l()})()}async function Y8(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}const Q8="0x5792579257925792579257925792579257925792579257925792579257925792",J8=q(0,{size:32});async function X8(e,t){async function n(l){if(l.endsWith(Q8.slice(2))){const f=Ft(Nu(l,-64,-32)),h=Nu(l,0,-64).slice(2).match(/.{1,64}/g),g=await Promise.all(h.map(m=>J8.slice(2)!==m?e.request({method:"eth_getTransactionReceipt",params:[`0x${m}`]},{dedupe:!0}):void 0)),y=g.some(m=>m===null)?100:g.every(m=>m?.status==="0x1")?200:g.every(m=>m?.status==="0x0")?500:600;return{atomic:!1,chainId:pt(f),receipts:g.filter(Boolean),status:y,version:"2.0.0"}}return e.request({method:"wallet_getCallsStatus",params:[l]})}const{atomic:r=!1,chainId:i,receipts:s,version:o="2.0.0",...a}=await n(t.id),[c,u]=(()=>{const l=a.status;return l>=100&&l<200?["pending",l]:l>=200&&l<300?["success",l]:l>=300&&l<700?["failure",l]:l==="CONFIRMED"?["success",200]:l==="PENDING"?["pending",100]:[void 0,l]})();return{...a,atomic:r,chainId:i?pt(i):void 0,receipts:s?.map(l=>({...l,blockNumber:Le(l.blockNumber),gasUsed:Le(l.gasUsed),status:Wp[l.status]}))??[],statusCode:u,status:c,version:o}}async function e_(e,t){const{account:n=e.account,chainId:r,nonce:i}=t;if(!n)throw new Ma({docsPath:"/docs/eip7702/prepareAuthorization"});const s=We(n),o=(()=>{if(t.executor)return t.executor==="self"?t.executor:We(t.executor)})(),a={address:t.contractAddress??t.address,chainId:r,nonce:i};return typeof a.chainId>"u"&&(a.chainId=e.chain?.id??await Z(e,Gi,"getChainId")({})),typeof a.nonce>"u"&&(a.nonce=await Z(e,nf,"getTransactionCount")({address:s.address,blockTag:"pending"}),(o==="self"||o?.address&&Fr(o.address,s.address))&&(a.nonce+=1)),a}class t_ extends F{constructor(t){super(`Call bundle failed with status: ${t.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=t}}async function yb(e,t){const{id:n,pollingInterval:r=e.pollingInterval,status:i=({statusCode:y})=>y===200||y>=300,retryCount:s=4,retryDelay:o=({count:y})=>~~(1<<y)*200,timeout:a=6e4,throwOnFailure:c=!1}=t,u=Oe(["waitForCallsStatus",e.uid,n]),{promise:l,resolve:d,reject:f}=Wd();let h;const g=on(u,{resolve:d,reject:f},y=>{const m=Hr(async()=>{const w=S=>{clearTimeout(h),m(),S(),g()};try{const S=await Rs(async()=>{const x=await Z(e,X8,"getCallsStatus")({id:n});if(c&&x.status==="failure")throw new t_(x);return x},{retryCount:s,delay:o});if(!i(S))return;w(()=>y.resolve(S))}catch(S){w(()=>y.reject(S))}},{interval:r,emitOnBegin:!0});return m});return h=a?setTimeout(()=>{g(),clearTimeout(h),f(new n_({id:n}))},a):void 0,await l}class n_ extends F{constructor({id:t}){super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}async function r_(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){const i=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,q(r)]:[t]},{retryCount:0}),o=(e.chain?.formatters?.transactionReceipt?.format||bd)(i);if(o.status==="reverted"&&n)throw new Nv({receipt:o});return o}const Yo="2.22.1",i_=()=>`@wagmi/core@${Yo}`;var bb=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},fa,gb;let tc=class tl extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return i_()}constructor(t,n={}){super(),fa.add(this),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:"WagmiCoreError"});const r=n.cause instanceof tl?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof tl&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${this.docsBaseUrl}${i}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...r?[`Details: ${r}`]:[],`Version: ${this.version}`].join(`
49
+ `),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(t){return bb(this,fa,"m",gb).call(this,this,t)}};fa=new WeakSet,gb=function e(t,n){return n?.(t)?t:t.cause?bb(this,fa,"m",e).call(this,t.cause,n):t};class vi extends tc{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class s_ extends tc{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}async function o_(e,t){let n;if(typeof t.connector=="function"?n=e._internal.connectors.setup(t.connector):n=t.connector,n.uid===e.state.current)throw new s_;try{e.setState(o=>({...o,status:"connecting"})),n.emitter.emit("message",{type:"connecting"});const{connector:r,...i}=t,s=await n.connect(i);return n.emitter.off("connect",e._internal.events.connect),n.emitter.on("change",e._internal.events.change),n.emitter.on("disconnect",e._internal.events.disconnect),await e.storage?.setItem("recentConnectorId",n.id),e.setState(o=>({...o,connections:new Map(o.connections).set(n.uid,{accounts:i.withCapabilities?s.accounts.map(a=>typeof a=="object"?a.address:a):s.accounts,chainId:s.chainId,connector:n}),current:n.uid,status:"connected"})),{accounts:i.withCapabilities?s.accounts.map(o=>typeof o=="object"?o:{address:o,capabilities:{}}):s.accounts,chainId:s.chainId}}catch(r){throw e.setState(i=>({...i,status:i.current?"connected":"disconnected"})),r}}const nl=256;let Ao=nl,Po;function wb(e=11){if(!Po||Ao+e>nl*2){Po="",Ao=0;for(let t=0;t<nl;t++)Po+=(256+Math.random()*256|0).toString(16).substring(1)}return Po.substring(Ao,Ao+++e)}function cf(e){const{batch:t,chain:n,ccipRead:r,key:i="base",name:s="Base Client",type:o="base"}=e,a=e.experimental_blockTag??(typeof n?.experimental_preconfirmationTime=="number"?"pending":void 0),c=n?.blockTime??12e3,u=Math.min(Math.max(Math.floor(c/2),500),4e3),l=e.pollingInterval??u,d=e.cacheTime??l,f=e.account?We(e.account):void 0,{config:h,request:g,value:y}=e.transport({account:f,chain:n,pollingInterval:l}),m={...h,...y},w={account:f,batch:t,cacheTime:d,ccipRead:r,chain:n,key:i,name:s,pollingInterval:l,request:g,transport:m,type:o,uid:wb(),...a?{experimental_blockTag:a}:{}};function S(x){return E=>{const v=E(x);for(const A in w)delete v[A];const I={...x,...v};return Object.assign(I,{extend:S(I)})}}return Object.assign(w,{extend:S(w)})}function a_(e){const{scheme:t,statement:n,...r}=e.match(c_)?.groups??{},{chainId:i,expirationTime:s,issuedAt:o,notBefore:a,requestId:c,...u}=e.match(u_)?.groups??{},l=e.split("Resources:")[1]?.split(`
50
+ - `).slice(1);return{...r,...u,...i?{chainId:Number(i)}:{},...s?{expirationTime:new Date(s)}:{},...o?{issuedAt:new Date(o)}:{},...a?{notBefore:new Date(a)}:{},...c?{requestId:c}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const c_=/^(?:(?<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)?/,u_=/(?: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 l_(e){const{address:t,domain:n,message:r,nonce:i,scheme:s,time:o=new Date}=e;if(n&&r.domain!==n||i&&r.nonce!==i||s&&r.scheme!==s||r.expirationTime&&o>=r.expirationTime||r.notBefore&&o<r.notBefore)return!1;try{if(!r.address||!et(r.address,{strict:!1})||t&&!Fr(r.address,t))return!1}catch{return!1}return!0}async function d_(e,t){const{address:n,domain:r,message:i,nonce:s,scheme:o,signature:a,time:c=new Date,...u}=t,l=a_(i);if(!l.address||!l_({address:n,domain:r,message:l,nonce:s,scheme:o,time:c}))return!1;const f=Ja(i);return Ka(e,{address:l.address,hash:f,signature:a,...u})}function f_(e){return{call:t=>io(e,t),createAccessList:t=>Wy(e,t),createBlockFilter:()=>k3(e),createContractEventFilter:t=>Ky(e,t),createEventFilter:t=>Zy(e,t),createPendingTransactionFilter:()=>Yy(e),estimateContractGas:t=>L3(e,t),estimateGas:t=>rf(e,t),getBalance:t=>R3(e,t),getBlobBaseFee:()=>U3(e),getBlock:t=>Ut(e,t),getBlockNumber:t=>ao(e,t),getBlockTransactionCount:t=>q3(e,t),getBytecode:t=>Ls(e,t),getChainId:()=>Gi(e),getCode:t=>Ls(e,t),getContractEvents:t=>rb(e,t),getEip712Domain:t=>K3(e,t),getEnsAddress:t=>f3(e,t),getEnsAvatar:t=>I3(e,t),getEnsName:t=>A3(e,t),getEnsResolver:t=>P3(e,t),getEnsText:t=>Vy(e,t),getFeeHistory:t=>Q3(e,t),estimateFeesPerGas:t=>eb(e,t),getFilterChanges:t=>Qa(e,t),getFilterLogs:t=>J3(e,t),getGasPrice:()=>tf(e),getLogs:t=>of(e,t),getProof:t=>P8(e,t),estimateMaxPriorityFeePerGas:t=>$3(e,t),fillTransaction:t=>tb(e,t),getStorageAt:t=>k8(e,t),getTransaction:t=>af(e,t),getTransactionConfirmations:t=>C8(e,t),getTransactionCount:t=>nf(e,t),getTransactionReceipt:t=>Zo(e,t),multicall:t=>B8(e,t),prepareTransactionRequest:t=>nb(e,t),readContract:t=>yt(e,t),sendRawTransaction:t=>Y8(e,t),sendRawTransactionSync:t=>r_(e,t),simulate:t=>Ju(e,t),simulateBlocks:t=>Ju(e,t),simulateCalls:t=>F8(e,t),simulateContract:t=>D8(e,t),verifyHash:t=>Ka(e,t),verifyMessage:t=>z8(e,t),verifySiweMessage:t=>d_(e,t),verifyTypedData:t=>H8(e,t),uninstallFilter:t=>ec(e,t),waitForTransactionReceipt:t=>G8(e,t),watchBlocks:t=>V8(e,t),watchBlockNumber:t=>mb(e,t),watchContractEvent:t=>W8(e,t),watchEvent:t=>K8(e,t),watchPendingTransactions:t=>Z8(e,t)}}function h_(e){const{key:t="public",name:n="Public Client"}=e;return cf({...e,key:t,name:n,type:"publicClient"}).extend(f_)}function vb({key:e,methods:t,name:n,request:r,retryCount:i=3,retryDelay:s=150,timeout:o,type:a},c){const u=wb();return{config:{key:e,methods:t,name:n,request:r,retryCount:i,retryDelay:s,timeout:o,type:a},request:t8(r,{methods:t,retryCount:i,retryDelay:s,uid:u}),value:c}}function fT(e,t={}){const{key:n="fallback",name:r="Fallback",rank:i=!1,shouldThrow:s=p_,retryCount:o,retryDelay:a}=t;return({chain:c,pollingInterval:u=4e3,timeout:l,...d})=>{let f=e,h=()=>{};const g=vb({key:n,name:r,async request({method:y,params:m}){let w;const S=async(x=0)=>{const E=f[x]({...d,chain:c,retryCount:0,timeout:l});try{const v=await E.request({method:y,params:m});return h({method:y,params:m,response:v,transport:E,status:"success"}),v}catch(v){if(h({error:v,method:y,params:m,transport:E,status:"error"}),s(v)||x===f.length-1||(w??=f.slice(x+1).some(I=>{const{include:A,exclude:B}=I({chain:c}).config.methods||{};return A?A.includes(y):B?!B.includes(y):!0}),!w))throw v;return S(x+1)}};return S()},retryCount:o,retryDelay:a,type:"fallback"},{onResponse:y=>h=y,transports:f.map(y=>y({chain:c,retryCount:0}))});if(i){const y=typeof i=="object"?i:{};m_({chain:c,interval:y.interval??u,onTransports:m=>f=m,ping:y.ping,sampleCount:y.sampleCount,timeout:y.timeout,transports:f,weights:y.weights})}return g}}function p_(e){return!!("code"in e&&typeof e.code=="number"&&(e.code===bi.code||e.code===he.code||hr.nodeMessage.test(e.message)||e.code===5e3))}function m_({chain:e,interval:t=4e3,onTransports:n,ping:r,sampleCount:i=10,timeout:s=1e3,transports:o,weights:a={}}){const{stability:c=.7,latency:u=.3}=a,l=[],d=async()=>{const f=await Promise.all(o.map(async y=>{const m=y({chain:e,retryCount:0,timeout:s}),w=Date.now();let S,x;try{await(r?r({transport:m}):m.request({method:"net_listening"})),x=1}catch{x=0}finally{S=Date.now()}return{latency:S-w,success:x}}));l.push(f),l.length>i&&l.shift();const h=Math.max(...l.map(y=>Math.max(...y.map(({latency:m})=>m)))),g=o.map((y,m)=>{const w=l.map(I=>I[m].latency),x=1-w.reduce((I,A)=>I+A,0)/w.length/h,E=l.map(I=>I[m].success),v=E.reduce((I,A)=>I+A,0)/E.length;return v===0?[0,m]:[u*x+c*v,m]}).sort((y,m)=>m[0]-y[0]);n(g.map(([,y])=>o[y])),await la(t),d()};d()}class y_ extends F{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 Z0(e,t={}){const{batch:n,fetchFn:r,fetchOptions:i,key:s="http",methods:o,name:a="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:u,retryDelay:l,raw:d}=t;return({chain:f,retryCount:h,timeout:g})=>{const{batchSize:y=1e3,wait:m=0}=typeof n=="object"?n:{},w=t.retryCount??h,S=g??t.timeout??1e4,x=e||f?.rpcUrls.default.http[0];if(!x)throw new y_;const E=d8(x,{fetchFn:r,fetchOptions:i,onRequest:c,onResponse:u,timeout:S});return vb({key:s,methods:o,name:a,async request({method:v,params:I}){const A={method:v,params:I},{schedule:B}=jy({id:x,wait:m,shouldSplitBatch(k){return k.length>y},fn:k=>E.request({body:k}),sort:(k,L)=>k.id-L.id}),T=async k=>n?B(k):[await E.request({body:k})],[{error:M,result:j}]=await T(A);if(d)return{error:M,result:j};if(M)throw new Td({body:A,error:M,url:x});return j},retryCount:w,retryDelay:l,timeout:S,type:"http"},{fetchOptions:i,url:x})}}function b_(e){const{r:t,s:n}=Rd.Signature.fromCompact(e.slice(2,130)),r=+`0x${e.slice(130)}`,[i,s]=(()=>{if(r===0||r===1)return[void 0,r];if(r===27)return[BigInt(r),0];if(r===28)return[BigInt(r),1];throw new Error("Invalid yParityOrV value")})();return typeof i<"u"?{r:q(t,{size:32}),s:q(n,{size:32}),v:i,yParity:s}:{r:q(t,{size:32}),s:q(n,{size:32}),yParity:s}}async function g_(e,t={}){let n;if(t.connector)n=t.connector;else{const{connections:i,current:s}=e.state;n=i.get(s)?.connector}const r=e.state.connections;n&&(await n.disconnect(),n.emitter.off("change",e._internal.events.change),n.emitter.off("disconnect",e._internal.events.disconnect),n.emitter.on("connect",e._internal.events.connect),r.delete(n.uid)),e.setState(i=>{if(r.size===0)return{...i,connections:new Map,current:null,status:"disconnected"};const s=r.values().next().value;return{...i,connections:new Map(r),current:s.connector.uid}});{const i=e.state.current;if(!i)return;const s=e.state.connections.get(i)?.connector;if(!s)return;await e.storage?.setItem("recentConnectorId",s.id)}}function xb(e){const t=e.state.current,n=e.state.connections.get(t),r=n?.accounts,i=r?.[0],s=e.chains.find(a=>a.id===n?.chainId),o=e.state.status;switch(o){case"connected":return{address:i,addresses:r,chain:s,chainId:n?.chainId,connector:n?.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:o};case"reconnecting":return{address:i,addresses:r,chain:s,chainId:n?.chainId,connector:n?.connector,isConnected:!!i,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:o};case"connecting":return{address:i,addresses:r,chain:s,chainId:n?.chainId,connector:n?.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:o};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:o}}}function Y0(e){return e.state.chainId}function xi(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;let n,r;if(Array.isArray(e)&&Array.isArray(t)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!xi(e[r],t[r]))return!1;return!0}if(typeof e.valueOf=="function"&&e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(typeof e.toString=="function"&&e.toString!==Object.prototype.toString)return e.toString()===t.toString();const i=Object.keys(e);if(n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.hasOwn(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(s&&!xi(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}let ko=[];function rl(e){const t=[...e.state.connections.values()];return e.state.status==="reconnecting"||xi(ko,t)?ko:(ko=t,t)}let Co=[];function Q0(e){const t=e.connectors;return Co.length===t.length&&Co.every((n,r)=>n===t[r])?Co:(Co=t,t)}let Vc=!1;async function w_(e,t={}){if(Vc)return[];Vc=!0,e.setState(u=>({...u,status:u.current?"reconnecting":"connecting"}));const n=[];if(t.connectors?.length)for(const u of t.connectors){let l;typeof u=="function"?l=e._internal.connectors.setup(u):l=u,n.push(l)}else n.push(...e.connectors);let r;try{r=await e.storage?.getItem("recentConnectorId")}catch{}const i={};for(const[,u]of e.state.connections)i[u.connector.id]=1;r&&(i[r]=0);const s=Object.keys(i).length>0?[...n].sort((u,l)=>(i[u.id]??10)-(i[l.id]??10)):n;let o=!1;const a=[],c=[];for(const u of s){const l=await u.getProvider().catch(()=>{});if(!l||c.some(h=>h===l)||!await u.isAuthorized())continue;const f=await u.connect({isReconnecting:!0}).catch(()=>null);f&&(u.emitter.off("connect",e._internal.events.connect),u.emitter.on("change",e._internal.events.change),u.emitter.on("disconnect",e._internal.events.disconnect),e.setState(h=>{const g=new Map(o?h.connections:new Map).set(u.uid,{accounts:f.accounts,chainId:f.chainId,connector:u});return{...h,current:o?h.current:u.uid,connections:g}}),a.push({accounts:f.accounts,chainId:f.chainId,connector:u}),c.push(l),o=!0)}return(e.state.status==="reconnecting"||e.state.status==="connecting")&&(o?e.setState(u=>({...u,status:"connected"})):e.setState(u=>({...u,connections:new Map,current:null,status:"disconnected"}))),Vc=!1,a}class Jn extends tc{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}function v_(e,t){const{onChange:n}=t;return e.subscribe(()=>xb(e),n,{equalityFn(r,i){const{connector:s,...o}=r,{connector:a,...c}=i;return xi(o,c)&&s?.id===a?.id&&s?.uid===a?.uid}})}function x_(e,t){const{onChange:n}=t;return e.subscribe(r=>r.chainId,n)}function E_(e,t){const{onChange:n}=t;return e.subscribe(()=>rl(e),n,{equalityFn:xi})}function __(e,t){const{onChange:n}=t;return e._internal.connectors.subscribe((r,i)=>{n(Object.values(r),i)})}function hT(e){return e}uf.type="injected";function uf(e={}){const{shimDisconnect:t=!0,unstable_shimAsyncInject:n}=e;function r(){const c=e.target;if(typeof c=="function"){const u=c();if(u)return u}return typeof c=="object"?c:typeof c=="string"?{...S_[c]??{id:c,name:`${c[0].toUpperCase()}${c.slice(1)}`,provider:`is${c[0].toUpperCase()}${c.slice(1)}`}}:{id:"injected",name:"Injected",provider(u){return u?.ethereum}}}let i,s,o,a;return c=>({get icon(){return r().icon},get id(){return r().id},get name(){return r().name},get supportsSimulation(){return!0},type:uf.type,async setup(){const u=await this.getProvider();u?.on&&e.target&&(o||(o=this.onConnect.bind(this),u.on("connect",o)),i||(i=this.onAccountsChanged.bind(this),u.on("accountsChanged",i)))},async connect({chainId:u,isReconnecting:l,withCapabilities:d}={}){const f=await this.getProvider();if(!f)throw new Jn;let h=[];if(l)h=await this.getAccounts().catch(()=>[]);else if(t)try{h=(await f.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0]?.caveats?.[0]?.value?.map(y=>Je(y)),h.length>0&&(h=await this.getAccounts())}catch(g){const y=g;if(y.code===he.code)throw new he(y);if(y.code===tr.code)throw y}try{!h?.length&&!l&&(h=(await f.request({method:"eth_requestAccounts"})).map(m=>Je(m))),o&&(f.removeListener("connect",o),o=void 0),i||(i=this.onAccountsChanged.bind(this),f.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),f.on("chainChanged",s)),a||(a=this.onDisconnect.bind(this),f.on("disconnect",a));let g=await this.getChainId();return u&&g!==u&&(g=(await this.switchChain({chainId:u}).catch(m=>{if(m.code===he.code)throw m;return{id:g}}))?.id??g),t&&await c.storage?.removeItem(`${this.id}.disconnected`),e.target||await c.storage?.setItem("injected.connected",!0),{accounts:d?h.map(y=>({address:y,capabilities:{}})):h,chainId:g}}catch(g){const y=g;throw y.code===he.code?new he(y):y.code===tr.code?new tr(y):y}},async disconnect(){const u=await this.getProvider();if(!u)throw new Jn;s&&(u.removeListener("chainChanged",s),s=void 0),a&&(u.removeListener("disconnect",a),a=void 0),o||(o=this.onConnect.bind(this),u.on("connect",o));try{await ab(()=>u.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}t&&await c.storage?.setItem(`${this.id}.disconnected`,!0),e.target||await c.storage?.removeItem("injected.connected")},async getAccounts(){const u=await this.getProvider();if(!u)throw new Jn;return(await u.request({method:"eth_accounts"})).map(d=>Je(d))},async getChainId(){const u=await this.getProvider();if(!u)throw new Jn;const l=await u.request({method:"eth_chainId"});return Number(l)},async getProvider(){if(typeof window>"u")return;let u;const l=r();return typeof l.provider=="function"?u=l.provider(window):typeof l.provider=="string"?u=Qo(window,l.provider):u=l.provider,u&&!u.removeListener&&("off"in u&&typeof u.off=="function"?u.removeListener=u.off:u.removeListener=()=>{}),u},async isAuthorized(){try{if(t&&await c.storage?.getItem(`${this.id}.disconnected`)||!e.target&&!await c.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(n!==void 0&&n!==!1){const f=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",f),!!await this.getProvider()),h=typeof n=="number"?n:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(y=>window.addEventListener("ethereum#initialized",()=>y(f()),{once:!0}))]:[],new Promise(y=>setTimeout(()=>y(f()),h))]))return!0}throw new Jn}return!!(await Rs(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:u,chainId:l}){const d=await this.getProvider();if(!d)throw new Jn;const f=c.chains.find(g=>g.id===l);if(!f)throw new Tt(new vi);const h=new Promise(g=>{const y=m=>{"chainId"in m&&m.chainId===l&&(c.emitter.off("change",y),g())};c.emitter.on("change",y)});try{return await Promise.all([d.request({method:"wallet_switchEthereumChain",params:[{chainId:q(l)}]}).then(async()=>{await this.getChainId()===l&&c.emitter.emit("change",{chainId:l})}),h]),f}catch(g){const y=g;if(y.code===4902||y?.data?.originalError?.code===4902)try{const{default:m,...w}=f.blockExplorers??{};let S;u?.blockExplorerUrls?S=u.blockExplorerUrls:m&&(S=[m.url,...Object.values(w).map(v=>v.url)]);let x;u?.rpcUrls?.length?x=u.rpcUrls:x=[f.rpcUrls.default?.http[0]??""];const E={blockExplorerUrls:S,chainId:q(l),chainName:u?.chainName??f.name,iconUrls:u?.iconUrls,nativeCurrency:u?.nativeCurrency??f.nativeCurrency,rpcUrls:x};return await Promise.all([d.request({method:"wallet_addEthereumChain",params:[E]}).then(async()=>{if(await this.getChainId()===l)c.emitter.emit("change",{chainId:l});else throw new he(new Error("User rejected switch after adding network."))}),h]),f}catch(m){throw new he(m)}throw y.code===he.code?new he(y):new Tt(y)}},async onAccountsChanged(u){if(u.length===0)this.onDisconnect();else if(c.emitter.listenerCount("connect")){const l=(await this.getChainId()).toString();this.onConnect({chainId:l}),t&&await c.storage?.removeItem(`${this.id}.disconnected`)}else c.emitter.emit("change",{accounts:u.map(l=>Je(l))})},onChainChanged(u){const l=Number(u);c.emitter.emit("change",{chainId:l})},async onConnect(u){const l=await this.getAccounts();if(l.length===0)return;const d=Number(u.chainId);c.emitter.emit("connect",{accounts:l,chainId:d});const f=await this.getProvider();f&&(o&&(f.removeListener("connect",o),o=void 0),i||(i=this.onAccountsChanged.bind(this),f.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),f.on("chainChanged",s)),a||(a=this.onDisconnect.bind(this),f.on("disconnect",a)))},async onDisconnect(u){const l=await this.getProvider();u&&u.code===1013&&l&&(await this.getAccounts()).length||(c.emitter.emit("disconnect"),l&&(s&&(l.removeListener("chainChanged",s),s=void 0),a&&(l.removeListener("disconnect",a),a=void 0),o||(o=this.onConnect.bind(this),l.on("connect",o))))}})}const S_={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(e){return e?.coinbaseWalletExtension?e.coinbaseWalletExtension:Qo(e,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(e){return Qo(e,t=>{if(!t.isMetaMask||t.isBraveWallet&&!t._events&&!t._state)return!1;const n=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const r of n)if(t[r])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(e){return e?.phantom?.ethereum?e.phantom?.ethereum:Qo(e,"isPhantom")}}};function Qo(e,t){function n(i){return typeof t=="function"?t(i):typeof t=="string"?i[t]:!0}const r=e.ethereum;if(r?.providers)return r.providers.find(i=>n(i));if(r&&n(r))return r}function I_(e){if(typeof window>"u")return;const t=n=>e(n.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}function A_(){const e=new Set;let t=[];const n=()=>I_(i=>{t.some(({info:s})=>s.uuid===i.info.uuid)||(t=[...t,i],e.forEach(s=>s(t,{added:[i]})))});let r=n();return{_listeners(){return e},clear(){e.forEach(i=>i([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),r?.()},findProvider({rdns:i}){return t.find(s=>s.info.rdns===i)},getProviders(){return t},reset(){this.clear(),r?.(),r=n()},subscribe(i,{emitImmediately:s}={}){return e.add(i),s&&i(t,{added:t}),()=>e.delete(i)}}}const P_=e=>(t,n,r)=>{const i=r.subscribe;return r.subscribe=(o,a,c)=>{let u=o;if(a){const l=c?.equalityFn||Object.is;let d=o(r.getState());u=f=>{const h=o(f);if(!l(d,h)){const g=d;a(d=h,g)}},c?.fireImmediately&&a(d,d)}return i(u)},e(t,n,r)},k_=P_;function C_(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,void 0),a=(s=n.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const il=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return il(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return il(r)(n)}}}},B_=(e,t)=>(n,r,i)=>{let s={storage:C_(()=>localStorage),partialize:y=>y,version:0,merge:(y,m)=>({...m,...y}),...t},o=!1;const a=new Set,c=new Set;let u=s.storage;if(!u)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...y)},r,i);const l=()=>{const y=s.partialize({...r()});return u.setItem(s.name,{state:y,version:s.version})},d=i.setState;i.setState=(y,m)=>{d(y,m),l()};const f=e((...y)=>{n(...y),l()},r,i);i.getInitialState=()=>f;let h;const g=()=>{var y,m;if(!u)return;o=!1,a.forEach(S=>{var x;return S((x=r())!=null?x:f)});const w=((m=s.onRehydrateStorage)==null?void 0:m.call(s,(y=r())!=null?y:f))||void 0;return il(u.getItem.bind(u))(s.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==s.version){if(s.migrate)return[!0,s.migrate(S.state,S.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var x;const[E,v]=S;if(h=s.merge(v,(x=r())!=null?x:f),n(h,!0),E)return l()}).then(()=>{w?.(h,void 0),h=r(),o=!0,c.forEach(S=>S(h))}).catch(S=>{w?.(void 0,S)})};return i.persist={setOptions:y=>{s={...s,...y},y.storage&&(u=y.storage)},clearStorage:()=>{u?.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>g(),hasHydrated:()=>o,onHydrate:y=>(a.add(y),()=>{a.delete(y)}),onFinishHydration:y=>(c.add(y),()=>{c.delete(y)})},s.skipHydration||g(),h||f},O_=B_,J0=e=>{let t;const n=new Set,r=(u,l)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const f=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,f))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,i,a);return a},Wc=e=>e?J0(e):J0;var Eb={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function s(c,u,l,d,f){if(typeof l!="function")throw new TypeError("The listener must be a function");var h=new i(l,d||c,f),g=n?n+u:u;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],h]:c._events[g].push(h):(c._events[g]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,d;if(this._eventsCount===0)return u;for(d in l=this._events)t.call(l,d)&&u.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=n?n+u:u,d=this._events[l];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,h=d.length,g=new Array(h);f<h;f++)g[f]=d[f].fn;return g},a.prototype.listenerCount=function(u){var l=n?n+u:u,d=this._events[l];return d?d.fn?1:d.length:0},a.prototype.emit=function(u,l,d,f,h,g){var y=n?n+u:u;if(!this._events[y])return!1;var m=this._events[y],w=arguments.length,S,x;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),w){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,l),!0;case 3:return m.fn.call(m.context,l,d),!0;case 4:return m.fn.call(m.context,l,d,f),!0;case 5:return m.fn.call(m.context,l,d,f,h),!0;case 6:return m.fn.call(m.context,l,d,f,h,g),!0}for(x=1,S=new Array(w-1);x<w;x++)S[x-1]=arguments[x];m.fn.apply(m.context,S)}else{var E=m.length,v;for(x=0;x<E;x++)switch(m[x].once&&this.removeListener(u,m[x].fn,void 0,!0),w){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,l);break;case 3:m[x].fn.call(m[x].context,l,d);break;case 4:m[x].fn.call(m[x].context,l,d,f);break;default:if(!S)for(v=1,S=new Array(w-1);v<w;v++)S[v-1]=arguments[v];m[x].fn.apply(m[x].context,S)}}return!0},a.prototype.on=function(u,l,d){return s(this,u,l,d,!1)},a.prototype.once=function(u,l,d){return s(this,u,l,d,!0)},a.prototype.removeListener=function(u,l,d,f){var h=n?n+u:u;if(!this._events[h])return this;if(!l)return o(this,h),this;var g=this._events[h];if(g.fn)g.fn===l&&(!f||g.once)&&(!d||g.context===d)&&o(this,h);else{for(var y=0,m=[],w=g.length;y<w;y++)(g[y].fn!==l||f&&!g[y].once||d&&g[y].context!==d)&&m.push(g[y]);m.length?this._events[h]=m.length===1?m[0]:m:o(this,h)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=n?n+u:u,this._events[l]&&o(this,l)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a})(Eb);var T_=Eb.exports;const ha=Fp(T_),pT=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:ha,default:ha},Symbol.toStringTag,{value:"Module"}));class $_{constructor(t){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new ha})}on(t,n){this._emitter.on(t,n)}once(t,n){this._emitter.once(t,n)}off(t,n){this._emitter.off(t,n)}emit(t,...n){const r=n[0];this._emitter.emit(t,{uid:this.uid,...r})}listenerCount(t){return this._emitter.listenerCount(t)}}function N_(e){return new $_(e)}function M_(e,t){return JSON.parse(e,(n,r)=>{let i=r;return i?.__type==="bigint"&&(i=BigInt(i.value)),i?.__type==="Map"&&(i=new Map(i.value)),t?.(n,i)??i})}function X0(e,t){return e.slice(0,t).join(".")||"."}function eh(e,t){const{length:n}=e;for(let r=0;r<n;++r)if(e[r]===t)return r+1;return 0}function L_(e,t){const n=typeof e=="function",r=typeof t=="function",i=[],s=[];return function(a,c){if(typeof c=="object")if(i.length){const u=eh(i,this);u===0?i[i.length]=this:(i.splice(u),s.splice(u)),s[s.length]=a;const l=eh(i,c);if(l!==0)return r?t.call(this,a,c,X0(s,l)):`[ref=${X0(s,l)}]`}else i[0]=c,s[0]=a;return n?e.call(this,a,c):c}}function R_(e,t,n,r){return JSON.stringify(e,L_((i,s)=>{let o=s;return typeof o=="bigint"&&(o={__type:"bigint",value:s.toString()}),o instanceof Map&&(o={__type:"Map",value:Array.from(s.entries())}),t?.(i,o)??o},r),n??void 0)}function U_(e){const{deserialize:t=M_,key:n="wagmi",serialize:r=R_,storage:i=_b}=e;function s(o){return o instanceof Promise?o.then(a=>a).catch(()=>null):o}return{...i,key:n,async getItem(o,a){const c=i.getItem(`${n}.${o}`),u=await s(c);return u?t(u)??null:a??null},async setItem(o,a){const c=`${n}.${o}`;a===null?await s(i.removeItem(c)):await s(i.setItem(c,r(a)))},async removeItem(o){await s(i.removeItem(`${n}.${o}`))}}}const _b={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function j_(){const e=typeof window<"u"&&window.localStorage?window.localStorage:_b;return{getItem(t){return e.getItem(t)},removeItem(t){e.removeItem(t)},setItem(t,n){try{e.setItem(t,n)}catch{}}}}const sl=256;let Bo=sl,Oo;function F_(e=11){if(!Oo||Bo+e>sl*2){Oo="",Bo=0;for(let t=0;t<sl;t++)Oo+=(256+Math.random()*256|0).toString(16).substring(1)}return Oo.substring(Bo,Bo+++e)}function mT(e){const{multiInjectedProviderDiscovery:t=!0,storage:n=U_({storage:j_()}),syncConnectedChain:r=!0,ssr:i=!1,...s}=e,o=typeof window<"u"&&t?A_():void 0,a=Wc(()=>s.chains),c=Wc(()=>{const v=[],I=new Set;for(const A of s.connectors??[]){const B=u(A);if(v.push(B),!i&&B.rdns){const T=typeof B.rdns=="string"?[B.rdns]:B.rdns;for(const M of T)I.add(M)}}if(!i&&o){const A=o.getProviders();for(const B of A)I.has(B.info.rdns)||v.push(u(l(B)))}return v});function u(v){const I=N_(F_()),A={...v({emitter:I,chains:a.getState(),storage:n,transports:s.transports}),emitter:I,uid:I.uid};return I.on("connect",x),A.setup?.(),A}function l(v){const{info:I}=v,A=v.provider;return uf({target:{...I,id:I.rdns,provider:A}})}const d=new Map;function f(v={}){const I=v.chainId??m.getState().chainId,A=a.getState().find(T=>T.id===I);if(v.chainId&&!A)throw new vi;{const T=d.get(m.getState().chainId);if(T&&!A)return T;if(!A)throw new vi}{const T=d.get(I);if(T)return T}let B;if(s.client)B=s.client({chain:A});else{const T=A.id,M=a.getState().map(L=>L.id),j={},k=Object.entries(s);for(const[L,$]of k)if(!(L==="chains"||L==="client"||L==="connectors"||L==="transports"))if(typeof $=="object")if(T in $)j[L]=$[T];else{if(M.some(O=>O in $))continue;j[L]=$}else j[L]=$;B=cf({...j,chain:A,batch:j.batch??{multicall:!0},transport:L=>s.transports[T]({...L,connectors:c})})}return d.set(I,B),B}function h(){return{chainId:a.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let g;const y="0.0.0-canary-";Yo.startsWith(y)?g=Number.parseInt(Yo.replace(y,""),10):g=Number.parseInt(Yo.split(".")[0]??"0",10);const m=Wc(k_(n?O_(h,{migrate(v,I){if(I===g)return v;const A=h(),B=w(v,A.chainId);return{...A,chainId:B}},name:"store",partialize(v){return{connections:{__type:"Map",value:Array.from(v.connections.entries()).map(([I,A])=>{const{id:B,name:T,type:M,uid:j}=A.connector;return[I,{...A,connector:{id:B,name:T,type:M,uid:j}}]})},chainId:v.chainId,current:v.current}},merge(v,I){typeof v=="object"&&v&&"status"in v&&delete v.status;const A=w(v,I.chainId);return{...I,...v,chainId:A}},skipHydration:i,storage:n,version:g}):h));m.setState(h());function w(v,I){return v&&typeof v=="object"&&"chainId"in v&&typeof v.chainId=="number"&&a.getState().some(A=>A.id===v.chainId)?v.chainId:I}r&&m.subscribe(({connections:v,current:I})=>I?v.get(I)?.chainId:void 0,v=>{if(a.getState().some(A=>A.id===v))return m.setState(A=>({...A,chainId:v??A.chainId}))}),o?.subscribe(v=>{const I=new Set,A=new Set;for(const T of c.getState())if(I.add(T.id),T.rdns){const M=typeof T.rdns=="string"?[T.rdns]:T.rdns;for(const j of M)A.add(j)}const B=[];for(const T of v){if(A.has(T.info.rdns))continue;const M=u(l(T));I.has(M.id)||B.push(M)}n&&!m.persist.hasHydrated()||c.setState(T=>[...T,...B],!0)});function S(v){m.setState(I=>{const A=I.connections.get(v.uid);return A?{...I,connections:new Map(I.connections).set(v.uid,{accounts:v.accounts??A.accounts,chainId:v.chainId??A.chainId,connector:A.connector})}:I})}function x(v){m.getState().status==="connecting"||m.getState().status==="reconnecting"||m.setState(I=>{const A=c.getState().find(B=>B.uid===v.uid);return A?(A.emitter.listenerCount("connect")&&A.emitter.off("connect",S),A.emitter.listenerCount("change")||A.emitter.on("change",S),A.emitter.listenerCount("disconnect")||A.emitter.on("disconnect",E),{...I,connections:new Map(I.connections).set(v.uid,{accounts:v.accounts,chainId:v.chainId,connector:A}),current:v.uid,status:"connected"}):I})}function E(v){m.setState(I=>{const A=I.connections.get(v.uid);if(A){const T=A.connector;T.emitter.listenerCount("change")&&A.connector.emitter.off("change",S),T.emitter.listenerCount("disconnect")&&A.connector.emitter.off("disconnect",E),T.emitter.listenerCount("connect")||A.connector.emitter.on("connect",x)}if(I.connections.delete(v.uid),I.connections.size===0)return{...I,connections:new Map,current:null,status:"disconnected"};const B=I.connections.values().next().value;return{...I,connections:new Map(I.connections),current:B.connector.uid}})}return{get chains(){return a.getState()},get connectors(){return c.getState()},storage:n,getClient:f,get state(){return m.getState()},setState(v){let I;typeof v=="function"?I=v(m.getState()):I=v;const A=h();typeof I!="object"&&(I=A),Object.keys(A).some(T=>!(T in I))&&(I=A),m.setState(I,!0)},subscribe(v,I,A){return m.subscribe(v,I,A?{...A,fireImmediately:A.emitImmediately}:void 0)},_internal:{mipd:o,async revalidate(){const v=m.getState(),I=v.connections;let A=v.current;for(const[,B]of I){const T=B.connector;T.isAuthorized&&await T.isAuthorized()||(I.delete(T.uid),A===T.uid&&(A=null))}m.setState(B=>({...B,connections:I,current:A}))},store:m,ssr:!!i,syncConnectedChain:r,transports:s.transports,chains:{setState(v){const I=typeof v=="function"?v(a.getState()):v;if(I.length!==0)return a.setState(I,!0)},subscribe(v){return a.subscribe(v)}},connectors:{providerDetailToConnector:l,setup:u,setState(v){return c.setState(typeof v=="function"?v(c.getState()):v,!0)},subscribe(v){return c.subscribe(v)}},events:{change:S,connect:x,disconnect:E}}}}function D_(e,t){const{initialState:n,reconnectOnMount:r}=t;return n&&!e._internal.store.persist.hasHydrated()&&e.setState({...n,chainId:e.chains.some(i=>i.id===n.chainId)?n.chainId:e.chains[0].id,connections:r?n.connections:new Map,status:r?"reconnecting":"disconnected"}),{async onMount(){e._internal.ssr&&(await e._internal.store.persist.rehydrate(),e._internal.mipd&&e._internal.connectors.setState(i=>{const s=new Set;for(const c of i??[])if(c.rdns){const u=Array.isArray(c.rdns)?c.rdns:[c.rdns];for(const l of u)s.add(l)}const o=[],a=e._internal.mipd?.getProviders()??[];for(const c of a){if(s.has(c.info.rdns))continue;const u=e._internal.connectors.providerDetailToConnector(c),l=e._internal.connectors.setup(u);o.push(l)}return[...i,...o]})),r?w_(e):e.storage&&e.setState(i=>({...i,connections:new Map}))}}}function z_(e){const{chain:t}=e,n=t.rpcUrls.default.http[0];if(!e.transports)return[n];const r=e.transports?.[t.id]?.({chain:t});return(r?.value?.transports||[r]).map(({value:s})=>s?.url||n)}function H_(e){const{children:t,config:n,initialState:r,reconnectOnMount:i=!0}=e,{onMount:s}=D_(n,{initialState:r,reconnectOnMount:i});n._internal.ssr||s();const o=Ae.useRef(!0);return Ae.useEffect(()=>{if(o.current&&n._internal.ssr)return s(),()=>{o.current=!1}},[]),t}const Sb=Ae.createContext(void 0);function yT(e){const{children:t,config:n}=e,r={value:n};return Ae.createElement(H_,e,Ae.createElement(Sb.Provider,r,t))}const q_="2.19.5",G_=()=>`wagmi@${q_}`;let V_=class extends tc{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return G_()}};class W_ extends V_{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function Vi(e={}){const t=e.config??Ae.useContext(Sb);if(!t)throw new W_;return t}var Ib={exports:{}},Ab={},Pb={exports:{}},kb={};/**
51
+ * @license React
52
+ * use-sync-external-store-shim.production.js
53
+ *
54
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
55
+ *
56
+ * This source code is licensed under the MIT license found in the
57
+ * LICENSE file in the root directory of this source tree.
58
+ */var Ei=Ae;function K_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Z_=typeof Object.is=="function"?Object.is:K_,Y_=Ei.useState,Q_=Ei.useEffect,J_=Ei.useLayoutEffect,X_=Ei.useDebugValue;function eS(e,t){var n=t(),r=Y_({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return J_(function(){i.value=n,i.getSnapshot=t,Kc(i)&&s({inst:i})},[e,n,t]),Q_(function(){return Kc(i)&&s({inst:i}),e(function(){Kc(i)&&s({inst:i})})},[e]),X_(n),n}function Kc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Z_(e,n)}catch{return!0}}function tS(e,t){return t()}var nS=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?tS:eS;kb.useSyncExternalStore=Ei.useSyncExternalStore!==void 0?Ei.useSyncExternalStore:nS;Pb.exports=kb;var rS=Pb.exports;/**
59
+ * @license React
60
+ * use-sync-external-store-shim/with-selector.production.js
61
+ *
62
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
63
+ *
64
+ * This source code is licensed under the MIT license found in the
65
+ * LICENSE file in the root directory of this source tree.
66
+ */var nc=Ae,iS=rS;function sS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var oS=typeof Object.is=="function"?Object.is:sS,aS=iS.useSyncExternalStore,cS=nc.useRef,uS=nc.useEffect,lS=nc.useMemo,dS=nc.useDebugValue;Ab.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=cS(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=lS(function(){function c(h){if(!u){if(u=!0,l=h,h=r(h),i!==void 0&&o.hasValue){var g=o.value;if(i(g,h))return d=g}return d=h}if(g=d,oS(l,h))return g;var y=r(h);return i!==void 0&&i(g,y)?(l=h,g):(l=h,d=y)}var u=!1,l,d,f=n===void 0?null:n;return[function(){return c(t())},f===null?void 0:function(){return c(f())}]},[t,n,r,i]);var a=aS(e,s[0],s[1]);return uS(function(){o.hasValue=!0,o.value=a},[a]),dS(a),a};Ib.exports=Ab;var fS=Ib.exports;const Zc=e=>typeof e=="object"&&!Array.isArray(e);function hS(e,t,n=t,r=xi){const i=Ae.useRef([]),s=fS.useSyncExternalStoreWithSelector(e,t,n,o=>o,(o,a)=>{if(Zc(o)&&Zc(a)&&i.current.length){for(const c of i.current)if(!r(o[c],a[c]))return!1;return!0}return r(o,a)});return Ae.useMemo(()=>{if(Zc(s)){const o={...s};let a={};for(const[c,u]of Object.entries(o))a={...a,[c]:{configurable:!1,enumerable:!0,get:()=>(i.current.includes(c)||i.current.push(c),u)}};return Object.defineProperties(o,a),o}return s},[s])}function gT(e={}){const t=Vi(e);return hS(n=>v_(t,{onChange:n}),()=>xb(t))}var uo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},pS={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},mS=class{#e=pS;#n=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},ol=new mS;function yS(e){setTimeout(e,0)}var rc=typeof window>"u"||"Deno"in globalThis;function Bt(){}function bS(e,t){return typeof e=="function"?e(t):e}function gS(e){return typeof e=="number"&&e>=0&&e!==1/0}function wS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function al(e,t){return typeof e=="function"?e(t):e}function vS(e,t){return typeof e=="function"?e(t):e}function th(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==lf(o,t.options))return!1}else if(!Us(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||s&&!s(t))}function nh(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(Tr(t.options.mutationKey)!==Tr(s))return!1}else if(!Us(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function lf(e,t){return(t?.queryKeyHashFn||Tr)(e)}function Tr(e){return JSON.stringify(e,(t,n)=>cl(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Us(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Us(e[n],t[n])):!1}var xS=Object.prototype.hasOwnProperty;function Cb(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=rh(e)&&rh(t);if(!r&&!(cl(e)&&cl(t)))return t;const s=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,c=r?new Array(a):{};let u=0;for(let l=0;l<a;l++){const d=r?l:o[l],f=e[d],h=t[d];if(f===h){c[d]=f,(r?l<s:xS.call(e,d))&&u++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){c[d]=h;continue}const g=Cb(f,h,n+1);c[d]=g,g===f&&u++}return s===a&&u===s?e:c}function ES(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function rh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cl(e){if(!ih(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ih(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ih(e){return Object.prototype.toString.call(e)==="[object Object]"}function _S(e){return new Promise(t=>{ol.setTimeout(t,e)})}function SS(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Cb(e,t):t}function IS(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function AS(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var df=Symbol();function Bb(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===df?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function PS(e,t){return typeof e=="function"?e(...t):!!e}function kS(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var CS=class extends uo{#e;#n;#t;constructor(){super(),this.#t=e=>{if(!rc&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#n||this.setEventListener(this.#t)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#t=e,this.#n?.(),this.#n=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Ob=new CS;function BS(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var OS=yS;function TS(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=OS;const s=a=>{t?e.push(a):i(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{s(()=>{a(...c)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Ye=TS(),$S=class extends uo{#e=!0;#n;#t;constructor(){super(),this.#t=e=>{if(!rc&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#n||this.setEventListener(this.#t)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#t=e,this.#n?.(),this.#n=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},pa=new $S;function NS(e){return Math.min(1e3*2**e,3e4)}function Tb(e){return(e??"online")==="online"?pa.isOnline():!0}var ul=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function $b(e){let t=!1,n=0,r;const i=BS(),s=()=>i.status!=="pending",o=y=>{if(!s()){const m=new ul(y);f(m),e.onCancel?.(m)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>Ob.isFocused()&&(e.networkMode==="always"||pa.isOnline())&&e.canRun(),l=()=>Tb(e.networkMode)&&e.canRun(),d=y=>{s()||(r?.(),i.resolve(y))},f=y=>{s()||(r?.(),i.reject(y))},h=()=>new Promise(y=>{r=m=>{(s()||u())&&y(m)},e.onPause?.()}).then(()=>{r=void 0,s()||e.onContinue?.()}),g=()=>{if(s())return;let y;const m=n===0?e.initialPromise:void 0;try{y=m??e.fn()}catch(w){y=Promise.reject(w)}Promise.resolve(y).then(d).catch(w=>{if(s())return;const S=e.retry??(rc?0:3),x=e.retryDelay??NS,E=typeof x=="function"?x(n,w):x,v=S===!0||typeof S=="number"&&n<S||typeof S=="function"&&S(n,w);if(t||!v){f(w);return}n++,e.onFail?.(n,w),_S(E).then(()=>u()?void 0:h()).then(()=>{t?f(w):g()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:a,continueRetry:c,canStart:l,start:()=>(l()?g():h().then(g),i)}}var Nb=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gS(this.gcTime)&&(this.#e=ol.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(rc?1/0:5*60*1e3))}clearGcTimeout(){this.#e&&(ol.clearTimeout(this.#e),this.#e=void 0)}},MS=class extends Nb{#e;#n;#t;#i;#r;#o;#a;constructor(e){super(),this.#a=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#t=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=oh(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=oh(this.options);t.data!==void 0&&(this.setState(sh(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#t.remove(this)}setData(e,t){const n=SS(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(Bt).catch(Bt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>vS(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===df||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>al(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!wS(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#a?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#t.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const a=this.observers.find(c=>c.options.queryFn);a&&this.setOptions(a.options)}const n=new AbortController,r=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},i=()=>{const a=Bb(this.options,t),u=(()=>{const l={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(l),l})();return this.#a=!1,this.options.persister?this.options.persister(a,u,this):a(u)},o=(()=>{const a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(a),a})();this.options.behavior?.onFetch(o,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#s({type:"fetch",meta:o.fetchOptions?.meta}),this.#r=$b({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:a=>{a instanceof ul&&a.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(a,c)=>{this.#s({type:"failed",failureCount:a,error:c})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const a=await this.#r.start();if(a===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(a),this.#t.config.onSuccess?.(a,this),this.#t.config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof ul){if(a.silent)return this.#r.promise;if(a.revert){if(this.state.data===void 0)throw a;return this.state.data}}throw this.#s({type:"error",error:a}),this.#t.config.onError?.(a,this),this.#t.config.onSettled?.(this.state.data,a,this),a}finally{this.scheduleGc()}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...LS(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...sh(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const i=e.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),Ye.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#t.notify({query:this,type:"updated",action:e})})}};function LS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tb(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function sh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oh(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}function ah(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let l=!1;const d=g=>{kS(g,()=>t.signal,()=>l=!0)},f=Bb(t.options,t.fetchOptions),h=async(g,y,m)=>{if(l)return Promise.reject();if(y==null&&g.pages.length)return Promise.resolve(g);const S=(()=>{const I={client:t.client,queryKey:t.queryKey,pageParam:y,direction:m?"backward":"forward",meta:t.options.meta};return d(I),I})(),x=await f(S),{maxPages:E}=t.options,v=m?AS:IS;return{pages:v(g.pages,x,E),pageParams:v(g.pageParams,y,E)}};if(i&&s.length){const g=i==="backward",y=g?RS:ch,m={pages:s,pageParams:o},w=y(r,m);a=await h(m,w,g)}else{const g=e??s.length;do{const y=c===0?o[0]??r.initialPageParam:ch(r,a);if(c>0&&y==null)break;a=await h(a,y),c++}while(c<g)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function ch(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function RS(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var US=class extends Nb{#e;#n;#t;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#t=e.mutationCache,this.#n=[],this.state=e.state||Mb(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#n.includes(e)||(this.#n.push(e),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#n=this.#n.filter(t=>t!==e),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#n.length||(this.state.status==="pending"?this.scheduleGc():this.#t.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=$b({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(s,o)=>{this.#r({type:"failed",failureCount:s,error:o})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)});const r=this.state.status==="pending",i=!this.#i.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:i}),await this.#t.config.onMutate?.(e,this,n);const o=await this.options.onMutate?.(e,n);o!==this.state.context&&this.#r({type:"pending",context:o,variables:e,isPaused:i})}const s=await this.#i.start();return await this.#t.config.onSuccess?.(s,e,this.state.context,this,n),await this.options.onSuccess?.(s,e,this.state.context,n),await this.#t.config.onSettled?.(s,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(s,null,e,this.state.context,n),this.#r({type:"success",data:s}),s}catch(s){try{await this.#t.config.onError?.(s,e,this.state.context,this,n)}catch(o){Promise.reject(o)}try{await this.options.onError?.(s,e,this.state.context,n)}catch(o){Promise.reject(o)}try{await this.#t.config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,n)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,s,e,this.state.context,n)}catch(o){Promise.reject(o)}throw this.#r({type:"error",error:s}),s}finally{this.#t.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Ye.batch(()=>{this.#n.forEach(n=>{n.onMutationUpdate(e)}),this.#t.notify({mutation:this,type:"updated",action:e})})}};function Mb(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var jS=class extends uo{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#n=new Map,this.#t=0}#e;#n;#t;build(e,t,n){const r=new US({client:e,mutationCache:this,mutationId:++this.#t,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=To(e);if(typeof t=="string"){const n=this.#n.get(t);n?n.push(e):this.#n.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=To(e);if(typeof t=="string"){const n=this.#n.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#n.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=To(e);if(typeof t=="string"){const r=this.#n.get(t)?.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=To(e);return typeof t=="string"?this.#n.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ye.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#n.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>nh(t,n))}findAll(e={}){return this.getAll().filter(t=>nh(e,t))}notify(e){Ye.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Ye.batch(()=>Promise.all(e.map(t=>t.continue().catch(Bt))))}};function To(e){return e.options.scope?.id}var FS=class extends uo{#e;#n=void 0;#t;#i;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),ES(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),n?.mutationKey&&this.options.mutationKey&&Tr(n.mutationKey)!==Tr(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#n}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,n){return this.#i=n,this.#t?.removeObserver(this),this.#t=this.#e.getMutationCache().build(this.#e,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??Mb();this.#n={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){Ye.batch(()=>{if(this.#i&&this.hasListeners()){const n=this.#n.variables,r=this.#n.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#i.onSuccess?.(t.data,n,r,i)}catch(s){Promise.reject(s)}try{this.#i.onSettled?.(t.data,null,n,r,i)}catch(s){Promise.reject(s)}}else if(t?.type==="error"){try{this.#i.onError?.(t.error,n,r,i)}catch(s){Promise.reject(s)}try{this.#i.onSettled?.(void 0,t.error,n,r,i)}catch(s){Promise.reject(s)}}}this.listeners.forEach(n=>{n(this.#n)})})}},DS=class extends uo{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,i=t.queryHash??lf(r,t);let s=this.get(i);return s||(s=new MS({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(s)),s}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ye.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>th(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>th(e,n)):t}notify(e){Ye.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ye.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ye.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vT=class{#e;#n;#t;#i;#r;#o;#a;#s;constructor(e={}){this.#e=e.queryCache||new DS,this.#n=e.mutationCache||new jS,this.#t=e.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#a=Ob.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=pa.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#a?.(),this.#a=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#n.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(al(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=this.#e.get(r.queryHash)?.state.data,o=bS(t,s);if(o!==void 0)return this.#e.build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ye.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;Ye.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return Ye.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ye.batch(()=>this.#e.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Bt).catch(Bt)}invalidateQueries(e,t={}){return Ye.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ye.batch(()=>this.#e.findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Bt)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Bt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(al(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Bt).catch(Bt)}fetchInfiniteQuery(e){return e.behavior=ah(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Bt).catch(Bt)}ensureInfiniteQueryData(e){return e.behavior=ah(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return pa.isOnline()?this.#n.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#n}getDefaultOptions(){return this.#t}setDefaultOptions(e){this.#t=e}setQueryDefaults(e,t){this.#i.set(Tr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{Us(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(Tr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Us(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#t.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=lf(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===df&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#t.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#n.clear()}};function zS(e){return{mutationFn(t){return o_(e,t)},mutationKey:["connect"]}}function HS(e){return{mutationFn(t){return g_(e,t)},mutationKey:["disconnect"]}}var Lb=Ae.createContext(void 0),qS=e=>{const t=Ae.useContext(Lb);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},xT=({client:e,children:t})=>(Ae.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),uv.jsx(Lb.Provider,{value:e,children:t}));function Rb(e,t){const n=qS(),[r]=Ae.useState(()=>new FS(n,e));Ae.useEffect(()=>{r.setOptions(e)},[r,e]);const i=Ae.useSyncExternalStore(Ae.useCallback(o=>r.subscribe(Ye.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=Ae.useCallback((o,a)=>{r.mutate(o,a).catch(Bt)},[r]);if(i.error&&PS(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function ET(e={}){const t=Vi(e);return Ae.useSyncExternalStore(n=>x_(t,{onChange:n}),()=>Y0(t),()=>Y0(t))}function GS(e={}){const t=Vi(e);return Ae.useSyncExternalStore(n=>__(t,{onChange:n}),()=>Q0(t),()=>Q0(t))}function _T(e={}){const{mutation:t}=e,n=Vi(e),r=zS(n),{mutate:i,mutateAsync:s,...o}=Rb({...t,...r});return Ae.useEffect(()=>n.subscribe(({status:a})=>a,(a,c)=>{c==="connected"&&a==="disconnected"&&o.reset()}),[n,o.reset]),{...o,connect:i,connectAsync:s,connectors:GS({config:n})}}function VS(e={}){const t=Vi(e);return Ae.useSyncExternalStore(n=>E_(t,{onChange:n}),()=>rl(t),()=>rl(t))}function ST(e={}){const{mutation:t}=e,n=Vi(e),r=HS(n),{mutate:i,mutateAsync:s,...o}=Rb({...t,...r});return{...o,connectors:VS({config:n}).map(a=>a.connector),disconnect:i,disconnectAsync:s}}ff.type="coinbaseWallet";function ff(e={}){return e.version==="3"||e.headlessMode?KS(e):WS(e)}function WS(e){let t,n,r,i;return s=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:ff.type,async connect({chainId:o,withCapabilities:a,...c}={}){try{const u=await this.getProvider(),l=(await u.request({method:"eth_requestAccounts",params:"instantOnboarding"in c&&c.instantOnboarding?[{onboarding:"instant"}]:[]})).map(f=>Je(f));n||(n=this.onAccountsChanged.bind(this),u.on("accountsChanged",n)),r||(r=this.onChainChanged.bind(this),u.on("chainChanged",r)),i||(i=this.onDisconnect.bind(this),u.on("disconnect",i));let d=await this.getChainId();return o&&d!==o&&(d=(await this.switchChain({chainId:o}).catch(h=>{if(h.code===he.code)throw h;return{id:d}}))?.id??d),{accounts:a?l.map(f=>({address:f,capabilities:{}})):l,chainId:d}}catch(u){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(u.message)?new he(u):u}},async disconnect(){const o=await this.getProvider();n&&(o.removeListener("accountsChanged",n),n=void 0),r&&(o.removeListener("chainChanged",r),r=void 0),i&&(o.removeListener("disconnect",i),i=void 0),o.disconnect(),o.close?.()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(a=>Je(a))},async getChainId(){const a=await(await this.getProvider()).request({method:"eth_chainId"});return Number(a)},async getProvider(){if(!t){const o=typeof e.preference=="string"?{options:e.preference}:{...e.preference,options:e.preference?.options??"all"},{createCoinbaseWalletSDK:a}=await Dr(async()=>{const{createCoinbaseWalletSDK:u}=await Promise.resolve().then(()=>vC);return{createCoinbaseWalletSDK:u}},void 0);t=a({...e,appChainIds:s.chains.map(u=>u.id),preference:o}).getProvider()}return t},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:o,chainId:a}){const c=s.chains.find(l=>l.id===a);if(!c)throw new Tt(new vi);const u=await this.getProvider();try{return await u.request({method:"wallet_switchEthereumChain",params:[{chainId:q(c.id)}]}),c}catch(l){if(l.code===4902)try{let d;o?.blockExplorerUrls?d=o.blockExplorerUrls:d=c.blockExplorers?.default.url?[c.blockExplorers?.default.url]:[];let f;o?.rpcUrls?.length?f=o.rpcUrls:f=[c.rpcUrls.default?.http[0]??""];const h={blockExplorerUrls:d,chainId:q(a),chainName:o?.chainName??c.name,iconUrls:o?.iconUrls,nativeCurrency:o?.nativeCurrency??c.nativeCurrency,rpcUrls:f};return await u.request({method:"wallet_addEthereumChain",params:[h]}),c}catch(d){throw new he(d)}throw new Tt(l)}},onAccountsChanged(o){o.length===0?this.onDisconnect():s.emitter.emit("change",{accounts:o.map(a=>Je(a))})},onChainChanged(o){const a=Number(o);s.emitter.emit("change",{chainId:a})},async onDisconnect(o){s.emitter.emit("disconnect");const a=await this.getProvider();n&&(a.removeListener("accountsChanged",n),n=void 0),r&&(a.removeListener("chainChanged",r),r=void 0),i&&(a.removeListener("disconnect",i),i=void 0)}})}function KS(e){let n,r,i,s,o;return a=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:ff.type,async connect({chainId:c,withCapabilities:u}={}){try{const l=await this.getProvider(),d=(await l.request({method:"eth_requestAccounts"})).map(h=>Je(h));i||(i=this.onAccountsChanged.bind(this),l.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),l.on("chainChanged",s)),o||(o=this.onDisconnect.bind(this),l.on("disconnect",o));let f=await this.getChainId();return c&&f!==c&&(f=(await this.switchChain({chainId:c}).catch(g=>{if(g.code===he.code)throw g;return{id:f}}))?.id??f),{accounts:u?d.map(h=>({address:h,capabilities:{}})):d,chainId:f}}catch(l){throw/(user closed modal|accounts received is empty|user denied account)/i.test(l.message)?new he(l):l}},async disconnect(){const c=await this.getProvider();i&&(c.removeListener("accountsChanged",i),i=void 0),s&&(c.removeListener("chainChanged",s),s=void 0),o&&(c.removeListener("disconnect",o),o=void 0),c.disconnect(),c.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(u=>Je(u))},async getChainId(){const u=await(await this.getProvider()).request({method:"eth_chainId"});return Number(u)},async getProvider(){if(!r){const c=await(async()=>{const{default:h}=await Dr(async()=>{const{default:g}=await import("./index-Ch0OF5I1.js").then(y=>y.i);return{default:g}},__vite__mapDeps([0,1,2,3,4]));return typeof h!="function"&&typeof h.default=="function"?h.default:h})();n=new c({...e,reloadOnDisconnect:!1});const u=n.walletExtension?.getChainId(),l=a.chains.find(h=>e.chainId?h.id===e.chainId:h.id===u)||a.chains[0],d=e.chainId||l?.id,f=e.jsonRpcUrl||l?.rpcUrls.default.http[0];r=n.makeWeb3Provider(f,d)}return r},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:c,chainId:u}){const l=a.chains.find(f=>f.id===u);if(!l)throw new Tt(new vi);const d=await this.getProvider();try{return await d.request({method:"wallet_switchEthereumChain",params:[{chainId:q(l.id)}]}),l}catch(f){if(f.code===4902)try{let h;c?.blockExplorerUrls?h=c.blockExplorerUrls:h=l.blockExplorers?.default.url?[l.blockExplorers?.default.url]:[];let g;c?.rpcUrls?.length?g=c.rpcUrls:g=[l.rpcUrls.default?.http[0]??""];const y={blockExplorerUrls:h,chainId:q(u),chainName:c?.chainName??l.name,iconUrls:c?.iconUrls,nativeCurrency:c?.nativeCurrency??l.nativeCurrency,rpcUrls:g};return await d.request({method:"wallet_addEthereumChain",params:[y]}),l}catch(h){throw new he(h)}throw new Tt(f)}},onAccountsChanged(c){c.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:c.map(u=>Je(u))})},onChainChanged(c){const u=Number(c);a.emitter.emit("change",{chainId:u})},async onDisconnect(c){a.emitter.emit("disconnect");const u=await this.getProvider();i&&(u.removeListener("accountsChanged",i),i=void 0),s&&(u.removeListener("chainChanged",s),s=void 0),o&&(u.removeListener("disconnect",o),o=void 0)}})}function ZS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ub={exports:{}},$e=Ub.exports={},Xt,en;function ll(){throw new Error("setTimeout has not been defined")}function dl(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Xt=setTimeout:Xt=ll}catch{Xt=ll}try{typeof clearTimeout=="function"?en=clearTimeout:en=dl}catch{en=dl}})();function jb(e){if(Xt===setTimeout)return setTimeout(e,0);if((Xt===ll||!Xt)&&setTimeout)return Xt=setTimeout,setTimeout(e,0);try{return Xt(e,0)}catch{try{return Xt.call(null,e,0)}catch{return Xt.call(this,e,0)}}}function YS(e){if(en===clearTimeout)return clearTimeout(e);if((en===dl||!en)&&clearTimeout)return en=clearTimeout,clearTimeout(e);try{return en(e)}catch{try{return en.call(null,e)}catch{return en.call(this,e)}}}var Pn=[],li=!1,yr,Jo=-1;function QS(){!li||!yr||(li=!1,yr.length?Pn=yr.concat(Pn):Jo=-1,Pn.length&&Fb())}function Fb(){if(!li){var e=jb(QS);li=!0;for(var t=Pn.length;t;){for(yr=Pn,Pn=[];++Jo<t;)yr&&yr[Jo].run();Jo=-1,t=Pn.length}yr=null,li=!1,YS(e)}}$e.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Pn.push(new Db(e,t)),Pn.length===1&&!li&&jb(Fb)};function Db(e,t){this.fun=e,this.array=t}Db.prototype.run=function(){this.fun.apply(null,this.array)};$e.title="browser";$e.browser=!0;$e.env={};$e.argv=[];$e.version="";$e.versions={};function Rn(){}$e.on=Rn;$e.addListener=Rn;$e.once=Rn;$e.off=Rn;$e.removeListener=Rn;$e.removeAllListeners=Rn;$e.emit=Rn;$e.prependListener=Rn;$e.prependOnceListener=Rn;$e.listeners=function(e){return[]};$e.binding=function(e){throw new Error("process.binding is not supported")};$e.cwd=function(){return"/"};$e.chdir=function(e){throw new Error("process.chdir is not supported")};$e.umask=function(){return 0};var JS=Ub.exports;const uh=ZS(JS);var fl={exports:{}},Yc,lh;function XS(){if(lh)return Yc;lh=1;var e=1e3,t=e*60,n=t*60,r=n*24,i=r*7,s=r*365.25;Yc=function(l,d){d=d||{};var f=typeof l;if(f==="string"&&l.length>0)return o(l);if(f==="number"&&isFinite(l))return d.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(d){var f=parseFloat(d[1]),h=(d[2]||"ms").toLowerCase();switch(h){case"years":case"year":case"yrs":case"yr":case"y":return f*s;case"weeks":case"week":case"w":return f*i;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(l){var d=Math.abs(l);return d>=r?Math.round(l/r)+"d":d>=n?Math.round(l/n)+"h":d>=t?Math.round(l/t)+"m":d>=e?Math.round(l/e)+"s":l+"ms"}function c(l){var d=Math.abs(l);return d>=r?u(l,d,r,"day"):d>=n?u(l,d,n,"hour"):d>=t?u(l,d,t,"minute"):d>=e?u(l,d,e,"second"):l+" ms"}function u(l,d,f,h){var g=d>=f*1.5;return Math.round(l/f)+" "+h+(g?"s":"")}return Yc}function eI(e){n.debug=n,n.default=n,n.coerce=c,n.disable=s,n.enable=i,n.enabled=o,n.humanize=XS(),n.destroy=u,Object.keys(e).forEach(l=>{n[l]=e[l]}),n.names=[],n.skips=[],n.formatters={};function t(l){let d=0;for(let f=0;f<l.length;f++)d=(d<<5)-d+l.charCodeAt(f),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(l){let d,f=null,h,g;function y(...m){if(!y.enabled)return;const w=y,S=Number(new Date),x=S-(d||S);w.diff=x,w.prev=d,w.curr=S,d=S,m[0]=n.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let E=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(I,A)=>{if(I==="%%")return"%";E++;const B=n.formatters[A];if(typeof B=="function"){const T=m[E];I=B.call(w,T),m.splice(E,1),E--}return I}),n.formatArgs.call(w,m),(w.log||n.log).apply(w,m)}return y.namespace=l,y.useColors=n.useColors(),y.color=n.selectColor(l),y.extend=r,y.destroy=n.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(h!==n.namespaces&&(h=n.namespaces,g=n.enabled(l)),g),set:m=>{f=m}}),typeof n.init=="function"&&n.init(y),y}function r(l,d){const f=n(this.namespace+(typeof d>"u"?":":d)+l);return f.log=this.log,f}function i(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];let d;const f=(typeof l=="string"?l:"").split(/[\s,]+/),h=f.length;for(d=0;d<h;d++)f[d]&&(l=f[d].replace(/\*/g,".*?"),l[0]==="-"?n.skips.push(new RegExp("^"+l.slice(1)+"$")):n.names.push(new RegExp("^"+l+"$")))}function s(){const l=[...n.names.map(a),...n.skips.map(a).map(d=>"-"+d)].join(",");return n.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let d,f;for(d=0,f=n.skips.length;d<f;d++)if(n.skips[d].test(l))return!1;for(d=0,f=n.names.length;d<f;d++)if(n.names[d].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var tI=eI;(function(e,t){var n={};t.formatArgs=i,t.save=s,t.load=o,t.useColors=r,t.storage=a(),t.destroy=(()=>{let u=!1;return()=>{u||(u=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function i(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;u.splice(1,0,l,"color: inherit");let d=0,f=0;u[0].replace(/%[a-zA-Z%]/g,h=>{h!=="%%"&&(d++,h==="%c"&&(f=d))}),u.splice(f,0,l)}t.log=console.debug||console.log||(()=>{});function s(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function o(){let u;try{u=t.storage.getItem("debug")}catch{}return!u&&typeof uh<"u"&&"env"in uh&&(u=n.DEBUG),u}function a(){try{return localStorage}catch{}}e.exports=tI(t);const{formatters:c}=e.exports;c.j=function(u){try{return JSON.stringify(u)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}})(fl,fl.exports);var IT=fl.exports,AT=js;js.default=js;js.stable=qb;js.stableStringify=qb;var ma="[...]",zb="[Circular]",$r=[],br=[];function Hb(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function js(e,t,n,r){typeof r>"u"&&(r=Hb()),hl(e,"",0,[],void 0,0,r);var i;try{br.length===0?i=JSON.stringify(e,t,n):i=JSON.stringify(e,Gb(t),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;$r.length!==0;){var s=$r.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function di(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);i.get!==void 0?i.configurable?(Object.defineProperty(r,n,{value:e}),$r.push([r,n,t,i])):br.push([t,n,e]):(r[n]=e,$r.push([r,n,t]))}function hl(e,t,n,r,i,s,o){s+=1;var a;if(typeof e=="object"&&e!==null){for(a=0;a<r.length;a++)if(r[a]===e){di(zb,e,t,i);return}if(typeof o.depthLimit<"u"&&s>o.depthLimit){di(ma,e,t,i);return}if(typeof o.edgesLimit<"u"&&n+1>o.edgesLimit){di(ma,e,t,i);return}if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)hl(e[a],a,a,r,e,s,o);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var u=c[a];hl(e[u],u,a,r,e,s,o)}}r.pop()}}function nI(e,t){return e<t?-1:e>t?1:0}function qb(e,t,n,r){typeof r>"u"&&(r=Hb());var i=pl(e,"",0,[],void 0,0,r)||e,s;try{br.length===0?s=JSON.stringify(i,t,n):s=JSON.stringify(i,Gb(t),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;$r.length!==0;){var o=$r.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function pl(e,t,n,r,i,s,o){s+=1;var a;if(typeof e=="object"&&e!==null){for(a=0;a<r.length;a++)if(r[a]===e){di(zb,e,t,i);return}try{if(typeof e.toJSON=="function")return}catch{return}if(typeof o.depthLimit<"u"&&s>o.depthLimit){di(ma,e,t,i);return}if(typeof o.edgesLimit<"u"&&n+1>o.edgesLimit){di(ma,e,t,i);return}if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)pl(e[a],a,a,r,e,s,o);else{var c={},u=Object.keys(e).sort(nI);for(a=0;a<u.length;a++){var l=u[a];pl(e[l],l,a,r,e,s,o),c[l]=e[l]}if(typeof i<"u")$r.push([i,t,e]),i[t]=c;else return c}r.pop()}}function Gb(e){return e=typeof e<"u"?e:function(t,n){return n},function(t,n){if(br.length>0)for(var r=0;r<br.length;r++){var i=br[r];if(i[1]===t&&i[0]===n){n=i[2],br.splice(r,1);break}}return e.call(this,t,n)}}function Vb(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,void 0),a=(s=n.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const ml=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return ml(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return ml(r)(n)}}}},rI=(e,t)=>(n,r,i)=>{let s={storage:Vb(()=>localStorage),partialize:y=>y,version:0,merge:(y,m)=>({...m,...y}),...t},o=!1;const a=new Set,c=new Set;let u=s.storage;if(!u)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...y)},r,i);const l=()=>{const y=s.partialize({...r()});return u.setItem(s.name,{state:y,version:s.version})},d=i.setState;i.setState=(y,m)=>{d(y,m),l()};const f=e((...y)=>{n(...y),l()},r,i);i.getInitialState=()=>f;let h;const g=()=>{var y,m;if(!u)return;o=!1,a.forEach(S=>{var x;return S((x=r())!=null?x:f)});const w=((m=s.onRehydrateStorage)==null?void 0:m.call(s,(y=r())!=null?y:f))||void 0;return ml(u.getItem.bind(u))(s.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==s.version){if(s.migrate){const x=s.migrate(S.state,S.version);return x instanceof Promise?x.then(E=>[!0,E]):[!0,x]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var x;const[E,v]=S;if(h=s.merge(v,(x=r())!=null?x:f),n(h,!0),E)return l()}).then(()=>{w?.(h,void 0),h=r(),o=!0,c.forEach(S=>S(h))}).catch(S=>{w?.(void 0,S)})};return i.persist={setOptions:y=>{s={...s,...y},y.storage&&(u=y.storage)},clearStorage:()=>{u?.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>g(),hasHydrated:()=>o,onHydrate:y=>(a.add(y),()=>{a.delete(y)}),onFinishHydration:y=>(c.add(y),()=>{c.delete(y)})},s.skipHydration||g(),h||f},iI=rI,dh=e=>{let t;const n=new Set,r=(u,l)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const f=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,f))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,i,a);return a},hf=e=>e?dh(e):dh;function qr(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Wb(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=qr(n);return(i,s)=>r.then(o=>s(o.transaction(t,i).objectStore(t)))}let Qc;function lo(){return Qc||(Qc=Wb("keyval-store","keyval")),Qc}function sI(e,t=lo()){return t("readonly",n=>qr(n.get(e)))}function oI(e,t,n=lo()){return n("readwrite",r=>(r.put(t,e),qr(r.transaction)))}function aI(e,t=lo()){return t("readwrite",n=>(n.delete(e),qr(n.transaction)))}function PT(e=lo()){return e("readwrite",t=>(t.clear(),qr(t.transaction)))}function cI(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},qr(e.transaction)}function kT(e=lo()){return e("readonly",t=>{if(t.getAllKeys)return qr(t.getAllKeys());const n=[];return cI(t,r=>n.push(r.key)).then(()=>n)})}Kb.type="walletConnect";function Kb(e){const t=e.isNewChainsStale??!0;let n,r;const i="eip155";let s,o,a,c,u,l;return d=>({id:"walletConnect",name:"WalletConnect",type:Kb.type,async setup(){const f=await this.getProvider().catch(()=>null);f&&(a||(a=this.onConnect.bind(this),f.on("connect",a)),u||(u=this.onSessionDelete.bind(this),f.on("session_delete",u)))},async connect({chainId:f,withCapabilities:h,...g}={}){try{const y=await this.getProvider();if(!y)throw new Jn;c||(c=this.onDisplayUri,y.on("display_uri",c));let m=f;if(!m){const E=await d.storage?.getItem("state")??{};d.chains.some(I=>I.id===E.chainId)?m=E.chainId:m=d.chains[0]?.id}if(!m)throw new Error("No chains found on connector.");const w=await this.isChainsStale();if(y.session&&w&&await y.disconnect(),!y.session||w){const E=d.chains.filter(v=>v.id!==m).map(v=>v.id);await y.connect({optionalChains:[m,...E],..."pairingTopic"in g?{pairingTopic:g.pairingTopic}:{}}),this.setRequestedChainsIds(d.chains.map(v=>v.id))}const S=(await y.enable()).map(E=>Je(E));let x=await this.getChainId();return f&&x!==f&&(x=(await this.switchChain({chainId:f}).catch(v=>{if(v.code===he.code&&v.cause?.message!=="Missing or invalid. request() method: wallet_addEthereumChain")throw v;return{id:x}}))?.id??x),c&&(y.removeListener("display_uri",c),c=void 0),a&&(y.removeListener("connect",a),a=void 0),s||(s=this.onAccountsChanged.bind(this),y.on("accountsChanged",s)),o||(o=this.onChainChanged.bind(this),y.on("chainChanged",o)),l||(l=this.onDisconnect.bind(this),y.on("disconnect",l)),u||(u=this.onSessionDelete.bind(this),y.on("session_delete",u)),{accounts:h?S.map(E=>({address:E,capabilities:{}})):S,chainId:x}}catch(y){throw/(user rejected|connection request reset)/i.test(y?.message)?new he(y):y}},async disconnect(){const f=await this.getProvider();try{await f?.disconnect()}catch(h){if(!/No matching key/i.test(h.message))throw h}finally{o&&(f?.removeListener("chainChanged",o),o=void 0),l&&(f?.removeListener("disconnect",l),l=void 0),a||(a=this.onConnect.bind(this),f?.on("connect",a)),s&&(f?.removeListener("accountsChanged",s),s=void 0),u&&(f?.removeListener("session_delete",u),u=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(h=>Je(h))},async getProvider({chainId:f}={}){async function h(){const g=d.chains.map(m=>m.id);if(!g.length)return;const{EthereumProvider:y}=await Dr(async()=>{const{EthereumProvider:m}=await import("./index.es-4KXFYWf6.js").then(w=>w.J);return{EthereumProvider:m}},__vite__mapDeps([5,4,2,1]));return await y.init({...e,disableProviderPing:!0,optionalChains:g,projectId:e.projectId,rpcMap:Object.fromEntries(d.chains.map(m=>{const[w]=z_({chain:m,transports:d.transports});return[m.id,w]})),showQrModal:e.showQrModal??!0})}return n||(r||(r=h()),n=await r,n?.events.setMaxListeners(Number.POSITIVE_INFINITY)),f&&await this.switchChain?.({chainId:f}),n},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[f,h]=await Promise.all([this.getAccounts(),this.getProvider()]);return f.length?await this.isChainsStale()&&h.session?(await h.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:f,chainId:h}){const g=await this.getProvider();if(!g)throw new Jn;const y=d.chains.find(m=>m.id===h);if(!y)throw new Tt(new vi);try{await Promise.all([new Promise(w=>{const S=({chainId:x})=>{x===h&&(d.emitter.off("change",S),w())};d.emitter.on("change",S)}),g.request({method:"wallet_switchEthereumChain",params:[{chainId:q(h)}]})]);const m=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...m,h]),y}catch(m){const w=m;if(/(user rejected)/i.test(w.message))throw new he(w);try{let S;f?.blockExplorerUrls?S=f.blockExplorerUrls:S=y.blockExplorers?.default.url?[y.blockExplorers?.default.url]:[];let x;f?.rpcUrls?.length?x=f.rpcUrls:x=[...y.rpcUrls.default.http];const E={blockExplorerUrls:S,chainId:q(h),chainName:f?.chainName??y.name,iconUrls:f?.iconUrls,nativeCurrency:f?.nativeCurrency??y.nativeCurrency,rpcUrls:x};await g.request({method:"wallet_addEthereumChain",params:[E]});const v=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...v,h]),y}catch(S){throw new he(S)}}},onAccountsChanged(f){f.length===0?this.onDisconnect():d.emitter.emit("change",{accounts:f.map(h=>Je(h))})},onChainChanged(f){const h=Number(f);d.emitter.emit("change",{chainId:h})},async onConnect(f){const h=Number(f.chainId),g=await this.getAccounts();d.emitter.emit("connect",{accounts:g,chainId:h})},async onDisconnect(f){this.setRequestedChainsIds([]),d.emitter.emit("disconnect");const h=await this.getProvider();s&&(h.removeListener("accountsChanged",s),s=void 0),o&&(h.removeListener("chainChanged",o),o=void 0),l&&(h.removeListener("disconnect",l),l=void 0),u&&(h.removeListener("session_delete",u),u=void 0),a||(a=this.onConnect.bind(this),h.on("connect",a))},onDisplayUri(f){d.emitter.emit("message",{type:"display_uri",data:f})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){return n?n.session?.namespaces[i]?.accounts?.map(h=>Number.parseInt(h.split(":")[1]||"",10))??[]:[]},async getRequestedChainsIds(){return await d.storage?.getItem(this.requestedChainsStorageKey)??[]},async isChainsStale(){if(!t)return!1;const f=d.chains.map(y=>y.id),h=this.getNamespaceChainsIds();if(h.length&&!h.some(y=>f.includes(y)))return!1;const g=await this.getRequestedChainsIds();return!f.every(y=>g.includes(y))},async setRequestedChainsIds(f){await d.storage?.setItem(this.requestedChainsStorageKey,f)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var fo,me,Zb,Yb,ar,fh,Qb,yl,pf,bl,gl,Jb,Fs={},Xb=[],uI=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ic=Array.isArray;function kn(e,t){for(var n in t)e[n]=t[n];return e}function eg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ae(e,t,n){var r,i,s,o={};for(s in t)s=="key"?r=t[s]:s=="ref"?i=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?fo.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)o[s]===void 0&&(o[s]=e.defaultProps[s]);return as(e,o,r,i,null)}function as(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++Zb,__i:-1,__u:0};return i==null&&me.vnode!=null&&me.vnode(s),s}function lI(){return{current:null}}function ho(e){return e.children}function cs(e,t){this.props=e,this.context=t}function _i(e,t){if(t==null)return e.__?_i(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?_i(e):null}function tg(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return tg(e)}}function wl(e){(!e.__d&&(e.__d=!0)&&ar.push(e)&&!ya.__r++||fh!==me.debounceRendering)&&((fh=me.debounceRendering)||Qb)(ya)}function ya(){var e,t,n,r,i,s,o,a;for(ar.sort(yl);e=ar.shift();)e.__d&&(t=ar.length,r=void 0,s=(i=(n=e).__v).__e,o=[],a=[],n.__P&&((r=kn({},i)).__v=i.__v+1,me.vnode&&me.vnode(r),mf(n.__P,r,i,n.__n,n.__P.namespaceURI,32&i.__u?[s]:null,o,s??_i(i),!!(32&i.__u),a),r.__v=i.__v,r.__.__k[r.__i]=r,sg(o,r,a),r.__e!=s&&tg(r)),ar.length>t&&ar.sort(yl));ya.__r=0}function ng(e,t,n,r,i,s,o,a,c,u,l){var d,f,h,g,y,m=r&&r.__k||Xb,w=t.length;for(n.__d=c,dI(n,t,m),c=n.__d,d=0;d<w;d++)(h=n.__k[d])!=null&&(f=h.__i===-1?Fs:m[h.__i]||Fs,h.__i=d,mf(e,h,f,i,s,o,a,c,u,l),g=h.__e,h.ref&&f.ref!=h.ref&&(f.ref&&yf(f.ref,null,h),l.push(h.ref,h.__c||g,h)),y==null&&g!=null&&(y=g),65536&h.__u||f.__k===h.__k?c=rg(h,c,e):typeof h.type=="function"&&h.__d!==void 0?c=h.__d:g&&(c=g.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=c,n.__e=y}function dI(e,t,n){var r,i,s,o,a,c=t.length,u=n.length,l=u,d=0;for(e.__k=[],r=0;r<c;r++)(i=t[r])!=null&&typeof i!="boolean"&&typeof i!="function"?(o=r+d,(i=e.__k[r]=typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?as(null,i,null,null,null):ic(i)?as(ho,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?as(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=e,i.__b=e.__b+1,s=null,(a=i.__i=fI(i,n,o,l))!==-1&&(l--,(s=n[a])&&(s.__u|=131072)),s==null||s.__v===null?(a==-1&&d--,typeof i.type!="function"&&(i.__u|=65536)):a!==o&&(a==o-1?d--:a==o+1?d++:(a>o?d--:d++,i.__u|=65536))):i=e.__k[r]=null;if(l)for(r=0;r<u;r++)(s=n[r])!=null&&!(131072&s.__u)&&(s.__e==e.__d&&(e.__d=_i(s)),og(s,s))}function rg(e,t,n){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=rg(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!n.contains(t)&&(t=_i(e)),n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function ig(e,t){return t=t||[],e==null||typeof e=="boolean"||(ic(e)?e.some(function(n){ig(n,t)}):t.push(e)),t}function fI(e,t,n,r){var i=e.key,s=e.type,o=n-1,a=n+1,c=t[n];if(c===null||c&&i==c.key&&s===c.type&&!(131072&c.__u))return n;if(r>(c!=null&&!(131072&c.__u)?1:0))for(;o>=0||a<t.length;){if(o>=0){if((c=t[o])&&!(131072&c.__u)&&i==c.key&&s===c.type)return o;o--}if(a<t.length){if((c=t[a])&&!(131072&c.__u)&&i==c.key&&s===c.type)return a;a++}}return-1}function hh(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||uI.test(t)?n:n+"px"}function $o(e,t,n,r,i){var s;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||hh(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||hh(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")s=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n.u=r.u:(n.u=pf,e.addEventListener(t,s?gl:bl,s)):e.removeEventListener(t,s?gl:bl,s);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ph(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=pf++;else if(t.t<n.u)return;return n(me.event?me.event(t):t)}}}function mf(e,t,n,r,i,s,o,a,c,u){var l,d,f,h,g,y,m,w,S,x,E,v,I,A,B,T,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),s=[a=t.__e=n.__e]),(l=me.__b)&&l(t);e:if(typeof M=="function")try{if(w=t.props,S="prototype"in M&&M.prototype.render,x=(l=M.contextType)&&r[l.__c],E=l?x?x.props.value:l.__:r,n.__c?m=(d=t.__c=n.__c).__=d.__E:(S?t.__c=d=new M(w,E):(t.__c=d=new cs(w,E),d.constructor=M,d.render=pI),x&&x.sub(d),d.props=w,d.state||(d.state={}),d.context=E,d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),S&&d.__s==null&&(d.__s=d.state),S&&M.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=kn({},d.__s)),kn(d.__s,M.getDerivedStateFromProps(w,d.__s))),h=d.props,g=d.state,d.__v=t,f)S&&M.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),S&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(S&&M.getDerivedStateFromProps==null&&w!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(w,E),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(w,d.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=w,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(j){j&&(j.__=t)}),v=0;v<d._sb.length;v++)d.__h.push(d._sb[v]);d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(w,d.__s,E),S&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,g,y)})}if(d.context=E,d.props=w,d.__P=e,d.__e=!1,I=me.__r,A=0,S){for(d.state=d.__s,d.__d=!1,I&&I(t),l=d.render(d.props,d.state,d.context),B=0;B<d._sb.length;B++)d.__h.push(d._sb[B]);d._sb=[]}else do d.__d=!1,I&&I(t),l=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++A<25);d.state=d.__s,d.getChildContext!=null&&(r=kn(kn({},r),d.getChildContext())),S&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(h,g)),ng(e,ic(T=l!=null&&l.type===ho&&l.key==null?l.props.children:l)?T:[T],t,n,r,i,s,o,a,c,u),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),m&&(d.__E=d.__=null)}catch(j){if(t.__v=null,c||s!=null){for(t.__u|=c?160:32;a&&a.nodeType===8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,t.__e=a}else t.__e=n.__e,t.__k=n.__k;me.__e(j,t,n)}else s==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=hI(n.__e,t,n,r,i,s,o,c,u);(l=me.diffed)&&l(t)}function sg(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)yf(n[r],n[++r],n[++r]);me.__c&&me.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){me.__e(s,i.__v)}})}function hI(e,t,n,r,i,s,o,a,c){var u,l,d,f,h,g,y,m=n.props,w=t.props,S=t.type;if(S==="svg"?i="http://www.w3.org/2000/svg":S==="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(u=0;u<s.length;u++)if((h=s[u])&&"setAttribute"in h==!!S&&(S?h.localName===S:h.nodeType===3)){e=h,s[u]=null;break}}if(e==null){if(S===null)return document.createTextNode(w);e=document.createElementNS(i,S,w.is&&w),a&&(me.__m&&me.__m(t,s),a=!1),s=null}if(S===null)m===w||a&&e.data===w||(e.data=w);else{if(s=s&&fo.call(e.childNodes),m=n.props||Fs,!a&&s!=null)for(m={},u=0;u<e.attributes.length;u++)m[(h=e.attributes[u]).name]=h.value;for(u in m)if(h=m[u],u!="children"){if(u=="dangerouslySetInnerHTML")d=h;else if(!(u in w)){if(u=="value"&&"defaultValue"in w||u=="checked"&&"defaultChecked"in w)continue;$o(e,u,null,h,i)}}for(u in w)h=w[u],u=="children"?f=h:u=="dangerouslySetInnerHTML"?l=h:u=="value"?g=h:u=="checked"?y=h:a&&typeof h!="function"||m[u]===h||$o(e,u,h,m[u],i);if(l)a||d&&(l.__html===d.__html||l.__html===e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(d&&(e.innerHTML=""),ng(e,ic(f)?f:[f],t,n,r,S==="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:n.__k&&_i(n,0),a,c),s!=null)for(u=s.length;u--;)eg(s[u]);a||(u="value",S==="progress"&&g==null?e.removeAttribute("value"):g!==void 0&&(g!==e[u]||S==="progress"&&!g||S==="option"&&g!==m[u])&&$o(e,u,g,m[u],i),u="checked",y!==void 0&&y!==e[u]&&$o(e,u,y,m[u],i))}return e}function yf(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){me.__e(i,n)}}function og(e,t,n){var r,i;if(me.unmount&&me.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||yf(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){me.__e(s,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&og(r[i],t,n||typeof e.type!="function");n||eg(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function pI(e,t,n){return this.constructor(e,n)}function Ds(e,t,n){var r,i,s,o;me.__&&me.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,s=[],o=[],mf(t,e=(!r&&n||t).__k=ae(ho,null,[e]),i||Fs,Fs,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?fo.call(t.childNodes):null,s,!r&&n?n:i?i.__e:t.firstChild,r,o),sg(s,e,o)}function ag(e,t){Ds(e,t,ag)}function mI(e,t,n){var r,i,s,o,a=kn({},e.props);for(s in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)s=="key"?r=t[s]:s=="ref"?i=t[s]:a[s]=t[s]===void 0&&o!==void 0?o[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?fo.call(arguments,2):n),as(e.type,a,r||e.key,i||e.ref,null)}function yI(e,t){var n={__c:t="__cC"+Jb++,__:e,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,s;return this.getChildContext||(i=[],(s={})[t]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(o){this.props.value!==o.value&&i.some(function(a){a.__e=!0,wl(a)})},this.sub=function(o){i.push(o);var a=o.componentWillUnmount;o.componentWillUnmount=function(){i&&i.splice(i.indexOf(o),1),a&&a.call(o)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}fo=Xb.slice,me={__e:function(e,t,n,r){for(var i,s,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(a){e=a}throw e}},Zb=0,Yb=function(e){return e!=null&&e.constructor==null},cs.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=kn({},this.state),typeof e=="function"&&(e=e(kn({},n),this.props)),e&&kn(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),wl(this))},cs.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),wl(this))},cs.prototype.render=ho,ar=[],Qb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,yl=function(e,t){return e.__v.__b-t.__v.__b},ya.__r=0,pf=0,bl=ph(!1),gl=ph(!0),Jb=0;const CT=Object.freeze(Object.defineProperty({__proto__:null,Component:cs,Fragment:ho,cloneElement:mI,createContext:yI,createElement:ae,createRef:lI,h:ae,hydrate:ag,get isValidElement(){return Yb},get options(){return me},render:Ds,toChildArray:ig},Symbol.toStringTag,{value:"Module"}));var Nn,de,Jc,mh,Si=0,cg=[],ve=me,yh=ve.__b,bh=ve.__r,gh=ve.diffed,wh=ve.__c,vh=ve.unmount,xh=ve.__;function Gr(e,t){ve.__h&&ve.__h(de,e,Si||t),Si=0;var n=de.__H||(de.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ba(e){return Si=1,ug(fg,e)}function ug(e,t,n){var r=Gr(Nn++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):fg(void 0,t),function(a){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,a);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=de,!de.u)){var i=function(a,c,u){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(f){return!!f.__c});if(l.every(function(f){return!f.__N}))return!s||s.call(this,a,c,u);var d=!1;return l.forEach(function(f){if(f.__N){var h=f.__[0];f.__=f.__N,f.__N=void 0,h!==f.__[0]&&(d=!0)}}),!(!d&&r.__c.props===a)&&(!s||s.call(this,a,c,u))};de.u=!0;var s=de.shouldComponentUpdate,o=de.componentWillUpdate;de.componentWillUpdate=function(a,c,u){if(this.__e){var l=s;s=void 0,i(a,c,u),s=l}o&&o.call(this,a,c,u)},de.shouldComponentUpdate=i}return r.__N||r.__}function lg(e,t){var n=Gr(Nn++,3);!ve.__s&&gf(n.__H,t)&&(n.__=e,n.i=t,de.__H.__h.push(n))}function dg(e,t){var n=Gr(Nn++,4);!ve.__s&&gf(n.__H,t)&&(n.__=e,n.i=t,de.__h.push(n))}function bI(e){return Si=5,bf(function(){return{current:e}},[])}function gI(e,t,n){Si=6,dg(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function bf(e,t){var n=Gr(Nn++,7);return gf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function wI(e,t){return Si=8,bf(function(){return e},t)}function vI(e){var t=de.context[e.__c],n=Gr(Nn++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(de)),t.props.value):e.__}function xI(e,t){ve.useDebugValue&&ve.useDebugValue(t?t(e):e)}function EI(e){var t=Gr(Nn++,10),n=ba();return t.__=e,de.componentDidCatch||(de.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function _I(){var e=Gr(Nn++,11);if(!e.__){for(var t=de.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function SI(){for(var e;e=cg.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Xo),e.__H.__h.forEach(vl),e.__H.__h=[]}catch(t){e.__H.__h=[],ve.__e(t,e.__v)}}ve.__b=function(e){de=null,yh&&yh(e)},ve.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),xh&&xh(e,t)},ve.__r=function(e){bh&&bh(e),Nn=0;var t=(de=e.__c).__H;t&&(Jc===de?(t.__h=[],de.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(Xo),t.__h.forEach(vl),t.__h=[],Nn=0)),Jc=de},ve.diffed=function(e){gh&&gh(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(cg.push(t)!==1&&mh===ve.requestAnimationFrame||((mh=ve.requestAnimationFrame)||II)(SI)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),Jc=de=null},ve.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Xo),n.__h=n.__h.filter(function(r){return!r.__||vl(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],ve.__e(r,n.__v)}}),wh&&wh(e,t)},ve.unmount=function(e){vh&&vh(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Xo(r)}catch(i){t=i}}),n.__H=void 0,t&&ve.__e(t,n.__v))};var Eh=typeof requestAnimationFrame=="function";function II(e){var t,n=function(){clearTimeout(r),Eh&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Eh&&(t=requestAnimationFrame(n))}function Xo(e){var t=de,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),de=t}function vl(e){var t=de;e.__c=e.__(),de=t}function gf(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function fg(e,t){return typeof t=="function"?t(e):t}const BT=Object.freeze(Object.defineProperty({__proto__:null,useCallback:wI,useContext:vI,useDebugValue:xI,useEffect:lg,useErrorBoundary:EI,useId:_I,useImperativeHandle:gI,useLayoutEffect:dg,useMemo:bf,useReducer:ug,useRef:bI,useState:ba},Symbol.toStringTag,{value:"Module"})),AI=[{inputs:[{name:"preOpGas",type:"uint256"},{name:"paid",type:"uint256"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"targetSuccess",type:"bool"},{name:"targetResult",type:"bytes"}],name:"ExecutionResult",type:"error"},{inputs:[{name:"opIndex",type:"uint256"},{name:"reason",type:"string"}],name:"FailedOp",type:"error"},{inputs:[{name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{name:"aggregator",type:"address"}],name:"SignatureValidationFailed",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"}],name:"ValidationResult",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"},{components:[{name:"aggregator",type:"address"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"stakeInfo",type:"tuple"}],name:"aggregatorInfo",type:"tuple"}],name:"ValidationResultWithAggregation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"factory",type:"address"},{indexed:!1,name:"paymaster",type:"address"}],name:"AccountDeployed",type:"event"},{anonymous:!1,inputs:[],name:"BeforeExecution",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalDeposit",type:"uint256"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"aggregator",type:"address"}],name:"SignatureAggregatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalStaked",type:"uint256"},{indexed:!1,name:"unstakeDelaySec",type:"uint256"}],name:"StakeLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawTime",type:"uint256"}],name:"StakeUnlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"StakeWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"paymaster",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"success",type:"bool"},{indexed:!1,name:"actualGasCost",type:"uint256"},{indexed:!1,name:"actualGasUsed",type:"uint256"}],name:"UserOperationEvent",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"revertReason",type:"bytes"}],name:"UserOperationRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"Withdrawn",type:"event"},{inputs:[],name:"SIG_VALIDATION_FAILED",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"},{name:"sender",type:"address"},{name:"paymasterAndData",type:"bytes"}],name:"_validateSenderAndPaymaster",outputs:[],stateMutability:"view",type:"function"},{inputs:[{name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"",type:"address"}],name:"deposits",outputs:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"getDepositInfo",outputs:[{components:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],name:"info",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{name:"sender",type:"address"},{name:"key",type:"uint192"}],name:"getNonce",outputs:[{name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOps",type:"tuple[]"},{name:"aggregator",type:"address"},{name:"signature",type:"bytes"}],name:"opsPerAggregator",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleAggregatedOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"ops",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"key",type:"uint192"}],name:"incrementNonce",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"callData",type:"bytes"},{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"paymaster",type:"address"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"}],name:"mUserOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"prefund",type:"uint256"},{name:"contextOffset",type:"uint256"},{name:"preOpGas",type:"uint256"}],name:"opInfo",type:"tuple"},{name:"context",type:"bytes"}],name:"innerHandleOp",outputs:[{name:"actualGasCost",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"",type:"address"},{name:"",type:"uint192"}],name:"nonceSequenceNumber",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"op",type:"tuple"},{name:"target",type:"address"},{name:"targetCallData",type:"bytes"}],name:"simulateHandleOp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"simulateValidation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"},{name:"withdrawAmount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],PI="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";function hg(e,t={}){const{forHash:n}=t,{authorization:r,factory:i,factoryData:s}=e;return n&&(i==="0x7702"||i==="0x7702000000000000000000000000000000000000")?r?Xe([r.address,s??"0x"]):"0x7702000000000000000000000000000000000000":i?Xe([i,s??"0x"]):"0x"}const _h="0x22e325a297439656";function pg(e,t={}){const{callGasLimit:n,callData:r,maxPriorityFeePerGas:i,maxFeePerGas:s,paymaster:o,paymasterData:a,paymasterPostOpGasLimit:c,paymasterSignature:u,paymasterVerificationGasLimit:l,sender:d,signature:f="0x",verificationGasLimit:h}=e,g=Xe([Me(q(h||0n),{size:16}),Me(q(n||0n),{size:16})]),y=hg(e,t),m=Xe([Me(q(i||0n),{size:16}),Me(q(s||0n),{size:16})]),w=e.nonce??0n,S=o?Xe([o,Me(q(l||0n),{size:16}),Me(q(c||0n),{size:16}),a||"0x",...u?t.forHash?[_h]:[u,Me(q(we(u)),{size:2}),_h]:[]]):"0x",x=e.preVerificationGas??0n;return{accountGasLimits:g,callData:r,initCode:y,gasFees:m,nonce:w,paymasterAndData:S,preVerificationGas:x,sender:d,signature:f}}const kI={PackedUserOperation:[{type:"address",name:"sender"},{type:"uint256",name:"nonce"},{type:"bytes",name:"initCode"},{type:"bytes",name:"callData"},{type:"bytes32",name:"accountGasLimits"},{type:"uint256",name:"preVerificationGas"},{type:"bytes32",name:"gasFees"},{type:"bytes",name:"paymasterAndData"}]};function CI(e){const{chainId:t,entryPointAddress:n,userOperation:r}=e,i=pg(r,{forHash:!0});return{types:kI,primaryType:"PackedUserOperation",domain:{name:"ERC4337",version:"1",chainId:t,verifyingContract:n},message:i}}function BI(e){const{chainId:t,entryPointAddress:n,entryPointVersion:r}=e,i=e.userOperation,{authorization:s,callData:o="0x",callGasLimit:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,paymasterAndData:d="0x",preVerificationGas:f,sender:h,verificationGasLimit:g}=i;if(r==="0.8"||r==="0.9")return co(CI({chainId:t,entryPointAddress:n,userOperation:i}));const y=(()=>{if(r==="0.6"){const m=i.initCode?.slice(0,42),w=i.initCode?.slice(42),S=hg({authorization:s,factory:m,factoryData:w},{forHash:!0});return mt([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[h,l,pe(S),pe(o),a,g,f,c,u,pe(d)])}if(r==="0.7"){const m=pg(i,{forHash:!0});return mt([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"}],[m.sender,m.nonce,pe(m.initCode),pe(m.callData),m.accountGasLimits,m.preVerificationGas,m.gasFees,pe(m.paymasterAndData)])}throw new Error(`entryPointVersion "${r}" not supported.`)})();return pe(mt([{type:"bytes32"},{type:"address"},{type:"uint256"}],[pe(y),n,BigInt(t)]))}async function OI(e){const{extend:t,nonceKeyManager:n=u8({source:{get(){return Date.now()},set(){}}}),...r}=e;let i=!1;const s=await e.getAddress();return{...t,...r,address:s,async getFactoryArgs(){return"isDeployed"in this&&await this.isDeployed()?{factory:void 0,factoryData:void 0}:e.getFactoryArgs()},async getNonce(o){const a=o?.key??BigInt(await n.consume({address:s,chainId:e.client.chain.id,client:e.client}));return e.getNonce?await e.getNonce({...o,key:a}):await yt(e.client,{abi:Id(["function getNonce(address, uint192) pure returns (uint256)"]),address:e.entryPoint.address,functionName:"getNonce",args:[s,a]})},async isDeployed(){return i?!0:(i=!!await Z(e.client,Ls,"getCode")({address:s}),i)},...e.sign?{async sign(o){const[{factory:a,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.sign(o)]);return a&&c?qc({address:a,data:c,signature:u}):u}}:{},async signMessage(o){const[{factory:a,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signMessage(o)]);return a&&c&&a!=="0x7702"?qc({address:a,data:c,signature:u}):u},async signTypedData(o){const[{factory:a,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signTypedData(o)]);return a&&c&&a!=="0x7702"?qc({address:a,data:c,signature:u}):u},type:"smart"}}class xl extends F{constructor({cause:t}){super("Smart Account is not deployed.",{cause:t,metaMessages:["This could arise when:","- No `factory`/`factoryData` or `initCode` properties are provided for Smart Account deployment.","- An incorrect `sender` address is provided."],name:"AccountNotDeployedError"})}}Object.defineProperty(xl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa20/});class Ii extends F{constructor({cause:t,data:n,message:r}={}){const i=r?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${i?`with reason: ${i}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n}}Object.defineProperty(Ii,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32521});Object.defineProperty(Ii,"message",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class El extends F{constructor({cause:t}){super("Failed to send funds to beneficiary.",{cause:t,name:"FailedToSendToBeneficiaryError"})}}Object.defineProperty(El,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa91/});class _l extends F{constructor({cause:t}){super("Gas value overflowed.",{cause:t,metaMessages:["This could arise when:","- one of the gas values exceeded 2**120 (uint120)"].filter(Boolean),name:"GasValuesOverflowError"})}}Object.defineProperty(_l,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa94/});class Sl extends F{constructor({cause:t}){super("The `handleOps` function was called by the Bundler with a gas limit too low.",{cause:t,name:"HandleOpsOutOfGasError"})}}Object.defineProperty(Sl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa95/});class Il extends F{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Failed to simulate deployment for Smart Account.",{cause:t,metaMessages:["This could arise when:","- Invalid `factory`/`factoryData` or `initCode` properties are present","- Smart Account deployment execution ran out of gas (low `verificationGasLimit` value)",`- Smart Account deployment execution reverted with an error
67
+ `,n&&`factory: ${n}`,r&&`factoryData: ${r}`,i&&`initCode: ${i}`].filter(Boolean),name:"InitCodeFailedError"})}}Object.defineProperty(Il,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa13/});class Al extends F{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Smart Account initialization implementation did not create an account.",{cause:t,metaMessages:["This could arise when:","- `factory`/`factoryData` or `initCode` properties are invalid",`- Smart Account initialization implementation is incorrect
68
+ `,n&&`factory: ${n}`,r&&`factoryData: ${r}`,i&&`initCode: ${i}`].filter(Boolean),name:"InitCodeMustCreateSenderError"})}}Object.defineProperty(Al,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa15/});class Pl extends F{constructor({cause:t,factory:n,factoryData:r,initCode:i,sender:s}){super("Smart Account initialization implementation does not return the expected sender.",{cause:t,metaMessages:["This could arise when:",`Smart Account initialization implementation does not return a sender address
69
+ `,n&&`factory: ${n}`,r&&`factoryData: ${r}`,i&&`initCode: ${i}`,s&&`sender: ${s}`].filter(Boolean),name:"InitCodeMustReturnSenderError"})}}Object.defineProperty(Pl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa14/});class kl extends F{constructor({cause:t}){super("Smart Account does not have sufficient funds to execute the User Operation.",{cause:t,metaMessages:["This could arise when:","- the Smart Account does not have sufficient funds to cover the required prefund, or","- a Paymaster was not provided"].filter(Boolean),name:"InsufficientPrefundError"})}}Object.defineProperty(kl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa21/});class Cl extends F{constructor({cause:t}){super("Bundler attempted to call an invalid function on the EntryPoint.",{cause:t,name:"InternalCallOnlyError"})}}Object.defineProperty(Cl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa92/});class Bl extends F{constructor({cause:t}){super("Bundler used an invalid aggregator for handling aggregated User Operations.",{cause:t,name:"InvalidAggregatorError"})}}Object.defineProperty(Bl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa96/});class Ol extends F{constructor({cause:t,nonce:n}){super("Invalid Smart Account nonce used for User Operation.",{cause:t,metaMessages:[n&&`nonce: ${n}`].filter(Boolean),name:"InvalidAccountNonceError"})}}Object.defineProperty(Ol,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa25/});class Tl extends F{constructor({cause:t}){super("Bundler has not set a beneficiary address.",{cause:t,name:"InvalidBeneficiaryError"})}}Object.defineProperty(Tl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa90/});class ga extends F{constructor({cause:t}){super("Invalid fields set on User Operation.",{cause:t,name:"InvalidFieldsError"})}}Object.defineProperty(ga,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class $l extends F{constructor({cause:t,paymasterAndData:n}){super("Paymaster properties provided are invalid.",{cause:t,metaMessages:["This could arise when:","- the `paymasterAndData` property is of an incorrect length\n",n&&`paymasterAndData: ${n}`].filter(Boolean),name:"InvalidPaymasterAndDataError"})}}Object.defineProperty($l,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa93/});class gr extends F{constructor({cause:t}){super("Paymaster deposit for the User Operation is too low.",{cause:t,metaMessages:["This could arise when:","- the Paymaster has deposited less than the expected amount via the `deposit` function"].filter(Boolean),name:"PaymasterDepositTooLowError"})}}Object.defineProperty(gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32508});Object.defineProperty(gr,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa31/});class Nl extends F{constructor({cause:t}){super("The `validatePaymasterUserOp` function on the Paymaster reverted.",{cause:t,name:"PaymasterFunctionRevertedError"})}}Object.defineProperty(Nl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa33/});class Ml extends F{constructor({cause:t}){super("The Paymaster contract has not been deployed.",{cause:t,name:"PaymasterNotDeployedError"})}}Object.defineProperty(Ml,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa30/});class wa extends F{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:t,name:"PaymasterRateLimitError"})}}Object.defineProperty(wa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32504});class va extends F{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:t,name:"PaymasterStakeTooLowError"})}}Object.defineProperty(va,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32505});class Ll extends F{constructor({cause:t}){super("Paymaster `postOp` function reverted.",{cause:t,name:"PaymasterPostOpFunctionRevertedError"})}}Object.defineProperty(Ll,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa50/});class Rl extends F{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Smart Account has already been deployed.",{cause:t,metaMessages:["Remove the following properties and try again:",n&&"`factory`",r&&"`factoryData`",i&&"`initCode`"].filter(Boolean),name:"SenderAlreadyConstructedError"})}}Object.defineProperty(Rl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa10/});class xa extends F{constructor({cause:t}){super("UserOperation rejected because account signature check failed (or paymaster signature, if the paymaster uses its data as signature).",{cause:t,name:"SignatureCheckFailedError"})}}Object.defineProperty(xa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32507});class Ul extends F{constructor({cause:t}){super("The `validateUserOp` function on the Smart Account reverted.",{cause:t,name:"SmartAccountFunctionRevertedError"})}}Object.defineProperty(Ul,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa23/});class Ea extends F{constructor({cause:t}){super("UserOperation rejected because account specified unsupported signature aggregator.",{cause:t,name:"UnsupportedSignatureAggregatorError"})}}Object.defineProperty(Ea,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32506});class jl extends F{constructor({cause:t}){super("User Operation expired.",{cause:t,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validateUserOp` on the Smart Account are not satisfied"].filter(Boolean),name:"UserOperationExpiredError"})}}Object.defineProperty(jl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa22/});class Fl extends F{constructor({cause:t}){super("Paymaster for User Operation expired.",{cause:t,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validatePaymasterUserOp` on the Paymaster are not satisfied"].filter(Boolean),name:"UserOperationPaymasterExpiredError"})}}Object.defineProperty(Fl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa32/});class Dl extends F{constructor({cause:t}){super("Signature provided for the User Operation is invalid.",{cause:t,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Smart Account"].filter(Boolean),name:"UserOperationSignatureError"})}}Object.defineProperty(Dl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa24/});class zl extends F{constructor({cause:t}){super("Signature provided for the User Operation is invalid.",{cause:t,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Paymaster"].filter(Boolean),name:"UserOperationPaymasterSignatureError"})}}Object.defineProperty(zl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa34/});class _a extends F{constructor({cause:t}){super("User Operation rejected by EntryPoint's `simulateValidation` during account creation or validation.",{cause:t,name:"UserOperationRejectedByEntryPointError"})}}Object.defineProperty(_a,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32500});class Sa extends F{constructor({cause:t}){super("User Operation rejected by Paymaster's `validatePaymasterUserOp`.",{cause:t,name:"UserOperationRejectedByPaymasterError"})}}Object.defineProperty(Sa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32501});class Ia extends F{constructor({cause:t}){super("User Operation rejected with op code validation error.",{cause:t,name:"UserOperationRejectedByOpCodeError"})}}Object.defineProperty(Ia,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32502});class Aa extends F{constructor({cause:t}){super("UserOperation out of time-range: either wallet or paymaster returned a time-range, and it is already expired (or will expire soon).",{cause:t,name:"UserOperationOutOfTimeRangeError"})}}Object.defineProperty(Aa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32503});class TI extends F{constructor({cause:t}){super(`An error occurred while executing user operation: ${t?.shortMessage}`,{cause:t,name:"UnknownBundlerError"})}}class Hl extends F{constructor({cause:t}){super("User Operation verification gas limit exceeded.",{cause:t,metaMessages:["This could arise when:","- the gas used for verification exceeded the `verificationGasLimit`"].filter(Boolean),name:"VerificationGasLimitExceededError"})}}Object.defineProperty(Hl,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa40/});class ql extends F{constructor({cause:t}){super("User Operation verification gas limit is too low.",{cause:t,metaMessages:["This could arise when:","- the `verificationGasLimit` is too low to verify the User Operation"].filter(Boolean),name:"VerificationGasLimitTooLowError"})}}Object.defineProperty(ql,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa41/});class $I extends F{constructor(t,{callData:n,callGasLimit:r,docsPath:i,factory:s,factoryData:o,initCode:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,paymaster:d,paymasterAndData:f,paymasterData:h,paymasterPostOpGasLimit:g,paymasterVerificationGasLimit:y,preVerificationGas:m,sender:w,signature:S,verificationGasLimit:x}){const E=Fi({callData:n,callGasLimit:r,factory:s,factoryData:o,initCode:a,maxFeePerGas:typeof c<"u"&&`${rt(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${rt(u)} gwei`,nonce:l,paymaster:d,paymasterAndData:f,paymasterData:h,paymasterPostOpGasLimit:g,paymasterVerificationGasLimit:y,preVerificationGas:m,sender:w,signature:S,verificationGasLimit:x});super(t.shortMessage,{cause:t,docsPath:i,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",E].filter(Boolean),name:"UserOperationExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class NI extends F{constructor({hash:t}){super(`User Operation receipt with hash "${t}" could not be found. The User Operation may not have been processed yet.`,{name:"UserOperationReceiptNotFoundError"})}}class MI extends F{constructor({hash:t}){super(`User Operation with hash "${t}" could not be found.`,{name:"UserOperationNotFoundError"})}}class Sh extends F{constructor({hash:t}){super(`Timed out while waiting for User Operation with hash "${t}" to be confirmed.`,{name:"WaitForUserOperationReceiptTimeoutError"})}}const LI=[Ii,ga,gr,wa,va,xa,Ea,Aa,_a,Sa,Ia];function RI(e,t){const n=(e.details||"").toLowerCase();if(xl.message.test(n))return new xl({cause:e});if(El.message.test(n))return new El({cause:e});if(_l.message.test(n))return new _l({cause:e});if(Sl.message.test(n))return new Sl({cause:e});if(Il.message.test(n))return new Il({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Al.message.test(n))return new Al({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Pl.message.test(n))return new Pl({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode,sender:t.sender});if(kl.message.test(n))return new kl({cause:e});if(Cl.message.test(n))return new Cl({cause:e});if(Ol.message.test(n))return new Ol({cause:e,nonce:t.nonce});if(Bl.message.test(n))return new Bl({cause:e});if(Tl.message.test(n))return new Tl({cause:e});if($l.message.test(n))return new $l({cause:e});if(gr.message.test(n))return new gr({cause:e});if(Nl.message.test(n))return new Nl({cause:e});if(Ml.message.test(n))return new Ml({cause:e});if(Ll.message.test(n))return new Ll({cause:e});if(Ul.message.test(n))return new Ul({cause:e});if(Rl.message.test(n))return new Rl({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(jl.message.test(n))return new jl({cause:e});if(Fl.message.test(n))return new Fl({cause:e});if(zl.message.test(n))return new zl({cause:e});if(Dl.message.test(n))return new Dl({cause:e});if(Hl.message.test(n))return new Hl({cause:e});if(ql.message.test(n))return new ql({cause:e});const r=e.walk(i=>LI.some(s=>s.code===i.code));if(r){if(r.code===Ii.code)return new Ii({cause:e,data:r.data,message:r.details});if(r.code===ga.code)return new ga({cause:e});if(r.code===gr.code)return new gr({cause:e});if(r.code===wa.code)return new wa({cause:e});if(r.code===va.code)return new va({cause:e});if(r.code===xa.code)return new xa({cause:e});if(r.code===Ea.code)return new Ea({cause:e});if(r.code===Aa.code)return new Aa({cause:e});if(r.code===_a.code)return new _a({cause:e});if(r.code===Sa.code)return new Sa({cause:e});if(r.code===Ia.code)return new Ia({cause:e})}return new TI({cause:e})}function mg(e,{calls:t,docsPath:n,...r}){const i=(()=>{const s=RI(e,r);if(t&&s instanceof Ii){const o=UI(s),a=t?.filter(c=>c.abi);if(o&&a.length>0)return jI({calls:a,revertData:o})}return s})();return new $I(i,{docsPath:n,...r})}function UI(e){let t;return e.walk(n=>{const r=n;if(typeof r.data=="string"||typeof r.data?.revertData=="string"||!(r instanceof F)&&typeof r.message=="string"){const i=(r.data?.revertData||r.data||r.message).match?.(/(0x[A-Za-z0-9]*)/);if(i)return t=i[1],!0}return!1}),t}function jI(e){const{calls:t,revertData:n}=e,{abi:r,functionName:i,args:s,to:o}=(()=>{const c=t?.filter(l=>!!l.abi);if(c.length===1)return c[0];const u=c.filter(l=>{try{return!!Bd({abi:l.abi,data:n})}catch{return!1}});return u.length===1?u[0]:{abi:[],functionName:c.reduce((l,d)=>`${l?`${l} | `:""}${d.functionName}`,""),args:void 0,to:void 0}})(),a=n==="0x"?new zm({functionName:i}):new sa({abi:r,data:n,functionName:i});return new Od(a,{abi:r,args:s,contractAddress:o,functionName:i})}function FI(e){const t={};return e.callGasLimit&&(t.callGasLimit=BigInt(e.callGasLimit)),e.preVerificationGas&&(t.preVerificationGas=BigInt(e.preVerificationGas)),e.verificationGasLimit&&(t.verificationGasLimit=BigInt(e.verificationGasLimit)),e.paymasterPostOpGasLimit&&(t.paymasterPostOpGasLimit=BigInt(e.paymasterPostOpGasLimit)),e.paymasterVerificationGasLimit&&(t.paymasterVerificationGasLimit=BigInt(e.paymasterVerificationGasLimit)),t}function sc(e){const t={};return typeof e.callData<"u"&&(t.callData=e.callData),typeof e.callGasLimit<"u"&&(t.callGasLimit=q(e.callGasLimit)),typeof e.factory<"u"&&(t.factory=e.factory),typeof e.factoryData<"u"&&(t.factoryData=e.factoryData),typeof e.initCode<"u"&&(t.initCode=e.initCode),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=q(e.nonce)),typeof e.paymaster<"u"&&(t.paymaster=e.paymaster),typeof e.paymasterAndData<"u"&&(t.paymasterAndData=e.paymasterAndData||"0x"),typeof e.paymasterData<"u"&&(t.paymasterData=e.paymasterData),typeof e.paymasterPostOpGasLimit<"u"&&(t.paymasterPostOpGasLimit=q(e.paymasterPostOpGasLimit)),typeof e.paymasterSignature<"u"&&(t.paymasterSignature=e.paymasterSignature),typeof e.paymasterVerificationGasLimit<"u"&&(t.paymasterVerificationGasLimit=q(e.paymasterVerificationGasLimit)),typeof e.preVerificationGas<"u"&&(t.preVerificationGas=q(e.preVerificationGas)),typeof e.sender<"u"&&(t.sender=e.sender),typeof e.signature<"u"&&(t.signature=e.signature),typeof e.verificationGasLimit<"u"&&(t.verificationGasLimit=q(e.verificationGasLimit)),typeof e.authorization<"u"&&(t.eip7702Auth=DI(e.authorization)),t}function DI(e){return{address:e.address,chainId:q(e.chainId),nonce:q(e.nonce),r:e.r?q(BigInt(e.r),{size:32}):Me("0x",{size:32}),s:e.s?q(BigInt(e.s),{size:32}):Me("0x",{size:32}),yParity:e.yParity?q(e.yParity,{size:1}):Me("0x",{size:32})}}async function zI(e,t){const{chainId:n,entryPointAddress:r,context:i,...s}=t,o=sc(s),{paymasterPostOpGasLimit:a,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterData",params:[{...o,callGasLimit:o.callGasLimit??"0x0",verificationGasLimit:o.verificationGasLimit??"0x0",preVerificationGas:o.preVerificationGas??"0x0"},r,q(n),i]});return{...u,...a&&{paymasterPostOpGasLimit:Le(a)},...c&&{paymasterVerificationGasLimit:Le(c)}}}async function HI(e,t){const{chainId:n,entryPointAddress:r,context:i,...s}=t,o=sc(s),{paymasterPostOpGasLimit:a,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterStubData",params:[{...o,callGasLimit:o.callGasLimit??"0x0",verificationGasLimit:o.verificationGasLimit??"0x0",preVerificationGas:o.preVerificationGas??"0x0"},r,q(n),i]});return{...u,...a&&{paymasterPostOpGasLimit:Le(a)},...c&&{paymasterVerificationGasLimit:Le(c)}}}const qI=["factory","fees","gas","paymaster","nonce","signature","authorization"];async function wf(e,t){const n=t,{account:r=e.account,parameters:i=qI,stateOverride:s}=n;if(!r)throw new Ma;const o=We(r),a=e,c=n.paymaster??a?.paymaster,u=typeof c=="string"?c:void 0,{getPaymasterStubData:l,getPaymasterData:d}=(()=>{if(c===!0)return{getPaymasterStubData:I=>Z(a,HI,"getPaymasterStubData")(I),getPaymasterData:I=>Z(a,zI,"getPaymasterData")(I)};if(typeof c=="object"){const{getPaymasterStubData:I,getPaymasterData:A}=c;return{getPaymasterStubData:A&&I?I:A,getPaymasterData:A&&I?A:void 0}}return{getPaymasterStubData:void 0,getPaymasterData:void 0}})(),f=n.paymasterContext?n.paymasterContext:a?.paymasterContext;let h={...n,paymaster:u,sender:o.address};const[g,y,m,w,S]=await Promise.all([(async()=>n.calls?o.encodeCalls(n.calls.map(I=>{const A=I;return A.abi?{data:Re(A),to:A.to,value:A.value}:A})):n.callData)(),(async()=>{if(!i.includes("factory"))return;if(n.initCode)return{initCode:n.initCode};if(n.factory&&n.factoryData)return{factory:n.factory,factoryData:n.factoryData};const{factory:I,factoryData:A}=await o.getFactoryArgs();return o.entryPoint.version==="0.6"?{initCode:I&&A?Xe([I,A]):void 0}:{factory:I,factoryData:A}})(),(async()=>{if(i.includes("fees")){if(typeof n.maxFeePerGas=="bigint"&&typeof n.maxPriorityFeePerGas=="bigint")return h;if(a?.userOperation?.estimateFeesPerGas){const I=await a.userOperation.estimateFeesPerGas({account:o,bundlerClient:a,userOperation:h});return{...h,...I}}try{const I=a.client??e,A=await Z(I,eb,"estimateFeesPerGas")({chain:I.chain,type:"eip1559"});return{maxFeePerGas:typeof n.maxFeePerGas=="bigint"?n.maxFeePerGas:BigInt(2n*A.maxFeePerGas),maxPriorityFeePerGas:typeof n.maxPriorityFeePerGas=="bigint"?n.maxPriorityFeePerGas:BigInt(2n*A.maxPriorityFeePerGas)}}catch{return}}})(),(async()=>{if(i.includes("nonce"))return typeof n.nonce=="bigint"?n.nonce:o.getNonce()})(),(async()=>{if(i.includes("authorization")){if(typeof n.authorization=="object")return n.authorization;if(o.authorization&&!await o.isDeployed())return{...await e_(o.client,o.authorization),r:"0xfffffffffffffffffffffffffffffff000000000000000000000000000000000",s:"0x7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",yParity:1}}})()]);typeof g<"u"&&(h.callData=g),typeof y<"u"&&(h={...h,...y}),typeof m<"u"&&(h={...h,...m}),typeof w<"u"&&(h.nonce=w),typeof S<"u"&&(h.authorization=S),i.includes("signature")&&(typeof n.signature<"u"?h.signature=n.signature:h.signature=await o.getStubSignature(h)),o.entryPoint.version==="0.6"&&!h.initCode&&(h.initCode="0x");let x;async function E(){return x||(e.chain?e.chain.id:(x=await Z(e,Gi,"getChainId")({}),x))}let v=!1;if(i.includes("paymaster")&&l&&!u&&!n.paymasterAndData){const{isFinal:I=!1,sponsor:A,...B}=await l({chainId:await E(),entryPointAddress:o.entryPoint.address,context:f,...h});v=I,h={...h,...B}}if(o.entryPoint.version==="0.6"&&!h.paymasterAndData&&(h.paymasterAndData="0x"),i.includes("gas")){if(o.userOperation?.estimateGas){const I=await o.userOperation.estimateGas(h);h={...h,...I}}if(typeof h.callGasLimit>"u"||typeof h.preVerificationGas>"u"||typeof h.verificationGasLimit>"u"||h.paymaster&&typeof h.paymasterPostOpGasLimit>"u"||h.paymaster&&typeof h.paymasterVerificationGasLimit>"u"){const I=await Z(a,yg,"estimateUserOperationGas")({account:o,callGasLimit:0n,preVerificationGas:0n,verificationGasLimit:0n,stateOverride:s,...h.paymaster?{paymasterPostOpGasLimit:0n,paymasterVerificationGasLimit:0n}:{},...h});h={...h,callGasLimit:h.callGasLimit??I.callGasLimit,preVerificationGas:h.preVerificationGas??I.preVerificationGas,verificationGasLimit:h.verificationGasLimit??I.verificationGasLimit,paymasterPostOpGasLimit:h.paymasterPostOpGasLimit??I.paymasterPostOpGasLimit,paymasterVerificationGasLimit:h.paymasterVerificationGasLimit??I.paymasterVerificationGasLimit}}}if(i.includes("paymaster")&&d&&!u&&!n.paymasterAndData&&!v){const I=await d({chainId:await E(),entryPointAddress:o.entryPoint.address,context:f,...h});h={...h,...I}}return delete h.calls,delete h.parameters,delete h.paymasterContext,typeof h.paymaster!="string"&&delete h.paymaster,h}async function yg(e,t){const{account:n=e.account,entryPointAddress:r,stateOverride:i}=t;if(!n&&!t.sender)throw new Ma;const s=n?We(n):void 0,o=Wa(i),a=s?await Z(e,wf,"prepareUserOperation")({...t,parameters:["authorization","factory","nonce","paymaster","signature"]}):t;try{const c=[sc(a),r??s?.entryPoint?.address],u=await e.request({method:"eth_estimateUserOperationGas",params:o?[...c,o]:[...c]});return FI(u)}catch(c){const u=t.calls;throw mg(c,{...a,...u?{calls:u}:{}})}}function GI(e){return e.request({method:"eth_supportedEntryPoints"})}function VI(e){const t={...e};return e.callGasLimit&&(t.callGasLimit=BigInt(e.callGasLimit)),e.maxFeePerGas&&(t.maxFeePerGas=BigInt(e.maxFeePerGas)),e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=BigInt(e.maxPriorityFeePerGas)),e.nonce&&(t.nonce=BigInt(e.nonce)),e.paymasterPostOpGasLimit&&(t.paymasterPostOpGasLimit=BigInt(e.paymasterPostOpGasLimit)),e.paymasterVerificationGasLimit&&(t.paymasterVerificationGasLimit=BigInt(e.paymasterVerificationGasLimit)),e.preVerificationGas&&(t.preVerificationGas=BigInt(e.preVerificationGas)),e.verificationGasLimit&&(t.verificationGasLimit=BigInt(e.verificationGasLimit)),t}async function WI(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationByHash",params:[t]},{dedupe:!0});if(!n)throw new MI({hash:t});const{blockHash:r,blockNumber:i,entryPoint:s,transactionHash:o,userOperation:a}=n;return{blockHash:r,blockNumber:BigInt(i),entryPoint:s,transactionHash:o,userOperation:VI(a)}}function KI(e){const t={...e};return e.actualGasCost&&(t.actualGasCost=BigInt(e.actualGasCost)),e.actualGasUsed&&(t.actualGasUsed=BigInt(e.actualGasUsed)),e.logs&&(t.logs=e.logs.map(n=>sn(n))),e.receipt&&(t.receipt=bd(t.receipt)),t}async function bg(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationReceipt",params:[t]},{dedupe:!0});if(!n)throw new NI({hash:t});return KI(n)}async function ZI(e,t){const{account:n=e.account,entryPointAddress:r}=t;if(!n&&!t.sender)throw new Ma;const i=n?We(n):void 0,s=i?await Z(e,wf,"prepareUserOperation")(t):t,o=t.signature||await i?.signUserOperation?.(s),a=sc({...s,signature:o});try{return await e.request({method:"eth_sendUserOperation",params:[a,r??i?.entryPoint?.address]},{retryCount:0})}catch(c){const u=t.calls;throw mg(c,{...s,...u?{calls:u}:{},signature:o})}}function YI(e,t){const{hash:n,pollingInterval:r=e.pollingInterval,retryCount:i,timeout:s=12e4}=t;let o=0;const a=Oe(["waitForUserOperationReceipt",e.uid,n]);return new Promise((c,u)=>{const l=on(a,{resolve:c,reject:u},d=>{const f=y=>{g(),y(),l()},h=s?setTimeout(()=>f(()=>d.reject(new Sh({hash:n}))),s):void 0,g=Hr(async()=>{i&&o>=i&&(clearTimeout(h),f(()=>d.reject(new Sh({hash:n}))));try{const y=await Z(e,bg,"getUserOperationReceipt")({hash:n});clearTimeout(h),f(()=>d.resolve(y))}catch(y){const m=y;m.name!=="UserOperationReceiptNotFoundError"&&(clearTimeout(h),f(()=>d.reject(m)))}o++},{emitOnBegin:!0,interval:r});return g})})}function QI(e){return{estimateUserOperationGas:t=>yg(e,t),getChainId:()=>Gi(e),getSupportedEntryPoints:()=>GI(e),getUserOperation:t=>WI(e,t),getUserOperationReceipt:t=>bg(e,t),prepareUserOperation:t=>wf(e,t),sendUserOperation:t=>ZI(e,t),waitForUserOperationReceipt:t=>YI(e,t)}}function JI(e){const{client:t,key:n="bundler",name:r="Bundler Client",paymaster:i,paymasterContext:s,transport:o,userOperation:a}=e;return Object.assign(cf({...e,chain:e.chain??t?.chain,key:n,name:r,transport:o,type:"bundlerClient"}),{client:t,paymaster:i,paymasterContext:s,userOperation:a}).extend(QI)}const Wi="4.3.6",gg="@coinbase/wallet-sdk",XI=()=>({chains:[]}),eA=()=>({keys:{}}),tA=()=>({account:{}}),nA=()=>({subAccount:void 0}),rA=()=>({subAccountConfig:{}}),iA=()=>({spendPermissions:[]}),sA=()=>({config:{version:Wi}}),Te=hf(iI((...e)=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},XI(...e)),eA(...e)),tA(...e)),nA(...e)),iA(...e)),sA(...e)),rA(...e)),{name:"cbwsdk.store",storage:Vb(()=>localStorage),partialize:e=>({chains:e.chains,keys:e.keys,account:e.account,subAccount:e.subAccount,spendPermissions:e.spendPermissions,config:e.config})})),oA={get:()=>Te.getState().subAccountConfig,set:e=>{Te.setState(t=>({subAccountConfig:Object.assign(Object.assign({},t.subAccountConfig),e)}))},clear:()=>{Te.setState({subAccountConfig:{}})}},aA={get:()=>Te.getState().subAccount,set:e=>{Te.setState(t=>({subAccount:t.subAccount?Object.assign(Object.assign({},t.subAccount),e):Object.assign({address:e.address},e)}))},clear:()=>{Te.setState({subAccount:void 0})}},cA={get:()=>Te.getState().spendPermissions,set:e=>{Te.setState({spendPermissions:e})},clear:()=>{Te.setState({spendPermissions:[]})}},uA={get:()=>Te.getState().account,set:e=>{Te.setState(t=>({account:Object.assign(Object.assign({},t.account),e)}))},clear:()=>{Te.setState({account:{}})}},lA={get:()=>Te.getState().chains,set:e=>{Te.setState({chains:e})},clear:()=>{Te.setState({chains:[]})}},dA={get:e=>Te.getState().keys[e],set:(e,t)=>{Te.setState(n=>({keys:Object.assign(Object.assign({},n.keys),{[e]:t})}))},clear:()=>{Te.setState({keys:{}})}},wg={get:()=>Te.getState().config,set:e=>{Te.setState(t=>({config:Object.assign(Object.assign({},t.config),e)}))}},fA={subAccounts:aA,subAccountsConfig:oA,spendPermissions:cA,account:uA,chains:lA,keys:dA,config:wg},W=Object.assign(Object.assign({},Te),fA),hA='!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClientAnalytics=t():e.ClientAnalytics=t()}(this,(function(){return(()=>{var e={792:e=>{var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};e.exports=t},562:e=>{var t,n;t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var i=e[r]<<16|e[r+1]<<8|e[r+2],a=0;a<4;a++)8*r+6*a<=8*e.length?n.push(t.charAt(i>>>6*(3-a)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\\/]/gi,"");for(var n=[],r=0,i=0;r<e.length;i=++r%4)0!=i&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*i+8)-1)<<2*i|t.indexOf(e.charAt(r))>>>6-2*i);return n}},e.exports=n},335:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},762:(e,t,n)=>{var r,i,a,o,s;r=n(562),i=n(792).utf8,a=n(335),o=n(792).bin,(s=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?o.stringToBytes(e):i.stringToBytes(e):a(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=r.bytesToWords(e),c=8*e.length,u=1732584193,l=-271733879,d=-1732584194,p=271733878,m=0;m<n.length;m++)n[m]=16711935&(n[m]<<8|n[m]>>>24)|4278255360&(n[m]<<24|n[m]>>>8);n[c>>>5]|=128<<c%32,n[14+(c+64>>>9<<4)]=c;var f=s._ff,v=s._gg,g=s._hh,b=s._ii;for(m=0;m<n.length;m+=16){var h=u,w=l,y=d,T=p;u=f(u,l,d,p,n[m+0],7,-680876936),p=f(p,u,l,d,n[m+1],12,-389564586),d=f(d,p,u,l,n[m+2],17,606105819),l=f(l,d,p,u,n[m+3],22,-1044525330),u=f(u,l,d,p,n[m+4],7,-176418897),p=f(p,u,l,d,n[m+5],12,1200080426),d=f(d,p,u,l,n[m+6],17,-1473231341),l=f(l,d,p,u,n[m+7],22,-45705983),u=f(u,l,d,p,n[m+8],7,1770035416),p=f(p,u,l,d,n[m+9],12,-1958414417),d=f(d,p,u,l,n[m+10],17,-42063),l=f(l,d,p,u,n[m+11],22,-1990404162),u=f(u,l,d,p,n[m+12],7,1804603682),p=f(p,u,l,d,n[m+13],12,-40341101),d=f(d,p,u,l,n[m+14],17,-1502002290),u=v(u,l=f(l,d,p,u,n[m+15],22,1236535329),d,p,n[m+1],5,-165796510),p=v(p,u,l,d,n[m+6],9,-1069501632),d=v(d,p,u,l,n[m+11],14,643717713),l=v(l,d,p,u,n[m+0],20,-373897302),u=v(u,l,d,p,n[m+5],5,-701558691),p=v(p,u,l,d,n[m+10],9,38016083),d=v(d,p,u,l,n[m+15],14,-660478335),l=v(l,d,p,u,n[m+4],20,-405537848),u=v(u,l,d,p,n[m+9],5,568446438),p=v(p,u,l,d,n[m+14],9,-1019803690),d=v(d,p,u,l,n[m+3],14,-187363961),l=v(l,d,p,u,n[m+8],20,1163531501),u=v(u,l,d,p,n[m+13],5,-1444681467),p=v(p,u,l,d,n[m+2],9,-51403784),d=v(d,p,u,l,n[m+7],14,1735328473),u=g(u,l=v(l,d,p,u,n[m+12],20,-1926607734),d,p,n[m+5],4,-378558),p=g(p,u,l,d,n[m+8],11,-2022574463),d=g(d,p,u,l,n[m+11],16,1839030562),l=g(l,d,p,u,n[m+14],23,-35309556),u=g(u,l,d,p,n[m+1],4,-1530992060),p=g(p,u,l,d,n[m+4],11,1272893353),d=g(d,p,u,l,n[m+7],16,-155497632),l=g(l,d,p,u,n[m+10],23,-1094730640),u=g(u,l,d,p,n[m+13],4,681279174),p=g(p,u,l,d,n[m+0],11,-358537222),d=g(d,p,u,l,n[m+3],16,-722521979),l=g(l,d,p,u,n[m+6],23,76029189),u=g(u,l,d,p,n[m+9],4,-640364487),p=g(p,u,l,d,n[m+12],11,-421815835),d=g(d,p,u,l,n[m+15],16,530742520),u=b(u,l=g(l,d,p,u,n[m+2],23,-995338651),d,p,n[m+0],6,-198630844),p=b(p,u,l,d,n[m+7],10,1126891415),d=b(d,p,u,l,n[m+14],15,-1416354905),l=b(l,d,p,u,n[m+5],21,-57434055),u=b(u,l,d,p,n[m+12],6,1700485571),p=b(p,u,l,d,n[m+3],10,-1894986606),d=b(d,p,u,l,n[m+10],15,-1051523),l=b(l,d,p,u,n[m+1],21,-2054922799),u=b(u,l,d,p,n[m+8],6,1873313359),p=b(p,u,l,d,n[m+15],10,-30611744),d=b(d,p,u,l,n[m+6],15,-1560198380),l=b(l,d,p,u,n[m+13],21,1309151649),u=b(u,l,d,p,n[m+4],6,-145523070),p=b(p,u,l,d,n[m+11],10,-1120210379),d=b(d,p,u,l,n[m+2],15,718787259),l=b(l,d,p,u,n[m+9],21,-343485551),u=u+h>>>0,l=l+w>>>0,d=d+y>>>0,p=p+T>>>0}return r.endian([u,l,d,p])})._ff=function(e,t,n,r,i,a,o){var s=e+(t&n|~t&r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._gg=function(e,t,n,r,i,a,o){var s=e+(t&r|n&~r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._hh=function(e,t,n,r,i,a,o){var s=e+(t^n^r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._ii=function(e,t,n,r,i,a,o){var s=e+(n^(t|~r))+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._blocksize=16,s._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=r.wordsToBytes(s(e,t));return t&&t.asBytes?n:t&&t.asString?o.bytesToString(n):r.bytesToHex(n)}},2:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Perfume:()=>ze,incrementUjNavigation:()=>Le,markStep:()=>Re,markStepOnce:()=>qe});var r,i,a={isResourceTiming:!1,isElementTiming:!1,maxTime:3e4,reportOptions:{},enableNavigationTracking:!0},o=window,s=o.console,c=o.navigator,u=o.performance,l=function(){return c.deviceMemory},d=function(){return c.hardwareConcurrency},p="mark.",m=function(){return u&&!!u.getEntriesByType&&!!u.now&&!!u.mark},f="4g",v=!1,g={},b={value:0},h={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},w={value:0},y={value:0},T={},k={isHidden:!1,didChange:!1},_=function(){k.isHidden=!1,document.hidden&&(k.isHidden=document.hidden,k.didChange=!0)},S=function(e,t){try{var n=new PerformanceObserver((function(e){t(e.getEntries())}));return n.observe({type:e,buffered:!0}),n}catch(e){s.warn("Perfume.js:",e)}return null},E=function(){return!!(d()&&d()<=4)||!!(l()&&l()<=4)},x=function(e,t){switch(e){case"slow-2g":case"2g":case"3g":return!0;default:return E()||t}},O=function(e){return parseFloat(e.toFixed(4))},j=function(e){return"number"!=typeof e?null:O(e/Math.pow(1024,2))},N=function(e,t,n,r,i){var s,u=function(){a.analyticsTracker&&(k.isHidden&&!["CLS","INP"].includes(e)||a.analyticsTracker({attribution:r,metricName:e,data:t,navigatorInformation:c?{deviceMemory:l()||0,hardwareConcurrency:d()||0,serviceWorkerStatus:"serviceWorker"in c?c.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:E(),isLowEndExperience:x(f,v)}:{},rating:n,navigationType:i}))};["CLS","INP"].includes(e)?u():(s=u,"requestIdleCallback"in o?o.requestIdleCallback(s,{timeout:3e3}):s())},I=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<b.value)){var t=e.duration-50;t>0&&(w.value+=t,y.value+=t)}}))};!function(e){e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable"}(r||(r={}));var P,M,B,C,D,A=((i={})[r.instant]={vitalsThresholds:[100,200],maxOutlierThreshold:1e4},i[r.quick]={vitalsThresholds:[200,500],maxOutlierThreshold:1e4},i[r.moderate]={vitalsThresholds:[500,1e3],maxOutlierThreshold:1e4},i[r.slow]={vitalsThresholds:[1e3,2e3],maxOutlierThreshold:1e4},i[r.unavoidable]={vitalsThresholds:[2e3,5e3],maxOutlierThreshold:2e4},i),L={RT:[100,200],TBT:[200,600],NTBT:[200,600]},U=function(e,t){return L[e]?t<=L[e][0]?"good":t<=L[e][1]?"needsImprovement":"poor":null},R=function(e,t,n){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=O(t[e]))})),N(e,t,null,n||{})},q=function(e){var t=e.attribution,n=e.name,r=e.rating,i=e.value,o=e.navigationType;"FCP"===n&&(b.value=i),["FCP","LCP"].includes(n)&&!T[0]&&(T[0]=S("longtask",I)),"FID"===n&&setTimeout((function(){k.didChange||(q({attribution:t,name:"TBT",rating:U("TBT",w.value),value:w.value,navigationType:o}),R("dataConsumption",h.value))}),1e4);var s=O(i);s<=a.maxTime&&s>=0&&N(n,s,r,t,o)},F=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},z=function(e){if("loading"===document.readyState)return"loading";var t=F();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},K=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},$=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var r=e,i=r.id?"#"+r.id:K(r)+(r.className&&r.className.length?"."+r.className.replace(/\\s+/g,"."):"");if(n.length+i.length>(t||100)-1)return n||i;if(n=n?i+">"+n:i,r.id)break;e=r.parentNode}}catch(e){}return n},Q=-1,W=function(){return Q},H=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Q=t.timeStamp,e(t))}),!0)},V=function(){var e=F();return e&&e.activationStart||0},J=function(e,t){var n=F(),r="navigate";return W()>=0?r="back-forward-cache":n&&(r=document.prerendering||V()>0?"prerender":document.wasDiscarded?"restore":n.type.replace(/_/g,"-")),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},X=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},G=function(e,t){var n=function n(r){"pagehide"!==r.type&&"hidden"!==document.visibilityState||(e(r),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Z=function(e,t,n,r){var i,a;return function(o){t.value>=0&&(o||r)&&((a=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Y=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},ee=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},te=-1,ne=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},re=function(e){"hidden"===document.visibilityState&&te>-1&&(te="visibilitychange"===e.type?e.timeStamp:0,ae())},ie=function(){addEventListener("visibilitychange",re,!0),addEventListener("prerenderingchange",re,!0)},ae=function(){removeEventListener("visibilitychange",re,!0),removeEventListener("prerenderingchange",re,!0)},oe=function(){return te<0&&(te=ne(),ie(),H((function(){setTimeout((function(){te=ne(),ie()}),0)}))),{get firstHiddenTime(){return te}}},se=function(e,t){t=t||{},ee((function(){var n,r=[1800,3e3],i=oe(),a=J("FCP"),o=X("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(a.value=Math.max(e.startTime-V(),0),a.entries.push(e),n(!0)))}))}));o&&(n=Z(e,a,r,t.reportAllChanges),H((function(i){a=J("FCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,n(!0)}))})))}))},ce={passive:!0,capture:!0},ue=new Date,le=function(e,t){P||(P=t,M=e,B=new Date,me(removeEventListener),de())},de=function(){if(M>=0&&M<B-ue){var e={entryType:"first-input",name:P.type,target:P.target,cancelable:P.cancelable,startTime:P.timeStamp,processingStart:P.timeStamp+M};C.forEach((function(t){t(e)})),C=[]}},pe=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){le(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,ce),removeEventListener("pointercancel",r,ce)};addEventListener("pointerup",n,ce),addEventListener("pointercancel",r,ce)}(t,e):le(t,e)}},me=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,pe,ce)}))},fe=0,ve=1/0,ge=0,be=function(e){e.forEach((function(e){e.interactionId&&(ve=Math.min(ve,e.interactionId),ge=Math.max(ge,e.interactionId),fe=ge?(ge-ve)/7+1:0)}))},he=function(){return D?fe:performance.interactionCount||0},we=0,ye=function(){return he()-we},Te=[],ke={},_e=function(e){var t=Te[Te.length-1],n=ke[e.interactionId];if(n||Te.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};ke[r.id]=r,Te.push(r)}Te.sort((function(e,t){return t.latency-e.latency})),Te.splice(10).forEach((function(e){delete ke[e.id]}))}},Se={},Ee=function e(t){document.prerendering?ee((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},xe=function(e,t){t=t||{};var n=[800,1800],r=J("TTFB"),i=Z(e,r,n,t.reportAllChanges);Ee((function(){var a=F();if(a){var o=a.responseStart;if(o<=0||o>performance.now())return;r.value=Math.max(o-V(),0),r.entries=[a],i(!0),H((function(){r=J("TTFB",0),(i=Z(e,r,n,t.reportAllChanges))(!0)}))}}))},Oe=function(e){e.forEach((function(e){e.identifier&&q({attribution:{identifier:e.identifier},name:"ET",rating:null,value:e.startTime})}))},je=function(e){e.forEach((function(e){if(a.isResourceTiming&&R("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;h.value[e.initiatorType]+=t,h.value.total+=t}}))},Ne=function(){!function(e,t){xe((function(e){!function(e){if(e.entries.length){var t=e.entries[0],n=t.activationStart||0,r=Math.max(t.domainLookupStart-n,0),i=Math.max(t.connectStart-n,0),a=Math.max(t.requestStart-n,0);e.attribution={waitingTime:r,dnsTime:i-r,connectionTime:a-i,requestTime:e.value-a,navigationEntry:t}}else e.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(e),function(e){e.value>0&&q(e)}(e)}),t)}(0,a.reportOptions.ttfb),function(e,t){!function(e,t){t=t||{},ee((function(){var e,n=[.1,.25],r=J("CLS"),i=-1,a=0,o=[],s=function(e){i>-1&&function(e){!function(e){if(e.entries.length){var t=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(t&&t.sources&&t.sources.length){var n=(r=t.sources).find((function(e){return e.node&&1===e.node.nodeType}))||r[0];if(n)return void(e.attribution={largestShiftTarget:$(n.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:n,largestShiftEntry:t,loadState:z(t.startTime)})}}var r;e.attribution={}}(e),function(e){q(e)}(e)}(e)},c=function(t){t.forEach((function(t){if(!t.hadRecentInput){var n=o[0],i=o[o.length-1];a&&t.startTime-i.startTime<1e3&&t.startTime-n.startTime<5e3?(a+=t.value,o.push(t)):(a=t.value,o=[t]),a>r.value&&(r.value=a,r.entries=o,e())}}))},u=X("layout-shift",c);u&&(e=Z(s,r,n,t.reportAllChanges),se((function(t){i=t.value,r.value<0&&(r.value=0,e())})),G((function(){c(u.takeRecords()),e(!0)})),H((function(){a=0,i=-1,r=J("CLS",0),e=Z(s,r,n,t.reportAllChanges),Y((function(){return e()}))})))}))}(0,t)}(0,a.reportOptions.cls),function(e,t){se((function(e){!function(e){if(e.entries.length){var t=F(),n=e.entries[e.entries.length-1];if(t){var r=t.activationStart||0,i=Math.max(0,t.responseStart-r);return void(e.attribution={timeToFirstByte:i,firstByteToFCP:e.value-i,loadState:z(e.entries[0].startTime),navigationEntry:t,fcpEntry:n})}}e.attribution={timeToFirstByte:0,firstByteToFCP:e.value,loadState:z(W())}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[100,300],i=oe(),a=J("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(a.value=e.processingStart-e.startTime,a.entries.push(e),n(!0))},s=function(e){e.forEach(o)},c=X("first-input",s);n=Z(e,a,r,t.reportAllChanges),c&&G((function(){s(c.takeRecords()),c.disconnect()}),!0),c&&H((function(){var i;a=J("FID"),n=Z(e,a,r,t.reportAllChanges),C=[],M=-1,P=null,me(addEventListener),i=o,C.push(i),de()}))}))}((function(e){!function(e){var t=e.entries[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fid),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[2500,4e3],i=oe(),a=J("LCP"),o=function(e){var t=e[e.length-1];if(t){var r=Math.max(t.startTime-V(),0);r<i.firstHiddenTime&&(a.value=r,a.entries=[t],n())}},s=X("largest-contentful-paint",o);if(s){n=Z(e,a,r,t.reportAllChanges);var c=function(){Se[a.id]||(o(s.takeRecords()),s.disconnect(),Se[a.id]=!0,n(!0))};["keydown","click"].forEach((function(e){addEventListener(e,c,{once:!0,capture:!0})})),G(c,!0),H((function(i){a=J("LCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,Se[a.id]=!0,n(!0)}))}))}}))}((function(e){!function(e){if(e.entries.length){var t=F();if(t){var n=t.activationStart||0,r=e.entries[e.entries.length-1],i=r.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===r.url}))[0],a=Math.max(0,t.responseStart-n),o=Math.max(a,i?(i.requestStart||i.startTime)-n:0),s=Math.max(o,i?i.responseEnd-n:0),c=Math.max(s,r?r.startTime-n:0),u={element:$(r.element),timeToFirstByte:a,resourceLoadDelay:o-a,resourceLoadTime:s-o,elementRenderDelay:c-s,navigationEntry:t,lcpEntry:r};return r.url&&(u.url=r.url),i&&(u.lcpResourceEntry=i),void(e.attribution=u)}}e.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:e.value}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.lcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n=[200,500];"interactionCount"in performance||D||(D=X("event",be,{type:"event",buffered:!0,durationThreshold:0}));var r,i=J("INP"),a=function(e){e.forEach((function(e){e.interactionId&&_e(e),"first-input"===e.entryType&&!Te.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&_e(e)}));var t,n=(t=Math.min(Te.length-1,Math.floor(ye()/50)),Te[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())},o=X("event",a,{durationThreshold:t.durationThreshold||40});r=Z(e,i,n,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),G((function(){a(o.takeRecords()),i.value<0&&ye()>0&&(i.value=0,i.entries=[]),r(!0)})),H((function(){Te=[],we=he(),i=J("INP"),r=Z(e,i,n,t.reportAllChanges)})))}))}((function(t){!function(e){if(e.entries.length){var t=e.entries.sort((function(e,t){return t.duration-e.duration||t.processingEnd-t.processingStart-(e.processingEnd-e.processingStart)}))[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}else e.attribution={}}(t),e(t)}),t)}((function(e){return q(e)}),a.reportOptions.inp),a.isResourceTiming&&S("resource",je),a.isElementTiming&&S("element",Oe)},Ie=function(e){var t="usageDetails"in e?e.usageDetails:{};R("storageEstimate",{quota:j(e.quota),usage:j(e.usage),caches:j(t.caches),indexedDB:j(t.indexedDB),serviceWorker:j(t.serviceWorkerRegistrations)})},Pe={finalMarkToStepsMap:{},startMarkToStepsMap:{},active:{},navigationSteps:{}},Me=function(e){delete Pe.active[e]},Be=function(){return Pe.navigationSteps},Ce=function(e){var t;return null!==(t=Be()[e])&&void 0!==t?t:{}},De=function(e,t,n){var r="step."+e,i=u.getEntriesByName(p+t).length>0;if(u.getEntriesByName(p+n).length>0&&a.steps){var o=A[a.steps[e].threshold],s=o.maxOutlierThreshold,c=o.vitalsThresholds;if(i){var l=u.measure(r,p+t,p+n),d=l.duration;if(d<=s){var m=function(e,t){return e<=t[0]?"good":e<=t[1]?"needsImprovement":"poor"}(d,c);d>=0&&(N("userJourneyStep",d,m,{stepName:e},void 0),u.measure("step.".concat(e,"_vitals_").concat(m),{start:l.startTime+l.duration,end:l.startTime+l.duration,detail:{type:"stepVital",duration:d}}))}}}},Ae=function(){var e=Be(),t=Pe.startMarkToStepsMap,n=Object.keys(e).length;if(0===n)return{};var r={},i=n-1,a=Ce(i);if(Object.keys(a).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))})),n>1){var o=Ce(i-1);Object.keys(o).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))}))}return r},Le=function(){var e,t=Object.keys(Pe.navigationSteps).length;Pe.navigationSteps[t]={};var n=Ae();null===(e=a.onMarkStep)||void 0===e||e.call(a,"",Object.keys(n))},Ue=function(e){var t,n,r,i,o,s,c;if(Pe.finalMarkToStepsMap[e]){!function(e){var t=Pe.navigationSteps,n=Pe.finalMarkToStepsMap,r=Object.keys(t).length;if(0!==r){var i=r-1,a=Ce(i);if(a&&n[e]){var o=n[e];o&&Object.keys(o).forEach((function(e){if(a[e]){var n=Ce(i)||{};n[e]=!1,t[i]=n}if(r>1){var o=i-1,s=Ce(o);s[e]&&(s[e]=!1,t[o]=s)}}))}}}(e);var u=Pe.finalMarkToStepsMap[e];Object.keys(u).forEach((function(t){var n=u[t];n.forEach(Me),Promise.all(n.map((function(n){return function(e,t,n,r){return new(n||(n=Promise))((function(e,t){function i(e){try{o(r.next(e))}catch(e){t(e)}}function a(e){try{o(r.throw(e))}catch(e){t(e)}}function o(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,a)}o((r=r.apply(undefined,[])).next())}))}(0,0,void 0,(function(){return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}(this,(function(r){switch(r.label){case 0:return[4,De(n,t,e)];case 1:return r.sent(),[2]}}))}))}))).catch((function(){}))}))}else r=e,i=Pe.navigationSteps,o=Object.keys(i).length,(c=Ce(s=(o>0?o:1)-1)||[])[r]=!0,i[s]=c,function(e){var t,n=null!==(t=Pe.startMarkToStepsMap[e])&&void 0!==t?t:[];Object.keys(n).forEach((function(e){Pe.active[e]||(Pe.active[e]=!0)}))}(e);if(a.enableNavigationTracking){var l=Ae();null===(t=a.onMarkStep)||void 0===t||t.call(a,e,Object.keys(l))}else null===(n=a.onMarkStep)||void 0===n||n.call(a,e,Object.keys(Pe.active))},Re=function(e){u.mark(p+e),Ue(e)},qe=function(e){0===u.getEntriesByName(p+e).length&&(u.mark(p+e),Ue(e))},Fe=0,ze=function(){function e(e){if(void 0===e&&(e={}),this.v="9.0.0-rc.3",a.analyticsTracker=e.analyticsTracker,a.isResourceTiming=!!e.resourceTiming,a.isElementTiming=!!e.elementTiming,a.maxTime=e.maxMeasureTime||a.maxTime,a.reportOptions=e.reportOptions||a.reportOptions,a.steps=e.steps,a.onMarkStep=e.onMarkStep,a.enableNavigationTracking=e.enableNavigationTracking,m()){"PerformanceObserver"in o&&Ne(),void 0!==document.hidden&&document.addEventListener("visibilitychange",_);var t=function(){if(!m())return{};var e=u.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,n=e.responseEnd;return{fetchTime:n-e.fetchStart,workerTime:e.workerStart>0?n-e.workerStart:0,totalTime:n-e.requestStart,downloadTime:n-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart,redirectTime:e.redirectEnd-e.redirectStart}}();R("navigationTiming",t),t.redirectTime&&q({attribution:{},name:"RT",rating:U("RT",t.redirectTime),value:t.redirectTime}),R("networkInformation",function(){if("connection"in c){var e=c.connection;return"object"!=typeof e?{}:(f=e.effectiveType,v=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}}()),c&&c.storage&&"function"==typeof c.storage.estimate&&c.storage.estimate().then(Ie),a.steps&&a.steps&&(Pe.startMarkToStepsMap={},Pe.finalMarkToStepsMap={},Pe.active={},Pe.navigationSteps={},Object.entries(a.steps).forEach((function(e){var t,n,r=e[0],i=e[1].marks,a=i[0],o=i[1],s=null!==(n=Pe.startMarkToStepsMap[a])&&void 0!==n?n:{};if(s[r]=!0,Pe.startMarkToStepsMap[a]=s,Pe.finalMarkToStepsMap[o]){var c=Pe.finalMarkToStepsMap[o][a]||[];c.push(r),Pe.finalMarkToStepsMap[o][a]=c}else Pe.finalMarkToStepsMap[o]=((t={})[a]=[r],t)})))}}return e.prototype.start=function(e){m()&&!g[e]&&(g[e]=!0,u.mark("mark_".concat(e,"_start")))},e.prototype.end=function(e,t,n){if(void 0===t&&(t={}),void 0===n&&(n=!0),m()&&g[e]){u.mark("mark_".concat(e,"_end")),delete g[e];var r=function(e){u.measure(e,"mark_".concat(e,"_start"),"mark_".concat(e,"_end"));var t=u.getEntriesByName(e).pop();return t&&"measure"===t.entryType?t.duration:-1}(e);n&&R(e,O(r),t)}},e.prototype.endPaint=function(e,t){var n=this;setTimeout((function(){n.end(e,t)}))},e.prototype.clear=function(e){delete g[e],u.clearMarks&&(u.clearMarks("mark_".concat(e,"_start")),u.clearMarks("mark_".concat(e,"_end")))},e.prototype.markNTBT=function(){var e=this;this.start("ntbt"),y.value=0,clearTimeout(Fe),Fe=setTimeout((function(){e.end("ntbt",{},!1),q({attribution:{},name:"NTBT",rating:U("NTBT",y.value),value:y.value}),y.value=0}),2e3)},e}()},426:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.iterator;var n={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},r=Object.assign,i={};function a(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}function o(){}function s(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}a.prototype.isReactComponent={},a.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},a.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},o.prototype=a.prototype;var c=s.prototype=new o;c.constructor=s,r(c,a.prototype),c.isPureReactComponent=!0;Array.isArray,Object.prototype.hasOwnProperty;var u={current:null};t.useCallback=function(e,t){return u.current.useCallback(e,t)},t.useEffect=function(e,t){return u.current.useEffect(e,t)},t.useRef=function(e){return u.current.useRef(e)}},784:(e,t,n)=>{"use strict";e.exports=n(426)},353:function(e,t,n){var r;!function(i,a){"use strict";var o="function",s="undefined",c="object",u="string",l="major",d="model",p="name",m="type",f="vendor",v="version",g="architecture",b="console",h="mobile",w="tablet",y="smarttv",T="wearable",k="embedded",_="Amazon",S="Apple",E="ASUS",x="BlackBerry",O="Browser",j="Chrome",N="Firefox",I="Google",P="Huawei",M="LG",B="Microsoft",C="Motorola",D="Opera",A="Samsung",L="Sharp",U="Sony",R="Xiaomi",q="Zebra",F="Facebook",z="Chromium OS",K="Mac OS",$=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Q=function(e,t){return typeof e===u&&-1!==W(t).indexOf(W(e))},W=function(e){return e.toLowerCase()},H=function(e,t){if(typeof e===u)return e=e.replace(/^\\s\\s*/,""),typeof t===s?e:e.substring(0,350)},V=function(e,t){for(var n,r,i,s,u,l,d=0;d<t.length&&!u;){var p=t[d],m=t[d+1];for(n=r=0;n<p.length&&!u&&p[n];)if(u=p[n++].exec(e))for(i=0;i<m.length;i++)l=u[++r],typeof(s=m[i])===c&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=l?l.replace(s[1],s[2]):a:this[s[0]]=l?s[1].call(this,l,s[2]):a:4===s.length&&(this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):a):this[s]=l||a;d+=2}},J=function(e,t){for(var n in t)if(typeof t[n]===c&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(Q(t[n][r],e))return"?"===n?a:n}else if(Q(t[n],e))return"?"===n?a:n;return e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},G={browser:[[/\\b(?:crmo|crios)\\/([\\w\\.]+)/i],[v,[p,"Chrome"]],[/edg(?:e|ios|a)?\\/([\\w\\.]+)/i],[v,[p,"Edge"]],[/(opera mini)\\/([-\\w\\.]+)/i,/(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,/(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i],[p,v],[/opios[\\/ ]+([\\w\\.]+)/i],[v,[p,D+" Mini"]],[/\\bopr\\/([\\w\\.]+)/i],[v,[p,D]],[/(kindle)\\/([\\w\\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,/(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,/(?:ms|\\()(ie) ([\\w\\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,/(heytap|ovi)browser\\/([\\d\\.]+)/i,/(weibo)__([\\d\\.]+)/i],[p,v],[/(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i],[v,[p,"UC"+O]],[/microm.+\\bqbcore\\/([\\w\\.]+)/i,/\\bqbcore\\/([\\w\\.]+).+microm/i],[v,[p,"WeChat(Win) Desktop"]],[/micromessenger\\/([\\w\\.]+)/i],[v,[p,"WeChat"]],[/konqueror\\/([\\w\\.]+)/i],[v,[p,"Konqueror"]],[/trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i],[v,[p,"IE"]],[/ya(?:search)?browser\\/([\\w\\.]+)/i],[v,[p,"Yandex"]],[/(avast|avg)\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 Secure "+O],v],[/\\bfocus\\/([\\w\\.]+)/i],[v,[p,N+" Focus"]],[/\\bopt\\/([\\w\\.]+)/i],[v,[p,D+" Touch"]],[/coc_coc\\w+\\/([\\w\\.]+)/i],[v,[p,"Coc Coc"]],[/dolfin\\/([\\w\\.]+)/i],[v,[p,"Dolphin"]],[/coast\\/([\\w\\.]+)/i],[v,[p,D+" Coast"]],[/miuibrowser\\/([\\w\\.]+)/i],[v,[p,"MIUI "+O]],[/fxios\\/([-\\w\\.]+)/i],[v,[p,N]],[/\\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+O]],[/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 "+O],v],[/(comodo_dragon)\\/([\\w\\.]+)/i],[[p,/_/g," "],v],[/(electron)\\/([\\w\\.]+) safari/i,/(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i],[p,v],[/(metasr)[\\/ ]?([\\w\\.]+)/i,/(lbbrowser)/i,/\\[(linkedin)app\\]/i],[p],[/((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i],[[p,F],v],[/(kakao(?:talk|story))[\\/ ]([\\w\\.]+)/i,/(naver)\\(.*?(\\d+\\.[\\w\\.]+).*\\)/i,/safari (line)\\/([\\w\\.]+)/i,/\\b(line)\\/([\\w\\.]+)\\/iab/i,/(chromium|instagram)[\\/ ]([-\\w\\.]+)/i],[p,v],[/\\bgsa\\/([\\w\\.]+) .*safari\\//i],[v,[p,"GSA"]],[/musical_ly(?:.+app_?version\\/|_)([\\w\\.]+)/i],[v,[p,"TikTok"]],[/headlesschrome(?:\\/([\\w\\.]+)| )/i],[v,[p,j+" Headless"]],[/ wv\\).+(chrome)\\/([\\w\\.]+)/i],[[p,j+" WebView"],v],[/droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i],[v,[p,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i],[p,v],[/version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i],[v,[p,"Mobile Safari"]],[/version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i],[v,p],[/webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i],[p,[v,J,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\\/([\\w\\.]+)/i],[p,v],[/(navigator|netscape\\d?)\\/([-\\w\\.]+)/i],[[p,"Netscape"],v],[/mobile vr; rv:([\\w\\.]+)\\).+firefox/i],[v,[p,N+" Reality"]],[/ekiohf.+(flow)\\/([\\w\\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,/(firefox)\\/([\\w\\.]+)/i,/(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,/(links) \\(([\\w\\.]+)/i,/panasonic;(viera)/i],[p,v],[/(cobalt)\\/([\\w\\.]+)/i],[p,[v,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,W]],[/((?:i[346]|x)86)[;\\)]/i],[[g,"ia32"]],[/\\b(aarch64|arm(v?8e?l?|_?64))\\b/i],[[g,"arm64"]],[/\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i],[[g,/ower/,"",W]],[/(sun4\\w)[;\\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i],[[g,W]]],device:[[/\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[f,A],[m,w]],[/\\b((?:s[cgp]h|gt|sm)-\\w+|sc[g-]?[\\d]+a?|galaxy nexus)/i,/samsung[- ]([-\\w]+)/i,/sec-(sgh\\w+)/i],[d,[f,A],[m,h]],[/(?:\\/|\\()(ip(?:hone|od)[\\w, ]*)(?:\\/|;)/i],[d,[f,S],[m,h]],[/\\((ipad);[-\\w\\),; ]+apple/i,/applecoremedia\\/[\\w\\.]+ \\((ipad)/i,/\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i],[d,[f,S],[m,w]],[/(macintosh);/i],[d,[f,S]],[/\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i],[d,[f,L],[m,h]],[/\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i],[d,[f,P],[m,w]],[/(?:huawei|honor)([-\\w ]+)[;\\)]/i,/\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i],[d,[f,P],[m,h]],[/\\b(poco[\\w ]+)(?: bui|\\))/i,/\\b; (\\w+) build\\/hm\\1/i,/\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,/\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,/\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,h]],[/\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,w]],[/; (\\w+) bui.+ oppo/i,/\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i],[d,[f,"OPPO"],[m,h]],[/vivo (\\w+)(?: bui|\\))/i,/\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i],[d,[f,"Vivo"],[m,h]],[/\\b(rmx[12]\\d{3})(?: bui|;|\\))/i],[d,[f,"Realme"],[m,h]],[/\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,/\\bmot(?:orola)?[- ](\\w*)/i,/((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i],[d,[f,C],[m,h]],[/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],[d,[f,C],[m,w]],[/((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[f,M],[m,w]],[/(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,/\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,/\\blg-?([\\d\\w]+) bui/i],[d,[f,M],[m,h]],[/(ideatab[-\\w ]+)/i,/lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i],[d,[f,"Lenovo"],[m,w]],[/(?:maemo|nokia).*(n900|lumia \\d+)/i,/nokia[-_ ]?([-\\w\\.]*)/i],[[d,/_/g," "],[f,"Nokia"],[m,h]],[/(pixel c)\\b/i],[d,[f,I],[m,w]],[/droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i],[d,[f,I],[m,h]],[/droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i],[d,[f,U],[m,h]],[/sony tablet [ps]/i,/\\b(?:sony)?sgp\\w+(?: bui|\\))/i],[[d,"Xperia Tablet"],[f,U],[m,w]],[/ (kb2005|in20[12]5|be20[12][59])\\b/i,/(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i],[d,[f,"OnePlus"],[m,h]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\\))/i,/(kf[a-z]+)( bui|\\)).+silk\\//i],[d,[f,_],[m,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i],[[d,/(.+)/g,"Fire Phone $1"],[f,_],[m,h]],[/(playbook);[-\\w\\),; ]+(rim)/i],[d,f,[m,w]],[/\\b((?:bb[a-f]|st[hv])100-\\d)/i,/\\(bb10; (\\w+)/i],[d,[f,x],[m,h]],[/(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i],[d,[f,E],[m,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],[d,[f,E],[m,h]],[/(nexus 9)/i],[d,[f,"HTC"],[m,w]],[/(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,/(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\\.))|sony(?!-bra))[-_ ]?([-\\w]*)/i],[f,[d,/_/g," "],[m,h]],[/droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i],[d,[f,"Acer"],[m,w]],[/droid.+; (m[1-5] note) bui/i,/\\bmz-([-\\w]{2,})/i],[d,[f,"Meizu"],[m,h]],[/(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,/(hp) ([\\w ]+\\w)/i,/(asus)-?(\\w+)/i,/(microsoft); (lumia[\\w ]+)/i,/(lenovo)[-_ ]?([-\\w]+)/i,/(jolla)/i,/(oppo) ?([\\w ]+) bui/i],[f,d,[m,h]],[/(kobo)\\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\\/([\\w\\.]+)/i,/(nook)[\\w ]+build\\/(\\w+)/i,/(dell) (strea[kpr\\d ]*[\\dko])/i,/(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,/(trinity)[- ]*(t\\d{3}) bui/i,/(gigaset)[- ]+(q\\w{1,9}) bui/i,/(vodafone) ([\\w ]+)(?:\\)| bui)/i],[f,d,[m,w]],[/(surface duo)/i],[d,[f,B],[m,w]],[/droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i],[d,[f,"Fairphone"],[m,h]],[/(u304aa)/i],[d,[f,"AT&T"],[m,h]],[/\\bsie-(\\w*)/i],[d,[f,"Siemens"],[m,h]],[/\\b(rct\\w+) b/i],[d,[f,"RCA"],[m,w]],[/\\b(venue[\\d ]{2,7}) b/i],[d,[f,"Dell"],[m,w]],[/\\b(q(?:mv|ta)\\w+) b/i],[d,[f,"Verizon"],[m,w]],[/\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i],[d,[f,"Barnes & Noble"],[m,w]],[/\\b(tm\\d{3}\\w+) b/i],[d,[f,"NuVision"],[m,w]],[/\\b(k88) b/i],[d,[f,"ZTE"],[m,w]],[/\\b(nx\\d{3}j) b/i],[d,[f,"ZTE"],[m,h]],[/\\b(gen\\d{3}) b.+49h/i],[d,[f,"Swiss"],[m,h]],[/\\b(zur\\d{3}) b/i],[d,[f,"Swiss"],[m,w]],[/\\b((zeki)?tb.*\\b) b/i],[d,[f,"Zeki"],[m,w]],[/\\b([yr]\\d{2}) b/i,/\\b(dragon[- ]+touch |dt)(\\w{5}) b/i],[[f,"Dragon Touch"],d,[m,w]],[/\\b(ns-?\\w{0,9}) b/i],[d,[f,"Insignia"],[m,w]],[/\\b((nxa|next)-?\\w{0,9}) b/i],[d,[f,"NextBook"],[m,w]],[/\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],d,[m,h]],[/\\b(lvtel\\-)?(v1[12]) b/i],[[f,"LvTel"],d,[m,h]],[/\\b(ph-1) /i],[d,[f,"Essential"],[m,h]],[/\\b(v(100md|700na|7011|917g).*\\b) b/i],[d,[f,"Envizen"],[m,w]],[/\\b(trio[-\\w\\. ]+) b/i],[d,[f,"MachSpeed"],[m,w]],[/\\btu_(1491) b/i],[d,[f,"Rotor"],[m,w]],[/(shield[\\w ]+) b/i],[d,[f,"Nvidia"],[m,w]],[/(sprint) (\\w+)/i],[f,d,[m,h]],[/(kin\\.[onetw]{3})/i],[[d,/\\./g," "],[f,B],[m,h]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i],[d,[f,q],[m,w]],[/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],[d,[f,q],[m,h]],[/smart-tv.+(samsung)/i],[f,[m,y]],[/hbbtv.+maple;(\\d+)/i],[[d,/^/,"SmartTV"],[f,A],[m,y]],[/(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i],[[f,M],[m,y]],[/(apple) ?tv/i],[f,[d,S+" TV"],[m,y]],[/crkey/i],[[d,j+"cast"],[f,I],[m,y]],[/droid.+aft(\\w)( bui|\\))/i],[d,[f,_],[m,y]],[/\\(dtv[\\);].+(aquos)/i,/(aquos-tv[\\w ]+)\\)/i],[d,[f,L],[m,y]],[/(bravia[\\w ]+)( bui|\\))/i],[d,[f,U],[m,y]],[/(mitv-\\w{5}) bui/i],[d,[f,R],[m,y]],[/Hbbtv.*(technisat) (.*);/i],[f,d,[m,y]],[/\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,/hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w\\+ ]*; *([\\w\\d][^;]*);([^;]*)/i],[[f,H],[d,H],[m,y]],[/\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i],[[m,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,d,[m,b]],[/droid.+; (shield) bui/i],[d,[f,"Nvidia"],[m,b]],[/(playstation [345portablevi]+)/i],[d,[f,U],[m,b]],[/\\b(xbox(?: one)?(?!; xbox))[\\); ]/i],[d,[f,B],[m,b]],[/((pebble))app/i],[f,d,[m,T]],[/(watch)(?: ?os[,\\/]|\\d,\\d\\/)[\\d\\.]+/i],[d,[f,S],[m,T]],[/droid.+; (glass) \\d/i],[d,[f,I],[m,T]],[/droid.+; (wt63?0{2,3})\\)/i],[d,[f,q],[m,T]],[/(quest( 2| pro)?)/i],[d,[f,F],[m,T]],[/(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i],[f,[m,k]],[/(aeobc)\\b/i],[d,[f,_],[m,k]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i],[d,[m,h]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i],[d,[m,w]],[/\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i],[[m,w]],[/(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i],[[m,h]],[/(android[-\\w\\. ]{0,9});.+buil/i],[d,[f,"Generic"]]],engine:[[/windows.+ edge\\/([\\w\\.]+)/i],[v,[p,"EdgeHTML"]],[/webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i],[v,[p,"Blink"]],[/(presto)\\/([\\w\\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,/ekioh(flow)\\/([\\w\\.]+)/i,/(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,/(icab)[\\/ ]([23]\\.[\\d\\.]+)/i,/\\b(libweb)/i],[p,v],[/rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i],[v,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,v],[/(windows) nt 6\\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,/(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i],[p,[v,J,X]],[/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],[[p,"Windows"],[v,J,X]],[/ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,/ios;fbsv\\/([\\d\\.]+)/i,/cfnetwork\\/.+darwin/i],[[v,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\\w\\. ]*)/i,/(macintosh|mac_powerpc\\b)(?!.+haiku)/i],[[p,K],[v,/_/g,"."]],[/droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i],[v,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,/(blackberry)\\w*\\/([\\w\\.]*)/i,/(tizen|kaios)[\\/ ]([\\w\\.]+)/i,/\\((series40);/i],[p,v],[/\\(bb(10);/i],[v,[p,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i],[v,[p,"Symbian"]],[/mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i],[v,[p,N+" OS"]],[/web0s;.+rt(tv)/i,/\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i],[v,[p,"webOS"]],[/watch(?: ?os[,\\/]|\\d,\\d\\/)([\\d\\.]+)/i],[v,[p,"watchOS"]],[/crkey\\/([\\d\\.]+)/i],[v,[p,j+"cast"]],[/(cros) [\\w]+(?:\\)| ([\\w\\.]+)\\b)/i],[[p,z],v],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\\/(\\d+\\.[\\w\\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\\);]+)/i,/\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,/(mint)[\\/\\(\\) ]?(\\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,/(hurd|linux) ?([\\w\\.]*)/i,/(gnu) ?([\\w\\.]*)/i,/\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,/(haiku) (\\w+)/i],[p,v],[/(sunos) ?([\\w\\.\\d]*)/i],[[p,"Solaris"],v],[/((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,/(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,/\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\\w\\.]*)/i],[p,v]]},Z=function(e,t){if(typeof e===c&&(t=e,e=a),!(this instanceof Z))return new Z(e,t).getResult();var n=typeof i!==s&&i.navigator?i.navigator:a,r=e||(n&&n.userAgent?n.userAgent:""),b=n&&n.userAgentData?n.userAgentData:a,y=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(G,t):G,T=n&&n.userAgent==r;return this.getBrowser=function(){var e,t={};return t[p]=a,t[v]=a,V.call(t,r,y.browser),t[l]=typeof(e=t[v])===u?e.replace(/[^\\d\\.]/g,"").split(".")[0]:a,T&&n&&n.brave&&typeof n.brave.isBrave==o&&(t[p]="Brave"),t},this.getCPU=function(){var e={};return e[g]=a,V.call(e,r,y.cpu),e},this.getDevice=function(){var e={};return e[f]=a,e[d]=a,e[m]=a,V.call(e,r,y.device),T&&!e[m]&&b&&b.mobile&&(e[m]=h),T&&"Macintosh"==e[d]&&n&&typeof n.standalone!==s&&n.maxTouchPoints&&n.maxTouchPoints>2&&(e[d]="iPad",e[m]=w),e},this.getEngine=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.engine),e},this.getOS=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.os),T&&!e[p]&&b&&"Unknown"!=b.platform&&(e[p]=b.platform.replace(/chrome os/i,z).replace(/macos/i,K)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===u&&e.length>350?H(e,350):e,this},this.setUA(r),this};Z.VERSION="1.0.35",Z.BROWSER=$([p,v,l]),Z.CPU=$([g]),Z.DEVICE=$([d,f,m,b,h,y,w,T,k]),Z.ENGINE=Z.OS=$([p,v]),typeof t!==s?(e.exports&&(t=e.exports=Z),t.UAParser=Z):n.amdO?(r=function(){return Z}.call(t,n,t,e))===a||(e.exports=r):typeof i!==s&&(i.UAParser=Z);var Y=typeof i!==s&&(i.jQuery||i.Zepto);if(Y&&!Y.ua){var ee=new Z;Y.ua=ee.getResult(),Y.ua.get=function(){return ee.getUA()},Y.ua.set=function(e){ee.setUA(e);var t=ee.getResult();for(var n in t)Y.ua[n]=t[n]}}}("object"==typeof window?window:this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{ActionType:()=>f,AmplitudePlatformName:()=>g,AnalyticsEventImportance:()=>l,AnalyticsQueries:()=>e,AuthStatus:()=>b,ComponentType:()=>m,IThresholdTier:()=>Jt,MetricType:()=>d,PlatformName:()=>v,SessionActions:()=>h,SessionAutomatedEvents:()=>w,SessionRank:()=>y,SubjectType:()=>p,UserTypeCommerce:()=>c,UserTypeInsto:()=>i,UserTypeRetail:()=>t,UserTypeRetailBusinessBanking:()=>s,UserTypeRetailEmployeeInternal:()=>a,UserTypeRetailEmployeePersonal:()=>o,UserTypeWallet:()=>u,automatedEvents:()=>xn,automatedMappingConfig:()=>In,clearMarkEntry:()=>Vn,clearPerformanceMarkEntries:()=>Xn,config:()=>A,createEventConfig:()=>On,createNewSpan:()=>Ln,createNewTrace:()=>Un,device:()=>W,endPerfMark:()=>Jn,exposeExperiment:()=>wn,flushQueue:()=>or,generateUUID:()=>V,getAnalyticsHeaders:()=>sr,getReferrerData:()=>le,getTracingHeaders:()=>An,getTracingId:()=>Dn,getUrlHostname:()=>pe,getUrlParams:()=>me,getUrlPathname:()=>fe,getUserContext:()=>ar,identify:()=>Tn,identifyFlow:()=>xe,identity:()=>H,identityFlow:()=>Se,incrementUjNavigation:()=>an,init:()=>yn,initNextJsTrackPageview:()=>_n,initTrackPageview:()=>kn,isEventKeyFormatValid:()=>we,isSessionEnded:()=>pt,location:()=>re,logEvent:()=>$t,logMetric:()=>Ht,logPageView:()=>on,logTrace:()=>Rn,markNTBT:()=>tn,markStep:()=>nn,markStepOnce:()=>rn,onVisibilityChange:()=>ln,optIn:()=>En,optOut:()=>Sn,perfMark:()=>Wn,persistentData:()=>oe,postMessage:()=>K,recordSessionDuration:()=>pn,removeFromIdentifyFlow:()=>Ee,savePersistentData:()=>st,sendScheduledEvents:()=>Bt,setBreadcrumbs:()=>ie,setConfig:()=>U,setLocation:()=>ae,setPagePath:()=>ve,setPageview:()=>Kt,setPersistentData:()=>se,setSessionStart:()=>dt,setTime:()=>Ue,startPerfMark:()=>Hn,timeStone:()=>Le,useEventLogger:()=>Yn,useLogEventOnMount:()=>tr,usePerformanceMarks:()=>rr});let e=function(e){return e.fbclid="fbclid",e.gclid="gclid",e.msclkid="msclkid",e.ptclid="ptclid",e.ttclid="ttclid",e.utm_source="utm_source",e.utm_medium="utm_medium",e.utm_campaign="utm_campaign",e.utm_term="utm_term",e.utm_content="utm_content",e}({});const t=0,i=1,a=2,o=3,s=4,c=5,u=6;let l=function(e){return e.low="low",e.high="high",e}({}),d=function(e){return e.count="count",e.rate="rate",e.gauge="gauge",e.distribution="distribution",e.histogram="histogram",e}({}),p=function(e){return e.commerce_merchant="commerce_merchant",e.device="device",e.edp_fingerprint_id="edp_fingerprint_id",e.nft_user="nft_user",e.user="user",e.wallet_user="wallet_user",e.uuid="user_uuid",e}({}),m=function(e){return e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon",e}({}),f=function(e){return e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e}({}),v=function(e){return e.unknown="unknown",e.web="web",e.android="android",e.ios="ios",e.mobile_web="mobile_web",e.tablet_web="tablet_web",e.server="server",e.windows="windows",e.macos="macos",e.extension="extension",e}({}),g=function(e){return e.web="Web",e.ios="iOS",e.android="Android",e}({}),b=function(e){return e[e.notLoggedIn=0]="notLoggedIn",e[e.loggedIn=1]="loggedIn",e}({}),h=function(e){return e.ac="ac",e.af="af",e.ah="ah",e.al="al",e.am="am",e.ar="ar",e.as="as",e}({}),w=function(e){return e.pv="pv",e}({}),y=function(e){return e.xs="xs",e.s="s",e.m="m",e.l="l",e.xl="xl",e.xxl="xxl",e}({});const T="https://analytics-service-dev.cbhq.net",k=3e5,_=5e3,S="analytics-db",E="experiment-exposure-db",x="Analytics SDK:",O=Object.values(e),j="pageview",N="session_duration",I={navigationTiming:{eventName:"perf_navigation_timing"},redirectTime:{eventName:"perf_redirect_time"},RT:{eventName:"perf_redirect_time"},TTFB:{eventName:"perf_time_to_first_byte"},networkInformation:{eventName:"perf_network_information"},storageEstimate:{eventName:"perf_storage_estimate"},FCP:{eventName:"perf_first_contentful_paint"},FID:{eventName:"perf_first_input_delay"},LCP:{eventName:"perf_largest_contentful_paint"},CLS:{eventName:"perf_cumulative_layout_shift"},TBT:{eventName:"perf_total_blocking_time"},NTBT:{eventName:"perf_navigation_total_blocking_time"},INP:{eventName:"perf_interact_to_next_paint"},ET:{eventName:"perf_element_timing"},userJourneyStep:{eventName:"perf_user_journey_step"}},P="1",M="web";function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}const C=/^(https?:\\/\\/)/;function D(e){return{eventsEndpoint:e+"/amp",metricsEndPoint:e+"/metrics",exposureEndpoint:e+"/track-exposures",tracesEndpoint:e+"/traces"}}const A=B({authCookie:"logged_in",amplitudeApiKey:"",batchEventsPeriod:_,batchEventsThreshold:30,batchMetricsPeriod:_,batchMetricsThreshold:30,batchTracesPeriod:_,batchTracesThreshold:30,headers:{},interactionManager:null,isAlwaysAuthed:!1,isProd:!1,isInternalApplication:!1,onError:(e,t)=>{console.error(x,e,t)},platform:v.unknown,projectName:"",ricTimeoutScheduleEvent:1e3,ricTimeoutSetDevice:500,showDebugLogging:!1,trackUserId:!1,version:null,apiEndpoint:T},D(T),{steps:{}}),L=[].reduce(((e,t)=>n=>e(t(n))),(e=>{if(!e.isProd)return e.isInternalApplication?(e.apiEndpoint="https://analytics-service-internal-dev.cbhq.net",B({},e,D(e.apiEndpoint))):e;const t=(e=>e.apiEndpoint?C.test(e.apiEndpoint)?e.apiEndpoint:`https://${e.apiEndpoint}`:e.isInternalApplication?"https://analytics-service-internal.cbhq.net":"https://as.coinbase.com")(e);return B({},e,{apiEndpoint:t},D(t))})),U=e=>{const{batchEventsThreshold:t,batchMetricsThreshold:n,batchTracesThreshold:r}=e,i=[t,n,r];for(const e of i)if((e||0)>30){console.warn("You are setting the threshhold for the batch limit to be greater than 30. This may cause request overload.");break}Object.assign(A,L(e))},R=[v.web,v.mobile_web,v.tablet_web];function q(){return"android"===A.platform}function F(){return"ios"===A.platform}function z(){return R.includes(A.platform)}function K(e){if(z()&&navigator&&"serviceWorker"in navigator&&navigator.serviceWorker.controller)try{navigator.serviceWorker.controller.postMessage(e)}catch(e){e instanceof Error&&A.onError(e)}}var $=n(353),Q=n.n($);const W={amplitudeOSName:null,amplitudeOSVersion:null,amplitudeDeviceModel:null,amplitudePlatform:null,browserName:null,browserMajor:null,osName:null,userAgent:null,width:null,height:null},H={countryCode:null,deviceId:null,device_os:null,isOptOut:!1,languageCode:null,locale:null,jwt:null,session_lcc_id:null,userAgent:null,userId:null},V=e=>e?(e^16*Math.random()>>e/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,V),J=()=>A.isAlwaysAuthed||!!H.userId,X=()=>{const e={};return H.countryCode&&(e.country_code=H.countryCode),e},G=()=>{const{platform:e}=A;if(e===v.web)switch(!0){case window.matchMedia("(max-width: 560px)").matches:return v.mobile_web;case window.matchMedia("(max-width: 1024px, min-width: 561px)").matches:return v.tablet_web}return e},Z=()=>{var e,t,n,r,i;z()?("requestIdleCallback"in window?window.requestIdleCallback(ne,{timeout:A.ricTimeoutSetDevice}):ne(),W.amplitudePlatform=g.web,W.userAgent=(null==(e=window)||null==(e=e.navigator)?void 0:e.userAgent)||null,ee({height:null!=(t=null==(n=window)?void 0:n.innerHeight)?t:null,width:null!=(r=null==(i=window)?void 0:i.innerWidth)?r:null})):F()?(W.amplitudePlatform=g.ios,W.userAgent=H.userAgent,W.userAgent&&ne()):q()&&(W.userAgent=H.userAgent,W.amplitudePlatform=g.android,W.userAgent&&ne())},Y=e=>{Object.assign(H,e),z()&&K({identity:{isAuthed:!!H.userId,locale:H.locale||null}})},ee=e=>{W.height=e.height,W.width=e.width},te=()=>{U({platform:G()}),z()&&K({config:{platform:A.platform}})},ne=()=>{var e;performance.mark&&performance.mark("ua_parser_start");const t=new(Q())(null!=(e=W.userAgent)?e:"").getResult();W.browserName=t.browser.name||null,W.browserMajor=t.browser.major||null,W.osName=t.os.name||null,W.amplitudeOSName=W.browserName,W.amplitudeOSVersion=W.browserMajor,W.amplitudeDeviceModel=W.osName,K({device:{browserName:W.browserName,osName:W.osName}}),performance.mark&&(performance.mark("ua_parser_end"),performance.measure("ua_parser","ua_parser_start","ua_parser_end"))},re={breadcrumbs:[],initialUAAData:{},pageKey:"",pageKeyRegex:{},pagePath:"",prevPageKey:"",prevPagePath:""};function ie(e){Object.assign(re,{breadcrumbs:e})}function ae(e){Object.assign(re,e)}const oe={eventId:0,sequenceNumber:0,sessionId:0,lastEventTime:0,sessionStart:0,sessionUUID:null,userId:null,ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0};function se(e){Object.assign(oe,e)}function ce(){var e,t;return null!=(e=null==(t=document)?void 0:t.referrer)?e:""}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ue.apply(this,arguments)}const le=()=>{const e=ce();if(!e)return{};const t=new URL(e);return t.hostname===pe()?{}:{referrer:e,referring_domain:t.hostname}},de=()=>{const e=new URLSearchParams(me()),t={};return O.forEach((n=>{e.has(n)&&(t[n]=(e.get(n)||"").toLowerCase())})),t},pe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.hostname)||""},me=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.search)||""},fe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.pathname)||""},ve=()=>{const e=A.overrideWindowLocation?re.pagePath:fe()+me();e&&e!==re.pagePath&&(e!==re.pagePath&&ge(),re.pagePath=e,re.pageKeyRegex&&Object.keys(re.pageKeyRegex).some((e=>{if(re.pageKeyRegex[e].test(re.pagePath))return re.pageKey=e,!0})))},ge=()=>{if(z()){const e=ce();if(!re.prevPagePath&&e){const t=new URL(e);if(t.hostname===pe())return void(re.prevPagePath=t.pathname)}}re.prevPagePath=re.pagePath,re.prevPageKey=re.pageKey},be=e=>{z()&&Object.assign(e,z()?(Object.keys(re.initialUAAData).length>0||(new URLSearchParams(me()),re.initialUAAData=ue({},(()=>{const e={};return O.forEach((t=>{oe[t]&&(e[t]=oe[t])})),e})(),de(),le())),re.initialUAAData):re.initialUAAData)},he=/^[a-zd]+(_[a-zd]+)*$/;function we(e){return he.test(e)}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ye.apply(this,arguments)}const Te=["action","component_type","component_name","context","logging_id"],ke=["num_non_hardware_accounts","ujs"],_e="ujs_",Se={};function Ee(e){e.forEach((e=>{ke.includes(e)&&delete Se[e]}))}function xe(e){var t;const n=Object.entries(e).reduce(((e,t)=>{const[n,r]=t;return!Te.includes(n)&&ke.includes(n)?we(n)?ye({},e,{[n]:r}):(A.onError(new Error("IdentityFlow property names must have snake case format"),{[n]:r}),e):e}),{});null!=(t=n.ujs)&&t.length&&(n.ujs=n.ujs.map((e=>`${_e}${e}`))),Object.assign(Se,n)}function Oe(){return A.platform!==v.unknown||(A.onError(new Error("SDK platform not initialized")),!1)}const je={eventsQueue:[],eventsScheduled:!1,metricsQueue:[],metricsScheduled:!1,tracesQueue:[],tracesScheduled:!1};function Ne(e){Object.assign(je,e)}const Ie={ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0},Pe={ac:20,af:5,ah:1,al:1,am:0,ar:10,as:20},Me={pv:25},Be={xs:0,s:1,m:1,l:2,xl:2,xxl:2},Ce=e=>e<15?y.xs:e<60?y.s:e<240?y.m:e<960?y.l:e<3840?y.xl:y.xxl,De=e=>{Object.assign(Ie,e)};function Ae(){return(new Date).getTime()}const Le={timeStart:Ae(),timeOnPagePath:0,timeOnPageKey:0,prevTimeOnPagePath:0,prevTimeOnPageKey:0,sessionDuration:0,sessionEnd:0,sessionStart:0,prevSessionDuration:0};function Ue(e){Object.assign(Le,e)}const Re=(e,t)=>t.some((t=>e instanceof t));let qe,Fe;const ze=new WeakMap,Ke=new WeakMap,$e=new WeakMap,Qe=new WeakMap,We=new WeakMap;let He={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Ke.get(e);if("objectStoreNames"===t)return e.objectStoreNames||$e.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Je(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Ve(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Fe||(Fe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(Xe(this),e),Je(ze.get(this))}:function(...e){return Je(t.apply(Xe(this),e))}:function(e,...n){const r=t.call(Xe(this),e,...n);return $e.set(r,e.sort?e.sort():[e]),Je(r)}:(e instanceof IDBTransaction&&function(e){if(Ke.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=()=>{t(),r()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)}));Ke.set(e,t)}(e),Re(e,qe||(qe=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,He):e);var t}function Je(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",a)},i=()=>{t(Je(e.result)),r()},a=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",a)}));return t.then((t=>{t instanceof IDBCursor&&ze.set(t,e)})).catch((()=>{})),We.set(t,e),t}(e);if(Qe.has(e))return Qe.get(e);const t=Ve(e);return t!==e&&(Qe.set(e,t),We.set(t,e)),t}const Xe=e=>We.get(e),Ge=["get","getKey","getAll","getAllKeys","count"],Ze=["put","add","delete","clear"],Ye=new Map;function et(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Ye.get(t))return Ye.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Ze.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Ge.includes(n))return;const a=async function(e,...t){const a=this.transaction(e,i?"readwrite":"readonly");let o=a.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&a.done]))[0]};return Ye.set(t,a),a}var tt;tt=He,He={...tt,get:(e,t,n)=>et(e,t)||tt.get(e,t,n),has:(e,t)=>!!et(e,t)||tt.has(e,t)};const nt={isReady:!1,idbKeyval:null};function rt(e){Object.assign(nt,e)}const it={},at=async e=>{if(!nt.idbKeyval)return Promise.resolve(null);try{return await nt.idbKeyval.get(e)}catch(e){return A.onError(new Error("IndexedDB:Get:InternalError")),Promise.resolve(null)}},ot=async(e,t)=>{if(nt.idbKeyval)try{await nt.idbKeyval.set(e,t)}catch(e){A.onError(new Error("IndexedDB:Set:InternalError"))}},st=()=>{"server"!==A.platform&&(se({sessionStart:Le.sessionStart,ac:Ie.ac,af:Ie.af,ah:Ie.ah,al:Ie.al,am:Ie.am,ar:Ie.ar,as:Ie.as,pv:Ie.pv}),H.userId&&se({userId:H.userId}),ot(S,oe))},ct="rgb(5,177,105)",ut=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`%c ${x}`,a=`color:${ct};font-size:11px;`,o=`Importance: ${r}`;console.group(i,a,t,o),n.forEach((e=>{e.event_type?console.log(e.event_type,e):console.log(e)})),console.groupEnd()},lt=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`color:${ct};font-size:11px;`,a=`%c ${x}`,o=`Importance: ${r}`;console.log(a,i,t,n,o)},dt=()=>{const e=Ae();oe.sessionId&&oe.lastEventTime&&oe.sessionUUID&&!pt(e)||(oe.sessionId=e,oe.sessionUUID=V(),Ue({sessionStart:e}),lt({metricName:"Started new session:",data:{persistentData:oe,timeStone:Le}})),oe.lastEventTime=e},pt=e=>e-oe.lastEventTime>18e5;function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mt.apply(this,arguments)}const ft=e=>{var t;(e=>{switch(e.action){case f.click:Ie.ac+=1;break;case f.focus:Ie.af+=1;break;case f.hover:Ie.ah+=1;break;case f.move:Ie.am+=1;break;case f.scroll:Ie.al+=1;break;case f.search:Ie.ar+=1;break;case f.select:Ie.as+=1}})(t=e),t.event_type!==j?t.event_type===N&&((e=>{if(!e.session_rank)return;const t=e.session_rank;Object.values(h).forEach((e=>{Ie.sqs+=Ie[e]*Pe[e]})),Object.values(w).forEach((e=>{Ie.sqs+=Ie[e]*Me[e]})),Ie.sqs*=Be[t]})(t),Object.assign(t,Ie),De({ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0})):Ie.pv+=1;const n=e.event_type;delete e.event_type;const r=e.deviceId?e.deviceId:null,i=e.timestamp;return delete e.timestamp,se({eventId:oe.eventId+1}),se({sequenceNumber:oe.sequenceNumber+1}),dt(),st(),{device_id:H.deviceId||r||null,user_id:H.userId,timestamp:i,event_id:oe.eventId,session_id:oe.sessionId||-1,event_type:n,version_name:A.version||null,platform:W.amplitudePlatform,os_name:W.amplitudeOSName,os_version:W.amplitudeOSVersion,device_model:W.amplitudeDeviceModel,language:H.languageCode,event_properties:mt({},e,{session_uuid:oe.sessionUUID,height:W.height,width:W.width}),user_properties:X(),uuid:V(),library:{name:"@cbhq/client-analytics",version:"10.6.0"},sequence_number:oe.sequenceNumber,user_agent:W.userAgent||H.userAgent}},vt=e=>e.map((e=>ft(e)));function gt(){return gt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gt.apply(this,arguments)}const bt=e=>e.map((e=>(e=>{const t=e.tags||{},n=gt({authed:J()?"true":"false",platform:A.platform},t,{project_name:A.projectName,version_name:A.version||null});return{metric_name:e.metricName,page_path:e.pagePath||null,value:e.value,tags:n,type:e.metricType}})(e))),ht=e=>0!==je.metricsQueue.length&&(je.metricsQueue.length>=A.batchMetricsThreshold||(je.metricsScheduled||(je.metricsScheduled=!0,setTimeout((()=>{je.metricsScheduled=!1,e(bt(je.metricsQueue)),je.metricsQueue=[]}),A.batchMetricsPeriod)),!1)),wt=e=>0!==je.tracesQueue.length&&(je.tracesQueue.length>=A.batchTracesThreshold||(je.tracesScheduled||(je.tracesScheduled=!0,setTimeout((()=>{je.tracesScheduled=!1,e(je.tracesQueue),je.tracesQueue=[]}),A.batchTracesPeriod)),!1)),yt=e=>{var t;z()&&null!=(t=window)&&t.requestIdleCallback?window.requestIdleCallback(e,{timeout:A.ricTimeoutScheduleEvent}):(q()||F())&&A.interactionManager?A.interactionManager.runAfterInteractions(e):e()};function Tt(){return Tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tt.apply(this,arguments)}const kt="application/x-www-form-urlencoded; charset=UTF-8",_t=e=>{const{data:t,importance:n,isJSON:r,onError:i,url:a}=e,o=r?"application/json":kt,s=n||l.low,c=r?JSON.stringify(t):new URLSearchParams(t).toString();function u(){const e=new XMLHttpRequest;e.open("POST",a,!0),Object.keys(A.headers||{}).forEach((t=>{e.setRequestHeader(t,A.headers[t])})),e.setRequestHeader("Content-Type",kt),H.jwt&&e.setRequestHeader("authorization",`Bearer ${H.jwt}`),e.send(c)}if(!z()||r||!("sendBeacon"in navigator)||s!==l.low||A.headers&&0!==Object.keys(A.headers).length)if(z()&&!r)u();else{const e=Tt({},A.headers,{"Content-Type":o});H.jwt&&(e.Authorization=`Bearer ${H.jwt}`),fetch(a,{method:"POST",mode:"no-cors",headers:e,body:c}).catch((e=>{i(e,{context:"AnalyticsSDKApiError"})}))}else{const e=new Blob([c],{type:kt});try{navigator.sendBeacon.bind(navigator)(a,e)||u()}catch(e){console.error(e),u()}}};var St=n(762),Et=n.n(St);const xt=(e,t,n)=>{const r=e||"";return Et()("2"+r+t+n)};function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ot.apply(this,arguments)}class jt extends Error{constructor(e){super(e),this.name="CircularJsonReference",this.message=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}}class Nt extends jt{constructor(...e){super(...e),this.name="DomReferenceInAnalyticsEvent"}}function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},It.apply(this,arguments)}const Pt=(e,t=l.low)=>{var n;e&&je.eventsQueue.push(e),nt.isReady&&(!A.trackUserId||H.userId?(t===l.high||(n=Mt,0!==je.eventsQueue.length&&(je.eventsQueue.length>=A.batchEventsThreshold||(je.eventsScheduled||(je.eventsScheduled=!0,setTimeout((()=>{je.eventsScheduled=!1,n(vt(je.eventsQueue)),je.eventsQueue=[]}),A.batchEventsPeriod)),0))))&&Bt():je.eventsQueue.length>10&&(A.trackUserId=!1,A.onError(new Error("userId not set in Logged-in"))))},Mt=(e,t=l.low)=>{if(H.isOptOut||0===e.length)return;let n;try{n=JSON.stringify(e)}catch(t){const r=e.map((e=>e.event_type)).join(", "),[i,a]=(e=>{try{const n=[];for(const r of e){const e=Ot({},r);r.event_properties&&(e.event_properties=Ot({},e.event_properties,{currentTarget:null,target:null,relatedTarget:null,_dispatchInstances:null,_targetInst:null,view:(t=r.event_properties.view,["string","number","boolean"].includes(typeof t)?r.event_properties.view:null)})),n.push(e)}return[!0,JSON.stringify(n)]}catch(e){return[!1,""]}var t})(e);if(!i)return void A.onError(new jt(t instanceof Error?t.message:"unknown"),{listEventType:r});n=a,A.onError(new Nt("Found DOM element reference"),{listEventType:r,stringifiedEventData:n})}const r=Ae().toString(),i=It({},{e:n,v:"2",upload_time:r},{client:A.amplitudeApiKey,checksum:xt(A.amplitudeApiKey,n,r)});_t({url:A.eventsEndpoint,data:i,importance:t,onError:A.onError}),ut({metricName:"Batch Events",data:e,importance:t})},Bt=()=>{Mt(vt(je.eventsQueue)),Ne({eventsQueue:[]})};function Ct(){return Ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ct.apply(this,arguments)}const Dt=Object.values(f),At=Object.values(m),Lt=e=>Dt.includes(e)?e:f.unknown,Ut=e=>At.includes(e)?e:m.unknown,Rt=(e,t,n)=>{const r={auth:J()?b.loggedIn:b.notLoggedIn,action:Lt(e),component_type:Ut(t),logging_id:n,platform:A.platform,project_name:A.projectName};return"number"==typeof H.userTypeEnum&&(r.user_type_enum=H.userTypeEnum),r},qt=e=>{const t=Ae();if(!e)return A.onError(new Error("missing logData")),Ct({},Rt(f.unknown,m.unknown),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});const n=Ct({},e,Rt(e.action,e.componentType,e.loggingId),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});return delete n.componentType,delete n.loggingId,n},Ft={blacklistRegex:[],isEnabled:!1};function zt(){return{page_key:re.pageKey,page_path:re.pagePath,prev_page_key:re.prevPageKey,prev_page_path:re.prevPagePath}}function Kt(e){Object.assign(Ft,e)}function $t(e,t,n=l.low){if(H.isOptOut)return;if(!Oe())return;const r=qt(t);!function(e){Ft.isEnabled&&(ve(),Object.assign(e,zt()))}(r),be(r),function(e){Object.keys(Se).length>0&&Object.assign(e,Se)}(r),r.has_double_fired=!1,r.event_type=e,n===l.high?Pt(r,n):yt((()=>{Pt(r)}))}function Qt(e,t=!1){t?_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Metrics",data:e})}function Wt(){return Wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wt.apply(this,arguments)}function Ht(e){if(!Oe())return;v.server!==A.platform&&!e.pagePath&&re.pagePath&&(e.pagePath=re.pagePath);const t=Object.keys(Se).length?Wt({},e.tags,Se):e.tags;t&&Object.assign(e,{tags:t}),je.metricsQueue.push(e),ht(Qt)&&(Qt(bt(je.metricsQueue)),je.metricsQueue=[])}function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(this,arguments)}let Jt=function(e){return e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable",e}({});function Xt(e){return e.toLowerCase()}let Gt={};const Zt=(e,t)=>{null!=A&&A.onMarkStep&&A.onMarkStep(e,t),xe({ujs:t})};let Yt;const en={Perfume:()=>{},markStep:e=>{},markStepOnce:e=>{},incrementUjNavigation:()=>{}},tn=()=>{z()&&Yt&&Yt.markNTBT&&Yt.markNTBT()},nn=e=>{z()&&Yt&&en.markStep&&en.markStep(e)},rn=e=>{z()&&Yt&&en.markStepOnce&&en.markStepOnce(e)},an=()=>{z()&&Yt&&en.incrementUjNavigation&&en.incrementUjNavigation()};function on(e={callMarkNTBT:!0}){"unknown"!==A.platform&&(Ft.blacklistRegex.some((e=>e.test(fe())))||($t(j,{action:f.render,componentType:m.page}),e.callMarkNTBT&&tn()))}let sn=!1,cn=!1;const un=e=>{sn=!e.persisted},ln=(e,t="hidden",n=!1)=>{cn||(addEventListener("pagehide",un),addEventListener("beforeunload",(()=>{})),cn=!0),addEventListener("visibilitychange",(({timeStamp:n})=>{document.visibilityState===t&&e({timeStamp:n,isUnloading:sn})}),{capture:!0,once:n})},dn=36e3;function pn(){const e=pt(Ae());if(e&&(O.forEach((e=>{oe[e]&&delete oe[e]})),st()),!oe.lastEventTime||!Le.sessionStart||!e)return;const t=Math.round((oe.lastEventTime-Le.sessionStart)/1e3);if(t<1||t>dn)return;const n=Ce(t);$t(N,{action:f.measurement,componentType:m.page,session_duration:t,session_end:oe.lastEventTime,session_start:Le.sessionStart,session_rank:n})}function mn(){return mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mn.apply(this,arguments)}const fn=[],vn=[],gn=()=>{const e=fn.shift();e&&e()},bn=()=>{const e=vn.shift();e&&e()};let hn={};function wn(e){const t=function(e){return{test_name:e.testName,group_name:e.group,subject_id:e.subjectId,exposed_at:Ae(),subject_type:e.subjectType,platform:A.platform}}(e);hn[e.testName]=hn[e.testName]||0,hn[e.testName]+k>Ae()?lt({metricName:`Event: exposeExperiment ${e.testName} not sent`,data:t}):(hn[e.testName]=Ae(),ot(E,hn),lt({metricName:`Event: exposeExperiment ${e.testName} sent`,data:t}),_t({url:A.exposureEndpoint,data:[t],onError:(t,n)=>{hn[e.testName]=0,ot(E,hn),A.onError(t,n)},isJSON:!0,importance:l.high}))}const yn=e=>{var t,r,i;U(e),z()&&(H.languageCode=(null==(t=navigator)?void 0:t.languages[0])||(null==(r=navigator)?void 0:r.language)||""),te(),(()=>{var e;if(z()&&null!=(e=window)&&e.indexedDB){const e=function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:a}={}){const o=indexedDB.open(e,t),s=Je(o);return r&&o.addEventListener("upgradeneeded",(e=>{r(Je(o.result),e.oldVersion,e.newVersion,Je(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{a&&e.addEventListener("close",(()=>a())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}("keyval-store",1,{upgrade(e){e.createObjectStore("keyval")}});rt({idbKeyval:{get:async t=>(await e).get("keyval",t),set:async(t,n)=>(await e).put("keyval",n,t),delete:async t=>(await e).delete("keyval",t),keys:async()=>(await e).getAllKeys("keyval")}})}else rt({idbKeyval:{get:async e=>new Promise((t=>{t(it[e])})),set:async(e,t)=>new Promise((n=>{it[e]=t,n(e)})),delete:async e=>new Promise((()=>{delete it[e]})),keys:async()=>new Promise((e=>{e(Object.keys(it))}))}})})(),lt({metricName:"Initialized Analytics:",data:{deviceId:H.deviceId}}),fn.push((()=>{Pt()})),(async()=>{const e=await at(S);rt({isReady:!0}),gn(),e&&(bn(),se({eventId:e.eventId||oe.eventId,sequenceNumber:e.sequenceNumber||oe.sequenceNumber,sessionId:e.sessionId||oe.sessionId,lastEventTime:e.lastEventTime||oe.lastEventTime,sessionUUID:e.sessionUUID||oe.sessionUUID}),function(e){se(mn({},function(e){const t={};return O.forEach((n=>{e[n]&&(t[n]=e[n])})),t}(e),de()))}(e),Ue({sessionStart:e.sessionStart||oe.sessionStart}),De({ac:e.ac||Ie.ac,af:e.af||Ie.af,ah:e.ah||Ie.ah,al:e.al||Ie.al,am:e.am||Ie.am,ar:e.ar||Ie.ar,as:e.as||Ie.as,pv:e.pv||Ie.pv}),A.trackUserId&&Y({userId:e.userId||H.userId}),pn(),lt({metricName:"Initialized Analytics IndexedDB:",data:e}))})(),async function(){at(E).then((e=>{hn=null!=e?e:{}})).catch((e=>{e instanceof Error&&A.onError(e)}))}(),Z(),z()&&(ln((()=>{se({lastEventTime:Ae()}),st(),Bt()}),"hidden"),ln((()=>{pn()}),"visible")),z()&&(i=()=>{var e,t,n,r;te(),ee({width:null!=(e=null==(t=window)?void 0:t.innerWidth)?e:null,height:null!=(n=null==(r=window)?void 0:r.innerHeight)?n:null})},addEventListener("resize",(()=>{requestAnimationFrame((()=>{i()}))}))),(()=>{if(z())try{const e=n(2);en.markStep=e.markStep,en.markStepOnce=e.markStepOnce,en.incrementUjNavigation=e.incrementUjNavigation,Yt=new e.Perfume({analyticsTracker:e=>{const{data:t,attribution:n,metricName:r,navigatorInformation:i,rating:a}=e,o=I[r],s=(null==n?void 0:n.category)||null;if(!o&&!s)return;const c=(null==i?void 0:i.deviceMemory)||0,u=(null==i?void 0:i.hardwareConcurrency)||0,l=(null==i?void 0:i.isLowEndDevice)||!1,p=(null==i?void 0:i.isLowEndExperience)||!1,v=(null==i?void 0:i.serviceWorkerStatus)||"unsupported",g=Vt({deviceMemory:c,hardwareConcurrency:u,isLowEndDevice:l,isLowEndExperience:p,serviceWorkerStatus:v},Gt),b={is_low_end_device:l,is_low_end_experience:p,page_key:re.pageKey||"",save_data:t.saveData||!1,service_worker:v,is_perf_metric:!0};if("navigationTiming"===r)t&&"number"==typeof t.redirectTime&&Ht({metricName:I.redirectTime.eventName,metricType:d.histogram,tags:b,value:t.redirectTime||0});else if("TTFB"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),Ht({metricName:I.TTFB.eventName,metricType:d.histogram,tags:Vt({},b),value:t}),a&&Ht({metricName:`perf_web_vitals_ttfb_${a}`,metricType:d.count,tags:b,value:1});else if("networkInformation"===r)null!=t&&t.effectiveType&&(Gt=t,$t(o.eventName,{action:f.measurement,componentType:m.page,networkInformationDownlink:t.downlink,networkInformationEffectiveType:t.effectiveType,networkInformationRtt:t.rtt,networkInformationSaveData:t.saveData,navigatorDeviceMemory:c,navigatorHardwareConcurrency:u}));else if("storageEstimate"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page},t,g)),Ht({metricName:"perf_storage_estimate_caches",metricType:d.histogram,tags:b,value:t.caches}),Ht({metricName:"perf_storage_estimate_indexed_db",metricType:d.histogram,tags:b,value:t.indexedDB});else if("CLS"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,score:100*t||null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_cls_${a}`,metricType:d.count,tags:b,value:1});else if("FID"===r){const e=(null==n?void 0:n.performanceEntry)||null,r=parseInt((null==e?void 0:e.processingStart)||"");$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,processingStart:null!=e&&e.processingStart?r:null,startTime:null!=e&&e.startTime?parseInt(e.startTime):null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_fidVitals_${a}`,metricType:d.count,tags:b,value:1})}else"userJourneyStep"===r?($t("perf_user_journey_step",Vt({action:f.measurement,componentType:m.page,duration:t||null,rating:null!=a?a:null,step_name:(null==n?void 0:n.stepName)||""},g)),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}_vitals_${a}`,metricType:d.count,tags:b,value:1}),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}`,metricType:d.distribution,tags:b,value:t||null})):I[r]&&t&&($t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),a&&(Ht({metricName:`perf_web_vitals_${Xt(r)}_${a}`,metricType:d.count,tags:b,value:1}),"LCP"===r&&Ht({metricName:`perf_web_vitals_${Xt(r)}`,metricType:d.distribution,tags:b,value:t})))},maxMeasureTime:3e4,steps:A.steps,onMarkStep:Zt})}catch(e){e instanceof Error&&A.onError(e)}})()},Tn=e=>{Y(e),e.userAgent&&Z(),lt({metricName:"Identify:",data:{countryCode:H.countryCode,deviceId:H.deviceId,userId:H.userId}})},kn=({blacklistRegex:e,pageKeyRegex:t,browserHistory:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.listen((()=>{on()}))},_n=({blacklistRegex:e,pageKeyRegex:t,nextJsRouter:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.events.on("routeChangeComplete",(()=>{on()}))},Sn=()=>{Y({isOptOut:!0}),ot(S,{})},En=()=>{Y({isOptOut:!1})},xn={Button:{label:"cb_button",uuid:"e921a074-40e6-4371-8700-134d5cd633e6",componentType:m.button}};function On(e,t,n){return{componentName:e,actions:t,data:n}}function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jn.apply(this,arguments)}function Nn(e,t,n){const{componentName:r,data:i}=n;$t(e.label,jn({componentType:e.componentType,action:t,loggingId:e.uuid,component_name:r},i))}const In={actionMapping:{onPress:f.click,onHover:f.hover},handlers:{Button:{[f.click]:e=>Nn(xn.Button,f.click,e),[f.hover]:e=>Nn(xn.Button,f.hover,e)}}};function Pn(e,t=!1){t?_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Traces",data:e})}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mn.apply(this,arguments)}const Bn=1e6;function Cn(e){return e*Bn}function Dn(e=function(){var e;return null==(e=window)?void 0:e.crypto}()){const t=new Uint32Array(2);return null==e||e.getRandomValues(t),((BigInt(t[0])<<BigInt(32))+BigInt(t[1])).toString()}function An(e,t){return{"x-datadog-origin":"rum","x-datadog-parent-id":t,"x-datadog-sampling-priority":"1","x-datadog-trace-id":e}}function Ln(e){var t;const{name:n,traceId:r,spanId:i,start:a,duration:o,resource:s,meta:c}=e;return{duration:o?Cn(o):0,name:n,resource:s,service:A.projectName,span_id:null!=i?i:Dn(),start:a?Cn(a):0,trace_id:null!=r?r:Dn(),parent_id:P,type:M,meta:Mn({platform:A.platform},re.pageKey?{page_key:re.pageKey}:{},null!=(t=Se.ujs)&&t.length?{last_ujs:Se.ujs[Se.ujs.length-1]}:{},null!=c?c:{})}}function Un(e){return[Ln(e)]}function Rn(e,t){Oe()&&function(e){return e.length>0}(e)&&(t&&function(e,t){e.forEach((e=>function(e,t){const n=Mn({},e.meta,t.meta),r={start:t.start?Cn(t.start):e.start,duration:t.duration?Cn(t.duration):e.duration};Object.assign(e,t,Mn({meta:n},r))}(e,t)))}(e,t),je.tracesQueue.push(e),wt(Pn)&&(Pn(je.tracesQueue),je.tracesQueue=[]))}function qn(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Fn(){return Fn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fn.apply(this,arguments)}function zn(){return void 0!==typeof window&&"performance"in window&&"mark"in performance&&"getEntriesByName"in performance}function Kn(e,t){return`perf_${e}${null!=t&&t.label?`_${t.label}`:""}`}function $n(e,t,n){return`${Kn(e,n)}__${t}`}let Qn={};function Wn(e,t,n){if(!zn())return;const r=$n(e,t,n);if(performance.mark(r),"end"===t){const t=Kn(e,n);!function(e,t,n){try{performance.measure(e,t,n)}catch(e){A.onError(e)}}(t,$n(e,"start",n),r);const i=performance.getEntriesByName(t).pop();i&&Ht(Fn({metricName:e,metricType:d.distribution,value:i.duration},null!=n&&n.tags?{tags:n.tags}:{}))}}function Hn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]||(Wn(e,"start",t),Qn[n]=!0)}function Vn(e,t){const n=$n(e,"start",t),r=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(Qn,[n].map(qn));Qn=r}function Jn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]&&(Wn(e,"end",t),Vn(e,t))}function Xn(){zn()&&(performance.clearMarks(),Qn={})}var Gn=n(784);function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zn.apply(this,arguments)}function Yn(e,t,n=l.low){const r=(0,Gn.useRef)(t);return(0,Gn.useEffect)((()=>{r.current=t}),[t]),(0,Gn.useCallback)((t=>{$t(e,Zn({},r.current,t),n)}),[e,n])}function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},er.apply(this,arguments)}function tr(e,t,n=l.low){(0,Gn.useEffect)((()=>{const r=er({},t,{action:f.render});$t(e,r,n)}),[])}function nr(){return nr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nr.apply(this,arguments)}const rr=function(e,t){return{markStartPerf:(0,Gn.useCallback)((()=>Hn(e,t)),[e,t]),markEndPerf:(0,Gn.useCallback)((n=>Jn(e,nr({},t,n))),[e,t])}};function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ir.apply(this,arguments)}function ar(){return Object.entries(ir({},Se,zt(),{sessionUUID:oe.sessionUUID,userId:oe.userId})).reduce(((e,t)=>{return null!=(n=t[1])&&""!==n?ir({},e,{[t[0]]:t[1]}):e;var n}),{})}async function or(){return new Promise((e=>{Mt(vt(je.eventsQueue)),Qt(bt(je.metricsQueue),!0),Pn(je.tracesQueue,!0),Ne({eventsQueue:[],metricsQueue:[],tracesQueue:[]}),e()}))}function sr(){return{"X-CB-Device-ID":H.deviceId||"unknown","X-CB-Is-Logged-In":H.userId?"true":"false","X-CB-Pagekey":re.pageKey||"unknown","X-CB-UJS":(e=Se.ujs,void 0===e||0===e.length?"":e.join(",")),"X-CB-Platform":A.platform||"unknown","X-CB-Project-Name":A.projectName||"unknown","X-CB-Session-UUID":oe.sessionUUID||"unknown","X-CB-Version-Name":A.version?String(A.version):"unknown"};var e}})(),r})()}));',pA=()=>new Promise((e,t)=>{if(window.ClientAnalytics)return e();try{const n=document.createElement("script");n.textContent=hA,n.type="text/javascript",document.head.appendChild(n),mA(),document.head.removeChild(n),e()}catch{console.error("Failed to execute inlined telemetry script"),t()}}),mA=()=>{var e,t,n;if(typeof window<"u"){const r=(n=(e=W.config.get().deviceId)!==null&&e!==void 0?e:(t=window.crypto)===null||t===void 0?void 0:t.randomUUID())!==null&&n!==void 0?n:"";if(window.ClientAnalytics){const{init:i,identify:s,PlatformName:o}=window.ClientAnalytics;i({isProd:!0,amplitudeApiKey:"c66737ad47ec354ced777935b0af822e",platform:o.web,projectName:"base_account_sdk",showDebugLogging:!1,version:"1.0.0",apiEndpoint:"https://cca-lite.coinbase.com"}),s({deviceId:r}),W.config.set({deviceId:r})}}},ke={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},Gl={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},vg="Unspecified error message.",yA="Unspecified server error.";function vf(e,t=vg){if(e&&Number.isInteger(e)){const n=e.toString();if(Vl(Gl,n))return Gl[n].message;if(xg(e))return yA}return t}function bA(e){if(!Number.isInteger(e))return!1;const t=e.toString();return!!(Gl[t]||xg(e))}function gA(e,{shouldIncludeStack:t=!1}={}){const n={};if(e&&typeof e=="object"&&!Array.isArray(e)&&Vl(e,"code")&&bA(e.code)){const r=e;n.code=r.code,r.message&&typeof r.message=="string"?(n.message=r.message,Vl(r,"data")&&(n.data=r.data)):(n.message=vf(n.code),n.data={originalError:Ih(e)})}else n.code=ke.rpc.internal,n.message=Ah(e,"message")?e.message:vg,n.data={originalError:Ih(e)};return t&&(n.stack=Ah(e,"stack")?e.stack:void 0),n}function xg(e){return e>=-32099&&e<=-32e3}function Ih(e){return e&&typeof e=="object"&&!Array.isArray(e)?Object.assign({},e):e}function Vl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ah(e,t){return typeof e=="object"&&e!==null&&t in e&&typeof e[t]=="string"}const G={rpc:{parse:e=>It(ke.rpc.parse,e),invalidRequest:e=>It(ke.rpc.invalidRequest,e),invalidParams:e=>It(ke.rpc.invalidParams,e),methodNotFound:e=>It(ke.rpc.methodNotFound,e),internal:e=>It(ke.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return It(t,e)},invalidInput:e=>It(ke.rpc.invalidInput,e),resourceNotFound:e=>It(ke.rpc.resourceNotFound,e),resourceUnavailable:e=>It(ke.rpc.resourceUnavailable,e),transactionRejected:e=>It(ke.rpc.transactionRejected,e),methodNotSupported:e=>It(ke.rpc.methodNotSupported,e),limitExceeded:e=>It(ke.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Qr(ke.provider.userRejectedRequest,e),unauthorized:e=>Qr(ke.provider.unauthorized,e),unsupportedMethod:e=>Qr(ke.provider.unsupportedMethod,e),disconnected:e=>Qr(ke.provider.disconnected,e),chainDisconnected:e=>Qr(ke.provider.chainDisconnected,e),unsupportedChain:e=>Qr(ke.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new _g(t,n,r)}}};function It(e,t){const[n,r]=Eg(t);return new xf(e,n||vf(e),r)}function Qr(e,t){const[n,r]=Eg(t);return new _g(e,n||vf(e),r)}function Eg(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}class xf extends Error{constructor(t,n,r){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=t,r!==void 0&&(this.data=r)}}class _g extends xf{constructor(t,n,r){if(!wA(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,n,r)}}function wA(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function Ph(e){return typeof e=="object"&&e!==null&&"code"in e&&"data"in e&&e.code===-32090&&typeof e.data=="object"&&e.data!==null&&"type"in e.data&&e.data.type==="INSUFFICIENT_FUNDS"}function Sg(e){return typeof e=="object"&&e!==null&&"details"in e}function vA(e){try{const t=JSON.parse(e.details);return new xf(t.code,t.message,t.data)}catch{return null}}function Ig(){return e=>e}const zs=Ig(),xA=Ig();function vn(e){return Math.floor(e)}const Ag=/^[0-9]*$/,Pg=/^[a-f0-9]*$/;function cr(e){return Ef(crypto.getRandomValues(new Uint8Array(e)))}function Ef(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function ea(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>Number.parseInt(t,16)))}function us(e,t=!1){const n=e.toString("hex");return zs(t?`0x${n}`:n)}function Xc(e){return us(Kl(e),!0)}function Wt(e){return xA(e.toString(10))}function ii(e){return zs(`0x${BigInt(e).toString(16)}`)}function kg(e){return e.startsWith("0x")||e.startsWith("0X")}function _f(e){return kg(e)?e.slice(2):e}function Cg(e){return kg(e)?`0x${e.slice(2)}`:`0x${e}`}function oc(e){if(typeof e!="string")return!1;const t=_f(e).toLowerCase();return Pg.test(t)}function Wl(e,t=!1){if(typeof e=="string"){const n=_f(e).toLowerCase();if(Pg.test(n))return zs(t?`0x${n}`:n)}throw G.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function Sf(e,t=!1){let n=Wl(e,!1);return n.length%2===1&&(n=zs(`0${n}`)),t?zs(`0x${n}`):n}function Hn(e){if(typeof e=="string"){const t=_f(e).toLowerCase();if(oc(t)&&t.length===40)return Cg(t)}throw G.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}function Kl(e){if(ce.isBuffer(e))return e;if(typeof e=="string"){if(oc(e)){const t=Sf(e,!1);return ce.from(t,"hex")}return ce.from(e,"utf8")}throw G.rpc.invalidParams(`Not binary data: ${String(e)}`)}function ls(e){if(typeof e=="number"&&Number.isInteger(e))return vn(e);if(typeof e=="string"){if(Ag.test(e))return vn(Number(e));if(oc(e))return vn(Number(BigInt(Sf(e,!0))))}throw G.rpc.invalidParams(`Not an integer: ${String(e)}`)}function ts(e){if(e!==null&&(typeof e=="bigint"||_A(e)))return BigInt(e.toString(10));if(typeof e=="number")return BigInt(ls(e));if(typeof e=="string"){if(Ag.test(e))return BigInt(e);if(oc(e))return BigInt(Sf(e,!0))}throw G.rpc.invalidParams(`Not an integer: ${String(e)}`)}function EA(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw G.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}function _A(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}const SA=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app.
70
+
71
+ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,IA=()=>{let e;return{getCrossOriginOpenerPolicy:()=>e===void 0?"undefined":e,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){e="non-browser-env";return}try{const t=`${window.location.origin}${window.location.pathname}`,n=await fetch(t,{method:"HEAD"});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=n.headers.get("Cross-Origin-Opener-Policy");e=r??"null",e==="same-origin"&&console.error(SA)}catch(t){console.error("Error checking Cross-Origin-Opener-Policy:",t.message),e="error"}}}},{checkCrossOriginOpenerPolicy:AA,getCrossOriginOpenerPolicy:PA}=IA();async function ds(e,t){const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),r=await window.fetch(t,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Wi,"X-Cbw-Sdk-Platform":gg}}),{result:i,error:s}=await r.json();if(s)throw s;return i}function kA(){return globalThis.coinbaseWalletExtension}function CA(){var e,t;try{const n=globalThis;return(e=n.ethereum)!==null&&e!==void 0?e:(t=n.top)===null||t===void 0?void 0:t.ethereum}catch{return}}function BA({metadata:e,preference:t}){var n,r;const{appName:i,appLogoUrl:s,appChainIds:o}=e;if(t.options!=="smartWalletOnly"){const c=kA();if(c)return(n=c.setAppInfo)===null||n===void 0||n.call(c,i,s,o,t),c}const a=CA();if(a?.isCoinbaseBrowser)return(r=a.setAppInfo)===null||r===void 0||r.call(a,i,s,o,t),a}function OA(e){if(!e||typeof e!="object"||Array.isArray(e))throw G.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;if(typeof t!="string"||t.length===0)throw G.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw G.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e});switch(t){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw G.provider.unsupportedMethod()}}function TA(e){if(e){if(!["all","smartWalletOnly","eoaOnly"].includes(e.options))throw new Error(`Invalid options: ${e.options}`);if(e.attribution&&e.attribution.auto!==void 0&&e.attribution.dataSuffix!==void 0)throw new Error("Attribution cannot contain both auto and dataSuffix properties");if(e.telemetry&&typeof e.telemetry!="boolean")throw new Error("Telemetry must be a boolean")}}function kh(e){if(typeof e!="function")throw new Error("toAccount is not a function")}const $A="https://keys.coinbase.com/connect",Bg="https://rpc.wallet.coinbase.com",Ch="https://www.walletlink.org",NA="https://go.cb-w.com/walletlink";var re;(function(e){e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon"})(re||(re={}));var ie;(function(e){e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e.error="error"})(ie||(ie={}));var se;(function(e){e.low="low",e.high="high"})(se||(se={}));function oe(e,t,n){var r,i,s,o;window.ClientAnalytics&&((r=window.ClientAnalytics)===null||r===void 0||r.logEvent(e,Object.assign(Object.assign({},t),{sdkVersion:Wi,appName:(s=(i=W.config.get().metadata)===null||i===void 0?void 0:i.appName)!==null&&s!==void 0?s:"",appOrigin:window.location.origin,appPreferredSigner:(o=W.config.get().preference)===null||o===void 0?void 0:o.options}),n))}const MA=()=>{oe("communicator.popup_setup.started",{action:ie.unknown,componentType:re.unknown},se.high)},LA=()=>{oe("communicator.popup_setup.completed",{action:ie.unknown,componentType:re.unknown},se.high)},RA=()=>{oe("communicator.popup_unload.received",{action:ie.unknown,componentType:re.unknown},se.high)},If=({snackbarContext:e})=>{oe(`snackbar.${e}.shown`,{action:ie.render,componentType:re.modal,snackbarContext:e},se.high)},fi=({snackbarContext:e,snackbarAction:t})=>{oe(`snackbar.${e}.action_clicked`,{action:ie.click,componentType:re.button,snackbarContext:e,snackbarAction:t},se.high)},UA='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function Og(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(UA)),document.documentElement.appendChild(e)}function Tg(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Tg(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function fs(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Tg(e))&&(r&&(r+=" "),r+=t);return r}function jA(){try{return window.frameElement!==null}catch{return!1}}function FA(){try{return jA()&&window.top?window.top.location:window.location}catch{return window.location}}function DA(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window?.navigator)===null||e===void 0?void 0:e.userAgent)}function $g(){var e,t;return(t=(e=window?.matchMedia)===null||e===void 0?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)!==null&&t!==void 0?t:!1}const zA=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",HA="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",qA="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class Ng{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=$g()}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",t.appendChild(this.root),this.render()}presentItem(t){const n=this.nextItemKey++;return this.items.set(n,t),this.render(),()=>{this.items.delete(n),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Ds(ae("div",null,ae(Mg,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([t,n])=>ae(GA,Object.assign({},n,{key:t}))))),this.root)}}const Mg=e=>ae("div",{class:fs("-cbwsdk-snackbar-container")},ae("style",null,zA),ae("div",{class:"-cbwsdk-snackbar"},e.children)),GA=({autoExpand:e,message:t,menuItems:n})=>{const[r,i]=ba(!0),[s,o]=ba(e??!1);lg(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return ae("div",{class:fs("-cbwsdk-snackbar-instance",r&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},ae("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},ae("img",{src:HA,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",ae("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),ae("div",{class:"-gear-container"},!s&&ae("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ae("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),ae("img",{src:qA,class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&ae("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map((c,u)=>ae("div",{class:fs("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:u},ae("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ae("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),ae("span",{class:fs("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))},Lg="M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z";class VA{constructor(){this.attached=!1,this.snackbar=new Ng}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,n=document.createElement("div");n.className="-cbwsdk-css-reset",t.appendChild(n),this.snackbar.attach(n),this.attached=!0,Og()}showConnecting(t){let n;return t.isUnlinkedErrorState?n={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]}:n={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:t.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:Lg,defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]},this.snackbar.presentItem(n)}}const Bh=420,Oh=700,WA={isRed:!1,info:"Retry",svgWidth:"10",svgHeight:"11",path:Lg,defaultFillRule:"evenodd",defaultClipRule:"evenodd"},KA="Popup was blocked. Try again.";let No=null;function ZA(e){const t=(window.innerWidth-Bh)/2+window.screenX,n=(window.innerHeight-Oh)/2+window.screenY;QA(e);function r(){const s=`wallet_${crypto.randomUUID()}`,o=window.open(e,s,`width=${Bh}, height=${Oh}, left=${t}, top=${n}`);return o?.focus(),o||null}let i=r();if(!i){const s=Af();return new Promise((o,a)=>{If({snackbarContext:"popup_blocked"}),s.presentItem({autoExpand:!0,message:KA,menuItems:[Object.assign(Object.assign({},WA),{onClick:()=>{fi({snackbarContext:"popup_blocked",snackbarAction:"confirm"}),i=r(),i?o(i):a(G.rpc.internal("Popup window was blocked")),s.clear()}})]})})}return Promise.resolve(i)}function YA(e){e&&!e.closed&&e.close()}function QA(e){const t={sdkName:gg,sdkVersion:Wi,origin:window.location.origin,coop:PA()};for(const[n,r]of Object.entries(t))e.searchParams.has(n)||e.searchParams.append(n,r.toString())}function Af(){if(!No){const e=document.createElement("div");e.className="-cbwsdk-css-reset",document.body.appendChild(e),No=new Ng,No.attach(e)}return No}class JA{constructor({url:t=$A,metadata:n,preference:r}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=c=>{if(c.origin!==this.url.origin)return;const u=c.data;i(u)&&(s(u),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{YA(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(G.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(MA(),this.popup=await ZA(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(()=>{this.disconnect(),RA()}).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:Wi,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw G.rpc.internal();return LA(),this.popup})),this.url=new URL(t),this.metadata=n,this.preference=r}}function Ze(e){return e.errorMessage!==void 0}function XA(e){const t=gA(e4(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return n.searchParams.set("version",Wi),n.searchParams.set("code",t.code.toString()),n.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:n.href})}function e4(e){var t;if(typeof e=="string")return{message:e,code:ke.rpc.internal};if(Ze(e)){const n=e.errorMessage,r=(t=e.errorCode)!==null&&t!==void 0?t:n.match(/(denied|rejected)/i)?ke.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},e),{message:n,code:r,data:{method:e.method}})}return e}class t4 extends ha{}class Nr{constructor(t,n){this.scope=t,this.module=n}storeObject(t,n){this.setItem(t,JSON.stringify(n))}loadObject(t){const n=this.getItem(t);return n?JSON.parse(n):void 0}setItem(t,n){localStorage.setItem(this.scopedKey(t),n)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),n=[];for(let r=0;r<localStorage.length;r++){const i=localStorage.key(r);typeof i=="string"&&i.startsWith(t)&&n.push(i)}n.forEach(r=>localStorage.removeItem(r))}scopedKey(t){return`-${this.scope}${this.module?`:${this.module}`:""}:${t}`}static clearAll(){new Nr("CBWSDK").clear(),new Nr("walletlink").clear()}}const n4=({signerType:e})=>{oe("provider.signer.loaded_from_storage",{action:ie.measurement,componentType:re.unknown,signerType:e},se.low)},r4=({method:e,correlationId:t})=>{oe("provider.request.started",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t},se.high)},i4=({method:e,correlationId:t,signerType:n,errorMessage:r})=>{oe("provider.request.error",{action:ie.error,componentType:re.unknown,method:e,signerType:n,correlationId:t,errorMessage:r},se.high)},s4=({method:e,signerType:t,correlationId:n})=>{oe("provider.request.responded",{action:ie.unknown,componentType:re.unknown,method:e,signerType:t,correlationId:n},se.high)},o4=()=>{oe("provider.enable_function.called",{action:ie.measurement,componentType:re.unknown},se.high)},a4=()=>{oe("signer.selection.requested",{action:ie.unknown,componentType:re.unknown},se.high)},c4=e=>{oe("signer.selection.responded",{action:ie.unknown,componentType:re.unknown,signerType:e},se.high)},Mo=hf(()=>({correlationIds:new Map})),Rt={get:e=>Mo.getState().correlationIds.get(e),set:(e,t)=>{Mo.setState(n=>{const r=new Map(n.correlationIds);return r.set(e,t),{correlationIds:r}})},delete:e=>{Mo.setState(t=>{const n=new Map(t.correlationIds);return n.delete(e),{correlationIds:n}})},clear:()=>{Mo.setState({correlationIds:new Map})}},u4=({method:e,correlationId:t})=>{var n;oe("scw_signer.handshake.started",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},l4=({method:e,correlationId:t,errorMessage:n})=>{var r;oe("scw_signer.handshake.error",{action:ie.error,componentType:re.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=W.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},se.high)},d4=({method:e,correlationId:t})=>{var n;oe("scw_signer.handshake.completed",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},f4=({method:e,correlationId:t})=>{var n;oe("scw_signer.request.started",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},h4=({method:e,correlationId:t,errorMessage:n})=>{var r;oe("scw_signer.request.error",{action:ie.error,componentType:re.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=W.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},se.high)},p4=({method:e,correlationId:t})=>{var n;oe("scw_signer.request.completed",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},m4=({method:e,correlationId:t})=>{var n;oe("scw_sub_account.request.started",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},y4=({method:e,correlationId:t})=>{var n;oe("scw_sub_account.request.completed",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},b4=({method:e,correlationId:t,errorMessage:n})=>{var r;oe("scw_sub_account.request.error",{action:ie.error,componentType:re.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=W.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},se.high)},g4=({method:e,correlationId:t})=>{var n;oe("scw_sub_account.add_owner.started",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},w4=({method:e,correlationId:t})=>{var n;oe("scw_sub_account.add_owner.completed",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},v4=({method:e,correlationId:t,errorMessage:n})=>{var r;oe("scw_sub_account.add_owner.error",{action:ie.error,componentType:re.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=W.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},se.high)},x4=({method:e,correlationId:t})=>{var n;oe("scw_sub_account.insufficient_balance.error_handling.started",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},E4=({method:e,correlationId:t})=>{var n;oe("scw_sub_account.insufficient_balance.error_handling.completed",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=W.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},se.high)},_4=({method:e,correlationId:t,errorMessage:n})=>{var r;oe("scw_sub_account.insufficient_balance.error_handling.error",{action:ie.error,componentType:re.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=W.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},se.high)},ur=e=>"message"in e&&typeof e.message=="string"?e.message:"",Rg=hf(()=>({}));function Th(e){e.forEach(t=>{var n,r,i,s,o,a,c,u;if(!t.rpcUrl)return;const l=Ks({id:t.id,rpcUrls:{default:{http:[t.rpcUrl]}},name:(r=(n=t.nativeCurrency)===null||n===void 0?void 0:n.name)!==null&&r!==void 0?r:"",nativeCurrency:{name:(s=(i=t.nativeCurrency)===null||i===void 0?void 0:i.name)!==null&&s!==void 0?s:"",symbol:(a=(o=t.nativeCurrency)===null||o===void 0?void 0:o.symbol)!==null&&a!==void 0?a:"",decimals:(u=(c=t.nativeCurrency)===null||c===void 0?void 0:c.decimal)!==null&&u!==void 0?u:18}}),d=h_({chain:l,transport:Z0(t.rpcUrl)}),f=JI({client:d,transport:Z0(t.rpcUrl)});Rg.setState({[t.id]:{client:d,bundlerClient:f}})})}function Ug(e){var t;return(t=Rg.getState()[e])===null||t===void 0?void 0:t.client}function xt(e,t,n){if(e==null)throw t??G.rpc.invalidParams({message:"value must be present",data:e})}function Xn(e,t){if(!Array.isArray(e))throw G.rpc.invalidParams({message:t??"value must be an array",data:e})}function Lo(e){if(typeof e!="object"||e===null)throw G.rpc.internal("sub account info is not an object");if(!("address"in e))throw G.rpc.internal("sub account is invalid");if("address"in e&&typeof e.address=="string"&&!et(e.address))throw G.rpc.internal("sub account address is invalid");if("factory"in e&&typeof e.factory=="string"&&!et(e.factory))throw G.rpc.internal("sub account factory address is invalid");if("factoryData"in e&&typeof e.factoryData=="string"&&!Qe(e.factoryData))throw G.rpc.internal("sub account factory data is invalid")}async function S4(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function I4(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function A4(e,t){const n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,new TextEncoder().encode(t));return{iv:n,cipherText:r}}async function P4(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return new TextDecoder().decode(r)}function jg(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}async function Fg(e,t){const n=jg(e),r=await crypto.subtle.exportKey(n,t);return Ef(new Uint8Array(r))}async function Dg(e,t){const n=jg(e),r=ea(t).buffer;return await crypto.subtle.importKey(n,new Uint8Array(r),{name:"ECDH",namedCurve:"P-256"},!0,e==="private"?["deriveKey"]:[])}async function k4(e,t){const n=JSON.stringify(e,(r,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return A4(t,n)}async function C4(e,t){return JSON.parse(await P4(t,e))}const B4="0.1.1";function O4(){return B4}let Ne=class Zl extends Error{constructor(t,n={}){const r=(()=>{if(n.cause instanceof Zl){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof Zl&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${i??""}`,a=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||i?["",r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0]:[]].filter(c=>typeof c=="string").join(`
72
+ `);super(a,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@${O4()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=i,this.shortMessage=t}walk(t){return zg(this,t)}};function zg(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?zg(e.cause,t):t?null:e}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function T4(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Pf(e,...t){if(!T4(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 $h(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 $4(e,t){Pf(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Yl(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function eu(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Kt(e,t){return e<<32-t|e>>>t}function N4(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Hg(e){return typeof e=="string"&&(e=N4(e)),Pf(e),e}let M4=class{};function L4(e){const t=r=>e().update(Hg(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function R4(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}function U4(e,t,n){return e&t^~e&n}function j4(e,t,n){return e&t^e&n^t&n}let F4=class extends M4{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=eu(this.buffer)}update(t){$h(this),t=Hg(t),Pf(t);const{view:n,buffer:r,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=eu(t);for(;i<=s-o;o+=i)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){$h(this),$4(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,Yl(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;R4(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=eu(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.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:i,finished:s,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=a,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const qn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),D4=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]),Gn=new Uint32Array(64);let z4=class extends F4{constructor(t=32){super(64,t,8,!1),this.A=qn[0]|0,this.B=qn[1]|0,this.C=qn[2]|0,this.D=qn[3]|0,this.E=qn[4]|0,this.F=qn[5]|0,this.G=qn[6]|0,this.H=qn[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:o,G:a,H:c}=this;return[t,n,r,i,s,o,a,c]}set(t,n,r,i,s,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Gn[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=Gn[d-15],h=Gn[d-2],g=Kt(f,7)^Kt(f,18)^f>>>3,y=Kt(h,17)^Kt(h,19)^h>>>10;Gn[d]=y+Gn[d-7]+g+Gn[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Kt(a,6)^Kt(a,11)^Kt(a,25),h=l+f+U4(a,c,u)+D4[d]+Gn[d]|0,y=(Kt(r,2)^Kt(r,13)^Kt(r,22))+j4(r,i,s)|0;l=u,u=c,c=a,a=o+h|0,o=s,s=i,i=r,r=h+y|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,i,s,o,a,c,u,l)}roundClean(){Yl(Gn)}destroy(){this.set(0,0,0,0,0,0,0,0),Yl(this.buffer)}};const H4=L4(()=>new z4),q4=H4,G4="#__bigint";function ac(e,t,n){return JSON.stringify(e,(r,i)=>typeof i=="bigint"?i.toString()+G4:i,n)}function V4(e,t){if(Pi(e)>t)throw new cP({givenSize:Pi(e),maxSize:t})}function W4(e,t){if(typeof t=="number"&&t>0&&t>Pi(e)-1)throw new Jg({offset:t,position:"start",size:Pi(e)})}function K4(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Pi(e)!==n-t)throw new Jg({offset:n,position:"end",size:Pi(e)})}const fn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Nh(e){if(e>=fn.zero&&e<=fn.nine)return e-fn.zero;if(e>=fn.A&&e<=fn.F)return e-(fn.A-10);if(e>=fn.a&&e<=fn.f)return e-(fn.a-10)}function kf(e,t){if(sr(e)>t)throw new iP({givenSize:sr(e),maxSize:t})}function Z4(e,t){if(typeof t=="number"&&t>0&&t>sr(e)-1)throw new Kg({offset:t,position:"start",size:sr(e)})}function Y4(e,t,n){if(typeof t=="number"&&typeof n=="number"&&sr(e)!==n-t)throw new Kg({offset:n,position:"end",size:sr(e)})}function qg(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const i=e.replace("0x","");if(i.length>r*2)throw new sP({size:Math.ceil(i.length/2),targetSize:r,type:"Hex"});return`0x${i[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Q4=new TextEncoder,J4=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function X4(e,t={}){const{strict:n=!1}=t;if(!e)throw new Mh(e);if(typeof e!="string")throw new Mh(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Lh(e);if(!e.startsWith("0x"))throw new Lh(e)}function cc(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Gg(e){return e instanceof Uint8Array?Ai(e):Array.isArray(e)?Ai(new Uint8Array(e)):e}function Ai(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=J4[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(kf(r,t.size),Wg(r,t.size)):r}function nr(e,t={}){const{signed:n,size:r}=t,i=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 o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const u=typeof e=="bigint"?"n":"";throw new rP({max:s?`${s}${u}`:void 0,min:`${o}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?eP(c,r):c}function Vg(e,t={}){return Ai(Q4.encode(e),t)}function eP(e,t){return qg(e,{dir:"left",size:t})}function Wg(e,t){return qg(e,{dir:"right",size:t})}function Ot(e,t,n,r={}){const{strict:i}=r;Z4(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return i&&Y4(s,t,n),s}function sr(e){return Math.ceil((e.length-2)/2)}function tP(e,t={}){const{signed:n}=t;t.size&&kf(e,t.size);const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n)-1n,o=s>>1n;return r<=o?r:r-s-1n}function nP(e,t={}){const{strict:n=!1}=t;try{return X4(e,{strict:n}),!0}catch{return!1}}let rP=class extends Ne{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number \`${s}\` is not in safe${i?` ${i*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 Mh extends Ne{constructor(t){super(`Value \`${typeof t=="object"?ac(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 Lh extends Ne{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"})}}let iP=class extends Ne{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"})}},Kg=class extends Ne{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"})}},sP=class extends Ne{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 oP(e){if(!(e instanceof Uint8Array)){if(!e)throw new Ro(e);if(typeof e!="object")throw new Ro(e);if(!("BYTES_PER_ELEMENT"in e))throw new Ro(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new Ro(e)}}function Zg(e){return e instanceof Uint8Array?e:typeof e=="string"?Qg(e):Yg(e)}function Yg(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Qg(e,t={}){const{size:n}=t;let r=e;n&&(kf(e,n),r=Wg(e,n));let i=r.slice(2);i.length%2&&(i=`0${i}`);const s=i.length/2,o=new Uint8Array(s);for(let a=0,c=0;a<s;a++){const u=Nh(i.charCodeAt(c++)),l=Nh(i.charCodeAt(c++));if(u===void 0||l===void 0)throw new Ne(`Invalid byte sequence ("${i[c-2]}${i[c-1]}" in "${i}").`);o[a]=u*16+l}return o}function Pi(e){return e.length}function Rh(e,t,n,r={}){const{strict:i}=r;W4(e,t);const s=e.slice(t,n);return i&&K4(s,t,n),s}function Uh(e,t={}){const{size:n}=t;typeof n<"u"&&V4(e,n);const r=Ai(e,t);return tP(r,t)}function aP(e){try{return oP(e),!0}catch{return!1}}class Ro extends Ne{constructor(t){super(`Value \`${typeof t=="object"?ac(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}let cP=class extends Ne{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"})}};class Jg extends Ne{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:"Bytes.SliceOffsetOutOfBoundsError"})}}function Xg(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=q4(Zg(e));return n==="Bytes"?r:Ai(r)}function e1(e,t={}){const{compressed:n}=t,{prefix:r,x:i,y:s}=e;if(n===!1||typeof i=="bigint"&&typeof s=="bigint"){if(r!==4)throw new jh({prefix:r,cause:new hP});return}if(n===!0||typeof i=="bigint"&&typeof s>"u"){if(r!==3&&r!==2)throw new jh({prefix:r,cause:new fP});return}throw new dP({publicKey:e})}function uP(e){const t=(()=>{if(nP(e))return t1(e);if(aP(e))return lP(e);const{prefix:n,x:r,y:i}=e;return typeof r=="bigint"&&typeof i=="bigint"?{prefix:n??4,x:r,y:i}:{prefix:n,x:r}})();return e1(t),t}function lP(e){return t1(Ai(e))}function t1(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new pP({publicKey:e});if(e.length===130){const r=BigInt(Ot(e,0,32)),i=BigInt(Ot(e,32,64));return{prefix:4,x:r,y:i}}if(e.length===132){const r=Number(Ot(e,0,1)),i=BigInt(Ot(e,1,33)),s=BigInt(Ot(e,33,65));return{prefix:r,x:i,y:s}}const t=Number(Ot(e,0,1)),n=BigInt(Ot(e,1,33));return{prefix:t,x:n}}function Cf(e,t={}){e1(e);const{prefix:n,x:r,y:i}=e,{includePrefix:s=!0}=t;return cc(s?nr(n,{size:1}):"0x",nr(r,{size:32}),typeof i=="bigint"?nr(i,{size:32}):"0x")}class dP extends Ne{constructor({publicKey:t}){super(`Value \`${ac(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class jh extends Ne{constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class fP extends Ne{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class hP extends Ne{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let pP=class extends Ne{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${sr(Gg(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const Fh=2n**256n-1n;function mP(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new tu({signature:e});if(typeof e.s>"u")throw new tu({signature:e});if(n&&typeof e.yParity>"u")throw new tu({signature:e});if(e.r<0n||e.r>Fh)throw new vP({value:e.r});if(e.s<0n||e.s>Fh)throw new xP({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new Bf({value:e.yParity})}function n1(e){if(e.length!==130&&e.length!==132)throw new wP({signature:e});const t=BigInt(Ot(e,0,32)),n=BigInt(Ot(e,32,64)),r=(()=>{const i=+`0x${e.slice(130)}`;if(!Number.isNaN(i))try{return bP(i)}catch{throw new Bf({value:i})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function yP(e){mP(e);const t=e.r,n=e.s;return cc(nr(t,{size:32}),nr(n,{size:32}),typeof e.yParity=="number"?nr(gP(e.yParity),{size:1}):"0x")}function bP(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new EP({value:e})}function gP(e){if(e===0)return 27;if(e===1)return 28;throw new Bf({value:e})}class wP extends Ne{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${sr(Gg(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class tu extends Ne{constructor({signature:t}){super(`Signature \`${ac(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class vP extends Ne{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class xP extends Ne{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class Bf extends Ne{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class EP extends Ne{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}const _P=new TextDecoder,Uo=Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[t,e.charCodeAt(0)]));({...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[e.charCodeAt(0),t]))});function SP(e,t={}){const{pad:n=!0,url:r=!1}=t,i=new Uint8Array(Math.ceil(e.length/3)*4);for(let c=0,u=0;u<e.length;c+=4,u+=3){const l=(e[u]<<16)+(e[u+1]<<8)+(e[u+2]|0);i[c]=Uo[l>>18],i[c+1]=Uo[l>>12&63],i[c+2]=Uo[l>>6&63],i[c+3]=Uo[l&63]}const s=e.length%3,o=Math.floor(e.length/3)*4+(s&&s+1);let a=_P.decode(new Uint8Array(i.buffer,0,o));return n&&s===1&&(a+="=="),n&&s===2&&(a+="="),r&&(a=a.replaceAll("+","-").replaceAll("/","_")),a}function IP(e,t={}){return SP(Qg(e),t)}Uint8Array.from([105,171,180,181,160,222,75,198,42,42,32,31,141,37,186,233]);function AP(e={}){const{flag:t=5,rpId:n=window.location.hostname,signCount:r=0}=e,i=Xg(Vg(n)),s=nr(t,{size:1}),o=nr(r,{size:4});return cc(i,s,o)}function PP(e){const{challenge:t,crossOrigin:n=!1,extraClientData:r,origin:i=window.location.origin}=e;return JSON.stringify({type:"webauthn.get",challenge:IP(t,{url:!0,pad:!1}),origin:i,crossOrigin:n,...r})}function kP(e){const{challenge:t,crossOrigin:n,extraClientData:r,flag:i,origin:s,rpId:o,signCount:a,userVerification:c="required"}=e,u=AP({flag:i,rpId:o,signCount:a}),l=PP({challenge:t,crossOrigin:n,extraClientData:r,origin:s}),d=Xg(Vg(l)),f=l.indexOf('"challenge"'),h=l.indexOf('"type"'),g={authenticatorData:u,clientDataJSON:l,challengeIndex:f,typeIndex:h,userVerificationRequired:c==="required"},y=cc(u,d);return{metadata:g,payload:y}}async function CP(e={}){const{extractable:t=!1}=e,n=await globalThis.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},t,["sign","verify"]),r=await globalThis.crypto.subtle.exportKey("raw",n.publicKey),i=uP(new Uint8Array(r));return{privateKey:n.privateKey,publicKey:i}}async function BP(e){const{payload:t,privateKey:n}=e,r=await globalThis.crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},n,Zg(t)),i=Yg(new Uint8Array(r)),s=Uh(Rh(i,0,32));let o=Uh(Rh(i,32,64));return o>k0.CURVE.n/2n&&(o=k0.CURVE.n-o),{r:s,s:o}}function OP(e,t){const n=typeof indexedDB<"u"?Wb(e,t):void 0;return{getItem:async r=>{const i=await sI(r,n);return i||null},removeItem:async r=>aI(r,n),setItem:async(r,i)=>oI(r,i,n)}}const TP="cbwsdk",$P="keys",Of="activeId",ki=OP(TP,$P);async function NP(){const e=await CP({extractable:!1}),t=Ot(Cf(e.publicKey),1);return await ki.setItem(t,e),await ki.setItem(Of,t),e}async function MP(){const e=await ki.getItem(Of);if(!e)return null;const t=await ki.getItem(e);return t||null}async function LP(){const e=await MP();if(!e){const t=await NP(),n=Ot(Cf(t.publicKey),1);return await ki.setItem(n,t),await ki.setItem(Of,n),t}return e}async function RP(){const e=await LP(),t=Ot(Cf(e.publicKey),1),n=async r=>{const{payload:i,metadata:s}=kP({challenge:r,origin:"https://keys.coinbase.com",userVerification:"preferred"}),o=await BP({payload:i,privateKey:e.privateKey});return{signature:yP(o),raw:{},webauthn:s}};return{id:t,publicKey:t,async sign({hash:r}){return n(r)},async signMessage({message:r}){return n(Ja(r))},async signTypedData(r){return n(co(r))},type:"webAuthn"}}async function Pa(){return{account:await RP()}}const Dh={storageKey:"ownPrivateKey",keyType:"private"},zh={storageKey:"ownPublicKey",keyType:"public"},Hh={storageKey:"peerPublicKey",keyType:"public"};class UP{constructor(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(t){this.sharedSecret=null,this.peerPublicKey=t,await this.storeKey(Hh,t),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,W.keys.clear()}async generateKeyPair(){const t=await S4();this.ownPrivateKey=t.privateKey,this.ownPublicKey=t.publicKey,await this.storeKey(Dh,t.privateKey),await this.storeKey(zh,t.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Dh)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(zh)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Hh)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await I4(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(t){const n=W.keys.get(t.storageKey);return n?Dg(t.keyType,n):null}async storeKey(t,n){const r=await Fg(t.keyType,n);W.keys.set(t.storageKey,r)}}function os(e,t){if(!(typeof e!="object"||e===null))return t.split(/[.[\]]+/).filter(Boolean).reduce((n,r)=>{if(typeof n=="object"&&n!==null)return n[r]},e)}const r1="0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a",i1="0xf85210B21cC50302F477BA56686d2019dC9b67Ad",jt=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"owner",type:"bytes"}],name:"AlreadyOwner",type:"error"},{inputs:[],name:"Initialized",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidEthereumAddressOwner",type:"error"},{inputs:[{name:"key",type:"uint256"}],name:"InvalidNonceKey",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidOwnerBytesLength",type:"error"},{inputs:[],name:"LastOwner",type:"error"},{inputs:[{name:"index",type:"uint256"}],name:"NoOwnerAtIndex",type:"error"},{inputs:[{name:"ownersRemaining",type:"uint256"}],name:"NotLastOwner",type:"error"},{inputs:[{name:"selector",type:"bytes4"}],name:"SelectorNotAllowed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"UnauthorizedCallContext",type:"error"},{inputs:[],name:"UpgradeFailed",type:"error"},{inputs:[{name:"index",type:"uint256"},{name:"expectedOwner",type:"bytes"},{name:"actualOwner",type:"bytes"}],name:"WrongOwnerAtIndex",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"AddOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"RemoveOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"REPLAYABLE_NONCE_KEY",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"addOwnerAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"addOwnerPublicKey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"functionSelector",type:"bytes4"}],name:"canSkipChainIdValidation",outputs:[{name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[],name:"domainSeparator",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{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"},{inputs:[],name:"entryPoint",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"calls",type:"bytes[]"}],name:"executeWithoutChainIdValidation",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHashWithoutChainId",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"$",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"owners",type:"bytes[]"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"isOwnerAddress",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"bytes"}],name:"isOwnerBytes",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"isOwnerPublicKey",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"result",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextOwnerIndex",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"}],name:"ownerAtIndex",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ownerCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeLastOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeOwnerAtIndex",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"removedOwnersCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"}],name:"replaySafeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"newImplementation",type:"address"},{name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"missingAccountFunds",type:"uint256"}],name:"validateUserOp",outputs:[{name:"validationData",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],s1=[{inputs:[{name:"implementation_",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"OwnerRequired",type:"error"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"createAccount",outputs:[{name:"account",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"getAddress",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initCodeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"}];function qh(e){var t;if(!Array.isArray(e.params))return null;switch(e.method){case"personal_sign":return e.params[1];case"eth_signTypedData_v4":return e.params[0];case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":return(t=e.params[0])===null||t===void 0?void 0:t.from;default:return null}}function jP(e,t){if(!Array.isArray(e.params))throw G.rpc.invalidParams();const n=[...e.params];switch(e.method){case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":n[0].from=t;break;case"eth_signTypedData_v4":n[0]=t;break;case"personal_sign":n[1]=t;break}return Object.assign(Object.assign({},e),{params:n})}function Gh(e){var t;if(!e||!Array.isArray(e)||!(!((t=e[0])===null||t===void 0)&&t.chainId)||typeof e[0].chainId!="string"&&typeof e[0].chainId!="number")throw G.rpc.invalidParams()}function FP(e){if(!e||!Array.isArray(e)||e.length!==1&&e.length!==2||typeof e[0]!="string"||!et(e[0]))throw G.rpc.invalidParams();if(e.length===2){if(!Array.isArray(e[1]))throw G.rpc.invalidParams();for(const t of e[1])if(typeof t!="string"||!t.startsWith("0x"))throw G.rpc.invalidParams()}}function ka(e,t){const n=Object.assign({},e);if(t&&e.method.startsWith("wallet_")){let r=os(n,"params.0.capabilities");if(typeof r>"u"&&(r={}),typeof r!="object")throw G.rpc.invalidParams();r=Object.assign(Object.assign({},t),r),n.params&&Array.isArray(n.params)&&(n.params[0]=Object.assign(Object.assign({},n.params[0]),{capabilities:r}))}return n}async function nu(){var e;const t=(e=W.subAccountsConfig.get())!==null&&e!==void 0?e:{},n={};if(t.enableAutoSubAccounts){const{account:r}=t.toOwnerAccount?await t.toOwnerAccount():await Pa();if(!r)throw G.provider.unauthorized("No owner account found");n.addSubAccount={account:{type:"create",keys:[{type:r.address?"address":"webauthn-p256",publicKey:r.address||r.publicKey}]}}}W.subAccountsConfig.set({capabilities:n})}function DP(e){if(!(e.method==="coinbase_fetchPermissions"&&e.params===void 0)){if(e.method==="coinbase_fetchPermissions"&&Array.isArray(e.params)&&e.params.length===1&&typeof e.params[0]=="object"){if(typeof e.params[0].account!="string"||!e.params[0].chainId.startsWith("0x"))throw G.rpc.invalidParams("FetchPermissions - Invalid params: params[0].account must be a hex string");if(typeof e.params[0].chainId!="string"||!e.params[0].chainId.startsWith("0x"))throw G.rpc.invalidParams("FetchPermissions - Invalid params: params[0].chainId must be a hex string");if(typeof e.params[0].spender!="string"||!e.params[0].spender.startsWith("0x"))throw G.rpc.invalidParams("FetchPermissions - Invalid params: params[0].spender must be a hex string");return}throw G.rpc.invalidParams()}}function zP(e){var t,n,r;if(e.params!==void 0)return e;const i=(t=W.getState().account.accounts)===null||t===void 0?void 0:t[0],s=(n=W.getState().account.chain)===null||n===void 0?void 0:n.id,o=(r=W.getState().subAccount)===null||r===void 0?void 0:r.address;if(!i||!o||!s)throw G.rpc.invalidParams("FetchPermissions - one or more of account, sub account, or chain id is missing, connect to sub account via wallet_connect first");return{method:"coinbase_fetchPermissions",params:[{account:i,chainId:q(s),spender:o}]}}function HP({spendPermission:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:i1},types:{SpendPermission:[{name:"account",type:"address"},{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermission",message:{account:e.account,spender:e.spender,token:e.token,allowance:e.allowance,period:e.period,start:e.start,end:e.end,salt:e.salt,extraData:e.extraData}}}function qP({spendPermissionBatch:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:i1},types:{SpendPermissionBatch:[{name:"account",type:"address"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"permissions",type:"PermissionDetails[]"}],PermissionDetails:[{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermissionBatch",message:{account:e.account,period:e.period,start:e.start,end:e.end,permissions:e.permissions.map(n=>({spender:n.spender,token:n.token,allowance:n.allowance,salt:n.salt,extraData:n.extraData}))}}}async function o1({client:e,id:t}){var n;const r=await yb(e,{id:t});if(r.status==="success")return(n=r.receipts)===null||n===void 0?void 0:n[0].transactionHash;throw G.rpc.internal("failed to send transaction")}function a1({calls:e,from:t,chainId:n,capabilities:r}){const i=wg.get().paymasterUrls;let s={method:"wallet_sendCalls",params:[{version:"1.0",calls:e,chainId:q(n),from:t,atomicRequired:!0,capabilities:r}]};return i?.[n]&&(s=ka(s,{paymasterService:{url:i?.[n]}})),s}async function GP(){const e=Af();return await new Promise(n=>{If({snackbarContext:"sub_account_insufficient_balance"}),e.presentItem({autoExpand:!0,message:"Insufficient spend permission. Choose how to proceed:",menuItems:[{isRed:!1,info:"Create new Spend Permission",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{fi({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"create_permission"}),e.clear(),n("update_permission")}},{isRed:!1,info:"Continue in Popup",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{fi({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"continue_in_popup"}),e.clear(),n("continue_popup")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{fi({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"cancel"}),e.clear(),n("cancel")}}]})})}function VP({errorData:e,sourceAddress:t}){var n;const r=[];for(const[i,{amount:s,sources:o}]of Object.entries((n=e?.required)!==null&&n!==void 0?n:{})){if(o.filter(c=>Le(c.balance)>=Le(s)&&c.address.toLowerCase()===t?.toLowerCase()).length===0)throw new Error("Source address has insufficient balance for a token");r.push({token:i,requiredAmount:Le(s)})}return r}function WP(e){return typeof e=="object"&&e!==null&&"calls"in e}function KP(e){return Array.isArray(e)&&e.length===1&&typeof e[0]=="object"&&e[0]!==null&&"to"in e[0]}function ZP(e){return Pr(pe(ht(e)),0,16)}function YP({attribution:e,dappOrigin:t}){if(e){if("auto"in e&&e.auto&&t)return ZP(t);if("dataSuffix"in e)return e.dataSuffix}}function QP(e,t){var n;if(!Array.isArray(e?.params))return!1;const r=(n=e.params[0])===null||n===void 0?void 0:n.capabilities;return!r||typeof r!="object"?!1:t in r}function jo(e,t){const n=e.filter(r=>r!==t);return[t,...n]}function Fo(e,t){return[...e.filter(r=>r!==t),t]}async function JP(){const e=W.spendPermissions.get(),t=W.subAccounts.get(),n=W.account.get().accounts;return n?{accounts:n?.map(i=>({address:i,capabilities:{subAccounts:t?[t]:void 0,spendPermissions:e.length>0?{permissions:e}:void 0}}))}:null}function XP(e){return e.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function Do(e){const t=btoa(String.fromCharCode(...new Uint8Array(e)));return XP(t)}function ek({webauthn:e,signature:t,id:n}){const r=n1(t);return{id:n,rawId:Do(Cn(n)),response:{authenticatorData:Do(ct(e.authenticatorData)),clientDataJSON:Do(Cn(e.clientDataJSON)),signature:Do(tk(r.r,r.s))},type:JSON.parse(e.clientDataJSON).type}}function tk(e,t){const n=ct(Ft(q(e))),r=ct(Ft(q(t))),i=n.length,s=r.length,o=i+s+4,a=new Uint8Array(o+2);return a[0]=48,a[1]=o,a[2]=2,a[3]=i,a.set(n,4),a[i+4]=2,a[i+5]=s,a.set(r,i+6),a}var nk=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};async function rk(e){const{owner:t,ownerIndex:n,address:r,client:i,factoryData:s}=e,o={abi:AI,address:PI,version:"0.6"},a={abi:s1,address:r1};return OI({client:i,entryPoint:o,extend:{abi:jt,factory:a},async decodeCalls(c){const u=Yd({abi:jt,data:c});if(u.functionName==="execute")return[{to:u.args[0],value:u.args[1],data:u.args[2]}];if(u.functionName==="executeBatch")return u.args[0].map(l=>({to:l.target,value:l.value,data:l.data}));throw new F(`unable to decode calls for "${u.functionName}"`)},async encodeCalls(c){var u,l;return c.length===1?Re({abi:jt,functionName:"execute",args:[c[0].to,(u=c[0].value)!==null&&u!==void 0?u:BigInt(0),(l=c[0].data)!==null&&l!==void 0?l:"0x"]}):Re({abi:jt,functionName:"executeBatch",args:[c.map(d=>{var f,h;return{data:(f=d.data)!==null&&f!==void 0?f:"0x",target:d.to,value:(h=d.value)!==null&&h!==void 0?h:BigInt(0)}})]})},async getAddress(){return r},async getFactoryArgs(){return s?{factory:a.address,factoryData:s}:{factory:a.address,factoryData:s}},async getStubSignature(){return t.type==="webAuthn"?"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000":ns({ownerIndex:n,signature:"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"})},async sign(c){const u=await this.getAddress(),l=ru({address:u,chainId:i.chain.id,hash:c.hash}),d=await zo({hash:l,owner:t});return ns({ownerIndex:n,signature:d})},async signMessage(c){const{message:u}=c,l=await this.getAddress(),d=ru({address:l,chainId:i.chain.id,hash:Ja(u)}),f=await zo({hash:d,owner:t});return ns({ownerIndex:n,signature:f})},async signTypedData(c){const{domain:u,types:l,primaryType:d,message:f}=c,h=await this.getAddress(),g=ru({address:h,chainId:i.chain.id,hash:co({domain:u,message:f,primaryType:d,types:l})}),y=await zo({hash:g,owner:t});return ns({ownerIndex:n,signature:y})},async signUserOperation(c){const{chainId:u=i.chain.id}=c,l=nk(c,["chainId"]),d=await this.getAddress(),f=BI({chainId:u,entryPointAddress:o.address,entryPointVersion:o.version,userOperation:Object.assign(Object.assign({},l),{sender:d})}),h=await zo({hash:f,owner:t});return ns({ownerIndex:n,signature:h})},userOperation:{async estimateGas(c){var u;if(t.type==="webAuthn")return{verificationGasLimit:BigInt(Math.max(Number((u=c.verificationGasLimit)!==null&&u!==void 0?u:BigInt(0)),8e5))}}}})}async function zo({hash:e,owner:t}){if(t.type==="webAuthn"){const{signature:n,webauthn:r}=await t.sign({hash:e});return ik({signature:n,webauthn:r})}if(t.sign)return t.sign({hash:e});throw new F("`owner` does not support raw sign.")}function ru({address:e,chainId:t,hash:n}){return co({domain:{chainId:t,name:"Coinbase Smart Wallet",verifyingContract:e,version:"1"},types:{CoinbaseSmartWalletMessage:[{name:"hash",type:"bytes32"}]},primaryType:"CoinbaseSmartWalletMessage",message:{hash:n}})}function ik({webauthn:e,signature:t}){const{r:n,s:r}=n1(t);return mt([{components:[{name:"authenticatorData",type:"bytes"},{name:"clientDataJSON",type:"bytes"},{name:"challengeIndex",type:"uint256"},{name:"typeIndex",type:"uint256"},{name:"r",type:"uint256"},{name:"s",type:"uint256"}],type:"tuple"}],[{authenticatorData:e.authenticatorData,clientDataJSON:Ir(e.clientDataJSON),challengeIndex:BigInt(e.challengeIndex),typeIndex:BigInt(e.typeIndex),r:n,s:r}])}function ns(e){const{ownerIndex:t=0}=e,n=(()=>{if(we(e.signature)!==65)return e.signature;const r=b_(e.signature);return X3(["bytes32","bytes32","uint8"],[r.r,r.s,r.yParity===0?27:28])})();return mt([{components:[{name:"ownerIndex",type:"uint8"},{name:"signatureData",type:"bytes"}],type:"tuple"}],[{ownerIndex:t,signatureData:n}])}async function sk({address:e,client:t,factory:n,factoryData:r,owner:i,ownerIndex:s,parentAddress:o,attribution:a}){var c;const u={address:e,factory:n,factoryData:r},l=(c=t.chain)===null||c===void 0?void 0:c.id;if(!l)throw G.rpc.internal("chainId not found");const d=await rk({owner:i,ownerIndex:s??1,address:e,client:t,factoryData:r}),f=async h=>{var g,y,m,w,S,x;try{switch(h.method){case"wallet_addSubAccount":return u;case"eth_accounts":return[u.address];case"eth_coinbase":return u.address;case"net_version":return l.toString();case"eth_chainId":return q(l);case"eth_sendTransaction":{Xn(h.params);const E=h.params[0];xt(E.to,G.rpc.invalidParams("to is required"));const v={to:E.to,data:Wl((g=E.data)!==null&&g!==void 0?g:"0x",!0),value:Wl((y=E.value)!==null&&y!==void 0?y:"0x",!0),from:(m=E.from)!==null&&m!==void 0?m:u.address},I=a1({calls:[v],chainId:l,from:v.from}),A=await f(I);return o1({client:t,id:A})}case"wallet_sendCalls":{Xn(h.params);const E=os(h.params[0],"chainId");if(!E)throw G.rpc.invalidParams("chainId is required");if(!Qe(E))throw G.rpc.invalidParams("chainId must be a hex encoded integer");if(!h.params[0])throw G.rpc.invalidParams("params are required");if(!("calls"in h.params[0]))throw G.rpc.invalidParams("calls are required");let v={method:"wallet_prepareCalls",params:[{version:"1.0",calls:h.params[0].calls,chainId:E,from:u.address,capabilities:"capabilities"in h.params[0]?h.params[0].capabilities:{}}]};o&&(v=ka(v,{funding:[{type:"spendPermission",data:{autoApply:!0,sources:[o],preference:"PREFER_DIRECT_BALANCE"}}]}));let I=await f(v);const A=await((S=(w=i).sign)===null||S===void 0?void 0:S.call(w,{hash:Yf(I.signatureRequest.hash)}));let B;if(!A)throw G.rpc.internal("signature not found");return Qe(A)?B={type:"secp256k1",data:{address:i.address,signature:A}}:B={type:"webauthn",data:{signature:JSON.stringify(ek(Object.assign({id:(x=i.id)!==null&&x!==void 0?x:"1"},A))),publicKey:i.publicKey}},(await f({method:"wallet_sendPreparedCalls",params:[{version:"1.0",type:I.type,data:I.userOp,chainId:I.chainId,signature:B}]}))[0]}case"wallet_sendPreparedCalls":{Xn(h.params);const E=os(h.params[0],"chainId");if(!E)throw G.rpc.invalidParams("chainId is required");if(!Qe(E))throw G.rpc.invalidParams("chainId must be a hex encoded integer");return await t.request({method:"wallet_sendPreparedCalls",params:h.params})}case"wallet_prepareCalls":{Xn(h.params);const E=os(h.params[0],"chainId");if(!E)throw G.rpc.invalidParams("chainId is required");if(!Qe(E))throw G.rpc.invalidParams("chainId must be a hex encoded integer");if(!h.params[0])throw G.rpc.invalidParams("params are required");if(!os(h.params[0],"calls"))throw G.rpc.invalidParams("calls are required");const v=h.params[0];return a&&v.capabilities&&!("attribution"in v.capabilities)&&(v.capabilities.attribution=a),await t.request({method:"wallet_prepareCalls",params:[Object.assign(Object.assign({},h.params[0]),{chainId:E})]})}case"personal_sign":{if(Xn(h.params),!Qe(h.params[0]))throw G.rpc.invalidParams("message must be a hex encoded string");const E=Yf(h.params[0]);return d.signMessage({message:E})}case"eth_signTypedData_v4":{Xn(h.params);const E=typeof h.params[1]=="string"?JSON.parse(h.params[1]):h.params[1];return d.signTypedData(E)}case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"wallet_addEthereumChain":case"wallet_switchEthereumChain":default:throw G.rpc.methodNotSupported()}}catch(E){if(Sg(E)){const v=vA(E);if(v)throw v}throw E}};return{request:f}}async function c1({address:e,client:t,publicKey:n,factory:r,factoryData:i}){if(!await Ls(t,{address:e})&&r&&i){if(Je(r)!==Je(r1))throw G.rpc.internal("unknown factory address");const a=Yd({abi:s1,data:i});if(a.functionName!=="createAccount")throw G.rpc.internal("unknown factory function");const[c]=a.args;return c.findIndex(u=>u.toLowerCase()===Vh(n).toLowerCase())}const o=await yt(t,{address:e,abi:jt,functionName:"ownerCount"});for(let a=Number(o)-1;a>=0;a--){const c=await yt(t,{address:e,abi:jt,functionName:"ownerAtIndex",args:[BigInt(a)]}),u=Vh(n);if(c.toLowerCase()===u.toLowerCase())return a}return-1}function Vh(e){return et(e)?Me(e):e}async function ok(){const e=Af();return new Promise(t=>{If({snackbarContext:"sub_account_add_owner"}),e.presentItem({autoExpand:!0,message:"App requires a signer update",menuItems:[{isRed:!1,info:"Confirm",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{fi({snackbarContext:"sub_account_add_owner",snackbarAction:"confirm"}),e.clear(),t("authenticate")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{fi({snackbarContext:"sub_account_add_owner",snackbarAction:"cancel"}),e.clear(),t("cancel")}}]})})}async function ak({ownerAccount:e,globalAccountRequest:t}){var n,r;const i=W.account.get(),s=W.subAccounts.get(),o=(n=i.accounts)===null||n===void 0?void 0:n.find(g=>g.toLowerCase()!==s?.address.toLowerCase());xt(o,G.provider.unauthorized("no global account")),xt((r=i.chain)===null||r===void 0?void 0:r.id,G.provider.unauthorized("no chain id")),xt(s?.address,G.provider.unauthorized("no sub account"));const a=[];if(e.type==="local"&&e.address&&a.push({to:s.address,data:Re({abi:jt,functionName:"addOwnerAddress",args:[e.address]}),value:ht(0)}),e.publicKey){const[g,y]=Ur([{type:"bytes32"},{type:"bytes32"}],e.publicKey);a.push({to:s.address,data:Re({abi:jt,functionName:"addOwnerPublicKey",args:[g,y]}),value:ht(0)})}const c={method:"wallet_sendCalls",params:[{version:"1",calls:a,chainId:q(84532),from:o}]};if(await ok()==="cancel")throw G.provider.unauthorized("user cancelled");const l=await t(c),d=Ug(i.chain.id);if(xt(d,G.rpc.internal(`client not found for chainId ${i.chain.id}`)),(await yb(d,{id:l})).status!=="success")throw G.rpc.internal("add owner call failed");const h=await c1({address:s.address,publicKey:e.type==="local"&&e.address?e.address:e.publicKey,client:d});if(h===-1)throw G.rpc.internal("failed to find owner index");return h}async function ck({errorData:e,globalAccountAddress:t,subAccountAddress:n,client:r,request:i,subAccountRequest:s,globalAccountRequest:o}){var a;const c=(a=r.chain)===null||a===void 0?void 0:a.id;xt(c,G.rpc.internal("invalid chainId"));const u=VP({errorData:e,sourceAddress:t}),l=await GP();if(l==="cancel")throw new Error("User cancelled funding");let d;const f=60*60*24,h=3;if(l==="update_permission"){if(u.length===1){const x=u[0],E=HP({spendPermission:{token:x.token,allowance:q(x.requiredAmount*BigInt(h)),period:f,account:t,spender:n,start:0,end:0xffffffffffff,salt:q(BigInt(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),extraData:"0x"},chainId:c});d={method:"eth_signTypedData_v4",params:[t,E]}}else{const x=qP({spendPermissionBatch:{account:t,period:f,start:0,end:0xffffffffffff,permissions:u.map(E=>({token:E.token,allowance:q(E.requiredAmount*BigInt(h)),period:f,account:t,spender:n,salt:"0x0",extraData:"0x"}))},chainId:c});d={method:"eth_signTypedData_v4",params:[t,x]}}try{await o(d)}catch(x){throw console.error(x),new Error("User denied spend permission request")}return s(i)}const g=u.map(x=>x.token.toLowerCase()==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".toLowerCase()?{to:n,value:q(x.requiredAmount),data:"0x"}:{to:x.token,value:"0x0",data:Re({abi:mE,functionName:"transfer",args:[n,x.requiredAmount]})});let y;if(i.method==="wallet_sendCalls"&&WP(i.params))y=i.params[0];else if(i.method==="eth_sendTransaction"&&KP(i.params))y=a1({calls:[i.params[0]],chainId:c,from:i.params[0].from}).params[0];else throw new Error("Could not get original call");const m=Re({abi:jt,functionName:"executeBatch",args:[y.calls.map(x=>{var E,v;return{target:x.to,value:Le((E=x.value)!==null&&E!==void 0?E:"0x0"),data:(v=x.data)!==null&&v!==void 0?v:"0x"}})]}),w=[...g,{data:m,to:n,value:"0x0"}],S=await o({method:"wallet_sendCalls",params:[Object.assign(Object.assign({},y),{calls:w,from:t})]});return i.method==="eth_sendTransaction"?o1({client:r,id:S}):S}class u1{constructor(t){var n,r,i,s;this.communicator=t.communicator,this.callback=t.callback,this.keyManager=new UP;const{account:o,chains:a}=W.getState();this.accounts=(n=o.accounts)!==null&&n!==void 0?n:[],this.chain=(r=o.chain)!==null&&r!==void 0?r:{id:(s=(i=t.metadata.appChainIds)===null||i===void 0?void 0:i[0])!==null&&s!==void 0?s:1},a&&Th(a)}async handshake(t){var n,r,i;const s=Rt.get(t);u4({method:t.method,correlationId:s});try{await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const o=await this.createRequestMessage({handshake:{method:t.method,params:(i=t.params)!==null&&i!==void 0?i:[]}},s),a=await this.communicator.postRequestAndWaitForResponse(o);if("failure"in a.content)throw a.content.failure;const c=await Dg("public",a.sender);await this.keyManager.setPeerPublicKey(c);const u=await this.decryptResponseMessage(a);this.handleResponse(t,u),d4({method:t.method,correlationId:s})}catch(o){throw l4({method:t.method,correlationId:s,errorMessage:ur(o)}),o}}async request(t){const n=Rt.get(t);f4({method:t.method,correlationId:n});try{const r=await this._request(t);return p4({method:t.method,correlationId:n}),r}catch(r){throw h4({method:t.method,correlationId:n,errorMessage:ur(r)}),r}}async _request(t){var n,r,i,s,o,a,c,u,l,d,f,h,g,y;if(this.accounts.length===0)switch(t.method){case"eth_requestAccounts":return await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n)),await nu(),await this.request({method:"wallet_connect",params:[{version:"1",capabilities:Object.assign({},(s=(i=W.subAccountsConfig.get())===null||i===void 0?void 0:i.capabilities)!==null&&s!==void 0?s:{})}]}),this.accounts;case"wallet_switchEthereumChain":{Gh(t.params),this.chain.id=Number(t.params[0].chainId);return}case"wallet_connect":{await((a=(o=this.communicator).waitForPopupLoaded)===null||a===void 0?void 0:a.call(o)),await nu();let m={};QP(t,"addSubAccount")&&(m=(u=(c=W.subAccountsConfig.get())===null||c===void 0?void 0:c.capabilities)!==null&&u!==void 0?u:{});const w=ka(t,m);return this.sendRequestToPopup(w)}case"wallet_sendCalls":case"wallet_sign":return this.sendRequestToPopup(t);default:throw G.provider.unauthorized()}if(this.shouldRequestUseSubAccountSigner(t)){const m=Rt.get(t);m4({method:t.method,correlationId:m});try{const w=await this.sendRequestToSubAccountSigner(t);return y4({method:t.method,correlationId:m}),w}catch(w){throw b4({method:t.method,correlationId:m,errorMessage:ur(w)}),w}}switch(t.method){case"eth_requestAccounts":case"eth_accounts":{const m=W.subAccounts.get(),w=W.subAccountsConfig.get();return m?.address&&(this.accounts=w?.enableAutoSubAccounts?jo(this.accounts,m.address):Fo(this.accounts,m.address)),(l=this.callback)===null||l===void 0||l.call(this,"connect",{chainId:q(this.chain.id)}),this.accounts}case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return q(this.chain.id);case"wallet_getCapabilities":return this.handleGetCapabilitiesRequest(t);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(t);case"eth_ecRecover":case"personal_sign":case"wallet_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(t);case"wallet_connect":{const m=await JP();if(m)return m;await((f=(d=this.communicator).waitForPopupLoaded)===null||f===void 0?void 0:f.call(d)),await nu();const w=W.subAccountsConfig.get(),S=ka(t,(h=w?.capabilities)!==null&&h!==void 0?h:{});return(g=this.callback)===null||g===void 0||g.call(this,"connect",{chainId:q(this.chain.id)}),this.sendRequestToPopup(S)}case"wallet_getSubAccounts":{const m=W.subAccounts.get();if(m?.address)return{subAccounts:[m]};if(!this.chain.rpcUrl)throw G.rpc.internal("No RPC URL set for chain");const w=await ds(t,this.chain.rpcUrl);if(Xn(w.subAccounts,"subAccounts"),w.subAccounts.length>0){Lo(w.subAccounts[0]);const S=w.subAccounts[0];W.subAccounts.set({address:S.address,factory:S.factory,factoryData:S.factoryData})}return w}case"wallet_addSubAccount":return this.addSubAccount(t);case"coinbase_fetchPermissions":{DP(t);const m=zP(t),w=await ds(m,Bg),S=pt((y=m.params)===null||y===void 0?void 0:y[0].chainId);return W.spendPermissions.set(w.permissions.map(x=>Object.assign(Object.assign({},x),{chainId:S}))),w}default:if(!this.chain.rpcUrl)throw G.rpc.internal("No RPC URL set for chain");return ds(t,this.chain.rpcUrl)}}async sendRequestToPopup(t){var n,r;await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const i=await this.sendEncryptedRequest(t),s=await this.decryptResponseMessage(i);return this.handleResponse(t,s)}async handleResponse(t,n){var r,i,s,o,a;const c=n.result;if("error"in c)throw c.error;switch(t.method){case"eth_requestAccounts":{const u=c.value;this.accounts=u,W.account.set({accounts:u,chain:this.chain}),(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",u);break}case"wallet_connect":{const u=c.value,l=u.accounts.map(w=>w.address);this.accounts=l,W.account.set({accounts:l});const d=u.accounts.at(0),f=d?.capabilities;if(f?.subAccounts){const w=f?.subAccounts;Xn(w,"subAccounts"),Lo(w[0]),W.subAccounts.set({address:w[0].address,factory:w[0].factory,factoryData:w[0].factoryData})}let h=[this.accounts[0]];const g=W.subAccounts.get(),y=W.subAccountsConfig.get();g?.address&&(this.accounts=y?.enableAutoSubAccounts?jo(this.accounts,g.address):Fo(this.accounts,g.address));const m=(s=(i=u?.accounts)===null||i===void 0?void 0:i[0].capabilities)===null||s===void 0?void 0:s.spendPermissions;m&&"permissions"in m&&W.spendPermissions.set(m?.permissions),(o=this.callback)===null||o===void 0||o.call(this,"accountsChanged",h);break}case"wallet_addSubAccount":{Lo(c.value);const u=c.value;W.subAccounts.set(u);const l=W.subAccountsConfig.get();this.accounts=l?.enableAutoSubAccounts?jo(this.accounts,u.address):Fo(this.accounts,u.address),(a=this.callback)===null||a===void 0||a.call(this,"accountsChanged",this.accounts);break}}return c.value}async cleanup(){var t,n;const r=W.config.get().metadata;await this.keyManager.clear(),W.account.clear(),W.subAccounts.clear(),W.spendPermissions.clear(),W.chains.clear(),this.accounts=[],this.chain={id:(n=(t=r?.appChainIds)===null||t===void 0?void 0:t[0])!==null&&n!==void 0?n:1}}async handleSwitchChainRequest(t){Gh(t.params);const n=ls(t.params[0].chainId);if(this.updateChain(n))return null;const i=await this.sendRequestToPopup(t);return i===null&&this.updateChain(n),i}async handleGetCapabilitiesRequest(t){FP(t.params);const n=t.params[0],r=t.params[1];if(!this.accounts.some(a=>Fr(a,n)))throw G.provider.unauthorized("no active account found when getting capabilities");const i=W.getState().account.capabilities;if(!i)return{};if(!r||r.length===0)return i;const s=new Set(r.map(a=>pt(a)));return Object.fromEntries(Object.entries(i).filter(([a])=>{try{const c=pt(a);return s.has(c)}catch{return!1}}))}async sendEncryptedRequest(t){const n=await this.keyManager.getSharedSecret();if(!n)throw G.provider.unauthorized("No shared secret found when encrypting request");const r=await k4({action:t,chainId:this.chain.id},n),i=Rt.get(t),s=await this.createRequestMessage({encrypted:r},i);return this.communicator.postRequestAndWaitForResponse(s)}async createRequestMessage(t,n){const r=await Fg("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),correlationId:n,sender:r,content:t,timestamp:new Date}}async decryptResponseMessage(t){var n,r,i;const s=t.content;if("failure"in s)throw s.failure;const o=await this.keyManager.getSharedSecret();if(!o)throw G.provider.unauthorized("Invalid session: no shared secret found when decrypting response");const a=await C4(s.encrypted,o),c=(n=a.data)===null||n===void 0?void 0:n.chains;if(c){const l=(r=a.data)===null||r===void 0?void 0:r.nativeCurrencies,d=Object.entries(c).map(([f,h])=>{const g=l?.[Number(f)];return Object.assign({id:Number(f),rpcUrl:h},g?{nativeCurrency:g}:{})});W.chains.set(d),this.updateChain(this.chain.id,d),Th(d)}const u=(i=a.data)===null||i===void 0?void 0:i.capabilities;return u&&W.account.set({capabilities:u}),a}updateChain(t,n){var r;const i=W.getState(),s=n??i.chains,o=s?.find(a=>a.id===t);return o?(o!==this.chain&&(this.chain=o,W.account.set({chain:o}),(r=this.callback)===null||r===void 0||r.call(this,"chainChanged",ii(o.id))),!0):!1}async addSubAccount(t){var n,r,i,s;const a=W.getState().subAccount,c=W.subAccountsConfig.get();if(a?.address)return this.accounts=c?.enableAutoSubAccounts?jo(this.accounts,a.address):Fo(this.accounts,a.address),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",this.accounts),a;if(await((i=(r=this.communicator).waitForPopupLoaded)===null||i===void 0?void 0:i.call(r)),Array.isArray(t.params)&&t.params.length>0&&t.params[0].account&&t.params[0].account.type==="create"){let l;if(t.params[0].account.keys&&t.params[0].account.keys.length>0)l=t.params[0].account.keys;else{const d=(s=W.subAccountsConfig.get())!==null&&s!==void 0?s:{},{account:f}=d.toOwnerAccount?await d.toOwnerAccount():await Pa();if(!f)throw G.provider.unauthorized("could not get subaccount owner account when adding sub account");l=[{type:f.address?"address":"webauthn-p256",publicKey:f.address||f.publicKey}]}t.params[0].account.keys=l}const u=await this.sendRequestToPopup(t);return Lo(u),u}shouldRequestUseSubAccountSigner(t){const n=qh(t),r=W.subAccounts.get();return n?n.toLowerCase()===r?.address.toLowerCase():!1}async sendRequestToSubAccountSigner(t){var n;const r=W.subAccounts.get(),i=W.subAccountsConfig.get(),s=W.config.get();xt(r?.address,G.provider.unauthorized("no active sub account when sending request to sub account signer"));const o=i?.toOwnerAccount?await i.toOwnerAccount():await Pa();xt(o?.account,G.provider.unauthorized("no active sub account owner when sending request to sub account signer")),qh(t)===void 0&&(t=jP(t,r.address));const c=Ug(this.chain.id);xt(c,G.rpc.internal(`client not found for chainId ${this.chain.id} when sending request to sub account signer`));const u=this.accounts.find(g=>g.toLowerCase()!==r.address.toLowerCase());xt(u,G.provider.unauthorized("no global account found when sending request to sub account signer"));const l=YP({attribution:(n=s.preference)===null||n===void 0?void 0:n.attribution,dappOrigin:window.location.origin}),d=o.account.type==="local"?o.account.address:o.account.publicKey;let f=await c1({address:r.address,factory:r.factory,factoryData:r.factoryData,publicKey:d,client:c});if(f===-1){const g=Rt.get(t);g4({method:t.method,correlationId:g});try{f=await ak({ownerAccount:o.account,globalAccountRequest:this.sendRequestToPopup.bind(this)}),w4({method:t.method,correlationId:g})}catch(y){return v4({method:t.method,correlationId:g,errorMessage:ur(y)}),G.provider.unauthorized("failed to add sub account owner when sending request to sub account signer")}}const{request:h}=await sk({address:r.address,owner:o.account,client:c,factory:r.factory,factoryData:r.factoryData,parentAddress:u,attribution:l?{suffix:l}:void 0,ownerIndex:f});try{return await h(t)}catch(g){let y;if(Sg(g))y=JSON.parse(g.details);else if(Ph(g))y=g;else throw g;if(!(Ph(y)&&y.data)||!y.data)throw g;const m=Rt.get(t);x4({method:t.method,correlationId:m});try{const w=await ck({errorData:y.data,globalAccountAddress:u,subAccountAddress:r.address,client:c,request:t,subAccountRequest:h,globalAccountRequest:this.request.bind(this)});return E4({method:t.method,correlationId:m}),w}catch(w){throw console.error(w),_4({method:t.method,correlationId:m,errorMessage:ur(w)}),g}}}}const uk=({method:e,correlationId:t})=>{oe("walletlink_signer.handshake.started",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t},se.high)},lk=({method:e,correlationId:t,errorMessage:n})=>{oe("walletlink_signer.handshake.error",{action:ie.error,componentType:re.unknown,method:e,correlationId:t,errorMessage:n},se.high)},dk=({method:e,correlationId:t})=>{oe("walletlink_signer.handshake.completed",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t},se.high)},fk=({method:e,correlationId:t})=>{oe("walletlink_signer.request.started",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t},se.high)},hk=({method:e,correlationId:t,errorMessage:n})=>{oe("walletlink_signer.request.error",{action:ie.error,componentType:re.unknown,method:e,correlationId:t,errorMessage:n},se.high)},pk=({method:e,correlationId:t})=>{oe("walletlink_signer.request.completed",{action:ie.unknown,componentType:re.unknown,method:e,correlationId:t},se.high)},Wh=()=>{oe("walletlink_signer.walletlink_connection.connection_failed",{action:ie.measurement,componentType:re.unknown},se.high)},mk=()=>{oe("walletlink_signer.walletlink_connection.fetch_unseen_events_failed",{action:ie.measurement,componentType:re.unknown},se.high)};var fe={},qe={};Object.defineProperty(qe,"__esModule",{value:!0});qe.output=qe.exists=qe.hash=qe.bytes=qe.bool=qe.number=qe.isBytes=void 0;function Ca(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}qe.number=Ca;function l1(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}qe.bool=l1;function d1(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}qe.isBytes=d1;function Tf(e,...t){if(!d1(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}qe.bytes=Tf;function f1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ca(e.outputLen),Ca(e.blockLen)}qe.hash=f1;function h1(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")}qe.exists=h1;function p1(e,t){Tf(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}qe.output=p1;const yk={number:Ca,bool:l1,bytes:Tf,hash:f1,exists:h1,output:p1};qe.default=yk;var J={};Object.defineProperty(J,"__esModule",{value:!0});J.add5L=J.add5H=J.add4H=J.add4L=J.add3H=J.add3L=J.add=J.rotlBL=J.rotlBH=J.rotlSL=J.rotlSH=J.rotr32L=J.rotr32H=J.rotrBL=J.rotrBH=J.rotrSL=J.rotrSH=J.shrSL=J.shrSH=J.toBig=J.split=J.fromBig=void 0;const Ho=BigInt(2**32-1),Ql=BigInt(32);function $f(e,t=!1){return t?{h:Number(e&Ho),l:Number(e>>Ql&Ho)}:{h:Number(e>>Ql&Ho)|0,l:Number(e&Ho)|0}}J.fromBig=$f;function m1(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:o}=$f(e[i],t);[n[i],r[i]]=[s,o]}return[n,r]}J.split=m1;const y1=(e,t)=>BigInt(e>>>0)<<Ql|BigInt(t>>>0);J.toBig=y1;const b1=(e,t,n)=>e>>>n;J.shrSH=b1;const g1=(e,t,n)=>e<<32-n|t>>>n;J.shrSL=g1;const w1=(e,t,n)=>e>>>n|t<<32-n;J.rotrSH=w1;const v1=(e,t,n)=>e<<32-n|t>>>n;J.rotrSL=v1;const x1=(e,t,n)=>e<<64-n|t>>>n-32;J.rotrBH=x1;const E1=(e,t,n)=>e>>>n-32|t<<64-n;J.rotrBL=E1;const _1=(e,t)=>t;J.rotr32H=_1;const S1=(e,t)=>e;J.rotr32L=S1;const I1=(e,t,n)=>e<<n|t>>>32-n;J.rotlSH=I1;const A1=(e,t,n)=>t<<n|e>>>32-n;J.rotlSL=A1;const P1=(e,t,n)=>t<<n-32|e>>>64-n;J.rotlBH=P1;const k1=(e,t,n)=>e<<n-32|t>>>64-n;J.rotlBL=k1;function C1(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}J.add=C1;const B1=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);J.add3L=B1;const O1=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;J.add3H=O1;const T1=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);J.add4L=T1;const $1=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;J.add4H=$1;const N1=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);J.add5L=N1;const M1=(e,t,n,r,i,s)=>t+n+r+i+s+(e/2**32|0)|0;J.add5H=M1;const bk={fromBig:$f,split:m1,toBig:y1,shrSH:b1,shrSL:g1,rotrSH:w1,rotrSL:v1,rotrBH:x1,rotrBL:E1,rotr32H:_1,rotr32L:S1,rotlSH:I1,rotlSL:A1,rotlBH:P1,rotlBL:k1,add:C1,add3L:B1,add3H:O1,add4L:T1,add4H:$1,add5H:M1,add5L:N1};J.default=bk;var L1={},uc={};Object.defineProperty(uc,"__esModule",{value:!0});uc.crypto=void 0;uc.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=uc,n=qe;function r(k){return k instanceof Uint8Array||k!=null&&typeof k=="object"&&k.constructor.name==="Uint8Array"}e.isBytes=r;const i=k=>new Uint8Array(k.buffer,k.byteOffset,k.byteLength);e.u8=i;const s=k=>new Uint32Array(k.buffer,k.byteOffset,Math.floor(k.byteLength/4));e.u32=s;const o=k=>new DataView(k.buffer,k.byteOffset,k.byteLength);e.createView=o;const a=(k,L)=>k<<32-L|k>>>L;e.rotr=a;const c=(k,L)=>k<<L|k>>>32-L>>>0;e.rotl=c,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const u=k=>k<<24&4278190080|k<<8&16711680|k>>>8&65280|k>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?k=>k:k=>(0,e.byteSwap)(k);function l(k){for(let L=0;L<k.length;L++)k[L]=(0,e.byteSwap)(k[L])}e.byteSwap32=l;const d=Array.from({length:256},(k,L)=>L.toString(16).padStart(2,"0"));function f(k){(0,n.bytes)(k);let L="";for(let $=0;$<k.length;$++)L+=d[k[$]];return L}e.bytesToHex=f;const h={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function g(k){if(k>=h._0&&k<=h._9)return k-h._0;if(k>=h._A&&k<=h._F)return k-(h._A-10);if(k>=h._a&&k<=h._f)return k-(h._a-10)}function y(k){if(typeof k!="string")throw new Error("hex string expected, got "+typeof k);const L=k.length,$=L/2;if(L%2)throw new Error("padded hex string expected, got unpadded hex of length "+L);const C=new Uint8Array($);for(let O=0,R=0;O<$;O++,R+=2){const U=g(k.charCodeAt(R)),H=g(k.charCodeAt(R+1));if(U===void 0||H===void 0){const V=k[R]+k[R+1];throw new Error('hex string expected, got non-hex character "'+V+'" at index '+R)}C[O]=U*16+H}return C}e.hexToBytes=y;const m=async()=>{};e.nextTick=m;async function w(k,L,$){let C=Date.now();for(let O=0;O<k;O++){$(O);const R=Date.now()-C;R>=0&&R<L||(await(0,e.nextTick)(),C+=R)}}e.asyncLoop=w;function S(k){if(typeof k!="string")throw new Error(`utf8ToBytes expected string, got ${typeof k}`);return new Uint8Array(new TextEncoder().encode(k))}e.utf8ToBytes=S;function x(k){return typeof k=="string"&&(k=S(k)),(0,n.bytes)(k),k}e.toBytes=x;function E(...k){let L=0;for(let C=0;C<k.length;C++){const O=k[C];(0,n.bytes)(O),L+=O.length}const $=new Uint8Array(L);for(let C=0,O=0;C<k.length;C++){const R=k[C];$.set(R,O),O+=R.length}return $}e.concatBytes=E;class v{clone(){return this._cloneInto()}}e.Hash=v;const I={}.toString;function A(k,L){if(L!==void 0&&I.call(L)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(k,L)}e.checkOpts=A;function B(k){const L=C=>k().update(x(C)).digest(),$=k();return L.outputLen=$.outputLen,L.blockLen=$.blockLen,L.create=()=>k(),L}e.wrapConstructor=B;function T(k){const L=(C,O)=>k(O).update(x(C)).digest(),$=k({});return L.outputLen=$.outputLen,L.blockLen=$.blockLen,L.create=C=>k(C),L}e.wrapConstructorWithOpts=T;function M(k){const L=(C,O)=>k(O).update(x(C)).digest(),$=k({});return L.outputLen=$.outputLen,L.blockLen=$.blockLen,L.create=C=>k(C),L}e.wrapXOFConstructorWithOpts=M;function j(k=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(k));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=j})(L1);Object.defineProperty(fe,"__esModule",{value:!0});fe.shake256=fe.shake128=fe.keccak_512=fe.keccak_384=fe.keccak_256=fe.keccak_224=fe.sha3_512=fe.sha3_384=fe.sha3_256=fe.sha3_224=fe.Keccak=fe.keccakP=void 0;const Jr=qe,Hs=J,gn=L1,R1=[],U1=[],j1=[],gk=BigInt(0),rs=BigInt(1),wk=BigInt(2),vk=BigInt(7),xk=BigInt(256),Ek=BigInt(113);for(let e=0,t=rs,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],R1.push(2*(5*r+n)),U1.push((e+1)*(e+2)/2%64);let i=gk;for(let s=0;s<7;s++)t=(t<<rs^(t>>vk)*Ek)%xk,t&wk&&(i^=rs<<(rs<<BigInt(s))-rs);j1.push(i)}const[_k,Sk]=(0,Hs.split)(j1,!0),Kh=(e,t,n)=>n>32?(0,Hs.rotlBH)(e,t,n):(0,Hs.rotlSH)(e,t,n),Zh=(e,t,n)=>n>32?(0,Hs.rotlBL)(e,t,n):(0,Hs.rotlSL)(e,t,n);function F1(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],l=n[c+1],d=Kh(u,l,1)^n[a],f=Zh(u,l,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=d,e[o+h+1]^=f}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=U1[o],c=Kh(i,s,a),u=Zh(i,s,a),l=R1[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=_k[r],e[1]^=Sk[r]}n.fill(0)}fe.keccakP=F1;let Nf=class D1 extends gn.Hash{constructor(t,n,r,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,Jr.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,gn.u32)(this.state)}keccak(){gn.isLE||(0,gn.byteSwap32)(this.state32),F1(this.state32,this.rounds),gn.isLE||(0,gn.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,Jr.exists)(this);const{blockLen:n,state:r}=this;t=(0,gn.toBytes)(t);const i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);for(let a=0;a<o;a++)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:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){(0,Jr.exists)(this,!1),(0,Jr.bytes)(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,Jr.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,Jr.output)(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,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new D1(n,r,i,o,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=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};fe.Keccak=Nf;const or=(e,t,n)=>(0,gn.wrapConstructor)(()=>new Nf(t,e,n));fe.sha3_224=or(6,144,224/8);fe.sha3_256=or(6,136,256/8);fe.sha3_384=or(6,104,384/8);fe.sha3_512=or(6,72,512/8);fe.keccak_224=or(1,144,224/8);fe.keccak_256=or(1,136,256/8);fe.keccak_384=or(1,104,384/8);fe.keccak_512=or(1,72,512/8);const z1=(e,t,n)=>(0,gn.wrapXOFConstructorWithOpts)((r={})=>new Nf(t,e,r.dkLen===void 0?n:r.dkLen,!0));fe.shake128=z1(31,168,128/8);fe.shake256=z1(31,136,256/8);const{keccak_256:Ik}=fe;function H1(e){return ce.allocUnsafe(e).fill(0)}function Ak(e){return`0x${e.toString(16)}`}function Pk(e){const t=Ak(e);return new ce(V1(t.slice(2)),"hex")}function kk(e){return e.toString(2).length}function q1(e,t){let n=e.toString(16);n.length%2!==0&&(n="0"+n);const r=n.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;r.length<t;)r.unshift(0);return ce.from(r)}function Ck(e,t){const n=e<0n;let r;if(n){const i=(1n<<BigInt(t))-1n;r=(~e&i)+1n}else r=e;return r&=(1n<<BigInt(t))-1n,r}function G1(e,t,n){const r=H1(t);return e=lc(e),n?e.length<t?(e.copy(r),r):e.slice(0,t):e.length<t?(e.copy(r,t-e.length),r):e.slice(-t)}function Bk(e,t){return G1(e,t,!0)}function lc(e){if(!ce.isBuffer(e))if(Array.isArray(e))e=ce.from(e);else if(typeof e=="string")W1(e)?e=ce.from(V1(K1(e)),"hex"):e=ce.from(e);else if(typeof e=="number")e=Pk(e);else if(e==null)e=ce.allocUnsafe(0);else if(typeof e=="bigint")e=q1(e);else if(e.toArray)e=ce.from(e.toArray());else throw new Error("invalid type");return e}function Ok(e){return e=lc(e),"0x"+e.toString("hex")}function Tk(e,t){if(e=lc(e),t||(t=256),t!==256)throw new Error("unsupported");return ce.from(Ik(new Uint8Array(e)))}function V1(e){return e.length%2?"0"+e:e}function W1(e){return typeof e=="string"&&e.match(/^0x[0-9A-Fa-f]*$/)}function K1(e){return typeof e=="string"&&e.startsWith("0x")?e.slice(2):e}var Z1={zeros:H1,setLength:G1,setLengthRight:Bk,isHexString:W1,stripHexPrefix:K1,toBuffer:lc,bufferToHex:Ok,keccak:Tk,bitLengthFromBigInt:kk,bufferBEFromBigInt:q1,twosFromBigInt:Ck};const st=Z1;function Y1(e){return e.startsWith("int[")?"int256"+e.slice(3):e==="int"?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):e==="uint"?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):e==="fixed"?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):e==="ufixed"?"ufixed128x128":e}function hi(e){return Number.parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function Yh(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[Number.parseInt(t[1],10),Number.parseInt(t[2],10)]}function Q1(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?t[2]===""?"dynamic":Number.parseInt(t[2],10):null}function lr(e){var t=typeof e;if(t==="string"||t==="number")return BigInt(e);if(t==="bigint")return e;throw new Error("Argument is not a number")}function Jt(e,t){var n,r,i,s;if(e==="address")return Jt("uint160",lr(t));if(e==="bool")return Jt("uint8",t?1:0);if(e==="string")return Jt("bytes",new ce(t,"utf8"));if(Nk(e)){if(typeof t.length>"u")throw new Error("Not an array?");if(n=Q1(e),n!=="dynamic"&&n!==0&&t.length>n)throw new Error("Elements exceed array size: "+n);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(s in t)i.push(Jt(e,t[s]));if(n==="dynamic"){var o=Jt("uint256",t.length);i.unshift(o)}return ce.concat(i)}else{if(e==="bytes")return t=new ce(t),i=ce.concat([Jt("uint256",t.length),t]),t.length%32!==0&&(i=ce.concat([i,st.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(n=hi(e),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);return st.setLengthRight(t,32)}else if(e.startsWith("uint")){if(n=hi(e),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=lr(t);const a=st.bitLengthFromBigInt(r);if(a>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+a);if(r<0)throw new Error("Supplied uint is negative");return st.bufferBEFromBigInt(r,32)}else if(e.startsWith("int")){if(n=hi(e),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=lr(t);const a=st.bitLengthFromBigInt(r);if(a>n)throw new Error("Supplied int exceeds width: "+n+" vs "+a);const c=st.twosFromBigInt(r,256);return st.bufferBEFromBigInt(c,32)}else if(e.startsWith("ufixed")){if(n=Yh(e),r=lr(t),r<0)throw new Error("Supplied ufixed is negative");return Jt("uint256",r*BigInt(2)**BigInt(n[1]))}else if(e.startsWith("fixed"))return n=Yh(e),Jt("int256",lr(t)*BigInt(2)**BigInt(n[1]))}throw new Error("Unsupported or invalid type: "+e)}function $k(e){return e==="string"||e==="bytes"||Q1(e)==="dynamic"}function Nk(e){return e.lastIndexOf("]")===e.length-1}function Mk(e,t){var n=[],r=[],i=32*e.length;for(var s in e){var o=Y1(e[s]),a=t[s],c=Jt(o,a);$k(o)?(n.push(Jt("uint256",i)),r.push(c),i+=c.length):n.push(c)}return ce.concat(n.concat(r))}function J1(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,i=[],s=0;s<e.length;s++){var o=Y1(e[s]),a=t[s];if(o==="bytes")i.push(a);else if(o==="string")i.push(new ce(a,"utf8"));else if(o==="bool")i.push(new ce(a?"01":"00","hex"));else if(o==="address")i.push(st.setLength(a,20));else if(o.startsWith("bytes")){if(n=hi(o),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);i.push(st.setLengthRight(a,n))}else if(o.startsWith("uint")){if(n=hi(o),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=lr(a);const c=st.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+c);i.push(st.bufferBEFromBigInt(r,n/8))}else if(o.startsWith("int")){if(n=hi(o),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=lr(a);const c=st.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied int exceeds width: "+n+" vs "+c);const u=st.twosFromBigInt(r,n);i.push(st.bufferBEFromBigInt(u,n/8))}else throw new Error("Unsupported or invalid type: "+o)}return ce.concat(i)}function Lk(e,t){return st.keccak(J1(e,t))}var Rk={rawEncode:Mk,solidityPack:J1,soliditySHA3:Lk};const Nt=Z1,hs=Rk,X1={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},iu={encodeData(e,t,n,r=!0){const i=["bytes32"],s=[this.hashType(e,n)];if(r){const o=(a,c,u)=>{if(n[c]!==void 0)return["bytes32",u==null?"0x0000000000000000000000000000000000000000000000000000000000000000":Nt.keccak(this.encodeData(c,u,n,r))];if(u===void 0)throw new Error(`missing value for field ${a} of type ${c}`);if(c==="bytes")return["bytes32",Nt.keccak(u)];if(c==="string")return typeof u=="string"&&(u=ce.from(u,"utf8")),["bytes32",Nt.keccak(u)];if(c.lastIndexOf("]")===c.length-1){const l=c.slice(0,c.lastIndexOf("[")),d=u.map(f=>o(a,l,f));return["bytes32",Nt.keccak(hs.rawEncode(d.map(([f])=>f),d.map(([,f])=>f)))]}return[c,u]};for(const a of n[e]){const[c,u]=o(a.name,a.type,t[a.name]);i.push(c),s.push(u)}}else for(const o of n[e]){let a=t[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=Nt.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=ce.from(a,"utf8")),a=Nt.keccak(a),s.push(a);else if(n[o.type]!==void 0)i.push("bytes32"),a=Nt.keccak(this.encodeData(o.type,a,n,r)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return hs.rawEncode(i,s)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter(i=>i!==e);r=[e].concat(r.sort());for(const i of r){if(!t[i])throw new Error("No type definition specified: "+i);n+=i+"("+t[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return n},findTypeDependencies(e,t,n=[]){if(e=e.match(/^\w*/)[0],n.includes(e)||t[e]===void 0)return n;n.push(e);for(const r of t[e])for(const i of this.findTypeDependencies(r.type,t,n))!n.includes(i)&&n.push(i);return n},hashStruct(e,t,n,r=!0){return Nt.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return Nt.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in X1.properties)e[n]&&(t[n]=e[n]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const n=this.sanitizeData(e),r=[ce.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),n.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(n.primaryType,n.message,n.types,t)),Nt.keccak(ce.concat(r))}};var Uk={TYPED_MESSAGE_SCHEMA:X1,TypedDataUtils:iu,hashForSignTypedDataLegacy:function(e){return jk(e.data)},hashForSignTypedData_v3:function(e){return iu.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return iu.hash(e.data)}};function jk(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const n=e.map(function(s){return s.type==="bytes"?Nt.toBuffer(s.value):s.value}),r=e.map(function(s){return s.type}),i=e.map(function(s){if(!s.name)throw t;return s.type+" "+s.name});return hs.soliditySHA3(["bytes32","bytes32"],[hs.soliditySHA3(new Array(e.length).fill("string"),i),hs.soliditySHA3(r,n)])}const qo=Fp(Uk),Fk="walletUsername",Jl="Addresses",Dk="AppVersion";class zk{constructor(t){this.secret=t}async encrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",ea(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},i,s.encode(t)),a=16,c=o.slice(o.byteLength-a),u=o.slice(0,o.byteLength-a),l=new Uint8Array(c),d=new Uint8Array(u),f=new Uint8Array([...r,...l,...d]);return Ef(f)}async decrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");return new Promise((r,i)=>{(async()=>{const s=await crypto.subtle.importKey("raw",ea(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=ea(t),a=o.slice(0,12),c=o.slice(12,28),u=o.slice(28),l=new Uint8Array([...u,...c]),d={name:"AES-GCM",iv:new Uint8Array(a)};try{const f=await window.crypto.subtle.decrypt(d,s,l),h=new TextDecoder;r(h.decode(f))}catch(f){i(f)}})()})}}class Hk{constructor(t,n,r){this.linkAPIUrl=t,this.sessionId=n;const i=`${n}:${r}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(n=>fetch(`${this.linkAPIUrl}/events/${n.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(n=>console.error("Unable to mark events as seen:",n))}async fetchUnseenEvents(){var t;const n=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(n.ok){const{events:r,error:i}=await n.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=r?.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${n.status}`)}}var nn;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(nn||(nn={}));class wt{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,n=WebSocket){this.WebSocketClass=n,this.webSocket=null,this.isDisconnecting=!1,this.url=t.replace(/^http/,"ws"),this.instanceId=wt.instanceCounter++,wt.activeInstances.add(this.instanceId)}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");if(this.isDisconnecting)throw new Error("WebSocket is disconnecting, cannot reconnect on same instance");return new Promise((t,n)=>{var r;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){n(s);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,nn.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),i.readyState!==WebSocket.OPEN&&n(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,nn.DISCONNECTED)},i.onopen=s=>{var o;t(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,nn.CONNECTED),wt.pendingData.length>0&&([...wt.pendingData].forEach(c=>this.sendData(c)),wt.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,c)}catch{}}})}disconnect(){var t;const{webSocket:n}=this;if(n){this.isDisconnecting=!0,this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,nn.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{n.close()}catch{}}}sendData(t){const{webSocket:n}=this;if(!n){wt.pendingData.push(t),this.isDisconnecting||this.connect();return}if(n.readyState!==WebSocket.OPEN){wt.pendingData.push(t);return}n.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}cleanup(){wt.activeInstances.delete(this.instanceId)}}wt.instanceCounter=0;wt.activeInstances=new Set;wt.pendingData=[];const Qh=1e4,qk=6e4;class Gk{constructor({session:t,linkAPIUrl:n,listener:r}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=vn(1),this.reconnectAttempts=0,this.isReconnecting=!1,this._connected=!1,this._linked=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,c)=>{const u=s[c];u!==void 0&&a(u)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;try{const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)}catch{}},this.handleMetadataUpdated=async(s,o)=>{var a;try{const c=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,c)}catch{}},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(Fk,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(Dk,s)},this.handleChainUpdated=async(s,o)=>{var a;try{const c=await this.cipher.decrypt(s),u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(c,u)}catch{}},this.session=t,this.cipher=new zk(t.secret),this.listener=r,this.linkAPIUrl=n,this.WebSocketClass=WebSocket;const i=this.createWebSocket();this.ws=i,this.http=new Hk(n,t.id,t.key),this.setupVisibilityChangeHandler()}createWebSocket(){const t=new wt(`${this.linkAPIUrl}/rpc`,this.WebSocketClass);return this.activeWsInstance=t,t.setConnectionStateListener(async n=>{if(t!==this.activeWsInstance)return;let r=!1;switch(n){case nn.DISCONNECTED:this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.lastHeartbeatResponse=0,r=!1,this.destroyed||(async()=>{if(this.isReconnecting)return;this.isReconnecting=!0;const s=this.reconnectAttempts===0?0:3e3;await new Promise(o=>setTimeout(o,s)),!this.destroyed&&t===this.activeWsInstance?(this.reconnectAttempts++,"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{Wh()}).finally(()=>{this.isReconnecting=!1})):this.isReconnecting=!1})();break;case nn.CONNECTED:this.reconnectAttempts=0;try{r=await this.handleConnected(),this.fetchUnseenEventsAPI().catch(()=>{})}catch{break}this.connected=r,this.updateLastHeartbeat(),this.heartbeatIntervalId&&clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=window.setInterval(()=>{this.heartbeat()},Qh),setTimeout(()=>{this.heartbeat()},100);break;case nn.CONNECTING:break}n!==nn.CONNECTED&&(this.connected=r)}),t.setIncomingDataListener(n=>{var r;switch(n.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const i=n.type==="IsLinkedOK"?n.linked:void 0;this.linked=i||n.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(n.metadata);break}case"Event":{this.handleIncomingEvent(n);break}}n.id!==void 0&&((r=this.requestResolutions.get(n.id))===null||r===void 0||r(n))}),t}setupVisibilityChangeHandler(){this.visibilityChangeHandler=()=>{!document.hidden&&!this.destroyed&&(this.connected?this.heartbeat():this.reconnectWithFreshWebSocket())},this.focusHandler=()=>{!this.destroyed&&!this.connected&&this.reconnectWithFreshWebSocket()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),window.addEventListener("focus",this.focusHandler),window.addEventListener("pageshow",t=>{t.persisted&&this.focusHandler&&this.focusHandler()})}reconnectWithFreshWebSocket(){if(this.destroyed)return;const t=this.ws;this.activeWsInstance=void 0,t.disconnect(),"cleanup"in t&&typeof t.cleanup=="function"&&t.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{Wh()})}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:vn(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.activeWsInstance=void 0,this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.focusHandler&&window.removeEventListener("focus",this.focusHandler),this.ws.disconnect(),"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.listener=void 0)}get connected(){return this._connected}set connected(t){this._connected=t}get linked(){return this._linked}set linked(t){var n,r;this._linked=t,t&&((n=this.onceLinked)===null||n===void 0||n.call(this)),(r=this.listener)===null||r===void 0||r.linkedUpdated(t)}setOnceLinked(t){return new Promise(n=>{this.linked?t().then(n):this.onceLinked=()=>{t().then(n),this.onceLinked=void 0}})}async handleIncomingEvent(t){var n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const r=await this.cipher.decrypt(t.data),i=JSON.parse(r);if(i.type!=="WEB3_RESPONSE")return;(n=this.listener)===null||n===void 0||n.handleWeb3ResponseMessage(i.id,i.response)}catch{}}async checkUnseenEvents(){await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){try{(await this.http.fetchUnseenEvents()).forEach(n=>{this.handleIncomingEvent(n)})}catch{mk()}}async publishEvent(t,n,r=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},n),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:vn(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:r};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Qh*2){this.ws.disconnect();return}if(this.connected)try{this.ws.sendData("h")}catch{}}async makeRequest(t,n={timeout:qk}){const r=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${r} timed out`))},n.timeout)}),new Promise(s=>{this.requestResolutions.set(r,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(r)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:vn(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:vn(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:vn(this.nextReqId++),sessionId:this.session.id}),!0)}}class Vk{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const t=this._nextRequestId,n=Cg(t.toString(16));return this.callbacks.get(n)&&this.callbacks.delete(n),t}}function Wk(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Mf(e,...t){if(!Wk(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function Jh(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 Kk(e,t){Mf(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const su=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Zt=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];const Zk=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Yk(e){Mf(e);let t="";for(let n=0;n<e.length;n++)t+=Zk[e[n]];return t}function Qk(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function ew(e){return typeof e=="string"&&(e=Qk(e)),Mf(e),e}let Jk=class{clone(){return this._cloneInto()}};function Xk(e){const t=r=>e().update(ew(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function eC(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}const tC=(e,t,n)=>e&t^~e&n,nC=(e,t,n)=>e&t^e&n^t&n;let rC=class extends Jk{constructor(t,n,r,i){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=su(this.buffer)}update(t){Jh(this);const{view:n,buffer:r,blockLen:i}=this;t=ew(t);const s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=su(t);for(;i<=s-o;o+=i)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Jh(this),Kk(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;eC(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=su(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.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:i,finished:s,destroyed:o,pos:a}=this;return t.length=i,t.pos=a,t.finished=s,t.destroyed=o,i%n&&t.buffer.set(r),t}};const iC=new Uint32Array([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]),Vn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Wn=new Uint32Array(64);let sC=class extends rC{constructor(){super(64,32,8,!1),this.A=Vn[0]|0,this.B=Vn[1]|0,this.C=Vn[2]|0,this.D=Vn[3]|0,this.E=Vn[4]|0,this.F=Vn[5]|0,this.G=Vn[6]|0,this.H=Vn[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:o,G:a,H:c}=this;return[t,n,r,i,s,o,a,c]}set(t,n,r,i,s,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Wn[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=Wn[d-15],h=Wn[d-2],g=Zt(f,7)^Zt(f,18)^f>>>3,y=Zt(h,17)^Zt(h,19)^h>>>10;Wn[d]=y+Wn[d-7]+g+Wn[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Zt(a,6)^Zt(a,11)^Zt(a,25),h=l+f+tC(a,c,u)+iC[d]+Wn[d]|0,y=(Zt(r,2)^Zt(r,13)^Zt(r,22))+nC(r,i,s)|0;l=u,u=c,c=a,a=o+h|0,o=s,s=i,i=r,r=h+y|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,i,s,o,a,c,u,l)}roundClean(){Wn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const oC=Xk(()=>new sC),Xh="session:id",ep="session:secret",tp="session:linked";class pi{constructor(t,n,r,i=!1){this.storage=t,this.id=n,this.secret=r,this.key=Yk(oC(`${n}, ${r} WalletLink`)),this._linked=!!i}static create(t){const n=cr(16),r=cr(32);return new pi(t,n,r).save()}static load(t){const n=t.getItem(Xh),r=t.getItem(tp),i=t.getItem(ep);return n&&i?new pi(t,n,i,r==="1"):null}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this.storage.setItem(Xh,this.id),this.storage.setItem(ep,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(tp,this._linked?"1":"0")}}const aC=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class cC{constructor(){this.root=null,this.darkMode=$g()}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),Og()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&(Ds(null,this.root),t&&Ds(ae(uC,Object.assign({},t,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const uC=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:i})=>{const s=n?"dark":"light";return ae(Mg,{darkMode:n},ae("div",{class:"-cbwsdk-redirect-dialog"},ae("style",null,aC),ae("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),ae("div",{class:fs("-cbwsdk-redirect-dialog-box",s)},ae("p",null,e),ae("button",{onClick:r},t))))};class np{constructor(){this.attached=!1,this.redirectDialog=new cC}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(t){const n=new URL(NA);n.searchParams.append("redirect_url",FA().href),t&&n.searchParams.append("wl_url",t);const r=document.createElement("a");r.target="cbw-opener",r.href=n.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(t){this.redirectToCoinbaseWallet(t),setTimeout(()=>{this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}})},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}}class xn{constructor(t){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=DA(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(Jl);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),xn.accountRequestCallbackIds.size>0&&(Array.from(xn.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),xn.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.metadata=t.metadata,this.accountsCallback=t.accountsCallback,this.chainCallback=t.chainCallback;const{session:n,ui:r,connection:i}=this.subscribe();this._session=n,this.connection=i,this.relayEventManager=new Vk,this.ui=r,this.ui.attach()}subscribe(){const t=pi.load(this.storage)||pi.create(this.storage),{linkAPIUrl:n}=this,r=new Gk({session:t,linkAPIUrl:n,listener:this}),i=this.isMobileWeb?new np:new VA;return r.connect(),{session:t,ui:i,connection:r}}resetAndReload(){this.connection.destroy().then(()=>{const t=pi.load(this.storage);t?.id===this._session.id&&Nr.clearAll(),document.location.reload()}).catch(t=>{})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:Wt(t.weiValue),data:us(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?Wt(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?Wt(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?Wt(t.gasPriceInWei):null,gasLimit:t.gasLimit?Wt(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:Wt(t.weiValue),data:us(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?Wt(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?Wt(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?Wt(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?Wt(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,n){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:us(t,!0),chainId:n}})}getWalletLinkSession(){return this._session}sendRequest(t){let n=null;const r=cr(8),i=s=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,s),n?.()};return new Promise((s,o)=>{n=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,a=>{if(n?.(),Ze(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(r,t)})}publishWeb3RequestEvent(t,n){const r={type:"WEB3_REQUEST",id:t,request:n};this.publishEvent("Web3Request",r,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(r.id,{method:n.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(n.method)}openCoinbaseWalletDeeplink(t){if(this.ui instanceof np)switch(t){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(t){const n={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",n,!1).then()}publishEvent(t,n,r){return this.connection.publishEvent(t,n,r)}handleWeb3ResponseMessage(t,n){if(n.method==="requestEthereumAccounts"){xn.accountRequestCallbackIds.forEach(r=>this.invokeCallback(r,n)),xn.accountRequestCallbackIds.clear();return}this.invokeCallback(t,n)}handleErrorResponse(t,n,r){var i;const s=(i=r?.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(t,{method:n,errorMessage:s})}invokeCallback(t,n){const r=this.relayEventManager.callbacks.get(t);r&&(r(n),this.relayEventManager.callbacks.delete(t))}requestEthereumAccounts(){const{appName:t,appLogoUrl:n}=this.metadata,r={method:"requestEthereumAccounts",params:{appName:t,appLogoUrl:n}},i=cr(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(Ze(a))return o(new Error(a.errorMessage));s(a)}),xn.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,r)})}watchAsset(t,n,r,i,s,o){const a={method:"watchAsset",params:{type:t,options:{address:n,symbol:r,decimals:i,image:s},chainId:o}};let c=null;const u=cr(8),l=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,d),c?.()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise((d,f)=>{this.relayEventManager.callbacks.set(u,h=>{if(c?.(),Ze(h))return f(new Error(h.errorMessage));d(h)}),this.publishWeb3RequestEvent(u,a)})}addEthereumChain(t,n,r,i,s,o){const a={method:"addEthereumChain",params:{chainId:t,rpcUrls:n,blockExplorerUrls:i,chainName:s,iconUrls:r,nativeCurrency:o}};let c=null;const u=cr(8),l=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,d),c?.()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise((d,f)=>{this.relayEventManager.callbacks.set(u,h=>{if(c?.(),Ze(h))return f(new Error(h.errorMessage));d(h)}),this.publishWeb3RequestEvent(u,a)})}switchEthereumChain(t,n){const r={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:n})};let i=null;const s=cr(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,r.method,a),i?.()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,c)=>{this.relayEventManager.callbacks.set(s,u=>{if(i?.(),Ze(u)&&u.errorCode)return c(G.provider.custom({code:u.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(Ze(u))return c(new Error(u.errorMessage));a(u)}),this.publishWeb3RequestEvent(s,r)})}}xn.accountRequestCallbackIds=new Set;const rp="DefaultChainId",ip="DefaultJsonRpcUrl";class tw{constructor(t){this._relay=null,this._addresses=[],this.metadata=t.metadata,this._storage=new Nr("walletlink",Ch),this.callback=t.callback||null;const n=this._storage.getItem(Jl);if(n){const r=n.split(" ");r[0]!==""&&(this._addresses=r.map(i=>Hn(i)))}this.initializeRelay()}getSession(){const t=this.initializeRelay(),{id:n,secret:r}=t.getWalletLinkSession();return{id:n,secret:r}}async handshake(t){const n="eth_requestAccounts",r=Rt.get(t);uk({method:n,correlationId:r});try{await this._eth_requestAccounts(),dk({method:n,correlationId:r})}catch(i){throw lk({method:n,correlationId:r,errorMessage:ur(i)}),i}}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var t;return(t=this._storage.getItem(ip))!==null&&t!==void 0?t:void 0}set jsonRpcUrl(t){this._storage.setItem(ip,t)}updateProviderInfo(t,n){var r;this.jsonRpcUrl=t;const i=this.getChainId();this._storage.setItem(rp,n.toString(10)),ls(n)!==i&&((r=this.callback)===null||r===void 0||r.call(this,"chainChanged",ii(n)))}async watchAsset(t){const n=Array.isArray(t)?t[0]:t;if(!n.type)throw G.rpc.invalidParams("Type is required");if(n?.type!=="ERC20")throw G.rpc.invalidParams(`Asset of type '${n.type}' is not supported`);if(!n?.options)throw G.rpc.invalidParams("Options are required");if(!n?.options.address)throw G.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=n.options,u=await this.initializeRelay().watchAsset(n.type,i,s,a,o,r?.toString());return Ze(u)?!1:!!u.result}async addEthereumChain(t){var n,r;const i=t[0];if(((n=i.rpcUrls)===null||n===void 0?void 0:n.length)===0)throw G.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw G.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw G.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:c=[],chainName:u,iconUrls:l=[],nativeCurrency:d}=i,f=await o.addEthereumChain(s.toString(),a,l,c,u,d);if(Ze(f))return!1;if(((r=f.result)===null||r===void 0?void 0:r.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw G.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(t){const n=t[0],r=Number.parseInt(n.chainId,16),s=await this.initializeRelay().switchEthereumChain(r.toString(10),this.selectedAddress||void 0);if(Ze(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,r),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(t,n){var r;if(!Array.isArray(t))throw new Error("addresses is not an array");const i=t.map(s=>Hn(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",i),this._storage.setItem(Jl,i.join(" ")))}async request(t){const n=Rt.get(t);fk({method:t.method,correlationId:n});try{const r=await this._request(t);return pk({method:t.method,correlationId:n}),r}catch(r){throw hk({method:t.method,correlationId:n,errorMessage:ur(r)}),r}}async _request(t){const n=t.params||[];switch(t.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return ii(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(t);case"personal_sign":return this.personalSign(t);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(t);case"wallet_addEthereumChain":return this.addEthereumChain(n);case"wallet_switchEthereumChain":return this.switchEthereumChain(n);case"wallet_watchAsset":return this.watchAsset(n);default:if(!this.jsonRpcUrl)throw G.rpc.internal("No RPC URL set for chain");return ds(t,this.jsonRpcUrl)}}_ensureKnownAddress(t){const n=Hn(t);if(!this._addresses.map(i=>Hn(i)).includes(n))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(t){const n=t.from?Hn(t.from):this.selectedAddress;if(!n)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(n);const r=t.to?Hn(t.to):null,i=t.value!=null?ts(t.value):BigInt(0),s=t.data?Kl(t.data):ce.alloc(0),o=t.nonce!=null?ls(t.nonce):null,a=t.gasPrice!=null?ts(t.gasPrice):null,c=t.maxFeePerGas!=null?ts(t.maxFeePerGas):null,u=t.maxPriorityFeePerGas!=null?ts(t.maxPriorityFeePerGas):null,l=t.gas!=null?ts(t.gas):null,d=t.chainId?ls(t.chainId):this.getChainId();return{fromAddress:n,toAddress:r,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:c,maxPriorityFeePerGas:u,gasLimit:l,chainId:d}}async ecRecover(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw G.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:Xc(r[0]),signature:Xc(r[1]),addPrefix:n==="personal_ecRecover"}});if(Ze(s))throw s;return s.result}getChainId(){var t;return Number.parseInt((t=this._storage.getItem(rp))!==null&&t!==void 0?t:"1",10)}async _eth_requestAccounts(){var t,n;if(this._addresses.length>0)return(t=this.callback)===null||t===void 0||t.call(this,"connect",{chainId:ii(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(Ze(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(n=this.callback)===null||n===void 0||n.call(this,"connect",{chainId:ii(this.getChainId())}),this._addresses}async personalSign({params:t}){if(!Array.isArray(t))throw G.rpc.invalidParams();const n=t[1],r=t[0];this._ensureKnownAddress(n);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:Hn(n),message:Xc(r),addPrefix:!0,typedDataJson:null}});if(Ze(s))throw s;return s.result}async _eth_signTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),i=await this.initializeRelay().signEthereumTransaction(n);if(Ze(i))throw i;return i.result}async _eth_sendRawTransaction(t){const n=Kl(t[0]),i=await this.initializeRelay().submitEthereumTransaction(n,this.getChainId());if(Ze(i))throw i;return i.result}async _eth_sendTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(n);if(Ze(i))throw i;return i.result}async signTypedData(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw G.rpc.invalidParams();const i=u=>{const l={eth_signTypedData_v1:qo.hashForSignTypedDataLegacy,eth_signTypedData_v3:qo.hashForSignTypedData_v3,eth_signTypedData_v4:qo.hashForSignTypedData_v4,eth_signTypedData:qo.hashForSignTypedData_v4};return us(l[n]({data:EA(u)}),!0)},s=r[n==="eth_signTypedData_v1"?1:0],o=r[n==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:Hn(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(Ze(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new xn({linkAPIUrl:Ch,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const nw="SignerType",rw=new Nr("CBWSDK","SignerConfigurator");function lC(){return rw.getItem(nw)}function dC(e){rw.setItem(nw,e)}function sp(e){if(e)return e instanceof u1?"scw":"walletlink"}async function fC(e){const{communicator:t,metadata:n,handshakeRequest:r,callback:i}=e;pC(t,n,i,r).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},e.preference),{handshakeRequest:r})},{data:o}=await t.postRequestAndWaitForResponse(s);return o}function hC(e){const{signerType:t,metadata:n,communicator:r,callback:i}=e;switch(t){case"scw":return new u1({metadata:n,callback:i,communicator:r});case"walletlink":return new tw({metadata:n,callback:i})}}async function pC(e,t,n,r){await e.onMessage(({event:s})=>s==="WalletLinkSessionRequest");const i=new tw({metadata:t,callback:n});e.postMessage({event:"WalletLinkUpdate",data:{session:i.getSession()}}),await i.handshake(r),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var mC=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};class yC extends t4{constructor(t){var{metadata:n}=t,r=t.preference,{keysUrl:i}=r,s=mC(r,["keysUrl"]);super(),this.signer=null,this.isCoinbaseWallet=!0,this.metadata=n,this.preference=s,this.communicator=new JA({url:i,metadata:n,preference:s});const o=lC();o&&(this.signer=this.initSigner(o),n4({signerType:o}))}async request(t){const n=crypto.randomUUID();Rt.set(t,n),r4({method:t.method,correlationId:n});try{const r=await this._request(t);return s4({method:t.method,signerType:sp(this.signer),correlationId:n}),r}catch(r){throw i4({method:t.method,correlationId:n,signerType:sp(this.signer),errorMessage:r instanceof Error?r.message:""}),r}finally{Rt.delete(t)}}async _request(t){try{if(OA(t),!this.signer)switch(t.method){case"eth_requestAccounts":{let r;const i=W.subAccountsConfig.get();i?.enableAutoSubAccounts?r="scw":r=await this.requestSignerSelection(t);const s=this.initSigner(r);r==="scw"&&i?.enableAutoSubAccounts?(await s.handshake({method:"handshake"}),await s.request(t)):await s.handshake(t),this.signer=s,dC(r);break}case"wallet_connect":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const i=await r.request(t);return this.signer=r,i}case"wallet_sendCalls":case"wallet_sign":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const i=await r.request(t);return await r.cleanup(),i}case"wallet_getCallsStatus":return await ds(t,Bg);case"net_version":return 1;case"eth_chainId":return ii(1);default:throw G.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")}return await this.signer.request(t)}catch(n){const{code:r}=n;return r===ke.provider.unauthorized&&this.disconnect(),Promise.reject(XA(n))}}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),o4(),await this.request({method:"eth_requestAccounts"})}async disconnect(){var t;await((t=this.signer)===null||t===void 0?void 0:t.cleanup()),this.signer=null,Nr.clearAll(),Rt.clear(),this.emit("disconnect",G.provider.disconnected("User initiated disconnection"))}async requestSignerSelection(t){a4();const n=await fC({communicator:this.communicator,preference:this.preference,metadata:this.metadata,handshakeRequest:t,callback:this.emit.bind(this)});return c4(n),n}initSigner(t){return hC({signerType:t,metadata:this.metadata,communicator:this.communicator,callback:this.emit.bind(this)})}}function bC(e){var t;const n={metadata:e.metadata,preference:e.preference};return(t=BA(n))!==null&&t!==void 0?t:new yC(n)}const gC={options:"all"};function wC(e){var t,n,r,i;const s={metadata:{appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||"",appChainIds:e.appChainIds||[]},preference:Object.assign(gC,(t=e.preference)!==null&&t!==void 0?t:{}),paymasterUrls:e.paymasterUrls};!((n=e.subAccounts)===null||n===void 0)&&n.toOwnerAccount&&kh(e.subAccounts.toOwnerAccount),W.subAccountsConfig.set({toOwnerAccount:(r=e.subAccounts)===null||r===void 0?void 0:r.toOwnerAccount,enableAutoSubAccounts:(i=e.subAccounts)===null||i===void 0?void 0:i.enableAutoSubAccounts}),W.config.set(s),W.persist.rehydrate(),AA(),s.preference.telemetry!==!1&&pA(),TA(s.preference);let o=null;const a={getProvider(){return o||(o=bC(s)),o.sdk=a,o},subAccount:{async create(c){var u,l;const d=W.getState();return xt((u=d.subAccount)===null||u===void 0?void 0:u.address,new Error("subaccount already exists")),await((l=a.getProvider())===null||l===void 0?void 0:l.request({method:"wallet_addSubAccount",params:[{version:"1",account:c}]}))},async get(){var c,u;const l=W.subAccounts.get();if(l?.address)return l;const f=(u=(await((c=a.getProvider())===null||c===void 0?void 0:c.request({method:"wallet_connect",params:[{version:"1",capabilities:{}}]}))).accounts[0].capabilities)===null||u===void 0?void 0:u.subAccounts;return Array.isArray(f)?f[0]:null},async addOwner({address:c,publicKey:u,chainId:l}){var d,f;const h=W.subAccounts.get(),g=W.account.get();xt(g,new Error("account does not exist")),xt(h?.address,new Error("subaccount does not exist"));const y=[];if(u){const[m,w]=Ur([{type:"bytes32"},{type:"bytes32"}],u);y.push({to:h.address,data:Re({abi:jt,functionName:"addOwnerPublicKey",args:[m,w]}),value:ht(0)})}return c&&y.push({to:h.address,data:Re({abi:jt,functionName:"addOwnerAddress",args:[c]}),value:ht(0)}),await((d=a.getProvider())===null||d===void 0?void 0:d.request({method:"wallet_sendCalls",params:[{calls:y,chainId:ht(l),from:(f=g.accounts)===null||f===void 0?void 0:f[0],version:"1"}]}))},setToOwnerAccount(c){kh(c),W.subAccountsConfig.set({toOwnerAccount:c})}}};return a}const vC=Object.freeze(Object.defineProperty({__proto__:null,createCoinbaseWalletSDK:wC,getCryptoKeyAccount:Pa},Symbol.toStringTag,{value:"Module"}));function qs(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function op(e){return qs(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const iw="2.23.2";let ou={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${iw}`},dc=class Xl extends Error{constructor(t,n={}){const r=n.cause instanceof Xl?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof Xl&&n.cause.docsPath||n.docsPath,s=ou.getDocsUrl?.({...n,docsPath:i}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...ou.version?[`Version: ${ou.version}`]:[]].join(`
73
+ `);super(o,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=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=iw}walk(t){return sw(this,t)}};function sw(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?sw(e.cause,t):t?null:e}let ow=class extends dc{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};function Ki(e,{dir:t,size:n=32}={}){return typeof e=="string"?xC(e,{dir:t,size:n}):EC(e,{dir:t,size:n})}function xC(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new ow({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function EC(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ow({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let i=0;i<n;i++){const s=t==="right";r[s?i:n-i-1]=e[s?i:e.length-i-1]}return r}let _C=class extends dc{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},SC=class extends dc{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Zi(e,{size:t}){if(op(e)>t)throw new SC({givenSize:op(e),maxSize:t})}function ed(e,t={}){const{signed:n}=t;t.size&&Zi(e,{size:t.size});const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function IC(e,t={}){return Number(ed(e,t))}const AC=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function td(e,t={}){return typeof e=="number"||typeof e=="bigint"?cw(e,t):typeof e=="string"?CC(e,t):typeof e=="boolean"?PC(e,t):aw(e,t)}function PC(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Zi(n,{size:t.size}),Ki(n,{size:t.size})):n}function aw(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=AC[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(Zi(r,{size:t.size}),Ki(r,{dir:"right",size:t.size})):r}function cw(e,t={}){const{signed:n,size:r}=t,i=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 o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const c=typeof e=="bigint"?"n":"";throw new _C({max:s?`${s}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?Ki(a,{size:r}):a}const kC=new TextEncoder;function CC(e,t={}){const n=kC.encode(e);return aw(n,t)}const BC=new TextEncoder;function OC(e,t={}){return typeof e=="number"||typeof e=="bigint"?$C(e,t):typeof e=="boolean"?TC(e,t):qs(e)?uw(e,t):lw(e,t)}function TC(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Zi(n,{size:t.size}),Ki(n,{size:t.size})):n}const hn={zero:48,nine:57,A:65,F:70,a:97,f:102};function ap(e){if(e>=hn.zero&&e<=hn.nine)return e-hn.zero;if(e>=hn.A&&e<=hn.F)return e-(hn.A-10);if(e>=hn.a&&e<=hn.f)return e-(hn.a-10)}function uw(e,t={}){let n=e;t.size&&(Zi(n,{size:t.size}),n=Ki(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,s=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const c=ap(r.charCodeAt(a++)),u=ap(r.charCodeAt(a++));if(c===void 0||u===void 0)throw new dc(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);s[o]=c*16+u}return s}function $C(e,t){const n=cw(e,t);return uw(n)}function lw(e,t={}){const n=BC.encode(e);return typeof t.size=="number"?(Zi(n,{size:t.size}),Ki(n,{dir:"right",size:t.size})):n}function Ba(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function NC(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function po(e,...t){if(!NC(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 MC(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ba(e.outputLen),Ba(e.blockLen)}function Ci(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 dw(e,t){po(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const Go=BigInt(2**32-1),cp=BigInt(32);function LC(e,t=!1){return t?{h:Number(e&Go),l:Number(e>>cp&Go)}:{h:Number(e>>cp&Go)|0,l:Number(e&Go)|0}}function RC(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:o}=LC(e[i],t);[n[i],r[i]]=[s,o]}return[n,r]}const UC=(e,t,n)=>e<<n|t>>>32-n,jC=(e,t,n)=>t<<n|e>>>32-n,FC=(e,t,n)=>t<<n-32|e>>>64-n,DC=(e,t,n)=>e<<n-32|t>>>64-n,Xr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function zC(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function au(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Yt(e,t){return e<<32-t|e>>>t}const up=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function HC(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function lp(e){for(let t=0;t<e.length;t++)e[t]=HC(e[t])}function qC(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function fc(e){return typeof e=="string"&&(e=qC(e)),po(e),e}function GC(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];po(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}let Lf=class{clone(){return this._cloneInto()}};function fw(e){const t=r=>e().update(fc(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function VC(e=32){if(Xr&&typeof Xr.getRandomValues=="function")return Xr.getRandomValues(new Uint8Array(e));if(Xr&&typeof Xr.randomBytes=="function")return Xr.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const hw=[],pw=[],mw=[],WC=BigInt(0),is=BigInt(1),KC=BigInt(2),ZC=BigInt(7),YC=BigInt(256),QC=BigInt(113);for(let e=0,t=is,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],hw.push(2*(5*r+n)),pw.push((e+1)*(e+2)/2%64);let i=WC;for(let s=0;s<7;s++)t=(t<<is^(t>>ZC)*QC)%YC,t&KC&&(i^=is<<(is<<BigInt(s))-is);mw.push(i)}const[JC,XC]=RC(mw,!0),dp=(e,t,n)=>n>32?FC(e,t,n):UC(e,t,n),fp=(e,t,n)=>n>32?DC(e,t,n):jC(e,t,n);function eB(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],l=n[c+1],d=dp(u,l,1)^n[a],f=fp(u,l,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=d,e[o+h+1]^=f}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=pw[o],c=dp(i,s,a),u=fp(i,s,a),l=hw[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=JC[r],e[1]^=XC[r]}n.fill(0)}let tB=class yw extends Lf{constructor(t,n,r,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Ba(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=zC(this.state)}keccak(){up||lp(this.state32),eB(this.state32,this.rounds),up||lp(this.state32),this.posOut=0,this.pos=0}update(t){Ci(this);const{blockLen:n,state:r}=this;t=fc(t);const i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);for(let a=0;a<o;a++)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:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Ci(this,!1),po(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Ba(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(dw(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,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new yw(n,r,i,o,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=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const nB=(e,t,n)=>fw(()=>new tB(t,e,n)),rB=nB(1,136,256/8);function bw(e,t){const n=t||"hex",r=rB(qs(e,{strict:!1})?OC(e):e);return n==="bytes"?r:td(r)}let iB=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 cu=new iB(8192);function sB(e,t){if(cu.has(`${e}.${t}`))return cu.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=bw(lw(n),"bytes"),i=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(r[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return cu.set(`${e}.${t}`,s),s}function oB(e){const t=bw(`0x${e.substring(4)}`).substring(26);return sB(`0x${t}`)}async function aB({hash:e,signature:t}){const n=qs(e)?e:td(e),{secp256k1:r}=await Dr(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>ZB);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:d,yParity:f}=t,h=Number(f??d),g=hp(h);return new r.Signature(ed(u),ed(l)).addRecoveryBit(g)}const o=qs(t)?t:td(t),a=IC(`0x${o.slice(130)}`),c=hp(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function hp(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 KT({hash:e,signature:t}){return oB(await aB({hash:e,signature:t}))}function cB(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}function uB(e,t,n){return e&t^~e&n}function lB(e,t,n){return e&t^e&n^t&n}let dB=class extends Lf{constructor(t,n,r,i){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=au(this.buffer)}update(t){Ci(this);const{view:n,buffer:r,blockLen:i}=this;t=fc(t);const s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=au(t);for(;i<=s-o;o+=i)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ci(this),dw(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;cB(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=au(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.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:i,finished:s,destroyed:o,pos:a}=this;return t.length=i,t.pos=a,t.finished=s,t.destroyed=o,i%n&&t.buffer.set(r),t}};const fB=new Uint32Array([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]),Kn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Zn=new Uint32Array(64);let hB=class extends dB{constructor(){super(64,32,8,!1),this.A=Kn[0]|0,this.B=Kn[1]|0,this.C=Kn[2]|0,this.D=Kn[3]|0,this.E=Kn[4]|0,this.F=Kn[5]|0,this.G=Kn[6]|0,this.H=Kn[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:o,G:a,H:c}=this;return[t,n,r,i,s,o,a,c]}set(t,n,r,i,s,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Zn[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=Zn[d-15],h=Zn[d-2],g=Yt(f,7)^Yt(f,18)^f>>>3,y=Yt(h,17)^Yt(h,19)^h>>>10;Zn[d]=y+Zn[d-7]+g+Zn[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Yt(a,6)^Yt(a,11)^Yt(a,25),h=l+f+uB(a,c,u)+fB[d]+Zn[d]|0,y=(Yt(r,2)^Yt(r,13)^Yt(r,22))+lB(r,i,s)|0;l=u,u=c,c=a,a=o+h|0,o=s,s=i,i=r,r=h+y|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,i,s,o,a,c,u,l)}roundClean(){Zn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const pB=fw(()=>new hB);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hc=BigInt(0),pc=BigInt(1),mB=BigInt(2);function Mr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function mo(e){if(!Mr(e))throw new Error("Uint8Array expected")}function Bi(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}const yB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Oi(e){mo(e);let t="";for(let n=0;n<e.length;n++)t+=yB[e[n]];return t}function si(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Rf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?hc:BigInt("0x"+e)}const pn={_0:48,_9:57,A:65,F:70,a:97,f:102};function pp(e){if(e>=pn._0&&e<=pn._9)return e-pn._0;if(e>=pn.A&&e<=pn.F)return e-(pn.A-10);if(e>=pn.a&&e<=pn.f)return e-(pn.a-10)}function Ti(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof 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 i=0,s=0;i<n;i++,s+=2){const o=pp(e.charCodeAt(s)),a=pp(e.charCodeAt(s+1));if(o===void 0||a===void 0){const c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}r[i]=o*16+a}return r}function xr(e){return Rf(Oi(e))}function Uf(e){return mo(e),Rf(Oi(Uint8Array.from(e).reverse()))}function $i(e,t){return Ti(e.toString(16).padStart(t*2,"0"))}function jf(e,t){return $i(e,t).reverse()}function bB(e){return Ti(si(e))}function Mt(e,t,n){let r;if(typeof t=="string")try{r=Ti(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Mr(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function Gs(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];mo(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}function gB(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function wB(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}const uu=e=>typeof e=="bigint"&&hc<=e;function mc(e,t,n){return uu(e)&&uu(t)&&uu(n)&&t<=e&&e<n}function Er(e,t,n,r){if(!mc(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function gw(e){let t;for(t=0;e>hc;e>>=pc,t+=1);return t}function vB(e,t){return e>>BigInt(t)&pc}function xB(e,t,n){return e|(n?pc:hc)<<BigInt(t)}const Ff=e=>(mB<<BigInt(e-1))-pc,lu=e=>new Uint8Array(e),mp=e=>Uint8Array.from(e);function ww(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=lu(e),i=lu(e),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},a=(...d)=>n(i,r,...d),c=(d=lu())=>{i=a(mp([0]),d),r=a(),d.length!==0&&(i=a(mp([1]),d),r=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const f=[];for(;d<t;){r=a();const h=r.slice();f.push(h),d+=r.length}return Gs(...f)};return(d,f)=>{o(),c(d);let h;for(;!(h=f(u()));)c();return o(),h}}const EB={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Mr(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function yo(e,t,n={}){const r=(i,s,o)=>{const a=EB[s];if(typeof a!="function")throw new Error("invalid validator function");const c=e[i];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(t))r(i,s,!1);for(const[i,s]of Object.entries(n))r(i,s,!0);return e}const _B=()=>{throw new Error("not implemented")};function nd(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const s=e(n,...r);return t.set(n,s),s}}const SB=Object.freeze(Object.defineProperty({__proto__:null,aInRange:Er,abool:Bi,abytes:mo,bitGet:vB,bitLen:gw,bitMask:Ff,bitSet:xB,bytesToHex:Oi,bytesToNumberBE:xr,bytesToNumberLE:Uf,concatBytes:Gs,createHmacDrbg:ww,ensureBytes:Mt,equalBytes:gB,hexToBytes:Ti,hexToNumber:Rf,inRange:mc,isBytes:Mr,memoized:nd,notImplemented:_B,numberToBytesBE:$i,numberToBytesLE:jf,numberToHexUnpadded:si,numberToVarBytesBE:bB,utf8ToBytes:wB,validateObject:yo},Symbol.toStringTag,{value:"Module"}));let vw=class extends Lf{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,MC(t);const r=fc(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 i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),s.fill(0)}update(t){return Ci(this),this.iHash.update(t),this}digestInto(t){Ci(this),po(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:i,destroyed:s,blockLen:o,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const xw=(e,t,n)=>new vw(e,t).update(n).digest();xw.create=(e,t)=>new vw(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ge=BigInt(0),Ce=BigInt(1),dr=BigInt(2),IB=BigInt(3),rd=BigInt(4),yp=BigInt(5),bp=BigInt(8);function lt(e,t){const n=e%t;return n>=Ge?n:t+n}function AB(e,t,n){if(t<Ge)throw new Error("invalid exponent, negatives unsupported");if(n<=Ge)throw new Error("invalid modulus");if(n===Ce)return Ge;let r=Ce;for(;t>Ge;)t&Ce&&(r=r*e%n),e=e*e%n,t>>=Ce;return r}function At(e,t,n){let r=e;for(;t-- >Ge;)r*=r,r%=n;return r}function id(e,t){if(e===Ge)throw new Error("invert: expected non-zero number");if(t<=Ge)throw new Error("invert: expected positive modulus, got "+t);let n=lt(e,t),r=t,i=Ge,s=Ce;for(;n!==Ge;){const a=r/n,c=r%n,u=i-s*a;r=n,n=c,i=s,s=u}if(r!==Ce)throw new Error("invert: does not exist");return lt(i,t)}function PB(e){const t=(e-Ce)/dr;let n,r,i;for(n=e-Ce,r=0;n%dr===Ge;n/=dr,r++);for(i=dr;i<e&&AB(i,t,e)!==e-Ce;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(e+Ce)/rd;return function(c,u){const l=c.pow(u,o);if(!c.eql(c.sqr(l),u))throw new Error("Cannot find square root");return l}}const s=(n+Ce)/dr;return function(a,c){if(a.pow(c,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,l=a.pow(a.mul(a.ONE,i),n),d=a.pow(c,s),f=a.pow(c,n);for(;!a.eql(f,a.ONE);){if(a.eql(f,a.ZERO))return a.ZERO;let h=1;for(let y=a.sqr(f);h<u&&!a.eql(y,a.ONE);h++)y=a.sqr(y);const g=a.pow(l,Ce<<BigInt(u-h-1));l=a.sqr(g),d=a.mul(d,g),f=a.mul(f,l),u=h}return d}}function kB(e){if(e%rd===IB){const t=(e+Ce)/rd;return function(r,i){const s=r.pow(i,t);if(!r.eql(r.sqr(s),i))throw new Error("Cannot find square root");return s}}if(e%bp===yp){const t=(e-yp)/bp;return function(r,i){const s=r.mul(i,dr),o=r.pow(s,t),a=r.mul(i,o),c=r.mul(r.mul(a,dr),o),u=r.mul(a,r.sub(c,r.ONE));if(!r.eql(r.sqr(u),i))throw new Error("Cannot find square root");return u}}return PB(e)}const CB=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function BB(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=CB.reduce((r,i)=>(r[i]="function",r),t);return yo(e,n)}function OB(e,t,n){if(n<Ge)throw new Error("invalid exponent, negatives unsupported");if(n===Ge)return e.ONE;if(n===Ce)return t;let r=e.ONE,i=t;for(;n>Ge;)n&Ce&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Ce;return r}function TB(e,t){const n=new Array(t.length),r=t.reduce((s,o,a)=>e.is0(o)?s:(n[a]=s,e.mul(s,o)),e.ONE),i=e.inv(r);return t.reduceRight((s,o,a)=>e.is0(o)?s:(n[a]=e.mul(s,n[a]),e.mul(s,o)),i),n}function Ew(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function _w(e,t,n=!1,r={}){if(e<=Ge)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:s}=Ew(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:i,BYTES:s,MASK:Ff(i),ZERO:Ge,ONE:Ce,create:c=>lt(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Ge<=c&&c<e},is0:c=>c===Ge,isOdd:c=>(c&Ce)===Ce,neg:c=>lt(-c,e),eql:(c,u)=>c===u,sqr:c=>lt(c*c,e),add:(c,u)=>lt(c+u,e),sub:(c,u)=>lt(c-u,e),mul:(c,u)=>lt(c*u,e),pow:(c,u)=>OB(a,c,u),div:(c,u)=>lt(c*id(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>id(c,e),sqrt:r.sqrt||(c=>(o||(o=kB(e)),o(a,c))),invertBatch:c=>TB(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>n?jf(c,s):$i(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return n?Uf(c):xr(c)}});return Object.freeze(a)}function Sw(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 Iw(e){const t=Sw(e);return t+Math.ceil(t/2)}function $B(e,t,n=!1){const r=e.length,i=Sw(t),s=Iw(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=n?Uf(e):xr(e),a=lt(o,t-Ce)+Ce;return n?jf(a,i):$i(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gp=BigInt(0),Vo=BigInt(1);function du(e,t){const n=t.negate();return e?n:t}function Aw(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function fu(e,t){Aw(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1);return{windows:n,windowSize:r}}function NB(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 MB(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 hu=new WeakMap,Pw=new WeakMap;function pu(e){return Pw.get(e)||1}function LB(e,t){return{constTimeNegate:du,hasPrecomputes(n){return pu(n)!==1},unsafeLadder(n,r,i=e.ZERO){let s=n;for(;r>gp;)r&Vo&&(i=i.add(s)),s=s.double(),r>>=Vo;return i},precomputeWindow(n,r){const{windows:i,windowSize:s}=fu(r,t),o=[];let a=n,c=a;for(let u=0;u<i;u++){c=a,o.push(c);for(let l=1;l<s;l++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,i){const{windows:s,windowSize:o}=fu(n,t);let a=e.ZERO,c=e.BASE;const u=BigInt(2**n-1),l=2**n,d=BigInt(n);for(let f=0;f<s;f++){const h=f*o;let g=Number(i&u);i>>=d,g>o&&(g-=l,i+=Vo);const y=h,m=h+Math.abs(g)-1,w=f%2!==0,S=g<0;g===0?c=c.add(du(w,r[y])):a=a.add(du(S,r[m]))}return{p:a,f:c}},wNAFUnsafe(n,r,i,s=e.ZERO){const{windows:o,windowSize:a}=fu(n,t),c=BigInt(2**n-1),u=2**n,l=BigInt(n);for(let d=0;d<o;d++){const f=d*a;if(i===gp)break;let h=Number(i&c);if(i>>=l,h>a&&(h-=u,i+=Vo),h===0)continue;let g=r[f+Math.abs(h)-1];h<0&&(g=g.negate()),s=s.add(g)}return s},getPrecomputes(n,r,i){let s=hu.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&hu.set(r,i(s))),s},wNAFCached(n,r,i){const s=pu(n);return this.wNAF(s,this.getPrecomputes(s,n,i),r)},wNAFCachedUnsafe(n,r,i,s){const o=pu(n);return o===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,n,i),r,s)},setWindowSize(n,r){Aw(r,t),Pw.set(n,r),hu.delete(n)}}}function RB(e,t,n,r){if(NB(n,e),MB(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,s=gw(BigInt(n.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=new Array(a+1).fill(i),u=Math.floor((t.BITS-1)/o)*o;let l=i;for(let d=u;d>=0;d-=o){c.fill(i);for(let h=0;h<r.length;h++){const g=r[h],y=Number(g>>BigInt(d)&BigInt(a));c[y]=c[y].add(n[h])}let f=i;for(let h=c.length-1,g=i;h>0;h--)g=g.add(c[h]),f=f.add(g);if(l=l.add(f),d!==0)for(let h=0;h<o;h++)l=l.double()}return l}function kw(e){return BB(e.Fp),yo(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ew(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function wp(e){e.lowS!==void 0&&Bi("lowS",e.lowS),e.prehash!==void 0&&Bi("prehash",e.prehash)}function UB(e){const t=kw(e);yo(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:jB,hexToBytes:FB}=SB;let DB=class extends Error{constructor(t=""){super(t)}};const En={Err:DB,_tlv:{encode:(e,t)=>{const{Err:n}=En;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,i=si(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?si(i.length/2|128):"";return si(e)+s+i+t},decode(e,t){const{Err:n}=En;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 i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const c=i&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+c);if(u.length!==c)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)o=o<<8|l;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=En;if(e<In)throw new t("integer: negative integers are not allowed");let n=si(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}=En;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 jB(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=En,i=typeof e=="string"?FB(e):e;mo(i);const{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,s),{v:u,l}=r.decode(2,c);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=En,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),s=r+i;return t.encode(48,s)}},In=BigInt(0),ze=BigInt(1);BigInt(2);const vp=BigInt(3);BigInt(4);function zB(e){const t=UB(e),{Fp:n}=t,r=_w(t.n,t.nBitLength),i=t.toBytes||((y,m,w)=>{const S=m.toAffine();return Gs(Uint8Array.from([4]),n.toBytes(S.x),n.toBytes(S.y))}),s=t.fromBytes||(y=>{const m=y.subarray(1),w=n.fromBytes(m.subarray(0,n.BYTES)),S=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:w,y:S}});function o(y){const{a:m,b:w}=t,S=n.sqr(y),x=n.mul(S,y);return n.add(n.add(x,n.mul(y,m)),w)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(y){return mc(y,ze,t.n)}function c(y){const{allowedPrivateKeyLengths:m,nByteLength:w,wrapPrivateKey:S,n:x}=t;if(m&&typeof y!="bigint"){if(Mr(y)&&(y=Oi(y)),typeof y!="string"||!m.includes(y.length))throw new Error("invalid private key");y=y.padStart(w*2,"0")}let E;try{E=typeof y=="bigint"?y:xr(Mt("private key",y,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof y)}return S&&(E=lt(E,x)),Er("private key",E,ze,x),E}function u(y){if(!(y instanceof f))throw new Error("ProjectivePoint expected")}const l=nd((y,m)=>{const{px:w,py:S,pz:x}=y;if(n.eql(x,n.ONE))return{x:w,y:S};const E=y.is0();m==null&&(m=E?n.ONE:n.inv(x));const v=n.mul(w,m),I=n.mul(S,m),A=n.mul(x,m);if(E)return{x:n.ZERO,y:n.ZERO};if(!n.eql(A,n.ONE))throw new Error("invZ was invalid");return{x:v,y:I}}),d=nd(y=>{if(y.is0()){if(t.allowInfinityPoint&&!n.is0(y.py))return;throw new Error("bad point: ZERO")}const{x:m,y:w}=y.toAffine();if(!n.isValid(m)||!n.isValid(w))throw new Error("bad point: x or y not FE");const S=n.sqr(w),x=o(m);if(!n.eql(S,x))throw new Error("bad point: equation left != right");if(!y.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class f{constructor(m,w,S){if(this.px=m,this.py=w,this.pz=S,m==null||!n.isValid(m))throw new Error("x required");if(w==null||!n.isValid(w))throw new Error("y required");if(S==null||!n.isValid(S))throw new Error("z required");Object.freeze(this)}static fromAffine(m){const{x:w,y:S}=m||{};if(!m||!n.isValid(w)||!n.isValid(S))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const x=E=>n.eql(E,n.ZERO);return x(w)&&x(S)?f.ZERO:new f(w,S,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const w=n.invertBatch(m.map(S=>S.pz));return m.map((S,x)=>S.toAffine(w[x])).map(f.fromAffine)}static fromHex(m){const w=f.fromAffine(s(Mt("pointHex",m)));return w.assertValidity(),w}static fromPrivateKey(m){return f.BASE.multiply(c(m))}static msm(m,w){return RB(f,r,m,w)}_setWindowSize(m){g.setWindowSize(this,m)}assertValidity(){d(this)}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){u(m);const{px:w,py:S,pz:x}=this,{px:E,py:v,pz:I}=m,A=n.eql(n.mul(w,I),n.mul(E,x)),B=n.eql(n.mul(S,I),n.mul(v,x));return A&&B}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:w}=t,S=n.mul(w,vp),{px:x,py:E,pz:v}=this;let I=n.ZERO,A=n.ZERO,B=n.ZERO,T=n.mul(x,x),M=n.mul(E,E),j=n.mul(v,v),k=n.mul(x,E);return k=n.add(k,k),B=n.mul(x,v),B=n.add(B,B),I=n.mul(m,B),A=n.mul(S,j),A=n.add(I,A),I=n.sub(M,A),A=n.add(M,A),A=n.mul(I,A),I=n.mul(k,I),B=n.mul(S,B),j=n.mul(m,j),k=n.sub(T,j),k=n.mul(m,k),k=n.add(k,B),B=n.add(T,T),T=n.add(B,T),T=n.add(T,j),T=n.mul(T,k),A=n.add(A,T),j=n.mul(E,v),j=n.add(j,j),T=n.mul(j,k),I=n.sub(I,T),B=n.mul(j,M),B=n.add(B,B),B=n.add(B,B),new f(I,A,B)}add(m){u(m);const{px:w,py:S,pz:x}=this,{px:E,py:v,pz:I}=m;let A=n.ZERO,B=n.ZERO,T=n.ZERO;const M=t.a,j=n.mul(t.b,vp);let k=n.mul(w,E),L=n.mul(S,v),$=n.mul(x,I),C=n.add(w,S),O=n.add(E,v);C=n.mul(C,O),O=n.add(k,L),C=n.sub(C,O),O=n.add(w,x);let R=n.add(E,I);return O=n.mul(O,R),R=n.add(k,$),O=n.sub(O,R),R=n.add(S,x),A=n.add(v,I),R=n.mul(R,A),A=n.add(L,$),R=n.sub(R,A),T=n.mul(M,O),A=n.mul(j,$),T=n.add(A,T),A=n.sub(L,T),T=n.add(L,T),B=n.mul(A,T),L=n.add(k,k),L=n.add(L,k),$=n.mul(M,$),O=n.mul(j,O),L=n.add(L,$),$=n.sub(k,$),$=n.mul(M,$),O=n.add(O,$),k=n.mul(L,O),B=n.add(B,k),k=n.mul(R,O),A=n.mul(C,A),A=n.sub(A,k),k=n.mul(C,L),T=n.mul(R,T),T=n.add(T,k),new f(A,B,T)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return g.wNAFCached(this,m,f.normalizeZ)}multiplyUnsafe(m){const{endo:w,n:S}=t;Er("scalar",m,In,S);const x=f.ZERO;if(m===In)return x;if(this.is0()||m===ze)return this;if(!w||g.hasPrecomputes(this))return g.wNAFCachedUnsafe(this,m,f.normalizeZ);let{k1neg:E,k1:v,k2neg:I,k2:A}=w.splitScalar(m),B=x,T=x,M=this;for(;v>In||A>In;)v&ze&&(B=B.add(M)),A&ze&&(T=T.add(M)),M=M.double(),v>>=ze,A>>=ze;return E&&(B=B.negate()),I&&(T=T.negate()),T=new f(n.mul(T.px,w.beta),T.py,T.pz),B.add(T)}multiply(m){const{endo:w,n:S}=t;Er("scalar",m,ze,S);let x,E;if(w){const{k1neg:v,k1:I,k2neg:A,k2:B}=w.splitScalar(m);let{p:T,f:M}=this.wNAF(I),{p:j,f:k}=this.wNAF(B);T=g.constTimeNegate(v,T),j=g.constTimeNegate(A,j),j=new f(n.mul(j.px,w.beta),j.py,j.pz),x=T.add(j),E=M.add(k)}else{const{p:v,f:I}=this.wNAF(m);x=v,E=I}return f.normalizeZ([x,E])[0]}multiplyAndAddUnsafe(m,w,S){const x=f.BASE,E=(I,A)=>A===In||A===ze||!I.equals(x)?I.multiplyUnsafe(A):I.multiply(A),v=E(this,w).add(E(m,S));return v.is0()?void 0:v}toAffine(m){return l(this,m)}isTorsionFree(){const{h:m,isTorsionFree:w}=t;if(m===ze)return!0;if(w)return w(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:w}=t;return m===ze?this:w?w(f,this):this.multiplyUnsafe(t.h)}toRawBytes(m=!0){return Bi("isCompressed",m),this.assertValidity(),i(f,this,m)}toHex(m=!0){return Bi("isCompressed",m),Oi(this.toRawBytes(m))}}f.BASE=new f(t.Gx,t.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const h=t.nBitLength,g=LB(f,t.endo?Math.ceil(h/2):h);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function HB(e){const t=kw(e);return yo(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function qB(e){const t=HB(e),{Fp:n,n:r}=t,i=n.BYTES+1,s=2*n.BYTES+1;function o($){return lt($,r)}function a($){return id($,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:d}=zB({...t,toBytes($,C,O){const R=C.toAffine(),U=n.toBytes(R.x),H=Gs;return Bi("isCompressed",O),O?H(Uint8Array.from([C.hasEvenY()?2:3]),U):H(Uint8Array.from([4]),U,n.toBytes(R.y))},fromBytes($){const C=$.length,O=$[0],R=$.subarray(1);if(C===i&&(O===2||O===3)){const U=xr(R);if(!mc(U,ze,n.ORDER))throw new Error("Point is not on curve");const H=l(U);let V;try{V=n.sqrt(H)}catch(te){const Y=te instanceof Error?": "+te.message:"";throw new Error("Point is not on curve"+Y)}const K=(V&ze)===ze;return(O&1)===1!==K&&(V=n.neg(V)),{x:U,y:V}}else if(C===s&&O===4){const U=n.fromBytes(R.subarray(0,n.BYTES)),H=n.fromBytes(R.subarray(n.BYTES,2*n.BYTES));return{x:U,y:H}}else{const U=i,H=s;throw new Error("invalid Point, expected length of "+U+", or uncompressed "+H+", got "+C)}}}),f=$=>Oi($i($,t.nByteLength));function h($){const C=r>>ze;return $>C}function g($){return h($)?o(-$):$}const y=($,C,O)=>xr($.slice(C,O));class m{constructor(C,O,R){this.r=C,this.s=O,this.recovery=R,this.assertValidity()}static fromCompact(C){const O=t.nByteLength;return C=Mt("compactSignature",C,O*2),new m(y(C,0,O),y(C,O,2*O))}static fromDER(C){const{r:O,s:R}=En.toSig(Mt("DER",C));return new m(O,R)}assertValidity(){Er("r",this.r,ze,r),Er("s",this.s,ze,r)}addRecoveryBit(C){return new m(this.r,this.s,C)}recoverPublicKey(C){const{r:O,s:R,recovery:U}=this,H=I(Mt("msgHash",C));if(U==null||![0,1,2,3].includes(U))throw new Error("recovery id invalid");const V=U===2||U===3?O+t.n:O;if(V>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const K=U&1?"03":"02",Q=c.fromHex(K+f(V)),te=a(V),Y=o(-H*te),X=o(R*te),ue=c.BASE.multiplyAndAddUnsafe(Q,Y,X);if(!ue)throw new Error("point at infinify");return ue.assertValidity(),ue}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Ti(this.toDERHex())}toDERHex(){return En.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ti(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const w={isValidPrivateKey($){try{return u($),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const $=Iw(t.n);return $B(t.randomBytes($),t.n)},precompute($=8,C=c.BASE){return C._setWindowSize($),C.multiply(BigInt(3)),C}};function S($,C=!0){return c.fromPrivateKey($).toRawBytes(C)}function x($){const C=Mr($),O=typeof $=="string",R=(C||O)&&$.length;return C?R===i||R===s:O?R===2*i||R===2*s:$ instanceof c}function E($,C,O=!0){if(x($))throw new Error("first arg must be private key");if(!x(C))throw new Error("second arg must be public key");return c.fromHex(C).multiply(u($)).toRawBytes(O)}const v=t.bits2int||function($){if($.length>8192)throw new Error("input is too large");const C=xr($),O=$.length*8-t.nBitLength;return O>0?C>>BigInt(O):C},I=t.bits2int_modN||function($){return o(v($))},A=Ff(t.nBitLength);function B($){return Er("num < 2^"+t.nBitLength,$,In,A),$i($,t.nByteLength)}function T($,C,O=M){if(["recovered","canonical"].some(xe=>xe in O))throw new Error("sign() legacy options not supported");const{hash:R,randomBytes:U}=t;let{lowS:H,prehash:V,extraEntropy:K}=O;H==null&&(H=!0),$=Mt("msgHash",$),wp(O),V&&($=Mt("prehashed msgHash",R($)));const Q=I($),te=u(C),Y=[B(te),B(Q)];if(K!=null&&K!==!1){const xe=K===!0?U(n.BYTES):K;Y.push(Mt("extraEntropy",xe))}const X=Gs(...Y),ue=Q;function Ue(xe){const be=v(xe);if(!d(be))return;const Ke=a(be),Ee=c.BASE.multiply(be).toAffine(),ye=o(Ee.x);if(ye===In)return;const _e=o(Ke*o(ue+ye*te));if(_e===In)return;let Pe=(Ee.x===ye?0:2)|Number(Ee.y&ze),it=_e;return H&&h(_e)&&(it=g(_e),Pe^=1),new m(ye,it,Pe)}return{seed:X,k2sig:Ue}}const M={lowS:t.lowS,prehash:!1},j={lowS:t.lowS,prehash:!1};function k($,C,O=M){const{seed:R,k2sig:U}=T($,C,O),H=t;return ww(H.hash.outputLen,H.nByteLength,H.hmac)(R,U)}c.BASE._setWindowSize(8);function L($,C,O,R=j){const U=$;C=Mt("msgHash",C),O=Mt("publicKey",O);const{lowS:H,prehash:V,format:K}=R;if(wp(R),"strict"in R)throw new Error("options.strict was renamed to lowS");if(K!==void 0&&K!=="compact"&&K!=="der")throw new Error("format must be compact or der");const Q=typeof U=="string"||Mr(U),te=!Q&&!K&&typeof U=="object"&&U!==null&&typeof U.r=="bigint"&&typeof U.s=="bigint";if(!Q&&!te)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let Y,X;try{if(te&&(Y=new m(U.r,U.s)),Q){try{K!=="compact"&&(Y=m.fromDER(U))}catch(Pe){if(!(Pe instanceof En.Err))throw Pe}!Y&&K!=="der"&&(Y=m.fromCompact(U))}X=c.fromHex(O)}catch{return!1}if(!Y||H&&Y.hasHighS())return!1;V&&(C=t.hash(C));const{r:ue,s:Ue}=Y,xe=I(C),be=a(Ue),Ke=o(xe*be),Ee=o(ue*be),ye=c.BASE.multiplyAndAddUnsafe(X,Ke,Ee)?.toAffine();return ye?o(ye.x)===ue:!1}return{CURVE:t,getPublicKey:S,getSharedSecret:E,sign:k,verify:L,ProjectivePoint:c,Signature:m,utils:w}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function GB(e){return{hash:e,hmac:(t,...n)=>xw(e,t,GC(...n)),randomBytes:VC}}function VB(e,t){const n=r=>qB({...e,...GB(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Cw=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),xp=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),WB=BigInt(1),sd=BigInt(2),Ep=(e,t)=>(e+t/sd)/t;function KB(e){const t=Cw,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,d=At(l,n,t)*l%t,f=At(d,n,t)*l%t,h=At(f,sd,t)*u%t,g=At(h,i,t)*h%t,y=At(g,s,t)*g%t,m=At(y,a,t)*y%t,w=At(m,c,t)*m%t,S=At(w,a,t)*y%t,x=At(S,n,t)*l%t,E=At(x,o,t)*g%t,v=At(E,r,t)*u%t,I=At(v,sd,t);if(!od.eql(od.sqr(I),e))throw new Error("Cannot find square root");return I}const od=_w(Cw,void 0,void 0,{sqrt:KB}),Bw=VB({a:BigInt(0),b:BigInt(7),Fp:od,n:xp,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=xp,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-WB*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,o=BigInt("0x100000000000000000000000000000000"),a=Ep(s*e,t),c=Ep(-r*e,t);let u=lt(e-a*n-c*i,t),l=lt(-a*r-c*s,t);const d=u>o,f=l>o;if(d&&(u=t-u),f&&(l=t-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}}},pB);BigInt(0);Bw.ProjectivePoint;const ZB=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Bw},Symbol.toStringTag,{value:"Module"}));function Vs(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function _p(e){return Vs(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Ow="2.23.2";let mu={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Ow}`};class Lr extends Error{constructor(t,n={}){const r=n.cause instanceof Lr?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof Lr&&n.cause.docsPath||n.docsPath,s=mu.getDocsUrl?.({...n,docsPath:i}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...mu.version?[`Version: ${mu.version}`]:[]].join(`
74
+ `);super(o,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=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Ow}walk(t){return Tw(this,t)}}function Tw(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Tw(e.cause,t):t?null:e}class $w extends Lr{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function Yi(e,{dir:t,size:n=32}={}){return typeof e=="string"?YB(e,{dir:t,size:n}):QB(e,{dir:t,size:n})}function YB(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new $w({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function QB(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new $w({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let i=0;i<n;i++){const s=t==="right";r[s?i:n-i-1]=e[s?i:e.length-i-1]}return r}class JB extends Lr{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class XB extends Lr{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Qi(e,{size:t}){if(_p(e)>t)throw new XB({givenSize:_p(e),maxSize:t})}function ad(e,t={}){const{signed:n}=t;t.size&&Qi(e,{size:t.size});const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function e9(e,t={}){return Number(ad(e,t))}const t9=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function cd(e,t={}){return typeof e=="number"||typeof e=="bigint"?Mw(e,t):typeof e=="string"?i9(e,t):typeof e=="boolean"?n9(e,t):Nw(e,t)}function n9(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Qi(n,{size:t.size}),Yi(n,{size:t.size})):n}function Nw(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=t9[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(Qi(r,{size:t.size}),Yi(r,{dir:"right",size:t.size})):r}function Mw(e,t={}){const{signed:n,size:r}=t,i=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 o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const c=typeof e=="bigint"?"n":"";throw new JB({max:s?`${s}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?Yi(a,{size:r}):a}const r9=new TextEncoder;function i9(e,t={}){const n=r9.encode(e);return Nw(n,t)}const s9=new TextEncoder;function o9(e,t={}){return typeof e=="number"||typeof e=="bigint"?c9(e,t):typeof e=="boolean"?a9(e,t):Vs(e)?Lw(e,t):Rw(e,t)}function a9(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Qi(n,{size:t.size}),Yi(n,{size:t.size})):n}const mn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Sp(e){if(e>=mn.zero&&e<=mn.nine)return e-mn.zero;if(e>=mn.A&&e<=mn.F)return e-(mn.A-10);if(e>=mn.a&&e<=mn.f)return e-(mn.a-10)}function Lw(e,t={}){let n=e;t.size&&(Qi(n,{size:t.size}),n=Yi(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,s=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const c=Sp(r.charCodeAt(a++)),u=Sp(r.charCodeAt(a++));if(c===void 0||u===void 0)throw new Lr(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);s[o]=c*16+u}return s}function c9(e,t){const n=Mw(e,t);return Lw(n)}function Rw(e,t={}){const n=s9.encode(e);return typeof t.size=="number"?(Qi(n,{size:t.size}),Yi(n,{dir:"right",size:t.size})):n}function Oa(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function u9(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function bo(e,...t){if(!u9(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 l9(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Oa(e.outputLen),Oa(e.blockLen)}function Ni(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 Uw(e,t){bo(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const Wo=BigInt(2**32-1),Ip=BigInt(32);function d9(e,t=!1){return t?{h:Number(e&Wo),l:Number(e>>Ip&Wo)}:{h:Number(e>>Ip&Wo)|0,l:Number(e&Wo)|0}}function f9(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:o}=d9(e[i],t);[n[i],r[i]]=[s,o]}return[n,r]}const h9=(e,t,n)=>e<<n|t>>>32-n,p9=(e,t,n)=>t<<n|e>>>32-n,m9=(e,t,n)=>t<<n-32|e>>>64-n,y9=(e,t,n)=>e<<n-32|t>>>64-n,ei=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function b9(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function yu(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Qt(e,t){return e<<32-t|e>>>t}const Ap=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function g9(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Pp(e){for(let t=0;t<e.length;t++)e[t]=g9(e[t])}function w9(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function yc(e){return typeof e=="string"&&(e=w9(e)),bo(e),e}function v9(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];bo(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}class Df{clone(){return this._cloneInto()}}function jw(e){const t=r=>e().update(yc(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function x9(e=32){if(ei&&typeof ei.getRandomValues=="function")return ei.getRandomValues(new Uint8Array(e));if(ei&&typeof ei.randomBytes=="function")return ei.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const Fw=[],Dw=[],zw=[],E9=BigInt(0),ss=BigInt(1),_9=BigInt(2),S9=BigInt(7),I9=BigInt(256),A9=BigInt(113);for(let e=0,t=ss,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Fw.push(2*(5*r+n)),Dw.push((e+1)*(e+2)/2%64);let i=E9;for(let s=0;s<7;s++)t=(t<<ss^(t>>S9)*A9)%I9,t&_9&&(i^=ss<<(ss<<BigInt(s))-ss);zw.push(i)}const[P9,k9]=f9(zw,!0),kp=(e,t,n)=>n>32?m9(e,t,n):h9(e,t,n),Cp=(e,t,n)=>n>32?y9(e,t,n):p9(e,t,n);function C9(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],l=n[c+1],d=kp(u,l,1)^n[a],f=Cp(u,l,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=d,e[o+h+1]^=f}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=Dw[o],c=kp(i,s,a),u=Cp(i,s,a),l=Fw[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=P9[r],e[1]^=k9[r]}n.fill(0)}class zf extends Df{constructor(t,n,r,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Oa(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=b9(this.state)}keccak(){Ap||Pp(this.state32),C9(this.state32,this.rounds),Ap||Pp(this.state32),this.posOut=0,this.pos=0}update(t){Ni(this);const{blockLen:n,state:r}=this;t=yc(t);const i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);for(let a=0;a<o;a++)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:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Ni(this,!1),bo(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Oa(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Uw(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,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new zf(n,r,i,o,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=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const B9=(e,t,n)=>jw(()=>new zf(t,e,n)),O9=B9(1,136,256/8);function Hw(e,t){const n=t||"hex",r=O9(Vs(e,{strict:!1})?o9(e):e);return n==="bytes"?r:cd(r)}class T9 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 bu=new T9(8192);function $9(e,t){if(bu.has(`${e}.${t}`))return bu.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Hw(Rw(n),"bytes"),i=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(r[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return bu.set(`${e}.${t}`,s),s}function N9(e){const t=Hw(`0x${e.substring(4)}`).substring(26);return $9(`0x${t}`)}async function M9({hash:e,signature:t}){const n=Vs(e)?e:cd(e),{secp256k1:r}=await Dr(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>_O);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:d,yParity:f}=t,h=Number(f??d),g=Bp(h);return new r.Signature(ad(u),ad(l)).addRecoveryBit(g)}const o=Vs(t)?t:cd(t),a=e9(`0x${o.slice(130)}`),c=Bp(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Bp(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 XT({hash:e,signature:t}){return N9(await M9({hash:e,signature:t}))}function L9(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}function R9(e,t,n){return e&t^~e&n}function U9(e,t,n){return e&t^e&n^t&n}class j9 extends Df{constructor(t,n,r,i){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=yu(this.buffer)}update(t){Ni(this);const{view:n,buffer:r,blockLen:i}=this;t=yc(t);const s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=yu(t);for(;i<=s-o;o+=i)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ni(this),Uw(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;L9(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=yu(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.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:i,finished:s,destroyed:o,pos:a}=this;return t.length=i,t.pos=a,t.finished=s,t.destroyed=o,i%n&&t.buffer.set(r),t}}const F9=new Uint32Array([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]),Yn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Qn=new Uint32Array(64);class D9 extends j9{constructor(){super(64,32,8,!1),this.A=Yn[0]|0,this.B=Yn[1]|0,this.C=Yn[2]|0,this.D=Yn[3]|0,this.E=Yn[4]|0,this.F=Yn[5]|0,this.G=Yn[6]|0,this.H=Yn[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:o,G:a,H:c}=this;return[t,n,r,i,s,o,a,c]}set(t,n,r,i,s,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Qn[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=Qn[d-15],h=Qn[d-2],g=Qt(f,7)^Qt(f,18)^f>>>3,y=Qt(h,17)^Qt(h,19)^h>>>10;Qn[d]=y+Qn[d-7]+g+Qn[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Qt(a,6)^Qt(a,11)^Qt(a,25),h=l+f+R9(a,c,u)+F9[d]+Qn[d]|0,y=(Qt(r,2)^Qt(r,13)^Qt(r,22))+U9(r,i,s)|0;l=u,u=c,c=a,a=o+h|0,o=s,s=i,i=r,r=h+y|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,i,s,o,a,c,u,l)}roundClean(){Qn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const z9=jw(()=>new D9);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const bc=BigInt(0),gc=BigInt(1),H9=BigInt(2);function Rr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function go(e){if(!Rr(e))throw new Error("Uint8Array expected")}function Mi(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}const q9=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Li(e){go(e);let t="";for(let n=0;n<e.length;n++)t+=q9[e[n]];return t}function oi(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Hf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?bc:BigInt("0x"+e)}const yn={_0:48,_9:57,A:65,F:70,a:97,f:102};function Op(e){if(e>=yn._0&&e<=yn._9)return e-yn._0;if(e>=yn.A&&e<=yn.F)return e-(yn.A-10);if(e>=yn.a&&e<=yn.f)return e-(yn.a-10)}function Ri(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof 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 i=0,s=0;i<n;i++,s+=2){const o=Op(e.charCodeAt(s)),a=Op(e.charCodeAt(s+1));if(o===void 0||a===void 0){const c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}r[i]=o*16+a}return r}function _r(e){return Hf(Li(e))}function qf(e){return go(e),Hf(Li(Uint8Array.from(e).reverse()))}function Ui(e,t){return Ri(e.toString(16).padStart(t*2,"0"))}function Gf(e,t){return Ui(e,t).reverse()}function G9(e){return Ri(oi(e))}function Lt(e,t,n){let r;if(typeof t=="string")try{r=Ri(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Rr(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function Ws(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];go(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}function V9(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function W9(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}const gu=e=>typeof e=="bigint"&&bc<=e;function wc(e,t,n){return gu(e)&&gu(t)&&gu(n)&&t<=e&&e<n}function Sr(e,t,n,r){if(!wc(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function qw(e){let t;for(t=0;e>bc;e>>=gc,t+=1);return t}function K9(e,t){return e>>BigInt(t)&gc}function Z9(e,t,n){return e|(n?gc:bc)<<BigInt(t)}const Vf=e=>(H9<<BigInt(e-1))-gc,wu=e=>new Uint8Array(e),Tp=e=>Uint8Array.from(e);function Gw(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=wu(e),i=wu(e),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},a=(...d)=>n(i,r,...d),c=(d=wu())=>{i=a(Tp([0]),d),r=a(),d.length!==0&&(i=a(Tp([1]),d),r=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const f=[];for(;d<t;){r=a();const h=r.slice();f.push(h),d+=r.length}return Ws(...f)};return(d,f)=>{o(),c(d);let h;for(;!(h=f(u()));)c();return o(),h}}const Y9={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Rr(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function wo(e,t,n={}){const r=(i,s,o)=>{const a=Y9[s];if(typeof a!="function")throw new Error("invalid validator function");const c=e[i];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(t))r(i,s,!1);for(const[i,s]of Object.entries(n))r(i,s,!0);return e}const Q9=()=>{throw new Error("not implemented")};function ud(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const s=e(n,...r);return t.set(n,s),s}}const J9=Object.freeze(Object.defineProperty({__proto__:null,aInRange:Sr,abool:Mi,abytes:go,bitGet:K9,bitLen:qw,bitMask:Vf,bitSet:Z9,bytesToHex:Li,bytesToNumberBE:_r,bytesToNumberLE:qf,concatBytes:Ws,createHmacDrbg:Gw,ensureBytes:Lt,equalBytes:V9,hexToBytes:Ri,hexToNumber:Hf,inRange:wc,isBytes:Rr,memoized:ud,notImplemented:Q9,numberToBytesBE:Ui,numberToBytesLE:Gf,numberToHexUnpadded:oi,numberToVarBytesBE:G9,utf8ToBytes:W9,validateObject:wo},Symbol.toStringTag,{value:"Module"}));class Vw extends Df{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,l9(t);const r=yc(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 i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),s.fill(0)}update(t){return Ni(this),this.iHash.update(t),this}digestInto(t){Ni(this),bo(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:i,destroyed:s,blockLen:o,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Ww=(e,t,n)=>new Vw(e,t).update(n).digest();Ww.create=(e,t)=>new Vw(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ve=BigInt(0),Be=BigInt(1),fr=BigInt(2),X9=BigInt(3),ld=BigInt(4),$p=BigInt(5),Np=BigInt(8);function dt(e,t){const n=e%t;return n>=Ve?n:t+n}function eO(e,t,n){if(t<Ve)throw new Error("invalid exponent, negatives unsupported");if(n<=Ve)throw new Error("invalid modulus");if(n===Be)return Ve;let r=Be;for(;t>Ve;)t&Be&&(r=r*e%n),e=e*e%n,t>>=Be;return r}function Pt(e,t,n){let r=e;for(;t-- >Ve;)r*=r,r%=n;return r}function dd(e,t){if(e===Ve)throw new Error("invert: expected non-zero number");if(t<=Ve)throw new Error("invert: expected positive modulus, got "+t);let n=dt(e,t),r=t,i=Ve,s=Be;for(;n!==Ve;){const a=r/n,c=r%n,u=i-s*a;r=n,n=c,i=s,s=u}if(r!==Be)throw new Error("invert: does not exist");return dt(i,t)}function tO(e){const t=(e-Be)/fr;let n,r,i;for(n=e-Be,r=0;n%fr===Ve;n/=fr,r++);for(i=fr;i<e&&eO(i,t,e)!==e-Be;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(e+Be)/ld;return function(c,u){const l=c.pow(u,o);if(!c.eql(c.sqr(l),u))throw new Error("Cannot find square root");return l}}const s=(n+Be)/fr;return function(a,c){if(a.pow(c,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,l=a.pow(a.mul(a.ONE,i),n),d=a.pow(c,s),f=a.pow(c,n);for(;!a.eql(f,a.ONE);){if(a.eql(f,a.ZERO))return a.ZERO;let h=1;for(let y=a.sqr(f);h<u&&!a.eql(y,a.ONE);h++)y=a.sqr(y);const g=a.pow(l,Be<<BigInt(u-h-1));l=a.sqr(g),d=a.mul(d,g),f=a.mul(f,l),u=h}return d}}function nO(e){if(e%ld===X9){const t=(e+Be)/ld;return function(r,i){const s=r.pow(i,t);if(!r.eql(r.sqr(s),i))throw new Error("Cannot find square root");return s}}if(e%Np===$p){const t=(e-$p)/Np;return function(r,i){const s=r.mul(i,fr),o=r.pow(s,t),a=r.mul(i,o),c=r.mul(r.mul(a,fr),o),u=r.mul(a,r.sub(c,r.ONE));if(!r.eql(r.sqr(u),i))throw new Error("Cannot find square root");return u}}return tO(e)}const rO=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function iO(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=rO.reduce((r,i)=>(r[i]="function",r),t);return wo(e,n)}function sO(e,t,n){if(n<Ve)throw new Error("invalid exponent, negatives unsupported");if(n===Ve)return e.ONE;if(n===Be)return t;let r=e.ONE,i=t;for(;n>Ve;)n&Be&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Be;return r}function oO(e,t){const n=new Array(t.length),r=t.reduce((s,o,a)=>e.is0(o)?s:(n[a]=s,e.mul(s,o)),e.ONE),i=e.inv(r);return t.reduceRight((s,o,a)=>e.is0(o)?s:(n[a]=e.mul(s,n[a]),e.mul(s,o)),i),n}function Kw(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Zw(e,t,n=!1,r={}){if(e<=Ve)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:s}=Kw(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:i,BYTES:s,MASK:Vf(i),ZERO:Ve,ONE:Be,create:c=>dt(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Ve<=c&&c<e},is0:c=>c===Ve,isOdd:c=>(c&Be)===Be,neg:c=>dt(-c,e),eql:(c,u)=>c===u,sqr:c=>dt(c*c,e),add:(c,u)=>dt(c+u,e),sub:(c,u)=>dt(c-u,e),mul:(c,u)=>dt(c*u,e),pow:(c,u)=>sO(a,c,u),div:(c,u)=>dt(c*dd(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>dd(c,e),sqrt:r.sqrt||(c=>(o||(o=nO(e)),o(a,c))),invertBatch:c=>oO(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>n?Gf(c,s):Ui(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return n?qf(c):_r(c)}});return Object.freeze(a)}function Yw(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 Qw(e){const t=Yw(e);return t+Math.ceil(t/2)}function aO(e,t,n=!1){const r=e.length,i=Yw(t),s=Qw(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=n?qf(e):_r(e),a=dt(o,t-Be)+Be;return n?Gf(a,i):Ui(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mp=BigInt(0),Ko=BigInt(1);function vu(e,t){const n=t.negate();return e?n:t}function Jw(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function xu(e,t){Jw(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1);return{windows:n,windowSize:r}}function cO(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 uO(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 Eu=new WeakMap,Xw=new WeakMap;function _u(e){return Xw.get(e)||1}function lO(e,t){return{constTimeNegate:vu,hasPrecomputes(n){return _u(n)!==1},unsafeLadder(n,r,i=e.ZERO){let s=n;for(;r>Mp;)r&Ko&&(i=i.add(s)),s=s.double(),r>>=Ko;return i},precomputeWindow(n,r){const{windows:i,windowSize:s}=xu(r,t),o=[];let a=n,c=a;for(let u=0;u<i;u++){c=a,o.push(c);for(let l=1;l<s;l++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,i){const{windows:s,windowSize:o}=xu(n,t);let a=e.ZERO,c=e.BASE;const u=BigInt(2**n-1),l=2**n,d=BigInt(n);for(let f=0;f<s;f++){const h=f*o;let g=Number(i&u);i>>=d,g>o&&(g-=l,i+=Ko);const y=h,m=h+Math.abs(g)-1,w=f%2!==0,S=g<0;g===0?c=c.add(vu(w,r[y])):a=a.add(vu(S,r[m]))}return{p:a,f:c}},wNAFUnsafe(n,r,i,s=e.ZERO){const{windows:o,windowSize:a}=xu(n,t),c=BigInt(2**n-1),u=2**n,l=BigInt(n);for(let d=0;d<o;d++){const f=d*a;if(i===Mp)break;let h=Number(i&c);if(i>>=l,h>a&&(h-=u,i+=Ko),h===0)continue;let g=r[f+Math.abs(h)-1];h<0&&(g=g.negate()),s=s.add(g)}return s},getPrecomputes(n,r,i){let s=Eu.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&Eu.set(r,i(s))),s},wNAFCached(n,r,i){const s=_u(n);return this.wNAF(s,this.getPrecomputes(s,n,i),r)},wNAFCachedUnsafe(n,r,i,s){const o=_u(n);return o===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,n,i),r,s)},setWindowSize(n,r){Jw(r,t),Xw.set(n,r),Eu.delete(n)}}}function dO(e,t,n,r){if(cO(n,e),uO(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,s=qw(BigInt(n.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=new Array(a+1).fill(i),u=Math.floor((t.BITS-1)/o)*o;let l=i;for(let d=u;d>=0;d-=o){c.fill(i);for(let h=0;h<r.length;h++){const g=r[h],y=Number(g>>BigInt(d)&BigInt(a));c[y]=c[y].add(n[h])}let f=i;for(let h=c.length-1,g=i;h>0;h--)g=g.add(c[h]),f=f.add(g);if(l=l.add(f),d!==0)for(let h=0;h<o;h++)l=l.double()}return l}function ev(e){return iO(e.Fp),wo(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Kw(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Lp(e){e.lowS!==void 0&&Mi("lowS",e.lowS),e.prehash!==void 0&&Mi("prehash",e.prehash)}function fO(e){const t=ev(e);wo(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:hO,hexToBytes:pO}=J9;class mO extends Error{constructor(t=""){super(t)}}const _n={Err:mO,_tlv:{encode:(e,t)=>{const{Err:n}=_n;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,i=oi(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?oi(i.length/2|128):"";return oi(e)+s+i+t},decode(e,t){const{Err:n}=_n;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 i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const c=i&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+c);if(u.length!==c)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)o=o<<8|l;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=_n;if(e<An)throw new t("integer: negative integers are not allowed");let n=oi(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}=_n;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 hO(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=_n,i=typeof e=="string"?pO(e):e;go(i);const{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,s),{v:u,l}=r.decode(2,c);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=_n,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),s=r+i;return t.encode(48,s)}},An=BigInt(0),He=BigInt(1);BigInt(2);const Rp=BigInt(3);BigInt(4);function yO(e){const t=fO(e),{Fp:n}=t,r=Zw(t.n,t.nBitLength),i=t.toBytes||((y,m,w)=>{const S=m.toAffine();return Ws(Uint8Array.from([4]),n.toBytes(S.x),n.toBytes(S.y))}),s=t.fromBytes||(y=>{const m=y.subarray(1),w=n.fromBytes(m.subarray(0,n.BYTES)),S=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:w,y:S}});function o(y){const{a:m,b:w}=t,S=n.sqr(y),x=n.mul(S,y);return n.add(n.add(x,n.mul(y,m)),w)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(y){return wc(y,He,t.n)}function c(y){const{allowedPrivateKeyLengths:m,nByteLength:w,wrapPrivateKey:S,n:x}=t;if(m&&typeof y!="bigint"){if(Rr(y)&&(y=Li(y)),typeof y!="string"||!m.includes(y.length))throw new Error("invalid private key");y=y.padStart(w*2,"0")}let E;try{E=typeof y=="bigint"?y:_r(Lt("private key",y,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof y)}return S&&(E=dt(E,x)),Sr("private key",E,He,x),E}function u(y){if(!(y instanceof f))throw new Error("ProjectivePoint expected")}const l=ud((y,m)=>{const{px:w,py:S,pz:x}=y;if(n.eql(x,n.ONE))return{x:w,y:S};const E=y.is0();m==null&&(m=E?n.ONE:n.inv(x));const v=n.mul(w,m),I=n.mul(S,m),A=n.mul(x,m);if(E)return{x:n.ZERO,y:n.ZERO};if(!n.eql(A,n.ONE))throw new Error("invZ was invalid");return{x:v,y:I}}),d=ud(y=>{if(y.is0()){if(t.allowInfinityPoint&&!n.is0(y.py))return;throw new Error("bad point: ZERO")}const{x:m,y:w}=y.toAffine();if(!n.isValid(m)||!n.isValid(w))throw new Error("bad point: x or y not FE");const S=n.sqr(w),x=o(m);if(!n.eql(S,x))throw new Error("bad point: equation left != right");if(!y.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class f{constructor(m,w,S){if(this.px=m,this.py=w,this.pz=S,m==null||!n.isValid(m))throw new Error("x required");if(w==null||!n.isValid(w))throw new Error("y required");if(S==null||!n.isValid(S))throw new Error("z required");Object.freeze(this)}static fromAffine(m){const{x:w,y:S}=m||{};if(!m||!n.isValid(w)||!n.isValid(S))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const x=E=>n.eql(E,n.ZERO);return x(w)&&x(S)?f.ZERO:new f(w,S,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const w=n.invertBatch(m.map(S=>S.pz));return m.map((S,x)=>S.toAffine(w[x])).map(f.fromAffine)}static fromHex(m){const w=f.fromAffine(s(Lt("pointHex",m)));return w.assertValidity(),w}static fromPrivateKey(m){return f.BASE.multiply(c(m))}static msm(m,w){return dO(f,r,m,w)}_setWindowSize(m){g.setWindowSize(this,m)}assertValidity(){d(this)}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){u(m);const{px:w,py:S,pz:x}=this,{px:E,py:v,pz:I}=m,A=n.eql(n.mul(w,I),n.mul(E,x)),B=n.eql(n.mul(S,I),n.mul(v,x));return A&&B}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:w}=t,S=n.mul(w,Rp),{px:x,py:E,pz:v}=this;let I=n.ZERO,A=n.ZERO,B=n.ZERO,T=n.mul(x,x),M=n.mul(E,E),j=n.mul(v,v),k=n.mul(x,E);return k=n.add(k,k),B=n.mul(x,v),B=n.add(B,B),I=n.mul(m,B),A=n.mul(S,j),A=n.add(I,A),I=n.sub(M,A),A=n.add(M,A),A=n.mul(I,A),I=n.mul(k,I),B=n.mul(S,B),j=n.mul(m,j),k=n.sub(T,j),k=n.mul(m,k),k=n.add(k,B),B=n.add(T,T),T=n.add(B,T),T=n.add(T,j),T=n.mul(T,k),A=n.add(A,T),j=n.mul(E,v),j=n.add(j,j),T=n.mul(j,k),I=n.sub(I,T),B=n.mul(j,M),B=n.add(B,B),B=n.add(B,B),new f(I,A,B)}add(m){u(m);const{px:w,py:S,pz:x}=this,{px:E,py:v,pz:I}=m;let A=n.ZERO,B=n.ZERO,T=n.ZERO;const M=t.a,j=n.mul(t.b,Rp);let k=n.mul(w,E),L=n.mul(S,v),$=n.mul(x,I),C=n.add(w,S),O=n.add(E,v);C=n.mul(C,O),O=n.add(k,L),C=n.sub(C,O),O=n.add(w,x);let R=n.add(E,I);return O=n.mul(O,R),R=n.add(k,$),O=n.sub(O,R),R=n.add(S,x),A=n.add(v,I),R=n.mul(R,A),A=n.add(L,$),R=n.sub(R,A),T=n.mul(M,O),A=n.mul(j,$),T=n.add(A,T),A=n.sub(L,T),T=n.add(L,T),B=n.mul(A,T),L=n.add(k,k),L=n.add(L,k),$=n.mul(M,$),O=n.mul(j,O),L=n.add(L,$),$=n.sub(k,$),$=n.mul(M,$),O=n.add(O,$),k=n.mul(L,O),B=n.add(B,k),k=n.mul(R,O),A=n.mul(C,A),A=n.sub(A,k),k=n.mul(C,L),T=n.mul(R,T),T=n.add(T,k),new f(A,B,T)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return g.wNAFCached(this,m,f.normalizeZ)}multiplyUnsafe(m){const{endo:w,n:S}=t;Sr("scalar",m,An,S);const x=f.ZERO;if(m===An)return x;if(this.is0()||m===He)return this;if(!w||g.hasPrecomputes(this))return g.wNAFCachedUnsafe(this,m,f.normalizeZ);let{k1neg:E,k1:v,k2neg:I,k2:A}=w.splitScalar(m),B=x,T=x,M=this;for(;v>An||A>An;)v&He&&(B=B.add(M)),A&He&&(T=T.add(M)),M=M.double(),v>>=He,A>>=He;return E&&(B=B.negate()),I&&(T=T.negate()),T=new f(n.mul(T.px,w.beta),T.py,T.pz),B.add(T)}multiply(m){const{endo:w,n:S}=t;Sr("scalar",m,He,S);let x,E;if(w){const{k1neg:v,k1:I,k2neg:A,k2:B}=w.splitScalar(m);let{p:T,f:M}=this.wNAF(I),{p:j,f:k}=this.wNAF(B);T=g.constTimeNegate(v,T),j=g.constTimeNegate(A,j),j=new f(n.mul(j.px,w.beta),j.py,j.pz),x=T.add(j),E=M.add(k)}else{const{p:v,f:I}=this.wNAF(m);x=v,E=I}return f.normalizeZ([x,E])[0]}multiplyAndAddUnsafe(m,w,S){const x=f.BASE,E=(I,A)=>A===An||A===He||!I.equals(x)?I.multiplyUnsafe(A):I.multiply(A),v=E(this,w).add(E(m,S));return v.is0()?void 0:v}toAffine(m){return l(this,m)}isTorsionFree(){const{h:m,isTorsionFree:w}=t;if(m===He)return!0;if(w)return w(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:w}=t;return m===He?this:w?w(f,this):this.multiplyUnsafe(t.h)}toRawBytes(m=!0){return Mi("isCompressed",m),this.assertValidity(),i(f,this,m)}toHex(m=!0){return Mi("isCompressed",m),Li(this.toRawBytes(m))}}f.BASE=new f(t.Gx,t.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const h=t.nBitLength,g=lO(f,t.endo?Math.ceil(h/2):h);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function bO(e){const t=ev(e);return wo(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function gO(e){const t=bO(e),{Fp:n,n:r}=t,i=n.BYTES+1,s=2*n.BYTES+1;function o($){return dt($,r)}function a($){return dd($,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:d}=yO({...t,toBytes($,C,O){const R=C.toAffine(),U=n.toBytes(R.x),H=Ws;return Mi("isCompressed",O),O?H(Uint8Array.from([C.hasEvenY()?2:3]),U):H(Uint8Array.from([4]),U,n.toBytes(R.y))},fromBytes($){const C=$.length,O=$[0],R=$.subarray(1);if(C===i&&(O===2||O===3)){const U=_r(R);if(!wc(U,He,n.ORDER))throw new Error("Point is not on curve");const H=l(U);let V;try{V=n.sqrt(H)}catch(te){const Y=te instanceof Error?": "+te.message:"";throw new Error("Point is not on curve"+Y)}const K=(V&He)===He;return(O&1)===1!==K&&(V=n.neg(V)),{x:U,y:V}}else if(C===s&&O===4){const U=n.fromBytes(R.subarray(0,n.BYTES)),H=n.fromBytes(R.subarray(n.BYTES,2*n.BYTES));return{x:U,y:H}}else{const U=i,H=s;throw new Error("invalid Point, expected length of "+U+", or uncompressed "+H+", got "+C)}}}),f=$=>Li(Ui($,t.nByteLength));function h($){const C=r>>He;return $>C}function g($){return h($)?o(-$):$}const y=($,C,O)=>_r($.slice(C,O));class m{constructor(C,O,R){this.r=C,this.s=O,this.recovery=R,this.assertValidity()}static fromCompact(C){const O=t.nByteLength;return C=Lt("compactSignature",C,O*2),new m(y(C,0,O),y(C,O,2*O))}static fromDER(C){const{r:O,s:R}=_n.toSig(Lt("DER",C));return new m(O,R)}assertValidity(){Sr("r",this.r,He,r),Sr("s",this.s,He,r)}addRecoveryBit(C){return new m(this.r,this.s,C)}recoverPublicKey(C){const{r:O,s:R,recovery:U}=this,H=I(Lt("msgHash",C));if(U==null||![0,1,2,3].includes(U))throw new Error("recovery id invalid");const V=U===2||U===3?O+t.n:O;if(V>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const K=U&1?"03":"02",Q=c.fromHex(K+f(V)),te=a(V),Y=o(-H*te),X=o(R*te),ue=c.BASE.multiplyAndAddUnsafe(Q,Y,X);if(!ue)throw new Error("point at infinify");return ue.assertValidity(),ue}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Ri(this.toDERHex())}toDERHex(){return _n.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ri(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const w={isValidPrivateKey($){try{return u($),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const $=Qw(t.n);return aO(t.randomBytes($),t.n)},precompute($=8,C=c.BASE){return C._setWindowSize($),C.multiply(BigInt(3)),C}};function S($,C=!0){return c.fromPrivateKey($).toRawBytes(C)}function x($){const C=Rr($),O=typeof $=="string",R=(C||O)&&$.length;return C?R===i||R===s:O?R===2*i||R===2*s:$ instanceof c}function E($,C,O=!0){if(x($))throw new Error("first arg must be private key");if(!x(C))throw new Error("second arg must be public key");return c.fromHex(C).multiply(u($)).toRawBytes(O)}const v=t.bits2int||function($){if($.length>8192)throw new Error("input is too large");const C=_r($),O=$.length*8-t.nBitLength;return O>0?C>>BigInt(O):C},I=t.bits2int_modN||function($){return o(v($))},A=Vf(t.nBitLength);function B($){return Sr("num < 2^"+t.nBitLength,$,An,A),Ui($,t.nByteLength)}function T($,C,O=M){if(["recovered","canonical"].some(xe=>xe in O))throw new Error("sign() legacy options not supported");const{hash:R,randomBytes:U}=t;let{lowS:H,prehash:V,extraEntropy:K}=O;H==null&&(H=!0),$=Lt("msgHash",$),Lp(O),V&&($=Lt("prehashed msgHash",R($)));const Q=I($),te=u(C),Y=[B(te),B(Q)];if(K!=null&&K!==!1){const xe=K===!0?U(n.BYTES):K;Y.push(Lt("extraEntropy",xe))}const X=Ws(...Y),ue=Q;function Ue(xe){const be=v(xe);if(!d(be))return;const Ke=a(be),Ee=c.BASE.multiply(be).toAffine(),ye=o(Ee.x);if(ye===An)return;const _e=o(Ke*o(ue+ye*te));if(_e===An)return;let Pe=(Ee.x===ye?0:2)|Number(Ee.y&He),it=_e;return H&&h(_e)&&(it=g(_e),Pe^=1),new m(ye,it,Pe)}return{seed:X,k2sig:Ue}}const M={lowS:t.lowS,prehash:!1},j={lowS:t.lowS,prehash:!1};function k($,C,O=M){const{seed:R,k2sig:U}=T($,C,O),H=t;return Gw(H.hash.outputLen,H.nByteLength,H.hmac)(R,U)}c.BASE._setWindowSize(8);function L($,C,O,R=j){const U=$;C=Lt("msgHash",C),O=Lt("publicKey",O);const{lowS:H,prehash:V,format:K}=R;if(Lp(R),"strict"in R)throw new Error("options.strict was renamed to lowS");if(K!==void 0&&K!=="compact"&&K!=="der")throw new Error("format must be compact or der");const Q=typeof U=="string"||Rr(U),te=!Q&&!K&&typeof U=="object"&&U!==null&&typeof U.r=="bigint"&&typeof U.s=="bigint";if(!Q&&!te)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let Y,X;try{if(te&&(Y=new m(U.r,U.s)),Q){try{K!=="compact"&&(Y=m.fromDER(U))}catch(Pe){if(!(Pe instanceof _n.Err))throw Pe}!Y&&K!=="der"&&(Y=m.fromCompact(U))}X=c.fromHex(O)}catch{return!1}if(!Y||H&&Y.hasHighS())return!1;V&&(C=t.hash(C));const{r:ue,s:Ue}=Y,xe=I(C),be=a(Ue),Ke=o(xe*be),Ee=o(ue*be),ye=c.BASE.multiplyAndAddUnsafe(X,Ke,Ee)?.toAffine();return ye?o(ye.x)===ue:!1}return{CURVE:t,getPublicKey:S,getSharedSecret:E,sign:k,verify:L,ProjectivePoint:c,Signature:m,utils:w}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function wO(e){return{hash:e,hmac:(t,...n)=>Ww(e,t,v9(...n)),randomBytes:x9}}function vO(e,t){const n=r=>gO({...e,...wO(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const tv=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Up=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),xO=BigInt(1),fd=BigInt(2),jp=(e,t)=>(e+t/fd)/t;function EO(e){const t=tv,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,d=Pt(l,n,t)*l%t,f=Pt(d,n,t)*l%t,h=Pt(f,fd,t)*u%t,g=Pt(h,i,t)*h%t,y=Pt(g,s,t)*g%t,m=Pt(y,a,t)*y%t,w=Pt(m,c,t)*m%t,S=Pt(w,a,t)*y%t,x=Pt(S,n,t)*l%t,E=Pt(x,o,t)*g%t,v=Pt(E,r,t)*u%t,I=Pt(v,fd,t);if(!hd.eql(hd.sqr(I),e))throw new Error("Cannot find square root");return I}const hd=Zw(tv,void 0,void 0,{sqrt:EO}),nv=vO({a:BigInt(0),b:BigInt(7),Fp:hd,n:Up,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Up,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-xO*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,o=BigInt("0x100000000000000000000000000000000"),a=jp(s*e,t),c=jp(-r*e,t);let u=dt(e-a*n-c*i,t),l=dt(-a*r-c*s,t);const d=u>o,f=l>o;if(d&&(u=t-u),f&&(l=t-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}}},z9);BigInt(0);nv.ProjectivePoint;const _O=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:nv},Symbol.toStringTag,{value:"Module"}));export{BT as A,ce as B,IT as C,AT as D,Qp as E,XT as F,fT as G,ht as H,xT as Q,yT as W,Dr as _,qO as a,ff as b,hT as c,mT as d,ST as e,vT as f,uh as g,Z0 as h,uf as i,gT as j,ET as k,Wb as l,zO as m,sI as n,oI as o,HO as p,aI as q,KT as r,GO as s,kT as t,_T as u,PT as v,Kb as w,dT as x,pT as y,CT as z};