@dcl/governance-site 2.5.0 → 2.5.1

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 (160) hide show
  1. package/assets/{ConstantsUtil-689989f0.js → ConstantsUtil-c3a75781.js} +1 -1
  2. package/assets/{ExchangeController-88f78111.js → ExchangeController-de6066de.js} +1 -1
  3. package/assets/{HelpersUtil-40f31189.js → HelpersUtil-47bce835.js} +1 -1
  4. package/assets/{NetworkUtil-2fb81493.js → NetworkUtil-cfdab321.js} +1 -1
  5. package/assets/{ReownAuthentication-e5d1d4cc.js → ReownAuthentication-c1098727.js} +1 -1
  6. package/assets/{SwapController-f47e6f17.js → SwapController-6f3f28da.js} +1 -1
  7. package/assets/{UserAvatar-0c19fd64.js → UserAvatar-4217a7be.js} +1 -1
  8. package/assets/{W3MFrameProviderSingleton-33e9645e.js → W3MFrameProviderSingleton-316899f0.js} +2 -2
  9. package/assets/{basic-509eb412.js → basic-d9c0f288.js} +1 -1
  10. package/assets/{biconomy-6fa3eb98.js → biconomy-bc04f7cc.js} +1 -1
  11. package/assets/{ccip-040f274b.js → ccip-d88eddf3.js} +1 -1
  12. package/assets/{ccip-6d1e4a15.js → ccip-e509a2bd.js} +1 -1
  13. package/assets/{chains-bae55e5f.js → chains-12910e1f.js} +1 -1
  14. package/assets/{common-f2e88a7e.js → common-583dfda9.js} +1 -1
  15. package/assets/{compat-b432550d.js → compat-000e5801.js} +1 -1
  16. package/assets/{controller-83cf739b.js → controller-5a843a75.js} +1 -1
  17. package/assets/{core-71a03396.js → core-1a166f08.js} +3 -3
  18. package/assets/{custom-7ae31f11.js → custom-3c5e7814.js} +1 -1
  19. package/assets/{data-capture-f1f485c2.js → data-capture-a27f6e5c.js} +1 -1
  20. package/assets/decimals-50f9fee1.js +1 -0
  21. package/assets/{decimals-9d5fec14.js → decimals-bddbc743.js} +1 -1
  22. package/assets/{email-be31d86e.js → email-0c5024d9.js} +1 -1
  23. package/assets/{embedded-wallet-41341ab4.js → embedded-wallet-d5992bd8.js} +1 -1
  24. package/assets/{engine-8d2b111b.js → engine-9b39863f.js} +1 -1
  25. package/assets/{estimate-l1-fee-8acb8860.js → estimate-l1-fee-69110584.js} +1 -1
  26. package/assets/eth_estimateGas-945ce595.js +1 -0
  27. package/assets/{eth_getStorageAt-2d8a4700.js → eth_getStorageAt-125a2bc1.js} +1 -1
  28. package/assets/{eth_getTransactionCount-273004ec.js → eth_getTransactionCount-6240f912.js} +1 -1
  29. package/assets/{ethereum-667be7dc.js → ethereum-0d579241.js} +1 -1
  30. package/assets/{execute-6c88dd5f.js → execute-264a98ed.js} +1 -1
  31. package/assets/{extractIPFS-640303a3.js → extractIPFS-d48a2b7b.js} +1 -1
  32. package/assets/features-7c8dc530.js +1 -0
  33. package/assets/{fetchTokenMetadata-1e138f21.js → fetchTokenMetadata-f32fb87e.js} +1 -1
  34. package/assets/{fortmatic-d34f42c3.js → fortmatic-5f1bb82e.js} +1 -1
  35. package/assets/{get-bytecode-8cb4e224.js → get-bytecode-7a8c6215.js} +1 -1
  36. package/assets/{get-ecosystem-wallet-info-ec712acc.js → get-ecosystem-wallet-info-0a9d1fa7.js} +1 -1
  37. package/assets/{getBalance-0308f38f.js → getBalance-e2e6d859.js} +1 -1
  38. package/assets/{getInstalledModules-17fa1a09.js → getInstalledModules-4e23fa8a.js} +1 -1
  39. package/assets/{getNFT-06eb1406.js → getNFT-5486b2f7.js} +1 -1
  40. package/assets/{getNFT-30795fe1.js → getNFT-74f5ae81.js} +1 -1
  41. package/assets/{hashBytecode-a29db705.js → hashBytecode-7a0e56f5.js} +1 -1
  42. package/assets/{hashTypedData-23a00dc9.js → hashTypedData-03b693eb.js} +1 -1
  43. package/assets/{hashTypedData-ba8e399b.js → hashTypedData-cc1589a7.js} +1 -1
  44. package/assets/{in-app-9acc158b.js → in-app-1d212717.js} +1 -1
  45. package/assets/{in-app-wallet-calls-48ca2694.js → in-app-wallet-calls-7fdb5823.js} +1 -1
  46. package/assets/{index-89cbc69d.js → index-06d7a58c.js} +1 -1
  47. package/assets/{index-355751ab.js → index-10c73e9d.js} +245 -245
  48. package/assets/{index-9ecf773e.js → index-19891b89.js} +1 -1
  49. package/assets/{index-2ebd7a81.js → index-206ffe7d.js} +1 -1
  50. package/assets/{index-f4401a12.js → index-20b33848.js} +1 -1
  51. package/assets/{index-6e64d31e.js → index-23dd6251.js} +2 -2
  52. package/assets/{index-2124b7cd.js → index-2cab452e.js} +1 -1
  53. package/assets/{index-9c2f8893.js → index-2f82abe0.js} +1 -1
  54. package/assets/{index-a5c29e80.js → index-30a8f53e.js} +1 -1
  55. package/assets/{index-4bc8eee8.js → index-31022e63.js} +1 -1
  56. package/assets/{index-a5876580.js → index-32a45902.js} +1 -1
  57. package/assets/{index-b7605561.js → index-3b678484.js} +1 -1
  58. package/assets/{index-3cdab001.js → index-3bc5c9df.js} +1 -1
  59. package/assets/{index-d7ed4af8.js → index-3d19d06c.js} +1 -1
  60. package/assets/{index-1368749b.js → index-401eba13.js} +1 -1
  61. package/assets/{index-f4841b7d.js → index-5071722a.js} +1 -1
  62. package/assets/{index-e7f3149f.css → index-59db4a58.css} +4 -4
  63. package/assets/{index-e6ba4bbe.js → index-5d7b6c51.js} +1 -1
  64. package/assets/{index-78689969.js → index-5ece9033.js} +1 -1
  65. package/assets/{index-33bd3c33.js → index-610c7efb.js} +1 -1
  66. package/assets/{index-a91bb597.js → index-69a0492a.js} +1 -1
  67. package/assets/{index-76dbec48.js → index-6d8da0b7.js} +1 -1
  68. package/assets/{index-863b5c53.js → index-6ec6d7c7.js} +1 -1
  69. package/assets/{index-ec8cf158.js → index-780a2232.js} +1 -1
  70. package/assets/{index-b40ed19e.js → index-7ad05b06.js} +1 -1
  71. package/assets/{index-e332724b.js → index-7f01a27a.js} +1 -1
  72. package/assets/{index-69ac8519.js → index-877ffe4a.js} +1 -1
  73. package/assets/{index-e6d2ed90.js → index-8aeaab91.js} +1 -1
  74. package/assets/{index-66d53073.js → index-8cbb4ff7.js} +2 -2
  75. package/assets/{index-e2d1a06e.js → index-8d81098b.js} +1 -1
  76. package/assets/{index-3ad96675.js → index-8fa35f13.js} +1 -1
  77. package/assets/{index-5f847edd.js → index-93724bad.js} +2 -2
  78. package/assets/index-9bee2cc7.js +77 -0
  79. package/assets/{index-2e071cd2.js → index-9d37fa54.js} +1 -1
  80. package/assets/{index-57dbcd5d.js → index-a151f6d7.js} +1 -1
  81. package/assets/{index-54323fc3.js → index-a22875e4.js} +2 -2
  82. package/assets/{index-d7bf28d3.js → index-a69ba1cc.js} +1 -1
  83. package/assets/{index-6c8c5091.js → index-a6a44c61.js} +1 -1
  84. package/assets/{index-b41b719c.js → index-aae2726c.js} +1 -1
  85. package/assets/{index-8bdd54b7.js → index-ad63abcf.js} +1 -1
  86. package/assets/{index-375e28ad.js → index-b3691f6b.js} +1 -1
  87. package/assets/{index-276c1c99.js → index-b3889ac8.js} +1 -1
  88. package/assets/{index-2537319c.js → index-bb13bbcd.js} +1 -1
  89. package/assets/{index-05f3c18a.js → index-bcedc0e6.js} +1 -1
  90. package/assets/{index-9e3730d4.js → index-c49dee70.js} +1 -1
  91. package/assets/{index-c7839713.js → index-cafc0996.js} +1 -1
  92. package/assets/{index-1c9749d2.js → index-d22cfc35.js} +1 -1
  93. package/assets/{index-9c119afb.js → index-d2f37bee.js} +1 -1
  94. package/assets/{index-ffdeacb2.js → index-d44b19e2.js} +1 -1
  95. package/assets/{index-8b5a06dd.js → index-d77a63d3.js} +1 -1
  96. package/assets/{index-ab687c6f.js → index-e332040b.js} +1 -1
  97. package/assets/{index-5b4e7208.js → index-e583ff4e.js} +1 -1
  98. package/assets/{index-5947dd15.js → index-e9ab8876.js} +1 -1
  99. package/assets/{index-3c50ab3b.js → index-f49c89c1.js} +1 -1
  100. package/assets/{index-3d2bada3.js → index-fe892b11.js} +1 -1
  101. package/assets/{index.es-2aacf970.js → index.es-0f7943d8.js} +1 -1
  102. package/assets/{index.es-ce0aa5fd.js → index.es-30a0ec70.js} +3 -3
  103. package/assets/{index.es-ac60fff2.js → index.es-4520fb10.js} +1 -1
  104. package/assets/{index.web-1837e57d.js → index.web-e2526e19.js} +1 -1
  105. package/assets/{localBatchGatewayRequest-b2e2be89.js → localBatchGatewayRequest-ff5d42f6.js} +1 -1
  106. package/assets/{native-8dd45a06.js → native-3e8a86bb.js} +1 -1
  107. package/assets/{networks-2b49f856.js → networks-fc1b1902.js} +1 -1
  108. package/assets/{onramp-7ba26b97.js → onramp-cf41485f.js} +1 -1
  109. package/assets/{openzeppelin-56d83a0f.js → openzeppelin-e72c7daa.js} +1 -1
  110. package/assets/{ownerOf-558180d2.js → ownerOf-c09a8f45.js} +1 -1
  111. package/assets/parseNft-147a451f.js +1 -0
  112. package/assets/{parseSignature-16c7c561.js → parseSignature-6b0b4698.js} +2 -2
  113. package/assets/{parseSignature-7a759338.js → parseSignature-b975d9a6.js} +1 -1
  114. package/assets/{passkeys-fd92f407.js → passkeys-bb25d43e.js} +1 -1
  115. package/assets/{pay-with-exchange-542b5282.js → pay-with-exchange-cd96ece6.js} +1 -1
  116. package/assets/{prepare-contract-call-ac31a985.js → prepare-contract-call-4be4cc68.js} +1 -1
  117. package/assets/{qr-overlay-548b2074.js → qr-overlay-fd67e1ca.js} +1 -1
  118. package/assets/{receive-9119a0fc.js → receive-9ddd4e2d.js} +1 -1
  119. package/assets/{redirect-state-202ec690.js → redirect-state-301cb22c.js} +1 -1
  120. package/assets/{resolveImplementation-ffd32467.js → resolveImplementation-6b55308f.js} +1 -1
  121. package/assets/{rpc-4fa5fbde.js → rpc-83ca4b71.js} +1 -1
  122. package/assets/{secp256k1-61174a68.js → secp256k1-44255658.js} +1 -1
  123. package/assets/{secp256k1-587b447b.js → secp256k1-4ab38443.js} +1 -1
  124. package/assets/{secp256k1-2e39eaab.js → secp256k1-ac683ebc.js} +1 -1
  125. package/assets/{send-5e9549ca.js → send-7e34f1e6.js} +1 -1
  126. package/assets/{send-batch-transaction-16b5b747.js → send-batch-transaction-429c82ee.js} +1 -1
  127. package/assets/{send-eip712-transaction-67b51817.js → send-eip712-transaction-20a9b9ed.js} +1 -1
  128. package/assets/send-gasless-transaction-0435da18.js +1 -0
  129. package/assets/{send-transaction-5984dc09.js → send-transaction-c3053b90.js} +1 -1
  130. package/assets/{session-proposal-548687be.js → session-proposal-d1473b74.js} +1 -1
  131. package/assets/{session-request-543a34de.js → session-request-f0a8f695.js} +1 -1
  132. package/assets/{sha256-865a5e2e.js → sha256-937f482f.js} +1 -1
  133. package/assets/{signing-67cb53a5.js → signing-6d6682ec.js} +2 -2
  134. package/assets/{socials-1c5f45aa.js → socials-d1713bee.js} +1 -1
  135. package/assets/{swaps-a0b58cae.js → swaps-8bad12fe.js} +1 -1
  136. package/assets/{thirdweb-d54893e0.js → thirdweb-73096eef.js} +2 -2
  137. package/assets/{to-serializable-transaction-2ea802ff.js → to-serializable-transaction-9e540f8c.js} +2 -2
  138. package/assets/{totalSupply-f714505e.js → totalSupply-7e83596b.js} +1 -1
  139. package/assets/{transaction-e500e7c4.js → transaction-ea614a5a.js} +1 -1
  140. package/assets/{transactionReceipt-c6fe2381.js → transactionReceipt-1e425ab1.js} +1 -1
  141. package/assets/{transactions-9a79e8f9.js → transactions-a47e2cb5.js} +1 -1
  142. package/assets/{tslib.es6-b444c8f1.js → tslib.es6-24024d67.js} +1 -1
  143. package/assets/{utils-74c631d9.js → utils-dddc86ba.js} +1 -1
  144. package/assets/{verifyHash-34edded7.js → verifyHash-b21b75c2.js} +1 -1
  145. package/assets/{w3m-modal-0795c078.js → w3m-modal-e914d462.js} +1 -1
  146. package/assets/{w3m-modal-906aa735.js → w3m-modal-ff2f112d.js} +1 -1
  147. package/assets/{wait-for-tx-receipt-dbf6b521.js → wait-for-tx-receipt-50389b4e.js} +1 -1
  148. package/assets/{wallets-331c410d.js → wallets-4e23dd0f.js} +4 -4
  149. package/assets/{web-connector-3a1204fd.js → web-connector-351693f5.js} +2 -2
  150. package/assets/{writeContract-f6b81199.js → writeContract-03e44e49.js} +2 -2
  151. package/assets/{zora-sepolia-eaf59a0b.js → zora-sepolia-72e60034.js} +1 -1
  152. package/assets/{zoraTestnet-55836178.js → zoraTestnet-1485f0af.js} +1 -1
  153. package/index.html +4 -4
  154. package/package.json +3 -3
  155. package/assets/decimals-37678a25.js +0 -1
  156. package/assets/eth_estimateGas-79dc1763.js +0 -1
  157. package/assets/features-0025dc16.js +0 -1
  158. package/assets/index-7ee82e4f.js +0 -77
  159. package/assets/parseNft-93d99682.js +0 -1
  160. package/assets/send-gasless-transaction-8bdf3649.js +0 -1
@@ -1,6 +1,6 @@
1
- import{B as Nu,C as hc,D as dc,E as _c,a as Uu,F as Bu,G as pc,n as Fu,H as bs,I as fc,l as qu,J as wc,t as ho,K as Mu,N as _o,o as zu,L as ju,q as Ku,A as Hu}from"./signing-67cb53a5.js";import{aw as Wu,ax as Gu,aB as gc,av as Ju,a as ii,h as qt,m as po,g as te,n as Oe,l as $n,c as Is,u as As,v as kr,s as st,af as Yu,f as Ps,a$ as kn,w as Zu,x as mc,b5 as fo}from"./prepare-contract-call-ac31a985.js";import{t as Ye,j as bi,k as Qu,a as Nn,w as Nr,C as Ts,b as Xu,m as eh,c as th,d as ih,f as rh,l as nh,p as sh,u as oh}from"./execute-6c88dd5f.js";import{m as Ec,h as Ii,a as Ue,l as Os,n as ah,o as ch,p as lh,d as uh,q as hh}from"./utils-74c631d9.js";import{t as Rs,i as dh,a as _h}from"./transaction-e500e7c4.js";import{p as Ds,c as ph,l as fh}from"./redirect-state-202ec690.js";import{e as wh,j as gh,g as yc,s as mh,o as Eh,c as yh}from"./to-serializable-transaction-2ea802ff.js";import{b as Mt,_ as a,g as vh,a as j,B as ee,e as oi,N as vc}from"./index-355751ab.js";import{i as bh,m as Ih}from"./index-5f847edd.js";import{c as Ah}from"./store-af6293b2.js";import{g as Ph,v as Th,s as Oh,w as Rh,p as Dh}from"./hashTypedData-ba8e399b.js";import{s as bc,c as Ht}from"./send-transaction-5984dc09.js";import{e as Lh}from"./eth_sendRawTransaction-5ae15b91.js";import{s as Un,I as Ai,g as Vh,e as U,h as mi,j as Ic,k as dr,l as xh,m as Sh,n as Bn,C as Ch,q as $h,r as kh,o as Nh,t as Uh,u as Ls,v as Vs,b as Ur,w as Pi,c as $t,P as wo,Q as Bh,x as Fh,a as go,y as Yt,f as Ac,z as yt,A as dt,B as Ot}from"./index-276c1c99.js";import{q as qh}from"./index-6ab757a5.js";import{f as Ze,t as Ne,a as Mh,c as zh,d as Gi}from"./index-69ac8519.js";import"./index-2124b7cd.js";function jh(i){const t=Wu(i);return Gu("0x19",gc(`Ethereum Signed Message:
2
- `+Ju(t)),t)}function Kh(i){return Nu(jh(i))}const Hh={"0x0":"reverted","0x1":"success"};function xs(i){var r;const[t,e]=(()=>{const n=i.status;return n>=100&&n<200?["pending",n]:n>=200&&n<300?["success",n]:n>=300&&n<700?["failure",n]:n==="CONFIRMED"?["success",200]:n==="PENDING"?["pending",100]:[void 0,n]})();return{...i,atomic:i.atomic,chainId:i.chainId?ii(i.chainId):void 0,receipts:((r=i.receipts)==null?void 0:r.map(n=>({...n,blockNumber:qt(n.blockNumber),gasUsed:qt(n.gasUsed),status:Hh[n.status]})))??[],status:t,statusCode:e,version:i.version}}function Ss(i,t){const e={};for(const[r,n]of Object.entries(i)){e[Number(r)]={};const s={};for(const[o,c]of Object.entries(n))s[o]=c;e[Number(r)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Cs(i,t){const e=i.calls[0];if(!e)throw new Error("No calls to send");const{calls:r,capabilities:n,version:s="2.0.0",chain:o=e.chain}=i,c=await Promise.all(r.map(async h=>{const{to:u,value:d}=h;if(u===void 0&&h.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[_,p,f]=await Promise.all([po(u),wh(h),po(d)]);return _?{data:p,to:te(_),value:typeof f=="bigint"||typeof f=="number"?Oe(f):void 0}:{data:p,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:i.atomicRequired??!1,calls:c,capabilities:n,chainId:Oe(o.id),from:te(t.address),version:s}],chain:o}}function $s(i){return Wh(i).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Wh(i,t,e="http"){const r=[];for(const n of i.rpc)e==="http"&&!n.startsWith("http")||e==="ws"&&!n.startsWith("ws")||(n.includes("${THIRDWEB_API_KEY}")?t?r.push(n.replace("${THIRDWEB_API_KEY}",t)+(typeof globalThis<"u"&&"APP_BUNDLE_ID"in globalThis?`/?bundleId=${globalThis.APP_BUNDLE_ID}`:"")):r.push(n.replace("${THIRDWEB_API_KEY}","")):n.includes("${")||r.push(n));if(r.length===0)throw new Error(`No RPC available for chainId "${i.chainId}" with mode ${e}`);return r}function at(i){return typeof i=="number"?i:$n(i)?ii(i):typeof i=="bigint"?Number(i):Number.parseInt(i,10)}function Gh(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function Jh(){return typeof Mt<"u"&&typeof Mt.versions<"u"&&typeof Mt.versions.node<"u"}function Pc(){return!Gh()&&!Jh()}const nt="com.coinbase.wallet",At="org.base.account",Tc="io.metamask",Yh="me.rainbow",Zh="io.zerion.wallet";function ks(i){return i.startsWith("http://")||i.startsWith("https://")}function Oc(i,t){if(!ks(i))return Rc(i,t);let e=i;e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function Rc(i,t){if(ks(i))return Oc(i,t);let e=i;e.includes("://")||(e=i.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function Qh(i,t){return ks(i)?Oc(i,t):Rc(i,t)}function Xh(){if(typeof navigator>"u")return!1;const i=Ec(navigator.userAgent);return i?i.toLowerCase().includes("android"):!1}function ed(){if(typeof navigator>"u")return!1;const i=Ec(navigator.userAgent);return i?i.toLowerCase().includes("ios")||i.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function td(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function id(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function mo(){return!!(Xh()||ed()||td()&&id()||typeof window<"u"&&window.innerWidth<640)}function hn(i){if(window!==window.top)window.open(i);else if(i.startsWith("http")){const e=document.createElement("a");e.href=i,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=i}function Ti(i){return typeof i=="string"?i.startsWith("ecosystem."):i.id.startsWith("ecosystem.")}async function Dc(i,t){if(Ti(i)){const{getEcosystemWalletInfo:e}=await a(()=>import("./get-ecosystem-wallet-info-ec712acc.js"),["assets/get-ecosystem-wallet-info-ec712acc.js","assets/execute-6c88dd5f.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/index-355751ab.js","assets/index-e7f3149f.css"]);return t?e(i).then(r=>r.image_id):e(i)}switch(i){case"smart":return t?a(()=>import("./image-457dda3a.js"),[]).then(e=>e.default):a(()=>import("./index-6446a77e.js"),[]).then(e=>e.wallet);case"inApp":return t?a(()=>import("./image-9a410d3c.js"),[]).then(e=>e.default):a(()=>import("./index-8da88caa.js"),[]).then(e=>e.wallet);case"walletConnect":return t?a(()=>import("./image-f9733682.js"),[]).then(e=>e.default):a(()=>import("./index-15eedc4e.js"),[]).then(e=>e.wallet);case"embedded":return t?a(()=>import("./image-a96f7117.js"),[]).then(e=>e.default):a(()=>import("./index-7212c9cc.js"),[]).then(e=>e.wallet);case"adapter":return t?a(()=>import("./image-9c02f89f.js"),[]).then(e=>e.default):a(()=>import("./index-b0b403fd.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?a(()=>import("./image-16777a49.js"),[]).then(e=>e.default):a(()=>import("./index-2a10dc2b.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?a(()=>import("./image-7c2061d3.js"),[]).then(e=>e.default):a(()=>import("./index-caa59ced.js"),[]).then(e=>e.wallet);case"com.ledger":return t?a(()=>import("./image-b5a8ac09.js"),[]).then(e=>e.default):a(()=>import("./index-0270c3ed.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?a(()=>import("./image-0c766de5.js"),[]).then(e=>e.default):a(()=>import("./index-722e5d11.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?a(()=>import("./image-bcf26615.js"),[]).then(e=>e.default):a(()=>import("./index-bdb9e65c.js"),[]).then(e=>e.wallet);case"io.metamask":return t?a(()=>import("./image-de75c02b.js"),[]).then(e=>e.default):a(()=>import("./index-227118f1.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?a(()=>import("./image-c9a27765.js"),[]).then(e=>e.default):a(()=>import("./index-00776358.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?a(()=>import("./image-d019f398.js"),[]).then(e=>e.default):a(()=>import("./index-8245891a.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?a(()=>import("./image-2807f8e7.js"),[]).then(e=>e.default):a(()=>import("./index-5e43b215.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?a(()=>import("./image-dffed0fc.js"),[]).then(e=>e.default):a(()=>import("./index-a9de2776.js"),[]).then(e=>e.wallet);case"com.safepal":return t?a(()=>import("./image-641d544d.js"),[]).then(e=>e.default):a(()=>import("./index-10cf0d2a.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?a(()=>import("./image-d175f270.js"),[]).then(e=>e.default):a(()=>import("./index-b773342e.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?a(()=>import("./image-d3a3443e.js"),[]).then(e=>e.default):a(()=>import("./index-81473c35.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?a(()=>import("./image-6facefd8.js"),[]).then(e=>e.default):a(()=>import("./index-3e63b2e6.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?a(()=>import("./image-b00b1601.js"),[]).then(e=>e.default):a(()=>import("./index-7446e542.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?a(()=>import("./image-cc9cc6e0.js"),[]).then(e=>e.default):a(()=>import("./index-a3a58d5a.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?a(()=>import("./image-b07914c1.js"),[]).then(e=>e.default):a(()=>import("./index-285c06f6.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?a(()=>import("./image-0468f46c.js"),[]).then(e=>e.default):a(()=>import("./index-4c61a7ce.js"),[]).then(e=>e.wallet);case"com.bybit":return t?a(()=>import("./image-01575dda.js"),[]).then(e=>e.default):a(()=>import("./index-71bf3273.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?a(()=>import("./image-bb215d6b.js"),[]).then(e=>e.default):a(()=>import("./index-918ba956.js"),[]).then(e=>e.wallet);case"io.trezor":return t?a(()=>import("./image-f296f4b3.js"),[]).then(e=>e.default):a(()=>import("./index-0e480432.js"),[]).then(e=>e.wallet);case"im.token":return t?a(()=>import("./image-2f03f1da.js"),[]).then(e=>e.default):a(()=>import("./index-8e91d60d.js"),[]).then(e=>e.wallet);case"global.safe":return t?a(()=>import("./image-49646d1e.js"),[]).then(e=>e.default):a(()=>import("./index-0589d490.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?a(()=>import("./image-5c1f75d1.js"),[]).then(e=>e.default):a(()=>import("./index-86555541.js"),[]).then(e=>e.wallet);case"co.arculus":return t?a(()=>import("./image-d87af41f.js"),[]).then(e=>e.default):a(()=>import("./index-5b03e28c.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?a(()=>import("./image-c9ef2140.js"),[]).then(e=>e.default):a(()=>import("./index-a984bcef.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?a(()=>import("./image-c81ee0ed.js"),[]).then(e=>e.default):a(()=>import("./index-33087d53.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?a(()=>import("./image-e811f346.js"),[]).then(e=>e.default):a(()=>import("./index-69ee2a62.js"),[]).then(e=>e.wallet);case"com.tangem":return t?a(()=>import("./image-10c86d8c.js"),[]).then(e=>e.default):a(()=>import("./index-2b14b372.js"),[]).then(e=>e.wallet);case"com.exodus":return t?a(()=>import("./image-4ad0ee26.js"),[]).then(e=>e.default):a(()=>import("./index-8409df5e.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?a(()=>import("./image-c4815890.js"),[]).then(e=>e.default):a(()=>import("./index-189338b3.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?a(()=>import("./image-de1c3862.js"),[]).then(e=>e.default):a(()=>import("./index-c8096e7f.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?a(()=>import("./image-b3b70e40.js"),[]).then(e=>e.default):a(()=>import("./index-81c101df.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?a(()=>import("./image-54fd557f.js"),[]).then(e=>e.default):a(()=>import("./index-4e301fa3.js"),[]).then(e=>e.wallet);case"app.backpack":return t?a(()=>import("./image-1ecb0644.js"),[]).then(e=>e.default):a(()=>import("./index-304fee63.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?a(()=>import("./image-3e0a941b.js"),[]).then(e=>e.default):a(()=>import("./index-2950e1ad.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?a(()=>import("./image-ca41c67a.js"),[]).then(e=>e.default):a(()=>import("./index-2aac81f4.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?a(()=>import("./image-20686420.js"),[]).then(e=>e.default):a(()=>import("./index-99f8b4e2.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?a(()=>import("./image-317d798f.js"),[]).then(e=>e.default):a(()=>import("./index-0bdb32c6.js"),[]).then(e=>e.wallet);case"me.haha":return t?a(()=>import("./image-ed1f211c.js"),[]).then(e=>e.default):a(()=>import("./index-7ca5e898.js"),[]).then(e=>e.wallet);case"com.bee":return t?a(()=>import("./image-7e8be6ea.js"),[]).then(e=>e.default):a(()=>import("./index-5302903c.js"),[]).then(e=>e.wallet);case"ag.jup":return t?a(()=>import("./image-a98c0516.js"),[]).then(e=>e.default):a(()=>import("./index-1b8787e9.js"),[]).then(e=>e.wallet);case"app.keplr":return t?a(()=>import("./image-cc041c91.js"),[]).then(e=>e.default):a(()=>import("./index-585f055b.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?a(()=>import("./image-9d9e2312.js"),[]).then(e=>e.default):a(()=>import("./index-49da4861.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?a(()=>import("./image-42bdf8ff.js"),[]).then(e=>e.default):a(()=>import("./index-07fcf923.js"),[]).then(e=>e.wallet);case"com.kraken":return t?a(()=>import("./image-5528c41d.js"),[]).then(e=>e.default):a(()=>import("./index-f644e0cd.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?a(()=>import("./image-060fe0ae.js"),[]).then(e=>e.default):a(()=>import("./index-e26ad4a5.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?a(()=>import("./image-ba202fa7.js"),[]).then(e=>e.default):a(()=>import("./index-67ea9d8a.js"),[]).then(e=>e.wallet);case"com.tomi":return t?a(()=>import("./image-a1d36ae9.js"),[]).then(e=>e.default):a(()=>import("./index-ee511134.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?a(()=>import("./image-d7aaeb5c.js"),[]).then(e=>e.default):a(()=>import("./index-a7304a61.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?a(()=>import("./image-106d5c9b.js"),[]).then(e=>e.default):a(()=>import("./index-7f687cf1.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?a(()=>import("./image-857dc386.js"),[]).then(e=>e.default):a(()=>import("./index-11290f98.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?a(()=>import("./image-41c20c8d.js"),[]).then(e=>e.default):a(()=>import("./index-67856a37.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?a(()=>import("./image-af1453eb.js"),[]).then(e=>e.default):a(()=>import("./index-3cfc001a.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?a(()=>import("./image-61ddff35.js"),[]).then(e=>e.default):a(()=>import("./index-5d6f8a76.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?a(()=>import("./image-32c2977c.js"),[]).then(e=>e.default):a(()=>import("./index-ce9308d1.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?a(()=>import("./image-02d13e5d.js"),[]).then(e=>e.default):a(()=>import("./index-0cb2e837.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?a(()=>import("./image-a3107a62.js"),[]).then(e=>e.default):a(()=>import("./index-62628991.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?a(()=>import("./image-9491d90e.js"),[]).then(e=>e.default):a(()=>import("./index-5e3ef02d.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?a(()=>import("./image-509849b8.js"),[]).then(e=>e.default):a(()=>import("./index-b3e7d4ff.js"),[]).then(e=>e.wallet);case"app.kabila":return t?a(()=>import("./image-c37912ea.js"),[]).then(e=>e.default):a(()=>import("./index-d1242dc7.js"),[]).then(e=>e.wallet);case"com.opera":return t?a(()=>import("./image-35187532.js"),[]).then(e=>e.default):a(()=>import("./index-ec7d1d18.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?a(()=>import("./image-7e5a82da.js"),[]).then(e=>e.default):a(()=>import("./index-b4a986e0.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?a(()=>import("./image-19183749.js"),[]).then(e=>e.default):a(()=>import("./index-e2ff913f.js"),[]).then(e=>e.wallet);case"com.chain":return t?a(()=>import("./image-c7557042.js"),[]).then(e=>e.default):a(()=>import("./index-a4a920bf.js"),[]).then(e=>e.wallet);case"io.huddln":return t?a(()=>import("./image-cbb18781.js"),[]).then(e=>e.default):a(()=>import("./index-000f902d.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?a(()=>import("./image-503e7dc6.js"),[]).then(e=>e.default):a(()=>import("./index-3f7b5edc.js"),[]).then(e=>e.wallet);case"world.freedom":return t?a(()=>import("./image-44abe227.js"),[]).then(e=>e.default):a(()=>import("./index-17400f49.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?a(()=>import("./image-41efff45.js"),[]).then(e=>e.default):a(()=>import("./index-c1eea23e.js"),[]).then(e=>e.wallet);case"pk.modular":return t?a(()=>import("./image-2c62d272.js"),[]).then(e=>e.default):a(()=>import("./index-a90d42c1.js"),[]).then(e=>e.wallet);case"app.wombat":return t?a(()=>import("./image-db0d0aef.js"),[]).then(e=>e.default):a(()=>import("./index-b0db46b7.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?a(()=>import("./image-17597121.js"),[]).then(e=>e.default):a(()=>import("./index-7f49781d.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?a(()=>import("./image-64a6dd7a.js"),[]).then(e=>e.default):a(()=>import("./index-d0e5c9ad.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?a(()=>import("./image-5cd7b7ce.js"),[]).then(e=>e.default):a(()=>import("./index-29ad9167.js"),[]).then(e=>e.wallet);case"com.zengo":return t?a(()=>import("./image-f5423b30.js"),[]).then(e=>e.default):a(()=>import("./index-07890dfc.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?a(()=>import("./image-bed41cb7.js"),[]).then(e=>e.default):a(()=>import("./index-834982ce.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?a(()=>import("./image-884201b7.js"),[]).then(e=>e.default):a(()=>import("./index-b7f5da10.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?a(()=>import("./image-a9f98399.js"),[]).then(e=>e.default):a(()=>import("./index-df9c7057.js"),[]).then(e=>e.wallet);case"network.cvl":return t?a(()=>import("./image-0a838b00.js"),[]).then(e=>e.default):a(()=>import("./index-c66d233e.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?a(()=>import("./image-ba3988f2.js"),[]).then(e=>e.default):a(()=>import("./index-581ba888.js"),[]).then(e=>e.wallet);case"io.xenea":return t?a(()=>import("./image-eaa00439.js"),[]).then(e=>e.default):a(()=>import("./index-ae61dcf2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?a(()=>import("./image-cc0c5a8e.js"),[]).then(e=>e.default):a(()=>import("./index-b2d504a8.js"),[]).then(e=>e.wallet);case"com.bitso":return t?a(()=>import("./image-363fa778.js"),[]).then(e=>e.default):a(()=>import("./index-21e99b5e.js"),[]).then(e=>e.wallet);case"io.enjin":return t?a(()=>import("./image-4b5d06e2.js"),[]).then(e=>e.default):a(()=>import("./index-0f9e3649.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?a(()=>import("./image-d8d63a50.js"),[]).then(e=>e.default):a(()=>import("./index-13b8f8f3.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?a(()=>import("./image-700c8836.js"),[]).then(e=>e.default):a(()=>import("./index-59d01a20.js"),[]).then(e=>e.wallet);case"app.everspace":return t?a(()=>import("./image-b2adbef7.js"),[]).then(e=>e.default):a(()=>import("./index-41983377.js"),[]).then(e=>e.wallet);case"app.zeal":return t?a(()=>import("./image-2b304b44.js"),[]).then(e=>e.default):a(()=>import("./index-2c401274.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?a(()=>import("./image-62b23ff9.js"),[]).then(e=>e.default):a(()=>import("./index-50616e3b.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?a(()=>import("./image-5155e3ea.js"),[]).then(e=>e.default):a(()=>import("./index-36b2634f.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?a(()=>import("./image-1f3c34c8.js"),[]).then(e=>e.default):a(()=>import("./index-f5fbab75.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?a(()=>import("./image-7f982316.js"),[]).then(e=>e.default):a(()=>import("./index-e5aa4409.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?a(()=>import("./image-b80a4d76.js"),[]).then(e=>e.default):a(()=>import("./index-631c21ed.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?a(()=>import("./image-28d0f7ac.js"),[]).then(e=>e.default):a(()=>import("./index-32de03f3.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?a(()=>import("./image-b9c9ea71.js"),[]).then(e=>e.default):a(()=>import("./index-bb1f188c.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?a(()=>import("./image-6ad2ea86.js"),[]).then(e=>e.default):a(()=>import("./index-030536ff.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?a(()=>import("./image-1279f38b.js"),[]).then(e=>e.default):a(()=>import("./index-75a75b59.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?a(()=>import("./image-31e2154f.js"),[]).then(e=>e.default):a(()=>import("./index-e8696e62.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?a(()=>import("./image-71e8d590.js"),[]).then(e=>e.default):a(()=>import("./index-c9e7e64b.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?a(()=>import("./image-13f3fee6.js"),[]).then(e=>e.default):a(()=>import("./index-744cdec3.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?a(()=>import("./image-76822fa4.js"),[]).then(e=>e.default):a(()=>import("./index-376ab352.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?a(()=>import("./image-f33ea7fd.js"),[]).then(e=>e.default):a(()=>import("./index-c8d1b7f0.js"),[]).then(e=>e.wallet);case"app.krystal":return t?a(()=>import("./image-f65c6ab6.js"),[]).then(e=>e.default):a(()=>import("./index-0169bd14.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?a(()=>import("./image-d2788e8f.js"),[]).then(e=>e.default):a(()=>import("./index-0eda26d1.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?a(()=>import("./image-80e5a20c.js"),[]).then(e=>e.default):a(()=>import("./index-49da96ea.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?a(()=>import("./image-4fb84256.js"),[]).then(e=>e.default):a(()=>import("./index-62b10a79.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?a(()=>import("./image-a45c4f75.js"),[]).then(e=>e.default):a(()=>import("./index-c3a93da4.js"),[]).then(e=>e.wallet);case"app.keyring":return t?a(()=>import("./image-9605b217.js"),[]).then(e=>e.default):a(()=>import("./index-5a3b22dc.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?a(()=>import("./image-2cbbbb70.js"),[]).then(e=>e.default):a(()=>import("./index-0506c551.js"),[]).then(e=>e.wallet);case"tech.okto":return t?a(()=>import("./image-1892b63a.js"),[]).then(e=>e.default):a(()=>import("./index-91f3c380.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?a(()=>import("./image-34615249.js"),[]).then(e=>e.default):a(()=>import("./index-497b6154.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?a(()=>import("./image-8ada696b.js"),[]).then(e=>e.default):a(()=>import("./index-b78a9f32.js"),[]).then(e=>e.wallet);case"app.nightly":return t?a(()=>import("./image-6e3e6c3a.js"),[]).then(e=>e.default):a(()=>import("./index-fc64e381.js"),[]).then(e=>e.wallet);case"com.coin98":return t?a(()=>import("./image-511b8bdd.js"),[]).then(e=>e.default):a(()=>import("./index-6245b91d.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?a(()=>import("./image-2ddbd867.js"),[]).then(e=>e.default):a(()=>import("./index-c26f1459.js"),[]).then(e=>e.wallet);case"app.linen":return t?a(()=>import("./image-e1c46f95.js"),[]).then(e=>e.default):a(()=>import("./index-e7839a17.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?a(()=>import("./image-7d585189.js"),[]).then(e=>e.default):a(()=>import("./index-43c25958.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?a(()=>import("./image-b91de37b.js"),[]).then(e=>e.default):a(()=>import("./index-7c1f072d.js"),[]).then(e=>e.wallet);case"my.mone":return t?a(()=>import("./image-047ee4aa.js"),[]).then(e=>e.default):a(()=>import("./index-b96f8500.js"),[]).then(e=>e.wallet);case"org.alephium":return t?a(()=>import("./image-4c6a97a0.js"),[]).then(e=>e.default):a(()=>import("./index-8e183615.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?a(()=>import("./image-7c3e3d96.js"),[]).then(e=>e.default):a(()=>import("./index-2976aec2.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?a(()=>import("./image-a24b6b7d.js"),[]).then(e=>e.default):a(()=>import("./index-c8c6ca55.js"),[]).then(e=>e.wallet);case"com.veworld":return t?a(()=>import("./image-7fd447ab.js"),[]).then(e=>e.default):a(()=>import("./index-f80ecd95.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?a(()=>import("./image-3456be06.js"),[]).then(e=>e.default):a(()=>import("./index-627d65cb.js"),[]).then(e=>e.wallet);case"io.noone":return t?a(()=>import("./image-34b47c79.js"),[]).then(e=>e.default):a(()=>import("./index-6321c578.js"),[]).then(e=>e.wallet);case"network.haqq":return t?a(()=>import("./image-dc070867.js"),[]).then(e=>e.default):a(()=>import("./index-0785a452.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?a(()=>import("./image-3a71e43d.js"),[]).then(e=>e.default):a(()=>import("./index-4111dedd.js"),[]).then(e=>e.wallet);case"me.iopay":return t?a(()=>import("./image-7ad14403.js"),[]).then(e=>e.default):a(()=>import("./index-e80bd9ca.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?a(()=>import("./image-e8d20ee9.js"),[]).then(e=>e.default):a(()=>import("./index-4ab5de1a.js"),[]).then(e=>e.wallet);case"io.okse":return t?a(()=>import("./image-474d82c4.js"),[]).then(e=>e.default):a(()=>import("./index-71590119.js"),[]).then(e=>e.wallet);case"network.over":return t?a(()=>import("./image-3f34f0de.js"),[]).then(e=>e.default):a(()=>import("./index-3afe8699.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?a(()=>import("./image-762fe7a2.js"),[]).then(e=>e.default):a(()=>import("./index-4c2e6f7b.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?a(()=>import("./image-15895c53.js"),[]).then(e=>e.default):a(()=>import("./index-a05528a1.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?a(()=>import("./image-654f273a.js"),[]).then(e=>e.default):a(()=>import("./index-7aea539e.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?a(()=>import("./image-4c1680a8.js"),[]).then(e=>e.default):a(()=>import("./index-6776bb2a.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?a(()=>import("./image-c6cb1237.js"),[]).then(e=>e.default):a(()=>import("./index-e103ab87.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?a(()=>import("./image-6b43a247.js"),[]).then(e=>e.default):a(()=>import("./index-7090f049.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?a(()=>import("./image-023d7646.js"),[]).then(e=>e.default):a(()=>import("./index-ffbb22f4.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?a(()=>import("./image-cfcbe910.js"),[]).then(e=>e.default):a(()=>import("./index-bacf660a.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?a(()=>import("./image-110fb3aa.js"),[]).then(e=>e.default):a(()=>import("./index-8a65315d.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?a(()=>import("./image-d693b325.js"),[]).then(e=>e.default):a(()=>import("./index-db0e81bf.js"),[]).then(e=>e.wallet);case"it.airgap":return t?a(()=>import("./image-fdfe9d08.js"),[]).then(e=>e.default):a(()=>import("./index-1d890df3.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?a(()=>import("./image-25c67499.js"),[]).then(e=>e.default):a(()=>import("./index-e53c2115.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?a(()=>import("./image-069d504d.js"),[]).then(e=>e.default):a(()=>import("./index-fd5f5806.js"),[]).then(e=>e.wallet);case"com.abra":return t?a(()=>import("./image-31f19877.js"),[]).then(e=>e.default):a(()=>import("./index-8e858979.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?a(()=>import("./image-613a2278.js"),[]).then(e=>e.default):a(()=>import("./index-76279f07.js"),[]).then(e=>e.wallet);case"com.premanft":return t?a(()=>import("./image-c08671a8.js"),[]).then(e=>e.default):a(()=>import("./index-b9d9ecbb.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?a(()=>import("./image-886d9db2.js"),[]).then(e=>e.default):a(()=>import("./index-41b359c5.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?a(()=>import("./image-a5242682.js"),[]).then(e=>e.default):a(()=>import("./index-c38229f3.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?a(()=>import("./image-0dbe18eb.js"),[]).then(e=>e.default):a(()=>import("./index-66f94957.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?a(()=>import("./image-c528d1ce.js"),[]).then(e=>e.default):a(()=>import("./index-12d5f8e0.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?a(()=>import("./image-eb9e4019.js"),[]).then(e=>e.default):a(()=>import("./index-8052aeb7.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?a(()=>import("./image-34d21788.js"),[]).then(e=>e.default):a(()=>import("./index-8048a16e.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?a(()=>import("./image-5f7cd182.js"),[]).then(e=>e.default):a(()=>import("./index-d8886e48.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?a(()=>import("./image-be8b4911.js"),[]).then(e=>e.default):a(()=>import("./index-55acd996.js"),[]).then(e=>e.wallet);case"app.freighter":return t?a(()=>import("./image-d54b32f4.js"),[]).then(e=>e.default):a(()=>import("./index-f80fefdd.js"),[]).then(e=>e.wallet);case"app.stickey":return t?a(()=>import("./image-ca8d6496.js"),[]).then(e=>e.default):a(()=>import("./index-265c3d2e.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?a(()=>import("./image-c12e115c.js"),[]).then(e=>e.default):a(()=>import("./index-43a1b491.js"),[]).then(e=>e.wallet);case"io.harti":return t?a(()=>import("./image-d784f4f2.js"),[]).then(e=>e.default):a(()=>import("./index-13d47a28.js"),[]).then(e=>e.wallet);case"io.dttd":return t?a(()=>import("./image-ee100c10.js"),[]).then(e=>e.default):a(()=>import("./index-7df9cd6f.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?a(()=>import("./image-4c71c8cb.js"),[]).then(e=>e.default):a(()=>import("./index-c6ee25d9.js"),[]).then(e=>e.wallet);case"io.klever":return t?a(()=>import("./image-2054fa08.js"),[]).then(e=>e.default):a(()=>import("./index-7536b804.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?a(()=>import("./image-1a3b97ef.js"),[]).then(e=>e.default):a(()=>import("./index-dad128bd.js"),[]).then(e=>e.wallet);case"is.callback":return t?a(()=>import("./image-44cedadf.js"),[]).then(e=>e.default):a(()=>import("./index-a89ba17c.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?a(()=>import("./image-8b8e30d2.js"),[]).then(e=>e.default):a(()=>import("./index-4791b221.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?a(()=>import("./image-450b8aba.js"),[]).then(e=>e.default):a(()=>import("./index-a584b790.js"),[]).then(e=>e.wallet);case"io.fizen":return t?a(()=>import("./image-6c7375f0.js"),[]).then(e=>e.default):a(()=>import("./index-8d632bf4.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?a(()=>import("./image-029cf582.js"),[]).then(e=>e.default):a(()=>import("./index-b2396d1c.js"),[]).then(e=>e.wallet);case"world.ixo":return t?a(()=>import("./image-d5b6946f.js"),[]).then(e=>e.default):a(()=>import("./index-8d2deecb.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?a(()=>import("./image-05c4ade8.js"),[]).then(e=>e.default):a(()=>import("./index-2738ffa4.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?a(()=>import("./image-fd93bd7d.js"),[]).then(e=>e.default):a(()=>import("./index-fb5522f0.js"),[]).then(e=>e.wallet);case"app.ammer":return t?a(()=>import("./image-7744a696.js"),[]).then(e=>e.default):a(()=>import("./index-a0112923.js"),[]).then(e=>e.wallet);case"us.binance":return t?a(()=>import("./image-e2b37e1f.js"),[]).then(e=>e.default):a(()=>import("./index-16fe022e.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?a(()=>import("./image-043d9975.js"),[]).then(e=>e.default):a(()=>import("./index-c0069eca.js"),[]).then(e=>e.wallet);case"co.muza":return t?a(()=>import("./image-aefdad5a.js"),[]).then(e=>e.default):a(()=>import("./index-0f9c6a24.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?a(()=>import("./image-367a479a.js"),[]).then(e=>e.default):a(()=>import("./index-148af89f.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?a(()=>import("./image-b745b1d3.js"),[]).then(e=>e.default):a(()=>import("./index-fe9fe747.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?a(()=>import("./image-ed319e2e.js"),[]).then(e=>e.default):a(()=>import("./index-5ce66a18.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?a(()=>import("./image-8d1fea94.js"),[]).then(e=>e.default):a(()=>import("./index-586bfc8b.js"),[]).then(e=>e.wallet);case"org.dota168":return t?a(()=>import("./image-4bdc287f.js"),[]).then(e=>e.default):a(()=>import("./index-6db764b9.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?a(()=>import("./image-6f794cd9.js"),[]).then(e=>e.default):a(()=>import("./index-a8a1817b.js"),[]).then(e=>e.wallet);case"com.coininn":return t?a(()=>import("./image-2dee0cf0.js"),[]).then(e=>e.default):a(()=>import("./index-69f20d4b.js"),[]).then(e=>e.wallet);case"me.easy":return t?a(()=>import("./image-a73c9941.js"),[]).then(e=>e.default):a(()=>import("./index-788028ef.js"),[]).then(e=>e.wallet);case"io.shido":return t?a(()=>import("./image-cddb40c4.js"),[]).then(e=>e.default):a(()=>import("./index-af115980.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?a(()=>import("./image-f58c6dbd.js"),[]).then(e=>e.default):a(()=>import("./index-01f493ba.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?a(()=>import("./image-4b4bdd54.js"),[]).then(e=>e.default):a(()=>import("./index-a61d31d4.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?a(()=>import("./image-e3ce6283.js"),[]).then(e=>e.default):a(()=>import("./index-72495416.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?a(()=>import("./image-11441301.js"),[]).then(e=>e.default):a(()=>import("./index-942bc8b4.js"),[]).then(e=>e.wallet);case"com.beexo":return t?a(()=>import("./image-47d043a0.js"),[]).then(e=>e.default):a(()=>import("./index-985b79f3.js"),[]).then(e=>e.wallet);case"social.halo":return t?a(()=>import("./image-352cd1ed.js"),[]).then(e=>e.default):a(()=>import("./index-b72e8b55.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?a(()=>import("./image-40ef351d.js"),[]).then(e=>e.default):a(()=>import("./index-8c4927a7.js"),[]).then(e=>e.wallet);case"app.status":return t?a(()=>import("./image-a83439d9.js"),[]).then(e=>e.default):a(()=>import("./index-332be3b9.js"),[]).then(e=>e.wallet);case"com.midoin":return t?a(()=>import("./image-bfda252b.js"),[]).then(e=>e.default):a(()=>import("./index-8debcecc.js"),[]).then(e=>e.wallet);case"id.competence":return t?a(()=>import("./image-1223cb9f.js"),[]).then(e=>e.default):a(()=>import("./index-acb3ee58.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?a(()=>import("./image-7b50c6d4.js"),[]).then(e=>e.default):a(()=>import("./index-de6b9e12.js"),[]).then(e=>e.wallet);case"llc.besc":return t?a(()=>import("./image-e9ff7d1f.js"),[]).then(e=>e.default):a(()=>import("./index-fcefde13.js"),[]).then(e=>e.wallet);case"baby.smart":return t?a(()=>import("./image-abf21e44.js"),[]).then(e=>e.default):a(()=>import("./index-89a91c5f.js"),[]).then(e=>e.wallet);case"app.onto":return t?a(()=>import("./image-52691b02.js"),[]).then(e=>e.default):a(()=>import("./index-8f8f8215.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?a(()=>import("./image-1f20507c.js"),[]).then(e=>e.default):a(()=>import("./index-a7156d06.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?a(()=>import("./image-8596ec3f.js"),[]).then(e=>e.default):a(()=>import("./index-88c3f3eb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?a(()=>import("./image-e52f7d79.js"),[]).then(e=>e.default):a(()=>import("./index-bda18f68.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?a(()=>import("./image-220d0e7b.js"),[]).then(e=>e.default):a(()=>import("./index-7049a0ee.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?a(()=>import("./image-42722682.js"),[]).then(e=>e.default):a(()=>import("./index-6c5378f9.js"),[]).then(e=>e.wallet);case"io.zkape":return t?a(()=>import("./image-0f66d24c.js"),[]).then(e=>e.default):a(()=>import("./index-ff824d5e.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?a(()=>import("./image-c06b41bb.js"),[]).then(e=>e.default):a(()=>import("./index-e8fde7f2.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?a(()=>import("./image-1f9dfe0a.js"),[]).then(e=>e.default):a(()=>import("./index-1ee724a2.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?a(()=>import("./image-c126314d.js"),[]).then(e=>e.default):a(()=>import("./index-31377f96.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?a(()=>import("./image-176cde2e.js"),[]).then(e=>e.default):a(()=>import("./index-a3aaa26a.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?a(()=>import("./image-0f9730ff.js"),[]).then(e=>e.default):a(()=>import("./index-7867075f.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?a(()=>import("./image-ee3481c8.js"),[]).then(e=>e.default):a(()=>import("./index-be6d9a1e.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?a(()=>import("./image-8a5c216f.js"),[]).then(e=>e.default):a(()=>import("./index-7679da53.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?a(()=>import("./image-7c2f2c0a.js"),[]).then(e=>e.default):a(()=>import("./index-15261f6e.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?a(()=>import("./image-c0c098f2.js"),[]).then(e=>e.default):a(()=>import("./index-f7977d9e.js"),[]).then(e=>e.wallet);case"com.webauth":return t?a(()=>import("./image-a0295917.js"),[]).then(e=>e.default):a(()=>import("./index-52f4eed7.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?a(()=>import("./image-dac78878.js"),[]).then(e=>e.default):a(()=>import("./index-d8f70364.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?a(()=>import("./image-a4514e06.js"),[]).then(e=>e.default):a(()=>import("./index-b7a49b10.js"),[]).then(e=>e.wallet);case"io.nash":return t?a(()=>import("./image-f900ff40.js"),[]).then(e=>e.default):a(()=>import("./index-f237b8d3.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?a(()=>import("./image-53b9b6ba.js"),[]).then(e=>e.default):a(()=>import("./index-cdf1dafe.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?a(()=>import("./image-c9f80d71.js"),[]).then(e=>e.default):a(()=>import("./index-aaeb66a6.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?a(()=>import("./image-c729756d.js"),[]).then(e=>e.default):a(()=>import("./index-baaa37df.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?a(()=>import("./image-a03bd401.js"),[]).then(e=>e.default):a(()=>import("./index-7fa95294.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?a(()=>import("./image-d17c8f8d.js"),[]).then(e=>e.default):a(()=>import("./index-a5cc73ae.js"),[]).then(e=>e.wallet);case"io.kigo":return t?a(()=>import("./image-3cc02532.js"),[]).then(e=>e.default):a(()=>import("./index-a7eb10a6.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?a(()=>import("./image-1567922c.js"),[]).then(e=>e.default):a(()=>import("./index-c82a8aec.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?a(()=>import("./image-131531c5.js"),[]).then(e=>e.default):a(()=>import("./index-14d4279a.js"),[]).then(e=>e.wallet);case"app.sinum":return t?a(()=>import("./image-e76d3d62.js"),[]).then(e=>e.default):a(()=>import("./index-797dc589.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?a(()=>import("./image-af55dad6.js"),[]).then(e=>e.default):a(()=>import("./index-4e9a0536.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?a(()=>import("./image-caec43bc.js"),[]).then(e=>e.default):a(()=>import("./index-8b0b95b5.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?a(()=>import("./image-64b9eec9.js"),[]).then(e=>e.default):a(()=>import("./index-951e2b77.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?a(()=>import("./image-25666b5a.js"),[]).then(e=>e.default):a(()=>import("./index-cd08fd6e.js"),[]).then(e=>e.wallet);case"money.keychain":return t?a(()=>import("./image-b10a18c1.js"),[]).then(e=>e.default):a(()=>import("./index-ed1ac633.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?a(()=>import("./image-bb1e75ca.js"),[]).then(e=>e.default):a(()=>import("./index-fc88585f.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?a(()=>import("./image-b152ccec.js"),[]).then(e=>e.default):a(()=>import("./index-936d7a89.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?a(()=>import("./image-a4dde23d.js"),[]).then(e=>e.default):a(()=>import("./index-f017d31a.js"),[]).then(e=>e.wallet);case"gg.indi":return t?a(()=>import("./image-21b12a44.js"),[]).then(e=>e.default):a(()=>import("./index-c666fda7.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?a(()=>import("./image-2bc1277f.js"),[]).then(e=>e.default):a(()=>import("./index-4cd5d792.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?a(()=>import("./image-66973cb5.js"),[]).then(e=>e.default):a(()=>import("./index-45c36709.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?a(()=>import("./image-35809c81.js"),[]).then(e=>e.default):a(()=>import("./index-1bd11577.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?a(()=>import("./image-1e5717b5.js"),[]).then(e=>e.default):a(()=>import("./index-1b4db9c7.js"),[]).then(e=>e.wallet);case"app.utorg":return t?a(()=>import("./image-dc54d4cd.js"),[]).then(e=>e.default):a(()=>import("./index-c4ddd66a.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?a(()=>import("./image-525331ad.js"),[]).then(e=>e.default):a(()=>import("./index-81db80ab.js"),[]).then(e=>e.wallet);case"org.rezor":return t?a(()=>import("./image-8cc58a0c.js"),[]).then(e=>e.default):a(()=>import("./index-e212258e.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?a(()=>import("./image-af1093f4.js"),[]).then(e=>e.default):a(()=>import("./index-bade2eba.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?a(()=>import("./image-f50f42e5.js"),[]).then(e=>e.default):a(()=>import("./index-5af4f55b.js"),[]).then(e=>e.wallet);case"com.ripio":return t?a(()=>import("./image-cb86b447.js"),[]).then(e=>e.default):a(()=>import("./index-473d69c2.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?a(()=>import("./image-39e869cb.js"),[]).then(e=>e.default):a(()=>import("./index-cb35f3fd.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?a(()=>import("./image-f9f924eb.js"),[]).then(e=>e.default):a(()=>import("./index-32e23421.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?a(()=>import("./image-488380be.js"),[]).then(e=>e.default):a(()=>import("./index-c0e6df99.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?a(()=>import("./image-9c004f74.js"),[]).then(e=>e.default):a(()=>import("./index-d07bfff2.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?a(()=>import("./image-50b6b33e.js"),[]).then(e=>e.default):a(()=>import("./index-ffd2ffb7.js"),[]).then(e=>e.wallet);case"com.zypto":return t?a(()=>import("./image-196f123e.js"),[]).then(e=>e.default):a(()=>import("./index-8df2641a.js"),[]).then(e=>e.wallet);case"io.nabox":return t?a(()=>import("./image-3883671c.js"),[]).then(e=>e.default):a(()=>import("./index-01a14e2a.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?a(()=>import("./image-bb9b6108.js"),[]).then(e=>e.default):a(()=>import("./index-8a3d5c3f.js"),[]).then(e=>e.wallet);case"com.ballet":return t?a(()=>import("./image-57e59283.js"),[]).then(e=>e.default):a(()=>import("./index-13074009.js"),[]).then(e=>e.wallet);case"io.talken":return t?a(()=>import("./image-3ba29785.js"),[]).then(e=>e.default):a(()=>import("./index-c7b27786.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?a(()=>import("./image-e5cfb36a.js"),[]).then(e=>e.default):a(()=>import("./index-aabdec8a.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?a(()=>import("./image-b0f9aaa8.js"),[]).then(e=>e.default):a(()=>import("./index-0d0f82b1.js"),[]).then(e=>e.wallet);case"io.pockie":return t?a(()=>import("./image-2c308eab.js"),[]).then(e=>e.default):a(()=>import("./index-19f3379d.js"),[]).then(e=>e.wallet);case"me.astrox":return t?a(()=>import("./image-b5d039e7.js"),[]).then(e=>e.default):a(()=>import("./index-4e154393.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?a(()=>import("./image-41fb4d11.js"),[]).then(e=>e.default):a(()=>import("./index-22d9233b.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?a(()=>import("./image-9b2bfcfa.js"),[]).then(e=>e.default):a(()=>import("./index-ce1fcd5f.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?a(()=>import("./image-cd654aa6.js"),[]).then(e=>e.default):a(()=>import("./index-880819c4.js"),[]).then(e=>e.wallet);case"app.gamic":return t?a(()=>import("./image-56cf8527.js"),[]).then(e=>e.default):a(()=>import("./index-6a3f5d94.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?a(()=>import("./image-711e4da4.js"),[]).then(e=>e.default):a(()=>import("./index-ac22aeb8.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?a(()=>import("./image-ecccfb56.js"),[]).then(e=>e.default):a(()=>import("./index-91a568b3.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?a(()=>import("./image-db0f091f.js"),[]).then(e=>e.default):a(()=>import("./index-7e16d451.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?a(()=>import("./image-dc4608a2.js"),[]).then(e=>e.default):a(()=>import("./index-d166450a.js"),[]).then(e=>e.wallet);case"com.hootark":return t?a(()=>import("./image-5945e86f.js"),[]).then(e=>e.default):a(()=>import("./index-b1565217.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?a(()=>import("./image-bf145898.js"),[]).then(e=>e.default):a(()=>import("./index-79850ec0.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?a(()=>import("./image-952960c2.js"),[]).then(e=>e.default):a(()=>import("./index-a67088fa.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?a(()=>import("./image-01241056.js"),[]).then(e=>e.default):a(()=>import("./index-b234aa52.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?a(()=>import("./image-200312c4.js"),[]).then(e=>e.default):a(()=>import("./index-28213add.js"),[]).then(e=>e.wallet);case"co.swopme":return t?a(()=>import("./image-9cb83c6c.js"),[]).then(e=>e.default):a(()=>import("./index-5afe3f99.js"),[]).then(e=>e.wallet);case"com.kresus":return t?a(()=>import("./image-dbe220f9.js"),[]).then(e=>e.default):a(()=>import("./index-22fc2519.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?a(()=>import("./image-9d2dc55c.js"),[]).then(e=>e.default):a(()=>import("./index-833f8d73.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?a(()=>import("./image-6f9546ad.js"),[]).then(e=>e.default):a(()=>import("./index-f0032e47.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?a(()=>import("./image-9036e48e.js"),[]).then(e=>e.default):a(()=>import("./index-4e5abbfd.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?a(()=>import("./image-8612d3a8.js"),[]).then(e=>e.default):a(()=>import("./index-84336255.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?a(()=>import("./image-8fdb37ca.js"),[]).then(e=>e.default):a(()=>import("./index-927da63d.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?a(()=>import("./image-57092d0b.js"),[]).then(e=>e.default):a(()=>import("./index-915b5067.js"),[]).then(e=>e.wallet);case"app.xverse":return t?a(()=>import("./image-c5cff271.js"),[]).then(e=>e.default):a(()=>import("./index-8dfa36dc.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?a(()=>import("./image-7f0b2363.js"),[]).then(e=>e.default):a(()=>import("./index-fd6770b8.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?a(()=>import("./image-2362c655.js"),[]).then(e=>e.default):a(()=>import("./index-eaa46159.js"),[]).then(e=>e.wallet);case"org.arianee":return t?a(()=>import("./image-5e686405.js"),[]).then(e=>e.default):a(()=>import("./index-97a74e48.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?a(()=>import("./image-70e00bb3.js"),[]).then(e=>e.default):a(()=>import("./index-b756dd2e.js"),[]).then(e=>e.wallet);case"io.owallet":return t?a(()=>import("./image-3cfd2235.js"),[]).then(e=>e.default):a(()=>import("./index-fb15c4cd.js"),[]).then(e=>e.wallet);case"io.zelus":return t?a(()=>import("./image-05de5297.js"),[]).then(e=>e.default):a(()=>import("./index-3f9874d3.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?a(()=>import("./image-6361c328.js"),[]).then(e=>e.default):a(()=>import("./index-e1095e2b.js"),[]).then(e=>e.wallet);case"io.clingon":return t?a(()=>import("./image-e6e485dc.js"),[]).then(e=>e.default):a(()=>import("./index-c40c0760.js"),[]).then(e=>e.wallet);case"com.icewal":return t?a(()=>import("./image-76792282.js"),[]).then(e=>e.default):a(()=>import("./index-d718436a.js"),[]).then(e=>e.wallet);case"io.streakk":return t?a(()=>import("./image-266744e5.js"),[]).then(e=>e.default):a(()=>import("./index-391abf76.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?a(()=>import("./image-83549573.js"),[]).then(e=>e.default):a(()=>import("./index-3589a1e3.js"),[]).then(e=>e.wallet);case"finance.porta":return t?a(()=>import("./image-17dd24f7.js"),[]).then(e=>e.default):a(()=>import("./index-a74f3d72.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?a(()=>import("./image-fba75105.js"),[]).then(e=>e.default):a(()=>import("./index-6b9fb6e9.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?a(()=>import("./image-e4f5f86c.js"),[]).then(e=>e.default):a(()=>import("./index-fc8872a5.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?a(()=>import("./image-fac24185.js"),[]).then(e=>e.default):a(()=>import("./index-70b80d31.js"),[]).then(e=>e.wallet);case"live.superex":return t?a(()=>import("./image-f28c48fb.js"),[]).then(e=>e.default):a(()=>import("./index-cc192ed1.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?a(()=>import("./image-2adb500e.js"),[]).then(e=>e.default):a(()=>import("./index-16aa25a6.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?a(()=>import("./image-4725c954.js"),[]).then(e=>e.default):a(()=>import("./index-b6eee293.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?a(()=>import("./image-57125edf.js"),[]).then(e=>e.default):a(()=>import("./index-3f051ac9.js"),[]).then(e=>e.wallet);case"com.reown":return t?a(()=>import("./image-aac193f4.js"),[]).then(e=>e.default):a(()=>import("./index-1e695d4e.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?a(()=>import("./image-1bb50bc7.js"),[]).then(e=>e.default):a(()=>import("./index-e1eb9218.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?a(()=>import("./image-dcef216f.js"),[]).then(e=>e.default):a(()=>import("./index-28b17e1f.js"),[]).then(e=>e.wallet);case"io.passpay":return t?a(()=>import("./image-dd734329.js"),[]).then(e=>e.default):a(()=>import("./index-ec29070b.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?a(()=>import("./image-1f7d22f5.js"),[]).then(e=>e.default):a(()=>import("./index-3a672fc0.js"),[]).then(e=>e.wallet);case"io.plutope":return t?a(()=>import("./image-2a5bdc0a.js"),[]).then(e=>e.default):a(()=>import("./index-1b657c21.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?a(()=>import("./image-66e13da5.js"),[]).then(e=>e.default):a(()=>import("./index-da110ac4.js"),[]).then(e=>e.wallet);case"co.xellar":return t?a(()=>import("./image-2e7a1558.js"),[]).then(e=>e.default):a(()=>import("./index-983280c1.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?a(()=>import("./image-1eac3549.js"),[]).then(e=>e.default):a(()=>import("./index-6e12566c.js"),[]).then(e=>e.wallet);case"org.shefi":return t?a(()=>import("./image-80c7d64c.js"),[]).then(e=>e.default):a(()=>import("./index-ca9b3ec6.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?a(()=>import("./image-711c3ffd.js"),[]).then(e=>e.default):a(()=>import("./index-209501cf.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?a(()=>import("./image-5a49e115.js"),[]).then(e=>e.default):a(()=>import("./index-19d2709a.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?a(()=>import("./image-ffcff004.js"),[]).then(e=>e.default):a(()=>import("./index-2f22c063.js"),[]).then(e=>e.wallet);case"finance.plena":return t?a(()=>import("./image-3b386918.js"),[]).then(e=>e.default):a(()=>import("./index-3150a291.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?a(()=>import("./image-a0b17548.js"),[]).then(e=>e.default):a(()=>import("./index-50b7ce8d.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?a(()=>import("./image-3f08d2bf.js"),[]).then(e=>e.default):a(()=>import("./index-fd4ea05e.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?a(()=>import("./image-97dca603.js"),[]).then(e=>e.default):a(()=>import("./index-ab132c56.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?a(()=>import("./image-9be340f3.js"),[]).then(e=>e.default):a(()=>import("./index-6f77685d.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?a(()=>import("./image-60cb9f98.js"),[]).then(e=>e.default):a(()=>import("./index-0094b416.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?a(()=>import("./image-065a65b9.js"),[]).then(e=>e.default):a(()=>import("./index-b3a43ac8.js"),[]).then(e=>e.wallet);case"io.blocto":return t?a(()=>import("./image-ba8918e5.js"),[]).then(e=>e.default):a(()=>import("./index-99ba3e8e.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?a(()=>import("./image-580ac281.js"),[]).then(e=>e.default):a(()=>import("./index-d99e31af.js"),[]).then(e=>e.wallet);case"io.getclave":return t?a(()=>import("./image-51491dec.js"),[]).then(e=>e.default):a(()=>import("./index-38ceb300.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?a(()=>import("./image-dad22fe1.js"),[]).then(e=>e.default):a(()=>import("./index-d905ffe1.js"),[]).then(e=>e.wallet);case"app.edge":return t?a(()=>import("./image-62cea552.js"),[]).then(e=>e.default):a(()=>import("./index-64333722.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?a(()=>import("./image-9218fd8d.js"),[]).then(e=>e.default):a(()=>import("./index-95a8a461.js"),[]).then(e=>e.wallet);case"io.konio":return t?a(()=>import("./image-7272768a.js"),[]).then(e=>e.default):a(()=>import("./index-1126bdc3.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?a(()=>import("./image-93940d00.js"),[]).then(e=>e.default):a(()=>import("./index-f5e0400c.js"),[]).then(e=>e.wallet);case"app.imem":return t?a(()=>import("./image-5bf5e0d8.js"),[]).then(e=>e.default):a(()=>import("./index-39ddef31.js"),[]).then(e=>e.wallet);case"com.purechain":return t?a(()=>import("./image-81c54595.js"),[]).then(e=>e.default):a(()=>import("./index-92730ad1.js"),[]).then(e=>e.wallet);case"io.ethos":return t?a(()=>import("./image-6251edd1.js"),[]).then(e=>e.default):a(()=>import("./index-4cc6f2c5.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?a(()=>import("./image-7f26a75c.js"),[]).then(e=>e.default):a(()=>import("./index-71e35aa9.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?a(()=>import("./image-13c11e7f.js"),[]).then(e=>e.default):a(()=>import("./index-538e2e43.js"),[]).then(e=>e.wallet);case"org.kelp":return t?a(()=>import("./image-817cf8f5.js"),[]).then(e=>e.default):a(()=>import("./index-7d1289f6.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?a(()=>import("./image-8ebb7b34.js"),[]).then(e=>e.default):a(()=>import("./index-151c8265.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?a(()=>import("./image-40cbb1ad.js"),[]).then(e=>e.default):a(()=>import("./index-85e4b674.js"),[]).then(e=>e.wallet);case"land.liker":return t?a(()=>import("./image-ccfd22d6.js"),[]).then(e=>e.default):a(()=>import("./index-4c6f6565.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?a(()=>import("./image-9925d1cf.js"),[]).then(e=>e.default):a(()=>import("./index-ae09efd8.js"),[]).then(e=>e.wallet);case"io.certhis":return t?a(()=>import("./image-471041b4.js"),[]).then(e=>e.default):a(()=>import("./index-1a617493.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?a(()=>import("./image-f1f5fc38.js"),[]).then(e=>e.default):a(()=>import("./index-7dc851bb.js"),[]).then(e=>e.wallet);case"com.saify":return t?a(()=>import("./image-d95f3c4c.js"),[]).then(e=>e.default):a(()=>import("./index-bb2fbf81.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?a(()=>import("./image-7bf0939d.js"),[]).then(e=>e.default):a(()=>import("./index-78245c0e.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?a(()=>import("./image-27b9813b.js"),[]).then(e=>e.default):a(()=>import("./index-5df9dfda.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?a(()=>import("./image-0ba1e020.js"),[]).then(e=>e.default):a(()=>import("./index-4fef871b.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?a(()=>import("./image-99fd5bd1.js"),[]).then(e=>e.default):a(()=>import("./index-7c539177.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?a(()=>import("./image-0d3e68e2.js"),[]).then(e=>e.default):a(()=>import("./index-2c973091.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?a(()=>import("./image-e3c10d02.js"),[]).then(e=>e.default):a(()=>import("./index-f23c24cd.js"),[]).then(e=>e.wallet);case"network.dgg":return t?a(()=>import("./image-a822d98f.js"),[]).then(e=>e.default):a(()=>import("./index-7da8b654.js"),[]).then(e=>e.wallet);case"io.up":return t?a(()=>import("./image-8b1d3857.js"),[]).then(e=>e.default):a(()=>import("./index-7ca60685.js"),[]).then(e=>e.wallet);case"com.lif3":return t?a(()=>import("./image-ecf39c49.js"),[]).then(e=>e.default):a(()=>import("./index-840742be.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?a(()=>import("./image-63b5aace.js"),[]).then(e=>e.default):a(()=>import("./index-82ae12bb.js"),[]).then(e=>e.wallet);case"pub.dg":return t?a(()=>import("./image-d4f231f9.js"),[]).then(e=>e.default):a(()=>import("./index-dd065471.js"),[]).then(e=>e.wallet);case"com.wemix":return t?a(()=>import("./image-ece4d4fe.js"),[]).then(e=>e.default):a(()=>import("./index-47858855.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?a(()=>import("./image-782306cd.js"),[]).then(e=>e.default):a(()=>import("./index-3911c3a9.js"),[]).then(e=>e.wallet);case"net.stasis":return t?a(()=>import("./image-cf884551.js"),[]).then(e=>e.default):a(()=>import("./index-581cc181.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?a(()=>import("./image-13d15a2a.js"),[]).then(e=>e.default):a(()=>import("./index-515a52f7.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?a(()=>import("./image-e4796e7b.js"),[]).then(e=>e.default):a(()=>import("./index-6e68418c.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?a(()=>import("./image-143beca5.js"),[]).then(e=>e.default):a(()=>import("./index-24171c56.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?a(()=>import("./image-b66f235a.js"),[]).then(e=>e.default):a(()=>import("./index-62eef073.js"),[]).then(e=>e.wallet);case"com.opz":return t?a(()=>import("./image-ab36b3d0.js"),[]).then(e=>e.default):a(()=>import("./index-0bf71e87.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?a(()=>import("./image-4da57b50.js"),[]).then(e=>e.default):a(()=>import("./index-1cfe6c91.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?a(()=>import("./image-d097d3c0.js"),[]).then(e=>e.default):a(()=>import("./index-6aa7373a.js"),[]).then(e=>e.wallet);case"app.omni":return t?a(()=>import("./image-edbde867.js"),[]).then(e=>e.default):a(()=>import("./index-83dbf629.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?a(()=>import("./image-e6d74564.js"),[]).then(e=>e.default):a(()=>import("./index-5f599cbc.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?a(()=>import("./image-a7cf1cb7.js"),[]).then(e=>e.default):a(()=>import("./index-3ae03fde.js"),[]).then(e=>e.wallet);case"io.kgen":return t?a(()=>import("./image-53e2712c.js"),[]).then(e=>e.default):a(()=>import("./index-b149efd8.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?a(()=>import("./image-8ec7d0f0.js"),[]).then(e=>e.default):a(()=>import("./index-09fc2522.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?a(()=>import("./image-f9f4ed70.js"),[]).then(e=>e.default):a(()=>import("./index-9ba221ec.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?a(()=>import("./image-d6c00189.js"),[]).then(e=>e.default):a(()=>import("./index-c306008e.js"),[]).then(e=>e.wallet);case"com.daffione":return t?a(()=>import("./image-1b8e76fd.js"),[]).then(e=>e.default):a(()=>import("./index-4baceff6.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?a(()=>import("./image-3350e758.js"),[]).then(e=>e.default):a(()=>import("./index-0820f529.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?a(()=>import("./image-656b3b28.js"),[]).then(e=>e.default):a(()=>import("./index-8e4830af.js"),[]).then(e=>e.wallet);case"com.nodle":return t?a(()=>import("./image-0e09889f.js"),[]).then(e=>e.default):a(()=>import("./index-35e870a9.js"),[]).then(e=>e.wallet);case"app.tofee":return t?a(()=>import("./image-8ea6e4f6.js"),[]).then(e=>e.default):a(()=>import("./index-8e6acbef.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?a(()=>import("./image-58187a73.js"),[]).then(e=>e.default):a(()=>import("./index-7afdafe1.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?a(()=>import("./image-ae50f251.js"),[]).then(e=>e.default):a(()=>import("./index-ba1b14c7.js"),[]).then(e=>e.wallet);case"io.ready":return t?a(()=>import("./image-670a4b24.js"),[]).then(e=>e.default):a(()=>import("./index-9fd377a1.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?a(()=>import("./image-5579beb2.js"),[]).then(e=>e.default):a(()=>import("./index-725adb4a.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?a(()=>import("./image-c38c98f9.js"),[]).then(e=>e.default):a(()=>import("./index-1ae64046.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?a(()=>import("./image-9d207498.js"),[]).then(e=>e.default):a(()=>import("./index-1b193e90.js"),[]).then(e=>e.wallet);case"com.apollox":return t?a(()=>import("./image-28e82398.js"),[]).then(e=>e.default):a(()=>import("./index-6d1315a8.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?a(()=>import("./image-55332d5f.js"),[]).then(e=>e.default):a(()=>import("./index-231e0fec.js"),[]).then(e=>e.wallet);case"com.payperless":return t?a(()=>import("./image-b24e2f77.js"),[]).then(e=>e.default):a(()=>import("./index-12726c72.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?a(()=>import("./image-bea35144.js"),[]).then(e=>e.default):a(()=>import("./index-cfc98f5c.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?a(()=>import("./image-e644625d.js"),[]).then(e=>e.default):a(()=>import("./index-44598661.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?a(()=>import("./image-40a5f8e6.js"),[]).then(e=>e.default):a(()=>import("./index-811c351c.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?a(()=>import("./image-0eb0f240.js"),[]).then(e=>e.default):a(()=>import("./index-3670e092.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?a(()=>import("./image-7a60b3ff.js"),[]).then(e=>e.default):a(()=>import("./index-eb0ba054.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?a(()=>import("./image-245048fe.js"),[]).then(e=>e.default):a(()=>import("./index-2fbd44af.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?a(()=>import("./image-066cc944.js"),[]).then(e=>e.default):a(()=>import("./index-d5d9bfbe.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?a(()=>import("./image-e6564e3c.js"),[]).then(e=>e.default):a(()=>import("./index-a8067c51.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?a(()=>import("./image-709eed7c.js"),[]).then(e=>e.default):a(()=>import("./index-a49ba1bb.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?a(()=>import("./image-c65259d1.js"),[]).then(e=>e.default):a(()=>import("./index-9945d0a4.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?a(()=>import("./image-ed29bf9b.js"),[]).then(e=>e.default):a(()=>import("./index-31d41b98.js"),[]).then(e=>e.wallet);case"io.helixid":return t?a(()=>import("./image-12433199.js"),[]).then(e=>e.default):a(()=>import("./index-b42d83d8.js"),[]).then(e=>e.wallet);case"com.broearn":return t?a(()=>import("./image-cbdbd157.js"),[]).then(e=>e.default):a(()=>import("./index-8cba0b6e.js"),[]).then(e=>e.wallet);case"io.altme":return t?a(()=>import("./image-ca02d7bb.js"),[]).then(e=>e.default):a(()=>import("./index-73c50e1e.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?a(()=>import("./image-432e8bb8.js"),[]).then(e=>e.default):a(()=>import("./index-9bb84581.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?a(()=>import("./image-871ed5ce.js"),[]).then(e=>e.default):a(()=>import("./index-93d5137e.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?a(()=>import("./image-81a0606b.js"),[]).then(e=>e.default):a(()=>import("./index-f8c4ff86.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?a(()=>import("./image-f86d5927.js"),[]).then(e=>e.default):a(()=>import("./index-627f6cad.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?a(()=>import("./image-2eedbf07.js"),[]).then(e=>e.default):a(()=>import("./index-aa90fc14.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?a(()=>import("./image-2c07c05f.js"),[]).then(e=>e.default):a(()=>import("./index-47da232a.js"),[]).then(e=>e.wallet);case"io.xucre":return t?a(()=>import("./image-c07d1b2c.js"),[]).then(e=>e.default):a(()=>import("./index-170c619c.js"),[]).then(e=>e.wallet);case"app.girin":return t?a(()=>import("./image-09062d73.js"),[]).then(e=>e.default):a(()=>import("./index-f71b397a.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?a(()=>import("./image-8613a3ca.js"),[]).then(e=>e.default):a(()=>import("./index-abba9359.js"),[]).then(e=>e.wallet);case"app.clot":return t?a(()=>import("./image-f4a61df0.js"),[]).then(e=>e.default):a(()=>import("./index-f3e673b3.js"),[]).then(e=>e.wallet);case"io.transi":return t?a(()=>import("./image-0ea595f0.js"),[]).then(e=>e.default):a(()=>import("./index-37bd9aea.js"),[]).then(e=>e.wallet);case"world.qoin":return t?a(()=>import("./image-62901d33.js"),[]).then(e=>e.default):a(()=>import("./index-3231dc25.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?a(()=>import("./image-43caab73.js"),[]).then(e=>e.default):a(()=>import("./index-92d93cc3.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?a(()=>import("./image-3d91272e.js"),[]).then(e=>e.default):a(()=>import("./index-f5818c2b.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?a(()=>import("./image-6cb471bf.js"),[]).then(e=>e.default):a(()=>import("./index-f18e900e.js"),[]).then(e=>e.wallet);case"social.gm2":return t?a(()=>import("./image-44bce38e.js"),[]).then(e=>e.default):a(()=>import("./index-87b8b62b.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?a(()=>import("./image-74f6892f.js"),[]).then(e=>e.default):a(()=>import("./index-c485d323.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?a(()=>import("./image-95707d33.js"),[]).then(e=>e.default):a(()=>import("./index-2397a481.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?a(()=>import("./image-c62303ba.js"),[]).then(e=>e.default):a(()=>import("./index-316cc9e5.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?a(()=>import("./image-0d9f0368.js"),[]).then(e=>e.default):a(()=>import("./index-38713a1f.js"),[]).then(e=>e.wallet);case"world.fncy":return t?a(()=>import("./image-f2423b40.js"),[]).then(e=>e.default):a(()=>import("./index-c028d29b.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?a(()=>import("./image-32ebcc66.js"),[]).then(e=>e.default):a(()=>import("./index-af717c2b.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?a(()=>import("./image-4c8aaa01.js"),[]).then(e=>e.default):a(()=>import("./index-bed9c938.js"),[]).then(e=>e.wallet);case"net.spatium":return t?a(()=>import("./image-53d9b4d6.js"),[]).then(e=>e.default):a(()=>import("./index-dc65cc91.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?a(()=>import("./image-7610f22b.js"),[]).then(e=>e.default):a(()=>import("./index-5681a391.js"),[]).then(e=>e.wallet);case"money.snowball":return t?a(()=>import("./image-51cdc0b8.js"),[]).then(e=>e.default):a(()=>import("./index-286c3409.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?a(()=>import("./image-4572a02e.js"),[]).then(e=>e.default):a(()=>import("./index-277d68f5.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?a(()=>import("./image-0c4cf48f.js"),[]).then(e=>e.default):a(()=>import("./index-558cd5cf.js"),[]).then(e=>e.wallet);case"pro.assure":return t?a(()=>import("./image-94dd1aa5.js"),[]).then(e=>e.default):a(()=>import("./index-d0de1ddc.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?a(()=>import("./image-cfeb7e4e.js"),[]).then(e=>e.default):a(()=>import("./index-b2e813da.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?a(()=>import("./image-0a4521df.js"),[]).then(e=>e.default):a(()=>import("./index-0c76bee3.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?a(()=>import("./image-21ff7259.js"),[]).then(e=>e.default):a(()=>import("./index-c0d3ed54.js"),[]).then(e=>e.wallet);case"io.xfun":return t?a(()=>import("./image-ab7eab0a.js"),[]).then(e=>e.default):a(()=>import("./index-bbac21b8.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?a(()=>import("./image-ad46e56a.js"),[]).then(e=>e.default):a(()=>import("./index-ba8d3b21.js"),[]).then(e=>e.wallet);case"com.itoken":return t?a(()=>import("./image-38730ac8.js"),[]).then(e=>e.default):a(()=>import("./index-3844f5e2.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?a(()=>import("./image-4e049c8f.js"),[]).then(e=>e.default):a(()=>import("./index-65e99912.js"),[]).then(e=>e.wallet);case"io.slavi":return t?a(()=>import("./image-89fffba6.js"),[]).then(e=>e.default):a(()=>import("./index-f140332a.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?a(()=>import("./image-f880eb1c.js"),[]).then(e=>e.default):a(()=>import("./index-005427c8.js"),[]).then(e=>e.wallet);case"com.dexari":return t?a(()=>import("./image-519a9542.js"),[]).then(e=>e.default):a(()=>import("./index-d5a2ce40.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?a(()=>import("./image-4a63038d.js"),[]).then(e=>e.default):a(()=>import("./index-1cd46658.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?a(()=>import("./image-be5a42a0.js"),[]).then(e=>e.default):a(()=>import("./index-7a297ae4.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?a(()=>import("./image-07ca05d0.js"),[]).then(e=>e.default):a(()=>import("./index-42240733.js"),[]).then(e=>e.wallet);case"org.onyx":return t?a(()=>import("./image-b4cb2cc3.js"),[]).then(e=>e.default):a(()=>import("./index-027feb57.js"),[]).then(e=>e.wallet);case"io.gk8":return t?a(()=>import("./image-054057a2.js"),[]).then(e=>e.default):a(()=>import("./index-55b6bc8c.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?a(()=>import("./image-34fce3b0.js"),[]).then(e=>e.default):a(()=>import("./index-fe9bd966.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?a(()=>import("./image-e8189a4a.js"),[]).then(e=>e.default):a(()=>import("./index-10f9a038.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?a(()=>import("./image-da3f70fc.js"),[]).then(e=>e.default):a(()=>import("./index-26a17756.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?a(()=>import("./image-af1396ec.js"),[]).then(e=>e.default):a(()=>import("./index-ab088860.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?a(()=>import("./image-09fe28d8.js"),[]).then(e=>e.default):a(()=>import("./index-498ee9a1.js"),[]).then(e=>e.wallet);case"at.swe":return t?a(()=>import("./image-f68002f8.js"),[]).then(e=>e.default):a(()=>import("./index-af8f7243.js"),[]).then(e=>e.wallet);case"network.wali":return t?a(()=>import("./image-f6995948.js"),[]).then(e=>e.default):a(()=>import("./index-48968481.js"),[]).then(e=>e.wallet);case"io.diamante":return t?a(()=>import("./image-aad82900.js"),[]).then(e=>e.default):a(()=>import("./index-3a282395.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?a(()=>import("./image-54d08cd3.js"),[]).then(e=>e.default):a(()=>import("./index-72a4ec05.js"),[]).then(e=>e.wallet);case"com.walllet":return t?a(()=>import("./image-07ffd14e.js"),[]).then(e=>e.default):a(()=>import("./index-fa662dbc.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?a(()=>import("./image-549f154d.js"),[]).then(e=>e.default):a(()=>import("./index-0ac97795.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?a(()=>import("./image-f6e0eef2.js"),[]).then(e=>e.default):a(()=>import("./index-73d05cfb.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?a(()=>import("./image-378209de.js"),[]).then(e=>e.default):a(()=>import("./index-f2301b5e.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?a(()=>import("./image-7024a0aa.js"),[]).then(e=>e.default):a(()=>import("./index-913da051.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?a(()=>import("./image-dbe3e155.js"),[]).then(e=>e.default):a(()=>import("./index-76d3522d.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?a(()=>import("./image-c0f49cdf.js"),[]).then(e=>e.default):a(()=>import("./index-1dd3cb0b.js"),[]).then(e=>e.wallet);case"io.walletv":return t?a(()=>import("./image-77ce3739.js"),[]).then(e=>e.default):a(()=>import("./index-ef07f313.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?a(()=>import("./image-bef4b947.js"),[]).then(e=>e.default):a(()=>import("./index-eb746007.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?a(()=>import("./image-526cc4a1.js"),[]).then(e=>e.default):a(()=>import("./index-205a3c69.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?a(()=>import("./image-244faf0e.js"),[]).then(e=>e.default):a(()=>import("./index-6d344c5d.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?a(()=>import("./image-5521933f.js"),[]).then(e=>e.default):a(()=>import("./index-e8664fcd.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?a(()=>import("./image-8210efca.js"),[]).then(e=>e.default):a(()=>import("./index-e2b65972.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?a(()=>import("./image-b6ed1ee2.js"),[]).then(e=>e.default):a(()=>import("./index-6bf1a16b.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?a(()=>import("./image-a73c068e.js"),[]).then(e=>e.default):a(()=>import("./index-eedb584a.js"),[]).then(e=>e.wallet);case"com.berasig":return t?a(()=>import("./image-378a9616.js"),[]).then(e=>e.default):a(()=>import("./index-11922a2c.js"),[]).then(e=>e.wallet);case"app.phantom":return t?a(()=>import("./image-6f26420d.js"),[]).then(e=>e.default):a(()=>import("./index-ea857e82.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?a(()=>import("./image-7c1dbca6.js"),[]).then(e=>e.default):a(()=>import("./index-cab8281e.js"),[]).then(e=>e.wallet);case"io.rabby":return t?a(()=>import("./image-89800dda.js"),[]).then(e=>e.default):a(()=>import("./index-e8e17a5d.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?a(()=>import("./image-27f7cb7b.js"),[]).then(e=>e.default):a(()=>import("./index-4c224abc.js"),[]).then(e=>e.wallet);case"fi.nu":return t?a(()=>import("./image-e03c645a.js"),[]).then(e=>e.default):a(()=>import("./index-fbcf3404.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?a(()=>import("./image-08cc368c.js"),[]).then(e=>e.default):a(()=>import("./index-19d74ba8.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?a(()=>import("./image-d08dd692.js"),[]).then(e=>e.default):a(()=>import("./index-ca907524.js"),[]).then(e=>e.wallet);case"tech.levain":return t?a(()=>import("./image-c8a607fb.js"),[]).then(e=>e.default):a(()=>import("./index-e7434ba2.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?a(()=>import("./image-4d28f2ad.js"),[]).then(e=>e.default):a(()=>import("./index-1c4ca0fc.js"),[]).then(e=>e.wallet);case"com.scramble":return t?a(()=>import("./image-01f4b143.js"),[]).then(e=>e.default):a(()=>import("./index-ed2d52c4.js"),[]).then(e=>e.wallet);case"io.finoa":return t?a(()=>import("./image-1408b3f0.js"),[]).then(e=>e.default):a(()=>import("./index-65d034fb.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?a(()=>import("./image-23c0dda4.js"),[]).then(e=>e.default):a(()=>import("./index-2255e91f.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?a(()=>import("./image-4ef9878d.js"),[]).then(e=>e.default):a(()=>import("./index-d076bc9c.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?a(()=>import("./image-a4bedfda.js"),[]).then(e=>e.default):a(()=>import("./index-39b1d425.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?a(()=>import("./image-b514423b.js"),[]).then(e=>e.default):a(()=>import("./index-3212011a.js"),[]).then(e=>e.wallet);case"app.berasig":return t?a(()=>import("./image-b8d53dbe.js"),[]).then(e=>e.default):a(()=>import("./index-c36a14b9.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?a(()=>import("./image-722f31e0.js"),[]).then(e=>e.default):a(()=>import("./index-1cf9a06a.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?a(()=>import("./image-d7bec2d7.js"),[]).then(e=>e.default):a(()=>import("./index-9bc74987.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?a(()=>import("./image-760da8a1.js"),[]).then(e=>e.default):a(()=>import("./index-bbd932c2.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?a(()=>import("./image-94c11ec5.js"),[]).then(e=>e.default):a(()=>import("./index-a0d8d357.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?a(()=>import("./image-73e461de.js"),[]).then(e=>e.default):a(()=>import("./index-8211384c.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?a(()=>import("./image-eee9ac42.js"),[]).then(e=>e.default):a(()=>import("./index-257af798.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?a(()=>import("./image-dc660df2.js"),[]).then(e=>e.default):a(()=>import("./index-362768b6.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?a(()=>import("./image-3049bab2.js"),[]).then(e=>e.default):a(()=>import("./index-6d87bae0.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?a(()=>import("./image-73015782.js"),[]).then(e=>e.default):a(()=>import("./index-076e41da.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?a(()=>import("./image-9be37efd.js"),[]).then(e=>e.default):a(()=>import("./index-db23cef0.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?a(()=>import("./image-def3c39a.js"),[]).then(e=>e.default):a(()=>import("./index-c4005ff6.js"),[]).then(e=>e.wallet);case"sh.frame":return t?a(()=>import("./image-81866b7a.js"),[]).then(e=>e.default):a(()=>import("./index-25b5d815.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?a(()=>import("./image-9748e3ec.js"),[]).then(e=>e.default):a(()=>import("./index-a19a1ed6.js"),[]).then(e=>e.wallet);case"org.base.account":return t?a(()=>import("./image-e65d639b.js"),[]).then(e=>e.default):a(()=>import("./index-39dc297d.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${i} not found`)}}function rd(i){const{createOptions:t}=i,e=bi();let r,n;function s(){r=void 0,n=void 0}let o=async()=>{},c=async u=>{n=u};const l=e.subscribe("chainChanged",u=>{n=u}),h=e.subscribe("disconnect",()=>{s(),l(),h()});return e.subscribe("accountChanged",u=>{r=u}),{autoConnect:async u=>{const{autoConnectBaseAccountSDK:d}=await a(()=>Promise.resolve().then(()=>yo),void 0),_=await i.providerFactory(),[p,f,w,g]=await d(u,e,_);return r=p,n=f,o=w,c=g,Ye({chainId:n.id,client:u.client,walletAddress:r.address,walletType:At}),r},connect:async u=>{const{connectBaseAccountSDK:d}=await a(()=>Promise.resolve().then(()=>yo),void 0),_=await i.providerFactory(),[p,f,w,g]=await d(u,e,_);return r=p,n=f,o=w,c=g,Ye({chainId:n.id,client:u.client,walletAddress:r.address,walletType:At}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(n)return n=Ii(n.id)||n,n},getConfig:()=>t,id:At,subscribe:e.subscribe,switchChain:async u=>{await c(u)}}}function Br(){if(!Pc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:i,hostname:t,port:e}=window.location;let r=`${i}//${t}`;e&&e!=="80"&&e!=="443"&&(r+=`:${e}`);const n=`${r}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:n,name:window.document.title||"thirdweb powered dApp",url:r}}let dn,Er;async function Lc(i){var s,o,c,l,h,u,d;if(dn){if(i&&Er){const _=((s=Er.chains)==null?void 0:s.map(g=>g.id))||[],p=((o=i.chains)==null?void 0:o.map(g=>g.id))||[],f=_.length===p.length&&_.every((g,I)=>g===p[I]),w=((c=i.appMetadata)==null?void 0:c.name)===((l=Er.appMetadata)==null?void 0:l.name);(!f||!w)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return dn}const{createBaseAccountSDK:t}=await a(()=>import("./index-54323fc3.js"),["assets/index-54323fc3.js","assets/jsxRuntime.module-5184af76.js","assets/hooks.module-dd6ad649.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/index-00639714.js","assets/parseSignature-16c7c561.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/to-serializable-transaction-2ea802ff.js","assets/transaction-e500e7c4.js","assets/transactionReceipt-c6fe2381.js","assets/rpc-4fa5fbde.js","assets/sha256-865a5e2e.js","assets/hashTypedData-ba8e399b.js","assets/get-bytecode-8cb4e224.js","assets/index-accd8060.js","assets/signing-67cb53a5.js","assets/hashBytecode-a29db705.js"]),e=Br(),n=t({appName:((h=i==null?void 0:i.appMetadata)==null?void 0:h.name)||e.name||"thirdweb powered dApp",appLogoUrl:((u=i==null?void 0:i.appMetadata)==null?void 0:u.logoUrl)||e.logoUrl||null,appChainIds:((d=i==null?void 0:i.chains)==null?void 0:d.map(_=>_.id))||[]}).getProvider();return dn=n,Er=i,n}function Vc(i){return i.id===At}function Eo({provider:i,address:t,client:e}){const r={address:te(t),async sendTransaction(n){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:te(t),gas:n.gas?Oe(n.gas):void 0,to:n.to,value:n.value?Oe(n.value):void 0}]});return Rs({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:te(t),walletType:At}),{transactionHash:s}},async signMessage({message:n}){if(!r.address)throw new Error("Provider not setup");const s=(()=>typeof n=="string"?Is(n):n.raw instanceof Uint8Array?As(n.raw):n.raw)(),o=await i.request({method:"personal_sign",params:[s,r.address]});if(!kr(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ds(n),l={EIP712Domain:hc(s),...n.types};dc({domain:s,message:o,primaryType:c,types:l});const h=_c({domain:s??{},message:o,primaryType:c,types:l}),u=await i.request({method:"eth_signTypedData_v4",params:[r.address,h]});if(!kr(u))throw new Error("Invalid signed payload returned");return u},sendCalls:async n=>{try{const{callParams:s,chain:o}=await Cs(n,r),c=await i.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${At} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:st(s)}`):s}},async getCallsStatus(n){try{const s=await i.request({method:"wallet_getCallsStatus",params:[n.id]});return xs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${At} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(n){const s=n.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[te(r.address)]});return Ss(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${At} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return r}function xc(i,t,e,r,n){const s=Eo({address:i,client:n,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",h),e.off("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(u){if(u[0]){const d=Eo({address:te(u[0]),client:n,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",u)}else c()}function h(u){const d=Ue(at(u));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",h),e.on("disconnect",c),[s,t,c,u=>Sc(e,u)]}async function nd(i,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const n=te(r[0]),s=await e.request({method:"eth_chainId"}),o=at(s);let c=i.chain&&i.chain.id===o?i.chain:Ue(o);return o&&(i!=null&&i.chain)&&o!==(i==null?void 0:i.chain.id)&&(await Sc(e,i.chain),c=i.chain),xc(n,c,e,t,i.client)}async function sd(i,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=at(s),c=i.chain&&i.chain.id===o?i.chain:Ue(o);return xc(n,c,e,t,i.client)}async function Sc(i,t){var s;const e=await i.request({method:"eth_chainId"}),r=Ue(at(e));if((r==null?void 0:r.id)===t.id)return;const n=Oe(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await Os(t);(o==null?void 0:o.code)===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:$s(c)}]})}}const yo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:sd,connectBaseAccountSDK:nd,getBaseAccountWebProvider:Lc,isBaseAccountSDKWallet:Vc},Symbol.toStringTag,{value:"Module"}));function od(i){const{createOptions:t}=i,e=bi();let r,n;function s(){r=void 0,n=void 0}let o=async()=>{},c=async u=>{n=u};const l=e.subscribe("chainChanged",u=>{n=u}),h=e.subscribe("disconnect",()=>{s(),l(),h()});return e.subscribe("accountChanged",u=>{r=u}),{autoConnect:async u=>{const{autoConnectCoinbaseWalletSDK:d}=await a(()=>Promise.resolve().then(()=>bo),void 0),_=await i.providerFactory(),[p,f,w,g]=await d(u,e,_);return r=p,n=f,o=w,c=g,Ye({chainId:n.id,client:u.client,walletAddress:r.address,walletType:nt}),r},connect:async u=>{const{connectCoinbaseWalletSDK:d}=await a(()=>Promise.resolve().then(()=>bo),void 0),_=await i.providerFactory(),[p,f,w,g]=await d(u,e,_);return r=p,n=f,o=w,c=g,Ye({chainId:n.id,client:u.client,walletAddress:r.address,walletType:nt}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(n)return n=Ii(n.id)||n,n},getConfig:()=>t,id:nt,onConnectRequested:async()=>{var u;if(i.onConnectRequested){const d=await i.providerFactory();return(u=i.onConnectRequested)==null?void 0:u.call(i,d)}},subscribe:e.subscribe,switchChain:async u=>{await c(u)}}}async function Cc(i){var t,e;await((e=(t=i==null?void 0:i.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const ad=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:Cc},Symbol.toStringTag,{value:"Module"}));let _n;async function $c(i){var t,e;if(!_n){let r=(await a(()=>import("./index-9e3730d4.js"),["assets/index-9e3730d4.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/signing-67cb53a5.js","assets/to-serializable-transaction-2ea802ff.js","assets/transaction-e500e7c4.js","assets/get-bytecode-8cb4e224.js","assets/hooks.module-dd6ad649.js","assets/index-00639714.js"])).default;typeof r!="function"&&typeof r.default=="function"&&(r=r.default);const s=new r({appChainIds:i!=null&&i.chains?i.chains.map(o=>o.id):void 0,appLogoUrl:((t=i==null?void 0:i.appMetadata)==null?void 0:t.logoUrl)||Br().logoUrl,appName:((e=i==null?void 0:i.appMetadata)==null?void 0:e.name)||Br().name}).makeWeb3Provider(i==null?void 0:i.walletConfig);return _n=s,s}return _n}function cd(i){return i.id===nt}function vo({provider:i,address:t,client:e}){const r={address:te(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await Cc(i)},async sendTransaction(n){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:te(t),gas:n.gas?Oe(n.gas):void 0,to:n.to,value:n.value?Oe(n.value):void 0}]});return Rs({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:te(t),walletType:nt}),{transactionHash:s}},async signMessage({message:n}){if(!r.address)throw new Error("Provider not setup");const s=(()=>typeof n=="string"?Is(n):n.raw instanceof Uint8Array?As(n.raw):n.raw)(),o=await i.request({method:"personal_sign",params:[s,r.address]});if(!kr(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ds(n),l={EIP712Domain:hc(s),...n.types};dc({domain:s,message:o,primaryType:c,types:l});const h=_c({domain:s??{},message:o,primaryType:c,types:l}),u=await i.request({method:"eth_signTypedData_v4",params:[r.address,h]});if(!kr(u))throw new Error("Invalid signed payload returned");return u},sendCalls:async n=>{try{const{callParams:s,chain:o}=await Cs(n,r),c=await i.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${nt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:st(s)}`):s}},async getCallsStatus(n){try{const s=await i.request({method:"wallet_getCallsStatus",params:[n.id]});return xs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${nt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(n){try{return await i.request({method:"wallet_getCallsStatus",params:[n.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${nt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(n){const s=n.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[te(r.address)]});return Ss(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${nt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return r}function kc(i,t,e,r,n){const s=vo({address:i,client:n,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",h),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(u){if(u[0]){const d=vo({address:te(u[0]),client:n,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",u)}else c()}function h(u){const d=Ue(at(u));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",h),e.on("disconnect",c),[s,t,c,u=>Nc(e,u)]}async function ld(i,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const n=te(r[0]),s=await e.request({method:"eth_chainId"}),o=at(s);let c=i.chain&&i.chain.id===o?i.chain:Ue(o);return o&&(i!=null&&i.chain)&&o!==(i==null?void 0:i.chain.id)&&(await Nc(e,i.chain),c=i.chain),kc(n,c,e,t,i.client)}async function ud(i,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=at(s),c=i.chain&&i.chain.id===o?i.chain:Ue(o);return kc(n,c,e,t,i.client)}async function Nc(i,t){var s;const e=await i.request({method:"eth_chainId"}),r=Ue(at(e));if((r==null?void 0:r.id)===t.id)return;const n=Oe(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await Os(t);(o==null?void 0:o.code)===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:$s(c)}]})}}const bo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:ud,connectCoinbaseWalletSDK:ld,getCoinbaseWebProvider:$c,isCoinbaseSDKWallet:cd},Symbol.toStringTag,{value:"Module"}));function Uc(...i){const[t,e]=i,r={id:t,partnerId:e==null?void 0:e.partnerId};return Qu({connectorFactory:async n=>{const{InAppWebConnector:s}=await a(()=>import("./web-connector-3a1204fd.js"),["assets/web-connector-3a1204fd.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/utils-74c631d9.js","assets/execute-6c88dd5f.js","assets/prepare-contract-call-ac31a985.js","assets/types-ba990c1e.js","assets/redirect-state-202ec690.js","assets/transaction-e500e7c4.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/sleep-9eff569f.js"]);return new s({client:n,ecosystem:r,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:r.partnerId},ecosystem:r})}function Ns(i){const t=bi();let e,r,n,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(()=>import("./index-2e071cd2.js"),["assets/index-2e071cd2.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/transaction-e500e7c4.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/to-serializable-transaction-2ea802ff.js","assets/execute-6c88dd5f.js","assets/signing-67cb53a5.js","assets/get-bytecode-8cb4e224.js","assets/send-eip712-transaction-67b51817.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/hashBytecode-a29db705.js","assets/sha256-865a5e2e.js","assets/send-transaction-5984dc09.js","assets/redirect-state-202ec690.js","assets/index-5f847edd.js","assets/ethereum-667be7dc.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-ba8e399b.js","assets/index-276c1c99.js","assets/index-accd8060.js","assets/index-2124b7cd.js","assets/index-6ab757a5.js","assets/index-69ac8519.js"]),[l,h]=await c(o,i);return s=o,e=l,n=h,Ye({chainId:n.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(()=>import("./index-2e071cd2.js"),["assets/index-2e071cd2.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/transaction-e500e7c4.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/to-serializable-transaction-2ea802ff.js","assets/execute-6c88dd5f.js","assets/signing-67cb53a5.js","assets/get-bytecode-8cb4e224.js","assets/send-eip712-transaction-67b51817.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/hashBytecode-a29db705.js","assets/sha256-865a5e2e.js","assets/send-transaction-5984dc09.js","assets/redirect-state-202ec690.js","assets/index-5f847edd.js","assets/ethereum-667be7dc.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-ba8e399b.js","assets/index-276c1c99.js","assets/index-accd8060.js","assets/index-2124b7cd.js","assets/index-6ab757a5.js","assets/index-69ac8519.js"]),[l,h]=await c(o,i);return r=o.personalAccount,s=o,e=l,n=h,Ye({chainId:n.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await a(()=>import("./index-2e071cd2.js"),["assets/index-2e071cd2.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/transaction-e500e7c4.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/to-serializable-transaction-2ea802ff.js","assets/execute-6c88dd5f.js","assets/signing-67cb53a5.js","assets/get-bytecode-8cb4e224.js","assets/send-eip712-transaction-67b51817.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/hashBytecode-a29db705.js","assets/sha256-865a5e2e.js","assets/send-transaction-5984dc09.js","assets/redirect-state-202ec690.js","assets/index-5f847edd.js","assets/ethereum-667be7dc.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-ba8e399b.js","assets/index-276c1c99.js","assets/index-accd8060.js","assets/index-2124b7cd.js","assets/index-6ab757a5.js","assets/index-69ac8519.js"]);await o(e)}e=void 0,r=void 0,n=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>r,getChain(){if(n)return n=Ii(n.id)||n,n},getConfig:()=>i,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var d;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await gh(o)){const _=yc({address:i.factoryAddress||bh((d=i.overrides)==null?void 0:d.entrypointAddress),chain:o,client:s.client});if(!await Uu(_))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(()=>import("./index-2e071cd2.js"),["assets/index-2e071cd2.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/transaction-e500e7c4.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/to-serializable-transaction-2ea802ff.js","assets/execute-6c88dd5f.js","assets/signing-67cb53a5.js","assets/get-bytecode-8cb4e224.js","assets/send-eip712-transaction-67b51817.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/hashBytecode-a29db705.js","assets/sha256-865a5e2e.js","assets/send-transaction-5984dc09.js","assets/redirect-state-202ec690.js","assets/index-5f847edd.js","assets/ethereum-667be7dc.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-ba8e399b.js","assets/index-276c1c99.js","assets/index-accd8060.js","assets/index-2124b7cd.js","assets/index-6ab757a5.js","assets/index-69ac8519.js"]),[h,u]=await l({...s,chain:o},{...i,chain:o});e=h,n=u,t.emit("accountChanged",h),t.emit("chainChanged",u)}}}function rt(...i){const[t,e]=i;switch(!0){case t==="smart":return Ns(e);case(t==="embedded"||t==="inApp"):return Nn(e);case Ti(t):return Uc(...i);case t===nt:{const r=e;return od({createOptions:r,onConnectRequested:async n=>{const{showCoinbasePopup:s}=await a(()=>Promise.resolve().then(()=>ad),void 0);return s(n)},providerFactory:()=>$c(r)})}case t===At:{const r=e;return rd({createOptions:r,providerFactory:()=>Lc(r)})}default:{let c=function(){n=void 0,s=void 0};const r=bi();let n,s,o,l=async()=>{};const h=r.subscribe("disconnect",()=>{c(),o==null||o(),h()});r.subscribe("accountChanged",p=>{n=p});let u=async()=>{throw new Error("Not implemented yet")};const d=mo()?p=>hn(p):void 0,_={autoConnect:async p=>{const{injectedProvider:f}=await a(()=>Promise.resolve().then(()=>Ao),void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:w}=await a(()=>Promise.resolve().then(()=>To),void 0),[g,I,T,y]=await w({chain:p.chain,client:p.client,emitter:r,id:t,provider:Fn(t)});return n=g,s=I,l=T,u=y,o=r.subscribe("chainChanged",v=>{s=v}),Ye({chainId:s.id,client:p.client,walletAddress:n.address,walletType:t}),n}if(p&&"client"in p){const{autoConnectWC:w}=await a(()=>import("./controller-83cf739b.js"),["assets/controller-83cf739b.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/transaction-e500e7c4.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/redirect-state-202ec690.js","assets/execute-6c88dd5f.js","assets/rpc-4fa5fbde.js","assets/to-serializable-transaction-2ea802ff.js","assets/hashTypedData-ba8e399b.js","assets/signing-67cb53a5.js","assets/get-bytecode-8cb4e224.js","assets/index-5f847edd.js","assets/ethereum-667be7dc.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/send-transaction-5984dc09.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-276c1c99.js","assets/index-accd8060.js","assets/index-2124b7cd.js","assets/index-6ab757a5.js","assets/index-69ac8519.js"]),[g,I,T,y]=await w(p,r,_.id,Nr,d);return n=g,s=I,l=T,u=y,Ye({chainId:s.id,client:p.client,walletAddress:n.address,walletType:t}),n}throw new Error("Failed to auto connect")},connect:async p=>{async function f(I){var v;const{connectWC:T}=await a(()=>import("./controller-83cf739b.js"),["assets/controller-83cf739b.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/transaction-e500e7c4.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/redirect-state-202ec690.js","assets/execute-6c88dd5f.js","assets/rpc-4fa5fbde.js","assets/to-serializable-transaction-2ea802ff.js","assets/hashTypedData-ba8e399b.js","assets/signing-67cb53a5.js","assets/get-bytecode-8cb4e224.js","assets/index-5f847edd.js","assets/ethereum-667be7dc.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/send-transaction-5984dc09.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-276c1c99.js","assets/index-accd8060.js","assets/index-2124b7cd.js","assets/index-6ab757a5.js","assets/index-69ac8519.js"]);let y;try{const[b,D,N,S]=await T({...I,walletConnect:{...I.walletConnect,onDisplayUri:((v=I.walletConnect)==null?void 0:v.onDisplayUri)||(async m=>{var P,E;if(typeof window<"u"&&typeof document<"u")if(mo()){const A=await Dc(t),O=A.mobile.native||A.mobile.universal;hn(O?Qh(O,m).redirect:m);return}else try{const{createQROverlay:A}=await a(()=>import("./qr-overlay-548b2074.js"),["assets/qr-overlay-548b2074.js","assets/index-355751ab.js","assets/index-e7f3149f.css"]);y&&y.destroy(),y=A(m,{theme:((E=(P=I.walletConnect)==null?void 0:P.qrModalOptions)==null?void 0:E.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var O,V;(V=(O=I.walletConnect)==null?void 0:O.onCancel)==null||V.call(O)}})}catch(A){console.error("Failed to create QR overlay:",A)}})}},r,_.id,Nr,d);return y&&(y.destroy(),y=void 0),n=b,s=D,l=N,u=S,Ye({chainId:s.id,client:I.client,walletAddress:n.address,walletType:t}),n}catch(b){throw y&&(y.destroy(),y=void 0),b}}if(t==="walletConnect"){const{client:I,chain:T,...y}=p;return f({chain:T,client:I,walletConnect:{...y}})}const w=p&&"walletConnect"in p,{injectedProvider:g}=await a(()=>Promise.resolve().then(()=>Ao),void 0);if(g(t)&&!w){const{connectEip1193Wallet:I}=await a(()=>Promise.resolve().then(()=>To),void 0),[T,y,v,b]=await I({chain:p.chain,client:p.client,emitter:r,id:t,provider:Fn(t)});return n=T,s=y,l=v,u=b,o=r.subscribe("chainChanged",D=>{s=D}),Ye({chainId:s.id,client:p.client,walletAddress:n.address,walletType:t}),n}if(p&&"client"in p)return f(p);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>n,getChain(){if(s)return s=Ii(s.id)||s,s},getConfig:()=>i[1],id:t,subscribe:r.subscribe,switchChain:async p=>{try{await u(p),s=p}catch(f){console.error("Error switching chain",f)}}};return _}}}function hd(){return rt("walletConnect")}const Io=(()=>Pc()?Ah():void 0)();function Us(i){const t=Bs().find(e=>e.info.rdns===i);return t==null?void 0:t.provider}function Bc(){return Bs().map(e=>e.info.rdns).map(e=>rt(e))}function dd(){if(Io)return Io}function Bs(){var t;const i=((t=dd())==null?void 0:t.getProviders())||[];for(const e of i)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=Tc;break}return i}const Ao=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Bs,getInstalledWallets:Bc,injectedProvider:Us},Symbol.toStringTag,{value:"Module"}));function Fn(i){const t=Us(i);if(!t)throw new Error(`No injected provider found for wallet: "${i}"`);return t}async function Fc({id:i,provider:t,emitter:e,client:r,chain:n}){var _,p;let s,c=0;for(;!(s!=null&&s[0])&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(f){if(console.error(f),(p=(_=_d(f))==null?void 0:_.toLowerCase())!=null&&p.includes("rejected"))throw f;await new Promise(w=>setTimeout(w,500))}c++}const l=s==null?void 0:s[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const h=te(l),u=await t.request({method:"eth_chainId"}).then(at).catch(f=>{throw new Error("Error reading chainId from provider",f)});let d=n&&n.id===u?n:Ue(u);try{n&&typeof n.id<"u"&&n.id!==u&&(await zc(t,n),d=n)}catch{console.warn(`Error switching to chain ${n==null?void 0:n.id} - defaulting to wallet chain (${u})`)}return Mc({address:h,chain:d,client:r,emitter:e,id:i,provider:t})}async function qc({id:i,provider:t,emitter:e,client:r,chain:n}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=te(o),l=await t.request({method:"eth_chainId"}).then(at),h=n&&n.id===l?n:Ue(l);return Mc({address:c,chain:h,client:r,emitter:e,id:i,provider:t})}function Po({provider:i,address:t,client:e,id:r}){const n={address:te(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:Oe(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?Oe(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?Oe(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?Oe(s.gas):void 0,nonce:s.nonce?Oe(s.nonce):void 0,to:s.to?te(s.to):void 0,data:s.data,value:s.value?Oe(s.value):void 0,authorizationList:s.authorizationList?Bu(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await i.request({method:"eth_sendTransaction",params:c});return Rs({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:te(t),walletType:r}),{transactionHash:l}}catch(l){throw dh(l)&&_h({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:te(t)}),l}},async signMessage({message:s}){if(!n.address)throw new Error("Provider not setup");const o=(()=>typeof s=="string"?Is(s):s.raw instanceof Uint8Array?As(s.raw):s.raw)();return await i.request({method:"personal_sign",params:[o,te(n.address)]})},async signAuthorization(s){const o=pc(s);let c;try{c=await i.request({method:"eth_sign",params:[te(n.address),o]})}catch{c=await i.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=Fu(c);return{...s,...l}},async signTypedData(s){if(!i||!n.address)throw new Error("Provider not setup");const o=Ds(s),{domain:c,message:l,primaryType:h}=o,u={EIP712Domain:Ph({domain:c}),...o.types};Th({domain:c,message:l,primaryType:h,types:u});const d=Oh({domain:c??{},message:l,primaryType:h,types:u});return await i.request({method:"eth_signTypedData_v4",params:[te(n.address),d]})},async watchAsset(s){return await i.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Cs(s,n),l=await i.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:c,client:e,id:l.id}:{chain:c,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:mh(o)}`):o}},async getCallsStatus(s){try{const o=await i.request({method:"wallet_getCallsStatus",params:[s.id]});return xs(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await i.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const c=await i.request({method:"wallet_getCapabilities",params:[te(n.address),o?[Oe(o)]:void 0]});return Ss(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${r} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return n}async function Mc({provider:i,address:t,chain:e,emitter:r,client:n,id:s}){const o=Po({address:t,client:n,id:s,provider:i});async function c(){i.removeListener("accountsChanged",h),i.removeListener("chainChanged",u),i.removeListener("disconnect",l);try{await Rh(()=>i.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(d){(d==null?void 0:d.code)!==1013&&(c(),r.emit("disconnect",d??void 0))}function h(d){if(d[0]){const _=Po({address:te(d[0]),client:n,id:s,provider:i});r.emit("accountChanged",_),r.emit("accountsChanged",d)}else l()}function u(d){const _=Ue(at(d));r.emit("chainChanged",_)}return i.on&&(i.on("accountsChanged",h),i.on("chainChanged",u),i.on("disconnect",l)),[o,e,l,d=>zc(i,d)]}async function zc(i,t){var r;const e=Oe(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const n=await Os(t);await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(r=n.explorers)==null?void 0:r.map(s=>s.url),chainId:e,chainName:n.name,nativeCurrency:n.nativeCurrency,rpcUrls:$s(n)}]})}}function _d(i){return i instanceof Error?i.message:typeof i=="string"?i:typeof i=="object"&&i!==null?JSON.stringify(i):String(i)}const To=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:qc,connectEip1193Wallet:Fc,getInjectedProvider:Fn},Symbol.toStringTag,{value:"Module"}));function pd(i){const t=i.walletId??"adapter",e=bi();let r,n,s;const o=async _=>(s=typeof i.provider=="function"?await i.provider(_):i.provider,s),c=e.subscribe("chainChanged",_=>{n=_});function l(){r=void 0,n=void 0}let h=async()=>{};const u=e.subscribe("disconnect",()=>{l(),c(),u()});e.subscribe("accountChanged",_=>{r=_});let d=async _=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:Yu(_.id)}]}))};return{autoConnect:async _=>{var I;const[p,f,w,g]=await qc({chain:_.chain,client:_.client,emitter:e,id:t,provider:await o({chainId:(I=_.chain)==null?void 0:I.id})});return r=p,n=f,h=w,d=g,e.emit("onConnect",_),Ye({client:_.client,walletAddress:r.address,walletType:t}),r},connect:async _=>{var I;const[p,f,w,g]=await Fc({chain:_.chain,client:_.client,emitter:e,id:t,provider:await o({chainId:(I=_.chain)==null?void 0:I.id})});return r=p,n=f,h=w,d=g,e.emit("onConnect",_),Ye({client:_.client,walletAddress:r.address,walletType:t}),r},disconnect:async()=>{l(),await h(),e.emit("disconnect",void 0)},getAccount:()=>r,getChain(){if(n)return n=Ii(n.id)||n,n},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async _=>{await d(_),e.emit("chainChanged",_)}}}function fd(i){const{chain:t,client:e,wallet:r,connectOverride:n}=i,s=Ps({chain:t,client:e}),o=new Map;return{on:(c,l)=>{const h=r.subscribe(c,l);let u=o.get(c);u||(u=new Map,o.set(c,u)),u.set(l,h)},removeListener:(c,l)=>{const h=o.get(c),u=h==null?void 0:h.get(l);u&&(u(),h==null||h.delete(l))},request:async c=>{switch(c.method){case"eth_sendTransaction":{const l=r.getAccount();if(!l)throw new Error("Account not connected");return(await bc({account:l,transaction:kn({...c.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const l=r.getAccount();if(!l)throw new Error("Account not connected");return Eh({account:l,transaction:kn({...c.params[0],chain:t,client:e})})}case"personal_sign":{const l=r.getAccount();if(!l)throw new Error("Account not connected");return l.signMessage({message:{raw:c.params[0]}})}case"eth_signTypedData_v4":{const l=r.getAccount();if(!l)throw new Error("Account not connected");const h=JSON.parse(c.params[1]);return l.signTypedData(h)}case"eth_accounts":{const l=r.getAccount();return l?[l.address]:[]}case"eth_requestAccounts":{const l=r.getAccount();if(l)return[l.address];const h=n?await n(r):await r.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!h)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[h.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const h=c.params[0].chainId;if(!h)throw new Error("Chain ID is required");const u=$n(h)?ii(h):h,d=Ue(u);return r.switchChain(d)}case"wallet_getCapabilities":{const l=r.getAccount();if(!l)throw new Error("Account not connected");if(!l.getCapabilities)throw new Error("Wallet does not support EIP-5792");const h=c.params[1];if(h&&Array.isArray(h)){const u=h[0],d=$n(u)?ii(u):Number(u);return l.getCapabilities(d?{chainId:d}:{})}return l.getCapabilities({})}case"wallet_sendCalls":{const l=r.getAccount();if(!l)throw new Error("Account not connected");if(!l.sendCalls)throw new Error("Wallet does not support EIP-5792");return l.sendCalls({...c.params[0],chain:t})}case"wallet_getCallsStatus":{const l=r.getAccount();if(!l)throw new Error("Account not connected");if(!l.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await l.getCallsStatusRaw({id:c.params[0],chain:t,client:e})}default:return s(c)}}}}const wd=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:pd,toProvider:fd},Symbol.toStringTag,{value:"Module"}));function gd(i){const t=bi();let e=i.chain;return{autoConnect:async()=>(t.emit("onConnect",i),i.adaptedAccount),connect:async()=>(t.emit("onConnect",i),i.adaptedAccount),disconnect:async()=>{await i.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return i.adaptedAccount},getChain(){return e=Ii(e.id)||e,e},getConfig(){return i},id:"adapter",subscribe:t.subscribe,switchChain:async r=>{await i.switchChain(r),e=r,t.emit("chainChanged",r)}}}async function md(){return(await a(()=>import("./wallet-infos-fd18fc6b.js"),[])).default}function Ed(i){if("privateKey"in i){const t=Kh(typeof i.message=="object"?i.message.raw:gc(i.message)),e=bs({payload:t,privateKey:i.privateKey});return fc(e)}if("account"in i){const{message:t,account:e}=i;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function yd(i){var s;const{privateKey:t,...e}=i;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=Zu(e.domain.chainId));const r=qu(e),n=bs({payload:r,privateKey:t});return fc(n)}function qn(i){const{client:t}=i,e=`0x${i.privateKey.replace(/^0x/,"")}`,r=mc(wc.getPublicKey(e.slice(2),!1)),n=Dh(r);return{address:te(n),sendTransaction:async o=>{const c=Ps({chain:Ue(o.chainId),client:t}),l=ho({privateKey:e,transaction:o});return{transactionHash:await Lh(c,l)}},signAuthorization:async o=>{const c=bs({payload:pc(o),privateKey:e});return Mu(o,{signature:c})},signMessage:async({message:o})=>Ed({message:o,privateKey:e}),signTransaction:async o=>ho({privateKey:e,transaction:o}),signTypedData:async o=>yd({...o,privateKey:e})}}async function vd(i){const t=mc(wc.utils.randomPrivateKey());return qn({client:i.client,privateKey:t})}async function bd(i){const{address:t,client:e,chain:r}=i,n=i.tokenAddress||(r.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(n&&te(n)!==te(_o)){const{getBalance:u}=await a(()=>import("./getBalance-0308f38f.js"),["assets/getBalance-0308f38f.js","assets/to-serializable-transaction-2ea802ff.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/transaction-e500e7c4.js","assets/signing-67cb53a5.js","assets/get-bytecode-8cb4e224.js","assets/decimals-9d5fec14.js"]);return u({address:t,contract:yc({address:n,chain:r,client:e})})}const s=Ps({chain:r,client:e}),[o,c,l,h]=await Promise.all([ah(r),ch(r),lh(r),zu(s,{address:t})]);return{chainId:r.id,decimals:c,displayValue:yh(h,c),name:l,symbol:o,tokenAddress:n??_o,value:h}}const Oo=qh;var wi=pt;const ir=xd().console||{},Id={mapHttpRequest:yr,mapHttpResponse:yr,wrapRequestSerializer:pn,wrapResponseSerializer:pn,wrapErrorSerializer:pn,req:yr,res:yr,err:Rd};function Ad(i,t){return Array.isArray(i)?i.filter(function(r){return r!=="!stdSerializers.err"}):i===!0?Object.keys(t):!1}function pt(i){i=i||{},i.browser=i.browser||{};const t=i.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const e=i.browser.write||ir;i.browser.write&&(i.browser.asObject=!0);const r=i.serializers||{},n=Ad(i.browser.serialize,r);let s=i.browser.serialize;Array.isArray(i.browser.serialize)&&i.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof e=="function"&&(e.error=e.fatal=e.warn=e.info=e.debug=e.trace=e),i.enabled===!1&&(i.level="silent");const c=i.level||"info",l=Object.create(e);l.log||(l.log=rr),Object.defineProperty(l,"levelVal",{get:u}),Object.defineProperty(l,"level",{get:d,set:_});const h={transmit:t,serialize:n,asObject:i.browser.asObject,levels:o,timestamp:Dd(i)};l.levels=pt.levels,l.level=c,l.setMaxListeners=l.getMaxListeners=l.emit=l.addListener=l.on=l.prependListener=l.once=l.prependOnceListener=l.removeListener=l.removeAllListeners=l.listeners=l.listenerCount=l.eventNames=l.write=l.flush=rr,l.serializers=r,l._serialize=n,l._stdErrSerialize=s,l.child=p,t&&(l._logEvent=Mn());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function _(f){if(f!=="silent"&&!this.levels.values[f])throw Error("unknown level "+f);this._level=f,ci(h,l,"error","log"),ci(h,l,"fatal","error"),ci(h,l,"warn","error"),ci(h,l,"info","log"),ci(h,l,"debug","log"),ci(h,l,"trace","log")}function p(f,w){if(!f)throw new Error("missing bindings for child Pino");w=w||{},n&&f.serializers&&(w.serializers=f.serializers);const g=w.serializers;if(n&&g){var I=Object.assign({},r,g),T=i.browser.serialize===!0?Object.keys(I):n;delete f.serializers,Zr([f],T,I,this._stdErrSerialize)}function y(v){this._childLevel=(v._childLevel|0)+1,this.error=li(v,f,"error"),this.fatal=li(v,f,"fatal"),this.warn=li(v,f,"warn"),this.info=li(v,f,"info"),this.debug=li(v,f,"debug"),this.trace=li(v,f,"trace"),I&&(this.serializers=I,this._serialize=T),t&&(this._logEvent=Mn([].concat(v._logEvent.bindings,f)))}return y.prototype=this,new y(this)}return l}pt.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};pt.stdSerializers=Id;pt.stdTimeFunctions=Object.assign({},{nullTime:jc,epochTime:Kc,unixTime:Ld,isoTime:Vd});function ci(i,t,e,r){const n=Object.getPrototypeOf(t);t[e]=t.levelVal>t.levels.values[e]?rr:n[e]?n[e]:ir[e]||ir[r]||rr,Pd(i,t,e)}function Pd(i,t,e){!i.transmit&&t[e]===rr||(t[e]=function(r){return function(){const s=i.timestamp(),o=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===ir?ir:this;for(var l=0;l<o.length;l++)o[l]=arguments[l];if(i.serialize&&!i.asObject&&Zr(o,this._serialize,this.serializers,this._stdErrSerialize),i.asObject?r.call(c,Td(this,e,o,s)):r.apply(c,o),i.transmit){const h=i.transmit.level||t.level,u=pt.levels.values[h],d=pt.levels.values[e];if(d<u)return;Od(this,{ts:s,methodLevel:e,methodValue:d,transmitLevel:h,transmitValue:pt.levels.values[i.transmit.level||t.level],send:i.transmit.send,val:t.levelVal},o)}}}(t[e]))}function Td(i,t,e,r){i._serialize&&Zr(e,i._serialize,i.serializers,i._stdErrSerialize);const n=e.slice();let s=n[0];const o={};r&&(o.time=r),o.level=pt.levels.values[t];let c=(i._childLevel|0)+1;if(c<1&&(c=1),s!==null&&typeof s=="object"){for(;c--&&typeof n[0]=="object";)Object.assign(o,n.shift());s=n.length?Oo(n.shift(),n):void 0}else typeof s=="string"&&(s=Oo(n.shift(),n));return s!==void 0&&(o.msg=s),o}function Zr(i,t,e,r){for(const n in i)if(r&&i[n]instanceof Error)i[n]=pt.stdSerializers.err(i[n]);else if(typeof i[n]=="object"&&!Array.isArray(i[n]))for(const s in i[n])t&&t.indexOf(s)>-1&&s in e&&(i[n][s]=e[s](i[n][s]))}function li(i,t,e){return function(){const r=new Array(1+arguments.length);r[0]=t;for(var n=1;n<r.length;n++)r[n]=arguments[n-1];return i[e].apply(this,r)}}function Od(i,t,e){const r=t.send,n=t.ts,s=t.methodLevel,o=t.methodValue,c=t.val,l=i._logEvent.bindings;Zr(e,i._serialize||Object.keys(i.serializers),i.serializers,i._stdErrSerialize===void 0?!0:i._stdErrSerialize),i._logEvent.ts=n,i._logEvent.messages=e.filter(function(h){return l.indexOf(h)===-1}),i._logEvent.level.label=s,i._logEvent.level.value=o,r(s,i._logEvent,c),i._logEvent=Mn(l)}function Mn(i){return{ts:0,messages:[],bindings:i||[],level:{label:"",value:0}}}function Rd(i){const t={type:i.constructor.name,msg:i.message,stack:i.stack};for(const e in i)t[e]===void 0&&(t[e]=i[e]);return t}function Dd(i){return typeof i.timestamp=="function"?i.timestamp:i.timestamp===!1?jc:Kc}function yr(){return{}}function pn(i){return i}function rr(){}function jc(){return!1}function Kc(){return Date.now()}function Ld(){return Math.round(Date.now()/1e3)}function Vd(){return new Date(Date.now()).toISOString()}function xd(){function i(t){return typeof t<"u"&&t}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return i(self)||i(window)||i(this)||{}}}const Qr=vh(wi),Sd={level:"info"},_r="custom_context",Fs=1e3*1024;let Cd=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},Ro=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new Cd(t);if(e.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${e.size}`);for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let e=this.head;for(;e!==null;)t.push(e.value),e=e.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const e=t.value;return t=t.next,{done:!1,value:e}}}}};class Hc{constructor(t,e=Fs){this.level=t??"error",this.levelValue=wi.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new Ro(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===wi.levels.values.error?console.error(t):e===wi.levels.values.warn?console.warn(t):e===wi.levels.values.debug?console.debug(t):e===wi.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(Un({timestamp:new Date().toISOString(),log:t}));const e=typeof t=="string"?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}getLogs(){return this.logs}clearLogs(){this.logs=new Ro(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(Un({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let $d=class{constructor(t,e=Fs){this.baseChunkLogger=new Hc(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const e=URL.createObjectURL(this.logsToBlob(t)),r=document.createElement("a");r.href=e,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(e)}},kd=class{constructor(t,e=Fs){this.baseChunkLogger=new Hc(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var Nd=Object.defineProperty,Ud=Object.defineProperties,Bd=Object.getOwnPropertyDescriptors,Do=Object.getOwnPropertySymbols,Fd=Object.prototype.hasOwnProperty,qd=Object.prototype.propertyIsEnumerable,Lo=(i,t,e)=>t in i?Nd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fr=(i,t)=>{for(var e in t||(t={}))Fd.call(t,e)&&Lo(i,e,t[e]);if(Do)for(var e of Do(t))qd.call(t,e)&&Lo(i,e,t[e]);return i},qr=(i,t)=>Ud(i,Bd(t));function qs(i){return qr(Fr({},i),{level:(i==null?void 0:i.level)||Sd.level})}function Md(i,t=_r){return i[t]||""}function zd(i,t,e=_r){return i[e]=t,i}function Be(i,t=_r){let e="";return typeof i.bindings>"u"?e=Md(i,t):e=i.bindings().context||"",e}function jd(i,t,e=_r){const r=Be(i,e);return r.trim()?`${r}/${t}`:t}function Le(i,t,e=_r){const r=jd(i,t,e),n=i.child({context:r});return zd(n,r,e)}function Kd(i){var t,e;const r=new $d((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:Qr(qr(Fr({},i.opts),{level:"trace",browser:qr(Fr({},(e=i.opts)==null?void 0:e.browser),{write:n=>r.write(n)})})),chunkLoggerController:r}}function Hd(i){var t;const e=new kd((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:Qr(qr(Fr({},i.opts),{level:"trace"}),e),chunkLoggerController:e}}function Wd(i){return typeof i.loggerOverride<"u"&&typeof i.loggerOverride!="string"?{logger:i.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Kd(i):Hd(i)}var Gd=Object.defineProperty,Jd=(i,t,e)=>t in i?Gd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Vo=(i,t,e)=>Jd(i,typeof t!="symbol"?t+"":t,e);class Yd extends Ai{constructor(t){super(),this.opts=t,Vo(this,"protocol","wc"),Vo(this,"version",2)}}var Zd=Object.defineProperty,Qd=(i,t,e)=>t in i?Zd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xd=(i,t,e)=>Qd(i,typeof t!="symbol"?t+"":t,e);class e_ extends Ai{constructor(t,e){super(),this.core=t,this.logger=e,Xd(this,"records",new Map)}}class t_{constructor(t,e){this.logger=t,this.core=e}}class i_ extends Ai{constructor(t,e){super(),this.relayer=t,this.logger=e}}let r_=class extends Ai{constructor(t){super()}},n_=class{constructor(t,e,r,n){this.core=t,this.logger=e,this.name=r}},s_=class extends Ai{constructor(t,e){super(),this.relayer=t,this.logger=e}};class o_ extends Ai{constructor(t,e){super(),this.core=t,this.logger=e}}let a_=class{constructor(t,e,r){this.core=t,this.logger=e,this.store=r}},c_=class{constructor(t,e){this.projectId=t,this.logger=e}},l_=class{constructor(t,e,r){this.core=t,this.logger=e,this.telemetryEnabled=r}};var u_=Object.defineProperty,h_=(i,t,e)=>t in i?u_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,xo=(i,t,e)=>h_(i,typeof t!="symbol"?t+"":t,e);let d_=class{constructor(t){this.opts=t,xo(this,"protocol","wc"),xo(this,"version",2)}},__=class{constructor(t){this.client=t}};function nr(i,{strict:t=!0}={}){return!i||typeof i!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(i):i.startsWith("0x")}function zn(i){return nr(i,{strict:!1})?Math.ceil((i.length-2)/2):i.length}const Wc="2.31.0";let Si={getDocsUrl:({docsBaseUrl:i,docsPath:t="",docsSlug:e})=>t?`${i??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${Wc}`};class ri extends Error{constructor(t,e={}){var c;const r=(()=>{var l;return e.cause instanceof ri?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),n=(()=>e.cause instanceof ri&&e.cause.docsPath||e.docsPath)(),s=(c=Si.getDocsUrl)==null?void 0:c.call(Si,{...e,docsPath:n}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Si.version?[`Version: ${Si.version}`]:[]].join(`
3
- `);super(o,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=Wc}walk(t){return Gc(this,t)}}function Gc(i,t){return t!=null&&t(i)?i:i&&typeof i=="object"&&"cause"in i&&i.cause!==void 0?Gc(i.cause,t):t?null:i}class Jc extends ri{constructor({size:t,targetSize:e,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Oi(i,{dir:t,size:e=32}={}){return typeof i=="string"?p_(i,{dir:t,size:e}):f_(i,{dir:t,size:e})}function p_(i,{dir:t,size:e=32}={}){if(e===null)return i;const r=i.replace("0x","");if(r.length>e*2)throw new Jc({size:Math.ceil(r.length/2),targetSize:e,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function f_(i,{dir:t,size:e=32}={}){if(e===null)return i;if(i.length>e)throw new Jc({size:i.length,targetSize:e,type:"bytes"});const r=new Uint8Array(e);for(let n=0;n<e;n++){const s=t==="right";r[s?n:e-n-1]=i[s?n:i.length-n-1]}return r}class w_ extends ri{constructor({max:t,min:e,signed:r,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${n*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class g_ extends ri{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Ri(i,{size:t}){if(zn(i)>t)throw new g_({givenSize:zn(i),maxSize:t})}function jn(i,t={}){const{signed:e}=t;t.size&&Ri(i,{size:t.size});const r=BigInt(i);if(!e)return r;const n=(i.length-2)/2,s=(1n<<BigInt(n)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(n*2,"f")}`)-1n}function m_(i,t={}){return Number(jn(i,t))}const E_=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function Kn(i,t={}){return typeof i=="number"||typeof i=="bigint"?Zc(i,t):typeof i=="string"?b_(i,t):typeof i=="boolean"?y_(i,t):Yc(i,t)}function y_(i,t={}){const e=`0x${Number(i)}`;return typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{size:t.size})):e}function Yc(i,t={}){let e="";for(let n=0;n<i.length;n++)e+=E_[i[n]];const r=`0x${e}`;return typeof t.size=="number"?(Ri(r,{size:t.size}),Oi(r,{dir:"right",size:t.size})):r}function Zc(i,t={}){const{signed:e,size:r}=t,n=BigInt(i);let s;r?e?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof i=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&n>s||n<o){const l=typeof i=="bigint"?"n":"";throw new w_({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:r,value:`${i}${l}`})}const c=`0x${(e&&n<0?(1n<<BigInt(r*8))+BigInt(n):n).toString(16)}`;return r?Oi(c,{size:r}):c}const v_=new TextEncoder;function b_(i,t={}){const e=v_.encode(i);return Yc(e,t)}const I_=new TextEncoder;function A_(i,t={}){return typeof i=="number"||typeof i=="bigint"?T_(i,t):typeof i=="boolean"?P_(i,t):nr(i)?Qc(i,t):Xc(i,t)}function P_(i,t={}){const e=new Uint8Array(1);return e[0]=Number(i),typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{size:t.size})):e}const mt={zero:48,nine:57,A:65,F:70,a:97,f:102};function So(i){if(i>=mt.zero&&i<=mt.nine)return i-mt.zero;if(i>=mt.A&&i<=mt.F)return i-(mt.A-10);if(i>=mt.a&&i<=mt.f)return i-(mt.a-10)}function Qc(i,t={}){let e=i;t.size&&(Ri(e,{size:t.size}),e=Oi(e,{dir:"right",size:t.size}));let r=e.slice(2);r.length%2&&(r=`0${r}`);const n=r.length/2,s=new Uint8Array(n);for(let o=0,c=0;o<n;o++){const l=So(r.charCodeAt(c++)),h=So(r.charCodeAt(c++));if(l===void 0||h===void 0)throw new ri(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[o]=l*16+h}return s}function T_(i,t){const e=Zc(i,t);return Qc(e)}function Xc(i,t={}){const e=I_.encode(i);return typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{dir:"right",size:t.size})):e}const vr=BigInt(2**32-1),Co=BigInt(32);function O_(i,t=!1){return t?{h:Number(i&vr),l:Number(i>>Co&vr)}:{h:Number(i>>Co&vr)|0,l:Number(i&vr)|0}}function R_(i,t=!1){const e=i.length;let r=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=O_(i[s],t);[r[s],n[s]]=[o,c]}return[r,n]}const D_=(i,t,e)=>i<<e|t>>>32-e,L_=(i,t,e)=>t<<e|i>>>32-e,V_=(i,t,e)=>t<<e-32|i>>>64-e,x_=(i,t,e)=>i<<e-32|t>>>64-e,ui=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function S_(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Mr(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function sr(i,...t){if(!S_(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function uI(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Mr(i.outputLen),Mr(i.blockLen)}function $o(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function C_(i,t){sr(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function $_(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function el(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function hI(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function dI(i,t){return i<<32-t|i>>>t}const k_=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function N_(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}function U_(i){for(let t=0;t<i.length;t++)i[t]=N_(i[t]);return i}const ko=k_?i=>i:U_;function B_(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function tl(i){return typeof i=="string"&&(i=B_(i)),sr(i),i}function _I(...i){let t=0;for(let r=0;r<i.length;r++){const n=i[r];sr(n),t+=n.length}const e=new Uint8Array(t);for(let r=0,n=0;r<i.length;r++){const s=i[r];e.set(s,n),n+=s.length}return e}class F_{}function q_(i){const t=r=>i().update(tl(r)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function pI(i=32){if(ui&&typeof ui.getRandomValues=="function")return ui.getRandomValues(new Uint8Array(i));if(ui&&typeof ui.randomBytes=="function")return Uint8Array.from(ui.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const M_=BigInt(0),Ci=BigInt(1),z_=BigInt(2),j_=BigInt(7),K_=BigInt(256),H_=BigInt(113),il=[],rl=[],nl=[];for(let i=0,t=Ci,e=1,r=0;i<24;i++){[e,r]=[r,(2*e+3*r)%5],il.push(2*(5*r+e)),rl.push((i+1)*(i+2)/2%64);let n=M_;for(let s=0;s<7;s++)t=(t<<Ci^(t>>j_)*H_)%K_,t&z_&&(n^=Ci<<(Ci<<BigInt(s))-Ci);nl.push(n)}const sl=R_(nl,!0),W_=sl[0],G_=sl[1],No=(i,t,e)=>e>32?V_(i,t,e):D_(i,t,e),Uo=(i,t,e)=>e>32?x_(i,t,e):L_(i,t,e);function J_(i,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,h=e[l],u=e[l+1],d=No(h,u,1)^e[c],_=Uo(h,u,1)^e[c+1];for(let p=0;p<50;p+=10)i[o+p]^=d,i[o+p+1]^=_}let n=i[2],s=i[3];for(let o=0;o<24;o++){const c=rl[o],l=No(n,s,c),h=Uo(n,s,c),u=il[o];n=i[u],s=i[u+1],i[u]=l,i[u+1]=h}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=W_[r],i[1]^=G_[r]}el(e)}class Ms extends F_{constructor(t,e,r,n=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=n,this.rounds=s,Mr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$_(this.state)}clone(){return this._cloneInto()}keccak(){ko(this.state32),J_(this.state32,this.rounds),ko(this.state32),this.posOut=0,this.pos=0}update(t){$o(this),t=tl(t),sr(t);const{blockLen:e,state:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:n}=this;t[r]^=e,e&128&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){$o(this,!1),sr(t),this.finish();const e=this.state,{blockLen:r}=this;for(let n=0,s=t.length;n<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Mr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(C_(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,el(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new Ms(e,r,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}}const Y_=(i,t,e)=>q_(()=>new Ms(t,i,e)),Z_=(()=>Y_(1,136,256/8))();function ol(i,t){const e=t||"hex",r=Z_(nr(i,{strict:!1})?A_(i):i);return e==="bytes"?r:Kn(r)}class Q_ extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const e=super.get(t);return super.has(t)&&e!==void 0&&(this.delete(t),super.set(t,e)),e}set(t,e){if(super.set(t,e),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const fn=new Q_(8192);function X_(i,t){if(fn.has(`${i}.${t}`))return fn.get(`${i}.${t}`);const e=t?`${t}${i.toLowerCase()}`:i.substring(2).toLowerCase(),r=ol(Xc(e),"bytes"),n=(t?e.substring(`${t}0x`.length):e).split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&n[o]&&(n[o]=n[o].toUpperCase()),(r[o>>1]&15)>=8&&n[o+1]&&(n[o+1]=n[o+1].toUpperCase());const s=`0x${n.join("")}`;return fn.set(`${i}.${t}`,s),s}function ep(i){const t=ol(`0x${i.substring(4)}`).substring(26);return X_(`0x${t}`)}async function tp({hash:i,signature:t}){const e=nr(i)?i:Kn(i),{secp256k1:r}=await a(()=>import("./secp256k1-587b447b.js"),["assets/secp256k1-587b447b.js","assets/signing-67cb53a5.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/to-serializable-transaction-2ea802ff.js","assets/transaction-e500e7c4.js","assets/get-bytecode-8cb4e224.js","assets/execute-6c88dd5f.js","assets/redirect-state-202ec690.js","assets/index-5f847edd.js","assets/ethereum-667be7dc.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-ba8e399b.js","assets/send-transaction-5984dc09.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-276c1c99.js","assets/index-accd8060.js","assets/index-2124b7cd.js","assets/index-6ab757a5.js","assets/index-69ac8519.js"]);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:h,s:u,v:d,yParity:_}=t,p=Number(_??d),f=Bo(p);return new r.Signature(jn(h),jn(u)).addRecoveryBit(f)}const o=nr(t)?t:Kn(t);if(zn(o)!==65)throw new Error("invalid signature length");const c=m_(`0x${o.slice(130)}`),l=Bo(c);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function Bo(i){if(i===0||i===1)return i;if(i===27)return 0;if(i===28)return 1;throw new Error("Invalid yParityOrV value")}async function ip({hash:i,signature:t}){return ep(await tp({hash:i,signature:t}))}function rp(i){const t=i.length;let e=0,r=0;for(;r<t;){let n=i.charCodeAt(r++);if(n&4294967168)if(!(n&4294965248))e+=2;else{if(n>=55296&&n<=56319&&r<t){const s=i.charCodeAt(r);(s&64512)===56320&&(++r,n=((n&1023)<<10)+(s&1023)+65536)}n&4294901760?e+=4:e+=3}else{e++;continue}}return e}function np(i,t,e){const r=i.length;let n=e,s=0;for(;s<r;){let o=i.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))t[n++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){const c=i.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}o&4294901760?(t[n++]=o>>18&7|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128):(t[n++]=o>>12&15|224,t[n++]=o>>6&63|128)}else{t[n++]=o;continue}t[n++]=o&63|128}}const sp=new TextEncoder,op=50;function ap(i,t,e){sp.encodeInto(i,t.subarray(e))}function cp(i,t,e){i.length>op?ap(i,t,e):np(i,t,e)}const lp=4096;function al(i,t,e){let r=t;const n=r+e,s=[];let o="";for(;r<n;){const c=i[r++];if(!(c&128))s.push(c);else if((c&224)===192){const l=i[r++]&63;s.push((c&31)<<6|l)}else if((c&240)===224){const l=i[r++]&63,h=i[r++]&63;s.push((c&31)<<12|l<<6|h)}else if((c&248)===240){const l=i[r++]&63,h=i[r++]&63,u=i[r++]&63;let d=(c&7)<<18|l<<12|h<<6|u;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(c);s.length>=lp&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const up=new TextDecoder,hp=200;function dp(i,t,e){const r=i.subarray(t,t+e);return up.decode(r)}function _p(i,t,e){return e>hp?dp(i,t,e):al(i,t,e)}class br{constructor(t,e){this.type=t,this.data=e}}class Me extends Error{constructor(t){super(t);const e=Object.create(Me.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Me.name})}}const $i=4294967295;function pp(i,t,e){const r=e/4294967296,n=e;i.setUint32(t,r),i.setUint32(t+4,n)}function cl(i,t,e){const r=Math.floor(e/4294967296),n=e;i.setUint32(t,r),i.setUint32(t+4,n)}function ll(i,t){const e=i.getInt32(t),r=i.getUint32(t+4);return e*4294967296+r}function fp(i,t){const e=i.getUint32(t),r=i.getUint32(t+4);return e*4294967296+r}const wp=-1,gp=4294967296-1,mp=17179869184-1;function Ep({sec:i,nsec:t}){if(i>=0&&t>=0&&i<=mp)if(t===0&&i<=gp){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,i),e}else{const e=i/4294967296,r=i&4294967295,n=new Uint8Array(8),s=new DataView(n.buffer);return s.setUint32(0,t<<2|e&3),s.setUint32(4,r),n}else{const e=new Uint8Array(12),r=new DataView(e.buffer);return r.setUint32(0,t),cl(r,4,i),e}}function yp(i){const t=i.getTime(),e=Math.floor(t/1e3),r=(t-e*1e3)*1e6,n=Math.floor(r/1e9);return{sec:e+n,nsec:r-n*1e9}}function vp(i){if(i instanceof Date){const t=yp(i);return Ep(t)}else return null}function bp(i){const t=new DataView(i.buffer,i.byteOffset,i.byteLength);switch(i.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),r=t.getUint32(4),n=(e&3)*4294967296+r,s=e>>>2;return{sec:n,nsec:s}}case 12:{const e=ll(t,4),r=t.getUint32(0);return{sec:e,nsec:r}}default:throw new Me(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${i.length}`)}}function Ip(i){const t=bp(i);return new Date(t.sec*1e3+t.nsec/1e6)}const Ap={type:wp,encode:vp,decode:Ip};class zr{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Ap)}register({type:t,encode:e,decode:r}){if(t>=0)this.encoders[t]=e,this.decoders[t]=r;else{const n=-1-t;this.builtInEncoders[n]=e,this.builtInDecoders[n]=r}}tryToEncode(t,e){for(let r=0;r<this.builtInEncoders.length;r++){const n=this.builtInEncoders[r];if(n!=null){const s=n(t,e);if(s!=null){const o=-1-r;return new br(o,s)}}}for(let r=0;r<this.encoders.length;r++){const n=this.encoders[r];if(n!=null){const s=n(t,e);if(s!=null){const o=r;return new br(o,s)}}}return t instanceof br?t:null}decode(t,e,r){const n=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return n?n(t,e,r):new br(e,t)}}zr.defaultCodec=new zr;function Pp(i){return i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer}function Hn(i){return i instanceof Uint8Array?i:ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Pp(i)?new Uint8Array(i):Uint8Array.from(i)}const Tp=100,Op=2048;class zs{constructor(t){this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??zr.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.maxDepth=(t==null?void 0:t.maxDepth)??Tp,this.initialBufferSize=(t==null?void 0:t.initialBufferSize)??Op,this.sortKeys=(t==null?void 0:t.sortKeys)??!1,this.forceFloat32=(t==null?void 0:t.forceFloat32)??!1,this.ignoreUndefined=(t==null?void 0:t.ignoreUndefined)??!1,this.forceIntegerToFloat=(t==null?void 0:t.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new zs({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,e)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(e*2)}resizeBuffer(t){const e=new ArrayBuffer(t),r=new Uint8Array(e),n=new DataView(e);r.set(this.bytes),this.view=n,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const r=rp(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),cp(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,e){const r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,e);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const e=t.byteLength;if(e<256)this.writeU8(196),this.writeU8(e);else if(e<65536)this.writeU8(197),this.writeU16(e);else if(e<4294967296)this.writeU8(198),this.writeU32(e);else throw new Error(`Too large binary: ${e}`);const r=Hn(t);this.writeU8a(r)}encodeArray(t,e){const r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const n of t)this.doEncode(n,e+1)}countWithoutUndefined(t,e){let r=0;for(const n of e)t[n]!==void 0&&r++;return r}encodeMap(t,e){const r=Object.keys(t);this.sortKeys&&r.sort();const n=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw new Error(`Too large map object: ${n}`);for(const s of r){const o=t[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,e+1))}}encodeExtension(t){if(typeof t.data=="function"){const r=t.data(this.pos+6),n=r.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(t.type),this.writeU8a(r);return}const e=t.data.length;if(e===1)this.writeU8(212);else if(e===2)this.writeU8(213);else if(e===4)this.writeU8(214);else if(e===8)this.writeU8(215);else if(e===16)this.writeU8(216);else if(e<256)this.writeU8(199),this.writeU8(e);else if(e<65536)this.writeU8(200),this.writeU16(e);else if(e<4294967296)this.writeU8(201),this.writeU32(e);else throw new Error(`Too large extension object: ${e}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),pp(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),cl(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}}function Rp(i,t){return new zs(t).encodeSharedRef(i)}function wn(i){return`${i<0?"-":""}0x${Math.abs(i).toString(16).padStart(2,"0")}`}const Dp=16,Lp=16;class Vp{constructor(t=Dp,e=Lp){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,r){const n=this.caches[r-1];e:for(const s of n){const o=s.bytes;for(let c=0;c<r;c++)if(o[c]!==t[e+c])continue e;return s.str}return null}store(t,e){const r=this.caches[t.length-1],n={bytes:t,str:e};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(t,e,r){const n=this.find(t,e,r);if(n!=null)return this.hit++,n;this.miss++;const s=al(t,e,r),o=Uint8Array.prototype.slice.call(t,e,e+r);return this.store(o,s),s}}const Wn="array",Ji="map_key",ul="map_value",xp=i=>{if(typeof i=="string"||typeof i=="number")return i;throw new Me("The type of key must be string or number but "+typeof i)};class Sp{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=Wn,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=Ji,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===Wn){const r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===Ji||t.type===ul){const r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const ki=-1,js=new DataView(new ArrayBuffer(0)),Cp=new Uint8Array(js.buffer);try{js.getInt8(0)}catch(i){if(!(i instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const Fo=new RangeError("Insufficient data"),$p=new Vp;class Ks{constructor(t){this.totalPos=0,this.pos=0,this.view=js,this.bytes=Cp,this.headByte=ki,this.stack=new Sp,this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??zr.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.rawStrings=(t==null?void 0:t.rawStrings)??!1,this.maxStrLength=(t==null?void 0:t.maxStrLength)??$i,this.maxBinLength=(t==null?void 0:t.maxBinLength)??$i,this.maxArrayLength=(t==null?void 0:t.maxArrayLength)??$i,this.maxMapLength=(t==null?void 0:t.maxMapLength)??$i,this.maxExtLength=(t==null?void 0:t.maxExtLength)??$i,this.keyDecoder=(t==null?void 0:t.keyDecoder)!==void 0?t.keyDecoder:$p,this.mapKeyConverter=(t==null?void 0:t.mapKeyConverter)??xp}clone(){return new Ks({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=ki,this.stack.reset()}setBuffer(t){const e=Hn(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===ki&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),r=Hn(t),n=new Uint8Array(e.length+r.length);n.set(e),n.set(r,e.length),this.setBuffer(n)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:r}=this;return new RangeError(`Extra ${e.byteLength-r} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,r;for await(const c of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{r=this.doDecodeSync(),e=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}const{headByte:n,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${wn(n)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let r=e,n=-1;for await(const s of t){if(e&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const n=t-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t<160){const n=t-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else{const n=t-160;e=this.decodeString(n,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const n=this.lookU8();e=this.decodeString(n,1)}else if(t===218){const n=this.lookU16();e=this.decodeString(n,2)}else if(t===219){const n=this.lookU32();e=this.decodeString(n,4)}else if(t===220){const n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===221){const n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===222){const n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===223){const n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===196){const n=this.lookU8();e=this.decodeBinary(n,1)}else if(t===197){const n=this.lookU16();e=this.decodeBinary(n,2)}else if(t===198){const n=this.lookU32();e=this.decodeBinary(n,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const n=this.lookU8();e=this.decodeExtension(n,1)}else if(t===200){const n=this.lookU16();e=this.decodeExtension(n,2)}else if(t===201){const n=this.lookU32();e=this.decodeExtension(n,4)}else throw new Me(`Unrecognized type byte: ${wn(t)}`);this.complete();const r=this.stack;for(;r.length>0;){const n=r.top();if(n.type===Wn)if(n.array[n.position]=e,n.position++,n.position===n.size)e=n.array,r.release(n);else continue e;else if(n.type===Ji){if(e==="__proto__")throw new Me("The key __proto__ is not allowed");n.key=this.mapKeyConverter(e),n.type=ul;continue e}else if(n.map[n.key]=e,n.readCount++,n.readCount===n.size)e=n.map,r.release(n);else{n.key=null,n.type=Ji;continue e}}return e}}readHeadByte(){return this.headByte===ki&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=ki}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new Me(`Unrecognized array type byte: ${wn(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new Me(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new Me(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){var s;if(t>this.maxStrLength)throw new Me(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw Fo;const r=this.pos+e;let n;return this.stateIsMapKey()&&((s=this.keyDecoder)!=null&&s.canBeCached(t))?n=this.keyDecoder.decode(this.bytes,r,t):n=_p(this.bytes,r,t),this.pos+=e+t,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ji:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new Me(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw Fo;const r=this.pos+e,n=this.bytes.subarray(r,r+t);return this.pos+=e+t,n}decodeExtension(t,e){if(t>this.maxExtLength)throw new Me(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+e),n=this.decodeBinary(t,e+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=fp(this.view,this.pos);return this.pos+=8,t}readI64(){const t=ll(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function kp(i,t){return new Ks(t).decode(i)}const Np=":";function Lr(i){const[t,e]=i.split(Np);return{namespace:t,reference:e}}function hl(i,t){return i.includes(":")?[i]:t.chains||[]}var Up=Object.defineProperty,Bp=Object.defineProperties,Fp=Object.getOwnPropertyDescriptors,qo=Object.getOwnPropertySymbols,qp=Object.prototype.hasOwnProperty,Mp=Object.prototype.propertyIsEnumerable,Gn=(i,t,e)=>t in i?Up(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Mo=(i,t)=>{for(var e in t||(t={}))qp.call(t,e)&&Gn(i,e,t[e]);if(qo)for(var e of qo(t))Mp.call(t,e)&&Gn(i,e,t[e]);return i},zp=(i,t)=>Bp(i,Fp(t)),zo=(i,t,e)=>Gn(i,typeof t!="symbol"?t+"":t,e);const jp="ReactNative",ze={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Kp="js";function jr(){return typeof Mt<"u"&&typeof Mt.versions<"u"&&typeof Mt.versions.node<"u"}function Kt(){return!mi()&&!!Ic()&&navigator.product===jp}function Hp(){return Kt()&&typeof j<"u"&&typeof(j==null?void 0:j.Platform)<"u"&&(j==null?void 0:j.Platform.OS)==="android"}function Wp(){return Kt()&&typeof j<"u"&&typeof(j==null?void 0:j.Platform)<"u"&&(j==null?void 0:j.Platform.OS)==="ios"}function Di(){return!jr()&&!!Ic()&&!!mi()}function pr(){return Kt()?ze.reactNative:jr()?ze.node:Di()?ze.browser:ze.unknown}function jo(){var i;try{return Kt()&&typeof j<"u"&&typeof(j==null?void 0:j.Application)<"u"?(i=j.Application)==null?void 0:i.applicationId:void 0}catch{return}}function Gp(i,t){const e=new URLSearchParams(i);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const n=t[r];n!==void 0&&e.set(r,n)}return e.toString()}function Jp(i){var t,e;const r=dl();try{return i!=null&&i.url&&r.url&&new URL(i.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${i.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),i.url=r.url),(t=i==null?void 0:i.icons)!=null&&t.length&&i.icons.length>0&&(i.icons=i.icons.filter(n=>n!=="")),zp(Mo(Mo({},r),i),{url:(i==null?void 0:i.url)||r.url,name:(i==null?void 0:i.name)||r.name,description:(i==null?void 0:i.description)||r.description,icons:(e=i==null?void 0:i.icons)!=null&&e.length&&i.icons.length>0?i.icons:r.icons})}catch(n){return console.warn("Error populating app metadata",n),i||r}}function dl(){return Vh()||{name:"",description:"",url:"",icons:[""]}}function Yp(){if(pr()===ze.reactNative&&typeof j<"u"&&typeof(j==null?void 0:j.Platform)<"u"){const{OS:e,Version:r}=j.Platform;return[e,r].join("-")}const i=xh();if(i===null)return"unknown";const t=i.os?i.os.replace(" ","").toLowerCase():"unknown";return i.type==="browser"?[t,i.name,i.version].join("-"):[t,i.version].join("-")}function Zp(){var i;const t=pr();return t===ze.browser?[t,((i=Sh())==null?void 0:i.host)||"unknown"].join(":"):t}function _l(i,t,e){const r=Yp(),n=Zp();return[[i,t].join("-"),[Kp,e].join("-"),r,n].join("/")}function Qp({protocol:i,version:t,relayUrl:e,sdkVersion:r,auth:n,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const h=e.split("?"),u=_l(i,t,r),d={auth:n,ua:u,projectId:s,useOnCloseEvent:o||void 0,packageName:l||void 0,bundleId:c||void 0},_=Gp(h[1]||"",d);return h[0]+"?"+_}function Zt(i,t){return i.filter(e=>t.includes(e)).length===i.length}function Jn(i){return Object.fromEntries(i.entries())}function Yn(i){return new Map(Object.entries(i))}function Gt(i=U.FIVE_MINUTES,t){const e=U.toMiliseconds(i||U.FIVE_MINUTES);let r,n,s,o;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),o=Promise.resolve(c))},reject:c=>{s&&n&&(clearTimeout(s),n(c))},done:()=>new Promise((c,l)=>{if(o)return c(o);s=setTimeout(()=>{const h=new Error(t);o=Promise.reject(h),l(h)},e),r=c,n=l})}}function _t(i,t,e){return new Promise(async(r,n)=>{const s=setTimeout(()=>n(new Error(e)),t);try{const o=await i;r(o)}catch(o){n(o)}clearTimeout(s)})}function pl(i,t){if(typeof t=="string"&&t.startsWith(`${i}:`))return t;if(i.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(i.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${i}`)}function Xp(i){return pl("topic",i)}function ef(i){return pl("id",i)}function fl(i){const[t,e]=i.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")r.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))r.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return r}function pe(i,t){return U.fromMiliseconds((t||Date.now())+U.toMiliseconds(i))}function kt(i){return Date.now()>=U.toMiliseconds(i)}function Q(i,t){return`${i}${t?`:${t}`:""}`}function ti(i=[],t=[]){return[...new Set([...i,...t])]}async function tf({id:i,topic:t,wcDeepLink:e}){var r;try{if(!e)return;const n=typeof e=="string"?JSON.parse(e):e,s=n==null?void 0:n.href;if(typeof s!="string")return;const o=rf(s,i,t),c=pr();if(c===ze.browser){if(!((r=mi())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}nf(o)}else c===ze.reactNative&&typeof(j==null?void 0:j.Linking)<"u"&&await j.Linking.openURL(o)}catch(n){console.error(n)}}function rf(i,t,e){const r=`requestId=${t}&sessionTopic=${e}`;i.endsWith("/")&&(i=i.slice(0,-1));let n=`${i}`;if(i.startsWith("https://t.me")){const s=i.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${cf(r,!0)}`}else n=`${n}/wc?${r}`;return n}function nf(i){let t="_self";af()?t="_top":(of()||i.startsWith("https://")||i.startsWith("http://"))&&(t="_blank"),window.open(i,t,"noreferrer noopener")}async function sf(i,t){let e="";try{if(Di()&&(e=localStorage.getItem(t),e))return e;e=await i.getItem(t)}catch(r){console.error(r)}return e}function Ko(i,t){if(!i.includes(t))return null;const e=i.split(/([&,?,=])/),r=e.indexOf(t);return e[r+2]}function Ho(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,i=>{const t=Math.random()*16|0;return(i==="x"?t:t&3|8).toString(16)})}function Hs(){return typeof Mt<"u"&&{}.IS_VITEST==="true"}function of(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function af(){try{return window.self!==window.top}catch{return!1}}function cf(i,t=!1){const e=ee.from(i).toString("base64");return t?e.replace(/[=]/g,""):e}function wl(i){return ee.from(i,"base64").toString("utf-8")}function lf(i){return new Promise(t=>setTimeout(t,i))}let uf=class{constructor({limit:t}){zo(this,"limit"),zo(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const Ir=BigInt(2**32-1),Wo=BigInt(32);function gl(i,t=!1){return t?{h:Number(i&Ir),l:Number(i>>Wo&Ir)}:{h:Number(i>>Wo&Ir)|0,l:Number(i&Ir)|0}}function ml(i,t=!1){const e=i.length;let r=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=gl(i[s],t);[r[s],n[s]]=[o,c]}return[r,n]}const Go=(i,t,e)=>i>>>e,Jo=(i,t,e)=>i<<32-e|t>>>e,Nt=(i,t,e)=>i>>>e|t<<32-e,Ut=(i,t,e)=>i<<32-e|t>>>e,Ki=(i,t,e)=>i<<64-e|t>>>e-32,Hi=(i,t,e)=>i>>>e-32|t<<64-e,hf=(i,t)=>t,df=(i,t)=>i,_f=(i,t,e)=>i<<e|t>>>32-e,pf=(i,t,e)=>t<<e|i>>>32-e,ff=(i,t,e)=>t<<e-32|i>>>64-e,wf=(i,t,e)=>i<<e-32|t>>>64-e;function it(i,t,e,r){const n=(t>>>0)+(r>>>0);return{h:i+e+(n/2**32|0)|0,l:n|0}}const Ws=(i,t,e)=>(i>>>0)+(t>>>0)+(e>>>0),Gs=(i,t,e,r)=>t+e+r+(i/2**32|0)|0,gf=(i,t,e,r)=>(i>>>0)+(t>>>0)+(e>>>0)+(r>>>0),mf=(i,t,e,r,n)=>t+e+r+n+(i/2**32|0)|0,Ef=(i,t,e,r,n)=>(i>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),yf=(i,t,e,r,n,s)=>t+e+r+n+s+(i/2**32|0)|0,hi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Js(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Tt(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function Qe(i,...t){if(!Js(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function Ys(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Tt(i.outputLen),Tt(i.blockLen)}function jt(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function Zs(i,t){Qe(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function or(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function Xe(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function gn(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function ct(i,t){return i<<32-t|i>>>t}const El=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function yl(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}const vt=El?i=>i:i=>yl(i);function vf(i){for(let t=0;t<i.length;t++)i[t]=yl(i[t]);return i}const Bt=El?i=>i:vf,vl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",bf=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function ar(i){if(Qe(i),vl)return i.toHex();let t="";for(let e=0;e<i.length;e++)t+=bf[i[e]];return t}const Et={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yo(i){if(i>=Et._0&&i<=Et._9)return i-Et._0;if(i>=Et.A&&i<=Et.F)return i-(Et.A-10);if(i>=Et.a&&i<=Et.f)return i-(Et.a-10)}function Qs(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);if(vl)return Uint8Array.fromHex(i);const t=i.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let n=0,s=0;n<e;n++,s+=2){const o=Yo(i.charCodeAt(s)),c=Yo(i.charCodeAt(s+1));if(o===void 0||c===void 0){const l=i[s]+i[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[n]=o*16+c}return r}function If(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function ot(i){return typeof i=="string"&&(i=If(i)),Qe(i),i}function Qt(...i){let t=0;for(let r=0;r<i.length;r++){const n=i[r];Qe(n),t+=n.length}const e=new Uint8Array(t);for(let r=0,n=0;r<i.length;r++){const s=i[r];e.set(s,n),n+=s.length}return e}class Xr{}function fr(i){const t=r=>i().update(ot(r)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function Af(i){const t=(r,n)=>i(n).update(ot(r)).digest(),e=i({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>i(r),t}function Li(i=32){if(hi&&typeof hi.getRandomValues=="function")return hi.getRandomValues(new Uint8Array(i));if(hi&&typeof hi.randomBytes=="function")return Uint8Array.from(hi.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const Pf=BigInt(0),Ni=BigInt(1),Tf=BigInt(2),Of=BigInt(7),Rf=BigInt(256),Df=BigInt(113),bl=[],Il=[],Al=[];for(let i=0,t=Ni,e=1,r=0;i<24;i++){[e,r]=[r,(2*e+3*r)%5],bl.push(2*(5*r+e)),Il.push((i+1)*(i+2)/2%64);let n=Pf;for(let s=0;s<7;s++)t=(t<<Ni^(t>>Of)*Df)%Rf,t&Tf&&(n^=Ni<<(Ni<<BigInt(s))-Ni);Al.push(n)}const Pl=ml(Al,!0),Lf=Pl[0],Vf=Pl[1],Zo=(i,t,e)=>e>32?ff(i,t,e):_f(i,t,e),Qo=(i,t,e)=>e>32?wf(i,t,e):pf(i,t,e);function xf(i,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,h=e[l],u=e[l+1],d=Zo(h,u,1)^e[c],_=Qo(h,u,1)^e[c+1];for(let p=0;p<50;p+=10)i[o+p]^=d,i[o+p+1]^=_}let n=i[2],s=i[3];for(let o=0;o<24;o++){const c=Il[o],l=Zo(n,s,c),h=Qo(n,s,c),u=bl[o];n=i[u],s=i[u+1],i[u]=l,i[u+1]=h}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=Lf[r],i[1]^=Vf[r]}Xe(e)}let Sf=class Tl extends Xr{constructor(t,e,r,n=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=n,this.rounds=s,Tt(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=or(this.state)}clone(){return this._cloneInto()}keccak(){Bt(this.state32),xf(this.state32,this.rounds),Bt(this.state32),this.posOut=0,this.pos=0}update(t){jt(this),t=ot(t),Qe(t);const{blockLen:e,state:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:n}=this;t[r]^=e,e&128&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){jt(this,!1),Qe(t),this.finish();const e=this.state,{blockLen:r}=this;for(let n=0,s=t.length;n<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Tt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Zs(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,Xe(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new Tl(e,r,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Cf=(i,t,e)=>fr(()=>new Sf(t,i,e)),$f=Cf(1,136,256/8);function kf(i,t,e,r){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,r);const n=BigInt(32),s=BigInt(4294967295),o=Number(e>>n&s),c=Number(e&s),l=r?4:0,h=r?0:4;i.setUint32(t+l,o,r),i.setUint32(t+h,c,r)}function Nf(i,t,e){return i&t^~i&e}function Uf(i,t,e){return i&t^i&e^t&e}let Ol=class extends Xr{constructor(t,e,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(t),this.view=gn(this.buffer)}update(t){jt(this),t=ot(t),Qe(t);const{view:e,buffer:r,blockLen:n}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(n-this.pos,s-o);if(c===n){const l=gn(t);for(;n<=s-o;o+=n)this.process(l,o);continue}r.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){jt(this),Zs(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:s}=this;let{pos:o}=this;e[o++]=128,Xe(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let d=o;d<n;d++)e[d]=0;kf(r,n-8,BigInt(this.length*8),s),this.process(r,0);const c=gn(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const h=l/4,u=this.get();if(h>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<h;d++)c.setUint32(4*d,u[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=n,t.pos=c,n%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const Rt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),be=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Ie=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Bf=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]),Dt=new Uint32Array(64);let Ff=class extends Ol{constructor(t=32){super(64,t,8,!1),this.A=Rt[0]|0,this.B=Rt[1]|0,this.C=Rt[2]|0,this.D=Rt[3]|0,this.E=Rt[4]|0,this.F=Rt[5]|0,this.G=Rt[6]|0,this.H=Rt[7]|0}get(){const{A:t,B:e,C:r,D:n,E:s,F:o,G:c,H:l}=this;return[t,e,r,n,s,o,c,l]}set(t,e,r,n,s,o,c,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=n|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)Dt[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const _=Dt[d-15],p=Dt[d-2],f=ct(_,7)^ct(_,18)^_>>>3,w=ct(p,17)^ct(p,19)^p>>>10;Dt[d]=w+Dt[d-7]+f+Dt[d-16]|0}let{A:r,B:n,C:s,D:o,E:c,F:l,G:h,H:u}=this;for(let d=0;d<64;d++){const _=ct(c,6)^ct(c,11)^ct(c,25),p=u+_+Nf(c,l,h)+Bf[d]+Dt[d]|0,f=(ct(r,2)^ct(r,13)^ct(r,22))+Uf(r,n,s)|0;u=h,h=l,l=c,c=o+p|0,o=s,s=n,n=r,r=p+f|0}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,u=u+this.H|0,this.set(r,n,s,o,c,l,h,u)}roundClean(){Xe(Dt)}destroy(){this.set(0,0,0,0,0,0,0,0),Xe(this.buffer)}};const Rl=ml(["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(i=>BigInt(i))),qf=Rl[0],Mf=Rl[1],Lt=new Uint32Array(80),Vt=new Uint32Array(80);let Xs=class extends Ol{constructor(t=64){super(128,t,16,!1),this.Ah=Ie[0]|0,this.Al=Ie[1]|0,this.Bh=Ie[2]|0,this.Bl=Ie[3]|0,this.Ch=Ie[4]|0,this.Cl=Ie[5]|0,this.Dh=Ie[6]|0,this.Dl=Ie[7]|0,this.Eh=Ie[8]|0,this.El=Ie[9]|0,this.Fh=Ie[10]|0,this.Fl=Ie[11]|0,this.Gh=Ie[12]|0,this.Gl=Ie[13]|0,this.Hh=Ie[14]|0,this.Hl=Ie[15]|0}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:s,Cl:o,Dh:c,Dl:l,Eh:h,El:u,Fh:d,Fl:_,Gh:p,Gl:f,Hh:w,Hl:g}=this;return[t,e,r,n,s,o,c,l,h,u,d,_,p,f,w,g]}set(t,e,r,n,s,o,c,l,h,u,d,_,p,f,w,g){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=n|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=h|0,this.El=u|0,this.Fh=d|0,this.Fl=_|0,this.Gh=p|0,this.Gl=f|0,this.Hh=w|0,this.Hl=g|0}process(t,e){for(let y=0;y<16;y++,e+=4)Lt[y]=t.getUint32(e),Vt[y]=t.getUint32(e+=4);for(let y=16;y<80;y++){const v=Lt[y-15]|0,b=Vt[y-15]|0,D=Nt(v,b,1)^Nt(v,b,8)^Go(v,b,7),N=Ut(v,b,1)^Ut(v,b,8)^Jo(v,b,7),S=Lt[y-2]|0,m=Vt[y-2]|0,P=Nt(S,m,19)^Ki(S,m,61)^Go(S,m,6),E=Ut(S,m,19)^Hi(S,m,61)^Jo(S,m,6),A=gf(N,E,Vt[y-7],Vt[y-16]),O=mf(A,D,P,Lt[y-7],Lt[y-16]);Lt[y]=O|0,Vt[y]=A|0}let{Ah:r,Al:n,Bh:s,Bl:o,Ch:c,Cl:l,Dh:h,Dl:u,Eh:d,El:_,Fh:p,Fl:f,Gh:w,Gl:g,Hh:I,Hl:T}=this;for(let y=0;y<80;y++){const v=Nt(d,_,14)^Nt(d,_,18)^Ki(d,_,41),b=Ut(d,_,14)^Ut(d,_,18)^Hi(d,_,41),D=d&p^~d&w,N=_&f^~_&g,S=Ef(T,b,N,Mf[y],Vt[y]),m=yf(S,I,v,D,qf[y],Lt[y]),P=S|0,E=Nt(r,n,28)^Ki(r,n,34)^Ki(r,n,39),A=Ut(r,n,28)^Hi(r,n,34)^Hi(r,n,39),O=r&s^r&c^s&c,V=n&o^n&l^o&l;I=w|0,T=g|0,w=p|0,g=f|0,p=d|0,f=_|0,{h:d,l:_}=it(h|0,u|0,m|0,P|0),h=c|0,u=l|0,c=s|0,l=o|0,s=r|0,o=n|0;const x=Ws(P,A,V);r=Gs(x,m,E,O),n=x|0}({h:r,l:n}=it(this.Ah|0,this.Al|0,r|0,n|0)),{h:s,l:o}=it(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=it(this.Ch|0,this.Cl|0,c|0,l|0),{h,l:u}=it(this.Dh|0,this.Dl|0,h|0,u|0),{h:d,l:_}=it(this.Eh|0,this.El|0,d|0,_|0),{h:p,l:f}=it(this.Fh|0,this.Fl|0,p|0,f|0),{h:w,l:g}=it(this.Gh|0,this.Gl|0,w|0,g|0),{h:I,l:T}=it(this.Hh|0,this.Hl|0,I|0,T|0),this.set(r,n,s,o,c,l,h,u,d,_,p,f,w,g,I,T)}roundClean(){Xe(Lt,Vt)}destroy(){Xe(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},zf=class extends Xs{constructor(){super(48),this.Ah=be[0]|0,this.Al=be[1]|0,this.Bh=be[2]|0,this.Bl=be[3]|0,this.Ch=be[4]|0,this.Cl=be[5]|0,this.Dh=be[6]|0,this.Dl=be[7]|0,this.Eh=be[8]|0,this.El=be[9]|0,this.Fh=be[10]|0,this.Fl=be[11]|0,this.Gh=be[12]|0,this.Gl=be[13]|0,this.Hh=be[14]|0,this.Hl=be[15]|0}};const Ae=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class jf extends Xs{constructor(){super(32),this.Ah=Ae[0]|0,this.Al=Ae[1]|0,this.Bh=Ae[2]|0,this.Bl=Ae[3]|0,this.Ch=Ae[4]|0,this.Cl=Ae[5]|0,this.Dh=Ae[6]|0,this.Dl=Ae[7]|0,this.Eh=Ae[8]|0,this.El=Ae[9]|0,this.Fh=Ae[10]|0,this.Fl=Ae[11]|0,this.Gh=Ae[12]|0,this.Gl=Ae[13]|0,this.Hh=Ae[14]|0,this.Hl=Ae[15]|0}}const en=fr(()=>new Ff),Kf=fr(()=>new Xs),Hf=fr(()=>new zf),Wf=fr(()=>new jf),Gf=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),_e=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),B=new Uint32Array(32);function xt(i,t,e,r,n,s){const o=n[s],c=n[s+1];let l=B[2*i],h=B[2*i+1],u=B[2*t],d=B[2*t+1],_=B[2*e],p=B[2*e+1],f=B[2*r],w=B[2*r+1],g=Ws(l,u,o);h=Gs(g,h,d,c),l=g|0,{Dh:w,Dl:f}={Dh:w^h,Dl:f^l},{Dh:w,Dl:f}={Dh:hf(w,f),Dl:df(w)},{h:p,l:_}=it(p,_,w,f),{Bh:d,Bl:u}={Bh:d^p,Bl:u^_},{Bh:d,Bl:u}={Bh:Nt(d,u,24),Bl:Ut(d,u,24)},B[2*i]=l,B[2*i+1]=h,B[2*t]=u,B[2*t+1]=d,B[2*e]=_,B[2*e+1]=p,B[2*r]=f,B[2*r+1]=w}function St(i,t,e,r,n,s){const o=n[s],c=n[s+1];let l=B[2*i],h=B[2*i+1],u=B[2*t],d=B[2*t+1],_=B[2*e],p=B[2*e+1],f=B[2*r],w=B[2*r+1],g=Ws(l,u,o);h=Gs(g,h,d,c),l=g|0,{Dh:w,Dl:f}={Dh:w^h,Dl:f^l},{Dh:w,Dl:f}={Dh:Nt(w,f,16),Dl:Ut(w,f,16)},{h:p,l:_}=it(p,_,w,f),{Bh:d,Bl:u}={Bh:d^p,Bl:u^_},{Bh:d,Bl:u}={Bh:Ki(d,u,63),Bl:Hi(d,u,63)},B[2*i]=l,B[2*i+1]=h,B[2*t]=u,B[2*t+1]=d,B[2*e]=_,B[2*e+1]=p,B[2*r]=f,B[2*r+1]=w}function Jf(i,t={},e,r,n){if(Tt(e),i<0||i>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==r)throw new Error("salt must be undefined or "+r);if(c!==void 0&&c.length!==n)throw new Error("personalization must be undefined or "+n)}class Yf extends Xr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Tt(t),Tt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=or(this.buffer)}update(t){jt(this),t=ot(t),Qe(t);const{blockLen:e,buffer:r,buffer32:n}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(Bt(n),this.compress(n,0,!1),Bt(n),this.pos=0);const h=Math.min(e-this.pos,s-l),u=o+l;if(h===e&&!(u%4)&&l+h<s){const d=new Uint32Array(c,u,Math.floor((s-l)/4));Bt(d);for(let _=0;l+e<s;_+=n.length,l+=e)this.length+=e,this.compress(d,_,!1);Bt(d);continue}r.set(t.subarray(l,l+h),this.pos),this.pos+=h,this.length+=h,l+=h}return this}digestInto(t){jt(this),Zs(t,this);const{pos:e,buffer32:r}=this;this.finished=!0,Xe(this.buffer.subarray(e)),Bt(r),this.compress(r,0,!0),Bt(r);const n=or(t);this.get().forEach((s,o)=>n[o]=vt(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){const{buffer:e,length:r,finished:n,destroyed:s,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=n,t.length=r,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Zf extends Yf{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=_e[0]|0,this.v0h=_e[1]|0,this.v1l=_e[2]|0,this.v1h=_e[3]|0,this.v2l=_e[4]|0,this.v2h=_e[5]|0,this.v3l=_e[6]|0,this.v3h=_e[7]|0,this.v4l=_e[8]|0,this.v4h=_e[9]|0,this.v5l=_e[10]|0,this.v5h=_e[11]|0,this.v6l=_e[12]|0,this.v6h=_e[13]|0,this.v7l=_e[14]|0,this.v7h=_e[15]|0,Jf(e,t,64,16,16);let{key:r,personalization:n,salt:s}=t,o=0;if(r!==void 0&&(r=ot(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=ot(s);const c=or(s);this.v4l^=vt(c[0]),this.v4h^=vt(c[1]),this.v5l^=vt(c[2]),this.v5h^=vt(c[3])}if(n!==void 0){n=ot(n);const c=or(n);this.v6l^=vt(c[0]),this.v6h^=vt(c[1]),this.v7l^=vt(c[2]),this.v7h^=vt(c[3])}if(r!==void 0){const c=new Uint8Array(this.blockLen);c.set(r),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:r,v1h:n,v2l:s,v2h:o,v3l:c,v3h:l,v4l:h,v4h:u,v5l:d,v5h:_,v6l:p,v6h:f,v7l:w,v7h:g}=this;return[t,e,r,n,s,o,c,l,h,u,d,_,p,f,w,g]}set(t,e,r,n,s,o,c,l,h,u,d,_,p,f,w,g){this.v0l=t|0,this.v0h=e|0,this.v1l=r|0,this.v1h=n|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=h|0,this.v4h=u|0,this.v5l=d|0,this.v5h=_|0,this.v6l=p|0,this.v6h=f|0,this.v7l=w|0,this.v7h=g|0}compress(t,e,r){this.get().forEach((l,h)=>B[h]=l),B.set(_e,16);let{h:n,l:s}=gl(BigInt(this.length));B[24]=_e[8]^s,B[25]=_e[9]^n,r&&(B[28]=~B[28],B[29]=~B[29]);let o=0;const c=Gf;for(let l=0;l<12;l++)xt(0,4,8,12,t,e+2*c[o++]),St(0,4,8,12,t,e+2*c[o++]),xt(1,5,9,13,t,e+2*c[o++]),St(1,5,9,13,t,e+2*c[o++]),xt(2,6,10,14,t,e+2*c[o++]),St(2,6,10,14,t,e+2*c[o++]),xt(3,7,11,15,t,e+2*c[o++]),St(3,7,11,15,t,e+2*c[o++]),xt(0,5,10,15,t,e+2*c[o++]),St(0,5,10,15,t,e+2*c[o++]),xt(1,6,11,12,t,e+2*c[o++]),St(1,6,11,12,t,e+2*c[o++]),xt(2,7,8,13,t,e+2*c[o++]),St(2,7,8,13,t,e+2*c[o++]),xt(3,4,9,14,t,e+2*c[o++]),St(3,4,9,14,t,e+2*c[o++]);this.v0l^=B[0]^B[16],this.v0h^=B[1]^B[17],this.v1l^=B[2]^B[18],this.v1h^=B[3]^B[19],this.v2l^=B[4]^B[20],this.v2h^=B[5]^B[21],this.v3l^=B[6]^B[22],this.v3h^=B[7]^B[23],this.v4l^=B[8]^B[24],this.v4h^=B[9]^B[25],this.v5l^=B[10]^B[26],this.v5h^=B[11]^B[27],this.v6l^=B[12]^B[28],this.v6h^=B[13]^B[29],this.v7l^=B[14]^B[30],this.v7h^=B[15]^B[31],Xe(B)}destroy(){this.destroyed=!0,Xe(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Qf=Af(i=>new Zf(i)),Xf="https://rpc.walletconnect.org/v1";function Dl(i){const t=`Ethereum Signed Message:
1
+ import{B as Nu,C as hc,D as dc,E as _c,a as Uu,F as Bu,G as pc,n as Fu,H as bs,I as fc,l as qu,J as wc,t as ho,K as Mu,N as _o,o as zu,L as ju,q as Ku,A as Hu}from"./signing-6d6682ec.js";import{aw as Wu,ax as Gu,aB as gc,av as Ju,a as ii,h as qt,m as po,g as te,n as Oe,l as $n,c as Is,u as As,v as kr,s as st,af as Yu,f as Ps,a$ as kn,w as Zu,x as mc,b5 as fo}from"./prepare-contract-call-4be4cc68.js";import{t as Ye,j as bi,k as Qu,a as Nn,w as Nr,C as Ts,b as Xu,m as eh,c as th,d as ih,f as rh,l as nh,p as sh,u as oh}from"./execute-264a98ed.js";import{m as Ec,h as Ii,a as Ue,l as Os,n as ah,o as ch,p as lh,d as uh,q as hh}from"./utils-dddc86ba.js";import{t as Rs,i as dh,a as _h}from"./transaction-ea614a5a.js";import{p as Ds,c as ph,l as fh}from"./redirect-state-301cb22c.js";import{e as wh,j as gh,g as yc,s as mh,o as Eh,c as yh}from"./to-serializable-transaction-9e540f8c.js";import{b as Mt,_ as a,g as vh,a as j,B as ee,e as oi,N as vc}from"./index-10c73e9d.js";import{i as bh,m as Ih}from"./index-93724bad.js";import{c as Ah}from"./store-af6293b2.js";import{g as Ph,v as Th,s as Oh,w as Rh,p as Dh}from"./hashTypedData-cc1589a7.js";import{s as bc,c as Ht}from"./send-transaction-c3053b90.js";import{e as Lh}from"./eth_sendRawTransaction-5ae15b91.js";import{s as Un,I as Ai,g as Vh,e as U,h as mi,j as Ic,k as dr,l as xh,m as Sh,n as Bn,C as Ch,q as $h,r as kh,o as Nh,t as Uh,u as Ls,v as Vs,b as Ur,w as Pi,c as $t,P as wo,Q as Bh,x as Fh,a as go,y as Yt,f as Ac,z as yt,A as dt,B as Ot}from"./index-b3889ac8.js";import{q as qh}from"./index-6ab757a5.js";import{f as Ze,t as Ne,a as Mh,c as zh,d as Gi}from"./index-877ffe4a.js";import"./index-2cab452e.js";function jh(i){const t=Wu(i);return Gu("0x19",gc(`Ethereum Signed Message:
2
+ `+Ju(t)),t)}function Kh(i){return Nu(jh(i))}const Hh={"0x0":"reverted","0x1":"success"};function xs(i){var r;const[t,e]=(()=>{const n=i.status;return n>=100&&n<200?["pending",n]:n>=200&&n<300?["success",n]:n>=300&&n<700?["failure",n]:n==="CONFIRMED"?["success",200]:n==="PENDING"?["pending",100]:[void 0,n]})();return{...i,atomic:i.atomic,chainId:i.chainId?ii(i.chainId):void 0,receipts:((r=i.receipts)==null?void 0:r.map(n=>({...n,blockNumber:qt(n.blockNumber),gasUsed:qt(n.gasUsed),status:Hh[n.status]})))??[],status:t,statusCode:e,version:i.version}}function Ss(i,t){const e={};for(const[r,n]of Object.entries(i)){e[Number(r)]={};const s={};for(const[o,c]of Object.entries(n))s[o]=c;e[Number(r)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Cs(i,t){const e=i.calls[0];if(!e)throw new Error("No calls to send");const{calls:r,capabilities:n,version:s="2.0.0",chain:o=e.chain}=i,c=await Promise.all(r.map(async h=>{const{to:u,value:d}=h;if(u===void 0&&h.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[_,p,f]=await Promise.all([po(u),wh(h),po(d)]);return _?{data:p,to:te(_),value:typeof f=="bigint"||typeof f=="number"?Oe(f):void 0}:{data:p,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:i.atomicRequired??!1,calls:c,capabilities:n,chainId:Oe(o.id),from:te(t.address),version:s}],chain:o}}function $s(i){return Wh(i).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Wh(i,t,e="http"){const r=[];for(const n of i.rpc)e==="http"&&!n.startsWith("http")||e==="ws"&&!n.startsWith("ws")||(n.includes("${THIRDWEB_API_KEY}")?t?r.push(n.replace("${THIRDWEB_API_KEY}",t)+(typeof globalThis<"u"&&"APP_BUNDLE_ID"in globalThis?`/?bundleId=${globalThis.APP_BUNDLE_ID}`:"")):r.push(n.replace("${THIRDWEB_API_KEY}","")):n.includes("${")||r.push(n));if(r.length===0)throw new Error(`No RPC available for chainId "${i.chainId}" with mode ${e}`);return r}function at(i){return typeof i=="number"?i:$n(i)?ii(i):typeof i=="bigint"?Number(i):Number.parseInt(i,10)}function Gh(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function Jh(){return typeof Mt<"u"&&typeof Mt.versions<"u"&&typeof Mt.versions.node<"u"}function Pc(){return!Gh()&&!Jh()}const nt="com.coinbase.wallet",At="org.base.account",Tc="io.metamask",Yh="me.rainbow",Zh="io.zerion.wallet";function ks(i){return i.startsWith("http://")||i.startsWith("https://")}function Oc(i,t){if(!ks(i))return Rc(i,t);let e=i;e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function Rc(i,t){if(ks(i))return Oc(i,t);let e=i;e.includes("://")||(e=i.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function Qh(i,t){return ks(i)?Oc(i,t):Rc(i,t)}function Xh(){if(typeof navigator>"u")return!1;const i=Ec(navigator.userAgent);return i?i.toLowerCase().includes("android"):!1}function ed(){if(typeof navigator>"u")return!1;const i=Ec(navigator.userAgent);return i?i.toLowerCase().includes("ios")||i.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function td(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function id(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function mo(){return!!(Xh()||ed()||td()&&id()||typeof window<"u"&&window.innerWidth<640)}function hn(i){if(window!==window.top)window.open(i);else if(i.startsWith("http")){const e=document.createElement("a");e.href=i,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=i}function Ti(i){return typeof i=="string"?i.startsWith("ecosystem."):i.id.startsWith("ecosystem.")}async function Dc(i,t){if(Ti(i)){const{getEcosystemWalletInfo:e}=await a(()=>import("./get-ecosystem-wallet-info-0a9d1fa7.js"),["assets/get-ecosystem-wallet-info-0a9d1fa7.js","assets/execute-264a98ed.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/index-10c73e9d.js","assets/index-59db4a58.css"]);return t?e(i).then(r=>r.image_id):e(i)}switch(i){case"smart":return t?a(()=>import("./image-457dda3a.js"),[]).then(e=>e.default):a(()=>import("./index-6446a77e.js"),[]).then(e=>e.wallet);case"inApp":return t?a(()=>import("./image-9a410d3c.js"),[]).then(e=>e.default):a(()=>import("./index-8da88caa.js"),[]).then(e=>e.wallet);case"walletConnect":return t?a(()=>import("./image-f9733682.js"),[]).then(e=>e.default):a(()=>import("./index-15eedc4e.js"),[]).then(e=>e.wallet);case"embedded":return t?a(()=>import("./image-a96f7117.js"),[]).then(e=>e.default):a(()=>import("./index-7212c9cc.js"),[]).then(e=>e.wallet);case"adapter":return t?a(()=>import("./image-9c02f89f.js"),[]).then(e=>e.default):a(()=>import("./index-b0b403fd.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?a(()=>import("./image-16777a49.js"),[]).then(e=>e.default):a(()=>import("./index-2a10dc2b.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?a(()=>import("./image-7c2061d3.js"),[]).then(e=>e.default):a(()=>import("./index-caa59ced.js"),[]).then(e=>e.wallet);case"com.ledger":return t?a(()=>import("./image-b5a8ac09.js"),[]).then(e=>e.default):a(()=>import("./index-0270c3ed.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?a(()=>import("./image-0c766de5.js"),[]).then(e=>e.default):a(()=>import("./index-722e5d11.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?a(()=>import("./image-bcf26615.js"),[]).then(e=>e.default):a(()=>import("./index-bdb9e65c.js"),[]).then(e=>e.wallet);case"io.metamask":return t?a(()=>import("./image-de75c02b.js"),[]).then(e=>e.default):a(()=>import("./index-227118f1.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?a(()=>import("./image-c9a27765.js"),[]).then(e=>e.default):a(()=>import("./index-00776358.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?a(()=>import("./image-d019f398.js"),[]).then(e=>e.default):a(()=>import("./index-8245891a.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?a(()=>import("./image-2807f8e7.js"),[]).then(e=>e.default):a(()=>import("./index-5e43b215.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?a(()=>import("./image-dffed0fc.js"),[]).then(e=>e.default):a(()=>import("./index-a9de2776.js"),[]).then(e=>e.wallet);case"com.safepal":return t?a(()=>import("./image-641d544d.js"),[]).then(e=>e.default):a(()=>import("./index-10cf0d2a.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?a(()=>import("./image-d175f270.js"),[]).then(e=>e.default):a(()=>import("./index-b773342e.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?a(()=>import("./image-d3a3443e.js"),[]).then(e=>e.default):a(()=>import("./index-81473c35.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?a(()=>import("./image-6facefd8.js"),[]).then(e=>e.default):a(()=>import("./index-3e63b2e6.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?a(()=>import("./image-b00b1601.js"),[]).then(e=>e.default):a(()=>import("./index-7446e542.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?a(()=>import("./image-cc9cc6e0.js"),[]).then(e=>e.default):a(()=>import("./index-a3a58d5a.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?a(()=>import("./image-b07914c1.js"),[]).then(e=>e.default):a(()=>import("./index-285c06f6.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?a(()=>import("./image-0468f46c.js"),[]).then(e=>e.default):a(()=>import("./index-4c61a7ce.js"),[]).then(e=>e.wallet);case"com.bybit":return t?a(()=>import("./image-01575dda.js"),[]).then(e=>e.default):a(()=>import("./index-71bf3273.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?a(()=>import("./image-bb215d6b.js"),[]).then(e=>e.default):a(()=>import("./index-918ba956.js"),[]).then(e=>e.wallet);case"io.trezor":return t?a(()=>import("./image-f296f4b3.js"),[]).then(e=>e.default):a(()=>import("./index-0e480432.js"),[]).then(e=>e.wallet);case"im.token":return t?a(()=>import("./image-2f03f1da.js"),[]).then(e=>e.default):a(()=>import("./index-8e91d60d.js"),[]).then(e=>e.wallet);case"global.safe":return t?a(()=>import("./image-49646d1e.js"),[]).then(e=>e.default):a(()=>import("./index-0589d490.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?a(()=>import("./image-5c1f75d1.js"),[]).then(e=>e.default):a(()=>import("./index-86555541.js"),[]).then(e=>e.wallet);case"co.arculus":return t?a(()=>import("./image-d87af41f.js"),[]).then(e=>e.default):a(()=>import("./index-5b03e28c.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?a(()=>import("./image-c9ef2140.js"),[]).then(e=>e.default):a(()=>import("./index-a984bcef.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?a(()=>import("./image-c81ee0ed.js"),[]).then(e=>e.default):a(()=>import("./index-33087d53.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?a(()=>import("./image-e811f346.js"),[]).then(e=>e.default):a(()=>import("./index-69ee2a62.js"),[]).then(e=>e.wallet);case"com.tangem":return t?a(()=>import("./image-10c86d8c.js"),[]).then(e=>e.default):a(()=>import("./index-2b14b372.js"),[]).then(e=>e.wallet);case"com.exodus":return t?a(()=>import("./image-4ad0ee26.js"),[]).then(e=>e.default):a(()=>import("./index-8409df5e.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?a(()=>import("./image-c4815890.js"),[]).then(e=>e.default):a(()=>import("./index-189338b3.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?a(()=>import("./image-de1c3862.js"),[]).then(e=>e.default):a(()=>import("./index-c8096e7f.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?a(()=>import("./image-b3b70e40.js"),[]).then(e=>e.default):a(()=>import("./index-81c101df.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?a(()=>import("./image-54fd557f.js"),[]).then(e=>e.default):a(()=>import("./index-4e301fa3.js"),[]).then(e=>e.wallet);case"app.backpack":return t?a(()=>import("./image-1ecb0644.js"),[]).then(e=>e.default):a(()=>import("./index-304fee63.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?a(()=>import("./image-3e0a941b.js"),[]).then(e=>e.default):a(()=>import("./index-2950e1ad.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?a(()=>import("./image-ca41c67a.js"),[]).then(e=>e.default):a(()=>import("./index-2aac81f4.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?a(()=>import("./image-20686420.js"),[]).then(e=>e.default):a(()=>import("./index-99f8b4e2.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?a(()=>import("./image-317d798f.js"),[]).then(e=>e.default):a(()=>import("./index-0bdb32c6.js"),[]).then(e=>e.wallet);case"me.haha":return t?a(()=>import("./image-ed1f211c.js"),[]).then(e=>e.default):a(()=>import("./index-7ca5e898.js"),[]).then(e=>e.wallet);case"com.bee":return t?a(()=>import("./image-7e8be6ea.js"),[]).then(e=>e.default):a(()=>import("./index-5302903c.js"),[]).then(e=>e.wallet);case"ag.jup":return t?a(()=>import("./image-a98c0516.js"),[]).then(e=>e.default):a(()=>import("./index-1b8787e9.js"),[]).then(e=>e.wallet);case"app.keplr":return t?a(()=>import("./image-cc041c91.js"),[]).then(e=>e.default):a(()=>import("./index-585f055b.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?a(()=>import("./image-9d9e2312.js"),[]).then(e=>e.default):a(()=>import("./index-49da4861.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?a(()=>import("./image-42bdf8ff.js"),[]).then(e=>e.default):a(()=>import("./index-07fcf923.js"),[]).then(e=>e.wallet);case"com.kraken":return t?a(()=>import("./image-5528c41d.js"),[]).then(e=>e.default):a(()=>import("./index-f644e0cd.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?a(()=>import("./image-060fe0ae.js"),[]).then(e=>e.default):a(()=>import("./index-e26ad4a5.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?a(()=>import("./image-ba202fa7.js"),[]).then(e=>e.default):a(()=>import("./index-67ea9d8a.js"),[]).then(e=>e.wallet);case"com.tomi":return t?a(()=>import("./image-a1d36ae9.js"),[]).then(e=>e.default):a(()=>import("./index-ee511134.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?a(()=>import("./image-d7aaeb5c.js"),[]).then(e=>e.default):a(()=>import("./index-a7304a61.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?a(()=>import("./image-106d5c9b.js"),[]).then(e=>e.default):a(()=>import("./index-7f687cf1.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?a(()=>import("./image-857dc386.js"),[]).then(e=>e.default):a(()=>import("./index-11290f98.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?a(()=>import("./image-41c20c8d.js"),[]).then(e=>e.default):a(()=>import("./index-67856a37.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?a(()=>import("./image-af1453eb.js"),[]).then(e=>e.default):a(()=>import("./index-3cfc001a.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?a(()=>import("./image-61ddff35.js"),[]).then(e=>e.default):a(()=>import("./index-5d6f8a76.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?a(()=>import("./image-32c2977c.js"),[]).then(e=>e.default):a(()=>import("./index-ce9308d1.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?a(()=>import("./image-02d13e5d.js"),[]).then(e=>e.default):a(()=>import("./index-0cb2e837.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?a(()=>import("./image-a3107a62.js"),[]).then(e=>e.default):a(()=>import("./index-62628991.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?a(()=>import("./image-9491d90e.js"),[]).then(e=>e.default):a(()=>import("./index-5e3ef02d.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?a(()=>import("./image-509849b8.js"),[]).then(e=>e.default):a(()=>import("./index-b3e7d4ff.js"),[]).then(e=>e.wallet);case"app.kabila":return t?a(()=>import("./image-c37912ea.js"),[]).then(e=>e.default):a(()=>import("./index-d1242dc7.js"),[]).then(e=>e.wallet);case"com.opera":return t?a(()=>import("./image-35187532.js"),[]).then(e=>e.default):a(()=>import("./index-ec7d1d18.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?a(()=>import("./image-7e5a82da.js"),[]).then(e=>e.default):a(()=>import("./index-b4a986e0.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?a(()=>import("./image-19183749.js"),[]).then(e=>e.default):a(()=>import("./index-e2ff913f.js"),[]).then(e=>e.wallet);case"com.chain":return t?a(()=>import("./image-c7557042.js"),[]).then(e=>e.default):a(()=>import("./index-a4a920bf.js"),[]).then(e=>e.wallet);case"io.huddln":return t?a(()=>import("./image-cbb18781.js"),[]).then(e=>e.default):a(()=>import("./index-000f902d.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?a(()=>import("./image-503e7dc6.js"),[]).then(e=>e.default):a(()=>import("./index-3f7b5edc.js"),[]).then(e=>e.wallet);case"world.freedom":return t?a(()=>import("./image-44abe227.js"),[]).then(e=>e.default):a(()=>import("./index-17400f49.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?a(()=>import("./image-41efff45.js"),[]).then(e=>e.default):a(()=>import("./index-c1eea23e.js"),[]).then(e=>e.wallet);case"pk.modular":return t?a(()=>import("./image-2c62d272.js"),[]).then(e=>e.default):a(()=>import("./index-a90d42c1.js"),[]).then(e=>e.wallet);case"app.wombat":return t?a(()=>import("./image-db0d0aef.js"),[]).then(e=>e.default):a(()=>import("./index-b0db46b7.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?a(()=>import("./image-17597121.js"),[]).then(e=>e.default):a(()=>import("./index-7f49781d.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?a(()=>import("./image-64a6dd7a.js"),[]).then(e=>e.default):a(()=>import("./index-d0e5c9ad.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?a(()=>import("./image-5cd7b7ce.js"),[]).then(e=>e.default):a(()=>import("./index-29ad9167.js"),[]).then(e=>e.wallet);case"com.zengo":return t?a(()=>import("./image-f5423b30.js"),[]).then(e=>e.default):a(()=>import("./index-07890dfc.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?a(()=>import("./image-bed41cb7.js"),[]).then(e=>e.default):a(()=>import("./index-834982ce.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?a(()=>import("./image-884201b7.js"),[]).then(e=>e.default):a(()=>import("./index-b7f5da10.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?a(()=>import("./image-a9f98399.js"),[]).then(e=>e.default):a(()=>import("./index-df9c7057.js"),[]).then(e=>e.wallet);case"network.cvl":return t?a(()=>import("./image-0a838b00.js"),[]).then(e=>e.default):a(()=>import("./index-c66d233e.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?a(()=>import("./image-ba3988f2.js"),[]).then(e=>e.default):a(()=>import("./index-581ba888.js"),[]).then(e=>e.wallet);case"io.xenea":return t?a(()=>import("./image-eaa00439.js"),[]).then(e=>e.default):a(()=>import("./index-ae61dcf2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?a(()=>import("./image-cc0c5a8e.js"),[]).then(e=>e.default):a(()=>import("./index-b2d504a8.js"),[]).then(e=>e.wallet);case"com.bitso":return t?a(()=>import("./image-363fa778.js"),[]).then(e=>e.default):a(()=>import("./index-21e99b5e.js"),[]).then(e=>e.wallet);case"io.enjin":return t?a(()=>import("./image-4b5d06e2.js"),[]).then(e=>e.default):a(()=>import("./index-0f9e3649.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?a(()=>import("./image-d8d63a50.js"),[]).then(e=>e.default):a(()=>import("./index-13b8f8f3.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?a(()=>import("./image-700c8836.js"),[]).then(e=>e.default):a(()=>import("./index-59d01a20.js"),[]).then(e=>e.wallet);case"app.everspace":return t?a(()=>import("./image-b2adbef7.js"),[]).then(e=>e.default):a(()=>import("./index-41983377.js"),[]).then(e=>e.wallet);case"app.zeal":return t?a(()=>import("./image-2b304b44.js"),[]).then(e=>e.default):a(()=>import("./index-2c401274.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?a(()=>import("./image-62b23ff9.js"),[]).then(e=>e.default):a(()=>import("./index-50616e3b.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?a(()=>import("./image-5155e3ea.js"),[]).then(e=>e.default):a(()=>import("./index-36b2634f.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?a(()=>import("./image-1f3c34c8.js"),[]).then(e=>e.default):a(()=>import("./index-f5fbab75.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?a(()=>import("./image-7f982316.js"),[]).then(e=>e.default):a(()=>import("./index-e5aa4409.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?a(()=>import("./image-b80a4d76.js"),[]).then(e=>e.default):a(()=>import("./index-631c21ed.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?a(()=>import("./image-28d0f7ac.js"),[]).then(e=>e.default):a(()=>import("./index-32de03f3.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?a(()=>import("./image-b9c9ea71.js"),[]).then(e=>e.default):a(()=>import("./index-bb1f188c.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?a(()=>import("./image-6ad2ea86.js"),[]).then(e=>e.default):a(()=>import("./index-030536ff.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?a(()=>import("./image-1279f38b.js"),[]).then(e=>e.default):a(()=>import("./index-75a75b59.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?a(()=>import("./image-31e2154f.js"),[]).then(e=>e.default):a(()=>import("./index-e8696e62.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?a(()=>import("./image-71e8d590.js"),[]).then(e=>e.default):a(()=>import("./index-c9e7e64b.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?a(()=>import("./image-13f3fee6.js"),[]).then(e=>e.default):a(()=>import("./index-744cdec3.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?a(()=>import("./image-76822fa4.js"),[]).then(e=>e.default):a(()=>import("./index-376ab352.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?a(()=>import("./image-f33ea7fd.js"),[]).then(e=>e.default):a(()=>import("./index-c8d1b7f0.js"),[]).then(e=>e.wallet);case"app.krystal":return t?a(()=>import("./image-f65c6ab6.js"),[]).then(e=>e.default):a(()=>import("./index-0169bd14.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?a(()=>import("./image-d2788e8f.js"),[]).then(e=>e.default):a(()=>import("./index-0eda26d1.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?a(()=>import("./image-80e5a20c.js"),[]).then(e=>e.default):a(()=>import("./index-49da96ea.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?a(()=>import("./image-4fb84256.js"),[]).then(e=>e.default):a(()=>import("./index-62b10a79.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?a(()=>import("./image-a45c4f75.js"),[]).then(e=>e.default):a(()=>import("./index-c3a93da4.js"),[]).then(e=>e.wallet);case"app.keyring":return t?a(()=>import("./image-9605b217.js"),[]).then(e=>e.default):a(()=>import("./index-5a3b22dc.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?a(()=>import("./image-2cbbbb70.js"),[]).then(e=>e.default):a(()=>import("./index-0506c551.js"),[]).then(e=>e.wallet);case"tech.okto":return t?a(()=>import("./image-1892b63a.js"),[]).then(e=>e.default):a(()=>import("./index-91f3c380.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?a(()=>import("./image-34615249.js"),[]).then(e=>e.default):a(()=>import("./index-497b6154.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?a(()=>import("./image-8ada696b.js"),[]).then(e=>e.default):a(()=>import("./index-b78a9f32.js"),[]).then(e=>e.wallet);case"app.nightly":return t?a(()=>import("./image-6e3e6c3a.js"),[]).then(e=>e.default):a(()=>import("./index-fc64e381.js"),[]).then(e=>e.wallet);case"com.coin98":return t?a(()=>import("./image-511b8bdd.js"),[]).then(e=>e.default):a(()=>import("./index-6245b91d.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?a(()=>import("./image-2ddbd867.js"),[]).then(e=>e.default):a(()=>import("./index-c26f1459.js"),[]).then(e=>e.wallet);case"app.linen":return t?a(()=>import("./image-e1c46f95.js"),[]).then(e=>e.default):a(()=>import("./index-e7839a17.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?a(()=>import("./image-7d585189.js"),[]).then(e=>e.default):a(()=>import("./index-43c25958.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?a(()=>import("./image-b91de37b.js"),[]).then(e=>e.default):a(()=>import("./index-7c1f072d.js"),[]).then(e=>e.wallet);case"my.mone":return t?a(()=>import("./image-047ee4aa.js"),[]).then(e=>e.default):a(()=>import("./index-b96f8500.js"),[]).then(e=>e.wallet);case"org.alephium":return t?a(()=>import("./image-4c6a97a0.js"),[]).then(e=>e.default):a(()=>import("./index-8e183615.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?a(()=>import("./image-7c3e3d96.js"),[]).then(e=>e.default):a(()=>import("./index-2976aec2.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?a(()=>import("./image-a24b6b7d.js"),[]).then(e=>e.default):a(()=>import("./index-c8c6ca55.js"),[]).then(e=>e.wallet);case"com.veworld":return t?a(()=>import("./image-7fd447ab.js"),[]).then(e=>e.default):a(()=>import("./index-f80ecd95.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?a(()=>import("./image-3456be06.js"),[]).then(e=>e.default):a(()=>import("./index-627d65cb.js"),[]).then(e=>e.wallet);case"io.noone":return t?a(()=>import("./image-34b47c79.js"),[]).then(e=>e.default):a(()=>import("./index-6321c578.js"),[]).then(e=>e.wallet);case"network.haqq":return t?a(()=>import("./image-dc070867.js"),[]).then(e=>e.default):a(()=>import("./index-0785a452.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?a(()=>import("./image-3a71e43d.js"),[]).then(e=>e.default):a(()=>import("./index-4111dedd.js"),[]).then(e=>e.wallet);case"me.iopay":return t?a(()=>import("./image-7ad14403.js"),[]).then(e=>e.default):a(()=>import("./index-e80bd9ca.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?a(()=>import("./image-e8d20ee9.js"),[]).then(e=>e.default):a(()=>import("./index-4ab5de1a.js"),[]).then(e=>e.wallet);case"io.okse":return t?a(()=>import("./image-474d82c4.js"),[]).then(e=>e.default):a(()=>import("./index-71590119.js"),[]).then(e=>e.wallet);case"network.over":return t?a(()=>import("./image-3f34f0de.js"),[]).then(e=>e.default):a(()=>import("./index-3afe8699.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?a(()=>import("./image-762fe7a2.js"),[]).then(e=>e.default):a(()=>import("./index-4c2e6f7b.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?a(()=>import("./image-15895c53.js"),[]).then(e=>e.default):a(()=>import("./index-a05528a1.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?a(()=>import("./image-654f273a.js"),[]).then(e=>e.default):a(()=>import("./index-7aea539e.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?a(()=>import("./image-4c1680a8.js"),[]).then(e=>e.default):a(()=>import("./index-6776bb2a.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?a(()=>import("./image-c6cb1237.js"),[]).then(e=>e.default):a(()=>import("./index-e103ab87.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?a(()=>import("./image-6b43a247.js"),[]).then(e=>e.default):a(()=>import("./index-7090f049.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?a(()=>import("./image-023d7646.js"),[]).then(e=>e.default):a(()=>import("./index-ffbb22f4.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?a(()=>import("./image-cfcbe910.js"),[]).then(e=>e.default):a(()=>import("./index-bacf660a.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?a(()=>import("./image-110fb3aa.js"),[]).then(e=>e.default):a(()=>import("./index-8a65315d.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?a(()=>import("./image-d693b325.js"),[]).then(e=>e.default):a(()=>import("./index-db0e81bf.js"),[]).then(e=>e.wallet);case"it.airgap":return t?a(()=>import("./image-fdfe9d08.js"),[]).then(e=>e.default):a(()=>import("./index-1d890df3.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?a(()=>import("./image-25c67499.js"),[]).then(e=>e.default):a(()=>import("./index-e53c2115.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?a(()=>import("./image-069d504d.js"),[]).then(e=>e.default):a(()=>import("./index-fd5f5806.js"),[]).then(e=>e.wallet);case"com.abra":return t?a(()=>import("./image-31f19877.js"),[]).then(e=>e.default):a(()=>import("./index-8e858979.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?a(()=>import("./image-613a2278.js"),[]).then(e=>e.default):a(()=>import("./index-76279f07.js"),[]).then(e=>e.wallet);case"com.premanft":return t?a(()=>import("./image-c08671a8.js"),[]).then(e=>e.default):a(()=>import("./index-b9d9ecbb.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?a(()=>import("./image-886d9db2.js"),[]).then(e=>e.default):a(()=>import("./index-41b359c5.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?a(()=>import("./image-a5242682.js"),[]).then(e=>e.default):a(()=>import("./index-c38229f3.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?a(()=>import("./image-0dbe18eb.js"),[]).then(e=>e.default):a(()=>import("./index-66f94957.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?a(()=>import("./image-c528d1ce.js"),[]).then(e=>e.default):a(()=>import("./index-12d5f8e0.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?a(()=>import("./image-eb9e4019.js"),[]).then(e=>e.default):a(()=>import("./index-8052aeb7.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?a(()=>import("./image-34d21788.js"),[]).then(e=>e.default):a(()=>import("./index-8048a16e.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?a(()=>import("./image-5f7cd182.js"),[]).then(e=>e.default):a(()=>import("./index-d8886e48.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?a(()=>import("./image-be8b4911.js"),[]).then(e=>e.default):a(()=>import("./index-55acd996.js"),[]).then(e=>e.wallet);case"app.freighter":return t?a(()=>import("./image-d54b32f4.js"),[]).then(e=>e.default):a(()=>import("./index-f80fefdd.js"),[]).then(e=>e.wallet);case"app.stickey":return t?a(()=>import("./image-ca8d6496.js"),[]).then(e=>e.default):a(()=>import("./index-265c3d2e.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?a(()=>import("./image-c12e115c.js"),[]).then(e=>e.default):a(()=>import("./index-43a1b491.js"),[]).then(e=>e.wallet);case"io.harti":return t?a(()=>import("./image-d784f4f2.js"),[]).then(e=>e.default):a(()=>import("./index-13d47a28.js"),[]).then(e=>e.wallet);case"io.dttd":return t?a(()=>import("./image-ee100c10.js"),[]).then(e=>e.default):a(()=>import("./index-7df9cd6f.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?a(()=>import("./image-4c71c8cb.js"),[]).then(e=>e.default):a(()=>import("./index-c6ee25d9.js"),[]).then(e=>e.wallet);case"io.klever":return t?a(()=>import("./image-2054fa08.js"),[]).then(e=>e.default):a(()=>import("./index-7536b804.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?a(()=>import("./image-1a3b97ef.js"),[]).then(e=>e.default):a(()=>import("./index-dad128bd.js"),[]).then(e=>e.wallet);case"is.callback":return t?a(()=>import("./image-44cedadf.js"),[]).then(e=>e.default):a(()=>import("./index-a89ba17c.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?a(()=>import("./image-8b8e30d2.js"),[]).then(e=>e.default):a(()=>import("./index-4791b221.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?a(()=>import("./image-450b8aba.js"),[]).then(e=>e.default):a(()=>import("./index-a584b790.js"),[]).then(e=>e.wallet);case"io.fizen":return t?a(()=>import("./image-6c7375f0.js"),[]).then(e=>e.default):a(()=>import("./index-8d632bf4.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?a(()=>import("./image-029cf582.js"),[]).then(e=>e.default):a(()=>import("./index-b2396d1c.js"),[]).then(e=>e.wallet);case"world.ixo":return t?a(()=>import("./image-d5b6946f.js"),[]).then(e=>e.default):a(()=>import("./index-8d2deecb.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?a(()=>import("./image-05c4ade8.js"),[]).then(e=>e.default):a(()=>import("./index-2738ffa4.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?a(()=>import("./image-fd93bd7d.js"),[]).then(e=>e.default):a(()=>import("./index-fb5522f0.js"),[]).then(e=>e.wallet);case"app.ammer":return t?a(()=>import("./image-7744a696.js"),[]).then(e=>e.default):a(()=>import("./index-a0112923.js"),[]).then(e=>e.wallet);case"us.binance":return t?a(()=>import("./image-e2b37e1f.js"),[]).then(e=>e.default):a(()=>import("./index-16fe022e.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?a(()=>import("./image-043d9975.js"),[]).then(e=>e.default):a(()=>import("./index-c0069eca.js"),[]).then(e=>e.wallet);case"co.muza":return t?a(()=>import("./image-aefdad5a.js"),[]).then(e=>e.default):a(()=>import("./index-0f9c6a24.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?a(()=>import("./image-367a479a.js"),[]).then(e=>e.default):a(()=>import("./index-148af89f.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?a(()=>import("./image-b745b1d3.js"),[]).then(e=>e.default):a(()=>import("./index-fe9fe747.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?a(()=>import("./image-ed319e2e.js"),[]).then(e=>e.default):a(()=>import("./index-5ce66a18.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?a(()=>import("./image-8d1fea94.js"),[]).then(e=>e.default):a(()=>import("./index-586bfc8b.js"),[]).then(e=>e.wallet);case"org.dota168":return t?a(()=>import("./image-4bdc287f.js"),[]).then(e=>e.default):a(()=>import("./index-6db764b9.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?a(()=>import("./image-6f794cd9.js"),[]).then(e=>e.default):a(()=>import("./index-a8a1817b.js"),[]).then(e=>e.wallet);case"com.coininn":return t?a(()=>import("./image-2dee0cf0.js"),[]).then(e=>e.default):a(()=>import("./index-69f20d4b.js"),[]).then(e=>e.wallet);case"me.easy":return t?a(()=>import("./image-a73c9941.js"),[]).then(e=>e.default):a(()=>import("./index-788028ef.js"),[]).then(e=>e.wallet);case"io.shido":return t?a(()=>import("./image-cddb40c4.js"),[]).then(e=>e.default):a(()=>import("./index-af115980.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?a(()=>import("./image-f58c6dbd.js"),[]).then(e=>e.default):a(()=>import("./index-01f493ba.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?a(()=>import("./image-4b4bdd54.js"),[]).then(e=>e.default):a(()=>import("./index-a61d31d4.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?a(()=>import("./image-e3ce6283.js"),[]).then(e=>e.default):a(()=>import("./index-72495416.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?a(()=>import("./image-11441301.js"),[]).then(e=>e.default):a(()=>import("./index-942bc8b4.js"),[]).then(e=>e.wallet);case"com.beexo":return t?a(()=>import("./image-47d043a0.js"),[]).then(e=>e.default):a(()=>import("./index-985b79f3.js"),[]).then(e=>e.wallet);case"social.halo":return t?a(()=>import("./image-352cd1ed.js"),[]).then(e=>e.default):a(()=>import("./index-b72e8b55.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?a(()=>import("./image-40ef351d.js"),[]).then(e=>e.default):a(()=>import("./index-8c4927a7.js"),[]).then(e=>e.wallet);case"app.status":return t?a(()=>import("./image-a83439d9.js"),[]).then(e=>e.default):a(()=>import("./index-332be3b9.js"),[]).then(e=>e.wallet);case"com.midoin":return t?a(()=>import("./image-bfda252b.js"),[]).then(e=>e.default):a(()=>import("./index-8debcecc.js"),[]).then(e=>e.wallet);case"id.competence":return t?a(()=>import("./image-1223cb9f.js"),[]).then(e=>e.default):a(()=>import("./index-acb3ee58.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?a(()=>import("./image-7b50c6d4.js"),[]).then(e=>e.default):a(()=>import("./index-de6b9e12.js"),[]).then(e=>e.wallet);case"llc.besc":return t?a(()=>import("./image-e9ff7d1f.js"),[]).then(e=>e.default):a(()=>import("./index-fcefde13.js"),[]).then(e=>e.wallet);case"baby.smart":return t?a(()=>import("./image-abf21e44.js"),[]).then(e=>e.default):a(()=>import("./index-89a91c5f.js"),[]).then(e=>e.wallet);case"app.onto":return t?a(()=>import("./image-52691b02.js"),[]).then(e=>e.default):a(()=>import("./index-8f8f8215.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?a(()=>import("./image-1f20507c.js"),[]).then(e=>e.default):a(()=>import("./index-a7156d06.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?a(()=>import("./image-8596ec3f.js"),[]).then(e=>e.default):a(()=>import("./index-88c3f3eb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?a(()=>import("./image-e52f7d79.js"),[]).then(e=>e.default):a(()=>import("./index-bda18f68.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?a(()=>import("./image-220d0e7b.js"),[]).then(e=>e.default):a(()=>import("./index-7049a0ee.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?a(()=>import("./image-42722682.js"),[]).then(e=>e.default):a(()=>import("./index-6c5378f9.js"),[]).then(e=>e.wallet);case"io.zkape":return t?a(()=>import("./image-0f66d24c.js"),[]).then(e=>e.default):a(()=>import("./index-ff824d5e.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?a(()=>import("./image-c06b41bb.js"),[]).then(e=>e.default):a(()=>import("./index-e8fde7f2.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?a(()=>import("./image-1f9dfe0a.js"),[]).then(e=>e.default):a(()=>import("./index-1ee724a2.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?a(()=>import("./image-c126314d.js"),[]).then(e=>e.default):a(()=>import("./index-31377f96.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?a(()=>import("./image-176cde2e.js"),[]).then(e=>e.default):a(()=>import("./index-a3aaa26a.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?a(()=>import("./image-0f9730ff.js"),[]).then(e=>e.default):a(()=>import("./index-7867075f.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?a(()=>import("./image-ee3481c8.js"),[]).then(e=>e.default):a(()=>import("./index-be6d9a1e.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?a(()=>import("./image-8a5c216f.js"),[]).then(e=>e.default):a(()=>import("./index-7679da53.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?a(()=>import("./image-7c2f2c0a.js"),[]).then(e=>e.default):a(()=>import("./index-15261f6e.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?a(()=>import("./image-c0c098f2.js"),[]).then(e=>e.default):a(()=>import("./index-f7977d9e.js"),[]).then(e=>e.wallet);case"com.webauth":return t?a(()=>import("./image-a0295917.js"),[]).then(e=>e.default):a(()=>import("./index-52f4eed7.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?a(()=>import("./image-dac78878.js"),[]).then(e=>e.default):a(()=>import("./index-d8f70364.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?a(()=>import("./image-a4514e06.js"),[]).then(e=>e.default):a(()=>import("./index-b7a49b10.js"),[]).then(e=>e.wallet);case"io.nash":return t?a(()=>import("./image-f900ff40.js"),[]).then(e=>e.default):a(()=>import("./index-f237b8d3.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?a(()=>import("./image-53b9b6ba.js"),[]).then(e=>e.default):a(()=>import("./index-cdf1dafe.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?a(()=>import("./image-c9f80d71.js"),[]).then(e=>e.default):a(()=>import("./index-aaeb66a6.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?a(()=>import("./image-c729756d.js"),[]).then(e=>e.default):a(()=>import("./index-baaa37df.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?a(()=>import("./image-a03bd401.js"),[]).then(e=>e.default):a(()=>import("./index-7fa95294.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?a(()=>import("./image-d17c8f8d.js"),[]).then(e=>e.default):a(()=>import("./index-a5cc73ae.js"),[]).then(e=>e.wallet);case"io.kigo":return t?a(()=>import("./image-3cc02532.js"),[]).then(e=>e.default):a(()=>import("./index-a7eb10a6.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?a(()=>import("./image-1567922c.js"),[]).then(e=>e.default):a(()=>import("./index-c82a8aec.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?a(()=>import("./image-131531c5.js"),[]).then(e=>e.default):a(()=>import("./index-14d4279a.js"),[]).then(e=>e.wallet);case"app.sinum":return t?a(()=>import("./image-e76d3d62.js"),[]).then(e=>e.default):a(()=>import("./index-797dc589.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?a(()=>import("./image-af55dad6.js"),[]).then(e=>e.default):a(()=>import("./index-4e9a0536.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?a(()=>import("./image-caec43bc.js"),[]).then(e=>e.default):a(()=>import("./index-8b0b95b5.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?a(()=>import("./image-64b9eec9.js"),[]).then(e=>e.default):a(()=>import("./index-951e2b77.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?a(()=>import("./image-25666b5a.js"),[]).then(e=>e.default):a(()=>import("./index-cd08fd6e.js"),[]).then(e=>e.wallet);case"money.keychain":return t?a(()=>import("./image-b10a18c1.js"),[]).then(e=>e.default):a(()=>import("./index-ed1ac633.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?a(()=>import("./image-bb1e75ca.js"),[]).then(e=>e.default):a(()=>import("./index-fc88585f.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?a(()=>import("./image-b152ccec.js"),[]).then(e=>e.default):a(()=>import("./index-936d7a89.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?a(()=>import("./image-a4dde23d.js"),[]).then(e=>e.default):a(()=>import("./index-f017d31a.js"),[]).then(e=>e.wallet);case"gg.indi":return t?a(()=>import("./image-21b12a44.js"),[]).then(e=>e.default):a(()=>import("./index-c666fda7.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?a(()=>import("./image-2bc1277f.js"),[]).then(e=>e.default):a(()=>import("./index-4cd5d792.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?a(()=>import("./image-66973cb5.js"),[]).then(e=>e.default):a(()=>import("./index-45c36709.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?a(()=>import("./image-35809c81.js"),[]).then(e=>e.default):a(()=>import("./index-1bd11577.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?a(()=>import("./image-1e5717b5.js"),[]).then(e=>e.default):a(()=>import("./index-1b4db9c7.js"),[]).then(e=>e.wallet);case"app.utorg":return t?a(()=>import("./image-dc54d4cd.js"),[]).then(e=>e.default):a(()=>import("./index-c4ddd66a.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?a(()=>import("./image-525331ad.js"),[]).then(e=>e.default):a(()=>import("./index-81db80ab.js"),[]).then(e=>e.wallet);case"org.rezor":return t?a(()=>import("./image-8cc58a0c.js"),[]).then(e=>e.default):a(()=>import("./index-e212258e.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?a(()=>import("./image-af1093f4.js"),[]).then(e=>e.default):a(()=>import("./index-bade2eba.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?a(()=>import("./image-f50f42e5.js"),[]).then(e=>e.default):a(()=>import("./index-5af4f55b.js"),[]).then(e=>e.wallet);case"com.ripio":return t?a(()=>import("./image-cb86b447.js"),[]).then(e=>e.default):a(()=>import("./index-473d69c2.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?a(()=>import("./image-39e869cb.js"),[]).then(e=>e.default):a(()=>import("./index-cb35f3fd.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?a(()=>import("./image-f9f924eb.js"),[]).then(e=>e.default):a(()=>import("./index-32e23421.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?a(()=>import("./image-488380be.js"),[]).then(e=>e.default):a(()=>import("./index-c0e6df99.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?a(()=>import("./image-9c004f74.js"),[]).then(e=>e.default):a(()=>import("./index-d07bfff2.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?a(()=>import("./image-50b6b33e.js"),[]).then(e=>e.default):a(()=>import("./index-ffd2ffb7.js"),[]).then(e=>e.wallet);case"com.zypto":return t?a(()=>import("./image-196f123e.js"),[]).then(e=>e.default):a(()=>import("./index-8df2641a.js"),[]).then(e=>e.wallet);case"io.nabox":return t?a(()=>import("./image-3883671c.js"),[]).then(e=>e.default):a(()=>import("./index-01a14e2a.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?a(()=>import("./image-bb9b6108.js"),[]).then(e=>e.default):a(()=>import("./index-8a3d5c3f.js"),[]).then(e=>e.wallet);case"com.ballet":return t?a(()=>import("./image-57e59283.js"),[]).then(e=>e.default):a(()=>import("./index-13074009.js"),[]).then(e=>e.wallet);case"io.talken":return t?a(()=>import("./image-3ba29785.js"),[]).then(e=>e.default):a(()=>import("./index-c7b27786.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?a(()=>import("./image-e5cfb36a.js"),[]).then(e=>e.default):a(()=>import("./index-aabdec8a.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?a(()=>import("./image-b0f9aaa8.js"),[]).then(e=>e.default):a(()=>import("./index-0d0f82b1.js"),[]).then(e=>e.wallet);case"io.pockie":return t?a(()=>import("./image-2c308eab.js"),[]).then(e=>e.default):a(()=>import("./index-19f3379d.js"),[]).then(e=>e.wallet);case"me.astrox":return t?a(()=>import("./image-b5d039e7.js"),[]).then(e=>e.default):a(()=>import("./index-4e154393.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?a(()=>import("./image-41fb4d11.js"),[]).then(e=>e.default):a(()=>import("./index-22d9233b.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?a(()=>import("./image-9b2bfcfa.js"),[]).then(e=>e.default):a(()=>import("./index-ce1fcd5f.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?a(()=>import("./image-cd654aa6.js"),[]).then(e=>e.default):a(()=>import("./index-880819c4.js"),[]).then(e=>e.wallet);case"app.gamic":return t?a(()=>import("./image-56cf8527.js"),[]).then(e=>e.default):a(()=>import("./index-6a3f5d94.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?a(()=>import("./image-711e4da4.js"),[]).then(e=>e.default):a(()=>import("./index-ac22aeb8.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?a(()=>import("./image-ecccfb56.js"),[]).then(e=>e.default):a(()=>import("./index-91a568b3.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?a(()=>import("./image-db0f091f.js"),[]).then(e=>e.default):a(()=>import("./index-7e16d451.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?a(()=>import("./image-dc4608a2.js"),[]).then(e=>e.default):a(()=>import("./index-d166450a.js"),[]).then(e=>e.wallet);case"com.hootark":return t?a(()=>import("./image-5945e86f.js"),[]).then(e=>e.default):a(()=>import("./index-b1565217.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?a(()=>import("./image-bf145898.js"),[]).then(e=>e.default):a(()=>import("./index-79850ec0.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?a(()=>import("./image-952960c2.js"),[]).then(e=>e.default):a(()=>import("./index-a67088fa.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?a(()=>import("./image-01241056.js"),[]).then(e=>e.default):a(()=>import("./index-b234aa52.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?a(()=>import("./image-200312c4.js"),[]).then(e=>e.default):a(()=>import("./index-28213add.js"),[]).then(e=>e.wallet);case"co.swopme":return t?a(()=>import("./image-9cb83c6c.js"),[]).then(e=>e.default):a(()=>import("./index-5afe3f99.js"),[]).then(e=>e.wallet);case"com.kresus":return t?a(()=>import("./image-dbe220f9.js"),[]).then(e=>e.default):a(()=>import("./index-22fc2519.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?a(()=>import("./image-9d2dc55c.js"),[]).then(e=>e.default):a(()=>import("./index-833f8d73.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?a(()=>import("./image-6f9546ad.js"),[]).then(e=>e.default):a(()=>import("./index-f0032e47.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?a(()=>import("./image-9036e48e.js"),[]).then(e=>e.default):a(()=>import("./index-4e5abbfd.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?a(()=>import("./image-8612d3a8.js"),[]).then(e=>e.default):a(()=>import("./index-84336255.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?a(()=>import("./image-8fdb37ca.js"),[]).then(e=>e.default):a(()=>import("./index-927da63d.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?a(()=>import("./image-57092d0b.js"),[]).then(e=>e.default):a(()=>import("./index-915b5067.js"),[]).then(e=>e.wallet);case"app.xverse":return t?a(()=>import("./image-c5cff271.js"),[]).then(e=>e.default):a(()=>import("./index-8dfa36dc.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?a(()=>import("./image-7f0b2363.js"),[]).then(e=>e.default):a(()=>import("./index-fd6770b8.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?a(()=>import("./image-2362c655.js"),[]).then(e=>e.default):a(()=>import("./index-eaa46159.js"),[]).then(e=>e.wallet);case"org.arianee":return t?a(()=>import("./image-5e686405.js"),[]).then(e=>e.default):a(()=>import("./index-97a74e48.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?a(()=>import("./image-70e00bb3.js"),[]).then(e=>e.default):a(()=>import("./index-b756dd2e.js"),[]).then(e=>e.wallet);case"io.owallet":return t?a(()=>import("./image-3cfd2235.js"),[]).then(e=>e.default):a(()=>import("./index-fb15c4cd.js"),[]).then(e=>e.wallet);case"io.zelus":return t?a(()=>import("./image-05de5297.js"),[]).then(e=>e.default):a(()=>import("./index-3f9874d3.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?a(()=>import("./image-6361c328.js"),[]).then(e=>e.default):a(()=>import("./index-e1095e2b.js"),[]).then(e=>e.wallet);case"io.clingon":return t?a(()=>import("./image-e6e485dc.js"),[]).then(e=>e.default):a(()=>import("./index-c40c0760.js"),[]).then(e=>e.wallet);case"com.icewal":return t?a(()=>import("./image-76792282.js"),[]).then(e=>e.default):a(()=>import("./index-d718436a.js"),[]).then(e=>e.wallet);case"io.streakk":return t?a(()=>import("./image-266744e5.js"),[]).then(e=>e.default):a(()=>import("./index-391abf76.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?a(()=>import("./image-83549573.js"),[]).then(e=>e.default):a(()=>import("./index-3589a1e3.js"),[]).then(e=>e.wallet);case"finance.porta":return t?a(()=>import("./image-17dd24f7.js"),[]).then(e=>e.default):a(()=>import("./index-a74f3d72.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?a(()=>import("./image-fba75105.js"),[]).then(e=>e.default):a(()=>import("./index-6b9fb6e9.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?a(()=>import("./image-e4f5f86c.js"),[]).then(e=>e.default):a(()=>import("./index-fc8872a5.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?a(()=>import("./image-fac24185.js"),[]).then(e=>e.default):a(()=>import("./index-70b80d31.js"),[]).then(e=>e.wallet);case"live.superex":return t?a(()=>import("./image-f28c48fb.js"),[]).then(e=>e.default):a(()=>import("./index-cc192ed1.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?a(()=>import("./image-2adb500e.js"),[]).then(e=>e.default):a(()=>import("./index-16aa25a6.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?a(()=>import("./image-4725c954.js"),[]).then(e=>e.default):a(()=>import("./index-b6eee293.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?a(()=>import("./image-57125edf.js"),[]).then(e=>e.default):a(()=>import("./index-3f051ac9.js"),[]).then(e=>e.wallet);case"com.reown":return t?a(()=>import("./image-aac193f4.js"),[]).then(e=>e.default):a(()=>import("./index-1e695d4e.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?a(()=>import("./image-1bb50bc7.js"),[]).then(e=>e.default):a(()=>import("./index-e1eb9218.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?a(()=>import("./image-dcef216f.js"),[]).then(e=>e.default):a(()=>import("./index-28b17e1f.js"),[]).then(e=>e.wallet);case"io.passpay":return t?a(()=>import("./image-dd734329.js"),[]).then(e=>e.default):a(()=>import("./index-ec29070b.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?a(()=>import("./image-1f7d22f5.js"),[]).then(e=>e.default):a(()=>import("./index-3a672fc0.js"),[]).then(e=>e.wallet);case"io.plutope":return t?a(()=>import("./image-2a5bdc0a.js"),[]).then(e=>e.default):a(()=>import("./index-1b657c21.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?a(()=>import("./image-66e13da5.js"),[]).then(e=>e.default):a(()=>import("./index-da110ac4.js"),[]).then(e=>e.wallet);case"co.xellar":return t?a(()=>import("./image-2e7a1558.js"),[]).then(e=>e.default):a(()=>import("./index-983280c1.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?a(()=>import("./image-1eac3549.js"),[]).then(e=>e.default):a(()=>import("./index-6e12566c.js"),[]).then(e=>e.wallet);case"org.shefi":return t?a(()=>import("./image-80c7d64c.js"),[]).then(e=>e.default):a(()=>import("./index-ca9b3ec6.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?a(()=>import("./image-711c3ffd.js"),[]).then(e=>e.default):a(()=>import("./index-209501cf.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?a(()=>import("./image-5a49e115.js"),[]).then(e=>e.default):a(()=>import("./index-19d2709a.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?a(()=>import("./image-ffcff004.js"),[]).then(e=>e.default):a(()=>import("./index-2f22c063.js"),[]).then(e=>e.wallet);case"finance.plena":return t?a(()=>import("./image-3b386918.js"),[]).then(e=>e.default):a(()=>import("./index-3150a291.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?a(()=>import("./image-a0b17548.js"),[]).then(e=>e.default):a(()=>import("./index-50b7ce8d.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?a(()=>import("./image-3f08d2bf.js"),[]).then(e=>e.default):a(()=>import("./index-fd4ea05e.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?a(()=>import("./image-97dca603.js"),[]).then(e=>e.default):a(()=>import("./index-ab132c56.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?a(()=>import("./image-9be340f3.js"),[]).then(e=>e.default):a(()=>import("./index-6f77685d.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?a(()=>import("./image-60cb9f98.js"),[]).then(e=>e.default):a(()=>import("./index-0094b416.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?a(()=>import("./image-065a65b9.js"),[]).then(e=>e.default):a(()=>import("./index-b3a43ac8.js"),[]).then(e=>e.wallet);case"io.blocto":return t?a(()=>import("./image-ba8918e5.js"),[]).then(e=>e.default):a(()=>import("./index-99ba3e8e.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?a(()=>import("./image-580ac281.js"),[]).then(e=>e.default):a(()=>import("./index-d99e31af.js"),[]).then(e=>e.wallet);case"io.getclave":return t?a(()=>import("./image-51491dec.js"),[]).then(e=>e.default):a(()=>import("./index-38ceb300.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?a(()=>import("./image-dad22fe1.js"),[]).then(e=>e.default):a(()=>import("./index-d905ffe1.js"),[]).then(e=>e.wallet);case"app.edge":return t?a(()=>import("./image-62cea552.js"),[]).then(e=>e.default):a(()=>import("./index-64333722.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?a(()=>import("./image-9218fd8d.js"),[]).then(e=>e.default):a(()=>import("./index-95a8a461.js"),[]).then(e=>e.wallet);case"io.konio":return t?a(()=>import("./image-7272768a.js"),[]).then(e=>e.default):a(()=>import("./index-1126bdc3.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?a(()=>import("./image-93940d00.js"),[]).then(e=>e.default):a(()=>import("./index-f5e0400c.js"),[]).then(e=>e.wallet);case"app.imem":return t?a(()=>import("./image-5bf5e0d8.js"),[]).then(e=>e.default):a(()=>import("./index-39ddef31.js"),[]).then(e=>e.wallet);case"com.purechain":return t?a(()=>import("./image-81c54595.js"),[]).then(e=>e.default):a(()=>import("./index-92730ad1.js"),[]).then(e=>e.wallet);case"io.ethos":return t?a(()=>import("./image-6251edd1.js"),[]).then(e=>e.default):a(()=>import("./index-4cc6f2c5.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?a(()=>import("./image-7f26a75c.js"),[]).then(e=>e.default):a(()=>import("./index-71e35aa9.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?a(()=>import("./image-13c11e7f.js"),[]).then(e=>e.default):a(()=>import("./index-538e2e43.js"),[]).then(e=>e.wallet);case"org.kelp":return t?a(()=>import("./image-817cf8f5.js"),[]).then(e=>e.default):a(()=>import("./index-7d1289f6.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?a(()=>import("./image-8ebb7b34.js"),[]).then(e=>e.default):a(()=>import("./index-151c8265.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?a(()=>import("./image-40cbb1ad.js"),[]).then(e=>e.default):a(()=>import("./index-85e4b674.js"),[]).then(e=>e.wallet);case"land.liker":return t?a(()=>import("./image-ccfd22d6.js"),[]).then(e=>e.default):a(()=>import("./index-4c6f6565.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?a(()=>import("./image-9925d1cf.js"),[]).then(e=>e.default):a(()=>import("./index-ae09efd8.js"),[]).then(e=>e.wallet);case"io.certhis":return t?a(()=>import("./image-471041b4.js"),[]).then(e=>e.default):a(()=>import("./index-1a617493.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?a(()=>import("./image-f1f5fc38.js"),[]).then(e=>e.default):a(()=>import("./index-7dc851bb.js"),[]).then(e=>e.wallet);case"com.saify":return t?a(()=>import("./image-d95f3c4c.js"),[]).then(e=>e.default):a(()=>import("./index-bb2fbf81.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?a(()=>import("./image-7bf0939d.js"),[]).then(e=>e.default):a(()=>import("./index-78245c0e.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?a(()=>import("./image-27b9813b.js"),[]).then(e=>e.default):a(()=>import("./index-5df9dfda.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?a(()=>import("./image-0ba1e020.js"),[]).then(e=>e.default):a(()=>import("./index-4fef871b.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?a(()=>import("./image-99fd5bd1.js"),[]).then(e=>e.default):a(()=>import("./index-7c539177.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?a(()=>import("./image-0d3e68e2.js"),[]).then(e=>e.default):a(()=>import("./index-2c973091.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?a(()=>import("./image-e3c10d02.js"),[]).then(e=>e.default):a(()=>import("./index-f23c24cd.js"),[]).then(e=>e.wallet);case"network.dgg":return t?a(()=>import("./image-a822d98f.js"),[]).then(e=>e.default):a(()=>import("./index-7da8b654.js"),[]).then(e=>e.wallet);case"io.up":return t?a(()=>import("./image-8b1d3857.js"),[]).then(e=>e.default):a(()=>import("./index-7ca60685.js"),[]).then(e=>e.wallet);case"com.lif3":return t?a(()=>import("./image-ecf39c49.js"),[]).then(e=>e.default):a(()=>import("./index-840742be.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?a(()=>import("./image-63b5aace.js"),[]).then(e=>e.default):a(()=>import("./index-82ae12bb.js"),[]).then(e=>e.wallet);case"pub.dg":return t?a(()=>import("./image-d4f231f9.js"),[]).then(e=>e.default):a(()=>import("./index-dd065471.js"),[]).then(e=>e.wallet);case"com.wemix":return t?a(()=>import("./image-ece4d4fe.js"),[]).then(e=>e.default):a(()=>import("./index-47858855.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?a(()=>import("./image-782306cd.js"),[]).then(e=>e.default):a(()=>import("./index-3911c3a9.js"),[]).then(e=>e.wallet);case"net.stasis":return t?a(()=>import("./image-cf884551.js"),[]).then(e=>e.default):a(()=>import("./index-581cc181.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?a(()=>import("./image-13d15a2a.js"),[]).then(e=>e.default):a(()=>import("./index-515a52f7.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?a(()=>import("./image-e4796e7b.js"),[]).then(e=>e.default):a(()=>import("./index-6e68418c.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?a(()=>import("./image-143beca5.js"),[]).then(e=>e.default):a(()=>import("./index-24171c56.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?a(()=>import("./image-b66f235a.js"),[]).then(e=>e.default):a(()=>import("./index-62eef073.js"),[]).then(e=>e.wallet);case"com.opz":return t?a(()=>import("./image-ab36b3d0.js"),[]).then(e=>e.default):a(()=>import("./index-0bf71e87.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?a(()=>import("./image-4da57b50.js"),[]).then(e=>e.default):a(()=>import("./index-1cfe6c91.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?a(()=>import("./image-d097d3c0.js"),[]).then(e=>e.default):a(()=>import("./index-6aa7373a.js"),[]).then(e=>e.wallet);case"app.omni":return t?a(()=>import("./image-edbde867.js"),[]).then(e=>e.default):a(()=>import("./index-83dbf629.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?a(()=>import("./image-e6d74564.js"),[]).then(e=>e.default):a(()=>import("./index-5f599cbc.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?a(()=>import("./image-a7cf1cb7.js"),[]).then(e=>e.default):a(()=>import("./index-3ae03fde.js"),[]).then(e=>e.wallet);case"io.kgen":return t?a(()=>import("./image-53e2712c.js"),[]).then(e=>e.default):a(()=>import("./index-b149efd8.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?a(()=>import("./image-8ec7d0f0.js"),[]).then(e=>e.default):a(()=>import("./index-09fc2522.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?a(()=>import("./image-f9f4ed70.js"),[]).then(e=>e.default):a(()=>import("./index-9ba221ec.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?a(()=>import("./image-d6c00189.js"),[]).then(e=>e.default):a(()=>import("./index-c306008e.js"),[]).then(e=>e.wallet);case"com.daffione":return t?a(()=>import("./image-1b8e76fd.js"),[]).then(e=>e.default):a(()=>import("./index-4baceff6.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?a(()=>import("./image-3350e758.js"),[]).then(e=>e.default):a(()=>import("./index-0820f529.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?a(()=>import("./image-656b3b28.js"),[]).then(e=>e.default):a(()=>import("./index-8e4830af.js"),[]).then(e=>e.wallet);case"com.nodle":return t?a(()=>import("./image-0e09889f.js"),[]).then(e=>e.default):a(()=>import("./index-35e870a9.js"),[]).then(e=>e.wallet);case"app.tofee":return t?a(()=>import("./image-8ea6e4f6.js"),[]).then(e=>e.default):a(()=>import("./index-8e6acbef.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?a(()=>import("./image-58187a73.js"),[]).then(e=>e.default):a(()=>import("./index-7afdafe1.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?a(()=>import("./image-ae50f251.js"),[]).then(e=>e.default):a(()=>import("./index-ba1b14c7.js"),[]).then(e=>e.wallet);case"io.ready":return t?a(()=>import("./image-670a4b24.js"),[]).then(e=>e.default):a(()=>import("./index-9fd377a1.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?a(()=>import("./image-5579beb2.js"),[]).then(e=>e.default):a(()=>import("./index-725adb4a.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?a(()=>import("./image-c38c98f9.js"),[]).then(e=>e.default):a(()=>import("./index-1ae64046.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?a(()=>import("./image-9d207498.js"),[]).then(e=>e.default):a(()=>import("./index-1b193e90.js"),[]).then(e=>e.wallet);case"com.apollox":return t?a(()=>import("./image-28e82398.js"),[]).then(e=>e.default):a(()=>import("./index-6d1315a8.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?a(()=>import("./image-55332d5f.js"),[]).then(e=>e.default):a(()=>import("./index-231e0fec.js"),[]).then(e=>e.wallet);case"com.payperless":return t?a(()=>import("./image-b24e2f77.js"),[]).then(e=>e.default):a(()=>import("./index-12726c72.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?a(()=>import("./image-bea35144.js"),[]).then(e=>e.default):a(()=>import("./index-cfc98f5c.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?a(()=>import("./image-e644625d.js"),[]).then(e=>e.default):a(()=>import("./index-44598661.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?a(()=>import("./image-40a5f8e6.js"),[]).then(e=>e.default):a(()=>import("./index-811c351c.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?a(()=>import("./image-0eb0f240.js"),[]).then(e=>e.default):a(()=>import("./index-3670e092.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?a(()=>import("./image-7a60b3ff.js"),[]).then(e=>e.default):a(()=>import("./index-eb0ba054.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?a(()=>import("./image-245048fe.js"),[]).then(e=>e.default):a(()=>import("./index-2fbd44af.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?a(()=>import("./image-066cc944.js"),[]).then(e=>e.default):a(()=>import("./index-d5d9bfbe.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?a(()=>import("./image-e6564e3c.js"),[]).then(e=>e.default):a(()=>import("./index-a8067c51.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?a(()=>import("./image-709eed7c.js"),[]).then(e=>e.default):a(()=>import("./index-a49ba1bb.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?a(()=>import("./image-c65259d1.js"),[]).then(e=>e.default):a(()=>import("./index-9945d0a4.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?a(()=>import("./image-ed29bf9b.js"),[]).then(e=>e.default):a(()=>import("./index-31d41b98.js"),[]).then(e=>e.wallet);case"io.helixid":return t?a(()=>import("./image-12433199.js"),[]).then(e=>e.default):a(()=>import("./index-b42d83d8.js"),[]).then(e=>e.wallet);case"com.broearn":return t?a(()=>import("./image-cbdbd157.js"),[]).then(e=>e.default):a(()=>import("./index-8cba0b6e.js"),[]).then(e=>e.wallet);case"io.altme":return t?a(()=>import("./image-ca02d7bb.js"),[]).then(e=>e.default):a(()=>import("./index-73c50e1e.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?a(()=>import("./image-432e8bb8.js"),[]).then(e=>e.default):a(()=>import("./index-9bb84581.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?a(()=>import("./image-871ed5ce.js"),[]).then(e=>e.default):a(()=>import("./index-93d5137e.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?a(()=>import("./image-81a0606b.js"),[]).then(e=>e.default):a(()=>import("./index-f8c4ff86.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?a(()=>import("./image-f86d5927.js"),[]).then(e=>e.default):a(()=>import("./index-627f6cad.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?a(()=>import("./image-2eedbf07.js"),[]).then(e=>e.default):a(()=>import("./index-aa90fc14.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?a(()=>import("./image-2c07c05f.js"),[]).then(e=>e.default):a(()=>import("./index-47da232a.js"),[]).then(e=>e.wallet);case"io.xucre":return t?a(()=>import("./image-c07d1b2c.js"),[]).then(e=>e.default):a(()=>import("./index-170c619c.js"),[]).then(e=>e.wallet);case"app.girin":return t?a(()=>import("./image-09062d73.js"),[]).then(e=>e.default):a(()=>import("./index-f71b397a.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?a(()=>import("./image-8613a3ca.js"),[]).then(e=>e.default):a(()=>import("./index-abba9359.js"),[]).then(e=>e.wallet);case"app.clot":return t?a(()=>import("./image-f4a61df0.js"),[]).then(e=>e.default):a(()=>import("./index-f3e673b3.js"),[]).then(e=>e.wallet);case"io.transi":return t?a(()=>import("./image-0ea595f0.js"),[]).then(e=>e.default):a(()=>import("./index-37bd9aea.js"),[]).then(e=>e.wallet);case"world.qoin":return t?a(()=>import("./image-62901d33.js"),[]).then(e=>e.default):a(()=>import("./index-3231dc25.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?a(()=>import("./image-43caab73.js"),[]).then(e=>e.default):a(()=>import("./index-92d93cc3.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?a(()=>import("./image-3d91272e.js"),[]).then(e=>e.default):a(()=>import("./index-f5818c2b.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?a(()=>import("./image-6cb471bf.js"),[]).then(e=>e.default):a(()=>import("./index-f18e900e.js"),[]).then(e=>e.wallet);case"social.gm2":return t?a(()=>import("./image-44bce38e.js"),[]).then(e=>e.default):a(()=>import("./index-87b8b62b.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?a(()=>import("./image-74f6892f.js"),[]).then(e=>e.default):a(()=>import("./index-c485d323.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?a(()=>import("./image-95707d33.js"),[]).then(e=>e.default):a(()=>import("./index-2397a481.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?a(()=>import("./image-c62303ba.js"),[]).then(e=>e.default):a(()=>import("./index-316cc9e5.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?a(()=>import("./image-0d9f0368.js"),[]).then(e=>e.default):a(()=>import("./index-38713a1f.js"),[]).then(e=>e.wallet);case"world.fncy":return t?a(()=>import("./image-f2423b40.js"),[]).then(e=>e.default):a(()=>import("./index-c028d29b.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?a(()=>import("./image-32ebcc66.js"),[]).then(e=>e.default):a(()=>import("./index-af717c2b.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?a(()=>import("./image-4c8aaa01.js"),[]).then(e=>e.default):a(()=>import("./index-bed9c938.js"),[]).then(e=>e.wallet);case"net.spatium":return t?a(()=>import("./image-53d9b4d6.js"),[]).then(e=>e.default):a(()=>import("./index-dc65cc91.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?a(()=>import("./image-7610f22b.js"),[]).then(e=>e.default):a(()=>import("./index-5681a391.js"),[]).then(e=>e.wallet);case"money.snowball":return t?a(()=>import("./image-51cdc0b8.js"),[]).then(e=>e.default):a(()=>import("./index-286c3409.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?a(()=>import("./image-4572a02e.js"),[]).then(e=>e.default):a(()=>import("./index-277d68f5.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?a(()=>import("./image-0c4cf48f.js"),[]).then(e=>e.default):a(()=>import("./index-558cd5cf.js"),[]).then(e=>e.wallet);case"pro.assure":return t?a(()=>import("./image-94dd1aa5.js"),[]).then(e=>e.default):a(()=>import("./index-d0de1ddc.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?a(()=>import("./image-cfeb7e4e.js"),[]).then(e=>e.default):a(()=>import("./index-b2e813da.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?a(()=>import("./image-0a4521df.js"),[]).then(e=>e.default):a(()=>import("./index-0c76bee3.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?a(()=>import("./image-21ff7259.js"),[]).then(e=>e.default):a(()=>import("./index-c0d3ed54.js"),[]).then(e=>e.wallet);case"io.xfun":return t?a(()=>import("./image-ab7eab0a.js"),[]).then(e=>e.default):a(()=>import("./index-bbac21b8.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?a(()=>import("./image-ad46e56a.js"),[]).then(e=>e.default):a(()=>import("./index-ba8d3b21.js"),[]).then(e=>e.wallet);case"com.itoken":return t?a(()=>import("./image-38730ac8.js"),[]).then(e=>e.default):a(()=>import("./index-3844f5e2.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?a(()=>import("./image-4e049c8f.js"),[]).then(e=>e.default):a(()=>import("./index-65e99912.js"),[]).then(e=>e.wallet);case"io.slavi":return t?a(()=>import("./image-89fffba6.js"),[]).then(e=>e.default):a(()=>import("./index-f140332a.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?a(()=>import("./image-f880eb1c.js"),[]).then(e=>e.default):a(()=>import("./index-005427c8.js"),[]).then(e=>e.wallet);case"com.dexari":return t?a(()=>import("./image-519a9542.js"),[]).then(e=>e.default):a(()=>import("./index-d5a2ce40.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?a(()=>import("./image-4a63038d.js"),[]).then(e=>e.default):a(()=>import("./index-1cd46658.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?a(()=>import("./image-be5a42a0.js"),[]).then(e=>e.default):a(()=>import("./index-7a297ae4.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?a(()=>import("./image-07ca05d0.js"),[]).then(e=>e.default):a(()=>import("./index-42240733.js"),[]).then(e=>e.wallet);case"org.onyx":return t?a(()=>import("./image-b4cb2cc3.js"),[]).then(e=>e.default):a(()=>import("./index-027feb57.js"),[]).then(e=>e.wallet);case"io.gk8":return t?a(()=>import("./image-054057a2.js"),[]).then(e=>e.default):a(()=>import("./index-55b6bc8c.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?a(()=>import("./image-34fce3b0.js"),[]).then(e=>e.default):a(()=>import("./index-fe9bd966.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?a(()=>import("./image-e8189a4a.js"),[]).then(e=>e.default):a(()=>import("./index-10f9a038.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?a(()=>import("./image-da3f70fc.js"),[]).then(e=>e.default):a(()=>import("./index-26a17756.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?a(()=>import("./image-af1396ec.js"),[]).then(e=>e.default):a(()=>import("./index-ab088860.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?a(()=>import("./image-09fe28d8.js"),[]).then(e=>e.default):a(()=>import("./index-498ee9a1.js"),[]).then(e=>e.wallet);case"at.swe":return t?a(()=>import("./image-f68002f8.js"),[]).then(e=>e.default):a(()=>import("./index-af8f7243.js"),[]).then(e=>e.wallet);case"network.wali":return t?a(()=>import("./image-f6995948.js"),[]).then(e=>e.default):a(()=>import("./index-48968481.js"),[]).then(e=>e.wallet);case"io.diamante":return t?a(()=>import("./image-aad82900.js"),[]).then(e=>e.default):a(()=>import("./index-3a282395.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?a(()=>import("./image-54d08cd3.js"),[]).then(e=>e.default):a(()=>import("./index-72a4ec05.js"),[]).then(e=>e.wallet);case"com.walllet":return t?a(()=>import("./image-07ffd14e.js"),[]).then(e=>e.default):a(()=>import("./index-fa662dbc.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?a(()=>import("./image-549f154d.js"),[]).then(e=>e.default):a(()=>import("./index-0ac97795.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?a(()=>import("./image-f6e0eef2.js"),[]).then(e=>e.default):a(()=>import("./index-73d05cfb.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?a(()=>import("./image-378209de.js"),[]).then(e=>e.default):a(()=>import("./index-f2301b5e.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?a(()=>import("./image-7024a0aa.js"),[]).then(e=>e.default):a(()=>import("./index-913da051.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?a(()=>import("./image-dbe3e155.js"),[]).then(e=>e.default):a(()=>import("./index-76d3522d.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?a(()=>import("./image-c0f49cdf.js"),[]).then(e=>e.default):a(()=>import("./index-1dd3cb0b.js"),[]).then(e=>e.wallet);case"io.walletv":return t?a(()=>import("./image-77ce3739.js"),[]).then(e=>e.default):a(()=>import("./index-ef07f313.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?a(()=>import("./image-bef4b947.js"),[]).then(e=>e.default):a(()=>import("./index-eb746007.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?a(()=>import("./image-526cc4a1.js"),[]).then(e=>e.default):a(()=>import("./index-205a3c69.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?a(()=>import("./image-244faf0e.js"),[]).then(e=>e.default):a(()=>import("./index-6d344c5d.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?a(()=>import("./image-5521933f.js"),[]).then(e=>e.default):a(()=>import("./index-e8664fcd.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?a(()=>import("./image-8210efca.js"),[]).then(e=>e.default):a(()=>import("./index-e2b65972.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?a(()=>import("./image-b6ed1ee2.js"),[]).then(e=>e.default):a(()=>import("./index-6bf1a16b.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?a(()=>import("./image-a73c068e.js"),[]).then(e=>e.default):a(()=>import("./index-eedb584a.js"),[]).then(e=>e.wallet);case"com.berasig":return t?a(()=>import("./image-378a9616.js"),[]).then(e=>e.default):a(()=>import("./index-11922a2c.js"),[]).then(e=>e.wallet);case"app.phantom":return t?a(()=>import("./image-6f26420d.js"),[]).then(e=>e.default):a(()=>import("./index-ea857e82.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?a(()=>import("./image-7c1dbca6.js"),[]).then(e=>e.default):a(()=>import("./index-cab8281e.js"),[]).then(e=>e.wallet);case"io.rabby":return t?a(()=>import("./image-89800dda.js"),[]).then(e=>e.default):a(()=>import("./index-e8e17a5d.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?a(()=>import("./image-27f7cb7b.js"),[]).then(e=>e.default):a(()=>import("./index-4c224abc.js"),[]).then(e=>e.wallet);case"fi.nu":return t?a(()=>import("./image-e03c645a.js"),[]).then(e=>e.default):a(()=>import("./index-fbcf3404.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?a(()=>import("./image-08cc368c.js"),[]).then(e=>e.default):a(()=>import("./index-19d74ba8.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?a(()=>import("./image-d08dd692.js"),[]).then(e=>e.default):a(()=>import("./index-ca907524.js"),[]).then(e=>e.wallet);case"tech.levain":return t?a(()=>import("./image-c8a607fb.js"),[]).then(e=>e.default):a(()=>import("./index-e7434ba2.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?a(()=>import("./image-4d28f2ad.js"),[]).then(e=>e.default):a(()=>import("./index-1c4ca0fc.js"),[]).then(e=>e.wallet);case"com.scramble":return t?a(()=>import("./image-01f4b143.js"),[]).then(e=>e.default):a(()=>import("./index-ed2d52c4.js"),[]).then(e=>e.wallet);case"io.finoa":return t?a(()=>import("./image-1408b3f0.js"),[]).then(e=>e.default):a(()=>import("./index-65d034fb.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?a(()=>import("./image-23c0dda4.js"),[]).then(e=>e.default):a(()=>import("./index-2255e91f.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?a(()=>import("./image-4ef9878d.js"),[]).then(e=>e.default):a(()=>import("./index-d076bc9c.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?a(()=>import("./image-a4bedfda.js"),[]).then(e=>e.default):a(()=>import("./index-39b1d425.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?a(()=>import("./image-b514423b.js"),[]).then(e=>e.default):a(()=>import("./index-3212011a.js"),[]).then(e=>e.wallet);case"app.berasig":return t?a(()=>import("./image-b8d53dbe.js"),[]).then(e=>e.default):a(()=>import("./index-c36a14b9.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?a(()=>import("./image-722f31e0.js"),[]).then(e=>e.default):a(()=>import("./index-1cf9a06a.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?a(()=>import("./image-d7bec2d7.js"),[]).then(e=>e.default):a(()=>import("./index-9bc74987.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?a(()=>import("./image-760da8a1.js"),[]).then(e=>e.default):a(()=>import("./index-bbd932c2.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?a(()=>import("./image-94c11ec5.js"),[]).then(e=>e.default):a(()=>import("./index-a0d8d357.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?a(()=>import("./image-73e461de.js"),[]).then(e=>e.default):a(()=>import("./index-8211384c.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?a(()=>import("./image-eee9ac42.js"),[]).then(e=>e.default):a(()=>import("./index-257af798.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?a(()=>import("./image-dc660df2.js"),[]).then(e=>e.default):a(()=>import("./index-362768b6.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?a(()=>import("./image-3049bab2.js"),[]).then(e=>e.default):a(()=>import("./index-6d87bae0.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?a(()=>import("./image-73015782.js"),[]).then(e=>e.default):a(()=>import("./index-076e41da.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?a(()=>import("./image-9be37efd.js"),[]).then(e=>e.default):a(()=>import("./index-db23cef0.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?a(()=>import("./image-def3c39a.js"),[]).then(e=>e.default):a(()=>import("./index-c4005ff6.js"),[]).then(e=>e.wallet);case"sh.frame":return t?a(()=>import("./image-81866b7a.js"),[]).then(e=>e.default):a(()=>import("./index-25b5d815.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?a(()=>import("./image-9748e3ec.js"),[]).then(e=>e.default):a(()=>import("./index-a19a1ed6.js"),[]).then(e=>e.wallet);case"org.base.account":return t?a(()=>import("./image-e65d639b.js"),[]).then(e=>e.default):a(()=>import("./index-39dc297d.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${i} not found`)}}function rd(i){const{createOptions:t}=i,e=bi();let r,n;function s(){r=void 0,n=void 0}let o=async()=>{},c=async u=>{n=u};const l=e.subscribe("chainChanged",u=>{n=u}),h=e.subscribe("disconnect",()=>{s(),l(),h()});return e.subscribe("accountChanged",u=>{r=u}),{autoConnect:async u=>{const{autoConnectBaseAccountSDK:d}=await a(()=>Promise.resolve().then(()=>yo),void 0),_=await i.providerFactory(),[p,f,w,g]=await d(u,e,_);return r=p,n=f,o=w,c=g,Ye({chainId:n.id,client:u.client,walletAddress:r.address,walletType:At}),r},connect:async u=>{const{connectBaseAccountSDK:d}=await a(()=>Promise.resolve().then(()=>yo),void 0),_=await i.providerFactory(),[p,f,w,g]=await d(u,e,_);return r=p,n=f,o=w,c=g,Ye({chainId:n.id,client:u.client,walletAddress:r.address,walletType:At}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(n)return n=Ii(n.id)||n,n},getConfig:()=>t,id:At,subscribe:e.subscribe,switchChain:async u=>{await c(u)}}}function Br(){if(!Pc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:i,hostname:t,port:e}=window.location;let r=`${i}//${t}`;e&&e!=="80"&&e!=="443"&&(r+=`:${e}`);const n=`${r}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:n,name:window.document.title||"thirdweb powered dApp",url:r}}let dn,Er;async function Lc(i){var s,o,c,l,h,u,d;if(dn){if(i&&Er){const _=((s=Er.chains)==null?void 0:s.map(g=>g.id))||[],p=((o=i.chains)==null?void 0:o.map(g=>g.id))||[],f=_.length===p.length&&_.every((g,I)=>g===p[I]),w=((c=i.appMetadata)==null?void 0:c.name)===((l=Er.appMetadata)==null?void 0:l.name);(!f||!w)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return dn}const{createBaseAccountSDK:t}=await a(()=>import("./index-a22875e4.js"),["assets/index-a22875e4.js","assets/jsxRuntime.module-5184af76.js","assets/hooks.module-dd6ad649.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/index-00639714.js","assets/parseSignature-6b0b4698.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/to-serializable-transaction-9e540f8c.js","assets/transaction-ea614a5a.js","assets/transactionReceipt-1e425ab1.js","assets/rpc-83ca4b71.js","assets/sha256-937f482f.js","assets/hashTypedData-cc1589a7.js","assets/get-bytecode-7a8c6215.js","assets/index-accd8060.js","assets/signing-6d6682ec.js","assets/hashBytecode-7a0e56f5.js"]),e=Br(),n=t({appName:((h=i==null?void 0:i.appMetadata)==null?void 0:h.name)||e.name||"thirdweb powered dApp",appLogoUrl:((u=i==null?void 0:i.appMetadata)==null?void 0:u.logoUrl)||e.logoUrl||null,appChainIds:((d=i==null?void 0:i.chains)==null?void 0:d.map(_=>_.id))||[]}).getProvider();return dn=n,Er=i,n}function Vc(i){return i.id===At}function Eo({provider:i,address:t,client:e}){const r={address:te(t),async sendTransaction(n){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:te(t),gas:n.gas?Oe(n.gas):void 0,to:n.to,value:n.value?Oe(n.value):void 0}]});return Rs({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:te(t),walletType:At}),{transactionHash:s}},async signMessage({message:n}){if(!r.address)throw new Error("Provider not setup");const s=(()=>typeof n=="string"?Is(n):n.raw instanceof Uint8Array?As(n.raw):n.raw)(),o=await i.request({method:"personal_sign",params:[s,r.address]});if(!kr(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ds(n),l={EIP712Domain:hc(s),...n.types};dc({domain:s,message:o,primaryType:c,types:l});const h=_c({domain:s??{},message:o,primaryType:c,types:l}),u=await i.request({method:"eth_signTypedData_v4",params:[r.address,h]});if(!kr(u))throw new Error("Invalid signed payload returned");return u},sendCalls:async n=>{try{const{callParams:s,chain:o}=await Cs(n,r),c=await i.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${At} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:st(s)}`):s}},async getCallsStatus(n){try{const s=await i.request({method:"wallet_getCallsStatus",params:[n.id]});return xs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${At} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(n){const s=n.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[te(r.address)]});return Ss(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${At} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return r}function xc(i,t,e,r,n){const s=Eo({address:i,client:n,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",h),e.off("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(u){if(u[0]){const d=Eo({address:te(u[0]),client:n,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",u)}else c()}function h(u){const d=Ue(at(u));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",h),e.on("disconnect",c),[s,t,c,u=>Sc(e,u)]}async function nd(i,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const n=te(r[0]),s=await e.request({method:"eth_chainId"}),o=at(s);let c=i.chain&&i.chain.id===o?i.chain:Ue(o);return o&&(i!=null&&i.chain)&&o!==(i==null?void 0:i.chain.id)&&(await Sc(e,i.chain),c=i.chain),xc(n,c,e,t,i.client)}async function sd(i,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=at(s),c=i.chain&&i.chain.id===o?i.chain:Ue(o);return xc(n,c,e,t,i.client)}async function Sc(i,t){var s;const e=await i.request({method:"eth_chainId"}),r=Ue(at(e));if((r==null?void 0:r.id)===t.id)return;const n=Oe(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await Os(t);(o==null?void 0:o.code)===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:$s(c)}]})}}const yo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:sd,connectBaseAccountSDK:nd,getBaseAccountWebProvider:Lc,isBaseAccountSDKWallet:Vc},Symbol.toStringTag,{value:"Module"}));function od(i){const{createOptions:t}=i,e=bi();let r,n;function s(){r=void 0,n=void 0}let o=async()=>{},c=async u=>{n=u};const l=e.subscribe("chainChanged",u=>{n=u}),h=e.subscribe("disconnect",()=>{s(),l(),h()});return e.subscribe("accountChanged",u=>{r=u}),{autoConnect:async u=>{const{autoConnectCoinbaseWalletSDK:d}=await a(()=>Promise.resolve().then(()=>bo),void 0),_=await i.providerFactory(),[p,f,w,g]=await d(u,e,_);return r=p,n=f,o=w,c=g,Ye({chainId:n.id,client:u.client,walletAddress:r.address,walletType:nt}),r},connect:async u=>{const{connectCoinbaseWalletSDK:d}=await a(()=>Promise.resolve().then(()=>bo),void 0),_=await i.providerFactory(),[p,f,w,g]=await d(u,e,_);return r=p,n=f,o=w,c=g,Ye({chainId:n.id,client:u.client,walletAddress:r.address,walletType:nt}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(n)return n=Ii(n.id)||n,n},getConfig:()=>t,id:nt,onConnectRequested:async()=>{var u;if(i.onConnectRequested){const d=await i.providerFactory();return(u=i.onConnectRequested)==null?void 0:u.call(i,d)}},subscribe:e.subscribe,switchChain:async u=>{await c(u)}}}async function Cc(i){var t,e;await((e=(t=i==null?void 0:i.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const ad=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:Cc},Symbol.toStringTag,{value:"Module"}));let _n;async function $c(i){var t,e;if(!_n){let r=(await a(()=>import("./index-c49dee70.js"),["assets/index-c49dee70.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/signing-6d6682ec.js","assets/to-serializable-transaction-9e540f8c.js","assets/transaction-ea614a5a.js","assets/get-bytecode-7a8c6215.js","assets/hooks.module-dd6ad649.js","assets/index-00639714.js"])).default;typeof r!="function"&&typeof r.default=="function"&&(r=r.default);const s=new r({appChainIds:i!=null&&i.chains?i.chains.map(o=>o.id):void 0,appLogoUrl:((t=i==null?void 0:i.appMetadata)==null?void 0:t.logoUrl)||Br().logoUrl,appName:((e=i==null?void 0:i.appMetadata)==null?void 0:e.name)||Br().name}).makeWeb3Provider(i==null?void 0:i.walletConfig);return _n=s,s}return _n}function cd(i){return i.id===nt}function vo({provider:i,address:t,client:e}){const r={address:te(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await Cc(i)},async sendTransaction(n){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:te(t),gas:n.gas?Oe(n.gas):void 0,to:n.to,value:n.value?Oe(n.value):void 0}]});return Rs({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:te(t),walletType:nt}),{transactionHash:s}},async signMessage({message:n}){if(!r.address)throw new Error("Provider not setup");const s=(()=>typeof n=="string"?Is(n):n.raw instanceof Uint8Array?As(n.raw):n.raw)(),o=await i.request({method:"personal_sign",params:[s,r.address]});if(!kr(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ds(n),l={EIP712Domain:hc(s),...n.types};dc({domain:s,message:o,primaryType:c,types:l});const h=_c({domain:s??{},message:o,primaryType:c,types:l}),u=await i.request({method:"eth_signTypedData_v4",params:[r.address,h]});if(!kr(u))throw new Error("Invalid signed payload returned");return u},sendCalls:async n=>{try{const{callParams:s,chain:o}=await Cs(n,r),c=await i.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${nt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:st(s)}`):s}},async getCallsStatus(n){try{const s=await i.request({method:"wallet_getCallsStatus",params:[n.id]});return xs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${nt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(n){try{return await i.request({method:"wallet_getCallsStatus",params:[n.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${nt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(n){const s=n.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[te(r.address)]});return Ss(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${nt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return r}function kc(i,t,e,r,n){const s=vo({address:i,client:n,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",h),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),r.emit("disconnect",void 0)}function l(u){if(u[0]){const d=vo({address:te(u[0]),client:n,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",u)}else c()}function h(u){const d=Ue(at(u));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",h),e.on("disconnect",c),[s,t,c,u=>Nc(e,u)]}async function ld(i,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const n=te(r[0]),s=await e.request({method:"eth_chainId"}),o=at(s);let c=i.chain&&i.chain.id===o?i.chain:Ue(o);return o&&(i!=null&&i.chain)&&o!==(i==null?void 0:i.chain.id)&&(await Nc(e,i.chain),c=i.chain),kc(n,c,e,t,i.client)}async function ud(i,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=at(s),c=i.chain&&i.chain.id===o?i.chain:Ue(o);return kc(n,c,e,t,i.client)}async function Nc(i,t){var s;const e=await i.request({method:"eth_chainId"}),r=Ue(at(e));if((r==null?void 0:r.id)===t.id)return;const n=Oe(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await Os(t);(o==null?void 0:o.code)===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:$s(c)}]})}}const bo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:ud,connectCoinbaseWalletSDK:ld,getCoinbaseWebProvider:$c,isCoinbaseSDKWallet:cd},Symbol.toStringTag,{value:"Module"}));function Uc(...i){const[t,e]=i,r={id:t,partnerId:e==null?void 0:e.partnerId};return Qu({connectorFactory:async n=>{const{InAppWebConnector:s}=await a(()=>import("./web-connector-351693f5.js"),["assets/web-connector-351693f5.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/utils-dddc86ba.js","assets/execute-264a98ed.js","assets/prepare-contract-call-4be4cc68.js","assets/types-ba990c1e.js","assets/redirect-state-301cb22c.js","assets/transaction-ea614a5a.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/sleep-9eff569f.js"]);return new s({client:n,ecosystem:r,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:r.partnerId},ecosystem:r})}function Ns(i){const t=bi();let e,r,n,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(()=>import("./index-9d37fa54.js"),["assets/index-9d37fa54.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/transaction-ea614a5a.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/to-serializable-transaction-9e540f8c.js","assets/execute-264a98ed.js","assets/signing-6d6682ec.js","assets/get-bytecode-7a8c6215.js","assets/send-eip712-transaction-20a9b9ed.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/hashBytecode-7a0e56f5.js","assets/sha256-937f482f.js","assets/send-transaction-c3053b90.js","assets/redirect-state-301cb22c.js","assets/index-93724bad.js","assets/ethereum-0d579241.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-cc1589a7.js","assets/index-b3889ac8.js","assets/index-accd8060.js","assets/index-2cab452e.js","assets/index-6ab757a5.js","assets/index-877ffe4a.js"]),[l,h]=await c(o,i);return s=o,e=l,n=h,Ye({chainId:n.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(()=>import("./index-9d37fa54.js"),["assets/index-9d37fa54.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/transaction-ea614a5a.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/to-serializable-transaction-9e540f8c.js","assets/execute-264a98ed.js","assets/signing-6d6682ec.js","assets/get-bytecode-7a8c6215.js","assets/send-eip712-transaction-20a9b9ed.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/hashBytecode-7a0e56f5.js","assets/sha256-937f482f.js","assets/send-transaction-c3053b90.js","assets/redirect-state-301cb22c.js","assets/index-93724bad.js","assets/ethereum-0d579241.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-cc1589a7.js","assets/index-b3889ac8.js","assets/index-accd8060.js","assets/index-2cab452e.js","assets/index-6ab757a5.js","assets/index-877ffe4a.js"]),[l,h]=await c(o,i);return r=o.personalAccount,s=o,e=l,n=h,Ye({chainId:n.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await a(()=>import("./index-9d37fa54.js"),["assets/index-9d37fa54.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/transaction-ea614a5a.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/to-serializable-transaction-9e540f8c.js","assets/execute-264a98ed.js","assets/signing-6d6682ec.js","assets/get-bytecode-7a8c6215.js","assets/send-eip712-transaction-20a9b9ed.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/hashBytecode-7a0e56f5.js","assets/sha256-937f482f.js","assets/send-transaction-c3053b90.js","assets/redirect-state-301cb22c.js","assets/index-93724bad.js","assets/ethereum-0d579241.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-cc1589a7.js","assets/index-b3889ac8.js","assets/index-accd8060.js","assets/index-2cab452e.js","assets/index-6ab757a5.js","assets/index-877ffe4a.js"]);await o(e)}e=void 0,r=void 0,n=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>r,getChain(){if(n)return n=Ii(n.id)||n,n},getConfig:()=>i,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var d;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await gh(o)){const _=yc({address:i.factoryAddress||bh((d=i.overrides)==null?void 0:d.entrypointAddress),chain:o,client:s.client});if(!await Uu(_))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(()=>import("./index-9d37fa54.js"),["assets/index-9d37fa54.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/transaction-ea614a5a.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/to-serializable-transaction-9e540f8c.js","assets/execute-264a98ed.js","assets/signing-6d6682ec.js","assets/get-bytecode-7a8c6215.js","assets/send-eip712-transaction-20a9b9ed.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/hashBytecode-7a0e56f5.js","assets/sha256-937f482f.js","assets/send-transaction-c3053b90.js","assets/redirect-state-301cb22c.js","assets/index-93724bad.js","assets/ethereum-0d579241.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-cc1589a7.js","assets/index-b3889ac8.js","assets/index-accd8060.js","assets/index-2cab452e.js","assets/index-6ab757a5.js","assets/index-877ffe4a.js"]),[h,u]=await l({...s,chain:o},{...i,chain:o});e=h,n=u,t.emit("accountChanged",h),t.emit("chainChanged",u)}}}function rt(...i){const[t,e]=i;switch(!0){case t==="smart":return Ns(e);case(t==="embedded"||t==="inApp"):return Nn(e);case Ti(t):return Uc(...i);case t===nt:{const r=e;return od({createOptions:r,onConnectRequested:async n=>{const{showCoinbasePopup:s}=await a(()=>Promise.resolve().then(()=>ad),void 0);return s(n)},providerFactory:()=>$c(r)})}case t===At:{const r=e;return rd({createOptions:r,providerFactory:()=>Lc(r)})}default:{let c=function(){n=void 0,s=void 0};const r=bi();let n,s,o,l=async()=>{};const h=r.subscribe("disconnect",()=>{c(),o==null||o(),h()});r.subscribe("accountChanged",p=>{n=p});let u=async()=>{throw new Error("Not implemented yet")};const d=mo()?p=>hn(p):void 0,_={autoConnect:async p=>{const{injectedProvider:f}=await a(()=>Promise.resolve().then(()=>Ao),void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:w}=await a(()=>Promise.resolve().then(()=>To),void 0),[g,I,T,y]=await w({chain:p.chain,client:p.client,emitter:r,id:t,provider:Fn(t)});return n=g,s=I,l=T,u=y,o=r.subscribe("chainChanged",v=>{s=v}),Ye({chainId:s.id,client:p.client,walletAddress:n.address,walletType:t}),n}if(p&&"client"in p){const{autoConnectWC:w}=await a(()=>import("./controller-5a843a75.js"),["assets/controller-5a843a75.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/transaction-ea614a5a.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/redirect-state-301cb22c.js","assets/execute-264a98ed.js","assets/rpc-83ca4b71.js","assets/to-serializable-transaction-9e540f8c.js","assets/hashTypedData-cc1589a7.js","assets/signing-6d6682ec.js","assets/get-bytecode-7a8c6215.js","assets/index-93724bad.js","assets/ethereum-0d579241.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/send-transaction-c3053b90.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-b3889ac8.js","assets/index-accd8060.js","assets/index-2cab452e.js","assets/index-6ab757a5.js","assets/index-877ffe4a.js"]),[g,I,T,y]=await w(p,r,_.id,Nr,d);return n=g,s=I,l=T,u=y,Ye({chainId:s.id,client:p.client,walletAddress:n.address,walletType:t}),n}throw new Error("Failed to auto connect")},connect:async p=>{async function f(I){var v;const{connectWC:T}=await a(()=>import("./controller-5a843a75.js"),["assets/controller-5a843a75.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/transaction-ea614a5a.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/redirect-state-301cb22c.js","assets/execute-264a98ed.js","assets/rpc-83ca4b71.js","assets/to-serializable-transaction-9e540f8c.js","assets/hashTypedData-cc1589a7.js","assets/signing-6d6682ec.js","assets/get-bytecode-7a8c6215.js","assets/index-93724bad.js","assets/ethereum-0d579241.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/send-transaction-c3053b90.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-b3889ac8.js","assets/index-accd8060.js","assets/index-2cab452e.js","assets/index-6ab757a5.js","assets/index-877ffe4a.js"]);let y;try{const[b,D,N,S]=await T({...I,walletConnect:{...I.walletConnect,onDisplayUri:((v=I.walletConnect)==null?void 0:v.onDisplayUri)||(async m=>{var P,E;if(typeof window<"u"&&typeof document<"u")if(mo()){const A=await Dc(t),O=A.mobile.native||A.mobile.universal;hn(O?Qh(O,m).redirect:m);return}else try{const{createQROverlay:A}=await a(()=>import("./qr-overlay-fd67e1ca.js"),["assets/qr-overlay-fd67e1ca.js","assets/index-10c73e9d.js","assets/index-59db4a58.css"]);y&&y.destroy(),y=A(m,{theme:((E=(P=I.walletConnect)==null?void 0:P.qrModalOptions)==null?void 0:E.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var O,V;(V=(O=I.walletConnect)==null?void 0:O.onCancel)==null||V.call(O)}})}catch(A){console.error("Failed to create QR overlay:",A)}})}},r,_.id,Nr,d);return y&&(y.destroy(),y=void 0),n=b,s=D,l=N,u=S,Ye({chainId:s.id,client:I.client,walletAddress:n.address,walletType:t}),n}catch(b){throw y&&(y.destroy(),y=void 0),b}}if(t==="walletConnect"){const{client:I,chain:T,...y}=p;return f({chain:T,client:I,walletConnect:{...y}})}const w=p&&"walletConnect"in p,{injectedProvider:g}=await a(()=>Promise.resolve().then(()=>Ao),void 0);if(g(t)&&!w){const{connectEip1193Wallet:I}=await a(()=>Promise.resolve().then(()=>To),void 0),[T,y,v,b]=await I({chain:p.chain,client:p.client,emitter:r,id:t,provider:Fn(t)});return n=T,s=y,l=v,u=b,o=r.subscribe("chainChanged",D=>{s=D}),Ye({chainId:s.id,client:p.client,walletAddress:n.address,walletType:t}),n}if(p&&"client"in p)return f(p);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>n,getChain(){if(s)return s=Ii(s.id)||s,s},getConfig:()=>i[1],id:t,subscribe:r.subscribe,switchChain:async p=>{try{await u(p),s=p}catch(f){console.error("Error switching chain",f)}}};return _}}}function hd(){return rt("walletConnect")}const Io=(()=>Pc()?Ah():void 0)();function Us(i){const t=Bs().find(e=>e.info.rdns===i);return t==null?void 0:t.provider}function Bc(){return Bs().map(e=>e.info.rdns).map(e=>rt(e))}function dd(){if(Io)return Io}function Bs(){var t;const i=((t=dd())==null?void 0:t.getProviders())||[];for(const e of i)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=Tc;break}return i}const Ao=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Bs,getInstalledWallets:Bc,injectedProvider:Us},Symbol.toStringTag,{value:"Module"}));function Fn(i){const t=Us(i);if(!t)throw new Error(`No injected provider found for wallet: "${i}"`);return t}async function Fc({id:i,provider:t,emitter:e,client:r,chain:n}){var _,p;let s,c=0;for(;!(s!=null&&s[0])&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(f){if(console.error(f),(p=(_=_d(f))==null?void 0:_.toLowerCase())!=null&&p.includes("rejected"))throw f;await new Promise(w=>setTimeout(w,500))}c++}const l=s==null?void 0:s[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const h=te(l),u=await t.request({method:"eth_chainId"}).then(at).catch(f=>{throw new Error("Error reading chainId from provider",f)});let d=n&&n.id===u?n:Ue(u);try{n&&typeof n.id<"u"&&n.id!==u&&(await zc(t,n),d=n)}catch{console.warn(`Error switching to chain ${n==null?void 0:n.id} - defaulting to wallet chain (${u})`)}return Mc({address:h,chain:d,client:r,emitter:e,id:i,provider:t})}async function qc({id:i,provider:t,emitter:e,client:r,chain:n}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=te(o),l=await t.request({method:"eth_chainId"}).then(at),h=n&&n.id===l?n:Ue(l);return Mc({address:c,chain:h,client:r,emitter:e,id:i,provider:t})}function Po({provider:i,address:t,client:e,id:r}){const n={address:te(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:Oe(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?Oe(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?Oe(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?Oe(s.gas):void 0,nonce:s.nonce?Oe(s.nonce):void 0,to:s.to?te(s.to):void 0,data:s.data,value:s.value?Oe(s.value):void 0,authorizationList:s.authorizationList?Bu(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await i.request({method:"eth_sendTransaction",params:c});return Rs({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:te(t),walletType:r}),{transactionHash:l}}catch(l){throw dh(l)&&_h({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:te(t)}),l}},async signMessage({message:s}){if(!n.address)throw new Error("Provider not setup");const o=(()=>typeof s=="string"?Is(s):s.raw instanceof Uint8Array?As(s.raw):s.raw)();return await i.request({method:"personal_sign",params:[o,te(n.address)]})},async signAuthorization(s){const o=pc(s);let c;try{c=await i.request({method:"eth_sign",params:[te(n.address),o]})}catch{c=await i.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=Fu(c);return{...s,...l}},async signTypedData(s){if(!i||!n.address)throw new Error("Provider not setup");const o=Ds(s),{domain:c,message:l,primaryType:h}=o,u={EIP712Domain:Ph({domain:c}),...o.types};Th({domain:c,message:l,primaryType:h,types:u});const d=Oh({domain:c??{},message:l,primaryType:h,types:u});return await i.request({method:"eth_signTypedData_v4",params:[te(n.address),d]})},async watchAsset(s){return await i.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Cs(s,n),l=await i.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:c,client:e,id:l.id}:{chain:c,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:mh(o)}`):o}},async getCallsStatus(s){try{const o=await i.request({method:"wallet_getCallsStatus",params:[s.id]});return xs(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await i.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const c=await i.request({method:"wallet_getCapabilities",params:[te(n.address),o?[Oe(o)]:void 0]});return Ss(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${r} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return n}async function Mc({provider:i,address:t,chain:e,emitter:r,client:n,id:s}){const o=Po({address:t,client:n,id:s,provider:i});async function c(){i.removeListener("accountsChanged",h),i.removeListener("chainChanged",u),i.removeListener("disconnect",l);try{await Rh(()=>i.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(d){(d==null?void 0:d.code)!==1013&&(c(),r.emit("disconnect",d??void 0))}function h(d){if(d[0]){const _=Po({address:te(d[0]),client:n,id:s,provider:i});r.emit("accountChanged",_),r.emit("accountsChanged",d)}else l()}function u(d){const _=Ue(at(d));r.emit("chainChanged",_)}return i.on&&(i.on("accountsChanged",h),i.on("chainChanged",u),i.on("disconnect",l)),[o,e,l,d=>zc(i,d)]}async function zc(i,t){var r;const e=Oe(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const n=await Os(t);await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(r=n.explorers)==null?void 0:r.map(s=>s.url),chainId:e,chainName:n.name,nativeCurrency:n.nativeCurrency,rpcUrls:$s(n)}]})}}function _d(i){return i instanceof Error?i.message:typeof i=="string"?i:typeof i=="object"&&i!==null?JSON.stringify(i):String(i)}const To=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:qc,connectEip1193Wallet:Fc,getInjectedProvider:Fn},Symbol.toStringTag,{value:"Module"}));function pd(i){const t=i.walletId??"adapter",e=bi();let r,n,s;const o=async _=>(s=typeof i.provider=="function"?await i.provider(_):i.provider,s),c=e.subscribe("chainChanged",_=>{n=_});function l(){r=void 0,n=void 0}let h=async()=>{};const u=e.subscribe("disconnect",()=>{l(),c(),u()});e.subscribe("accountChanged",_=>{r=_});let d=async _=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:Yu(_.id)}]}))};return{autoConnect:async _=>{var I;const[p,f,w,g]=await qc({chain:_.chain,client:_.client,emitter:e,id:t,provider:await o({chainId:(I=_.chain)==null?void 0:I.id})});return r=p,n=f,h=w,d=g,e.emit("onConnect",_),Ye({client:_.client,walletAddress:r.address,walletType:t}),r},connect:async _=>{var I;const[p,f,w,g]=await Fc({chain:_.chain,client:_.client,emitter:e,id:t,provider:await o({chainId:(I=_.chain)==null?void 0:I.id})});return r=p,n=f,h=w,d=g,e.emit("onConnect",_),Ye({client:_.client,walletAddress:r.address,walletType:t}),r},disconnect:async()=>{l(),await h(),e.emit("disconnect",void 0)},getAccount:()=>r,getChain(){if(n)return n=Ii(n.id)||n,n},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async _=>{await d(_),e.emit("chainChanged",_)}}}function fd(i){const{chain:t,client:e,wallet:r,connectOverride:n}=i,s=Ps({chain:t,client:e}),o=new Map;return{on:(c,l)=>{const h=r.subscribe(c,l);let u=o.get(c);u||(u=new Map,o.set(c,u)),u.set(l,h)},removeListener:(c,l)=>{const h=o.get(c),u=h==null?void 0:h.get(l);u&&(u(),h==null||h.delete(l))},request:async c=>{switch(c.method){case"eth_sendTransaction":{const l=r.getAccount();if(!l)throw new Error("Account not connected");return(await bc({account:l,transaction:kn({...c.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const l=r.getAccount();if(!l)throw new Error("Account not connected");return Eh({account:l,transaction:kn({...c.params[0],chain:t,client:e})})}case"personal_sign":{const l=r.getAccount();if(!l)throw new Error("Account not connected");return l.signMessage({message:{raw:c.params[0]}})}case"eth_signTypedData_v4":{const l=r.getAccount();if(!l)throw new Error("Account not connected");const h=JSON.parse(c.params[1]);return l.signTypedData(h)}case"eth_accounts":{const l=r.getAccount();return l?[l.address]:[]}case"eth_requestAccounts":{const l=r.getAccount();if(l)return[l.address];const h=n?await n(r):await r.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!h)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[h.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const h=c.params[0].chainId;if(!h)throw new Error("Chain ID is required");const u=$n(h)?ii(h):h,d=Ue(u);return r.switchChain(d)}case"wallet_getCapabilities":{const l=r.getAccount();if(!l)throw new Error("Account not connected");if(!l.getCapabilities)throw new Error("Wallet does not support EIP-5792");const h=c.params[1];if(h&&Array.isArray(h)){const u=h[0],d=$n(u)?ii(u):Number(u);return l.getCapabilities(d?{chainId:d}:{})}return l.getCapabilities({})}case"wallet_sendCalls":{const l=r.getAccount();if(!l)throw new Error("Account not connected");if(!l.sendCalls)throw new Error("Wallet does not support EIP-5792");return l.sendCalls({...c.params[0],chain:t})}case"wallet_getCallsStatus":{const l=r.getAccount();if(!l)throw new Error("Account not connected");if(!l.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await l.getCallsStatusRaw({id:c.params[0],chain:t,client:e})}default:return s(c)}}}}const wd=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:pd,toProvider:fd},Symbol.toStringTag,{value:"Module"}));function gd(i){const t=bi();let e=i.chain;return{autoConnect:async()=>(t.emit("onConnect",i),i.adaptedAccount),connect:async()=>(t.emit("onConnect",i),i.adaptedAccount),disconnect:async()=>{await i.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return i.adaptedAccount},getChain(){return e=Ii(e.id)||e,e},getConfig(){return i},id:"adapter",subscribe:t.subscribe,switchChain:async r=>{await i.switchChain(r),e=r,t.emit("chainChanged",r)}}}async function md(){return(await a(()=>import("./wallet-infos-fd18fc6b.js"),[])).default}function Ed(i){if("privateKey"in i){const t=Kh(typeof i.message=="object"?i.message.raw:gc(i.message)),e=bs({payload:t,privateKey:i.privateKey});return fc(e)}if("account"in i){const{message:t,account:e}=i;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function yd(i){var s;const{privateKey:t,...e}=i;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=Zu(e.domain.chainId));const r=qu(e),n=bs({payload:r,privateKey:t});return fc(n)}function qn(i){const{client:t}=i,e=`0x${i.privateKey.replace(/^0x/,"")}`,r=mc(wc.getPublicKey(e.slice(2),!1)),n=Dh(r);return{address:te(n),sendTransaction:async o=>{const c=Ps({chain:Ue(o.chainId),client:t}),l=ho({privateKey:e,transaction:o});return{transactionHash:await Lh(c,l)}},signAuthorization:async o=>{const c=bs({payload:pc(o),privateKey:e});return Mu(o,{signature:c})},signMessage:async({message:o})=>Ed({message:o,privateKey:e}),signTransaction:async o=>ho({privateKey:e,transaction:o}),signTypedData:async o=>yd({...o,privateKey:e})}}async function vd(i){const t=mc(wc.utils.randomPrivateKey());return qn({client:i.client,privateKey:t})}async function bd(i){const{address:t,client:e,chain:r}=i,n=i.tokenAddress||(r.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(n&&te(n)!==te(_o)){const{getBalance:u}=await a(()=>import("./getBalance-e2e6d859.js"),["assets/getBalance-e2e6d859.js","assets/to-serializable-transaction-9e540f8c.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/transaction-ea614a5a.js","assets/signing-6d6682ec.js","assets/get-bytecode-7a8c6215.js","assets/decimals-bddbc743.js"]);return u({address:t,contract:yc({address:n,chain:r,client:e})})}const s=Ps({chain:r,client:e}),[o,c,l,h]=await Promise.all([ah(r),ch(r),lh(r),zu(s,{address:t})]);return{chainId:r.id,decimals:c,displayValue:yh(h,c),name:l,symbol:o,tokenAddress:n??_o,value:h}}const Oo=qh;var wi=pt;const ir=xd().console||{},Id={mapHttpRequest:yr,mapHttpResponse:yr,wrapRequestSerializer:pn,wrapResponseSerializer:pn,wrapErrorSerializer:pn,req:yr,res:yr,err:Rd};function Ad(i,t){return Array.isArray(i)?i.filter(function(r){return r!=="!stdSerializers.err"}):i===!0?Object.keys(t):!1}function pt(i){i=i||{},i.browser=i.browser||{};const t=i.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const e=i.browser.write||ir;i.browser.write&&(i.browser.asObject=!0);const r=i.serializers||{},n=Ad(i.browser.serialize,r);let s=i.browser.serialize;Array.isArray(i.browser.serialize)&&i.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof e=="function"&&(e.error=e.fatal=e.warn=e.info=e.debug=e.trace=e),i.enabled===!1&&(i.level="silent");const c=i.level||"info",l=Object.create(e);l.log||(l.log=rr),Object.defineProperty(l,"levelVal",{get:u}),Object.defineProperty(l,"level",{get:d,set:_});const h={transmit:t,serialize:n,asObject:i.browser.asObject,levels:o,timestamp:Dd(i)};l.levels=pt.levels,l.level=c,l.setMaxListeners=l.getMaxListeners=l.emit=l.addListener=l.on=l.prependListener=l.once=l.prependOnceListener=l.removeListener=l.removeAllListeners=l.listeners=l.listenerCount=l.eventNames=l.write=l.flush=rr,l.serializers=r,l._serialize=n,l._stdErrSerialize=s,l.child=p,t&&(l._logEvent=Mn());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function _(f){if(f!=="silent"&&!this.levels.values[f])throw Error("unknown level "+f);this._level=f,ci(h,l,"error","log"),ci(h,l,"fatal","error"),ci(h,l,"warn","error"),ci(h,l,"info","log"),ci(h,l,"debug","log"),ci(h,l,"trace","log")}function p(f,w){if(!f)throw new Error("missing bindings for child Pino");w=w||{},n&&f.serializers&&(w.serializers=f.serializers);const g=w.serializers;if(n&&g){var I=Object.assign({},r,g),T=i.browser.serialize===!0?Object.keys(I):n;delete f.serializers,Zr([f],T,I,this._stdErrSerialize)}function y(v){this._childLevel=(v._childLevel|0)+1,this.error=li(v,f,"error"),this.fatal=li(v,f,"fatal"),this.warn=li(v,f,"warn"),this.info=li(v,f,"info"),this.debug=li(v,f,"debug"),this.trace=li(v,f,"trace"),I&&(this.serializers=I,this._serialize=T),t&&(this._logEvent=Mn([].concat(v._logEvent.bindings,f)))}return y.prototype=this,new y(this)}return l}pt.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};pt.stdSerializers=Id;pt.stdTimeFunctions=Object.assign({},{nullTime:jc,epochTime:Kc,unixTime:Ld,isoTime:Vd});function ci(i,t,e,r){const n=Object.getPrototypeOf(t);t[e]=t.levelVal>t.levels.values[e]?rr:n[e]?n[e]:ir[e]||ir[r]||rr,Pd(i,t,e)}function Pd(i,t,e){!i.transmit&&t[e]===rr||(t[e]=function(r){return function(){const s=i.timestamp(),o=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===ir?ir:this;for(var l=0;l<o.length;l++)o[l]=arguments[l];if(i.serialize&&!i.asObject&&Zr(o,this._serialize,this.serializers,this._stdErrSerialize),i.asObject?r.call(c,Td(this,e,o,s)):r.apply(c,o),i.transmit){const h=i.transmit.level||t.level,u=pt.levels.values[h],d=pt.levels.values[e];if(d<u)return;Od(this,{ts:s,methodLevel:e,methodValue:d,transmitLevel:h,transmitValue:pt.levels.values[i.transmit.level||t.level],send:i.transmit.send,val:t.levelVal},o)}}}(t[e]))}function Td(i,t,e,r){i._serialize&&Zr(e,i._serialize,i.serializers,i._stdErrSerialize);const n=e.slice();let s=n[0];const o={};r&&(o.time=r),o.level=pt.levels.values[t];let c=(i._childLevel|0)+1;if(c<1&&(c=1),s!==null&&typeof s=="object"){for(;c--&&typeof n[0]=="object";)Object.assign(o,n.shift());s=n.length?Oo(n.shift(),n):void 0}else typeof s=="string"&&(s=Oo(n.shift(),n));return s!==void 0&&(o.msg=s),o}function Zr(i,t,e,r){for(const n in i)if(r&&i[n]instanceof Error)i[n]=pt.stdSerializers.err(i[n]);else if(typeof i[n]=="object"&&!Array.isArray(i[n]))for(const s in i[n])t&&t.indexOf(s)>-1&&s in e&&(i[n][s]=e[s](i[n][s]))}function li(i,t,e){return function(){const r=new Array(1+arguments.length);r[0]=t;for(var n=1;n<r.length;n++)r[n]=arguments[n-1];return i[e].apply(this,r)}}function Od(i,t,e){const r=t.send,n=t.ts,s=t.methodLevel,o=t.methodValue,c=t.val,l=i._logEvent.bindings;Zr(e,i._serialize||Object.keys(i.serializers),i.serializers,i._stdErrSerialize===void 0?!0:i._stdErrSerialize),i._logEvent.ts=n,i._logEvent.messages=e.filter(function(h){return l.indexOf(h)===-1}),i._logEvent.level.label=s,i._logEvent.level.value=o,r(s,i._logEvent,c),i._logEvent=Mn(l)}function Mn(i){return{ts:0,messages:[],bindings:i||[],level:{label:"",value:0}}}function Rd(i){const t={type:i.constructor.name,msg:i.message,stack:i.stack};for(const e in i)t[e]===void 0&&(t[e]=i[e]);return t}function Dd(i){return typeof i.timestamp=="function"?i.timestamp:i.timestamp===!1?jc:Kc}function yr(){return{}}function pn(i){return i}function rr(){}function jc(){return!1}function Kc(){return Date.now()}function Ld(){return Math.round(Date.now()/1e3)}function Vd(){return new Date(Date.now()).toISOString()}function xd(){function i(t){return typeof t<"u"&&t}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return i(self)||i(window)||i(this)||{}}}const Qr=vh(wi),Sd={level:"info"},_r="custom_context",Fs=1e3*1024;let Cd=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},Ro=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new Cd(t);if(e.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${e.size}`);for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let e=this.head;for(;e!==null;)t.push(e.value),e=e.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const e=t.value;return t=t.next,{done:!1,value:e}}}}};class Hc{constructor(t,e=Fs){this.level=t??"error",this.levelValue=wi.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new Ro(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===wi.levels.values.error?console.error(t):e===wi.levels.values.warn?console.warn(t):e===wi.levels.values.debug?console.debug(t):e===wi.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(Un({timestamp:new Date().toISOString(),log:t}));const e=typeof t=="string"?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}getLogs(){return this.logs}clearLogs(){this.logs=new Ro(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(Un({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let $d=class{constructor(t,e=Fs){this.baseChunkLogger=new Hc(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const e=URL.createObjectURL(this.logsToBlob(t)),r=document.createElement("a");r.href=e,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(e)}},kd=class{constructor(t,e=Fs){this.baseChunkLogger=new Hc(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var Nd=Object.defineProperty,Ud=Object.defineProperties,Bd=Object.getOwnPropertyDescriptors,Do=Object.getOwnPropertySymbols,Fd=Object.prototype.hasOwnProperty,qd=Object.prototype.propertyIsEnumerable,Lo=(i,t,e)=>t in i?Nd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fr=(i,t)=>{for(var e in t||(t={}))Fd.call(t,e)&&Lo(i,e,t[e]);if(Do)for(var e of Do(t))qd.call(t,e)&&Lo(i,e,t[e]);return i},qr=(i,t)=>Ud(i,Bd(t));function qs(i){return qr(Fr({},i),{level:(i==null?void 0:i.level)||Sd.level})}function Md(i,t=_r){return i[t]||""}function zd(i,t,e=_r){return i[e]=t,i}function Be(i,t=_r){let e="";return typeof i.bindings>"u"?e=Md(i,t):e=i.bindings().context||"",e}function jd(i,t,e=_r){const r=Be(i,e);return r.trim()?`${r}/${t}`:t}function Le(i,t,e=_r){const r=jd(i,t,e),n=i.child({context:r});return zd(n,r,e)}function Kd(i){var t,e;const r=new $d((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:Qr(qr(Fr({},i.opts),{level:"trace",browser:qr(Fr({},(e=i.opts)==null?void 0:e.browser),{write:n=>r.write(n)})})),chunkLoggerController:r}}function Hd(i){var t;const e=new kd((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:Qr(qr(Fr({},i.opts),{level:"trace"}),e),chunkLoggerController:e}}function Wd(i){return typeof i.loggerOverride<"u"&&typeof i.loggerOverride!="string"?{logger:i.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Kd(i):Hd(i)}var Gd=Object.defineProperty,Jd=(i,t,e)=>t in i?Gd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Vo=(i,t,e)=>Jd(i,typeof t!="symbol"?t+"":t,e);class Yd extends Ai{constructor(t){super(),this.opts=t,Vo(this,"protocol","wc"),Vo(this,"version",2)}}var Zd=Object.defineProperty,Qd=(i,t,e)=>t in i?Zd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xd=(i,t,e)=>Qd(i,typeof t!="symbol"?t+"":t,e);class e_ extends Ai{constructor(t,e){super(),this.core=t,this.logger=e,Xd(this,"records",new Map)}}class t_{constructor(t,e){this.logger=t,this.core=e}}class i_ extends Ai{constructor(t,e){super(),this.relayer=t,this.logger=e}}let r_=class extends Ai{constructor(t){super()}},n_=class{constructor(t,e,r,n){this.core=t,this.logger=e,this.name=r}},s_=class extends Ai{constructor(t,e){super(),this.relayer=t,this.logger=e}};class o_ extends Ai{constructor(t,e){super(),this.core=t,this.logger=e}}let a_=class{constructor(t,e,r){this.core=t,this.logger=e,this.store=r}},c_=class{constructor(t,e){this.projectId=t,this.logger=e}},l_=class{constructor(t,e,r){this.core=t,this.logger=e,this.telemetryEnabled=r}};var u_=Object.defineProperty,h_=(i,t,e)=>t in i?u_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,xo=(i,t,e)=>h_(i,typeof t!="symbol"?t+"":t,e);let d_=class{constructor(t){this.opts=t,xo(this,"protocol","wc"),xo(this,"version",2)}},__=class{constructor(t){this.client=t}};function nr(i,{strict:t=!0}={}){return!i||typeof i!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(i):i.startsWith("0x")}function zn(i){return nr(i,{strict:!1})?Math.ceil((i.length-2)/2):i.length}const Wc="2.31.0";let Si={getDocsUrl:({docsBaseUrl:i,docsPath:t="",docsSlug:e})=>t?`${i??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${Wc}`};class ri extends Error{constructor(t,e={}){var c;const r=(()=>{var l;return e.cause instanceof ri?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),n=(()=>e.cause instanceof ri&&e.cause.docsPath||e.docsPath)(),s=(c=Si.getDocsUrl)==null?void 0:c.call(Si,{...e,docsPath:n}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Si.version?[`Version: ${Si.version}`]:[]].join(`
3
+ `);super(o,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=Wc}walk(t){return Gc(this,t)}}function Gc(i,t){return t!=null&&t(i)?i:i&&typeof i=="object"&&"cause"in i&&i.cause!==void 0?Gc(i.cause,t):t?null:i}class Jc extends ri{constructor({size:t,targetSize:e,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Oi(i,{dir:t,size:e=32}={}){return typeof i=="string"?p_(i,{dir:t,size:e}):f_(i,{dir:t,size:e})}function p_(i,{dir:t,size:e=32}={}){if(e===null)return i;const r=i.replace("0x","");if(r.length>e*2)throw new Jc({size:Math.ceil(r.length/2),targetSize:e,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function f_(i,{dir:t,size:e=32}={}){if(e===null)return i;if(i.length>e)throw new Jc({size:i.length,targetSize:e,type:"bytes"});const r=new Uint8Array(e);for(let n=0;n<e;n++){const s=t==="right";r[s?n:e-n-1]=i[s?n:i.length-n-1]}return r}class w_ extends ri{constructor({max:t,min:e,signed:r,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${n*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class g_ extends ri{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Ri(i,{size:t}){if(zn(i)>t)throw new g_({givenSize:zn(i),maxSize:t})}function jn(i,t={}){const{signed:e}=t;t.size&&Ri(i,{size:t.size});const r=BigInt(i);if(!e)return r;const n=(i.length-2)/2,s=(1n<<BigInt(n)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(n*2,"f")}`)-1n}function m_(i,t={}){return Number(jn(i,t))}const E_=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function Kn(i,t={}){return typeof i=="number"||typeof i=="bigint"?Zc(i,t):typeof i=="string"?b_(i,t):typeof i=="boolean"?y_(i,t):Yc(i,t)}function y_(i,t={}){const e=`0x${Number(i)}`;return typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{size:t.size})):e}function Yc(i,t={}){let e="";for(let n=0;n<i.length;n++)e+=E_[i[n]];const r=`0x${e}`;return typeof t.size=="number"?(Ri(r,{size:t.size}),Oi(r,{dir:"right",size:t.size})):r}function Zc(i,t={}){const{signed:e,size:r}=t,n=BigInt(i);let s;r?e?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof i=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&n>s||n<o){const l=typeof i=="bigint"?"n":"";throw new w_({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:r,value:`${i}${l}`})}const c=`0x${(e&&n<0?(1n<<BigInt(r*8))+BigInt(n):n).toString(16)}`;return r?Oi(c,{size:r}):c}const v_=new TextEncoder;function b_(i,t={}){const e=v_.encode(i);return Yc(e,t)}const I_=new TextEncoder;function A_(i,t={}){return typeof i=="number"||typeof i=="bigint"?T_(i,t):typeof i=="boolean"?P_(i,t):nr(i)?Qc(i,t):Xc(i,t)}function P_(i,t={}){const e=new Uint8Array(1);return e[0]=Number(i),typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{size:t.size})):e}const mt={zero:48,nine:57,A:65,F:70,a:97,f:102};function So(i){if(i>=mt.zero&&i<=mt.nine)return i-mt.zero;if(i>=mt.A&&i<=mt.F)return i-(mt.A-10);if(i>=mt.a&&i<=mt.f)return i-(mt.a-10)}function Qc(i,t={}){let e=i;t.size&&(Ri(e,{size:t.size}),e=Oi(e,{dir:"right",size:t.size}));let r=e.slice(2);r.length%2&&(r=`0${r}`);const n=r.length/2,s=new Uint8Array(n);for(let o=0,c=0;o<n;o++){const l=So(r.charCodeAt(c++)),h=So(r.charCodeAt(c++));if(l===void 0||h===void 0)throw new ri(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[o]=l*16+h}return s}function T_(i,t){const e=Zc(i,t);return Qc(e)}function Xc(i,t={}){const e=I_.encode(i);return typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{dir:"right",size:t.size})):e}const vr=BigInt(2**32-1),Co=BigInt(32);function O_(i,t=!1){return t?{h:Number(i&vr),l:Number(i>>Co&vr)}:{h:Number(i>>Co&vr)|0,l:Number(i&vr)|0}}function R_(i,t=!1){const e=i.length;let r=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=O_(i[s],t);[r[s],n[s]]=[o,c]}return[r,n]}const D_=(i,t,e)=>i<<e|t>>>32-e,L_=(i,t,e)=>t<<e|i>>>32-e,V_=(i,t,e)=>t<<e-32|i>>>64-e,x_=(i,t,e)=>i<<e-32|t>>>64-e,ui=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function S_(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Mr(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function sr(i,...t){if(!S_(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function uI(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Mr(i.outputLen),Mr(i.blockLen)}function $o(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function C_(i,t){sr(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function $_(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function el(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function hI(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function dI(i,t){return i<<32-t|i>>>t}const k_=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function N_(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}function U_(i){for(let t=0;t<i.length;t++)i[t]=N_(i[t]);return i}const ko=k_?i=>i:U_;function B_(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function tl(i){return typeof i=="string"&&(i=B_(i)),sr(i),i}function _I(...i){let t=0;for(let r=0;r<i.length;r++){const n=i[r];sr(n),t+=n.length}const e=new Uint8Array(t);for(let r=0,n=0;r<i.length;r++){const s=i[r];e.set(s,n),n+=s.length}return e}class F_{}function q_(i){const t=r=>i().update(tl(r)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function pI(i=32){if(ui&&typeof ui.getRandomValues=="function")return ui.getRandomValues(new Uint8Array(i));if(ui&&typeof ui.randomBytes=="function")return Uint8Array.from(ui.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const M_=BigInt(0),Ci=BigInt(1),z_=BigInt(2),j_=BigInt(7),K_=BigInt(256),H_=BigInt(113),il=[],rl=[],nl=[];for(let i=0,t=Ci,e=1,r=0;i<24;i++){[e,r]=[r,(2*e+3*r)%5],il.push(2*(5*r+e)),rl.push((i+1)*(i+2)/2%64);let n=M_;for(let s=0;s<7;s++)t=(t<<Ci^(t>>j_)*H_)%K_,t&z_&&(n^=Ci<<(Ci<<BigInt(s))-Ci);nl.push(n)}const sl=R_(nl,!0),W_=sl[0],G_=sl[1],No=(i,t,e)=>e>32?V_(i,t,e):D_(i,t,e),Uo=(i,t,e)=>e>32?x_(i,t,e):L_(i,t,e);function J_(i,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,h=e[l],u=e[l+1],d=No(h,u,1)^e[c],_=Uo(h,u,1)^e[c+1];for(let p=0;p<50;p+=10)i[o+p]^=d,i[o+p+1]^=_}let n=i[2],s=i[3];for(let o=0;o<24;o++){const c=rl[o],l=No(n,s,c),h=Uo(n,s,c),u=il[o];n=i[u],s=i[u+1],i[u]=l,i[u+1]=h}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=W_[r],i[1]^=G_[r]}el(e)}class Ms extends F_{constructor(t,e,r,n=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=n,this.rounds=s,Mr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$_(this.state)}clone(){return this._cloneInto()}keccak(){ko(this.state32),J_(this.state32,this.rounds),ko(this.state32),this.posOut=0,this.pos=0}update(t){$o(this),t=tl(t),sr(t);const{blockLen:e,state:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:n}=this;t[r]^=e,e&128&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){$o(this,!1),sr(t),this.finish();const e=this.state,{blockLen:r}=this;for(let n=0,s=t.length;n<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Mr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(C_(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,el(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new Ms(e,r,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}}const Y_=(i,t,e)=>q_(()=>new Ms(t,i,e)),Z_=(()=>Y_(1,136,256/8))();function ol(i,t){const e=t||"hex",r=Z_(nr(i,{strict:!1})?A_(i):i);return e==="bytes"?r:Kn(r)}class Q_ extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const e=super.get(t);return super.has(t)&&e!==void 0&&(this.delete(t),super.set(t,e)),e}set(t,e){if(super.set(t,e),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const fn=new Q_(8192);function X_(i,t){if(fn.has(`${i}.${t}`))return fn.get(`${i}.${t}`);const e=t?`${t}${i.toLowerCase()}`:i.substring(2).toLowerCase(),r=ol(Xc(e),"bytes"),n=(t?e.substring(`${t}0x`.length):e).split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&n[o]&&(n[o]=n[o].toUpperCase()),(r[o>>1]&15)>=8&&n[o+1]&&(n[o+1]=n[o+1].toUpperCase());const s=`0x${n.join("")}`;return fn.set(`${i}.${t}`,s),s}function ep(i){const t=ol(`0x${i.substring(4)}`).substring(26);return X_(`0x${t}`)}async function tp({hash:i,signature:t}){const e=nr(i)?i:Kn(i),{secp256k1:r}=await a(()=>import("./secp256k1-4ab38443.js"),["assets/secp256k1-4ab38443.js","assets/signing-6d6682ec.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/to-serializable-transaction-9e540f8c.js","assets/transaction-ea614a5a.js","assets/get-bytecode-7a8c6215.js","assets/execute-264a98ed.js","assets/redirect-state-301cb22c.js","assets/index-93724bad.js","assets/ethereum-0d579241.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-cc1589a7.js","assets/send-transaction-c3053b90.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-b3889ac8.js","assets/index-accd8060.js","assets/index-2cab452e.js","assets/index-6ab757a5.js","assets/index-877ffe4a.js"]);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:h,s:u,v:d,yParity:_}=t,p=Number(_??d),f=Bo(p);return new r.Signature(jn(h),jn(u)).addRecoveryBit(f)}const o=nr(t)?t:Kn(t);if(zn(o)!==65)throw new Error("invalid signature length");const c=m_(`0x${o.slice(130)}`),l=Bo(c);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function Bo(i){if(i===0||i===1)return i;if(i===27)return 0;if(i===28)return 1;throw new Error("Invalid yParityOrV value")}async function ip({hash:i,signature:t}){return ep(await tp({hash:i,signature:t}))}function rp(i){const t=i.length;let e=0,r=0;for(;r<t;){let n=i.charCodeAt(r++);if(n&4294967168)if(!(n&4294965248))e+=2;else{if(n>=55296&&n<=56319&&r<t){const s=i.charCodeAt(r);(s&64512)===56320&&(++r,n=((n&1023)<<10)+(s&1023)+65536)}n&4294901760?e+=4:e+=3}else{e++;continue}}return e}function np(i,t,e){const r=i.length;let n=e,s=0;for(;s<r;){let o=i.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))t[n++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){const c=i.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}o&4294901760?(t[n++]=o>>18&7|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128):(t[n++]=o>>12&15|224,t[n++]=o>>6&63|128)}else{t[n++]=o;continue}t[n++]=o&63|128}}const sp=new TextEncoder,op=50;function ap(i,t,e){sp.encodeInto(i,t.subarray(e))}function cp(i,t,e){i.length>op?ap(i,t,e):np(i,t,e)}const lp=4096;function al(i,t,e){let r=t;const n=r+e,s=[];let o="";for(;r<n;){const c=i[r++];if(!(c&128))s.push(c);else if((c&224)===192){const l=i[r++]&63;s.push((c&31)<<6|l)}else if((c&240)===224){const l=i[r++]&63,h=i[r++]&63;s.push((c&31)<<12|l<<6|h)}else if((c&248)===240){const l=i[r++]&63,h=i[r++]&63,u=i[r++]&63;let d=(c&7)<<18|l<<12|h<<6|u;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(c);s.length>=lp&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const up=new TextDecoder,hp=200;function dp(i,t,e){const r=i.subarray(t,t+e);return up.decode(r)}function _p(i,t,e){return e>hp?dp(i,t,e):al(i,t,e)}class br{constructor(t,e){this.type=t,this.data=e}}class Me extends Error{constructor(t){super(t);const e=Object.create(Me.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Me.name})}}const $i=4294967295;function pp(i,t,e){const r=e/4294967296,n=e;i.setUint32(t,r),i.setUint32(t+4,n)}function cl(i,t,e){const r=Math.floor(e/4294967296),n=e;i.setUint32(t,r),i.setUint32(t+4,n)}function ll(i,t){const e=i.getInt32(t),r=i.getUint32(t+4);return e*4294967296+r}function fp(i,t){const e=i.getUint32(t),r=i.getUint32(t+4);return e*4294967296+r}const wp=-1,gp=4294967296-1,mp=17179869184-1;function Ep({sec:i,nsec:t}){if(i>=0&&t>=0&&i<=mp)if(t===0&&i<=gp){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,i),e}else{const e=i/4294967296,r=i&4294967295,n=new Uint8Array(8),s=new DataView(n.buffer);return s.setUint32(0,t<<2|e&3),s.setUint32(4,r),n}else{const e=new Uint8Array(12),r=new DataView(e.buffer);return r.setUint32(0,t),cl(r,4,i),e}}function yp(i){const t=i.getTime(),e=Math.floor(t/1e3),r=(t-e*1e3)*1e6,n=Math.floor(r/1e9);return{sec:e+n,nsec:r-n*1e9}}function vp(i){if(i instanceof Date){const t=yp(i);return Ep(t)}else return null}function bp(i){const t=new DataView(i.buffer,i.byteOffset,i.byteLength);switch(i.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),r=t.getUint32(4),n=(e&3)*4294967296+r,s=e>>>2;return{sec:n,nsec:s}}case 12:{const e=ll(t,4),r=t.getUint32(0);return{sec:e,nsec:r}}default:throw new Me(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${i.length}`)}}function Ip(i){const t=bp(i);return new Date(t.sec*1e3+t.nsec/1e6)}const Ap={type:wp,encode:vp,decode:Ip};class zr{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Ap)}register({type:t,encode:e,decode:r}){if(t>=0)this.encoders[t]=e,this.decoders[t]=r;else{const n=-1-t;this.builtInEncoders[n]=e,this.builtInDecoders[n]=r}}tryToEncode(t,e){for(let r=0;r<this.builtInEncoders.length;r++){const n=this.builtInEncoders[r];if(n!=null){const s=n(t,e);if(s!=null){const o=-1-r;return new br(o,s)}}}for(let r=0;r<this.encoders.length;r++){const n=this.encoders[r];if(n!=null){const s=n(t,e);if(s!=null){const o=r;return new br(o,s)}}}return t instanceof br?t:null}decode(t,e,r){const n=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return n?n(t,e,r):new br(e,t)}}zr.defaultCodec=new zr;function Pp(i){return i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer}function Hn(i){return i instanceof Uint8Array?i:ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Pp(i)?new Uint8Array(i):Uint8Array.from(i)}const Tp=100,Op=2048;class zs{constructor(t){this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??zr.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.maxDepth=(t==null?void 0:t.maxDepth)??Tp,this.initialBufferSize=(t==null?void 0:t.initialBufferSize)??Op,this.sortKeys=(t==null?void 0:t.sortKeys)??!1,this.forceFloat32=(t==null?void 0:t.forceFloat32)??!1,this.ignoreUndefined=(t==null?void 0:t.ignoreUndefined)??!1,this.forceIntegerToFloat=(t==null?void 0:t.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new zs({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,e)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(e*2)}resizeBuffer(t){const e=new ArrayBuffer(t),r=new Uint8Array(e),n=new DataView(e);r.set(this.bytes),this.view=n,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const r=rp(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),cp(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,e){const r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,e);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const e=t.byteLength;if(e<256)this.writeU8(196),this.writeU8(e);else if(e<65536)this.writeU8(197),this.writeU16(e);else if(e<4294967296)this.writeU8(198),this.writeU32(e);else throw new Error(`Too large binary: ${e}`);const r=Hn(t);this.writeU8a(r)}encodeArray(t,e){const r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const n of t)this.doEncode(n,e+1)}countWithoutUndefined(t,e){let r=0;for(const n of e)t[n]!==void 0&&r++;return r}encodeMap(t,e){const r=Object.keys(t);this.sortKeys&&r.sort();const n=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw new Error(`Too large map object: ${n}`);for(const s of r){const o=t[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,e+1))}}encodeExtension(t){if(typeof t.data=="function"){const r=t.data(this.pos+6),n=r.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(t.type),this.writeU8a(r);return}const e=t.data.length;if(e===1)this.writeU8(212);else if(e===2)this.writeU8(213);else if(e===4)this.writeU8(214);else if(e===8)this.writeU8(215);else if(e===16)this.writeU8(216);else if(e<256)this.writeU8(199),this.writeU8(e);else if(e<65536)this.writeU8(200),this.writeU16(e);else if(e<4294967296)this.writeU8(201),this.writeU32(e);else throw new Error(`Too large extension object: ${e}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),pp(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),cl(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}}function Rp(i,t){return new zs(t).encodeSharedRef(i)}function wn(i){return`${i<0?"-":""}0x${Math.abs(i).toString(16).padStart(2,"0")}`}const Dp=16,Lp=16;class Vp{constructor(t=Dp,e=Lp){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,r){const n=this.caches[r-1];e:for(const s of n){const o=s.bytes;for(let c=0;c<r;c++)if(o[c]!==t[e+c])continue e;return s.str}return null}store(t,e){const r=this.caches[t.length-1],n={bytes:t,str:e};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(t,e,r){const n=this.find(t,e,r);if(n!=null)return this.hit++,n;this.miss++;const s=al(t,e,r),o=Uint8Array.prototype.slice.call(t,e,e+r);return this.store(o,s),s}}const Wn="array",Ji="map_key",ul="map_value",xp=i=>{if(typeof i=="string"||typeof i=="number")return i;throw new Me("The type of key must be string or number but "+typeof i)};class Sp{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=Wn,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=Ji,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===Wn){const r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===Ji||t.type===ul){const r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const ki=-1,js=new DataView(new ArrayBuffer(0)),Cp=new Uint8Array(js.buffer);try{js.getInt8(0)}catch(i){if(!(i instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const Fo=new RangeError("Insufficient data"),$p=new Vp;class Ks{constructor(t){this.totalPos=0,this.pos=0,this.view=js,this.bytes=Cp,this.headByte=ki,this.stack=new Sp,this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??zr.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.rawStrings=(t==null?void 0:t.rawStrings)??!1,this.maxStrLength=(t==null?void 0:t.maxStrLength)??$i,this.maxBinLength=(t==null?void 0:t.maxBinLength)??$i,this.maxArrayLength=(t==null?void 0:t.maxArrayLength)??$i,this.maxMapLength=(t==null?void 0:t.maxMapLength)??$i,this.maxExtLength=(t==null?void 0:t.maxExtLength)??$i,this.keyDecoder=(t==null?void 0:t.keyDecoder)!==void 0?t.keyDecoder:$p,this.mapKeyConverter=(t==null?void 0:t.mapKeyConverter)??xp}clone(){return new Ks({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=ki,this.stack.reset()}setBuffer(t){const e=Hn(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===ki&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),r=Hn(t),n=new Uint8Array(e.length+r.length);n.set(e),n.set(r,e.length),this.setBuffer(n)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:r}=this;return new RangeError(`Extra ${e.byteLength-r} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,r;for await(const c of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{r=this.doDecodeSync(),e=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}const{headByte:n,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${wn(n)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let r=e,n=-1;for await(const s of t){if(e&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const n=t-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t<160){const n=t-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else{const n=t-160;e=this.decodeString(n,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const n=this.lookU8();e=this.decodeString(n,1)}else if(t===218){const n=this.lookU16();e=this.decodeString(n,2)}else if(t===219){const n=this.lookU32();e=this.decodeString(n,4)}else if(t===220){const n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===221){const n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===222){const n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===223){const n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===196){const n=this.lookU8();e=this.decodeBinary(n,1)}else if(t===197){const n=this.lookU16();e=this.decodeBinary(n,2)}else if(t===198){const n=this.lookU32();e=this.decodeBinary(n,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const n=this.lookU8();e=this.decodeExtension(n,1)}else if(t===200){const n=this.lookU16();e=this.decodeExtension(n,2)}else if(t===201){const n=this.lookU32();e=this.decodeExtension(n,4)}else throw new Me(`Unrecognized type byte: ${wn(t)}`);this.complete();const r=this.stack;for(;r.length>0;){const n=r.top();if(n.type===Wn)if(n.array[n.position]=e,n.position++,n.position===n.size)e=n.array,r.release(n);else continue e;else if(n.type===Ji){if(e==="__proto__")throw new Me("The key __proto__ is not allowed");n.key=this.mapKeyConverter(e),n.type=ul;continue e}else if(n.map[n.key]=e,n.readCount++,n.readCount===n.size)e=n.map,r.release(n);else{n.key=null,n.type=Ji;continue e}}return e}}readHeadByte(){return this.headByte===ki&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=ki}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new Me(`Unrecognized array type byte: ${wn(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new Me(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new Me(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){var s;if(t>this.maxStrLength)throw new Me(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw Fo;const r=this.pos+e;let n;return this.stateIsMapKey()&&((s=this.keyDecoder)!=null&&s.canBeCached(t))?n=this.keyDecoder.decode(this.bytes,r,t):n=_p(this.bytes,r,t),this.pos+=e+t,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ji:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new Me(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw Fo;const r=this.pos+e,n=this.bytes.subarray(r,r+t);return this.pos+=e+t,n}decodeExtension(t,e){if(t>this.maxExtLength)throw new Me(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+e),n=this.decodeBinary(t,e+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=fp(this.view,this.pos);return this.pos+=8,t}readI64(){const t=ll(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function kp(i,t){return new Ks(t).decode(i)}const Np=":";function Lr(i){const[t,e]=i.split(Np);return{namespace:t,reference:e}}function hl(i,t){return i.includes(":")?[i]:t.chains||[]}var Up=Object.defineProperty,Bp=Object.defineProperties,Fp=Object.getOwnPropertyDescriptors,qo=Object.getOwnPropertySymbols,qp=Object.prototype.hasOwnProperty,Mp=Object.prototype.propertyIsEnumerable,Gn=(i,t,e)=>t in i?Up(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Mo=(i,t)=>{for(var e in t||(t={}))qp.call(t,e)&&Gn(i,e,t[e]);if(qo)for(var e of qo(t))Mp.call(t,e)&&Gn(i,e,t[e]);return i},zp=(i,t)=>Bp(i,Fp(t)),zo=(i,t,e)=>Gn(i,typeof t!="symbol"?t+"":t,e);const jp="ReactNative",ze={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Kp="js";function jr(){return typeof Mt<"u"&&typeof Mt.versions<"u"&&typeof Mt.versions.node<"u"}function Kt(){return!mi()&&!!Ic()&&navigator.product===jp}function Hp(){return Kt()&&typeof j<"u"&&typeof(j==null?void 0:j.Platform)<"u"&&(j==null?void 0:j.Platform.OS)==="android"}function Wp(){return Kt()&&typeof j<"u"&&typeof(j==null?void 0:j.Platform)<"u"&&(j==null?void 0:j.Platform.OS)==="ios"}function Di(){return!jr()&&!!Ic()&&!!mi()}function pr(){return Kt()?ze.reactNative:jr()?ze.node:Di()?ze.browser:ze.unknown}function jo(){var i;try{return Kt()&&typeof j<"u"&&typeof(j==null?void 0:j.Application)<"u"?(i=j.Application)==null?void 0:i.applicationId:void 0}catch{return}}function Gp(i,t){const e=new URLSearchParams(i);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const n=t[r];n!==void 0&&e.set(r,n)}return e.toString()}function Jp(i){var t,e;const r=dl();try{return i!=null&&i.url&&r.url&&new URL(i.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${i.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),i.url=r.url),(t=i==null?void 0:i.icons)!=null&&t.length&&i.icons.length>0&&(i.icons=i.icons.filter(n=>n!=="")),zp(Mo(Mo({},r),i),{url:(i==null?void 0:i.url)||r.url,name:(i==null?void 0:i.name)||r.name,description:(i==null?void 0:i.description)||r.description,icons:(e=i==null?void 0:i.icons)!=null&&e.length&&i.icons.length>0?i.icons:r.icons})}catch(n){return console.warn("Error populating app metadata",n),i||r}}function dl(){return Vh()||{name:"",description:"",url:"",icons:[""]}}function Yp(){if(pr()===ze.reactNative&&typeof j<"u"&&typeof(j==null?void 0:j.Platform)<"u"){const{OS:e,Version:r}=j.Platform;return[e,r].join("-")}const i=xh();if(i===null)return"unknown";const t=i.os?i.os.replace(" ","").toLowerCase():"unknown";return i.type==="browser"?[t,i.name,i.version].join("-"):[t,i.version].join("-")}function Zp(){var i;const t=pr();return t===ze.browser?[t,((i=Sh())==null?void 0:i.host)||"unknown"].join(":"):t}function _l(i,t,e){const r=Yp(),n=Zp();return[[i,t].join("-"),[Kp,e].join("-"),r,n].join("/")}function Qp({protocol:i,version:t,relayUrl:e,sdkVersion:r,auth:n,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const h=e.split("?"),u=_l(i,t,r),d={auth:n,ua:u,projectId:s,useOnCloseEvent:o||void 0,packageName:l||void 0,bundleId:c||void 0},_=Gp(h[1]||"",d);return h[0]+"?"+_}function Zt(i,t){return i.filter(e=>t.includes(e)).length===i.length}function Jn(i){return Object.fromEntries(i.entries())}function Yn(i){return new Map(Object.entries(i))}function Gt(i=U.FIVE_MINUTES,t){const e=U.toMiliseconds(i||U.FIVE_MINUTES);let r,n,s,o;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),o=Promise.resolve(c))},reject:c=>{s&&n&&(clearTimeout(s),n(c))},done:()=>new Promise((c,l)=>{if(o)return c(o);s=setTimeout(()=>{const h=new Error(t);o=Promise.reject(h),l(h)},e),r=c,n=l})}}function _t(i,t,e){return new Promise(async(r,n)=>{const s=setTimeout(()=>n(new Error(e)),t);try{const o=await i;r(o)}catch(o){n(o)}clearTimeout(s)})}function pl(i,t){if(typeof t=="string"&&t.startsWith(`${i}:`))return t;if(i.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(i.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${i}`)}function Xp(i){return pl("topic",i)}function ef(i){return pl("id",i)}function fl(i){const[t,e]=i.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")r.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))r.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return r}function pe(i,t){return U.fromMiliseconds((t||Date.now())+U.toMiliseconds(i))}function kt(i){return Date.now()>=U.toMiliseconds(i)}function Q(i,t){return`${i}${t?`:${t}`:""}`}function ti(i=[],t=[]){return[...new Set([...i,...t])]}async function tf({id:i,topic:t,wcDeepLink:e}){var r;try{if(!e)return;const n=typeof e=="string"?JSON.parse(e):e,s=n==null?void 0:n.href;if(typeof s!="string")return;const o=rf(s,i,t),c=pr();if(c===ze.browser){if(!((r=mi())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}nf(o)}else c===ze.reactNative&&typeof(j==null?void 0:j.Linking)<"u"&&await j.Linking.openURL(o)}catch(n){console.error(n)}}function rf(i,t,e){const r=`requestId=${t}&sessionTopic=${e}`;i.endsWith("/")&&(i=i.slice(0,-1));let n=`${i}`;if(i.startsWith("https://t.me")){const s=i.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${cf(r,!0)}`}else n=`${n}/wc?${r}`;return n}function nf(i){let t="_self";af()?t="_top":(of()||i.startsWith("https://")||i.startsWith("http://"))&&(t="_blank"),window.open(i,t,"noreferrer noopener")}async function sf(i,t){let e="";try{if(Di()&&(e=localStorage.getItem(t),e))return e;e=await i.getItem(t)}catch(r){console.error(r)}return e}function Ko(i,t){if(!i.includes(t))return null;const e=i.split(/([&,?,=])/),r=e.indexOf(t);return e[r+2]}function Ho(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,i=>{const t=Math.random()*16|0;return(i==="x"?t:t&3|8).toString(16)})}function Hs(){return typeof Mt<"u"&&{}.IS_VITEST==="true"}function of(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function af(){try{return window.self!==window.top}catch{return!1}}function cf(i,t=!1){const e=ee.from(i).toString("base64");return t?e.replace(/[=]/g,""):e}function wl(i){return ee.from(i,"base64").toString("utf-8")}function lf(i){return new Promise(t=>setTimeout(t,i))}let uf=class{constructor({limit:t}){zo(this,"limit"),zo(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const Ir=BigInt(2**32-1),Wo=BigInt(32);function gl(i,t=!1){return t?{h:Number(i&Ir),l:Number(i>>Wo&Ir)}:{h:Number(i>>Wo&Ir)|0,l:Number(i&Ir)|0}}function ml(i,t=!1){const e=i.length;let r=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=gl(i[s],t);[r[s],n[s]]=[o,c]}return[r,n]}const Go=(i,t,e)=>i>>>e,Jo=(i,t,e)=>i<<32-e|t>>>e,Nt=(i,t,e)=>i>>>e|t<<32-e,Ut=(i,t,e)=>i<<32-e|t>>>e,Ki=(i,t,e)=>i<<64-e|t>>>e-32,Hi=(i,t,e)=>i>>>e-32|t<<64-e,hf=(i,t)=>t,df=(i,t)=>i,_f=(i,t,e)=>i<<e|t>>>32-e,pf=(i,t,e)=>t<<e|i>>>32-e,ff=(i,t,e)=>t<<e-32|i>>>64-e,wf=(i,t,e)=>i<<e-32|t>>>64-e;function it(i,t,e,r){const n=(t>>>0)+(r>>>0);return{h:i+e+(n/2**32|0)|0,l:n|0}}const Ws=(i,t,e)=>(i>>>0)+(t>>>0)+(e>>>0),Gs=(i,t,e,r)=>t+e+r+(i/2**32|0)|0,gf=(i,t,e,r)=>(i>>>0)+(t>>>0)+(e>>>0)+(r>>>0),mf=(i,t,e,r,n)=>t+e+r+n+(i/2**32|0)|0,Ef=(i,t,e,r,n)=>(i>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),yf=(i,t,e,r,n,s)=>t+e+r+n+s+(i/2**32|0)|0,hi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Js(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Tt(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function Qe(i,...t){if(!Js(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function Ys(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Tt(i.outputLen),Tt(i.blockLen)}function jt(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function Zs(i,t){Qe(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function or(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function Xe(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function gn(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function ct(i,t){return i<<32-t|i>>>t}const El=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function yl(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}const vt=El?i=>i:i=>yl(i);function vf(i){for(let t=0;t<i.length;t++)i[t]=yl(i[t]);return i}const Bt=El?i=>i:vf,vl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",bf=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function ar(i){if(Qe(i),vl)return i.toHex();let t="";for(let e=0;e<i.length;e++)t+=bf[i[e]];return t}const Et={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yo(i){if(i>=Et._0&&i<=Et._9)return i-Et._0;if(i>=Et.A&&i<=Et.F)return i-(Et.A-10);if(i>=Et.a&&i<=Et.f)return i-(Et.a-10)}function Qs(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);if(vl)return Uint8Array.fromHex(i);const t=i.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let n=0,s=0;n<e;n++,s+=2){const o=Yo(i.charCodeAt(s)),c=Yo(i.charCodeAt(s+1));if(o===void 0||c===void 0){const l=i[s]+i[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[n]=o*16+c}return r}function If(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function ot(i){return typeof i=="string"&&(i=If(i)),Qe(i),i}function Qt(...i){let t=0;for(let r=0;r<i.length;r++){const n=i[r];Qe(n),t+=n.length}const e=new Uint8Array(t);for(let r=0,n=0;r<i.length;r++){const s=i[r];e.set(s,n),n+=s.length}return e}class Xr{}function fr(i){const t=r=>i().update(ot(r)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function Af(i){const t=(r,n)=>i(n).update(ot(r)).digest(),e=i({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>i(r),t}function Li(i=32){if(hi&&typeof hi.getRandomValues=="function")return hi.getRandomValues(new Uint8Array(i));if(hi&&typeof hi.randomBytes=="function")return Uint8Array.from(hi.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const Pf=BigInt(0),Ni=BigInt(1),Tf=BigInt(2),Of=BigInt(7),Rf=BigInt(256),Df=BigInt(113),bl=[],Il=[],Al=[];for(let i=0,t=Ni,e=1,r=0;i<24;i++){[e,r]=[r,(2*e+3*r)%5],bl.push(2*(5*r+e)),Il.push((i+1)*(i+2)/2%64);let n=Pf;for(let s=0;s<7;s++)t=(t<<Ni^(t>>Of)*Df)%Rf,t&Tf&&(n^=Ni<<(Ni<<BigInt(s))-Ni);Al.push(n)}const Pl=ml(Al,!0),Lf=Pl[0],Vf=Pl[1],Zo=(i,t,e)=>e>32?ff(i,t,e):_f(i,t,e),Qo=(i,t,e)=>e>32?wf(i,t,e):pf(i,t,e);function xf(i,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,h=e[l],u=e[l+1],d=Zo(h,u,1)^e[c],_=Qo(h,u,1)^e[c+1];for(let p=0;p<50;p+=10)i[o+p]^=d,i[o+p+1]^=_}let n=i[2],s=i[3];for(let o=0;o<24;o++){const c=Il[o],l=Zo(n,s,c),h=Qo(n,s,c),u=bl[o];n=i[u],s=i[u+1],i[u]=l,i[u+1]=h}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=Lf[r],i[1]^=Vf[r]}Xe(e)}let Sf=class Tl extends Xr{constructor(t,e,r,n=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=n,this.rounds=s,Tt(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=or(this.state)}clone(){return this._cloneInto()}keccak(){Bt(this.state32),xf(this.state32,this.rounds),Bt(this.state32),this.posOut=0,this.pos=0}update(t){jt(this),t=ot(t),Qe(t);const{blockLen:e,state:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:n}=this;t[r]^=e,e&128&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){jt(this,!1),Qe(t),this.finish();const e=this.state,{blockLen:r}=this;for(let n=0,s=t.length;n<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Tt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Zs(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,Xe(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new Tl(e,r,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Cf=(i,t,e)=>fr(()=>new Sf(t,i,e)),$f=Cf(1,136,256/8);function kf(i,t,e,r){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,r);const n=BigInt(32),s=BigInt(4294967295),o=Number(e>>n&s),c=Number(e&s),l=r?4:0,h=r?0:4;i.setUint32(t+l,o,r),i.setUint32(t+h,c,r)}function Nf(i,t,e){return i&t^~i&e}function Uf(i,t,e){return i&t^i&e^t&e}let Ol=class extends Xr{constructor(t,e,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(t),this.view=gn(this.buffer)}update(t){jt(this),t=ot(t),Qe(t);const{view:e,buffer:r,blockLen:n}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(n-this.pos,s-o);if(c===n){const l=gn(t);for(;n<=s-o;o+=n)this.process(l,o);continue}r.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){jt(this),Zs(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:s}=this;let{pos:o}=this;e[o++]=128,Xe(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let d=o;d<n;d++)e[d]=0;kf(r,n-8,BigInt(this.length*8),s),this.process(r,0);const c=gn(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const h=l/4,u=this.get();if(h>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<h;d++)c.setUint32(4*d,u[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=n,t.pos=c,n%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const Rt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),be=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Ie=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Bf=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]),Dt=new Uint32Array(64);let Ff=class extends Ol{constructor(t=32){super(64,t,8,!1),this.A=Rt[0]|0,this.B=Rt[1]|0,this.C=Rt[2]|0,this.D=Rt[3]|0,this.E=Rt[4]|0,this.F=Rt[5]|0,this.G=Rt[6]|0,this.H=Rt[7]|0}get(){const{A:t,B:e,C:r,D:n,E:s,F:o,G:c,H:l}=this;return[t,e,r,n,s,o,c,l]}set(t,e,r,n,s,o,c,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=n|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)Dt[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const _=Dt[d-15],p=Dt[d-2],f=ct(_,7)^ct(_,18)^_>>>3,w=ct(p,17)^ct(p,19)^p>>>10;Dt[d]=w+Dt[d-7]+f+Dt[d-16]|0}let{A:r,B:n,C:s,D:o,E:c,F:l,G:h,H:u}=this;for(let d=0;d<64;d++){const _=ct(c,6)^ct(c,11)^ct(c,25),p=u+_+Nf(c,l,h)+Bf[d]+Dt[d]|0,f=(ct(r,2)^ct(r,13)^ct(r,22))+Uf(r,n,s)|0;u=h,h=l,l=c,c=o+p|0,o=s,s=n,n=r,r=p+f|0}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,u=u+this.H|0,this.set(r,n,s,o,c,l,h,u)}roundClean(){Xe(Dt)}destroy(){this.set(0,0,0,0,0,0,0,0),Xe(this.buffer)}};const Rl=ml(["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(i=>BigInt(i))),qf=Rl[0],Mf=Rl[1],Lt=new Uint32Array(80),Vt=new Uint32Array(80);let Xs=class extends Ol{constructor(t=64){super(128,t,16,!1),this.Ah=Ie[0]|0,this.Al=Ie[1]|0,this.Bh=Ie[2]|0,this.Bl=Ie[3]|0,this.Ch=Ie[4]|0,this.Cl=Ie[5]|0,this.Dh=Ie[6]|0,this.Dl=Ie[7]|0,this.Eh=Ie[8]|0,this.El=Ie[9]|0,this.Fh=Ie[10]|0,this.Fl=Ie[11]|0,this.Gh=Ie[12]|0,this.Gl=Ie[13]|0,this.Hh=Ie[14]|0,this.Hl=Ie[15]|0}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:s,Cl:o,Dh:c,Dl:l,Eh:h,El:u,Fh:d,Fl:_,Gh:p,Gl:f,Hh:w,Hl:g}=this;return[t,e,r,n,s,o,c,l,h,u,d,_,p,f,w,g]}set(t,e,r,n,s,o,c,l,h,u,d,_,p,f,w,g){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=n|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=h|0,this.El=u|0,this.Fh=d|0,this.Fl=_|0,this.Gh=p|0,this.Gl=f|0,this.Hh=w|0,this.Hl=g|0}process(t,e){for(let y=0;y<16;y++,e+=4)Lt[y]=t.getUint32(e),Vt[y]=t.getUint32(e+=4);for(let y=16;y<80;y++){const v=Lt[y-15]|0,b=Vt[y-15]|0,D=Nt(v,b,1)^Nt(v,b,8)^Go(v,b,7),N=Ut(v,b,1)^Ut(v,b,8)^Jo(v,b,7),S=Lt[y-2]|0,m=Vt[y-2]|0,P=Nt(S,m,19)^Ki(S,m,61)^Go(S,m,6),E=Ut(S,m,19)^Hi(S,m,61)^Jo(S,m,6),A=gf(N,E,Vt[y-7],Vt[y-16]),O=mf(A,D,P,Lt[y-7],Lt[y-16]);Lt[y]=O|0,Vt[y]=A|0}let{Ah:r,Al:n,Bh:s,Bl:o,Ch:c,Cl:l,Dh:h,Dl:u,Eh:d,El:_,Fh:p,Fl:f,Gh:w,Gl:g,Hh:I,Hl:T}=this;for(let y=0;y<80;y++){const v=Nt(d,_,14)^Nt(d,_,18)^Ki(d,_,41),b=Ut(d,_,14)^Ut(d,_,18)^Hi(d,_,41),D=d&p^~d&w,N=_&f^~_&g,S=Ef(T,b,N,Mf[y],Vt[y]),m=yf(S,I,v,D,qf[y],Lt[y]),P=S|0,E=Nt(r,n,28)^Ki(r,n,34)^Ki(r,n,39),A=Ut(r,n,28)^Hi(r,n,34)^Hi(r,n,39),O=r&s^r&c^s&c,V=n&o^n&l^o&l;I=w|0,T=g|0,w=p|0,g=f|0,p=d|0,f=_|0,{h:d,l:_}=it(h|0,u|0,m|0,P|0),h=c|0,u=l|0,c=s|0,l=o|0,s=r|0,o=n|0;const x=Ws(P,A,V);r=Gs(x,m,E,O),n=x|0}({h:r,l:n}=it(this.Ah|0,this.Al|0,r|0,n|0)),{h:s,l:o}=it(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=it(this.Ch|0,this.Cl|0,c|0,l|0),{h,l:u}=it(this.Dh|0,this.Dl|0,h|0,u|0),{h:d,l:_}=it(this.Eh|0,this.El|0,d|0,_|0),{h:p,l:f}=it(this.Fh|0,this.Fl|0,p|0,f|0),{h:w,l:g}=it(this.Gh|0,this.Gl|0,w|0,g|0),{h:I,l:T}=it(this.Hh|0,this.Hl|0,I|0,T|0),this.set(r,n,s,o,c,l,h,u,d,_,p,f,w,g,I,T)}roundClean(){Xe(Lt,Vt)}destroy(){Xe(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},zf=class extends Xs{constructor(){super(48),this.Ah=be[0]|0,this.Al=be[1]|0,this.Bh=be[2]|0,this.Bl=be[3]|0,this.Ch=be[4]|0,this.Cl=be[5]|0,this.Dh=be[6]|0,this.Dl=be[7]|0,this.Eh=be[8]|0,this.El=be[9]|0,this.Fh=be[10]|0,this.Fl=be[11]|0,this.Gh=be[12]|0,this.Gl=be[13]|0,this.Hh=be[14]|0,this.Hl=be[15]|0}};const Ae=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class jf extends Xs{constructor(){super(32),this.Ah=Ae[0]|0,this.Al=Ae[1]|0,this.Bh=Ae[2]|0,this.Bl=Ae[3]|0,this.Ch=Ae[4]|0,this.Cl=Ae[5]|0,this.Dh=Ae[6]|0,this.Dl=Ae[7]|0,this.Eh=Ae[8]|0,this.El=Ae[9]|0,this.Fh=Ae[10]|0,this.Fl=Ae[11]|0,this.Gh=Ae[12]|0,this.Gl=Ae[13]|0,this.Hh=Ae[14]|0,this.Hl=Ae[15]|0}}const en=fr(()=>new Ff),Kf=fr(()=>new Xs),Hf=fr(()=>new zf),Wf=fr(()=>new jf),Gf=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),_e=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),B=new Uint32Array(32);function xt(i,t,e,r,n,s){const o=n[s],c=n[s+1];let l=B[2*i],h=B[2*i+1],u=B[2*t],d=B[2*t+1],_=B[2*e],p=B[2*e+1],f=B[2*r],w=B[2*r+1],g=Ws(l,u,o);h=Gs(g,h,d,c),l=g|0,{Dh:w,Dl:f}={Dh:w^h,Dl:f^l},{Dh:w,Dl:f}={Dh:hf(w,f),Dl:df(w)},{h:p,l:_}=it(p,_,w,f),{Bh:d,Bl:u}={Bh:d^p,Bl:u^_},{Bh:d,Bl:u}={Bh:Nt(d,u,24),Bl:Ut(d,u,24)},B[2*i]=l,B[2*i+1]=h,B[2*t]=u,B[2*t+1]=d,B[2*e]=_,B[2*e+1]=p,B[2*r]=f,B[2*r+1]=w}function St(i,t,e,r,n,s){const o=n[s],c=n[s+1];let l=B[2*i],h=B[2*i+1],u=B[2*t],d=B[2*t+1],_=B[2*e],p=B[2*e+1],f=B[2*r],w=B[2*r+1],g=Ws(l,u,o);h=Gs(g,h,d,c),l=g|0,{Dh:w,Dl:f}={Dh:w^h,Dl:f^l},{Dh:w,Dl:f}={Dh:Nt(w,f,16),Dl:Ut(w,f,16)},{h:p,l:_}=it(p,_,w,f),{Bh:d,Bl:u}={Bh:d^p,Bl:u^_},{Bh:d,Bl:u}={Bh:Ki(d,u,63),Bl:Hi(d,u,63)},B[2*i]=l,B[2*i+1]=h,B[2*t]=u,B[2*t+1]=d,B[2*e]=_,B[2*e+1]=p,B[2*r]=f,B[2*r+1]=w}function Jf(i,t={},e,r,n){if(Tt(e),i<0||i>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==r)throw new Error("salt must be undefined or "+r);if(c!==void 0&&c.length!==n)throw new Error("personalization must be undefined or "+n)}class Yf extends Xr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Tt(t),Tt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=or(this.buffer)}update(t){jt(this),t=ot(t),Qe(t);const{blockLen:e,buffer:r,buffer32:n}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(Bt(n),this.compress(n,0,!1),Bt(n),this.pos=0);const h=Math.min(e-this.pos,s-l),u=o+l;if(h===e&&!(u%4)&&l+h<s){const d=new Uint32Array(c,u,Math.floor((s-l)/4));Bt(d);for(let _=0;l+e<s;_+=n.length,l+=e)this.length+=e,this.compress(d,_,!1);Bt(d);continue}r.set(t.subarray(l,l+h),this.pos),this.pos+=h,this.length+=h,l+=h}return this}digestInto(t){jt(this),Zs(t,this);const{pos:e,buffer32:r}=this;this.finished=!0,Xe(this.buffer.subarray(e)),Bt(r),this.compress(r,0,!0),Bt(r);const n=or(t);this.get().forEach((s,o)=>n[o]=vt(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){const{buffer:e,length:r,finished:n,destroyed:s,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=n,t.length=r,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Zf extends Yf{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=_e[0]|0,this.v0h=_e[1]|0,this.v1l=_e[2]|0,this.v1h=_e[3]|0,this.v2l=_e[4]|0,this.v2h=_e[5]|0,this.v3l=_e[6]|0,this.v3h=_e[7]|0,this.v4l=_e[8]|0,this.v4h=_e[9]|0,this.v5l=_e[10]|0,this.v5h=_e[11]|0,this.v6l=_e[12]|0,this.v6h=_e[13]|0,this.v7l=_e[14]|0,this.v7h=_e[15]|0,Jf(e,t,64,16,16);let{key:r,personalization:n,salt:s}=t,o=0;if(r!==void 0&&(r=ot(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=ot(s);const c=or(s);this.v4l^=vt(c[0]),this.v4h^=vt(c[1]),this.v5l^=vt(c[2]),this.v5h^=vt(c[3])}if(n!==void 0){n=ot(n);const c=or(n);this.v6l^=vt(c[0]),this.v6h^=vt(c[1]),this.v7l^=vt(c[2]),this.v7h^=vt(c[3])}if(r!==void 0){const c=new Uint8Array(this.blockLen);c.set(r),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:r,v1h:n,v2l:s,v2h:o,v3l:c,v3h:l,v4l:h,v4h:u,v5l:d,v5h:_,v6l:p,v6h:f,v7l:w,v7h:g}=this;return[t,e,r,n,s,o,c,l,h,u,d,_,p,f,w,g]}set(t,e,r,n,s,o,c,l,h,u,d,_,p,f,w,g){this.v0l=t|0,this.v0h=e|0,this.v1l=r|0,this.v1h=n|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=h|0,this.v4h=u|0,this.v5l=d|0,this.v5h=_|0,this.v6l=p|0,this.v6h=f|0,this.v7l=w|0,this.v7h=g|0}compress(t,e,r){this.get().forEach((l,h)=>B[h]=l),B.set(_e,16);let{h:n,l:s}=gl(BigInt(this.length));B[24]=_e[8]^s,B[25]=_e[9]^n,r&&(B[28]=~B[28],B[29]=~B[29]);let o=0;const c=Gf;for(let l=0;l<12;l++)xt(0,4,8,12,t,e+2*c[o++]),St(0,4,8,12,t,e+2*c[o++]),xt(1,5,9,13,t,e+2*c[o++]),St(1,5,9,13,t,e+2*c[o++]),xt(2,6,10,14,t,e+2*c[o++]),St(2,6,10,14,t,e+2*c[o++]),xt(3,7,11,15,t,e+2*c[o++]),St(3,7,11,15,t,e+2*c[o++]),xt(0,5,10,15,t,e+2*c[o++]),St(0,5,10,15,t,e+2*c[o++]),xt(1,6,11,12,t,e+2*c[o++]),St(1,6,11,12,t,e+2*c[o++]),xt(2,7,8,13,t,e+2*c[o++]),St(2,7,8,13,t,e+2*c[o++]),xt(3,4,9,14,t,e+2*c[o++]),St(3,4,9,14,t,e+2*c[o++]);this.v0l^=B[0]^B[16],this.v0h^=B[1]^B[17],this.v1l^=B[2]^B[18],this.v1h^=B[3]^B[19],this.v2l^=B[4]^B[20],this.v2h^=B[5]^B[21],this.v3l^=B[6]^B[22],this.v3h^=B[7]^B[23],this.v4l^=B[8]^B[24],this.v4h^=B[9]^B[25],this.v5l^=B[10]^B[26],this.v5h^=B[11]^B[27],this.v6l^=B[12]^B[28],this.v6h^=B[13]^B[29],this.v7l^=B[14]^B[30],this.v7h^=B[15]^B[31],Xe(B)}destroy(){this.destroyed=!0,Xe(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Qf=Af(i=>new Zf(i)),Xf="https://rpc.walletconnect.org/v1";function Dl(i){const t=`Ethereum Signed Message:
4
4
  ${i.length}`,e=new TextEncoder().encode(t+i);return"0x"+ee.from($f(e)).toString("hex")}async function ew(i,t,e,r,n,s){switch(e.t){case"eip191":return await tw(i,t,e.s);case"eip1271":return await iw(i,t,e.s,r,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}async function tw(i,t,e){return(await ip({hash:Dl(t),signature:e})).toLowerCase()===i.toLowerCase()}async function iw(i,t,e,r,n,s){const o=Lr(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",h=e.substring(2),u=(h.length/2).toString(16).padStart(64,"0"),d=(t.startsWith("0x")?t:Dl(t)).substring(2),_=c+d+l+u+h,p=await fetch(`${s||Xf}/?chainId=${r}&projectId=${n}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:rw(),jsonrpc:"2.0",method:"eth_call",params:[{to:i,data:_},"latest"]})}),{result:f}=await p.json();return f?f.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function rw(){return Date.now()+Math.floor(Math.random()*1e3)}function nw(i){const t=atob(i),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);const r=e[0];if(r===0)throw new Error("No signatures found");const n=1+r*64;if(e.length<n)throw new Error("Transaction data too short for claimed signature count");if(e.length<100)throw new Error("Transaction too short");const s=ee.from(i,"base64").slice(1,65);return dr.encode(s)}function sw(i){const t=new Uint8Array(ee.from(i,"base64")),e=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length);const n=Qf(r,{dkLen:32});return dr.encode(n)}function Xo(i){const t=new Uint8Array(en(ow(i)));return dr.encode(t)}function ow(i){if(i instanceof Uint8Array)return i;if(Array.isArray(i))return new Uint8Array(i);if(typeof i=="object"&&i!=null&&i.data)return new Uint8Array(Object.values(i.data));if(typeof i=="object"&&i)return new Uint8Array(Object.values(i));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function ea(i){const t=ee.from(i,"base64"),e=kp(t).txn;if(!e)throw new Error("Invalid signed transaction: missing 'txn' field");const r=Rp(e),n=ee.from("TX"),s=ee.concat([n,ee.from(r)]),o=Wf(s);return Mh.encode(o).replace(/=+$/,"")}function mn(i){const t=[];let e=BigInt(i);for(;e>=BigInt(128);)t.push(Number(e&BigInt(127)|BigInt(128))),e>>=BigInt(7);return t.push(Number(e)),ee.from(t)}function aw(i){const t=ee.from(i.signed.bodyBytes,"base64"),e=ee.from(i.signed.authInfoBytes,"base64"),r=ee.from(i.signature.signature,"base64"),n=[];n.push(ee.from([10])),n.push(mn(t.length)),n.push(t),n.push(ee.from([18])),n.push(mn(e.length)),n.push(e),n.push(ee.from([26])),n.push(mn(r.length)),n.push(r);const s=ee.concat(n),o=en(s);return ee.from(o).toString("hex").toUpperCase()}var cw=Object.defineProperty,lw=Object.defineProperties,uw=Object.getOwnPropertyDescriptors,ta=Object.getOwnPropertySymbols,hw=Object.prototype.hasOwnProperty,dw=Object.prototype.propertyIsEnumerable,ia=(i,t,e)=>t in i?cw(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_w=(i,t)=>{for(var e in t||(t={}))hw.call(t,e)&&ia(i,e,t[e]);if(ta)for(var e of ta(t))dw.call(t,e)&&ia(i,e,t[e]);return i},pw=(i,t)=>lw(i,uw(t));const fw="did:pkh:",eo=i=>i==null?void 0:i.split(":"),ww=i=>{const t=i&&eo(i);if(t)return i.includes(fw)?t[3]:t[1]},Zn=i=>{const t=i&&eo(i);if(t)return t[2]+":"+t[3]},Kr=i=>{const t=i&&eo(i);if(t)return t.pop()};async function ra(i){const{cacao:t,projectId:e}=i,{s:r,p:n}=t,s=Ll(n,n.iss),o=Kr(n.iss);return await ew(o,s,r,Zn(n.iss),e)}const Ll=(i,t)=>{const e=`${i.domain} wants you to sign in with your Ethereum account:`,r=Kr(t);if(!i.aud&&!i.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=i.statement||void 0;const s=`URI: ${i.aud||i.uri}`,o=`Version: ${i.version}`,c=`Chain ID: ${ww(t)}`,l=`Nonce: ${i.nonce}`,h=`Issued At: ${i.iat}`,u=i.exp?`Expiration Time: ${i.exp}`:void 0,d=i.nbf?`Not Before: ${i.nbf}`:void 0,_=i.requestId?`Request ID: ${i.requestId}`:void 0,p=i.resources?`Resources:${i.resources.map(w=>`
5
5
  - ${w}`).join("")}`:void 0,f=Vr(i.resources);if(f){const w=cr(f);n=Pw(n,w)}return[e,r,"",n,"",s,o,c,l,h,u,d,_,p].filter(w=>w!=null).join(`
6
6
  `)};function gw(i){return ee.from(JSON.stringify(i)).toString("base64")}function mw(i){return JSON.parse(ee.from(i,"base64").toString("utf-8"))}function ni(i){if(!i)throw new Error("No recap provided, value is undefined");if(!i.att)throw new Error("No `att` property found");const t=Object.keys(i.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(e=>{const r=i.att[e];if(Array.isArray(r))throw new Error(`Resource must be an object: ${e}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(r).forEach(n=>{const s=r[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${o}`)})})})}function Ew(i,t,e,r={}){return e==null||e.sort((n,s)=>n.localeCompare(s)),{att:{[i]:yw(t,e,r)}}}function yw(i,t,e={}){t=t==null?void 0:t.sort((n,s)=>n.localeCompare(s));const r=t.map(n=>({[`${i}/${n}`]:[e]}));return Object.assign({},...r)}function Vl(i){return ni(i),`urn:recap:${gw(i).replace(/=/g,"")}`}function cr(i){const t=mw(i.replace("urn:recap:",""));return ni(t),t}function vw(i,t,e){const r=Ew(i,t,e);return Vl(r)}function bw(i){return i&&i.includes("urn:recap:")}function Iw(i,t){const e=cr(i),r=cr(t),n=Aw(e,r);return Vl(n)}function Aw(i,t){ni(i),ni(t);const e=Object.keys(i.att).concat(Object.keys(t.att)).sort((n,s)=>n.localeCompare(s)),r={att:{}};return e.forEach(n=>{var s,o;Object.keys(((s=i.att)==null?void 0:s[n])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[n])||{})).sort((c,l)=>c.localeCompare(l)).forEach(c=>{var l,h;r.att[n]=pw(_w({},r.att[n]),{[c]:((l=i.att[n])==null?void 0:l[c])||((h=t.att[n])==null?void 0:h[c])})})}),r}function Pw(i="",t){ni(t);const e="I further authorize the stated URI to perform the following actions on my behalf: ";if(i.includes(e))return i;const r=[];let n=0;Object.keys(t.att).forEach(c=>{const l=Object.keys(t.att[c]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));l.sort((d,_)=>d.action.localeCompare(_.action));const h={};l.forEach(d=>{h[d.ability]||(h[d.ability]=[]),h[d.ability].push(d.action)});const u=Object.keys(h).map(d=>(n++,`(${n}) '${d}': '${h[d].join("', '")}' for '${c}'.`));r.push(u.join(", ").replace(".,","."))});const s=r.join(" "),o=`${e}${s}`;return`${i?i+" ":""}${o}`}function na(i){var t;const e=cr(i);ni(e);const r=(t=e.att)==null?void 0:t.eip155;return r?Object.keys(r).map(n=>n.split("/")[1]):[]}function sa(i){const t=cr(i);ni(t);const e=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(n=>{var s;(s=n==null?void 0:n[0])!=null&&s.chains&&e.push(n[0].chains)})}),[...new Set(e.flat())]}function Vr(i){if(!i)return;const t=i==null?void 0:i[i.length-1];return bw(t)?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function xl(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Qn(i){if(typeof i!="boolean")throw new Error(`boolean expected, not ${i}`)}function En(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function Ce(i,...t){if(!xl(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function oa(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function Tw(i,t){Ce(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function zt(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function Ei(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function Ow(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}const Rw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Dw(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function Xn(i){if(typeof i=="string")i=Dw(i);else if(xl(i))i=es(i);else throw new Error("Uint8Array expected, got "+typeof i);return i}function Lw(i,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(i,t)}function Vw(i,t){if(i.length!==t.length)return!1;let e=0;for(let r=0;r<i.length;r++)e|=i[r]^t[r];return e===0}const xw=(i,t)=>{function e(r,...n){if(Ce(r),!Rw)throw new Error("Non little-endian hardware is not yet supported");if(i.nonceLength!==void 0){const h=n[0];if(!h)throw new Error("nonce / iv required");i.varSizeNonce?Ce(h):Ce(h,i.nonceLength)}const s=i.tagLength;s&&n[1]!==void 0&&Ce(n[1]);const o=t(r,...n),c=(h,u)=>{if(u!==void 0){if(h!==2)throw new Error("cipher output not supported");Ce(u)}};let l=!1;return{encrypt(h,u){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,Ce(h),c(o.encrypt.length,u),o.encrypt(h,u)},decrypt(h,u){if(Ce(h),s&&h.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(o.decrypt.length,u),o.decrypt(h,u)}}}return Object.assign(e,i),e};function aa(i,t,e=!0){if(t===void 0)return new Uint8Array(i);if(t.length!==i)throw new Error("invalid output length, expected "+i+", got: "+t.length);if(e&&!Cw(t))throw new Error("invalid output, must be aligned");return t}function ca(i,t,e,r){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,r);const n=BigInt(32),s=BigInt(4294967295),o=Number(e>>n&s),c=Number(e&s),l=r?4:0,h=r?0:4;i.setUint32(t+l,o,r),i.setUint32(t+h,c,r)}function Sw(i,t,e){Qn(e);const r=new Uint8Array(16),n=Ow(r);return ca(n,0,BigInt(t),e),ca(n,8,BigInt(i),e),r}function Cw(i){return i.byteOffset%4===0}function es(i){return Uint8Array.from(i)}const Sl=i=>Uint8Array.from(i.split("").map(t=>t.charCodeAt(0))),$w=Sl("expand 16-byte k"),kw=Sl("expand 32-byte k"),Nw=zt($w),Uw=zt(kw);function Y(i,t){return i<<t|i>>>32-t}function ts(i){return i.byteOffset%4===0}const Ar=64,Bw=16,Cl=2**32-1,la=new Uint32Array;function Fw(i,t,e,r,n,s,o,c){const l=n.length,h=new Uint8Array(Ar),u=zt(h),d=ts(n)&&ts(s),_=d?zt(n):la,p=d?zt(s):la;for(let f=0;f<l;o++){if(i(t,e,r,u,o,c),o>=Cl)throw new Error("arx: counter overflow");const w=Math.min(Ar,l-f);if(d&&w===Ar){const g=f/4;if(f%4!==0)throw new Error("arx: invalid block position");for(let I=0,T;I<Bw;I++)T=g+I,p[T]=_[T]^u[I];f+=Ar;continue}for(let g=0,I;g<w;g++)I=f+g,s[I]=n[I]^h[g];f+=w}}function qw(i,t){const{allowShortKeys:e,extendNonceFn:r,counterLength:n,counterRight:s,rounds:o}=Lw({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof i!="function")throw new Error("core must be a function");return En(n),En(o),Qn(s),Qn(e),(c,l,h,u,d=0)=>{Ce(c),Ce(l),Ce(h);const _=h.length;if(u===void 0&&(u=new Uint8Array(_)),Ce(u),En(d),d<0||d>=Cl)throw new Error("arx: counter overflow");if(u.length<_)throw new Error(`arx: output (${u.length}) is shorter than data (${_})`);const p=[];let f=c.length,w,g;if(f===32)p.push(w=es(c)),g=Uw;else if(f===16&&e)w=new Uint8Array(32),w.set(c),w.set(c,16),g=Nw,p.push(w);else throw new Error(`arx: invalid 32-byte key, got length=${f}`);ts(l)||p.push(l=es(l));const I=zt(w);if(r){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(g,I,zt(l.subarray(0,16)),I),l=l.subarray(16)}const T=16-n;if(T!==l.length)throw new Error(`arx: nonce must be ${T} or 16 bytes`);if(T!==12){const v=new Uint8Array(12);v.set(l,s?0:12-l.length),l=v,p.push(l)}const y=zt(l);return Fw(i,g,I,y,h,u,d,o),Ei(...p),u}}const ge=(i,t)=>i[t++]&255|(i[t++]&255)<<8;class Mw{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=Xn(t),Ce(t,32);const e=ge(t,0),r=ge(t,2),n=ge(t,4),s=ge(t,6),o=ge(t,8),c=ge(t,10),l=ge(t,12),h=ge(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|r<<3)&8191,this.r[2]=(r>>>10|n<<6)&7939,this.r[3]=(n>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|c<<2)&8191,this.r[7]=(c>>>11|l<<5)&8065,this.r[8]=(l>>>8|h<<8)&8191,this.r[9]=h>>>5&127;for(let u=0;u<8;u++)this.pad[u]=ge(t,16+2*u)}process(t,e,r=!1){const n=r?0:2048,{h:s,r:o}=this,c=o[0],l=o[1],h=o[2],u=o[3],d=o[4],_=o[5],p=o[6],f=o[7],w=o[8],g=o[9],I=ge(t,e+0),T=ge(t,e+2),y=ge(t,e+4),v=ge(t,e+6),b=ge(t,e+8),D=ge(t,e+10),N=ge(t,e+12),S=ge(t,e+14);let m=s[0]+(I&8191),P=s[1]+((I>>>13|T<<3)&8191),E=s[2]+((T>>>10|y<<6)&8191),A=s[3]+((y>>>7|v<<9)&8191),O=s[4]+((v>>>4|b<<12)&8191),V=s[5]+(b>>>1&8191),x=s[6]+((b>>>14|D<<2)&8191),C=s[7]+((D>>>11|N<<5)&8191),$=s[8]+((N>>>8|S<<8)&8191),F=s[9]+(S>>>5|n),L=0,M=L+m*c+P*(5*g)+E*(5*w)+A*(5*f)+O*(5*p);L=M>>>13,M&=8191,M+=V*(5*_)+x*(5*d)+C*(5*u)+$*(5*h)+F*(5*l),L+=M>>>13,M&=8191;let q=L+m*l+P*c+E*(5*g)+A*(5*w)+O*(5*f);L=q>>>13,q&=8191,q+=V*(5*p)+x*(5*_)+C*(5*d)+$*(5*u)+F*(5*h),L+=q>>>13,q&=8191;let z=L+m*h+P*l+E*c+A*(5*g)+O*(5*w);L=z>>>13,z&=8191,z+=V*(5*f)+x*(5*p)+C*(5*_)+$*(5*d)+F*(5*u),L+=z>>>13,z&=8191;let H=L+m*u+P*h+E*l+A*c+O*(5*g);L=H>>>13,H&=8191,H+=V*(5*w)+x*(5*f)+C*(5*p)+$*(5*_)+F*(5*d),L+=H>>>13,H&=8191;let K=L+m*d+P*u+E*h+A*l+O*c;L=K>>>13,K&=8191,K+=V*(5*g)+x*(5*w)+C*(5*f)+$*(5*p)+F*(5*_),L+=K>>>13,K&=8191;let W=L+m*_+P*d+E*u+A*h+O*l;L=W>>>13,W&=8191,W+=V*c+x*(5*g)+C*(5*w)+$*(5*f)+F*(5*p),L+=W>>>13,W&=8191;let ie=L+m*p+P*_+E*d+A*u+O*h;L=ie>>>13,ie&=8191,ie+=V*l+x*c+C*(5*g)+$*(5*w)+F*(5*f),L+=ie>>>13,ie&=8191;let ue=L+m*f+P*p+E*_+A*d+O*u;L=ue>>>13,ue&=8191,ue+=V*h+x*l+C*c+$*(5*g)+F*(5*w),L+=ue>>>13,ue&=8191;let ce=L+m*w+P*f+E*p+A*_+O*d;L=ce>>>13,ce&=8191,ce+=V*u+x*h+C*l+$*c+F*(5*g),L+=ce>>>13,ce&=8191;let oe=L+m*g+P*w+E*f+A*p+O*_;L=oe>>>13,oe&=8191,oe+=V*d+x*u+C*h+$*l+F*c,L+=oe>>>13,oe&=8191,L=(L<<2)+L|0,L=L+M|0,M=L&8191,L=L>>>13,q+=L,s[0]=M,s[1]=q,s[2]=z,s[3]=H,s[4]=K,s[5]=W,s[6]=ie,s[7]=ue,s[8]=ce,s[9]=oe}finalize(){const{h:t,pad:e}=this,r=new Uint16Array(10);let n=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=n,n=t[c]>>>13,t[c]&=8191;t[0]+=n*5,n=t[0]>>>13,t[0]&=8191,t[1]+=n,n=t[1]>>>13,t[1]&=8191,t[2]+=n,r[0]=t[0]+5,n=r[0]>>>13,r[0]&=8191;for(let c=1;c<10;c++)r[c]=t[c]+n,n=r[c]>>>13,r[c]&=8191;r[9]-=8192;let s=(n^1)-1;for(let c=0;c<10;c++)r[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|r[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+e[0];t[0]=o&65535;for(let c=1;c<8;c++)o=(t[c]+e[c]|0)+(o>>>16)|0,t[c]=o&65535;Ei(r)}update(t){oa(this),t=Xn(t),Ce(t);const{buffer:e,blockLen:r}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(r-this.pos,n-s);if(o===r){for(;r<=n-s;s+=r)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===r&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){Ei(this.h,this.r,this.buffer,this.pad)}digestInto(t){oa(this),Tw(t,this),this.finished=!0;const{buffer:e,h:r}=this;let{pos:n}=this;if(n){for(e[n++]=1;n<16;n++)e[n]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=r[o]>>>0,t[s++]=r[o]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}}function zw(i){const t=(r,n)=>i(n).update(Xn(r)).digest(),e=i(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>i(r),t}const jw=zw(i=>new Mw(i));function Kw(i,t,e,r,n,s=20){let o=i[0],c=i[1],l=i[2],h=i[3],u=t[0],d=t[1],_=t[2],p=t[3],f=t[4],w=t[5],g=t[6],I=t[7],T=n,y=e[0],v=e[1],b=e[2],D=o,N=c,S=l,m=h,P=u,E=d,A=_,O=p,V=f,x=w,C=g,$=I,F=T,L=y,M=v,q=b;for(let H=0;H<s;H+=2)D=D+P|0,F=Y(F^D,16),V=V+F|0,P=Y(P^V,12),D=D+P|0,F=Y(F^D,8),V=V+F|0,P=Y(P^V,7),N=N+E|0,L=Y(L^N,16),x=x+L|0,E=Y(E^x,12),N=N+E|0,L=Y(L^N,8),x=x+L|0,E=Y(E^x,7),S=S+A|0,M=Y(M^S,16),C=C+M|0,A=Y(A^C,12),S=S+A|0,M=Y(M^S,8),C=C+M|0,A=Y(A^C,7),m=m+O|0,q=Y(q^m,16),$=$+q|0,O=Y(O^$,12),m=m+O|0,q=Y(q^m,8),$=$+q|0,O=Y(O^$,7),D=D+E|0,q=Y(q^D,16),C=C+q|0,E=Y(E^C,12),D=D+E|0,q=Y(q^D,8),C=C+q|0,E=Y(E^C,7),N=N+A|0,F=Y(F^N,16),$=$+F|0,A=Y(A^$,12),N=N+A|0,F=Y(F^N,8),$=$+F|0,A=Y(A^$,7),S=S+O|0,L=Y(L^S,16),V=V+L|0,O=Y(O^V,12),S=S+O|0,L=Y(L^S,8),V=V+L|0,O=Y(O^V,7),m=m+P|0,M=Y(M^m,16),x=x+M|0,P=Y(P^x,12),m=m+P|0,M=Y(M^m,8),x=x+M|0,P=Y(P^x,7);let z=0;r[z++]=o+D|0,r[z++]=c+N|0,r[z++]=l+S|0,r[z++]=h+m|0,r[z++]=u+P|0,r[z++]=d+E|0,r[z++]=_+A|0,r[z++]=p+O|0,r[z++]=f+V|0,r[z++]=w+x|0,r[z++]=g+C|0,r[z++]=I+$|0,r[z++]=T+F|0,r[z++]=y+L|0,r[z++]=v+M|0,r[z++]=b+q|0}const Hw=qw(Kw,{counterRight:!1,counterLength:4,allowShortKeys:!1}),Ww=new Uint8Array(16),ua=(i,t)=>{i.update(t);const e=t.length%16;e&&i.update(Ww.subarray(e))},Gw=new Uint8Array(32);function ha(i,t,e,r,n){const s=i(t,e,Gw),o=jw.create(s);n&&ua(o,n),ua(o,r);const c=Sw(r.length,n?n.length:0,!0);o.update(c);const l=o.digest();return Ei(s,c),l}const Jw=i=>(t,e,r)=>({encrypt(n,s){const o=n.length;s=aa(o+16,s,!1),s.set(n);const c=s.subarray(0,-16);i(t,e,c,c,1);const l=ha(i,t,e,c,r);return s.set(l,o),Ei(l),s},decrypt(n,s){s=aa(n.length-16,s,!1);const o=n.subarray(0,-16),c=n.subarray(-16),l=ha(i,t,e,o,r);if(!Vw(c,l))throw new Error("invalid tag");return s.set(n.subarray(0,-16)),i(t,e,s,s,1),Ei(l),s}}),$l=xw({blockSize:64,nonceLength:12,tagLength:16},Jw(Hw));let kl=class extends Xr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Ys(t);const r=ot(e);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 n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),Xe(s)}update(t){return jt(this),this.iHash.update(t),this}digestInto(t){jt(this),Qe(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:e,iHash:r,finished:n,destroyed:s,blockLen:o,outputLen:c}=this;return t=t,t.finished=n,t.destroyed=s,t.blockLen=o,t.outputLen=c,t.oHash=e._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 tn=(i,t,e)=>new kl(i,t).update(e).digest();tn.create=(i,t)=>new kl(i,t);function Yw(i,t,e){return Ys(i),e===void 0&&(e=new Uint8Array(i.outputLen)),tn(i,ot(e),ot(t))}const yn=Uint8Array.from([0]),da=Uint8Array.of();function Zw(i,t,e,r=32){Ys(i),Tt(r);const n=i.outputLen;if(r>255*n)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(r/n);e===void 0&&(e=da);const o=new Uint8Array(s*n),c=tn.create(i,t),l=c._cloneInto(),h=new Uint8Array(c.outputLen);for(let u=0;u<s;u++)yn[0]=u+1,l.update(u===0?da:h).update(e).update(yn).digestInto(h),o.set(h,n*u),c._cloneInto(l);return c.destroy(),l.destroy(),Xe(h,yn),o.slice(0,r)}const Qw=(i,t,e,r,n)=>Zw(i,Yw(i,t,e),r,n),rn=en,to=BigInt(0),is=BigInt(1);function Hr(i,t){if(typeof t!="boolean")throw new Error(i+" boolean expected, got "+t)}function Pr(i){const t=i.toString(16);return t.length&1?"0"+t:t}function Nl(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return i===""?to:BigInt("0x"+i)}function nn(i){return Nl(ar(i))}function Wr(i){return Qe(i),Nl(ar(Uint8Array.from(i).reverse()))}function io(i,t){return Qs(i.toString(16).padStart(t*2,"0"))}function ro(i,t){return io(i,t).reverse()}function Se(i,t,e){let r;if(typeof t=="string")try{r=Qs(t)}catch(s){throw new Error(i+" must be hex string or Uint8Array, cause: "+s)}else if(Js(t))r=Uint8Array.from(t);else throw new Error(i+" must be hex string or Uint8Array");const n=r.length;if(typeof e=="number"&&n!==e)throw new Error(i+" of length "+e+" expected, got "+n);return r}const vn=i=>typeof i=="bigint"&&to<=i;function Xw(i,t,e){return vn(i)&&vn(t)&&vn(e)&&t<=i&&i<e}function rs(i,t,e,r){if(!Xw(t,e,r))throw new Error("expected valid "+i+": "+e+" <= n < "+r+", got "+t)}function e0(i){let t;for(t=0;i>to;i>>=is,t+=1);return t}const sn=i=>(is<<BigInt(i))-is;function t0(i,t,e){if(typeof i!="number"||i<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 e!="function")throw new Error("hmacFn must be a function");const r=_=>new Uint8Array(_),n=_=>Uint8Array.of(_);let s=r(i),o=r(i),c=0;const l=()=>{s.fill(1),o.fill(0),c=0},h=(..._)=>e(o,s,..._),u=(_=r(0))=>{o=h(n(0),_),s=h(),_.length!==0&&(o=h(n(1),_),s=h())},d=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let _=0;const p=[];for(;_<t;){s=h();const f=s.slice();p.push(f),_+=s.length}return Qt(...p)};return(_,p)=>{l(),u(_);let f;for(;!(f=p(d()));)u();return l(),f}}function on(i,t,e={}){if(!i||typeof i!="object")throw new Error("expected valid options object");function r(n,s,o){const c=i[n];if(o&&c===void 0)return;const l=typeof c;if(l!==s||c===null)throw new Error(`param "${n}" is invalid: expected ${s}, got ${l}`)}Object.entries(t).forEach(([n,s])=>r(n,s,!1)),Object.entries(e).forEach(([n,s])=>r(n,s,!0))}function _a(i){const t=new WeakMap;return(e,...r)=>{const n=t.get(e);if(n!==void 0)return n;const s=i(e,...r);return t.set(e,s),s}}const ke=BigInt(0),Re=BigInt(1),Xt=BigInt(2),i0=BigInt(3),Ul=BigInt(4),Bl=BigInt(5),Fl=BigInt(8);function Je(i,t){const e=i%t;return e>=ke?e:t+e}function tt(i,t,e){let r=i;for(;t-- >ke;)r*=r,r%=e;return r}function pa(i,t){if(i===ke)throw new Error("invert: expected non-zero number");if(t<=ke)throw new Error("invert: expected positive modulus, got "+t);let e=Je(i,t),r=t,n=ke,s=Re;for(;e!==ke;){const o=r/e,c=r%e,l=n-s*o;r=e,e=c,n=s,s=l}if(r!==Re)throw new Error("invert: does not exist");return Je(n,t)}function ql(i,t){const e=(i.ORDER+Re)/Ul,r=i.pow(t,e);if(!i.eql(i.sqr(r),t))throw new Error("Cannot find square root");return r}function r0(i,t){const e=(i.ORDER-Bl)/Fl,r=i.mul(t,Xt),n=i.pow(r,e),s=i.mul(t,n),o=i.mul(i.mul(s,Xt),n),c=i.mul(s,i.sub(o,i.ONE));if(!i.eql(i.sqr(c),t))throw new Error("Cannot find square root");return c}function n0(i){if(i<BigInt(3))throw new Error("sqrt is not defined for small field");let t=i-Re,e=0;for(;t%Xt===ke;)t/=Xt,e++;let r=Xt;const n=Vi(i);for(;fa(n,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return ql;let s=n.pow(r,t);const o=(t+Re)/Xt;return function(c,l){if(c.is0(l))return l;if(fa(c,l)!==1)throw new Error("Cannot find square root");let h=e,u=c.mul(c.ONE,s),d=c.pow(l,t),_=c.pow(l,o);for(;!c.eql(d,c.ONE);){if(c.is0(d))return c.ZERO;let p=1,f=c.sqr(d);for(;!c.eql(f,c.ONE);)if(p++,f=c.sqr(f),p===h)throw new Error("Cannot find square root");const w=Re<<BigInt(h-p-1),g=c.pow(u,w);h=p,u=c.sqr(g),d=c.mul(d,u),_=c.mul(_,g)}return _}}function s0(i){return i%Ul===i0?ql:i%Fl===Bl?r0:n0(i)}const o0=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function a0(i){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=o0.reduce((r,n)=>(r[n]="function",r),t);return on(i,e),i}function c0(i,t,e){if(e<ke)throw new Error("invalid exponent, negatives unsupported");if(e===ke)return i.ONE;if(e===Re)return t;let r=i.ONE,n=t;for(;e>ke;)e&Re&&(r=i.mul(r,n)),n=i.sqr(n),e>>=Re;return r}function Ml(i,t,e=!1){const r=new Array(t.length).fill(e?i.ZERO:void 0),n=t.reduce((o,c,l)=>i.is0(c)?o:(r[l]=o,i.mul(o,c)),i.ONE),s=i.inv(n);return t.reduceRight((o,c,l)=>i.is0(c)?o:(r[l]=i.mul(o,r[l]),i.mul(o,c)),s),r}function fa(i,t){const e=(i.ORDER-Re)/Xt,r=i.pow(t,e),n=i.eql(r,i.ONE),s=i.eql(r,i.ZERO),o=i.eql(r,i.neg(i.ONE));if(!n&&!s&&!o)throw new Error("invalid Legendre symbol result");return n?1:s?0:-1}function l0(i,t){t!==void 0&&Tt(t);const e=t!==void 0?t:i.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function Vi(i,t,e=!1,r={}){if(i<=ke)throw new Error("invalid field: expected ORDER > 0, got "+i);let n,s;if(typeof t=="object"&&t!=null){if(r.sqrt||e)throw new Error("cannot specify opts in two arguments");const u=t;u.BITS&&(n=u.BITS),u.sqrt&&(s=u.sqrt),typeof u.isLE=="boolean"&&(e=u.isLE)}else typeof t=="number"&&(n=t),r.sqrt&&(s=r.sqrt);const{nBitLength:o,nByteLength:c}=l0(i,n);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const h=Object.freeze({ORDER:i,isLE:e,BITS:o,BYTES:c,MASK:sn(o),ZERO:ke,ONE:Re,create:u=>Je(u,i),isValid:u=>{if(typeof u!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof u);return ke<=u&&u<i},is0:u=>u===ke,isValidNot0:u=>!h.is0(u)&&h.isValid(u),isOdd:u=>(u&Re)===Re,neg:u=>Je(-u,i),eql:(u,d)=>u===d,sqr:u=>Je(u*u,i),add:(u,d)=>Je(u+d,i),sub:(u,d)=>Je(u-d,i),mul:(u,d)=>Je(u*d,i),pow:(u,d)=>c0(h,u,d),div:(u,d)=>Je(u*pa(d,i),i),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>pa(u,i),sqrt:s||(u=>(l||(l=s0(i)),l(h,u))),toBytes:u=>e?ro(u,c):io(u,c),fromBytes:u=>{if(u.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+u.length);return e?Wr(u):nn(u)},invertBatch:u=>Ml(h,u),cmov:(u,d,_)=>_?d:u});return Object.freeze(h)}function zl(i){if(typeof i!="bigint")throw new Error("field order must be bigint");const t=i.toString(2).length;return Math.ceil(t/8)}function jl(i){const t=zl(i);return t+Math.ceil(t/2)}function u0(i,t,e=!1){const r=i.length,n=zl(t),s=jl(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=e?Wr(i):nn(i),c=Je(o,t-Re)+Re;return e?ro(c,n):io(c,n)}const yi=BigInt(0),ei=BigInt(1);function Yi(i,t){const e=t.negate();return i?e:t}function h0(i,t,e){const r=t==="pz"?s=>s.pz:s=>s.ez,n=Ml(i.Fp,e.map(r));return e.map((s,o)=>s.toAffine(n[o])).map(i.fromAffine)}function Kl(i,t){if(!Number.isSafeInteger(i)||i<=0||i>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+i)}function bn(i,t){Kl(i,t);const e=Math.ceil(t/i)+1,r=2**(i-1),n=2**i,s=sn(i),o=BigInt(i);return{windows:e,windowSize:r,mask:s,maxNumber:n,shiftBy:o}}function wa(i,t,e){const{windowSize:r,mask:n,maxNumber:s,shiftBy:o}=e;let c=Number(i&n),l=i>>o;c>r&&(c-=s,l+=ei);const h=t*r,u=h+Math.abs(c)-1,d=c===0,_=c<0,p=t%2!==0;return{nextN:l,offset:u,isZero:d,isNeg:_,isNegF:p,offsetF:h}}function d0(i,t){if(!Array.isArray(i))throw new Error("array expected");i.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}function _0(i,t){if(!Array.isArray(i))throw new Error("array of scalars expected");i.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}const In=new WeakMap,Hl=new WeakMap;function An(i){return Hl.get(i)||1}function ga(i){if(i!==yi)throw new Error("invalid wNAF")}function p0(i,t){return{constTimeNegate:Yi,hasPrecomputes(e){return An(e)!==1},unsafeLadder(e,r,n=i.ZERO){let s=e;for(;r>yi;)r&ei&&(n=n.add(s)),s=s.double(),r>>=ei;return n},precomputeWindow(e,r){const{windows:n,windowSize:s}=bn(r,t),o=[];let c=e,l=c;for(let h=0;h<n;h++){l=c,o.push(l);for(let u=1;u<s;u++)l=l.add(c),o.push(l);c=l.double()}return o},wNAF(e,r,n){let s=i.ZERO,o=i.BASE;const c=bn(e,t);for(let l=0;l<c.windows;l++){const{nextN:h,offset:u,isZero:d,isNeg:_,isNegF:p,offsetF:f}=wa(n,l,c);n=h,d?o=o.add(Yi(p,r[f])):s=s.add(Yi(_,r[u]))}return ga(n),{p:s,f:o}},wNAFUnsafe(e,r,n,s=i.ZERO){const o=bn(e,t);for(let c=0;c<o.windows&&n!==yi;c++){const{nextN:l,offset:h,isZero:u,isNeg:d}=wa(n,c,o);if(n=l,!u){const _=r[h];s=s.add(d?_.negate():_)}}return ga(n),s},getPrecomputes(e,r,n){let s=In.get(r);return s||(s=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(s=n(s)),In.set(r,s))),s},wNAFCached(e,r,n){const s=An(e);return this.wNAF(s,this.getPrecomputes(s,e,n),r)},wNAFCachedUnsafe(e,r,n,s){const o=An(e);return o===1?this.unsafeLadder(e,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),r,s)},setWindowSize(e,r){Kl(r,t),Hl.set(e,r),In.delete(e)}}}function f0(i,t,e,r){let n=t,s=i.ZERO,o=i.ZERO;for(;e>yi||r>yi;)e&ei&&(s=s.add(n)),r&ei&&(o=o.add(n)),n=n.double(),e>>=ei,r>>=ei;return{p1:s,p2:o}}function w0(i,t,e,r){d0(e,i),_0(r,t);const n=e.length,s=r.length;if(n!==s)throw new Error("arrays of points and scalars must have equal length");const o=i.ZERO,c=e0(BigInt(n));let l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);const h=sn(l),u=new Array(Number(h)+1).fill(o),d=Math.floor((t.BITS-1)/l)*l;let _=o;for(let p=d;p>=0;p-=l){u.fill(o);for(let w=0;w<s;w++){const g=r[w],I=Number(g>>BigInt(p)&h);u[I]=u[I].add(e[w])}let f=o;for(let w=u.length-1,g=o;w>0;w--)g=g.add(u[w]),f=f.add(g);if(_=_.add(f),p!==0)for(let w=0;w<l;w++)_=_.double()}return _}function ma(i,t){if(t){if(t.ORDER!==i)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return a0(t),t}else return Vi(i)}function g0(i,t,e={}){if(!t||typeof t!="object")throw new Error(`expected valid ${i} CURVE object`);for(const o of["p","n","h"]){const c=t[o];if(!(typeof c=="bigint"&&c>yi))throw new Error(`CURVE.${o} must be positive bigint`)}const r=ma(t.p,e.Fp),n=ma(t.n,e.Fn),s=["Gx","Gy","a",i==="weierstrass"?"b":"d"];for(const o of s)if(!r.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return{Fp:r,Fn:n}}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const Ui=BigInt(0),di=BigInt(1),Tr=BigInt(2);function m0(i){return on(i,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...i})}function E0(i){const t=m0(i),{P:e,type:r,adjustScalarBytes:n,powPminus2:s,randomBytes:o}=t,c=r==="x25519";if(!c&&r!=="x448")throw new Error("invalid type");const l=o||Li,h=c?255:448,u=c?32:56,d=BigInt(c?9:5),_=BigInt(c?121665:39081),p=c?Tr**BigInt(254):Tr**BigInt(447),f=c?BigInt(8)*Tr**BigInt(251)-di:BigInt(4)*Tr**BigInt(445)-di,w=p+f+di,g=m=>Je(m,e),I=T(d);function T(m){return ro(g(m),u)}function y(m){const P=Se("u coordinate",m,u);return c&&(P[31]&=127),g(Wr(P))}function v(m){return Wr(n(Se("scalar",m,u)))}function b(m,P){const E=S(y(P),v(m));if(E===Ui)throw new Error("invalid private or public key received");return T(E)}function D(m){return b(m,I)}function N(m,P,E){const A=g(m*(P-E));return P=g(P-A),E=g(E+A),{x_2:P,x_3:E}}function S(m,P){rs("u",m,Ui,e),rs("scalar",P,p,w);const E=P,A=m;let O=di,V=Ui,x=m,C=di,$=Ui;for(let L=BigInt(h-1);L>=Ui;L--){const M=E>>L&di;$^=M,{x_2:O,x_3:x}=N($,O,x),{x_2:V,x_3:C}=N($,V,C),$=M;const q=O+V,z=g(q*q),H=O-V,K=g(H*H),W=z-K,ie=x+C,ue=x-C,ce=g(ue*q),oe=g(ie*H),je=ce+oe,gt=ce-oe;x=g(je*je),C=g(A*g(gt*gt)),O=g(z*K),V=g(W*(z+g(_*W)))}({x_2:O,x_3:x}=N($,O,x)),{x_2:V,x_3:C}=N($,V,C);const F=s(V);return g(O*F)}return{scalarMult:b,scalarMultBase:D,getSharedSecret:(m,P)=>b(m,P),getPublicKey:m=>D(m),utils:{randomPrivateKey:()=>l(u)},GuBytes:I.slice()}}BigInt(0);const y0=BigInt(1),Ea=BigInt(2),v0=BigInt(3),b0=BigInt(5),I0=BigInt(8),Wl={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:I0,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function A0(i){const t=BigInt(10),e=BigInt(20),r=BigInt(40),n=BigInt(80),s=Wl.p,o=i*i%s*i%s,c=tt(o,Ea,s)*o%s,l=tt(c,y0,s)*i%s,h=tt(l,b0,s)*l%s,u=tt(h,t,s)*h%s,d=tt(u,e,s)*u%s,_=tt(d,r,s)*d%s,p=tt(_,n,s)*_%s,f=tt(p,n,s)*_%s,w=tt(f,t,s)*h%s;return{pow_p_5_8:tt(w,Ea,s)*i%s,b2:o}}function P0(i){return i[0]&=248,i[31]&=127,i[31]|=64,i}const ns=(()=>{const i=Wl.p;return E0({P:i,type:"x25519",powPminus2:t=>{const{pow_p_5_8:e,b2:r}=A0(t);return Je(tt(e,v0,i)*r,i)},adjustScalarBytes:P0})})();function ya(i){i.lowS!==void 0&&Hr("lowS",i.lowS),i.prehash!==void 0&&Hr("prehash",i.prehash)}class T0 extends Error{constructor(t=""){super(t)}}const It={Err:T0,_tlv:{encode:(i,t)=>{const{Err:e}=It;if(i<0||i>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,n=Pr(r);if(n.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?Pr(n.length/2|128):"";return Pr(i)+s+n+t},decode(i,t){const{Err:e}=It;let r=0;if(i<0||i>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==i)throw new e("tlv.decode: wrong tlv");const n=t[r++],s=!!(n&128);let o=0;if(!s)o=n;else{const l=n&127;if(!l)throw new e("tlv.decode(long): indefinite length not supported");if(l>4)throw new e("tlv.decode(long): byte length is too big");const h=t.subarray(r,r+l);if(h.length!==l)throw new e("tlv.decode: length bytes not complete");if(h[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const u of h)o=o<<8|u;if(r+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+o);if(c.length!==o)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+o)}}},_int:{encode(i){const{Err:t}=It;if(i<Zi)throw new t("integer: negative integers are not allowed");let e=Pr(i);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(i){const{Err:t}=It;if(i[0]&128)throw new t("invalid signature integer: negative");if(i[0]===0&&!(i[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return nn(i)}},toSig(i){const{Err:t,_int:e,_tlv:r}=It,n=Se("signature",i),{v:s,l:o}=r.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l}=r.decode(2,s),{v:h,l:u}=r.decode(2,l);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(c),s:e.decode(h)}},hexFromSig(i){const{_tlv:t,_int:e}=It,r=t.encode(2,e.encode(i.r)),n=t.encode(2,e.encode(i.s)),s=r+n;return t.encode(48,s)}},Zi=BigInt(0),Qi=BigInt(1),O0=BigInt(2),Or=BigInt(3),R0=BigInt(4);function D0(i,t,e){function r(n){const s=i.sqr(n),o=i.mul(s,n);return i.add(i.add(o,i.mul(n,t)),e)}return r}function Gl(i,t,e){const{BYTES:r}=i;function n(s){let o;if(typeof s=="bigint")o=s;else{let c=Se("private key",s);if(t){if(!t.includes(c.length*2))throw new Error("invalid private key");const l=new Uint8Array(r);l.set(c,l.length-c.length),c=l}try{o=i.fromBytes(c)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof s}`)}}if(e&&(o=i.create(o)),!i.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return n}function L0(i,t={}){const{Fp:e,Fn:r}=g0("weierstrass",i,t),{h:n,n:s}=i;on(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=t;if(o&&(!e.is0(i.a)||typeof o.beta!="bigint"||typeof o.splitScalar!="function"))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function c(){if(!e.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(S,m,P){const{x:E,y:A}=m.toAffine(),O=e.toBytes(E);if(Hr("isCompressed",P),P){c();const V=!e.isOdd(A);return Qt(Jl(V),O)}else return Qt(Uint8Array.of(4),O,e.toBytes(A))}function h(S){Qe(S);const m=e.BYTES,P=m+1,E=2*m+1,A=S.length,O=S[0],V=S.subarray(1);if(A===P&&(O===2||O===3)){const x=e.fromBytes(V);if(!e.isValid(x))throw new Error("bad point: is not on curve, wrong x");const C=_(x);let $;try{$=e.sqrt(C)}catch(L){const M=L instanceof Error?": "+L.message:"";throw new Error("bad point: is not on curve, sqrt error"+M)}c();const F=e.isOdd($);return(O&1)===1!==F&&($=e.neg($)),{x,y:$}}else if(A===E&&O===4){const x=e.fromBytes(V.subarray(m*0,m*1)),C=e.fromBytes(V.subarray(m*1,m*2));if(!p(x,C))throw new Error("bad point: is not on curve");return{x,y:C}}else throw new Error(`bad point: got length ${A}, expected compressed=${P} or uncompressed=${E}`)}const u=t.toBytes||l,d=t.fromBytes||h,_=D0(e,i.a,i.b);function p(S,m){const P=e.sqr(m),E=_(S);return e.eql(P,E)}if(!p(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const f=e.mul(e.pow(i.a,Or),R0),w=e.mul(e.sqr(i.b),BigInt(27));if(e.is0(e.add(f,w)))throw new Error("bad curve params: a or b");function g(S,m,P=!1){if(!e.isValid(m)||P&&e.is0(m))throw new Error(`bad point coordinate ${S}`);return m}function I(S){if(!(S instanceof b))throw new Error("ProjectivePoint expected")}const T=_a((S,m)=>{const{px:P,py:E,pz:A}=S;if(e.eql(A,e.ONE))return{x:P,y:E};const O=S.is0();m==null&&(m=O?e.ONE:e.inv(A));const V=e.mul(P,m),x=e.mul(E,m),C=e.mul(A,m);if(O)return{x:e.ZERO,y:e.ZERO};if(!e.eql(C,e.ONE))throw new Error("invZ was invalid");return{x:V,y:x}}),y=_a(S=>{if(S.is0()){if(t.allowInfinityPoint&&!e.is0(S.py))return;throw new Error("bad point: ZERO")}const{x:m,y:P}=S.toAffine();if(!e.isValid(m)||!e.isValid(P))throw new Error("bad point: x or y not field elements");if(!p(m,P))throw new Error("bad point: equation left != right");if(!S.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function v(S,m,P,E,A){return P=new b(e.mul(P.px,S),P.py,P.pz),m=Yi(E,m),P=Yi(A,P),m.add(P)}class b{constructor(m,P,E){this.px=g("x",m),this.py=g("y",P,!0),this.pz=g("z",E),Object.freeze(this)}static fromAffine(m){const{x:P,y:E}=m||{};if(!m||!e.isValid(P)||!e.isValid(E))throw new Error("invalid affine point");if(m instanceof b)throw new Error("projective point not allowed");return e.is0(P)&&e.is0(E)?b.ZERO:new b(P,E,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){return h0(b,"pz",m)}static fromBytes(m){return Qe(m),b.fromHex(m)}static fromHex(m){const P=b.fromAffine(d(Se("pointHex",m)));return P.assertValidity(),P}static fromPrivateKey(m){const P=Gl(r,t.allowedPrivateKeyLengths,t.wrapPrivateKey);return b.BASE.multiply(P(m))}static msm(m,P){return w0(b,r,m,P)}precompute(m=8,P=!0){return N.setWindowSize(this,m),P||this.multiply(Or),this}_setWindowSize(m){this.precompute(m)}assertValidity(){y(this)}hasEvenY(){const{y:m}=this.toAffine();if(!e.isOdd)throw new Error("Field doesn't support isOdd");return!e.isOdd(m)}equals(m){I(m);const{px:P,py:E,pz:A}=this,{px:O,py:V,pz:x}=m,C=e.eql(e.mul(P,x),e.mul(O,A)),$=e.eql(e.mul(E,x),e.mul(V,A));return C&&$}negate(){return new b(this.px,e.neg(this.py),this.pz)}double(){const{a:m,b:P}=i,E=e.mul(P,Or),{px:A,py:O,pz:V}=this;let x=e.ZERO,C=e.ZERO,$=e.ZERO,F=e.mul(A,A),L=e.mul(O,O),M=e.mul(V,V),q=e.mul(A,O);return q=e.add(q,q),$=e.mul(A,V),$=e.add($,$),x=e.mul(m,$),C=e.mul(E,M),C=e.add(x,C),x=e.sub(L,C),C=e.add(L,C),C=e.mul(x,C),x=e.mul(q,x),$=e.mul(E,$),M=e.mul(m,M),q=e.sub(F,M),q=e.mul(m,q),q=e.add(q,$),$=e.add(F,F),F=e.add($,F),F=e.add(F,M),F=e.mul(F,q),C=e.add(C,F),M=e.mul(O,V),M=e.add(M,M),F=e.mul(M,q),x=e.sub(x,F),$=e.mul(M,L),$=e.add($,$),$=e.add($,$),new b(x,C,$)}add(m){I(m);const{px:P,py:E,pz:A}=this,{px:O,py:V,pz:x}=m;let C=e.ZERO,$=e.ZERO,F=e.ZERO;const L=i.a,M=e.mul(i.b,Or);let q=e.mul(P,O),z=e.mul(E,V),H=e.mul(A,x),K=e.add(P,E),W=e.add(O,V);K=e.mul(K,W),W=e.add(q,z),K=e.sub(K,W),W=e.add(P,A);let ie=e.add(O,x);return W=e.mul(W,ie),ie=e.add(q,H),W=e.sub(W,ie),ie=e.add(E,A),C=e.add(V,x),ie=e.mul(ie,C),C=e.add(z,H),ie=e.sub(ie,C),F=e.mul(L,W),C=e.mul(M,H),F=e.add(C,F),C=e.sub(z,F),F=e.add(z,F),$=e.mul(C,F),z=e.add(q,q),z=e.add(z,q),H=e.mul(L,H),W=e.mul(M,W),z=e.add(z,H),H=e.sub(q,H),H=e.mul(L,H),W=e.add(W,H),q=e.mul(z,W),$=e.add($,q),q=e.mul(ie,W),C=e.mul(K,C),C=e.sub(C,q),q=e.mul(K,z),F=e.mul(ie,F),F=e.add(F,q),new b(C,$,F)}subtract(m){return this.add(m.negate())}is0(){return this.equals(b.ZERO)}multiply(m){const{endo:P}=t;if(!r.isValidNot0(m))throw new Error("invalid scalar: out of range");let E,A;const O=V=>N.wNAFCached(this,V,b.normalizeZ);if(P){const{k1neg:V,k1:x,k2neg:C,k2:$}=P.splitScalar(m),{p:F,f:L}=O(x),{p:M,f:q}=O($);A=L.add(q),E=v(P.beta,F,M,V,C)}else{const{p:V,f:x}=O(m);E=V,A=x}return b.normalizeZ([E,A])[0]}multiplyUnsafe(m){const{endo:P}=t,E=this;if(!r.isValid(m))throw new Error("invalid scalar: out of range");if(m===Zi||E.is0())return b.ZERO;if(m===Qi)return E;if(N.hasPrecomputes(this))return this.multiply(m);if(P){const{k1neg:A,k1:O,k2neg:V,k2:x}=P.splitScalar(m),{p1:C,p2:$}=f0(b,E,O,x);return v(P.beta,C,$,A,V)}else return N.wNAFCachedUnsafe(E,m)}multiplyAndAddUnsafe(m,P,E){const A=this.multiplyUnsafe(P).add(m.multiplyUnsafe(E));return A.is0()?void 0:A}toAffine(m){return T(this,m)}isTorsionFree(){const{isTorsionFree:m}=t;return n===Qi?!0:m?m(b,this):N.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:m}=t;return n===Qi?this:m?m(b,this):this.multiplyUnsafe(n)}toBytes(m=!0){return Hr("isCompressed",m),this.assertValidity(),u(b,this,m)}toRawBytes(m=!0){return this.toBytes(m)}toHex(m=!0){return ar(this.toBytes(m))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}b.BASE=new b(i.Gx,i.Gy,e.ONE),b.ZERO=new b(e.ZERO,e.ONE,e.ZERO),b.Fp=e,b.Fn=r;const D=r.BITS,N=p0(b,t.endo?Math.ceil(D/2):D);return b}function Jl(i){return Uint8Array.of(i?2:3)}function V0(i,t,e={}){on(t,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=t.randomBytes||Li,n=t.hmac||((E,...A)=>tn(t.hash,E,Qt(...A))),{Fp:s,Fn:o}=i,{ORDER:c,BITS:l}=o;function h(E){const A=c>>Qi;return E>A}function u(E){return h(E)?o.neg(E):E}function d(E,A){if(!o.isValidNot0(A))throw new Error(`invalid signature ${E}: out of range 1..CURVE.n`)}class _{constructor(A,O,V){d("r",A),d("s",O),this.r=A,this.s=O,V!=null&&(this.recovery=V),Object.freeze(this)}static fromCompact(A){const O=o.BYTES,V=Se("compactSignature",A,O*2);return new _(o.fromBytes(V.subarray(0,O)),o.fromBytes(V.subarray(O,O*2)))}static fromDER(A){const{r:O,s:V}=It.toSig(Se("DER",A));return new _(O,V)}assertValidity(){}addRecoveryBit(A){return new _(this.r,this.s,A)}recoverPublicKey(A){const O=s.ORDER,{r:V,s:x,recovery:C}=this;if(C==null||![0,1,2,3].includes(C))throw new Error("recovery id invalid");if(c*O0<O&&C>1)throw new Error("recovery id is ambiguous for h>1 curve");const $=C===2||C===3?V+c:V;if(!s.isValid($))throw new Error("recovery id 2 or 3 invalid");const F=s.toBytes($),L=i.fromHex(Qt(Jl((C&1)===0),F)),M=o.inv($),q=y(Se("msgHash",A)),z=o.create(-q*M),H=o.create(x*M),K=i.BASE.multiplyUnsafe(z).add(L.multiplyUnsafe(H));if(K.is0())throw new Error("point at infinify");return K.assertValidity(),K}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new _(this.r,o.neg(this.s),this.recovery):this}toBytes(A){if(A==="compact")return Qt(o.toBytes(this.r),o.toBytes(this.s));if(A==="der")return Qs(It.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return ar(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return ar(this.toBytes("compact"))}}const p=Gl(o,e.allowedPrivateKeyLengths,e.wrapPrivateKey),f={isValidPrivateKey(E){try{return p(E),!0}catch{return!1}},normPrivateKeyToScalar:p,randomPrivateKey:()=>{const E=c;return u0(r(jl(E)),E)},precompute(E=8,A=i.BASE){return A.precompute(E,!1)}};function w(E,A=!0){return i.fromPrivateKey(E).toBytes(A)}function g(E){if(typeof E=="bigint")return!1;if(E instanceof i)return!0;const A=Se("key",E).length,O=s.BYTES,V=O+1,x=2*O+1;if(!(e.allowedPrivateKeyLengths||o.BYTES===V))return A===V||A===x}function I(E,A,O=!0){if(g(E)===!0)throw new Error("first arg must be private key");if(g(A)===!1)throw new Error("second arg must be public key");return i.fromHex(A).multiply(p(E)).toBytes(O)}const T=t.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");const A=nn(E),O=E.length*8-l;return O>0?A>>BigInt(O):A},y=t.bits2int_modN||function(E){return o.create(T(E))},v=sn(l);function b(E){return rs("num < 2^"+l,E,Zi,v),o.toBytes(E)}function D(E,A,O=N){if(["recovered","canonical"].some(K=>K in O))throw new Error("sign() legacy options not supported");const{hash:V}=t;let{lowS:x,prehash:C,extraEntropy:$}=O;x==null&&(x=!0),E=Se("msgHash",E),ya(O),C&&(E=Se("prehashed msgHash",V(E)));const F=y(E),L=p(A),M=[b(L),b(F)];if($!=null&&$!==!1){const K=$===!0?r(s.BYTES):$;M.push(Se("extraEntropy",K))}const q=Qt(...M),z=F;function H(K){const W=T(K);if(!o.isValidNot0(W))return;const ie=o.inv(W),ue=i.BASE.multiply(W).toAffine(),ce=o.create(ue.x);if(ce===Zi)return;const oe=o.create(ie*o.create(z+ce*L));if(oe===Zi)return;let je=(ue.x===ce?0:2)|Number(ue.y&Qi),gt=oe;return x&&h(oe)&&(gt=u(oe),je^=1),new _(ce,gt,je)}return{seed:q,k2sig:H}}const N={lowS:t.lowS,prehash:!1},S={lowS:t.lowS,prehash:!1};function m(E,A,O=N){const{seed:V,k2sig:x}=D(E,A,O);return t0(t.hash.outputLen,o.BYTES,n)(V,x)}i.BASE.precompute(8);function P(E,A,O,V=S){const x=E;A=Se("msgHash",A),O=Se("publicKey",O),ya(V);const{lowS:C,prehash:$,format:F}=V;if("strict"in V)throw new Error("options.strict was renamed to lowS");if(F!==void 0&&!["compact","der","js"].includes(F))throw new Error('format must be "compact", "der" or "js"');const L=typeof x=="string"||Js(x),M=!L&&!F&&typeof x=="object"&&x!==null&&typeof x.r=="bigint"&&typeof x.s=="bigint";if(!L&&!M)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let q,z;try{if(M)if(F===void 0||F==="js")q=new _(x.r,x.s);else throw new Error("invalid format");if(L){try{F!=="compact"&&(q=_.fromDER(x))}catch(je){if(!(je instanceof It.Err))throw je}!q&&F!=="der"&&(q=_.fromCompact(x))}z=i.fromHex(O)}catch{return!1}if(!q||C&&q.hasHighS())return!1;$&&(A=t.hash(A));const{r:H,s:K}=q,W=y(A),ie=o.inv(K),ue=o.create(W*ie),ce=o.create(H*ie),oe=i.BASE.multiplyUnsafe(ue).add(z.multiplyUnsafe(ce));return oe.is0()?!1:o.create(oe.x)===H}return Object.freeze({getPublicKey:w,getSharedSecret:I,sign:m,verify:P,utils:f,Point:i,Signature:_})}function x0(i){const t={a:i.a,b:i.b,p:i.Fp.ORDER,n:i.n,h:i.h,Gx:i.Gx,Gy:i.Gy},e=i.Fp,r=Vi(t.n,i.nBitLength),n={Fp:e,Fn:r,allowedPrivateKeyLengths:i.allowedPrivateKeyLengths,allowInfinityPoint:i.allowInfinityPoint,endo:i.endo,wrapPrivateKey:i.wrapPrivateKey,isTorsionFree:i.isTorsionFree,clearCofactor:i.clearCofactor,fromBytes:i.fromBytes,toBytes:i.toBytes};return{CURVE:t,curveOpts:n}}function S0(i){const{CURVE:t,curveOpts:e}=x0(i),r={hash:i.hash,hmac:i.hmac,randomBytes:i.randomBytes,lowS:i.lowS,bits2int:i.bits2int,bits2int_modN:i.bits2int_modN};return{CURVE:t,curveOpts:e,ecdsaOpts:r}}function C0(i,t){return Object.assign({},t,{ProjectivePoint:t.Point,CURVE:i})}function $0(i){const{CURVE:t,curveOpts:e,ecdsaOpts:r}=S0(i),n=L0(t,e),s=V0(n,r,e);return C0(i,s)}function ss(i,t){const e=r=>$0({...i,hash:r});return{...e(t),create:e}}const Yl={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Zl={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},Ql={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},k0=Vi(Yl.p),N0=Vi(Zl.p),U0=Vi(Ql.p),B0=ss({...Yl,Fp:k0,lowS:!1},en);ss({...Zl,Fp:N0,lowS:!1},Hf),ss({...Ql,Fp:U0,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},Kf);const F0=B0,Xl="base10",De="base16",$e="base64pad",Ft="base64url",wr="utf8",eu=0,Pt=1,gr=2,q0=0,va=1,Xi=12,no=32;function M0(){const i=ns.utils.randomPrivateKey(),t=ns.getPublicKey(i);return{privateKey:Ne(i,De),publicKey:Ne(t,De)}}function os(){const i=Li(no);return Ne(i,De)}function z0(i,t){const e=ns.getSharedSecret(Ze(i,De),Ze(t,De)),r=Qw(rn,e,void 0,void 0,no);return Ne(r,De)}function xr(i){const t=rn(Ze(i,De));return Ne(t,De)}function Ge(i){const t=rn(Ze(i,wr));return Ne(t,De)}function tu(i){return Ze(`${i}`,Xl)}function si(i){return Number(Ne(i,Xl))}function iu(i){return i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ru(i){const t=i.replace(/-/g,"+").replace(/_/g,"/"),e=(4-t.length%4)%4;return t+"=".repeat(e)}function j0(i){const t=tu(typeof i.type<"u"?i.type:eu);if(si(t)===Pt&&typeof i.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const e=typeof i.senderPublicKey<"u"?Ze(i.senderPublicKey,De):void 0,r=typeof i.iv<"u"?Ze(i.iv,De):Li(Xi),n=Ze(i.symKey,De),s=$l(n,r).encrypt(Ze(i.message,wr)),o=nu({type:t,sealed:s,iv:r,senderPublicKey:e});return i.encoding===Ft?iu(o):o}function K0(i){const t=Ze(i.symKey,De),{sealed:e,iv:r}=lr({encoded:i.encoded,encoding:i.encoding}),n=$l(t,r).decrypt(e);if(n===null)throw new Error("Failed to decrypt");return Ne(n,wr)}function H0(i,t){const e=tu(gr),r=Li(Xi),n=Ze(i,wr),s=nu({type:e,sealed:n,iv:r});return t===Ft?iu(s):s}function W0(i,t){const{sealed:e}=lr({encoded:i,encoding:t});return Ne(e,wr)}function nu(i){if(si(i.type)===gr)return Ne(Gi([i.type,i.sealed]),$e);if(si(i.type)===Pt){if(typeof i.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Ne(Gi([i.type,i.senderPublicKey,i.iv,i.sealed]),$e)}return Ne(Gi([i.type,i.iv,i.sealed]),$e)}function lr(i){const t=(i.encoding||$e)===Ft?ru(i.encoded):i.encoded,e=Ze(t,$e),r=e.slice(q0,va),n=va;if(si(r)===Pt){const l=n+no,h=l+Xi,u=e.slice(n,l),d=e.slice(l,h),_=e.slice(h);return{type:r,sealed:_,iv:d,senderPublicKey:u}}if(si(r)===gr){const l=e.slice(n),h=Li(Xi);return{type:r,sealed:l,iv:h}}const s=n+Xi,o=e.slice(n,s),c=e.slice(s);return{type:r,sealed:c,iv:o}}function G0(i,t){const e=lr({encoded:i,encoding:t==null?void 0:t.encoding});return su({type:si(e.type),senderPublicKey:typeof e.senderPublicKey<"u"?Ne(e.senderPublicKey,De):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function su(i){const t=(i==null?void 0:i.type)||eu;if(t===Pt){if(typeof(i==null?void 0:i.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(i==null?void 0:i.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:i==null?void 0:i.senderPublicKey,receiverPublicKey:i==null?void 0:i.receiverPublicKey}}function ba(i){return i.type===Pt&&typeof i.senderPublicKey=="string"&&typeof i.receiverPublicKey=="string"}function Ia(i){return i.type===gr}function J0(i){const t=ee.from(i.x,"base64"),e=ee.from(i.y,"base64");return Gi([new Uint8Array([4]),t,e])}function Y0(i,t){const[e,r,n]=i.split("."),s=ee.from(ru(n),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),c=s.slice(32,64),l=`${e}.${r}`,h=rn(l),u=J0(t);if(!F0.verify(Gi([o,c]),h,u))throw new Error("Invalid signature");return Bn(i).payload}const Z0="irn";function Gr(i){return(i==null?void 0:i.relay)||{protocol:Z0}}function gi(i){const t=Ch[i];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${i}`);return t}function Q0(i,t="-"){const e={},r="relay"+t;return Object.keys(i).forEach(n=>{if(n.startsWith(r)){const s=n.replace(r,""),o=i[n];e[s]=o}}),e}function Aa(i){if(!i.includes("wc:")){const h=wl(i);h!=null&&h.includes("wc:")&&(i=h)}i=i.includes("wc://")?i.replace("wc://",""):i,i=i.includes("wc:")?i.replace("wc:",""):i;const t=i.indexOf(":"),e=i.indexOf("?")!==-1?i.indexOf("?"):void 0,r=i.substring(0,t),n=i.substring(t+1,e).split("@"),s=typeof e<"u"?i.substring(e):"",o=new URLSearchParams(s),c={};o.forEach((h,u)=>{c[u]=h});const l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:r,topic:X0(n[0]),version:parseInt(n[1],10),symKey:c.symKey,relay:Q0(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function X0(i){return i.startsWith("//")?i.substring(2):i}function eg(i,t="-"){const e="relay",r={};return Object.keys(i).forEach(n=>{const s=n,o=e+t+s;i[s]&&(r[o]=i[s])}),r}function Pa(i){const t=new URLSearchParams,e=eg(i.relay);Object.keys(e).sort().forEach(n=>{t.set(n,e[n])}),t.set("symKey",i.symKey),i.expiryTimestamp&&t.set("expiryTimestamp",i.expiryTimestamp.toString()),i.methods&&t.set("methods",i.methods.join(","));const r=t.toString();return`${i.protocol}:${i.topic}@${i.version}?${r}`}function Rr(i,t,e){return`${i}?wc_ev=${e}&topic=${t}`}var tg=Object.defineProperty,ig=Object.defineProperties,rg=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,ng=Object.prototype.hasOwnProperty,sg=Object.prototype.propertyIsEnumerable,Oa=(i,t,e)=>t in i?tg(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,og=(i,t)=>{for(var e in t||(t={}))ng.call(t,e)&&Oa(i,e,t[e]);if(Ta)for(var e of Ta(t))sg.call(t,e)&&Oa(i,e,t[e]);return i},ag=(i,t)=>ig(i,rg(t));function xi(i){const t=[];return i.forEach(e=>{const[r,n]=e.split(":");t.push(`${r}:${n}`)}),t}function cg(i){const t=[];return Object.values(i).forEach(e=>{t.push(...xi(e.accounts))}),t}function lg(i,t){const e=[];return Object.values(i).forEach(r=>{xi(r.accounts).includes(t)&&e.push(...r.methods)}),e}function ug(i,t){const e=[];return Object.values(i).forEach(r=>{xi(r.accounts).includes(t)&&e.push(...r.events)}),e}function ou(i){return i.includes(":")}function hg(i){return ou(i)?i.split(":")[0]:i}function Ra(i){var t,e,r;const n={};if(!ur(i))return n;for(const[s,o]of Object.entries(i)){const c=ou(s)?[s]:o.chains,l=o.methods||[],h=o.events||[],u=hg(s);n[u]=ag(og({},n[u]),{chains:ti(c,(t=n[u])==null?void 0:t.chains),methods:ti(l,(e=n[u])==null?void 0:e.methods),events:ti(h,(r=n[u])==null?void 0:r.events)})}return n}function dg(i){const t={};return i==null||i.forEach(e=>{var r;const[n,s]=e.split(":");t[n]||(t[n]={accounts:[],chains:[],events:[],methods:[]}),t[n].accounts.push(e),(r=t[n].chains)==null||r.push(`${n}:${s}`)}),t}function Da(i,t){t=t.map(r=>r.replace("did:pkh:",""));const e=dg(t);for(const[r,n]of Object.entries(e))n.methods?n.methods=ti(n.methods,i):n.methods=i,n.events=["chainChanged","accountsChanged"];return e}function _g(i,t){var e,r,n,s,o,c;const l=Ra(i),h=Ra(t),u={},d=Object.keys(l).concat(Object.keys(h));for(const _ of d)u[_]={chains:ti((e=l[_])==null?void 0:e.chains,(r=h[_])==null?void 0:r.chains),methods:ti((n=l[_])==null?void 0:n.methods,(s=h[_])==null?void 0:s.methods),events:ti((o=l[_])==null?void 0:o.events,(c=h[_])==null?void 0:c.events)};return u}const pg={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},fg={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function k(i,t){const{message:e,code:r}=fg[i];return{message:t?`${e} ${t}`:e,code:r}}function ae(i,t){const{message:e,code:r}=pg[i];return{message:t?`${e} ${t}`:e,code:r}}function vi(i,t){return Array.isArray(i)?typeof t<"u"&&i.length?i.every(t):!0:!1}function ur(i){return Object.getPrototypeOf(i)===Object.prototype&&Object.keys(i).length}function fe(i){return typeof i>"u"}function de(i,t){return t&&fe(i)?!0:typeof i=="string"&&!!i.trim().length}function so(i,t){return t&&fe(i)?!0:typeof i=="number"&&!isNaN(i)}function wg(i,t){const{requiredNamespaces:e}=t,r=Object.keys(i.namespaces),n=Object.keys(e);let s=!0;return Zt(n,r)?(r.forEach(o=>{const{accounts:c,methods:l,events:h}=i.namespaces[o],u=xi(c),d=e[o];(!Zt(hl(o,d),u)||!Zt(d.methods,l)||!Zt(d.events,h))&&(s=!1)}),s):!1}function Jr(i){return de(i,!1)&&i.includes(":")?i.split(":").length===2:!1}function gg(i){if(de(i,!1)&&i.includes(":")){const t=i.split(":");if(t.length===3){const e=t[0]+":"+t[1];return!!t[2]&&Jr(e)}}return!1}function mg(i){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(de(i,!1)){if(t(i))return!0;const e=wl(i);return t(e)}}catch{}return!1}function Eg(i){var t;return(t=i==null?void 0:i.proposer)==null?void 0:t.publicKey}function yg(i){return i==null?void 0:i.topic}function vg(i,t){let e=null;return de(i==null?void 0:i.publicKey,!1)||(e=k("MISSING_OR_INVALID",`${t} controller public key should be a string`)),e}function La(i){let t=!0;return vi(i)?i.length&&(t=i.every(e=>de(e,!1))):t=!1,t}function bg(i,t,e){let r=null;return vi(t)&&t.length?t.forEach(n=>{r||Jr(n)||(r=ae("UNSUPPORTED_CHAINS",`${e}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):Jr(i)||(r=ae("UNSUPPORTED_CHAINS",`${e}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function Ig(i,t,e){let r=null;return Object.entries(i).forEach(([n,s])=>{if(r)return;const o=bg(n,hl(n,s),`${t} ${e}`);o&&(r=o)}),r}function Ag(i,t){let e=null;return vi(i)?i.forEach(r=>{e||gg(r)||(e=ae("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):e=ae("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),e}function Pg(i,t){let e=null;return Object.values(i).forEach(r=>{if(e)return;const n=Ag(r==null?void 0:r.accounts,`${t} namespace`);n&&(e=n)}),e}function Tg(i,t){let e=null;return La(i==null?void 0:i.methods)?La(i==null?void 0:i.events)||(e=ae("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):e=ae("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),e}function au(i,t){let e=null;return Object.values(i).forEach(r=>{if(e)return;const n=Tg(r,`${t}, namespace`);n&&(e=n)}),e}function Og(i,t,e){let r=null;if(i&&ur(i)){const n=au(i,t);n&&(r=n);const s=Ig(i,t,e);s&&(r=s)}else r=k("MISSING_OR_INVALID",`${t}, ${e} should be an object with data`);return r}function Pn(i,t){let e=null;if(i&&ur(i)){const r=au(i,t);r&&(e=r);const n=Pg(i,t);n&&(e=n)}else e=k("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return e}function cu(i){return de(i.protocol,!0)}function Rg(i,t){let e=!1;return t&&!i?e=!0:i&&vi(i)&&i.length&&i.forEach(r=>{e=cu(r)}),e}function Dg(i){return typeof i=="number"}function xe(i){return typeof i<"u"&&typeof i!==null}function Lg(i){return!(!i||typeof i!="object"||!i.code||!so(i.code,!1)||!i.message||!de(i.message,!1))}function Vg(i){return!(fe(i)||!de(i.method,!1))}function xg(i){return!(fe(i)||fe(i.result)&&fe(i.error)||!so(i.id,!1)||!de(i.jsonrpc,!1))}function Sg(i){return!(fe(i)||!de(i.name,!1))}function Va(i,t){return!(!Jr(t)||!cg(i).includes(t))}function Cg(i,t,e){return de(e,!1)?lg(i,t).includes(e):!1}function $g(i,t,e){return de(e,!1)?ug(i,t).includes(e):!1}function xa(i,t,e){let r=null;const n=kg(i),s=Ng(t),o=Object.keys(n),c=Object.keys(s),l=Sa(Object.keys(i)),h=Sa(Object.keys(t)),u=l.filter(d=>!h.includes(d));return u.length&&(r=k("NON_CONFORMING_NAMESPACES",`${e} namespaces keys don't satisfy requiredNamespaces.
@@ -9,4 +9,4 @@ ${i.length}`,e=new TextEncoder().encode(t+i);return"0x"+ee.from($f(e)).toString(
9
9
  Required: ${o.toString()}
10
10
  Approved: ${c.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||r)return;const _=xi(t[d].accounts);_.includes(d)||(r=k("NON_CONFORMING_NAMESPACES",`${e} namespaces accounts don't satisfy namespace accounts for ${d}
11
11
  Required: ${d}
12
- Approved: ${_.toString()}`))}),o.forEach(d=>{r||(Zt(n[d].methods,s[d].methods)?Zt(n[d].events,s[d].events)||(r=k("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${d}`)):r=k("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function kg(i){const t={};return Object.keys(i).forEach(e=>{var r;e.includes(":")?t[e]=i[e]:(r=i[e].chains)==null||r.forEach(n=>{t[n]={methods:i[e].methods,events:i[e].events}})}),t}function Sa(i){return[...new Set(i.map(t=>t.includes(":")?t.split(":")[0]:t))]}function Ng(i){const t={};return Object.keys(i).forEach(e=>{if(e.includes(":"))t[e]=i[e];else{const r=xi(i[e].accounts);r==null||r.forEach(n=>{t[n]={accounts:i[e].accounts.filter(s=>s.includes(`${n}:`)),methods:i[e].methods,events:i[e].events}})}}),t}function Ug(i,t){return so(i,!1)&&i<=t.max&&i>=t.min}function Ca(){const i=pr();return new Promise(t=>{switch(i){case ze.browser:t(Bg());break;case ze.reactNative:t(Fg());break;case ze.node:t(qg());break;default:t(!0)}})}function Bg(){return Di()&&(navigator==null?void 0:navigator.onLine)}async function Fg(){if(Kt()&&typeof j<"u"&&j!=null&&j.NetInfo){const i=await(j==null?void 0:j.NetInfo.fetch());return i==null?void 0:i.isConnected}return!0}function qg(){return!0}function Mg(i){switch(pr()){case ze.browser:zg(i);break;case ze.reactNative:jg(i);break}}function zg(i){!Kt()&&Di()&&(window.addEventListener("online",()=>i(!0)),window.addEventListener("offline",()=>i(!1)))}function jg(i){var t;Kt()&&typeof j<"u"&&j!=null&&j.NetInfo&&((t=j)==null||t.NetInfo.addEventListener(e=>i(e==null?void 0:e.isConnected)))}function Kg(){var i;return Di()&&mi()?((i=mi())==null?void 0:i.visibilityState)==="visible":!0}const Tn={};class Bi{static get(t){return Tn[t]}static set(t,e){Tn[t]=e}static delete(t){delete Tn[t]}}function Hg(i){const t=dr.decode(i);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Wg({publicKey:i,signature:t,payload:e}){var r;const n=as(e.method),s=128|parseInt(((r=e.version)==null?void 0:r.toString())||"4"),o=Yg(e.address),c=e.era==="00"?new Uint8Array([0]):as(e.era);if(c.length!==1&&c.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),h=new Uint8Array([l&255,l>>8&255]),u=BigInt(`0x${Jg(e.tip)}`),d=Qg(u),_=new Uint8Array([0,...i,o,...t,...c,...h,...d,...n]),p=Zg(_.length+1);return new Uint8Array([...p,s,..._])}function Gg(i){const t=as(i),e=zh.blake2b(t,void 0,32);return"0x"+ee.from(e).toString("hex")}function as(i){return new Uint8Array(i.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function Jg(i){return i.startsWith("0x")?i.slice(2):i}function Yg(i){const t=dr.decode(i)[0];return t===42?0:t===60?2:1}function Zg(i){if(i<64)return new Uint8Array([i<<2]);if(i<16384){const t=i<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(i<1<<30){const t=i<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Qg(i){if(i<BigInt(1)<<BigInt(6))return new Uint8Array([Number(i<<BigInt(2))]);if(i<BigInt(1)<<BigInt(14)){const t=i<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(i<BigInt(1)<<BigInt(30)){const t=i<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Xg(i){const t=Uint8Array.from(ee.from(i.signature,"hex")),e=Hg(i.transaction.address),r=Wg({publicKey:e,signature:t,payload:i.transaction}),n=ee.from(r).toString("hex");return Gg(n)}const lu="wc",uu=2,Yr="core",wt=`${lu}@2:${Yr}:`,em={name:Yr,logger:"error"},tm={database:":memory:"},im="crypto",$a="client_ed25519_seed",rm=U.ONE_DAY,nm="keychain",sm="0.3",om="messages",am="0.3",cm=U.SIX_HOURS,lm="publisher",hu="irn",um="error",du="wss://relay.walletconnect.org",hm="relayer",le={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},dm="_subscription",Ke={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},_m=.1,cs="2.21.8",se={link_mode:"link_mode",relay:"relay"},Sr={inbound:"inbound",outbound:"outbound"},pm="0.3",fm="WALLETCONNECT_CLIENT_ID",ka="WALLETCONNECT_LINK_MODE_APPS",qe={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},wm="subscription",gm="0.3",mm="pairing",Em="0.3",Fi={wc_pairingDelete:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:U.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:U.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:U.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:U.ONE_DAY,prompt:!1,tag:0},res:{ttl:U.ONE_DAY,prompt:!1,tag:0}}},Jt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},et={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},ym="history",vm="0.3",bm="expirer",We={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Im="0.3",Am="verify-api",Pm="https://verify.walletconnect.com",_u="https://verify.walletconnect.org",er=_u,Tm=`${er}/v3`,Om=[Pm,_u],Rm="echo",Dm="https://echo.walletconnect.com",ht={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},bt={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Ct={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},qi={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Wt={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},Mi={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Lm=.1,Vm="event-client",xm=86400,Sm="https://pulse.walletconnect.org/batch";function Cm(i,t){if(i.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<i.length;n++){var s=i.charAt(n),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=n}var c=i.length,l=i.charAt(0),h=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function d(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var w=0,g=0,I=0,T=f.length;I!==T&&f[I]===0;)I++,w++;for(var y=(T-I)*u+1>>>0,v=new Uint8Array(y);I!==T;){for(var b=f[I],D=0,N=y-1;(b!==0||D<g)&&N!==-1;N--,D++)b+=256*v[N]>>>0,v[N]=b%c>>>0,b=b/c>>>0;if(b!==0)throw new Error("Non-zero carry");g=D,I++}for(var S=y-g;S!==y&&v[S]===0;)S++;for(var m=l.repeat(w);S<y;++S)m+=i.charAt(v[S]);return m}function _(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var w=0;if(f[w]!==" "){for(var g=0,I=0;f[w]===l;)g++,w++;for(var T=(f.length-w)*h+1>>>0,y=new Uint8Array(T);f[w];){var v=e[f.charCodeAt(w)];if(v===255)return;for(var b=0,D=T-1;(v!==0||b<I)&&D!==-1;D--,b++)v+=c*y[D]>>>0,y[D]=v%256>>>0,v=v/256>>>0;if(v!==0)throw new Error("Non-zero carry");I=b,w++}if(f[w]!==" "){for(var N=T-I;N!==T&&y[N]===0;)N++;for(var S=new Uint8Array(g+(T-N)),m=g;N!==T;)S[m++]=y[N++];return S}}}function p(f){var w=_(f);if(w)return w;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:_,decode:p}}var $m=Cm,km=$m;const pu=i=>{if(i instanceof Uint8Array&&i.constructor.name==="Uint8Array")return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(ArrayBuffer.isView(i))return new Uint8Array(i.buffer,i.byteOffset,i.byteLength);throw new Error("Unknown type, must be binary type")},Nm=i=>new TextEncoder().encode(i),Um=i=>new TextDecoder().decode(i);class Bm{constructor(t,e,r){this.name=t,this.prefix=e,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class Fm{constructor(t,e,r){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return fu(this,t)}}class qm{constructor(t){this.decoders=t}or(t){return fu(this,t)}decode(t){const e=t[0],r=this.decoders[e];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const fu=(i,t)=>new qm({...i.decoders||{[i.prefix]:i},...t.decoders||{[t.prefix]:t}});class Mm{constructor(t,e,r,n){this.name=t,this.prefix=e,this.baseEncode=r,this.baseDecode=n,this.encoder=new Bm(t,e,r),this.decoder=new Fm(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const an=({name:i,prefix:t,encode:e,decode:r})=>new Mm(i,t,e,r),mr=({prefix:i,name:t,alphabet:e})=>{const{encode:r,decode:n}=km(e,t);return an({prefix:i,name:t,encode:r,decode:s=>pu(n(s))})},zm=(i,t,e,r)=>{const n={};for(let u=0;u<t.length;++u)n[t[u]]=u;let s=i.length;for(;i[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,h=0;for(let u=0;u<s;++u){const d=n[i[u]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);l=l<<e|d,c+=e,c>=8&&(c-=8,o[h++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},jm=(i,t,e)=>{const r=t[t.length-1]==="=",n=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<i.length;++l)for(c=c<<8|i[l],o+=8;o>e;)o-=e,s+=t[n&c>>o];if(o&&(s+=t[n&c<<e-o]),r)for(;s.length*e&7;)s+="=";return s},ve=({name:i,prefix:t,bitsPerChar:e,alphabet:r})=>an({prefix:t,name:i,encode(n){return jm(n,r,e)},decode(n){return zm(n,r,e,i)}}),Km=an({prefix:"\0",name:"identity",encode:i=>Um(i),decode:i=>Nm(i)});var Hm=Object.freeze({__proto__:null,identity:Km});const Wm=ve({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Gm=Object.freeze({__proto__:null,base2:Wm});const Jm=ve({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ym=Object.freeze({__proto__:null,base8:Jm});const Zm=mr({prefix:"9",name:"base10",alphabet:"0123456789"});var Qm=Object.freeze({__proto__:null,base10:Zm});const Xm=ve({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),eE=ve({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var tE=Object.freeze({__proto__:null,base16:Xm,base16upper:eE});const iE=ve({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),rE=ve({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),nE=ve({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sE=ve({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),oE=ve({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),aE=ve({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),cE=ve({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lE=ve({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uE=ve({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var hE=Object.freeze({__proto__:null,base32:iE,base32upper:rE,base32pad:nE,base32padupper:sE,base32hex:oE,base32hexupper:aE,base32hexpad:cE,base32hexpadupper:lE,base32z:uE});const dE=mr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_E=mr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var pE=Object.freeze({__proto__:null,base36:dE,base36upper:_E});const fE=mr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wE=mr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var gE=Object.freeze({__proto__:null,base58btc:fE,base58flickr:wE});const mE=ve({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),EE=ve({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yE=ve({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),vE=ve({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var bE=Object.freeze({__proto__:null,base64:mE,base64pad:EE,base64url:yE,base64urlpad:vE});const wu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),IE=wu.reduce((i,t,e)=>(i[e]=t,i),[]),AE=wu.reduce((i,t,e)=>(i[t.codePointAt(0)]=e,i),[]);function PE(i){return i.reduce((t,e)=>(t+=IE[e],t),"")}function TE(i){const t=[];for(const e of i){const r=AE[e.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(r)}return new Uint8Array(t)}const OE=an({prefix:"🚀",name:"base256emoji",encode:PE,decode:TE});var RE=Object.freeze({__proto__:null,base256emoji:OE}),DE=gu,Na=128,LE=127,VE=~LE,xE=Math.pow(2,31);function gu(i,t,e){t=t||[],e=e||0;for(var r=e;i>=xE;)t[e++]=i&255|Na,i/=128;for(;i&VE;)t[e++]=i&255|Na,i>>>=7;return t[e]=i|0,gu.bytes=e-r+1,t}var SE=ls,CE=128,Ua=127;function ls(i,r){var e=0,r=r||0,n=0,s=r,o,c=i.length;do{if(s>=c)throw ls.bytes=0,new RangeError("Could not decode varint");o=i[s++],e+=n<28?(o&Ua)<<n:(o&Ua)*Math.pow(2,n),n+=7}while(o>=CE);return ls.bytes=s-r,e}var $E=Math.pow(2,7),kE=Math.pow(2,14),NE=Math.pow(2,21),UE=Math.pow(2,28),BE=Math.pow(2,35),FE=Math.pow(2,42),qE=Math.pow(2,49),ME=Math.pow(2,56),zE=Math.pow(2,63),jE=function(i){return i<$E?1:i<kE?2:i<NE?3:i<UE?4:i<BE?5:i<FE?6:i<qE?7:i<ME?8:i<zE?9:10},KE={encode:DE,decode:SE,encodingLength:jE},mu=KE;const Ba=(i,t,e=0)=>(mu.encode(i,t,e),t),Fa=i=>mu.encodingLength(i),us=(i,t)=>{const e=t.byteLength,r=Fa(i),n=r+Fa(e),s=new Uint8Array(n+e);return Ba(i,s,0),Ba(e,s,r),s.set(t,n),new HE(i,e,t,s)};class HE{constructor(t,e,r,n){this.code=t,this.size=e,this.digest=r,this.bytes=n}}const Eu=({name:i,code:t,encode:e})=>new WE(i,t,e);class WE{constructor(t,e,r){this.name=t,this.code=e,this.encode=r}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?us(this.code,e):e.then(r=>us(this.code,r))}else throw Error("Unknown type, must be binary type")}}const yu=i=>async t=>new Uint8Array(await crypto.subtle.digest(i,t)),GE=Eu({name:"sha2-256",code:18,encode:yu("SHA-256")}),JE=Eu({name:"sha2-512",code:19,encode:yu("SHA-512")});var YE=Object.freeze({__proto__:null,sha256:GE,sha512:JE});const vu=0,ZE="identity",bu=pu,QE=i=>us(vu,bu(i)),XE={code:vu,name:ZE,encode:bu,digest:QE};var ey=Object.freeze({__proto__:null,identity:XE});new TextEncoder,new TextDecoder;const qa={...Hm,...Gm,...Ym,...Qm,...tE,...hE,...pE,...gE,...bE,...RE};({...YE,...ey});function Iu(i){return globalThis.Buffer!=null?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):i}function ty(i=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Iu(globalThis.Buffer.allocUnsafe(i)):new Uint8Array(i)}function Au(i,t,e,r){return{name:i,prefix:t,encoder:{name:i,prefix:t,encode:e},decoder:{decode:r}}}const Ma=Au("utf8","u",i=>"u"+new TextDecoder("utf8").decode(i),i=>new TextEncoder().encode(i.substring(1))),On=Au("ascii","a",i=>{let t="a";for(let e=0;e<i.length;e++)t+=String.fromCharCode(i[e]);return t},i=>{i=i.substring(1);const t=ty(i.length);for(let e=0;e<i.length;e++)t[e]=i.charCodeAt(e);return t}),iy={utf8:Ma,"utf-8":Ma,hex:qa.base16,latin1:On,ascii:On,binary:On,...qa};function ry(i,t="utf8"){const e=iy[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Iu(globalThis.Buffer.from(i,"utf-8")):e.decoder.decode(`${e.prefix}${i}`)}var ny=Object.defineProperty,sy=(i,t,e)=>t in i?ny(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,lt=(i,t,e)=>sy(i,typeof t!="symbol"?t+"":t,e);class oy{constructor(t,e){this.core=t,this.logger=e,lt(this,"keychain",new Map),lt(this,"name",nm),lt(this,"version",sm),lt(this,"initialized",!1),lt(this,"storagePrefix",wt),lt(this,"init",async()=>{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),lt(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),lt(this,"set",async(r,n)=>{this.isInitialized(),this.keychain.set(r,n),await this.persist()}),lt(this,"get",r=>{this.isInitialized();const n=this.keychain.get(r);if(typeof n>"u"){const{message:s}=k("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(s)}return n}),lt(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),await this.persist()}),this.core=t,this.logger=Le(e,this.name)}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,Jn(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Yn(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var ay=Object.defineProperty,cy=(i,t,e)=>t in i?ay(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,me=(i,t,e)=>cy(i,typeof t!="symbol"?t+"":t,e);class ly{constructor(t,e,r){this.core=t,this.logger=e,me(this,"name",im),me(this,"keychain"),me(this,"randomSessionIdentifier",os()),me(this,"initialized",!1),me(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),me(this,"hasKeys",n=>(this.isInitialized(),this.keychain.has(n))),me(this,"getClientId",async()=>{this.isInitialized();const n=await this.getClientSeed(),s=wo(n);return Bh(s.publicKey)}),me(this,"generateKeyPair",()=>{this.isInitialized();const n=M0();return this.setPrivateKey(n.publicKey,n.privateKey)}),me(this,"signJWT",async n=>{this.isInitialized();const s=await this.getClientSeed(),o=wo(s),c=this.randomSessionIdentifier;return await Fh(c,n,rm,o)}),me(this,"generateSharedKey",(n,s,o)=>{this.isInitialized();const c=this.getPrivateKey(n),l=z0(c,s);return this.setSymKey(l,o)}),me(this,"setSymKey",async(n,s)=>{this.isInitialized();const o=s||xr(n);return await this.keychain.set(o,n),o}),me(this,"deleteKeyPair",async n=>{this.isInitialized(),await this.keychain.del(n)}),me(this,"deleteSymKey",async n=>{this.isInitialized(),await this.keychain.del(n)}),me(this,"encode",async(n,s,o)=>{this.isInitialized();const c=su(o),l=Un(s);if(Ia(c))return H0(l,o==null?void 0:o.encoding);if(ba(c)){const _=c.senderPublicKey,p=c.receiverPublicKey;n=await this.generateSharedKey(_,p)}const h=this.getSymKey(n),{type:u,senderPublicKey:d}=c;return j0({type:u,symKey:h,message:l,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),me(this,"decode",async(n,s,o)=>{this.isInitialized();const c=G0(s,o);if(Ia(c)){const l=W0(s,o==null?void 0:o.encoding);return go(l)}if(ba(c)){const l=c.receiverPublicKey,h=c.senderPublicKey;n=await this.generateSharedKey(l,h)}try{const l=this.getSymKey(n),h=K0({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return go(h)}catch(l){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),me(this,"getPayloadType",(n,s=$e)=>{const o=lr({encoded:n,encoding:s});return si(o.type)}),me(this,"getPayloadSenderPublicKey",(n,s=$e)=>{const o=lr({encoded:n,encoding:s});return o.senderPublicKey?Ne(o.senderPublicKey,De):void 0}),this.core=t,this.logger=Le(e,this.name),this.keychain=r||new oy(this.core,this.logger)}get context(){return Be(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get($a)}catch{t=os(),await this.keychain.set($a,t)}return ry(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var uy=Object.defineProperty,hy=Object.defineProperties,dy=Object.getOwnPropertyDescriptors,za=Object.getOwnPropertySymbols,_y=Object.prototype.hasOwnProperty,py=Object.prototype.propertyIsEnumerable,hs=(i,t,e)=>t in i?uy(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fy=(i,t)=>{for(var e in t||(t={}))_y.call(t,e)&&hs(i,e,t[e]);if(za)for(var e of za(t))py.call(t,e)&&hs(i,e,t[e]);return i},wy=(i,t)=>hy(i,dy(t)),Fe=(i,t,e)=>hs(i,typeof t!="symbol"?t+"":t,e);class gy extends t_{constructor(t,e){super(t,e),this.logger=t,this.core=e,Fe(this,"messages",new Map),Fe(this,"messagesWithoutClientAck",new Map),Fe(this,"name",om),Fe(this,"version",am),Fe(this,"initialized",!1),Fe(this,"storagePrefix",wt),Fe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const n=await this.getRelayerMessagesWithoutClientAck();typeof n<"u"&&(this.messagesWithoutClientAck=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),Fe(this,"set",async(r,n,s)=>{this.isInitialized();const o=Ge(n);let c=this.messages.get(r);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=n,this.messages.set(r,c),s===Sr.inbound){const l=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,wy(fy({},l),{[o]:n}))}return await this.persist(),o}),Fe(this,"get",r=>{this.isInitialized();let n=this.messages.get(r);return typeof n>"u"&&(n={}),n}),Fe(this,"getWithoutAck",r=>{this.isInitialized();const n={};for(const s of r){const o=this.messagesWithoutClientAck.get(s)||{};n[s]=Object.values(o)}return n}),Fe(this,"has",(r,n)=>{this.isInitialized();const s=this.get(r),o=Ge(n);return typeof s[o]<"u"}),Fe(this,"ack",async(r,n)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(r);if(typeof s>"u")return;const o=Ge(n);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,s),await this.persist()}),Fe(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),await this.persist()}),this.logger=Le(t,this.name),this.core=e}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,Jn(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,Jn(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Yn(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?Yn(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var my=Object.defineProperty,Ey=Object.defineProperties,yy=Object.getOwnPropertyDescriptors,ja=Object.getOwnPropertySymbols,vy=Object.prototype.hasOwnProperty,by=Object.prototype.propertyIsEnumerable,ds=(i,t,e)=>t in i?my(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_i=(i,t)=>{for(var e in t||(t={}))vy.call(t,e)&&ds(i,e,t[e]);if(ja)for(var e of ja(t))by.call(t,e)&&ds(i,e,t[e]);return i},Ka=(i,t)=>Ey(i,yy(t)),He=(i,t,e)=>ds(i,typeof t!="symbol"?t+"":t,e);class Iy extends i_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,He(this,"events",new oi.EventEmitter),He(this,"name",lm),He(this,"queue",new Map),He(this,"publishTimeout",U.toMiliseconds(U.ONE_MINUTE)),He(this,"initialPublishTimeout",U.toMiliseconds(U.ONE_SECOND*15)),He(this,"needsTransportRestart",!1),He(this,"publish",async(r,n,s)=>{var o,c,l,h,u;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:n,opts:s}});const d=(s==null?void 0:s.ttl)||cm,_=(s==null?void 0:s.prompt)||!1,p=(s==null?void 0:s.tag)||0,f=(s==null?void 0:s.id)||Yt().toString(),w=gi(Gr().protocol),g={id:f,method:(s==null?void 0:s.publishMethod)||w.publish,params:_i({topic:r,message:n,ttl:d,prompt:_,tag:p,attestation:s==null?void 0:s.attestation},(s==null?void 0:s.tvf)&&{tvf:s.tvf})},I=`Failed to publish payload, please try again. id:${f} tag:${p}`;try{fe((o=g.params)==null?void 0:o.prompt)&&((c=g.params)==null||delete c.prompt),fe((l=g.params)==null?void 0:l.tag)&&((h=g.params)==null||delete h.tag);const T=new Promise(async y=>{const v=({id:D})=>{var N;((N=g.id)==null?void 0:N.toString())===D.toString()&&(this.removeRequestFromQueue(D),this.relayer.events.removeListener(le.publish,v),y())};this.relayer.events.on(le.publish,v);const b=_t(new Promise((D,N)=>{this.rpcPublish(g,s).then(D).catch(S=>{this.logger.warn(S,S==null?void 0:S.message),N(S)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${f} tag:${p}`);try{await b,this.events.removeListener(le.publish,v)}catch(D){this.queue.set(f,{request:g,opts:s,attempt:1}),this.logger.warn(D,D==null?void 0:D.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:r,message:n,opts:s}}),await _t(T,this.publishTimeout,I)}catch(T){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(T),(u=s==null?void 0:s.internal)!=null&&u.throwOnFailedPublish)throw T}finally{this.queue.delete(f)}}),He(this,"publishCustom",async r=>{var n,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:r});const{payload:h,opts:u={}}=r,{attestation:d,tvf:_,publishMethod:p,prompt:f,tag:w,ttl:g=U.FIVE_MINUTES}=u,I=u.id||Yt().toString(),T=gi(Gr().protocol),y=p||T.publish,v={id:I,method:y,params:_i(Ka(_i({},h),{ttl:g,prompt:f,tag:w,attestation:d}),_)},b=`Failed to publish custom payload, please try again. id:${I} tag:${w}`;try{fe((n=v.params)==null?void 0:n.prompt)&&((s=v.params)==null||delete s.prompt),fe((o=v.params)==null?void 0:o.tag)&&((c=v.params)==null||delete c.tag);const D=new Promise(async N=>{const S=({id:P})=>{var E;((E=v.id)==null?void 0:E.toString())===P.toString()&&(this.removeRequestFromQueue(P),this.relayer.events.removeListener(le.publish,S),N())};this.relayer.events.on(le.publish,S);const m=_t(new Promise((P,E)=>{this.rpcPublish(v,u).then(P).catch(A=>{this.logger.warn(A,A==null?void 0:A.message),E(A)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${y} id:${I} tag:${w}`);try{await m,this.events.removeListener(le.publish,S)}catch(P){this.queue.set(I,{request:v,opts:u,attempt:1}),this.logger.warn(P,P==null?void 0:P.message)}});this.logger.trace({type:"method",method:"publish",params:{id:I,payload:h,opts:u}}),await _t(D,this.publishTimeout,b)}catch(D){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(D),(l=u==null?void 0:u.internal)!=null&&l.throwOnFailedPublish)throw D}finally{this.queue.delete(I)}}),He(this,"on",(r,n)=>{this.events.on(r,n)}),He(this,"once",(r,n)=>{this.events.once(r,n)}),He(this,"off",(r,n)=>{this.events.off(r,n)}),He(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),this.relayer=t,this.logger=Le(e,this.name),this.registerEventListeners()}get context(){return Be(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const r=await this.relayer.request(t);return this.relayer.events.emit(le.publish,_i(_i({},t),e)),this.logger.debug("Successfully Published Payload"),r}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var r;const n=t.attempt+1;this.queue.set(e,Ka(_i({},t),{attempt:n})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(r=t.request.params)==null?void 0:r.tag}, attempt: ${n}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Pi.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(le.connection_stalled);return}this.checkQueue()}),this.relayer.on(le.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var Ay=Object.defineProperty,Py=(i,t,e)=>t in i?Ay(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,pi=(i,t,e)=>Py(i,typeof t!="symbol"?t+"":t,e);class Ty{constructor(){pi(this,"map",new Map),pi(this,"set",(t,e)=>{const r=this.get(t);this.exists(t,e)||this.map.set(t,[...r,e])}),pi(this,"get",t=>this.map.get(t)||[]),pi(this,"exists",(t,e)=>this.get(t).includes(e)),pi(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,e))return;const n=r.filter(s=>s!==e);if(!n.length){this.map.delete(t);return}this.map.set(t,n)}),pi(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var Oy=Object.defineProperty,Ry=Object.defineProperties,Dy=Object.getOwnPropertyDescriptors,Ha=Object.getOwnPropertySymbols,Ly=Object.prototype.hasOwnProperty,Vy=Object.prototype.propertyIsEnumerable,_s=(i,t,e)=>t in i?Oy(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,zi=(i,t)=>{for(var e in t||(t={}))Ly.call(t,e)&&_s(i,e,t[e]);if(Ha)for(var e of Ha(t))Vy.call(t,e)&&_s(i,e,t[e]);return i},Rn=(i,t)=>Ry(i,Dy(t)),re=(i,t,e)=>_s(i,typeof t!="symbol"?t+"":t,e);class xy extends s_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,re(this,"subscriptions",new Map),re(this,"topicMap",new Ty),re(this,"events",new oi.EventEmitter),re(this,"name",wm),re(this,"version",gm),re(this,"pending",new Map),re(this,"cached",[]),re(this,"initialized",!1),re(this,"storagePrefix",wt),re(this,"subscribeTimeout",U.toMiliseconds(U.ONE_MINUTE)),re(this,"initialSubscribeTimeout",U.toMiliseconds(U.ONE_SECOND*15)),re(this,"clientId"),re(this,"batchSubscribeTopicsLimit",500),re(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),re(this,"subscribe",async(r,n)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:n}});try{const o=Gr(n),c={topic:r,relay:o,transportType:n==null?void 0:n.transportType};(s=n==null?void 0:n.internal)!=null&&s.skipSubscribe||this.pending.set(r,c);const l=await this.rpcSubscribe(r,o,n);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:n}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),re(this,"unsubscribe",async(r,n)=>{this.isInitialized(),typeof(n==null?void 0:n.id)<"u"?await this.unsubscribeById(r,n.id,n):await this.unsubscribeByTopic(r,n)}),re(this,"isSubscribed",r=>new Promise(n=>{n(this.topicMap.topics.includes(r))})),re(this,"isKnownTopic",r=>new Promise(n=>{n(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(s=>s.topic===r))})),re(this,"on",(r,n)=>{this.events.on(r,n)}),re(this,"once",(r,n)=>{this.events.once(r,n)}),re(this,"off",(r,n)=>{this.events.off(r,n)}),re(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),re(this,"start",async()=>{await this.onConnect()}),re(this,"stop",async()=>{await this.onDisconnect()}),re(this,"restart",async()=>{await this.restore(),await this.onRestart()}),re(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(n=>{r.push(n)}),await this.batchSubscribe(r)}),re(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Pi.pulse,async()=>{await this.checkPending()}),this.events.on(qe.created,async r=>{const n=qe.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:r}),await this.persist()}),this.events.on(qe.deleted,async r=>{const n=qe.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:r}),await this.persist()})}),this.relayer=t,this.logger=Le(e,this.name),this.clientId=""}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,e){let r=!1;try{r=this.getSubscription(t).topic===e}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const r=this.topicMap.get(t);await Promise.all(r.map(async n=>await this.unsubscribeById(t,n,e)))}async unsubscribeById(t,e,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}});try{const n=Gr(r);await this.restartToComplete({topic:t,id:e,relay:n}),await this.rpcUnsubscribe(t,e,n);const s=ae("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(t,e,r){var n,s;const o=await this.getSubscriptionId(t);if((n=r==null?void 0:r.internal)!=null&&n.skipSubscribe)return o;(!r||(r==null?void 0:r.transportType)===se.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:gi(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=r==null?void 0:r.internal)==null?void 0:s.throwOnFailedPublish;try{if((r==null?void 0:r.transportType)===se.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(d=>this.logger.warn(d))},U.toMiliseconds(U.ONE_SECOND)),o;const h=new Promise(async d=>{const _=p=>{p.topic===t&&(this.events.removeListener(qe.created,_),d(p.id))};this.events.on(qe.created,_);try{const p=await _t(new Promise((f,w)=>{this.relayer.request(c).catch(g=>{this.logger.warn(g,g==null?void 0:g.message),w(g)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(qe.created,_),d(p)}catch{}}),u=await _t(h,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!u&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return u?o:null}catch(h){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(le.connection_stalled),l)throw h}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,r={method:gi(e.protocol).batchSubscribe,params:{topics:t.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await _t(new Promise(n=>{this.relayer.request(r).catch(s=>this.logger.warn(s)).then(n)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,r={method:gi(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let n;try{n=await await _t(new Promise((s,o)=>{this.relayer.request(r).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}return n}rpcUnsubscribe(t,e,r){const n={method:gi(r.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(t,e){this.setSubscription(t,Rn(zi({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,zi({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,r){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,r),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,zi({},e)),this.topicMap.set(e.topic,t),this.events.emit(qe.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:r}=k("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(qe.deleted,Rn(zi({},r),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(qe.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const n=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(qe.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var r;return e.topic===((r=this.subscriptions.get(e.id))==null?void 0:r.topic)})){const{message:e}=k("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Rn(zi({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await lf(U.toMiliseconds(U.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return Ge(t+await this.getClientId())}}var Sy=Object.defineProperty,Wa=Object.getOwnPropertySymbols,Cy=Object.prototype.hasOwnProperty,$y=Object.prototype.propertyIsEnumerable,ps=(i,t,e)=>t in i?Sy(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ga=(i,t)=>{for(var e in t||(t={}))Cy.call(t,e)&&ps(i,e,t[e]);if(Wa)for(var e of Wa(t))$y.call(t,e)&&ps(i,e,t[e]);return i},Z=(i,t,e)=>ps(i,typeof t!="symbol"?t+"":t,e);class ky extends r_{constructor(t){super(t),Z(this,"protocol","wc"),Z(this,"version",2),Z(this,"core"),Z(this,"logger"),Z(this,"events",new oi.EventEmitter),Z(this,"provider"),Z(this,"messages"),Z(this,"subscriber"),Z(this,"publisher"),Z(this,"name",hm),Z(this,"transportExplicitlyClosed",!1),Z(this,"initialized",!1),Z(this,"connectionAttemptInProgress",!1),Z(this,"relayUrl"),Z(this,"projectId"),Z(this,"packageName"),Z(this,"bundleId"),Z(this,"hasExperiencedNetworkDisruption",!1),Z(this,"pingTimeout"),Z(this,"heartBeatTimeout",U.toMiliseconds(U.THIRTY_SECONDS+U.FIVE_SECONDS)),Z(this,"reconnectTimeout"),Z(this,"connectPromise"),Z(this,"reconnectInProgress",!1),Z(this,"requestsInFlight",[]),Z(this,"connectTimeout",U.toMiliseconds(U.ONE_SECOND*15)),Z(this,"request",async e=>{var r,n;this.logger.debug("Publishing Request Payload");const s=e.id||Yt().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(r=e.params)==null?void 0:r.topic},"relayer.request - publishing...");const o=`${s}:${((n=e.params)==null?void 0:n.tag)||""}`;this.requestsInFlight.push(o);const c=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),Z(this,"resetPingTimeout",()=>{jr()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,r,n,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.terminate)==null||s.call(n)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Z(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),Z(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(le.connect)}),Z(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),Z(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(le.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Z(this,"registerProviderListeners",()=>{this.provider.on(Ke.payload,this.onPayloadHandler),this.provider.on(Ke.connect,this.onConnectHandler),this.provider.on(Ke.disconnect,this.onDisconnectHandler),this.provider.on(Ke.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Le(t.logger,this.name):Qr(qs({level:t.logger||um})),this.messages=new gy(this.logger,t.core),this.subscriber=new xy(this,this.logger),this.publisher=new Iy(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||du,Hp()?this.packageName=jo():Wp()&&(this.bundleId=jo()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return Be(this.logger)}get connected(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,r){this.isInitialized(),await this.publisher.publish(t,e,r),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:se.relay},Sr.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var r,n,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((r=e==null?void 0:e.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(n=e==null?void 0:e.internal)==null?void 0:n.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const h=u=>{u.topic===t&&(this.subscriber.off(qe.created,h),l())};return await Promise.all([new Promise(u=>{l=u,this.subscriber.on(qe.created,h)}),new Promise(async(u,d)=>{c=await this.subscriber.subscribe(t,Ga({internal:{throwOnFailedPublish:o}},e)).catch(_=>{o&&d(_)})||c,u()})]),c}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await _t(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(e,r)=>{await this.connect(t).then(e).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Ca())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((r,n)=>r.publishedAt-n.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const r of e)try{await this.onMessageEvent(r)}catch(n){this.logger.warn(n,"Error while processing batch message event: "+(n==null?void 0:n.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:r}=t;if(!e.sessionExists){const n=pe(U.FIVE_MINUTES),s={topic:r,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,s)}this.events.emit(le.message,t),await this.recordMessageEvent(t,Sr.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(r,n)=>{const s=()=>{n(new Error("Connection interrupted while trying to connect"))};this.provider.once(Ke.disconnect,s),await _t(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{n(o)}).finally(()=>{this.provider.off(Ke.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{n(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Ke.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Ke.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const n=r;this.logger.warn({},n.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(r=>setTimeout(r,U.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,r,n,s;if(jr())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Nh(new Uh(Qp({sdkVersion:cs,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:r,message:n}=t;await this.messages.set(r,n,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const n=this.messages.has(e,r);return n&&this.logger.warn(`Ignoring duplicate message: ${r}`),n}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),Ls(t)){if(!t.method.endsWith(dm))return;const e=t.params,{topic:r,message:n,publishedAt:s,attestation:o}=e.data,c={topic:r,message:n,publishedAt:s,transportType:se.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ga({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else Vs(t)&&this.events.emit(le.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,Sr.inbound),this.events.emit(le.message,t))}async acknowledgePayload(t){const e=Ur(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Ke.payload,this.onPayloadHandler),this.provider.off(Ke.connect,this.onConnectHandler),this.provider.off(Ke.disconnect,this.onDisconnectHandler),this.provider.off(Ke.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Ca();Mg(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Pi.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Kg())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(le.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},U.toMiliseconds(_m)))))}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function Ny(i,t){return i===t||Number.isNaN(i)&&Number.isNaN(t)}function Ja(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function Ya(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Uy="[object RegExp]",By="[object String]",Fy="[object Number]",qy="[object Boolean]",Za="[object Arguments]",My="[object Symbol]",zy="[object Date]",jy="[object Map]",Ky="[object Set]",Hy="[object Array]",Wy="[object Function]",Gy="[object ArrayBuffer]",Dn="[object Object]",Jy="[object Error]",Yy="[object DataView]",Zy="[object Uint8Array]",Qy="[object Uint8ClampedArray]",Xy="[object Uint16Array]",ev="[object Uint32Array]",tv="[object BigUint64Array]",iv="[object Int8Array]",rv="[object Int16Array]",nv="[object Int32Array]",sv="[object BigInt64Array]",ov="[object Float32Array]",av="[object Float64Array]";function cv(){}function Qa(i){if(!i||typeof i!="object")return!1;const t=Object.getPrototypeOf(i);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(i)==="[object Object]":!1}function lv(i,t,e){return Wi(i,t,void 0,void 0,void 0,void 0,e)}function Wi(i,t,e,r,n,s,o){const c=o(i,t,e,r,n,s);if(c!==void 0)return c;if(typeof i==typeof t)switch(typeof i){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return i===t;case"number":return i===t||Object.is(i,t);case"function":return i===t;case"object":return tr(i,t,s,o)}return tr(i,t,s,o)}function tr(i,t,e,r){if(Object.is(i,t))return!0;let n=Ya(i),s=Ya(t);if(n===Za&&(n=Dn),s===Za&&(s=Dn),n!==s)return!1;switch(n){case By:return i.toString()===t.toString();case Fy:{const l=i.valueOf(),h=t.valueOf();return Ny(l,h)}case qy:case zy:case My:return Object.is(i.valueOf(),t.valueOf());case Uy:return i.source===t.source&&i.flags===t.flags;case Wy:return i===t}e=e??new Map;const o=e.get(i),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(i,t),e.set(t,i);try{switch(n){case jy:{if(i.size!==t.size)return!1;for(const[l,h]of i.entries())if(!t.has(l)||!Wi(h,t.get(l),l,i,t,e,r))return!1;return!0}case Ky:{if(i.size!==t.size)return!1;const l=Array.from(i.values()),h=Array.from(t.values());for(let u=0;u<l.length;u++){const d=l[u],_=h.findIndex(p=>Wi(d,p,void 0,i,t,e,r));if(_===-1)return!1;h.splice(_,1)}return!0}case Hy:case Zy:case Qy:case Xy:case ev:case tv:case iv:case rv:case nv:case sv:case ov:case av:{if(typeof ee<"u"&&ee.isBuffer(i)!==ee.isBuffer(t)||i.length!==t.length)return!1;for(let l=0;l<i.length;l++)if(!Wi(i[l],t[l],l,i,t,e,r))return!1;return!0}case Gy:return i.byteLength!==t.byteLength?!1:tr(new Uint8Array(i),new Uint8Array(t),e,r);case Yy:return i.byteLength!==t.byteLength||i.byteOffset!==t.byteOffset?!1:tr(new Uint8Array(i),new Uint8Array(t),e,r);case Jy:return i.name===t.name&&i.message===t.message;case Dn:{if(!(tr(i.constructor,t.constructor,e,r)||Qa(i)&&Qa(t)))return!1;const l=[...Object.keys(i),...Ja(i)],h=[...Object.keys(t),...Ja(t)];if(l.length!==h.length)return!1;for(let u=0;u<l.length;u++){const d=l[u],_=i[d];if(!Object.hasOwn(t,d))return!1;const p=t[d];if(!Wi(_,p,d,i,t,e,r))return!1}return!0}default:return!1}}finally{e.delete(i),e.delete(t)}}function uv(i,t){return lv(i,t,cv)}var hv=Object.defineProperty,Xa=Object.getOwnPropertySymbols,dv=Object.prototype.hasOwnProperty,_v=Object.prototype.propertyIsEnumerable,fs=(i,t,e)=>t in i?hv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ec=(i,t)=>{for(var e in t||(t={}))dv.call(t,e)&&fs(i,e,t[e]);if(Xa)for(var e of Xa(t))_v.call(t,e)&&fs(i,e,t[e]);return i},Ve=(i,t,e)=>fs(i,typeof t!="symbol"?t+"":t,e);class ai extends n_{constructor(t,e,r,n=wt,s=void 0){super(t,e,r,n),this.core=t,this.logger=e,this.name=r,Ve(this,"map",new Map),Ve(this,"version",pm),Ve(this,"cached",[]),Ve(this,"initialized",!1),Ve(this,"getKey"),Ve(this,"storagePrefix",wt),Ve(this,"recentlyDeleted",[]),Ve(this,"recentlyDeletedLimit",200),Ve(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!fe(o)?this.map.set(this.getKey(o),o):Eg(o)?this.map.set(o.id,o):yg(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),Ve(this,"set",async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),await this.persist())}),Ve(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),Ve(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>uv(c[l],o[l]))):this.values)),Ve(this,"update",async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});const l=ec(ec({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),Ve(this,"delete",async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=Le(e,this.name),this.storagePrefix=n,this.getKey=s}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:n}=k("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}const{message:r}=k("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=k("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var pv=Object.defineProperty,fv=(i,t,e)=>t in i?pv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,G=(i,t,e)=>fv(i,typeof t!="symbol"?t+"":t,e);class wv{constructor(t,e){this.core=t,this.logger=e,G(this,"name",mm),G(this,"version",Em),G(this,"events",new vc),G(this,"pairings"),G(this,"initialized",!1),G(this,"storagePrefix",wt),G(this,"ignoredPayloadTypes",[Pt]),G(this,"registeredMethods",[]),G(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),G(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),G(this,"create",async r=>{this.isInitialized();const n=os(),s=await this.core.crypto.setSymKey(n),o=pe(U.FIVE_MINUTES),c={protocol:hu},l={topic:s,expiry:o,relay:c,active:!1,methods:r==null?void 0:r.methods},h=Pa({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:c,expiryTimestamp:o,methods:r==null?void 0:r.methods});return this.events.emit(Jt.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:r==null?void 0:r.transportType,internal:r==null?void 0:r.internal}),{topic:s,uri:h}}),G(this,"pair",async r=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[ht.pairing_started]}});this.isValidPair(r,n);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:h}=Aa(r.uri);n.props.properties.topic=s,n.addTrace(ht.pairing_uri_validation_success),n.addTrace(ht.pairing_uri_not_expired);let u;if(this.pairings.keys.includes(s)){if(u=this.pairings.get(s),n.addTrace(ht.existing_pairing),u.active)throw n.setError(bt.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(ht.pairing_not_expired)}const d=l||pe(U.FIVE_MINUTES),_={topic:s,relay:c,expiry:d,active:!1,methods:h};this.core.expirer.set(s,d),await this.pairings.set(s,_),n.addTrace(ht.store_new_pairing),r.activatePairing&&await this.activate({topic:s}),this.events.emit(Jt.create,_),n.addTrace(ht.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),n.addTrace(ht.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(bt.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(p){throw n.setError(bt.subscribe_pairing_topic_failure),p}return n.addTrace(ht.subscribe_pairing_topic_success),_}),G(this,"activate",async({topic:r})=>{this.isInitialized();const n=pe(U.FIVE_MINUTES);this.core.expirer.set(r,n),await this.pairings.update(r,{active:!0,expiry:n})}),G(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:n}=r;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Gt();this.events.once(Q("pairing_ping",s),({error:h})=>{h?l(h):c()}),await o()}}),G(this,"updateExpiry",async({topic:r,expiry:n})=>{this.isInitialized(),await this.pairings.update(r,{expiry:n})}),G(this,"updateMetadata",async({topic:r,metadata:n})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:n})}),G(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),G(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",ae("USER_DISCONNECTED")),await this.deletePairing(n))}),G(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:n,relay:s,expiry:o,methods:c}=r,l=this.core.crypto.keychain.get(n);return Pa({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),G(this,"sendRequest",async(r,n,s)=>{const o=$t(n,s),c=await this.core.crypto.encode(r,o),l=Fi[n].req;return this.core.history.set(r,o),this.core.relayer.publish(r,c,l),o.id}),G(this,"sendResult",async(r,n,s)=>{const o=Ur(r,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,r)).request.method,h=Fi[l].res;await this.core.relayer.publish(n,c,h),await this.core.history.resolve(o)}),G(this,"sendError",async(r,n,s)=>{const o=Ac(r,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,r)).request.method,h=Fi[l]?Fi[l].res:Fi.unregistered_method.res;await this.core.relayer.publish(n,c,h),await this.core.history.resolve(o)}),G(this,"deletePairing",async(r,n)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,ae("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),n?Promise.resolve():this.core.expirer.del(r)])}),G(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(n=>kt(n.expiry));await Promise.all(r.map(n=>this.deletePairing(n.topic)))}),G(this,"onRelayEventRequest",async r=>{const{topic:n,payload:s}=r;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(n,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(n,s);default:return await this.onUnknownRpcMethodRequest(n,s)}}),G(this,"onRelayEventResponse",async r=>{const{topic:n,payload:s}=r,o=(await this.core.history.get(n,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}}),G(this,"onPairingPingRequest",async(r,n)=>{const{id:s}=n;try{this.isValidPing({topic:r}),await this.sendResult(s,r,!0),this.events.emit(Jt.ping,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),G(this,"onPairingPingResponse",(r,n)=>{const{id:s}=n;setTimeout(()=>{yt(n)?this.events.emit(Q("pairing_ping",s),{}):dt(n)&&this.events.emit(Q("pairing_ping",s),{error:n.error})},500)}),G(this,"onPairingDeleteRequest",async(r,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(Jt.delete,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),G(this,"onUnknownRpcMethodRequest",async(r,n)=>{const{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;const c=ae("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,r,c),this.logger.error(c)}catch(c){await this.sendError(s,r,c),this.logger.error(c)}}),G(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(ae("WC_METHOD_UNSUPPORTED",r))}),G(this,"isValidPair",(r,n)=>{var s;if(!xe(r)){const{message:c}=k("MISSING_OR_INVALID",`pair() params: ${r}`);throw n.setError(bt.malformed_pairing_uri),new Error(c)}if(!mg(r.uri)){const{message:c}=k("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw n.setError(bt.malformed_pairing_uri),new Error(c)}const o=Aa(r==null?void 0:r.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:c}=k("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(bt.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=k("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(bt.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&U.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){n.setError(bt.pairing_expired);const{message:c}=k("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),G(this,"isValidPing",async r=>{if(!xe(r)){const{message:s}=k("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidPairingTopic(n)}),G(this,"isValidDisconnect",async r=>{if(!xe(r)){const{message:s}=k("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidPairingTopic(n)}),G(this,"isValidPairingTopic",async r=>{if(!de(r,!1)){const{message:n}=k("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(n)}if(!this.pairings.keys.includes(r)){const{message:n}=k("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(n)}if(kt(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:n}=k("EXPIRED",`pairing topic: ${r}`);throw new Error(n)}}),this.core=t,this.logger=Le(e,this.name),this.pairings=new ai(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Be(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(le.message,async t=>{const{topic:e,message:r,transportType:n}=t;if(this.pairings.keys.includes(e)&&n!==se.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const s=await this.core.crypto.decode(e,r);Ls(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):Vs(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,r)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(We.expired,async t=>{const{topic:e}=fl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Jt.expire,{topic:e}))})}}var gv=Object.defineProperty,mv=(i,t,e)=>t in i?gv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ee=(i,t,e)=>mv(i,typeof t!="symbol"?t+"":t,e);class Ev extends e_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Ee(this,"records",new Map),Ee(this,"events",new oi.EventEmitter),Ee(this,"name",ym),Ee(this,"version",vm),Ee(this,"cached",[]),Ee(this,"initialized",!1),Ee(this,"storagePrefix",wt),Ee(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Ee(this,"set",(r,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:n,chainId:s}),this.records.has(n.id))return;const o={id:n.id,topic:r,request:{method:n.method,params:n.params||null},chainId:s,expiry:pe(U.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(et.created,o)}),Ee(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const n=await this.getRecord(r.id);typeof n.response>"u"&&(n.response=dt(r)?{error:r.error}:{result:r.result},this.records.set(n.id,n),this.persist(),this.events.emit(et.updated,n))}),Ee(this,"get",async(r,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:n}),await this.getRecord(n))),Ee(this,"delete",(r,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===r){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(et.deleted,s)}}),this.persist()}),Ee(this,"exists",async(r,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===r:!1)),Ee(this,"on",(r,n)=>{this.events.on(r,n)}),Ee(this,"once",(r,n)=>{this.events.once(r,n)}),Ee(this,"off",(r,n)=>{this.events.off(r,n)}),Ee(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),this.logger=Le(e,this.name)}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const r={topic:e.topic,request:$t(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(r)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:r}=k("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(et.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=k("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(et.created,t=>{const e=et.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(et.updated,t=>{const e=et.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(et.deleted,t=>{const e=et.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Pi.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{U.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(et.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var yv=Object.defineProperty,vv=(i,t,e)=>t in i?yv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Pe=(i,t,e)=>vv(i,typeof t!="symbol"?t+"":t,e);class bv extends o_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Pe(this,"expirations",new Map),Pe(this,"events",new oi.EventEmitter),Pe(this,"name",bm),Pe(this,"version",Im),Pe(this,"cached",[]),Pe(this,"initialized",!1),Pe(this,"storagePrefix",wt),Pe(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Pe(this,"has",r=>{try{const n=this.formatTarget(r);return typeof this.getExpiration(n)<"u"}catch{return!1}}),Pe(this,"set",(r,n)=>{this.isInitialized();const s=this.formatTarget(r),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(We.created,{target:s,expiration:o})}),Pe(this,"get",r=>{this.isInitialized();const n=this.formatTarget(r);return this.getExpiration(n)}),Pe(this,"del",r=>{if(this.isInitialized(),this.has(r)){const n=this.formatTarget(r),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(We.deleted,{target:n,expiration:s})}}),Pe(this,"on",(r,n)=>{this.events.on(r,n)}),Pe(this,"once",(r,n)=>{this.events.once(r,n)}),Pe(this,"off",(r,n)=>{this.events.off(r,n)}),Pe(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),this.logger=Le(e,this.name)}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if(typeof t=="string")return Xp(t);if(typeof t=="number")return ef(t);const{message:e}=k("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(We.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=k("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:r}=k("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return e}checkExpiry(t,e){const{expiry:r}=e;U.toMiliseconds(r)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(We.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Pi.pulse,()=>this.checkExpirations()),this.events.on(We.created,t=>{const e=We.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(We.expired,t=>{const e=We.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(We.deleted,t=>{const e=We.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Iv=Object.defineProperty,Av=(i,t,e)=>t in i?Iv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,he=(i,t,e)=>Av(i,typeof t!="symbol"?t+"":t,e);class Pv extends a_{constructor(t,e,r){super(t,e,r),this.core=t,this.logger=e,this.store=r,he(this,"name",Am),he(this,"abortController"),he(this,"isDevEnv"),he(this,"verifyUrlV3",Tm),he(this,"storagePrefix",wt),he(this,"version",uu),he(this,"publicKey"),he(this,"fetchPromise"),he(this,"init",async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&U.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),he(this,"register",async n=>{if(!Di()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=n,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const h=mi(),u=this.startAbortTimer(U.ONE_SECOND*5),d=await new Promise((_,p)=>{const f=()=>{window.removeEventListener("message",g),h.body.removeChild(w),p("attestation aborted")};this.abortController.signal.addEventListener("abort",f);const w=h.createElement("iframe");w.src=l,w.style.display="none",w.addEventListener("error",f,{signal:this.abortController.signal});const g=I=>{if(I.data&&typeof I.data=="string")try{const T=JSON.parse(I.data);if(T.type==="verify_attestation"){if(Bn(T.attestation).payload.id!==o)return;clearInterval(u),h.body.removeChild(w),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",g),_(T.attestation===null?"":T.attestation)}}catch(T){this.logger.warn(T)}};h.body.appendChild(w),window.addEventListener("message",g,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(h){this.logger.warn(h)}return""}),he(this,"resolve",async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Bn(s).payload.id!==c)return;const h=await this.isValidJwtAttestation(s);if(h){if(!h.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return h}}if(!o)return;const l=this.getVerifyUrl(n==null?void 0:n.verifyUrl);return this.fetchAttestation(o,l)}),he(this,"fetchAttestation",async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const o=this.startAbortTimer(U.ONE_SECOND*5),c=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),he(this,"getVerifyUrl",n=>{let s=n||er;return Om.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${er}`),s=er),s}),he(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(U.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}}),he(this,"persistPublicKey",async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n}),he(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),he(this,"isValidJwtAttestation",async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(n,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),he(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),he(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n}),he(this,"validateAttestation",(n,s)=>{const o=Y0(n,s.publicKey),c={hasExpired:U.toMiliseconds(o.exp)<Date.now(),payload:o};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=Le(e,this.name),this.abortController=new AbortController,this.isDevEnv=Hs(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Be(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),U.toMiliseconds(t))}}var Tv=Object.defineProperty,Ov=(i,t,e)=>t in i?Tv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,tc=(i,t,e)=>Ov(i,typeof t!="symbol"?t+"":t,e);class Rv extends c_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,tc(this,"context",Rm),tc(this,"registerDeviceToken",async r=>{const{clientId:n,token:s,notificationType:o,enableEncrypted:c=!1}=r,l=`${Dm}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:o,token:s,always_raw:c})})}),this.logger=Le(e,this.context)}}var Dv=Object.defineProperty,ic=Object.getOwnPropertySymbols,Lv=Object.prototype.hasOwnProperty,Vv=Object.prototype.propertyIsEnumerable,ws=(i,t,e)=>t in i?Dv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ji=(i,t)=>{for(var e in t||(t={}))Lv.call(t,e)&&ws(i,e,t[e]);if(ic)for(var e of ic(t))Vv.call(t,e)&&ws(i,e,t[e]);return i},we=(i,t,e)=>ws(i,typeof t!="symbol"?t+"":t,e);class xv extends l_{constructor(t,e,r=!0){super(t,e,r),this.core=t,this.logger=e,we(this,"context",Vm),we(this,"storagePrefix",wt),we(this,"storageVersion",Lm),we(this,"events",new Map),we(this,"shouldPersist",!1),we(this,"init",async()=>{if(!Hs())try{const n={eventId:Ho(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:_l(this.core.relayer.protocol,this.core.relayer.version,cs)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}}),we(this,"createEvent",n=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=n,h=Ho(),u=this.core.projectId||"",d=Date.now(),_=ji({eventId:h,timestamp:d,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:u,domain:this.getAppDomain()},this.setMethods(h));return this.telemetryEnabled&&(this.events.set(h,_),this.shouldPersist=!0),_}),we(this,"getEvent",n=>{const{eventId:s,topic:o}=n;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return ji(ji({},c),this.setMethods(c.eventId))}),we(this,"deleteEvent",n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0}),we(this,"setEventListeners",()=>{this.core.heartbeat.on(Pi.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{U.fromMiliseconds(Date.now())-U.fromMiliseconds(n.timestamp)>xm&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})}),we(this,"setMethods",n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)})),we(this,"addTrace",(n,s)=>{const o=this.events.get(n);o&&(o.props.properties.trace.push(s),this.events.set(n,o),this.shouldPersist=!0)}),we(this,"setError",(n,s)=>{const o=this.events.get(n);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(n,o),this.shouldPersist=!0)}),we(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),we(this,"restore",async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,ji(ji({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}}),we(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,o]of this.events)o.props.type&&n.push(o);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),we(this,"sendEvent",async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Sm}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${cs}${s}`,{method:"POST",body:JSON.stringify(n)})}),we(this,"getAppDomain",()=>dl().url),this.logger=Le(e,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Sv=Object.defineProperty,rc=Object.getOwnPropertySymbols,Cv=Object.prototype.hasOwnProperty,$v=Object.prototype.propertyIsEnumerable,gs=(i,t,e)=>t in i?Sv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,nc=(i,t)=>{for(var e in t||(t={}))Cv.call(t,e)&&gs(i,e,t[e]);if(rc)for(var e of rc(t))$v.call(t,e)&&gs(i,e,t[e]);return i},ne=(i,t,e)=>gs(i,typeof t!="symbol"?t+"":t,e);class oo extends Yd{constructor(t){var e;super(t),ne(this,"protocol",lu),ne(this,"version",uu),ne(this,"name",Yr),ne(this,"relayUrl"),ne(this,"projectId"),ne(this,"customStoragePrefix"),ne(this,"events",new oi.EventEmitter),ne(this,"logger"),ne(this,"heartbeat"),ne(this,"relayer"),ne(this,"crypto"),ne(this,"storage"),ne(this,"history"),ne(this,"expirer"),ne(this,"pairing"),ne(this,"verify"),ne(this,"echoClient"),ne(this,"linkModeSupportedApps"),ne(this,"eventClient"),ne(this,"initialized",!1),ne(this,"logChunkController"),ne(this,"on",(c,l)=>this.events.on(c,l)),ne(this,"once",(c,l)=>this.events.once(c,l)),ne(this,"off",(c,l)=>this.events.off(c,l)),ne(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ne(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:h})=>{if(!c||!l)return;const u={topic:c,message:l,publishedAt:Date.now(),transportType:se.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:h})});const r=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}catch(c){console.warn("Failed to copy global core",c)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||du,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const n=qs({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:em.logger,name:Yr}),{logger:s,chunkLoggerController:o}=Wd({opts:n,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Le(s,this.name),this.heartbeat=new $h,this.crypto=new ly(this,this.logger,t==null?void 0:t.keychain),this.history=new Ev(this,this.logger),this.expirer=new bv(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new kh(nc(nc({},tm),t==null?void 0:t.storageOptions)),this.relayer=new ky({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new wv(this,this.logger),this.verify=new Pv(this,this.logger,this.storage),this.echoClient=new Rv(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new xv(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new oo(t);await e.initialize();const r=await e.crypto.getClientId();return await e.storage.setItem(fm,r),e}get context(){return Be(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(ka,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(ka)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,r=`${e}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof Mt<"u"&&{}.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const kv=oo,Pu="wc",Tu=2,Ou="client",ao=`${Pu}@${Tu}:${Ou}:`,Ln={name:Ou,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},sc="WALLETCONNECT_DEEPLINK_CHOICE",Nv="proposal",oc="Proposal expired",Uv="session",fi=U.SEVEN_DAYS,Bv="engine",ye={wc_sessionPropose:{req:{ttl:U.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1104},res:{ttl:U.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1106},res:{ttl:U.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:U.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:U.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1112},res:{ttl:U.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1114},res:{ttl:U.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:U.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:U.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1119}}},Vn={min:U.FIVE_MINUTES,max:U.SEVEN_DAYS},ut={idle:"IDLE",active:"ACTIVE"},Fv={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},qv="request",Mv=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],zv="wc",jv="auth",Kv="authKeys",Hv="pairingTopics",Wv="requests",cn=`${zv}@${1.5}:${jv}:`,Cr=`${cn}:PUB_KEY`;var Gv=Object.defineProperty,Jv=Object.defineProperties,Yv=Object.getOwnPropertyDescriptors,ac=Object.getOwnPropertySymbols,Zv=Object.prototype.hasOwnProperty,Qv=Object.prototype.propertyIsEnumerable,ms=(i,t,e)=>t in i?Gv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,X=(i,t)=>{for(var e in t||(t={}))Zv.call(t,e)&&ms(i,e,t[e]);if(ac)for(var e of ac(t))Qv.call(t,e)&&ms(i,e,t[e]);return i},Te=(i,t)=>Jv(i,Yv(t)),R=(i,t,e)=>ms(i,typeof t!="symbol"?t+"":t,e);class Xv extends __{constructor(t){super(t),R(this,"name",Bv),R(this,"events",new vc),R(this,"initialized",!1),R(this,"requestQueue",{state:ut.idle,queue:[]}),R(this,"sessionRequestQueue",{state:ut.idle,queue:[]}),R(this,"emittedSessionRequests",new uf({limit:500})),R(this,"requestQueueDelay",U.ONE_SECOND),R(this,"expectedPairingMethodMap",new Map),R(this,"recentlyDeletedMap",new Map),R(this,"recentlyDeletedLimit",200),R(this,"relayMessageCache",[]),R(this,"pendingSessions",new Map),R(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(ye)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},U.toMiliseconds(this.requestQueueDelay)))}),R(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=Te(X({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(r),r.optionalNamespaces=_g(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:h}=r;let u=n,d,_=!1;try{if(u){const D=this.client.core.pairing.pairings.get(u);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),_=D.active}}catch(D){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),D}if(!u||!_){const{topic:D,uri:N}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});u=D,d=N}if(!u){const{message:D}=k("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(D)}const p=await this.client.core.crypto.generateKeyPair(),f=ye.wc_sessionPropose.req.ttl||U.FIVE_MINUTES,w=pe(f),g=Te(X(X({requiredNamespaces:s,optionalNamespaces:o,relays:h??[{protocol:hu}],proposer:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:w,pairingTopic:u},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Ot()}),I=Q("session_connect",g.id),{reject:T,resolve:y,done:v}=Gt(f,oc),b=({id:D})=>{D===g.id&&(this.client.events.off("proposal_expire",b),this.pendingSessions.delete(g.id),this.events.emit(I,{error:{message:oc,code:0}}))};return this.client.events.on("proposal_expire",b),this.events.once(I,({error:D,session:N})=>{this.client.events.off("proposal_expire",b),D?T(D):N&&y(N)}),await this.sendProposeSession({proposal:g,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:g.id}}}),await this.setProposal(g.id,g),{uri:d,approval:v}}),R(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(r){throw this.client.logger.error("pair() failed"),r}}),R(this,"approve",async e=>{var r,n,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=e==null?void 0:e.id)==null?void 0:r.toString(),trace:[Ct.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(m){throw o.setError(qi.no_internet_connection),m}try{await this.isValidProposalId(e==null?void 0:e.id)}catch(m){throw this.client.logger.error(`approve() -> proposal.get(${e==null?void 0:e.id}) failed`),o.setError(qi.proposal_not_found),m}try{await this.isValidApprove(e)}catch(m){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(qi.session_approve_namespace_validation_failure),m}const{id:c,relayProtocol:l,namespaces:h,sessionProperties:u,scopedProperties:d,sessionConfig:_}=e,p=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:f,proposer:w,requiredNamespaces:g,optionalNamespaces:I}=p;let T=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:f});T||(T=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Ct.session_approve_started,properties:{topic:f,trace:[Ct.session_approve_started,Ct.session_namespaces_validation_success]}}));const y=await this.client.core.crypto.generateKeyPair(),v=w.publicKey,b=await this.client.core.crypto.generateSharedKey(y,v),D=X(X(X({relay:{protocol:l??"irn"},namespaces:h,controller:{publicKey:y,metadata:this.client.metadata},expiry:pe(fi)},u&&{sessionProperties:u}),d&&{scopedProperties:d}),_&&{sessionConfig:_}),N=se.relay;T.addTrace(Ct.subscribing_session_topic);try{await this.client.core.relayer.subscribe(b,{transportType:N,internal:{skipSubscribe:!0}})}catch(m){throw T.setError(qi.subscribe_session_topic_failure),m}T.addTrace(Ct.subscribe_session_topic_success);const S=Te(X({},D),{topic:b,requiredNamespaces:g,optionalNamespaces:I,pairingTopic:f,acknowledged:!1,self:D.controller,peer:{publicKey:w.publicKey,metadata:w.metadata},controller:y,transportType:se.relay});await this.client.session.set(b,S),T.addTrace(Ct.store_session);try{await this.sendApproveSession({sessionTopic:b,proposal:p,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:y},sessionSettleRequest:D,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),T.addTrace(Ct.session_approve_publish_success)}catch(m){throw this.client.logger.error(m),this.client.session.delete(b,ae("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(b),m}return this.client.core.eventClient.deleteEvent({eventId:T.eventId}),await this.client.core.pairing.updateMetadata({topic:f,metadata:w.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(b,pe(fi)),{topic:b,acknowledged:()=>Promise.resolve(this.client.session.get(b))}}),R(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:r,reason:n}=e;let s;try{s=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}s&&await this.sendError({id:r,topic:s,error:n,rpcOpts:ye.wc_sessionPropose.reject}),await this.deleteProposal(r)}),R(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:n}=e,{done:s,resolve:o,reject:c}=Gt(),l=Ot(),h=Yt().toString(),u=this.client.session.get(r).namespaces;return this.events.once(Q("session_update",l),({error:d})=>{d?c(d):o()}),await this.client.session.update(r,{namespaces:n}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:h}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:u}),c(d)}),{acknowledged:s}}),R(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:r}=e,n=Ot(),{done:s,resolve:o,reject:c}=Gt();return this.events.once(Q("session_extend",n),({error:l})=>{l?c(l):o()}),await this.setExpiry(r,pe(fi)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),R(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(g){throw this.client.logger.error("request() -> isValidRequest() failed"),g}const{chainId:r,request:n,topic:s,expiry:o=ye.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);(c==null?void 0:c.transportType)===se.relay&&await this.confirmOnlineStateOrThrow();const l=Ot(),h=Yt().toString(),{done:u,resolve:d,reject:_}=Gt(o,"Request expired. Please try again.");this.events.once(Q("session_request",l),({error:g,result:I})=>{g?_(g):d(I)});const p="wc_sessionRequest",f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(f)return await this.sendRequest({clientRpcId:l,relayRpcId:h,topic:s,method:p,params:{request:Te(X({},n),{expiryTimestamp:pe(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(g=>_(g)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:r,id:l}),await u();const w={request:Te(X({},n),{expiryTimestamp:pe(o)}),chainId:r};return await Promise.all([new Promise(async g=>{await this.sendRequest({clientRpcId:l,relayRpcId:h,topic:s,method:p,params:w,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,w)}).catch(I=>_(I)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:r,id:l}),g()}),new Promise(async g=>{var I;if(!((I=c.sessionConfig)!=null&&I.disableDeepLink)){const T=await sf(this.client.core.storage,sc);await tf({id:l,topic:s,wcDeepLink:T})}g()}),u()]).then(g=>g[2])}),R(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:r,response:n}=e,{id:s}=n,o=this.client.session.get(r);o.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);yt(n)?await this.sendResult({id:s,topic:r,result:n.result,throwOnFailedPublish:!0,appLink:c}):dt(n)&&await this.sendError({id:s,topic:r,error:n.error,appLink:c}),this.cleanupAfterResponse(e)}),R(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:r}=e;if(this.client.session.keys.includes(r)){const n=Ot(),s=Yt().toString(),{done:o,resolve:c,reject:l}=Gt();this.events.once(Q("session_ping",n),({error:h})=>{h?l(h):c()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:r}))}),R(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:r,event:n,chainId:s}=e,o=Yt().toString(),c=Ot();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),R(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:r}=e;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:ae("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:n}=k("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(n)}}),R(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(r=>wg(r,e)))),R(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),R(this,"authenticate",async(e,r)=>{var n;this.isInitialized(),this.isValidAuthenticate(e);const s=r&&this.client.core.linkModeSupportedApps.includes(r)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),o=s?se.link_mode:se.relay;o===se.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:h,domain:u,nonce:d,type:_,exp:p,nbf:f,methods:w=[],expiry:g}=e,I=[...e.resources||[]],{topic:T,uri:y}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:T,uri:y}});const v=await this.client.core.crypto.generateKeyPair(),b=xr(v);if(await Promise.all([this.client.auth.authKeys.set(Cr,{responseTopic:b,publicKey:v}),this.client.auth.pairingTopics.set(b,{topic:b,pairingTopic:T})]),await this.client.core.relayer.subscribe(b,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${T}`),w.length>0){const{namespace:L}=Lr(c[0]);let M=vw(L,"request",w);Vr(I)&&(M=Iw(M,I.pop())),I.push(M)}const D=g&&g>ye.wc_sessionAuthenticate.req.ttl?g:ye.wc_sessionAuthenticate.req.ttl,N={authPayload:{type:_??"caip122",chains:c,statement:l,aud:h,domain:u,version:"1",nonce:d,iat:new Date().toISOString(),exp:p,nbf:f,resources:I},requester:{publicKey:v,metadata:this.client.metadata},expiryTimestamp:pe(D)},S={eip155:{chains:c,methods:[...new Set(["personal_sign",...w])],events:["chainChanged","accountsChanged"]}},m={requiredNamespaces:{},optionalNamespaces:S,relays:[{protocol:"irn"}],pairingTopic:T,proposer:{publicKey:v,metadata:this.client.metadata},expiryTimestamp:pe(ye.wc_sessionPropose.req.ttl),id:Ot()},{done:P,resolve:E,reject:A}=Gt(D,"Request expired"),O=Ot(),V=Q("session_connect",m.id),x=Q("session_request",O),C=async({error:L,session:M})=>{this.events.off(x,$),L?A(L):M&&E({session:M})},$=async L=>{var M,q,z;if(await this.deletePendingAuthRequest(O,{message:"fulfilled",code:0}),L.error){const oe=ae("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return L.error.code===oe.code?void 0:(this.events.off(V,C),A(L.error.message))}await this.deleteProposal(m.id),this.events.off(V,C);const{cacaos:H,responder:K}=L.result,W=[],ie=[];for(const oe of H){await ra({cacao:oe,projectId:this.client.core.projectId})||(this.client.logger.error(oe,"Signature verification failed"),A(ae("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:je}=oe,gt=Vr(je.resources),uo=[Zn(je.iss)],$u=Kr(je.iss);if(gt){const un=na(gt),ku=sa(gt);W.push(...un),uo.push(...ku)}for(const un of uo)ie.push(`${un}:${$u}`)}const ue=await this.client.core.crypto.generateSharedKey(v,K.publicKey);let ce;W.length>0&&(ce={topic:ue,acknowledged:!0,self:{publicKey:v,metadata:this.client.metadata},peer:K,controller:K.publicKey,expiry:pe(fi),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:T,namespaces:Da([...new Set(W)],[...new Set(ie)]),transportType:o},await this.client.core.relayer.subscribe(ue,{transportType:o}),await this.client.session.set(ue,ce),T&&await this.client.core.pairing.updateMetadata({topic:T,metadata:K.metadata}),ce=this.client.session.get(ue)),(M=this.client.metadata.redirect)!=null&&M.linkMode&&(q=K.metadata.redirect)!=null&&q.linkMode&&(z=K.metadata.redirect)!=null&&z.universal&&r&&(this.client.core.addLinkModeSupportedApp(K.metadata.redirect.universal),this.client.session.update(ue,{transportType:se.link_mode})),E({auths:H,session:ce})};this.events.once(V,C),this.events.once(x,$);let F;try{if(s){const L=$t("wc_sessionAuthenticate",N,O);this.client.core.history.set(T,L);const M=await this.client.core.crypto.encode("",L,{type:gr,encoding:Ft});F=Rr(r,T,M)}else await Promise.all([this.sendRequest({topic:T,method:"wc_sessionAuthenticate",params:N,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:O}),this.sendRequest({topic:T,method:"wc_sessionPropose",params:m,expiry:ye.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:m.id})])}catch(L){throw this.events.off(V,C),this.events.off(x,$),L}return await this.setProposal(m.id,m),await this.setAuthRequest(O,{request:Te(X({},N),{verifyContext:{}}),pairingTopic:T,transportType:o}),{uri:F??y,response:P}}),R(this,"approveSessionAuthenticate",async e=>{const{id:r,auths:n}=e,s=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[Wt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(g){throw s.setError(Mi.no_internet_connection),g}const o=this.getPendingAuthRequest(r);if(!o)throw s.setError(Mi.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const c=o.transportType||se.relay;c===se.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),u=xr(l),d={type:Pt,receiverPublicKey:l,senderPublicKey:h},_=[],p=[];for(const g of n){if(!await ra({cacao:g,projectId:this.client.core.projectId})){s.setError(Mi.invalid_cacao);const b=ae("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:u,error:b,encodeOpts:d}),new Error(b.message)}s.addTrace(Wt.cacaos_verified);const{p:I}=g,T=Vr(I.resources),y=[Zn(I.iss)],v=Kr(I.iss);if(T){const b=na(T),D=sa(T);_.push(...b),y.push(...D)}for(const b of y)p.push(`${b}:${v}`)}const f=await this.client.core.crypto.generateSharedKey(h,l);s.addTrace(Wt.create_authenticated_session_topic);let w;if((_==null?void 0:_.length)>0){w={topic:f,acknowledged:!0,self:{publicKey:h,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:pe(fi),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Da([...new Set(_)],[...new Set(p)]),transportType:c},s.addTrace(Wt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(g){throw s.setError(Mi.subscribe_authenticated_session_topic_failure),g}s.addTrace(Wt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,w),s.addTrace(Wt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Wt.publishing_authenticated_session_approve);try{await this.sendResult({topic:u,id:r,result:{cacaos:n,responder:{publicKey:h,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(g){throw s.setError(Mi.authenticated_session_approve_publish_failure),g}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:w}}),R(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:r,reason:n}=e,s=this.getPendingAuthRequest(r);if(!s)throw new Error(`Could not find pending auth request with id ${r}`);s.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=xr(o),h={type:Pt,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:r,topic:l,error:n,encodeOpts:h,rpcOpts:ye.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.deleteProposal(r)}),R(this,"formatAuthMessage",e=>{this.isInitialized();const{request:r,iss:n}=e;return Ll(r,n)}),R(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),R(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const r=this.client.core.pairing.pairings.get(e.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===e.peer.metadata.url&&s.topic&&s.topic!==r.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),R(this,"deleteSession",async e=>{var r;const{topic:n,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,ae("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(sc).catch(h=>this.client.logger.warn(h)),this.getPendingSessionRequests().forEach(h=>{h.topic===n&&this.deletePendingSessionRequest(h.id,ae("USER_DISCONNECTED"))}),n===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=ut.idle),o&&this.client.events.emit("session_delete",{id:c,topic:n})}),R(this,"deleteProposal",async(e,r)=>{if(r)try{const n=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s==null||s.setError(qi.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ae("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),R(this,"deletePendingSessionRequest",async(e,r,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,r),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),n&&(this.sessionRequestQueue.state=ut.idle,this.client.events.emit("session_request_expire",{id:e}))}),R(this,"deletePendingAuthRequest",async(e,r,n=!1)=>{await Promise.all([this.client.auth.requests.delete(e,r),n?Promise.resolve():this.client.core.expirer.del(e)])}),R(this,"setExpiry",async(e,r)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,r),await this.client.session.update(e,{expiry:r}))}),R(this,"setProposal",async(e,r)=>{this.client.core.expirer.set(e,pe(ye.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,r)}),R(this,"setAuthRequest",async(e,r)=>{const{request:n,pairingTopic:s,transportType:o=se.relay}=r;this.client.core.expirer.set(e,n.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:e,pairingTopic:s,verifyContext:n.verifyContext,transportType:o})}),R(this,"setPendingSessionRequest",async e=>{const{id:r,topic:n,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||pe(ye.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,c),await this.client.pendingRequest.set(r,{id:r,topic:n,params:s,verifyContext:o})}),R(this,"sendRequest",async e=>{const{topic:r,method:n,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:h,appLink:u,tvf:d,publishOpts:_={}}=e,p=$t(n,s,l);let f;const w=!!u;try{const T=w?Ft:$e;f=await this.client.core.crypto.encode(r,p,{encoding:T})}catch(T){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),T}let g;if(Mv.includes(n)){const T=Ge(JSON.stringify(p)),y=Ge(f);g=await this.client.core.verify.register({id:y,decryptedId:T})}const I=X(X({},ye[n].req),_);if(I.attestation=g,o&&(I.ttl=o),c&&(I.id=c),this.client.core.history.set(r,p),w){const T=Rr(u,r,f);await j.Linking.openURL(T,this.client.name)}else I.tvf=Te(X({},d),{correlationId:p.id}),h?(I.internal=Te(X({},I.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,f,I)):this.client.core.relayer.publish(r,f,I).catch(T=>this.client.logger.error(T));return p.id}),R(this,"sendProposeSession",async e=>{const{proposal:r,publishOpts:n}=e,s=$t("wc_sessionPropose",r,r.id);this.client.core.history.set(r.pairingTopic,s);const o=await this.client.core.crypto.encode(r.pairingTopic,s,{encoding:$e}),c=Ge(JSON.stringify(s)),l=Ge(o),h=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:r.pairingTopic,sessionProposal:o},opts:Te(X({},n),{publishMethod:"wc_proposeSession",attestation:h})})}),R(this,"sendApproveSession",async e=>{const{sessionTopic:r,pairingProposalResponse:n,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=Ur(s.id,n),h=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:$e}),u=$t("wc_sessionSettle",o,c==null?void 0:c.id),d=await this.client.core.crypto.encode(r,u,{encoding:$e});this.client.core.history.set(r,u),await this.client.core.relayer.publishCustom({payload:{sessionTopic:r,pairingTopic:s.pairingTopic,sessionProposalResponse:h,sessionSettlementRequest:d},opts:Te(X({},c),{publishMethod:"wc_approveSession"})})}),R(this,"sendResult",async e=>{const{id:r,topic:n,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,h=Ur(r,s);let u;const d=l&&typeof(j==null?void 0:j.Linking)<"u";try{const f=d?Ft:$e;u=await this.client.core.crypto.encode(n,h,Te(X({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),f}let _,p;try{_=await this.client.core.history.get(n,r);const f=_.request;try{p=this.getTVFParams(r,f.params,s)}catch(w){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${w==null?void 0:w.message}`)}}catch(f){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${r}) failed`),f}if(d){const f=Rr(l,n,u);await j.Linking.openURL(f,this.client.name)}else{const f=_.request.method,w=ye[f].res;w.tvf=Te(X({},p),{correlationId:r}),o?(w.internal=Te(X({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,u,w)):this.client.core.relayer.publish(n,u,w).catch(g=>this.client.logger.error(g))}await this.client.core.history.resolve(h)}),R(this,"sendError",async e=>{const{id:r,topic:n,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,h=Ac(r,s);let u;const d=l&&typeof(j==null?void 0:j.Linking)<"u";try{const p=d?Ft:$e;u=await this.client.core.crypto.encode(n,h,Te(X({},o||{}),{encoding:p}))}catch(p){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),p}let _;try{_=await this.client.core.history.get(n,r)}catch(p){throw this.client.logger.error(`sendError() -> history.get(${n}, ${r}) failed`),p}if(d){const p=Rr(l,n,u);await j.Linking.openURL(p,this.client.name)}else{const p=_.request.method,f=c||ye[p].res;this.client.core.relayer.publish(n,u,f)}await this.client.core.history.resolve(h)}),R(this,"cleanup",async()=>{const e=[],r=[];this.client.session.getAll().forEach(n=>{let s=!1;kt(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&e.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{kt(n.expiryTimestamp)&&r.push(n.id)}),await Promise.all([...e.map(n=>this.deleteSession({topic:n})),...r.map(n=>this.deleteProposal(n))])}),R(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),R(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),R(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===ut.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ut.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=ut.idle}),R(this,"processRequest",async e=>{const{topic:r,payload:n,attestation:s,transportType:o,encryptedId:c}=e,l=n.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:n,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,n);case"wc_sessionPing":return await this.onSessionPingRequest(r,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:n,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:n,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),R(this,"onRelayEventResponse",async e=>{const{topic:r,payload:n,transportType:s}=e,o=(await this.client.core.history.get(r,n.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(r,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,n);case"wc_sessionExtend":return this.onSessionExtendResponse(r,n);case"wc_sessionPing":return this.onSessionPingResponse(r,n);case"wc_sessionRequest":return this.onSessionRequestResponse(r,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,n);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),R(this,"onRelayEventUnknownPayload",e=>{const{topic:r}=e,{message:n}=k("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)}),R(this,"shouldIgnorePairingRequest",e=>{const{topic:r,requestMethod:n}=e,s=this.expectedPairingMethodMap.get(r);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),R(this,"onSessionProposeRequest",async e=>{const{topic:r,payload:n,attestation:s,encryptedId:o}=e,{params:c,id:l}=n;try{const h=this.client.core.eventClient.getEvent({topic:r});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),h==null||h.setError(bt.proposal_listener_not_found)),this.isValidConnect(X({},n.params));const u=c.expiryTimestamp||pe(ye.wc_sessionPropose.req.ttl),d=X({id:l,pairingTopic:r,expiryTimestamp:u,attestation:s,encryptedId:o},c);await this.setProposal(l,d);const _=await this.getVerifyContext({attestationId:s,hash:Ge(JSON.stringify(n)),encryptedId:o,metadata:d.proposer.metadata});h==null||h.addTrace(ht.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:d,verifyContext:_})}catch(h){await this.sendError({id:l,topic:r,error:h,rpcOpts:ye.wc_sessionPropose.autoReject}),this.client.logger.error(h)}}),R(this,"onSessionProposeResponse",async(e,r,n)=>{const{id:s}=r;if(yt(r)){const{result:o}=r;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const h=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:h});const u=await this.client.core.crypto.generateSharedKey(l,h);this.pendingSessions.set(s,{sessionTopic:u,pairingTopic:e,proposalId:s,publicKey:l});const d=await this.client.core.relayer.subscribe(u,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:e})}else if(dt(r)){await this.deleteProposal(s);const o=Q("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),R(this,"onSessionSettleRequest",async(e,r)=>{const{id:n,params:s}=r;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:h,sessionProperties:u,scopedProperties:d,sessionConfig:_}=r.params,p=[...this.pendingSessions.values()].find(g=>g.sessionTopic===e);if(!p)return this.client.logger.error(`Pending session not found for topic ${e}`);const f=this.client.proposal.get(p.proposalId),w=Te(X(X(X({topic:e,relay:o,expiry:l,namespaces:h,acknowledged:!0,pairingTopic:p.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:c.publicKey,self:{publicKey:p.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},u&&{sessionProperties:u}),d&&{scopedProperties:d}),_&&{sessionConfig:_}),{transportType:se.relay});await this.client.session.set(w.topic,w),await this.setExpiry(w.topic,w.expiry),await this.client.core.pairing.updateMetadata({topic:p.pairingTopic,metadata:w.peer.metadata}),this.client.events.emit("session_connect",{session:w}),this.events.emit(Q("session_connect",p.proposalId),{session:w}),this.pendingSessions.delete(p.proposalId),this.deleteProposal(p.proposalId,!1),this.cleanupDuplicatePairings(w),await this.sendResult({id:r.id,topic:e,result:!0})}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),R(this,"onSessionSettleResponse",async(e,r)=>{const{id:n}=r;yt(r)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(Q("session_approve",n),{})):dt(r)&&(await this.client.session.delete(e,ae("USER_DISCONNECTED")),this.events.emit(Q("session_approve",n),{error:r.error}))}),R(this,"onSessionUpdateRequest",async(e,r)=>{const{params:n,id:s}=r;try{const o=`${e}_session_update`,c=Bi.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:ae("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(X({topic:e},n));try{Bi.set(o,s),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Bi.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:n})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),R(this,"isRequestOutOfSync",(e,r)=>r.toString().slice(0,-3)<e.toString().slice(0,-3)),R(this,"onSessionUpdateResponse",(e,r)=>{const{id:n}=r,s=Q("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);yt(r)?this.events.emit(Q("session_update",n),{}):dt(r)&&this.events.emit(Q("session_update",n),{error:r.error})}),R(this,"onSessionExtendRequest",async(e,r)=>{const{id:n}=r;try{this.isValidExtend({topic:e}),await this.setExpiry(e,pe(fi)),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),R(this,"onSessionExtendResponse",(e,r)=>{const{id:n}=r,s=Q("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);yt(r)?this.events.emit(Q("session_extend",n),{}):dt(r)&&this.events.emit(Q("session_extend",n),{error:r.error})}),R(this,"onSessionPingRequest",async(e,r)=>{const{id:n}=r;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),R(this,"onSessionPingResponse",(e,r)=>{const{id:n}=r,s=Q("session_ping",n);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);yt(r)?this.events.emit(Q("session_ping",n),{}):dt(r)&&this.events.emit(Q("session_ping",n),{error:r.error})},500)}),R(this,"onSessionDeleteRequest",async(e,r)=>{const{id:n}=r;try{this.isValidDisconnect({topic:e,reason:r.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(le.publish,async()=>{s(await this.deleteSession({topic:e,id:n}))})}),this.sendResult({id:n,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:ae("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),R(this,"onSessionRequest",async e=>{var r,n,s;const{topic:o,payload:c,attestation:l,encryptedId:h,transportType:u}=e,{id:d,params:_}=c;try{await this.isValidRequest(X({topic:o},_));const p=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Ge(JSON.stringify($t("wc_sessionRequest",_,d))),encryptedId:h,metadata:p.peer.metadata,transportType:u}),w={id:d,topic:o,params:_,verifyContext:f};await this.setPendingSessionRequest(w),u===se.link_mode&&(r=p.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((n=p.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(w):(this.addSessionRequestToSessionRequestQueue(w),this.processSessionRequestQueue())}catch(p){await this.sendError({id:d,topic:o,error:p}),this.client.logger.error(p)}}),R(this,"onSessionRequestResponse",(e,r)=>{const{id:n}=r,s=Q("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);yt(r)?this.events.emit(Q("session_request",n),{result:r.result}):dt(r)&&this.events.emit(Q("session_request",n),{error:r.error})}),R(this,"onSessionEventRequest",async(e,r)=>{const{id:n,params:s}=r;try{const o=`${e}_session_event_${s.event.name}`,c=Bi.get(o);if(c&&this.isRequestOutOfSync(c,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(X({topic:e},s)),this.client.events.emit("session_event",{id:n,topic:e,params:s}),Bi.set(o,n)}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),R(this,"onSessionAuthenticateResponse",(e,r)=>{const{id:n}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:r}),yt(r)?this.events.emit(Q("session_request",n),{result:r.result}):dt(r)&&this.events.emit(Q("session_request",n),{error:r.error})}),R(this,"onSessionAuthenticateRequest",async e=>{var r;const{topic:n,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:h,authPayload:u,expiryTimestamp:d}=s.params,_=await this.getVerifyContext({attestationId:o,hash:Ge(JSON.stringify(s)),encryptedId:c,metadata:h.metadata,transportType:l}),p={requester:h,pairingTopic:n,id:s.id,authPayload:u,verifyContext:_,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:p,pairingTopic:n,transportType:l}),l===se.link_mode&&(r=h.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(h.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:_})}catch(h){this.client.logger.error(h);const u=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),_=this.getAppLinkIfEnabled(s.params.requester.metadata,l),p={type:Pt,receiverPublicKey:u,senderPublicKey:d};await this.sendError({id:s.id,topic:n,error:h,encodeOpts:p,rpcOpts:ye.wc_sessionAuthenticate.autoReject,appLink:_})}}),R(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),R(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ut.idle,this.processSessionRequestQueue()},U.toMiliseconds(this.requestQueueDelay))}),R(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:r})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=Q("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(Q("session_request",s.request.id),{error:r})})}),R(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===ut.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(r){this.client.logger.error(r)}}),R(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=ut.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),R(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const r=this.client.proposal.getAll().find(n=>n.pairingTopic===e.topic);r&&this.onSessionProposeRequest({topic:e.topic,payload:$t("wc_sessionPropose",Te(X({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id),attestation:r.attestation,encryptedId:r.encryptedId})}),R(this,"isValidConnect",async e=>{if(!xe(e)){const{message:h}=k("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(h)}const{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(fe(r)||await this.isValidPairingTopic(r),!Rg(l,!0)){const{message:h}=k("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(h)}if(!fe(n)&&ur(n)!==0){const h="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(h):this.client.logger.warn(h),this.validateNamespaces(n,"requiredNamespaces")}if(!fe(s)&&ur(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const h=Object.keys(n||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(u=>h.includes(u.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(c)}, required/optional namespaces: ${JSON.stringify(h)}`)}}),R(this,"validateNamespaces",(e,r)=>{const n=Og(e,"connect()",r);if(n)throw new Error(n.message)}),R(this,"isValidApprove",async e=>{if(!xe(e))throw new Error(k("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:r,namespaces:n,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const l=this.client.proposal.get(r),h=Pn(n,"approve()");if(h)throw new Error(h.message);const u=xa(l.requiredNamespaces,n,"approve()");if(u)throw new Error(u.message);if(!de(s,!0)){const{message:d}=k("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const d=new Set(Object.keys(n));if(!Object.keys(c).every(_=>d.has(_.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),R(this,"isValidReject",async e=>{if(!xe(e)){const{message:s}=k("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:r,reason:n}=e;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!Lg(n)){const{message:s}=k("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}}),R(this,"isValidSessionSettleRequest",e=>{if(!xe(e)){const{message:h}=k("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(h)}const{relay:r,controller:n,namespaces:s,expiry:o}=e;if(!cu(r)){const{message:h}=k("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const c=vg(n,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=Pn(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(kt(o)){const{message:h}=k("EXPIRED","onSessionSettleRequest()");throw new Error(h)}}),R(this,"isValidUpdate",async e=>{if(!xe(e)){const{message:l}=k("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:r,namespaces:n}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const s=this.client.session.get(r),o=Pn(n,"update()");if(o)throw new Error(o.message);const c=xa(s.requiredNamespaces,n,"update()");if(c)throw new Error(c.message)}),R(this,"isValidExtend",async e=>{if(!xe(e)){const{message:n}=k("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(n)}const{topic:r}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),R(this,"isValidRequest",async e=>{if(!xe(e)){const{message:l}=k("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:r,request:n,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:c}=this.client.session.get(r);if(!Va(c,s)){const{message:l}=k("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!Vg(n)){const{message:l}=k("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(l)}if(!Cg(c,s,n.method)){const{message:l}=k("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(l)}if(o&&!Ug(o,Vn)){const{message:l}=k("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Vn.min} and ${Vn.max}`);throw new Error(l)}}),R(this,"isValidRespond",async e=>{var r;if(!xe(e)){const{message:o}=k("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:n,response:s}=e;try{await this.isValidSessionTopic(n)}catch(o){throw(r=e==null?void 0:e.response)!=null&&r.id&&this.cleanupAfterResponse(e),o}if(!xg(s)){const{message:o}=k("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),R(this,"isValidPing",async e=>{if(!xe(e)){const{message:n}=k("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(n)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),R(this,"isValidEmit",async e=>{if(!xe(e)){const{message:c}=k("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:r,event:n,chainId:s}=e;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!Va(o,s)){const{message:c}=k("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!Sg(n)){const{message:c}=k("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}if(!$g(o,s,n.name)){const{message:c}=k("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}}),R(this,"isValidDisconnect",async e=>{if(!xe(e)){const{message:n}=k("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(n)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),R(this,"isValidAuthenticate",e=>{const{chains:r,uri:n,domain:s,nonce:o}=e;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!de(n,!1))throw new Error("uri is required parameter");if(!de(s,!1))throw new Error("domain is required parameter");if(!de(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(l=>Lr(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=Lr(r[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),R(this,"getVerifyContext",async e=>{const{attestationId:r,hash:n,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||er,validation:"UNKNOWN",origin:o.url||""}};try{if(c===se.link_mode){const u=this.getAppLinkIfEnabled(o,c);return l.verified.validation=u&&new URL(u).origin===new URL(o.url).origin?"VALID":"INVALID",l}const h=await this.client.core.verify.resolve({attestationId:r,hash:n,encryptedId:s,verifyUrl:o.verifyUrl});h&&(l.verified.origin=h.origin,l.verified.isScam=h.isScam,l.verified.validation=h.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(h){this.client.logger.warn(h)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l}),R(this,"validateSessionProps",(e,r)=>{Object.values(e).forEach((n,s)=>{if(n==null){const{message:o}=k("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${n} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),R(this,"getPendingAuthRequest",e=>{const r=this.client.auth.requests.get(e);return typeof r=="object"?r:void 0}),R(this,"addToRecentlyDeleted",(e,r)=>{if(this.recentlyDeletedMap.set(e,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(o)}}}),R(this,"checkRecentlyDeleted",e=>{const r=this.recentlyDeletedMap.get(e);if(r){const{message:n}=k("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${e}`);throw new Error(n)}}),R(this,"isLinkModeEnabled",(e,r)=>{var n,s,o,c,l,h,u,d,_;return!e||r!==se.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((h=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:h.universal)!==""&&((u=e==null?void 0:e.redirect)==null?void 0:u.universal)!==void 0&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==""&&((_=e==null?void 0:e.redirect)==null?void 0:_.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(j==null?void 0:j.Linking)<"u"}),R(this,"getAppLinkIfEnabled",(e,r)=>{var n;return this.isLinkModeEnabled(e,r)?(n=e==null?void 0:e.redirect)==null?void 0:n.universal:void 0}),R(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const r=Ko(e,"topic")||"",n=decodeURIComponent(Ko(e,"wc_ev")||""),s=this.client.session.keys.includes(r);s&&this.client.session.update(r,{transportType:se.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:n,sessionExists:s})}),R(this,"registerLinkModeListeners",async()=>{var e;if(Hs()||Kt()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const r=j==null?void 0:j.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await r.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}),R(this,"getTVFParams",(e,r,n)=>{var s,o,c;if(!((s=r.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[r.request.method],chainId:r.chainId};try{const h=this.extractTxHashesFromResult(r.request,n);l.txHashes=h,l.contractAddresses=this.isValidContractData(r.request.params)?[(c=(o=r.request.params)==null?void 0:o[0])==null?void 0:c.to]:[]}catch(h){this.client.logger.warn("Error getting TVF params",h)}return l}),R(this,"isValidContractData",e=>{var r;if(!e)return!1;try{const n=(e==null?void 0:e.data)||((r=e==null?void 0:e[0])==null?void 0:r.data);if(!n.startsWith("0x"))return!1;const s=n.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),R(this,"extractTxHashesFromResult",(e,r)=>{var n;try{if(!r)return[];const s=e.method,o=Fv[s];if(s==="sui_signTransaction")return[sw(r.transactionBytes)];if(s==="near_signTransaction")return[Xo(r)];if(s==="near_signTransactions")return r.map(l=>Xo(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(n=r.tx_json)==null?void 0:n.hash];if(s==="polkadot_signTransaction")return[Xg({transaction:e.params.transactionPayload,signature:r.signature})];if(s==="algo_signTxn")return vi(r)?r.map(l=>ea(l)):[ea(r)];if(s==="cosmos_signDirect")return[aw(r)];if(typeof r=="string")return[r];const c=r[o.key];if(vi(c))return s==="solana_signAllTransactions"?c.map(l=>nw(l)):c;if(typeof c=="string")return[c]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[r,n]of Object.entries(e))for(const s of n)try{await this.onProviderMessageEvent({topic:r,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(le.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:r,attestation:n,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(Cr)?this.client.auth.authKeys.get(Cr):{responseTopic:void 0,publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,r,{receiverPublicKey:o,encoding:s===se.link_mode?Ft:$e});Ls(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:n,transportType:s,encryptedId:Ge(r)})):Vs(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:e,payload:c,transportType:s}),this.client.core.history.delete(e,c.id)):await this.onRelayEventUnknownPayload({topic:e,payload:c,transportType:s}),await this.client.core.relayer.messages.ack(e,r)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(We.expired,async t=>{const{topic:e,id:r}=fl(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,k("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,k("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(Jt.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Jt.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!de(t,!1)){const{message:e}=k("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=k("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(kt(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=k("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!de(t,!1)){const{message:e}=k("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=k("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(kt(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=k("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=k("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(de(t,!1)){const{message:e}=k("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=k("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!Dg(t)){const{message:e}=k("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=k("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(kt(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=k("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class eb extends ai{constructor(t,e){super(t,e,Nv,ao),this.core=t,this.logger=e}}class tb extends ai{constructor(t,e){super(t,e,Uv,ao),this.core=t,this.logger=e}}class ib extends ai{constructor(t,e){super(t,e,qv,ao,r=>r.id),this.core=t,this.logger=e}}class rb extends ai{constructor(t,e){super(t,e,Kv,cn,()=>Cr),this.core=t,this.logger=e}}class nb extends ai{constructor(t,e){super(t,e,Hv,cn),this.core=t,this.logger=e}}class sb extends ai{constructor(t,e){super(t,e,Wv,cn,r=>r.id),this.core=t,this.logger=e}}var ob=Object.defineProperty,ab=(i,t,e)=>t in i?ob(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,xn=(i,t,e)=>ab(i,typeof t!="symbol"?t+"":t,e);class cb{constructor(t,e){this.core=t,this.logger=e,xn(this,"authKeys"),xn(this,"pairingTopics"),xn(this,"requests"),this.authKeys=new rb(this.core,this.logger),this.pairingTopics=new nb(this.core,this.logger),this.requests=new sb(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var lb=Object.defineProperty,ub=(i,t,e)=>t in i?lb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,J=(i,t,e)=>ub(i,typeof t!="symbol"?t+"":t,e);class co extends d_{constructor(t){super(t),J(this,"protocol",Pu),J(this,"version",Tu),J(this,"name",Ln.name),J(this,"metadata"),J(this,"core"),J(this,"logger"),J(this,"events",new oi.EventEmitter),J(this,"engine"),J(this,"session"),J(this,"proposal"),J(this,"pendingRequest"),J(this,"auth"),J(this,"signConfig"),J(this,"on",(r,n)=>this.events.on(r,n)),J(this,"once",(r,n)=>this.events.once(r,n)),J(this,"off",(r,n)=>this.events.off(r,n)),J(this,"removeListener",(r,n)=>this.events.removeListener(r,n)),J(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),J(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"update",async r=>{try{return await this.engine.update(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"request",async r=>{try{return await this.engine.request(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"find",r=>{try{return this.engine.find(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),J(this,"authenticate",async(r,n)=>{try{return await this.engine.authenticate(r,n)}catch(s){throw this.logger.error(s.message),s}}),J(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(n){throw this.logger.error(n.message),n}}),this.name=(t==null?void 0:t.name)||Ln.name,this.metadata=Jp(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const e=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Qr(qs({level:(t==null?void 0:t.logger)||Ln.logger}));this.core=(t==null?void 0:t.core)||new kv(t),this.logger=Le(e,this.name),this.session=new tb(this.core,this.logger),this.proposal=new eb(this.core,this.logger),this.pendingRequest=new ib(this.core,this.logger),this.engine=new Xv(this),this.auth=new cb(this.core,this.logger)}static async init(t){const e=new co(t);return await e.initialize(),e}get context(){return Be(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const hb=co,db="08c4b07e3ad25f1a27c14a4e8cecb6f0",vI="eip155";async function _b(i){const{account:t,chainId:e,params:[r]}=i;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:r})).transactionHash}function ln(i,t){if(fo(i.address)!==fo(t))throw new Error(`Failed to validate account address (${i.address}), differs from ${t}`)}function bI(i){const t=i.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${i}, should have the format 'eip155:1'`);return e}async function pb(i){const{account:t,chainId:e,thirdwebClient:r,params:[n]}=i;n.from!==void 0&&ln(t,n.from);const s=kn({chain:Ue(e),client:r,data:n.data,gas:n.gas?qt(n.gas):void 0,gasPrice:n.gasPrice?qt(n.gasPrice):void 0,to:n.to,value:n.value?qt(n.value):void 0});return(await bc({account:t,transaction:s})).transactionHash}async function cc(i){const{account:t,params:e}=i;return ln(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function fb(i){const{account:t,params:[e]}=i;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&ln(t,e.from),t.signTransaction({data:e.data,gas:e.gas?qt(e.gas):void 0,gasPrice:e.gasPrice?qt(e.gasPrice):void 0,nonce:e.nonce?ii(e.nonce):void 0,to:e.to,value:e.value?qt(e.value):void 0})}async function lc(i){const{account:t,params:e}=i;return ln(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Ru(i){var r;const{wallet:t,params:e}=i;return((r=t.getChain())==null?void 0:r.id)===ii(e[0].chainId)||await t.switchChain(uh(ii(e[0].chainId))),"0x1"}const II=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Ru},Symbol.toStringTag,{value:"Module"}));let ft;async function Du(){if(!ft)return[];const i=await ft.getWalletConnectSessions();return JSON.parse(i??"[]")}function wb(i){ft||(ft=new Ts({clientId:i.clientId,storage:null}))}async function AI(i){if(!ft)return;const t=await ft.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(i),await ft.saveWalletConnectSessions(st(e))}async function gb(i){if(!ft)return;const t=await ft.getWalletConnectSessions(),r=JSON.parse(t??"[]").filter(n=>n.topic!==i.topic);await ft.saveWalletConnectSessions(st(r))}let Sn=new WeakMap;const mb={eth_sendRawTransaction:_b,eth_sendTransaction:pb,eth_sign:cc,eth_signTransaction:fb,eth_signTypedData:lc,eth_signTypedData_v4:lc,personal_sign:cc,wallet_addEthereumChain:i=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Ru};async function Eb(i){var u,d,_,p;const{wallet:t,requestHandlers:e,onConnect:r,onDisconnect:n,client:s}=i,o=(()=>i.chains&&i.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),i.chains.slice(0,10)):i.chains)();if(Sn.has(s))return Sn.get(s);wb({clientId:i.client.clientId});const c=Br(),l=await hb.init({metadata:{description:((u=i.appMetadata)==null?void 0:u.description)??c.description,icons:[((d=i.appMetadata)==null?void 0:d.logoUrl)??c.logoUrl],name:((_=i.appMetadata)==null?void 0:_.name)??c.name,url:((p=i.appMetadata)==null?void 0:p.url)??c.url},projectId:i.projectId??db});l.on("session_proposal",async f=>{const{onSessionProposal:w}=await a(()=>import("./session-proposal-548687be.js"),["assets/session-proposal-548687be.js","assets/signing-67cb53a5.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/to-serializable-transaction-2ea802ff.js","assets/transaction-e500e7c4.js","assets/get-bytecode-8cb4e224.js","assets/execute-6c88dd5f.js","assets/redirect-state-202ec690.js","assets/index-5f847edd.js","assets/ethereum-667be7dc.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-ba8e399b.js","assets/send-transaction-5984dc09.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-276c1c99.js","assets/index-accd8060.js","assets/index-2124b7cd.js","assets/index-6ab757a5.js","assets/index-69ac8519.js"]);await w({chains:o,event:f,onConnect:r,wallet:t,walletConnectClient:l}).catch(g=>{if(i.onError)i.onError(g);else throw g})}),l.on("session_request",async f=>{const{fulfillRequest:w}=await a(()=>import("./session-request-543a34de.js"),["assets/session-request-543a34de.js","assets/index-355751ab.js","assets/index-e7f3149f.css","assets/signing-67cb53a5.js","assets/prepare-contract-call-ac31a985.js","assets/utils-74c631d9.js","assets/to-serializable-transaction-2ea802ff.js","assets/transaction-e500e7c4.js","assets/get-bytecode-8cb4e224.js","assets/execute-6c88dd5f.js","assets/redirect-state-202ec690.js","assets/index-5f847edd.js","assets/ethereum-667be7dc.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-ba8e399b.js","assets/send-transaction-5984dc09.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-276c1c99.js","assets/index-accd8060.js","assets/index-2124b7cd.js","assets/index-6ab757a5.js","assets/index-69ac8519.js"]);await w({event:f,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(g=>{if(i.onError)i.onError(g);else throw g})}),l.on("session_event",async f=>{}),l.on("session_ping",f=>{}),l.on("session_delete",async f=>{await Lu({session:{topic:f.topic},walletConnectClient:l}).catch(w=>{if(i.onError)i.onError(w);else throw w})});const h=l.disconnect;return l.disconnect=async f=>{const w=await h(f).catch(()=>{});return n&&bb({onDisconnect:n,topic:f.topic}),w},Sn.set(i.client,l),l}function yb(i){const{uri:t,walletConnectClient:e}=i;e.core.pairing.pair({uri:t})}async function vb(){return Du()}async function Lu(i){gb(i.session);try{await i.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:i.session.topic})}catch{}}async function bb(i){const{topic:t,onDisconnect:e}=i,r=await Du();e(r.find(n=>n.topic===t)??{topic:t})}function Ib(i){return[rt("inApp",{executionMode:i==null?void 0:i.executionMode}),rt(Tc),rt(nt,{appMetadata:i==null?void 0:i.appMetadata,chains:i==null?void 0:i.chains}),rt(Yh),rt("io.rabby"),rt(Zh),rt("com.okex.wallet")]}function Ab(i,t){const e=new Set;let r=i();const n=()=>{for(const o of e)o()},s=o=>{r=o,n()};for(const o of t)o.subscribe(()=>{s(i())});return{getValue(){return r},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Dr(i,t,e=!0){e&&i();const r=t.map(n=>n.subscribe(()=>{i()}));return()=>{for(const n of r)n()}}const hr="tw:connected-wallet-params";async function PI(i,t,e){if(!Tb(e))throw new Error("given params are not stringifiable");const r=await i.getItem(hr);let n;if(r){try{n=JSON.parse(r)}catch{n={}}n[t]=e}else n={[t]:e};i.setItem(hr,st(n))}async function Pb(i,t){const e=await i.getItem(hr);let r;if(e){try{r=JSON.parse(e)}catch{r={}}delete r[t],i.setItem(hr,st(r))}}async function TI(i,t){const e=await i.getItem(hr);if(!e)return null;try{const r=JSON.parse(e);return r!=null&&r[t]?r[t]:null}catch{return null}}function Tb(i){try{return st(i),!0}catch{return!1}}function Es(i){if(!i)return!1;if(i.id==="smart")return!0;if(i.id==="inApp"||Ti(i)){const t=i.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t!=null&&t.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const Vu="thirdweb:connected-wallet-ids",$r="thirdweb:active-wallet-id",ys="thirdweb:active-chain",uc="thirdweb:last-used-wallet-id";function Ob(i){const t=Ht(void 0),e=Ht(void 0),r=Ht(void 0),n=Ht("unknown"),s=Ht(new Map);Dr(()=>{hh([...s.getValue().values()])},[s]),Dr(()=>{const y=r.getValue();if(!y)return;const v=s.getValue().get(y.id);!v||v===y||r.setValue(v)},[s,r]);const o=Ht(new Map),c=Ht(!1),l=Ab(()=>Array.from(o.getValue().values()),[o]),h=y=>{const v=o.getValue();if(v.has(y.id))return;const b=new Map(v);b.set(y.id,y),o.setValue(b)},u=y=>{const v=o.getValue(),b=new Map(v);b.delete(y.id),o.setValue(b)},d=y=>{Pb(i,y.id),u(y),t.getValue()===y&&(i.removeItem($r),e.setValue(void 0),r.setValue(void 0),t.setValue(void 0),n.setValue("disconnected"))},_=y=>{d(y),y.disconnect()},p=async(y,v)=>{if(!y.getAccount())throw new Error("Cannot set a wallet without an account as active");const D=await(async()=>v!=null&&v.accountAbstraction&&!Es(y)?await Rb(y,v.client,v.accountAbstraction,d):y)();return await i.setItem($r,y.id),await i.setItem(uc,y.id),h(y),(v==null?void 0:v.setWalletAsActive)!==!1&&w(D),y.subscribe("accountChanged",async()=>{var S;const N=await p(y,v);(S=v==null?void 0:v.onConnect)==null||S.call(v,N,l.getValue())}),D},f=async(y,v)=>{var D;const b=await p(y,v);return(D=v==null?void 0:v.onConnect)==null||D.call(v,b,l.getValue()),b},w=y=>{const v=y.getAccount();if(!v)throw new Error("Cannot set a wallet without an account as active");h(y),t.setValue(y),e.setValue(v),r.setValue(y.getChain()),n.setValue("connected");const b=P=>{e.setValue(P)},D=y.subscribe("accountChanged",b),N=y.subscribe("chainChanged",P=>r.setValue(P)),S=y.subscribe("disconnect",()=>{m()}),m=()=>{d(y),D(),N(),S()}},g=async y=>{w(y),y.id!=="smart"&&(await i.setItem($r,y.id),await i.setItem(uc,y.id))};Dr(()=>{const y=r.getValue();y?i.setItem(ys,st(y)):i.removeItem(ys)},[r],!1),Dr(async()=>{const v=l.getValue().map(b=>b==null?void 0:b.id).filter(b=>!!b);i.setItem(Vu,st(Array.from(new Set([...v]))))},[l],!1);const I=async y=>{const v=t.getValue();if(!v)throw new Error("No active wallet found");if(!v.switchChain)throw new Error("Wallet does not support switching chains");if(Es(v)){const b=await lo(i);if(b){const D=l.getValue().find(N=>N.id===b);if(D){await D.switchChain(y),await v.switchChain(y),w(v);return}}await v.switchChain(y),w(v)}else await v.switchChain(y);r.setValue(v.getChain())};function T(y){const v=s.getValue();if(y.every(N=>{const S=v.get(N.id);return st(S)===st(N)}))return;const D=new Map(v);for(const N of y)D.set(N.id,N);s.setValue(D)}return{activeAccountStore:e,activeWalletChainStore:r,activeWalletConnectionStatusStore:n,activeWalletStore:t,addConnectedWallet:h,connect:f,connectedWallets:l,defineChains:T,disconnectWallet:_,handleConnection:p,isAutoConnecting:c,removeConnectedWallet:u,setActiveWallet:g,switchActiveWalletChain:I}}async function xu(i){try{const t=await i.getItem(Vu);return t?JSON.parse(t):[]}catch{return[]}}async function lo(i){try{const t=await i.getItem($r);if(t)return t}catch{}return null}async function Su(i){try{const t=await i.getItem(ys);if(t)return JSON.parse(t)}catch{}return null}const Rb=async(i,t,e,r)=>{const n=i.getAccount();if(!n)throw new Error("Cannot set a wallet without an account as active");const s=Ns(e);await s.connect({chain:e.chain,client:t,personalAccount:n});const o=i.subscribe("disconnect",()=>{c()}),c=()=>{o(),r(s)};return s};function Cu(i,t){return new Promise((e,r)=>{const n=setTimeout(()=>{r(new Error(t.message))},t.ms);i.then(s=>{clearTimeout(n),e(s)},s=>{clearTimeout(n),r(s)})})}function Db(i){const t=r=>Ih(r)||Ti(r),e=Es(i.wallet)&&i.connectedWallets.some(r=>{var n,s,o,c,l,h;return t(r)&&((s=(n=r.getAccount())==null?void 0:n.address)==null?void 0:s.toLowerCase())===((h=(l=(c=(o=i.wallet).getAdminAccount)==null?void 0:c.call(o))==null?void 0:l.address)==null?void 0:h.toLowerCase())});return t(i.wallet)||e}function Lb(){if(typeof document>"u")return;const i=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let r=e;const n=e.indexOf("?");n!==-1&&(t=new URLSearchParams(e.substring(n)),r=e.substring(0,n));const s=i.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=i.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,c=i.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=i.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,h=i.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0,u=i.get("state")??(t==null?void 0:t.get("state"))??void 0;if((l||o)&&s){const d=(()=>{if(o)return i.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();i.delete("walletId"),i.delete("authProvider"),i.delete("authCookie"),i.delete("authFlow"),i.delete("state"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow"),t==null||t.delete("state");const _=i.toString(),p=_?`?${_}`:"";let f=r;if(t){const w=t.toString();w&&(f=`${r}?${w}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${f}`),{authCookie:l,authFlow:h,authProvider:c,authResult:d,state:u,walletId:s}}}let Cn;const Vb=async i=>{if(Cn&&!i.force&&await Cn)return!0;const t=xb(i);return Cn=t,t},xb=async({storage:i,props:t,createWalletFn:e,manager:r,connectOverride:n,setLastAuthProvider:s})=>{var D,N,S,m,P;const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let h=!1;r.isAutoConnecting.setValue(!0);let[u,d]=await Promise.all([xu(i),lo(i)]);const _=t.readUrlToken===!1?void 0:Lb();let p=_;if(_!=null&&_.authResult&&(await ph(_.state)||(p=void 0)),(p==null?void 0:p.authFlow)==="link"&&p.authResult)return await Sb({client:t.client,connectOverride:n,createWalletFn:e,manager:r,onConnect:c,props:t,setLastAuthProvider:s,storage:i,timeout:l,urlToken:p,wallets:o});const f=o.find(E=>E.id===(p==null?void 0:p.walletId));if(p!=null&&p.authCookie&&f&&await new Ts({clientId:t.client.clientId,ecosystem:Ti(f)?{id:f.id,partnerId:(D=f.getConfig())==null?void 0:D.partnerId}:void 0,storage:i}).saveAuthCookie(p.authCookie),p!=null&&p.walletId&&(d=p.walletId,u=u!=null&&u.includes(p.walletId)?u:[p.walletId,...u||[]]),p!=null&&p.authProvider&&await(s==null?void 0:s(p.authProvider,i)),!u)return h;const w=await Su(i)||t.chain,g=u.map(E=>{const A=o.find(O=>O.id===E);return A||e(E)}),I=d&&(g.find(E=>E.id===d)||e(d));if(I){r.activeWalletConnectionStatusStore.setValue("connecting"),await Cu(vs({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:w,wallet:I}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(E=>{console.warn(E.message),t.onTimeout&&t.onTimeout()});try{await(n?n(I):r.connect(I,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(E){E instanceof Error&&console.warn("Error auto connecting wallet:",E.message),r.activeWalletConnectionStatusStore.setValue("disconnected")}}else r.activeWalletConnectionStatusStore.setValue("disconnected");const T=g.filter(E=>E.id!==d&&u.includes(E.id));for(const E of T)try{await vs({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:w,wallet:E}),r.addConnectedWallet(E)}catch{}I&&Db({connectedWallets:I?[I,...T]:T,wallet:I})&&((N=t.siweAuth)!=null&&N.requiresAuth)&&!((S=t.siweAuth)!=null&&S.isLoggedIn)&&!((m=t.siweAuth)!=null&&m.isLoggingIn)&&await((P=t.siweAuth)==null?void 0:P.doLogin().catch(E=>{console.warn("Error signing in with SIWE:",E.message)})),r.isAutoConnecting.setValue(!1);const v=r.activeWalletStore.getValue(),b=r.connectedWallets.getValue();if(v){h=!0;try{c==null||c(v,b)}catch(E){console.error("Error calling onConnect callback:",E)}}else r.activeWalletConnectionStatusStore.setValue("disconnected");return h};async function Sb(i){var v;const{client:t,connectOverride:e,createWalletFn:r,manager:n,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:h,urlToken:u,wallets:d}=i,[_,p]=await Promise.all([xu(l),lo(l)]),f=await Su(l)||o.chain;if(!p||!_)return console.warn("No stored wallet found for linking flow"),n.isAutoConnecting.setValue(!1),!1;u.authProvider&&await(c==null?void 0:c(u.authProvider,l));const w=d.find(b=>b.id===p)||r(p);n.activeWalletConnectionStatusStore.setValue("connecting");try{await Cu(vs({authResult:void 0,client:t,lastConnectedChain:f,wallet:w}),{message:`AutoConnect timeout: ${h}ms limit exceeded.`,ms:h}),await(e?e(w):n.connect(w,{accountAbstraction:o.accountAbstraction,client:t}))}catch(b){return console.warn("Failed to auto-connect for linking:",b),n.activeWalletConnectionStatusStore.setValue("disconnected"),n.isAutoConnecting.setValue(!1),!1}const g=Ti(w)?{id:w.id,partnerId:(v=w.getConfig())==null?void 0:v.partnerId}:void 0,I=new Ts({clientId:t.clientId,ecosystem:g,storage:l});try{await fh({client:t,ecosystem:g,storage:I,tokenToLink:u.authResult.storedToken.cookieString})}catch(b){console.error("Failed to link profile after redirect:",b)}n.isAutoConnecting.setValue(!1);const T=n.activeWalletStore.getValue(),y=n.connectedWallets.getValue();if(T){try{s==null||s(T,y)}catch(b){console.error("Error calling onConnect callback:",b)}return!0}return!1}async function vs(i){return i.wallet.autoConnect({authResult:i.authResult,chain:i.lastConnectedChain,client:i.client})}async function Cb(i){const t=i.wallets||Ib(i),e=Ob(Nr);return await Vb({createWalletFn:rt,manager:e,props:{...i,wallets:t},storage:Nr})}const OI=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:mb,EIP1193:wd,authenticate:Xu,authenticateWithRedirect:eh,autoConnect:Cb,createWallet:rt,createWalletAdapter:gd,createWalletConnectClient:Eb,createWalletConnectSession:yb,deploySmartAccount:Hu,disconnectWalletConnectSession:Lu,ecosystemWallet:Uc,embeddedWallet:Nn,generateAccount:vd,getActiveWalletConnectSessions:vb,getAllWalletsList:md,getInstalledWallets:Bc,getProfiles:th,getUser:Ku,getUserEmail:ih,getUserPhoneNumber:rh,getWalletBalance:bd,getWalletInfo:Dc,inAppWallet:Nn,injectedProvider:Us,isBaseAccountSDKWallet:Vc,linkProfile:nh,preAuthenticate:sh,privateKeyAccount:qn,privateKeyToAccount:qn,randomPrivateKey:ju,smartWallet:Ns,unlinkProfile:oh,walletConnect:hd},Symbol.toStringTag,{value:"Module"}));export{el as A,Qr as B,q_ as C,db as D,dI as E,Lr as F,uI as G,F_ as H,Mr as I,_I as J,ae as K,pI as L,Es as M,vI as N,II as O,ou as P,OI as Q,ur as V,hg as Y,TI as a,Br as b,AI as c,Lu as d,Du as e,Qh as f,Dc as g,_b as h,pb as i,fb as j,lc as k,cc as l,qs as m,at as n,vi as o,bI as p,co as q,ti as r,PI as s,pe as t,kt as u,hI as v,$o as w,tl as x,sr as y,C_ as z};
12
+ Approved: ${_.toString()}`))}),o.forEach(d=>{r||(Zt(n[d].methods,s[d].methods)?Zt(n[d].events,s[d].events)||(r=k("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${d}`)):r=k("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function kg(i){const t={};return Object.keys(i).forEach(e=>{var r;e.includes(":")?t[e]=i[e]:(r=i[e].chains)==null||r.forEach(n=>{t[n]={methods:i[e].methods,events:i[e].events}})}),t}function Sa(i){return[...new Set(i.map(t=>t.includes(":")?t.split(":")[0]:t))]}function Ng(i){const t={};return Object.keys(i).forEach(e=>{if(e.includes(":"))t[e]=i[e];else{const r=xi(i[e].accounts);r==null||r.forEach(n=>{t[n]={accounts:i[e].accounts.filter(s=>s.includes(`${n}:`)),methods:i[e].methods,events:i[e].events}})}}),t}function Ug(i,t){return so(i,!1)&&i<=t.max&&i>=t.min}function Ca(){const i=pr();return new Promise(t=>{switch(i){case ze.browser:t(Bg());break;case ze.reactNative:t(Fg());break;case ze.node:t(qg());break;default:t(!0)}})}function Bg(){return Di()&&(navigator==null?void 0:navigator.onLine)}async function Fg(){if(Kt()&&typeof j<"u"&&j!=null&&j.NetInfo){const i=await(j==null?void 0:j.NetInfo.fetch());return i==null?void 0:i.isConnected}return!0}function qg(){return!0}function Mg(i){switch(pr()){case ze.browser:zg(i);break;case ze.reactNative:jg(i);break}}function zg(i){!Kt()&&Di()&&(window.addEventListener("online",()=>i(!0)),window.addEventListener("offline",()=>i(!1)))}function jg(i){var t;Kt()&&typeof j<"u"&&j!=null&&j.NetInfo&&((t=j)==null||t.NetInfo.addEventListener(e=>i(e==null?void 0:e.isConnected)))}function Kg(){var i;return Di()&&mi()?((i=mi())==null?void 0:i.visibilityState)==="visible":!0}const Tn={};class Bi{static get(t){return Tn[t]}static set(t,e){Tn[t]=e}static delete(t){delete Tn[t]}}function Hg(i){const t=dr.decode(i);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Wg({publicKey:i,signature:t,payload:e}){var r;const n=as(e.method),s=128|parseInt(((r=e.version)==null?void 0:r.toString())||"4"),o=Yg(e.address),c=e.era==="00"?new Uint8Array([0]):as(e.era);if(c.length!==1&&c.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),h=new Uint8Array([l&255,l>>8&255]),u=BigInt(`0x${Jg(e.tip)}`),d=Qg(u),_=new Uint8Array([0,...i,o,...t,...c,...h,...d,...n]),p=Zg(_.length+1);return new Uint8Array([...p,s,..._])}function Gg(i){const t=as(i),e=zh.blake2b(t,void 0,32);return"0x"+ee.from(e).toString("hex")}function as(i){return new Uint8Array(i.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function Jg(i){return i.startsWith("0x")?i.slice(2):i}function Yg(i){const t=dr.decode(i)[0];return t===42?0:t===60?2:1}function Zg(i){if(i<64)return new Uint8Array([i<<2]);if(i<16384){const t=i<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(i<1<<30){const t=i<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Qg(i){if(i<BigInt(1)<<BigInt(6))return new Uint8Array([Number(i<<BigInt(2))]);if(i<BigInt(1)<<BigInt(14)){const t=i<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(i<BigInt(1)<<BigInt(30)){const t=i<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Xg(i){const t=Uint8Array.from(ee.from(i.signature,"hex")),e=Hg(i.transaction.address),r=Wg({publicKey:e,signature:t,payload:i.transaction}),n=ee.from(r).toString("hex");return Gg(n)}const lu="wc",uu=2,Yr="core",wt=`${lu}@2:${Yr}:`,em={name:Yr,logger:"error"},tm={database:":memory:"},im="crypto",$a="client_ed25519_seed",rm=U.ONE_DAY,nm="keychain",sm="0.3",om="messages",am="0.3",cm=U.SIX_HOURS,lm="publisher",hu="irn",um="error",du="wss://relay.walletconnect.org",hm="relayer",le={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},dm="_subscription",Ke={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},_m=.1,cs="2.21.8",se={link_mode:"link_mode",relay:"relay"},Sr={inbound:"inbound",outbound:"outbound"},pm="0.3",fm="WALLETCONNECT_CLIENT_ID",ka="WALLETCONNECT_LINK_MODE_APPS",qe={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},wm="subscription",gm="0.3",mm="pairing",Em="0.3",Fi={wc_pairingDelete:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:U.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:U.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:U.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:U.ONE_DAY,prompt:!1,tag:0},res:{ttl:U.ONE_DAY,prompt:!1,tag:0}}},Jt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},et={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},ym="history",vm="0.3",bm="expirer",We={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Im="0.3",Am="verify-api",Pm="https://verify.walletconnect.com",_u="https://verify.walletconnect.org",er=_u,Tm=`${er}/v3`,Om=[Pm,_u],Rm="echo",Dm="https://echo.walletconnect.com",ht={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},bt={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Ct={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},qi={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Wt={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},Mi={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Lm=.1,Vm="event-client",xm=86400,Sm="https://pulse.walletconnect.org/batch";function Cm(i,t){if(i.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<i.length;n++){var s=i.charAt(n),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=n}var c=i.length,l=i.charAt(0),h=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function d(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var w=0,g=0,I=0,T=f.length;I!==T&&f[I]===0;)I++,w++;for(var y=(T-I)*u+1>>>0,v=new Uint8Array(y);I!==T;){for(var b=f[I],D=0,N=y-1;(b!==0||D<g)&&N!==-1;N--,D++)b+=256*v[N]>>>0,v[N]=b%c>>>0,b=b/c>>>0;if(b!==0)throw new Error("Non-zero carry");g=D,I++}for(var S=y-g;S!==y&&v[S]===0;)S++;for(var m=l.repeat(w);S<y;++S)m+=i.charAt(v[S]);return m}function _(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var w=0;if(f[w]!==" "){for(var g=0,I=0;f[w]===l;)g++,w++;for(var T=(f.length-w)*h+1>>>0,y=new Uint8Array(T);f[w];){var v=e[f.charCodeAt(w)];if(v===255)return;for(var b=0,D=T-1;(v!==0||b<I)&&D!==-1;D--,b++)v+=c*y[D]>>>0,y[D]=v%256>>>0,v=v/256>>>0;if(v!==0)throw new Error("Non-zero carry");I=b,w++}if(f[w]!==" "){for(var N=T-I;N!==T&&y[N]===0;)N++;for(var S=new Uint8Array(g+(T-N)),m=g;N!==T;)S[m++]=y[N++];return S}}}function p(f){var w=_(f);if(w)return w;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:_,decode:p}}var $m=Cm,km=$m;const pu=i=>{if(i instanceof Uint8Array&&i.constructor.name==="Uint8Array")return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(ArrayBuffer.isView(i))return new Uint8Array(i.buffer,i.byteOffset,i.byteLength);throw new Error("Unknown type, must be binary type")},Nm=i=>new TextEncoder().encode(i),Um=i=>new TextDecoder().decode(i);class Bm{constructor(t,e,r){this.name=t,this.prefix=e,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class Fm{constructor(t,e,r){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return fu(this,t)}}class qm{constructor(t){this.decoders=t}or(t){return fu(this,t)}decode(t){const e=t[0],r=this.decoders[e];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const fu=(i,t)=>new qm({...i.decoders||{[i.prefix]:i},...t.decoders||{[t.prefix]:t}});class Mm{constructor(t,e,r,n){this.name=t,this.prefix=e,this.baseEncode=r,this.baseDecode=n,this.encoder=new Bm(t,e,r),this.decoder=new Fm(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const an=({name:i,prefix:t,encode:e,decode:r})=>new Mm(i,t,e,r),mr=({prefix:i,name:t,alphabet:e})=>{const{encode:r,decode:n}=km(e,t);return an({prefix:i,name:t,encode:r,decode:s=>pu(n(s))})},zm=(i,t,e,r)=>{const n={};for(let u=0;u<t.length;++u)n[t[u]]=u;let s=i.length;for(;i[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,h=0;for(let u=0;u<s;++u){const d=n[i[u]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);l=l<<e|d,c+=e,c>=8&&(c-=8,o[h++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},jm=(i,t,e)=>{const r=t[t.length-1]==="=",n=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<i.length;++l)for(c=c<<8|i[l],o+=8;o>e;)o-=e,s+=t[n&c>>o];if(o&&(s+=t[n&c<<e-o]),r)for(;s.length*e&7;)s+="=";return s},ve=({name:i,prefix:t,bitsPerChar:e,alphabet:r})=>an({prefix:t,name:i,encode(n){return jm(n,r,e)},decode(n){return zm(n,r,e,i)}}),Km=an({prefix:"\0",name:"identity",encode:i=>Um(i),decode:i=>Nm(i)});var Hm=Object.freeze({__proto__:null,identity:Km});const Wm=ve({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Gm=Object.freeze({__proto__:null,base2:Wm});const Jm=ve({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ym=Object.freeze({__proto__:null,base8:Jm});const Zm=mr({prefix:"9",name:"base10",alphabet:"0123456789"});var Qm=Object.freeze({__proto__:null,base10:Zm});const Xm=ve({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),eE=ve({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var tE=Object.freeze({__proto__:null,base16:Xm,base16upper:eE});const iE=ve({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),rE=ve({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),nE=ve({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sE=ve({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),oE=ve({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),aE=ve({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),cE=ve({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lE=ve({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uE=ve({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var hE=Object.freeze({__proto__:null,base32:iE,base32upper:rE,base32pad:nE,base32padupper:sE,base32hex:oE,base32hexupper:aE,base32hexpad:cE,base32hexpadupper:lE,base32z:uE});const dE=mr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_E=mr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var pE=Object.freeze({__proto__:null,base36:dE,base36upper:_E});const fE=mr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wE=mr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var gE=Object.freeze({__proto__:null,base58btc:fE,base58flickr:wE});const mE=ve({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),EE=ve({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yE=ve({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),vE=ve({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var bE=Object.freeze({__proto__:null,base64:mE,base64pad:EE,base64url:yE,base64urlpad:vE});const wu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),IE=wu.reduce((i,t,e)=>(i[e]=t,i),[]),AE=wu.reduce((i,t,e)=>(i[t.codePointAt(0)]=e,i),[]);function PE(i){return i.reduce((t,e)=>(t+=IE[e],t),"")}function TE(i){const t=[];for(const e of i){const r=AE[e.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(r)}return new Uint8Array(t)}const OE=an({prefix:"🚀",name:"base256emoji",encode:PE,decode:TE});var RE=Object.freeze({__proto__:null,base256emoji:OE}),DE=gu,Na=128,LE=127,VE=~LE,xE=Math.pow(2,31);function gu(i,t,e){t=t||[],e=e||0;for(var r=e;i>=xE;)t[e++]=i&255|Na,i/=128;for(;i&VE;)t[e++]=i&255|Na,i>>>=7;return t[e]=i|0,gu.bytes=e-r+1,t}var SE=ls,CE=128,Ua=127;function ls(i,r){var e=0,r=r||0,n=0,s=r,o,c=i.length;do{if(s>=c)throw ls.bytes=0,new RangeError("Could not decode varint");o=i[s++],e+=n<28?(o&Ua)<<n:(o&Ua)*Math.pow(2,n),n+=7}while(o>=CE);return ls.bytes=s-r,e}var $E=Math.pow(2,7),kE=Math.pow(2,14),NE=Math.pow(2,21),UE=Math.pow(2,28),BE=Math.pow(2,35),FE=Math.pow(2,42),qE=Math.pow(2,49),ME=Math.pow(2,56),zE=Math.pow(2,63),jE=function(i){return i<$E?1:i<kE?2:i<NE?3:i<UE?4:i<BE?5:i<FE?6:i<qE?7:i<ME?8:i<zE?9:10},KE={encode:DE,decode:SE,encodingLength:jE},mu=KE;const Ba=(i,t,e=0)=>(mu.encode(i,t,e),t),Fa=i=>mu.encodingLength(i),us=(i,t)=>{const e=t.byteLength,r=Fa(i),n=r+Fa(e),s=new Uint8Array(n+e);return Ba(i,s,0),Ba(e,s,r),s.set(t,n),new HE(i,e,t,s)};class HE{constructor(t,e,r,n){this.code=t,this.size=e,this.digest=r,this.bytes=n}}const Eu=({name:i,code:t,encode:e})=>new WE(i,t,e);class WE{constructor(t,e,r){this.name=t,this.code=e,this.encode=r}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?us(this.code,e):e.then(r=>us(this.code,r))}else throw Error("Unknown type, must be binary type")}}const yu=i=>async t=>new Uint8Array(await crypto.subtle.digest(i,t)),GE=Eu({name:"sha2-256",code:18,encode:yu("SHA-256")}),JE=Eu({name:"sha2-512",code:19,encode:yu("SHA-512")});var YE=Object.freeze({__proto__:null,sha256:GE,sha512:JE});const vu=0,ZE="identity",bu=pu,QE=i=>us(vu,bu(i)),XE={code:vu,name:ZE,encode:bu,digest:QE};var ey=Object.freeze({__proto__:null,identity:XE});new TextEncoder,new TextDecoder;const qa={...Hm,...Gm,...Ym,...Qm,...tE,...hE,...pE,...gE,...bE,...RE};({...YE,...ey});function Iu(i){return globalThis.Buffer!=null?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):i}function ty(i=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Iu(globalThis.Buffer.allocUnsafe(i)):new Uint8Array(i)}function Au(i,t,e,r){return{name:i,prefix:t,encoder:{name:i,prefix:t,encode:e},decoder:{decode:r}}}const Ma=Au("utf8","u",i=>"u"+new TextDecoder("utf8").decode(i),i=>new TextEncoder().encode(i.substring(1))),On=Au("ascii","a",i=>{let t="a";for(let e=0;e<i.length;e++)t+=String.fromCharCode(i[e]);return t},i=>{i=i.substring(1);const t=ty(i.length);for(let e=0;e<i.length;e++)t[e]=i.charCodeAt(e);return t}),iy={utf8:Ma,"utf-8":Ma,hex:qa.base16,latin1:On,ascii:On,binary:On,...qa};function ry(i,t="utf8"){const e=iy[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Iu(globalThis.Buffer.from(i,"utf-8")):e.decoder.decode(`${e.prefix}${i}`)}var ny=Object.defineProperty,sy=(i,t,e)=>t in i?ny(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,lt=(i,t,e)=>sy(i,typeof t!="symbol"?t+"":t,e);class oy{constructor(t,e){this.core=t,this.logger=e,lt(this,"keychain",new Map),lt(this,"name",nm),lt(this,"version",sm),lt(this,"initialized",!1),lt(this,"storagePrefix",wt),lt(this,"init",async()=>{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),lt(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),lt(this,"set",async(r,n)=>{this.isInitialized(),this.keychain.set(r,n),await this.persist()}),lt(this,"get",r=>{this.isInitialized();const n=this.keychain.get(r);if(typeof n>"u"){const{message:s}=k("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(s)}return n}),lt(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),await this.persist()}),this.core=t,this.logger=Le(e,this.name)}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,Jn(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Yn(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var ay=Object.defineProperty,cy=(i,t,e)=>t in i?ay(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,me=(i,t,e)=>cy(i,typeof t!="symbol"?t+"":t,e);class ly{constructor(t,e,r){this.core=t,this.logger=e,me(this,"name",im),me(this,"keychain"),me(this,"randomSessionIdentifier",os()),me(this,"initialized",!1),me(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),me(this,"hasKeys",n=>(this.isInitialized(),this.keychain.has(n))),me(this,"getClientId",async()=>{this.isInitialized();const n=await this.getClientSeed(),s=wo(n);return Bh(s.publicKey)}),me(this,"generateKeyPair",()=>{this.isInitialized();const n=M0();return this.setPrivateKey(n.publicKey,n.privateKey)}),me(this,"signJWT",async n=>{this.isInitialized();const s=await this.getClientSeed(),o=wo(s),c=this.randomSessionIdentifier;return await Fh(c,n,rm,o)}),me(this,"generateSharedKey",(n,s,o)=>{this.isInitialized();const c=this.getPrivateKey(n),l=z0(c,s);return this.setSymKey(l,o)}),me(this,"setSymKey",async(n,s)=>{this.isInitialized();const o=s||xr(n);return await this.keychain.set(o,n),o}),me(this,"deleteKeyPair",async n=>{this.isInitialized(),await this.keychain.del(n)}),me(this,"deleteSymKey",async n=>{this.isInitialized(),await this.keychain.del(n)}),me(this,"encode",async(n,s,o)=>{this.isInitialized();const c=su(o),l=Un(s);if(Ia(c))return H0(l,o==null?void 0:o.encoding);if(ba(c)){const _=c.senderPublicKey,p=c.receiverPublicKey;n=await this.generateSharedKey(_,p)}const h=this.getSymKey(n),{type:u,senderPublicKey:d}=c;return j0({type:u,symKey:h,message:l,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),me(this,"decode",async(n,s,o)=>{this.isInitialized();const c=G0(s,o);if(Ia(c)){const l=W0(s,o==null?void 0:o.encoding);return go(l)}if(ba(c)){const l=c.receiverPublicKey,h=c.senderPublicKey;n=await this.generateSharedKey(l,h)}try{const l=this.getSymKey(n),h=K0({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return go(h)}catch(l){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),me(this,"getPayloadType",(n,s=$e)=>{const o=lr({encoded:n,encoding:s});return si(o.type)}),me(this,"getPayloadSenderPublicKey",(n,s=$e)=>{const o=lr({encoded:n,encoding:s});return o.senderPublicKey?Ne(o.senderPublicKey,De):void 0}),this.core=t,this.logger=Le(e,this.name),this.keychain=r||new oy(this.core,this.logger)}get context(){return Be(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get($a)}catch{t=os(),await this.keychain.set($a,t)}return ry(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var uy=Object.defineProperty,hy=Object.defineProperties,dy=Object.getOwnPropertyDescriptors,za=Object.getOwnPropertySymbols,_y=Object.prototype.hasOwnProperty,py=Object.prototype.propertyIsEnumerable,hs=(i,t,e)=>t in i?uy(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fy=(i,t)=>{for(var e in t||(t={}))_y.call(t,e)&&hs(i,e,t[e]);if(za)for(var e of za(t))py.call(t,e)&&hs(i,e,t[e]);return i},wy=(i,t)=>hy(i,dy(t)),Fe=(i,t,e)=>hs(i,typeof t!="symbol"?t+"":t,e);class gy extends t_{constructor(t,e){super(t,e),this.logger=t,this.core=e,Fe(this,"messages",new Map),Fe(this,"messagesWithoutClientAck",new Map),Fe(this,"name",om),Fe(this,"version",am),Fe(this,"initialized",!1),Fe(this,"storagePrefix",wt),Fe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const n=await this.getRelayerMessagesWithoutClientAck();typeof n<"u"&&(this.messagesWithoutClientAck=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),Fe(this,"set",async(r,n,s)=>{this.isInitialized();const o=Ge(n);let c=this.messages.get(r);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=n,this.messages.set(r,c),s===Sr.inbound){const l=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,wy(fy({},l),{[o]:n}))}return await this.persist(),o}),Fe(this,"get",r=>{this.isInitialized();let n=this.messages.get(r);return typeof n>"u"&&(n={}),n}),Fe(this,"getWithoutAck",r=>{this.isInitialized();const n={};for(const s of r){const o=this.messagesWithoutClientAck.get(s)||{};n[s]=Object.values(o)}return n}),Fe(this,"has",(r,n)=>{this.isInitialized();const s=this.get(r),o=Ge(n);return typeof s[o]<"u"}),Fe(this,"ack",async(r,n)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(r);if(typeof s>"u")return;const o=Ge(n);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,s),await this.persist()}),Fe(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),await this.persist()}),this.logger=Le(t,this.name),this.core=e}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,Jn(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,Jn(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Yn(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?Yn(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var my=Object.defineProperty,Ey=Object.defineProperties,yy=Object.getOwnPropertyDescriptors,ja=Object.getOwnPropertySymbols,vy=Object.prototype.hasOwnProperty,by=Object.prototype.propertyIsEnumerable,ds=(i,t,e)=>t in i?my(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_i=(i,t)=>{for(var e in t||(t={}))vy.call(t,e)&&ds(i,e,t[e]);if(ja)for(var e of ja(t))by.call(t,e)&&ds(i,e,t[e]);return i},Ka=(i,t)=>Ey(i,yy(t)),He=(i,t,e)=>ds(i,typeof t!="symbol"?t+"":t,e);class Iy extends i_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,He(this,"events",new oi.EventEmitter),He(this,"name",lm),He(this,"queue",new Map),He(this,"publishTimeout",U.toMiliseconds(U.ONE_MINUTE)),He(this,"initialPublishTimeout",U.toMiliseconds(U.ONE_SECOND*15)),He(this,"needsTransportRestart",!1),He(this,"publish",async(r,n,s)=>{var o,c,l,h,u;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:n,opts:s}});const d=(s==null?void 0:s.ttl)||cm,_=(s==null?void 0:s.prompt)||!1,p=(s==null?void 0:s.tag)||0,f=(s==null?void 0:s.id)||Yt().toString(),w=gi(Gr().protocol),g={id:f,method:(s==null?void 0:s.publishMethod)||w.publish,params:_i({topic:r,message:n,ttl:d,prompt:_,tag:p,attestation:s==null?void 0:s.attestation},(s==null?void 0:s.tvf)&&{tvf:s.tvf})},I=`Failed to publish payload, please try again. id:${f} tag:${p}`;try{fe((o=g.params)==null?void 0:o.prompt)&&((c=g.params)==null||delete c.prompt),fe((l=g.params)==null?void 0:l.tag)&&((h=g.params)==null||delete h.tag);const T=new Promise(async y=>{const v=({id:D})=>{var N;((N=g.id)==null?void 0:N.toString())===D.toString()&&(this.removeRequestFromQueue(D),this.relayer.events.removeListener(le.publish,v),y())};this.relayer.events.on(le.publish,v);const b=_t(new Promise((D,N)=>{this.rpcPublish(g,s).then(D).catch(S=>{this.logger.warn(S,S==null?void 0:S.message),N(S)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${f} tag:${p}`);try{await b,this.events.removeListener(le.publish,v)}catch(D){this.queue.set(f,{request:g,opts:s,attempt:1}),this.logger.warn(D,D==null?void 0:D.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:r,message:n,opts:s}}),await _t(T,this.publishTimeout,I)}catch(T){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(T),(u=s==null?void 0:s.internal)!=null&&u.throwOnFailedPublish)throw T}finally{this.queue.delete(f)}}),He(this,"publishCustom",async r=>{var n,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:r});const{payload:h,opts:u={}}=r,{attestation:d,tvf:_,publishMethod:p,prompt:f,tag:w,ttl:g=U.FIVE_MINUTES}=u,I=u.id||Yt().toString(),T=gi(Gr().protocol),y=p||T.publish,v={id:I,method:y,params:_i(Ka(_i({},h),{ttl:g,prompt:f,tag:w,attestation:d}),_)},b=`Failed to publish custom payload, please try again. id:${I} tag:${w}`;try{fe((n=v.params)==null?void 0:n.prompt)&&((s=v.params)==null||delete s.prompt),fe((o=v.params)==null?void 0:o.tag)&&((c=v.params)==null||delete c.tag);const D=new Promise(async N=>{const S=({id:P})=>{var E;((E=v.id)==null?void 0:E.toString())===P.toString()&&(this.removeRequestFromQueue(P),this.relayer.events.removeListener(le.publish,S),N())};this.relayer.events.on(le.publish,S);const m=_t(new Promise((P,E)=>{this.rpcPublish(v,u).then(P).catch(A=>{this.logger.warn(A,A==null?void 0:A.message),E(A)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${y} id:${I} tag:${w}`);try{await m,this.events.removeListener(le.publish,S)}catch(P){this.queue.set(I,{request:v,opts:u,attempt:1}),this.logger.warn(P,P==null?void 0:P.message)}});this.logger.trace({type:"method",method:"publish",params:{id:I,payload:h,opts:u}}),await _t(D,this.publishTimeout,b)}catch(D){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(D),(l=u==null?void 0:u.internal)!=null&&l.throwOnFailedPublish)throw D}finally{this.queue.delete(I)}}),He(this,"on",(r,n)=>{this.events.on(r,n)}),He(this,"once",(r,n)=>{this.events.once(r,n)}),He(this,"off",(r,n)=>{this.events.off(r,n)}),He(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),this.relayer=t,this.logger=Le(e,this.name),this.registerEventListeners()}get context(){return Be(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const r=await this.relayer.request(t);return this.relayer.events.emit(le.publish,_i(_i({},t),e)),this.logger.debug("Successfully Published Payload"),r}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var r;const n=t.attempt+1;this.queue.set(e,Ka(_i({},t),{attempt:n})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(r=t.request.params)==null?void 0:r.tag}, attempt: ${n}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Pi.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(le.connection_stalled);return}this.checkQueue()}),this.relayer.on(le.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var Ay=Object.defineProperty,Py=(i,t,e)=>t in i?Ay(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,pi=(i,t,e)=>Py(i,typeof t!="symbol"?t+"":t,e);class Ty{constructor(){pi(this,"map",new Map),pi(this,"set",(t,e)=>{const r=this.get(t);this.exists(t,e)||this.map.set(t,[...r,e])}),pi(this,"get",t=>this.map.get(t)||[]),pi(this,"exists",(t,e)=>this.get(t).includes(e)),pi(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,e))return;const n=r.filter(s=>s!==e);if(!n.length){this.map.delete(t);return}this.map.set(t,n)}),pi(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var Oy=Object.defineProperty,Ry=Object.defineProperties,Dy=Object.getOwnPropertyDescriptors,Ha=Object.getOwnPropertySymbols,Ly=Object.prototype.hasOwnProperty,Vy=Object.prototype.propertyIsEnumerable,_s=(i,t,e)=>t in i?Oy(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,zi=(i,t)=>{for(var e in t||(t={}))Ly.call(t,e)&&_s(i,e,t[e]);if(Ha)for(var e of Ha(t))Vy.call(t,e)&&_s(i,e,t[e]);return i},Rn=(i,t)=>Ry(i,Dy(t)),re=(i,t,e)=>_s(i,typeof t!="symbol"?t+"":t,e);class xy extends s_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,re(this,"subscriptions",new Map),re(this,"topicMap",new Ty),re(this,"events",new oi.EventEmitter),re(this,"name",wm),re(this,"version",gm),re(this,"pending",new Map),re(this,"cached",[]),re(this,"initialized",!1),re(this,"storagePrefix",wt),re(this,"subscribeTimeout",U.toMiliseconds(U.ONE_MINUTE)),re(this,"initialSubscribeTimeout",U.toMiliseconds(U.ONE_SECOND*15)),re(this,"clientId"),re(this,"batchSubscribeTopicsLimit",500),re(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),re(this,"subscribe",async(r,n)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:n}});try{const o=Gr(n),c={topic:r,relay:o,transportType:n==null?void 0:n.transportType};(s=n==null?void 0:n.internal)!=null&&s.skipSubscribe||this.pending.set(r,c);const l=await this.rpcSubscribe(r,o,n);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:n}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),re(this,"unsubscribe",async(r,n)=>{this.isInitialized(),typeof(n==null?void 0:n.id)<"u"?await this.unsubscribeById(r,n.id,n):await this.unsubscribeByTopic(r,n)}),re(this,"isSubscribed",r=>new Promise(n=>{n(this.topicMap.topics.includes(r))})),re(this,"isKnownTopic",r=>new Promise(n=>{n(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(s=>s.topic===r))})),re(this,"on",(r,n)=>{this.events.on(r,n)}),re(this,"once",(r,n)=>{this.events.once(r,n)}),re(this,"off",(r,n)=>{this.events.off(r,n)}),re(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),re(this,"start",async()=>{await this.onConnect()}),re(this,"stop",async()=>{await this.onDisconnect()}),re(this,"restart",async()=>{await this.restore(),await this.onRestart()}),re(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(n=>{r.push(n)}),await this.batchSubscribe(r)}),re(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Pi.pulse,async()=>{await this.checkPending()}),this.events.on(qe.created,async r=>{const n=qe.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:r}),await this.persist()}),this.events.on(qe.deleted,async r=>{const n=qe.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:r}),await this.persist()})}),this.relayer=t,this.logger=Le(e,this.name),this.clientId=""}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,e){let r=!1;try{r=this.getSubscription(t).topic===e}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const r=this.topicMap.get(t);await Promise.all(r.map(async n=>await this.unsubscribeById(t,n,e)))}async unsubscribeById(t,e,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}});try{const n=Gr(r);await this.restartToComplete({topic:t,id:e,relay:n}),await this.rpcUnsubscribe(t,e,n);const s=ae("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(t,e,r){var n,s;const o=await this.getSubscriptionId(t);if((n=r==null?void 0:r.internal)!=null&&n.skipSubscribe)return o;(!r||(r==null?void 0:r.transportType)===se.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:gi(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=r==null?void 0:r.internal)==null?void 0:s.throwOnFailedPublish;try{if((r==null?void 0:r.transportType)===se.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(d=>this.logger.warn(d))},U.toMiliseconds(U.ONE_SECOND)),o;const h=new Promise(async d=>{const _=p=>{p.topic===t&&(this.events.removeListener(qe.created,_),d(p.id))};this.events.on(qe.created,_);try{const p=await _t(new Promise((f,w)=>{this.relayer.request(c).catch(g=>{this.logger.warn(g,g==null?void 0:g.message),w(g)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(qe.created,_),d(p)}catch{}}),u=await _t(h,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!u&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return u?o:null}catch(h){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(le.connection_stalled),l)throw h}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,r={method:gi(e.protocol).batchSubscribe,params:{topics:t.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await _t(new Promise(n=>{this.relayer.request(r).catch(s=>this.logger.warn(s)).then(n)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,r={method:gi(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let n;try{n=await await _t(new Promise((s,o)=>{this.relayer.request(r).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}return n}rpcUnsubscribe(t,e,r){const n={method:gi(r.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(t,e){this.setSubscription(t,Rn(zi({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,zi({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,r){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,r),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,zi({},e)),this.topicMap.set(e.topic,t),this.events.emit(qe.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:r}=k("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(qe.deleted,Rn(zi({},r),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(qe.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const n=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(qe.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var r;return e.topic===((r=this.subscriptions.get(e.id))==null?void 0:r.topic)})){const{message:e}=k("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Rn(zi({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await lf(U.toMiliseconds(U.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return Ge(t+await this.getClientId())}}var Sy=Object.defineProperty,Wa=Object.getOwnPropertySymbols,Cy=Object.prototype.hasOwnProperty,$y=Object.prototype.propertyIsEnumerable,ps=(i,t,e)=>t in i?Sy(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ga=(i,t)=>{for(var e in t||(t={}))Cy.call(t,e)&&ps(i,e,t[e]);if(Wa)for(var e of Wa(t))$y.call(t,e)&&ps(i,e,t[e]);return i},Z=(i,t,e)=>ps(i,typeof t!="symbol"?t+"":t,e);class ky extends r_{constructor(t){super(t),Z(this,"protocol","wc"),Z(this,"version",2),Z(this,"core"),Z(this,"logger"),Z(this,"events",new oi.EventEmitter),Z(this,"provider"),Z(this,"messages"),Z(this,"subscriber"),Z(this,"publisher"),Z(this,"name",hm),Z(this,"transportExplicitlyClosed",!1),Z(this,"initialized",!1),Z(this,"connectionAttemptInProgress",!1),Z(this,"relayUrl"),Z(this,"projectId"),Z(this,"packageName"),Z(this,"bundleId"),Z(this,"hasExperiencedNetworkDisruption",!1),Z(this,"pingTimeout"),Z(this,"heartBeatTimeout",U.toMiliseconds(U.THIRTY_SECONDS+U.FIVE_SECONDS)),Z(this,"reconnectTimeout"),Z(this,"connectPromise"),Z(this,"reconnectInProgress",!1),Z(this,"requestsInFlight",[]),Z(this,"connectTimeout",U.toMiliseconds(U.ONE_SECOND*15)),Z(this,"request",async e=>{var r,n;this.logger.debug("Publishing Request Payload");const s=e.id||Yt().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(r=e.params)==null?void 0:r.topic},"relayer.request - publishing...");const o=`${s}:${((n=e.params)==null?void 0:n.tag)||""}`;this.requestsInFlight.push(o);const c=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),Z(this,"resetPingTimeout",()=>{jr()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,r,n,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.terminate)==null||s.call(n)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Z(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),Z(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(le.connect)}),Z(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),Z(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(le.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Z(this,"registerProviderListeners",()=>{this.provider.on(Ke.payload,this.onPayloadHandler),this.provider.on(Ke.connect,this.onConnectHandler),this.provider.on(Ke.disconnect,this.onDisconnectHandler),this.provider.on(Ke.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Le(t.logger,this.name):Qr(qs({level:t.logger||um})),this.messages=new gy(this.logger,t.core),this.subscriber=new xy(this,this.logger),this.publisher=new Iy(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||du,Hp()?this.packageName=jo():Wp()&&(this.bundleId=jo()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return Be(this.logger)}get connected(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,r){this.isInitialized(),await this.publisher.publish(t,e,r),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:se.relay},Sr.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var r,n,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((r=e==null?void 0:e.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(n=e==null?void 0:e.internal)==null?void 0:n.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const h=u=>{u.topic===t&&(this.subscriber.off(qe.created,h),l())};return await Promise.all([new Promise(u=>{l=u,this.subscriber.on(qe.created,h)}),new Promise(async(u,d)=>{c=await this.subscriber.subscribe(t,Ga({internal:{throwOnFailedPublish:o}},e)).catch(_=>{o&&d(_)})||c,u()})]),c}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await _t(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(e,r)=>{await this.connect(t).then(e).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Ca())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((r,n)=>r.publishedAt-n.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const r of e)try{await this.onMessageEvent(r)}catch(n){this.logger.warn(n,"Error while processing batch message event: "+(n==null?void 0:n.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:r}=t;if(!e.sessionExists){const n=pe(U.FIVE_MINUTES),s={topic:r,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,s)}this.events.emit(le.message,t),await this.recordMessageEvent(t,Sr.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(r,n)=>{const s=()=>{n(new Error("Connection interrupted while trying to connect"))};this.provider.once(Ke.disconnect,s),await _t(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{n(o)}).finally(()=>{this.provider.off(Ke.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{n(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Ke.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Ke.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const n=r;this.logger.warn({},n.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(r=>setTimeout(r,U.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,r,n,s;if(jr())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Nh(new Uh(Qp({sdkVersion:cs,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:r,message:n}=t;await this.messages.set(r,n,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const n=this.messages.has(e,r);return n&&this.logger.warn(`Ignoring duplicate message: ${r}`),n}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),Ls(t)){if(!t.method.endsWith(dm))return;const e=t.params,{topic:r,message:n,publishedAt:s,attestation:o}=e.data,c={topic:r,message:n,publishedAt:s,transportType:se.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ga({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else Vs(t)&&this.events.emit(le.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,Sr.inbound),this.events.emit(le.message,t))}async acknowledgePayload(t){const e=Ur(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Ke.payload,this.onPayloadHandler),this.provider.off(Ke.connect,this.onConnectHandler),this.provider.off(Ke.disconnect,this.onDisconnectHandler),this.provider.off(Ke.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Ca();Mg(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Pi.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Kg())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(le.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},U.toMiliseconds(_m)))))}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function Ny(i,t){return i===t||Number.isNaN(i)&&Number.isNaN(t)}function Ja(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function Ya(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Uy="[object RegExp]",By="[object String]",Fy="[object Number]",qy="[object Boolean]",Za="[object Arguments]",My="[object Symbol]",zy="[object Date]",jy="[object Map]",Ky="[object Set]",Hy="[object Array]",Wy="[object Function]",Gy="[object ArrayBuffer]",Dn="[object Object]",Jy="[object Error]",Yy="[object DataView]",Zy="[object Uint8Array]",Qy="[object Uint8ClampedArray]",Xy="[object Uint16Array]",ev="[object Uint32Array]",tv="[object BigUint64Array]",iv="[object Int8Array]",rv="[object Int16Array]",nv="[object Int32Array]",sv="[object BigInt64Array]",ov="[object Float32Array]",av="[object Float64Array]";function cv(){}function Qa(i){if(!i||typeof i!="object")return!1;const t=Object.getPrototypeOf(i);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(i)==="[object Object]":!1}function lv(i,t,e){return Wi(i,t,void 0,void 0,void 0,void 0,e)}function Wi(i,t,e,r,n,s,o){const c=o(i,t,e,r,n,s);if(c!==void 0)return c;if(typeof i==typeof t)switch(typeof i){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return i===t;case"number":return i===t||Object.is(i,t);case"function":return i===t;case"object":return tr(i,t,s,o)}return tr(i,t,s,o)}function tr(i,t,e,r){if(Object.is(i,t))return!0;let n=Ya(i),s=Ya(t);if(n===Za&&(n=Dn),s===Za&&(s=Dn),n!==s)return!1;switch(n){case By:return i.toString()===t.toString();case Fy:{const l=i.valueOf(),h=t.valueOf();return Ny(l,h)}case qy:case zy:case My:return Object.is(i.valueOf(),t.valueOf());case Uy:return i.source===t.source&&i.flags===t.flags;case Wy:return i===t}e=e??new Map;const o=e.get(i),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(i,t),e.set(t,i);try{switch(n){case jy:{if(i.size!==t.size)return!1;for(const[l,h]of i.entries())if(!t.has(l)||!Wi(h,t.get(l),l,i,t,e,r))return!1;return!0}case Ky:{if(i.size!==t.size)return!1;const l=Array.from(i.values()),h=Array.from(t.values());for(let u=0;u<l.length;u++){const d=l[u],_=h.findIndex(p=>Wi(d,p,void 0,i,t,e,r));if(_===-1)return!1;h.splice(_,1)}return!0}case Hy:case Zy:case Qy:case Xy:case ev:case tv:case iv:case rv:case nv:case sv:case ov:case av:{if(typeof ee<"u"&&ee.isBuffer(i)!==ee.isBuffer(t)||i.length!==t.length)return!1;for(let l=0;l<i.length;l++)if(!Wi(i[l],t[l],l,i,t,e,r))return!1;return!0}case Gy:return i.byteLength!==t.byteLength?!1:tr(new Uint8Array(i),new Uint8Array(t),e,r);case Yy:return i.byteLength!==t.byteLength||i.byteOffset!==t.byteOffset?!1:tr(new Uint8Array(i),new Uint8Array(t),e,r);case Jy:return i.name===t.name&&i.message===t.message;case Dn:{if(!(tr(i.constructor,t.constructor,e,r)||Qa(i)&&Qa(t)))return!1;const l=[...Object.keys(i),...Ja(i)],h=[...Object.keys(t),...Ja(t)];if(l.length!==h.length)return!1;for(let u=0;u<l.length;u++){const d=l[u],_=i[d];if(!Object.hasOwn(t,d))return!1;const p=t[d];if(!Wi(_,p,d,i,t,e,r))return!1}return!0}default:return!1}}finally{e.delete(i),e.delete(t)}}function uv(i,t){return lv(i,t,cv)}var hv=Object.defineProperty,Xa=Object.getOwnPropertySymbols,dv=Object.prototype.hasOwnProperty,_v=Object.prototype.propertyIsEnumerable,fs=(i,t,e)=>t in i?hv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ec=(i,t)=>{for(var e in t||(t={}))dv.call(t,e)&&fs(i,e,t[e]);if(Xa)for(var e of Xa(t))_v.call(t,e)&&fs(i,e,t[e]);return i},Ve=(i,t,e)=>fs(i,typeof t!="symbol"?t+"":t,e);class ai extends n_{constructor(t,e,r,n=wt,s=void 0){super(t,e,r,n),this.core=t,this.logger=e,this.name=r,Ve(this,"map",new Map),Ve(this,"version",pm),Ve(this,"cached",[]),Ve(this,"initialized",!1),Ve(this,"getKey"),Ve(this,"storagePrefix",wt),Ve(this,"recentlyDeleted",[]),Ve(this,"recentlyDeletedLimit",200),Ve(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!fe(o)?this.map.set(this.getKey(o),o):Eg(o)?this.map.set(o.id,o):yg(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),Ve(this,"set",async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),await this.persist())}),Ve(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),Ve(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>uv(c[l],o[l]))):this.values)),Ve(this,"update",async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});const l=ec(ec({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),Ve(this,"delete",async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=Le(e,this.name),this.storagePrefix=n,this.getKey=s}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:n}=k("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}const{message:r}=k("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=k("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var pv=Object.defineProperty,fv=(i,t,e)=>t in i?pv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,G=(i,t,e)=>fv(i,typeof t!="symbol"?t+"":t,e);class wv{constructor(t,e){this.core=t,this.logger=e,G(this,"name",mm),G(this,"version",Em),G(this,"events",new vc),G(this,"pairings"),G(this,"initialized",!1),G(this,"storagePrefix",wt),G(this,"ignoredPayloadTypes",[Pt]),G(this,"registeredMethods",[]),G(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),G(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),G(this,"create",async r=>{this.isInitialized();const n=os(),s=await this.core.crypto.setSymKey(n),o=pe(U.FIVE_MINUTES),c={protocol:hu},l={topic:s,expiry:o,relay:c,active:!1,methods:r==null?void 0:r.methods},h=Pa({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:c,expiryTimestamp:o,methods:r==null?void 0:r.methods});return this.events.emit(Jt.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:r==null?void 0:r.transportType,internal:r==null?void 0:r.internal}),{topic:s,uri:h}}),G(this,"pair",async r=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[ht.pairing_started]}});this.isValidPair(r,n);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:h}=Aa(r.uri);n.props.properties.topic=s,n.addTrace(ht.pairing_uri_validation_success),n.addTrace(ht.pairing_uri_not_expired);let u;if(this.pairings.keys.includes(s)){if(u=this.pairings.get(s),n.addTrace(ht.existing_pairing),u.active)throw n.setError(bt.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(ht.pairing_not_expired)}const d=l||pe(U.FIVE_MINUTES),_={topic:s,relay:c,expiry:d,active:!1,methods:h};this.core.expirer.set(s,d),await this.pairings.set(s,_),n.addTrace(ht.store_new_pairing),r.activatePairing&&await this.activate({topic:s}),this.events.emit(Jt.create,_),n.addTrace(ht.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),n.addTrace(ht.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(bt.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(p){throw n.setError(bt.subscribe_pairing_topic_failure),p}return n.addTrace(ht.subscribe_pairing_topic_success),_}),G(this,"activate",async({topic:r})=>{this.isInitialized();const n=pe(U.FIVE_MINUTES);this.core.expirer.set(r,n),await this.pairings.update(r,{active:!0,expiry:n})}),G(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:n}=r;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Gt();this.events.once(Q("pairing_ping",s),({error:h})=>{h?l(h):c()}),await o()}}),G(this,"updateExpiry",async({topic:r,expiry:n})=>{this.isInitialized(),await this.pairings.update(r,{expiry:n})}),G(this,"updateMetadata",async({topic:r,metadata:n})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:n})}),G(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),G(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",ae("USER_DISCONNECTED")),await this.deletePairing(n))}),G(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:n,relay:s,expiry:o,methods:c}=r,l=this.core.crypto.keychain.get(n);return Pa({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),G(this,"sendRequest",async(r,n,s)=>{const o=$t(n,s),c=await this.core.crypto.encode(r,o),l=Fi[n].req;return this.core.history.set(r,o),this.core.relayer.publish(r,c,l),o.id}),G(this,"sendResult",async(r,n,s)=>{const o=Ur(r,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,r)).request.method,h=Fi[l].res;await this.core.relayer.publish(n,c,h),await this.core.history.resolve(o)}),G(this,"sendError",async(r,n,s)=>{const o=Ac(r,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,r)).request.method,h=Fi[l]?Fi[l].res:Fi.unregistered_method.res;await this.core.relayer.publish(n,c,h),await this.core.history.resolve(o)}),G(this,"deletePairing",async(r,n)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,ae("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),n?Promise.resolve():this.core.expirer.del(r)])}),G(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(n=>kt(n.expiry));await Promise.all(r.map(n=>this.deletePairing(n.topic)))}),G(this,"onRelayEventRequest",async r=>{const{topic:n,payload:s}=r;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(n,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(n,s);default:return await this.onUnknownRpcMethodRequest(n,s)}}),G(this,"onRelayEventResponse",async r=>{const{topic:n,payload:s}=r,o=(await this.core.history.get(n,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}}),G(this,"onPairingPingRequest",async(r,n)=>{const{id:s}=n;try{this.isValidPing({topic:r}),await this.sendResult(s,r,!0),this.events.emit(Jt.ping,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),G(this,"onPairingPingResponse",(r,n)=>{const{id:s}=n;setTimeout(()=>{yt(n)?this.events.emit(Q("pairing_ping",s),{}):dt(n)&&this.events.emit(Q("pairing_ping",s),{error:n.error})},500)}),G(this,"onPairingDeleteRequest",async(r,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(Jt.delete,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),G(this,"onUnknownRpcMethodRequest",async(r,n)=>{const{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;const c=ae("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,r,c),this.logger.error(c)}catch(c){await this.sendError(s,r,c),this.logger.error(c)}}),G(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(ae("WC_METHOD_UNSUPPORTED",r))}),G(this,"isValidPair",(r,n)=>{var s;if(!xe(r)){const{message:c}=k("MISSING_OR_INVALID",`pair() params: ${r}`);throw n.setError(bt.malformed_pairing_uri),new Error(c)}if(!mg(r.uri)){const{message:c}=k("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw n.setError(bt.malformed_pairing_uri),new Error(c)}const o=Aa(r==null?void 0:r.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:c}=k("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(bt.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=k("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(bt.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&U.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){n.setError(bt.pairing_expired);const{message:c}=k("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),G(this,"isValidPing",async r=>{if(!xe(r)){const{message:s}=k("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidPairingTopic(n)}),G(this,"isValidDisconnect",async r=>{if(!xe(r)){const{message:s}=k("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(s)}const{topic:n}=r;await this.isValidPairingTopic(n)}),G(this,"isValidPairingTopic",async r=>{if(!de(r,!1)){const{message:n}=k("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(n)}if(!this.pairings.keys.includes(r)){const{message:n}=k("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(n)}if(kt(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:n}=k("EXPIRED",`pairing topic: ${r}`);throw new Error(n)}}),this.core=t,this.logger=Le(e,this.name),this.pairings=new ai(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Be(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(le.message,async t=>{const{topic:e,message:r,transportType:n}=t;if(this.pairings.keys.includes(e)&&n!==se.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const s=await this.core.crypto.decode(e,r);Ls(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):Vs(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,r)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(We.expired,async t=>{const{topic:e}=fl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Jt.expire,{topic:e}))})}}var gv=Object.defineProperty,mv=(i,t,e)=>t in i?gv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ee=(i,t,e)=>mv(i,typeof t!="symbol"?t+"":t,e);class Ev extends e_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Ee(this,"records",new Map),Ee(this,"events",new oi.EventEmitter),Ee(this,"name",ym),Ee(this,"version",vm),Ee(this,"cached",[]),Ee(this,"initialized",!1),Ee(this,"storagePrefix",wt),Ee(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Ee(this,"set",(r,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:n,chainId:s}),this.records.has(n.id))return;const o={id:n.id,topic:r,request:{method:n.method,params:n.params||null},chainId:s,expiry:pe(U.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(et.created,o)}),Ee(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const n=await this.getRecord(r.id);typeof n.response>"u"&&(n.response=dt(r)?{error:r.error}:{result:r.result},this.records.set(n.id,n),this.persist(),this.events.emit(et.updated,n))}),Ee(this,"get",async(r,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:n}),await this.getRecord(n))),Ee(this,"delete",(r,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===r){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(et.deleted,s)}}),this.persist()}),Ee(this,"exists",async(r,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===r:!1)),Ee(this,"on",(r,n)=>{this.events.on(r,n)}),Ee(this,"once",(r,n)=>{this.events.once(r,n)}),Ee(this,"off",(r,n)=>{this.events.off(r,n)}),Ee(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),this.logger=Le(e,this.name)}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const r={topic:e.topic,request:$t(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(r)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:r}=k("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(et.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=k("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(et.created,t=>{const e=et.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(et.updated,t=>{const e=et.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(et.deleted,t=>{const e=et.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Pi.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{U.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(et.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var yv=Object.defineProperty,vv=(i,t,e)=>t in i?yv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Pe=(i,t,e)=>vv(i,typeof t!="symbol"?t+"":t,e);class bv extends o_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Pe(this,"expirations",new Map),Pe(this,"events",new oi.EventEmitter),Pe(this,"name",bm),Pe(this,"version",Im),Pe(this,"cached",[]),Pe(this,"initialized",!1),Pe(this,"storagePrefix",wt),Pe(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Pe(this,"has",r=>{try{const n=this.formatTarget(r);return typeof this.getExpiration(n)<"u"}catch{return!1}}),Pe(this,"set",(r,n)=>{this.isInitialized();const s=this.formatTarget(r),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(We.created,{target:s,expiration:o})}),Pe(this,"get",r=>{this.isInitialized();const n=this.formatTarget(r);return this.getExpiration(n)}),Pe(this,"del",r=>{if(this.isInitialized(),this.has(r)){const n=this.formatTarget(r),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(We.deleted,{target:n,expiration:s})}}),Pe(this,"on",(r,n)=>{this.events.on(r,n)}),Pe(this,"once",(r,n)=>{this.events.once(r,n)}),Pe(this,"off",(r,n)=>{this.events.off(r,n)}),Pe(this,"removeListener",(r,n)=>{this.events.removeListener(r,n)}),this.logger=Le(e,this.name)}get context(){return Be(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if(typeof t=="string")return Xp(t);if(typeof t=="number")return ef(t);const{message:e}=k("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(We.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=k("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:r}=k("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return e}checkExpiry(t,e){const{expiry:r}=e;U.toMiliseconds(r)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(We.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Pi.pulse,()=>this.checkExpirations()),this.events.on(We.created,t=>{const e=We.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(We.expired,t=>{const e=We.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(We.deleted,t=>{const e=We.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Iv=Object.defineProperty,Av=(i,t,e)=>t in i?Iv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,he=(i,t,e)=>Av(i,typeof t!="symbol"?t+"":t,e);class Pv extends a_{constructor(t,e,r){super(t,e,r),this.core=t,this.logger=e,this.store=r,he(this,"name",Am),he(this,"abortController"),he(this,"isDevEnv"),he(this,"verifyUrlV3",Tm),he(this,"storagePrefix",wt),he(this,"version",uu),he(this,"publicKey"),he(this,"fetchPromise"),he(this,"init",async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&U.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),he(this,"register",async n=>{if(!Di()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=n,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const h=mi(),u=this.startAbortTimer(U.ONE_SECOND*5),d=await new Promise((_,p)=>{const f=()=>{window.removeEventListener("message",g),h.body.removeChild(w),p("attestation aborted")};this.abortController.signal.addEventListener("abort",f);const w=h.createElement("iframe");w.src=l,w.style.display="none",w.addEventListener("error",f,{signal:this.abortController.signal});const g=I=>{if(I.data&&typeof I.data=="string")try{const T=JSON.parse(I.data);if(T.type==="verify_attestation"){if(Bn(T.attestation).payload.id!==o)return;clearInterval(u),h.body.removeChild(w),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",g),_(T.attestation===null?"":T.attestation)}}catch(T){this.logger.warn(T)}};h.body.appendChild(w),window.addEventListener("message",g,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(h){this.logger.warn(h)}return""}),he(this,"resolve",async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Bn(s).payload.id!==c)return;const h=await this.isValidJwtAttestation(s);if(h){if(!h.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return h}}if(!o)return;const l=this.getVerifyUrl(n==null?void 0:n.verifyUrl);return this.fetchAttestation(o,l)}),he(this,"fetchAttestation",async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const o=this.startAbortTimer(U.ONE_SECOND*5),c=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),he(this,"getVerifyUrl",n=>{let s=n||er;return Om.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${er}`),s=er),s}),he(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(U.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}}),he(this,"persistPublicKey",async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n}),he(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),he(this,"isValidJwtAttestation",async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(n,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),he(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),he(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n}),he(this,"validateAttestation",(n,s)=>{const o=Y0(n,s.publicKey),c={hasExpired:U.toMiliseconds(o.exp)<Date.now(),payload:o};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=Le(e,this.name),this.abortController=new AbortController,this.isDevEnv=Hs(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Be(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),U.toMiliseconds(t))}}var Tv=Object.defineProperty,Ov=(i,t,e)=>t in i?Tv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,tc=(i,t,e)=>Ov(i,typeof t!="symbol"?t+"":t,e);class Rv extends c_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,tc(this,"context",Rm),tc(this,"registerDeviceToken",async r=>{const{clientId:n,token:s,notificationType:o,enableEncrypted:c=!1}=r,l=`${Dm}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:o,token:s,always_raw:c})})}),this.logger=Le(e,this.context)}}var Dv=Object.defineProperty,ic=Object.getOwnPropertySymbols,Lv=Object.prototype.hasOwnProperty,Vv=Object.prototype.propertyIsEnumerable,ws=(i,t,e)=>t in i?Dv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ji=(i,t)=>{for(var e in t||(t={}))Lv.call(t,e)&&ws(i,e,t[e]);if(ic)for(var e of ic(t))Vv.call(t,e)&&ws(i,e,t[e]);return i},we=(i,t,e)=>ws(i,typeof t!="symbol"?t+"":t,e);class xv extends l_{constructor(t,e,r=!0){super(t,e,r),this.core=t,this.logger=e,we(this,"context",Vm),we(this,"storagePrefix",wt),we(this,"storageVersion",Lm),we(this,"events",new Map),we(this,"shouldPersist",!1),we(this,"init",async()=>{if(!Hs())try{const n={eventId:Ho(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:_l(this.core.relayer.protocol,this.core.relayer.version,cs)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}}),we(this,"createEvent",n=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=n,h=Ho(),u=this.core.projectId||"",d=Date.now(),_=ji({eventId:h,timestamp:d,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:u,domain:this.getAppDomain()},this.setMethods(h));return this.telemetryEnabled&&(this.events.set(h,_),this.shouldPersist=!0),_}),we(this,"getEvent",n=>{const{eventId:s,topic:o}=n;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return ji(ji({},c),this.setMethods(c.eventId))}),we(this,"deleteEvent",n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0}),we(this,"setEventListeners",()=>{this.core.heartbeat.on(Pi.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{U.fromMiliseconds(Date.now())-U.fromMiliseconds(n.timestamp)>xm&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})}),we(this,"setMethods",n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)})),we(this,"addTrace",(n,s)=>{const o=this.events.get(n);o&&(o.props.properties.trace.push(s),this.events.set(n,o),this.shouldPersist=!0)}),we(this,"setError",(n,s)=>{const o=this.events.get(n);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(n,o),this.shouldPersist=!0)}),we(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),we(this,"restore",async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,ji(ji({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}}),we(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,o]of this.events)o.props.type&&n.push(o);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),we(this,"sendEvent",async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Sm}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${cs}${s}`,{method:"POST",body:JSON.stringify(n)})}),we(this,"getAppDomain",()=>dl().url),this.logger=Le(e,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Sv=Object.defineProperty,rc=Object.getOwnPropertySymbols,Cv=Object.prototype.hasOwnProperty,$v=Object.prototype.propertyIsEnumerable,gs=(i,t,e)=>t in i?Sv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,nc=(i,t)=>{for(var e in t||(t={}))Cv.call(t,e)&&gs(i,e,t[e]);if(rc)for(var e of rc(t))$v.call(t,e)&&gs(i,e,t[e]);return i},ne=(i,t,e)=>gs(i,typeof t!="symbol"?t+"":t,e);class oo extends Yd{constructor(t){var e;super(t),ne(this,"protocol",lu),ne(this,"version",uu),ne(this,"name",Yr),ne(this,"relayUrl"),ne(this,"projectId"),ne(this,"customStoragePrefix"),ne(this,"events",new oi.EventEmitter),ne(this,"logger"),ne(this,"heartbeat"),ne(this,"relayer"),ne(this,"crypto"),ne(this,"storage"),ne(this,"history"),ne(this,"expirer"),ne(this,"pairing"),ne(this,"verify"),ne(this,"echoClient"),ne(this,"linkModeSupportedApps"),ne(this,"eventClient"),ne(this,"initialized",!1),ne(this,"logChunkController"),ne(this,"on",(c,l)=>this.events.on(c,l)),ne(this,"once",(c,l)=>this.events.once(c,l)),ne(this,"off",(c,l)=>this.events.off(c,l)),ne(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ne(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:h})=>{if(!c||!l)return;const u={topic:c,message:l,publishedAt:Date.now(),transportType:se.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:h})});const r=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}catch(c){console.warn("Failed to copy global core",c)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||du,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const n=qs({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:em.logger,name:Yr}),{logger:s,chunkLoggerController:o}=Wd({opts:n,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Le(s,this.name),this.heartbeat=new $h,this.crypto=new ly(this,this.logger,t==null?void 0:t.keychain),this.history=new Ev(this,this.logger),this.expirer=new bv(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new kh(nc(nc({},tm),t==null?void 0:t.storageOptions)),this.relayer=new ky({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new wv(this,this.logger),this.verify=new Pv(this,this.logger,this.storage),this.echoClient=new Rv(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new xv(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new oo(t);await e.initialize();const r=await e.crypto.getClientId();return await e.storage.setItem(fm,r),e}get context(){return Be(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(ka,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(ka)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,r=`${e}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof Mt<"u"&&{}.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const kv=oo,Pu="wc",Tu=2,Ou="client",ao=`${Pu}@${Tu}:${Ou}:`,Ln={name:Ou,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},sc="WALLETCONNECT_DEEPLINK_CHOICE",Nv="proposal",oc="Proposal expired",Uv="session",fi=U.SEVEN_DAYS,Bv="engine",ye={wc_sessionPropose:{req:{ttl:U.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1104},res:{ttl:U.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1106},res:{ttl:U.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:U.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:U.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1112},res:{ttl:U.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:U.ONE_DAY,prompt:!1,tag:1114},res:{ttl:U.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:U.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:U.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:U.FIVE_MINUTES,prompt:!1,tag:1119}}},Vn={min:U.FIVE_MINUTES,max:U.SEVEN_DAYS},ut={idle:"IDLE",active:"ACTIVE"},Fv={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},qv="request",Mv=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],zv="wc",jv="auth",Kv="authKeys",Hv="pairingTopics",Wv="requests",cn=`${zv}@${1.5}:${jv}:`,Cr=`${cn}:PUB_KEY`;var Gv=Object.defineProperty,Jv=Object.defineProperties,Yv=Object.getOwnPropertyDescriptors,ac=Object.getOwnPropertySymbols,Zv=Object.prototype.hasOwnProperty,Qv=Object.prototype.propertyIsEnumerable,ms=(i,t,e)=>t in i?Gv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,X=(i,t)=>{for(var e in t||(t={}))Zv.call(t,e)&&ms(i,e,t[e]);if(ac)for(var e of ac(t))Qv.call(t,e)&&ms(i,e,t[e]);return i},Te=(i,t)=>Jv(i,Yv(t)),R=(i,t,e)=>ms(i,typeof t!="symbol"?t+"":t,e);class Xv extends __{constructor(t){super(t),R(this,"name",Bv),R(this,"events",new vc),R(this,"initialized",!1),R(this,"requestQueue",{state:ut.idle,queue:[]}),R(this,"sessionRequestQueue",{state:ut.idle,queue:[]}),R(this,"emittedSessionRequests",new uf({limit:500})),R(this,"requestQueueDelay",U.ONE_SECOND),R(this,"expectedPairingMethodMap",new Map),R(this,"recentlyDeletedMap",new Map),R(this,"recentlyDeletedLimit",200),R(this,"relayMessageCache",[]),R(this,"pendingSessions",new Map),R(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(ye)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},U.toMiliseconds(this.requestQueueDelay)))}),R(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=Te(X({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(r),r.optionalNamespaces=_g(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:h}=r;let u=n,d,_=!1;try{if(u){const D=this.client.core.pairing.pairings.get(u);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),_=D.active}}catch(D){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),D}if(!u||!_){const{topic:D,uri:N}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});u=D,d=N}if(!u){const{message:D}=k("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(D)}const p=await this.client.core.crypto.generateKeyPair(),f=ye.wc_sessionPropose.req.ttl||U.FIVE_MINUTES,w=pe(f),g=Te(X(X({requiredNamespaces:s,optionalNamespaces:o,relays:h??[{protocol:hu}],proposer:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:w,pairingTopic:u},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Ot()}),I=Q("session_connect",g.id),{reject:T,resolve:y,done:v}=Gt(f,oc),b=({id:D})=>{D===g.id&&(this.client.events.off("proposal_expire",b),this.pendingSessions.delete(g.id),this.events.emit(I,{error:{message:oc,code:0}}))};return this.client.events.on("proposal_expire",b),this.events.once(I,({error:D,session:N})=>{this.client.events.off("proposal_expire",b),D?T(D):N&&y(N)}),await this.sendProposeSession({proposal:g,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:g.id}}}),await this.setProposal(g.id,g),{uri:d,approval:v}}),R(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(r){throw this.client.logger.error("pair() failed"),r}}),R(this,"approve",async e=>{var r,n,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=e==null?void 0:e.id)==null?void 0:r.toString(),trace:[Ct.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(m){throw o.setError(qi.no_internet_connection),m}try{await this.isValidProposalId(e==null?void 0:e.id)}catch(m){throw this.client.logger.error(`approve() -> proposal.get(${e==null?void 0:e.id}) failed`),o.setError(qi.proposal_not_found),m}try{await this.isValidApprove(e)}catch(m){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(qi.session_approve_namespace_validation_failure),m}const{id:c,relayProtocol:l,namespaces:h,sessionProperties:u,scopedProperties:d,sessionConfig:_}=e,p=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:f,proposer:w,requiredNamespaces:g,optionalNamespaces:I}=p;let T=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:f});T||(T=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Ct.session_approve_started,properties:{topic:f,trace:[Ct.session_approve_started,Ct.session_namespaces_validation_success]}}));const y=await this.client.core.crypto.generateKeyPair(),v=w.publicKey,b=await this.client.core.crypto.generateSharedKey(y,v),D=X(X(X({relay:{protocol:l??"irn"},namespaces:h,controller:{publicKey:y,metadata:this.client.metadata},expiry:pe(fi)},u&&{sessionProperties:u}),d&&{scopedProperties:d}),_&&{sessionConfig:_}),N=se.relay;T.addTrace(Ct.subscribing_session_topic);try{await this.client.core.relayer.subscribe(b,{transportType:N,internal:{skipSubscribe:!0}})}catch(m){throw T.setError(qi.subscribe_session_topic_failure),m}T.addTrace(Ct.subscribe_session_topic_success);const S=Te(X({},D),{topic:b,requiredNamespaces:g,optionalNamespaces:I,pairingTopic:f,acknowledged:!1,self:D.controller,peer:{publicKey:w.publicKey,metadata:w.metadata},controller:y,transportType:se.relay});await this.client.session.set(b,S),T.addTrace(Ct.store_session);try{await this.sendApproveSession({sessionTopic:b,proposal:p,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:y},sessionSettleRequest:D,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),T.addTrace(Ct.session_approve_publish_success)}catch(m){throw this.client.logger.error(m),this.client.session.delete(b,ae("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(b),m}return this.client.core.eventClient.deleteEvent({eventId:T.eventId}),await this.client.core.pairing.updateMetadata({topic:f,metadata:w.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(b,pe(fi)),{topic:b,acknowledged:()=>Promise.resolve(this.client.session.get(b))}}),R(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:r,reason:n}=e;let s;try{s=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}s&&await this.sendError({id:r,topic:s,error:n,rpcOpts:ye.wc_sessionPropose.reject}),await this.deleteProposal(r)}),R(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:n}=e,{done:s,resolve:o,reject:c}=Gt(),l=Ot(),h=Yt().toString(),u=this.client.session.get(r).namespaces;return this.events.once(Q("session_update",l),({error:d})=>{d?c(d):o()}),await this.client.session.update(r,{namespaces:n}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:h}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:u}),c(d)}),{acknowledged:s}}),R(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:r}=e,n=Ot(),{done:s,resolve:o,reject:c}=Gt();return this.events.once(Q("session_extend",n),({error:l})=>{l?c(l):o()}),await this.setExpiry(r,pe(fi)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),R(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(g){throw this.client.logger.error("request() -> isValidRequest() failed"),g}const{chainId:r,request:n,topic:s,expiry:o=ye.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);(c==null?void 0:c.transportType)===se.relay&&await this.confirmOnlineStateOrThrow();const l=Ot(),h=Yt().toString(),{done:u,resolve:d,reject:_}=Gt(o,"Request expired. Please try again.");this.events.once(Q("session_request",l),({error:g,result:I})=>{g?_(g):d(I)});const p="wc_sessionRequest",f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(f)return await this.sendRequest({clientRpcId:l,relayRpcId:h,topic:s,method:p,params:{request:Te(X({},n),{expiryTimestamp:pe(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(g=>_(g)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:r,id:l}),await u();const w={request:Te(X({},n),{expiryTimestamp:pe(o)}),chainId:r};return await Promise.all([new Promise(async g=>{await this.sendRequest({clientRpcId:l,relayRpcId:h,topic:s,method:p,params:w,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,w)}).catch(I=>_(I)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:r,id:l}),g()}),new Promise(async g=>{var I;if(!((I=c.sessionConfig)!=null&&I.disableDeepLink)){const T=await sf(this.client.core.storage,sc);await tf({id:l,topic:s,wcDeepLink:T})}g()}),u()]).then(g=>g[2])}),R(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:r,response:n}=e,{id:s}=n,o=this.client.session.get(r);o.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);yt(n)?await this.sendResult({id:s,topic:r,result:n.result,throwOnFailedPublish:!0,appLink:c}):dt(n)&&await this.sendError({id:s,topic:r,error:n.error,appLink:c}),this.cleanupAfterResponse(e)}),R(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:r}=e;if(this.client.session.keys.includes(r)){const n=Ot(),s=Yt().toString(),{done:o,resolve:c,reject:l}=Gt();this.events.once(Q("session_ping",n),({error:h})=>{h?l(h):c()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:r}))}),R(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:r,event:n,chainId:s}=e,o=Yt().toString(),c=Ot();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),R(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:r}=e;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:ae("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:n}=k("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(n)}}),R(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(r=>wg(r,e)))),R(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),R(this,"authenticate",async(e,r)=>{var n;this.isInitialized(),this.isValidAuthenticate(e);const s=r&&this.client.core.linkModeSupportedApps.includes(r)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),o=s?se.link_mode:se.relay;o===se.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:h,domain:u,nonce:d,type:_,exp:p,nbf:f,methods:w=[],expiry:g}=e,I=[...e.resources||[]],{topic:T,uri:y}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:T,uri:y}});const v=await this.client.core.crypto.generateKeyPair(),b=xr(v);if(await Promise.all([this.client.auth.authKeys.set(Cr,{responseTopic:b,publicKey:v}),this.client.auth.pairingTopics.set(b,{topic:b,pairingTopic:T})]),await this.client.core.relayer.subscribe(b,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${T}`),w.length>0){const{namespace:L}=Lr(c[0]);let M=vw(L,"request",w);Vr(I)&&(M=Iw(M,I.pop())),I.push(M)}const D=g&&g>ye.wc_sessionAuthenticate.req.ttl?g:ye.wc_sessionAuthenticate.req.ttl,N={authPayload:{type:_??"caip122",chains:c,statement:l,aud:h,domain:u,version:"1",nonce:d,iat:new Date().toISOString(),exp:p,nbf:f,resources:I},requester:{publicKey:v,metadata:this.client.metadata},expiryTimestamp:pe(D)},S={eip155:{chains:c,methods:[...new Set(["personal_sign",...w])],events:["chainChanged","accountsChanged"]}},m={requiredNamespaces:{},optionalNamespaces:S,relays:[{protocol:"irn"}],pairingTopic:T,proposer:{publicKey:v,metadata:this.client.metadata},expiryTimestamp:pe(ye.wc_sessionPropose.req.ttl),id:Ot()},{done:P,resolve:E,reject:A}=Gt(D,"Request expired"),O=Ot(),V=Q("session_connect",m.id),x=Q("session_request",O),C=async({error:L,session:M})=>{this.events.off(x,$),L?A(L):M&&E({session:M})},$=async L=>{var M,q,z;if(await this.deletePendingAuthRequest(O,{message:"fulfilled",code:0}),L.error){const oe=ae("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return L.error.code===oe.code?void 0:(this.events.off(V,C),A(L.error.message))}await this.deleteProposal(m.id),this.events.off(V,C);const{cacaos:H,responder:K}=L.result,W=[],ie=[];for(const oe of H){await ra({cacao:oe,projectId:this.client.core.projectId})||(this.client.logger.error(oe,"Signature verification failed"),A(ae("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:je}=oe,gt=Vr(je.resources),uo=[Zn(je.iss)],$u=Kr(je.iss);if(gt){const un=na(gt),ku=sa(gt);W.push(...un),uo.push(...ku)}for(const un of uo)ie.push(`${un}:${$u}`)}const ue=await this.client.core.crypto.generateSharedKey(v,K.publicKey);let ce;W.length>0&&(ce={topic:ue,acknowledged:!0,self:{publicKey:v,metadata:this.client.metadata},peer:K,controller:K.publicKey,expiry:pe(fi),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:T,namespaces:Da([...new Set(W)],[...new Set(ie)]),transportType:o},await this.client.core.relayer.subscribe(ue,{transportType:o}),await this.client.session.set(ue,ce),T&&await this.client.core.pairing.updateMetadata({topic:T,metadata:K.metadata}),ce=this.client.session.get(ue)),(M=this.client.metadata.redirect)!=null&&M.linkMode&&(q=K.metadata.redirect)!=null&&q.linkMode&&(z=K.metadata.redirect)!=null&&z.universal&&r&&(this.client.core.addLinkModeSupportedApp(K.metadata.redirect.universal),this.client.session.update(ue,{transportType:se.link_mode})),E({auths:H,session:ce})};this.events.once(V,C),this.events.once(x,$);let F;try{if(s){const L=$t("wc_sessionAuthenticate",N,O);this.client.core.history.set(T,L);const M=await this.client.core.crypto.encode("",L,{type:gr,encoding:Ft});F=Rr(r,T,M)}else await Promise.all([this.sendRequest({topic:T,method:"wc_sessionAuthenticate",params:N,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:O}),this.sendRequest({topic:T,method:"wc_sessionPropose",params:m,expiry:ye.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:m.id})])}catch(L){throw this.events.off(V,C),this.events.off(x,$),L}return await this.setProposal(m.id,m),await this.setAuthRequest(O,{request:Te(X({},N),{verifyContext:{}}),pairingTopic:T,transportType:o}),{uri:F??y,response:P}}),R(this,"approveSessionAuthenticate",async e=>{const{id:r,auths:n}=e,s=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[Wt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(g){throw s.setError(Mi.no_internet_connection),g}const o=this.getPendingAuthRequest(r);if(!o)throw s.setError(Mi.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const c=o.transportType||se.relay;c===se.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),u=xr(l),d={type:Pt,receiverPublicKey:l,senderPublicKey:h},_=[],p=[];for(const g of n){if(!await ra({cacao:g,projectId:this.client.core.projectId})){s.setError(Mi.invalid_cacao);const b=ae("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:u,error:b,encodeOpts:d}),new Error(b.message)}s.addTrace(Wt.cacaos_verified);const{p:I}=g,T=Vr(I.resources),y=[Zn(I.iss)],v=Kr(I.iss);if(T){const b=na(T),D=sa(T);_.push(...b),y.push(...D)}for(const b of y)p.push(`${b}:${v}`)}const f=await this.client.core.crypto.generateSharedKey(h,l);s.addTrace(Wt.create_authenticated_session_topic);let w;if((_==null?void 0:_.length)>0){w={topic:f,acknowledged:!0,self:{publicKey:h,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:pe(fi),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Da([...new Set(_)],[...new Set(p)]),transportType:c},s.addTrace(Wt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(g){throw s.setError(Mi.subscribe_authenticated_session_topic_failure),g}s.addTrace(Wt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,w),s.addTrace(Wt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Wt.publishing_authenticated_session_approve);try{await this.sendResult({topic:u,id:r,result:{cacaos:n,responder:{publicKey:h,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(g){throw s.setError(Mi.authenticated_session_approve_publish_failure),g}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:w}}),R(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:r,reason:n}=e,s=this.getPendingAuthRequest(r);if(!s)throw new Error(`Could not find pending auth request with id ${r}`);s.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=xr(o),h={type:Pt,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:r,topic:l,error:n,encodeOpts:h,rpcOpts:ye.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.deleteProposal(r)}),R(this,"formatAuthMessage",e=>{this.isInitialized();const{request:r,iss:n}=e;return Ll(r,n)}),R(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),R(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const r=this.client.core.pairing.pairings.get(e.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===e.peer.metadata.url&&s.topic&&s.topic!==r.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),R(this,"deleteSession",async e=>{var r;const{topic:n,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,ae("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(sc).catch(h=>this.client.logger.warn(h)),this.getPendingSessionRequests().forEach(h=>{h.topic===n&&this.deletePendingSessionRequest(h.id,ae("USER_DISCONNECTED"))}),n===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=ut.idle),o&&this.client.events.emit("session_delete",{id:c,topic:n})}),R(this,"deleteProposal",async(e,r)=>{if(r)try{const n=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s==null||s.setError(qi.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ae("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),R(this,"deletePendingSessionRequest",async(e,r,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,r),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),n&&(this.sessionRequestQueue.state=ut.idle,this.client.events.emit("session_request_expire",{id:e}))}),R(this,"deletePendingAuthRequest",async(e,r,n=!1)=>{await Promise.all([this.client.auth.requests.delete(e,r),n?Promise.resolve():this.client.core.expirer.del(e)])}),R(this,"setExpiry",async(e,r)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,r),await this.client.session.update(e,{expiry:r}))}),R(this,"setProposal",async(e,r)=>{this.client.core.expirer.set(e,pe(ye.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,r)}),R(this,"setAuthRequest",async(e,r)=>{const{request:n,pairingTopic:s,transportType:o=se.relay}=r;this.client.core.expirer.set(e,n.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:e,pairingTopic:s,verifyContext:n.verifyContext,transportType:o})}),R(this,"setPendingSessionRequest",async e=>{const{id:r,topic:n,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||pe(ye.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,c),await this.client.pendingRequest.set(r,{id:r,topic:n,params:s,verifyContext:o})}),R(this,"sendRequest",async e=>{const{topic:r,method:n,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:h,appLink:u,tvf:d,publishOpts:_={}}=e,p=$t(n,s,l);let f;const w=!!u;try{const T=w?Ft:$e;f=await this.client.core.crypto.encode(r,p,{encoding:T})}catch(T){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),T}let g;if(Mv.includes(n)){const T=Ge(JSON.stringify(p)),y=Ge(f);g=await this.client.core.verify.register({id:y,decryptedId:T})}const I=X(X({},ye[n].req),_);if(I.attestation=g,o&&(I.ttl=o),c&&(I.id=c),this.client.core.history.set(r,p),w){const T=Rr(u,r,f);await j.Linking.openURL(T,this.client.name)}else I.tvf=Te(X({},d),{correlationId:p.id}),h?(I.internal=Te(X({},I.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,f,I)):this.client.core.relayer.publish(r,f,I).catch(T=>this.client.logger.error(T));return p.id}),R(this,"sendProposeSession",async e=>{const{proposal:r,publishOpts:n}=e,s=$t("wc_sessionPropose",r,r.id);this.client.core.history.set(r.pairingTopic,s);const o=await this.client.core.crypto.encode(r.pairingTopic,s,{encoding:$e}),c=Ge(JSON.stringify(s)),l=Ge(o),h=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:r.pairingTopic,sessionProposal:o},opts:Te(X({},n),{publishMethod:"wc_proposeSession",attestation:h})})}),R(this,"sendApproveSession",async e=>{const{sessionTopic:r,pairingProposalResponse:n,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=Ur(s.id,n),h=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:$e}),u=$t("wc_sessionSettle",o,c==null?void 0:c.id),d=await this.client.core.crypto.encode(r,u,{encoding:$e});this.client.core.history.set(r,u),await this.client.core.relayer.publishCustom({payload:{sessionTopic:r,pairingTopic:s.pairingTopic,sessionProposalResponse:h,sessionSettlementRequest:d},opts:Te(X({},c),{publishMethod:"wc_approveSession"})})}),R(this,"sendResult",async e=>{const{id:r,topic:n,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,h=Ur(r,s);let u;const d=l&&typeof(j==null?void 0:j.Linking)<"u";try{const f=d?Ft:$e;u=await this.client.core.crypto.encode(n,h,Te(X({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),f}let _,p;try{_=await this.client.core.history.get(n,r);const f=_.request;try{p=this.getTVFParams(r,f.params,s)}catch(w){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${w==null?void 0:w.message}`)}}catch(f){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${r}) failed`),f}if(d){const f=Rr(l,n,u);await j.Linking.openURL(f,this.client.name)}else{const f=_.request.method,w=ye[f].res;w.tvf=Te(X({},p),{correlationId:r}),o?(w.internal=Te(X({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,u,w)):this.client.core.relayer.publish(n,u,w).catch(g=>this.client.logger.error(g))}await this.client.core.history.resolve(h)}),R(this,"sendError",async e=>{const{id:r,topic:n,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,h=Ac(r,s);let u;const d=l&&typeof(j==null?void 0:j.Linking)<"u";try{const p=d?Ft:$e;u=await this.client.core.crypto.encode(n,h,Te(X({},o||{}),{encoding:p}))}catch(p){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),p}let _;try{_=await this.client.core.history.get(n,r)}catch(p){throw this.client.logger.error(`sendError() -> history.get(${n}, ${r}) failed`),p}if(d){const p=Rr(l,n,u);await j.Linking.openURL(p,this.client.name)}else{const p=_.request.method,f=c||ye[p].res;this.client.core.relayer.publish(n,u,f)}await this.client.core.history.resolve(h)}),R(this,"cleanup",async()=>{const e=[],r=[];this.client.session.getAll().forEach(n=>{let s=!1;kt(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&e.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{kt(n.expiryTimestamp)&&r.push(n.id)}),await Promise.all([...e.map(n=>this.deleteSession({topic:n})),...r.map(n=>this.deleteProposal(n))])}),R(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),R(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),R(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===ut.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ut.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=ut.idle}),R(this,"processRequest",async e=>{const{topic:r,payload:n,attestation:s,transportType:o,encryptedId:c}=e,l=n.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:n,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,n);case"wc_sessionPing":return await this.onSessionPingRequest(r,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:n,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:n,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),R(this,"onRelayEventResponse",async e=>{const{topic:r,payload:n,transportType:s}=e,o=(await this.client.core.history.get(r,n.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(r,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,n);case"wc_sessionExtend":return this.onSessionExtendResponse(r,n);case"wc_sessionPing":return this.onSessionPingResponse(r,n);case"wc_sessionRequest":return this.onSessionRequestResponse(r,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,n);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),R(this,"onRelayEventUnknownPayload",e=>{const{topic:r}=e,{message:n}=k("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)}),R(this,"shouldIgnorePairingRequest",e=>{const{topic:r,requestMethod:n}=e,s=this.expectedPairingMethodMap.get(r);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),R(this,"onSessionProposeRequest",async e=>{const{topic:r,payload:n,attestation:s,encryptedId:o}=e,{params:c,id:l}=n;try{const h=this.client.core.eventClient.getEvent({topic:r});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),h==null||h.setError(bt.proposal_listener_not_found)),this.isValidConnect(X({},n.params));const u=c.expiryTimestamp||pe(ye.wc_sessionPropose.req.ttl),d=X({id:l,pairingTopic:r,expiryTimestamp:u,attestation:s,encryptedId:o},c);await this.setProposal(l,d);const _=await this.getVerifyContext({attestationId:s,hash:Ge(JSON.stringify(n)),encryptedId:o,metadata:d.proposer.metadata});h==null||h.addTrace(ht.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:d,verifyContext:_})}catch(h){await this.sendError({id:l,topic:r,error:h,rpcOpts:ye.wc_sessionPropose.autoReject}),this.client.logger.error(h)}}),R(this,"onSessionProposeResponse",async(e,r,n)=>{const{id:s}=r;if(yt(r)){const{result:o}=r;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const h=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:h});const u=await this.client.core.crypto.generateSharedKey(l,h);this.pendingSessions.set(s,{sessionTopic:u,pairingTopic:e,proposalId:s,publicKey:l});const d=await this.client.core.relayer.subscribe(u,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:e})}else if(dt(r)){await this.deleteProposal(s);const o=Q("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),R(this,"onSessionSettleRequest",async(e,r)=>{const{id:n,params:s}=r;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:h,sessionProperties:u,scopedProperties:d,sessionConfig:_}=r.params,p=[...this.pendingSessions.values()].find(g=>g.sessionTopic===e);if(!p)return this.client.logger.error(`Pending session not found for topic ${e}`);const f=this.client.proposal.get(p.proposalId),w=Te(X(X(X({topic:e,relay:o,expiry:l,namespaces:h,acknowledged:!0,pairingTopic:p.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:c.publicKey,self:{publicKey:p.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},u&&{sessionProperties:u}),d&&{scopedProperties:d}),_&&{sessionConfig:_}),{transportType:se.relay});await this.client.session.set(w.topic,w),await this.setExpiry(w.topic,w.expiry),await this.client.core.pairing.updateMetadata({topic:p.pairingTopic,metadata:w.peer.metadata}),this.client.events.emit("session_connect",{session:w}),this.events.emit(Q("session_connect",p.proposalId),{session:w}),this.pendingSessions.delete(p.proposalId),this.deleteProposal(p.proposalId,!1),this.cleanupDuplicatePairings(w),await this.sendResult({id:r.id,topic:e,result:!0})}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),R(this,"onSessionSettleResponse",async(e,r)=>{const{id:n}=r;yt(r)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(Q("session_approve",n),{})):dt(r)&&(await this.client.session.delete(e,ae("USER_DISCONNECTED")),this.events.emit(Q("session_approve",n),{error:r.error}))}),R(this,"onSessionUpdateRequest",async(e,r)=>{const{params:n,id:s}=r;try{const o=`${e}_session_update`,c=Bi.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:ae("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(X({topic:e},n));try{Bi.set(o,s),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Bi.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:n})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),R(this,"isRequestOutOfSync",(e,r)=>r.toString().slice(0,-3)<e.toString().slice(0,-3)),R(this,"onSessionUpdateResponse",(e,r)=>{const{id:n}=r,s=Q("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);yt(r)?this.events.emit(Q("session_update",n),{}):dt(r)&&this.events.emit(Q("session_update",n),{error:r.error})}),R(this,"onSessionExtendRequest",async(e,r)=>{const{id:n}=r;try{this.isValidExtend({topic:e}),await this.setExpiry(e,pe(fi)),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),R(this,"onSessionExtendResponse",(e,r)=>{const{id:n}=r,s=Q("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);yt(r)?this.events.emit(Q("session_extend",n),{}):dt(r)&&this.events.emit(Q("session_extend",n),{error:r.error})}),R(this,"onSessionPingRequest",async(e,r)=>{const{id:n}=r;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),R(this,"onSessionPingResponse",(e,r)=>{const{id:n}=r,s=Q("session_ping",n);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);yt(r)?this.events.emit(Q("session_ping",n),{}):dt(r)&&this.events.emit(Q("session_ping",n),{error:r.error})},500)}),R(this,"onSessionDeleteRequest",async(e,r)=>{const{id:n}=r;try{this.isValidDisconnect({topic:e,reason:r.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(le.publish,async()=>{s(await this.deleteSession({topic:e,id:n}))})}),this.sendResult({id:n,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:ae("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),R(this,"onSessionRequest",async e=>{var r,n,s;const{topic:o,payload:c,attestation:l,encryptedId:h,transportType:u}=e,{id:d,params:_}=c;try{await this.isValidRequest(X({topic:o},_));const p=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Ge(JSON.stringify($t("wc_sessionRequest",_,d))),encryptedId:h,metadata:p.peer.metadata,transportType:u}),w={id:d,topic:o,params:_,verifyContext:f};await this.setPendingSessionRequest(w),u===se.link_mode&&(r=p.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((n=p.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(w):(this.addSessionRequestToSessionRequestQueue(w),this.processSessionRequestQueue())}catch(p){await this.sendError({id:d,topic:o,error:p}),this.client.logger.error(p)}}),R(this,"onSessionRequestResponse",(e,r)=>{const{id:n}=r,s=Q("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);yt(r)?this.events.emit(Q("session_request",n),{result:r.result}):dt(r)&&this.events.emit(Q("session_request",n),{error:r.error})}),R(this,"onSessionEventRequest",async(e,r)=>{const{id:n,params:s}=r;try{const o=`${e}_session_event_${s.event.name}`,c=Bi.get(o);if(c&&this.isRequestOutOfSync(c,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(X({topic:e},s)),this.client.events.emit("session_event",{id:n,topic:e,params:s}),Bi.set(o,n)}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),R(this,"onSessionAuthenticateResponse",(e,r)=>{const{id:n}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:r}),yt(r)?this.events.emit(Q("session_request",n),{result:r.result}):dt(r)&&this.events.emit(Q("session_request",n),{error:r.error})}),R(this,"onSessionAuthenticateRequest",async e=>{var r;const{topic:n,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:h,authPayload:u,expiryTimestamp:d}=s.params,_=await this.getVerifyContext({attestationId:o,hash:Ge(JSON.stringify(s)),encryptedId:c,metadata:h.metadata,transportType:l}),p={requester:h,pairingTopic:n,id:s.id,authPayload:u,verifyContext:_,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:p,pairingTopic:n,transportType:l}),l===se.link_mode&&(r=h.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(h.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:_})}catch(h){this.client.logger.error(h);const u=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),_=this.getAppLinkIfEnabled(s.params.requester.metadata,l),p={type:Pt,receiverPublicKey:u,senderPublicKey:d};await this.sendError({id:s.id,topic:n,error:h,encodeOpts:p,rpcOpts:ye.wc_sessionAuthenticate.autoReject,appLink:_})}}),R(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),R(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ut.idle,this.processSessionRequestQueue()},U.toMiliseconds(this.requestQueueDelay))}),R(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:r})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=Q("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(Q("session_request",s.request.id),{error:r})})}),R(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===ut.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(r){this.client.logger.error(r)}}),R(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=ut.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),R(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const r=this.client.proposal.getAll().find(n=>n.pairingTopic===e.topic);r&&this.onSessionProposeRequest({topic:e.topic,payload:$t("wc_sessionPropose",Te(X({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id),attestation:r.attestation,encryptedId:r.encryptedId})}),R(this,"isValidConnect",async e=>{if(!xe(e)){const{message:h}=k("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(h)}const{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(fe(r)||await this.isValidPairingTopic(r),!Rg(l,!0)){const{message:h}=k("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(h)}if(!fe(n)&&ur(n)!==0){const h="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(h):this.client.logger.warn(h),this.validateNamespaces(n,"requiredNamespaces")}if(!fe(s)&&ur(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const h=Object.keys(n||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(u=>h.includes(u.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(c)}, required/optional namespaces: ${JSON.stringify(h)}`)}}),R(this,"validateNamespaces",(e,r)=>{const n=Og(e,"connect()",r);if(n)throw new Error(n.message)}),R(this,"isValidApprove",async e=>{if(!xe(e))throw new Error(k("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:r,namespaces:n,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const l=this.client.proposal.get(r),h=Pn(n,"approve()");if(h)throw new Error(h.message);const u=xa(l.requiredNamespaces,n,"approve()");if(u)throw new Error(u.message);if(!de(s,!0)){const{message:d}=k("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(fe(o)||this.validateSessionProps(o,"sessionProperties"),!fe(c)){this.validateSessionProps(c,"scopedProperties");const d=new Set(Object.keys(n));if(!Object.keys(c).every(_=>d.has(_.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),R(this,"isValidReject",async e=>{if(!xe(e)){const{message:s}=k("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:r,reason:n}=e;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!Lg(n)){const{message:s}=k("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}}),R(this,"isValidSessionSettleRequest",e=>{if(!xe(e)){const{message:h}=k("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(h)}const{relay:r,controller:n,namespaces:s,expiry:o}=e;if(!cu(r)){const{message:h}=k("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const c=vg(n,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=Pn(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(kt(o)){const{message:h}=k("EXPIRED","onSessionSettleRequest()");throw new Error(h)}}),R(this,"isValidUpdate",async e=>{if(!xe(e)){const{message:l}=k("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:r,namespaces:n}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const s=this.client.session.get(r),o=Pn(n,"update()");if(o)throw new Error(o.message);const c=xa(s.requiredNamespaces,n,"update()");if(c)throw new Error(c.message)}),R(this,"isValidExtend",async e=>{if(!xe(e)){const{message:n}=k("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(n)}const{topic:r}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),R(this,"isValidRequest",async e=>{if(!xe(e)){const{message:l}=k("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:r,request:n,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:c}=this.client.session.get(r);if(!Va(c,s)){const{message:l}=k("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!Vg(n)){const{message:l}=k("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(l)}if(!Cg(c,s,n.method)){const{message:l}=k("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(l)}if(o&&!Ug(o,Vn)){const{message:l}=k("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Vn.min} and ${Vn.max}`);throw new Error(l)}}),R(this,"isValidRespond",async e=>{var r;if(!xe(e)){const{message:o}=k("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:n,response:s}=e;try{await this.isValidSessionTopic(n)}catch(o){throw(r=e==null?void 0:e.response)!=null&&r.id&&this.cleanupAfterResponse(e),o}if(!xg(s)){const{message:o}=k("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),R(this,"isValidPing",async e=>{if(!xe(e)){const{message:n}=k("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(n)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),R(this,"isValidEmit",async e=>{if(!xe(e)){const{message:c}=k("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:r,event:n,chainId:s}=e;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!Va(o,s)){const{message:c}=k("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!Sg(n)){const{message:c}=k("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}if(!$g(o,s,n.name)){const{message:c}=k("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}}),R(this,"isValidDisconnect",async e=>{if(!xe(e)){const{message:n}=k("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(n)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),R(this,"isValidAuthenticate",e=>{const{chains:r,uri:n,domain:s,nonce:o}=e;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!de(n,!1))throw new Error("uri is required parameter");if(!de(s,!1))throw new Error("domain is required parameter");if(!de(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(l=>Lr(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=Lr(r[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),R(this,"getVerifyContext",async e=>{const{attestationId:r,hash:n,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||er,validation:"UNKNOWN",origin:o.url||""}};try{if(c===se.link_mode){const u=this.getAppLinkIfEnabled(o,c);return l.verified.validation=u&&new URL(u).origin===new URL(o.url).origin?"VALID":"INVALID",l}const h=await this.client.core.verify.resolve({attestationId:r,hash:n,encryptedId:s,verifyUrl:o.verifyUrl});h&&(l.verified.origin=h.origin,l.verified.isScam=h.isScam,l.verified.validation=h.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(h){this.client.logger.warn(h)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l}),R(this,"validateSessionProps",(e,r)=>{Object.values(e).forEach((n,s)=>{if(n==null){const{message:o}=k("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${n} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),R(this,"getPendingAuthRequest",e=>{const r=this.client.auth.requests.get(e);return typeof r=="object"?r:void 0}),R(this,"addToRecentlyDeleted",(e,r)=>{if(this.recentlyDeletedMap.set(e,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(o)}}}),R(this,"checkRecentlyDeleted",e=>{const r=this.recentlyDeletedMap.get(e);if(r){const{message:n}=k("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${e}`);throw new Error(n)}}),R(this,"isLinkModeEnabled",(e,r)=>{var n,s,o,c,l,h,u,d,_;return!e||r!==se.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((h=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:h.universal)!==""&&((u=e==null?void 0:e.redirect)==null?void 0:u.universal)!==void 0&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==""&&((_=e==null?void 0:e.redirect)==null?void 0:_.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(j==null?void 0:j.Linking)<"u"}),R(this,"getAppLinkIfEnabled",(e,r)=>{var n;return this.isLinkModeEnabled(e,r)?(n=e==null?void 0:e.redirect)==null?void 0:n.universal:void 0}),R(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const r=Ko(e,"topic")||"",n=decodeURIComponent(Ko(e,"wc_ev")||""),s=this.client.session.keys.includes(r);s&&this.client.session.update(r,{transportType:se.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:n,sessionExists:s})}),R(this,"registerLinkModeListeners",async()=>{var e;if(Hs()||Kt()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const r=j==null?void 0:j.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await r.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}),R(this,"getTVFParams",(e,r,n)=>{var s,o,c;if(!((s=r.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[r.request.method],chainId:r.chainId};try{const h=this.extractTxHashesFromResult(r.request,n);l.txHashes=h,l.contractAddresses=this.isValidContractData(r.request.params)?[(c=(o=r.request.params)==null?void 0:o[0])==null?void 0:c.to]:[]}catch(h){this.client.logger.warn("Error getting TVF params",h)}return l}),R(this,"isValidContractData",e=>{var r;if(!e)return!1;try{const n=(e==null?void 0:e.data)||((r=e==null?void 0:e[0])==null?void 0:r.data);if(!n.startsWith("0x"))return!1;const s=n.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),R(this,"extractTxHashesFromResult",(e,r)=>{var n;try{if(!r)return[];const s=e.method,o=Fv[s];if(s==="sui_signTransaction")return[sw(r.transactionBytes)];if(s==="near_signTransaction")return[Xo(r)];if(s==="near_signTransactions")return r.map(l=>Xo(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(n=r.tx_json)==null?void 0:n.hash];if(s==="polkadot_signTransaction")return[Xg({transaction:e.params.transactionPayload,signature:r.signature})];if(s==="algo_signTxn")return vi(r)?r.map(l=>ea(l)):[ea(r)];if(s==="cosmos_signDirect")return[aw(r)];if(typeof r=="string")return[r];const c=r[o.key];if(vi(c))return s==="solana_signAllTransactions"?c.map(l=>nw(l)):c;if(typeof c=="string")return[c]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[r,n]of Object.entries(e))for(const s of n)try{await this.onProviderMessageEvent({topic:r,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=k("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(le.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:r,attestation:n,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(Cr)?this.client.auth.authKeys.get(Cr):{responseTopic:void 0,publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,r,{receiverPublicKey:o,encoding:s===se.link_mode?Ft:$e});Ls(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:n,transportType:s,encryptedId:Ge(r)})):Vs(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:e,payload:c,transportType:s}),this.client.core.history.delete(e,c.id)):await this.onRelayEventUnknownPayload({topic:e,payload:c,transportType:s}),await this.client.core.relayer.messages.ack(e,r)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(We.expired,async t=>{const{topic:e,id:r}=fl(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,k("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,k("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(Jt.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Jt.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!de(t,!1)){const{message:e}=k("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=k("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(kt(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=k("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!de(t,!1)){const{message:e}=k("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=k("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(kt(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=k("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=k("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(de(t,!1)){const{message:e}=k("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=k("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!Dg(t)){const{message:e}=k("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=k("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(kt(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=k("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class eb extends ai{constructor(t,e){super(t,e,Nv,ao),this.core=t,this.logger=e}}class tb extends ai{constructor(t,e){super(t,e,Uv,ao),this.core=t,this.logger=e}}class ib extends ai{constructor(t,e){super(t,e,qv,ao,r=>r.id),this.core=t,this.logger=e}}class rb extends ai{constructor(t,e){super(t,e,Kv,cn,()=>Cr),this.core=t,this.logger=e}}class nb extends ai{constructor(t,e){super(t,e,Hv,cn),this.core=t,this.logger=e}}class sb extends ai{constructor(t,e){super(t,e,Wv,cn,r=>r.id),this.core=t,this.logger=e}}var ob=Object.defineProperty,ab=(i,t,e)=>t in i?ob(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,xn=(i,t,e)=>ab(i,typeof t!="symbol"?t+"":t,e);class cb{constructor(t,e){this.core=t,this.logger=e,xn(this,"authKeys"),xn(this,"pairingTopics"),xn(this,"requests"),this.authKeys=new rb(this.core,this.logger),this.pairingTopics=new nb(this.core,this.logger),this.requests=new sb(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var lb=Object.defineProperty,ub=(i,t,e)=>t in i?lb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,J=(i,t,e)=>ub(i,typeof t!="symbol"?t+"":t,e);class co extends d_{constructor(t){super(t),J(this,"protocol",Pu),J(this,"version",Tu),J(this,"name",Ln.name),J(this,"metadata"),J(this,"core"),J(this,"logger"),J(this,"events",new oi.EventEmitter),J(this,"engine"),J(this,"session"),J(this,"proposal"),J(this,"pendingRequest"),J(this,"auth"),J(this,"signConfig"),J(this,"on",(r,n)=>this.events.on(r,n)),J(this,"once",(r,n)=>this.events.once(r,n)),J(this,"off",(r,n)=>this.events.off(r,n)),J(this,"removeListener",(r,n)=>this.events.removeListener(r,n)),J(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),J(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"update",async r=>{try{return await this.engine.update(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"request",async r=>{try{return await this.engine.request(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"find",r=>{try{return this.engine.find(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),J(this,"authenticate",async(r,n)=>{try{return await this.engine.authenticate(r,n)}catch(s){throw this.logger.error(s.message),s}}),J(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(n){throw this.logger.error(n.message),n}}),J(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(n){throw this.logger.error(n.message),n}}),this.name=(t==null?void 0:t.name)||Ln.name,this.metadata=Jp(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const e=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Qr(qs({level:(t==null?void 0:t.logger)||Ln.logger}));this.core=(t==null?void 0:t.core)||new kv(t),this.logger=Le(e,this.name),this.session=new tb(this.core,this.logger),this.proposal=new eb(this.core,this.logger),this.pendingRequest=new ib(this.core,this.logger),this.engine=new Xv(this),this.auth=new cb(this.core,this.logger)}static async init(t){const e=new co(t);return await e.initialize(),e}get context(){return Be(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const hb=co,db="08c4b07e3ad25f1a27c14a4e8cecb6f0",vI="eip155";async function _b(i){const{account:t,chainId:e,params:[r]}=i;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:r})).transactionHash}function ln(i,t){if(fo(i.address)!==fo(t))throw new Error(`Failed to validate account address (${i.address}), differs from ${t}`)}function bI(i){const t=i.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${i}, should have the format 'eip155:1'`);return e}async function pb(i){const{account:t,chainId:e,thirdwebClient:r,params:[n]}=i;n.from!==void 0&&ln(t,n.from);const s=kn({chain:Ue(e),client:r,data:n.data,gas:n.gas?qt(n.gas):void 0,gasPrice:n.gasPrice?qt(n.gasPrice):void 0,to:n.to,value:n.value?qt(n.value):void 0});return(await bc({account:t,transaction:s})).transactionHash}async function cc(i){const{account:t,params:e}=i;return ln(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function fb(i){const{account:t,params:[e]}=i;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&ln(t,e.from),t.signTransaction({data:e.data,gas:e.gas?qt(e.gas):void 0,gasPrice:e.gasPrice?qt(e.gasPrice):void 0,nonce:e.nonce?ii(e.nonce):void 0,to:e.to,value:e.value?qt(e.value):void 0})}async function lc(i){const{account:t,params:e}=i;return ln(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Ru(i){var r;const{wallet:t,params:e}=i;return((r=t.getChain())==null?void 0:r.id)===ii(e[0].chainId)||await t.switchChain(uh(ii(e[0].chainId))),"0x1"}const II=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Ru},Symbol.toStringTag,{value:"Module"}));let ft;async function Du(){if(!ft)return[];const i=await ft.getWalletConnectSessions();return JSON.parse(i??"[]")}function wb(i){ft||(ft=new Ts({clientId:i.clientId,storage:null}))}async function AI(i){if(!ft)return;const t=await ft.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(i),await ft.saveWalletConnectSessions(st(e))}async function gb(i){if(!ft)return;const t=await ft.getWalletConnectSessions(),r=JSON.parse(t??"[]").filter(n=>n.topic!==i.topic);await ft.saveWalletConnectSessions(st(r))}let Sn=new WeakMap;const mb={eth_sendRawTransaction:_b,eth_sendTransaction:pb,eth_sign:cc,eth_signTransaction:fb,eth_signTypedData:lc,eth_signTypedData_v4:lc,personal_sign:cc,wallet_addEthereumChain:i=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Ru};async function Eb(i){var u,d,_,p;const{wallet:t,requestHandlers:e,onConnect:r,onDisconnect:n,client:s}=i,o=(()=>i.chains&&i.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),i.chains.slice(0,10)):i.chains)();if(Sn.has(s))return Sn.get(s);wb({clientId:i.client.clientId});const c=Br(),l=await hb.init({metadata:{description:((u=i.appMetadata)==null?void 0:u.description)??c.description,icons:[((d=i.appMetadata)==null?void 0:d.logoUrl)??c.logoUrl],name:((_=i.appMetadata)==null?void 0:_.name)??c.name,url:((p=i.appMetadata)==null?void 0:p.url)??c.url},projectId:i.projectId??db});l.on("session_proposal",async f=>{const{onSessionProposal:w}=await a(()=>import("./session-proposal-d1473b74.js"),["assets/session-proposal-d1473b74.js","assets/signing-6d6682ec.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/to-serializable-transaction-9e540f8c.js","assets/transaction-ea614a5a.js","assets/get-bytecode-7a8c6215.js","assets/execute-264a98ed.js","assets/redirect-state-301cb22c.js","assets/index-93724bad.js","assets/ethereum-0d579241.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-cc1589a7.js","assets/send-transaction-c3053b90.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-b3889ac8.js","assets/index-accd8060.js","assets/index-2cab452e.js","assets/index-6ab757a5.js","assets/index-877ffe4a.js"]);await w({chains:o,event:f,onConnect:r,wallet:t,walletConnectClient:l}).catch(g=>{if(i.onError)i.onError(g);else throw g})}),l.on("session_request",async f=>{const{fulfillRequest:w}=await a(()=>import("./session-request-f0a8f695.js"),["assets/session-request-f0a8f695.js","assets/index-10c73e9d.js","assets/index-59db4a58.css","assets/signing-6d6682ec.js","assets/prepare-contract-call-4be4cc68.js","assets/utils-dddc86ba.js","assets/to-serializable-transaction-9e540f8c.js","assets/transaction-ea614a5a.js","assets/get-bytecode-7a8c6215.js","assets/execute-264a98ed.js","assets/redirect-state-301cb22c.js","assets/index-93724bad.js","assets/ethereum-0d579241.js","assets/types-ba990c1e.js","assets/store-af6293b2.js","assets/hashTypedData-cc1589a7.js","assets/send-transaction-c3053b90.js","assets/eth_sendRawTransaction-5ae15b91.js","assets/index-b3889ac8.js","assets/index-accd8060.js","assets/index-2cab452e.js","assets/index-6ab757a5.js","assets/index-877ffe4a.js"]);await w({event:f,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(g=>{if(i.onError)i.onError(g);else throw g})}),l.on("session_event",async f=>{}),l.on("session_ping",f=>{}),l.on("session_delete",async f=>{await Lu({session:{topic:f.topic},walletConnectClient:l}).catch(w=>{if(i.onError)i.onError(w);else throw w})});const h=l.disconnect;return l.disconnect=async f=>{const w=await h(f).catch(()=>{});return n&&bb({onDisconnect:n,topic:f.topic}),w},Sn.set(i.client,l),l}function yb(i){const{uri:t,walletConnectClient:e}=i;e.core.pairing.pair({uri:t})}async function vb(){return Du()}async function Lu(i){gb(i.session);try{await i.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:i.session.topic})}catch{}}async function bb(i){const{topic:t,onDisconnect:e}=i,r=await Du();e(r.find(n=>n.topic===t)??{topic:t})}function Ib(i){return[rt("inApp",{executionMode:i==null?void 0:i.executionMode}),rt(Tc),rt(nt,{appMetadata:i==null?void 0:i.appMetadata,chains:i==null?void 0:i.chains}),rt(Yh),rt("io.rabby"),rt(Zh),rt("com.okex.wallet")]}function Ab(i,t){const e=new Set;let r=i();const n=()=>{for(const o of e)o()},s=o=>{r=o,n()};for(const o of t)o.subscribe(()=>{s(i())});return{getValue(){return r},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Dr(i,t,e=!0){e&&i();const r=t.map(n=>n.subscribe(()=>{i()}));return()=>{for(const n of r)n()}}const hr="tw:connected-wallet-params";async function PI(i,t,e){if(!Tb(e))throw new Error("given params are not stringifiable");const r=await i.getItem(hr);let n;if(r){try{n=JSON.parse(r)}catch{n={}}n[t]=e}else n={[t]:e};i.setItem(hr,st(n))}async function Pb(i,t){const e=await i.getItem(hr);let r;if(e){try{r=JSON.parse(e)}catch{r={}}delete r[t],i.setItem(hr,st(r))}}async function TI(i,t){const e=await i.getItem(hr);if(!e)return null;try{const r=JSON.parse(e);return r!=null&&r[t]?r[t]:null}catch{return null}}function Tb(i){try{return st(i),!0}catch{return!1}}function Es(i){if(!i)return!1;if(i.id==="smart")return!0;if(i.id==="inApp"||Ti(i)){const t=i.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t!=null&&t.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const Vu="thirdweb:connected-wallet-ids",$r="thirdweb:active-wallet-id",ys="thirdweb:active-chain",uc="thirdweb:last-used-wallet-id";function Ob(i){const t=Ht(void 0),e=Ht(void 0),r=Ht(void 0),n=Ht("unknown"),s=Ht(new Map);Dr(()=>{hh([...s.getValue().values()])},[s]),Dr(()=>{const y=r.getValue();if(!y)return;const v=s.getValue().get(y.id);!v||v===y||r.setValue(v)},[s,r]);const o=Ht(new Map),c=Ht(!1),l=Ab(()=>Array.from(o.getValue().values()),[o]),h=y=>{const v=o.getValue();if(v.has(y.id))return;const b=new Map(v);b.set(y.id,y),o.setValue(b)},u=y=>{const v=o.getValue(),b=new Map(v);b.delete(y.id),o.setValue(b)},d=y=>{Pb(i,y.id),u(y),t.getValue()===y&&(i.removeItem($r),e.setValue(void 0),r.setValue(void 0),t.setValue(void 0),n.setValue("disconnected"))},_=y=>{d(y),y.disconnect()},p=async(y,v)=>{if(!y.getAccount())throw new Error("Cannot set a wallet without an account as active");const D=await(async()=>v!=null&&v.accountAbstraction&&!Es(y)?await Rb(y,v.client,v.accountAbstraction,d):y)();return await i.setItem($r,y.id),await i.setItem(uc,y.id),h(y),(v==null?void 0:v.setWalletAsActive)!==!1&&w(D),y.subscribe("accountChanged",async()=>{var S;const N=await p(y,v);(S=v==null?void 0:v.onConnect)==null||S.call(v,N,l.getValue())}),D},f=async(y,v)=>{var D;const b=await p(y,v);return(D=v==null?void 0:v.onConnect)==null||D.call(v,b,l.getValue()),b},w=y=>{const v=y.getAccount();if(!v)throw new Error("Cannot set a wallet without an account as active");h(y),t.setValue(y),e.setValue(v),r.setValue(y.getChain()),n.setValue("connected");const b=P=>{e.setValue(P)},D=y.subscribe("accountChanged",b),N=y.subscribe("chainChanged",P=>r.setValue(P)),S=y.subscribe("disconnect",()=>{m()}),m=()=>{d(y),D(),N(),S()}},g=async y=>{w(y),y.id!=="smart"&&(await i.setItem($r,y.id),await i.setItem(uc,y.id))};Dr(()=>{const y=r.getValue();y?i.setItem(ys,st(y)):i.removeItem(ys)},[r],!1),Dr(async()=>{const v=l.getValue().map(b=>b==null?void 0:b.id).filter(b=>!!b);i.setItem(Vu,st(Array.from(new Set([...v]))))},[l],!1);const I=async y=>{const v=t.getValue();if(!v)throw new Error("No active wallet found");if(!v.switchChain)throw new Error("Wallet does not support switching chains");if(Es(v)){const b=await lo(i);if(b){const D=l.getValue().find(N=>N.id===b);if(D){await D.switchChain(y),await v.switchChain(y),w(v);return}}await v.switchChain(y),w(v)}else await v.switchChain(y);r.setValue(v.getChain())};function T(y){const v=s.getValue();if(y.every(N=>{const S=v.get(N.id);return st(S)===st(N)}))return;const D=new Map(v);for(const N of y)D.set(N.id,N);s.setValue(D)}return{activeAccountStore:e,activeWalletChainStore:r,activeWalletConnectionStatusStore:n,activeWalletStore:t,addConnectedWallet:h,connect:f,connectedWallets:l,defineChains:T,disconnectWallet:_,handleConnection:p,isAutoConnecting:c,removeConnectedWallet:u,setActiveWallet:g,switchActiveWalletChain:I}}async function xu(i){try{const t=await i.getItem(Vu);return t?JSON.parse(t):[]}catch{return[]}}async function lo(i){try{const t=await i.getItem($r);if(t)return t}catch{}return null}async function Su(i){try{const t=await i.getItem(ys);if(t)return JSON.parse(t)}catch{}return null}const Rb=async(i,t,e,r)=>{const n=i.getAccount();if(!n)throw new Error("Cannot set a wallet without an account as active");const s=Ns(e);await s.connect({chain:e.chain,client:t,personalAccount:n});const o=i.subscribe("disconnect",()=>{c()}),c=()=>{o(),r(s)};return s};function Cu(i,t){return new Promise((e,r)=>{const n=setTimeout(()=>{r(new Error(t.message))},t.ms);i.then(s=>{clearTimeout(n),e(s)},s=>{clearTimeout(n),r(s)})})}function Db(i){const t=r=>Ih(r)||Ti(r),e=Es(i.wallet)&&i.connectedWallets.some(r=>{var n,s,o,c,l,h;return t(r)&&((s=(n=r.getAccount())==null?void 0:n.address)==null?void 0:s.toLowerCase())===((h=(l=(c=(o=i.wallet).getAdminAccount)==null?void 0:c.call(o))==null?void 0:l.address)==null?void 0:h.toLowerCase())});return t(i.wallet)||e}function Lb(){if(typeof document>"u")return;const i=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let r=e;const n=e.indexOf("?");n!==-1&&(t=new URLSearchParams(e.substring(n)),r=e.substring(0,n));const s=i.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=i.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,c=i.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=i.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,h=i.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0,u=i.get("state")??(t==null?void 0:t.get("state"))??void 0;if((l||o)&&s){const d=(()=>{if(o)return i.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();i.delete("walletId"),i.delete("authProvider"),i.delete("authCookie"),i.delete("authFlow"),i.delete("state"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow"),t==null||t.delete("state");const _=i.toString(),p=_?`?${_}`:"";let f=r;if(t){const w=t.toString();w&&(f=`${r}?${w}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${f}`),{authCookie:l,authFlow:h,authProvider:c,authResult:d,state:u,walletId:s}}}let Cn;const Vb=async i=>{if(Cn&&!i.force&&await Cn)return!0;const t=xb(i);return Cn=t,t},xb=async({storage:i,props:t,createWalletFn:e,manager:r,connectOverride:n,setLastAuthProvider:s})=>{var D,N,S,m,P;const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let h=!1;r.isAutoConnecting.setValue(!0);let[u,d]=await Promise.all([xu(i),lo(i)]);const _=t.readUrlToken===!1?void 0:Lb();let p=_;if(_!=null&&_.authResult&&(await ph(_.state)||(p=void 0)),(p==null?void 0:p.authFlow)==="link"&&p.authResult)return await Sb({client:t.client,connectOverride:n,createWalletFn:e,manager:r,onConnect:c,props:t,setLastAuthProvider:s,storage:i,timeout:l,urlToken:p,wallets:o});const f=o.find(E=>E.id===(p==null?void 0:p.walletId));if(p!=null&&p.authCookie&&f&&await new Ts({clientId:t.client.clientId,ecosystem:Ti(f)?{id:f.id,partnerId:(D=f.getConfig())==null?void 0:D.partnerId}:void 0,storage:i}).saveAuthCookie(p.authCookie),p!=null&&p.walletId&&(d=p.walletId,u=u!=null&&u.includes(p.walletId)?u:[p.walletId,...u||[]]),p!=null&&p.authProvider&&await(s==null?void 0:s(p.authProvider,i)),!u)return h;const w=await Su(i)||t.chain,g=u.map(E=>{const A=o.find(O=>O.id===E);return A||e(E)}),I=d&&(g.find(E=>E.id===d)||e(d));if(I){r.activeWalletConnectionStatusStore.setValue("connecting"),await Cu(vs({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:w,wallet:I}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(E=>{console.warn(E.message),t.onTimeout&&t.onTimeout()});try{await(n?n(I):r.connect(I,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(E){E instanceof Error&&console.warn("Error auto connecting wallet:",E.message),r.activeWalletConnectionStatusStore.setValue("disconnected")}}else r.activeWalletConnectionStatusStore.setValue("disconnected");const T=g.filter(E=>E.id!==d&&u.includes(E.id));for(const E of T)try{await vs({authResult:p==null?void 0:p.authResult,client:t.client,lastConnectedChain:w,wallet:E}),r.addConnectedWallet(E)}catch{}I&&Db({connectedWallets:I?[I,...T]:T,wallet:I})&&((N=t.siweAuth)!=null&&N.requiresAuth)&&!((S=t.siweAuth)!=null&&S.isLoggedIn)&&!((m=t.siweAuth)!=null&&m.isLoggingIn)&&await((P=t.siweAuth)==null?void 0:P.doLogin().catch(E=>{console.warn("Error signing in with SIWE:",E.message)})),r.isAutoConnecting.setValue(!1);const v=r.activeWalletStore.getValue(),b=r.connectedWallets.getValue();if(v){h=!0;try{c==null||c(v,b)}catch(E){console.error("Error calling onConnect callback:",E)}}else r.activeWalletConnectionStatusStore.setValue("disconnected");return h};async function Sb(i){var v;const{client:t,connectOverride:e,createWalletFn:r,manager:n,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:h,urlToken:u,wallets:d}=i,[_,p]=await Promise.all([xu(l),lo(l)]),f=await Su(l)||o.chain;if(!p||!_)return console.warn("No stored wallet found for linking flow"),n.isAutoConnecting.setValue(!1),!1;u.authProvider&&await(c==null?void 0:c(u.authProvider,l));const w=d.find(b=>b.id===p)||r(p);n.activeWalletConnectionStatusStore.setValue("connecting");try{await Cu(vs({authResult:void 0,client:t,lastConnectedChain:f,wallet:w}),{message:`AutoConnect timeout: ${h}ms limit exceeded.`,ms:h}),await(e?e(w):n.connect(w,{accountAbstraction:o.accountAbstraction,client:t}))}catch(b){return console.warn("Failed to auto-connect for linking:",b),n.activeWalletConnectionStatusStore.setValue("disconnected"),n.isAutoConnecting.setValue(!1),!1}const g=Ti(w)?{id:w.id,partnerId:(v=w.getConfig())==null?void 0:v.partnerId}:void 0,I=new Ts({clientId:t.clientId,ecosystem:g,storage:l});try{await fh({client:t,ecosystem:g,storage:I,tokenToLink:u.authResult.storedToken.cookieString})}catch(b){console.error("Failed to link profile after redirect:",b)}n.isAutoConnecting.setValue(!1);const T=n.activeWalletStore.getValue(),y=n.connectedWallets.getValue();if(T){try{s==null||s(T,y)}catch(b){console.error("Error calling onConnect callback:",b)}return!0}return!1}async function vs(i){return i.wallet.autoConnect({authResult:i.authResult,chain:i.lastConnectedChain,client:i.client})}async function Cb(i){const t=i.wallets||Ib(i),e=Ob(Nr);return await Vb({createWalletFn:rt,manager:e,props:{...i,wallets:t},storage:Nr})}const OI=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:mb,EIP1193:wd,authenticate:Xu,authenticateWithRedirect:eh,autoConnect:Cb,createWallet:rt,createWalletAdapter:gd,createWalletConnectClient:Eb,createWalletConnectSession:yb,deploySmartAccount:Hu,disconnectWalletConnectSession:Lu,ecosystemWallet:Uc,embeddedWallet:Nn,generateAccount:vd,getActiveWalletConnectSessions:vb,getAllWalletsList:md,getInstalledWallets:Bc,getProfiles:th,getUser:Ku,getUserEmail:ih,getUserPhoneNumber:rh,getWalletBalance:bd,getWalletInfo:Dc,inAppWallet:Nn,injectedProvider:Us,isBaseAccountSDKWallet:Vc,linkProfile:nh,preAuthenticate:sh,privateKeyAccount:qn,privateKeyToAccount:qn,randomPrivateKey:ju,smartWallet:Ns,unlinkProfile:oh,walletConnect:hd},Symbol.toStringTag,{value:"Module"}));export{el as A,Qr as B,q_ as C,db as D,dI as E,Lr as F,uI as G,F_ as H,Mr as I,_I as J,ae as K,pI as L,Es as M,vI as N,II as O,ou as P,OI as Q,ur as V,hg as Y,TI as a,Br as b,AI as c,Lu as d,Du as e,Qh as f,Dc as g,_b as h,pb as i,fb as j,lc as k,cc as l,qs as m,at as n,vi as o,bI as p,co as q,ti as r,PI as s,pe as t,kt as u,hI as v,$o as w,tl as x,sr as y,C_ as z};