@wormhole-foundation/wormhole-connect 0.3.19-beta.3-development → 0.3.19-beta.5-development

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 (115) hide show
  1. package/dist/assets/{ccip-B8sh0red.js → ccip-De5bB7ry.js} +1 -1
  2. package/dist/assets/{evm-B3YdeaCI.js → evm-DJTN7n-6.js} +4 -4
  3. package/dist/assets/{index-moDeJTxm.js → index-CdA027fm.js} +1 -1
  4. package/dist/assets/{index-1ZJmfQkw.js → index-D8xdfMo8.js} +2 -2
  5. package/dist/assets/{index.es-CXmj0UJy.js → index.es-DsPAzXeV.js} +2 -2
  6. package/dist/main.js +7 -7
  7. package/dist/src/components/ManualAddressInput.d.ts.map +1 -1
  8. package/dist/src/routes/cosmosGateway/cosmosGateway.d.ts +2 -0
  9. package/dist/src/routes/cosmosGateway/cosmosGateway.d.ts.map +1 -1
  10. package/dist/src/routes/porticoBridge/porticoBridge.d.ts +2 -0
  11. package/dist/src/routes/porticoBridge/porticoBridge.d.ts.map +1 -1
  12. package/dist/src/routes/sdkv2/route.d.ts +1 -1
  13. package/dist/src/routes/sdkv2/route.d.ts.map +1 -1
  14. package/dist/src/routes/tbtc/tbtc.d.ts +2 -0
  15. package/dist/src/routes/tbtc/tbtc.d.ts.map +1 -1
  16. package/lib/{algorand-BDR3KPTJ.js → algorand-BizCMnCe.js} +1 -1
  17. package/lib/{algorand-CNPRWbNB.mjs → algorand-CZC9cPKi.mjs} +4 -4
  18. package/lib/{aptos-BPs26BCC.mjs → aptos-B4ng1XsR.mjs} +1 -1
  19. package/lib/{aptos-t3uXFwih.mjs → aptos-CRkEBLid.mjs} +4 -4
  20. package/lib/{aptos-tCZHrDAP.js → aptos-CXyHqFt8.js} +2 -2
  21. package/lib/{aptos-Br9Q1n2N.js → aptos-i8WEm-Fe.js} +1 -1
  22. package/lib/{browser-33Nc32cs.mjs → browser-CIwNo6kY.mjs} +2 -2
  23. package/lib/{browser-Cz60hQ-L.js → browser-DEzmpMBm.js} +1 -1
  24. package/lib/{ccip-CtmuOQGX.js → ccip-6omn1tDF.js} +1 -1
  25. package/lib/{ccip-CE49B2YD.mjs → ccip-LzzuUWf7.mjs} +1 -1
  26. package/lib/{chain-BT07YJHt.js → chain-BteoJHpg.js} +1 -1
  27. package/lib/{chain-CbwtJlkc.mjs → chain-Cc-vL0Ji.mjs} +1 -1
  28. package/lib/{cosmos-LlwNYP69.mjs → cosmos-5NiZ8EbB.mjs} +3 -3
  29. package/lib/{cosmos-t65H2NQC.js → cosmos-DM4Lrmu1.js} +1 -1
  30. package/lib/{cosmwasm-CiJ3I3AY.js → cosmwasm-8FJsT7LT.js} +2 -2
  31. package/lib/{cosmwasm-CbTKetWD.mjs → cosmwasm-BHEBPmf7.mjs} +6 -6
  32. package/lib/{create-Chqnlpoq.js → create-48Wkagqs.js} +1 -1
  33. package/lib/{create-HNw0Emrd.mjs → create-BIAJIVSg.mjs} +1 -1
  34. package/lib/{ens-validation.es6-BaZUabxu.js → ens-validation.es6-Bw--s4Qc.js} +1 -1
  35. package/lib/{ens-validation.es6-CyEOHc9J.mjs → ens-validation.es6-DQFhqeC0.mjs} +2 -2
  36. package/lib/{evm-lHNM4jqm.mjs → evm-B5hnoH2O.mjs} +6 -6
  37. package/lib/{evm-CjvzIUCn.mjs → evm-Dd33ef5o.mjs} +6 -6
  38. package/lib/{evm-CNC7JHe1.js → evm-JNEgzI8_.js} +4 -4
  39. package/lib/{evm-3AGyBI-h.js → evm-OwiMOsDg.js} +2 -2
  40. package/lib/{index-BWsL77BI.mjs → index-10BWvX1N.mjs} +3 -3
  41. package/lib/{index-DPNt5r2L.js → index-670AMJe5.js} +1 -1
  42. package/lib/{index-C4kvGnSA.mjs → index-B03MiI2p.mjs} +2 -2
  43. package/lib/{index-BpuXk_6h.js → index-B9pFbfyU.js} +1 -1
  44. package/lib/{index-35qsyZLz.js → index-BDi5PNJc.js} +1 -1
  45. package/lib/{index-BCSt_UXY.js → index-BFIX3imu.js} +1 -1
  46. package/lib/{index-CACyup9A.js → index-BHUxBugG.js} +1 -1
  47. package/lib/{index-DVVJw5ml.js → index-BHWhOqWI.js} +1 -1
  48. package/lib/{index-ztQgUCWf.js → index-BJPmRnHn.js} +1 -1
  49. package/lib/{index-BCnyHegg.mjs → index-Bg59b-Bk.mjs} +4 -4
  50. package/lib/{index-CbCfazgA.mjs → index-By8Yxkcx.mjs} +5 -5
  51. package/lib/{index-Tl7zYqHL.js → index-C1oy9Lkm.js} +6 -6
  52. package/lib/{index-DJzhcNDU.mjs → index-CHqEmT8z.mjs} +6 -6
  53. package/lib/{index-Bk7wdRtH.mjs → index-CMKVJZ8E.mjs} +3 -3
  54. package/lib/{index-DRTx-Ru8.mjs → index-CNbmckF9.mjs} +4 -4
  55. package/lib/{index-D1dHZqit.mjs → index-CU3qSQjR.mjs} +4 -4
  56. package/lib/{index-CjyrCdi_.mjs → index-CVjCpWVm.mjs} +1 -1
  57. package/lib/{index-BBtf8VGl.js → index-CYRY8C8f.js} +1 -1
  58. package/lib/{index-DfJLd65b.mjs → index-Cx7DnGQ7.mjs} +4 -4
  59. package/lib/{index-CdSy2Lfd.mjs → index-D4oa5qLu.mjs} +85 -62
  60. package/lib/{index-zKUpU-3R.mjs → index-D7DR5q91.mjs} +4 -4
  61. package/lib/{index-BH5gBrJu.mjs → index-D83yFXT3.mjs} +3 -3
  62. package/lib/{index-B6m0ovID.mjs → index-D8SeaoGs.mjs} +2 -2
  63. package/lib/{index-DGRaAUXo.mjs → index-D8l7OdtE.mjs} +2 -2
  64. package/lib/{index-Dbwiqljw.js → index-DETB2K9l.js} +1 -1
  65. package/lib/{index-abvwfKBf.js → index-DGfMxIjQ.js} +1 -1
  66. package/lib/{index-l_e-RUun.js → index-DLpTO2U3.js} +1 -1
  67. package/lib/{index-CokIAiMa.mjs → index-DX18kVfL.mjs} +4 -4
  68. package/lib/{index-dJMYtBle.mjs → index-DX6w1JtB.mjs} +4 -4
  69. package/lib/{index-B9L2kltl.mjs → index-DbMbSuyg.mjs} +4 -4
  70. package/lib/{index-DCPwTd_i.js → index-DfYaeaDv.js} +1 -1
  71. package/lib/{index-0t31FGKV.js → index-DjmghqSr.js} +1 -1
  72. package/lib/{index-UOSBfEgg.js → index-DlRC-hs-.js} +1 -1
  73. package/lib/{index-Cp5np38p.mjs → index-G7Dlm7ed.mjs} +1 -1
  74. package/lib/{index-Bp0NhDcb.js → index-Hyeca4Ym.js} +1 -1
  75. package/lib/{index-DVH-ZIP6.mjs → index-ROBBwabT.mjs} +4 -4
  76. package/lib/{index-CO9tmWap.js → index-WhcobQtR.js} +1 -1
  77. package/lib/{index-DrncQYMG.js → index-X-BikqCf.js} +1 -1
  78. package/lib/{index-BqGvvv6N.js → index-ZCZHbA1F.js} +1 -1
  79. package/lib/{index-Cofatf_w.js → index-isN8Fo1n.js} +1 -1
  80. package/lib/{index-B9gw1I6s.js → index-j8isX5f9.js} +1 -1
  81. package/lib/{index-CGLAoOXl.mjs → index-jlt17KkN.mjs} +4 -4
  82. package/lib/{index-BS1tjK_Z.mjs → index-mtuCwj6Z.mjs} +5 -5
  83. package/lib/{index-Bfw-brA6.js → index-oVIYJXdI.js} +1 -1
  84. package/lib/{index-CYap2RXm.js → index-tvG-rfJZ.js} +1 -1
  85. package/lib/{index-DvUq-nIQ.mjs → index-ybRLAtD8.mjs} +5 -5
  86. package/lib/{index.es-494n2GDU.js → index.es-B33YjOZu.js} +2 -2
  87. package/lib/{index.es-DnXnnX-i.mjs → index.es-BON8c55F.mjs} +4 -4
  88. package/lib/index.js +1 -1
  89. package/lib/index.mjs +1 -1
  90. package/lib/{libsodium-wrappers-9p7NdjLu.mjs → libsodium-wrappers-DTuXKVrZ.mjs} +1 -1
  91. package/lib/{libsodium-wrappers-Dechaffz.js → libsodium-wrappers-VihnPAqR.js} +1 -1
  92. package/lib/{sei-SWKTnPTF.mjs → sei-C6N03jzv.mjs} +2 -2
  93. package/lib/{sei-DORxBQd-.js → sei-DTeCXpXl.js} +1 -1
  94. package/lib/{solana-Bd9eRY8E.js → solana--YauUjmQ.js} +2 -2
  95. package/lib/{solana-T2pgCVfU.mjs → solana-BMm013WW.mjs} +6 -6
  96. package/lib/{solana-DvbMa7B_.mjs → solana-DdaraOHp.mjs} +3 -3
  97. package/lib/{solana-KhBV5LOd.js → solana-T3yS-Q_9.js} +1 -1
  98. package/lib/{solanaEmbed.esm-CnKFJhsj.js → solanaEmbed.esm-DMwXbxXO.js} +1 -1
  99. package/lib/{solanaEmbed.esm-8eZSo5K2.mjs → solanaEmbed.esm-D_lKLzGu.mjs} +2 -2
  100. package/lib/src/components/ManualAddressInput.d.ts.map +1 -1
  101. package/lib/src/routes/cosmosGateway/cosmosGateway.d.ts +2 -0
  102. package/lib/src/routes/cosmosGateway/cosmosGateway.d.ts.map +1 -1
  103. package/lib/src/routes/porticoBridge/porticoBridge.d.ts +2 -0
  104. package/lib/src/routes/porticoBridge/porticoBridge.d.ts.map +1 -1
  105. package/lib/src/routes/sdkv2/route.d.ts +1 -1
  106. package/lib/src/routes/sdkv2/route.d.ts.map +1 -1
  107. package/lib/src/routes/tbtc/tbtc.d.ts +2 -0
  108. package/lib/src/routes/tbtc/tbtc.d.ts.map +1 -1
  109. package/lib/{sui-DDu4a1uc.mjs → sui-Btvc4SGv.mjs} +4 -4
  110. package/lib/{sui-CjRGl9Gg.mjs → sui-CXyWZ2Gp.mjs} +1 -1
  111. package/lib/{sui-B382sZz0.js → sui-DWLiZoeB.js} +1 -1
  112. package/lib/{sui-DwH1wYGH.js → sui-DbQOBpeH.js} +2 -2
  113. package/lib/{unsignedTransaction-BbAfXtog.mjs → unsignedTransaction-CtPR6znR.mjs} +2 -2
  114. package/lib/{unsignedTransaction-mu6HJcHt.js → unsignedTransaction-DZq5iThY.js} +1 -1
  115. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  var Dr = Object.defineProperty;
