@dcl/landing-site 0.0.1-23617412190.commit-e3cca1e → 0.0.1-23619144615.commit-9dd6c8c

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 (146) hide show
  1. package/assets/{AnimatedBackground-gNtI-YhV.js → AnimatedBackground-BX21LYI2.js} +2 -2
  2. package/assets/FooterLanding-r_hZlF_u.js +1 -0
  3. package/assets/{add-CHM98Fes.js → add-DaN_WwVR.js} +1 -1
  4. package/assets/all-wallets-Dnuhj0Og.js +6 -0
  5. package/assets/{app-store-CRgqc_8W.js → app-store-CcYHqDTq.js} +2 -2
  6. package/assets/{apple-DA-gL0ew.js → apple-BP0ixQ55.js} +2 -2
  7. package/assets/arrow-bottom-DCVMAr8H.js +8 -0
  8. package/assets/{arrow-bottom-circle-W7EphmHv.js → arrow-bottom-circle-BcZjyH_3.js} +2 -2
  9. package/assets/arrow-left-B8e4P5ki.js +8 -0
  10. package/assets/arrow-right-Cb1MhLlX.js +8 -0
  11. package/assets/arrow-top-CsxZbNjO.js +8 -0
  12. package/assets/auto-track-BOxo_bvT.js +1 -0
  13. package/assets/{bank-BJ_zMNdO.js → bank-CmtjeWfr.js} +1 -1
  14. package/assets/{basic-Cbs3wtVd.js → basic-DzuqKs2l.js} +1 -1
  15. package/assets/{browser-BZI6LlMK.js → browser-DQjkDFvi.js} +2 -2
  16. package/assets/{card-a0PEwixX.js → card-C3dOAVqt.js} +2 -2
  17. package/assets/ccip-Z16c_UnO.js +1 -0
  18. package/assets/{checkmark-bold-nUmAb0Jv.js → checkmark-bold-ButdL_LZ.js} +2 -2
  19. package/assets/{checkmark-DxhM6kxf.js → checkmark-iVuMZlIm.js} +2 -2
  20. package/assets/chevron-bottom-jJpGeUUx.js +8 -0
  21. package/assets/chevron-left-Ch61xlSU.js +8 -0
  22. package/assets/chevron-right-BTWePK-z.js +8 -0
  23. package/assets/chevron-top-DT7Y9DlB.js +8 -0
  24. package/assets/{chrome-store-C0l7_S46.js → chrome-store-WwSkA5JI.js} +2 -2
  25. package/assets/{clock-CGFlkuTk.js → clock-DLLelcN_.js} +2 -2
  26. package/assets/close-2B53ZcOr.js +8 -0
  27. package/assets/{coinPlaceholder-BcTAu_IN.js → coinPlaceholder-BqU1Y-z1.js} +2 -2
  28. package/assets/{compass-AzcmZa1s.js → compass-Dkii6WBH.js} +2 -2
  29. package/assets/{copy-DU6nZmjR.js → copy-CtlKkDiy.js} +2 -2
  30. package/assets/core-CTGAiloq.js +908 -0
  31. package/assets/cursor-h29Fyu_C.js +3 -0
  32. package/assets/{cursor-transparent-CBn-iCcY.js → cursor-transparent-Cna8_emv.js} +1 -1
  33. package/assets/{desktop-Cgv-18ZV.js → desktop-DVSar6pk.js} +2 -2
  34. package/assets/{disconnect-BccJ3jIT.js → disconnect-DWAlWLSE.js} +2 -2
  35. package/assets/{discord-5RUDhSal.js → discord-qzKpdTIN.js} +2 -2
  36. package/assets/{etherscan-C3fPztHb.js → etherscan-Dq8VeI1F.js} +2 -2
  37. package/assets/{exclamation-triangle-D_ozpW4c.js → exclamation-triangle-DB0vGdPg.js} +2 -2
  38. package/assets/{extension-BBOn_gDX.js → extension-DrmX2qvD.js} +1 -1
  39. package/assets/{external-link-BWUOLdmG.js → external-link-CQ-Po7zU.js} +1 -1
  40. package/assets/{facebook-CPf0OEse.js → facebook-Cj_V7srz.js} +2 -2
  41. package/assets/{farcaster-CR6V0phI.js → farcaster-j1zJY7FO.js} +2 -2
  42. package/assets/filters-CoTrUOjM.js +8 -0
  43. package/assets/{github-Df-6J-fJ.js → github-BiFTJBr4.js} +2 -2
  44. package/assets/{google-ZDEMGNHZ.js → google-CoUxHqlc.js} +1 -1
  45. package/assets/{help-circle-BL4M8ISL.js → help-circle-CmYFWRl7.js} +1 -1
  46. package/assets/hooks.module-Dz_XB4AG.js +1 -0
  47. package/assets/{id-B8ywMzga.js → id-DT3gYsIn.js} +2 -2
  48. package/assets/{image-CwqhHOgq.js → image-2xI41_yv.js} +2 -2
  49. package/assets/index-4qKnY3-Z.js +1 -0
  50. package/assets/index-BGXseWrC.js +7 -0
  51. package/assets/index-BHPQscxU.js +51 -0
  52. package/assets/index-Bk20Akf-.js +1 -0
  53. package/assets/index-BopA34hw.js +1 -0
  54. package/assets/index-BrKy0seX.js +5 -0
  55. package/assets/index-BwH4aTS1.js +811 -0
  56. package/assets/index-CXihcgXx.js +1 -0
  57. package/assets/index-D8K5W9P2.js +1 -0
  58. package/assets/index-DI7YJmGL.js +1 -0
  59. package/assets/index-DSHMyLVX.js +1 -0
  60. package/assets/{index-BfZPjAvn.js → index-DZDTS3ye.js} +3 -3
  61. package/assets/index-DiIGGt9K.js +2 -0
  62. package/assets/index-DrVu52Xh.js +1 -0
  63. package/assets/index-SuZZOLV8.js +44 -0
  64. package/assets/index-WOcjF2jM.js +1 -0
  65. package/assets/index-YmvX5-ha.js +2 -0
  66. package/assets/index-nibyPLVP.js +1 -0
  67. package/assets/index.es-jzCaEkpf.js +39 -0
  68. package/assets/index.umd--3ii-zIl.js +1 -0
  69. package/assets/{info-COI3OebQ.js → info-DjLA3veR.js} +2 -2
  70. package/assets/{info-circle-D_RgtoG_.js → info-circle-3PDrwt0H.js} +2 -2
  71. package/assets/{lightbulb-D29oA1kW.js → lightbulb-DhWVBMDA.js} +2 -2
  72. package/assets/{mail-CJ9rvNEO.js → mail-BsPt7fsq.js} +1 -1
  73. package/assets/{mobile-BSTR0oWP.js → mobile-CgXcD3VR.js} +2 -2
  74. package/assets/{more-BcYAHybc.js → more-DIJuTEs0.js} +2 -2
  75. package/assets/{network-placeholder-Cnunuezr.js → network-placeholder-66B326HU.js} +2 -2
  76. package/assets/{nftPlaceholder-rT8UJE4K.js → nftPlaceholder-BLN_a1sQ.js} +2 -2
  77. package/assets/node-COcrmc-E.js +4 -0
  78. package/assets/off-D2UQbFAS.js +8 -0
  79. package/assets/{play-store-DvfWnN4y.js → play-store-SCtH_5I1.js} +2 -2
  80. package/assets/{plus-gHBDgGjM.js → plus-DHy0b-9d.js} +2 -2
  81. package/assets/{qr-code-DDHcNUue.js → qr-code-PfdfX8iw.js} +1 -1
  82. package/assets/{recycle-horizontal-BRiwD6Mt.js → recycle-horizontal-BuVlk9dd.js} +1 -1
  83. package/assets/{refresh-B9gXvGXV.js → refresh-LidcEqi6.js} +2 -2
  84. package/assets/{reown-logo-WhOyJ0P-.js → reown-logo-CAccVEkV.js} +2 -2
  85. package/assets/search-oQ7C4gac.js +8 -0
  86. package/assets/secp256k1-SQKxdWJA.js +1 -0
  87. package/assets/secp256k1-r2Z-F5jQ.js +1 -0
  88. package/assets/{send-Bwl7uhNH.js → send-Czq-woFq.js} +2 -2
  89. package/assets/{swapHorizontal-DZpWZtIz.js → swapHorizontal-BLAZ4GpX.js} +2 -2
  90. package/assets/{swapHorizontalBold-BsXTfOUB.js → swapHorizontalBold-CeMDPZ2B.js} +2 -2
  91. package/assets/{swapHorizontalMedium-C_6kbXTl.js → swapHorizontalMedium-CVCZLiVS.js} +2 -2
  92. package/assets/{swapHorizontalRoundedBold-C0Zn63rG.js → swapHorizontalRoundedBold-D00KZQV-.js} +2 -2
  93. package/assets/{swapVertical-3Bh1HEox.js → swapVertical-CtlfdZa9.js} +2 -2
  94. package/assets/swiper-react-ZPE95VoW.js +1 -0
  95. package/assets/{telegram-DNIzTF3I.js → telegram-DiYfT0lk.js} +2 -2
  96. package/assets/{three-dots-COxARji7.js → three-dots-BpX8IpHh.js} +2 -2
  97. package/assets/{twitch-CZ-7Kiwd.js → twitch-CSH-Nxxc.js} +2 -2
  98. package/assets/{twitterIcon-Dcm6rS6L.js → twitterIcon-DiNCGGjL.js} +2 -2
  99. package/assets/{verify-CDFvKR62.js → verify-B4Hhnjw3.js} +2 -2
  100. package/assets/{verify-filled-xoYiPqK4.js → verify-filled-BO8MFee3.js} +2 -2
  101. package/assets/{w3m-modal-DelFzwRg.js → w3m-modal-Ch3BGvga.js} +1 -1
  102. package/assets/{wallet-BFpTXEJT.js → wallet-CNUrWE3L.js} +2 -2
  103. package/assets/{wallet-placeholder-AXXSMd3R.js → wallet-placeholder-CtQg5prg.js} +2 -2
  104. package/assets/{walletconnect-Cz3JVcWt.js → walletconnect-DxVGyv5n.js} +4 -4
  105. package/assets/{warning-circle-8Kak1pmh.js → warning-circle-BNcoUtgr.js} +1 -1
  106. package/assets/{x-C-F8mfxV.js → x-C0p-xVca.js} +2 -2
  107. package/index.html +2 -5
  108. package/package.json +3 -3
  109. package/assets/FooterLanding-iYuz415B.js +0 -1
  110. package/assets/all-wallets-Qb9stbRm.js +0 -6
  111. package/assets/arrow-bottom-rhor6qOA.js +0 -8
  112. package/assets/arrow-left-Bq3H-u24.js +0 -8
  113. package/assets/arrow-right-CkiCqXKz.js +0 -8
  114. package/assets/arrow-top-BbayD3ny.js +0 -8
  115. package/assets/auto-track-CpyrW7jj.js +0 -1
  116. package/assets/chevron-bottom-C2GrTkGW.js +0 -8
  117. package/assets/chevron-left-TOHygVkY.js +0 -8
  118. package/assets/chevron-right-kK9l_fNM.js +0 -8
  119. package/assets/chevron-top-GkMD6fM_.js +0 -8
  120. package/assets/close-D_Rm3jAw.js +0 -8
  121. package/assets/core-kZLq_ADy.js +0 -907
  122. package/assets/cursor-BkgcU3pB.js +0 -3
  123. package/assets/filters-DJ44i8Mo.js +0 -8
  124. package/assets/index-BA7pz-wf.js +0 -1
  125. package/assets/index-BFntqBXC.js +0 -1
  126. package/assets/index-B_dMHlXr.js +0 -1
  127. package/assets/index-BgXJ6Z6L.js +0 -1
  128. package/assets/index-CJxXHUcP.js +0 -1
  129. package/assets/index-CXz9iuA3.js +0 -1
  130. package/assets/index-Cg_5qxO-.js +0 -2
  131. package/assets/index-CntXRSz5.js +0 -2
  132. package/assets/index-DIS5DQM_.js +0 -1
  133. package/assets/index-Dbv53o1b.js +0 -1
  134. package/assets/index-DoaqdCF9.js +0 -601
  135. package/assets/index-Dsk1niAz.js +0 -7
  136. package/assets/index-HuL12PNJ.js +0 -5
  137. package/assets/index-mgaHX57j.js +0 -1
  138. package/assets/index-vWYtvmN_.js +0 -1
  139. package/assets/index.es-D0tGeUGR.js +0 -38
  140. package/assets/index.umd-CIiTi8qb.js +0 -1
  141. package/assets/off-B_Wn42xj.js +0 -8
  142. package/assets/search-DpE00x6Q.js +0 -8
  143. package/assets/swiper-react-BALcxKpm.js +0 -1
  144. package/assets/vendor-mui-40jyI-Tp.js +0 -197
  145. package/assets/vendor-react-DJXYd7Dm.js +0 -40
  146. package/assets/vendor-web3-Dw3dBix7.js +0 -74
@@ -0,0 +1,44 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ccip-Z16c_UnO.js","assets/index-BwH4aTS1.js","assets/hooks.module-Dz_XB4AG.js","assets/node-COcrmc-E.js","assets/index-nibyPLVP.js"])))=>i.map(i=>d[i]);
2
+ import{B as Xs,_ as Z,h as uo,y as f0}from"./hooks.module-Dz_XB4AG.js";import{k as Ae,l as ue,n as C,m as k,o as je,H as Qc,q as Is,r as Tr,t as Xc,s as eu,u as p0,v as wn,w as ra,x as h0,y as m0,z as b0,A as y0,C as st,D as Ke,E as rn,F as lo,G as sn,I as fo,J as fr,K as pr,L as g0,M as w0,N as v0,O as Ie,P as er,Q as te,S as tu,R as X,T as Jr,U as ie,V as Ht,W as x0,X as me,Y as Ct,Z as Ft,$ as nu,a0 as E0,a1 as Vn,a2 as ru,a3 as De,a4 as A0,a5 as de,a6 as P0,a7 as k0,a8 as S0,a9 as I0,aa as _0,ab as Oe,h as su,ac as Or,ad as po,ae as T0,af as O0,ag as sa,ah as C0,ai as B0,aj as zt,ak as iu,al as ve,am as ho,an as au,ao as ei,ap as ou,B as Y,aq as N0,ar as $0,as as mo,at as bo,j as M0}from"./index-BwH4aTS1.js";import{f as L0,e as R0,a as Re,E as hr,F as ti,b as yo,N as go,c as wo,d as vo,I as xo,g as Eo,h as Ao,T as Po,i as ni,U as tr}from"./node-COcrmc-E.js";import{c as j0,g as D0,d as U0,s as F0}from"./index-nibyPLVP.js";const cu={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function ia(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Ae(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?Ae(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?cu[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=z0(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 z0(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 uu(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:ia(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 nt(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 du={"0x0":"reverted","0x1":"success"};function aa(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=>nt(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Ae(e.transactionIndex):null,status:e.status?du[e.status]:null,type:e.type?cu[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const G0={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function nr(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=H0(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=>ue(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=C(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=C(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=C(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=C(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=C(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=C(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=G0[e.type]),typeof e.value<"u"&&(n.value=C(e.value)),n}function H0(e){return e.map(t=>({address:t.address,r:t.r?C(BigInt(t.r)):t.r,s:t.s?C(BigInt(t.s)):t.s,chainId:C(t.chainId),nonce:C(t.nonce),...typeof t.yParity<"u"?{yParity:C(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:C(t.v)}:{}}))}const q0=2n**256n-1n;function he(e){return typeof e[0]=="string"?yt(e):V0(e)}function V0(e){let t=0;for(const s of e)t+=s.length;const n=new Uint8Array(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function yt(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}let ko=class extends k{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},lu=class extends k{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},W0=class extends k{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const K0={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 W0({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new lu({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new ko({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 ko({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 oa(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(K0);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function Z0(e,t="hex"){const n=fu(e),r=oa(new Uint8Array(n.length));return n.encode(r),t==="hex"?ue(r.bytes):r.bytes}function fu(e){return Array.isArray(e)?Y0(e.map(t=>fu(t))):J0(e)}function Y0(e){const t=e.reduce((s,i)=>s+i.length,0),n=pu(t);return{length:t<=55?1+t:1+n+t,encode(s){t<=55?s.pushByte(192+t):(s.pushByte(247+n),n===1?s.pushUint8(t):n===2?s.pushUint16(t):n===3?s.pushUint24(t):s.pushUint32(t));for(const{encode:i}of e)i(s)}}}function J0(e){const t=typeof e=="string"?je(e):e,n=pu(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(s){t.length===1&&t[0]<128?s.pushBytes(t):t.length<=55?(s.pushByte(128+t.length),s.pushBytes(t)):(s.pushByte(183+n),n===1?s.pushUint8(t.length):n===2?s.pushUint16(t.length):n===3?s.pushUint24(t.length):s.pushUint32(t.length),s.pushBytes(t))}}}function pu(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 k("Length is too large.")}function ca(e,t="wei"){return L0(e,R0[t])}function Sn(e){const t=Object.entries(e).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=t.reduce((r,[s])=>Math.max(r,s.length),0);return t.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(`
3
+ `)}class Q0 extends k{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Sn(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 X0 extends k{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:a,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:l,value:p}){const f=Sn({chain:s&&`${s?.name} (id: ${s?.id})`,from:n?.address,to:l,value:typeof p<"u"&&`${ca(p)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${Re(o)} gwei`,maxFeePerGas:typeof c<"u"&&`${Re(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Re(u)} gwei`,nonce:d});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",f].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class hu extends k{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i}){let a="Transaction";r&&i!==void 0&&(a=`Transaction at block time "${r}" at index "${i}"`),t&&i!==void 0&&(a=`Transaction at block hash "${t}" at index "${i}"`),n&&i!==void 0&&(a=`Transaction at block number "${n}" at index "${i}"`),s&&(a=`Transaction with hash "${s}"`),super(`${a} could not be found.`,{name:"TransactionNotFoundError"})}}class mu extends k{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 ep extends k{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 tp extends k{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}function bu(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>je(i)):e.blobs,s=[];for(const i of r)s.push(Uint8Array.from(t.blobToKzgCommitment(i)));return n==="bytes"?s:s.map(i=>ue(i))}function yu(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(a=>je(a)):e.blobs,s=typeof e.commitments[0]=="string"?e.commitments.map(a=>je(a)):e.commitments,i=[];for(let a=0;a<r.length;a++){const o=r[a],c=s[a];i.push(Uint8Array.from(t.computeBlobKzgProof(o,c)))}return n==="bytes"?i:i.map(a=>ue(a))}function np(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),a=Number(n>>s&i),o=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,o,r)}function rp(e,t,n){return e&t^~e&n}function sp(e,t,n){return e&t^e&n^t&n}let gu=class extends Qc{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=Is(this.buffer)}update(t){Tr(this),t=Xc(t),eu(t);const{view:n,buffer:r,blockLen:s}=this,i=t.length;for(let a=0;a<i;){const o=Math.min(s-this.pos,i-a);if(o===s){const c=Is(t);for(;s<=i-a;a+=s)this.process(c,a);continue}r.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Tr(this),p0(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:a}=this;n[a++]=128,wn(this.buffer.subarray(a)),this.padOffset>s-a&&(this.process(r,0),a=0);for(let l=a;l<s;l++)n[l]=0;np(r,s-8,BigInt(this.length*8),i),this.process(r,0);const o=Is(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)o.setUint32(4*l,d[l],i)}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:s,finished:i,destroyed:a,pos:o}=this;return t.destroyed=a,t.finished=i,t.length=s,t.pos=o,s%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const vt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),fe=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),pe=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),ip=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]),xt=new Uint32Array(64);let ap=class extends gu{constructor(t=32){super(64,t,8,!1),this.A=vt[0]|0,this.B=vt[1]|0,this.C=vt[2]|0,this.D=vt[3]|0,this.E=vt[4]|0,this.F=vt[5]|0,this.G=vt[6]|0,this.H=vt[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:a,G:o,H:c}=this;return[t,n,r,s,i,a,o,c]}set(t,n,r,s,i,a,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=c|0}process(t,n){for(let l=0;l<16;l++,n+=4)xt[l]=t.getUint32(n,!1);for(let l=16;l<64;l++){const p=xt[l-15],f=xt[l-2],m=Ke(p,7)^Ke(p,18)^p>>>3,h=Ke(f,17)^Ke(f,19)^f>>>10;xt[l]=h+xt[l-7]+m+xt[l-16]|0}let{A:r,B:s,C:i,D:a,E:o,F:c,G:u,H:d}=this;for(let l=0;l<64;l++){const p=Ke(o,6)^Ke(o,11)^Ke(o,25),f=d+p+rp(o,c,u)+ip[l]+xt[l]|0,h=(Ke(r,2)^Ke(r,13)^Ke(r,22))+sp(r,s,i)|0;d=u,u=c,c=o,o=a+f|0,a=i,i=s,s=r,r=f+h|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(r,s,i,a,o,c,u,d)}roundClean(){wn(xt)}destroy(){this.set(0,0,0,0,0,0,0,0),wn(this.buffer)}};const wu=w0(["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))),op=wu[0],cp=wu[1],Et=new Uint32Array(80),At=new Uint32Array(80);class vu extends gu{constructor(t=64){super(128,t,16,!1),this.Ah=pe[0]|0,this.Al=pe[1]|0,this.Bh=pe[2]|0,this.Bl=pe[3]|0,this.Ch=pe[4]|0,this.Cl=pe[5]|0,this.Dh=pe[6]|0,this.Dl=pe[7]|0,this.Eh=pe[8]|0,this.El=pe[9]|0,this.Fh=pe[10]|0,this.Fl=pe[11]|0,this.Gh=pe[12]|0,this.Gl=pe[13]|0,this.Hh=pe[14]|0,this.Hl=pe[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:s,Ch:i,Cl:a,Dh:o,Dl:c,Eh:u,El:d,Fh:l,Fl:p,Gh:f,Gl:m,Hh:h,Hl:y}=this;return[t,n,r,s,i,a,o,c,u,d,l,p,f,m,h,y]}set(t,n,r,s,i,a,o,c,u,d,l,p,f,m,h,y){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=c|0,this.Eh=u|0,this.El=d|0,this.Fh=l|0,this.Fl=p|0,this.Gh=f|0,this.Gl=m|0,this.Hh=h|0,this.Hl=y|0}process(t,n){for(let g=0;g<16;g++,n+=4)Et[g]=t.getUint32(n),At[g]=t.getUint32(n+=4);for(let g=16;g<80;g++){const b=Et[g-15]|0,x=At[g-15]|0,E=rn(b,x,1)^rn(b,x,8)^lo(b,x,7),P=sn(b,x,1)^sn(b,x,8)^fo(b,x,7),O=Et[g-2]|0,M=At[g-2]|0,_=rn(O,M,19)^fr(O,M,61)^lo(O,M,6),$=sn(O,M,19)^pr(O,M,61)^fo(O,M,6),v=h0(P,$,At[g-7],At[g-16]),I=m0(v,E,_,Et[g-7],Et[g-16]);Et[g]=I|0,At[g]=v|0}let{Ah:r,Al:s,Bh:i,Bl:a,Ch:o,Cl:c,Dh:u,Dl:d,Eh:l,El:p,Fh:f,Fl:m,Gh:h,Gl:y,Hh:w,Hl:A}=this;for(let g=0;g<80;g++){const b=rn(l,p,14)^rn(l,p,18)^fr(l,p,41),x=sn(l,p,14)^sn(l,p,18)^pr(l,p,41),E=l&f^~l&h,P=p&m^~p&y,O=b0(A,x,P,cp[g],At[g]),M=y0(O,w,b,E,op[g],Et[g]),_=O|0,$=rn(r,s,28)^fr(r,s,34)^fr(r,s,39),v=sn(r,s,28)^pr(r,s,34)^pr(r,s,39),I=r&i^r&o^i&o,U=s&a^s&c^a&c;w=h|0,A=y|0,h=f|0,y=m|0,f=l|0,m=p|0,{h:l,l:p}=st(u|0,d|0,M|0,_|0),u=o|0,d=c|0,o=i|0,c=a|0,i=r|0,a=s|0;const S=v0(_,v,U);r=g0(S,M,$,I),s=S|0}({h:r,l:s}=st(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:a}=st(this.Bh|0,this.Bl|0,i|0,a|0),{h:o,l:c}=st(this.Ch|0,this.Cl|0,o|0,c|0),{h:u,l:d}=st(this.Dh|0,this.Dl|0,u|0,d|0),{h:l,l:p}=st(this.Eh|0,this.El|0,l|0,p|0),{h:f,l:m}=st(this.Fh|0,this.Fl|0,f|0,m|0),{h,l:y}=st(this.Gh|0,this.Gl|0,h|0,y|0),{h:w,l:A}=st(this.Hh|0,this.Hl|0,w|0,A|0),this.set(r,s,i,a,o,c,u,d,l,p,f,m,h,y,w,A)}roundClean(){wn(Et,At)}destroy(){wn(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class up extends vu{constructor(){super(48),this.Ah=fe[0]|0,this.Al=fe[1]|0,this.Bh=fe[2]|0,this.Bl=fe[3]|0,this.Ch=fe[4]|0,this.Cl=fe[5]|0,this.Dh=fe[6]|0,this.Dl=fe[7]|0,this.Eh=fe[8]|0,this.El=fe[9]|0,this.Fh=fe[10]|0,this.Fl=fe[11]|0,this.Gh=fe[12]|0,this.Gl=fe[13]|0,this.Hh=fe[14]|0,this.Hl=fe[15]|0}}const ua=ra(()=>new ap),dp=ra(()=>new vu),lp=ra(()=>new up),fp=ua;function pp(e,t){return fp(Ie(e,{strict:!1})?er(e):e)}function hp(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),s=pp(t);return s.set([n],0),r==="bytes"?s:ue(s)}function mp(e){const{commitments:t,version:n}=e,r=e.to??(typeof t[0]=="string"?"hex":"bytes"),s=[];for(const i of t)s.push(hp({commitment:i,to:r,version:n}));return s}const So=6,xu=32,da=4096,Eu=xu*da,Io=Eu*So-1-1*da*So;class bp extends k{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class yp extends k{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function gp(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?je(e.data):e.data,r=te(n);if(!r)throw new yp;if(r>Io)throw new bp({maxSize:Io,size:r});const s=[];let i=!0,a=0;for(;i;){const o=oa(new Uint8Array(Eu));let c=0;for(;c<da;){const u=n.slice(a,a+(xu-1));if(o.pushByte(0),o.pushBytes(u),u.length<31){o.pushByte(128),i=!1;break}c++,a+=31}s.push(o)}return t==="bytes"?s.map(o=>o.bytes):s.map(o=>ue(o.bytes))}function wp(e){const{data:t,kzg:n,to:r}=e,s=e.blobs??gp({data:t,to:r}),i=e.commitments??bu({blobs:s,kzg:n,to:r}),a=e.proofs??yu({blobs:s,commitments:i,kzg:n,to:r}),o=[];for(let c=0;c<s.length;c++)o.push({blob:s[c],commitment:i[c],proof:a[c]});return o}class ri extends k{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 Au extends k{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}function qt(e,t,n,{strict:r}={}){return Ie(e,{strict:!1})?si(e,t,n,{strict:r}):Su(e,t,n,{strict:r})}function Pu(e,t){if(typeof t=="number"&&t>0&&t>te(e)-1)throw new tu({offset:t,position:"start",size:te(e)})}function ku(e,t,n){if(typeof t=="number"&&typeof n=="number"&&te(e)!==n-t)throw new tu({offset:n,position:"end",size:te(e)})}function Su(e,t,n,{strict:r}={}){Pu(e,t);const s=e.slice(t,n);return r&&ku(s,t,n),s}function si(e,t,n,{strict:r}={}){Pu(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&ku(s,t,n),s}function vp(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 Q0({transaction:e})}function In({blockNumber:e,chain:t,contract:n}){const r=t?.contracts?.[n];if(!r)throw new ri({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ri({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}class Qr extends k{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(`
4
+ `),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}const xp={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."},Iu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Ep={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function qe(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new $p(e.type);return`${e.name}(${Xr(e.inputs,{includeName:t})})`}function Xr(e,{includeName:t=!1}={}){return e?e.map(n=>Ap(n,{includeName:t})).join(t?", ":","):""}function Ap(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Xr(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}class Pp extends k{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(`
5
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class _o extends k{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(`
6
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class _u extends k{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
7
+ `),{metaMessages:[`Params: (${Xr(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 rr extends k{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class kp extends k{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
8
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class Sp extends k{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${te(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Tu extends k{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
9
+ `),{name:"AbiEncodingLengthMismatchError"})}}class Ip extends k{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(`
10
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class To extends k{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(`
11
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Ou extends k{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(`
12
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class _p extends k{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Tp extends k{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(`
13
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Oo extends k{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(`
14
+ `),{docsPath:n,name:"AbiEventNotFoundError"})}}class vn extends k{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(`
15
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Cu extends k{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(`
16
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Op extends k{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(`
17
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class Cp extends k{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${qe(t.abiItem)}\`, and`,`\`${n.type}\` in \`${qe(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let Bu=class extends k{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Cr extends k{constructor({abiItem:t,data:n,params:r,size:s}){super([`Data size of ${s} bytes is too small for non-indexed event parameters.`].join(`
18
+ `),{metaMessages:[`Params: (${Xr(r,{includeName:!0})})`,`Data: ${n} (${s} 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=s}}class la extends k{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${qe(t,{includeName:!0})}".`].join(`
19
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class Bp extends k{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
20
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Np extends k{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
21
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Nu=class extends k{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
22
+ `),{name:"InvalidArrayError"})}};class $p extends k{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
23
+ `),{name:"InvalidDefinitionTypeError"})}}class Mp extends k{constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}const Lp=e=>X(er(e));function Rp(e){return Lp(e)}const jp="1.2.3";let ke=class ii extends Error{constructor(t,n={}){const r=n.cause instanceof ii?n.cause.details:n.cause?.message?n.cause.message:n.details,s=n.cause instanceof ii&&n.cause.docsPath||n.docsPath,i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${jp}`].join(`
24
+ `);super(i),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=s,this.metaMessages=n.metaMessages,this.shortMessage=t}};function gt(e,t){return e.exec(t)?.groups}const $u=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Mu=/^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)?$/,Lu=/^\(.+?\).*?$/,Co=/^tuple(?<array>(\[(\d*)\])*)$/;function ai(e){let t=e.type;if(Co.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const i=e.components[s];t+=ai(i),s<n-1&&(t+=", ")}const r=gt(Co,e.type);return t+=`)${r?.array||""}`,ai({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function un(e){let t="";const n=e.length;for(let r=0;r<n;r++){const s=e[r];t+=ai(s),r!==n-1&&(t+=", ")}return t}function Br(e){return e.type==="function"?`function ${e.name}(${un(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${un(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${un(e.inputs)})`:e.type==="error"?`error ${e.name}(${un(e.inputs)})`:e.type==="constructor"?`constructor(${un(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Ru=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Dp(e){return Ru.test(e)}function Up(e){return gt(Ru,e)}const ju=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Fp(e){return ju.test(e)}function zp(e){return gt(ju,e)}const Du=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Gp(e){return Du.test(e)}function Hp(e){return gt(Du,e)}const Uu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function es(e){return Uu.test(e)}function qp(e){return gt(Uu,e)}const Fu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Vp(e){return Fu.test(e)}function Wp(e){return gt(Fu,e)}const zu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Kp(e){return zu.test(e)}function Zp(e){return gt(zu,e)}const Yp=/^receive\(\) external payable$/;function Jp(e){return Yp.test(e)}const Bo=new Set(["memory","indexed","storage","calldata"]),Qp=new Set(["indexed"]),oi=new Set(["calldata","memory","storage"]);class Xp extends ke{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class eh extends ke{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class th extends ke{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class nh extends ke{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 rh extends ke{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class sh extends ke{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class ih extends ke{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class ah extends ke{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class oh extends ke{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class _n extends ke{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class ch extends ke{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class uh extends ke{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class dh extends ke{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class lh extends ke{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function fh(e,t,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let i="";for(const a of s[1])i+=`[${a.type}${a.name?`:${a.name}`:""}]`;r+=`(${s[0]}{${i}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const _s=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 ci(e,t={}){if(Gp(e))return ph(e,t);if(Fp(e))return hh(e,t);if(Dp(e))return mh(e,t);if(Vp(e))return bh(e,t);if(Kp(e))return yh(e);if(Jp(e))return{type:"receive",stateMutability:"payable"};throw new ch({signature:e})}function ph(e,t={}){const n=Hp(e);if(!n)throw new _n({signature:e,type:"function"});const r=_e(n.parameters),s=[],i=r.length;for(let o=0;o<i;o++)s.push(bt(r[o],{modifiers:oi,structs:t,type:"function"}));const a=[];if(n.returns){const o=_e(n.returns),c=o.length;for(let u=0;u<c;u++)a.push(bt(o[u],{modifiers:oi,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:a}}function hh(e,t={}){const n=zp(e);if(!n)throw new _n({signature:e,type:"event"});const r=_e(n.parameters),s=[],i=r.length;for(let a=0;a<i;a++)s.push(bt(r[a],{modifiers:Qp,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:s}}function mh(e,t={}){const n=Up(e);if(!n)throw new _n({signature:e,type:"error"});const r=_e(n.parameters),s=[],i=r.length;for(let a=0;a<i;a++)s.push(bt(r[a],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:s}}function bh(e,t={}){const n=Wp(e);if(!n)throw new _n({signature:e,type:"constructor"});const r=_e(n.parameters),s=[],i=r.length;for(let a=0;a<i;a++)s.push(bt(r[a],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function yh(e){const t=Zp(e);if(!t)throw new _n({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const gh=/^(?<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$_]*))?$/,wh=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,vh=/^u?int$/;function bt(e,t){const n=fh(e,t?.type,t?.structs);if(_s.has(n))return _s.get(n);const r=Lu.test(e),s=gt(r?wh:gh,e);if(!s)throw new rh({param:e});if(s.name&&Eh(s.name))throw new sh({param:e,name:s.name});const i=s.name?{name:s.name}:{},a=s.modifier==="indexed"?{indexed:!0}:{},o=t?.structs??{};let c,u={};if(r){c="tuple";const l=_e(s.type),p=[],f=l.length;for(let m=0;m<f;m++)p.push(bt(l[m],{structs:o}));u={components:p}}else if(s.type in o)c="tuple",u={components:o[s.type]};else if(vh.test(s.type))c=`${s.type}256`;else if(s.type==="address payable")c="address";else if(c=s.type,t?.type!=="struct"&&!Gu(c))throw new th({type:c});if(s.modifier){if(!t?.modifiers?.has?.(s.modifier))throw new ih({param:e,type:t?.type,modifier:s.modifier});if(oi.has(s.modifier)&&!Ah(c,!!s.array))throw new ah({param:e,type:t?.type,modifier:s.modifier})}const d={type:`${c}${s.array??""}`,...i,...a,...u};return _s.set(n,d),d}function _e(e,t=[],n="",r=0){const s=e.trim().length;for(let i=0;i<s;i++){const a=e[i],o=e.slice(i+1);switch(a){case",":return r===0?_e(o,[...t,n.trim()]):_e(o,t,`${n}${a}`,r);case"(":return _e(o,t,`${n}${a}`,r+1);case")":return _e(o,t,`${n}${a}`,r-1);default:return _e(o,t,`${n}${a}`,r)}}if(n==="")return t;if(r!==0)throw new lh({current:n,depth:r});return t.push(n.trim()),t}function Gu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||$u.test(e)||Mu.test(e)}const xh=/^(?: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 Eh(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||$u.test(e)||Mu.test(e)||xh.test(e)}function Ah(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function fa(e){const t={},n=e.length;for(let a=0;a<n;a++){const o=e[a];if(!es(o))continue;const c=qp(o);if(!c)throw new _n({signature:o,type:"struct"});const u=c.properties.split(";"),d=[],l=u.length;for(let p=0;p<l;p++){const m=u[p].trim();if(!m)continue;const h=bt(m,{type:"struct"});d.push(h)}if(!d.length)throw new uh({signature:o});t[c.name]=d}const r={},s=Object.entries(t),i=s.length;for(let a=0;a<i;a++){const[o,c]=s[a];r[o]=Hu(c,t)}return r}const Ph=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Hu(e=[],t={},n=new Set){const r=[],s=e.length;for(let i=0;i<s;i++){const a=e[i];if(Lu.test(a.type))r.push(a);else{const c=gt(Ph,a.type);if(!c?.type)throw new oh({abiParameter:a});const{array:u,type:d}=c;if(d in t){if(n.has(d))throw new dh({type:d});r.push({...a,type:`tuple${u??""}`,components:Hu(t[d],t,new Set([...n,d]))})}else if(Gu(d))r.push(a);else throw new eh({type:d})}}return r}function pa(e){const t=fa(e),n=[],r=e.length;for(let s=0;s<r;s++){const i=e[s];es(i)||n.push(ci(i,t))}return n}function No(e){let t;if(typeof e=="string")t=ci(e);else{const n=fa(e),r=e.length;for(let s=0;s<r;s++){const i=e[s];if(!es(i)){t=ci(i,n);break}}}if(!t)throw new Xp({signature:e});return t}function $o(e){const t=[];if(typeof e=="string"){const n=_e(e),r=n.length;for(let s=0;s<r;s++)t.push(bt(n[s],{modifiers:Bo}))}else{const n=fa(e),r=e.length;for(let s=0;s<r;s++){const i=e[s];if(es(i))continue;const a=_e(i),o=a.length;for(let c=0;c<o;c++)t.push(bt(a[c],{modifiers:Bo,structs:n}))}}if(t.length===0)throw new nh({params:e});return t}function kh(e){let t=!0,n="",r=0,s="",i=!1;for(let a=0;a<e.length;a++){const o=e[a];if(["(",")",","].includes(o)&&(t=!0),o==="("&&r++,o===")"&&r--,!!t){if(r===0){if(o===" "&&["event","function",""].includes(s))s="";else if(s+=o,o===")"){i=!0;break}continue}if(o===" "){e[a-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=o,n+=o}}if(!i)throw new k("Unable to normalize signature.");return s}const Sh=e=>{const t=typeof e=="string"?e:Br(e);return kh(t)};function qu(e){return Rp(Sh(e))}const sr=e=>qt(qu(e),0,4);function Ih(e,t={}){typeof t.size<"u"&&Jr(e,{size:t.size});const n=ue(e,t);return ie(n,t)}function _h(e,t={}){let n=e;if(typeof t.size<"u"&&(Jr(n,{size:t.size}),n=Ht(n)),n.length>1||n[0]>1)throw new x0(n);return!!n[0]}function ht(e,t={}){typeof t.size<"u"&&Jr(e,{size:t.size});const n=ue(e,t);return Ae(n,t)}function Th(e,t={}){let n=e;return typeof t.size<"u"&&(Jr(n,{size:t.size}),n=Ht(n,{dir:"right"})),new TextDecoder().decode(n)}const Oh=/^(.*)\[([0-9]*)\]$/,Vu=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ha=/^(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 Ce(e,t){if(e.length!==t.length)throw new Tu({expectedLength:e.length,givenLength:t.length});const n=Ch({params:e,values:t}),r=ba(n);return r.length===0?"0x":r}function Ch({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(ma({param:e[r],value:t[r]}));return n}function ma({param:e,value:t}){const n=ya(e.type);if(n){const[r,s]=n;return Nh(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return jh(t,{param:e});if(e.type==="address")return Bh(t);if(e.type==="bool")return Mh(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,s="256"]=ha.exec(e.type)??[];return Lh(t,{signed:r,size:Number(s)})}if(e.type.startsWith("bytes"))return $h(t,{param:e});if(e.type==="string")return Rh(t);throw new Bp(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function ba(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:a,encoded:o}=e[i];a?t+=32:t+=te(o)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:a,encoded:o}=e[i];a?(n.push(C(t+s,{size:32})),r.push(o),s+=te(o)):n.push(o)}return he([...n,...r])}function Bh(e){if(!me(e))throw new Ct({address:e});return{dynamic:!1,encoded:Ft(e.toLowerCase())}}function Nh(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Nu(e);if(!r&&e.length!==t)throw new kp({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let s=!1;const i=[];for(let a=0;a<e.length;a++){const o=ma({param:n,value:e[a]});o.dynamic&&(s=!0),i.push(o)}if(r||s){const a=ba(i);if(r){const o=C(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?he([o,a]):o}}if(s)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:he(i.map(({encoded:a})=>a))}}function $h(e,{param:t}){const[,n]=t.type.split("bytes"),r=te(e);if(!n){let s=e;return r%32!==0&&(s=Ft(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:he([Ft(C(r,{size:32})),s])}}if(r!==Number.parseInt(n,10))throw new Sp({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Ft(e,{dir:"right"})}}function Mh(e){if(typeof e!="boolean")throw new k(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Ft(nu(e))}}function Lh(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new E0({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:C(e,{size:32,signed:t})}}function Rh(e){const t=Vn(e),n=Math.ceil(te(t)/32),r=[];for(let s=0;s<n;s++)r.push(Ft(qt(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:he([Ft(C(te(t),{size:32})),...r])}}function jh(e,{param:t}){let n=!1;const r=[];for(let s=0;s<t.components.length;s++){const i=t.components[s],a=Array.isArray(e)?s:i.name,o=ma({param:i,value:e[a]});r.push(o),o.dynamic&&(n=!0)}return{dynamic:n,encoded:n?ba(r):he(r.map(({encoded:s})=>s))}}function ya(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Yt(e,t){const n=typeof t=="string"?je(t):t,r=oa(n);if(te(n)===0&&e.length>0)throw new rr;if(te(t)&&te(t)<32)throw new _u({data:typeof t=="string"?t:ue(t),params:e,size:te(t)});let s=0;const i=[];for(let a=0;a<e.length;++a){const o=e[a];r.setPosition(s);const[c,u]=pn(r,o,{staticPosition:0});s+=u,i.push(c)}return i}function pn(e,t,{staticPosition:n}){const r=ya(t.type);if(r){const[s,i]=r;return Uh(e,{...t,type:i},{length:s,staticPosition:n})}if(t.type==="tuple")return Hh(e,t,{staticPosition:n});if(t.type==="address")return Dh(e);if(t.type==="bool")return Fh(e);if(t.type.startsWith("bytes"))return zh(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Gh(e,t);if(t.type==="string")return qh(e,{staticPosition:n});throw new Np(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Mo=32,ui=32;function Dh(e){const t=e.readBytes(32);return[ru(ue(Su(t,-20))),32]}function Uh(e,t,{length:n,staticPosition:r}){if(!n){const a=ht(e.readBytes(ui)),o=r+a,c=o+Mo;e.setPosition(o);const u=ht(e.readBytes(Mo)),d=Wn(t);let l=0;const p=[];for(let f=0;f<u;++f){e.setPosition(c+(d?f*32:l));const[m,h]=pn(e,t,{staticPosition:c});l+=h,p.push(m)}return e.setPosition(r+32),[p,32]}if(Wn(t)){const a=ht(e.readBytes(ui)),o=r+a,c=[];for(let u=0;u<n;++u){e.setPosition(o+u*32);const[d]=pn(e,t,{staticPosition:o});c.push(d)}return e.setPosition(r+32),[c,32]}let s=0;const i=[];for(let a=0;a<n;++a){const[o,c]=pn(e,t,{staticPosition:r+s});s+=c,i.push(o)}return[i,s]}function Fh(e){return[_h(e.readBytes(32),{size:32}),32]}function zh(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const a=ht(e.readBytes(32));e.setPosition(n+a);const o=ht(e.readBytes(32));if(o===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(o);return e.setPosition(n+32),[ue(c),32]}return[ue(e.readBytes(Number.parseInt(s,10),32)),32]}function Gh(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?Ih(s,{signed:n}):ht(s,{signed:n}),32]}function Hh(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:a})=>!a),s=r?[]:{};let i=0;if(Wn(t)){const a=ht(e.readBytes(ui)),o=n+a;for(let c=0;c<t.components.length;++c){const u=t.components[c];e.setPosition(o+i);const[d,l]=pn(e,u,{staticPosition:o});i+=l,s[r?c:u?.name]=d}return e.setPosition(n+32),[s,32]}for(let a=0;a<t.components.length;++a){const o=t.components[a],[c,u]=pn(e,o,{staticPosition:n});s[r?a:o?.name]=c,i+=u}return[s,i]}function qh(e,{staticPosition:t}){const n=ht(e.readBytes(32)),r=t+n;e.setPosition(r);const s=ht(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),a=Th(Ht(i));return e.setPosition(t+32),[a,32]}function Wn(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Wn);const n=ya(e.type);return!!(n&&Wn({...e,type:n[1]}))}function Wu(e){const{abi:t,data:n}=e,r=qt(n,0,4);if(r==="0x")throw new rr;const i=[...t||[],Iu,Ep].find(a=>a.type==="error"&&r===sr(qe(a)));if(!i)throw new Ou(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?Yt(i.inputs,qt(n,4)):void 0,errorName:i.name}}function Ku({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((s,i)=>`${r&&s.name?`${s.name}: `:""}${typeof t[i]=="object"?De(t[i]):t[i]}`).join(", ")})`}const ts=qu;function Jt(e){const{abi:t,args:n=[],name:r}=e,s=Ie(r,{strict:!1}),i=t.filter(o=>s?o.type==="function"?sr(o)===r:o.type==="event"?ts(o)===r:!1:"name"in o&&o.name===r);if(i.length===0)return;if(i.length===1)return i[0];let a;for(const o of i){if(!("inputs"in o))continue;if(!n||n.length===0){if(!o.inputs||o.inputs.length===0)return o;continue}if(!o.inputs||o.inputs.length===0||o.inputs.length!==n.length)continue;if(n.every((u,d)=>{const l="inputs"in o&&o.inputs[d];return l?di(u,l):!1})){if(a&&"inputs"in a&&a.inputs){const u=Zu(o.inputs,a.inputs,n);if(u)throw new Cp({abiItem:o,type:u[0]},{abiItem:a,type:u[1]})}a=o}}return a||i[0]}function di(e,t){const n=typeof e,r=t.type;switch(r){case"address":return me(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((s,i)=>n==="object"&&di(Object.values(e)[i],s)):/^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(s=>di(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Zu(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return Zu(s.components,i.components,n[r]);const a=[s.type,i.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")?me(n[r],{strict:!1}):a.includes("address")&&a.includes("bytes")?me(n[r],{strict:!1}):!1)return a}}class Vh extends k{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Wh extends k{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Lo(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
25
+ `,"")}function Kh(e){return e.reduce((t,{address:n,...r})=>{let s=`${t} ${n}:
26
+ `;return r.nonce&&(s+=` nonce: ${r.nonce}
27
+ `),r.balance&&(s+=` balance: ${r.balance}
28
+ `),r.code&&(s+=` code: ${r.code}
29
+ `),r.state&&(s+=` state:
30
+ `,s+=Lo(r.state)),r.stateDiff&&(s+=` stateDiff:
31
+ `,s+=Lo(r.stateDiff)),s},` State Override:
32
+ `).slice(0,-1)}class Yu extends k{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:a,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:l,value:p,stateOverride:f}){const m=n?de(n):void 0;let h=Sn({from:m?.address,to:l,value:typeof p<"u"&&`${ca(p)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${Re(o)} gwei`,maxFeePerGas:typeof c<"u"&&`${Re(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Re(u)} gwei`,nonce:d});f&&(h+=`
33
+ ${Kh(f)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",h].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class ga extends k{constructor(t,{abi:n,args:r,contractAddress:s,docsPath:i,functionName:a,sender:o}){const c=Jt({abi:n,args:r,name:a}),u=c?Ku({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=c?qe(c,{includeName:!0}):void 0,l=Sn({address:s&&A0(s),function:d,args:u&&u!=="()"&&`${[...Array(a?.length??0).keys()].map(()=>" ").join("")}${u}`,sender:o});super(t.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:t,docsPath:i,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],l&&"Contract Call:",l].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=s,this.functionName=a,this.sender=o}}class Nr extends k{constructor({abi:t,data:n,functionName:r,message:s}){let i,a,o,c;if(n&&n!=="0x")try{a=Wu({abi:t,data:n});const{abiItem:d,errorName:l,args:p}=a;if(l==="Error")c=p[0];else if(l==="Panic"){const[f]=p;c=xp[f]}else{const f=d?qe(d,{includeName:!0}):void 0,m=d&&p?Ku({abiItem:d,args:p,includeFunctionName:!1,includeName:!1}):void 0;o=[f?`Error: ${f}`:"",m&&m!=="()"?` ${[...Array(l?.length??0).keys()].map(()=>" ").join("")}${m}`:""]}}catch(d){i=d}else s&&(c=s);let u;i instanceof Ou&&(u=i.signature,o=[`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(`
34
+ `):`The contract function "${r}" reverted.`,{cause:i,metaMessages:o,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=a,this.raw=n,this.reason=c,this.signature=u}}class Ju extends k{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 Zh extends k{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 ns extends k{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}}function rs(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof k?e.walk(s=>s?.code===hr.code):e;return r instanceof k?new hr({cause:e,message:r.details}):hr.nodeMessage.test(n)?new hr({cause:e,message:e.details}):ti.nodeMessage.test(n)?new ti({cause:e,maxFeePerGas:t?.maxFeePerGas}):yo.nodeMessage.test(n)?new yo({cause:e,maxFeePerGas:t?.maxFeePerGas}):go.nodeMessage.test(n)?new go({cause:e,nonce:t?.nonce}):wo.nodeMessage.test(n)?new wo({cause:e,nonce:t?.nonce}):vo.nodeMessage.test(n)?new vo({cause:e,nonce:t?.nonce}):xo.nodeMessage.test(n)?new xo({cause:e}):Eo.nodeMessage.test(n)?new Eo({cause:e,gas:t?.gas}):Ao.nodeMessage.test(n)?new Ao({cause:e,gas:t?.gas}):Po.nodeMessage.test(n)?new Po({cause:e}):ni.nodeMessage.test(n)?new ni({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new tr({cause:e})}function Qu(e,{docsPath:t,...n}){const r=(()=>{const s=rs(e,n);return s instanceof tr?e:s})();return new Yu(r,{docsPath:t,...n})}function ss(e,{format:t}){if(!t)return{};const n={};function r(i){const a=Object.keys(i);for(const o of a)o in e&&(n[o]=e[o]),i[o]&&typeof i[o]=="object"&&!Array.isArray(i[o])&&r(i[o])}const s=t(e||{});return r(s),n}function Tn(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:s}=e,i=t?de(t):void 0;if(i&&!me(i.address))throw new Ct({address:i.address});if(s&&!me(s))throw new Ct({address:s});if(n&&n>q0)throw new ti({maxFeePerGas:n});if(r&&n&&r>n)throw new ni({maxFeePerGas:n,maxPriorityFeePerGas:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const wa=BigInt(0),li=BigInt(1);function ir(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function va(e){if(!ir(e))throw new Error("Uint8Array expected")}function Kn(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function mr(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Xu(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?wa:BigInt("0x"+e)}const ed=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Yh=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Zn(e){if(va(e),ed)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Yh[e[n]];return t}const it={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ro(e){if(e>=it._0&&e<=it._9)return e-it._0;if(e>=it.A&&e<=it.F)return e-(it.A-10);if(e>=it.a&&e<=it.f)return e-(it.a-10)}function $r(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(ed)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 s=0,i=0;s<n;s++,i+=2){const a=Ro(e.charCodeAt(i)),o=Ro(e.charCodeAt(i+1));if(a===void 0||o===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=a*16+o}return r}function Gt(e){return Xu(Zn(e))}function td(e){return va(e),Xu(Zn(Uint8Array.from(e).reverse()))}function ar(e,t){return $r(e.toString(16).padStart(t*2,"0"))}function nd(e,t){return ar(e,t).reverse()}function Me(e,t,n){let r;if(typeof t=="string")try{r=$r(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(ir(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function Mr(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];va(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}const Ts=e=>typeof e=="bigint"&&wa<=e;function xa(e,t,n){return Ts(e)&&Ts(t)&&Ts(n)&&t<=e&&e<n}function hn(e,t,n,r){if(!xa(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Jh(e){let t;for(t=0;e>wa;e>>=li,t+=1);return t}const is=e=>(li<<BigInt(e))-li,Os=e=>new Uint8Array(e),jo=e=>Uint8Array.from(e);function Qh(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=Os(e),s=Os(e),i=0;const a=()=>{r.fill(1),s.fill(0),i=0},o=(...l)=>n(s,r,...l),c=(l=Os(0))=>{s=o(jo([0]),l),r=o(),l.length!==0&&(s=o(jo([1]),l),r=o())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let l=0;const p=[];for(;l<t;){r=o();const f=r.slice();p.push(f),l+=r.length}return Mr(...p)};return(l,p)=>{a(),c(l);let f;for(;!(f=p(u()));)c();return a(),f}}const Xh={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"||ir(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 as(e,t,n={}){const r=(s,i,a)=>{const o=Xh[i];if(typeof o!="function")throw new Error("invalid validator function");const c=e[s];if(!(a&&c===void 0)&&!o(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}function Do(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const em="0.1.1";function tm(){return em}let G=class ct extends Error{static setStaticOptions(t){ct.prototype.docsOrigin=t.docsOrigin,ct.prototype.showVersion=t.showVersion,ct.prototype.version=t.version}constructor(t,n={}){const r=(()=>{if(n.cause instanceof ct){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})(),s=n.cause instanceof ct&&n.cause.docsPath||n.docsPath,i=n.docsOrigin??ct.prototype.docsOrigin,a=`${i}${s??""}`,o=!!(n.version??ct.prototype.showVersion),c=n.version??ct.prototype.version,u=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s||o?["",r?`Details: ${r}`:void 0,s?`See: ${a}`:void 0,o?`Version: ${c}`:void 0]:[]].filter(d=>typeof d=="string").join(`
35
+ `);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=a,this.docsOrigin=i,this.docsPath=s,this.shortMessage=t,this.showVersion=o,this.version=c}walk(t){return rd(this,t)}};Object.defineProperty(G,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${tm()}`}});G.setStaticOptions(G.defaultStaticOptions);function rd(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?rd(e.cause,t):t?null:e}function or(e,t){if(dn(e)>t)throw new km({givenSize:dn(e),maxSize:t})}const at={zero:48,nine:57,A:65,F:70,a:97,f:102};function Uo(e){if(e>=at.zero&&e<=at.nine)return e-at.zero;if(e>=at.A&&e<=at.F)return e-(at.A-10);if(e>=at.a&&e<=at.f)return e-(at.a-10)}function nm(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Sm({size:e.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let i=0;i<r;i++){const a=n==="right";s[a?i:r-i-1]=e[a?i:e.length-i-1]}return s}function sd(e,t={}){const{dir:n="left"}=t;let r=e,s=0;for(let i=0;i<r.length-1&&r[n==="left"?i:r.length-i-1].toString()==="0";i++)s++;return r=n==="left"?r.slice(s):r.slice(0,r.length-s),r}function os(e,t){if(Be(e)>t)throw new lm({givenSize:Be(e),maxSize:t})}function rm(e,t){if(typeof t=="number"&&t>0&&t>Be(e)-1)throw new ld({offset:t,position:"start",size:Be(e)})}function sm(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Be(e)!==n-t)throw new ld({offset:n,position:"end",size:Be(e)})}function id(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new fm({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const im="#__bigint";function ad(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+im:s,n)}const am=new TextEncoder,om=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function cm(e,t={}){const{strict:n=!1}=t;if(!e)throw new Fo(e);if(typeof e!="string")throw new Fo(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new zo(e);if(!e.startsWith("0x"))throw new zo(e)}function Ve(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function um(e){return e instanceof Uint8Array?We(e):Array.isArray(e)?We(new Uint8Array(e)):e}function od(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(os(n,t.size),Vt(n,t.size)):n}function We(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=om[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(os(r,t.size),Wt(r,t.size)):r}function ye(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<a){const u=typeof e=="bigint"?"n":"";throw new dd({max:i?`${i}${u}`:void 0,min:`${a}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&s<0?BigInt.asUintN(r*8,BigInt(s)):s).toString(16)}`;return r?Vt(c,r):c}function Ea(e,t={}){return We(am.encode(e),t)}function Vt(e,t){return id(e,{dir:"left",size:t})}function Wt(e,t){return id(e,{dir:"right",size:t})}function tt(e,t,n,r={}){const{strict:s}=r;rm(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&sm(i,t,n),i}function Be(e){return Math.ceil((e.length-2)/2)}function cd(e,t={}){const{signed:n}=t;t.size&&os(e,t.size);const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n)-1n,a=i>>1n;return r<=a?r:r-i-1n}function ud(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:cd(e,t))}function dm(e,t={}){const{strict:n=!1}=t;try{return cm(e,{strict:n}),!0}catch{return!1}}let dd=class extends G{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*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"})}},Fo=class extends G{constructor(t){super(`Value \`${typeof t=="object"?ad(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"})}},zo=class extends G{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"})}},lm=class extends G{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"})}},ld=class extends G{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"})}},fm=class extends G{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 pm=new TextDecoder,hm=new TextEncoder;function mm(e){return e instanceof Uint8Array?e:typeof e=="string"?fd(e):bm(e)}function bm(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function fd(e,t={}){const{size:n}=t;let r=e;n&&(os(e,n),r=Wt(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,a=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const u=Uo(s.charCodeAt(c++)),d=Uo(s.charCodeAt(c++));if(u===void 0||d===void 0)throw new G(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);a[o]=u<<4|d}return a}function ym(e,t={}){const{size:n}=t,r=hm.encode(e);return typeof n=="number"?(or(r,n),gm(r,n)):r}function gm(e,t){return nm(e,{dir:"right",size:t})}function dn(e){return e.length}function wm(e,t,n,r={}){return e.slice(t,n)}function vm(e,t={}){const{size:n}=t;typeof n<"u"&&or(e,n);const r=We(e,t);return cd(r,t)}function xm(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(or(r,n),r=pd(r)),r.length>1||r[0]>1)throw new Pm(r);return!!r[0]}function mt(e,t={}){const{size:n}=t;typeof n<"u"&&or(e,n);const r=We(e,t);return ud(r,t)}function Em(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(or(r,n),r=Am(r)),pm.decode(r)}function pd(e){return sd(e,{dir:"left"})}function Am(e){return sd(e,{dir:"right"})}class Pm extends G{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 km=class extends G{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"})}},Sm=class extends G{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 hd(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=P0(mm(e));return n==="Bytes"?r:We(r)}const Im={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 Om({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Tm({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Go({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 Go({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 _m(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Im);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Go extends G{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Tm extends G{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 Om extends G{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"})}}class Cm 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 Bm={checksum:new Cm(8192)},Cs=Bm.checksum,Nm=/^0x[a-fA-F0-9]{40}$/;function cs(e,t={}){const{strict:n=!0}=t;if(!Nm.test(e))throw new Ho({address:e,cause:new $m});if(n){if(e.toLowerCase()===e)return;if(md(e)!==e)throw new Ho({address:e,cause:new Mm})}}function md(e){if(Cs.has(e))return Cs.get(e);cs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=hd(ym(t),{as:"Bytes"}),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return Cs.set(e,s),s}function fi(e,t={}){const{strict:n=!0}=t??{};try{return cs(e,{strict:n}),!0}catch{return!1}}class Ho extends G{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 $m extends G{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 Mm extends G{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 Ee=BigInt(0),ge=BigInt(1),Dt=BigInt(2),Lm=BigInt(3),bd=BigInt(4),yd=BigInt(5),gd=BigInt(8);function xe(e,t){const n=e%t;return n>=Ee?n:t+n}function Ne(e,t,n){let r=e;for(;t-- >Ee;)r*=r,r%=n;return r}function pi(e,t){if(e===Ee)throw new Error("invert: expected non-zero number");if(t<=Ee)throw new Error("invert: expected positive modulus, got "+t);let n=xe(e,t),r=t,s=Ee,i=ge;for(;n!==Ee;){const o=r/n,c=r%n,u=s-i*o;r=n,n=c,s=i,i=u}if(r!==ge)throw new Error("invert: does not exist");return xe(s,t)}function wd(e,t){const n=(e.ORDER+ge)/bd,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Rm(e,t){const n=(e.ORDER-yd)/gd,r=e.mul(t,Dt),s=e.pow(r,n),i=e.mul(t,s),a=e.mul(e.mul(i,Dt),s),o=e.mul(i,e.sub(a,e.ONE));if(!e.eql(e.sqr(o),t))throw new Error("Cannot find square root");return o}function jm(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-ge,n=0;for(;t%Dt===Ee;)t/=Dt,n++;let r=Dt;const s=On(e);for(;qo(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return wd;let i=s.pow(r,t);const a=(t+ge)/Dt;return function(c,u){if(c.is0(u))return u;if(qo(c,u)!==1)throw new Error("Cannot find square root");let d=n,l=c.mul(c.ONE,i),p=c.pow(u,t),f=c.pow(u,a);for(;!c.eql(p,c.ONE);){if(c.is0(p))return c.ZERO;let m=1,h=c.sqr(p);for(;!c.eql(h,c.ONE);)if(m++,h=c.sqr(h),m===d)throw new Error("Cannot find square root");const y=ge<<BigInt(d-m-1),w=c.pow(l,y);d=m,l=c.sqr(w),p=c.mul(p,l),f=c.mul(f,w)}return f}}function Dm(e){return e%bd===Lm?wd:e%gd===yd?Rm:jm(e)}const Um=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Fm(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Um.reduce((r,s)=>(r[s]="function",r),t);return as(e,n)}function zm(e,t,n){if(n<Ee)throw new Error("invalid exponent, negatives unsupported");if(n===Ee)return e.ONE;if(n===ge)return t;let r=e.ONE,s=t;for(;n>Ee;)n&ge&&(r=e.mul(r,s)),s=e.sqr(s),n>>=ge;return r}function vd(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((a,o,c)=>e.is0(o)?a:(r[c]=a,e.mul(a,o)),e.ONE),i=e.inv(s);return t.reduceRight((a,o,c)=>e.is0(o)?a:(r[c]=e.mul(a,r[c]),e.mul(a,o)),i),r}function qo(e,t){const n=(e.ORDER-ge)/Dt,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),a=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!a)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function xd(e,t){t!==void 0&&k0(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function On(e,t,n=!1,r={}){if(e<=Ee)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=xd(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let a;const o=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:is(s),ZERO:Ee,ONE:ge,create:c=>xe(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Ee<=c&&c<e},is0:c=>c===Ee,isOdd:c=>(c&ge)===ge,neg:c=>xe(-c,e),eql:(c,u)=>c===u,sqr:c=>xe(c*c,e),add:(c,u)=>xe(c+u,e),sub:(c,u)=>xe(c-u,e),mul:(c,u)=>xe(c*u,e),pow:(c,u)=>zm(o,c,u),div:(c,u)=>xe(c*pi(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>pi(c,e),sqrt:r.sqrt||(c=>(a||(a=Dm(e)),a(o,c))),toBytes:c=>n?nd(c,i):ar(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?td(c):Gt(c)},invertBatch:c=>vd(o,c),cmov:(c,u,d)=>d?u:c});return Object.freeze(o)}function Ed(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 Ad(e){const t=Ed(e);return t+Math.ceil(t/2)}function Gm(e,t,n=!1){const r=e.length,s=Ed(t),i=Ad(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const a=n?td(e):Gt(e),o=xe(a,t-ge)+ge;return n?nd(o,s):ar(o,s)}class Pd extends Qc{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,S0(t);const r=Xc(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 s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?t.create().update(r).digest():r);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=t.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),wn(i)}update(t){return Tr(this),this.iHash.update(t),this}digestInto(t){Tr(this),eu(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:s,destroyed:i,blockLen:a,outputLen:o}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=a,t.outputLen=o,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 kd=(e,t,n)=>new Pd(e,t).update(n).digest();kd.create=(e,t)=>new Pd(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vo=BigInt(0),hi=BigInt(1);function Bs(e,t){const n=t.negate();return e?n:t}function Sd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ns(e,t){Sd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=is(e),a=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:a}}function Wo(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:a}=n;let o=Number(e&s),c=e>>a;o>r&&(o-=i,c+=hi);const u=t*r,d=u+Math.abs(o)-1,l=o===0,p=o<0,f=t%2!==0;return{nextN:c,offset:d,isZero:l,isNeg:p,isNegF:f,offsetF:u}}function Hm(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 qm(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 $s=new WeakMap,Id=new WeakMap;function Ms(e){return Id.get(e)||1}function Vm(e,t){return{constTimeNegate:Bs,hasPrecomputes(n){return Ms(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>Vo;)r&hi&&(s=s.add(i)),i=i.double(),r>>=hi;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=Ns(r,t),a=[];let o=n,c=o;for(let u=0;u<s;u++){c=o,a.push(c);for(let d=1;d<i;d++)c=c.add(o),a.push(c);o=c.double()}return a},wNAF(n,r,s){let i=e.ZERO,a=e.BASE;const o=Ns(n,t);for(let c=0;c<o.windows;c++){const{nextN:u,offset:d,isZero:l,isNeg:p,isNegF:f,offsetF:m}=Wo(s,c,o);s=u,l?a=a.add(Bs(f,r[m])):i=i.add(Bs(p,r[d]))}return{p:i,f:a}},wNAFUnsafe(n,r,s,i=e.ZERO){const a=Ns(n,t);for(let o=0;o<a.windows&&s!==Vo;o++){const{nextN:c,offset:u,isZero:d,isNeg:l}=Wo(s,o,a);if(s=c,!d){const p=r[u];i=i.add(l?p.negate():p)}}return i},getPrecomputes(n,r,s){let i=$s.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&$s.set(r,s(i))),i},wNAFCached(n,r,s){const i=Ms(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const a=Ms(n);return a===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(a,this.getPrecomputes(a,n,s),r,i)},setWindowSize(n,r){Sd(r,t),Id.set(n,r),$s.delete(n)}}}function Wm(e,t,n,r){Hm(n,e),qm(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const a=e.ZERO,o=Jh(BigInt(s));let c=1;o>12?c=o-3:o>4?c=o-2:o>0&&(c=2);const u=is(c),d=new Array(Number(u)+1).fill(a),l=Math.floor((t.BITS-1)/c)*c;let p=a;for(let f=l;f>=0;f-=c){d.fill(a);for(let h=0;h<i;h++){const y=r[h],w=Number(y>>BigInt(f)&u);d[w]=d[w].add(n[h])}let m=a;for(let h=d.length-1,y=a;h>0;h--)y=y.add(d[h]),m=m.add(y);if(p=p.add(m),f!==0)for(let h=0;h<c;h++)p=p.double()}return p}function _d(e){return Fm(e.Fp),as(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...xd(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ko(e){e.lowS!==void 0&&Kn("lowS",e.lowS),e.prehash!==void 0&&Kn("prehash",e.prehash)}function Km(e){const t=_d(e);as(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:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}class Zm extends Error{constructor(t=""){super(t)}}const dt={Err:Zm,_tlv:{encode:(e,t)=>{const{Err:n}=dt;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,s=mr(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?mr(s.length/2|128):"";return mr(e)+i+s+t},decode(e,t){const{Err:n}=dt;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 s=t[r++],i=!!(s&128);let a=0;if(!i)a=s;else{const c=s&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 d of u)a=a<<8|d;if(r+=c,a<128)throw new n("tlv.decode(long): not minimal encoding")}const o=t.subarray(r,r+a);if(o.length!==a)throw new n("tlv.decode: wrong value length");return{v:o,l:t.subarray(r+a)}}},_int:{encode(e){const{Err:t}=dt;if(e<pt)throw new t("integer: negative integers are not allowed");let n=mr(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}=dt;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 Gt(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=dt,s=Me("signature",e),{v:i,l:a}=r.decode(48,s);if(a.length)throw new t("invalid signature: left bytes after parsing");const{v:o,l:c}=r.decode(2,i),{v:u,l:d}=r.decode(2,c);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(o),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=dt,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}};function Ls(e,t){return Zn(ar(e,t))}const pt=BigInt(0),ae=BigInt(1);BigInt(2);const Rs=BigInt(3),Ym=BigInt(4);function Jm(e){const t=Km(e),{Fp:n}=t,r=On(t.n,t.nBitLength),s=t.toBytes||((g,b,x)=>{const E=b.toAffine();return Mr(Uint8Array.from([4]),n.toBytes(E.x),n.toBytes(E.y))}),i=t.fromBytes||(g=>{const b=g.subarray(1),x=n.fromBytes(b.subarray(0,n.BYTES)),E=n.fromBytes(b.subarray(n.BYTES,2*n.BYTES));return{x,y:E}});function a(g){const{a:b,b:x}=t,E=n.sqr(g),P=n.mul(E,g);return n.add(n.add(P,n.mul(g,b)),x)}function o(g,b){const x=n.sqr(b),E=a(g);return n.eql(x,E)}if(!o(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,Rs),Ym),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 d(g){return xa(g,ae,t.n)}function l(g){const{allowedPrivateKeyLengths:b,nByteLength:x,wrapPrivateKey:E,n:P}=t;if(b&&typeof g!="bigint"){if(ir(g)&&(g=Zn(g)),typeof g!="string"||!b.includes(g.length))throw new Error("invalid private key");g=g.padStart(x*2,"0")}let O;try{O=typeof g=="bigint"?g:Gt(Me("private key",g,x))}catch{throw new Error("invalid private key, expected hex or "+x+" bytes, got "+typeof g)}return E&&(O=xe(O,P)),hn("private key",O,ae,P),O}function p(g){if(!(g instanceof h))throw new Error("ProjectivePoint expected")}const f=Do((g,b)=>{const{px:x,py:E,pz:P}=g;if(n.eql(P,n.ONE))return{x,y:E};const O=g.is0();b==null&&(b=O?n.ONE:n.inv(P));const M=n.mul(x,b),_=n.mul(E,b),$=n.mul(P,b);if(O)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:M,y:_}}),m=Do(g=>{if(g.is0()){if(t.allowInfinityPoint&&!n.is0(g.py))return;throw new Error("bad point: ZERO")}const{x:b,y:x}=g.toAffine();if(!n.isValid(b)||!n.isValid(x))throw new Error("bad point: x or y not FE");if(!o(b,x))throw new Error("bad point: equation left != right");if(!g.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class h{constructor(b,x,E){if(b==null||!n.isValid(b))throw new Error("x required");if(x==null||!n.isValid(x)||n.is0(x))throw new Error("y required");if(E==null||!n.isValid(E))throw new Error("z required");this.px=b,this.py=x,this.pz=E,Object.freeze(this)}static fromAffine(b){const{x,y:E}=b||{};if(!b||!n.isValid(x)||!n.isValid(E))throw new Error("invalid affine point");if(b instanceof h)throw new Error("projective point not allowed");const P=O=>n.eql(O,n.ZERO);return P(x)&&P(E)?h.ZERO:new h(x,E,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const x=vd(n,b.map(E=>E.pz));return b.map((E,P)=>E.toAffine(x[P])).map(h.fromAffine)}static fromHex(b){const x=h.fromAffine(i(Me("pointHex",b)));return x.assertValidity(),x}static fromPrivateKey(b){return h.BASE.multiply(l(b))}static msm(b,x){return Wm(h,r,b,x)}_setWindowSize(b){A.setWindowSize(this,b)}assertValidity(){m(this)}hasEvenY(){const{y:b}=this.toAffine();if(n.isOdd)return!n.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){p(b);const{px:x,py:E,pz:P}=this,{px:O,py:M,pz:_}=b,$=n.eql(n.mul(x,_),n.mul(O,P)),v=n.eql(n.mul(E,_),n.mul(M,P));return $&&v}negate(){return new h(this.px,n.neg(this.py),this.pz)}double(){const{a:b,b:x}=t,E=n.mul(x,Rs),{px:P,py:O,pz:M}=this;let _=n.ZERO,$=n.ZERO,v=n.ZERO,I=n.mul(P,P),U=n.mul(O,O),S=n.mul(M,M),T=n.mul(P,O);return T=n.add(T,T),v=n.mul(P,M),v=n.add(v,v),_=n.mul(b,v),$=n.mul(E,S),$=n.add(_,$),_=n.sub(U,$),$=n.add(U,$),$=n.mul(_,$),_=n.mul(T,_),v=n.mul(E,v),S=n.mul(b,S),T=n.sub(I,S),T=n.mul(b,T),T=n.add(T,v),v=n.add(I,I),I=n.add(v,I),I=n.add(I,S),I=n.mul(I,T),$=n.add($,I),S=n.mul(O,M),S=n.add(S,S),I=n.mul(S,T),_=n.sub(_,I),v=n.mul(S,U),v=n.add(v,v),v=n.add(v,v),new h(_,$,v)}add(b){p(b);const{px:x,py:E,pz:P}=this,{px:O,py:M,pz:_}=b;let $=n.ZERO,v=n.ZERO,I=n.ZERO;const U=t.a,S=n.mul(t.b,Rs);let T=n.mul(x,O),L=n.mul(E,M),N=n.mul(P,_),D=n.add(x,E),F=n.add(O,M);D=n.mul(D,F),F=n.add(T,L),D=n.sub(D,F),F=n.add(x,P);let K=n.add(O,_);return F=n.mul(F,K),K=n.add(T,N),F=n.sub(F,K),K=n.add(E,P),$=n.add(M,_),K=n.mul(K,$),$=n.add(L,N),K=n.sub(K,$),I=n.mul(U,F),$=n.mul(S,N),I=n.add($,I),$=n.sub(L,I),I=n.add(L,I),v=n.mul($,I),L=n.add(T,T),L=n.add(L,T),N=n.mul(U,N),F=n.mul(S,F),L=n.add(L,N),N=n.sub(T,N),N=n.mul(U,N),F=n.add(F,N),T=n.mul(L,F),v=n.add(v,T),T=n.mul(K,F),$=n.mul(D,$),$=n.sub($,T),T=n.mul(D,L),I=n.mul(K,I),I=n.add(I,T),new h($,v,I)}subtract(b){return this.add(b.negate())}is0(){return this.equals(h.ZERO)}wNAF(b){return A.wNAFCached(this,b,h.normalizeZ)}multiplyUnsafe(b){const{endo:x,n:E}=t;hn("scalar",b,pt,E);const P=h.ZERO;if(b===pt)return P;if(this.is0()||b===ae)return this;if(!x||A.hasPrecomputes(this))return A.wNAFCachedUnsafe(this,b,h.normalizeZ);let{k1neg:O,k1:M,k2neg:_,k2:$}=x.splitScalar(b),v=P,I=P,U=this;for(;M>pt||$>pt;)M&ae&&(v=v.add(U)),$&ae&&(I=I.add(U)),U=U.double(),M>>=ae,$>>=ae;return O&&(v=v.negate()),_&&(I=I.negate()),I=new h(n.mul(I.px,x.beta),I.py,I.pz),v.add(I)}multiply(b){const{endo:x,n:E}=t;hn("scalar",b,ae,E);let P,O;if(x){const{k1neg:M,k1:_,k2neg:$,k2:v}=x.splitScalar(b);let{p:I,f:U}=this.wNAF(_),{p:S,f:T}=this.wNAF(v);I=A.constTimeNegate(M,I),S=A.constTimeNegate($,S),S=new h(n.mul(S.px,x.beta),S.py,S.pz),P=I.add(S),O=U.add(T)}else{const{p:M,f:_}=this.wNAF(b);P=M,O=_}return h.normalizeZ([P,O])[0]}multiplyAndAddUnsafe(b,x,E){const P=h.BASE,O=(_,$)=>$===pt||$===ae||!_.equals(P)?_.multiplyUnsafe($):_.multiply($),M=O(this,x).add(O(b,E));return M.is0()?void 0:M}toAffine(b){return f(this,b)}isTorsionFree(){const{h:b,isTorsionFree:x}=t;if(b===ae)return!0;if(x)return x(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:x}=t;return b===ae?this:x?x(h,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return Kn("isCompressed",b),this.assertValidity(),s(h,this,b)}toHex(b=!0){return Kn("isCompressed",b),Zn(this.toRawBytes(b))}}h.BASE=new h(t.Gx,t.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);const{endo:y,nBitLength:w}=t,A=Vm(h,y?Math.ceil(w/2):w);return{CURVE:t,ProjectivePoint:h,normPrivateKeyToScalar:l,weierstrassEquation:a,isWithinCurveOrder:d}}function Qm(e){const t=_d(e);return as(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Xm(e){const t=Qm(e),{Fp:n,n:r,nByteLength:s,nBitLength:i}=t,a=n.BYTES+1,o=2*n.BYTES+1;function c(S){return xe(S,r)}function u(S){return pi(S,r)}const{ProjectivePoint:d,normPrivateKeyToScalar:l,weierstrassEquation:p,isWithinCurveOrder:f}=Jm({...t,toBytes(S,T,L){const N=T.toAffine(),D=n.toBytes(N.x),F=Mr;return Kn("isCompressed",L),L?F(Uint8Array.from([T.hasEvenY()?2:3]),D):F(Uint8Array.from([4]),D,n.toBytes(N.y))},fromBytes(S){const T=S.length,L=S[0],N=S.subarray(1);if(T===a&&(L===2||L===3)){const D=Gt(N);if(!xa(D,ae,n.ORDER))throw new Error("Point is not on curve");const F=p(D);let K;try{K=n.sqrt(F)}catch(we){const le=we instanceof Error?": "+we.message:"";throw new Error("Point is not on curve"+le)}const J=(K&ae)===ae;return(L&1)===1!==J&&(K=n.neg(K)),{x:D,y:K}}else if(T===o&&L===4){const D=n.fromBytes(N.subarray(0,n.BYTES)),F=n.fromBytes(N.subarray(n.BYTES,2*n.BYTES));return{x:D,y:F}}else{const D=a,F=o;throw new Error("invalid Point, expected length of "+D+", or uncompressed "+F+", got "+T)}}});function m(S){const T=r>>ae;return S>T}function h(S){return m(S)?c(-S):S}const y=(S,T,L)=>Gt(S.slice(T,L));class w{constructor(T,L,N){hn("r",T,ae,r),hn("s",L,ae,r),this.r=T,this.s=L,N!=null&&(this.recovery=N),Object.freeze(this)}static fromCompact(T){const L=s;return T=Me("compactSignature",T,L*2),new w(y(T,0,L),y(T,L,2*L))}static fromDER(T){const{r:L,s:N}=dt.toSig(Me("DER",T));return new w(L,N)}assertValidity(){}addRecoveryBit(T){return new w(this.r,this.s,T)}recoverPublicKey(T){const{r:L,s:N,recovery:D}=this,F=P(Me("msgHash",T));if(D==null||![0,1,2,3].includes(D))throw new Error("recovery id invalid");const K=D===2||D===3?L+t.n:L;if(K>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const J=D&1?"03":"02",Ue=d.fromHex(J+Ls(K,n.BYTES)),we=u(K),le=c(-F*we),en=c(N*we),wt=d.BASE.multiplyAndAddUnsafe(Ue,le,en);if(!wt)throw new Error("point at infinify");return wt.assertValidity(),wt}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return $r(this.toDERHex())}toDERHex(){return dt.hexFromSig(this)}toCompactRawBytes(){return $r(this.toCompactHex())}toCompactHex(){const T=s;return Ls(this.r,T)+Ls(this.s,T)}}const A={isValidPrivateKey(S){try{return l(S),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const S=Ad(t.n);return Gm(t.randomBytes(S),t.n)},precompute(S=8,T=d.BASE){return T._setWindowSize(S),T.multiply(BigInt(3)),T}};function g(S,T=!0){return d.fromPrivateKey(S).toRawBytes(T)}function b(S){if(typeof S=="bigint")return!1;if(S instanceof d)return!0;const L=Me("key",S).length,N=n.BYTES,D=N+1,F=2*N+1;if(!(t.allowedPrivateKeyLengths||s===D))return L===D||L===F}function x(S,T,L=!0){if(b(S)===!0)throw new Error("first arg must be private key");if(b(T)===!1)throw new Error("second arg must be public key");return d.fromHex(T).multiply(l(S)).toRawBytes(L)}const E=t.bits2int||function(S){if(S.length>8192)throw new Error("input is too large");const T=Gt(S),L=S.length*8-i;return L>0?T>>BigInt(L):T},P=t.bits2int_modN||function(S){return c(E(S))},O=is(i);function M(S){return hn("num < 2^"+i,S,pt,O),ar(S,s)}function _(S,T,L=$){if(["recovered","canonical"].some($t=>$t in L))throw new Error("sign() legacy options not supported");const{hash:N,randomBytes:D}=t;let{lowS:F,prehash:K,extraEntropy:J}=L;F==null&&(F=!0),S=Me("msgHash",S),Ko(L),K&&(S=Me("prehashed msgHash",N(S)));const Ue=P(S),we=l(T),le=[M(we),M(Ue)];if(J!=null&&J!==!1){const $t=J===!0?D(n.BYTES):J;le.push(Me("extraEntropy",$t))}const en=Mr(...le),wt=Ue;function ks($t){const tn=E($t);if(!f(tn))return;const Ss=u(tn),$n=d.BASE.multiply(tn).toAffine(),Mt=c($n.x);if(Mt===pt)return;const Mn=c(Ss*c(wt+Mt*we));if(Mn===pt)return;let nn=($n.x===Mt?0:2)|Number($n.y&ae),co=Mn;return F&&m(Mn)&&(co=h(Mn),nn^=1),new w(Mt,co,nn)}return{seed:en,k2sig:ks}}const $={lowS:t.lowS,prehash:!1},v={lowS:t.lowS,prehash:!1};function I(S,T,L=$){const{seed:N,k2sig:D}=_(S,T,L),F=t;return Qh(F.hash.outputLen,F.nByteLength,F.hmac)(N,D)}d.BASE._setWindowSize(8);function U(S,T,L,N=v){const D=S;T=Me("msgHash",T),L=Me("publicKey",L);const{lowS:F,prehash:K,format:J}=N;if(Ko(N),"strict"in N)throw new Error("options.strict was renamed to lowS");if(J!==void 0&&J!=="compact"&&J!=="der")throw new Error("format must be compact or der");const Ue=typeof D=="string"||ir(D),we=!Ue&&!J&&typeof D=="object"&&D!==null&&typeof D.r=="bigint"&&typeof D.s=="bigint";if(!Ue&&!we)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let le,en;try{if(we&&(le=new w(D.r,D.s)),Ue){try{J!=="compact"&&(le=w.fromDER(D))}catch(nn){if(!(nn instanceof dt.Err))throw nn}!le&&J!=="der"&&(le=w.fromCompact(D))}en=d.fromHex(L)}catch{return!1}if(!le||F&&le.hasHighS())return!1;K&&(T=t.hash(T));const{r:wt,s:ks}=le,$t=P(T),tn=u(ks),Ss=c($t*tn),$n=c(wt*tn),Mt=d.BASE.multiplyAndAddUnsafe(en,Ss,$n)?.toAffine();return Mt?c(Mt.x)===wt:!1}return{CURVE:t,getPublicKey:g,getSharedSecret:x,sign:I,verify:U,ProjectivePoint:d,Signature:w,utils:A}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function eb(e){return{hash:e,hmac:(t,...n)=>kd(e,t,I0(...n)),randomBytes:_0}}function us(e,t){const n=r=>Xm({...e,...eb(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Td=On(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),tb=Td.create(BigInt("-3")),nb=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),rb=us({a:tb,b:nb,Fp:Td,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},ua),Od=On(BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff")),sb=Od.create(BigInt("-3")),ib=BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef");us({a:sb,b:ib,Fp:Od,n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"),h:BigInt(1),lowS:!1},lp);const Cd=On(BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),ab=Cd.create(BigInt("-3")),ob=BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00");us({a:ab,b:ob,Fp:Cd,n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650"),h:BigInt(1),lowS:!1,allowedPrivateKeyLengths:[130,131,132]},dp);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Zo=rb;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Bd=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Yo=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),cb=BigInt(0),ub=BigInt(1),mi=BigInt(2),Jo=(e,t)=>(e+t/mi)/t;function db(e){const t=Bd,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),a=BigInt(23),o=BigInt(44),c=BigInt(88),u=e*e*e%t,d=u*u*e%t,l=Ne(d,n,t)*d%t,p=Ne(l,n,t)*d%t,f=Ne(p,mi,t)*u%t,m=Ne(f,s,t)*f%t,h=Ne(m,i,t)*m%t,y=Ne(h,o,t)*h%t,w=Ne(y,c,t)*y%t,A=Ne(w,o,t)*h%t,g=Ne(A,n,t)*d%t,b=Ne(g,a,t)*m%t,x=Ne(b,r,t)*u%t,E=Ne(x,mi,t);if(!bi.eql(bi.sqr(E),e))throw new Error("Cannot find square root");return E}const bi=On(Bd,void 0,void 0,{sqrt:db}),Aa=us({a:cb,b:BigInt(7),Fp:bi,n:Yo,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Yo,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-ub*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,a=BigInt("0x100000000000000000000000000000000"),o=Jo(i*e,t),c=Jo(-r*e,t);let u=xe(e-o*n-c*s,t),d=xe(-o*r-c*i,t);const l=u>a,p=d>a;if(l&&(u=t-u),p&&(d=t-d),u>a||d>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:l,k1:u,k2neg:p,k2:d}}}},ua),lb=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Aa},Symbol.toStringTag,{value:"Module"})),fb=/^(.*)\[([0-9]*)\]$/,pb=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Nd=/^(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)?$/,Qo=2n**256n-1n;function $d(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new js({signature:e});if(typeof e.s>"u")throw new js({signature:e});if(n&&typeof e.yParity>"u")throw new js({signature:e});if(e.r<0n||e.r>Qo)throw new vb({value:e.r});if(e.s<0n||e.s>Qo)throw new xb({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new ka({value:e.yParity})}function hb(e){return Md(We(e))}function Md(e){if(e.length!==130&&e.length!==132)throw new wb({signature:e});const t=BigInt(tt(e,0,32)),n=BigInt(tt(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return Pa(s)}catch{throw new ka({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function mb(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return bb(e)}function bb(e){const t=typeof e=="string"?Md(e):e instanceof Uint8Array?hb(e):typeof e.r=="string"?gb(e):e.v?yb(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return $d(t),t}function yb(e){return{r:e.r,s:e.s,yParity:Pa(e.v)}}function gb(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=Pa(n)),typeof r!="number")throw new ka({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function Pa(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 Eb({value:e})}let wb=class extends G{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Be(um(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},js=class extends G{constructor({signature:t}){super(`Signature \`${ad(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}},vb=class extends G{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"})}},xb=class extends G{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"})}},ka=class extends G{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"})}},Eb=class extends G{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 mn(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=_a(t.type);if(i){const[a,o]=i;return Pb(e,{...t,type:o},{checksumAddress:r,length:a,staticPosition:s})}if(t.type==="tuple")return _b(e,t,{checksumAddress:r,staticPosition:s});if(t.type==="address")return Ab(e,{checksum:r});if(t.type==="bool")return kb(e);if(t.type.startsWith("bytes"))return Sb(e,t,{staticPosition:s});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Ib(e,t);if(t.type==="string")return Tb(e,{staticPosition:s});throw new Oa(t.type)}const Xo=32,yi=32;function Ab(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(i=>n?md(i):i)(We(wm(r,-20))),32]}function Pb(e,t,n){const{checksumAddress:r,length:s,staticPosition:i}=n;if(!s){const c=mt(e.readBytes(yi)),u=i+c,d=u+Xo;e.setPosition(u);const l=mt(e.readBytes(Xo)),p=Yn(t);let f=0;const m=[];for(let h=0;h<l;++h){e.setPosition(d+(p?h*32:f));const[y,w]=mn(e,t,{checksumAddress:r,staticPosition:d});f+=w,m.push(y)}return e.setPosition(i+32),[m,32]}if(Yn(t)){const c=mt(e.readBytes(yi)),u=i+c,d=[];for(let l=0;l<s;++l){e.setPosition(u+l*32);const[p]=mn(e,t,{checksumAddress:r,staticPosition:u});d.push(p)}return e.setPosition(i+32),[d,32]}let a=0;const o=[];for(let c=0;c<s;++c){const[u,d]=mn(e,t,{checksumAddress:r,staticPosition:i+a});a+=d,o.push(u)}return[o,a]}function kb(e){return[xm(e.readBytes(32),{size:32}),32]}function Sb(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const a=mt(e.readBytes(32));e.setPosition(n+a);const o=mt(e.readBytes(32));if(o===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(o);return e.setPosition(n+32),[We(c),32]}return[We(e.readBytes(Number.parseInt(s,10),32)),32]}function Ib(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?vm(s,{signed:n}):mt(s,{signed:n}),32]}function _b(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=t.components.length===0||t.components.some(({name:c})=>!c),a=i?[]:{};let o=0;if(Yn(t)){const c=mt(e.readBytes(yi)),u=s+c;for(let d=0;d<t.components.length;++d){const l=t.components[d];e.setPosition(u+o);const[p,f]=mn(e,l,{checksumAddress:r,staticPosition:u});o+=f,a[i?d:l?.name]=p}return e.setPosition(s+32),[a,32]}for(let c=0;c<t.components.length;++c){const u=t.components[c],[d,l]=mn(e,u,{checksumAddress:r,staticPosition:s});a[i?c:u?.name]=d,o+=l}return[a,o]}function Tb(e,{staticPosition:t}){const n=mt(e.readBytes(32)),r=t+n;e.setPosition(r);const s=mt(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),a=Em(pd(i));return e.setPosition(t+32),[a,32]}function Ob({checksumAddress:e,parameters:t,values:n}){const r=[];for(let s=0;s<t.length;s++)r.push(Sa({checksumAddress:e,parameter:t[s],value:n[s]}));return r}function Sa({checksumAddress:e=!1,parameter:t,value:n}){const r=t,s=_a(r.type);if(s){const[i,a]=s;return Bb(n,{checksumAddress:e,length:i,parameter:{...r,type:a}})}if(r.type==="tuple")return Rb(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Cb(n,{checksum:e});if(r.type==="bool")return $b(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const i=r.type.startsWith("int"),[,,a="256"]=Nd.exec(r.type)??[];return Mb(n,{signed:i,size:Number(a)})}if(r.type.startsWith("bytes"))return Nb(n,{type:r.type});if(r.type==="string")return Lb(n);throw new Oa(r.type)}function Ia(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:a,encoded:o}=e[i];a?t+=32:t+=Be(o)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:a,encoded:o}=e[i];a?(n.push(ye(t+s,{size:32})),r.push(o),s+=Be(o)):n.push(o)}return Ve(...n,...r)}function Cb(e,t){const{checksum:n=!1}=t;return cs(e,{strict:n}),{dynamic:!1,encoded:Vt(e.toLowerCase())}}function Bb(e,t){const{checksumAddress:n,length:r,parameter:s}=t,i=r===null;if(!Array.isArray(e))throw new zb(e);if(!i&&e.length!==r)throw new Fb({expectedLength:r,givenLength:e.length,type:`${s.type}[${r}]`});let a=!1;const o=[];for(let c=0;c<e.length;c++){const u=Sa({checksumAddress:n,parameter:s,value:e[c]});u.dynamic&&(a=!0),o.push(u)}if(i||a){const c=Ia(o);if(i){const u=ye(o.length,{size:32});return{dynamic:!0,encoded:o.length>0?Ve(u,c):u}}if(a)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:Ve(...o.map(({encoded:c})=>c))}}function Nb(e,{type:t}){const[,n]=t.split("bytes"),r=Be(e);if(!n){let s=e;return r%32!==0&&(s=Wt(s,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Ve(Vt(ye(r,{size:32})),s)}}if(r!==Number.parseInt(n,10))throw new Rd({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Wt(e)}}function $b(e){if(typeof e!="boolean")throw new G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Vt(od(e))}}function Mb(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new dd({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:ye(e,{size:32,signed:t})}}function Lb(e){const t=Ea(e),n=Math.ceil(Be(t)/32),r=[];for(let s=0;s<n;s++)r.push(Wt(tt(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:Ve(Wt(ye(Be(t),{size:32})),...r)}}function Rb(e,t){const{checksumAddress:n,parameter:r}=t;let s=!1;const i=[];for(let a=0;a<r.components.length;a++){const o=r.components[a],c=Array.isArray(e)?a:o.name,u=Sa({checksumAddress:n,parameter:o,value:e[c]});i.push(u),u.dynamic&&(s=!0)}return{dynamic:s,encoded:s?Ia(i):Ve(...i.map(({encoded:a})=>a))}}function _a(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Yn(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Yn);const n=_a(e.type);return!!(n&&Yn({...e,type:n[1]}))}function jb(e,t,n={}){const{as:r="Array",checksumAddress:s=!1}=n,i=typeof t=="string"?fd(t):t,a=_m(i);if(dn(i)===0&&e.length>0)throw new Ub;if(dn(i)&&dn(i)<32)throw new Db({data:typeof t=="string"?t:We(t),parameters:e,size:dn(i)});let o=0;const c=r==="Array"?[]:{};for(let u=0;u<e.length;++u){const d=e[u];a.setPosition(o);const[l,p]=mn(a,d,{checksumAddress:s,staticPosition:0});o+=p,r==="Array"?c.push(l):c[d.name??u]=l}return c}function Ta(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new jd({expectedLength:e.length,givenLength:t.length});const s=Ob({checksumAddress:r,parameters:e,values:t}),i=Ia(s);return i.length===0?"0x":i}function gi(e,t){if(e.length!==t.length)throw new jd({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r];n.push(gi.encode(s,i))}return Ve(...n)}(function(e){function t(n,r,s=!1){if(n==="address"){const c=r;return cs(c),Vt(c.toLowerCase(),s?32:0)}if(n==="string")return Ea(r);if(n==="bytes")return r;if(n==="bool")return Vt(od(r),s?32:1);const i=n.match(Nd);if(i){const[c,u,d="256"]=i,l=Number.parseInt(d,10)/8;return ye(r,{size:s?32:l,signed:u==="int"})}const a=n.match(pb);if(a){const[c,u]=a;if(Number.parseInt(u,10)!==(r.length-2)/2)throw new Rd({expectedSize:Number.parseInt(u,10),value:r});return Wt(r,s?32:0)}const o=n.match(fb);if(o&&Array.isArray(r)){const[c,u]=o,d=[];for(let l=0;l<r.length;l++)d.push(t(u,r[l],!0));return d.length===0?"0x":Ve(...d)}throw new Oa(n)}e.encode=t})(gi||(gi={}));function Ld(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?$o(e):e}class Db extends G{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${un(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Ub extends G{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Fb extends G{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 Rd extends G{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Be(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class jd extends G{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
36
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class zb extends G{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class Oa extends G{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 Gb(e,t={}){return typeof e.chainId=="string"?Hb(e):{...e,...t.signature}}function Hb(e){const{address:t,chainId:n,nonce:r}=e,s=mb(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...s}}async function Jn(e,{address:t,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?C(n):void 0,i=await e.request({method:"eth_getCode",params:[t,s||r]},{dedupe:!!s});if(i!=="0x")return i}const Dd="0x6492649264926492649264926492649264926492649264926492649264926492";function qb(e){if(tt(e,-32)!==Dd)throw new Kb(e)}function Vb(e){const{data:t,signature:n,to:r}=e;return Ve(Ta(Ld("address, bytes, bytes"),[r,t,n]),Dd)}function Wb(e){try{return qb(e),!0}catch{return!1}}let Kb=class extends G{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 Zb="0x8010801080108010801080108010801080108010801080108010801080108010",Yb=Ld("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function Ud(e){if(typeof e=="string"){if(tt(e,-32)!==Zb)throw new Xb(e)}else $d(e.authorization)}function Jb(e){Ud(e);const t=ud(tt(e,-64,-32)),n=tt(e,-t-64,-64),r=tt(e,0,-t-64),[s,i,a]=jb(Yb,n);return{authorization:Gb({address:s.delegation,chainId:Number(s.chainId),nonce:s.nonce,yParity:s.yParity,r:s.r,s:s.s}),signature:r,...a&&a!=="0x"?{data:a,to:i}:{}}}function Qb(e){try{return Ud(e),!0}catch{return!1}}class Xb extends G{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 Lr=[{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"}],wi=[{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"}]}],Fd=[{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"}],zd=[...Fd,{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"}]}],ey=[...Fd,{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"}]}],ec=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],tc=[{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"}]}],Gd=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],nc=[{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"}],ty=[{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"}]}],Hd="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",ny="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",ry="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Ca="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033",Ds="/docs/contract/encodeDeployData";function Ba(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const s=t.find(a=>"type"in a&&a.type==="constructor");if(!s)throw new Pp({docsPath:Ds});if(!("inputs"in s))throw new _o({docsPath:Ds});if(!s.inputs||s.inputs.length===0)throw new _o({docsPath:Ds});const i=Ce(s.inputs,n);return yt([r,i])}const rc="/docs/contract/encodeFunctionData";function sy(e){const{abi:t,args:n,functionName:r}=e;let s=t[0];if(r){const i=Jt({abi:t,args:n,name:r});if(!i)throw new vn(r,{docsPath:rc});s=i}if(s.type!=="function")throw new vn(void 0,{docsPath:rc});return{abi:[s],functionName:sr(qe(s))}}function se(e){const{args:t}=e,{abi:n,functionName:r}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:sy(e),s=n[0],i=r,a="inputs"in s&&s.inputs?Ce(s.inputs,t??[]):void 0;return yt([i,a??"0x"])}function Cn(e,t){if(!me(e,{strict:!1}))throw new Ct({address:e});if(!me(t,{strict:!1}))throw new Ct({address:t});return e.toLowerCase()===t.toLowerCase()}function iy(e){const t=X(`0x${e.substring(4)}`).substring(26);return ru(`0x${t}`)}async function ay({hash:e,signature:t}){const n=Ie(e)?e:Oe(e),{secp256k1:r}=await su(async()=>{const{secp256k1:a}=await Promise.resolve().then(()=>lb);return{secp256k1:a}},void 0);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:d,v:l,yParity:p}=t,f=Number(p??l),m=sc(f);return new r.Signature(ie(u),ie(d)).addRecoveryBit(m)}const a=Ie(t)?t:Oe(t);if(te(a)!==65)throw new Error("invalid signature length");const o=Ae(`0x${a.slice(130)}`),c=sc(o);return r.Signature.fromCompact(a.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function sc(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 qd({hash:e,signature:t}){return iy(await ay({hash:e,signature:t}))}function oy(e){const{chainId:t,nonce:n,to:r}=e,s=e.contractAddress??e.address,i=X(yt(["0x05",Z0([t?C(t):"0x",s,n?C(n):"0x"])]));return r==="bytes"?je(i):i}async function Vd(e){const{authorization:t,signature:n}=e;return qd({hash:oy(t),signature:n??t})}async function cy({address:e,authorization:t,signature:n}){return Cn(Or(e),await Vd({authorization:t,signature:n}))}function j(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const s=e[n];return typeof s=="function"?s:i=>t(e,i)}function uy({r:e,s:t,to:n="hex",v:r,yParity:s}){const i=(()=>{if(s===0||s===1)return s;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),a=`0x${new Aa.Signature(ie(e),ie(t)).toCompactHex()}${i===0?"1b":"1c"}`;return n==="hex"?a:je(a)}function dy(e){return{address:e.address,amount:ye(e.amount),index:ye(e.index),validatorIndex:ye(e.validatorIndex)}}function Wd(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:ye(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:ye(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:ye(e.gasLimit)},...typeof e.number=="bigint"&&{number:ye(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:ye(e.prevRandao)},...typeof e.time=="bigint"&&{time:ye(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(dy)}}}const ly="0x82ad56cb",Us="/docs/contract/decodeFunctionResult";function Qt(e){const{abi:t,args:n,functionName:r,data:s}=e;let i=t[0];if(r){const o=Jt({abi:t,args:n,name:r});if(!o)throw new vn(r,{docsPath:Us});i=o}if(i.type!=="function")throw new vn(void 0,{docsPath:Us});if(!i.outputs)throw new Cu(i.name,{docsPath:Us});const a=Yt(i.outputs,s);if(a&&a.length>1)return a;if(a&&a.length===1)return a[0]}function ic(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new po({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new po({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function fy(e){const{balance:t,nonce:n,state:r,stateDiff:s,code:i}=e,a={};if(i!==void 0&&(a.code=i),t!==void 0&&(a.balance=C(t)),n!==void 0&&(a.nonce=C(n)),r!==void 0&&(a.state=ic(r)),s!==void 0){if(a.state)throw new Wh;a.stateDiff=ic(s)}return a}function ds(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!me(n,{strict:!1}))throw new Ct({address:n});if(t[n])throw new Vh({address:n});t[n]=fy(r)}return t}async function ls(e,t){const{account:n=e.account,authorizationList:r,batch:s=!!e.batch?.multicall,blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",accessList:o,blobs:c,blockOverrides:u,code:d,data:l,factory:p,factoryData:f,gas:m,gasPrice:h,maxFeePerBlobGas:y,maxFeePerGas:w,maxPriorityFeePerGas:A,nonce:g,to:b,value:x,stateOverride:E,...P}=t,O=n?de(n):void 0;if(d&&(p||f))throw new k("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(d&&b)throw new k("Cannot provide both `code` & `to` as parameters.");const M=d&&l,_=p&&f&&b&&l,$=M||_,v=M?Kd({code:d,data:l}):_?my({data:l,factory:p,factoryData:f,to:b}):l;try{Tn(t);const U=(typeof i=="bigint"?C(i):void 0)||a,S=u?Wd(u):void 0,T=ds(E),L=e.chain?.formatters?.transactionRequest?.format,D=(L||nr)({...ss(P,{format:L}),accessList:o,account:O,authorizationList:r,blobs:c,data:v,gas:m,gasPrice:h,maxFeePerBlobGas:y,maxFeePerGas:w,maxPriorityFeePerGas:A,nonce:g,to:$?void 0:b,value:x},"call");if(s&&py({request:D})&&!T&&!S)try{return await hy(e,{...D,blockNumber:i,blockTag:a})}catch(J){if(!(J instanceof Au)&&!(J instanceof ri))throw J}const F=(()=>{const J=[D,U];return T&&S?[...J,T,S]:T?[...J,T]:S?[...J,{},S]:J})(),K=await e.request({method:"eth_call",params:F});return K==="0x"?{data:void 0}:{data:K}}catch(I){const U=by(I),{offchainLookup:S,offchainLookupSignature:T}=await su(async()=>{const{offchainLookup:L,offchainLookupSignature:N}=await import("./ccip-Z16c_UnO.js");return{offchainLookup:L,offchainLookupSignature:N}},__vite__mapDeps([0,1,2,3,4]));if(e.ccipRead!==!1&&U?.slice(0,10)===T&&b)return{data:await S(e,{data:U,to:b})};throw $&&U?.slice(0,10)==="0x101bb98d"?new Zh({factory:p}):Qu(I,{...t,account:O,chain:e.chain})}}function py({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(ly)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function hy(e,t){const{batchSize:n=1024,deployless:r=!1,wait:s=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",data:o,to:c}=t,u=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return In({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Au})(),l=(typeof i=="bigint"?C(i):void 0)||a,{schedule:p}=T0({id:`${e.uid}.${l}`,wait:s,shouldSplitBatch(h){return h.reduce((w,{data:A})=>w+(A.length-2),0)>n*2},fn:async h=>{const y=h.map(g=>({allowFailure:!0,callData:g.data,target:g.to})),w=se({abi:Lr,args:[y],functionName:"aggregate3"}),A=await e.request({method:"eth_call",params:[{...u===null?{data:Kd({code:Ca,data:w})}:{to:u,data:w}},l]});return Qt({abi:Lr,args:[y],functionName:"aggregate3",data:A||"0x"})}}),[{returnData:f,success:m}]=await p({data:o,to:c});if(!m)throw new ns({data:f});return f==="0x"?{data:void 0}:{data:f}}function Kd(e){const{code:t,data:n}=e;return Ba({abi:pa(["constructor(bytes, bytes)"]),bytecode:Hd,args:[t,n]})}function my(e){const{data:t,factory:n,factoryData:r,to:s}=e;return Ba({abi:pa(["constructor(address, bytes, address, bytes)"]),bytecode:ny,args:[s,t,n,r]})}function by(e){if(!(e instanceof k))return;const t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}const yy=3;function xn(e,{abi:t,address:n,args:r,docsPath:s,functionName:i,sender:a}){const o=e instanceof ns?e:e instanceof k?e.walk(m=>"data"in m)||e.walk():{},{code:c,data:u,details:d,message:l,shortMessage:p}=o,f=e instanceof rr?new Ju({functionName:i}):[yy,O0.code].includes(c)&&(u||d||l||p)||c===sa.code&&d==="execution reverted"&&u?new Nr({abi:t,data:typeof u=="object"?u.data:u,functionName:i,message:o instanceof C0?d:p??l}):e;return new ga(f,{abi:t,args:r,contractAddress:n,docsPath:s,functionName:i,sender:a})}async function Pe(e,t){const{abi:n,address:r,args:s,functionName:i,...a}=t,o=se({abi:n,args:s,functionName:i});try{const{data:c}=await j(e,ls,"call")({...a,data:o,to:r});return Qt({abi:n,args:s,functionName:i,data:c||"0x"})}catch(c){throw xn(c,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:i})}}async function fs(e,t){const{address:n,chain:r=e.chain,hash:s,erc6492VerifierAddress:i=t.universalSignatureVerifierAddress??r?.contracts?.erc6492Verifier?.address,multicallAddress:a=t.multicallAddress??r?.contracts?.multicall3?.address}=t;if(r?.verifyHash)return await r.verifyHash(e,t);const o=(()=>{const c=t.signature;return Ie(c)?c:typeof c=="object"&&"r"in c&&"s"in c?uy(c):ue(c)})();try{return Qb(o)?await gy(e,{...t,multicallAddress:a,signature:o}):await wy(e,{...t,verifierAddress:i,signature:o})}catch(c){try{if(Cn(Or(n),await qd({hash:s,signature:o})))return!0}catch{}if(c instanceof Kt)return!1;throw c}}async function gy(e,t){const{address:n,blockNumber:r,blockTag:s,hash:i,multicallAddress:a}=t,{authorization:o,data:c,signature:u,to:d}=Jb(t.signature);if(await Jn(e,{address:n,blockNumber:r,blockTag:s})===yt(["0xef0100",o.address]))return await vy(e,{address:n,blockNumber:r,blockTag:s,hash:i,signature:u});const p={address:o.address,chainId:Number(o.chainId),nonce:Number(o.nonce),r:C(o.r,{size:32}),s:C(o.s,{size:32}),yParity:o.yParity};if(!await cy({address:n,authorization:p}))throw new Kt;const m=await j(e,Pe,"readContract")({...a?{address:a}:{code:Ca},authorizationList:[p],abi:Lr,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:d??n,callData:c}]:[],{allowFailure:!0,target:n,callData:se({abi:Gd,functionName:"isValidSignature",args:[i,u]})}]]});if(m[m.length-1]?.returnData?.startsWith("0x1626ba7e"))return!0;throw new Kt}async function wy(e,t){const{address:n,factory:r,factoryData:s,hash:i,signature:a,verifierAddress:o,...c}=t,u=await(async()=>!r&&!s||Wb(a)?a:Vb({data:s,signature:a,to:r}))(),d=o?{to:o,data:se({abi:nc,functionName:"isValidSig",args:[n,i,u]}),...c}:{data:Ba({abi:nc,args:[n,i,u],bytecode:ry}),...c},{data:l}=await j(e,ls,"call")(d).catch(p=>{throw p instanceof Yu?new Kt:p});if(B0(l??"0x0"))return!0;throw new Kt}async function vy(e,t){const{address:n,blockNumber:r,blockTag:s,hash:i,signature:a}=t;if((await j(e,Pe,"readContract")({address:n,abi:Gd,args:[i,a],blockNumber:r,blockTag:s,functionName:"isValidSignature"}).catch(c=>{throw c instanceof ga?new Kt:c})).startsWith("0x1626ba7e"))return!0;throw new Kt}class Kt extends Error{}function Na(e){if(!(e instanceof k))return!1;const t=e.walk(n=>n instanceof Nr);return t instanceof Nr?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 $a(e){const{abi:t,data:n}=e,r=qt(n,0,4),s=t.find(i=>i.type==="function"&&r===sr(qe(i)));if(!s)throw new Op(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Yt(s.inputs,qt(n,4)):void 0}}const Fs="/docs/contract/encodeErrorResult";function ac(e){const{abi:t,errorName:n,args:r}=e;let s=t[0];if(n){const c=Jt({abi:t,args:r,name:n});if(!c)throw new To(n,{docsPath:Fs});s=c}if(s.type!=="error")throw new To(void 0,{docsPath:Fs});const i=qe(s),a=sr(i);let o="0x";if(r&&r.length>0){if(!s.inputs)throw new Ip(s.name,{docsPath:Fs});o=Ce(s.inputs,r)}return yt([a,o])}const zs="/docs/contract/encodeFunctionResult";function xy(e){const{abi:t,functionName:n,result:r}=e;let s=t[0];if(n){const a=Jt({abi:t,name:n});if(!a)throw new vn(n,{docsPath:zs});s=a}if(s.type!=="function")throw new vn(void 0,{docsPath:zs});if(!s.outputs)throw new Cu(s.name,{docsPath:zs});const i=(()=>{if(s.outputs.length===0)return[];if(s.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Nu(r)})();return Ce(s.outputs,i)}const ps="x-batch-gateway:true";async function Ey(e){const{data:t,ccipRequest:n}=e,{args:[r]}=$a({abi:wi,data:t}),s=[],i=[];return await Promise.all(r.map(async(a,o)=>{try{i[o]=a.urls.includes(ps)?await Ey({data:a.data,ccipRequest:n}):await n(a),s[o]=!1}catch(c){s[o]=!0,i[o]=Ay(c)}})),xy({abi:wi,functionName:"query",result:[s,i]})}function Ay(e){return e.name==="HttpRequestError"&&e.status?ac({abi:wi,errorName:"HttpError",args:[e.status,e.shortMessage]}):ac({abi:[Iu],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Zd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Ie(t)?t:null}function vi(e){let t=new Uint8Array(32).fill(0);if(!e)return ue(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const s=Zd(n[r]),i=s?er(s):X(zt(n[r]),"bytes");t=X(he([t,i]),"bytes")}return ue(t)}function Py(e){return`[${e.slice(2)}]`}function ky(e){const t=new Uint8Array(32).fill(0);return e?Zd(e)||X(zt(e)):ue(t)}function Ma(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(zt(t).byteLength+2);let r=0;const s=t.split(".");for(let i=0;i<s.length;i++){let a=zt(s[i]);a.byteLength>255&&(a=zt(Py(ky(s[i])))),n[r]=a.length,n.set(a,r+1),r+=a.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function Sy(e,t){const{blockNumber:n,blockTag:r,coinType:s,name:i,gatewayUrls:a,strict:o}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return In({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),d=c?.ensTlds;if(d&&!d.some(p=>i.endsWith(p)))return null;const l=s!=null?[vi(i),BigInt(s)]:[vi(i)];try{const p=se({abi:tc,functionName:"addr",args:l}),f={address:u,abi:zd,functionName:"resolveWithGateways",args:[Oe(Ma(i)),p,a??[ps]],blockNumber:n,blockTag:r},h=await j(e,Pe,"readContract")(f);if(h[0]==="0x")return null;const y=Qt({abi:tc,args:l,functionName:"addr",data:h[0]});return y==="0x"||Ht(y)==="0x00"?null:y}catch(p){if(o)throw p;if(Na(p))return null;throw p}}class Iy extends k{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 Ln extends k{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class La extends k{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 _y extends k{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const Ty=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Oy=/^(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>\/.*)?$/,Cy=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,By=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Ny(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 oc(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Yd({uri:e,gatewayUrls:t}){const n=Cy.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=oc(t?.ipfs,"https://ipfs.io"),s=oc(t?.arweave,"https://arweave.net"),i=e.match(Ty),{protocol:a,subpath:o,target:c,subtarget:u=""}=i?.groups||{},d=a==="ipns:/"||o==="ipns/",l=a==="ipfs:/"||o==="ipfs/"||Oy.test(e);if(e.startsWith("http")&&!d&&!l){let f=e;return t?.arweave&&(f=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:f,isOnChain:!1,isEncoded:!1}}if((d||l)&&c)return{uri:`${r}/${d?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&c)return{uri:`${s}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(By,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new La({uri:e})}function Jd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Iy({data:e});return e.image||e.image_url||e.image_data}async function $y({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(s=>s.json());return await Ra({gatewayUrls:e,uri:Jd(n)})}catch{throw new La({uri:t})}}async function Ra({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Yd({uri:t,gatewayUrls:e});if(r||await Ny(n))return n;throw new La({uri:t})}function My(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=t.split("/"),[i,a]=n.split(":"),[o,c]=r.split(":");if(!i||i.toLowerCase()!=="eip155")throw new Ln({reason:"Only EIP-155 supported"});if(!a)throw new Ln({reason:"Chain ID not found"});if(!c)throw new Ln({reason:"Contract address not found"});if(!s)throw new Ln({reason:"Token ID not found"});if(!o)throw new Ln({reason:"ERC namespace not found"});return{chainID:Number.parseInt(a,10),namespace:o.toLowerCase(),contractAddress:c,tokenID:s}}async function Ly(e,{nft:t}){if(t.namespace==="erc721")return Pe(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 Pe(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 _y({namespace:t.namespace})}async function Ry(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?jy(e,{gatewayUrls:t,record:n}):Ra({uri:n,gatewayUrls:t})}async function jy(e,{gatewayUrls:t,record:n}){const r=My(n),s=await Ly(e,{nft:r}),{uri:i,isOnChain:a,isEncoded:o}=Yd({uri:s,gatewayUrls:t});if(a&&(i.includes("data:application/json;base64,")||i.startsWith("{"))){const u=o?atob(i.replace("data:application/json;base64,","")):i,d=JSON.parse(u);return Ra({uri:Jd(d),gatewayUrls:t})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),$y({gatewayUrls:t,uri:i.replace(/(?:0x)?{id}/,c)})}async function Qd(e,t){const{blockNumber:n,blockTag:r,key:s,name:i,gatewayUrls:a,strict:o}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return In({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),d=c?.ensTlds;if(d&&!d.some(l=>i.endsWith(l)))return null;try{const l={address:u,abi:zd,args:[Oe(Ma(i)),se({abi:ec,functionName:"text",args:[vi(i),s]}),a??[ps]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},f=await j(e,Pe,"readContract")(l);if(f[0]==="0x")return null;const m=Qt({abi:ec,functionName:"text",data:f[0]});return m===""?null:m}catch(l){if(o)throw l;if(Na(l))return null;throw l}}async function Dy(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:i,strict:a,universalResolverAddress:o}){const c=await j(e,Qd,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:s,universalResolverAddress:o,gatewayUrls:i,strict:a});if(!c)return null;try{return await Ry(e,{record:c,gatewayUrls:r})}catch{return null}}async function Uy(e,t){const{address:n,blockNumber:r,blockTag:s,coinType:i=60n,gatewayUrls:a,strict:o}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return In({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const d={address:u,abi:ey,args:[n,i,a??[ps]],functionName:"reverseWithGateways",blockNumber:r,blockTag:s},l=j(e,Pe,"readContract"),[p]=await l(d);return p||null}catch(d){if(o)throw d;if(Na(d))return null;throw d}}async function Fy(e,t){const{blockNumber:n,blockTag:r,name:s}=t,{chain:i}=e,a=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!i)throw new Error("client chain not configured. universalResolverAddress is required.");return In({blockNumber:n,chain:i,contract:"ensUniversalResolver"})})(),o=i?.ensTlds;if(o&&!o.some(u=>s.endsWith(u)))throw new Error(`${s} is not a valid ENS TLD (${o?.join(", ")}) for chain "${i.name}" (id: ${i.id}).`);const[c]=await j(e,Pe,"readContract")({address:a,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Oe(Ma(s))],blockNumber:n,blockTag:r});return c}async function Xd(e,t){const{account:n=e.account,blockNumber:r,blockTag:s="latest",blobs:i,data:a,gas:o,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:d,maxPriorityFeePerGas:l,to:p,value:f,...m}=t,h=n?de(n):void 0;try{Tn(t);const w=(typeof r=="bigint"?C(r):void 0)||s,A=e.chain?.formatters?.transactionRequest?.format,b=(A||nr)({...ss(m,{format:A}),account:h,blobs:i,data:a,gas:o,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:d,maxPriorityFeePerGas:l,to:p,value:f},"createAccessList"),x=await e.request({method:"eth_createAccessList",params:[b,w]});return{accessList:x.accessList,gasUsed:BigInt(x.gasUsed)}}catch(y){throw Qu(y,{...t,account:h,chain:e.chain})}}function hs(e,{method:t}){const n={};return e.transport.type==="fallback"&&e.transport.onResponse?.(({method:r,response:s,status:i,transport:a})=>{i==="success"&&t===r&&(n[s]=a.request)}),r=>n[r]||e.request}async function zy(e){const t=hs(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}class Gy extends k{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}const cc="/docs/contract/encodeEventTopics";function cr(e){const{abi:t,eventName:n,args:r}=e;let s=t[0];if(n){const c=Jt({abi:t,name:n});if(!c)throw new Oo(n,{docsPath:cc});s=c}if(s.type!=="event")throw new Oo(void 0,{docsPath:cc});const i=qe(s),a=ts(i);let o=[];if(r&&"inputs"in s){const c=s.inputs?.filter(d=>"indexed"in d&&d.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?c?.map(d=>r[d.name])??[]:[];u.length>0&&(o=c?.map((d,l)=>Array.isArray(u[l])?u[l].map((p,f)=>uc({param:d,value:u[l][f]})):typeof u[l]<"u"&&u[l]!==null?uc({param:d,value:u[l]}):null)??[])}return[a,...o]}function uc({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return X(er(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Gy(e.type);return Ce([e],[t])}async function el(e,t){const{address:n,abi:r,args:s,eventName:i,fromBlock:a,strict:o,toBlock:c}=t,u=hs(e,{method:"eth_newFilter"}),d=i?cr({abi:r,args:s,eventName:i}):void 0,l=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof a=="bigint"?C(a):a,toBlock:typeof c=="bigint"?C(c):c,topics:d}]});return{abi:r,args:s,eventName:i,id:l,request:u(l),strict:!!o,type:"event"}}async function tl(e,{address:t,args:n,event:r,events:s,fromBlock:i,strict:a,toBlock:o}={}){const c=s??(r?[r]:void 0),u=hs(e,{method:"eth_newFilter"});let d=[];c&&(d=[c.flatMap(f=>cr({abi:[f],eventName:f.name,args:n}))],r&&(d=d[0]));const l=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof i=="bigint"?C(i):i,toBlock:typeof o=="bigint"?C(o):o,...d.length?{topics:d}:{}}]});return{abi:c,args:n,eventName:r?r.name:void 0,fromBlock:i,id:l,request:u(l),strict:!!a,toBlock:o,type:"event"}}async function nl(e){const t=hs(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}class Hy extends k{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:a,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:l,value:p}){const f=Sn({from:n?.address,to:l,value:typeof p<"u"&&`${ca(p)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${Re(o)} gwei`,maxFeePerGas:typeof c<"u"&&`${Re(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Re(u)} gwei`,nonce:d});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",f].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}function qy(e,{docsPath:t,...n}){const r=(()=>{const s=rs(e,n);return s instanceof tr?e:s})();return new Hy(r,{docsPath:t,...n})}class rl extends k{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class ja extends k{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Vy extends k{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Re(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class sl extends k{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 Ge(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:s}={}){const i=s??!1,a=n!==void 0?C(n):void 0;let o=null;if(t?o=await e.request({method:"eth_getBlockByHash",params:[t,i]},{dedupe:!0}):o=await e.request({method:"eth_getBlockByNumber",params:[a||r,i]},{dedupe:!!a}),!o)throw new sl({blockHash:t,blockNumber:n});return(e.chain?.formatters?.block?.format||uu)(o,"getBlock")}async function Da(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Wy(e,t){return il(e,t)}async function il(e,t){const{block:n,chain:r=e.chain,request:s}=t||{};try{const i=r?.fees?.maxPriorityFeePerGas??r?.fees?.defaultPriorityFee;if(typeof i=="function"){const o=n||await j(e,Ge,"getBlock")({}),c=await i({block:o,client:e,request:s});if(c===null)throw new Error;return c}if(typeof i<"u")return i;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return ie(a)}catch{const[i,a]=await Promise.all([n?Promise.resolve(n):j(e,Ge,"getBlock")({}),j(e,Da,"getGasPrice")({})]);if(typeof i.baseFeePerGas!="bigint")throw new ja;const o=a-i.baseFeePerGas;return o<0n?0n:o}}async function al(e,t){return xi(e,t)}async function xi(e,t){const{block:n,chain:r=e.chain,request:s,type:i="eip1559"}=t||{},a=await(async()=>typeof r?.fees?.baseFeeMultiplier=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:s}):r?.fees?.baseFeeMultiplier??1.2)();if(a<1)throw new rl;const c=10**(a.toString().split(".")[1]?.length??0),u=p=>p*BigInt(Math.ceil(a*c))/BigInt(c),d=n||await j(e,Ge,"getBlock")({});if(typeof r?.fees?.estimateFeesPerGas=="function"){const p=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:s,type:i});if(p!==null)return p}if(i==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new ja;const p=typeof s?.maxPriorityFeePerGas=="bigint"?s.maxPriorityFeePerGas:await il(e,{block:d,chain:r,request:s}),f=u(d.baseFeePerGas);return{maxFeePerGas:s?.maxFeePerGas??f+p,maxPriorityFeePerGas:p}}return{gasPrice:s?.gasPrice??u(await j(e,Da,"getGasPrice")({}))}}async function Ua(e,{address:t,blockTag:n="latest",blockNumber:r}){const s=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?C(r):n]},{dedupe:!!r});return Ae(s)}function Ky(e,{docsPath:t,...n}){const r=(()=>{const s=rs(e,n);return s instanceof tr?e:s})();return new X0(r,{docsPath:t,...n})}async function Bn(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Ae(t)}async function ol(e,t){const{account:n=e.account,accessList:r,authorizationList:s,chain:i=e.chain,blobVersionedHashes:a,blobs:o,data:c,gas:u,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:m,nonceManager:h,to:y,type:w,value:A,...g}=t,b=await(async()=>{if(!n||!h||typeof m<"u")return m;const O=de(n),M=i?i.id:await j(e,Bn,"getChainId")({});return await h.consume({address:O.address,chainId:M,client:e})})();Tn(t);const x=i?.formatters?.transactionRequest?.format,P=(x||nr)({...ss(g,{format:x}),account:n?de(n):void 0,accessList:r,authorizationList:s,blobs:o,blobVersionedHashes:a,data:c,gas:u,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:b,to:y,type:w,value:A},"fillTransaction");try{const O=await e.request({method:"eth_fillTransaction",params:[P]}),_=(i?.formatters?.transaction?.format||ia)(O.tx);delete _.blockHash,delete _.blockNumber,delete _.r,delete _.s,delete _.transactionIndex,delete _.v,delete _.yParity,_.data=_.input,_.gas&&(_.gas=t.gas??_.gas),_.gasPrice&&(_.gasPrice=t.gasPrice??_.gasPrice),_.maxFeePerBlobGas&&(_.maxFeePerBlobGas=t.maxFeePerBlobGas??_.maxFeePerBlobGas),_.maxFeePerGas&&(_.maxFeePerGas=t.maxFeePerGas??_.maxFeePerGas),_.maxPriorityFeePerGas&&(_.maxPriorityFeePerGas=t.maxPriorityFeePerGas??_.maxPriorityFeePerGas),_.nonce&&(_.nonce=t.nonce??_.nonce);const $=await(async()=>{if(typeof i?.fees?.baseFeeMultiplier=="function"){const S=await j(e,Ge,"getBlock")({});return i.fees.baseFeeMultiplier({block:S,client:e,request:t})}return i?.fees?.baseFeeMultiplier??1.2})();if($<1)throw new rl;const I=10**($.toString().split(".")[1]?.length??0),U=S=>S*BigInt(Math.ceil($*I))/BigInt(I);return _.maxFeePerGas&&!t.maxFeePerGas&&(_.maxFeePerGas=U(_.maxFeePerGas)),_.gasPrice&&!t.gasPrice&&(_.gasPrice=U(_.gasPrice)),{raw:O.raw,transaction:{from:P.from,..._}}}catch(O){throw Ky(O,{...t,chain:e.chain})}}const Zy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],dc=new Map,Gs=new iu(128);async function cl(e,t){let n=t;n.account??=e.account,n.parameters??=Zy;const{account:r,chain:s=e.chain,nonceManager:i,parameters:a}=n,o=(()=>{if(typeof s?.prepareTransactionRequest=="function")return{fn:s.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(s?.prepareTransactionRequest))return{fn:s.prepareTransactionRequest[0],runAt:s.prepareTransactionRequest[1].runAt}})();let c;async function u(){return c||(typeof n.chainId<"u"?n.chainId:s?s.id:(c=await j(e,Bn,"getChainId")({}),c))}const d=r&&de(r);let l=n.nonce;if(a.includes("nonce")&&typeof l>"u"&&d&&i){const b=await u();l=await i.consume({address:d.address,chainId:b,client:e})}o?.fn&&o.runAt?.includes("beforeFillTransaction")&&(n=await o.fn({...n,chain:s},{phase:"beforeFillTransaction"}),l??=n.nonce);const f=((a.includes("blobVersionedHashes")||a.includes("sidecars"))&&n.kzg&&n.blobs||Gs.get(e.uid)===!1||!["fees","gas"].some(x=>a.includes(x))?!1:!!(a.includes("chainId")&&typeof n.chainId!="number"||a.includes("nonce")&&typeof l!="number"||a.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||a.includes("gas")&&typeof n.gas!="bigint"))?await j(e,ol,"fillTransaction")({...n,nonce:l}).then(b=>{const{chainId:x,from:E,gas:P,gasPrice:O,nonce:M,maxFeePerBlobGas:_,maxFeePerGas:$,maxPriorityFeePerGas:v,type:I,...U}=b.transaction;return Gs.set(e.uid,!0),{...n,...E?{from:E}:{},...I?{type:I}:{},...typeof x<"u"?{chainId:x}:{},...typeof P<"u"?{gas:P}:{},...typeof O<"u"?{gasPrice:O}:{},...typeof M<"u"?{nonce:M}:{},...typeof _<"u"?{maxFeePerBlobGas:_}:{},...typeof $<"u"?{maxFeePerGas:$}:{},...typeof v<"u"?{maxPriorityFeePerGas:v}:{},..."nonceKey"in U&&typeof U.nonceKey<"u"?{nonceKey:U.nonceKey}:{}}}).catch(b=>{const x=b;return x.name!=="TransactionExecutionError"||x.walk?.(P=>{const O=P;return O.name==="MethodNotFoundRpcError"||O.name==="MethodNotSupportedRpcError"})&&Gs.set(e.uid,!1),n}):n;l??=f.nonce,n={...f,...d?{from:d?.address}:{},...l?{nonce:l}:{}};const{blobs:m,gas:h,kzg:y,type:w}=n;o?.fn&&o.runAt?.includes("beforeFillParameters")&&(n=await o.fn({...n,chain:s},{phase:"beforeFillParameters"}));let A;async function g(){return A||(A=await j(e,Ge,"getBlock")({blockTag:"latest"}),A)}if(a.includes("nonce")&&typeof l>"u"&&d&&!i&&(n.nonce=await j(e,Ua,"getTransactionCount")({address:d.address,blockTag:"pending"})),(a.includes("blobVersionedHashes")||a.includes("sidecars"))&&m&&y){const b=bu({blobs:m,kzg:y});if(a.includes("blobVersionedHashes")){const x=mp({commitments:b,to:"hex"});n.blobVersionedHashes=x}if(a.includes("sidecars")){const x=yu({blobs:m,commitments:b,kzg:y}),E=wp({blobs:m,commitments:b,proofs:x,to:"hex"});n.sidecars=E}}if(a.includes("chainId")&&(n.chainId=await u()),(a.includes("fees")||a.includes("type"))&&typeof w>"u")try{n.type=vp(n)}catch{let b=dc.get(e.uid);typeof b>"u"&&(b=typeof(await g())?.baseFeePerGas=="bigint",dc.set(e.uid,b)),n.type=b?"eip1559":"legacy"}if(a.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const b=await g(),{maxFeePerGas:x,maxPriorityFeePerGas:E}=await xi(e,{block:b,chain:s,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<E)throw new Vy({maxPriorityFeePerGas:E});n.maxPriorityFeePerGas=E,n.maxFeePerGas=x}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new ja;if(typeof n.gasPrice>"u"){const b=await g(),{gasPrice:x}=await xi(e,{block:b,chain:s,request:n,type:"legacy"});n.gasPrice=x}}return a.includes("gas")&&typeof h>"u"&&(n.gas=await j(e,Fa,"estimateGas")({...n,account:d,prepare:d?.type==="local"?[]:["blobVersionedHashes"]})),o?.fn&&o.runAt?.includes("afterFillParameters")&&(n=await o.fn({...n,chain:s},{phase:"afterFillParameters"})),Tn(n),delete n.parameters,n}async function Fa(e,t){const{account:n=e.account,prepare:r=!0}=t,s=n?de(n):void 0,i=(()=>{if(Array.isArray(r))return r;if(s?.type!=="local")return["blobVersionedHashes"]})();try{const a=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await Vd({authorization:t.authorizationList[0]}).catch(()=>{throw new k("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:o,authorizationList:c,blobs:u,blobVersionedHashes:d,blockNumber:l,blockTag:p,data:f,gas:m,gasPrice:h,maxFeePerBlobGas:y,maxFeePerGas:w,maxPriorityFeePerGas:A,nonce:g,value:b,stateOverride:x,...E}=r?await cl(e,{...t,parameters:i,to:a}):t;if(m&&t.gas!==m)return m;const O=(typeof l=="bigint"?C(l):void 0)||p,M=ds(x);Tn(t);const _=e.chain?.formatters?.transactionRequest?.format,v=(_||nr)({...ss(E,{format:_}),account:s,accessList:o,authorizationList:c,blobs:u,blobVersionedHashes:d,data:f,gasPrice:h,maxFeePerBlobGas:y,maxFeePerGas:w,maxPriorityFeePerGas:A,nonce:g,to:a,value:b},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:M?[v,O??e.experimental_blockTag??"latest",M]:O?[v,O]:[v]}))}catch(a){throw qy(a,{...t,account:s,chain:e.chain})}}async function Yy(e,t){const{abi:n,address:r,args:s,functionName:i,dataSuffix:a,...o}=t,c=se({abi:n,args:s,functionName:i});try{return await j(e,Fa,"estimateGas")({data:`${c}${a?a.replace("0x",""):""}`,to:r,...o})}catch(u){const d=o.account?de(o.account):void 0;throw xn(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:d?.address})}}async function Jy(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const s=typeof n=="bigint"?C(n):void 0,i=await e.request({method:"eth_getBalance",params:[t,s||r]});return BigInt(i)}async function Qy(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}const Xy=new Map,eg=new Map;function tg(e){const t=(s,i)=>({clear:()=>i.delete(s),get:()=>i.get(s),set:a=>i.set(s,a)}),n=t(e,Xy),r=t(e,eg);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function ng(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=tg(t),s=r.response.get();if(s&&n>0&&Date.now()-s.created.getTime()<n)return s.data;let i=r.promise.get();i||(i=e(),r.promise.set(i));try{const a=await i;return r.response.set({created:new Date,data:a}),a}finally{r.promise.clear()}}const rg=e=>`blockNumber.${e}`;async function ur(e,{cacheTime:t=e.cacheTime}={}){const n=await ng(()=>e.request({method:"eth_blockNumber"}),{cacheKey:rg(e.uid),cacheTime:t});return BigInt(n)}async function sg(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?C(n):void 0;let i;return t?i=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):i=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[s||r]},{dedupe:!!s}),Ae(i)}const lc="/docs/contract/decodeEventLog";function Rr(e){const{abi:t,data:n,strict:r,topics:s}=e,i=r??!0,[a,...o]=s;if(!a)throw new _p({docsPath:lc});const c=t.find(h=>h.type==="event"&&a===ts(qe(h)));if(!(c&&"name"in c)||c.type!=="event")throw new Tp(a,{docsPath:lc});const{name:u,inputs:d}=c,l=d?.some(h=>!("name"in h&&h.name)),p=l?[]:{},f=d.map((h,y)=>[h,y]).filter(([h])=>"indexed"in h&&h.indexed);for(let h=0;h<f.length;h++){const[y,w]=f[h],A=o[h];if(!A)throw new la({abiItem:c,param:y});p[l?w:y.name||w]=ig({param:y,value:A})}const m=d.filter(h=>!("indexed"in h&&h.indexed));if(m.length>0){if(n&&n!=="0x")try{const h=Yt(m,n);if(h)if(l)for(let y=0;y<d.length;y++)p[y]=p[y]??h.shift();else for(let y=0;y<m.length;y++)p[m[y].name]=h[y]}catch(h){if(i)throw h instanceof _u||h instanceof lu?new Cr({abiItem:c,data:n,params:m,size:te(n)}):h}else if(i)throw new Cr({abiItem:c,data:"0x",params:m,size:0})}return{eventName:u,args:Object.values(p).length>0?p:void 0}}function ig({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Yt([e],t)||[])[0]}function za(e){const{abi:t,args:n,logs:r,strict:s=!0}=e,i=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(a=>{const o=t.filter(d=>d.type==="event"&&a.topics[0]===ts(d));if(o.length===0)return null;let c,u;for(const d of o)try{c=Rr({...a,abi:[d],strict:!0}),u=d;break}catch{}if(!c&&!s){u=o[0];try{c=Rr({...a,abi:[u],strict:!1})}catch{const d=u.inputs?.some(l=>!("name"in l&&l.name));return{...a,args:d?[]:{},eventName:u.name}}}return!c||!u||i&&!i.includes(c.eventName)||!ag({args:c.args,inputs:u.inputs,matchArgs:n})?null:{...c,...a}}).filter(Boolean)}function ag(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function s(i,a,o){try{return i.type==="address"?Cn(a,o):i.type==="string"||i.type==="bytes"?X(er(a))===o:a===o}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((i,a)=>{if(i==null)return!0;const o=n[a];return o?(Array.isArray(i)?i:[i]).some(u=>s(o,u,t[a])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([i,a])=>{if(a==null)return!0;const o=n.find(u=>u.name===i);return o?(Array.isArray(a)?a:[a]).some(u=>s(o,u,t[i])):!1}):!1}async function Ga(e,{address:t,blockHash:n,fromBlock:r,toBlock:s,event:i,events:a,args:o,strict:c}={}){const u=c??!1,d=a??(i?[i]:void 0);let l=[];d&&(l=[d.flatMap(h=>cr({abi:[h],eventName:h.name,args:a?void 0:o}))],i&&(l=l[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:l,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:l,fromBlock:typeof r=="bigint"?C(r):r,toBlock:typeof s=="bigint"?C(s):s}]});const f=p.map(m=>nt(m));return d?za({abi:d,args:o,logs:f,strict:u}):f}async function ul(e,t){const{abi:n,address:r,args:s,blockHash:i,eventName:a,fromBlock:o,toBlock:c,strict:u}=t,d=a?Jt({abi:n,name:a}):void 0,l=d?void 0:n.filter(p=>p.type==="event");return j(e,Ga,"getLogs")({address:r,args:s,blockHash:i,event:d,events:l,fromBlock:o,toBlock:c,strict:u})}class og extends k{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 cg(e,t){const{address:n,factory:r,factoryData:s}=t;try{const[i,a,o,c,u,d,l]=await j(e,Pe,"readContract")({abi:ug,address:n,functionName:"eip712Domain",factory:r,factoryData:s});return{domain:{name:a,version:o,chainId:Number(c),verifyingContract:u,salt:d},extensions:l,fields:i}}catch(i){const a=i;throw a.name==="ContractFunctionExecutionError"&&a.cause.name==="ContractFunctionZeroDataError"?new og({address:n}):a}}const ug=[{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 dg(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 lg(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const i=typeof n=="bigint"?C(n):void 0,a=await e.request({method:"eth_feeHistory",params:[C(t),i||r,s]},{dedupe:!!i});return dg(a)}async function ms(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 s=r.map(i=>nt(i));return!("abi"in t)||!t.abi?s:za({abi:t.abi,logs:s,strict:n})}async function fg(e,{filter:t}){const n=t.strict??!1,s=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(i=>nt(i));return t.abi?za({abi:t.abi,logs:s,strict:n}):s}function pg(e,t){if(e.length!==t.length)throw new Tu({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r];n.push(dl(s,i))}return yt(n)}function dl(e,t,n=!1){if(e==="address"){const a=t;if(!me(a))throw new Ct({address:a});return ve(a.toLowerCase(),{size:n?32:null})}if(e==="string")return Vn(t);if(e==="bytes")return t;if(e==="bool")return ve(nu(t),{size:n?32:1});const r=e.match(ha);if(r){const[a,o,c="256"]=r,u=Number.parseInt(c,10)/8;return C(t,{size:n?32:u,signed:o==="int"})}const s=e.match(Vu);if(s){const[a,o]=s;if(Number.parseInt(o,10)!==(t.length-2)/2)throw new Bu({expectedSize:Number.parseInt(o,10),givenSize:(t.length-2)/2});return ve(t,{dir:"right",size:n?32:null})}const i=e.match(Oh);if(i&&Array.isArray(t)){const[a,o]=i,c=[];for(let u=0;u<t.length;u++)c.push(dl(o,t[u],!0));return c.length===0?"0x":yt(c)}throw new Mp(e)}function hg(e){const{source:t}=e,n=new Map,r=new iu(8192),s=new Map,i=({address:a,chainId:o})=>`${a}.${o}`;return{async consume({address:a,chainId:o,client:c}){const u=i({address:a,chainId:o}),d=this.get({address:a,chainId:o,client:c});this.increment({address:a,chainId:o});const l=await d;return await t.set({address:a,chainId:o},l),r.set(u,l),l},async increment({address:a,chainId:o}){const c=i({address:a,chainId:o}),u=n.get(c)??0;n.set(c,u+1)},async get({address:a,chainId:o,client:c}){const u=i({address:a,chainId:o});let d=s.get(u);return d||(d=(async()=>{try{const p=await t.get({address:a,chainId:o,client:c}),f=r.get(u)??0;return f>0&&p<=f?f+1:(r.delete(u),p)}finally{this.reset({address:a,chainId:o})}})(),s.set(u,d)),(n.get(u)??0)+await d},reset({address:a,chainId:o}){const c=i({address:a,chainId:o});n.delete(c),s.delete(c)}}}const mg=`Ethereum Signed Message:
37
+ `;function bg(e){const t=typeof e=="string"?Vn(e):typeof e.raw=="string"?e.raw:ue(e.raw),n=Vn(`${mg}${te(t)}`);return he([n,t])}function bs(e,t){return X(bg(e),t)}class yg extends k{constructor({domain:t}){super(`Invalid domain "${De(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class gg extends k{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 wg extends k{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function vg(e){const{domain:t,message:n,primaryType:r,types:s}=e,i=(a,o)=>{for(const c of a){const{name:u,type:d}=c,l=o[u],p=d.match(ha);if(p&&(typeof l=="number"||typeof l=="bigint")){const[h,y,w]=p;C(l,{signed:y==="int",size:Number.parseInt(w,10)/8})}if(d==="address"&&typeof l=="string"&&!me(l))throw new Ct({address:l});const f=d.match(Vu);if(f){const[h,y]=f;if(y&&te(l)!==Number.parseInt(y,10))throw new Bu({expectedSize:Number.parseInt(y,10),givenSize:te(l)})}const m=s[d];m&&(Eg(d),i(m,l))}};if(s.EIP712Domain&&t){if(typeof t!="object")throw new yg({domain:t});i(s.EIP712Domain,t)}if(r!=="EIP712Domain")if(s[r])i(s[r],n);else throw new gg({primaryType:r,types:s})}function xg({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 Eg(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new wg({type:e})}function dr(e){const{domain:t={},message:n,primaryType:r}=e,s={EIP712Domain:xg({domain:t}),...e.types};vg({domain:t,message:n,primaryType:r,types:s});const i=["0x1901"];return t&&i.push(Ag({domain:t,types:s})),r!=="EIP712Domain"&&i.push(ll({data:n,primaryType:r,types:s})),X(he(i))}function Ag({domain:e,types:t}){return ll({data:e,primaryType:"EIP712Domain",types:t})}function ll({data:e,primaryType:t,types:n}){const r=fl({data:e,primaryType:t,types:n});return X(r)}function fl({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],s=[Pg({primaryType:t,types:n})];for(const i of n[t]){const[a,o]=hl({types:n,name:i.name,type:i.type,value:e[i.name]});r.push(a),s.push(o)}return Ce(r,s)}function Pg({primaryType:e,types:t}){const n=Oe(kg({primaryType:e,types:t}));return X(n)}function kg({primaryType:e,types:t}){let n="";const r=pl({primaryType:e,types:t});r.delete(e);const s=[e,...Array.from(r).sort()];for(const i of s)n+=`${i}(${t[i].map(({name:a,type:o})=>`${o} ${a}`).join(",")})`;return n}function pl({primaryType:e,types:t},n=new Set){const s=e.match(/^\w*/u)?.[0];if(n.has(s)||t[s]===void 0)return n;n.add(s);for(const i of t[s])pl({primaryType:i.type,types:t},n);return n}function hl({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},X(fl({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},X(r)];if(n==="string")return[{type:"bytes32"},X(Oe(r))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),i=r.map(a=>hl({name:t,type:s,types:e,value:a}));return[{type:"bytes32"},X(Ce(i.map(([a])=>a),i.map(([,a])=>a)))]}return[{type:n},r]}const Sg="0x6492649264926492649264926492649264926492649264926492649264926492";function Hs(e){const{address:t,data:n,signature:r,to:s="hex"}=e,i=yt([Ce([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),Sg]);return s==="hex"?i:je(i)}function Ig(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function _g(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Ae(e.nonce):void 0,storageProof:e.storageProof?Ig(e.storageProof):void 0}}async function Tg(e,{address:t,blockNumber:n,blockTag:r,storageKeys:s}){const i=r??"latest",a=n!==void 0?C(n):void 0,o=await e.request({method:"eth_getProof",params:[t,s,a||i]});return _g(o)}async function Og(e,{address:t,blockNumber:n,blockTag:r="latest",slot:s}){const i=n!==void 0?C(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,s,i||r]})}async function Ha(e,{blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i,sender:a,nonce:o}){const c=r||"latest",u=n!==void 0?C(n):void 0;let d=null;if(s?d=await e.request({method:"eth_getTransactionByHash",params:[s]},{dedupe:!0}):t?d=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,C(i)]},{dedupe:!0}):(u||c)&&typeof i=="number"?d=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[u||c,C(i)]},{dedupe:!!u}):a&&typeof o=="number"&&(d=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[a,C(o)]},{dedupe:!0})),!d)throw new hu({blockHash:t,blockNumber:n,blockTag:c,hash:s,index:i});return(e.chain?.formatters?.transaction?.format||ia)(d,"getTransaction")}async function Cg(e,{hash:t,transactionReceipt:n}){const[r,s]=await Promise.all([j(e,ur,"getBlockNumber")({}),t?j(e,Ha,"getTransaction")({hash:t}):void 0]),i=n?.blockNumber||s?.blockNumber;return i?r-i+1n:0n}async function Ir(e,{hash:t}){const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new mu({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||aa)(n,"getTransactionReceipt")}async function Bg(e,t){const{account:n,authorizationList:r,allowFailure:s=!0,blockNumber:i,blockOverrides:a,blockTag:o,stateOverride:c}=t,u=t.contracts,{batchSize:d=t.batchSize??1024,deployless:l=t.deployless??!1}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(l)return null;if(e.chain)return In({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),f=[[]];let m=0,h=0;for(let A=0;A<u.length;A++){const{abi:g,address:b,args:x,functionName:E}=u[A];try{const P=se({abi:g,args:x,functionName:E});h+=(P.length-2)/2,d>0&&h>d&&f[m].length>0&&(m++,h=(P.length-2)/2,f[m]=[]),f[m]=[...f[m],{allowFailure:!0,callData:P,target:b}]}catch(P){const O=xn(P,{abi:g,address:b,args:x,docsPath:"/docs/contract/multicall",functionName:E,sender:n});if(!s)throw O;f[m]=[...f[m],{allowFailure:!0,callData:"0x",target:b}]}}const y=await Promise.allSettled(f.map(A=>j(e,Pe,"readContract")({...p===null?{code:Ca}:{address:p},abi:Lr,account:n,args:[A],authorizationList:r,blockNumber:i,blockOverrides:a,blockTag:o,functionName:"aggregate3",stateOverride:c}))),w=[];for(let A=0;A<y.length;A++){const g=y[A];if(g.status==="rejected"){if(!s)throw g.reason;for(let x=0;x<f[A].length;x++)w.push({status:"failure",error:g.reason,result:void 0});continue}const b=g.value;for(let x=0;x<b.length;x++){const{returnData:E,success:P}=b[x],{callData:O}=f[A][x],{abi:M,address:_,functionName:$,args:v}=u[w.length];try{if(O==="0x")throw new rr;if(!P)throw new ns({data:E});const I=Qt({abi:M,args:v,data:E,functionName:$});w.push(s?{result:I,status:"success"}:I)}catch(I){const U=xn(I,{abi:M,address:_,args:v,docsPath:"/docs/contract/multicall",functionName:$});if(!s)throw U;w.push({error:U,result:void 0,status:"failure"})}}}if(w.length!==u.length)throw new k("multicall results mismatch");return w}async function Ei(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:s,returnFullTransactions:i,traceTransfers:a,validation:o}=t;try{const c=[];for(const p of s){const f=p.blockOverrides?Wd(p.blockOverrides):void 0,m=p.calls.map(y=>{const w=y,A=w.account?de(w.account):void 0,g=w.abi?se(w):w.data,b={...w,account:A,data:w.dataSuffix?he([g||"0x",w.dataSuffix]):g,from:w.from??A?.address};return Tn(b),nr(b)}),h=p.stateOverrides?ds(p.stateOverrides):void 0;c.push({blockOverrides:f,calls:m,stateOverrides:h})}const d=(typeof n=="bigint"?C(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:i,traceTransfers:a,validation:o},d]})).map((p,f)=>({...uu(p),calls:p.calls.map((m,h)=>{const{abi:y,args:w,functionName:A,to:g}=s[f].calls[h],b=m.error?.data??m.returnData,x=BigInt(m.gasUsed),E=m.logs?.map(_=>nt(_)),P=m.status==="0x1"?"success":"failure",O=y&&P==="success"&&b!=="0x"?Qt({abi:y,data:b,functionName:A}):null,M=(()=>{if(P==="success")return;let _;if(m.error?.data==="0x"?_=new rr:m.error&&(_=new ns(m.error)),!!_)return xn(_,{abi:y??[],address:g??"0x",args:w,functionName:A??"<unknown>"})})();return{data:b,gasUsed:x,logs:E,status:P,...P==="success"?{result:O}:{error:M}}})}))}catch(c){const u=c,d=rs(u,{});throw d instanceof tr?u:d}}function Ai(e){let t=!0,n="",r=0,s="",i=!1;for(let a=0;a<e.length;a++){const o=e[a];if(["(",")",","].includes(o)&&(t=!0),o==="("&&r++,o===")"&&r--,!!t){if(r===0){if(o===" "&&["event","function","error",""].includes(s))s="";else if(s+=o,o===")"){i=!0;break}continue}if(o===" "){e[a-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=o,n+=o}}if(!i)throw new G("Unable to normalize signature.");return s}function Pi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return fi(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((s,i)=>Pi(Object.values(e)[i],s)):/^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(s=>Pi(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function ml(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return ml(s.components,i.components,n[r]);const a=[s.type,i.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")?fi(n[r],{strict:!1}):a.includes("address")&&a.includes("bytes")?fi(n[r],{strict:!1}):!1)return a}}function bl(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?No(e):e;return{...r,...n?{hash:ln(r)}:{}}}function ys(e,t,n){const{args:r=[],prepare:s=!0}=n??{},i=dm(t,{strict:!1}),a=e.filter(u=>i?u.type==="function"||u.type==="error"?yl(u)===tt(t,0,4):u.type==="event"?ln(u)===t:!1:"name"in u&&u.name===t);if(a.length===0)throw new jr({name:t});if(a.length===1)return{...a[0],...s?{hash:ln(a[0])}:{}};let o;for(const u of a){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...s?{hash:ln(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((l,p)=>{const f="inputs"in u&&u.inputs[p];return f?Pi(l,f):!1})){if(o&&"inputs"in o&&o.inputs){const l=ml(u.inputs,o.inputs,r);if(l)throw new $g({abiItem:u,type:l[0]},{abiItem:o,type:l[1]})}o=u}}const c=(()=>{if(o)return o;const[u,...d]=a;return{...u,overloads:d}})();if(!c)throw new jr({name:t});return{...c,...s?{hash:ln(c)}:{}}}function yl(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return ys(n,r)}return e[0]})();return tt(ln(t),0,4)}function Ng(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,s]=e;return ys(r,s)}return e[0]})(),n=typeof t=="string"?t:Br(t);return Ai(n)}function ln(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return ys(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:hd(Ea(Ng(t)))}class $g extends G{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Ai(Br(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Ai(Br(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 jr extends G{constructor({name:t,data:n,type:r="item"}){const s=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${s} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function Mg(...e){const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,a]=e;return[Rg(i),a]}return e})(),{bytecode:r,args:s}=n;return Ve(r,t.inputs?.length&&s?.length?Ta(t.inputs,s):"0x")}function Lg(e){return bl(e)}function Rg(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new jr({name:"constructor"});return t}function jg(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[u,d,l]=e;return[fc(u,d,{args:l}),l]}const[o,c]=e;return[o,c]})(),{overloads:r}=t,s=r?fc([t,...r],t.name,{args:n}):t,i=Dg(s),a=n.length>0?Ta(s.inputs,n):void 0;return a?Ve(i,a):i}function an(e,t={}){return bl(e,t)}function fc(e,t,n){const r=ys(e,t,n);if(r.type!=="function")throw new jr({name:t,type:"function"});return r}function Dg(e){return yl(e)}const Ug="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Ze="0x0000000000000000000000000000000000000000",Fg="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function zg(e,t){const{blockNumber:n,blockTag:r,calls:s,stateOverrides:i,traceAssetChanges:a,traceTransfers:o,validation:c}=t,u=t.account?de(t.account):void 0;if(a&&!u)throw new k("`account` is required when `traceAssetChanges` is true");const d=u?Mg(Lg("constructor(bytes, bytes)"),{bytecode:Hd,args:[Fg,jg(an("function getBalance(address)"),[u.address])]}):void 0,l=a?await Promise.all(t.calls.map(async N=>{if(!N.data&&!N.abi)return;const{accessList:D}=await Xd(e,{account:u.address,...N,data:N.abi?se(N):N.data});return D.map(({address:F,storageKeys:K})=>K.length>0?F:null)})).then(N=>N.flat().filter(Boolean)):[],p=await Ei(e,{blockNumber:n,blockTag:r,blocks:[...a?[{calls:[{data:d}],stateOverrides:i},{calls:l.map((N,D)=>({abi:[an("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:N,from:Ze,nonce:D})),stateOverrides:[{address:Ze,nonce:0}]}]:[],{calls:[...s,{}].map(N=>({...N,from:u?.address})),stateOverrides:i},...a?[{calls:[{data:d}]},{calls:l.map((N,D)=>({abi:[an("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:N,from:Ze,nonce:D})),stateOverrides:[{address:Ze,nonce:0}]},{calls:l.map((N,D)=>({to:N,abi:[an("function decimals() returns (uint256)")],functionName:"decimals",from:Ze,nonce:D})),stateOverrides:[{address:Ze,nonce:0}]},{calls:l.map((N,D)=>({to:N,abi:[an("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Ze,nonce:D})),stateOverrides:[{address:Ze,nonce:0}]},{calls:l.map((N,D)=>({to:N,abi:[an("function symbol() returns (string)")],functionName:"symbol",from:Ze,nonce:D})),stateOverrides:[{address:Ze,nonce:0}]}]:[]],traceTransfers:o,validation:c}),f=a?p[2]:p[0],[m,h,,y,w,A,g,b]=a?p:[],{calls:x,...E}=f,P=x.slice(0,-1)??[],O=m?.calls??[],M=h?.calls??[],_=[...O,...M].map(N=>N.status==="success"?ie(N.data):null),$=y?.calls??[],v=w?.calls??[],I=[...$,...v].map(N=>N.status==="success"?ie(N.data):null),U=(A?.calls??[]).map(N=>N.status==="success"?N.result:null),S=(b?.calls??[]).map(N=>N.status==="success"?N.result:null),T=(g?.calls??[]).map(N=>N.status==="success"?N.result:null),L=[];for(const[N,D]of I.entries()){const F=_[N];if(typeof D!="bigint"||typeof F!="bigint")continue;const K=U[N-1],J=S[N-1],Ue=T[N-1],we=N===0?{address:Ug,decimals:18,symbol:"ETH"}:{address:l[N-1],decimals:Ue||K?Number(K??1):void 0,symbol:J??void 0};L.some(le=>le.token.address===we.address)||L.push({token:we,value:{pre:F,post:D,diff:D-F}})}return{assetChanges:L,block:E,results:P}}async function Gg(e,t){const{abi:n,address:r,args:s,dataSuffix:i,functionName:a,...o}=t,c=o.account?de(o.account):e.account,u=se({abi:n,args:s,functionName:a});try{const{data:d}=await j(e,ls,"call")({batch:!1,data:`${u}${i?i.replace("0x",""):""}`,to:r,...o,account:c}),l=Qt({abi:n,args:s,functionName:a,data:d||"0x"}),p=n.filter(f=>"name"in f&&f.name===t.functionName);return{result:l,request:{abi:p,address:r,args:s,dataSuffix:i,functionName:a,...o,account:c}}}catch(d){throw xn(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:a,sender:c?.address})}}async function gs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}async function Hg(e,{address:t,message:n,factory:r,factoryData:s,signature:i,...a}){const o=bs(n);return j(e,fs,"verifyHash")({address:t,factory:r,factoryData:s,hash:o,signature:i,...a})}async function qg(e,t){const{address:n,factory:r,factoryData:s,signature:i,message:a,primaryType:o,types:c,domain:u,...d}=t,l=dr({message:a,primaryType:o,types:c,domain:u});return j(e,fs,"verifyHash")({address:n,factory:r,factoryData:s,hash:l,signature:i,...d})}const qs=new Map,pc=new Map;let Vg=0;function rt(e,t,n){const r=++Vg,s=()=>qs.get(e)||[],i=()=>{const d=s();qs.set(e,d.filter(l=>l.id!==r))},a=()=>{const d=s();if(!d.some(p=>p.id===r))return;const l=pc.get(e);if(d.length===1&&l){const p=l();p instanceof Promise&&p.catch(()=>{})}i()},o=s();if(qs.set(e,[...o,{id:r,fns:t}]),o&&o.length>0)return a;const c={};for(const d in t)c[d]=(...l)=>{const p=s();if(p.length!==0)for(const f of p)f.fns[d]?.(...l)};const u=n(c);return typeof u=="function"&&pc.set(e,u),a}function Xt(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let s=!0;const i=()=>s=!1;return(async()=>{let o;t&&(o=await e({unpoll:i}));const c=await n?.(o)??r;await ho(c);const u=async()=>{s&&(await e({unpoll:i}),await ho(r),u())};u()})(),i}function gl(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:s,poll:i,pollingInterval:a=e.pollingInterval}){const o=typeof i<"u"?i:!(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 o?(()=>{const l=De(["watchBlockNumber",e.uid,t,n,a]);return rt(l,{onBlockNumber:r,onError:s},p=>Xt(async()=>{try{const f=await j(e,ur,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(f===c)return;if(f-c>1&&n)for(let m=c+1n;m<f;m++)p.onBlockNumber(m,c),c=m}(c===void 0||f>c)&&(p.onBlockNumber(f,c),c=f)}catch(f){p.onError?.(f)}},{emitOnBegin:t,interval:a}))})():(()=>{const l=De(["watchBlockNumber",e.uid,t,n]);return rt(l,{onBlockNumber:r,onError:s},p=>{let f=!0,m=()=>f=!1;return(async()=>{try{const h=(()=>{if(e.transport.type==="fallback"){const w=e.transport.transports.find(A=>A.config.type==="webSocket"||A.config.type==="ipc");return w?w.value:e.transport}return e.transport})(),{unsubscribe:y}=await h.subscribe({params:["newHeads"],onData(w){if(!f)return;const A=ie(w.result?.number);p.onBlockNumber(A,c),c=A},onError(w){p.onError?.(w)}});m=y,f||m()}catch(h){s?.(h)}})(),()=>m()})})()}async function Wg(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:s,onReplaced:i,retryCount:a=6,retryDelay:o=({count:x})=>~~(1<<x)*200,timeout:c=18e4}=t,u=De(["waitForTransactionReceipt",e.uid,s]),d=t.pollingInterval?t.pollingInterval:e.chain?.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval;let l,p,f,m=!1,h,y;const{promise:w,resolve:A,reject:g}=au(),b=c?setTimeout(()=>{y?.(),h?.(),g(new tp({hash:s}))},c):void 0;return h=rt(u,{onReplaced:i,resolve:A,reject:g},async x=>{if(f=await j(e,Ir,"getTransactionReceipt")({hash:s}).catch(()=>{}),f&&r<=1){clearTimeout(b),x.resolve(f),h?.();return}y=j(e,gl,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:d,async onBlockNumber(E){const P=M=>{clearTimeout(b),y?.(),M(),h?.()};let O=E;if(!m)try{if(f){if(r>1&&(!f.blockNumber||O-f.blockNumber+1n<r))return;P(()=>x.resolve(f));return}if(n&&!l&&(m=!0,await ei(async()=>{l=await j(e,Ha,"getTransaction")({hash:s}),l.blockNumber&&(O=l.blockNumber)},{delay:o,retryCount:a}),m=!1),f=await j(e,Ir,"getTransactionReceipt")({hash:s}),r>1&&(!f.blockNumber||O-f.blockNumber+1n<r))return;P(()=>x.resolve(f))}catch(M){if(M instanceof hu||M instanceof mu){if(!l){m=!1;return}try{p=l,m=!0;const _=await ei(()=>j(e,Ge,"getBlock")({blockNumber:O,includeTransactions:!0}),{delay:o,retryCount:a,shouldRetry:({error:I})=>I instanceof sl});m=!1;const $=_.transactions.find(({from:I,nonce:U})=>I===p.from&&U===p.nonce);if(!$||(f=await j(e,Ir,"getTransactionReceipt")({hash:$.hash}),r>1&&(!f.blockNumber||O-f.blockNumber+1n<r)))return;let v="replaced";$.to===p.to&&$.value===p.value&&$.input===p.input?v="repriced":$.from===$.to&&$.value===0n&&(v="cancelled"),P(()=>{x.onReplaced?.({reason:v,replacedTransaction:p,transaction:$,transactionReceipt:f}),x.resolve(f)})}catch(_){P(()=>x.reject(_))}}else P(()=>x.reject(M))}}})}),w}function Kg(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:s,onError:i,includeTransactions:a,poll:o,pollingInterval:c=e.pollingInterval}){const u=typeof o<"u"?o:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),d=a??!1;let l;return u?(()=>{const m=De(["watchBlocks",e.uid,t,n,r,d,c]);return rt(m,{onBlock:s,onError:i},h=>Xt(async()=>{try{const y=await j(e,Ge,"getBlock")({blockTag:t,includeTransactions:d});if(y.number!==null&&l?.number!=null){if(y.number===l.number)return;if(y.number-l.number>1&&n)for(let w=l?.number+1n;w<y.number;w++){const A=await j(e,Ge,"getBlock")({blockNumber:w,includeTransactions:d});h.onBlock(A,l),l=A}}(l?.number==null||t==="pending"&&y?.number==null||y.number!==null&&y.number>l.number)&&(h.onBlock(y,l),l=y)}catch(y){h.onError?.(y)}},{emitOnBegin:r,interval:c}))})():(()=>{let m=!0,h=!0,y=()=>m=!1;return(async()=>{try{r&&j(e,Ge,"getBlock")({blockTag:t,includeTransactions:d}).then(g=>{m&&h&&(s(g,void 0),h=!1)}).catch(i);const w=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),{unsubscribe:A}=await w.subscribe({params:["newHeads"],async onData(g){if(!m)return;const b=await j(e,Ge,"getBlock")({blockNumber:g.result?.number,includeTransactions:d}).catch(()=>{});m&&(s(b,l),h=!1,l=b)},onError(g){i?.(g)}});y=A,m||y()}catch(w){i?.(w)}})(),()=>y()})()}function Zg(e,t){const{abi:n,address:r,args:s,batch:i=!0,eventName:a,fromBlock:o,onError:c,onLogs:u,poll:d,pollingInterval:l=e.pollingInterval,strict:p}=t;return(typeof d<"u"?d: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")))?(()=>{const y=p??!1,w=De(["watchContractEvent",r,s,i,e.uid,a,l,y,o]);return rt(w,{onLogs:u,onError:c},A=>{let g;o!==void 0&&(g=o-1n);let b,x=!1;const E=Xt(async()=>{if(!x){try{b=await j(e,el,"createContractEventFilter")({abi:n,address:r,args:s,eventName:a,strict:y,fromBlock:o})}catch{}x=!0;return}try{let P;if(b)P=await j(e,ms,"getFilterChanges")({filter:b});else{const O=await j(e,ur,"getBlockNumber")({});g&&g<O?P=await j(e,ul,"getContractEvents")({abi:n,address:r,args:s,eventName:a,fromBlock:g+1n,toBlock:O,strict:y}):P=[],g=O}if(P.length===0)return;if(i)A.onLogs(P);else for(const O of P)A.onLogs([O])}catch(P){b&&P instanceof sa&&(x=!1),A.onError?.(P)}},{emitOnBegin:!0,interval:l});return async()=>{b&&await j(e,gs,"uninstallFilter")({filter:b}),E()}})})():(()=>{const y=p??!1,w=De(["watchContractEvent",r,s,i,e.uid,a,l,y]);let A=!0,g=()=>A=!1;return rt(w,{onLogs:u,onError:c},b=>((async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const O=e.transport.transports.find(M=>M.config.type==="webSocket"||M.config.type==="ipc");return O?O.value:e.transport}return e.transport})(),E=a?cr({abi:n,eventName:a,args:s}):[],{unsubscribe:P}=await x.subscribe({params:["logs",{address:r,topics:E}],onData(O){if(!A)return;const M=O.result;try{const{eventName:_,args:$}=Rr({abi:n,data:M.data,topics:M.topics,strict:p}),v=nt(M,{args:$,eventName:_});b.onLogs([v])}catch(_){let $,v;if(_ instanceof Cr||_ instanceof la){if(p)return;$=_.abiItem.name,v=_.abiItem.inputs?.some(U=>!("name"in U&&U.name))}const I=nt(M,{args:v?[]:{},eventName:$});b.onLogs([I])}},onError(O){b.onError?.(O)}});g=P,A||g()}catch(x){c?.(x)}})(),()=>g()))})()}function Yg(e,{address:t,args:n,batch:r=!0,event:s,events:i,fromBlock:a,onError:o,onLogs:c,poll:u,pollingInterval:d=e.pollingInterval,strict:l}){const p=typeof u<"u"?u: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")),f=l??!1;return p?(()=>{const y=De(["watchEvent",t,n,r,e.uid,s,d,a]);return rt(y,{onLogs:c,onError:o},w=>{let A;a!==void 0&&(A=a-1n);let g,b=!1;const x=Xt(async()=>{if(!b){try{g=await j(e,tl,"createEventFilter")({address:t,args:n,event:s,events:i,strict:f,fromBlock:a})}catch{}b=!0;return}try{let E;if(g)E=await j(e,ms,"getFilterChanges")({filter:g});else{const P=await j(e,ur,"getBlockNumber")({});A&&A!==P?E=await j(e,Ga,"getLogs")({address:t,args:n,event:s,events:i,fromBlock:A+1n,toBlock:P}):E=[],A=P}if(E.length===0)return;if(r)w.onLogs(E);else for(const P of E)w.onLogs([P])}catch(E){g&&E instanceof sa&&(b=!1),w.onError?.(E)}},{emitOnBegin:!0,interval:d});return async()=>{g&&await j(e,gs,"uninstallFilter")({filter:g}),x()}})})():(()=>{let y=!0,w=()=>y=!1;return(async()=>{try{const A=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(P=>P.config.type==="webSocket"||P.config.type==="ipc");return E?E.value:e.transport}return e.transport})(),g=i??(s?[s]:void 0);let b=[];g&&(b=[g.flatMap(P=>cr({abi:[P],eventName:P.name,args:n}))],s&&(b=b[0]));const{unsubscribe:x}=await A.subscribe({params:["logs",{address:t,topics:b}],onData(E){if(!y)return;const P=E.result;try{const{eventName:O,args:M}=Rr({abi:g??[],data:P.data,topics:P.topics,strict:f}),_=nt(P,{args:M,eventName:O});c([_])}catch(O){let M,_;if(O instanceof Cr||O instanceof la){if(l)return;M=O.abiItem.name,_=O.abiItem.inputs?.some(v=>!("name"in v&&v.name))}const $=nt(P,{args:_?[]:{},eventName:M});c([$])}},onError(E){o?.(E)}});w=x,y||w()}catch(A){o?.(A)}})(),()=>w()})()}function Jg(e,{batch:t=!0,onError:n,onTransactions:r,poll:s,pollingInterval:i=e.pollingInterval}){return(typeof s<"u"?s:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=De(["watchPendingTransactions",e.uid,t,i]);return rt(u,{onTransactions:r,onError:n},d=>{let l;const p=Xt(async()=>{try{if(!l)try{l=await j(e,nl,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const f=await j(e,ms,"getFilterChanges")({filter:l});if(f.length===0)return;if(t)d.onTransactions(f);else for(const m of f)d.onTransactions([m])}catch(f){d.onError?.(f)}},{emitOnBegin:!0,interval:i});return async()=>{l&&await j(e,gs,"uninstallFilter")({filter:l}),p()}})})():(()=>{let u=!0,d=()=>u=!1;return(async()=>{try{const{unsubscribe:l}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!u)return;const f=p.result;r([f])},onError(p){n?.(p)}});d=l,u||d()}catch(l){n?.(l)}})(),()=>d()})()}async function Qg(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}const Xg="0x5792579257925792579257925792579257925792579257925792579257925792",e1=C(0,{size:32});async function t1(e,t){async function n(d){if(d.endsWith(Xg.slice(2))){const p=Ht(si(d,-64,-32)),f=si(d,0,-64).slice(2).match(/.{1,64}/g),m=await Promise.all(f.map(y=>e1.slice(2)!==y?e.request({method:"eth_getTransactionReceipt",params:[`0x${y}`]},{dedupe:!0}):void 0)),h=m.some(y=>y===null)?100:m.every(y=>y?.status==="0x1")?200:m.every(y=>y?.status==="0x0")?500:600;return{atomic:!1,chainId:Ae(p),receipts:m.filter(Boolean),status:h,version:"2.0.0"}}return e.request({method:"wallet_getCallsStatus",params:[d]})}const{atomic:r=!1,chainId:s,receipts:i,version:a="2.0.0",...o}=await n(t.id),[c,u]=(()=>{const d=o.status;return d>=100&&d<200?["pending",d]:d>=200&&d<300?["success",d]:d>=300&&d<700?["failure",d]:d==="CONFIRMED"?["success",200]:d==="PENDING"?["pending",100]:[void 0,d]})();return{...o,atomic:r,chainId:s?Ae(s):void 0,receipts:i?.map(d=>({...d,blockNumber:ie(d.blockNumber),gasUsed:ie(d.gasUsed),status:du[d.status]}))??[],statusCode:u,status:c,version:a}}async function n1(e,t){const{account:n=e.account,chainId:r,nonce:s}=t;if(!n)throw new Qr({docsPath:"/docs/eip7702/prepareAuthorization"});const i=de(n),a=(()=>{if(t.executor)return t.executor==="self"?t.executor:de(t.executor)})(),o={address:t.contractAddress??t.address,chainId:r,nonce:s};return typeof o.chainId>"u"&&(o.chainId=e.chain?.id??await j(e,Bn,"getChainId")({})),typeof o.nonce>"u"&&(o.nonce=await j(e,Ua,"getTransactionCount")({address:i.address,blockTag:"pending"}),(a==="self"||a?.address&&Cn(a.address,i.address))&&(o.nonce+=1)),o}class r1 extends k{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 wl(e,t){const{id:n,pollingInterval:r=e.pollingInterval,status:s=({statusCode:h})=>h===200||h>=300,retryCount:i=4,retryDelay:a=({count:h})=>~~(1<<h)*200,timeout:o=6e4,throwOnFailure:c=!1}=t,u=De(["waitForCallsStatus",e.uid,n]),{promise:d,resolve:l,reject:p}=au();let f;const m=rt(u,{resolve:l,reject:p},h=>{const y=Xt(async()=>{const w=A=>{clearTimeout(f),y(),A(),m()};try{const A=await ei(async()=>{const g=await j(e,t1,"getCallsStatus")({id:n});if(c&&g.status==="failure")throw new r1(g);return g},{retryCount:i,delay:a});if(!s(A))return;w(()=>h.resolve(A))}catch(A){w(()=>h.reject(A))}},{interval:r,emitOnBegin:!0});return y});return f=o?setTimeout(()=>{m(),clearTimeout(f),p(new s1({id:n}))},o):void 0,await d}class s1 extends k{constructor({id:t}){super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}async function i1(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){const s=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,C(r)]:[t]},{retryCount:0}),a=(e.chain?.formatters?.transactionReceipt?.format||aa)(s);if(a.status==="reverted"&&n)throw new ep({receipt:a});return a}function a1(e){const{scheme:t,statement:n,...r}=e.match(o1)?.groups??{},{chainId:s,expirationTime:i,issuedAt:a,notBefore:o,requestId:c,...u}=e.match(c1)?.groups??{},d=e.split("Resources:")[1]?.split(`
38
+ - `).slice(1);return{...r,...u,...s?{chainId:Number(s)}:{},...i?{expirationTime:new Date(i)}:{},...a?{issuedAt:new Date(a)}:{},...o?{notBefore:new Date(o)}:{},...c?{requestId:c}:{},...d?{resources:d}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const o1=/^(?:(?<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)?/,c1=/(?: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 u1(e){const{address:t,domain:n,message:r,nonce:s,scheme:i,time:a=new Date}=e;if(n&&r.domain!==n||s&&r.nonce!==s||i&&r.scheme!==i||r.expirationTime&&a>=r.expirationTime||r.notBefore&&a<r.notBefore)return!1;try{if(!r.address||!me(r.address,{strict:!1})||t&&!Cn(r.address,t))return!1}catch{return!1}return!0}async function d1(e,t){const{address:n,domain:r,message:s,nonce:i,scheme:a,signature:o,time:c=new Date,...u}=t,d=a1(s);if(!d.address||!u1({address:n,domain:r,message:d,nonce:i,scheme:a,time:c}))return!1;const p=bs(s);return fs(e,{address:d.address,hash:p,signature:o,...u})}function l1(e){return{call:t=>ls(e,t),createAccessList:t=>Xd(e,t),createBlockFilter:()=>zy(e),createContractEventFilter:t=>el(e,t),createEventFilter:t=>tl(e,t),createPendingTransactionFilter:()=>nl(e),estimateContractGas:t=>Yy(e,t),estimateGas:t=>Fa(e,t),getBalance:t=>Jy(e,t),getBlobBaseFee:()=>Qy(e),getBlock:t=>Ge(e,t),getBlockNumber:t=>ur(e,t),getBlockTransactionCount:t=>sg(e,t),getBytecode:t=>Jn(e,t),getChainId:()=>Bn(e),getCode:t=>Jn(e,t),getContractEvents:t=>ul(e,t),getEip712Domain:t=>cg(e,t),getEnsAddress:t=>Sy(e,t),getEnsAvatar:t=>Dy(e,t),getEnsName:t=>Uy(e,t),getEnsResolver:t=>Fy(e,t),getEnsText:t=>Qd(e,t),getFeeHistory:t=>lg(e,t),estimateFeesPerGas:t=>al(e,t),getFilterChanges:t=>ms(e,t),getFilterLogs:t=>fg(e,t),getGasPrice:()=>Da(e),getLogs:t=>Ga(e,t),getProof:t=>Tg(e,t),estimateMaxPriorityFeePerGas:t=>Wy(e,t),fillTransaction:t=>ol(e,t),getStorageAt:t=>Og(e,t),getTransaction:t=>Ha(e,t),getTransactionConfirmations:t=>Cg(e,t),getTransactionCount:t=>Ua(e,t),getTransactionReceipt:t=>Ir(e,t),multicall:t=>Bg(e,t),prepareTransactionRequest:t=>cl(e,t),readContract:t=>Pe(e,t),sendRawTransaction:t=>Qg(e,t),sendRawTransactionSync:t=>i1(e,t),simulate:t=>Ei(e,t),simulateBlocks:t=>Ei(e,t),simulateCalls:t=>zg(e,t),simulateContract:t=>Gg(e,t),verifyHash:t=>fs(e,t),verifyMessage:t=>Hg(e,t),verifySiweMessage:t=>d1(e,t),verifyTypedData:t=>qg(e,t),uninstallFilter:t=>gs(e,t),waitForTransactionReceipt:t=>Wg(e,t),watchBlocks:t=>Kg(e,t),watchBlockNumber:t=>gl(e,t),watchContractEvent:t=>Zg(e,t),watchEvent:t=>Yg(e,t),watchPendingTransactions:t=>Jg(e,t)}}function f1(e){const{key:t="public",name:n="Public Client"}=e;return ou({...e,key:t,name:n,type:"publicClient"}).extend(l1)}function p1(e){const{r:t,s:n}=Aa.Signature.fromCompact(e.slice(2,130)),r=+`0x${e.slice(130)}`,[s,i]=(()=>{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 s<"u"?{r:C(t,{size:32}),s:C(n,{size:32}),v:s,yParity:i}:{r:C(t,{size:32}),s:C(n,{size:32}),yParity:i}}function vl(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var i;const a=c=>c===null?null:JSON.parse(c,void 0),o=(i=n.getItem(s))!=null?i:null;return o instanceof Promise?o.then(a):a(o)},setItem:(s,i)=>n.setItem(s,JSON.stringify(i,void 0)),removeItem:s=>n.removeItem(s)}}const ki=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return ki(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return ki(r)(n)}}}},h1=(e,t)=>(n,r,s)=>{let i={storage:vl(()=>localStorage),partialize:h=>h,version:0,merge:(h,y)=>({...y,...h}),...t},a=!1;const o=new Set,c=new Set;let u=i.storage;if(!u)return e((...h)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...h)},r,s);const d=()=>{const h=i.partialize({...r()});return u.setItem(i.name,{state:h,version:i.version})},l=s.setState;s.setState=(h,y)=>{l(h,y),d()};const p=e((...h)=>{n(...h),d()},r,s);s.getInitialState=()=>p;let f;const m=()=>{var h,y;if(!u)return;a=!1,o.forEach(A=>{var g;return A((g=r())!=null?g:p)});const w=((y=i.onRehydrateStorage)==null?void 0:y.call(i,(h=r())!=null?h:p))||void 0;return ki(u.getItem.bind(u))(i.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==i.version){if(i.migrate){const g=i.migrate(A.state,A.version);return g instanceof Promise?g.then(b=>[!0,b]):[!0,g]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,A.state];return[!1,void 0]}).then(A=>{var g;const[b,x]=A;if(f=i.merge(x,(g=r())!=null?g:p),n(f,!0),b)return d()}).then(()=>{w?.(f,void 0),f=r(),a=!0,c.forEach(A=>A(f))}).catch(A=>{w?.(void 0,A)})};return s.persist={setOptions:h=>{i={...i,...h},h.storage&&(u=h.storage)},clearStorage:()=>{u?.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>m(),hasHydrated:()=>a,onHydrate:h=>(o.add(h),()=>{o.delete(h)}),onFinishHydration:h=>(c.add(h),()=>{c.delete(h)})},i.skipHydration||m(),f||p},m1=h1,hc=e=>{let t;const n=new Set,r=(u,d)=>{const l=typeof u=="function"?u(t):u;if(!Object.is(l,t)){const p=t;t=d??(typeof l!="object"||l===null)?l:Object.assign({},t,l),n.forEach(f=>f(t,p))}},s=()=>t,o={setState:r,getState:s,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,s,o);return o},qa=e=>e?hc(e):hc,b1=[{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"}],y1="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";function xl(e,t={}){const{forHash:n}=t,{authorization:r,factory:s,factoryData:i}=e;return n&&(s==="0x7702"||s==="0x7702000000000000000000000000000000000000")?r?he([r.address,i??"0x"]):"0x7702000000000000000000000000000000000000":s?he([s,i??"0x"]):"0x"}const mc="0x22e325a297439656";function El(e,t={}){const{callGasLimit:n,callData:r,maxPriorityFeePerGas:s,maxFeePerGas:i,paymaster:a,paymasterData:o,paymasterPostOpGasLimit:c,paymasterSignature:u,paymasterVerificationGasLimit:d,sender:l,signature:p="0x",verificationGasLimit:f}=e,m=he([ve(C(f||0n),{size:16}),ve(C(n||0n),{size:16})]),h=xl(e,t),y=he([ve(C(s||0n),{size:16}),ve(C(i||0n),{size:16})]),w=e.nonce??0n,A=a?he([a,ve(C(d||0n),{size:16}),ve(C(c||0n),{size:16}),o||"0x",...u?t.forHash?[mc]:[u,ve(C(te(u)),{size:2}),mc]:[]]):"0x",g=e.preVerificationGas??0n;return{accountGasLimits:m,callData:r,initCode:h,gasFees:y,nonce:w,paymasterAndData:A,preVerificationGas:g,sender:l,signature:p}}const g1={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 w1(e){const{chainId:t,entryPointAddress:n,userOperation:r}=e,s=El(r,{forHash:!0});return{types:g1,primaryType:"PackedUserOperation",domain:{name:"ERC4337",version:"1",chainId:t,verifyingContract:n},message:s}}function v1(e){const{chainId:t,entryPointAddress:n,entryPointVersion:r}=e,s=e.userOperation,{authorization:i,callData:a="0x",callGasLimit:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,paymasterAndData:l="0x",preVerificationGas:p,sender:f,verificationGasLimit:m}=s;if(r==="0.8"||r==="0.9")return dr(w1({chainId:t,entryPointAddress:n,userOperation:s}));const h=(()=>{if(r==="0.6"){const y=s.initCode?.slice(0,42),w=s.initCode?.slice(42),A=xl({authorization:i,factory:y,factoryData:w},{forHash:!0});return Ce([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[f,d,X(A),X(a),o,m,p,c,u,X(l)])}if(r==="0.7"){const y=El(s,{forHash:!0});return Ce([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"}],[y.sender,y.nonce,X(y.initCode),X(y.callData),y.accountGasLimits,y.preVerificationGas,y.gasFees,X(y.paymasterAndData)])}throw new Error(`entryPointVersion "${r}" not supported.`)})();return X(Ce([{type:"bytes32"},{type:"address"},{type:"uint256"}],[X(h),n,BigInt(t)]))}async function x1(e){const{extend:t,nonceKeyManager:n=hg({source:{get(){return Date.now()},set(){}}}),...r}=e;let s=!1;const i=await e.getAddress();return{...t,...r,address:i,async getFactoryArgs(){return"isDeployed"in this&&await this.isDeployed()?{factory:void 0,factoryData:void 0}:e.getFactoryArgs()},async getNonce(a){const o=a?.key??BigInt(await n.consume({address:i,chainId:e.client.chain.id,client:e.client}));return e.getNonce?await e.getNonce({...a,key:o}):await Pe(e.client,{abi:pa(["function getNonce(address, uint192) pure returns (uint256)"]),address:e.entryPoint.address,functionName:"getNonce",args:[i,o]})},async isDeployed(){return s?!0:(s=!!await j(e.client,Jn,"getCode")({address:i}),s)},...e.sign?{async sign(a){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.sign(a)]);return o&&c?Hs({address:o,data:c,signature:u}):u}}:{},async signMessage(a){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signMessage(a)]);return o&&c&&o!=="0x7702"?Hs({address:o,data:c,signature:u}):u},async signTypedData(a){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signTypedData(a)]);return o&&c&&o!=="0x7702"?Hs({address:o,data:c,signature:u}):u},type:"smart"}}class Si extends k{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(Si,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa20/});class En extends k{constructor({cause:t,data:n,message:r}={}){const s=r?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${s?`with reason: ${s}`:"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(En,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32521});Object.defineProperty(En,"message",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Ii extends k{constructor({cause:t}){super("Failed to send funds to beneficiary.",{cause:t,name:"FailedToSendToBeneficiaryError"})}}Object.defineProperty(Ii,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa91/});class _i extends k{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(_i,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa94/});class Ti extends k{constructor({cause:t}){super("The `handleOps` function was called by the Bundler with a gas limit too low.",{cause:t,name:"HandleOpsOutOfGasError"})}}Object.defineProperty(Ti,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa95/});class Oi extends k{constructor({cause:t,factory:n,factoryData:r,initCode:s}){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
39
+ `,n&&`factory: ${n}`,r&&`factoryData: ${r}`,s&&`initCode: ${s}`].filter(Boolean),name:"InitCodeFailedError"})}}Object.defineProperty(Oi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa13/});class Ci extends k{constructor({cause:t,factory:n,factoryData:r,initCode:s}){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
40
+ `,n&&`factory: ${n}`,r&&`factoryData: ${r}`,s&&`initCode: ${s}`].filter(Boolean),name:"InitCodeMustCreateSenderError"})}}Object.defineProperty(Ci,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa15/});class Bi extends k{constructor({cause:t,factory:n,factoryData:r,initCode:s,sender:i}){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
41
+ `,n&&`factory: ${n}`,r&&`factoryData: ${r}`,s&&`initCode: ${s}`,i&&`sender: ${i}`].filter(Boolean),name:"InitCodeMustReturnSenderError"})}}Object.defineProperty(Bi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa14/});class Ni extends k{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(Ni,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa21/});class $i extends k{constructor({cause:t}){super("Bundler attempted to call an invalid function on the EntryPoint.",{cause:t,name:"InternalCallOnlyError"})}}Object.defineProperty($i,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa92/});class Mi extends k{constructor({cause:t}){super("Bundler used an invalid aggregator for handling aggregated User Operations.",{cause:t,name:"InvalidAggregatorError"})}}Object.defineProperty(Mi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa96/});class Li extends k{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(Li,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa25/});class Ri extends k{constructor({cause:t}){super("Bundler has not set a beneficiary address.",{cause:t,name:"InvalidBeneficiaryError"})}}Object.defineProperty(Ri,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa90/});class Dr extends k{constructor({cause:t}){super("Invalid fields set on User Operation.",{cause:t,name:"InvalidFieldsError"})}}Object.defineProperty(Dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class ji extends k{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(ji,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa93/});class Ut extends k{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(Ut,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32508});Object.defineProperty(Ut,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa31/});class Di extends k{constructor({cause:t}){super("The `validatePaymasterUserOp` function on the Paymaster reverted.",{cause:t,name:"PaymasterFunctionRevertedError"})}}Object.defineProperty(Di,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa33/});class Ui extends k{constructor({cause:t}){super("The Paymaster contract has not been deployed.",{cause:t,name:"PaymasterNotDeployedError"})}}Object.defineProperty(Ui,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa30/});class Ur extends k{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:t,name:"PaymasterRateLimitError"})}}Object.defineProperty(Ur,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32504});class Fr extends k{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:t,name:"PaymasterStakeTooLowError"})}}Object.defineProperty(Fr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32505});class Fi extends k{constructor({cause:t}){super("Paymaster `postOp` function reverted.",{cause:t,name:"PaymasterPostOpFunctionRevertedError"})}}Object.defineProperty(Fi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa50/});class zi extends k{constructor({cause:t,factory:n,factoryData:r,initCode:s}){super("Smart Account has already been deployed.",{cause:t,metaMessages:["Remove the following properties and try again:",n&&"`factory`",r&&"`factoryData`",s&&"`initCode`"].filter(Boolean),name:"SenderAlreadyConstructedError"})}}Object.defineProperty(zi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa10/});class zr extends k{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(zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32507});class Gi extends k{constructor({cause:t}){super("The `validateUserOp` function on the Smart Account reverted.",{cause:t,name:"SmartAccountFunctionRevertedError"})}}Object.defineProperty(Gi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa23/});class Gr extends k{constructor({cause:t}){super("UserOperation rejected because account specified unsupported signature aggregator.",{cause:t,name:"UnsupportedSignatureAggregatorError"})}}Object.defineProperty(Gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32506});class Hi extends k{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(Hi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa22/});class qi extends k{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(qi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa32/});class Vi extends k{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(Vi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa24/});class Wi extends k{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(Wi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa34/});class Hr extends k{constructor({cause:t}){super("User Operation rejected by EntryPoint's `simulateValidation` during account creation or validation.",{cause:t,name:"UserOperationRejectedByEntryPointError"})}}Object.defineProperty(Hr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32500});class qr extends k{constructor({cause:t}){super("User Operation rejected by Paymaster's `validatePaymasterUserOp`.",{cause:t,name:"UserOperationRejectedByPaymasterError"})}}Object.defineProperty(qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32501});class Vr extends k{constructor({cause:t}){super("User Operation rejected with op code validation error.",{cause:t,name:"UserOperationRejectedByOpCodeError"})}}Object.defineProperty(Vr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32502});class Wr extends k{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(Wr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32503});class E1 extends k{constructor({cause:t}){super(`An error occurred while executing user operation: ${t?.shortMessage}`,{cause:t,name:"UnknownBundlerError"})}}class Ki extends k{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(Ki,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa40/});class Zi extends k{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(Zi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa41/});class A1 extends k{constructor(t,{callData:n,callGasLimit:r,docsPath:s,factory:i,factoryData:a,initCode:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,paymaster:l,paymasterAndData:p,paymasterData:f,paymasterPostOpGasLimit:m,paymasterVerificationGasLimit:h,preVerificationGas:y,sender:w,signature:A,verificationGasLimit:g}){const b=Sn({callData:n,callGasLimit:r,factory:i,factoryData:a,initCode:o,maxFeePerGas:typeof c<"u"&&`${Re(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Re(u)} gwei`,nonce:d,paymaster:l,paymasterAndData:p,paymasterData:f,paymasterPostOpGasLimit:m,paymasterVerificationGasLimit:h,preVerificationGas:y,sender:w,signature:A,verificationGasLimit:g});super(t.shortMessage,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",b].filter(Boolean),name:"UserOperationExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class P1 extends k{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 k1 extends k{constructor({hash:t}){super(`User Operation with hash "${t}" could not be found.`,{name:"UserOperationNotFoundError"})}}class bc extends k{constructor({hash:t}){super(`Timed out while waiting for User Operation with hash "${t}" to be confirmed.`,{name:"WaitForUserOperationReceiptTimeoutError"})}}const S1=[En,Dr,Ut,Ur,Fr,zr,Gr,Wr,Hr,qr,Vr];function I1(e,t){const n=(e.details||"").toLowerCase();if(Si.message.test(n))return new Si({cause:e});if(Ii.message.test(n))return new Ii({cause:e});if(_i.message.test(n))return new _i({cause:e});if(Ti.message.test(n))return new Ti({cause:e});if(Oi.message.test(n))return new Oi({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Ci.message.test(n))return new Ci({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Bi.message.test(n))return new Bi({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode,sender:t.sender});if(Ni.message.test(n))return new Ni({cause:e});if($i.message.test(n))return new $i({cause:e});if(Li.message.test(n))return new Li({cause:e,nonce:t.nonce});if(Mi.message.test(n))return new Mi({cause:e});if(Ri.message.test(n))return new Ri({cause:e});if(ji.message.test(n))return new ji({cause:e});if(Ut.message.test(n))return new Ut({cause:e});if(Di.message.test(n))return new Di({cause:e});if(Ui.message.test(n))return new Ui({cause:e});if(Fi.message.test(n))return new Fi({cause:e});if(Gi.message.test(n))return new Gi({cause:e});if(zi.message.test(n))return new zi({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Hi.message.test(n))return new Hi({cause:e});if(qi.message.test(n))return new qi({cause:e});if(Wi.message.test(n))return new Wi({cause:e});if(Vi.message.test(n))return new Vi({cause:e});if(Ki.message.test(n))return new Ki({cause:e});if(Zi.message.test(n))return new Zi({cause:e});const r=e.walk(s=>S1.some(i=>i.code===s.code));if(r){if(r.code===En.code)return new En({cause:e,data:r.data,message:r.details});if(r.code===Dr.code)return new Dr({cause:e});if(r.code===Ut.code)return new Ut({cause:e});if(r.code===Ur.code)return new Ur({cause:e});if(r.code===Fr.code)return new Fr({cause:e});if(r.code===zr.code)return new zr({cause:e});if(r.code===Gr.code)return new Gr({cause:e});if(r.code===Wr.code)return new Wr({cause:e});if(r.code===Hr.code)return new Hr({cause:e});if(r.code===qr.code)return new qr({cause:e});if(r.code===Vr.code)return new Vr({cause:e})}return new E1({cause:e})}function Al(e,{calls:t,docsPath:n,...r}){const s=(()=>{const i=I1(e,r);if(t&&i instanceof En){const a=_1(i),o=t?.filter(c=>c.abi);if(a&&o.length>0)return T1({calls:o,revertData:a})}return i})();return new A1(s,{docsPath:n,...r})}function _1(e){let t;return e.walk(n=>{const r=n;if(typeof r.data=="string"||typeof r.data?.revertData=="string"||!(r instanceof k)&&typeof r.message=="string"){const s=(r.data?.revertData||r.data||r.message).match?.(/(0x[A-Za-z0-9]*)/);if(s)return t=s[1],!0}return!1}),t}function T1(e){const{calls:t,revertData:n}=e,{abi:r,functionName:s,args:i,to:a}=(()=>{const c=t?.filter(d=>!!d.abi);if(c.length===1)return c[0];const u=c.filter(d=>{try{return!!Wu({abi:d.abi,data:n})}catch{return!1}});return u.length===1?u[0]:{abi:[],functionName:c.reduce((d,l)=>`${d?`${d} | `:""}${l.functionName}`,""),args:void 0,to:void 0}})(),o=n==="0x"?new Ju({functionName:s}):new Nr({abi:r,data:n,functionName:s});return new ga(o,{abi:r,args:i,contractAddress:a,functionName:s})}function O1(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 ws(e){const t={};return typeof e.callData<"u"&&(t.callData=e.callData),typeof e.callGasLimit<"u"&&(t.callGasLimit=C(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=C(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=C(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=C(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=C(e.paymasterPostOpGasLimit)),typeof e.paymasterSignature<"u"&&(t.paymasterSignature=e.paymasterSignature),typeof e.paymasterVerificationGasLimit<"u"&&(t.paymasterVerificationGasLimit=C(e.paymasterVerificationGasLimit)),typeof e.preVerificationGas<"u"&&(t.preVerificationGas=C(e.preVerificationGas)),typeof e.sender<"u"&&(t.sender=e.sender),typeof e.signature<"u"&&(t.signature=e.signature),typeof e.verificationGasLimit<"u"&&(t.verificationGasLimit=C(e.verificationGasLimit)),typeof e.authorization<"u"&&(t.eip7702Auth=C1(e.authorization)),t}function C1(e){return{address:e.address,chainId:C(e.chainId),nonce:C(e.nonce),r:e.r?C(BigInt(e.r),{size:32}):ve("0x",{size:32}),s:e.s?C(BigInt(e.s),{size:32}):ve("0x",{size:32}),yParity:e.yParity?C(e.yParity,{size:1}):ve("0x",{size:32})}}async function B1(e,t){const{chainId:n,entryPointAddress:r,context:s,...i}=t,a=ws(i),{paymasterPostOpGasLimit:o,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterData",params:[{...a,callGasLimit:a.callGasLimit??"0x0",verificationGasLimit:a.verificationGasLimit??"0x0",preVerificationGas:a.preVerificationGas??"0x0"},r,C(n),s]});return{...u,...o&&{paymasterPostOpGasLimit:ie(o)},...c&&{paymasterVerificationGasLimit:ie(c)}}}async function N1(e,t){const{chainId:n,entryPointAddress:r,context:s,...i}=t,a=ws(i),{paymasterPostOpGasLimit:o,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterStubData",params:[{...a,callGasLimit:a.callGasLimit??"0x0",verificationGasLimit:a.verificationGasLimit??"0x0",preVerificationGas:a.preVerificationGas??"0x0"},r,C(n),s]});return{...u,...o&&{paymasterPostOpGasLimit:ie(o)},...c&&{paymasterVerificationGasLimit:ie(c)}}}const $1=["factory","fees","gas","paymaster","nonce","signature","authorization"];async function Va(e,t){const n=t,{account:r=e.account,parameters:s=$1,stateOverride:i}=n;if(!r)throw new Qr;const a=de(r),o=e,c=n.paymaster??o?.paymaster,u=typeof c=="string"?c:void 0,{getPaymasterStubData:d,getPaymasterData:l}=(()=>{if(c===!0)return{getPaymasterStubData:E=>j(o,N1,"getPaymasterStubData")(E),getPaymasterData:E=>j(o,B1,"getPaymasterData")(E)};if(typeof c=="object"){const{getPaymasterStubData:E,getPaymasterData:P}=c;return{getPaymasterStubData:P&&E?E:P,getPaymasterData:P&&E?P:void 0}}return{getPaymasterStubData:void 0,getPaymasterData:void 0}})(),p=n.paymasterContext?n.paymasterContext:o?.paymasterContext;let f={...n,paymaster:u,sender:a.address};const[m,h,y,w,A]=await Promise.all([(async()=>n.calls?a.encodeCalls(n.calls.map(E=>{const P=E;return P.abi?{data:se(P),to:P.to,value:P.value}:P})):n.callData)(),(async()=>{if(!s.includes("factory"))return;if(n.initCode)return{initCode:n.initCode};if(n.factory&&n.factoryData)return{factory:n.factory,factoryData:n.factoryData};const{factory:E,factoryData:P}=await a.getFactoryArgs();return a.entryPoint.version==="0.6"?{initCode:E&&P?he([E,P]):void 0}:{factory:E,factoryData:P}})(),(async()=>{if(s.includes("fees")){if(typeof n.maxFeePerGas=="bigint"&&typeof n.maxPriorityFeePerGas=="bigint")return f;if(o?.userOperation?.estimateFeesPerGas){const E=await o.userOperation.estimateFeesPerGas({account:a,bundlerClient:o,userOperation:f});return{...f,...E}}try{const E=o.client??e,P=await j(E,al,"estimateFeesPerGas")({chain:E.chain,type:"eip1559"});return{maxFeePerGas:typeof n.maxFeePerGas=="bigint"?n.maxFeePerGas:BigInt(2n*P.maxFeePerGas),maxPriorityFeePerGas:typeof n.maxPriorityFeePerGas=="bigint"?n.maxPriorityFeePerGas:BigInt(2n*P.maxPriorityFeePerGas)}}catch{return}}})(),(async()=>{if(s.includes("nonce"))return typeof n.nonce=="bigint"?n.nonce:a.getNonce()})(),(async()=>{if(s.includes("authorization")){if(typeof n.authorization=="object")return n.authorization;if(a.authorization&&!await a.isDeployed())return{...await n1(a.client,a.authorization),r:"0xfffffffffffffffffffffffffffffff000000000000000000000000000000000",s:"0x7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",yParity:1}}})()]);typeof m<"u"&&(f.callData=m),typeof h<"u"&&(f={...f,...h}),typeof y<"u"&&(f={...f,...y}),typeof w<"u"&&(f.nonce=w),typeof A<"u"&&(f.authorization=A),s.includes("signature")&&(typeof n.signature<"u"?f.signature=n.signature:f.signature=await a.getStubSignature(f)),a.entryPoint.version==="0.6"&&!f.initCode&&(f.initCode="0x");let g;async function b(){return g||(e.chain?e.chain.id:(g=await j(e,Bn,"getChainId")({}),g))}let x=!1;if(s.includes("paymaster")&&d&&!u&&!n.paymasterAndData){const{isFinal:E=!1,sponsor:P,...O}=await d({chainId:await b(),entryPointAddress:a.entryPoint.address,context:p,...f});x=E,f={...f,...O}}if(a.entryPoint.version==="0.6"&&!f.paymasterAndData&&(f.paymasterAndData="0x"),s.includes("gas")){if(a.userOperation?.estimateGas){const E=await a.userOperation.estimateGas(f);f={...f,...E}}if(typeof f.callGasLimit>"u"||typeof f.preVerificationGas>"u"||typeof f.verificationGasLimit>"u"||f.paymaster&&typeof f.paymasterPostOpGasLimit>"u"||f.paymaster&&typeof f.paymasterVerificationGasLimit>"u"){const E=await j(o,Pl,"estimateUserOperationGas")({account:a,callGasLimit:0n,preVerificationGas:0n,verificationGasLimit:0n,stateOverride:i,...f.paymaster?{paymasterPostOpGasLimit:0n,paymasterVerificationGasLimit:0n}:{},...f});f={...f,callGasLimit:f.callGasLimit??E.callGasLimit,preVerificationGas:f.preVerificationGas??E.preVerificationGas,verificationGasLimit:f.verificationGasLimit??E.verificationGasLimit,paymasterPostOpGasLimit:f.paymasterPostOpGasLimit??E.paymasterPostOpGasLimit,paymasterVerificationGasLimit:f.paymasterVerificationGasLimit??E.paymasterVerificationGasLimit}}}if(s.includes("paymaster")&&l&&!u&&!n.paymasterAndData&&!x){const E=await l({chainId:await b(),entryPointAddress:a.entryPoint.address,context:p,...f});f={...f,...E}}return delete f.calls,delete f.parameters,delete f.paymasterContext,typeof f.paymaster!="string"&&delete f.paymaster,f}async function Pl(e,t){const{account:n=e.account,entryPointAddress:r,stateOverride:s}=t;if(!n&&!t.sender)throw new Qr;const i=n?de(n):void 0,a=ds(s),o=i?await j(e,Va,"prepareUserOperation")({...t,parameters:["authorization","factory","nonce","paymaster","signature"]}):t;try{const c=[ws(o),r??i?.entryPoint?.address],u=await e.request({method:"eth_estimateUserOperationGas",params:a?[...c,a]:[...c]});return O1(u)}catch(c){const u=t.calls;throw Al(c,{...o,...u?{calls:u}:{}})}}function M1(e){return e.request({method:"eth_supportedEntryPoints"})}function L1(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 R1(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationByHash",params:[t]},{dedupe:!0});if(!n)throw new k1({hash:t});const{blockHash:r,blockNumber:s,entryPoint:i,transactionHash:a,userOperation:o}=n;return{blockHash:r,blockNumber:BigInt(s),entryPoint:i,transactionHash:a,userOperation:L1(o)}}function j1(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=>nt(n))),e.receipt&&(t.receipt=aa(t.receipt)),t}async function kl(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationReceipt",params:[t]},{dedupe:!0});if(!n)throw new P1({hash:t});return j1(n)}async function D1(e,t){const{account:n=e.account,entryPointAddress:r}=t;if(!n&&!t.sender)throw new Qr;const s=n?de(n):void 0,i=s?await j(e,Va,"prepareUserOperation")(t):t,a=t.signature||await s?.signUserOperation?.(i),o=ws({...i,signature:a});try{return await e.request({method:"eth_sendUserOperation",params:[o,r??s?.entryPoint?.address]},{retryCount:0})}catch(c){const u=t.calls;throw Al(c,{...i,...u?{calls:u}:{},signature:a})}}function U1(e,t){const{hash:n,pollingInterval:r=e.pollingInterval,retryCount:s,timeout:i=12e4}=t;let a=0;const o=De(["waitForUserOperationReceipt",e.uid,n]);return new Promise((c,u)=>{const d=rt(o,{resolve:c,reject:u},l=>{const p=h=>{m(),h(),d()},f=i?setTimeout(()=>p(()=>l.reject(new bc({hash:n}))),i):void 0,m=Xt(async()=>{s&&a>=s&&(clearTimeout(f),p(()=>l.reject(new bc({hash:n}))));try{const h=await j(e,kl,"getUserOperationReceipt")({hash:n});clearTimeout(f),p(()=>l.resolve(h))}catch(h){const y=h;y.name!=="UserOperationReceiptNotFoundError"&&(clearTimeout(f),p(()=>l.reject(y)))}a++},{emitOnBegin:!0,interval:r});return m})})}function F1(e){return{estimateUserOperationGas:t=>Pl(e,t),getChainId:()=>Bn(e),getSupportedEntryPoints:()=>M1(e),getUserOperation:t=>R1(e,t),getUserOperationReceipt:t=>kl(e,t),prepareUserOperation:t=>Va(e,t),sendUserOperation:t=>D1(e,t),waitForUserOperationReceipt:t=>U1(e,t)}}function z1(e){const{client:t,key:n="bundler",name:r="Bundler Client",paymaster:s,paymasterContext:i,transport:a,userOperation:o}=e;return Object.assign(ou({...e,chain:e.chain??t?.chain,key:n,name:r,transport:a,type:"bundlerClient"}),{client:t,paymaster:s,paymasterContext:i,userOperation:o}).extend(F1)}const Nn="4.3.6",Sl="@coinbase/wallet-sdk",G1=()=>({chains:[]}),H1=()=>({keys:{}}),q1=()=>({account:{}}),V1=()=>({subAccount:void 0}),W1=()=>({subAccountConfig:{}}),K1=()=>({spendPermissions:[]}),Z1=()=>({config:{version:Nn}}),re=qa(m1((...e)=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},G1(...e)),H1(...e)),q1(...e)),V1(...e)),K1(...e)),Z1(...e)),W1(...e)),{name:"cbwsdk.store",storage:vl(()=>localStorage),partialize:e=>({chains:e.chains,keys:e.keys,account:e.account,subAccount:e.subAccount,spendPermissions:e.spendPermissions,config:e.config})})),Y1={get:()=>re.getState().subAccountConfig,set:e=>{re.setState(t=>({subAccountConfig:Object.assign(Object.assign({},t.subAccountConfig),e)}))},clear:()=>{re.setState({subAccountConfig:{}})}},J1={get:()=>re.getState().subAccount,set:e=>{re.setState(t=>({subAccount:t.subAccount?Object.assign(Object.assign({},t.subAccount),e):Object.assign({address:e.address},e)}))},clear:()=>{re.setState({subAccount:void 0})}},Q1={get:()=>re.getState().spendPermissions,set:e=>{re.setState({spendPermissions:e})},clear:()=>{re.setState({spendPermissions:[]})}},X1={get:()=>re.getState().account,set:e=>{re.setState(t=>({account:Object.assign(Object.assign({},t.account),e)}))},clear:()=>{re.setState({account:{}})}},ew={get:()=>re.getState().chains,set:e=>{re.setState({chains:e})},clear:()=>{re.setState({chains:[]})}},tw={get:e=>re.getState().keys[e],set:(e,t)=>{re.setState(n=>({keys:Object.assign(Object.assign({},n.keys),{[e]:t})}))},clear:()=>{re.setState({keys:{}})}},Il={get:()=>re.getState().config,set:e=>{re.setState(t=>({config:Object.assign(Object.assign({},t.config),e)}))}},nw={subAccounts:J1,subAccountsConfig:Y1,spendPermissions:Q1,account:X1,chains:ew,keys:tw,config:Il},R=Object.assign(Object.assign({},re),nw),rw='!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})()}));',sw=()=>new Promise((e,t)=>{if(window.ClientAnalytics)return e();try{const n=document.createElement("script");n.textContent=rw,n.type="text/javascript",document.head.appendChild(n),iw(),document.head.removeChild(n),e()}catch{console.error("Failed to execute inlined telemetry script"),t()}}),iw=()=>{var e,t,n;if(typeof window<"u"){const r=(n=(e=R.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:s,identify:i,PlatformName:a}=window.ClientAnalytics;s({isProd:!0,amplitudeApiKey:"c66737ad47ec354ced777935b0af822e",platform:a.web,projectName:"base_account_sdk",showDebugLogging:!1,version:"1.0.0",apiEndpoint:"https://cca-lite.coinbase.com"}),i({deviceId:r}),R.config.set({deviceId:r})}}},ne={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}},Yi={"-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."}},_l="Unspecified error message.",aw="Unspecified server error.";function Wa(e,t=_l){if(e&&Number.isInteger(e)){const n=e.toString();if(Ji(Yi,n))return Yi[n].message;if(Tl(e))return aw}return t}function ow(e){if(!Number.isInteger(e))return!1;const t=e.toString();return!!(Yi[t]||Tl(e))}function cw(e,{shouldIncludeStack:t=!1}={}){const n={};if(e&&typeof e=="object"&&!Array.isArray(e)&&Ji(e,"code")&&ow(e.code)){const r=e;n.code=r.code,r.message&&typeof r.message=="string"?(n.message=r.message,Ji(r,"data")&&(n.data=r.data)):(n.message=Wa(n.code),n.data={originalError:yc(e)})}else n.code=ne.rpc.internal,n.message=gc(e,"message")?e.message:_l,n.data={originalError:yc(e)};return t&&(n.stack=gc(e,"stack")?e.stack:void 0),n}function Tl(e){return e>=-32099&&e<=-32e3}function yc(e){return e&&typeof e=="object"&&!Array.isArray(e)?Object.assign({},e):e}function Ji(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function gc(e,t){return typeof e=="object"&&e!==null&&t in e&&typeof e[t]=="string"}const B={rpc:{parse:e=>$e(ne.rpc.parse,e),invalidRequest:e=>$e(ne.rpc.invalidRequest,e),invalidParams:e=>$e(ne.rpc.invalidParams,e),methodNotFound:e=>$e(ne.rpc.methodNotFound,e),internal:e=>$e(ne.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 $e(t,e)},invalidInput:e=>$e(ne.rpc.invalidInput,e),resourceNotFound:e=>$e(ne.rpc.resourceNotFound,e),resourceUnavailable:e=>$e(ne.rpc.resourceUnavailable,e),transactionRejected:e=>$e(ne.rpc.transactionRejected,e),methodNotSupported:e=>$e(ne.rpc.methodNotSupported,e),limitExceeded:e=>$e(ne.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>on(ne.provider.userRejectedRequest,e),unauthorized:e=>on(ne.provider.unauthorized,e),unsupportedMethod:e=>on(ne.provider.unsupportedMethod,e),disconnected:e=>on(ne.provider.disconnected,e),chainDisconnected:e=>on(ne.provider.chainDisconnected,e),unsupportedChain:e=>on(ne.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 Cl(t,n,r)}}};function $e(e,t){const[n,r]=Ol(t);return new Ka(e,n||Wa(e),r)}function on(e,t){const[n,r]=Ol(t);return new Cl(e,n||Wa(e),r)}function Ol(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 Ka 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 Cl extends Ka{constructor(t,n,r){if(!uw(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,n,r)}}function uw(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function wc(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 Bl(e){return typeof e=="object"&&e!==null&&"details"in e}function dw(e){try{const t=JSON.parse(e.details);return new Ka(t.code,t.message,t.data)}catch{return null}}function Nl(){return e=>e}const Qn=Nl(),lw=Nl();function lt(e){return Math.floor(e)}const $l=/^[0-9]*$/,Ml=/^[a-f0-9]*$/;function Lt(e){return Za(crypto.getRandomValues(new Uint8Array(e)))}function Za(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function _r(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>Number.parseInt(t,16)))}function Fn(e,t=!1){const n=e.toString("hex");return Qn(t?`0x${n}`:n)}function Vs(e){return Fn(Xi(e),!0)}function Ye(e){return lw(e.toString(10))}function fn(e){return Qn(`0x${BigInt(e).toString(16)}`)}function Ll(e){return e.startsWith("0x")||e.startsWith("0X")}function Ya(e){return Ll(e)?e.slice(2):e}function Rl(e){return Ll(e)?`0x${e.slice(2)}`:`0x${e}`}function vs(e){if(typeof e!="string")return!1;const t=Ya(e).toLowerCase();return Ml.test(t)}function Qi(e,t=!1){if(typeof e=="string"){const n=Ya(e).toLowerCase();if(Ml.test(n))return Qn(t?`0x${n}`:n)}throw B.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function Ja(e,t=!1){let n=Qi(e,!1);return n.length%2===1&&(n=Qn(`0${n}`)),t?Qn(`0x${n}`):n}function Pt(e){if(typeof e=="string"){const t=Ya(e).toLowerCase();if(vs(t)&&t.length===40)return Rl(t)}throw B.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}function Xi(e){if(Y.isBuffer(e))return e;if(typeof e=="string"){if(vs(e)){const t=Ja(e,!1);return Y.from(t,"hex")}return Y.from(e,"utf8")}throw B.rpc.invalidParams(`Not binary data: ${String(e)}`)}function zn(e){if(typeof e=="number"&&Number.isInteger(e))return lt(e);if(typeof e=="string"){if($l.test(e))return lt(Number(e));if(vs(e))return lt(Number(BigInt(Ja(e,!0))))}throw B.rpc.invalidParams(`Not an integer: ${String(e)}`)}function Rn(e){if(e!==null&&(typeof e=="bigint"||pw(e)))return BigInt(e.toString(10));if(typeof e=="number")return BigInt(zn(e));if(typeof e=="string"){if($l.test(e))return BigInt(e);if(vs(e))return BigInt(Ja(e,!0))}throw B.rpc.invalidParams(`Not an integer: ${String(e)}`)}function fw(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw B.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}function pw(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}const hw=`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.
42
+
43
+ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,mw=()=>{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(hw)}catch(t){console.error("Error checking Cross-Origin-Opener-Policy:",t.message),e="error"}}}},{checkCrossOriginOpenerPolicy:bw,getCrossOriginOpenerPolicy:yw}=mw();async function Gn(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":Nn,"X-Cbw-Sdk-Platform":Sl}}),{result:s,error:i}=await r.json();if(i)throw i;return s}function gw(){return globalThis.coinbaseWalletExtension}function ww(){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 vw({metadata:e,preference:t}){var n,r;const{appName:s,appLogoUrl:i,appChainIds:a}=e;if(t.options!=="smartWalletOnly"){const c=gw();if(c)return(n=c.setAppInfo)===null||n===void 0||n.call(c,s,i,a,t),c}const o=ww();if(o?.isCoinbaseBrowser)return(r=o.setAppInfo)===null||r===void 0||r.call(o,s,i,a,t),o}function xw(e){if(!e||typeof e!="object"||Array.isArray(e))throw B.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 B.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 B.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 B.provider.unsupportedMethod()}}function Ew(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 vc(e){if(typeof e!="function")throw new Error("toAccount is not a function")}const Aw="https://keys.coinbase.com/connect",jl="https://rpc.wallet.coinbase.com",xc="https://www.walletlink.org",Pw="https://go.cb-w.com/walletlink";var H;(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"})(H||(H={}));var q;(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"})(q||(q={}));var V;(function(e){e.low="low",e.high="high"})(V||(V={}));function W(e,t,n){var r,s,i,a;window.ClientAnalytics&&((r=window.ClientAnalytics)===null||r===void 0||r.logEvent(e,Object.assign(Object.assign({},t),{sdkVersion:Nn,appName:(i=(s=R.config.get().metadata)===null||s===void 0?void 0:s.appName)!==null&&i!==void 0?i:"",appOrigin:window.location.origin,appPreferredSigner:(a=R.config.get().preference)===null||a===void 0?void 0:a.options}),n))}const kw=()=>{W("communicator.popup_setup.started",{action:q.unknown,componentType:H.unknown},V.high)},Sw=()=>{W("communicator.popup_setup.completed",{action:q.unknown,componentType:H.unknown},V.high)},Iw=()=>{W("communicator.popup_unload.received",{action:q.unknown,componentType:H.unknown},V.high)},Qa=({snackbarContext:e})=>{W(`snackbar.${e}.shown`,{action:q.render,componentType:H.modal,snackbarContext:e},V.high)},bn=({snackbarContext:e,snackbarAction:t})=>{W(`snackbar.${e}.action_clicked`,{action:q.click,componentType:H.button,snackbarContext:e,snackbarAction:t},V.high)},_w='@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 Dl(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(_w)),document.documentElement.appendChild(e)}function Ul(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=Ul(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Hn(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Ul(e))&&(r&&(r+=" "),r+=t);return r}function Tw(){try{return window.frameElement!==null}catch{return!1}}function Ow(){try{return Tw()&&window.top?window.top.location:window.location}catch{return window.location}}function Cw(){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 Fl(){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 Bw=".-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}",Nw="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",$w="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class zl{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=Fl()}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&&Xs(Z("div",null,Z(Gl,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([t,n])=>Z(Mw,Object.assign({},n,{key:t}))))),this.root)}}const Gl=e=>Z("div",{class:Hn("-cbwsdk-snackbar-container")},Z("style",null,Bw),Z("div",{class:"-cbwsdk-snackbar"},e.children)),Mw=({autoExpand:e,message:t,menuItems:n})=>{const[r,s]=uo(!0),[i,a]=uo(e??!1);f0(()=>{const c=[window.setTimeout(()=>{s(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{a(!i)};return Z("div",{class:Hn("-cbwsdk-snackbar-instance",r&&"-cbwsdk-snackbar-instance-hidden",i&&"-cbwsdk-snackbar-instance-expanded")},Z("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},Z("img",{src:Nw,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",Z("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),Z("div",{class:"-gear-container"},!i&&Z("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Z("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),Z("img",{src:$w,class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&Z("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map((c,u)=>Z("div",{class:Hn("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:u},Z("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Z("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),Z("span",{class:Hn("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))},Hl="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 Lw{constructor(){this.attached=!1,this.snackbar=new zl}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,Dl()}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:Hl,defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]},this.snackbar.presentItem(n)}}const Ec=420,Ac=700,Rw={isRed:!1,info:"Retry",svgWidth:"10",svgHeight:"11",path:Hl,defaultFillRule:"evenodd",defaultClipRule:"evenodd"},jw="Popup was blocked. Try again.";let br=null;function Dw(e){const t=(window.innerWidth-Ec)/2+window.screenX,n=(window.innerHeight-Ac)/2+window.screenY;Fw(e);function r(){const i=`wallet_${crypto.randomUUID()}`,a=window.open(e,i,`width=${Ec}, height=${Ac}, left=${t}, top=${n}`);return a?.focus(),a||null}let s=r();if(!s){const i=Xa();return new Promise((a,o)=>{Qa({snackbarContext:"popup_blocked"}),i.presentItem({autoExpand:!0,message:jw,menuItems:[Object.assign(Object.assign({},Rw),{onClick:()=>{bn({snackbarContext:"popup_blocked",snackbarAction:"confirm"}),s=r(),s?a(s):o(B.rpc.internal("Popup window was blocked")),i.clear()}})]})})}return Promise.resolve(s)}function Uw(e){e&&!e.closed&&e.close()}function Fw(e){const t={sdkName:Sl,sdkVersion:Nn,origin:window.location.origin,coop:yw()};for(const[n,r]of Object.entries(t))e.searchParams.has(n)||e.searchParams.append(n,r.toString())}function Xa(){if(!br){const e=document.createElement("div");e.className="-cbwsdk-css-reset",document.body.appendChild(e),br=new zl,br.attach(e)}return br}class zw{constructor({url:t=Aw,metadata:n,preference:r}){this.popup=null,this.listeners=new Map,this.postMessage=async s=>{(await this.waitForPopupLoaded()).postMessage(s,this.url.origin)},this.postRequestAndWaitForResponse=async s=>{const i=this.onMessage(({requestId:a})=>a===s.id);return this.postMessage(s),await i},this.onMessage=async s=>new Promise((i,a)=>{const o=c=>{if(c.origin!==this.url.origin)return;const u=c.data;s(u)&&(i(u),window.removeEventListener("message",o),this.listeners.delete(o))};window.addEventListener("message",o),this.listeners.set(o,{reject:a})}),this.disconnect=()=>{Uw(this.popup),this.popup=null,this.listeners.forEach(({reject:s},i)=>{s(B.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",i)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(kw(),this.popup=await Dw(this.url),this.onMessage(({event:s})=>s==="PopupUnload").then(()=>{this.disconnect(),Iw()}).catch(()=>{}),this.onMessage(({event:s})=>s==="PopupLoaded").then(s=>{this.postMessage({requestId:s.id,data:{version:Nn,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw B.rpc.internal();return Sw(),this.popup})),this.url=new URL(t),this.metadata=n,this.preference=r}}function ce(e){return e.errorMessage!==void 0}function Gw(e){const t=cw(Hw(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return n.searchParams.set("version",Nn),n.searchParams.set("code",t.code.toString()),n.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:n.href})}function Hw(e){var t;if(typeof e=="string")return{message:e,code:ne.rpc.internal};if(ce(e)){const n=e.errorMessage,r=(t=e.errorCode)!==null&&t!==void 0?t:n.match(/(denied|rejected)/i)?ne.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},e),{message:n,code:r,data:{method:e.method}})}return e}class qw extends N0{}class Zt{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 s=localStorage.key(r);typeof s=="string"&&s.startsWith(t)&&n.push(s)}n.forEach(r=>localStorage.removeItem(r))}scopedKey(t){return`-${this.scope}${this.module?`:${this.module}`:""}:${t}`}static clearAll(){new Zt("CBWSDK").clear(),new Zt("walletlink").clear()}}const Vw=({signerType:e})=>{W("provider.signer.loaded_from_storage",{action:q.measurement,componentType:H.unknown,signerType:e},V.low)},Ww=({method:e,correlationId:t})=>{W("provider.request.started",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t},V.high)},Kw=({method:e,correlationId:t,signerType:n,errorMessage:r})=>{W("provider.request.error",{action:q.error,componentType:H.unknown,method:e,signerType:n,correlationId:t,errorMessage:r},V.high)},Zw=({method:e,signerType:t,correlationId:n})=>{W("provider.request.responded",{action:q.unknown,componentType:H.unknown,method:e,signerType:t,correlationId:n},V.high)},Yw=()=>{W("provider.enable_function.called",{action:q.measurement,componentType:H.unknown},V.high)},Jw=()=>{W("signer.selection.requested",{action:q.unknown,componentType:H.unknown},V.high)},Qw=e=>{W("signer.selection.responded",{action:q.unknown,componentType:H.unknown,signerType:e},V.high)},yr=qa(()=>({correlationIds:new Map})),ze={get:e=>yr.getState().correlationIds.get(e),set:(e,t)=>{yr.setState(n=>{const r=new Map(n.correlationIds);return r.set(e,t),{correlationIds:r}})},delete:e=>{yr.setState(t=>{const n=new Map(t.correlationIds);return n.delete(e),{correlationIds:n}})},clear:()=>{yr.setState({correlationIds:new Map})}},Xw=({method:e,correlationId:t})=>{var n;W("scw_signer.handshake.started",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},e6=({method:e,correlationId:t,errorMessage:n})=>{var r;W("scw_signer.handshake.error",{action:q.error,componentType:H.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=R.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},V.high)},t6=({method:e,correlationId:t})=>{var n;W("scw_signer.handshake.completed",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},n6=({method:e,correlationId:t})=>{var n;W("scw_signer.request.started",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},r6=({method:e,correlationId:t,errorMessage:n})=>{var r;W("scw_signer.request.error",{action:q.error,componentType:H.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=R.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},V.high)},s6=({method:e,correlationId:t})=>{var n;W("scw_signer.request.completed",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},i6=({method:e,correlationId:t})=>{var n;W("scw_sub_account.request.started",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},a6=({method:e,correlationId:t})=>{var n;W("scw_sub_account.request.completed",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},o6=({method:e,correlationId:t,errorMessage:n})=>{var r;W("scw_sub_account.request.error",{action:q.error,componentType:H.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=R.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},V.high)},c6=({method:e,correlationId:t})=>{var n;W("scw_sub_account.add_owner.started",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},u6=({method:e,correlationId:t})=>{var n;W("scw_sub_account.add_owner.completed",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},d6=({method:e,correlationId:t,errorMessage:n})=>{var r;W("scw_sub_account.add_owner.error",{action:q.error,componentType:H.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=R.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},V.high)},l6=({method:e,correlationId:t})=>{var n;W("scw_sub_account.insufficient_balance.error_handling.started",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},f6=({method:e,correlationId:t})=>{var n;W("scw_sub_account.insufficient_balance.error_handling.completed",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=R.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},V.high)},p6=({method:e,correlationId:t,errorMessage:n})=>{var r;W("scw_sub_account.insufficient_balance.error_handling.error",{action:q.error,componentType:H.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=R.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},V.high)},Rt=e=>"message"in e&&typeof e.message=="string"?e.message:"",ql=qa(()=>({}));function Pc(e){e.forEach(t=>{var n,r,s,i,a,o,c,u;if(!t.rpcUrl)return;const d=$0({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:(i=(s=t.nativeCurrency)===null||s===void 0?void 0:s.name)!==null&&i!==void 0?i:"",symbol:(o=(a=t.nativeCurrency)===null||a===void 0?void 0:a.symbol)!==null&&o!==void 0?o:"",decimals:(u=(c=t.nativeCurrency)===null||c===void 0?void 0:c.decimal)!==null&&u!==void 0?u:18}}),l=f1({chain:d,transport:mo(t.rpcUrl)}),p=z1({client:l,transport:mo(t.rpcUrl)});ql.setState({[t.id]:{client:l,bundlerClient:p}})})}function Vl(e){var t;return(t=ql.getState()[e])===null||t===void 0?void 0:t.client}function Te(e,t,n){if(e==null)throw t??B.rpc.invalidParams({message:"value must be present",data:e})}function Tt(e,t){if(!Array.isArray(e))throw B.rpc.invalidParams({message:t??"value must be an array",data:e})}function gr(e){if(typeof e!="object"||e===null)throw B.rpc.internal("sub account info is not an object");if(!("address"in e))throw B.rpc.internal("sub account is invalid");if("address"in e&&typeof e.address=="string"&&!me(e.address))throw B.rpc.internal("sub account address is invalid");if("factory"in e&&typeof e.factory=="string"&&!me(e.factory))throw B.rpc.internal("sub account factory address is invalid");if("factoryData"in e&&typeof e.factoryData=="string"&&!Ie(e.factoryData))throw B.rpc.internal("sub account factory data is invalid")}async function h6(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function m6(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function b6(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 y6(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return new TextDecoder().decode(r)}function Wl(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}async function Kl(e,t){const n=Wl(e),r=await crypto.subtle.exportKey(n,t);return Za(new Uint8Array(r))}async function Zl(e,t){const n=Wl(e),r=_r(t).buffer;return await crypto.subtle.importKey(n,new Uint8Array(r),{name:"ECDH",namedCurve:"P-256"},!0,e==="private"?["deriveKey"]:[])}async function g6(e,t){const n=JSON.stringify(e,(r,s)=>{if(!(s instanceof Error))return s;const i=s;return Object.assign(Object.assign({},i.code?{code:i.code}:{}),{message:i.message})});return b6(t,n)}async function w6(e,t){return JSON.parse(await y6(t,e))}const v6="0.1.1";function x6(){return v6}class ee extends Error{constructor(t,n={}){const r=(()=>{if(n.cause instanceof ee){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})(),s=n.cause instanceof ee&&n.cause.docsPath||n.docsPath,a=`https://oxlib.sh${s??""}`,o=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s?["",r?`Details: ${r}`:void 0,s?`See: ${a}`:void 0]:[]].filter(c=>typeof c=="string").join(`
44
+ `);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,"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@${x6()}`}),this.cause=n.cause,this.details=r,this.docs=a,this.docsPath=s,this.shortMessage=t}walk(t){return Yl(this,t)}}function Yl(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Yl(e.cause,t):t?null:e}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function E6(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function eo(e,...t){if(!E6(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 kc(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 A6(e,t){eo(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function ea(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ws(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Je(e,t){return e<<32-t|e>>>t}function P6(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Jl(e){return typeof e=="string"&&(e=P6(e)),eo(e),e}let k6=class{};function S6(e){const t=r=>e().update(Jl(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function I6(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),a=Number(n>>s&i),o=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,o,r)}function _6(e,t,n){return e&t^~e&n}function T6(e,t,n){return e&t^e&n^t&n}let O6=class extends k6{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=Ws(this.buffer)}update(t){kc(this),t=Jl(t),eo(t);const{view:n,buffer:r,blockLen:s}=this,i=t.length;for(let a=0;a<i;){const o=Math.min(s-this.pos,i-a);if(o===s){const c=Ws(t);for(;s<=i-a;a+=s)this.process(c,a);continue}r.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){kc(this),A6(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:a}=this;n[a++]=128,ea(this.buffer.subarray(a)),this.padOffset>s-a&&(this.process(r,0),a=0);for(let l=a;l<s;l++)n[l]=0;I6(r,s-8,BigInt(this.length*8),i),this.process(r,0);const o=Ws(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)o.setUint32(4*l,d[l],i)}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:s,finished:i,destroyed:a,pos:o}=this;return t.destroyed=a,t.finished=i,t.length=s,t.pos=o,s%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const kt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),C6=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]),St=new Uint32Array(64);let B6=class extends O6{constructor(t=32){super(64,t,8,!1),this.A=kt[0]|0,this.B=kt[1]|0,this.C=kt[2]|0,this.D=kt[3]|0,this.E=kt[4]|0,this.F=kt[5]|0,this.G=kt[6]|0,this.H=kt[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:a,G:o,H:c}=this;return[t,n,r,s,i,a,o,c]}set(t,n,r,s,i,a,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=c|0}process(t,n){for(let l=0;l<16;l++,n+=4)St[l]=t.getUint32(n,!1);for(let l=16;l<64;l++){const p=St[l-15],f=St[l-2],m=Je(p,7)^Je(p,18)^p>>>3,h=Je(f,17)^Je(f,19)^f>>>10;St[l]=h+St[l-7]+m+St[l-16]|0}let{A:r,B:s,C:i,D:a,E:o,F:c,G:u,H:d}=this;for(let l=0;l<64;l++){const p=Je(o,6)^Je(o,11)^Je(o,25),f=d+p+_6(o,c,u)+C6[l]+St[l]|0,h=(Je(r,2)^Je(r,13)^Je(r,22))+T6(r,s,i)|0;d=u,u=c,c=o,o=a+f|0,a=i,i=s,s=r,r=f+h|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(r,s,i,a,o,c,u,d)}roundClean(){ea(St)}destroy(){this.set(0,0,0,0,0,0,0,0),ea(this.buffer)}};const N6=S6(()=>new B6),$6=N6,M6="#__bigint";function xs(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+M6:s,n)}function L6(e,t){if(Pn(e)>t)throw new Q6({givenSize:Pn(e),maxSize:t})}function R6(e,t){if(typeof t=="number"&&t>0&&t>Pn(e)-1)throw new of({offset:t,position:"start",size:Pn(e)})}function j6(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Pn(e)!==n-t)throw new of({offset:n,position:"end",size:Pn(e)})}const ot={zero:48,nine:57,A:65,F:70,a:97,f:102};function Sc(e){if(e>=ot.zero&&e<=ot.nine)return e-ot.zero;if(e>=ot.A&&e<=ot.F)return e-(ot.A-10);if(e>=ot.a&&e<=ot.f)return e-(ot.a-10)}function to(e,t){if(Bt(e)>t)throw new K6({givenSize:Bt(e),maxSize:t})}function D6(e,t){if(typeof t=="number"&&t>0&&t>Bt(e)-1)throw new nf({offset:t,position:"start",size:Bt(e)})}function U6(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Bt(e)!==n-t)throw new nf({offset:n,position:"end",size:Bt(e)})}function Ql(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new Z6({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const F6=new TextEncoder,z6=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function G6(e,t={}){const{strict:n=!1}=t;if(!e)throw new Ic(e);if(typeof e!="string")throw new Ic(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new _c(e);if(!e.startsWith("0x"))throw new _c(e)}function Es(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Xl(e){return e instanceof Uint8Array?An(e):Array.isArray(e)?An(new Uint8Array(e)):e}function An(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=z6[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(to(r,t.size),tf(r,t.size)):r}function Ot(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<a){const u=typeof e=="bigint"?"n":"";throw new W6({max:i?`${i}${u}`:void 0,min:`${a}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?H6(c,r):c}function ef(e,t={}){return An(F6.encode(e),t)}function H6(e,t){return Ql(e,{dir:"left",size:t})}function tf(e,t){return Ql(e,{dir:"right",size:t})}function Le(e,t,n,r={}){const{strict:s}=r;D6(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&U6(i,t,n),i}function Bt(e){return Math.ceil((e.length-2)/2)}function q6(e,t={}){const{signed:n}=t;t.size&&to(e,t.size);const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n)-1n,a=i>>1n;return r<=a?r:r-i-1n}function V6(e,t={}){const{strict:n=!1}=t;try{return G6(e,{strict:n}),!0}catch{return!1}}class W6 extends ee{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*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 Ic extends ee{constructor(t){super(`Value \`${typeof t=="object"?xs(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 _c 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"})}}let K6=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"})}},nf=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"})}};class Z6 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"})}}function Y6(e){if(!(e instanceof Uint8Array)){if(!e)throw new wr(e);if(typeof e!="object")throw new wr(e);if(!("BYTES_PER_ELEMENT"in e))throw new wr(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new wr(e)}}function rf(e){return e instanceof Uint8Array?e:typeof e=="string"?af(e):sf(e)}function sf(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function af(e,t={}){const{size:n}=t;let r=e;n&&(to(e,n),r=tf(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,a=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const u=Sc(s.charCodeAt(c++)),d=Sc(s.charCodeAt(c++));if(u===void 0||d===void 0)throw new ee(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);a[o]=u*16+d}return a}function Pn(e){return e.length}function Tc(e,t,n,r={}){const{strict:s}=r;R6(e,t);const i=e.slice(t,n);return s&&j6(i,t,n),i}function Oc(e,t={}){const{size:n}=t;typeof n<"u"&&L6(e,n);const r=An(e,t);return q6(r,t)}function J6(e){try{return Y6(e),!0}catch{return!1}}class wr extends ee{constructor(t){super(`Value \`${typeof t=="object"?xs(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"})}}class Q6 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"})}}class of 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:"Bytes.SliceOffsetOutOfBoundsError"})}}function cf(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=$6(rf(e));return n==="Bytes"?r:An(r)}function uf(e,t={}){const{compressed:n}=t,{prefix:r,x:s,y:i}=e;if(n===!1||typeof s=="bigint"&&typeof i=="bigint"){if(r!==4)throw new Cc({prefix:r,cause:new r5});return}if(n===!0||typeof s=="bigint"&&typeof i>"u"){if(r!==3&&r!==2)throw new Cc({prefix:r,cause:new n5});return}throw new t5({publicKey:e})}function X6(e){const t=(()=>{if(V6(e))return df(e);if(J6(e))return e5(e);const{prefix:n,x:r,y:s}=e;return typeof r=="bigint"&&typeof s=="bigint"?{prefix:n??4,x:r,y:s}:{prefix:n,x:r}})();return uf(t),t}function e5(e){return df(An(e))}function df(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new s5({publicKey:e});if(e.length===130){const r=BigInt(Le(e,0,32)),s=BigInt(Le(e,32,64));return{prefix:4,x:r,y:s}}if(e.length===132){const r=Number(Le(e,0,1)),s=BigInt(Le(e,1,33)),i=BigInt(Le(e,33,65));return{prefix:r,x:s,y:i}}const t=Number(Le(e,0,1)),n=BigInt(Le(e,1,33));return{prefix:t,x:n}}function no(e,t={}){uf(e);const{prefix:n,x:r,y:s}=e,{includePrefix:i=!0}=t;return Es(i?Ot(n,{size:1}):"0x",Ot(r,{size:32}),typeof s=="bigint"?Ot(s,{size:32}):"0x")}class t5 extends ee{constructor({publicKey:t}){super(`Value \`${xs(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 Cc extends ee{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 n5 extends ee{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 r5 extends ee{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let s5=class extends ee{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 ${Bt(Xl(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const Bc=2n**256n-1n;function i5(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Ks({signature:e});if(typeof e.s>"u")throw new Ks({signature:e});if(n&&typeof e.yParity>"u")throw new Ks({signature:e});if(e.r<0n||e.r>Bc)throw new d5({value:e.r});if(e.s<0n||e.s>Bc)throw new l5({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new ro({value:e.yParity})}function lf(e){if(e.length!==130&&e.length!==132)throw new u5({signature:e});const t=BigInt(Le(e,0,32)),n=BigInt(Le(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return o5(s)}catch{throw new ro({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function a5(e){i5(e);const t=e.r,n=e.s;return Es(Ot(t,{size:32}),Ot(n,{size:32}),typeof e.yParity=="number"?Ot(c5(e.yParity),{size:1}):"0x")}function o5(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 f5({value:e})}function c5(e){if(e===0)return 27;if(e===1)return 28;throw new ro({value:e})}class u5 extends ee{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Bt(Xl(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Ks extends ee{constructor({signature:t}){super(`Signature \`${xs(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class d5 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"})}}class l5 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"})}}class ro 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"})}}class f5 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"})}}const p5=new TextDecoder,vr=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 h5(e,t={}){const{pad:n=!0,url:r=!1}=t,s=new Uint8Array(Math.ceil(e.length/3)*4);for(let c=0,u=0;u<e.length;c+=4,u+=3){const d=(e[u]<<16)+(e[u+1]<<8)+(e[u+2]|0);s[c]=vr[d>>18],s[c+1]=vr[d>>12&63],s[c+2]=vr[d>>6&63],s[c+3]=vr[d&63]}const i=e.length%3,a=Math.floor(e.length/3)*4+(i&&i+1);let o=p5.decode(new Uint8Array(s.buffer,0,a));return n&&i===1&&(o+="=="),n&&i===2&&(o+="="),r&&(o=o.replaceAll("+","-").replaceAll("/","_")),o}function m5(e,t={}){return h5(af(e),t)}Uint8Array.from([105,171,180,181,160,222,75,198,42,42,32,31,141,37,186,233]);function b5(e={}){const{flag:t=5,rpId:n=window.location.hostname,signCount:r=0}=e,s=cf(ef(n)),i=Ot(t,{size:1}),a=Ot(r,{size:4});return Es(s,i,a)}function y5(e){const{challenge:t,crossOrigin:n=!1,extraClientData:r,origin:s=window.location.origin}=e;return JSON.stringify({type:"webauthn.get",challenge:m5(t,{url:!0,pad:!1}),origin:s,crossOrigin:n,...r})}function g5(e){const{challenge:t,crossOrigin:n,extraClientData:r,flag:s,origin:i,rpId:a,signCount:o,userVerification:c="required"}=e,u=b5({flag:s,rpId:a,signCount:o}),d=y5({challenge:t,crossOrigin:n,extraClientData:r,origin:i}),l=cf(ef(d)),p=d.indexOf('"challenge"'),f=d.indexOf('"type"'),m={authenticatorData:u,clientDataJSON:d,challengeIndex:p,typeIndex:f,userVerificationRequired:c==="required"},h=Es(u,l);return{metadata:m,payload:h}}async function w5(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),s=X6(new Uint8Array(r));return{privateKey:n.privateKey,publicKey:s}}async function v5(e){const{payload:t,privateKey:n}=e,r=await globalThis.crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},n,rf(t)),s=sf(new Uint8Array(r)),i=Oc(Tc(s,0,32));let a=Oc(Tc(s,32,64));return a>Zo.CURVE.n/2n&&(a=Zo.CURVE.n-a),{r:i,s:a}}function x5(e,t){const n=typeof indexedDB<"u"?j0(e,t):void 0;return{getItem:async r=>{const s=await D0(r,n);return s||null},removeItem:async r=>U0(r,n),setItem:async(r,s)=>F0(r,s,n)}}const E5="cbwsdk",A5="keys",so="activeId",kn=x5(E5,A5);async function P5(){const e=await w5({extractable:!1}),t=Le(no(e.publicKey),1);return await kn.setItem(t,e),await kn.setItem(so,t),e}async function k5(){const e=await kn.getItem(so);if(!e)return null;const t=await kn.getItem(e);return t||null}async function S5(){const e=await k5();if(!e){const t=await P5(),n=Le(no(t.publicKey),1);return await kn.setItem(n,t),await kn.setItem(so,n),t}return e}async function I5(){const e=await S5(),t=Le(no(e.publicKey),1),n=async r=>{const{payload:s,metadata:i}=g5({challenge:r,origin:"https://keys.coinbase.com",userVerification:"preferred"}),a=await v5({payload:s,privateKey:e.privateKey});return{signature:a5(a),raw:{},webauthn:i}};return{id:t,publicKey:t,async sign({hash:r}){return n(r)},async signMessage({message:r}){return n(bs(r))},async signTypedData(r){return n(dr(r))},type:"webAuthn"}}async function Kr(){return{account:await I5()}}const Nc={storageKey:"ownPrivateKey",keyType:"private"},$c={storageKey:"ownPublicKey",keyType:"public"},Mc={storageKey:"peerPublicKey",keyType:"public"};class _5{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(Mc,t),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,R.keys.clear()}async generateKeyPair(){const t=await h6();this.ownPrivateKey=t.privateKey,this.ownPublicKey=t.publicKey,await this.storeKey(Nc,t.privateKey),await this.storeKey($c,t.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Nc)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey($c)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Mc)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await m6(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(t){const n=R.keys.get(t.storageKey);return n?Zl(t.keyType,n):null}async storeKey(t,n){const r=await Kl(t.keyType,n);R.keys.set(t.storageKey,r)}}function Un(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 ff="0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a",pf="0xf85210B21cC50302F477BA56686d2019dC9b67Ad",He=[{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"}],hf=[{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 Lc(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 T5(e,t){if(!Array.isArray(e.params))throw B.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 Rc(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 B.rpc.invalidParams()}function O5(e){if(!e||!Array.isArray(e)||e.length!==1&&e.length!==2||typeof e[0]!="string"||!me(e[0]))throw B.rpc.invalidParams();if(e.length===2){if(!Array.isArray(e[1]))throw B.rpc.invalidParams();for(const t of e[1])if(typeof t!="string"||!t.startsWith("0x"))throw B.rpc.invalidParams()}}function Zr(e,t){const n=Object.assign({},e);if(t&&e.method.startsWith("wallet_")){let r=Un(n,"params.0.capabilities");if(typeof r>"u"&&(r={}),typeof r!="object")throw B.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 Zs(){var e;const t=(e=R.subAccountsConfig.get())!==null&&e!==void 0?e:{},n={};if(t.enableAutoSubAccounts){const{account:r}=t.toOwnerAccount?await t.toOwnerAccount():await Kr();if(!r)throw B.provider.unauthorized("No owner account found");n.addSubAccount={account:{type:"create",keys:[{type:r.address?"address":"webauthn-p256",publicKey:r.address||r.publicKey}]}}}R.subAccountsConfig.set({capabilities:n})}function C5(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 B.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 B.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 B.rpc.invalidParams("FetchPermissions - Invalid params: params[0].spender must be a hex string");return}throw B.rpc.invalidParams()}}function B5(e){var t,n,r;if(e.params!==void 0)return e;const s=(t=R.getState().account.accounts)===null||t===void 0?void 0:t[0],i=(n=R.getState().account.chain)===null||n===void 0?void 0:n.id,a=(r=R.getState().subAccount)===null||r===void 0?void 0:r.address;if(!s||!a||!i)throw B.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:s,chainId:C(i),spender:a}]}}function N5({spendPermission:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:pf},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 $5({spendPermissionBatch:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:pf},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 mf({client:e,id:t}){var n;const r=await wl(e,{id:t});if(r.status==="success")return(n=r.receipts)===null||n===void 0?void 0:n[0].transactionHash;throw B.rpc.internal("failed to send transaction")}function bf({calls:e,from:t,chainId:n,capabilities:r}){const s=Il.get().paymasterUrls;let i={method:"wallet_sendCalls",params:[{version:"1.0",calls:e,chainId:C(n),from:t,atomicRequired:!0,capabilities:r}]};return s?.[n]&&(i=Zr(i,{paymasterService:{url:s?.[n]}})),i}async function M5(){const e=Xa();return await new Promise(n=>{Qa({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:()=>{bn({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:()=>{bn({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:()=>{bn({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"cancel"}),e.clear(),n("cancel")}}]})})}function L5({errorData:e,sourceAddress:t}){var n;const r=[];for(const[s,{amount:i,sources:a}]of Object.entries((n=e?.required)!==null&&n!==void 0?n:{})){if(a.filter(c=>ie(c.balance)>=ie(i)&&c.address.toLowerCase()===t?.toLowerCase()).length===0)throw new Error("Source address has insufficient balance for a token");r.push({token:s,requiredAmount:ie(i)})}return r}function R5(e){return typeof e=="object"&&e!==null&&"calls"in e}function j5(e){return Array.isArray(e)&&e.length===1&&typeof e[0]=="object"&&e[0]!==null&&"to"in e[0]}function D5(e){return qt(X(Oe(e)),0,16)}function U5({attribution:e,dappOrigin:t}){if(e){if("auto"in e&&e.auto&&t)return D5(t);if("dataSuffix"in e)return e.dataSuffix}}function F5(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 xr(e,t){const n=e.filter(r=>r!==t);return[t,...n]}function Er(e,t){return[...e.filter(r=>r!==t),t]}async function z5(){const e=R.spendPermissions.get(),t=R.subAccounts.get(),n=R.account.get().accounts;return n?{accounts:n?.map(s=>({address:s,capabilities:{subAccounts:t?[t]:void 0,spendPermissions:e.length>0?{permissions:e}:void 0}}))}:null}function G5(e){return e.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function Ar(e){const t=btoa(String.fromCharCode(...new Uint8Array(e)));return G5(t)}function H5({webauthn:e,signature:t,id:n}){const r=lf(t);return{id:n,rawId:Ar(zt(n)),response:{authenticatorData:Ar(je(e.authenticatorData)),clientDataJSON:Ar(zt(e.clientDataJSON)),signature:Ar(q5(r.r,r.s))},type:JSON.parse(e.clientDataJSON).type}}function q5(e,t){const n=je(Ht(C(e))),r=je(Ht(C(t))),s=n.length,i=r.length,a=s+i+4,o=new Uint8Array(a+2);return o[0]=48,o[1]=a,o[2]=2,o[3]=s,o.set(n,4),o[s+4]=2,o[s+5]=i,o.set(r,s+6),o}var V5=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 s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n};async function W5(e){const{owner:t,ownerIndex:n,address:r,client:s,factoryData:i}=e,a={abi:b1,address:y1,version:"0.6"},o={abi:hf,address:ff};return x1({client:s,entryPoint:a,extend:{abi:He,factory:o},async decodeCalls(c){const u=$a({abi:He,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(d=>({to:d.target,value:d.value,data:d.data}));throw new k(`unable to decode calls for "${u.functionName}"`)},async encodeCalls(c){var u,d;return c.length===1?se({abi:He,functionName:"execute",args:[c[0].to,(u=c[0].value)!==null&&u!==void 0?u:BigInt(0),(d=c[0].data)!==null&&d!==void 0?d:"0x"]}):se({abi:He,functionName:"executeBatch",args:[c.map(l=>{var p,f;return{data:(p=l.data)!==null&&p!==void 0?p:"0x",target:l.to,value:(f=l.value)!==null&&f!==void 0?f:BigInt(0)}})]})},async getAddress(){return r},async getFactoryArgs(){return i?{factory:o.address,factoryData:i}:{factory:o.address,factoryData:i}},async getStubSignature(){return t.type==="webAuthn"?"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000":jn({ownerIndex:n,signature:"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"})},async sign(c){const u=await this.getAddress(),d=Ys({address:u,chainId:s.chain.id,hash:c.hash}),l=await Pr({hash:d,owner:t});return jn({ownerIndex:n,signature:l})},async signMessage(c){const{message:u}=c,d=await this.getAddress(),l=Ys({address:d,chainId:s.chain.id,hash:bs(u)}),p=await Pr({hash:l,owner:t});return jn({ownerIndex:n,signature:p})},async signTypedData(c){const{domain:u,types:d,primaryType:l,message:p}=c,f=await this.getAddress(),m=Ys({address:f,chainId:s.chain.id,hash:dr({domain:u,message:p,primaryType:l,types:d})}),h=await Pr({hash:m,owner:t});return jn({ownerIndex:n,signature:h})},async signUserOperation(c){const{chainId:u=s.chain.id}=c,d=V5(c,["chainId"]),l=await this.getAddress(),p=v1({chainId:u,entryPointAddress:a.address,entryPointVersion:a.version,userOperation:Object.assign(Object.assign({},d),{sender:l})}),f=await Pr({hash:p,owner:t});return jn({ownerIndex:n,signature:f})},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 Pr({hash:e,owner:t}){if(t.type==="webAuthn"){const{signature:n,webauthn:r}=await t.sign({hash:e});return K5({signature:n,webauthn:r})}if(t.sign)return t.sign({hash:e});throw new k("`owner` does not support raw sign.")}function Ys({address:e,chainId:t,hash:n}){return dr({domain:{chainId:t,name:"Coinbase Smart Wallet",verifyingContract:e,version:"1"},types:{CoinbaseSmartWalletMessage:[{name:"hash",type:"bytes32"}]},primaryType:"CoinbaseSmartWalletMessage",message:{hash:n}})}function K5({webauthn:e,signature:t}){const{r:n,s:r}=lf(t);return Ce([{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:Vn(e.clientDataJSON),challengeIndex:BigInt(e.challengeIndex),typeIndex:BigInt(e.typeIndex),r:n,s:r}])}function jn(e){const{ownerIndex:t=0}=e,n=(()=>{if(te(e.signature)!==65)return e.signature;const r=p1(e.signature);return pg(["bytes32","bytes32","uint8"],[r.r,r.s,r.yParity===0?27:28])})();return Ce([{components:[{name:"ownerIndex",type:"uint8"},{name:"signatureData",type:"bytes"}],type:"tuple"}],[{ownerIndex:t,signatureData:n}])}async function Z5({address:e,client:t,factory:n,factoryData:r,owner:s,ownerIndex:i,parentAddress:a,attribution:o}){var c;const u={address:e,factory:n,factoryData:r},d=(c=t.chain)===null||c===void 0?void 0:c.id;if(!d)throw B.rpc.internal("chainId not found");const l=await W5({owner:s,ownerIndex:i??1,address:e,client:t,factoryData:r}),p=async f=>{var m,h,y,w,A,g;try{switch(f.method){case"wallet_addSubAccount":return u;case"eth_accounts":return[u.address];case"eth_coinbase":return u.address;case"net_version":return d.toString();case"eth_chainId":return C(d);case"eth_sendTransaction":{Tt(f.params);const b=f.params[0];Te(b.to,B.rpc.invalidParams("to is required"));const x={to:b.to,data:Qi((m=b.data)!==null&&m!==void 0?m:"0x",!0),value:Qi((h=b.value)!==null&&h!==void 0?h:"0x",!0),from:(y=b.from)!==null&&y!==void 0?y:u.address},E=bf({calls:[x],chainId:d,from:x.from}),P=await p(E);return mf({client:t,id:P})}case"wallet_sendCalls":{Tt(f.params);const b=Un(f.params[0],"chainId");if(!b)throw B.rpc.invalidParams("chainId is required");if(!Ie(b))throw B.rpc.invalidParams("chainId must be a hex encoded integer");if(!f.params[0])throw B.rpc.invalidParams("params are required");if(!("calls"in f.params[0]))throw B.rpc.invalidParams("calls are required");let x={method:"wallet_prepareCalls",params:[{version:"1.0",calls:f.params[0].calls,chainId:b,from:u.address,capabilities:"capabilities"in f.params[0]?f.params[0].capabilities:{}}]};a&&(x=Zr(x,{funding:[{type:"spendPermission",data:{autoApply:!0,sources:[a],preference:"PREFER_DIRECT_BALANCE"}}]}));let E=await p(x);const P=await((A=(w=s).sign)===null||A===void 0?void 0:A.call(w,{hash:bo(E.signatureRequest.hash)}));let O;if(!P)throw B.rpc.internal("signature not found");return Ie(P)?O={type:"secp256k1",data:{address:s.address,signature:P}}:O={type:"webauthn",data:{signature:JSON.stringify(H5(Object.assign({id:(g=s.id)!==null&&g!==void 0?g:"1"},P))),publicKey:s.publicKey}},(await p({method:"wallet_sendPreparedCalls",params:[{version:"1.0",type:E.type,data:E.userOp,chainId:E.chainId,signature:O}]}))[0]}case"wallet_sendPreparedCalls":{Tt(f.params);const b=Un(f.params[0],"chainId");if(!b)throw B.rpc.invalidParams("chainId is required");if(!Ie(b))throw B.rpc.invalidParams("chainId must be a hex encoded integer");return await t.request({method:"wallet_sendPreparedCalls",params:f.params})}case"wallet_prepareCalls":{Tt(f.params);const b=Un(f.params[0],"chainId");if(!b)throw B.rpc.invalidParams("chainId is required");if(!Ie(b))throw B.rpc.invalidParams("chainId must be a hex encoded integer");if(!f.params[0])throw B.rpc.invalidParams("params are required");if(!Un(f.params[0],"calls"))throw B.rpc.invalidParams("calls are required");const x=f.params[0];return o&&x.capabilities&&!("attribution"in x.capabilities)&&(x.capabilities.attribution=o),await t.request({method:"wallet_prepareCalls",params:[Object.assign(Object.assign({},f.params[0]),{chainId:b})]})}case"personal_sign":{if(Tt(f.params),!Ie(f.params[0]))throw B.rpc.invalidParams("message must be a hex encoded string");const b=bo(f.params[0]);return l.signMessage({message:b})}case"eth_signTypedData_v4":{Tt(f.params);const b=typeof f.params[1]=="string"?JSON.parse(f.params[1]):f.params[1];return l.signTypedData(b)}case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"wallet_addEthereumChain":case"wallet_switchEthereumChain":default:throw B.rpc.methodNotSupported()}}catch(b){if(Bl(b)){const x=dw(b);if(x)throw x}throw b}};return{request:p}}async function yf({address:e,client:t,publicKey:n,factory:r,factoryData:s}){if(!await Jn(t,{address:e})&&r&&s){if(Or(r)!==Or(ff))throw B.rpc.internal("unknown factory address");const o=$a({abi:hf,data:s});if(o.functionName!=="createAccount")throw B.rpc.internal("unknown factory function");const[c]=o.args;return c.findIndex(u=>u.toLowerCase()===jc(n).toLowerCase())}const a=await Pe(t,{address:e,abi:He,functionName:"ownerCount"});for(let o=Number(a)-1;o>=0;o--){const c=await Pe(t,{address:e,abi:He,functionName:"ownerAtIndex",args:[BigInt(o)]}),u=jc(n);if(c.toLowerCase()===u.toLowerCase())return o}return-1}function jc(e){return me(e)?ve(e):e}async function Y5(){const e=Xa();return new Promise(t=>{Qa({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:()=>{bn({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:()=>{bn({snackbarContext:"sub_account_add_owner",snackbarAction:"cancel"}),e.clear(),t("cancel")}}]})})}async function J5({ownerAccount:e,globalAccountRequest:t}){var n,r;const s=R.account.get(),i=R.subAccounts.get(),a=(n=s.accounts)===null||n===void 0?void 0:n.find(m=>m.toLowerCase()!==i?.address.toLowerCase());Te(a,B.provider.unauthorized("no global account")),Te((r=s.chain)===null||r===void 0?void 0:r.id,B.provider.unauthorized("no chain id")),Te(i?.address,B.provider.unauthorized("no sub account"));const o=[];if(e.type==="local"&&e.address&&o.push({to:i.address,data:se({abi:He,functionName:"addOwnerAddress",args:[e.address]}),value:Oe(0)}),e.publicKey){const[m,h]=Yt([{type:"bytes32"},{type:"bytes32"}],e.publicKey);o.push({to:i.address,data:se({abi:He,functionName:"addOwnerPublicKey",args:[m,h]}),value:Oe(0)})}const c={method:"wallet_sendCalls",params:[{version:"1",calls:o,chainId:C(84532),from:a}]};if(await Y5()==="cancel")throw B.provider.unauthorized("user cancelled");const d=await t(c),l=Vl(s.chain.id);if(Te(l,B.rpc.internal(`client not found for chainId ${s.chain.id}`)),(await wl(l,{id:d})).status!=="success")throw B.rpc.internal("add owner call failed");const f=await yf({address:i.address,publicKey:e.type==="local"&&e.address?e.address:e.publicKey,client:l});if(f===-1)throw B.rpc.internal("failed to find owner index");return f}async function Q5({errorData:e,globalAccountAddress:t,subAccountAddress:n,client:r,request:s,subAccountRequest:i,globalAccountRequest:a}){var o;const c=(o=r.chain)===null||o===void 0?void 0:o.id;Te(c,B.rpc.internal("invalid chainId"));const u=L5({errorData:e,sourceAddress:t}),d=await M5();if(d==="cancel")throw new Error("User cancelled funding");let l;const p=60*60*24,f=3;if(d==="update_permission"){if(u.length===1){const g=u[0],b=N5({spendPermission:{token:g.token,allowance:C(g.requiredAmount*BigInt(f)),period:p,account:t,spender:n,start:0,end:0xffffffffffff,salt:C(BigInt(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),extraData:"0x"},chainId:c});l={method:"eth_signTypedData_v4",params:[t,b]}}else{const g=$5({spendPermissionBatch:{account:t,period:p,start:0,end:0xffffffffffff,permissions:u.map(b=>({token:b.token,allowance:C(b.requiredAmount*BigInt(f)),period:p,account:t,spender:n,salt:"0x0",extraData:"0x"}))},chainId:c});l={method:"eth_signTypedData_v4",params:[t,g]}}try{await a(l)}catch(g){throw console.error(g),new Error("User denied spend permission request")}return i(s)}const m=u.map(g=>g.token.toLowerCase()==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".toLowerCase()?{to:n,value:C(g.requiredAmount),data:"0x"}:{to:g.token,value:"0x0",data:se({abi:ty,functionName:"transfer",args:[n,g.requiredAmount]})});let h;if(s.method==="wallet_sendCalls"&&R5(s.params))h=s.params[0];else if(s.method==="eth_sendTransaction"&&j5(s.params))h=bf({calls:[s.params[0]],chainId:c,from:s.params[0].from}).params[0];else throw new Error("Could not get original call");const y=se({abi:He,functionName:"executeBatch",args:[h.calls.map(g=>{var b,x;return{target:g.to,value:ie((b=g.value)!==null&&b!==void 0?b:"0x0"),data:(x=g.data)!==null&&x!==void 0?x:"0x"}})]}),w=[...m,{data:y,to:n,value:"0x0"}],A=await a({method:"wallet_sendCalls",params:[Object.assign(Object.assign({},h),{calls:w,from:t})]});return s.method==="eth_sendTransaction"?mf({client:r,id:A}):A}class gf{constructor(t){var n,r,s,i;this.communicator=t.communicator,this.callback=t.callback,this.keyManager=new _5;const{account:a,chains:o}=R.getState();this.accounts=(n=a.accounts)!==null&&n!==void 0?n:[],this.chain=(r=a.chain)!==null&&r!==void 0?r:{id:(i=(s=t.metadata.appChainIds)===null||s===void 0?void 0:s[0])!==null&&i!==void 0?i:1},o&&Pc(o)}async handshake(t){var n,r,s;const i=ze.get(t);Xw({method:t.method,correlationId:i});try{await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const a=await this.createRequestMessage({handshake:{method:t.method,params:(s=t.params)!==null&&s!==void 0?s:[]}},i),o=await this.communicator.postRequestAndWaitForResponse(a);if("failure"in o.content)throw o.content.failure;const c=await Zl("public",o.sender);await this.keyManager.setPeerPublicKey(c);const u=await this.decryptResponseMessage(o);this.handleResponse(t,u),t6({method:t.method,correlationId:i})}catch(a){throw e6({method:t.method,correlationId:i,errorMessage:Rt(a)}),a}}async request(t){const n=ze.get(t);n6({method:t.method,correlationId:n});try{const r=await this._request(t);return s6({method:t.method,correlationId:n}),r}catch(r){throw r6({method:t.method,correlationId:n,errorMessage:Rt(r)}),r}}async _request(t){var n,r,s,i,a,o,c,u,d,l,p,f,m,h;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 Zs(),await this.request({method:"wallet_connect",params:[{version:"1",capabilities:Object.assign({},(i=(s=R.subAccountsConfig.get())===null||s===void 0?void 0:s.capabilities)!==null&&i!==void 0?i:{})}]}),this.accounts;case"wallet_switchEthereumChain":{Rc(t.params),this.chain.id=Number(t.params[0].chainId);return}case"wallet_connect":{await((o=(a=this.communicator).waitForPopupLoaded)===null||o===void 0?void 0:o.call(a)),await Zs();let y={};F5(t,"addSubAccount")&&(y=(u=(c=R.subAccountsConfig.get())===null||c===void 0?void 0:c.capabilities)!==null&&u!==void 0?u:{});const w=Zr(t,y);return this.sendRequestToPopup(w)}case"wallet_sendCalls":case"wallet_sign":return this.sendRequestToPopup(t);default:throw B.provider.unauthorized()}if(this.shouldRequestUseSubAccountSigner(t)){const y=ze.get(t);i6({method:t.method,correlationId:y});try{const w=await this.sendRequestToSubAccountSigner(t);return a6({method:t.method,correlationId:y}),w}catch(w){throw o6({method:t.method,correlationId:y,errorMessage:Rt(w)}),w}}switch(t.method){case"eth_requestAccounts":case"eth_accounts":{const y=R.subAccounts.get(),w=R.subAccountsConfig.get();return y?.address&&(this.accounts=w?.enableAutoSubAccounts?xr(this.accounts,y.address):Er(this.accounts,y.address)),(d=this.callback)===null||d===void 0||d.call(this,"connect",{chainId:C(this.chain.id)}),this.accounts}case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return C(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 y=await z5();if(y)return y;await((p=(l=this.communicator).waitForPopupLoaded)===null||p===void 0?void 0:p.call(l)),await Zs();const w=R.subAccountsConfig.get(),A=Zr(t,(f=w?.capabilities)!==null&&f!==void 0?f:{});return(m=this.callback)===null||m===void 0||m.call(this,"connect",{chainId:C(this.chain.id)}),this.sendRequestToPopup(A)}case"wallet_getSubAccounts":{const y=R.subAccounts.get();if(y?.address)return{subAccounts:[y]};if(!this.chain.rpcUrl)throw B.rpc.internal("No RPC URL set for chain");const w=await Gn(t,this.chain.rpcUrl);if(Tt(w.subAccounts,"subAccounts"),w.subAccounts.length>0){gr(w.subAccounts[0]);const A=w.subAccounts[0];R.subAccounts.set({address:A.address,factory:A.factory,factoryData:A.factoryData})}return w}case"wallet_addSubAccount":return this.addSubAccount(t);case"coinbase_fetchPermissions":{C5(t);const y=B5(t),w=await Gn(y,jl),A=Ae((h=y.params)===null||h===void 0?void 0:h[0].chainId);return R.spendPermissions.set(w.permissions.map(g=>Object.assign(Object.assign({},g),{chainId:A}))),w}default:if(!this.chain.rpcUrl)throw B.rpc.internal("No RPC URL set for chain");return Gn(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 s=await this.sendEncryptedRequest(t),i=await this.decryptResponseMessage(s);return this.handleResponse(t,i)}async handleResponse(t,n){var r,s,i,a,o;const c=n.result;if("error"in c)throw c.error;switch(t.method){case"eth_requestAccounts":{const u=c.value;this.accounts=u,R.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,d=u.accounts.map(w=>w.address);this.accounts=d,R.account.set({accounts:d});const l=u.accounts.at(0),p=l?.capabilities;if(p?.subAccounts){const w=p?.subAccounts;Tt(w,"subAccounts"),gr(w[0]),R.subAccounts.set({address:w[0].address,factory:w[0].factory,factoryData:w[0].factoryData})}let f=[this.accounts[0]];const m=R.subAccounts.get(),h=R.subAccountsConfig.get();m?.address&&(this.accounts=h?.enableAutoSubAccounts?xr(this.accounts,m.address):Er(this.accounts,m.address));const y=(i=(s=u?.accounts)===null||s===void 0?void 0:s[0].capabilities)===null||i===void 0?void 0:i.spendPermissions;y&&"permissions"in y&&R.spendPermissions.set(y?.permissions),(a=this.callback)===null||a===void 0||a.call(this,"accountsChanged",f);break}case"wallet_addSubAccount":{gr(c.value);const u=c.value;R.subAccounts.set(u);const d=R.subAccountsConfig.get();this.accounts=d?.enableAutoSubAccounts?xr(this.accounts,u.address):Er(this.accounts,u.address),(o=this.callback)===null||o===void 0||o.call(this,"accountsChanged",this.accounts);break}}return c.value}async cleanup(){var t,n;const r=R.config.get().metadata;await this.keyManager.clear(),R.account.clear(),R.subAccounts.clear(),R.spendPermissions.clear(),R.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){Rc(t.params);const n=zn(t.params[0].chainId);if(this.updateChain(n))return null;const s=await this.sendRequestToPopup(t);return s===null&&this.updateChain(n),s}async handleGetCapabilitiesRequest(t){O5(t.params);const n=t.params[0],r=t.params[1];if(!this.accounts.some(o=>Cn(o,n)))throw B.provider.unauthorized("no active account found when getting capabilities");const s=R.getState().account.capabilities;if(!s)return{};if(!r||r.length===0)return s;const i=new Set(r.map(o=>Ae(o)));return Object.fromEntries(Object.entries(s).filter(([o])=>{try{const c=Ae(o);return i.has(c)}catch{return!1}}))}async sendEncryptedRequest(t){const n=await this.keyManager.getSharedSecret();if(!n)throw B.provider.unauthorized("No shared secret found when encrypting request");const r=await g6({action:t,chainId:this.chain.id},n),s=ze.get(t),i=await this.createRequestMessage({encrypted:r},s);return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(t,n){const r=await Kl("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),correlationId:n,sender:r,content:t,timestamp:new Date}}async decryptResponseMessage(t){var n,r,s;const i=t.content;if("failure"in i)throw i.failure;const a=await this.keyManager.getSharedSecret();if(!a)throw B.provider.unauthorized("Invalid session: no shared secret found when decrypting response");const o=await w6(i.encrypted,a),c=(n=o.data)===null||n===void 0?void 0:n.chains;if(c){const d=(r=o.data)===null||r===void 0?void 0:r.nativeCurrencies,l=Object.entries(c).map(([p,f])=>{const m=d?.[Number(p)];return Object.assign({id:Number(p),rpcUrl:f},m?{nativeCurrency:m}:{})});R.chains.set(l),this.updateChain(this.chain.id,l),Pc(l)}const u=(s=o.data)===null||s===void 0?void 0:s.capabilities;return u&&R.account.set({capabilities:u}),o}updateChain(t,n){var r;const s=R.getState(),i=n??s.chains,a=i?.find(o=>o.id===t);return a?(a!==this.chain&&(this.chain=a,R.account.set({chain:a}),(r=this.callback)===null||r===void 0||r.call(this,"chainChanged",fn(a.id))),!0):!1}async addSubAccount(t){var n,r,s,i;const o=R.getState().subAccount,c=R.subAccountsConfig.get();if(o?.address)return this.accounts=c?.enableAutoSubAccounts?xr(this.accounts,o.address):Er(this.accounts,o.address),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",this.accounts),o;if(await((s=(r=this.communicator).waitForPopupLoaded)===null||s===void 0?void 0:s.call(r)),Array.isArray(t.params)&&t.params.length>0&&t.params[0].account&&t.params[0].account.type==="create"){let d;if(t.params[0].account.keys&&t.params[0].account.keys.length>0)d=t.params[0].account.keys;else{const l=(i=R.subAccountsConfig.get())!==null&&i!==void 0?i:{},{account:p}=l.toOwnerAccount?await l.toOwnerAccount():await Kr();if(!p)throw B.provider.unauthorized("could not get subaccount owner account when adding sub account");d=[{type:p.address?"address":"webauthn-p256",publicKey:p.address||p.publicKey}]}t.params[0].account.keys=d}const u=await this.sendRequestToPopup(t);return gr(u),u}shouldRequestUseSubAccountSigner(t){const n=Lc(t),r=R.subAccounts.get();return n?n.toLowerCase()===r?.address.toLowerCase():!1}async sendRequestToSubAccountSigner(t){var n;const r=R.subAccounts.get(),s=R.subAccountsConfig.get(),i=R.config.get();Te(r?.address,B.provider.unauthorized("no active sub account when sending request to sub account signer"));const a=s?.toOwnerAccount?await s.toOwnerAccount():await Kr();Te(a?.account,B.provider.unauthorized("no active sub account owner when sending request to sub account signer")),Lc(t)===void 0&&(t=T5(t,r.address));const c=Vl(this.chain.id);Te(c,B.rpc.internal(`client not found for chainId ${this.chain.id} when sending request to sub account signer`));const u=this.accounts.find(m=>m.toLowerCase()!==r.address.toLowerCase());Te(u,B.provider.unauthorized("no global account found when sending request to sub account signer"));const d=U5({attribution:(n=i.preference)===null||n===void 0?void 0:n.attribution,dappOrigin:window.location.origin}),l=a.account.type==="local"?a.account.address:a.account.publicKey;let p=await yf({address:r.address,factory:r.factory,factoryData:r.factoryData,publicKey:l,client:c});if(p===-1){const m=ze.get(t);c6({method:t.method,correlationId:m});try{p=await J5({ownerAccount:a.account,globalAccountRequest:this.sendRequestToPopup.bind(this)}),u6({method:t.method,correlationId:m})}catch(h){return d6({method:t.method,correlationId:m,errorMessage:Rt(h)}),B.provider.unauthorized("failed to add sub account owner when sending request to sub account signer")}}const{request:f}=await Z5({address:r.address,owner:a.account,client:c,factory:r.factory,factoryData:r.factoryData,parentAddress:u,attribution:d?{suffix:d}:void 0,ownerIndex:p});try{return await f(t)}catch(m){let h;if(Bl(m))h=JSON.parse(m.details);else if(wc(m))h=m;else throw m;if(!(wc(h)&&h.data)||!h.data)throw m;const y=ze.get(t);l6({method:t.method,correlationId:y});try{const w=await Q5({errorData:h.data,globalAccountAddress:u,subAccountAddress:r.address,client:c,request:t,subAccountRequest:f,globalAccountRequest:this.request.bind(this)});return f6({method:t.method,correlationId:y}),w}catch(w){throw console.error(w),p6({method:t.method,correlationId:y,errorMessage:Rt(w)}),m}}}}const X5=({method:e,correlationId:t})=>{W("walletlink_signer.handshake.started",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t},V.high)},ev=({method:e,correlationId:t,errorMessage:n})=>{W("walletlink_signer.handshake.error",{action:q.error,componentType:H.unknown,method:e,correlationId:t,errorMessage:n},V.high)},tv=({method:e,correlationId:t})=>{W("walletlink_signer.handshake.completed",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t},V.high)},nv=({method:e,correlationId:t})=>{W("walletlink_signer.request.started",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t},V.high)},rv=({method:e,correlationId:t,errorMessage:n})=>{W("walletlink_signer.request.error",{action:q.error,componentType:H.unknown,method:e,correlationId:t,errorMessage:n},V.high)},sv=({method:e,correlationId:t})=>{W("walletlink_signer.request.completed",{action:q.unknown,componentType:H.unknown,method:e,correlationId:t},V.high)},Dc=()=>{W("walletlink_signer.walletlink_connection.connection_failed",{action:q.measurement,componentType:H.unknown},V.high)},iv=()=>{W("walletlink_signer.walletlink_connection.fetch_unseen_events_failed",{action:q.measurement,componentType:H.unknown},V.high)};var Q={},oe={};Object.defineProperty(oe,"__esModule",{value:!0});oe.output=oe.exists=oe.hash=oe.bytes=oe.bool=oe.number=oe.isBytes=void 0;function Yr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}oe.number=Yr;function wf(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}oe.bool=wf;function vf(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}oe.isBytes=vf;function io(e,...t){if(!vf(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}`)}oe.bytes=io;function xf(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Yr(e.outputLen),Yr(e.blockLen)}oe.hash=xf;function Ef(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")}oe.exists=Ef;function Af(e,t){io(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}oe.output=Af;const av={number:Yr,bool:wf,bytes:io,hash:xf,exists:Ef,output:Af};oe.default=av;var z={};Object.defineProperty(z,"__esModule",{value:!0});z.add5L=z.add5H=z.add4H=z.add4L=z.add3H=z.add3L=z.add=z.rotlBL=z.rotlBH=z.rotlSL=z.rotlSH=z.rotr32L=z.rotr32H=z.rotrBL=z.rotrBH=z.rotrSL=z.rotrSH=z.shrSL=z.shrSH=z.toBig=z.split=z.fromBig=void 0;const kr=BigInt(2**32-1),ta=BigInt(32);function ao(e,t=!1){return t?{h:Number(e&kr),l:Number(e>>ta&kr)}:{h:Number(e>>ta&kr)|0,l:Number(e&kr)|0}}z.fromBig=ao;function Pf(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:a}=ao(e[s],t);[n[s],r[s]]=[i,a]}return[n,r]}z.split=Pf;const kf=(e,t)=>BigInt(e>>>0)<<ta|BigInt(t>>>0);z.toBig=kf;const Sf=(e,t,n)=>e>>>n;z.shrSH=Sf;const If=(e,t,n)=>e<<32-n|t>>>n;z.shrSL=If;const _f=(e,t,n)=>e>>>n|t<<32-n;z.rotrSH=_f;const Tf=(e,t,n)=>e<<32-n|t>>>n;z.rotrSL=Tf;const Of=(e,t,n)=>e<<64-n|t>>>n-32;z.rotrBH=Of;const Cf=(e,t,n)=>e>>>n-32|t<<64-n;z.rotrBL=Cf;const Bf=(e,t)=>t;z.rotr32H=Bf;const Nf=(e,t)=>e;z.rotr32L=Nf;const $f=(e,t,n)=>e<<n|t>>>32-n;z.rotlSH=$f;const Mf=(e,t,n)=>t<<n|e>>>32-n;z.rotlSL=Mf;const Lf=(e,t,n)=>t<<n-32|e>>>64-n;z.rotlBH=Lf;const Rf=(e,t,n)=>e<<n-32|t>>>64-n;z.rotlBL=Rf;function jf(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}z.add=jf;const Df=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);z.add3L=Df;const Uf=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;z.add3H=Uf;const Ff=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);z.add4L=Ff;const zf=(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0;z.add4H=zf;const Gf=(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0);z.add5L=Gf;const Hf=(e,t,n,r,s,i)=>t+n+r+s+i+(e/2**32|0)|0;z.add5H=Hf;const ov={fromBig:ao,split:Pf,toBig:kf,shrSH:Sf,shrSL:If,rotrSH:_f,rotrSL:Tf,rotrBH:Of,rotrBL:Cf,rotr32H:Bf,rotr32L:Nf,rotlSH:$f,rotlSL:Mf,rotlBH:Lf,rotlBL:Rf,add:jf,add3L:Df,add3H:Uf,add4L:Ff,add4H:zf,add5H:Hf,add5L:Gf};z.default=ov;var qf={},As={};Object.defineProperty(As,"__esModule",{value:!0});As.crypto=void 0;As.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=As,n=oe;function r(v){return v instanceof Uint8Array||v!=null&&typeof v=="object"&&v.constructor.name==="Uint8Array"}e.isBytes=r;const s=v=>new Uint8Array(v.buffer,v.byteOffset,v.byteLength);e.u8=s;const i=v=>new Uint32Array(v.buffer,v.byteOffset,Math.floor(v.byteLength/4));e.u32=i;const a=v=>new DataView(v.buffer,v.byteOffset,v.byteLength);e.createView=a;const o=(v,I)=>v<<32-I|v>>>I;e.rotr=o;const c=(v,I)=>v<<I|v>>>32-I>>>0;e.rotl=c,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const u=v=>v<<24&4278190080|v<<8&16711680|v>>>8&65280|v>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?v=>v:v=>(0,e.byteSwap)(v);function d(v){for(let I=0;I<v.length;I++)v[I]=(0,e.byteSwap)(v[I])}e.byteSwap32=d;const l=Array.from({length:256},(v,I)=>I.toString(16).padStart(2,"0"));function p(v){(0,n.bytes)(v);let I="";for(let U=0;U<v.length;U++)I+=l[v[U]];return I}e.bytesToHex=p;const f={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function m(v){if(v>=f._0&&v<=f._9)return v-f._0;if(v>=f._A&&v<=f._F)return v-(f._A-10);if(v>=f._a&&v<=f._f)return v-(f._a-10)}function h(v){if(typeof v!="string")throw new Error("hex string expected, got "+typeof v);const I=v.length,U=I/2;if(I%2)throw new Error("padded hex string expected, got unpadded hex of length "+I);const S=new Uint8Array(U);for(let T=0,L=0;T<U;T++,L+=2){const N=m(v.charCodeAt(L)),D=m(v.charCodeAt(L+1));if(N===void 0||D===void 0){const F=v[L]+v[L+1];throw new Error('hex string expected, got non-hex character "'+F+'" at index '+L)}S[T]=N*16+D}return S}e.hexToBytes=h;const y=async()=>{};e.nextTick=y;async function w(v,I,U){let S=Date.now();for(let T=0;T<v;T++){U(T);const L=Date.now()-S;L>=0&&L<I||(await(0,e.nextTick)(),S+=L)}}e.asyncLoop=w;function A(v){if(typeof v!="string")throw new Error(`utf8ToBytes expected string, got ${typeof v}`);return new Uint8Array(new TextEncoder().encode(v))}e.utf8ToBytes=A;function g(v){return typeof v=="string"&&(v=A(v)),(0,n.bytes)(v),v}e.toBytes=g;function b(...v){let I=0;for(let S=0;S<v.length;S++){const T=v[S];(0,n.bytes)(T),I+=T.length}const U=new Uint8Array(I);for(let S=0,T=0;S<v.length;S++){const L=v[S];U.set(L,T),T+=L.length}return U}e.concatBytes=b;class x{clone(){return this._cloneInto()}}e.Hash=x;const E={}.toString;function P(v,I){if(I!==void 0&&E.call(I)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(v,I)}e.checkOpts=P;function O(v){const I=S=>v().update(g(S)).digest(),U=v();return I.outputLen=U.outputLen,I.blockLen=U.blockLen,I.create=()=>v(),I}e.wrapConstructor=O;function M(v){const I=(S,T)=>v(T).update(g(S)).digest(),U=v({});return I.outputLen=U.outputLen,I.blockLen=U.blockLen,I.create=S=>v(S),I}e.wrapConstructorWithOpts=M;function _(v){const I=(S,T)=>v(T).update(g(S)).digest(),U=v({});return I.outputLen=U.outputLen,I.blockLen=U.blockLen,I.create=S=>v(S),I}e.wrapXOFConstructorWithOpts=_;function $(v=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(v));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=$})(qf);Object.defineProperty(Q,"__esModule",{value:!0});Q.shake256=Q.shake128=Q.keccak_512=Q.keccak_384=Q.keccak_256=Q.keccak_224=Q.sha3_512=Q.sha3_384=Q.sha3_256=Q.sha3_224=Q.Keccak=Q.keccakP=void 0;const cn=oe,Xn=z,ut=qf,Vf=[],Wf=[],Kf=[],cv=BigInt(0),Dn=BigInt(1),uv=BigInt(2),dv=BigInt(7),lv=BigInt(256),fv=BigInt(113);for(let e=0,t=Dn,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Vf.push(2*(5*r+n)),Wf.push((e+1)*(e+2)/2%64);let s=cv;for(let i=0;i<7;i++)t=(t<<Dn^(t>>dv)*fv)%lv,t&uv&&(s^=Dn<<(Dn<<BigInt(i))-Dn);Kf.push(s)}const[pv,hv]=(0,Xn.split)(Kf,!0),Uc=(e,t,n)=>n>32?(0,Xn.rotlBH)(e,t,n):(0,Xn.rotlSH)(e,t,n),Fc=(e,t,n)=>n>32?(0,Xn.rotlBL)(e,t,n):(0,Xn.rotlSL)(e,t,n);function Zf(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let a=0;a<10;a++)n[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,c=(a+2)%10,u=n[c],d=n[c+1],l=Uc(u,d,1)^n[o],p=Fc(u,d,1)^n[o+1];for(let f=0;f<50;f+=10)e[a+f]^=l,e[a+f+1]^=p}let s=e[2],i=e[3];for(let a=0;a<24;a++){const o=Wf[a],c=Uc(s,i,o),u=Fc(s,i,o),d=Vf[a];s=e[d],i=e[d+1],e[d]=c,e[d+1]=u}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)n[o]=e[a+o];for(let o=0;o<10;o++)e[a+o]^=~n[(o+2)%10]&n[(o+4)%10]}e[0]^=pv[r],e[1]^=hv[r]}n.fill(0)}Q.keccakP=Zf;class lr extends ut.Hash{constructor(t,n,r,s=!1,i=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,cn.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,ut.u32)(this.state)}keccak(){ut.isLE||(0,ut.byteSwap32)(this.state32),Zf(this.state32,this.rounds),ut.isLE||(0,ut.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,cn.exists)(this);const{blockLen:n,state:r}=this;t=(0,ut.toBytes)(t);const s=t.length;for(let i=0;i<s;){const a=Math.min(n-this.pos,s-i);for(let o=0;o<a;o++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,n&128&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){(0,cn.exists)(this,!1),(0,cn.bytes)(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const a=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+a),s),this.posOut+=a,s+=a}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,cn.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,cn.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:s,rounds:i,enableXOF:a}=this;return t||(t=new lr(n,r,s,a,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=a,t.destroyed=this.destroyed,t}}Q.Keccak=lr;const Nt=(e,t,n)=>(0,ut.wrapConstructor)(()=>new lr(t,e,n));Q.sha3_224=Nt(6,144,224/8);Q.sha3_256=Nt(6,136,256/8);Q.sha3_384=Nt(6,104,384/8);Q.sha3_512=Nt(6,72,512/8);Q.keccak_224=Nt(1,144,224/8);Q.keccak_256=Nt(1,136,256/8);Q.keccak_384=Nt(1,104,384/8);Q.keccak_512=Nt(1,72,512/8);const Yf=(e,t,n)=>(0,ut.wrapXOFConstructorWithOpts)((r={})=>new lr(t,e,r.dkLen===void 0?n:r.dkLen,!0));Q.shake128=Yf(31,168,128/8);Q.shake256=Yf(31,136,256/8);const{keccak_256:mv}=Q;function Jf(e){return Y.allocUnsafe(e).fill(0)}function bv(e){return`0x${e.toString(16)}`}function yv(e){const t=bv(e);return new Y(e0(t.slice(2)),"hex")}function gv(e){return e.toString(2).length}function Qf(e,t){let n=e.toString(16);n.length%2!==0&&(n="0"+n);const r=n.match(/.{1,2}/g).map(s=>parseInt(s,16));for(;r.length<t;)r.unshift(0);return Y.from(r)}function wv(e,t){const n=e<0n;let r;if(n){const s=(1n<<BigInt(t))-1n;r=(~e&s)+1n}else r=e;return r&=(1n<<BigInt(t))-1n,r}function Xf(e,t,n){const r=Jf(t);return e=Ps(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 vv(e,t){return Xf(e,t,!0)}function Ps(e){if(!Y.isBuffer(e))if(Array.isArray(e))e=Y.from(e);else if(typeof e=="string")t0(e)?e=Y.from(e0(n0(e)),"hex"):e=Y.from(e);else if(typeof e=="number")e=yv(e);else if(e==null)e=Y.allocUnsafe(0);else if(typeof e=="bigint")e=Qf(e);else if(e.toArray)e=Y.from(e.toArray());else throw new Error("invalid type");return e}function xv(e){return e=Ps(e),"0x"+e.toString("hex")}function Ev(e,t){if(e=Ps(e),t||(t=256),t!==256)throw new Error("unsupported");return Y.from(mv(new Uint8Array(e)))}function e0(e){return e.length%2?"0"+e:e}function t0(e){return typeof e=="string"&&e.match(/^0x[0-9A-Fa-f]*$/)}function n0(e){return typeof e=="string"&&e.startsWith("0x")?e.slice(2):e}var r0={zeros:Jf,setLength:Xf,setLengthRight:vv,isHexString:t0,stripHexPrefix:n0,toBuffer:Ps,bufferToHex:xv,keccak:Ev,bitLengthFromBigInt:gv,bufferBEFromBigInt:Qf,twosFromBigInt:wv};const be=r0;function s0(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 yn(e){return Number.parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function zc(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[Number.parseInt(t[1],10),Number.parseInt(t[2],10)]}function i0(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?t[2]===""?"dynamic":Number.parseInt(t[2],10):null}function jt(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 Xe(e,t){var n,r,s,i;if(e==="address")return Xe("uint160",jt(t));if(e==="bool")return Xe("uint8",t?1:0);if(e==="string")return Xe("bytes",new Y(t,"utf8"));if(Pv(e)){if(typeof t.length>"u")throw new Error("Not an array?");if(n=i0(e),n!=="dynamic"&&n!==0&&t.length>n)throw new Error("Elements exceed array size: "+n);s=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(i in t)s.push(Xe(e,t[i]));if(n==="dynamic"){var a=Xe("uint256",t.length);s.unshift(a)}return Y.concat(s)}else{if(e==="bytes")return t=new Y(t),s=Y.concat([Xe("uint256",t.length),t]),t.length%32!==0&&(s=Y.concat([s,be.zeros(32-t.length%32)])),s;if(e.startsWith("bytes")){if(n=yn(e),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);return be.setLengthRight(t,32)}else if(e.startsWith("uint")){if(n=yn(e),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=jt(t);const o=be.bitLengthFromBigInt(r);if(o>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+o);if(r<0)throw new Error("Supplied uint is negative");return be.bufferBEFromBigInt(r,32)}else if(e.startsWith("int")){if(n=yn(e),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=jt(t);const o=be.bitLengthFromBigInt(r);if(o>n)throw new Error("Supplied int exceeds width: "+n+" vs "+o);const c=be.twosFromBigInt(r,256);return be.bufferBEFromBigInt(c,32)}else if(e.startsWith("ufixed")){if(n=zc(e),r=jt(t),r<0)throw new Error("Supplied ufixed is negative");return Xe("uint256",r*BigInt(2)**BigInt(n[1]))}else if(e.startsWith("fixed"))return n=zc(e),Xe("int256",jt(t)*BigInt(2)**BigInt(n[1]))}throw new Error("Unsupported or invalid type: "+e)}function Av(e){return e==="string"||e==="bytes"||i0(e)==="dynamic"}function Pv(e){return e.lastIndexOf("]")===e.length-1}function kv(e,t){var n=[],r=[],s=32*e.length;for(var i in e){var a=s0(e[i]),o=t[i],c=Xe(a,o);Av(a)?(n.push(Xe("uint256",s)),r.push(c),s+=c.length):n.push(c)}return Y.concat(n.concat(r))}function a0(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,s=[],i=0;i<e.length;i++){var a=s0(e[i]),o=t[i];if(a==="bytes")s.push(o);else if(a==="string")s.push(new Y(o,"utf8"));else if(a==="bool")s.push(new Y(o?"01":"00","hex"));else if(a==="address")s.push(be.setLength(o,20));else if(a.startsWith("bytes")){if(n=yn(a),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);s.push(be.setLengthRight(o,n))}else if(a.startsWith("uint")){if(n=yn(a),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=jt(o);const c=be.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+c);s.push(be.bufferBEFromBigInt(r,n/8))}else if(a.startsWith("int")){if(n=yn(a),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=jt(o);const c=be.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied int exceeds width: "+n+" vs "+c);const u=be.twosFromBigInt(r,n);s.push(be.bufferBEFromBigInt(u,n/8))}else throw new Error("Unsupported or invalid type: "+a)}return Y.concat(s)}function Sv(e,t){return be.keccak(a0(e,t))}var Iv={rawEncode:kv,solidityPack:a0,soliditySHA3:Sv};const Fe=r0,qn=Iv,o0={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"]},Js={encodeData(e,t,n,r=!0){const s=["bytes32"],i=[this.hashType(e,n)];if(r){const a=(o,c,u)=>{if(n[c]!==void 0)return["bytes32",u==null?"0x0000000000000000000000000000000000000000000000000000000000000000":Fe.keccak(this.encodeData(c,u,n,r))];if(u===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",Fe.keccak(u)];if(c==="string")return typeof u=="string"&&(u=Y.from(u,"utf8")),["bytes32",Fe.keccak(u)];if(c.lastIndexOf("]")===c.length-1){const d=c.slice(0,c.lastIndexOf("[")),l=u.map(p=>a(o,d,p));return["bytes32",Fe.keccak(qn.rawEncode(l.map(([p])=>p),l.map(([,p])=>p)))]}return[c,u]};for(const o of n[e]){const[c,u]=a(o.name,o.type,t[o.name]);s.push(c),i.push(u)}}else for(const a of n[e]){let o=t[a.name];if(o!==void 0)if(a.type==="bytes")s.push("bytes32"),o=Fe.keccak(o),i.push(o);else if(a.type==="string")s.push("bytes32"),typeof o=="string"&&(o=Y.from(o,"utf8")),o=Fe.keccak(o),i.push(o);else if(n[a.type]!==void 0)s.push("bytes32"),o=Fe.keccak(this.encodeData(a.type,o,n,r)),i.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(a.type),i.push(o)}}return qn.rawEncode(s,i)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter(s=>s!==e);r=[e].concat(r.sort());for(const s of r){if(!t[s])throw new Error("No type definition specified: "+s);n+=s+"("+t[s].map(({name:a,type:o})=>o+" "+a).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 s of this.findTypeDependencies(r.type,t,n))!n.includes(s)&&n.push(s);return n},hashStruct(e,t,n,r=!0){return Fe.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return Fe.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in o0.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=[Y.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)),Fe.keccak(Y.concat(r))}};var _v={TYPED_MESSAGE_SCHEMA:o0,TypedDataUtils:Js,hashForSignTypedDataLegacy:function(e){return Tv(e.data)},hashForSignTypedData_v3:function(e){return Js.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Js.hash(e.data)}};function Tv(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(i){return i.type==="bytes"?Fe.toBuffer(i.value):i.value}),r=e.map(function(i){return i.type}),s=e.map(function(i){if(!i.name)throw t;return i.type+" "+i.name});return qn.soliditySHA3(["bytes32","bytes32"],[qn.soliditySHA3(new Array(e.length).fill("string"),s),qn.soliditySHA3(r,n)])}const Sr=M0(_v),Ov="walletUsername",na="Addresses",Cv="AppVersion";class Bv{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)),s=await crypto.subtle.importKey("raw",_r(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},s,i.encode(t)),o=16,c=a.slice(a.byteLength-o),u=a.slice(0,a.byteLength-o),d=new Uint8Array(c),l=new Uint8Array(u),p=new Uint8Array([...r,...d,...l]);return Za(p)}async decrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");return new Promise((r,s)=>{(async()=>{const i=await crypto.subtle.importKey("raw",_r(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=_r(t),o=a.slice(0,12),c=a.slice(12,28),u=a.slice(28),d=new Uint8Array([...u,...c]),l={name:"AES-GCM",iv:new Uint8Array(o)};try{const p=await window.crypto.subtle.decrypt(l,i,d),f=new TextDecoder;r(f.decode(p))}catch(p){s(p)}})()})}}class Nv{constructor(t,n,r){this.linkAPIUrl=t,this.sessionId=n;const s=`${n}:${r}`;this.auth=`Basic ${btoa(s)}`}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:s}=await n.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(t=r?.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${n.status}`)}}var et;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(et||(et={}));class Se{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=Se.instanceCounter++,Se.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 s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){n(i);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,et.CONNECTING),s.onclose=i=>{var a;this.clearWebSocket(),s.readyState!==WebSocket.OPEN&&n(new Error(`websocket error ${i.code}: ${i.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,et.DISCONNECTED)},s.onopen=i=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,et.CONNECTED),Se.pendingData.length>0&&([...Se.pendingData].forEach(c=>this.sendData(c)),Se.pendingData=[])},s.onmessage=i=>{var a,o;if(i.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(i.data);(o=this.incomingDataListener)===null||o===void 0||o.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,et.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{n.close()}catch{}}}sendData(t){const{webSocket:n}=this;if(!n){Se.pendingData.push(t),this.isDisconnecting||this.connect();return}if(n.readyState!==WebSocket.OPEN){Se.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(){Se.activeInstances.delete(this.instanceId)}}Se.instanceCounter=0;Se.activeInstances=new Set;Se.pendingData=[];const Gc=1e4,$v=6e4;class Mv{constructor({session:t,linkAPIUrl:n,listener:r}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=lt(1),this.reconnectAttempts=0,this.isReconnecting=!1,this._connected=!1,this._linked=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=i=>{if(!i)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>i.JsonRpcUrl&&this.handleChainUpdated(o,i.JsonRpcUrl)]]).forEach((o,c)=>{const u=i[c];u!==void 0&&o(u)})},this.handleDestroyed=i=>{var a;i==="1"&&((a=this.listener)===null||a===void 0||a.resetAndReload())},this.handleAccountUpdated=async i=>{var a;try{const o=await this.cipher.decrypt(i);(a=this.listener)===null||a===void 0||a.accountUpdated(o)}catch{}},this.handleMetadataUpdated=async(i,a)=>{var o;try{const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.metadataUpdated(i,c)}catch{}},this.handleWalletUsernameUpdated=async i=>{this.handleMetadataUpdated(Ov,i)},this.handleAppVersionUpdated=async i=>{this.handleMetadataUpdated(Cv,i)},this.handleChainUpdated=async(i,a)=>{var o;try{const c=await this.cipher.decrypt(i),u=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.chainUpdated(c,u)}catch{}},this.session=t,this.cipher=new Bv(t.secret),this.listener=r,this.linkAPIUrl=n,this.WebSocketClass=WebSocket;const s=this.createWebSocket();this.ws=s,this.http=new Nv(n,t.id,t.key),this.setupVisibilityChangeHandler()}createWebSocket(){const t=new Se(`${this.linkAPIUrl}/rpc`,this.WebSocketClass);return this.activeWsInstance=t,t.setConnectionStateListener(async n=>{if(t!==this.activeWsInstance)return;let r=!1;switch(n){case et.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 i=this.reconnectAttempts===0?0:3e3;await new Promise(a=>setTimeout(a,i)),!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(()=>{Dc()}).finally(()=>{this.isReconnecting=!1})):this.isReconnecting=!1})();break;case et.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()},Gc),setTimeout(()=>{this.heartbeat()},100);break;case et.CONNECTING:break}n!==et.CONNECTED&&(this.connected=r)}),t.setIncomingDataListener(n=>{var r;switch(n.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const s=n.type==="IsLinkedOK"?n.linked:void 0;this.linked=s||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(()=>{Dc()})}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:lt(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),s=JSON.parse(r);if(s.type!=="WEB3_RESPONSE")return;(n=this.listener)===null||n===void 0||n.handleWeb3ResponseMessage(s.id,s.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{iv()}}async publishEvent(t,n,r=!1){const s=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"}))),i={type:"PublishEvent",id:lt(this.nextReqId++),sessionId:this.session.id,event:t,data:s,callWebhook:r};return this.setOnceLinked(async()=>{const a=await this.makeRequest(i);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Gc*2){this.ws.disconnect();return}if(this.connected)try{this.ws.sendData("h")}catch{}}async makeRequest(t,n={timeout:$v}){const r=t.id;this.sendData(t);let s;return Promise.race([new Promise((i,a)=>{s=window.setTimeout(()=>{a(new Error(`request ${r} timed out`))},n.timeout)}),new Promise(i=>{this.requestResolutions.set(r,a=>{clearTimeout(s),i(a),this.requestResolutions.delete(r)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:lt(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:lt(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:lt(this.nextReqId++),sessionId:this.session.id}),!0)}}class Lv{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const t=this._nextRequestId,n=Rl(t.toString(16));return this.callbacks.get(n)&&this.callbacks.delete(n),t}}function Rv(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function oo(e,...t){if(!Rv(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 Hc(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 jv(e,t){oo(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 Qs=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Qe=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];const Dv=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Uv(e){oo(e);let t="";for(let n=0;n<e.length;n++)t+=Dv[e[n]];return t}function Fv(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function c0(e){return typeof e=="string"&&(e=Fv(e)),oo(e),e}class zv{clone(){return this._cloneInto()}}function Gv(e){const t=r=>e().update(c0(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Hv(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),a=Number(n>>s&i),o=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,o,r)}const qv=(e,t,n)=>e&t^~e&n,Vv=(e,t,n)=>e&t^e&n^t&n;class Wv extends zv{constructor(t,n,r,s){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Qs(this.buffer)}update(t){Hc(this);const{view:n,buffer:r,blockLen:s}=this;t=c0(t);const i=t.length;for(let a=0;a<i;){const o=Math.min(s-this.pos,i-a);if(o===s){const c=Qs(t);for(;s<=i-a;a+=s)this.process(c,a);continue}r.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Hc(this),jv(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:a}=this;n[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(r,0),a=0);for(let l=a;l<s;l++)n[l]=0;Hv(r,s-8,BigInt(this.length*8),i),this.process(r,0);const o=Qs(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)o.setUint32(4*l,d[l],i)}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:s,finished:i,destroyed:a,pos:o}=this;return t.length=s,t.pos=o,t.finished=i,t.destroyed=a,s%n&&t.buffer.set(r),t}}const Kv=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]),It=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_t=new Uint32Array(64);class Zv extends Wv{constructor(){super(64,32,8,!1),this.A=It[0]|0,this.B=It[1]|0,this.C=It[2]|0,this.D=It[3]|0,this.E=It[4]|0,this.F=It[5]|0,this.G=It[6]|0,this.H=It[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:a,G:o,H:c}=this;return[t,n,r,s,i,a,o,c]}set(t,n,r,s,i,a,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=c|0}process(t,n){for(let l=0;l<16;l++,n+=4)_t[l]=t.getUint32(n,!1);for(let l=16;l<64;l++){const p=_t[l-15],f=_t[l-2],m=Qe(p,7)^Qe(p,18)^p>>>3,h=Qe(f,17)^Qe(f,19)^f>>>10;_t[l]=h+_t[l-7]+m+_t[l-16]|0}let{A:r,B:s,C:i,D:a,E:o,F:c,G:u,H:d}=this;for(let l=0;l<64;l++){const p=Qe(o,6)^Qe(o,11)^Qe(o,25),f=d+p+qv(o,c,u)+Kv[l]+_t[l]|0,h=(Qe(r,2)^Qe(r,13)^Qe(r,22))+Vv(r,s,i)|0;d=u,u=c,c=o,o=a+f|0,a=i,i=s,s=r,r=f+h|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(r,s,i,a,o,c,u,d)}roundClean(){_t.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Yv=Gv(()=>new Zv),qc="session:id",Vc="session:secret",Wc="session:linked";class gn{constructor(t,n,r,s=!1){this.storage=t,this.id=n,this.secret=r,this.key=Uv(Yv(`${n}, ${r} WalletLink`)),this._linked=!!s}static create(t){const n=Lt(16),r=Lt(32);return new gn(t,n,r).save()}static load(t){const n=t.getItem(qc),r=t.getItem(Wc),s=t.getItem(Vc);return n&&s?new gn(t,n,s,r==="1"):null}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this.storage.setItem(qc,this.id),this.storage.setItem(Vc,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(Wc,this._linked?"1":"0")}}const Jv=".-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 Qv{constructor(){this.root=null,this.darkMode=Fl()}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),Dl()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&(Xs(null,this.root),t&&Xs(Z(Xv,Object.assign({},t,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const Xv=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:s})=>{const i=n?"dark":"light";return Z(Gl,{darkMode:n},Z("div",{class:"-cbwsdk-redirect-dialog"},Z("style",null,Jv),Z("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),Z("div",{class:Hn("-cbwsdk-redirect-dialog-box",i)},Z("p",null,e),Z("button",{onClick:r},t))))};class Kc{constructor(){this.attached=!1,this.redirectDialog=new Qv}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(Pw);n.searchParams.append("redirect_url",Ow().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 ft{constructor(t){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=Cw(),this.linkedUpdated=i=>{this.isLinked=i;const a=this.storage.getItem(na);if(i&&(this._session.linked=i),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!i&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(i,a)=>{this.storage.setItem(i,a)},this.chainUpdated=(i,a)=>{this.chainCallbackParams.chainId===i&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:i,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(a,Number.parseInt(i,10)))},this.accountUpdated=i=>{this.accountsCallback&&this.accountsCallback([i]),ft.accountRequestCallbackIds.size>0&&(Array.from(ft.accountRequestCallbackIds.values()).forEach(a=>{this.invokeCallback(a,{method:"requestEthereumAccounts",result:[i]})}),ft.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:s}=this.subscribe();this._session=n,this.connection=s,this.relayEventManager=new Lv,this.ui=r,this.ui.attach()}subscribe(){const t=gn.load(this.storage)||gn.create(this.storage),{linkAPIUrl:n}=this,r=new Mv({session:t,linkAPIUrl:n,listener:this}),s=this.isMobileWeb?new Kc:new Lw;return r.connect(),{session:t,ui:s,connection:r}}resetAndReload(){this.connection.destroy().then(()=>{const t=gn.load(this.storage);t?.id===this._session.id&&Zt.clearAll(),document.location.reload()}).catch(t=>{})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:Ye(t.weiValue),data:Fn(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?Ye(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?Ye(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?Ye(t.gasPriceInWei):null,gasLimit:t.gasLimit?Ye(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:Ye(t.weiValue),data:Fn(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?Ye(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?Ye(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?Ye(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?Ye(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,n){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Fn(t,!0),chainId:n}})}getWalletLinkSession(){return this._session}sendRequest(t){let n=null;const r=Lt(8),s=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,i),n?.()};return new Promise((i,a)=>{n=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,o=>{if(n?.(),ce(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(r,t)})}publishWeb3RequestEvent(t,n){const r={type:"WEB3_REQUEST",id:t,request:n};this.publishEvent("Web3Request",r,!0).then(s=>{}).catch(s=>{this.handleWeb3ResponseMessage(r.id,{method:n.method,errorMessage:s.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(n.method)}openCoinbaseWalletDeeplink(t){if(this.ui instanceof Kc)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"){ft.accountRequestCallbackIds.forEach(r=>this.invokeCallback(r,n)),ft.accountRequestCallbackIds.clear();return}this.invokeCallback(t,n)}handleErrorResponse(t,n,r){var s;const i=(s=r?.message)!==null&&s!==void 0?s:"Unspecified error message.";this.handleWeb3ResponseMessage(t,{method:n,errorMessage:i})}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}},s=Lt(8);return new Promise((i,a)=>{this.relayEventManager.callbacks.set(s,o=>{if(ce(o))return a(new Error(o.errorMessage));i(o)}),ft.accountRequestCallbackIds.add(s),this.publishWeb3RequestEvent(s,r)})}watchAsset(t,n,r,s,i,a){const o={method:"watchAsset",params:{type:t,options:{address:n,symbol:r,decimals:s,image:i},chainId:a}};let c=null;const u=Lt(8),d=l=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,l),c?.()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((l,p)=>{this.relayEventManager.callbacks.set(u,f=>{if(c?.(),ce(f))return p(new Error(f.errorMessage));l(f)}),this.publishWeb3RequestEvent(u,o)})}addEthereumChain(t,n,r,s,i,a){const o={method:"addEthereumChain",params:{chainId:t,rpcUrls:n,blockExplorerUrls:s,chainName:i,iconUrls:r,nativeCurrency:a}};let c=null;const u=Lt(8),d=l=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,l),c?.()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise((l,p)=>{this.relayEventManager.callbacks.set(u,f=>{if(c?.(),ce(f))return p(new Error(f.errorMessage));l(f)}),this.publishWeb3RequestEvent(u,o)})}switchEthereumChain(t,n){const r={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:n})};let s=null;const i=Lt(8),a=o=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,r.method,o),s?.()};return s=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:a,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(i,u=>{if(s?.(),ce(u)&&u.errorCode)return c(B.provider.custom({code:u.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(ce(u))return c(new Error(u.errorMessage));o(u)}),this.publishWeb3RequestEvent(i,r)})}}ft.accountRequestCallbackIds=new Set;const Zc="DefaultChainId",Yc="DefaultJsonRpcUrl";class u0{constructor(t){this._relay=null,this._addresses=[],this.metadata=t.metadata,this._storage=new Zt("walletlink",xc),this.callback=t.callback||null;const n=this._storage.getItem(na);if(n){const r=n.split(" ");r[0]!==""&&(this._addresses=r.map(s=>Pt(s)))}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=ze.get(t);X5({method:n,correlationId:r});try{await this._eth_requestAccounts(),tv({method:n,correlationId:r})}catch(s){throw ev({method:n,correlationId:r,errorMessage:Rt(s)}),s}}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var t;return(t=this._storage.getItem(Yc))!==null&&t!==void 0?t:void 0}set jsonRpcUrl(t){this._storage.setItem(Yc,t)}updateProviderInfo(t,n){var r;this.jsonRpcUrl=t;const s=this.getChainId();this._storage.setItem(Zc,n.toString(10)),zn(n)!==s&&((r=this.callback)===null||r===void 0||r.call(this,"chainChanged",fn(n)))}async watchAsset(t){const n=Array.isArray(t)?t[0]:t;if(!n.type)throw B.rpc.invalidParams("Type is required");if(n?.type!=="ERC20")throw B.rpc.invalidParams(`Asset of type '${n.type}' is not supported`);if(!n?.options)throw B.rpc.invalidParams("Options are required");if(!n?.options.address)throw B.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:s,symbol:i,image:a,decimals:o}=n.options,u=await this.initializeRelay().watchAsset(n.type,s,i,o,a,r?.toString());return ce(u)?!1:!!u.result}async addEthereumChain(t){var n,r;const s=t[0];if(((n=s.rpcUrls)===null||n===void 0?void 0:n.length)===0)throw B.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!s.chainName||s.chainName.trim()==="")throw B.rpc.invalidParams("chainName is a required field");if(!s.nativeCurrency)throw B.rpc.invalidParams("nativeCurrency is a required field");const i=Number.parseInt(s.chainId,16);if(i===this.getChainId())return!1;const a=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:u,iconUrls:d=[],nativeCurrency:l}=s,p=await a.addEthereumChain(i.toString(),o,d,c,u,l);if(ce(p))return!1;if(((r=p.result)===null||r===void 0?void 0:r.isApproved)===!0)return this.updateProviderInfo(o[0],i),null;throw B.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(t){const n=t[0],r=Number.parseInt(n.chainId,16),i=await this.initializeRelay().switchEthereumChain(r.toString(10),this.selectedAddress||void 0);if(ce(i))throw i;const a=i.result;return a.isApproved&&a.rpcUrl.length>0&&this.updateProviderInfo(a.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 s=t.map(i=>Pt(i));JSON.stringify(s)!==JSON.stringify(this._addresses)&&(this._addresses=s,(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",s),this._storage.setItem(na,s.join(" ")))}async request(t){const n=ze.get(t);nv({method:t.method,correlationId:n});try{const r=await this._request(t);return sv({method:t.method,correlationId:n}),r}catch(r){throw rv({method:t.method,correlationId:n,errorMessage:Rt(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 fn(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 B.rpc.internal("No RPC URL set for chain");return Gn(t,this.jsonRpcUrl)}}_ensureKnownAddress(t){const n=Pt(t);if(!this._addresses.map(s=>Pt(s)).includes(n))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(t){const n=t.from?Pt(t.from):this.selectedAddress;if(!n)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(n);const r=t.to?Pt(t.to):null,s=t.value!=null?Rn(t.value):BigInt(0),i=t.data?Xi(t.data):Y.alloc(0),a=t.nonce!=null?zn(t.nonce):null,o=t.gasPrice!=null?Rn(t.gasPrice):null,c=t.maxFeePerGas!=null?Rn(t.maxFeePerGas):null,u=t.maxPriorityFeePerGas!=null?Rn(t.maxPriorityFeePerGas):null,d=t.gas!=null?Rn(t.gas):null,l=t.chainId?zn(t.chainId):this.getChainId();return{fromAddress:n,toAddress:r,weiValue:s,data:i,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:u,gasLimit:d,chainId:l}}async ecRecover(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw B.rpc.invalidParams();const i=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:Vs(r[0]),signature:Vs(r[1]),addPrefix:n==="personal_ecRecover"}});if(ce(i))throw i;return i.result}getChainId(){var t;return Number.parseInt((t=this._storage.getItem(Zc))!==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:fn(this.getChainId())}),this._addresses;const s=await this.initializeRelay().requestEthereumAccounts();if(ce(s))throw s;if(!s.result)throw new Error("accounts received is empty");return this._setAddresses(s.result),(n=this.callback)===null||n===void 0||n.call(this,"connect",{chainId:fn(this.getChainId())}),this._addresses}async personalSign({params:t}){if(!Array.isArray(t))throw B.rpc.invalidParams();const n=t[1],r=t[0];this._ensureKnownAddress(n);const i=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:Pt(n),message:Vs(r),addPrefix:!0,typedDataJson:null}});if(ce(i))throw i;return i.result}async _eth_signTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),s=await this.initializeRelay().signEthereumTransaction(n);if(ce(s))throw s;return s.result}async _eth_sendRawTransaction(t){const n=Xi(t[0]),s=await this.initializeRelay().submitEthereumTransaction(n,this.getChainId());if(ce(s))throw s;return s.result}async _eth_sendTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),s=await this.initializeRelay().signAndSubmitEthereumTransaction(n);if(ce(s))throw s;return s.result}async signTypedData(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw B.rpc.invalidParams();const s=u=>{const d={eth_signTypedData_v1:Sr.hashForSignTypedDataLegacy,eth_signTypedData_v3:Sr.hashForSignTypedData_v3,eth_signTypedData_v4:Sr.hashForSignTypedData_v4,eth_signTypedData:Sr.hashForSignTypedData_v4};return Fn(d[n]({data:fw(u)}),!0)},i=r[n==="eth_signTypedData_v1"?1:0],a=r[n==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(i);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:Pt(i),message:s(a),typedDataJson:JSON.stringify(a,null,2),addPrefix:!1}});if(ce(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new ft({linkAPIUrl:xc,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const d0="SignerType",l0=new Zt("CBWSDK","SignerConfigurator");function e2(){return l0.getItem(d0)}function t2(e){l0.setItem(d0,e)}function Jc(e){if(e)return e instanceof gf?"scw":"walletlink"}async function n2(e){const{communicator:t,metadata:n,handshakeRequest:r,callback:s}=e;s2(t,n,s,r).catch(()=>{});const i={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},e.preference),{handshakeRequest:r})},{data:a}=await t.postRequestAndWaitForResponse(i);return a}function r2(e){const{signerType:t,metadata:n,communicator:r,callback:s}=e;switch(t){case"scw":return new gf({metadata:n,callback:s,communicator:r});case"walletlink":return new u0({metadata:n,callback:s})}}async function s2(e,t,n,r){await e.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const s=new u0({metadata:t,callback:n});e.postMessage({event:"WalletLinkUpdate",data:{session:s.getSession()}}),await s.handshake(r),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var i2=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 s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n};class a2 extends qw{constructor(t){var{metadata:n}=t,r=t.preference,{keysUrl:s}=r,i=i2(r,["keysUrl"]);super(),this.signer=null,this.isCoinbaseWallet=!0,this.metadata=n,this.preference=i,this.communicator=new zw({url:s,metadata:n,preference:i});const a=e2();a&&(this.signer=this.initSigner(a),Vw({signerType:a}))}async request(t){const n=crypto.randomUUID();ze.set(t,n),Ww({method:t.method,correlationId:n});try{const r=await this._request(t);return Zw({method:t.method,signerType:Jc(this.signer),correlationId:n}),r}catch(r){throw Kw({method:t.method,correlationId:n,signerType:Jc(this.signer),errorMessage:r instanceof Error?r.message:""}),r}finally{ze.delete(t)}}async _request(t){try{if(xw(t),!this.signer)switch(t.method){case"eth_requestAccounts":{let r;const s=R.subAccountsConfig.get();s?.enableAutoSubAccounts?r="scw":r=await this.requestSignerSelection(t);const i=this.initSigner(r);r==="scw"&&s?.enableAutoSubAccounts?(await i.handshake({method:"handshake"}),await i.request(t)):await i.handshake(t),this.signer=i,t2(r);break}case"wallet_connect":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const s=await r.request(t);return this.signer=r,s}case"wallet_sendCalls":case"wallet_sign":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const s=await r.request(t);return await r.cleanup(),s}case"wallet_getCallsStatus":return await Gn(t,jl);case"net_version":return 1;case"eth_chainId":return fn(1);default:throw B.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")}return await this.signer.request(t)}catch(n){const{code:r}=n;return r===ne.provider.unauthorized&&this.disconnect(),Promise.reject(Gw(n))}}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),Yw(),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,Zt.clearAll(),ze.clear(),this.emit("disconnect",B.provider.disconnected("User initiated disconnection"))}async requestSignerSelection(t){Jw();const n=await n2({communicator:this.communicator,preference:this.preference,metadata:this.metadata,handshakeRequest:t,callback:this.emit.bind(this)});return Qw(n),n}initSigner(t){return r2({signerType:t,metadata:this.metadata,communicator:this.communicator,callback:this.emit.bind(this)})}}function o2(e){var t;const n={metadata:e.metadata,preference:e.preference};return(t=vw(n))!==null&&t!==void 0?t:new a2(n)}const c2={options:"all"};function u2(e){var t,n,r,s;const i={metadata:{appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||"",appChainIds:e.appChainIds||[]},preference:Object.assign(c2,(t=e.preference)!==null&&t!==void 0?t:{}),paymasterUrls:e.paymasterUrls};!((n=e.subAccounts)===null||n===void 0)&&n.toOwnerAccount&&vc(e.subAccounts.toOwnerAccount),R.subAccountsConfig.set({toOwnerAccount:(r=e.subAccounts)===null||r===void 0?void 0:r.toOwnerAccount,enableAutoSubAccounts:(s=e.subAccounts)===null||s===void 0?void 0:s.enableAutoSubAccounts}),R.config.set(i),R.persist.rehydrate(),bw(),i.preference.telemetry!==!1&&sw(),Ew(i.preference);let a=null;const o={getProvider(){return a||(a=o2(i)),a.sdk=o,a},subAccount:{async create(c){var u,d;const l=R.getState();return Te((u=l.subAccount)===null||u===void 0?void 0:u.address,new Error("subaccount already exists")),await((d=o.getProvider())===null||d===void 0?void 0:d.request({method:"wallet_addSubAccount",params:[{version:"1",account:c}]}))},async get(){var c,u;const d=R.subAccounts.get();if(d?.address)return d;const p=(u=(await((c=o.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(p)?p[0]:null},async addOwner({address:c,publicKey:u,chainId:d}){var l,p;const f=R.subAccounts.get(),m=R.account.get();Te(m,new Error("account does not exist")),Te(f?.address,new Error("subaccount does not exist"));const h=[];if(u){const[y,w]=Yt([{type:"bytes32"},{type:"bytes32"}],u);h.push({to:f.address,data:se({abi:He,functionName:"addOwnerPublicKey",args:[y,w]}),value:Oe(0)})}return c&&h.push({to:f.address,data:se({abi:He,functionName:"addOwnerAddress",args:[c]}),value:Oe(0)}),await((l=o.getProvider())===null||l===void 0?void 0:l.request({method:"wallet_sendCalls",params:[{calls:h,chainId:Oe(d),from:(p=m.accounts)===null||p===void 0?void 0:p[0],version:"1"}]}))},setToOwnerAccount(c){vc(c),R.subAccountsConfig.set({toOwnerAccount:c})}}};return o}const z2=Object.freeze(Object.defineProperty({__proto__:null,createCoinbaseWalletSDK:u2,getCryptoKeyAccount:Kr},Symbol.toStringTag,{value:"Module"}));export{Ey as a,he as b,ls as c,Wu as d,Ce as e,z2 as f,Cn as i,ps as l};