2
2
  var zr = (e, t, r) => t in e ? Dr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var D = (e, t, r) => (zr(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { g as Vr, b3 as Fr, by as Gr, c5 as Je, c6 as Lr, au as Wr, az as Kt, bp as Ae, bM as Kr, bO as Jt, c7 as Jr, b_ as Ht, b4 as Hr, at as Xr } from "./index-CdSy2Lfd.mjs";
5
- import { i as rr, g as ft, a as qr, b as nr, c as ir, d as nt, t as it, S as Zr, e as _e, p as Yr, f as Qr, h as He, j as en, u as Xe, k as tn, l as rn, m as Xt, n as nn, _ as sn } from "./sui-DDu4a1uc.mjs";
6
- import "./index-B9L2kltl.mjs";
7
- import { r as an } from "./chain-CbwtJlkc.mjs";
4
+ import { g as Vr, b3 as Fr, by as Gr, c5 as Je, c6 as Lr, au as Wr, az as Kt, bp as Ae, bM as Kr, bO as Jt, c7 as Jr, b_ as Ht, b4 as Hr, at as Xr } from "./index-D4oa5qLu.mjs";
5
+ import { i as rr, g as ft, a as qr, b as nr, c as ir, d as nt, t as it, S as Zr, e as _e, p as Yr, f as Qr, h as He, j as en, u as Xe, k as tn, l as rn, m as Xt, n as nn, _ as sn } from "./sui-Btvc4SGv.mjs";
6
+ import "./index-DbMbSuyg.mjs";
7
+ import { r as an } from "./chain-Cc-vL0Ji.mjs";
8
8
  class on {
9
9
  constructor(t, r, n, i, s = !1) {
10
10
  D(this, "transaction");
@@ -17,11 +17,11 @@ var fn = (r, t, e, n) => ({
17
17
  return h(r, t, n);
18
18
  }
19
19
  }), v = (r, t, e) => (Ce(r, t, "access private method"), e);
20
- import { bM as rt, bW as Lt, bX as De, by as Ve, bb as ce, bY as Bt, at as Be, bZ as Hn, aB as Cr, bp as Me, az as hn, b_ as Br, ax as dn, bN as Fr, b$ as Lr } from "./index-CdSy2Lfd.mjs";
21
- import { E as _r, a as $r } from "./index-DRTx-Ru8.mjs";
22
- import "./index-BCnyHegg.mjs";
23
- import { E as pn, a as gn, b as Fe, c as Dr, _ as Vr } from "./evm-lHNM4jqm.mjs";
24
- import { r as Mr } from "./chain-CbwtJlkc.mjs";
20
+ import { bM as rt, bW as Lt, bX as De, by as Ve, bb as ce, bY as Bt, at as Be, bZ as Hn, aB as Cr, bp as Me, az as hn, b_ as Br, ax as dn, bN as Fr, b$ as Lr } from "./index-D4oa5qLu.mjs";
21
+ import { E as _r, a as $r } from "./index-CNbmckF9.mjs";
22
+ import "./index-Bg59b-Bk.mjs";
23
+ import { E as pn, a as gn, b as Fe, c as Dr, _ as Vr } from "./evm-B5hnoH2O.mjs";
24
+ import { r as Mr } from "./chain-Cc-vL0Ji.mjs";
25
25
  const Gr = "6.12.1";
26
26
  function Hr(r, t, e) {
27
27
  const n = t.split("|").map((i) => i.trim());
@@ -1,4 +1,4 @@
1
- "use strict";const Ye=require("./index-Tl7zYqHL.js");var Et={},Me={},x={},bt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function r(f,c){var d=f>>>16&65535,E=f&65535,y=c>>>16&65535,v=c&65535;return E*v+(d*v+E*y<<16>>>0)|0}e.mul=Math.imul||r;function n(f,c){return f+c|0}e.add=n;function a(f,c){return f-c|0}e.sub=a;function D(f,c){return f<<c|f>>>32-c}e.rotl=D;function l(f,c){return f<<32-c|f>>>c}e.rotr=l;function w(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}e.isInteger=Number.isInteger||w,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(f){return e.isInteger(f)&&f>=-e.MAX_SAFE_INTEGER&&f<=e.MAX_SAFE_INTEGER}})(bt);Object.defineProperty(x,"__esModule",{value:!0});var vt=bt;function It(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])<<16>>16}x.readInt16BE=It;function Rt(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])>>>0}x.readUint16BE=Rt;function Pt(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])<<16>>16}x.readInt16LE=Pt;function Ht(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])>>>0}x.readUint16LE=Ht;function wt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>8,r[n+1]=e>>>0,r}x.writeUint16BE=wt;x.writeInt16BE=wt;function yt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r}x.writeUint16LE=yt;x.writeInt16LE=yt;function qe(e,r){return r===void 0&&(r=0),e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]}x.readInt32BE=qe;function $e(e,r){return r===void 0&&(r=0),(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0}x.readUint32BE=$e;function Ge(e,r){return r===void 0&&(r=0),e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r]}x.readInt32LE=Ge;function Ve(e,r){return r===void 0&&(r=0),(e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r])>>>0}x.readUint32LE=Ve;function Ne(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>24,r[n+1]=e>>>16,r[n+2]=e>>>8,r[n+3]=e>>>0,r}x.writeUint32BE=Ne;x.writeInt32BE=Ne;function Te(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r[n+2]=e>>>16,r[n+3]=e>>>24,r}x.writeUint32LE=Te;x.writeInt32LE=Te;function Kt(e,r){r===void 0&&(r=0);var n=qe(e,r),a=qe(e,r+4);return n*4294967296+a-(a>>31)*4294967296}x.readInt64BE=Kt;function zt(e,r){r===void 0&&(r=0);var n=$e(e,r),a=$e(e,r+4);return n*4294967296+a}x.readUint64BE=zt;function Yt(e,r){r===void 0&&(r=0);var n=Ge(e,r),a=Ge(e,r+4);return a*4294967296+n-(n>>31)*4294967296}x.readInt64LE=Yt;function qt(e,r){r===void 0&&(r=0);var n=Ve(e,r),a=Ve(e,r+4);return a*4294967296+n}x.readUint64LE=qt;function gt(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Ne(e/4294967296>>>0,r,n),Ne(e>>>0,r,n+4),r}x.writeUint64BE=gt;x.writeInt64BE=gt;function St(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Te(e>>>0,r,n),Te(e/4294967296>>>0,r,n+4),r}x.writeUint64LE=St;x.writeInt64LE=St;function $t(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var a=0,D=1,l=e/8+n-1;l>=n;l--)a+=r[l]*D,D*=256;return a}x.readUintBE=$t;function Gt(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var a=0,D=1,l=n;l<n+e/8;l++)a+=r[l]*D,D*=256;return a}x.readUintLE=Gt;function Vt(e,r,n,a){if(n===void 0&&(n=new Uint8Array(e/8)),a===void 0&&(a=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!vt.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var D=1,l=e/8+a-1;l>=a;l--)n[l]=r/D&255,D*=256;return n}x.writeUintBE=Vt;function Wt(e,r,n,a){if(n===void 0&&(n=new Uint8Array(e/8)),a===void 0&&(a=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!vt.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var D=1,l=a;l<a+e/8;l++)n[l]=r/D&255,D*=256;return n}x.writeUintLE=Wt;function Xt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r)}x.readFloat32BE=Xt;function Jt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r,!0)}x.readFloat32LE=Jt;function Qt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r)}x.readFloat64BE=Qt;function Zt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r,!0)}x.readFloat64LE=Zt;function kt(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat32(n,e),r}x.writeFloat32BE=kt;function er(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat32(n,e,!0),r}x.writeFloat32LE=er;function tr(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat64(n,e),r}x.writeFloat64BE=tr;function rr(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat64(n,e,!0),r}x.writeFloat64LE=rr;var de={};Object.defineProperty(de,"__esModule",{value:!0});function nr(e){for(var r=0;r<e.length;r++)e[r]=0;return e}de.wipe=nr;Object.defineProperty(Me,"__esModule",{value:!0});var _e=x,We=de,ir=20;function ar(e,r,n){for(var a=1634760805,D=857760878,l=2036477234,w=1797285236,f=n[3]<<24|n[2]<<16|n[1]<<8|n[0],c=n[7]<<24|n[6]<<16|n[5]<<8|n[4],d=n[11]<<24|n[10]<<16|n[9]<<8|n[8],E=n[15]<<24|n[14]<<16|n[13]<<8|n[12],y=n[19]<<24|n[18]<<16|n[17]<<8|n[16],v=n[23]<<24|n[22]<<16|n[21]<<8|n[20],b=n[27]<<24|n[26]<<16|n[25]<<8|n[24],g=n[31]<<24|n[30]<<16|n[29]<<8|n[28],A=r[3]<<24|r[2]<<16|r[1]<<8|r[0],p=r[7]<<24|r[6]<<16|r[5]<<8|r[4],O=r[11]<<24|r[10]<<16|r[9]<<8|r[8],o=r[15]<<24|r[14]<<16|r[13]<<8|r[12],_=a,u=D,s=l,h=w,t=f,i=c,S=d,C=E,F=y,L=v,j=b,B=g,T=A,M=p,m=O,N=o,G=0;G<ir;G+=2)_=_+t|0,T^=_,T=T>>>16|T<<16,F=F+T|0,t^=F,t=t>>>20|t<<12,u=u+i|0,M^=u,M=M>>>16|M<<16,L=L+M|0,i^=L,i=i>>>20|i<<12,s=s+S|0,m^=s,m=m>>>16|m<<16,j=j+m|0,S^=j,S=S>>>20|S<<12,h=h+C|0,N^=h,N=N>>>16|N<<16,B=B+N|0,C^=B,C=C>>>20|C<<12,s=s+S|0,m^=s,m=m>>>24|m<<8,j=j+m|0,S^=j,S=S>>>25|S<<7,h=h+C|0,N^=h,N=N>>>24|N<<8,B=B+N|0,C^=B,C=C>>>25|C<<7,u=u+i|0,M^=u,M=M>>>24|M<<8,L=L+M|0,i^=L,i=i>>>25|i<<7,_=_+t|0,T^=_,T=T>>>24|T<<8,F=F+T|0,t^=F,t=t>>>25|t<<7,_=_+i|0,N^=_,N=N>>>16|N<<16,j=j+N|0,i^=j,i=i>>>20|i<<12,u=u+S|0,T^=u,T=T>>>16|T<<16,B=B+T|0,S^=B,S=S>>>20|S<<12,s=s+C|0,M^=s,M=M>>>16|M<<16,F=F+M|0,C^=F,C=C>>>20|C<<12,h=h+t|0,m^=h,m=m>>>16|m<<16,L=L+m|0,t^=L,t=t>>>20|t<<12,s=s+C|0,M^=s,M=M>>>24|M<<8,F=F+M|0,C^=F,C=C>>>25|C<<7,h=h+t|0,m^=h,m=m>>>24|m<<8,L=L+m|0,t^=L,t=t>>>25|t<<7,u=u+S|0,T^=u,T=T>>>24|T<<8,B=B+T|0,S^=B,S=S>>>25|S<<7,_=_+i|0,N^=_,N=N>>>24|N<<8,j=j+N|0,i^=j,i=i>>>25|i<<7;_e.writeUint32LE(_+a|0,e,0),_e.writeUint32LE(u+D|0,e,4),_e.writeUint32LE(s+l|0,e,8),_e.writeUint32LE(h+w|0,e,12),_e.writeUint32LE(t+f|0,e,16),_e.writeUint32LE(i+c|0,e,20),_e.writeUint32LE(S+d|0,e,24),_e.writeUint32LE(C+E|0,e,28),_e.writeUint32LE(F+y|0,e,32),_e.writeUint32LE(L+v|0,e,36),_e.writeUint32LE(j+b|0,e,40),_e.writeUint32LE(B+g|0,e,44),_e.writeUint32LE(T+A|0,e,48),_e.writeUint32LE(M+p|0,e,52),_e.writeUint32LE(m+O|0,e,56),_e.writeUint32LE(N+o|0,e,60)}function mt(e,r,n,a,D){if(D===void 0&&(D=0),e.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(a.length<n.length)throw new Error("ChaCha: destination is shorter than source");var l,w;if(D===0){if(r.length!==8&&r.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");l=new Uint8Array(16),w=l.length-r.length,l.set(r,w)}else{if(r.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");l=r,w=D}for(var f=new Uint8Array(64),c=0;c<n.length;c+=64){ar(f,l,e);for(var d=c;d<c+64&&d<n.length;d++)a[d]=n[d]^f[d-c];fr(l,0,w)}return We.wipe(f),D===0&&We.wipe(l),a}Me.streamXOR=mt;function ur(e,r,n,a){return a===void 0&&(a=0),We.wipe(n),mt(e,r,n,n,a)}Me.stream=ur;function fr(e,r,n){for(var a=1;n--;)a=a+(e[r]&255)|0,e[r]=a&255,a>>>=8,r++;if(a>0)throw new Error("ChaCha: counter overflow")}var Ct={},be={};Object.defineProperty(be,"__esModule",{value:!0});function hr(e,r,n){return~(e-1)&r|e-1&n}be.select=hr;function sr(e,r){return(e|0)-(r|0)-1>>>31&1}be.lessOrEqual=sr;function pt(e,r){if(e.length!==r.length)return 0;for(var n=0,a=0;a<e.length;a++)n|=e[a]^r[a];return 1&n-1>>>8}be.compare=pt;function or(e,r){return e.length===0||r.length===0?!1:pt(e,r)!==0}be.equal=or;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=be,n=de;e.DIGEST_LENGTH=16;var a=function(){function w(f){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=f[0]|f[1]<<8;this._r[0]=c&8191;var d=f[2]|f[3]<<8;this._r[1]=(c>>>13|d<<3)&8191;var E=f[4]|f[5]<<8;this._r[2]=(d>>>10|E<<6)&7939;var y=f[6]|f[7]<<8;this._r[3]=(E>>>7|y<<9)&8191;var v=f[8]|f[9]<<8;this._r[4]=(y>>>4|v<<12)&255,this._r[5]=v>>>1&8190;var b=f[10]|f[11]<<8;this._r[6]=(v>>>14|b<<2)&8191;var g=f[12]|f[13]<<8;this._r[7]=(b>>>11|g<<5)&8065;var A=f[14]|f[15]<<8;this._r[8]=(g>>>8|A<<8)&8191,this._r[9]=A>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return w.prototype._blocks=function(f,c,d){for(var E=this._fin?0:2048,y=this._h[0],v=this._h[1],b=this._h[2],g=this._h[3],A=this._h[4],p=this._h[5],O=this._h[6],o=this._h[7],_=this._h[8],u=this._h[9],s=this._r[0],h=this._r[1],t=this._r[2],i=this._r[3],S=this._r[4],C=this._r[5],F=this._r[6],L=this._r[7],j=this._r[8],B=this._r[9];d>=16;){var T=f[c+0]|f[c+1]<<8;y+=T&8191;var M=f[c+2]|f[c+3]<<8;v+=(T>>>13|M<<3)&8191;var m=f[c+4]|f[c+5]<<8;b+=(M>>>10|m<<6)&8191;var N=f[c+6]|f[c+7]<<8;g+=(m>>>7|N<<9)&8191;var G=f[c+8]|f[c+9]<<8;A+=(N>>>4|G<<12)&8191,p+=G>>>1&8191;var J=f[c+10]|f[c+11]<<8;O+=(G>>>14|J<<2)&8191;var X=f[c+12]|f[c+13]<<8;o+=(J>>>11|X<<5)&8191;var W=f[c+14]|f[c+15]<<8;_+=(X>>>8|W<<8)&8191,u+=W>>>5|E;var U=0,I=U;I+=y*s,I+=v*(5*B),I+=b*(5*j),I+=g*(5*L),I+=A*(5*F),U=I>>>13,I&=8191,I+=p*(5*C),I+=O*(5*S),I+=o*(5*i),I+=_*(5*t),I+=u*(5*h),U+=I>>>13,I&=8191;var R=U;R+=y*h,R+=v*s,R+=b*(5*B),R+=g*(5*j),R+=A*(5*L),U=R>>>13,R&=8191,R+=p*(5*F),R+=O*(5*C),R+=o*(5*S),R+=_*(5*i),R+=u*(5*t),U+=R>>>13,R&=8191;var P=U;P+=y*t,P+=v*h,P+=b*s,P+=g*(5*B),P+=A*(5*j),U=P>>>13,P&=8191,P+=p*(5*L),P+=O*(5*F),P+=o*(5*C),P+=_*(5*S),P+=u*(5*i),U+=P>>>13,P&=8191;var H=U;H+=y*i,H+=v*t,H+=b*h,H+=g*s,H+=A*(5*B),U=H>>>13,H&=8191,H+=p*(5*j),H+=O*(5*L),H+=o*(5*F),H+=_*(5*C),H+=u*(5*S),U+=H>>>13,H&=8191;var K=U;K+=y*S,K+=v*i,K+=b*t,K+=g*h,K+=A*s,U=K>>>13,K&=8191,K+=p*(5*B),K+=O*(5*j),K+=o*(5*L),K+=_*(5*F),K+=u*(5*C),U+=K>>>13,K&=8191;var z=U;z+=y*C,z+=v*S,z+=b*i,z+=g*t,z+=A*h,U=z>>>13,z&=8191,z+=p*s,z+=O*(5*B),z+=o*(5*j),z+=_*(5*L),z+=u*(5*F),U+=z>>>13,z&=8191;var Y=U;Y+=y*F,Y+=v*C,Y+=b*S,Y+=g*i,Y+=A*t,U=Y>>>13,Y&=8191,Y+=p*h,Y+=O*s,Y+=o*(5*B),Y+=_*(5*j),Y+=u*(5*L),U+=Y>>>13,Y&=8191;var q=U;q+=y*L,q+=v*F,q+=b*C,q+=g*S,q+=A*i,U=q>>>13,q&=8191,q+=p*t,q+=O*h,q+=o*s,q+=_*(5*B),q+=u*(5*j),U+=q>>>13,q&=8191;var $=U;$+=y*j,$+=v*L,$+=b*F,$+=g*C,$+=A*S,U=$>>>13,$&=8191,$+=p*i,$+=O*t,$+=o*h,$+=_*s,$+=u*(5*B),U+=$>>>13,$&=8191;var V=U;V+=y*B,V+=v*j,V+=b*L,V+=g*F,V+=A*C,U=V>>>13,V&=8191,V+=p*S,V+=O*i,V+=o*t,V+=_*h,V+=u*s,U+=V>>>13,V&=8191,U=(U<<2)+U|0,U=U+I|0,I=U&8191,U=U>>>13,R+=U,y=I,v=R,b=P,g=H,A=K,p=z,O=Y,o=q,_=$,u=V,c+=16,d-=16}this._h[0]=y,this._h[1]=v,this._h[2]=b,this._h[3]=g,this._h[4]=A,this._h[5]=p,this._h[6]=O,this._h[7]=o,this._h[8]=_,this._h[9]=u},w.prototype.finish=function(f,c){c===void 0&&(c=0);var d=new Uint16Array(10),E,y,v,b;if(this._leftover){for(b=this._leftover,this._buffer[b++]=1;b<16;b++)this._buffer[b]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(E=this._h[1]>>>13,this._h[1]&=8191,b=2;b<10;b++)this._h[b]+=E,E=this._h[b]>>>13,this._h[b]&=8191;for(this._h[0]+=E*5,E=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=E,E=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=E,d[0]=this._h[0]+5,E=d[0]>>>13,d[0]&=8191,b=1;b<10;b++)d[b]=this._h[b]+E,E=d[b]>>>13,d[b]&=8191;for(d[9]-=8192,y=(E^1)-1,b=0;b<10;b++)d[b]&=y;for(y=~y,b=0;b<10;b++)this._h[b]=this._h[b]&y|d[b];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,v=this._h[0]+this._pad[0],this._h[0]=v&65535,b=1;b<8;b++)v=(this._h[b]+this._pad[b]|0)+(v>>>16)|0,this._h[b]=v&65535;return f[c+0]=this._h[0]>>>0,f[c+1]=this._h[0]>>>8,f[c+2]=this._h[1]>>>0,f[c+3]=this._h[1]>>>8,f[c+4]=this._h[2]>>>0,f[c+5]=this._h[2]>>>8,f[c+6]=this._h[3]>>>0,f[c+7]=this._h[3]>>>8,f[c+8]=this._h[4]>>>0,f[c+9]=this._h[4]>>>8,f[c+10]=this._h[5]>>>0,f[c+11]=this._h[5]>>>8,f[c+12]=this._h[6]>>>0,f[c+13]=this._h[6]>>>8,f[c+14]=this._h[7]>>>0,f[c+15]=this._h[7]>>>8,this._finished=!0,this},w.prototype.update=function(f){var c=0,d=f.length,E;if(this._leftover){E=16-this._leftover,E>d&&(E=d);for(var y=0;y<E;y++)this._buffer[this._leftover+y]=f[c+y];if(d-=E,c+=E,this._leftover+=E,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(d>=16&&(E=d-d%16,this._blocks(f,c,E),c+=E,d-=E),d){for(var y=0;y<d;y++)this._buffer[this._leftover+y]=f[c+y];this._leftover+=d}return this},w.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},w.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},w}();e.Poly1305=a;function D(w,f){var c=new a(w);c.update(f);var d=c.digest();return c.clean(),d}e.oneTimeAuth=D;function l(w,f){return w.length!==e.DIGEST_LENGTH||f.length!==e.DIGEST_LENGTH?!1:r.equal(w,f)}e.equal=l})(Ct);(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=Me,n=Ct,a=de,D=x,l=be;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var w=new Uint8Array(16),f=function(){function c(d){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,d.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(d)}return c.prototype.seal=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var A=E.length+this.tagLength,p;if(v){if(v.length!==A)throw new Error("ChaCha20Poly1305: incorrect destination length");p=v}else p=new Uint8Array(A);return r.streamXOR(this._key,b,E,p,4),this._authenticate(p.subarray(p.length-this.tagLength,p.length),g,p.subarray(0,p.length-this.tagLength),y),a.wipe(b),p},c.prototype.open=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(E.length<this.tagLength)return null;var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var A=new Uint8Array(this.tagLength);if(this._authenticate(A,g,E.subarray(0,E.length-this.tagLength),y),!l.equal(A,E.subarray(E.length-this.tagLength,E.length)))return null;var p=E.length-this.tagLength,O;if(v){if(v.length!==p)throw new Error("ChaCha20Poly1305: incorrect destination length");O=v}else O=new Uint8Array(p);return r.streamXOR(this._key,b,E.subarray(0,E.length-this.tagLength),O,4),a.wipe(b),O},c.prototype.clean=function(){return a.wipe(this._key),this},c.prototype._authenticate=function(d,E,y,v){var b=new n.Poly1305(E);v&&(b.update(v),v.length%16>0&&b.update(w.subarray(v.length%16))),b.update(y),y.length%16>0&&b.update(w.subarray(y.length%16));var g=new Uint8Array(8);v&&D.writeUint64LE(v.length,g),b.update(g),D.writeUint64LE(y.length,g),b.update(g);for(var A=b.digest(),p=0;p<A.length;p++)d[p]=A[p];b.clean(),a.wipe(A),a.wipe(g)},c}();e.ChaCha20Poly1305=f})(Et);var At={},Ue={},ke={};Object.defineProperty(ke,"__esModule",{value:!0});function cr(e){return typeof e.saveState<"u"&&typeof e.restoreState<"u"&&typeof e.cleanSavedState<"u"}ke.isSerializableHash=cr;Object.defineProperty(Ue,"__esModule",{value:!0});var Ee=ke,lr=be,Dr=de,Ut=function(){function e(r,n){this._finished=!1,this._inner=new r,this._outer=new r,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var a=new Uint8Array(this.blockSize);n.length>this.blockSize?this._inner.update(n).finish(a).clean():a.set(n);for(var D=0;D<a.length;D++)a[D]^=54;this._inner.update(a);for(var D=0;D<a.length;D++)a[D]^=106;this._outer.update(a),Ee.isSerializableHash(this._inner)&&Ee.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Dr.wipe(a)}return e.prototype.reset=function(){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){Ee.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ee.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(r){return this._inner.update(r),this},e.prototype.finish=function(r){return this._finished?(this._outer.finish(r),this):(this._inner.finish(r),this._outer.update(r.subarray(0,this.digestLength)).finish(r),this._finished=!0,this)},e.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},e.prototype.saveState=function(){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(r){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(r),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(r){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(r)},e}();Ue.HMAC=Ut;function _r(e,r,n){var a=new Ut(e,r);a.update(n);var D=a.digest();return a.clean(),D}Ue.hmac=_r;Ue.equal=lr.equal;Object.defineProperty(At,"__esModule",{value:!0});var rt=Ue,nt=de,dr=function(){function e(r,n,a,D){a===void 0&&(a=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=r,this._info=D;var l=rt.hmac(this._hash,a,n);this._hmac=new rt.HMAC(r,l),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var r=this._counter[0];if(r===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),r>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(r){for(var n=new Uint8Array(r),a=0;a<n.length;a++)this._bufpos===this._buffer.length&&this._fillBuffer(),n[a]=this._buffer[this._bufpos++];return n},e.prototype.clean=function(){this._hmac.clean(),nt.wipe(this._buffer),nt.wipe(this._counter),this._bufpos=0},e}(),Er=At.HKDF=dr,et={},xe={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.BrowserRandomSource=void 0;const it=65536;class br{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const r=typeof self<"u"?self.crypto||self.msCrypto:null;r&&r.getRandomValues!==void 0&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const n=new Uint8Array(r);for(let a=0;a<n.length;a+=it)this._crypto.getRandomValues(n.subarray(a,a+Math.min(n.length-a,it)));return n}}Le.BrowserRandomSource=br;var Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.NodeRandomSource=void 0;const vr=de;class wr{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Ye.commonjsRequire<"u"){const r=Ye.requireCryptoBrowserify();r&&r.randomBytes&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let n=this._crypto.randomBytes(r);if(n.length!==r)throw new Error("NodeRandomSource: got fewer bytes than requested");const a=new Uint8Array(r);for(let D=0;D<a.length;D++)a[D]=n[D];return(0,vr.wipe)(n),a}}Be.NodeRandomSource=wr;Object.defineProperty(xe,"__esModule",{value:!0});xe.SystemRandomSource=void 0;const yr=Le,gr=Be;class Sr{constructor(){if(this.isAvailable=!1,this.name="",this._source=new yr.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new gr.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(r){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(r)}}xe.SystemRandomSource=Sr;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const r=xe,n=x,a=de;e.defaultRandomSource=new r.SystemRandomSource;function D(d,E=e.defaultRandomSource){return E.randomBytes(d)}e.randomBytes=D;function l(d=e.defaultRandomSource){const E=D(4,d),y=(0,n.readUint32LE)(E);return(0,a.wipe)(E),y}e.randomUint32=l;const w="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(d,E=w,y=e.defaultRandomSource){if(E.length<2)throw new Error("randomString charset is too short");if(E.length>256)throw new Error("randomString charset is too long");let v="";const b=E.length,g=256-256%b;for(;d>0;){const A=D(Math.ceil(d*256/g),y);for(let p=0;p<A.length&&d>0;p++){const O=A[p];O<g&&(v+=E.charAt(O%b),d--)}(0,a.wipe)(A)}return v}e.randomString=f;function c(d,E=w,y=e.defaultRandomSource){const v=Math.ceil(d/(Math.log(E.length)/Math.LN2));return f(v,E,y)}e.randomStringForEntropy=c})(et);var Ot={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=x,n=de;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var a=function(){function f(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},f.prototype.update=function(c,d){if(d===void 0&&(d=c.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var E=0;if(this._bytesHashed+=d,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&d>0;)this._buffer[this._bufferLength++]=c[E++],d--;this._bufferLength===this.blockSize&&(l(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(E=l(this._temp,this._state,c,E,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=c[E++],d--;return this},f.prototype.finish=function(c){if(!this._finished){var d=this._bytesHashed,E=this._bufferLength,y=d/536870912|0,v=d<<3,b=d%64<56?64:128;this._buffer[E]=128;for(var g=E+1;g<b-8;g++)this._buffer[g]=0;r.writeUint32BE(y,this._buffer,b-8),r.writeUint32BE(v,this._buffer,b-4),l(this._temp,this._state,this._buffer,0,b),this._finished=!0}for(var g=0;g<this.digestLength/4;g++)r.writeUint32BE(this._state[g],c,g*4);return this},f.prototype.digest=function(){var c=new Uint8Array(this.digestLength);return this.finish(c),c},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(c){n.wipe(c.state),c.buffer&&n.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},f}();e.SHA256=a;var D=new Int32Array([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]);function l(f,c,d,E,y){for(;y>=64;){for(var v=c[0],b=c[1],g=c[2],A=c[3],p=c[4],O=c[5],o=c[6],_=c[7],u=0;u<16;u++){var s=E+u*4;f[u]=r.readUint32BE(d,s)}for(var u=16;u<64;u++){var h=f[u-2],t=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=f[u-15];var i=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;f[u]=(t+f[u-7]|0)+(i+f[u-16]|0)}for(var u=0;u<64;u++){var t=(((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&O^~p&o)|0)+(_+(D[u]+f[u]|0)|0)|0,i=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&b^v&g^b&g)|0;_=o,o=O,O=p,p=A+t|0,A=g,g=b,b=v,v=t+i|0}c[0]+=v,c[1]+=b,c[2]+=g,c[3]+=A,c[4]+=p,c[5]+=O,c[6]+=o,c[7]+=_,E+=64,y-=64}return E}function w(f){var c=new a;c.update(f);var d=c.digest();return c.clean(),d}e.hash=w})(Ot);var Ft={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const r=et,n=de;e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;function a(u){const s=new Float64Array(16);if(u)for(let h=0;h<u.length;h++)s[h]=u[h];return s}const D=new Uint8Array(32);D[0]=9;const l=a([56129,1]);function w(u){let s=1;for(let h=0;h<16;h++){let t=u[h]+s+65535;s=Math.floor(t/65536),u[h]=t-s*65536}u[0]+=s-1+37*(s-1)}function f(u,s,h){const t=~(h-1);for(let i=0;i<16;i++){const S=t&(u[i]^s[i]);u[i]^=S,s[i]^=S}}function c(u,s){const h=a(),t=a();for(let i=0;i<16;i++)t[i]=s[i];w(t),w(t),w(t);for(let i=0;i<2;i++){h[0]=t[0]-65517;for(let C=1;C<15;C++)h[C]=t[C]-65535-(h[C-1]>>16&1),h[C-1]&=65535;h[15]=t[15]-32767-(h[14]>>16&1);const S=h[15]>>16&1;h[14]&=65535,f(t,h,1-S)}for(let i=0;i<16;i++)u[2*i]=t[i]&255,u[2*i+1]=t[i]>>8}function d(u,s){for(let h=0;h<16;h++)u[h]=s[2*h]+(s[2*h+1]<<8);u[15]&=32767}function E(u,s,h){for(let t=0;t<16;t++)u[t]=s[t]+h[t]}function y(u,s,h){for(let t=0;t<16;t++)u[t]=s[t]-h[t]}function v(u,s,h){let t,i,S=0,C=0,F=0,L=0,j=0,B=0,T=0,M=0,m=0,N=0,G=0,J=0,X=0,W=0,U=0,I=0,R=0,P=0,H=0,K=0,z=0,Y=0,q=0,$=0,V=0,ve=0,ge=0,me=0,Fe=0,Re=0,tt=0,Z=h[0],k=h[1],ee=h[2],te=h[3],re=h[4],ne=h[5],ie=h[6],ae=h[7],ue=h[8],fe=h[9],he=h[10],se=h[11],oe=h[12],ce=h[13],le=h[14],De=h[15];t=s[0],S+=t*Z,C+=t*k,F+=t*ee,L+=t*te,j+=t*re,B+=t*ne,T+=t*ie,M+=t*ae,m+=t*ue,N+=t*fe,G+=t*he,J+=t*se,X+=t*oe,W+=t*ce,U+=t*le,I+=t*De,t=s[1],C+=t*Z,F+=t*k,L+=t*ee,j+=t*te,B+=t*re,T+=t*ne,M+=t*ie,m+=t*ae,N+=t*ue,G+=t*fe,J+=t*he,X+=t*se,W+=t*oe,U+=t*ce,I+=t*le,R+=t*De,t=s[2],F+=t*Z,L+=t*k,j+=t*ee,B+=t*te,T+=t*re,M+=t*ne,m+=t*ie,N+=t*ae,G+=t*ue,J+=t*fe,X+=t*he,W+=t*se,U+=t*oe,I+=t*ce,R+=t*le,P+=t*De,t=s[3],L+=t*Z,j+=t*k,B+=t*ee,T+=t*te,M+=t*re,m+=t*ne,N+=t*ie,G+=t*ae,J+=t*ue,X+=t*fe,W+=t*he,U+=t*se,I+=t*oe,R+=t*ce,P+=t*le,H+=t*De,t=s[4],j+=t*Z,B+=t*k,T+=t*ee,M+=t*te,m+=t*re,N+=t*ne,G+=t*ie,J+=t*ae,X+=t*ue,W+=t*fe,U+=t*he,I+=t*se,R+=t*oe,P+=t*ce,H+=t*le,K+=t*De,t=s[5],B+=t*Z,T+=t*k,M+=t*ee,m+=t*te,N+=t*re,G+=t*ne,J+=t*ie,X+=t*ae,W+=t*ue,U+=t*fe,I+=t*he,R+=t*se,P+=t*oe,H+=t*ce,K+=t*le,z+=t*De,t=s[6],T+=t*Z,M+=t*k,m+=t*ee,N+=t*te,G+=t*re,J+=t*ne,X+=t*ie,W+=t*ae,U+=t*ue,I+=t*fe,R+=t*he,P+=t*se,H+=t*oe,K+=t*ce,z+=t*le,Y+=t*De,t=s[7],M+=t*Z,m+=t*k,N+=t*ee,G+=t*te,J+=t*re,X+=t*ne,W+=t*ie,U+=t*ae,I+=t*ue,R+=t*fe,P+=t*he,H+=t*se,K+=t*oe,z+=t*ce,Y+=t*le,q+=t*De,t=s[8],m+=t*Z,N+=t*k,G+=t*ee,J+=t*te,X+=t*re,W+=t*ne,U+=t*ie,I+=t*ae,R+=t*ue,P+=t*fe,H+=t*he,K+=t*se,z+=t*oe,Y+=t*ce,q+=t*le,$+=t*De,t=s[9],N+=t*Z,G+=t*k,J+=t*ee,X+=t*te,W+=t*re,U+=t*ne,I+=t*ie,R+=t*ae,P+=t*ue,H+=t*fe,K+=t*he,z+=t*se,Y+=t*oe,q+=t*ce,$+=t*le,V+=t*De,t=s[10],G+=t*Z,J+=t*k,X+=t*ee,W+=t*te,U+=t*re,I+=t*ne,R+=t*ie,P+=t*ae,H+=t*ue,K+=t*fe,z+=t*he,Y+=t*se,q+=t*oe,$+=t*ce,V+=t*le,ve+=t*De,t=s[11],J+=t*Z,X+=t*k,W+=t*ee,U+=t*te,I+=t*re,R+=t*ne,P+=t*ie,H+=t*ae,K+=t*ue,z+=t*fe,Y+=t*he,q+=t*se,$+=t*oe,V+=t*ce,ve+=t*le,ge+=t*De,t=s[12],X+=t*Z,W+=t*k,U+=t*ee,I+=t*te,R+=t*re,P+=t*ne,H+=t*ie,K+=t*ae,z+=t*ue,Y+=t*fe,q+=t*he,$+=t*se,V+=t*oe,ve+=t*ce,ge+=t*le,me+=t*De,t=s[13],W+=t*Z,U+=t*k,I+=t*ee,R+=t*te,P+=t*re,H+=t*ne,K+=t*ie,z+=t*ae,Y+=t*ue,q+=t*fe,$+=t*he,V+=t*se,ve+=t*oe,ge+=t*ce,me+=t*le,Fe+=t*De,t=s[14],U+=t*Z,I+=t*k,R+=t*ee,P+=t*te,H+=t*re,K+=t*ne,z+=t*ie,Y+=t*ae,q+=t*ue,$+=t*fe,V+=t*he,ve+=t*se,ge+=t*oe,me+=t*ce,Fe+=t*le,Re+=t*De,t=s[15],I+=t*Z,R+=t*k,P+=t*ee,H+=t*te,K+=t*re,z+=t*ne,Y+=t*ie,q+=t*ae,$+=t*ue,V+=t*fe,ve+=t*he,ge+=t*se,me+=t*oe,Fe+=t*ce,Re+=t*le,tt+=t*De,S+=38*R,C+=38*P,F+=38*H,L+=38*K,j+=38*z,B+=38*Y,T+=38*q,M+=38*$,m+=38*V,N+=38*ve,G+=38*ge,J+=38*me,X+=38*Fe,W+=38*Re,U+=38*tt,i=1,t=S+i+65535,i=Math.floor(t/65536),S=t-i*65536,t=C+i+65535,i=Math.floor(t/65536),C=t-i*65536,t=F+i+65535,i=Math.floor(t/65536),F=t-i*65536,t=L+i+65535,i=Math.floor(t/65536),L=t-i*65536,t=j+i+65535,i=Math.floor(t/65536),j=t-i*65536,t=B+i+65535,i=Math.floor(t/65536),B=t-i*65536,t=T+i+65535,i=Math.floor(t/65536),T=t-i*65536,t=M+i+65535,i=Math.floor(t/65536),M=t-i*65536,t=m+i+65535,i=Math.floor(t/65536),m=t-i*65536,t=N+i+65535,i=Math.floor(t/65536),N=t-i*65536,t=G+i+65535,i=Math.floor(t/65536),G=t-i*65536,t=J+i+65535,i=Math.floor(t/65536),J=t-i*65536,t=X+i+65535,i=Math.floor(t/65536),X=t-i*65536,t=W+i+65535,i=Math.floor(t/65536),W=t-i*65536,t=U+i+65535,i=Math.floor(t/65536),U=t-i*65536,t=I+i+65535,i=Math.floor(t/65536),I=t-i*65536,S+=i-1+37*(i-1),i=1,t=S+i+65535,i=Math.floor(t/65536),S=t-i*65536,t=C+i+65535,i=Math.floor(t/65536),C=t-i*65536,t=F+i+65535,i=Math.floor(t/65536),F=t-i*65536,t=L+i+65535,i=Math.floor(t/65536),L=t-i*65536,t=j+i+65535,i=Math.floor(t/65536),j=t-i*65536,t=B+i+65535,i=Math.floor(t/65536),B=t-i*65536,t=T+i+65535,i=Math.floor(t/65536),T=t-i*65536,t=M+i+65535,i=Math.floor(t/65536),M=t-i*65536,t=m+i+65535,i=Math.floor(t/65536),m=t-i*65536,t=N+i+65535,i=Math.floor(t/65536),N=t-i*65536,t=G+i+65535,i=Math.floor(t/65536),G=t-i*65536,t=J+i+65535,i=Math.floor(t/65536),J=t-i*65536,t=X+i+65535,i=Math.floor(t/65536),X=t-i*65536,t=W+i+65535,i=Math.floor(t/65536),W=t-i*65536,t=U+i+65535,i=Math.floor(t/65536),U=t-i*65536,t=I+i+65535,i=Math.floor(t/65536),I=t-i*65536,S+=i-1+37*(i-1),u[0]=S,u[1]=C,u[2]=F,u[3]=L,u[4]=j,u[5]=B,u[6]=T,u[7]=M,u[8]=m,u[9]=N,u[10]=G,u[11]=J,u[12]=X,u[13]=W,u[14]=U,u[15]=I}function b(u,s){v(u,s,s)}function g(u,s){const h=a();for(let t=0;t<16;t++)h[t]=s[t];for(let t=253;t>=0;t--)b(h,h),t!==2&&t!==4&&v(h,h,s);for(let t=0;t<16;t++)u[t]=h[t]}function A(u,s){const h=new Uint8Array(32),t=new Float64Array(80),i=a(),S=a(),C=a(),F=a(),L=a(),j=a();for(let m=0;m<31;m++)h[m]=u[m];h[31]=u[31]&127|64,h[0]&=248,d(t,s);for(let m=0;m<16;m++)S[m]=t[m];i[0]=F[0]=1;for(let m=254;m>=0;--m){const N=h[m>>>3]>>>(m&7)&1;f(i,S,N),f(C,F,N),E(L,i,C),y(i,i,C),E(C,S,F),y(S,S,F),b(F,L),b(j,i),v(i,C,i),v(C,S,L),E(L,i,C),y(i,i,C),b(S,i),y(C,F,j),v(i,C,l),E(i,i,F),v(C,C,i),v(i,F,j),v(F,S,t),b(S,L),f(i,S,N),f(C,F,N)}for(let m=0;m<16;m++)t[m+16]=i[m],t[m+32]=C[m],t[m+48]=S[m],t[m+64]=F[m];const B=t.subarray(32),T=t.subarray(16);g(B,B),v(T,T,B);const M=new Uint8Array(32);return c(M,T),M}e.scalarMult=A;function p(u){return A(u,D)}e.scalarMultBase=p;function O(u){if(u.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const s=new Uint8Array(u);return{publicKey:p(s),secretKey:s}}e.generateKeyPairFromSeed=O;function o(u){const s=(0,r.randomBytes)(32,u),h=O(s);return(0,n.wipe)(s),h}e.generateKeyPair=o;function _(u,s,h=!1){if(u.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(s.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const t=A(u,s);if(h){let i=0;for(let S=0;S<t.length;S++)i|=t[S];if(i===0)throw new Error("X25519: invalid shared key")}return t}e.sharedKey=_})(Ft);function mr(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),a=0;a<n.length;a++)n[a]=255;for(var D=0;D<e.length;D++){var l=e.charAt(D),w=l.charCodeAt(0);if(n[w]!==255)throw new TypeError(l+" is ambiguous");n[w]=D}var f=e.length,c=e.charAt(0),d=Math.log(f)/Math.log(256),E=Math.log(256)/Math.log(f);function y(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var A=0,p=0,O=0,o=g.length;O!==o&&g[O]===0;)O++,A++;for(var _=(o-O)*E+1>>>0,u=new Uint8Array(_);O!==o;){for(var s=g[O],h=0,t=_-1;(s!==0||h<p)&&t!==-1;t--,h++)s+=256*u[t]>>>0,u[t]=s%f>>>0,s=s/f>>>0;if(s!==0)throw new Error("Non-zero carry");p=h,O++}for(var i=_-p;i!==_&&u[i]===0;)i++;for(var S=c.repeat(A);i<_;++i)S+=e.charAt(u[i]);return S}function v(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var A=0;if(g[A]!==" "){for(var p=0,O=0;g[A]===c;)p++,A++;for(var o=(g.length-A)*d+1>>>0,_=new Uint8Array(o);g[A];){var u=n[g.charCodeAt(A)];if(u===255)return;for(var s=0,h=o-1;(u!==0||s<O)&&h!==-1;h--,s++)u+=f*_[h]>>>0,_[h]=u%256>>>0,u=u/256>>>0;if(u!==0)throw new Error("Non-zero carry");O=s,A++}if(g[A]!==" "){for(var t=o-O;t!==o&&_[t]===0;)t++;for(var i=new Uint8Array(p+(o-t)),S=p;t!==o;)i[S++]=_[t++];return i}}}function b(g){var A=v(g);if(A)return A;throw new Error(`Non-${r} character`)}return{encode:y,decodeUnsafe:v,decode:b}}var Cr=mr,pr=Cr;const Ar=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Ur=e=>new TextEncoder().encode(e),Or=e=>new TextDecoder().decode(e);class Fr{constructor(r,n,a){this.name=r,this.prefix=n,this.baseEncode=a}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Nr{constructor(r,n,a){if(this.name=r,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=a}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return Nt(this,r)}}class Tr{constructor(r){this.decoders=r}or(r){return Nt(this,r)}decode(r){const n=r[0],a=this.decoders[n];if(a)return a.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Nt=(e,r)=>new Tr({...e.decoders||{[e.prefix]:e},...r.decoders||{[r.prefix]:r}});class Mr{constructor(r,n,a,D){this.name=r,this.prefix=n,this.baseEncode=a,this.baseDecode=D,this.encoder=new Fr(r,n,a),this.decoder=new Nr(r,n,D)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const je=({name:e,prefix:r,encode:n,decode:a})=>new Mr(e,r,n,a),Oe=({prefix:e,name:r,alphabet:n})=>{const{encode:a,decode:D}=pr(n,r);return je({prefix:e,name:r,encode:a,decode:l=>Ar(D(l))})},xr=(e,r,n,a)=>{const D={};for(let E=0;E<r.length;++E)D[r[E]]=E;let l=e.length;for(;e[l-1]==="=";)--l;const w=new Uint8Array(l*n/8|0);let f=0,c=0,d=0;for(let E=0;E<l;++E){const y=D[e[E]];if(y===void 0)throw new SyntaxError(`Non-${a} character`);c=c<<n|y,f+=n,f>=8&&(f-=8,w[d++]=255&c>>f)}if(f>=n||255&c<<8-f)throw new SyntaxError("Unexpected end of data");return w},Lr=(e,r,n)=>{const a=r[r.length-1]==="=",D=(1<<n)-1;let l="",w=0,f=0;for(let c=0;c<e.length;++c)for(f=f<<8|e[c],w+=8;w>n;)w-=n,l+=r[D&f>>w];if(w&&(l+=r[D&f<<n-w]),a)for(;l.length*n&7;)l+="=";return l},Q=({name:e,prefix:r,bitsPerChar:n,alphabet:a})=>je({prefix:r,name:e,encode(D){return Lr(D,a,n)},decode(D){return xr(D,a,n,e)}}),Br=je({prefix:"\0",name:"identity",encode:e=>Or(e),decode:e=>Ur(e)}),jr=Object.freeze(Object.defineProperty({__proto__:null,identity:Br},Symbol.toStringTag,{value:"Module"})),Ir=Q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Rr=Object.freeze(Object.defineProperty({__proto__:null,base2:Ir},Symbol.toStringTag,{value:"Module"})),Pr=Q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Hr=Object.freeze(Object.defineProperty({__proto__:null,base8:Pr},Symbol.toStringTag,{value:"Module"})),Kr=Oe({prefix:"9",name:"base10",alphabet:"0123456789"}),zr=Object.freeze(Object.defineProperty({__proto__:null,base10:Kr},Symbol.toStringTag,{value:"Module"})),Yr=Q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qr=Q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),$r=Object.freeze(Object.defineProperty({__proto__:null,base16:Yr,base16upper:qr},Symbol.toStringTag,{value:"Module"})),Gr=Q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Vr=Q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wr=Q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Xr=Q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Jr=Q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Qr=Q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zr=Q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),kr=Q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),en=Q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),tn=Object.freeze(Object.defineProperty({__proto__:null,base32:Gr,base32hex:Jr,base32hexpad:Zr,base32hexpadupper:kr,base32hexupper:Qr,base32pad:Wr,base32padupper:Xr,base32upper:Vr,base32z:en},Symbol.toStringTag,{value:"Module"})),rn=Oe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),nn=Oe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),an=Object.freeze(Object.defineProperty({__proto__:null,base36:rn,base36upper:nn},Symbol.toStringTag,{value:"Module"})),un=Oe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fn=Oe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),hn=Object.freeze(Object.defineProperty({__proto__:null,base58btc:un,base58flickr:fn},Symbol.toStringTag,{value:"Module"})),sn=Q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),on=Q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cn=Q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ln=Q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Dn=Object.freeze(Object.defineProperty({__proto__:null,base64:sn,base64pad:on,base64url:cn,base64urlpad:ln},Symbol.toStringTag,{value:"Module"})),Tt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),_n=Tt.reduce((e,r,n)=>(e[n]=r,e),[]),dn=Tt.reduce((e,r,n)=>(e[r.codePointAt(0)]=n,e),[]);function En(e){return e.reduce((r,n)=>(r+=_n[n],r),"")}function bn(e){const r=[];for(const n of e){const a=dn[n.codePointAt(0)];if(a===void 0)throw new Error(`Non-base256emoji character: ${n}`);r.push(a)}return new Uint8Array(r)}const vn=je({prefix:"🚀",name:"base256emoji",encode:En,decode:bn}),wn=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:vn},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var Mt={};/*! *****************************************************************************
1
+ "use strict";const Ye=require("./index-C1oy9Lkm.js");var Et={},Me={},x={},bt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function r(f,c){var d=f>>>16&65535,E=f&65535,y=c>>>16&65535,v=c&65535;return E*v+(d*v+E*y<<16>>>0)|0}e.mul=Math.imul||r;function n(f,c){return f+c|0}e.add=n;function a(f,c){return f-c|0}e.sub=a;function D(f,c){return f<<c|f>>>32-c}e.rotl=D;function l(f,c){return f<<32-c|f>>>c}e.rotr=l;function w(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}e.isInteger=Number.isInteger||w,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(f){return e.isInteger(f)&&f>=-e.MAX_SAFE_INTEGER&&f<=e.MAX_SAFE_INTEGER}})(bt);Object.defineProperty(x,"__esModule",{value:!0});var vt=bt;function It(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])<<16>>16}x.readInt16BE=It;function Rt(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])>>>0}x.readUint16BE=Rt;function Pt(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])<<16>>16}x.readInt16LE=Pt;function Ht(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])>>>0}x.readUint16LE=Ht;function wt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>8,r[n+1]=e>>>0,r}x.writeUint16BE=wt;x.writeInt16BE=wt;function yt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r}x.writeUint16LE=yt;x.writeInt16LE=yt;function qe(e,r){return r===void 0&&(r=0),e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]}x.readInt32BE=qe;function $e(e,r){return r===void 0&&(r=0),(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0}x.readUint32BE=$e;function Ge(e,r){return r===void 0&&(r=0),e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r]}x.readInt32LE=Ge;function Ve(e,r){return r===void 0&&(r=0),(e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r])>>>0}x.readUint32LE=Ve;function Ne(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>24,r[n+1]=e>>>16,r[n+2]=e>>>8,r[n+3]=e>>>0,r}x.writeUint32BE=Ne;x.writeInt32BE=Ne;function Te(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r[n+2]=e>>>16,r[n+3]=e>>>24,r}x.writeUint32LE=Te;x.writeInt32LE=Te;function Kt(e,r){r===void 0&&(r=0);var n=qe(e,r),a=qe(e,r+4);return n*4294967296+a-(a>>31)*4294967296}x.readInt64BE=Kt;function zt(e,r){r===void 0&&(r=0);var n=$e(e,r),a=$e(e,r+4);return n*4294967296+a}x.readUint64BE=zt;function Yt(e,r){r===void 0&&(r=0);var n=Ge(e,r),a=Ge(e,r+4);return a*4294967296+n-(n>>31)*4294967296}x.readInt64LE=Yt;function qt(e,r){r===void 0&&(r=0);var n=Ve(e,r),a=Ve(e,r+4);return a*4294967296+n}x.readUint64LE=qt;function gt(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Ne(e/4294967296>>>0,r,n),Ne(e>>>0,r,n+4),r}x.writeUint64BE=gt;x.writeInt64BE=gt;function St(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Te(e>>>0,r,n),Te(e/4294967296>>>0,r,n+4),r}x.writeUint64LE=St;x.writeInt64LE=St;function $t(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var a=0,D=1,l=e/8+n-1;l>=n;l--)a+=r[l]*D,D*=256;return a}x.readUintBE=$t;function Gt(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var a=0,D=1,l=n;l<n+e/8;l++)a+=r[l]*D,D*=256;return a}x.readUintLE=Gt;function Vt(e,r,n,a){if(n===void 0&&(n=new Uint8Array(e/8)),a===void 0&&(a=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!vt.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var D=1,l=e/8+a-1;l>=a;l--)n[l]=r/D&255,D*=256;return n}x.writeUintBE=Vt;function Wt(e,r,n,a){if(n===void 0&&(n=new Uint8Array(e/8)),a===void 0&&(a=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!vt.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var D=1,l=a;l<a+e/8;l++)n[l]=r/D&255,D*=256;return n}x.writeUintLE=Wt;function Xt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r)}x.readFloat32BE=Xt;function Jt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r,!0)}x.readFloat32LE=Jt;function Qt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r)}x.readFloat64BE=Qt;function Zt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r,!0)}x.readFloat64LE=Zt;function kt(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat32(n,e),r}x.writeFloat32BE=kt;function er(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat32(n,e,!0),r}x.writeFloat32LE=er;function tr(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat64(n,e),r}x.writeFloat64BE=tr;function rr(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat64(n,e,!0),r}x.writeFloat64LE=rr;var de={};Object.defineProperty(de,"__esModule",{value:!0});function nr(e){for(var r=0;r<e.length;r++)e[r]=0;return e}de.wipe=nr;Object.defineProperty(Me,"__esModule",{value:!0});var _e=x,We=de,ir=20;function ar(e,r,n){for(var a=1634760805,D=857760878,l=2036477234,w=1797285236,f=n[3]<<24|n[2]<<16|n[1]<<8|n[0],c=n[7]<<24|n[6]<<16|n[5]<<8|n[4],d=n[11]<<24|n[10]<<16|n[9]<<8|n[8],E=n[15]<<24|n[14]<<16|n[13]<<8|n[12],y=n[19]<<24|n[18]<<16|n[17]<<8|n[16],v=n[23]<<24|n[22]<<16|n[21]<<8|n[20],b=n[27]<<24|n[26]<<16|n[25]<<8|n[24],g=n[31]<<24|n[30]<<16|n[29]<<8|n[28],A=r[3]<<24|r[2]<<16|r[1]<<8|r[0],p=r[7]<<24|r[6]<<16|r[5]<<8|r[4],O=r[11]<<24|r[10]<<16|r[9]<<8|r[8],o=r[15]<<24|r[14]<<16|r[13]<<8|r[12],_=a,u=D,s=l,h=w,t=f,i=c,S=d,C=E,F=y,L=v,j=b,B=g,T=A,M=p,m=O,N=o,G=0;G<ir;G+=2)_=_+t|0,T^=_,T=T>>>16|T<<16,F=F+T|0,t^=F,t=t>>>20|t<<12,u=u+i|0,M^=u,M=M>>>16|M<<16,L=L+M|0,i^=L,i=i>>>20|i<<12,s=s+S|0,m^=s,m=m>>>16|m<<16,j=j+m|0,S^=j,S=S>>>20|S<<12,h=h+C|0,N^=h,N=N>>>16|N<<16,B=B+N|0,C^=B,C=C>>>20|C<<12,s=s+S|0,m^=s,m=m>>>24|m<<8,j=j+m|0,S^=j,S=S>>>25|S<<7,h=h+C|0,N^=h,N=N>>>24|N<<8,B=B+N|0,C^=B,C=C>>>25|C<<7,u=u+i|0,M^=u,M=M>>>24|M<<8,L=L+M|0,i^=L,i=i>>>25|i<<7,_=_+t|0,T^=_,T=T>>>24|T<<8,F=F+T|0,t^=F,t=t>>>25|t<<7,_=_+i|0,N^=_,N=N>>>16|N<<16,j=j+N|0,i^=j,i=i>>>20|i<<12,u=u+S|0,T^=u,T=T>>>16|T<<16,B=B+T|0,S^=B,S=S>>>20|S<<12,s=s+C|0,M^=s,M=M>>>16|M<<16,F=F+M|0,C^=F,C=C>>>20|C<<12,h=h+t|0,m^=h,m=m>>>16|m<<16,L=L+m|0,t^=L,t=t>>>20|t<<12,s=s+C|0,M^=s,M=M>>>24|M<<8,F=F+M|0,C^=F,C=C>>>25|C<<7,h=h+t|0,m^=h,m=m>>>24|m<<8,L=L+m|0,t^=L,t=t>>>25|t<<7,u=u+S|0,T^=u,T=T>>>24|T<<8,B=B+T|0,S^=B,S=S>>>25|S<<7,_=_+i|0,N^=_,N=N>>>24|N<<8,j=j+N|0,i^=j,i=i>>>25|i<<7;_e.writeUint32LE(_+a|0,e,0),_e.writeUint32LE(u+D|0,e,4),_e.writeUint32LE(s+l|0,e,8),_e.writeUint32LE(h+w|0,e,12),_e.writeUint32LE(t+f|0,e,16),_e.writeUint32LE(i+c|0,e,20),_e.writeUint32LE(S+d|0,e,24),_e.writeUint32LE(C+E|0,e,28),_e.writeUint32LE(F+y|0,e,32),_e.writeUint32LE(L+v|0,e,36),_e.writeUint32LE(j+b|0,e,40),_e.writeUint32LE(B+g|0,e,44),_e.writeUint32LE(T+A|0,e,48),_e.writeUint32LE(M+p|0,e,52),_e.writeUint32LE(m+O|0,e,56),_e.writeUint32LE(N+o|0,e,60)}function mt(e,r,n,a,D){if(D===void 0&&(D=0),e.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(a.length<n.length)throw new Error("ChaCha: destination is shorter than source");var l,w;if(D===0){if(r.length!==8&&r.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");l=new Uint8Array(16),w=l.length-r.length,l.set(r,w)}else{if(r.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");l=r,w=D}for(var f=new Uint8Array(64),c=0;c<n.length;c+=64){ar(f,l,e);for(var d=c;d<c+64&&d<n.length;d++)a[d]=n[d]^f[d-c];fr(l,0,w)}return We.wipe(f),D===0&&We.wipe(l),a}Me.streamXOR=mt;function ur(e,r,n,a){return a===void 0&&(a=0),We.wipe(n),mt(e,r,n,n,a)}Me.stream=ur;function fr(e,r,n){for(var a=1;n--;)a=a+(e[r]&255)|0,e[r]=a&255,a>>>=8,r++;if(a>0)throw new Error("ChaCha: counter overflow")}var Ct={},be={};Object.defineProperty(be,"__esModule",{value:!0});function hr(e,r,n){return~(e-1)&r|e-1&n}be.select=hr;function sr(e,r){return(e|0)-(r|0)-1>>>31&1}be.lessOrEqual=sr;function pt(e,r){if(e.length!==r.length)return 0;for(var n=0,a=0;a<e.length;a++)n|=e[a]^r[a];return 1&n-1>>>8}be.compare=pt;function or(e,r){return e.length===0||r.length===0?!1:pt(e,r)!==0}be.equal=or;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=be,n=de;e.DIGEST_LENGTH=16;var a=function(){function w(f){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=f[0]|f[1]<<8;this._r[0]=c&8191;var d=f[2]|f[3]<<8;this._r[1]=(c>>>13|d<<3)&8191;var E=f[4]|f[5]<<8;this._r[2]=(d>>>10|E<<6)&7939;var y=f[6]|f[7]<<8;this._r[3]=(E>>>7|y<<9)&8191;var v=f[8]|f[9]<<8;this._r[4]=(y>>>4|v<<12)&255,this._r[5]=v>>>1&8190;var b=f[10]|f[11]<<8;this._r[6]=(v>>>14|b<<2)&8191;var g=f[12]|f[13]<<8;this._r[7]=(b>>>11|g<<5)&8065;var A=f[14]|f[15]<<8;this._r[8]=(g>>>8|A<<8)&8191,this._r[9]=A>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return w.prototype._blocks=function(f,c,d){for(var E=this._fin?0:2048,y=this._h[0],v=this._h[1],b=this._h[2],g=this._h[3],A=this._h[4],p=this._h[5],O=this._h[6],o=this._h[7],_=this._h[8],u=this._h[9],s=this._r[0],h=this._r[1],t=this._r[2],i=this._r[3],S=this._r[4],C=this._r[5],F=this._r[6],L=this._r[7],j=this._r[8],B=this._r[9];d>=16;){var T=f[c+0]|f[c+1]<<8;y+=T&8191;var M=f[c+2]|f[c+3]<<8;v+=(T>>>13|M<<3)&8191;var m=f[c+4]|f[c+5]<<8;b+=(M>>>10|m<<6)&8191;var N=f[c+6]|f[c+7]<<8;g+=(m>>>7|N<<9)&8191;var G=f[c+8]|f[c+9]<<8;A+=(N>>>4|G<<12)&8191,p+=G>>>1&8191;var J=f[c+10]|f[c+11]<<8;O+=(G>>>14|J<<2)&8191;var X=f[c+12]|f[c+13]<<8;o+=(J>>>11|X<<5)&8191;var W=f[c+14]|f[c+15]<<8;_+=(X>>>8|W<<8)&8191,u+=W>>>5|E;var U=0,I=U;I+=y*s,I+=v*(5*B),I+=b*(5*j),I+=g*(5*L),I+=A*(5*F),U=I>>>13,I&=8191,I+=p*(5*C),I+=O*(5*S),I+=o*(5*i),I+=_*(5*t),I+=u*(5*h),U+=I>>>13,I&=8191;var R=U;R+=y*h,R+=v*s,R+=b*(5*B),R+=g*(5*j),R+=A*(5*L),U=R>>>13,R&=8191,R+=p*(5*F),R+=O*(5*C),R+=o*(5*S),R+=_*(5*i),R+=u*(5*t),U+=R>>>13,R&=8191;var P=U;P+=y*t,P+=v*h,P+=b*s,P+=g*(5*B),P+=A*(5*j),U=P>>>13,P&=8191,P+=p*(5*L),P+=O*(5*F),P+=o*(5*C),P+=_*(5*S),P+=u*(5*i),U+=P>>>13,P&=8191;var H=U;H+=y*i,H+=v*t,H+=b*h,H+=g*s,H+=A*(5*B),U=H>>>13,H&=8191,H+=p*(5*j),H+=O*(5*L),H+=o*(5*F),H+=_*(5*C),H+=u*(5*S),U+=H>>>13,H&=8191;var K=U;K+=y*S,K+=v*i,K+=b*t,K+=g*h,K+=A*s,U=K>>>13,K&=8191,K+=p*(5*B),K+=O*(5*j),K+=o*(5*L),K+=_*(5*F),K+=u*(5*C),U+=K>>>13,K&=8191;var z=U;z+=y*C,z+=v*S,z+=b*i,z+=g*t,z+=A*h,U=z>>>13,z&=8191,z+=p*s,z+=O*(5*B),z+=o*(5*j),z+=_*(5*L),z+=u*(5*F),U+=z>>>13,z&=8191;var Y=U;Y+=y*F,Y+=v*C,Y+=b*S,Y+=g*i,Y+=A*t,U=Y>>>13,Y&=8191,Y+=p*h,Y+=O*s,Y+=o*(5*B),Y+=_*(5*j),Y+=u*(5*L),U+=Y>>>13,Y&=8191;var q=U;q+=y*L,q+=v*F,q+=b*C,q+=g*S,q+=A*i,U=q>>>13,q&=8191,q+=p*t,q+=O*h,q+=o*s,q+=_*(5*B),q+=u*(5*j),U+=q>>>13,q&=8191;var $=U;$+=y*j,$+=v*L,$+=b*F,$+=g*C,$+=A*S,U=$>>>13,$&=8191,$+=p*i,$+=O*t,$+=o*h,$+=_*s,$+=u*(5*B),U+=$>>>13,$&=8191;var V=U;V+=y*B,V+=v*j,V+=b*L,V+=g*F,V+=A*C,U=V>>>13,V&=8191,V+=p*S,V+=O*i,V+=o*t,V+=_*h,V+=u*s,U+=V>>>13,V&=8191,U=(U<<2)+U|0,U=U+I|0,I=U&8191,U=U>>>13,R+=U,y=I,v=R,b=P,g=H,A=K,p=z,O=Y,o=q,_=$,u=V,c+=16,d-=16}this._h[0]=y,this._h[1]=v,this._h[2]=b,this._h[3]=g,this._h[4]=A,this._h[5]=p,this._h[6]=O,this._h[7]=o,this._h[8]=_,this._h[9]=u},w.prototype.finish=function(f,c){c===void 0&&(c=0);var d=new Uint16Array(10),E,y,v,b;if(this._leftover){for(b=this._leftover,this._buffer[b++]=1;b<16;b++)this._buffer[b]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(E=this._h[1]>>>13,this._h[1]&=8191,b=2;b<10;b++)this._h[b]+=E,E=this._h[b]>>>13,this._h[b]&=8191;for(this._h[0]+=E*5,E=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=E,E=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=E,d[0]=this._h[0]+5,E=d[0]>>>13,d[0]&=8191,b=1;b<10;b++)d[b]=this._h[b]+E,E=d[b]>>>13,d[b]&=8191;for(d[9]-=8192,y=(E^1)-1,b=0;b<10;b++)d[b]&=y;for(y=~y,b=0;b<10;b++)this._h[b]=this._h[b]&y|d[b];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,v=this._h[0]+this._pad[0],this._h[0]=v&65535,b=1;b<8;b++)v=(this._h[b]+this._pad[b]|0)+(v>>>16)|0,this._h[b]=v&65535;return f[c+0]=this._h[0]>>>0,f[c+1]=this._h[0]>>>8,f[c+2]=this._h[1]>>>0,f[c+3]=this._h[1]>>>8,f[c+4]=this._h[2]>>>0,f[c+5]=this._h[2]>>>8,f[c+6]=this._h[3]>>>0,f[c+7]=this._h[3]>>>8,f[c+8]=this._h[4]>>>0,f[c+9]=this._h[4]>>>8,f[c+10]=this._h[5]>>>0,f[c+11]=this._h[5]>>>8,f[c+12]=this._h[6]>>>0,f[c+13]=this._h[6]>>>8,f[c+14]=this._h[7]>>>0,f[c+15]=this._h[7]>>>8,this._finished=!0,this},w.prototype.update=function(f){var c=0,d=f.length,E;if(this._leftover){E=16-this._leftover,E>d&&(E=d);for(var y=0;y<E;y++)this._buffer[this._leftover+y]=f[c+y];if(d-=E,c+=E,this._leftover+=E,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(d>=16&&(E=d-d%16,this._blocks(f,c,E),c+=E,d-=E),d){for(var y=0;y<d;y++)this._buffer[this._leftover+y]=f[c+y];this._leftover+=d}return this},w.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},w.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},w}();e.Poly1305=a;function D(w,f){var c=new a(w);c.update(f);var d=c.digest();return c.clean(),d}e.oneTimeAuth=D;function l(w,f){return w.length!==e.DIGEST_LENGTH||f.length!==e.DIGEST_LENGTH?!1:r.equal(w,f)}e.equal=l})(Ct);(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=Me,n=Ct,a=de,D=x,l=be;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var w=new Uint8Array(16),f=function(){function c(d){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,d.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(d)}return c.prototype.seal=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var A=E.length+this.tagLength,p;if(v){if(v.length!==A)throw new Error("ChaCha20Poly1305: incorrect destination length");p=v}else p=new Uint8Array(A);return r.streamXOR(this._key,b,E,p,4),this._authenticate(p.subarray(p.length-this.tagLength,p.length),g,p.subarray(0,p.length-this.tagLength),y),a.wipe(b),p},c.prototype.open=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(E.length<this.tagLength)return null;var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var A=new Uint8Array(this.tagLength);if(this._authenticate(A,g,E.subarray(0,E.length-this.tagLength),y),!l.equal(A,E.subarray(E.length-this.tagLength,E.length)))return null;var p=E.length-this.tagLength,O;if(v){if(v.length!==p)throw new Error("ChaCha20Poly1305: incorrect destination length");O=v}else O=new Uint8Array(p);return r.streamXOR(this._key,b,E.subarray(0,E.length-this.tagLength),O,4),a.wipe(b),O},c.prototype.clean=function(){return a.wipe(this._key),this},c.prototype._authenticate=function(d,E,y,v){var b=new n.Poly1305(E);v&&(b.update(v),v.length%16>0&&b.update(w.subarray(v.length%16))),b.update(y),y.length%16>0&&b.update(w.subarray(y.length%16));var g=new Uint8Array(8);v&&D.writeUint64LE(v.length,g),b.update(g),D.writeUint64LE(y.length,g),b.update(g);for(var A=b.digest(),p=0;p<A.length;p++)d[p]=A[p];b.clean(),a.wipe(A),a.wipe(g)},c}();e.ChaCha20Poly1305=f})(Et);var At={},Ue={},ke={};Object.defineProperty(ke,"__esModule",{value:!0});function cr(e){return typeof e.saveState<"u"&&typeof e.restoreState<"u"&&typeof e.cleanSavedState<"u"}ke.isSerializableHash=cr;Object.defineProperty(Ue,"__esModule",{value:!0});var Ee=ke,lr=be,Dr=de,Ut=function(){function e(r,n){this._finished=!1,this._inner=new r,this._outer=new r,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var a=new Uint8Array(this.blockSize);n.length>this.blockSize?this._inner.update(n).finish(a).clean():a.set(n);for(var D=0;D<a.length;D++)a[D]^=54;this._inner.update(a);for(var D=0;D<a.length;D++)a[D]^=106;this._outer.update(a),Ee.isSerializableHash(this._inner)&&Ee.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Dr.wipe(a)}return e.prototype.reset=function(){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){Ee.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ee.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(r){return this._inner.update(r),this},e.prototype.finish=function(r){return this._finished?(this._outer.finish(r),this):(this._inner.finish(r),this._outer.update(r.subarray(0,this.digestLength)).finish(r),this._finished=!0,this)},e.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},e.prototype.saveState=function(){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(r){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(r),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(r){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(r)},e}();Ue.HMAC=Ut;function _r(e,r,n){var a=new Ut(e,r);a.update(n);var D=a.digest();return a.clean(),D}Ue.hmac=_r;Ue.equal=lr.equal;Object.defineProperty(At,"__esModule",{value:!0});var rt=Ue,nt=de,dr=function(){function e(r,n,a,D){a===void 0&&(a=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=r,this._info=D;var l=rt.hmac(this._hash,a,n);this._hmac=new rt.HMAC(r,l),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var r=this._counter[0];if(r===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),r>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(r){for(var n=new Uint8Array(r),a=0;a<n.length;a++)this._bufpos===this._buffer.length&&this._fillBuffer(),n[a]=this._buffer[this._bufpos++];return n},e.prototype.clean=function(){this._hmac.clean(),nt.wipe(this._buffer),nt.wipe(this._counter),this._bufpos=0},e}(),Er=At.HKDF=dr,et={},xe={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.BrowserRandomSource=void 0;const it=65536;class br{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const r=typeof self<"u"?self.crypto||self.msCrypto:null;r&&r.getRandomValues!==void 0&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const n=new Uint8Array(r);for(let a=0;a<n.length;a+=it)this._crypto.getRandomValues(n.subarray(a,a+Math.min(n.length-a,it)));return n}}Le.BrowserRandomSource=br;var Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.NodeRandomSource=void 0;const vr=de;class wr{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Ye.commonjsRequire<"u"){const r=Ye.requireCryptoBrowserify();r&&r.randomBytes&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let n=this._crypto.randomBytes(r);if(n.length!==r)throw new Error("NodeRandomSource: got fewer bytes than requested");const a=new Uint8Array(r);for(let D=0;D<a.length;D++)a[D]=n[D];return(0,vr.wipe)(n),a}}Be.NodeRandomSource=wr;Object.defineProperty(xe,"__esModule",{value:!0});xe.SystemRandomSource=void 0;const yr=Le,gr=Be;class Sr{constructor(){if(this.isAvailable=!1,this.name="",this._source=new yr.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new gr.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(r){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(r)}}xe.SystemRandomSource=Sr;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const r=xe,n=x,a=de;e.defaultRandomSource=new r.SystemRandomSource;function D(d,E=e.defaultRandomSource){return E.randomBytes(d)}e.randomBytes=D;function l(d=e.defaultRandomSource){const E=D(4,d),y=(0,n.readUint32LE)(E);return(0,a.wipe)(E),y}e.randomUint32=l;const w="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(d,E=w,y=e.defaultRandomSource){if(E.length<2)throw new Error("randomString charset is too short");if(E.length>256)throw new Error("randomString charset is too long");let v="";const b=E.length,g=256-256%b;for(;d>0;){const A=D(Math.ceil(d*256/g),y);for(let p=0;p<A.length&&d>0;p++){const O=A[p];O<g&&(v+=E.charAt(O%b),d--)}(0,a.wipe)(A)}return v}e.randomString=f;function c(d,E=w,y=e.defaultRandomSource){const v=Math.ceil(d/(Math.log(E.length)/Math.LN2));return f(v,E,y)}e.randomStringForEntropy=c})(et);var Ot={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=x,n=de;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var a=function(){function f(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},f.prototype.update=function(c,d){if(d===void 0&&(d=c.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var E=0;if(this._bytesHashed+=d,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&d>0;)this._buffer[this._bufferLength++]=c[E++],d--;this._bufferLength===this.blockSize&&(l(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(E=l(this._temp,this._state,c,E,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=c[E++],d--;return this},f.prototype.finish=function(c){if(!this._finished){var d=this._bytesHashed,E=this._bufferLength,y=d/536870912|0,v=d<<3,b=d%64<56?64:128;this._buffer[E]=128;for(var g=E+1;g<b-8;g++)this._buffer[g]=0;r.writeUint32BE(y,this._buffer,b-8),r.writeUint32BE(v,this._buffer,b-4),l(this._temp,this._state,this._buffer,0,b),this._finished=!0}for(var g=0;g<this.digestLength/4;g++)r.writeUint32BE(this._state[g],c,g*4);return this},f.prototype.digest=function(){var c=new Uint8Array(this.digestLength);return this.finish(c),c},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(c){n.wipe(c.state),c.buffer&&n.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},f}();e.SHA256=a;var D=new Int32Array([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]);function l(f,c,d,E,y){for(;y>=64;){for(var v=c[0],b=c[1],g=c[2],A=c[3],p=c[4],O=c[5],o=c[6],_=c[7],u=0;u<16;u++){var s=E+u*4;f[u]=r.readUint32BE(d,s)}for(var u=16;u<64;u++){var h=f[u-2],t=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=f[u-15];var i=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;f[u]=(t+f[u-7]|0)+(i+f[u-16]|0)}for(var u=0;u<64;u++){var t=(((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&O^~p&o)|0)+(_+(D[u]+f[u]|0)|0)|0,i=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&b^v&g^b&g)|0;_=o,o=O,O=p,p=A+t|0,A=g,g=b,b=v,v=t+i|0}c[0]+=v,c[1]+=b,c[2]+=g,c[3]+=A,c[4]+=p,c[5]+=O,c[6]+=o,c[7]+=_,E+=64,y-=64}return E}function w(f){var c=new a;c.update(f);var d=c.digest();return c.clean(),d}e.hash=w})(Ot);var Ft={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const r=et,n=de;e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;function a(u){const s=new Float64Array(16);if(u)for(let h=0;h<u.length;h++)s[h]=u[h];return s}const D=new Uint8Array(32);D[0]=9;const l=a([56129,1]);function w(u){let s=1;for(let h=0;h<16;h++){let t=u[h]+s+65535;s=Math.floor(t/65536),u[h]=t-s*65536}u[0]+=s-1+37*(s-1)}function f(u,s,h){const t=~(h-1);for(let i=0;i<16;i++){const S=t&(u[i]^s[i]);u[i]^=S,s[i]^=S}}function c(u,s){const h=a(),t=a();for(let i=0;i<16;i++)t[i]=s[i];w(t),w(t),w(t);for(let i=0;i<2;i++){h[0]=t[0]-65517;for(let C=1;C<15;C++)h[C]=t[C]-65535-(h[C-1]>>16&1),h[C-1]&=65535;h[15]=t[15]-32767-(h[14]>>16&1);const S=h[15]>>16&1;h[14]&=65535,f(t,h,1-S)}for(let i=0;i<16;i++)u[2*i]=t[i]&255,u[2*i+1]=t[i]>>8}function d(u,s){for(let h=0;h<16;h++)u[h]=s[2*h]+(s[2*h+1]<<8);u[15]&=32767}function E(u,s,h){for(let t=0;t<16;t++)u[t]=s[t]+h[t]}function y(u,s,h){for(let t=0;t<16;t++)u[t]=s[t]-h[t]}function v(u,s,h){let t,i,S=0,C=0,F=0,L=0,j=0,B=0,T=0,M=0,m=0,N=0,G=0,J=0,X=0,W=0,U=0,I=0,R=0,P=0,H=0,K=0,z=0,Y=0,q=0,$=0,V=0,ve=0,ge=0,me=0,Fe=0,Re=0,tt=0,Z=h[0],k=h[1],ee=h[2],te=h[3],re=h[4],ne=h[5],ie=h[6],ae=h[7],ue=h[8],fe=h[9],he=h[10],se=h[11],oe=h[12],ce=h[13],le=h[14],De=h[15];t=s[0],S+=t*Z,C+=t*k,F+=t*ee,L+=t*te,j+=t*re,B+=t*ne,T+=t*ie,M+=t*ae,m+=t*ue,N+=t*fe,G+=t*he,J+=t*se,X+=t*oe,W+=t*ce,U+=t*le,I+=t*De,t=s[1],C+=t*Z,F+=t*k,L+=t*ee,j+=t*te,B+=t*re,T+=t*ne,M+=t*ie,m+=t*ae,N+=t*ue,G+=t*fe,J+=t*he,X+=t*se,W+=t*oe,U+=t*ce,I+=t*le,R+=t*De,t=s[2],F+=t*Z,L+=t*k,j+=t*ee,B+=t*te,T+=t*re,M+=t*ne,m+=t*ie,N+=t*ae,G+=t*ue,J+=t*fe,X+=t*he,W+=t*se,U+=t*oe,I+=t*ce,R+=t*le,P+=t*De,t=s[3],L+=t*Z,j+=t*k,B+=t*ee,T+=t*te,M+=t*re,m+=t*ne,N+=t*ie,G+=t*ae,J+=t*ue,X+=t*fe,W+=t*he,U+=t*se,I+=t*oe,R+=t*ce,P+=t*le,H+=t*De,t=s[4],j+=t*Z,B+=t*k,T+=t*ee,M+=t*te,m+=t*re,N+=t*ne,G+=t*ie,J+=t*ae,X+=t*ue,W+=t*fe,U+=t*he,I+=t*se,R+=t*oe,P+=t*ce,H+=t*le,K+=t*De,t=s[5],B+=t*Z,T+=t*k,M+=t*ee,m+=t*te,N+=t*re,G+=t*ne,J+=t*ie,X+=t*ae,W+=t*ue,U+=t*fe,I+=t*he,R+=t*se,P+=t*oe,H+=t*ce,K+=t*le,z+=t*De,t=s[6],T+=t*Z,M+=t*k,m+=t*ee,N+=t*te,G+=t*re,J+=t*ne,X+=t*ie,W+=t*ae,U+=t*ue,I+=t*fe,R+=t*he,P+=t*se,H+=t*oe,K+=t*ce,z+=t*le,Y+=t*De,t=s[7],M+=t*Z,m+=t*k,N+=t*ee,G+=t*te,J+=t*re,X+=t*ne,W+=t*ie,U+=t*ae,I+=t*ue,R+=t*fe,P+=t*he,H+=t*se,K+=t*oe,z+=t*ce,Y+=t*le,q+=t*De,t=s[8],m+=t*Z,N+=t*k,G+=t*ee,J+=t*te,X+=t*re,W+=t*ne,U+=t*ie,I+=t*ae,R+=t*ue,P+=t*fe,H+=t*he,K+=t*se,z+=t*oe,Y+=t*ce,q+=t*le,$+=t*De,t=s[9],N+=t*Z,G+=t*k,J+=t*ee,X+=t*te,W+=t*re,U+=t*ne,I+=t*ie,R+=t*ae,P+=t*ue,H+=t*fe,K+=t*he,z+=t*se,Y+=t*oe,q+=t*ce,$+=t*le,V+=t*De,t=s[10],G+=t*Z,J+=t*k,X+=t*ee,W+=t*te,U+=t*re,I+=t*ne,R+=t*ie,P+=t*ae,H+=t*ue,K+=t*fe,z+=t*he,Y+=t*se,q+=t*oe,$+=t*ce,V+=t*le,ve+=t*De,t=s[11],J+=t*Z,X+=t*k,W+=t*ee,U+=t*te,I+=t*re,R+=t*ne,P+=t*ie,H+=t*ae,K+=t*ue,z+=t*fe,Y+=t*he,q+=t*se,$+=t*oe,V+=t*ce,ve+=t*le,ge+=t*De,t=s[12],X+=t*Z,W+=t*k,U+=t*ee,I+=t*te,R+=t*re,P+=t*ne,H+=t*ie,K+=t*ae,z+=t*ue,Y+=t*fe,q+=t*he,$+=t*se,V+=t*oe,ve+=t*ce,ge+=t*le,me+=t*De,t=s[13],W+=t*Z,U+=t*k,I+=t*ee,R+=t*te,P+=t*re,H+=t*ne,K+=t*ie,z+=t*ae,Y+=t*ue,q+=t*fe,$+=t*he,V+=t*se,ve+=t*oe,ge+=t*ce,me+=t*le,Fe+=t*De,t=s[14],U+=t*Z,I+=t*k,R+=t*ee,P+=t*te,H+=t*re,K+=t*ne,z+=t*ie,Y+=t*ae,q+=t*ue,$+=t*fe,V+=t*he,ve+=t*se,ge+=t*oe,me+=t*ce,Fe+=t*le,Re+=t*De,t=s[15],I+=t*Z,R+=t*k,P+=t*ee,H+=t*te,K+=t*re,z+=t*ne,Y+=t*ie,q+=t*ae,$+=t*ue,V+=t*fe,ve+=t*he,ge+=t*se,me+=t*oe,Fe+=t*ce,Re+=t*le,tt+=t*De,S+=38*R,C+=38*P,F+=38*H,L+=38*K,j+=38*z,B+=38*Y,T+=38*q,M+=38*$,m+=38*V,N+=38*ve,G+=38*ge,J+=38*me,X+=38*Fe,W+=38*Re,U+=38*tt,i=1,t=S+i+65535,i=Math.floor(t/65536),S=t-i*65536,t=C+i+65535,i=Math.floor(t/65536),C=t-i*65536,t=F+i+65535,i=Math.floor(t/65536),F=t-i*65536,t=L+i+65535,i=Math.floor(t/65536),L=t-i*65536,t=j+i+65535,i=Math.floor(t/65536),j=t-i*65536,t=B+i+65535,i=Math.floor(t/65536),B=t-i*65536,t=T+i+65535,i=Math.floor(t/65536),T=t-i*65536,t=M+i+65535,i=Math.floor(t/65536),M=t-i*65536,t=m+i+65535,i=Math.floor(t/65536),m=t-i*65536,t=N+i+65535,i=Math.floor(t/65536),N=t-i*65536,t=G+i+65535,i=Math.floor(t/65536),G=t-i*65536,t=J+i+65535,i=Math.floor(t/65536),J=t-i*65536,t=X+i+65535,i=Math.floor(t/65536),X=t-i*65536,t=W+i+65535,i=Math.floor(t/65536),W=t-i*65536,t=U+i+65535,i=Math.floor(t/65536),U=t-i*65536,t=I+i+65535,i=Math.floor(t/65536),I=t-i*65536,S+=i-1+37*(i-1),i=1,t=S+i+65535,i=Math.floor(t/65536),S=t-i*65536,t=C+i+65535,i=Math.floor(t/65536),C=t-i*65536,t=F+i+65535,i=Math.floor(t/65536),F=t-i*65536,t=L+i+65535,i=Math.floor(t/65536),L=t-i*65536,t=j+i+65535,i=Math.floor(t/65536),j=t-i*65536,t=B+i+65535,i=Math.floor(t/65536),B=t-i*65536,t=T+i+65535,i=Math.floor(t/65536),T=t-i*65536,t=M+i+65535,i=Math.floor(t/65536),M=t-i*65536,t=m+i+65535,i=Math.floor(t/65536),m=t-i*65536,t=N+i+65535,i=Math.floor(t/65536),N=t-i*65536,t=G+i+65535,i=Math.floor(t/65536),G=t-i*65536,t=J+i+65535,i=Math.floor(t/65536),J=t-i*65536,t=X+i+65535,i=Math.floor(t/65536),X=t-i*65536,t=W+i+65535,i=Math.floor(t/65536),W=t-i*65536,t=U+i+65535,i=Math.floor(t/65536),U=t-i*65536,t=I+i+65535,i=Math.floor(t/65536),I=t-i*65536,S+=i-1+37*(i-1),u[0]=S,u[1]=C,u[2]=F,u[3]=L,u[4]=j,u[5]=B,u[6]=T,u[7]=M,u[8]=m,u[9]=N,u[10]=G,u[11]=J,u[12]=X,u[13]=W,u[14]=U,u[15]=I}function b(u,s){v(u,s,s)}function g(u,s){const h=a();for(let t=0;t<16;t++)h[t]=s[t];for(let t=253;t>=0;t--)b(h,h),t!==2&&t!==4&&v(h,h,s);for(let t=0;t<16;t++)u[t]=h[t]}function A(u,s){const h=new Uint8Array(32),t=new Float64Array(80),i=a(),S=a(),C=a(),F=a(),L=a(),j=a();for(let m=0;m<31;m++)h[m]=u[m];h[31]=u[31]&127|64,h[0]&=248,d(t,s);for(let m=0;m<16;m++)S[m]=t[m];i[0]=F[0]=1;for(let m=254;m>=0;--m){const N=h[m>>>3]>>>(m&7)&1;f(i,S,N),f(C,F,N),E(L,i,C),y(i,i,C),E(C,S,F),y(S,S,F),b(F,L),b(j,i),v(i,C,i),v(C,S,L),E(L,i,C),y(i,i,C),b(S,i),y(C,F,j),v(i,C,l),E(i,i,F),v(C,C,i),v(i,F,j),v(F,S,t),b(S,L),f(i,S,N),f(C,F,N)}for(let m=0;m<16;m++)t[m+16]=i[m],t[m+32]=C[m],t[m+48]=S[m],t[m+64]=F[m];const B=t.subarray(32),T=t.subarray(16);g(B,B),v(T,T,B);const M=new Uint8Array(32);return c(M,T),M}e.scalarMult=A;function p(u){return A(u,D)}e.scalarMultBase=p;function O(u){if(u.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const s=new Uint8Array(u);return{publicKey:p(s),secretKey:s}}e.generateKeyPairFromSeed=O;function o(u){const s=(0,r.randomBytes)(32,u),h=O(s);return(0,n.wipe)(s),h}e.generateKeyPair=o;function _(u,s,h=!1){if(u.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(s.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const t=A(u,s);if(h){let i=0;for(let S=0;S<t.length;S++)i|=t[S];if(i===0)throw new Error("X25519: invalid shared key")}return t}e.sharedKey=_})(Ft);function mr(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),a=0;a<n.length;a++)n[a]=255;for(var D=0;D<e.length;D++){var l=e.charAt(D),w=l.charCodeAt(0);if(n[w]!==255)throw new TypeError(l+" is ambiguous");n[w]=D}var f=e.length,c=e.charAt(0),d=Math.log(f)/Math.log(256),E=Math.log(256)/Math.log(f);function y(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var A=0,p=0,O=0,o=g.length;O!==o&&g[O]===0;)O++,A++;for(var _=(o-O)*E+1>>>0,u=new Uint8Array(_);O!==o;){for(var s=g[O],h=0,t=_-1;(s!==0||h<p)&&t!==-1;t--,h++)s+=256*u[t]>>>0,u[t]=s%f>>>0,s=s/f>>>0;if(s!==0)throw new Error("Non-zero carry");p=h,O++}for(var i=_-p;i!==_&&u[i]===0;)i++;for(var S=c.repeat(A);i<_;++i)S+=e.charAt(u[i]);return S}function v(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var A=0;if(g[A]!==" "){for(var p=0,O=0;g[A]===c;)p++,A++;for(var o=(g.length-A)*d+1>>>0,_=new Uint8Array(o);g[A];){var u=n[g.charCodeAt(A)];if(u===255)return;for(var s=0,h=o-1;(u!==0||s<O)&&h!==-1;h--,s++)u+=f*_[h]>>>0,_[h]=u%256>>>0,u=u/256>>>0;if(u!==0)throw new Error("Non-zero carry");O=s,A++}if(g[A]!==" "){for(var t=o-O;t!==o&&_[t]===0;)t++;for(var i=new Uint8Array(p+(o-t)),S=p;t!==o;)i[S++]=_[t++];return i}}}function b(g){var A=v(g);if(A)return A;throw new Error(`Non-${r} character`)}return{encode:y,decodeUnsafe:v,decode:b}}var Cr=mr,pr=Cr;const Ar=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Ur=e=>new TextEncoder().encode(e),Or=e=>new TextDecoder().decode(e);class Fr{constructor(r,n,a){this.name=r,this.prefix=n,this.baseEncode=a}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Nr{constructor(r,n,a){if(this.name=r,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=a}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return Nt(this,r)}}class Tr{constructor(r){this.decoders=r}or(r){return Nt(this,r)}decode(r){const n=r[0],a=this.decoders[n];if(a)return a.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Nt=(e,r)=>new Tr({...e.decoders||{[e.prefix]:e},...r.decoders||{[r.prefix]:r}});class Mr{constructor(r,n,a,D){this.name=r,this.prefix=n,this.baseEncode=a,this.baseDecode=D,this.encoder=new Fr(r,n,a),this.decoder=new Nr(r,n,D)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const je=({name:e,prefix:r,encode:n,decode:a})=>new Mr(e,r,n,a),Oe=({prefix:e,name:r,alphabet:n})=>{const{encode:a,decode:D}=pr(n,r);return je({prefix:e,name:r,encode:a,decode:l=>Ar(D(l))})},xr=(e,r,n,a)=>{const D={};for(let E=0;E<r.length;++E)D[r[E]]=E;let l=e.length;for(;e[l-1]==="=";)--l;const w=new Uint8Array(l*n/8|0);let f=0,c=0,d=0;for(let E=0;E<l;++E){const y=D[e[E]];if(y===void 0)throw new SyntaxError(`Non-${a} character`);c=c<<n|y,f+=n,f>=8&&(f-=8,w[d++]=255&c>>f)}if(f>=n||255&c<<8-f)throw new SyntaxError("Unexpected end of data");return w},Lr=(e,r,n)=>{const a=r[r.length-1]==="=",D=(1<<n)-1;let l="",w=0,f=0;for(let c=0;c<e.length;++c)for(f=f<<8|e[c],w+=8;w>n;)w-=n,l+=r[D&f>>w];if(w&&(l+=r[D&f<<n-w]),a)for(;l.length*n&7;)l+="=";return l},Q=({name:e,prefix:r,bitsPerChar:n,alphabet:a})=>je({prefix:r,name:e,encode(D){return Lr(D,a,n)},decode(D){return xr(D,a,n,e)}}),Br=je({prefix:"\0",name:"identity",encode:e=>Or(e),decode:e=>Ur(e)}),jr=Object.freeze(Object.defineProperty({__proto__:null,identity:Br},Symbol.toStringTag,{value:"Module"})),Ir=Q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Rr=Object.freeze(Object.defineProperty({__proto__:null,base2:Ir},Symbol.toStringTag,{value:"Module"})),Pr=Q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Hr=Object.freeze(Object.defineProperty({__proto__:null,base8:Pr},Symbol.toStringTag,{value:"Module"})),Kr=Oe({prefix:"9",name:"base10",alphabet:"0123456789"}),zr=Object.freeze(Object.defineProperty({__proto__:null,base10:Kr},Symbol.toStringTag,{value:"Module"})),Yr=Q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qr=Q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),$r=Object.freeze(Object.defineProperty({__proto__:null,base16:Yr,base16upper:qr},Symbol.toStringTag,{value:"Module"})),Gr=Q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Vr=Q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wr=Q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Xr=Q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Jr=Q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Qr=Q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zr=Q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),kr=Q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),en=Q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),tn=Object.freeze(Object.defineProperty({__proto__:null,base32:Gr,base32hex:Jr,base32hexpad:Zr,base32hexpadupper:kr,base32hexupper:Qr,base32pad:Wr,base32padupper:Xr,base32upper:Vr,base32z:en},Symbol.toStringTag,{value:"Module"})),rn=Oe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),nn=Oe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),an=Object.freeze(Object.defineProperty({__proto__:null,base36:rn,base36upper:nn},Symbol.toStringTag,{value:"Module"})),un=Oe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fn=Oe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),hn=Object.freeze(Object.defineProperty({__proto__:null,base58btc:un,base58flickr:fn},Symbol.toStringTag,{value:"Module"})),sn=Q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),on=Q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cn=Q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ln=Q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Dn=Object.freeze(Object.defineProperty({__proto__:null,base64:sn,base64pad:on,base64url:cn,base64urlpad:ln},Symbol.toStringTag,{value:"Module"})),Tt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),_n=Tt.reduce((e,r,n)=>(e[n]=r,e),[]),dn=Tt.reduce((e,r,n)=>(e[r.codePointAt(0)]=n,e),[]);function En(e){return e.reduce((r,n)=>(r+=_n[n],r),"")}function bn(e){const r=[];for(const n of e){const a=dn[n.codePointAt(0)];if(a===void 0)throw new Error(`Non-base256emoji character: ${n}`);r.push(a)}return new Uint8Array(r)}const vn=je({prefix:"🚀",name:"base256emoji",encode:En,decode:bn}),wn=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:vn},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var Mt={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var g=(d,e,t)=>e in d?y(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var i=(d,e,t)=>(g(d,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-Tl7zYqHL.js"),o=require("./aptos-tCZHrDAP.js"),f=require("./chain-BT07YJHt.js");class k{constructor(e,t,s,n,a=!1){i(this,"transaction");i(this,"network");i(this,"chain");i(this,"description");i(this,"parallelizable");this.transaction=e,this.network=t,this.chain=s,this.description=n,this.parallelizable=a}}const w=[{name:"tokenBridgeAddress",...r.universalAddressItem},{name:"chain",...r.chainItem()},{name:"domainSeparator",binary:"bytes",custom:r.bytes.encode(o.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...r.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],m=d=>r.serializeLayout(w,d);class c{constructor(e,t,s,n){i(this,"network");i(this,"chain");i(this,"connection");i(this,"contracts");i(this,"chainId");i(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=s,this.contracts=n,this.chainId=r.toChainId(t);const a=n.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=a}static async fromRpc(e,t){const[s,n]=await o.AptosPlatform.chainFromRpc(e),a=t[n];if(a.network!==s)throw new Error("Network mismatch "+a.network+" !== "+s);return new c(s,n,e,a.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(o.APTOS_SEPARATOR);let s;if(s=(await this.connection.getAccountResource(t[0],`${this.tokenBridgeAddress}::state::OriginInfo`)).data,!s)throw r.ErrNotWrapped;const n=r.toChain(parseInt(s.token_chain.number)),a=new r.UniversalAddress(s.token_address.external_address);return{chain:n,address:a}}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource(o.coalesceModuleAddress(t),`${this.tokenBridgeAddress}::state::OriginInfo`),r.toNative(this.chain,t)}async isTransferCompleted(e){const s=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data.consumed_vaas.elems.handle;try{return await this.connection.getTableItem(s,{key_type:"vector<u8>",value_type:"u8",key:`0x${r.dist.Buffer.from(r.keccak_256(e.hash)).toString("hex")}`}),!0}catch{return!1}}async getWrappedNative(){return r.toNative(this.chain,o.APTOS_COIN)}async*createAttestation(e,t){const s={chain:this.chain,address:new o.AptosAddress(e)},n=await this.getAssetFullyQualifiedType(s);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,type_arguments:[n],arguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,type_arguments:[],arguments:[r.serialize(e)]},"Aptos.CreateWrappedCoinType");const s=await this.getAssetFullyQualifiedType(e.payload.token);if(!s)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,type_arguments:[s],arguments:[r.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,s,n,a){const A=0n,h=0n,l=r.isNative(s)?o.APTOS_COIN:s.toString(),u=t.address.toUniversalAddress().toUint8Array(),p=r.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,type_arguments:[l],arguments:[n,p,u,h,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,type_arguments:[l],arguments:[n,p,u,A,h]},"Aptos.TransferTokens")}async*redeem(e,t,s=!0){const n=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,type_arguments:[n],arguments:[r.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?o.isValidAptosType(e.address.toString())?e.address.toString():null:`${c.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data,{handle:s}=t.native_infos,n=await this.connection.getTableItem(s,{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}});return n?[n.account_address,r.hex.decode(n.module_name),r.hex.decode(n.struct_name)].join(o.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,s){if(r.isNative(s.address))throw new Error("Invalid token address");const n=m({chain:s.chain,tokenBridgeAddress:new o.AptosAddress(t).toUniversalAddress(),tokenId:s.address.toUniversalAddress()});return r.hex.encode(r.sha3_256(n),!0)}createUnsignedTx(e,t,s=!1){return new k(e,this.network,this.chain,t,s)}}f.registerProtocol("Aptos","TokenBridge",c);exports.AptosTokenBridge=c;
1
+ "use strict";var y=Object.defineProperty;var g=(d,e,t)=>e in d?y(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var i=(d,e,t)=>(g(d,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-C1oy9Lkm.js"),o=require("./aptos-CXyHqFt8.js"),f=require("./chain-BteoJHpg.js");class k{constructor(e,t,s,n,a=!1){i(this,"transaction");i(this,"network");i(this,"chain");i(this,"description");i(this,"parallelizable");this.transaction=e,this.network=t,this.chain=s,this.description=n,this.parallelizable=a}}const w=[{name:"tokenBridgeAddress",...r.universalAddressItem},{name:"chain",...r.chainItem()},{name:"domainSeparator",binary:"bytes",custom:r.bytes.encode(o.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...r.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],m=d=>r.serializeLayout(w,d);class c{constructor(e,t,s,n){i(this,"network");i(this,"chain");i(this,"connection");i(this,"contracts");i(this,"chainId");i(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=s,this.contracts=n,this.chainId=r.toChainId(t);const a=n.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=a}static async fromRpc(e,t){const[s,n]=await o.AptosPlatform.chainFromRpc(e),a=t[n];if(a.network!==s)throw new Error("Network mismatch "+a.network+" !== "+s);return new c(s,n,e,a.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(o.APTOS_SEPARATOR);let s;if(s=(await this.connection.getAccountResource(t[0],`${this.tokenBridgeAddress}::state::OriginInfo`)).data,!s)throw r.ErrNotWrapped;const n=r.toChain(parseInt(s.token_chain.number)),a=new r.UniversalAddress(s.token_address.external_address);return{chain:n,address:a}}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource(o.coalesceModuleAddress(t),`${this.tokenBridgeAddress}::state::OriginInfo`),r.toNative(this.chain,t)}async isTransferCompleted(e){const s=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data.consumed_vaas.elems.handle;try{return await this.connection.getTableItem(s,{key_type:"vector<u8>",value_type:"u8",key:`0x${r.dist.Buffer.from(r.keccak_256(e.hash)).toString("hex")}`}),!0}catch{return!1}}async getWrappedNative(){return r.toNative(this.chain,o.APTOS_COIN)}async*createAttestation(e,t){const s={chain:this.chain,address:new o.AptosAddress(e)},n=await this.getAssetFullyQualifiedType(s);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,type_arguments:[n],arguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,type_arguments:[],arguments:[r.serialize(e)]},"Aptos.CreateWrappedCoinType");const s=await this.getAssetFullyQualifiedType(e.payload.token);if(!s)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,type_arguments:[s],arguments:[r.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,s,n,a){const A=0n,h=0n,l=r.isNative(s)?o.APTOS_COIN:s.toString(),u=t.address.toUniversalAddress().toUint8Array(),p=r.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,type_arguments:[l],arguments:[n,p,u,h,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,type_arguments:[l],arguments:[n,p,u,A,h]},"Aptos.TransferTokens")}async*redeem(e,t,s=!0){const n=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,type_arguments:[n],arguments:[r.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?o.isValidAptosType(e.address.toString())?e.address.toString():null:`${c.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data,{handle:s}=t.native_infos,n=await this.connection.getTableItem(s,{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}});return n?[n.account_address,r.hex.decode(n.module_name),r.hex.decode(n.struct_name)].join(o.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,s){if(r.isNative(s.address))throw new Error("Invalid token address");const n=m({chain:s.chain,tokenBridgeAddress:new o.AptosAddress(t).toUniversalAddress(),tokenId:s.address.toUniversalAddress()});return r.hex.encode(r.sha3_256(n),!0)}createUnsignedTx(e,t,s=!1){return new k(e,this.network,this.chain,t,s)}}f.registerProtocol("Aptos","TokenBridge",c);exports.AptosTokenBridge=c;
@@ -1,11 +1,11 @@
1
1
  var N = Object.defineProperty;
2
2
  var W = (h, t, e) => t in h ? N(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
3
3
  var c = (h, t, e) => (W(h, typeof t != "symbol" ? t + "" : t, e), e);
4
- import "./index-CokIAiMa.mjs";
5
- import { C as p, a as i, G as v, _ as x } from "./cosmwasm-CbTKetWD.mjs";
6
- import { b as o, c as g, C as E } from "./unsignedTransaction-BbAfXtog.mjs";
7
- import { az as u, b4 as d, bp as B, bO as S, c6 as q, au as I, b_ as y } from "./index-CdSy2Lfd.mjs";
8
- import { r as D } from "./chain-CbwtJlkc.mjs";
4
+ import "./index-DX18kVfL.mjs";
5
+ import { C as p, a as i, G as v, _ as x } from "./cosmwasm-BHEBPmf7.mjs";
6
+ import { b as o, c as g, C as E } from "./unsignedTransaction-CtPR6znR.mjs";
7
+ import { az as u, b4 as d, bp as B, bO as S, c6 as q, au as I, b_ as y } from "./index-D4oa5qLu.mjs";
8
+ import { r as D } from "./chain-Cc-vL0Ji.mjs";
9
9
  class k {
10
10
  constructor(t, e, r, s) {
11
11
  c(this, "network");
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./index-Tl7zYqHL.js"),F=require("./index-Bfw-brA6.js"),I=require("./browser-Cz60hQ-L.js");var le={};Object.defineProperty(le,"__esModule",{value:!0});le.getLocalStorage=le.getLocalStorageOrThrow=le.getCrypto=le.getCryptoOrThrow=le.getLocation=le.getLocationOrThrow=le.getNavigator=le.getNavigatorOrThrow=le.getDocument=le.getDocumentOrThrow=le.getFromWindowOrThrow=le.getFromWindow=void 0;function lr(o){let t;return typeof window<"u"&&typeof window[o]<"u"&&(t=window[o]),t}le.getFromWindow=lr;function Fr(o){const t=lr(o);if(!t)throw new Error(`${o} is not defined in Window`);return t}le.getFromWindowOrThrow=Fr;function nw(){return Fr("document")}le.getDocumentOrThrow=nw;function ow(){return lr("document")}le.getDocument=ow;function aw(){return Fr("navigator")}le.getNavigatorOrThrow=aw;function cw(){return lr("navigator")}le.getNavigator=cw;function uw(){return Fr("location")}le.getLocationOrThrow=uw;function hw(){return lr("location")}le.getLocation=hw;function lw(){return Fr("crypto")}le.getCryptoOrThrow=lw;function pw(){return lr("crypto")}le.getCrypto=pw;function dw(){return Fr("localStorage")}le.getLocalStorageOrThrow=dw;function fw(){return lr("localStorage")}le.getLocalStorage=fw;var $o={};Object.defineProperty($o,"__esModule",{value:!0});$o.getWindowMetadata=void 0;const Pu=le;function gw(){let o,t;try{o=Pu.getDocumentOrThrow(),t=Pu.getLocationOrThrow()}catch{return null}function r(){const R=o.getElementsByTagName("link"),N=[];for(let M=0;M<R.length;M++){const C=R[M],V=C.getAttribute("rel");if(V&&V.toLowerCase().indexOf("icon")>-1){const q=C.getAttribute("href");if(q)if(q.toLowerCase().indexOf("https:")===-1&&q.toLowerCase().indexOf("http:")===-1&&q.indexOf("//")!==0){let Y=t.protocol+"//"+t.host;if(q.indexOf("/")===0)Y+=q;else{const me=t.pathname.split("/");me.pop();const te=me.join("/");Y+=te+"/"+q}N.push(Y)}else if(q.indexOf("//")===0){const Y=t.protocol+q;N.push(Y)}else N.push(q)}}return N}function s(...R){const N=o.getElementsByTagName("meta");for(let M=0;M<N.length;M++){const C=N[M],V=["itemprop","property","name"].map(q=>C.getAttribute(q)).filter(q=>q?R.includes(q):!1);if(V.length&&V){const q=C.getAttribute("content");if(q)return q}}return""}function a(){let R=s("name","og:site_name","og:title","twitter:title");return R||(R=o.title),R}function u(){return s("description","og:description","twitter:description","keywords")}const l=a(),f=u(),w=t.origin,_=r();return{description:f,url:w,icons:_,name:l}}$o.getWindowMetadata=gw;function yw(o,t=[]){const r=[];return Object.keys(o).forEach(s=>{if(t.length&&!t.includes(s))return;const a=o[s];r.push(...a.accounts)}),r}const mw={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}};function vw(o,t){const{message:r,code:s}=mw[o];return{message:r,code:s}}function wo(o,t){return!!Array.isArray(o)}const ww=o=>JSON.stringify(o,(t,r)=>typeof r=="bigint"?r.toString()+"n":r),bw=o=>{const t=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=o.replace(t,'$1"$2n"$3');return JSON.parse(r,(s,a)=>typeof a=="string"&&a.match(/^\d+n$/)?BigInt(a.substring(0,a.length-1)):a)};function xo(o){if(typeof o!="string")throw new Error(`Cannot safe json parse value of type ${typeof o}`);try{return bw(o)}catch{return o}}function Do(o){return typeof o=="string"?o:ww(o)||""}const _w="idb-keyval";var Ew=(o={})=>{const t=o.base&&o.base.length>0?`${o.base}:`:"",r=a=>t+a;let s;return o.dbName&&o.storeName&&(s=I.createStore(o.dbName,o.storeName)),{name:_w,options:o,async hasItem(a){return!(typeof await I.get(r(a),s)>"u")},async getItem(a){return await I.get(r(a),s)??null},setItem(a,u){return I.set(r(a),u,s)},removeItem(a){return I.del(r(a),s)},getKeys(){return I.keys(s)},clear(){return I.clear(s)}}};const Iw="WALLET_CONNECT_V2_INDEXED_DB",Pw="keyvaluestorage";let Sw=class{constructor(){this.indexedDb=I.createStorage({driver:Ew({dbName:Iw,storeName:Pw})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const r=await this.indexedDb.getItem(t);if(r!==null)return r}async setItem(t,r){await this.indexedDb.setItem(t,Do(r))}async removeItem(t){await this.indexedDb.removeItem(t)}};var so=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof H.dist.global<"u"?H.dist.global:typeof self<"u"?self:{},Es={exports:{}};(function(){let o;function t(){}o=t,o.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},o.prototype.setItem=function(r,s){this[r]=String(s)},o.prototype.removeItem=function(r){delete this[r]},o.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(s){r[s]=void 0,delete r[s]})},o.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},o.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof so<"u"&&so.localStorage?Es.exports=so.localStorage:typeof window<"u"&&window.localStorage?Es.exports=window.localStorage:Es.exports=new t})();function Ow(o){var t;return[o[0],xo((t=o[1])!=null?t:"")]}let Rw=class{constructor(){this.localStorage=Es.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Ow)}async getItem(t){const r=this.localStorage.getItem(t);if(r!==null)return xo(r)}async setItem(t,r){this.localStorage.setItem(t,Do(r))}async removeItem(t){this.localStorage.removeItem(t)}};const Aw="wc_storage_version",Su=1,Nw=async(o,t,r)=>{const s=Aw,a=await t.getItem(s);if(a&&a>=Su){r(t);return}const u=await o.getKeys();if(!u.length){r(t);return}const l=[];for(;u.length;){const f=u.shift();if(!f)continue;const w=f.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const _=await o.getItem(f);await t.setItem(f,_),l.push(f)}}await t.setItem(s,Su),r(t),Tw(o,l)},Tw=async(o,t)=>{t.length&&t.forEach(async r=>{await o.removeItem(r)})};let Cw=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const t=new Rw;this.storage=t;try{const r=new Sw;Nw(t,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,r){return await this.initialize(),this.storage.setItem(t,r)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),t())},20)})}};var jr={};/*! *****************************************************************************
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./index-C1oy9Lkm.js"),F=require("./index-oVIYJXdI.js"),I=require("./browser-DEzmpMBm.js");var le={};Object.defineProperty(le,"__esModule",{value:!0});le.getLocalStorage=le.getLocalStorageOrThrow=le.getCrypto=le.getCryptoOrThrow=le.getLocation=le.getLocationOrThrow=le.getNavigator=le.getNavigatorOrThrow=le.getDocument=le.getDocumentOrThrow=le.getFromWindowOrThrow=le.getFromWindow=void 0;function lr(o){let t;return typeof window<"u"&&typeof window[o]<"u"&&(t=window[o]),t}le.getFromWindow=lr;function Fr(o){const t=lr(o);if(!t)throw new Error(`${o} is not defined in Window`);return t}le.getFromWindowOrThrow=Fr;function nw(){return Fr("document")}le.getDocumentOrThrow=nw;function ow(){return lr("document")}le.getDocument=ow;function aw(){return Fr("navigator")}le.getNavigatorOrThrow=aw;function cw(){return lr("navigator")}le.getNavigator=cw;function uw(){return Fr("location")}le.getLocationOrThrow=uw;function hw(){return lr("location")}le.getLocation=hw;function lw(){return Fr("crypto")}le.getCryptoOrThrow=lw;function pw(){return lr("crypto")}le.getCrypto=pw;function dw(){return Fr("localStorage")}le.getLocalStorageOrThrow=dw;function fw(){return lr("localStorage")}le.getLocalStorage=fw;var $o={};Object.defineProperty($o,"__esModule",{value:!0});$o.getWindowMetadata=void 0;const Pu=le;function gw(){let o,t;try{o=Pu.getDocumentOrThrow(),t=Pu.getLocationOrThrow()}catch{return null}function r(){const R=o.getElementsByTagName("link"),N=[];for(let M=0;M<R.length;M++){const C=R[M],V=C.getAttribute("rel");if(V&&V.toLowerCase().indexOf("icon")>-1){const q=C.getAttribute("href");if(q)if(q.toLowerCase().indexOf("https:")===-1&&q.toLowerCase().indexOf("http:")===-1&&q.indexOf("//")!==0){let Y=t.protocol+"//"+t.host;if(q.indexOf("/")===0)Y+=q;else{const me=t.pathname.split("/");me.pop();const te=me.join("/");Y+=te+"/"+q}N.push(Y)}else if(q.indexOf("//")===0){const Y=t.protocol+q;N.push(Y)}else N.push(q)}}return N}function s(...R){const N=o.getElementsByTagName("meta");for(let M=0;M<N.length;M++){const C=N[M],V=["itemprop","property","name"].map(q=>C.getAttribute(q)).filter(q=>q?R.includes(q):!1);if(V.length&&V){const q=C.getAttribute("content");if(q)return q}}return""}function a(){let R=s("name","og:site_name","og:title","twitter:title");return R||(R=o.title),R}function u(){return s("description","og:description","twitter:description","keywords")}const l=a(),f=u(),w=t.origin,_=r();return{description:f,url:w,icons:_,name:l}}$o.getWindowMetadata=gw;function yw(o,t=[]){const r=[];return Object.keys(o).forEach(s=>{if(t.length&&!t.includes(s))return;const a=o[s];r.push(...a.accounts)}),r}const mw={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}};function vw(o,t){const{message:r,code:s}=mw[o];return{message:r,code:s}}function wo(o,t){return!!Array.isArray(o)}const ww=o=>JSON.stringify(o,(t,r)=>typeof r=="bigint"?r.toString()+"n":r),bw=o=>{const t=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=o.replace(t,'$1"$2n"$3');return JSON.parse(r,(s,a)=>typeof a=="string"&&a.match(/^\d+n$/)?BigInt(a.substring(0,a.length-1)):a)};function xo(o){if(typeof o!="string")throw new Error(`Cannot safe json parse value of type ${typeof o}`);try{return bw(o)}catch{return o}}function Do(o){return typeof o=="string"?o:ww(o)||""}const _w="idb-keyval";var Ew=(o={})=>{const t=o.base&&o.base.length>0?`${o.base}:`:"",r=a=>t+a;let s;return o.dbName&&o.storeName&&(s=I.createStore(o.dbName,o.storeName)),{name:_w,options:o,async hasItem(a){return!(typeof await I.get(r(a),s)>"u")},async getItem(a){return await I.get(r(a),s)??null},setItem(a,u){return I.set(r(a),u,s)},removeItem(a){return I.del(r(a),s)},getKeys(){return I.keys(s)},clear(){return I.clear(s)}}};const Iw="WALLET_CONNECT_V2_INDEXED_DB",Pw="keyvaluestorage";let Sw=class{constructor(){this.indexedDb=I.createStorage({driver:Ew({dbName:Iw,storeName:Pw})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const r=await this.indexedDb.getItem(t);if(r!==null)return r}async setItem(t,r){await this.indexedDb.setItem(t,Do(r))}async removeItem(t){await this.indexedDb.removeItem(t)}};var so=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof H.dist.global<"u"?H.dist.global:typeof self<"u"?self:{},Es={exports:{}};(function(){let o;function t(){}o=t,o.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},o.prototype.setItem=function(r,s){this[r]=String(s)},o.prototype.removeItem=function(r){delete this[r]},o.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(s){r[s]=void 0,delete r[s]})},o.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},o.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof so<"u"&&so.localStorage?Es.exports=so.localStorage:typeof window<"u"&&window.localStorage?Es.exports=window.localStorage:Es.exports=new t})();function Ow(o){var t;return[o[0],xo((t=o[1])!=null?t:"")]}let Rw=class{constructor(){this.localStorage=Es.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Ow)}async getItem(t){const r=this.localStorage.getItem(t);if(r!==null)return xo(r)}async setItem(t,r){this.localStorage.setItem(t,Do(r))}async removeItem(t){this.localStorage.removeItem(t)}};const Aw="wc_storage_version",Su=1,Nw=async(o,t,r)=>{const s=Aw,a=await t.getItem(s);if(a&&a>=Su){r(t);return}const u=await o.getKeys();if(!u.length){r(t);return}const l=[];for(;u.length;){const f=u.shift();if(!f)continue;const w=f.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const _=await o.getItem(f);await t.setItem(f,_),l.push(f)}}await t.setItem(s,Su),r(t),Tw(o,l)},Tw=async(o,t)=>{t.length&&t.forEach(async r=>{await o.removeItem(r)})};let Cw=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const t=new Rw;this.storage=t;try{const r=new Sw;Nw(t,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,r){return await this.initialize(),this.storage.setItem(t,r)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),t())},20)})}};var jr={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -43,4 +43,4 @@ __p += '`),ee&&(A+=`' +
43
43
  function print() { __p += __j.call(arguments, '') }
44
44
  `:`;
45
45
  `)+A+`return __p
46
- }`;var G=_u(function(){return ie(d,U+"return "+A).apply(r,g)});if(G.source=A,Wn(G))throw G;return G}function pv(e){return se(e).toLowerCase()}function dv(e){return se(e).toUpperCase()}function fv(e,i,n){if(e=se(e),e&&(n||i===r))return Ta(e);if(!e||!(i=Ye(i)))return e;var c=ft(e),h=ft(i),d=Ca(c,h),g=$a(c,h)+1;return Wt(c,d,g).join("")}function gv(e,i,n){if(e=se(e),e&&(n||i===r))return e.slice(0,Da(e)+1);if(!e||!(i=Ye(i)))return e;var c=ft(e),h=$a(c,ft(i))+1;return Wt(c,0,h).join("")}function yv(e,i,n){if(e=se(e),e&&(n||i===r))return e.replace(Ks,"");if(!e||!(i=Ye(i)))return e;var c=ft(e),h=Ca(c,ft(i));return Wt(c,h).join("")}function mv(e,i){var n=Ds,c=rt;if(be(i)){var h="separator"in i?i.separator:h;n="length"in i?W(i.length):n,c="omission"in i?Ye(i.omission):c}e=se(e);var d=e.length;if(wr(e)){var g=ft(e);d=g.length}if(n>=d)return e;var y=n-br(c);if(y<1)return c;var v=g?Wt(g,0,y).join(""):e.slice(0,y);if(h===r)return v+c;if(g&&(y+=v.length-y),Jn(h)){if(e.slice(y).search(h)){var S,O=v;for(h.global||(h=hn(h.source,se(Zo.exec(h))+"g")),h.lastIndex=0;S=h.exec(O);)var A=S.index;v=v.slice(0,A===r?y:A)}}else if(e.indexOf(Ye(h),y)!=y){var D=v.lastIndexOf(h);D>-1&&(v=v.slice(0,D))}return v+c}function vv(e){return e=se(e),e&&Al.test(e)?e.replace(Go,Kp):e}var wv=Rr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Yn=Ec("toUpperCase");function bu(e,i,n){return e=se(e),i=n?r:i,i===r?kp(e)?Gp(e):$p(e):e.match(i)||[]}var _u=Q(function(e,i){try{return Ge(e,r,i)}catch(n){return Wn(n)?n:new B(n)}}),bv=Ct(function(e,i){return st(i,function(n){n=It(n),Nt(e,n,Vn(e[n],e))}),e});function _v(e){var i=e==null?0:e.length,n=L();return e=i?ge(e,function(c){if(typeof c[1]!="function")throw new nt(l);return[n(c[0]),c[1]]}):[],Q(function(c){for(var h=-1;++h<i;){var d=e[h];if(Ge(d[0],this,c))return Ge(d[1],this,c)}})}function Ev(e){return Kd(at(e,R))}function Zn(e){return function(){return e}}function Iv(e,i){return e==null||e!==e?i:e}var Pv=Pc(),Sv=Pc(!0);function Ve(e){return e}function Xn(e){return ec(typeof e=="function"?e:at(e,R))}function Ov(e){return rc(at(e,R))}function Rv(e,i){return ic(e,at(i,R))}var Av=Q(function(e,i){return function(n){return si(n,e,i)}}),Nv=Q(function(e,i){return function(n){return si(e,n,i)}});function eo(e,i,n){var c=Ae(i),h=Zi(i,c);n==null&&!(be(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Zi(i,Ae(i)));var d=!(be(n)&&"chain"in n)||!!n.chain,g=xt(e);return st(h,function(y){var v=i[y];e[y]=v,g&&(e.prototype[y]=function(){var S=this.__chain__;if(d||S){var O=e(this.__wrapped__),A=O.__actions__=ze(this.__actions__);return A.push({func:v,args:arguments,thisArg:e}),O.__chain__=S,O}return v.apply(e,kt([this.value()],arguments))})}),e}function Tv(){return Ce._===this&&(Ce._=td),this}function to(){}function Cv(e){return e=W(e),Q(function(i){return sc(i,e)})}var $v=$n(ge),xv=$n(Sa),Dv=$n(rn);function Eu(e){return Mn(e)?sn(It(e)):hf(e)}function Fv(e){return function(i){return e==null?r:sr(e,i)}}var jv=Oc(),qv=Oc(!0);function ro(){return[]}function io(){return!1}function Uv(){return{}}function Mv(){return""}function Lv(){return!0}function kv(e,i){if(e=W(e),e<1||e>ue)return[];var n=De,c=Fe(e,De);i=L(i),e-=De;for(var h=an(c,i);++n<e;)i(n);return h}function zv(e){return K(e)?ge(e,It):Ze(e)?[e]:ze(zc(se(e)))}function Hv(e){var i=++Xp;return se(e)+i}var Bv=ss(function(e,i){return e+i},0),Vv=xn("ceil"),Kv=ss(function(e,i){return e/i},1),Wv=xn("floor");function Jv(e){return e&&e.length?Yi(e,Ve,vn):r}function Gv(e,i){return e&&e.length?Yi(e,L(i,2),vn):r}function Qv(e){return Aa(e,Ve)}function Yv(e,i){return Aa(e,L(i,2))}function Zv(e){return e&&e.length?Yi(e,Ve,En):r}function Xv(e,i){return e&&e.length?Yi(e,L(i,2),En):r}var ew=ss(function(e,i){return e*i},1),tw=xn("round"),rw=ss(function(e,i){return e-i},0);function iw(e){return e&&e.length?on(e,Ve):0}function sw(e,i){return e&&e.length?on(e,L(i,2)):0}return p.after=Oy,p.ary=Xc,p.assign=dm,p.assignIn=du,p.assignInWith=ms,p.assignWith=fm,p.at=gm,p.before=eu,p.bind=Vn,p.bindAll=bv,p.bindKey=tu,p.castArray=Uy,p.chain=Qc,p.chunk=Wf,p.compact=Jf,p.concat=Gf,p.cond=_v,p.conforms=Ev,p.constant=Zn,p.countBy=iy,p.create=ym,p.curry=ru,p.curryRight=iu,p.debounce=su,p.defaults=mm,p.defaultsDeep=vm,p.defer=Ry,p.delay=Ay,p.difference=Qf,p.differenceBy=Yf,p.differenceWith=Zf,p.drop=Xf,p.dropRight=eg,p.dropRightWhile=tg,p.dropWhile=rg,p.fill=ig,p.filter=ny,p.flatMap=cy,p.flatMapDeep=uy,p.flatMapDepth=hy,p.flatten=Kc,p.flattenDeep=sg,p.flattenDepth=ng,p.flip=Ny,p.flow=Pv,p.flowRight=Sv,p.fromPairs=og,p.functions=Sm,p.functionsIn=Om,p.groupBy=ly,p.initial=cg,p.intersection=ug,p.intersectionBy=hg,p.intersectionWith=lg,p.invert=Am,p.invertBy=Nm,p.invokeMap=dy,p.iteratee=Xn,p.keyBy=fy,p.keys=Ae,p.keysIn=Be,p.map=ls,p.mapKeys=Cm,p.mapValues=$m,p.matches=Ov,p.matchesProperty=Rv,p.memoize=ds,p.merge=xm,p.mergeWith=fu,p.method=Av,p.methodOf=Nv,p.mixin=eo,p.negate=fs,p.nthArg=Cv,p.omit=Dm,p.omitBy=Fm,p.once=Ty,p.orderBy=gy,p.over=$v,p.overArgs=Cy,p.overEvery=xv,p.overSome=Dv,p.partial=Kn,p.partialRight=nu,p.partition=yy,p.pick=jm,p.pickBy=gu,p.property=Eu,p.propertyOf=Fv,p.pull=gg,p.pullAll=Jc,p.pullAllBy=yg,p.pullAllWith=mg,p.pullAt=vg,p.range=jv,p.rangeRight=qv,p.rearg=$y,p.reject=wy,p.remove=wg,p.rest=xy,p.reverse=Hn,p.sampleSize=_y,p.set=Um,p.setWith=Mm,p.shuffle=Ey,p.slice=bg,p.sortBy=Sy,p.sortedUniq=Rg,p.sortedUniqBy=Ag,p.split=cv,p.spread=Dy,p.tail=Ng,p.take=Tg,p.takeRight=Cg,p.takeRightWhile=$g,p.takeWhile=xg,p.tap=Jg,p.throttle=Fy,p.thru=hs,p.toArray=hu,p.toPairs=yu,p.toPairsIn=mu,p.toPath=zv,p.toPlainObject=pu,p.transform=Lm,p.unary=jy,p.union=Dg,p.unionBy=Fg,p.unionWith=jg,p.uniq=qg,p.uniqBy=Ug,p.uniqWith=Mg,p.unset=km,p.unzip=Bn,p.unzipWith=Gc,p.update=zm,p.updateWith=Hm,p.values=Tr,p.valuesIn=Bm,p.without=Lg,p.words=bu,p.wrap=qy,p.xor=kg,p.xorBy=zg,p.xorWith=Hg,p.zip=Bg,p.zipObject=Vg,p.zipObjectDeep=Kg,p.zipWith=Wg,p.entries=yu,p.entriesIn=mu,p.extend=du,p.extendWith=ms,eo(p,p),p.add=Bv,p.attempt=_u,p.camelCase=Jm,p.capitalize=vu,p.ceil=Vv,p.clamp=Vm,p.clone=My,p.cloneDeep=ky,p.cloneDeepWith=zy,p.cloneWith=Ly,p.conformsTo=Hy,p.deburr=wu,p.defaultTo=Iv,p.divide=Kv,p.endsWith=Gm,p.eq=yt,p.escape=Qm,p.escapeRegExp=Ym,p.every=sy,p.find=oy,p.findIndex=Bc,p.findKey=wm,p.findLast=ay,p.findLastIndex=Vc,p.findLastKey=bm,p.floor=Wv,p.forEach=Yc,p.forEachRight=Zc,p.forIn=_m,p.forInRight=Em,p.forOwn=Im,p.forOwnRight=Pm,p.get=Gn,p.gt=By,p.gte=Vy,p.has=Rm,p.hasIn=Qn,p.head=Wc,p.identity=Ve,p.includes=py,p.indexOf=ag,p.inRange=Km,p.invoke=Tm,p.isArguments=ar,p.isArray=K,p.isArrayBuffer=Ky,p.isArrayLike=He,p.isArrayLikeObject=Ee,p.isBoolean=Wy,p.isBuffer=Jt,p.isDate=Jy,p.isElement=Gy,p.isEmpty=Qy,p.isEqual=Yy,p.isEqualWith=Zy,p.isError=Wn,p.isFinite=Xy,p.isFunction=xt,p.isInteger=ou,p.isLength=gs,p.isMap=au,p.isMatch=em,p.isMatchWith=tm,p.isNaN=rm,p.isNative=im,p.isNil=nm,p.isNull=sm,p.isNumber=cu,p.isObject=be,p.isObjectLike=_e,p.isPlainObject=hi,p.isRegExp=Jn,p.isSafeInteger=om,p.isSet=uu,p.isString=ys,p.isSymbol=Ze,p.isTypedArray=Nr,p.isUndefined=am,p.isWeakMap=cm,p.isWeakSet=um,p.join=pg,p.kebabCase=Zm,p.last=ut,p.lastIndexOf=dg,p.lowerCase=Xm,p.lowerFirst=ev,p.lt=hm,p.lte=lm,p.max=Jv,p.maxBy=Gv,p.mean=Qv,p.meanBy=Yv,p.min=Zv,p.minBy=Xv,p.stubArray=ro,p.stubFalse=io,p.stubObject=Uv,p.stubString=Mv,p.stubTrue=Lv,p.multiply=ew,p.nth=fg,p.noConflict=Tv,p.noop=to,p.now=ps,p.pad=tv,p.padEnd=rv,p.padStart=iv,p.parseInt=sv,p.random=Wm,p.reduce=my,p.reduceRight=vy,p.repeat=nv,p.replace=ov,p.result=qm,p.round=tw,p.runInContext=m,p.sample=by,p.size=Iy,p.snakeCase=av,p.some=Py,p.sortedIndex=_g,p.sortedIndexBy=Eg,p.sortedIndexOf=Ig,p.sortedLastIndex=Pg,p.sortedLastIndexBy=Sg,p.sortedLastIndexOf=Og,p.startCase=uv,p.startsWith=hv,p.subtract=rw,p.sum=iw,p.sumBy=sw,p.template=lv,p.times=kv,p.toFinite=Dt,p.toInteger=W,p.toLength=lu,p.toLower=pv,p.toNumber=ht,p.toSafeInteger=pm,p.toString=se,p.toUpper=dv,p.trim=fv,p.trimEnd=gv,p.trimStart=yv,p.truncate=mv,p.unescape=vv,p.uniqueId=Hv,p.upperCase=wv,p.upperFirst=Yn,p.each=Yc,p.eachRight=Zc,p.first=Wc,eo(p,function(){var e={};return _t(p,function(i,n){oe.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,st(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),st(["drop","take"],function(e,i){X.prototype[e]=function(n){n=n===r?1:Re(W(n),0);var c=this.__filtered__&&!i?new X(this):this.clone();return c.__filtered__?c.__takeCount__=Fe(n,c.__takeCount__):c.__views__.push({size:Fe(n,De),type:e+(c.__dir__<0?"Right":"")}),c},X.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),st(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==E||n==J;X.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:L(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),st(["head","last"],function(e,i){var n="take"+(i?"Right":"");X.prototype[e]=function(){return this[n](1).value()[0]}}),st(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");X.prototype[e]=function(){return this.__filtered__?new X(this):this[n](1)}}),X.prototype.compact=function(){return this.filter(Ve)},X.prototype.find=function(e){return this.filter(e).head()},X.prototype.findLast=function(e){return this.reverse().find(e)},X.prototype.invokeMap=Q(function(e,i){return typeof e=="function"?new X(this):this.map(function(n){return si(n,e,i)})}),X.prototype.reject=function(e){return this.filter(fs(L(e)))},X.prototype.slice=function(e,i){e=W(e);var n=this;return n.__filtered__&&(e>0||i<0)?new X(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=W(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},X.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},X.prototype.toArray=function(){return this.take(De)},_t(X.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,v=g instanceof X,S=y[0],O=v||K(g),A=function(Z){var ee=h.apply(p,kt([Z],y));return c&&D?ee[0]:ee};O&&n&&typeof S=="function"&&S.length!=1&&(v=O=!1);var D=this.__chain__,U=!!this.__actions__.length,k=d&&!D,G=v&&!U;if(!d&&O){g=G?g:new X(this);var z=e.apply(g,y);return z.__actions__.push({func:hs,args:[A],thisArg:r}),new ot(z,D)}return k&&G?e.apply(this,y):(z=this.thru(A),k?c?z.value()[0]:z.value():z)})}),st(["pop","push","shift","sort","splice","unshift"],function(e){var i=ji[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(K(d)?d:[],h)}return this[n](function(g){return i.apply(K(g)?g:[],h)})}}),_t(X.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";oe.call(Pr,c)||(Pr[c]=[]),Pr[c].push({name:i,func:n})}}),Pr[is(r,Y).name]=[{name:"wrapper",func:r}],X.prototype.clone=md,X.prototype.reverse=vd,X.prototype.value=wd,p.prototype.at=Gg,p.prototype.chain=Qg,p.prototype.commit=Yg,p.prototype.next=Zg,p.prototype.plant=ey,p.prototype.reverse=ty,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=ry,p.prototype.first=p.prototype.head,Yr&&(p.prototype[Yr]=Xg),p},_r=Qp();Xt?((Xt.exports=_r)._=_r,Zs._=_r):Ce._=_r}).call(mi)})(Co,Co.exports);var cI=Object.defineProperty,uI=Object.defineProperties,hI=Object.getOwnPropertyDescriptors,Sh=Object.getOwnPropertySymbols,lI=Object.prototype.hasOwnProperty,pI=Object.prototype.propertyIsEnumerable,Oh=(o,t,r)=>t in o?cI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,bs=(o,t)=>{for(var r in t||(t={}))lI.call(t,r)&&Oh(o,r,t[r]);if(Sh)for(var r of Sh(t))pI.call(t,r)&&Oh(o,r,t[r]);return o},dI=(o,t)=>uI(o,hI(t));function Yt(o,t,r){var s;const a=k0(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${aI}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function fr(o){return o.includes(":")?o.split(":")[1]:o}function dl(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function fI(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function gI(o={},t={}){const r=Rh(o),s=Rh(t);return Co.exports.merge(r,s)}function Rh(o){var t,r,s,a;const u={};if(!Dr(o))return u;for(const[l,f]of Object.entries(o)){const w=ko(l)?[l]:f.chains,_=f.methods||[],T=f.events||[],R=f.rpcMap||{},N=vi(l);u[N]=dI(bs(bs({},u[N]),f),{chains:ao(w,(t=u[N])==null?void 0:t.chains),methods:ao(_,(r=u[N])==null?void 0:r.methods),events:ao(T,(s=u[N])==null?void 0:s.events),rpcMap:bs(bs({},R),(a=u[N])==null?void 0:a.rpcMap)})}return u}function yI(o){return o.includes(":")?o.split(":")[2]:o}function mI(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],f=ko(r)?[r]:s.chains?s.chains:dl(s.accounts);t[r]={chains:f,methods:a,events:u,accounts:l}}return t}function go(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const fl={},ye=o=>fl[o],yo=(o,t)=>{fl[o]=t};class vI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class wI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Yt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(fr(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class bI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class _I{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class EI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=fr(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class II{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class PI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class SI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Yt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace);return typeof s>"u"?void 0:new Ut(new Zt(s,ye("disableProviderPing")))}}var OI=Object.defineProperty,RI=Object.defineProperties,AI=Object.getOwnPropertyDescriptors,Ah=Object.getOwnPropertySymbols,NI=Object.prototype.hasOwnProperty,TI=Object.prototype.propertyIsEnumerable,Nh=(o,t,r)=>t in o?OI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,_s=(o,t)=>{for(var r in t||(t={}))NI.call(t,r)&&Nh(o,r,t[r]);if(Ah)for(var r of Ah(t))TI.call(t,r)&&Nh(o,r,t[r]);return o},mo=(o,t)=>RI(o,AI(t));class Ko{constructor(t){this.events=new H.Ct,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:I.ot(I.k({level:(t==null?void 0:t.logger)||Ih})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new Ko(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:_s({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,I.formatJsonRpcResult(a,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Pe("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=mI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==ll)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(hr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await KE.init({logger:this.providerOpts.logger||Ih,relayUrl:this.providerOpts.relayUrl||sI,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>vi(r)))];yo("client",this.client),yo("events",this.events),yo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=fI(r,this.session),a=dl(s),u=gI(this.namespaces,this.optionalNamespaces),l=mo(_s({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new wI({namespace:l});break;case"solana":this.rpcProviders[r]=new bI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new _I({namespace:l});break;case"polkadot":this.rpcProviders[r]=new vI({namespace:l});break;case"cip34":this.rpcProviders[r]=new EI({namespace:l});break;case"elrond":this.rpcProviders[r]=new II({namespace:l});break;case"multiversx":this.rpcProviders[r]=new PI({namespace:l});break;case"near":this.rpcProviders[r]=new SI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&hr(a)&&this.events.emit("accountsChanged",a.map(yI))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=vi(a),f=go(a)!==go(u)?`${l}:${go(u)}`:a;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=mo(_s({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",mo(_s({},Pe("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Mt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>vi(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=vi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${Ph}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${Ph}/${t}`)}}const CI=Ko,$I="wc",xI="ethereum_provider",DI=`${$I}@2:${xI}:`,FI="https://rpc.walletconnect.com/v1/",Rs=["eth_sendTransaction","personal_sign"],gl=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],As=["chainChanged","accountsChanged"],yl=["chainChanged","accountsChanged","message","disconnect","connect"];var jI=Object.defineProperty,qI=Object.defineProperties,UI=Object.getOwnPropertyDescriptors,Th=Object.getOwnPropertySymbols,MI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,Ch=(o,t,r)=>t in o?jI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,bi=(o,t)=>{for(var r in t||(t={}))MI.call(t,r)&&Ch(o,r,t[r]);if(Th)for(var r of Th(t))LI.call(t,r)&&Ch(o,r,t[r]);return o},$h=(o,t)=>qI(o,UI(t));function Ns(o){return Number(o[0].split(":")[1])}function vo(o){return`0x${o.toString(16)}`}function kI(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:f}=o;if(!wo(t))throw new Error("Invalid chains");const w={chains:t,methods:s||Rs,events:u||As,rpcMap:bi({},t.length?{[Ns(t)]:f[Ns(t)]}:{})},_=u==null?void 0:u.filter(M=>!As.includes(M)),T=s==null?void 0:s.filter(M=>!Rs.includes(M));if(!r&&!l&&!a&&!(_!=null&&_.length)&&!(T!=null&&T.length))return{required:t.length?w:void 0};const R=(_==null?void 0:_.length)&&(T==null?void 0:T.length)||!r,N={chains:[...new Set(R?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:gl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:yl))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class xs{constructor(){this.events=new H.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=DI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new xs;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=kI(this.rpc);try{const a=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(_=>{!_.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect($h(bi({namespaces:bi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(_=>{l(_)}).catch(_=>{f(new Error(_.message))})});if(!a)return;const u=yw(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:vo(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",vo(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",$h(bi({},vw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",vo(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=a.length?(t==null?void 0:t.methods)||Rs:[],w=a.length?(t==null?void 0:t.events)||As:[],_=(t==null?void 0:t.optionalMethods)||[],T=(t==null?void 0:t.optionalEvents)||[],R=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(M=>this.formatChainId(M)),optionalChains:u.map(M=>this.formatChainId(M)),methods:f,events:w,optionalMethods:_,optionalEvents:T,rpcMap:R,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Ns(this.rpc.chains):Ns(this.rpc.optionalChains),this.signer=await CI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-Cofatf_w.js")).then(a=>a.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(bi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&wo(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&wo(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${FI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const zI=xs;exports.EthereumProvider=zI;exports.OPTIONAL_EVENTS=yl;exports.OPTIONAL_METHODS=gl;exports.REQUIRED_EVENTS=As;exports.REQUIRED_METHODS=Rs;exports.default=xs;
46
+ }`;var G=_u(function(){return ie(d,U+"return "+A).apply(r,g)});if(G.source=A,Wn(G))throw G;return G}function pv(e){return se(e).toLowerCase()}function dv(e){return se(e).toUpperCase()}function fv(e,i,n){if(e=se(e),e&&(n||i===r))return Ta(e);if(!e||!(i=Ye(i)))return e;var c=ft(e),h=ft(i),d=Ca(c,h),g=$a(c,h)+1;return Wt(c,d,g).join("")}function gv(e,i,n){if(e=se(e),e&&(n||i===r))return e.slice(0,Da(e)+1);if(!e||!(i=Ye(i)))return e;var c=ft(e),h=$a(c,ft(i))+1;return Wt(c,0,h).join("")}function yv(e,i,n){if(e=se(e),e&&(n||i===r))return e.replace(Ks,"");if(!e||!(i=Ye(i)))return e;var c=ft(e),h=Ca(c,ft(i));return Wt(c,h).join("")}function mv(e,i){var n=Ds,c=rt;if(be(i)){var h="separator"in i?i.separator:h;n="length"in i?W(i.length):n,c="omission"in i?Ye(i.omission):c}e=se(e);var d=e.length;if(wr(e)){var g=ft(e);d=g.length}if(n>=d)return e;var y=n-br(c);if(y<1)return c;var v=g?Wt(g,0,y).join(""):e.slice(0,y);if(h===r)return v+c;if(g&&(y+=v.length-y),Jn(h)){if(e.slice(y).search(h)){var S,O=v;for(h.global||(h=hn(h.source,se(Zo.exec(h))+"g")),h.lastIndex=0;S=h.exec(O);)var A=S.index;v=v.slice(0,A===r?y:A)}}else if(e.indexOf(Ye(h),y)!=y){var D=v.lastIndexOf(h);D>-1&&(v=v.slice(0,D))}return v+c}function vv(e){return e=se(e),e&&Al.test(e)?e.replace(Go,Kp):e}var wv=Rr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Yn=Ec("toUpperCase");function bu(e,i,n){return e=se(e),i=n?r:i,i===r?kp(e)?Gp(e):$p(e):e.match(i)||[]}var _u=Q(function(e,i){try{return Ge(e,r,i)}catch(n){return Wn(n)?n:new B(n)}}),bv=Ct(function(e,i){return st(i,function(n){n=It(n),Nt(e,n,Vn(e[n],e))}),e});function _v(e){var i=e==null?0:e.length,n=L();return e=i?ge(e,function(c){if(typeof c[1]!="function")throw new nt(l);return[n(c[0]),c[1]]}):[],Q(function(c){for(var h=-1;++h<i;){var d=e[h];if(Ge(d[0],this,c))return Ge(d[1],this,c)}})}function Ev(e){return Kd(at(e,R))}function Zn(e){return function(){return e}}function Iv(e,i){return e==null||e!==e?i:e}var Pv=Pc(),Sv=Pc(!0);function Ve(e){return e}function Xn(e){return ec(typeof e=="function"?e:at(e,R))}function Ov(e){return rc(at(e,R))}function Rv(e,i){return ic(e,at(i,R))}var Av=Q(function(e,i){return function(n){return si(n,e,i)}}),Nv=Q(function(e,i){return function(n){return si(e,n,i)}});function eo(e,i,n){var c=Ae(i),h=Zi(i,c);n==null&&!(be(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Zi(i,Ae(i)));var d=!(be(n)&&"chain"in n)||!!n.chain,g=xt(e);return st(h,function(y){var v=i[y];e[y]=v,g&&(e.prototype[y]=function(){var S=this.__chain__;if(d||S){var O=e(this.__wrapped__),A=O.__actions__=ze(this.__actions__);return A.push({func:v,args:arguments,thisArg:e}),O.__chain__=S,O}return v.apply(e,kt([this.value()],arguments))})}),e}function Tv(){return Ce._===this&&(Ce._=td),this}function to(){}function Cv(e){return e=W(e),Q(function(i){return sc(i,e)})}var $v=$n(ge),xv=$n(Sa),Dv=$n(rn);function Eu(e){return Mn(e)?sn(It(e)):hf(e)}function Fv(e){return function(i){return e==null?r:sr(e,i)}}var jv=Oc(),qv=Oc(!0);function ro(){return[]}function io(){return!1}function Uv(){return{}}function Mv(){return""}function Lv(){return!0}function kv(e,i){if(e=W(e),e<1||e>ue)return[];var n=De,c=Fe(e,De);i=L(i),e-=De;for(var h=an(c,i);++n<e;)i(n);return h}function zv(e){return K(e)?ge(e,It):Ze(e)?[e]:ze(zc(se(e)))}function Hv(e){var i=++Xp;return se(e)+i}var Bv=ss(function(e,i){return e+i},0),Vv=xn("ceil"),Kv=ss(function(e,i){return e/i},1),Wv=xn("floor");function Jv(e){return e&&e.length?Yi(e,Ve,vn):r}function Gv(e,i){return e&&e.length?Yi(e,L(i,2),vn):r}function Qv(e){return Aa(e,Ve)}function Yv(e,i){return Aa(e,L(i,2))}function Zv(e){return e&&e.length?Yi(e,Ve,En):r}function Xv(e,i){return e&&e.length?Yi(e,L(i,2),En):r}var ew=ss(function(e,i){return e*i},1),tw=xn("round"),rw=ss(function(e,i){return e-i},0);function iw(e){return e&&e.length?on(e,Ve):0}function sw(e,i){return e&&e.length?on(e,L(i,2)):0}return p.after=Oy,p.ary=Xc,p.assign=dm,p.assignIn=du,p.assignInWith=ms,p.assignWith=fm,p.at=gm,p.before=eu,p.bind=Vn,p.bindAll=bv,p.bindKey=tu,p.castArray=Uy,p.chain=Qc,p.chunk=Wf,p.compact=Jf,p.concat=Gf,p.cond=_v,p.conforms=Ev,p.constant=Zn,p.countBy=iy,p.create=ym,p.curry=ru,p.curryRight=iu,p.debounce=su,p.defaults=mm,p.defaultsDeep=vm,p.defer=Ry,p.delay=Ay,p.difference=Qf,p.differenceBy=Yf,p.differenceWith=Zf,p.drop=Xf,p.dropRight=eg,p.dropRightWhile=tg,p.dropWhile=rg,p.fill=ig,p.filter=ny,p.flatMap=cy,p.flatMapDeep=uy,p.flatMapDepth=hy,p.flatten=Kc,p.flattenDeep=sg,p.flattenDepth=ng,p.flip=Ny,p.flow=Pv,p.flowRight=Sv,p.fromPairs=og,p.functions=Sm,p.functionsIn=Om,p.groupBy=ly,p.initial=cg,p.intersection=ug,p.intersectionBy=hg,p.intersectionWith=lg,p.invert=Am,p.invertBy=Nm,p.invokeMap=dy,p.iteratee=Xn,p.keyBy=fy,p.keys=Ae,p.keysIn=Be,p.map=ls,p.mapKeys=Cm,p.mapValues=$m,p.matches=Ov,p.matchesProperty=Rv,p.memoize=ds,p.merge=xm,p.mergeWith=fu,p.method=Av,p.methodOf=Nv,p.mixin=eo,p.negate=fs,p.nthArg=Cv,p.omit=Dm,p.omitBy=Fm,p.once=Ty,p.orderBy=gy,p.over=$v,p.overArgs=Cy,p.overEvery=xv,p.overSome=Dv,p.partial=Kn,p.partialRight=nu,p.partition=yy,p.pick=jm,p.pickBy=gu,p.property=Eu,p.propertyOf=Fv,p.pull=gg,p.pullAll=Jc,p.pullAllBy=yg,p.pullAllWith=mg,p.pullAt=vg,p.range=jv,p.rangeRight=qv,p.rearg=$y,p.reject=wy,p.remove=wg,p.rest=xy,p.reverse=Hn,p.sampleSize=_y,p.set=Um,p.setWith=Mm,p.shuffle=Ey,p.slice=bg,p.sortBy=Sy,p.sortedUniq=Rg,p.sortedUniqBy=Ag,p.split=cv,p.spread=Dy,p.tail=Ng,p.take=Tg,p.takeRight=Cg,p.takeRightWhile=$g,p.takeWhile=xg,p.tap=Jg,p.throttle=Fy,p.thru=hs,p.toArray=hu,p.toPairs=yu,p.toPairsIn=mu,p.toPath=zv,p.toPlainObject=pu,p.transform=Lm,p.unary=jy,p.union=Dg,p.unionBy=Fg,p.unionWith=jg,p.uniq=qg,p.uniqBy=Ug,p.uniqWith=Mg,p.unset=km,p.unzip=Bn,p.unzipWith=Gc,p.update=zm,p.updateWith=Hm,p.values=Tr,p.valuesIn=Bm,p.without=Lg,p.words=bu,p.wrap=qy,p.xor=kg,p.xorBy=zg,p.xorWith=Hg,p.zip=Bg,p.zipObject=Vg,p.zipObjectDeep=Kg,p.zipWith=Wg,p.entries=yu,p.entriesIn=mu,p.extend=du,p.extendWith=ms,eo(p,p),p.add=Bv,p.attempt=_u,p.camelCase=Jm,p.capitalize=vu,p.ceil=Vv,p.clamp=Vm,p.clone=My,p.cloneDeep=ky,p.cloneDeepWith=zy,p.cloneWith=Ly,p.conformsTo=Hy,p.deburr=wu,p.defaultTo=Iv,p.divide=Kv,p.endsWith=Gm,p.eq=yt,p.escape=Qm,p.escapeRegExp=Ym,p.every=sy,p.find=oy,p.findIndex=Bc,p.findKey=wm,p.findLast=ay,p.findLastIndex=Vc,p.findLastKey=bm,p.floor=Wv,p.forEach=Yc,p.forEachRight=Zc,p.forIn=_m,p.forInRight=Em,p.forOwn=Im,p.forOwnRight=Pm,p.get=Gn,p.gt=By,p.gte=Vy,p.has=Rm,p.hasIn=Qn,p.head=Wc,p.identity=Ve,p.includes=py,p.indexOf=ag,p.inRange=Km,p.invoke=Tm,p.isArguments=ar,p.isArray=K,p.isArrayBuffer=Ky,p.isArrayLike=He,p.isArrayLikeObject=Ee,p.isBoolean=Wy,p.isBuffer=Jt,p.isDate=Jy,p.isElement=Gy,p.isEmpty=Qy,p.isEqual=Yy,p.isEqualWith=Zy,p.isError=Wn,p.isFinite=Xy,p.isFunction=xt,p.isInteger=ou,p.isLength=gs,p.isMap=au,p.isMatch=em,p.isMatchWith=tm,p.isNaN=rm,p.isNative=im,p.isNil=nm,p.isNull=sm,p.isNumber=cu,p.isObject=be,p.isObjectLike=_e,p.isPlainObject=hi,p.isRegExp=Jn,p.isSafeInteger=om,p.isSet=uu,p.isString=ys,p.isSymbol=Ze,p.isTypedArray=Nr,p.isUndefined=am,p.isWeakMap=cm,p.isWeakSet=um,p.join=pg,p.kebabCase=Zm,p.last=ut,p.lastIndexOf=dg,p.lowerCase=Xm,p.lowerFirst=ev,p.lt=hm,p.lte=lm,p.max=Jv,p.maxBy=Gv,p.mean=Qv,p.meanBy=Yv,p.min=Zv,p.minBy=Xv,p.stubArray=ro,p.stubFalse=io,p.stubObject=Uv,p.stubString=Mv,p.stubTrue=Lv,p.multiply=ew,p.nth=fg,p.noConflict=Tv,p.noop=to,p.now=ps,p.pad=tv,p.padEnd=rv,p.padStart=iv,p.parseInt=sv,p.random=Wm,p.reduce=my,p.reduceRight=vy,p.repeat=nv,p.replace=ov,p.result=qm,p.round=tw,p.runInContext=m,p.sample=by,p.size=Iy,p.snakeCase=av,p.some=Py,p.sortedIndex=_g,p.sortedIndexBy=Eg,p.sortedIndexOf=Ig,p.sortedLastIndex=Pg,p.sortedLastIndexBy=Sg,p.sortedLastIndexOf=Og,p.startCase=uv,p.startsWith=hv,p.subtract=rw,p.sum=iw,p.sumBy=sw,p.template=lv,p.times=kv,p.toFinite=Dt,p.toInteger=W,p.toLength=lu,p.toLower=pv,p.toNumber=ht,p.toSafeInteger=pm,p.toString=se,p.toUpper=dv,p.trim=fv,p.trimEnd=gv,p.trimStart=yv,p.truncate=mv,p.unescape=vv,p.uniqueId=Hv,p.upperCase=wv,p.upperFirst=Yn,p.each=Yc,p.eachRight=Zc,p.first=Wc,eo(p,function(){var e={};return _t(p,function(i,n){oe.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,st(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),st(["drop","take"],function(e,i){X.prototype[e]=function(n){n=n===r?1:Re(W(n),0);var c=this.__filtered__&&!i?new X(this):this.clone();return c.__filtered__?c.__takeCount__=Fe(n,c.__takeCount__):c.__views__.push({size:Fe(n,De),type:e+(c.__dir__<0?"Right":"")}),c},X.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),st(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==E||n==J;X.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:L(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),st(["head","last"],function(e,i){var n="take"+(i?"Right":"");X.prototype[e]=function(){return this[n](1).value()[0]}}),st(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");X.prototype[e]=function(){return this.__filtered__?new X(this):this[n](1)}}),X.prototype.compact=function(){return this.filter(Ve)},X.prototype.find=function(e){return this.filter(e).head()},X.prototype.findLast=function(e){return this.reverse().find(e)},X.prototype.invokeMap=Q(function(e,i){return typeof e=="function"?new X(this):this.map(function(n){return si(n,e,i)})}),X.prototype.reject=function(e){return this.filter(fs(L(e)))},X.prototype.slice=function(e,i){e=W(e);var n=this;return n.__filtered__&&(e>0||i<0)?new X(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=W(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},X.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},X.prototype.toArray=function(){return this.take(De)},_t(X.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,v=g instanceof X,S=y[0],O=v||K(g),A=function(Z){var ee=h.apply(p,kt([Z],y));return c&&D?ee[0]:ee};O&&n&&typeof S=="function"&&S.length!=1&&(v=O=!1);var D=this.__chain__,U=!!this.__actions__.length,k=d&&!D,G=v&&!U;if(!d&&O){g=G?g:new X(this);var z=e.apply(g,y);return z.__actions__.push({func:hs,args:[A],thisArg:r}),new ot(z,D)}return k&&G?e.apply(this,y):(z=this.thru(A),k?c?z.value()[0]:z.value():z)})}),st(["pop","push","shift","sort","splice","unshift"],function(e){var i=ji[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(K(d)?d:[],h)}return this[n](function(g){return i.apply(K(g)?g:[],h)})}}),_t(X.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";oe.call(Pr,c)||(Pr[c]=[]),Pr[c].push({name:i,func:n})}}),Pr[is(r,Y).name]=[{name:"wrapper",func:r}],X.prototype.clone=md,X.prototype.reverse=vd,X.prototype.value=wd,p.prototype.at=Gg,p.prototype.chain=Qg,p.prototype.commit=Yg,p.prototype.next=Zg,p.prototype.plant=ey,p.prototype.reverse=ty,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=ry,p.prototype.first=p.prototype.head,Yr&&(p.prototype[Yr]=Xg),p},_r=Qp();Xt?((Xt.exports=_r)._=_r,Zs._=_r):Ce._=_r}).call(mi)})(Co,Co.exports);var cI=Object.defineProperty,uI=Object.defineProperties,hI=Object.getOwnPropertyDescriptors,Sh=Object.getOwnPropertySymbols,lI=Object.prototype.hasOwnProperty,pI=Object.prototype.propertyIsEnumerable,Oh=(o,t,r)=>t in o?cI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,bs=(o,t)=>{for(var r in t||(t={}))lI.call(t,r)&&Oh(o,r,t[r]);if(Sh)for(var r of Sh(t))pI.call(t,r)&&Oh(o,r,t[r]);return o},dI=(o,t)=>uI(o,hI(t));function Yt(o,t,r){var s;const a=k0(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${aI}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function fr(o){return o.includes(":")?o.split(":")[1]:o}function dl(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function fI(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function gI(o={},t={}){const r=Rh(o),s=Rh(t);return Co.exports.merge(r,s)}function Rh(o){var t,r,s,a;const u={};if(!Dr(o))return u;for(const[l,f]of Object.entries(o)){const w=ko(l)?[l]:f.chains,_=f.methods||[],T=f.events||[],R=f.rpcMap||{},N=vi(l);u[N]=dI(bs(bs({},u[N]),f),{chains:ao(w,(t=u[N])==null?void 0:t.chains),methods:ao(_,(r=u[N])==null?void 0:r.methods),events:ao(T,(s=u[N])==null?void 0:s.events),rpcMap:bs(bs({},R),(a=u[N])==null?void 0:a.rpcMap)})}return u}function yI(o){return o.includes(":")?o.split(":")[2]:o}function mI(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],f=ko(r)?[r]:s.chains?s.chains:dl(s.accounts);t[r]={chains:f,methods:a,events:u,accounts:l}}return t}function go(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const fl={},ye=o=>fl[o],yo=(o,t)=>{fl[o]=t};class vI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class wI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Yt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(fr(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class bI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class _I{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class EI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=fr(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class II{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class PI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class SI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Yt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace);return typeof s>"u"?void 0:new Ut(new Zt(s,ye("disableProviderPing")))}}var OI=Object.defineProperty,RI=Object.defineProperties,AI=Object.getOwnPropertyDescriptors,Ah=Object.getOwnPropertySymbols,NI=Object.prototype.hasOwnProperty,TI=Object.prototype.propertyIsEnumerable,Nh=(o,t,r)=>t in o?OI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,_s=(o,t)=>{for(var r in t||(t={}))NI.call(t,r)&&Nh(o,r,t[r]);if(Ah)for(var r of Ah(t))TI.call(t,r)&&Nh(o,r,t[r]);return o},mo=(o,t)=>RI(o,AI(t));class Ko{constructor(t){this.events=new H.Ct,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:I.ot(I.k({level:(t==null?void 0:t.logger)||Ih})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new Ko(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:_s({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,I.formatJsonRpcResult(a,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Pe("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=mI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==ll)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(hr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await KE.init({logger:this.providerOpts.logger||Ih,relayUrl:this.providerOpts.relayUrl||sI,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>vi(r)))];yo("client",this.client),yo("events",this.events),yo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=fI(r,this.session),a=dl(s),u=gI(this.namespaces,this.optionalNamespaces),l=mo(_s({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new wI({namespace:l});break;case"solana":this.rpcProviders[r]=new bI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new _I({namespace:l});break;case"polkadot":this.rpcProviders[r]=new vI({namespace:l});break;case"cip34":this.rpcProviders[r]=new EI({namespace:l});break;case"elrond":this.rpcProviders[r]=new II({namespace:l});break;case"multiversx":this.rpcProviders[r]=new PI({namespace:l});break;case"near":this.rpcProviders[r]=new SI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&hr(a)&&this.events.emit("accountsChanged",a.map(yI))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=vi(a),f=go(a)!==go(u)?`${l}:${go(u)}`:a;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=mo(_s({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",mo(_s({},Pe("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Mt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>vi(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=vi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${Ph}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${Ph}/${t}`)}}const CI=Ko,$I="wc",xI="ethereum_provider",DI=`${$I}@2:${xI}:`,FI="https://rpc.walletconnect.com/v1/",Rs=["eth_sendTransaction","personal_sign"],gl=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],As=["chainChanged","accountsChanged"],yl=["chainChanged","accountsChanged","message","disconnect","connect"];var jI=Object.defineProperty,qI=Object.defineProperties,UI=Object.getOwnPropertyDescriptors,Th=Object.getOwnPropertySymbols,MI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,Ch=(o,t,r)=>t in o?jI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,bi=(o,t)=>{for(var r in t||(t={}))MI.call(t,r)&&Ch(o,r,t[r]);if(Th)for(var r of Th(t))LI.call(t,r)&&Ch(o,r,t[r]);return o},$h=(o,t)=>qI(o,UI(t));function Ns(o){return Number(o[0].split(":")[1])}function vo(o){return`0x${o.toString(16)}`}function kI(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:f}=o;if(!wo(t))throw new Error("Invalid chains");const w={chains:t,methods:s||Rs,events:u||As,rpcMap:bi({},t.length?{[Ns(t)]:f[Ns(t)]}:{})},_=u==null?void 0:u.filter(M=>!As.includes(M)),T=s==null?void 0:s.filter(M=>!Rs.includes(M));if(!r&&!l&&!a&&!(_!=null&&_.length)&&!(T!=null&&T.length))return{required:t.length?w:void 0};const R=(_==null?void 0:_.length)&&(T==null?void 0:T.length)||!r,N={chains:[...new Set(R?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:gl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:yl))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class xs{constructor(){this.events=new H.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=DI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new xs;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=kI(this.rpc);try{const a=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(_=>{!_.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect($h(bi({namespaces:bi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(_=>{l(_)}).catch(_=>{f(new Error(_.message))})});if(!a)return;const u=yw(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:vo(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",vo(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",$h(bi({},vw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",vo(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=a.length?(t==null?void 0:t.methods)||Rs:[],w=a.length?(t==null?void 0:t.events)||As:[],_=(t==null?void 0:t.optionalMethods)||[],T=(t==null?void 0:t.optionalEvents)||[],R=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(M=>this.formatChainId(M)),optionalChains:u.map(M=>this.formatChainId(M)),methods:f,events:w,optionalMethods:_,optionalEvents:T,rpcMap:R,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Ns(this.rpc.chains):Ns(this.rpc.optionalChains),this.signer=await CI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-isN8Fo1n.js")).then(a=>a.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(bi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&wo(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&wo(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${FI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const zI=xs;exports.EthereumProvider=zI;exports.OPTIONAL_EVENTS=yl;exports.OPTIONAL_METHODS=gl;exports.REQUIRED_EVENTS=As;exports.REQUIRED_METHODS=Rs;exports.default=xs;