@wormhole-foundation/wormhole-connect 1.0.0-beta.3-development → 1.0.0-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 (154) hide show
  1. package/dist/assets/{ccip-YN27M9dL.js → ccip-B-OK94pJ.js} +1 -1
  2. package/dist/assets/{evm-wKiUiV3-.js → evm-CPj7oFVL.js} +4 -4
  3. package/dist/assets/{index-B9_Snb-C.js → index-BWMdho2w.js} +2 -2
  4. package/dist/assets/{index-8fbGA94c.js → index-DGFWhjyA.js} +1 -1
  5. package/dist/assets/{index-BBy_QGBB.js → index-Ddso83Ti.js} +1 -1
  6. package/dist/assets/{index.es-BY7lrdO_.js → index.es-VchQxXD4.js} +2 -2
  7. package/dist/main.js +115 -62
  8. package/dist/src/components/v2/Button.d.ts +1 -1
  9. package/dist/src/components/v2/Button.d.ts.map +1 -1
  10. package/dist/src/config/types.d.ts +17 -3
  11. package/dist/src/config/types.d.ts.map +1 -1
  12. package/dist/src/hooks/useTransactionHistory.d.ts +1 -1
  13. package/dist/src/hooks/useTransactionHistory.d.ts.map +1 -1
  14. package/dist/src/hooks/useTransactionHistoryMayan.d.ts.map +1 -1
  15. package/dist/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  16. package/dist/src/icons/TxReadyForClaim.d.ts +2 -2
  17. package/dist/src/icons/TxReadyForClaim.d.ts.map +1 -1
  18. package/dist/src/utils/inProgressTxCache.d.ts +5 -0
  19. package/dist/src/utils/inProgressTxCache.d.ts.map +1 -0
  20. package/dist/src/utils/polling.d.ts +5 -0
  21. package/dist/src/utils/polling.d.ts.map +1 -0
  22. package/dist/src/utils/sdkv2.d.ts +3 -2
  23. package/dist/src/utils/sdkv2.d.ts.map +1 -1
  24. package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  25. package/dist/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
  26. package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
  27. package/dist/src/views/v2/Redeem/index.d.ts.map +1 -1
  28. package/dist/src/views/v2/TxHistory/Widget/Item.d.ts +8 -0
  29. package/dist/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -0
  30. package/dist/src/views/v2/TxHistory/Widget/index.d.ts +4 -0
  31. package/dist/src/views/v2/TxHistory/Widget/index.d.ts.map +1 -0
  32. package/dist/src/views/v2/TxHistory/index.d.ts.map +1 -1
  33. package/lib/{algorand-DIrI8hux.js → algorand-DFJZIdnH.js} +1 -1
  34. package/lib/{algorand-BZLSulqp.mjs → algorand-qEY4HHOc.mjs} +3 -3
  35. package/lib/{aptos-ClFQX748.mjs → aptos-BCuZuiBG.mjs} +1 -1
  36. package/lib/{aptos-B61S9Mku.js → aptos-BHw0JlTE.js} +1 -1
  37. package/lib/{aptos-poOCeL-e.js → aptos-D-S8DXGs.js} +2 -2
  38. package/lib/{aptos-BXyptrTk.mjs → aptos-DoqExVYR.mjs} +3 -3
  39. package/lib/{ccip-CROSeCCn.js → ccip-CXJ3nCk_.js} +1 -1
  40. package/lib/{ccip-BcLqF-ov.mjs → ccip-_0LmpQds.mjs} +1 -1
  41. package/lib/{cosmos-B7IowZE9.mjs → cosmos-0un-E2-0.mjs} +6 -6
  42. package/lib/{cosmos-D-fRtzTz.js → cosmos-DCgWSBll.js} +1 -1
  43. package/lib/{cosmwasm-BU28GqyN.js → cosmwasm-BsEhYnuw.js} +2 -2
  44. package/lib/{cosmwasm-i8-2LBd4.mjs → cosmwasm-DvwgrLe6.mjs} +7 -7
  45. package/lib/{events-BIfEV615.mjs → events-BL2eUG60.mjs} +1 -1
  46. package/lib/{events-CG085uVS.js → events-wpqGOay9.js} +1 -1
  47. package/lib/{evm-z72BQwjo.js → evm-B46tP5Ah.js} +1 -1
  48. package/lib/{evm-DSo1klm4.js → evm-BOrFw20j.js} +4 -4
  49. package/lib/{evm-BG4p6wWc.mjs → evm-CkxKsuQ-.mjs} +7 -7
  50. package/lib/{evm-DqVh4NBz.mjs → evm-kynWl8-i.mjs} +5 -5
  51. package/lib/{index-Coqx-ZYc.js → index-6gwCyfQU.js} +1 -1
  52. package/lib/{index-B-bMfv9J.mjs → index-BHOu1oLq.mjs} +3 -3
  53. package/lib/{index-9Ifk_2V6.js → index-BNWJG0G4.js} +1 -1
  54. package/lib/{index-Xxsx46yX.mjs → index-BOppeFAI.mjs} +1 -1
  55. package/lib/{index-l3VuXtv4.mjs → index-BTBmklHJ.mjs} +2 -2
  56. package/lib/{index-CQ_e_FtW.js → index-BVz1aMw3.js} +1 -1
  57. package/lib/{index--kQS0wX-.js → index-BWNh4wvK.js} +1 -1
  58. package/lib/{index-x3yNXPc-.js → index-BwCIDEBK.js} +1 -1
  59. package/lib/{index-DkmEXbbA.js → index-C4ri6eMC.js} +1 -1
  60. package/lib/{index-CytdQ1id.js → index-C7amSMG9.js} +1 -1
  61. package/lib/{index-CdnXAZl6.js → index-CAkX47d8.js} +1 -1
  62. package/lib/{index-ByG9EJHX.js → index-CDGktAjP.js} +137 -84
  63. package/lib/{index-CkrE6mmF.js → index-CFVm1KSi.js} +1 -1
  64. package/lib/{index-Cfu2mlWW.mjs → index-CLH7U4rp.mjs} +2 -2
  65. package/lib/{index-BhfoV5RZ.js → index-CNIDBiCc.js} +1 -1
  66. package/lib/{index-xrevpHY6.js → index-CPgdgK8L.js} +1 -1
  67. package/lib/{index-DjSK9SdK.mjs → index-CTwzW64I.mjs} +2 -2
  68. package/lib/{index-Cf-xLfst.js → index-CUInBQd6.js} +1 -1
  69. package/lib/{index-CGmv-GLf.js → index-CaFGZvKm.js} +1 -1
  70. package/lib/{index-DTLOaiZ5.mjs → index-Cb47usqO.mjs} +2 -2
  71. package/lib/{index-BDhzG0Bz.mjs → index-CjwA7HmM.mjs} +5313 -4809
  72. package/lib/{index--orPBbEs.mjs → index-CkPaHAgJ.mjs} +3 -3
  73. package/lib/{index-C1XMdJFH.js → index-ClLbfY74.js} +1 -1
  74. package/lib/{index-CJJaUncM.js → index-ClRkhvNK.js} +1 -1
  75. package/lib/{index-DGI2tbSC.mjs → index-Cm3iq-IJ.mjs} +1 -1
  76. package/lib/{index-DEfagu36.js → index-CtJdy4GW.js} +1 -1
  77. package/lib/{index-BUcxdUpo.mjs → index-D0W1ZmqN.mjs} +2 -2
  78. package/lib/{index-Bn9MsO0e.mjs → index-D5SPCl8N.mjs} +2 -2
  79. package/lib/{index-C8UyzBg3.mjs → index-D6Sqxs9J.mjs} +4 -4
  80. package/lib/{index-BM3TrHYu.mjs → index-DC65dQZI.mjs} +7 -7
  81. package/lib/{index-2u6Q9y32.js → index-DICIR39L.js} +1 -1
  82. package/lib/{index-C8tIBuyM.mjs → index-DIddLRbN.mjs} +1 -1
  83. package/lib/{index-C1t8_dYP.mjs → index-DSSXLwpv.mjs} +1 -1
  84. package/lib/{index-eY_q88kc.js → index-DVKptZW_.js} +1 -1
  85. package/lib/{index-CLiemfL3.js → index-DcbhKZoU.js} +1 -1
  86. package/lib/{index-B51snNHX.mjs → index-DojwGTf0.mjs} +1 -1
  87. package/lib/{index-3CEBQmCn.mjs → index-DrQrqu4U.mjs} +2 -2
  88. package/lib/{index-C262JAz4.mjs → index-DvQkOUhD.mjs} +4 -4
  89. package/lib/{index-C1fq1xT0.mjs → index-Dw4gUoPq.mjs} +2 -2
  90. package/lib/{index-DTtBAHqC.mjs → index-IypSUdxl.mjs} +2 -2
  91. package/lib/{index-GyFHGs5Z.js → index-QfqpopxL.js} +1 -1
  92. package/lib/{index-C2ZrCXVv.mjs → index-SiA6wvOM.mjs} +2 -2
  93. package/lib/{index-D1GFc9u_.js → index-dZuWNqUJ.js} +1 -1
  94. package/lib/{index-DTj0BYI6.mjs → index-fzN-meRd.mjs} +1 -1
  95. package/lib/{index-CYfEuKEC.js → index-hWgZ0Dfs.js} +1 -1
  96. package/lib/{index-BrFyHtHO.js → index-tKKMDrTV.js} +1 -1
  97. package/lib/{index-B3uNul6-.mjs → index-tKooq_Tx.mjs} +3 -3
  98. package/lib/{index-C3Ztf7te.mjs → index-yd8RiLQo.mjs} +4 -4
  99. package/lib/{index.es-CTYy3A6V.js → index.es-BfpZO8dT.js} +2 -2
  100. package/lib/{index.es-zlUSra_a.mjs → index.es-P5wvRtJq.mjs} +5 -5
  101. package/lib/index.js +1 -1
  102. package/lib/index.mjs +1 -1
  103. package/lib/{libsodium-wrappers-BL6m46dv.mjs → libsodium-wrappers-BB6-Iffd.mjs} +1 -1
  104. package/lib/{libsodium-wrappers-_Sv3nUjE.js → libsodium-wrappers-BvMpC4vD.js} +1 -1
  105. package/lib/{pako.esm-Bf33_673.mjs → pako.esm-C7QrkxRd.mjs} +3 -3
  106. package/lib/{pako.esm-CEjOh_1P.js → pako.esm-DlDLS2rv.js} +1 -1
  107. package/lib/{pbkdf2-C3vdgkb4.mjs → pbkdf2-DMV4l9Li.mjs} +1 -1
  108. package/lib/{pbkdf2-BJ3CFykt.js → pbkdf2-Di1EjoiV.js} +1 -1
  109. package/lib/{sei-BXWrZef6.mjs → sei-CnR3Aw9g.mjs} +4 -4
  110. package/lib/{sei-LGYYUG8M.js → sei-RTyi_UJs.js} +1 -1
  111. package/lib/{signer-DaJj3hCp.mjs → signer-BAztlcE7.mjs} +1 -1
  112. package/lib/{signer-BQ4T60Nz.js → signer-CbhSUdvo.js} +1 -1
  113. package/lib/solana-Bkh_veaR.mjs +16 -0
  114. package/lib/solana-CKipdoh2.js +1 -0
  115. package/lib/{solana-Cl4jwD2F.mjs → solana-CP3uz3z9.mjs} +4 -4
  116. package/lib/{solana-AQlZomQ6.js → solana-Cglhypga.js} +1 -1
  117. package/lib/{solanaEmbed.esm-B_5axZif.js → solanaEmbed.esm-8VvaQIYa.js} +1 -1
  118. package/lib/{solanaEmbed.esm-DEMxZG02.mjs → solanaEmbed.esm-DfSXcnar.mjs} +4 -4
  119. package/lib/src/components/v2/Button.d.ts +1 -1
  120. package/lib/src/components/v2/Button.d.ts.map +1 -1
  121. package/lib/src/config/types.d.ts +17 -3
  122. package/lib/src/config/types.d.ts.map +1 -1
  123. package/lib/src/hooks/useTransactionHistory.d.ts +1 -1
  124. package/lib/src/hooks/useTransactionHistory.d.ts.map +1 -1
  125. package/lib/src/hooks/useTransactionHistoryMayan.d.ts.map +1 -1
  126. package/lib/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  127. package/lib/src/icons/TxReadyForClaim.d.ts +2 -2
  128. package/lib/src/icons/TxReadyForClaim.d.ts.map +1 -1
  129. package/lib/src/utils/inProgressTxCache.d.ts +5 -0
  130. package/lib/src/utils/inProgressTxCache.d.ts.map +1 -0
  131. package/lib/src/utils/polling.d.ts +5 -0
  132. package/lib/src/utils/polling.d.ts.map +1 -0
  133. package/lib/src/utils/sdkv2.d.ts +3 -2
  134. package/lib/src/utils/sdkv2.d.ts.map +1 -1
  135. package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  136. package/lib/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
  137. package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
  138. package/lib/src/views/v2/Redeem/index.d.ts.map +1 -1
  139. package/lib/src/views/v2/TxHistory/Widget/Item.d.ts +8 -0
  140. package/lib/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -0
  141. package/lib/src/views/v2/TxHistory/Widget/index.d.ts +4 -0
  142. package/lib/src/views/v2/TxHistory/Widget/index.d.ts.map +1 -0
  143. package/lib/src/views/v2/TxHistory/index.d.ts.map +1 -1
  144. package/lib/{sui-IAt2YxVB.js → sui-BLA0P5P1.js} +2 -2
  145. package/lib/{sui-tX-807Bw.js → sui-BMLSVXBy.js} +1 -1
  146. package/lib/{sui-DfdFzATl.mjs → sui-C73zQuHR.mjs} +1 -1
  147. package/lib/{sui-BpKCqOiX.mjs → sui-WPdV6u03.mjs} +4 -4
  148. package/lib/{unsignedTransaction-B1rzGa0o.mjs → unsignedTransaction-BWLDqwPd.mjs} +2 -2
  149. package/lib/{unsignedTransaction-BzNQ2WFS.js → unsignedTransaction-Cl0WbHFW.js} +1 -1
  150. package/lib/{utils-DZZcQv7V.js → utils-CA5brb9u.js} +1 -1
  151. package/lib/{utils-Xa6ErDQY.mjs → utils-Cd5O9nI7.mjs} +2 -2
  152. package/package.json +1 -1
  153. package/lib/solana-6EZacoKb.js +0 -1
  154. package/lib/solana-CbB3tRah.mjs +0 -16
@@ -1,6 +1,6 @@
1
- import { n as _t, s as ce, T as N, o as ot, R as Do, a as C, t as H, p as K, y as gt } from "./index-BUcxdUpo.mjs";
1
+ import { n as _t, s as ce, T as N, o as ot, R as Do, a as C, t as H, p as K, y as gt } from "./index-D0W1ZmqN.mjs";
2
2
  import { d as Uo } from "./dijkstra-BZM-8g-B.mjs";
3
- import { Z as Wo } from "./index-BDhzG0Bz.mjs";
3
+ import { Z as Wo } from "./index-CjwA7HmM.mjs";
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2019 Google LLC
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("./index-ByG9EJHX.js"),Bl=require("./dijkstra-CtFxn7S9.js"),Vt=require("./events-CG085uVS.js"),$=require("./index-eY_q88kc.js"),K=require("./index-DEfagu36.js");let kl=class extends $.r{constructor(e){super(e),this.events=new Vt.eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict($.formatJsonRpcRequest(e.method,e.params||[],e.id||$.getBigIntRpcId().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{$.isJsonRpcError(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),$.isJsonRpcResponse(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};var Dl=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],i=0;i<t.rangeCount;i++)r.push(t.getRangeAt(i));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return t.removeAllRanges(),function(){t.type==="Caret"&&t.removeAllRanges(),t.rangeCount||r.forEach(function(n){t.addRange(n)}),e&&e.focus()}},Ul=Dl,Po={"text/plain":"Text","text/html":"Url",default:"Text"},Ll="Copy to clipboard: #{key}, Enter";function ql(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}function $l(t,e){var r,i,n,s,o,a,h=!1;e||(e={}),r=e.debug||!1;try{n=Ul(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=t,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(p){if(p.stopPropagation(),e.format)if(p.preventDefault(),typeof p.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var y=Po[e.format]||Po.default;window.clipboardData.setData(y,t)}else p.clipboardData.clearData(),p.clipboardData.setData(e.format,t);e.onCopy&&(p.preventDefault(),e.onCopy(p.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var d=document.execCommand("copy");if(!d)throw new Error("copy command was unsuccessful");h=!0}catch(p){r&&console.error("unable to copy using execCommand: ",p),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(y){r&&console.error("unable to copy using clipboardData: ",y),r&&console.error("falling back to prompt"),i=ql("message"in e?e.message:Ll),window.prompt(i,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),n()}return h}var zl=$l,jl={}.toString,Zs=Array.isArray||function(t){return jl.call(t)=="[object Array]"},Kl=Z.requireElliptic(),eo={},ze={};Object.defineProperty(ze,"__esModule",{value:!0});var Oc=ze.getLocalStorage=Hc=ze.getLocalStorageOrThrow=Kc=ze.getCrypto=jc=ze.getCryptoOrThrow=zc=ze.getLocation=$c=ze.getLocationOrThrow=qc=ze.getNavigator=Lc=ze.getNavigatorOrThrow=Uc=ze.getDocument=Dc=ze.getDocumentOrThrow=kc=ze.getFromWindowOrThrow=Bc=ze.getFromWindow=void 0;function Ur(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}var Bc=ze.getFromWindow=Ur;function si(t){const e=Ur(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}var kc=ze.getFromWindowOrThrow=si;function Hl(){return si("document")}var Dc=ze.getDocumentOrThrow=Hl;function Vl(){return Ur("document")}var Uc=ze.getDocument=Vl;function Jl(){return si("navigator")}var Lc=ze.getNavigatorOrThrow=Jl;function Wl(){return Ur("navigator")}var qc=ze.getNavigator=Wl;function Gl(){return si("location")}var $c=ze.getLocationOrThrow=Gl;function Ql(){return Ur("location")}var zc=ze.getLocation=Ql;function Yl(){return si("crypto")}var jc=ze.getCryptoOrThrow=Yl;function Xl(){return Ur("crypto")}var Kc=ze.getCrypto=Xl;function Zl(){return si("localStorage")}var Hc=ze.getLocalStorageOrThrow=Zl;function ef(){return Ur("localStorage")}Oc=ze.getLocalStorage=ef;Object.defineProperty(eo,"__esModule",{value:!0});var Vc=eo.getWindowMetadata=void 0;const To=ze;function tf(){let t,e;try{t=To.getDocumentOrThrow(),e=To.getLocationOrThrow()}catch{return null}function r(){const y=t.getElementsByTagName("link"),C=[];for(let E=0;E<y.length;E++){const v=y[E],k=v.getAttribute("rel");if(k&&k.toLowerCase().indexOf("icon")>-1){const B=v.getAttribute("href");if(B)if(B.toLowerCase().indexOf("https:")===-1&&B.toLowerCase().indexOf("http:")===-1&&B.indexOf("//")!==0){let U=e.protocol+"//"+e.host;if(B.indexOf("/")===0)U+=B;else{const A=e.pathname.split("/");A.pop();const F=A.join("/");U+=F+"/"+B}C.push(U)}else if(B.indexOf("//")===0){const U=e.protocol+B;C.push(U)}else C.push(B)}}return C}function i(...y){const C=t.getElementsByTagName("meta");for(let E=0;E<C.length;E++){const v=C[E],k=["itemprop","property","name"].map(B=>v.getAttribute(B)).filter(B=>B?y.includes(B):!1);if(k.length&&k){const B=v.getAttribute("content");if(B)return B}}return""}function n(){let y=i("name","og:site_name","og:title","twitter:title");return y||(y=t.title),y}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,d=r();return{description:a,url:h,icons:d,name:o}}Vc=eo.getWindowMetadata=tf;var rf=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},nf=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),sf=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=Z.dist.process.platform}return t}(),of=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),af=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),cf=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),hf=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,uf=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Oo=3,lf=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",hf]],Bo=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function ff(t){return t?ko(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new cf:typeof navigator<"u"?ko(navigator.userAgent):gf()}function df(t){return t!==""&&lf.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function ko(t){var e=df(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new af;var n=i[1]&&i[1].split(/[._]/).slice(0,3);n?n.length<Oo&&(n=rf(n,mf(Oo-n.length))):n=[];var s=n.join("."),o=pf(t),a=uf.exec(t);return a&&a[1]?new of(r,s,o,a[1]):new nf(r,s,o)}function pf(t){for(var e=0,r=Bo.length;e<r;e++){var i=Bo[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function gf(){var t=typeof Z.dist.process<"u"&&Z.dist.process.version;return t?new sf(Z.dist.process.version.slice(1)):null}function mf(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function to(t){return ff(t)}function En(){const t=to();return t&&t.os?t.os:void 0}function Jc(){const t=En();return t?t.toLowerCase().includes("android"):!1}function Wc(){const t=En();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function yf(){return En()?Jc()||Wc():!1}function Gc(){const t=to();return t&&t.name?t.name.toLowerCase()==="node":!1}function wf(){return!Gc()&&!!Qc()}const vf=Bc,bf=kc,_f=Dc,Af=Uc,Ef=Lc,Qc=qc,Sf=$c,If=zc,Mf=jc,Nf=Kc,xf=Hc,Sn=Oc;function Cf(){return Vc()}function Ff(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Rf(t){return typeof t=="string"?t:JSON.stringify(t)}const Yc=Ff,Xc=Rf;function Zc(t,e){const r=Xc(e),i=Sn();i&&i.setItem(t,r)}function Pf(t){let e=null,r=null;const i=Sn();return i&&(r=i.getItem(t)),e=r&&Yc(r),e}function Tf(t){const e=Sn();e&&e.removeItem(t)}const eh="WALLETCONNECT_DEEPLINK_CHOICE";function Of(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function Bf(t){const e=t.href.split("?")[0];Zc(eh,Object.assign(Object.assign({},t),{href:e}))}function th(t,e){return t.filter(r=>r.name.toLowerCase().includes(e.toLowerCase()))[0]}function kf(t,e){let r=t;return e&&(r=e.map(i=>th(t,i)).filter(Boolean)),r}const rh="https://registry.walletconnect.com";function Df(){return rh+"/api/v2/wallets"}function Uf(){return rh+"/api/v2/dapps"}function ih(t,e="mobile"){var r;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(r=t.image_url.sm)!==null&&r!==void 0?r:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function Lf(t,e="mobile"){return Object.values(t).filter(r=>!!r[e].universal||!!r[e].native).map(r=>ih(r,e))}const qf=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:to,detectOS:En,formatIOSMobile:Of,formatMobileRegistry:Lf,formatMobileRegistryEntry:ih,getClientMeta:Cf,getCrypto:Nf,getCryptoOrThrow:Mf,getDappRegistryUrl:Uf,getDocument:Af,getDocumentOrThrow:_f,getFromWindow:vf,getFromWindowOrThrow:bf,getLocal:Pf,getLocalStorage:Sn,getLocalStorageOrThrow:xf,getLocation:If,getLocationOrThrow:Sf,getMobileLinkRegistry:kf,getMobileRegistryEntry:th,getNavigator:Qc,getNavigatorOrThrow:Ef,getWalletRegistryUrl:Df,isAndroid:Jc,isBrowser:wf,isIOS:Wc,isMobile:yf,isNode:Gc,mobileLinkChoiceKey:eh,removeLocal:Tf,safeJsonParse:Yc,safeJsonStringify:Xc,saveMobileLinkInfo:Bf,setLocal:Zc},Symbol.toStringTag,{value:"Module"})),$f=Z.getAugmentedNamespace(qf);var Oi={},zf=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},nh={},Fr={},jf=Zs;function Kf(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},t.foo()===42}catch{return!1}}Pe.TYPED_ARRAY_SUPPORT=Kf();var Do=Pe.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function Pe(t,e,r){return!Pe.TYPED_ARRAY_SUPPORT&&!(this instanceof Pe)?new Pe(t,e,r):typeof t=="number"?sh(this,t):Yf(this,t,e,r)}Pe.TYPED_ARRAY_SUPPORT&&(Pe.prototype.__proto__=Uint8Array.prototype,Pe.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&Pe[Symbol.species]===Pe&&Object.defineProperty(Pe,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function ro(t){if(t>=Do)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Do.toString(16)+" bytes");return t|0}function Hf(t){return t!==t}function Yr(t,e){var r;return Pe.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=Pe.prototype):(r=t,r===null&&(r=new Pe(e)),r.length=e),r}function sh(t,e){var r=Yr(t,e<0?0:ro(e)|0);if(!Pe.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)r[i]=0;return r}function Vf(t,e){var r=ah(e)|0,i=Yr(t,r),n=i.write(e);return n!==r&&(i=i.slice(0,n)),i}function Ms(t,e){for(var r=e.length<0?0:ro(e.length)|0,i=Yr(t,r),n=0;n<r;n+=1)i[n]=e[n]&255;return i}function Jf(t,e,r,i){if(r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");var n;return r===void 0&&i===void 0?n=new Uint8Array(e):i===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,i),Pe.TYPED_ARRAY_SUPPORT?n.__proto__=Pe.prototype:n=Ms(t,n),n}function Wf(t,e){if(Pe.isBuffer(e)){var r=ro(e.length)|0,i=Yr(t,r);return i.length===0||e.copy(i,0,0,r),i}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Hf(e.length)?Yr(t,0):Ms(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return Ms(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function oh(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ah(t){if(Pe.isBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;return e===0?0:oh(t).length}function Gf(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Qf(t,e,r,i){return Gf(oh(e,t.length-r),t,r,i)}function Yf(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Jf(t,e,r,i):typeof e=="string"?Vf(t,e):Wf(t,e)}Pe.prototype.write=function(e,r,i){r===void 0?(i=this.length,r=0):i===void 0&&typeof r=="string"?(i=this.length,r=0):isFinite(r)&&(r=r|0,isFinite(i)?i=i|0:i=void 0);var n=this.length-r;if((i===void 0||i>n)&&(i=n),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");return Qf(this,e,r,i)};Pe.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(Pe.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=Pe.prototype;else{var s=r-e;n=new Pe(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+e]}return n};Pe.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,o;if(this===e&&i<r&&r<n)for(o=s-1;o>=0;--o)e[o+r]=this[o+i];else if(s<1e3||!Pe.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s};Pe.prototype.fill=function(e,r,i){if(typeof e=="string"){if(typeof r=="string"?(r=0,i=this.length):typeof i=="string"&&(i=this.length),e.length===1){var n=e.charCodeAt(0);n<256&&(e=n)}}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{var o=Pe.isBuffer(e)?e:new Pe(e),a=o.length;for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};Pe.concat=function(e,r){if(!jf(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return Yr(null,0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=sh(null,r),s=0;for(i=0;i<e.length;++i){var o=e[i];if(!Pe.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};Pe.byteLength=ah;Pe.prototype._isBuffer=!0;Pe.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};Fr.alloc=function(t){var e=new Pe(t);return e.fill(0),e};Fr.from=function(t){return new Pe(t)};var Pt={},io,Xf=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Pt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Pt.getSymbolTotalCodewords=function(e){return Xf[e]};Pt.getBCHDigit=function(t){for(var e=0;t!==0;)e++,t>>>=1;return e};Pt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');io=e};Pt.isKanjiModeEnabled=function(){return typeof io<"u"};Pt.toSJIS=function(e){return io(e)};var In={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");var i=r.toLowerCase();switch(i){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(In);function ch(){this.buffer=[],this.length=0}ch.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Zf=ch,Uo=Fr;function Bi(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=Uo.alloc(t*t),this.reservedBit=Uo.alloc(t*t)}Bi.prototype.set=function(t,e,r,i){var n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)};Bi.prototype.get=function(t,e){return this.data[t*this.size+e]};Bi.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Bi.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var ed=Bi,hh={};(function(t){var e=Pt.getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];for(var n=Math.floor(i/7)+2,s=e(i),o=s===145?26:Math.ceil((s-13)/(2*n-2))*2,a=[s-7],h=1;h<n-1;h++)a[h]=a[h-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){for(var n=[],s=t.getRowColCoords(i),o=s.length,a=0;a<o;a++)for(var h=0;h<o;h++)a===0&&h===0||a===0&&h===o-1||a===o-1&&h===0||n.push([s[a],s[h]]);return n}})(hh);var uh={},td=Pt.getSymbolSize,Lo=7;uh.getPositions=function(e){var r=td(e);return[[0,0],[r-Lo,0],[0,r-Lo]]};var lh={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){for(var s=n.size,o=0,a=0,h=0,d=null,p=null,y=0;y<s;y++){a=h=0,d=p=null;for(var C=0;C<s;C++){var E=n.get(y,C);E===d?a++:(a>=5&&(o+=e.N1+(a-5)),d=E,a=1),E=n.get(C,y),E===p?h++:(h>=5&&(o+=e.N1+(h-5)),p=E,h=1)}a>=5&&(o+=e.N1+(a-5)),h>=5&&(o+=e.N1+(h-5))}return o},t.getPenaltyN2=function(n){for(var s=n.size,o=0,a=0;a<s-1;a++)for(var h=0;h<s-1;h++){var d=n.get(a,h)+n.get(a,h+1)+n.get(a+1,h)+n.get(a+1,h+1);(d===4||d===0)&&o++}return o*e.N2},t.getPenaltyN3=function(n){for(var s=n.size,o=0,a=0,h=0,d=0;d<s;d++){a=h=0;for(var p=0;p<s;p++)a=a<<1&2047|n.get(d,p),p>=10&&(a===1488||a===93)&&o++,h=h<<1&2047|n.get(p,d),p>=10&&(h===1488||h===93)&&o++}return o*e.N3},t.getPenaltyN4=function(n){for(var s=0,o=n.data.length,a=0;a<o;a++)s+=n.data[a];var h=Math.abs(Math.ceil(s*100/o/5)-10);return h*e.N4};function r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){for(var o=s.size,a=0;a<o;a++)for(var h=0;h<o;h++)s.isReserved(h,a)||s.xor(h,a,r(n,h,a))},t.getBestMask=function(n,s){for(var o=Object.keys(t.Patterns).length,a=0,h=1/0,d=0;d<o;d++){s(d),t.applyMask(d,n);var p=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(d,n),p<h&&(h=p,a=d)}return a}})(lh);var Mn={},xr=In,Vi=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ji=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Mn.getBlocksCount=function(e,r){switch(r){case xr.L:return Vi[(e-1)*4+0];case xr.M:return Vi[(e-1)*4+1];case xr.Q:return Vi[(e-1)*4+2];case xr.H:return Vi[(e-1)*4+3];default:return}};Mn.getTotalCodewordsCount=function(e,r){switch(r){case xr.L:return Ji[(e-1)*4+0];case xr.M:return Ji[(e-1)*4+1];case xr.Q:return Ji[(e-1)*4+2];case xr.H:return Ji[(e-1)*4+3];default:return}};var fh={},Nn={},dh=Fr,_i=dh.alloc(512),cn=dh.alloc(256);(function(){for(var e=1,r=0;r<255;r++)_i[r]=e,cn[e]=r,e<<=1,e&256&&(e^=285);for(r=255;r<512;r++)_i[r]=_i[r-255]})();Nn.log=function(e){if(e<1)throw new Error("log("+e+")");return cn[e]};Nn.exp=function(e){return _i[e]};Nn.mul=function(e,r){return e===0||r===0?0:_i[cn[e]+cn[r]]};(function(t){var e=Fr,r=Nn;t.mul=function(n,s){for(var o=e.alloc(n.length+s.length-1),a=0;a<n.length;a++)for(var h=0;h<s.length;h++)o[a+h]^=r.mul(n[a],s[h]);return o},t.mod=function(n,s){for(var o=e.from(n);o.length-s.length>=0;){for(var a=o[0],h=0;h<s.length;h++)o[h]^=r.mul(s[h],a);for(var d=0;d<o.length&&o[d]===0;)d++;o=o.slice(d)}return o},t.generateECPolynomial=function(n){for(var s=e.from([1]),o=0;o<n;o++)s=t.mul(s,[1,r.exp(o)]);return s}})(fh);var qo=Fr,ph=fh,rd=Z.bufferPolyfill.Buffer;function no(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}no.prototype.initialize=function(e){this.degree=e,this.genPoly=ph.generateECPolynomial(this.degree)};no.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var r=qo.alloc(this.degree),i=rd.concat([e,r],e.length+this.degree),n=ph.mod(i,this.genPoly),s=this.degree-n.length;if(s>0){var o=qo.alloc(this.degree);return n.copy(o,s),o}return n};var id=no,gh={},Rr={},so={};so.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var nr={},mh="[0-9]+",nd="[A-Z $%*+\\-./:]+",Ni="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ni=Ni.replace(/u/g,"\\u");var sd="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ni+`)(?:.|[\r
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("./index-CDGktAjP.js"),Bl=require("./dijkstra-CtFxn7S9.js"),Vt=require("./events-wpqGOay9.js"),$=require("./index-DVKptZW_.js"),K=require("./index-CtJdy4GW.js");let kl=class extends $.r{constructor(e){super(e),this.events=new Vt.eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict($.formatJsonRpcRequest(e.method,e.params||[],e.id||$.getBigIntRpcId().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{$.isJsonRpcError(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),$.isJsonRpcResponse(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};var Dl=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],i=0;i<t.rangeCount;i++)r.push(t.getRangeAt(i));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return t.removeAllRanges(),function(){t.type==="Caret"&&t.removeAllRanges(),t.rangeCount||r.forEach(function(n){t.addRange(n)}),e&&e.focus()}},Ul=Dl,Po={"text/plain":"Text","text/html":"Url",default:"Text"},Ll="Copy to clipboard: #{key}, Enter";function ql(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}function $l(t,e){var r,i,n,s,o,a,h=!1;e||(e={}),r=e.debug||!1;try{n=Ul(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=t,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(p){if(p.stopPropagation(),e.format)if(p.preventDefault(),typeof p.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var y=Po[e.format]||Po.default;window.clipboardData.setData(y,t)}else p.clipboardData.clearData(),p.clipboardData.setData(e.format,t);e.onCopy&&(p.preventDefault(),e.onCopy(p.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var d=document.execCommand("copy");if(!d)throw new Error("copy command was unsuccessful");h=!0}catch(p){r&&console.error("unable to copy using execCommand: ",p),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(y){r&&console.error("unable to copy using clipboardData: ",y),r&&console.error("falling back to prompt"),i=ql("message"in e?e.message:Ll),window.prompt(i,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),n()}return h}var zl=$l,jl={}.toString,Zs=Array.isArray||function(t){return jl.call(t)=="[object Array]"},Kl=Z.requireElliptic(),eo={},ze={};Object.defineProperty(ze,"__esModule",{value:!0});var Oc=ze.getLocalStorage=Hc=ze.getLocalStorageOrThrow=Kc=ze.getCrypto=jc=ze.getCryptoOrThrow=zc=ze.getLocation=$c=ze.getLocationOrThrow=qc=ze.getNavigator=Lc=ze.getNavigatorOrThrow=Uc=ze.getDocument=Dc=ze.getDocumentOrThrow=kc=ze.getFromWindowOrThrow=Bc=ze.getFromWindow=void 0;function Ur(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}var Bc=ze.getFromWindow=Ur;function si(t){const e=Ur(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}var kc=ze.getFromWindowOrThrow=si;function Hl(){return si("document")}var Dc=ze.getDocumentOrThrow=Hl;function Vl(){return Ur("document")}var Uc=ze.getDocument=Vl;function Jl(){return si("navigator")}var Lc=ze.getNavigatorOrThrow=Jl;function Wl(){return Ur("navigator")}var qc=ze.getNavigator=Wl;function Gl(){return si("location")}var $c=ze.getLocationOrThrow=Gl;function Ql(){return Ur("location")}var zc=ze.getLocation=Ql;function Yl(){return si("crypto")}var jc=ze.getCryptoOrThrow=Yl;function Xl(){return Ur("crypto")}var Kc=ze.getCrypto=Xl;function Zl(){return si("localStorage")}var Hc=ze.getLocalStorageOrThrow=Zl;function ef(){return Ur("localStorage")}Oc=ze.getLocalStorage=ef;Object.defineProperty(eo,"__esModule",{value:!0});var Vc=eo.getWindowMetadata=void 0;const To=ze;function tf(){let t,e;try{t=To.getDocumentOrThrow(),e=To.getLocationOrThrow()}catch{return null}function r(){const y=t.getElementsByTagName("link"),C=[];for(let E=0;E<y.length;E++){const v=y[E],k=v.getAttribute("rel");if(k&&k.toLowerCase().indexOf("icon")>-1){const B=v.getAttribute("href");if(B)if(B.toLowerCase().indexOf("https:")===-1&&B.toLowerCase().indexOf("http:")===-1&&B.indexOf("//")!==0){let U=e.protocol+"//"+e.host;if(B.indexOf("/")===0)U+=B;else{const A=e.pathname.split("/");A.pop();const F=A.join("/");U+=F+"/"+B}C.push(U)}else if(B.indexOf("//")===0){const U=e.protocol+B;C.push(U)}else C.push(B)}}return C}function i(...y){const C=t.getElementsByTagName("meta");for(let E=0;E<C.length;E++){const v=C[E],k=["itemprop","property","name"].map(B=>v.getAttribute(B)).filter(B=>B?y.includes(B):!1);if(k.length&&k){const B=v.getAttribute("content");if(B)return B}}return""}function n(){let y=i("name","og:site_name","og:title","twitter:title");return y||(y=t.title),y}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,d=r();return{description:a,url:h,icons:d,name:o}}Vc=eo.getWindowMetadata=tf;var rf=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},nf=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),sf=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=Z.dist.process.platform}return t}(),of=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),af=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),cf=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),hf=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,uf=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Oo=3,lf=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",hf]],Bo=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function ff(t){return t?ko(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new cf:typeof navigator<"u"?ko(navigator.userAgent):gf()}function df(t){return t!==""&&lf.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function ko(t){var e=df(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new af;var n=i[1]&&i[1].split(/[._]/).slice(0,3);n?n.length<Oo&&(n=rf(n,mf(Oo-n.length))):n=[];var s=n.join("."),o=pf(t),a=uf.exec(t);return a&&a[1]?new of(r,s,o,a[1]):new nf(r,s,o)}function pf(t){for(var e=0,r=Bo.length;e<r;e++){var i=Bo[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function gf(){var t=typeof Z.dist.process<"u"&&Z.dist.process.version;return t?new sf(Z.dist.process.version.slice(1)):null}function mf(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function to(t){return ff(t)}function En(){const t=to();return t&&t.os?t.os:void 0}function Jc(){const t=En();return t?t.toLowerCase().includes("android"):!1}function Wc(){const t=En();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function yf(){return En()?Jc()||Wc():!1}function Gc(){const t=to();return t&&t.name?t.name.toLowerCase()==="node":!1}function wf(){return!Gc()&&!!Qc()}const vf=Bc,bf=kc,_f=Dc,Af=Uc,Ef=Lc,Qc=qc,Sf=$c,If=zc,Mf=jc,Nf=Kc,xf=Hc,Sn=Oc;function Cf(){return Vc()}function Ff(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Rf(t){return typeof t=="string"?t:JSON.stringify(t)}const Yc=Ff,Xc=Rf;function Zc(t,e){const r=Xc(e),i=Sn();i&&i.setItem(t,r)}function Pf(t){let e=null,r=null;const i=Sn();return i&&(r=i.getItem(t)),e=r&&Yc(r),e}function Tf(t){const e=Sn();e&&e.removeItem(t)}const eh="WALLETCONNECT_DEEPLINK_CHOICE";function Of(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function Bf(t){const e=t.href.split("?")[0];Zc(eh,Object.assign(Object.assign({},t),{href:e}))}function th(t,e){return t.filter(r=>r.name.toLowerCase().includes(e.toLowerCase()))[0]}function kf(t,e){let r=t;return e&&(r=e.map(i=>th(t,i)).filter(Boolean)),r}const rh="https://registry.walletconnect.com";function Df(){return rh+"/api/v2/wallets"}function Uf(){return rh+"/api/v2/dapps"}function ih(t,e="mobile"){var r;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(r=t.image_url.sm)!==null&&r!==void 0?r:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function Lf(t,e="mobile"){return Object.values(t).filter(r=>!!r[e].universal||!!r[e].native).map(r=>ih(r,e))}const qf=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:to,detectOS:En,formatIOSMobile:Of,formatMobileRegistry:Lf,formatMobileRegistryEntry:ih,getClientMeta:Cf,getCrypto:Nf,getCryptoOrThrow:Mf,getDappRegistryUrl:Uf,getDocument:Af,getDocumentOrThrow:_f,getFromWindow:vf,getFromWindowOrThrow:bf,getLocal:Pf,getLocalStorage:Sn,getLocalStorageOrThrow:xf,getLocation:If,getLocationOrThrow:Sf,getMobileLinkRegistry:kf,getMobileRegistryEntry:th,getNavigator:Qc,getNavigatorOrThrow:Ef,getWalletRegistryUrl:Df,isAndroid:Jc,isBrowser:wf,isIOS:Wc,isMobile:yf,isNode:Gc,mobileLinkChoiceKey:eh,removeLocal:Tf,safeJsonParse:Yc,safeJsonStringify:Xc,saveMobileLinkInfo:Bf,setLocal:Zc},Symbol.toStringTag,{value:"Module"})),$f=Z.getAugmentedNamespace(qf);var Oi={},zf=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},nh={},Fr={},jf=Zs;function Kf(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},t.foo()===42}catch{return!1}}Pe.TYPED_ARRAY_SUPPORT=Kf();var Do=Pe.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function Pe(t,e,r){return!Pe.TYPED_ARRAY_SUPPORT&&!(this instanceof Pe)?new Pe(t,e,r):typeof t=="number"?sh(this,t):Yf(this,t,e,r)}Pe.TYPED_ARRAY_SUPPORT&&(Pe.prototype.__proto__=Uint8Array.prototype,Pe.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&Pe[Symbol.species]===Pe&&Object.defineProperty(Pe,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function ro(t){if(t>=Do)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Do.toString(16)+" bytes");return t|0}function Hf(t){return t!==t}function Yr(t,e){var r;return Pe.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=Pe.prototype):(r=t,r===null&&(r=new Pe(e)),r.length=e),r}function sh(t,e){var r=Yr(t,e<0?0:ro(e)|0);if(!Pe.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)r[i]=0;return r}function Vf(t,e){var r=ah(e)|0,i=Yr(t,r),n=i.write(e);return n!==r&&(i=i.slice(0,n)),i}function Ms(t,e){for(var r=e.length<0?0:ro(e.length)|0,i=Yr(t,r),n=0;n<r;n+=1)i[n]=e[n]&255;return i}function Jf(t,e,r,i){if(r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");var n;return r===void 0&&i===void 0?n=new Uint8Array(e):i===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,i),Pe.TYPED_ARRAY_SUPPORT?n.__proto__=Pe.prototype:n=Ms(t,n),n}function Wf(t,e){if(Pe.isBuffer(e)){var r=ro(e.length)|0,i=Yr(t,r);return i.length===0||e.copy(i,0,0,r),i}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Hf(e.length)?Yr(t,0):Ms(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return Ms(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function oh(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ah(t){if(Pe.isBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;return e===0?0:oh(t).length}function Gf(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Qf(t,e,r,i){return Gf(oh(e,t.length-r),t,r,i)}function Yf(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Jf(t,e,r,i):typeof e=="string"?Vf(t,e):Wf(t,e)}Pe.prototype.write=function(e,r,i){r===void 0?(i=this.length,r=0):i===void 0&&typeof r=="string"?(i=this.length,r=0):isFinite(r)&&(r=r|0,isFinite(i)?i=i|0:i=void 0);var n=this.length-r;if((i===void 0||i>n)&&(i=n),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");return Qf(this,e,r,i)};Pe.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(Pe.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=Pe.prototype;else{var s=r-e;n=new Pe(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+e]}return n};Pe.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,o;if(this===e&&i<r&&r<n)for(o=s-1;o>=0;--o)e[o+r]=this[o+i];else if(s<1e3||!Pe.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s};Pe.prototype.fill=function(e,r,i){if(typeof e=="string"){if(typeof r=="string"?(r=0,i=this.length):typeof i=="string"&&(i=this.length),e.length===1){var n=e.charCodeAt(0);n<256&&(e=n)}}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{var o=Pe.isBuffer(e)?e:new Pe(e),a=o.length;for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};Pe.concat=function(e,r){if(!jf(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return Yr(null,0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=sh(null,r),s=0;for(i=0;i<e.length;++i){var o=e[i];if(!Pe.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};Pe.byteLength=ah;Pe.prototype._isBuffer=!0;Pe.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};Fr.alloc=function(t){var e=new Pe(t);return e.fill(0),e};Fr.from=function(t){return new Pe(t)};var Pt={},io,Xf=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Pt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Pt.getSymbolTotalCodewords=function(e){return Xf[e]};Pt.getBCHDigit=function(t){for(var e=0;t!==0;)e++,t>>>=1;return e};Pt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');io=e};Pt.isKanjiModeEnabled=function(){return typeof io<"u"};Pt.toSJIS=function(e){return io(e)};var In={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");var i=r.toLowerCase();switch(i){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(In);function ch(){this.buffer=[],this.length=0}ch.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Zf=ch,Uo=Fr;function Bi(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=Uo.alloc(t*t),this.reservedBit=Uo.alloc(t*t)}Bi.prototype.set=function(t,e,r,i){var n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)};Bi.prototype.get=function(t,e){return this.data[t*this.size+e]};Bi.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Bi.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var ed=Bi,hh={};(function(t){var e=Pt.getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];for(var n=Math.floor(i/7)+2,s=e(i),o=s===145?26:Math.ceil((s-13)/(2*n-2))*2,a=[s-7],h=1;h<n-1;h++)a[h]=a[h-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){for(var n=[],s=t.getRowColCoords(i),o=s.length,a=0;a<o;a++)for(var h=0;h<o;h++)a===0&&h===0||a===0&&h===o-1||a===o-1&&h===0||n.push([s[a],s[h]]);return n}})(hh);var uh={},td=Pt.getSymbolSize,Lo=7;uh.getPositions=function(e){var r=td(e);return[[0,0],[r-Lo,0],[0,r-Lo]]};var lh={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){for(var s=n.size,o=0,a=0,h=0,d=null,p=null,y=0;y<s;y++){a=h=0,d=p=null;for(var C=0;C<s;C++){var E=n.get(y,C);E===d?a++:(a>=5&&(o+=e.N1+(a-5)),d=E,a=1),E=n.get(C,y),E===p?h++:(h>=5&&(o+=e.N1+(h-5)),p=E,h=1)}a>=5&&(o+=e.N1+(a-5)),h>=5&&(o+=e.N1+(h-5))}return o},t.getPenaltyN2=function(n){for(var s=n.size,o=0,a=0;a<s-1;a++)for(var h=0;h<s-1;h++){var d=n.get(a,h)+n.get(a,h+1)+n.get(a+1,h)+n.get(a+1,h+1);(d===4||d===0)&&o++}return o*e.N2},t.getPenaltyN3=function(n){for(var s=n.size,o=0,a=0,h=0,d=0;d<s;d++){a=h=0;for(var p=0;p<s;p++)a=a<<1&2047|n.get(d,p),p>=10&&(a===1488||a===93)&&o++,h=h<<1&2047|n.get(p,d),p>=10&&(h===1488||h===93)&&o++}return o*e.N3},t.getPenaltyN4=function(n){for(var s=0,o=n.data.length,a=0;a<o;a++)s+=n.data[a];var h=Math.abs(Math.ceil(s*100/o/5)-10);return h*e.N4};function r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){for(var o=s.size,a=0;a<o;a++)for(var h=0;h<o;h++)s.isReserved(h,a)||s.xor(h,a,r(n,h,a))},t.getBestMask=function(n,s){for(var o=Object.keys(t.Patterns).length,a=0,h=1/0,d=0;d<o;d++){s(d),t.applyMask(d,n);var p=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(d,n),p<h&&(h=p,a=d)}return a}})(lh);var Mn={},xr=In,Vi=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ji=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Mn.getBlocksCount=function(e,r){switch(r){case xr.L:return Vi[(e-1)*4+0];case xr.M:return Vi[(e-1)*4+1];case xr.Q:return Vi[(e-1)*4+2];case xr.H:return Vi[(e-1)*4+3];default:return}};Mn.getTotalCodewordsCount=function(e,r){switch(r){case xr.L:return Ji[(e-1)*4+0];case xr.M:return Ji[(e-1)*4+1];case xr.Q:return Ji[(e-1)*4+2];case xr.H:return Ji[(e-1)*4+3];default:return}};var fh={},Nn={},dh=Fr,_i=dh.alloc(512),cn=dh.alloc(256);(function(){for(var e=1,r=0;r<255;r++)_i[r]=e,cn[e]=r,e<<=1,e&256&&(e^=285);for(r=255;r<512;r++)_i[r]=_i[r-255]})();Nn.log=function(e){if(e<1)throw new Error("log("+e+")");return cn[e]};Nn.exp=function(e){return _i[e]};Nn.mul=function(e,r){return e===0||r===0?0:_i[cn[e]+cn[r]]};(function(t){var e=Fr,r=Nn;t.mul=function(n,s){for(var o=e.alloc(n.length+s.length-1),a=0;a<n.length;a++)for(var h=0;h<s.length;h++)o[a+h]^=r.mul(n[a],s[h]);return o},t.mod=function(n,s){for(var o=e.from(n);o.length-s.length>=0;){for(var a=o[0],h=0;h<s.length;h++)o[h]^=r.mul(s[h],a);for(var d=0;d<o.length&&o[d]===0;)d++;o=o.slice(d)}return o},t.generateECPolynomial=function(n){for(var s=e.from([1]),o=0;o<n;o++)s=t.mul(s,[1,r.exp(o)]);return s}})(fh);var qo=Fr,ph=fh,rd=Z.bufferPolyfill.Buffer;function no(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}no.prototype.initialize=function(e){this.degree=e,this.genPoly=ph.generateECPolynomial(this.degree)};no.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var r=qo.alloc(this.degree),i=rd.concat([e,r],e.length+this.degree),n=ph.mod(i,this.genPoly),s=this.degree-n.length;if(s>0){var o=qo.alloc(this.degree);return n.copy(o,s),o}return n};var id=no,gh={},Rr={},so={};so.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var nr={},mh="[0-9]+",nd="[A-Z $%*+\\-./:]+",Ni="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ni=Ni.replace(/u/g,"\\u");var sd="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ni+`)(?:.|[\r
2
2
  ]))+`;nr.KANJI=new RegExp(Ni,"g");nr.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");nr.BYTE=new RegExp(sd,"g");nr.NUMERIC=new RegExp(mh,"g");nr.ALPHANUMERIC=new RegExp(nd,"g");var od=new RegExp("^"+Ni+"$"),ad=new RegExp("^"+mh+"$"),cd=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");nr.testKanji=function(e){return od.test(e)};nr.testNumeric=function(e){return ad.test(e)};nr.testAlphanumeric=function(e){return cd.test(e)};(function(t){var e=so,r=nr;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,o){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?s.ccBits[0]:o<27?s.ccBits[1]:s.ccBits[2]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");var s=n.toLowerCase();switch(s){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}t.from=function(s,o){if(t.isValid(s))return s;try{return i(s)}catch{return o}}})(Rr);(function(t){var e=Pt,r=Mn,i=In,n=Rr,s=so,o=Zs,a=7973,h=e.getBCHDigit(a);function d(E,v,k){for(var B=1;B<=40;B++)if(v<=t.getCapacity(B,k,E))return B}function p(E,v){return n.getCharCountIndicator(E,v)+4}function y(E,v){var k=0;return E.forEach(function(B){var U=p(B.mode,v);k+=U+B.getBitsLength()}),k}function C(E,v){for(var k=1;k<=40;k++){var B=y(E,k);if(B<=t.getCapacity(k,v,n.MIXED))return k}}t.from=function(v,k){return s.isValid(v)?parseInt(v,10):k},t.getCapacity=function(v,k,B){if(!s.isValid(v))throw new Error("Invalid QR Code version");typeof B>"u"&&(B=n.BYTE);var U=e.getSymbolTotalCodewords(v),A=r.getTotalCodewordsCount(v,k),F=(U-A)*8;if(B===n.MIXED)return F;var R=F-p(B,v);switch(B){case n.NUMERIC:return Math.floor(R/10*3);case n.ALPHANUMERIC:return Math.floor(R/11*2);case n.KANJI:return Math.floor(R/13);case n.BYTE:default:return Math.floor(R/8)}},t.getBestVersionForData=function(v,k){var B,U=i.from(k,i.M);if(o(v)){if(v.length>1)return C(v,U);if(v.length===0)return 1;B=v[0]}else B=v;return d(B.mode,B.getLength(),U)},t.getEncodedBits=function(v){if(!s.isValid(v)||v<7)throw new Error("Invalid QR Code version");for(var k=v<<12;e.getBCHDigit(k)-h>=0;)k^=a<<e.getBCHDigit(k)-h;return v<<12|k}})(gh);var yh={},Ns=Pt,wh=1335,hd=21522,$o=Ns.getBCHDigit(wh);yh.getEncodedBits=function(e,r){for(var i=e.bit<<3|r,n=i<<10;Ns.getBCHDigit(n)-$o>=0;)n^=wh<<Ns.getBCHDigit(n)-$o;return(i<<10|n)^hd};var vh={},ud=Rr;function Xr(t){this.mode=ud.NUMERIC,this.data=t.toString()}Xr.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Xr.prototype.getLength=function(){return this.data.length};Xr.prototype.getBitsLength=function(){return Xr.getBitsLength(this.data.length)};Xr.prototype.write=function(e){var r,i,n;for(r=0;r+3<=this.data.length;r+=3)i=this.data.substr(r,3),n=parseInt(i,10),e.put(n,10);var s=this.data.length-r;s>0&&(i=this.data.substr(r),n=parseInt(i,10),e.put(n,s*3+1))};var ld=Xr,fd=Rr,Qn=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Zr(t){this.mode=fd.ALPHANUMERIC,this.data=t}Zr.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Zr.prototype.getLength=function(){return this.data.length};Zr.prototype.getBitsLength=function(){return Zr.getBitsLength(this.data.length)};Zr.prototype.write=function(e){var r;for(r=0;r+2<=this.data.length;r+=2){var i=Qn.indexOf(this.data[r])*45;i+=Qn.indexOf(this.data[r+1]),e.put(i,11)}this.data.length%2&&e.put(Qn.indexOf(this.data[r]),6)};var dd=Zr,pd=Fr,gd=Rr;function ei(t){this.mode=gd.BYTE,this.data=pd.from(t)}ei.getBitsLength=function(e){return e*8};ei.prototype.getLength=function(){return this.data.length};ei.prototype.getBitsLength=function(){return ei.getBitsLength(this.data.length)};ei.prototype.write=function(t){for(var e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var md=ei,yd=Rr,wd=Pt;function ti(t){this.mode=yd.KANJI,this.data=t}ti.getBitsLength=function(e){return e*13};ti.prototype.getLength=function(){return this.data.length};ti.prototype.getBitsLength=function(){return ti.getBitsLength(this.data.length)};ti.prototype.write=function(t){var e;for(e=0;e<this.data.length;e++){var r=wd.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
3
3
  Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var vd=ti;(function(t){var e=Rr,r=ld,i=dd,n=md,s=vd,o=nr,a=Pt,h=Bl.dijkstraExports;function d(U){return unescape(encodeURIComponent(U)).length}function p(U,A,F){for(var R=[],O;(O=U.exec(F))!==null;)R.push({data:O[0],index:O.index,mode:A,length:O[0].length});return R}function y(U){var A=p(o.NUMERIC,e.NUMERIC,U),F=p(o.ALPHANUMERIC,e.ALPHANUMERIC,U),R,O;a.isKanjiModeEnabled()?(R=p(o.BYTE,e.BYTE,U),O=p(o.KANJI,e.KANJI,U)):(R=p(o.BYTE_KANJI,e.BYTE,U),O=[]);var D=A.concat(F,R,O);return D.sort(function(L,q){return L.index-q.index}).map(function(L){return{data:L.data,mode:L.mode,length:L.length}})}function C(U,A){switch(A){case e.NUMERIC:return r.getBitsLength(U);case e.ALPHANUMERIC:return i.getBitsLength(U);case e.KANJI:return s.getBitsLength(U);case e.BYTE:return n.getBitsLength(U)}}function E(U){return U.reduce(function(A,F){var R=A.length-1>=0?A[A.length-1]:null;return R&&R.mode===F.mode?(A[A.length-1].data+=F.data,A):(A.push(F),A)},[])}function v(U){for(var A=[],F=0;F<U.length;F++){var R=U[F];switch(R.mode){case e.NUMERIC:A.push([R,{data:R.data,mode:e.ALPHANUMERIC,length:R.length},{data:R.data,mode:e.BYTE,length:R.length}]);break;case e.ALPHANUMERIC:A.push([R,{data:R.data,mode:e.BYTE,length:R.length}]);break;case e.KANJI:A.push([R,{data:R.data,mode:e.BYTE,length:d(R.data)}]);break;case e.BYTE:A.push([{data:R.data,mode:e.BYTE,length:d(R.data)}])}}return A}function k(U,A){for(var F={},R={start:{}},O=["start"],D=0;D<U.length;D++){for(var L=U[D],q=[],Q=0;Q<L.length;Q++){var ee=L[Q],te=""+D+Q;q.push(te),F[te]={node:ee,lastCount:0},R[te]={};for(var xe=0;xe<O.length;xe++){var c=O[xe];F[c]&&F[c].node.mode===ee.mode?(R[c][te]=C(F[c].lastCount+ee.length,ee.mode)-C(F[c].lastCount,ee.mode),F[c].lastCount+=ee.length):(F[c]&&(F[c].lastCount=ee.length),R[c][te]=C(ee.length,ee.mode)+4+e.getCharCountIndicator(ee.mode,A))}}O=q}for(xe=0;xe<O.length;xe++)R[O[xe]].end=0;return{map:R,table:F}}function B(U,A){var F,R=e.getBestModeForData(U);if(F=e.from(A,R),F!==e.BYTE&&F.bit<R.bit)throw new Error('"'+U+'" cannot be encoded with mode '+e.toString(F)+`.
4
4
  Suggested mode is: `+e.toString(R));switch(F===e.KANJI&&!a.isKanjiModeEnabled()&&(F=e.BYTE),F){case e.NUMERIC:return new r(U);case e.ALPHANUMERIC:return new i(U);case e.KANJI:return new s(U);case e.BYTE:return new n(U)}}t.fromArray=function(A){return A.reduce(function(F,R){return typeof R=="string"?F.push(B(R,null)):R.data&&F.push(B(R.data,R.mode)),F},[])},t.fromString=function(A,F){for(var R=y(A,a.isKanjiModeEnabled()),O=v(R),D=k(O,F),L=h.find_path(D.map,"start","end"),q=[],Q=1;Q<L.length-1;Q++)q.push(D.table[L[Q]].node);return t.fromArray(E(q))},t.rawSplit=function(A){return t.fromArray(y(A,a.isKanjiModeEnabled()))}})(vh);var zo=Fr,xn=Pt,Yn=In,bd=Zf,_d=ed,Ad=hh,Ed=uh,xs=lh,Cs=Mn,Sd=id,hn=gh,Id=yh,Md=Rr,Xn=vh,Nd=Zs;function xd(t,e){for(var r=t.size,i=Ed.getPositions(e),n=0;n<i.length;n++)for(var s=i[n][0],o=i[n][1],a=-1;a<=7;a++)if(!(s+a<=-1||r<=s+a))for(var h=-1;h<=7;h++)o+h<=-1||r<=o+h||(a>=0&&a<=6&&(h===0||h===6)||h>=0&&h<=6&&(a===0||a===6)||a>=2&&a<=4&&h>=2&&h<=4?t.set(s+a,o+h,!0,!0):t.set(s+a,o+h,!1,!0))}function Cd(t){for(var e=t.size,r=8;r<e-8;r++){var i=r%2===0;t.set(r,6,i,!0),t.set(6,r,i,!0)}}function Fd(t,e){for(var r=Ad.getPositions(e),i=0;i<r.length;i++)for(var n=r[i][0],s=r[i][1],o=-2;o<=2;o++)for(var a=-2;a<=2;a++)o===-2||o===2||a===-2||a===2||o===0&&a===0?t.set(n+o,s+a,!0,!0):t.set(n+o,s+a,!1,!0)}function Rd(t,e){for(var r=t.size,i=hn.getEncodedBits(e),n,s,o,a=0;a<18;a++)n=Math.floor(a/3),s=a%3+r-8-3,o=(i>>a&1)===1,t.set(n,s,o,!0),t.set(s,n,o,!0)}function Zn(t,e,r){var i=t.size,n=Id.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(i-15+s,8,o,!0),s<8?t.set(8,i-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(i-8,8,1,!0)}function Pd(t,e){for(var r=t.size,i=-1,n=r-1,s=7,o=0,a=r-1;a>0;a-=2)for(a===6&&a--;;){for(var h=0;h<2;h++)if(!t.isReserved(n,a-h)){var d=!1;o<e.length&&(d=(e[o]>>>s&1)===1),t.set(n,a-h,d),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||r<=n){n-=i,i=-i;break}}}function Td(t,e,r){var i=new bd;r.forEach(function(d){i.put(d.mode.bit,4),i.put(d.getLength(),Md.getCharCountIndicator(d.mode,t)),d.write(i)});var n=xn.getSymbolTotalCodewords(t),s=Cs.getTotalCodewordsCount(t,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);for(var a=(o-i.getLengthInBits())/8,h=0;h<a;h++)i.put(h%2?17:236,8);return Od(i,t,e)}function Od(t,e,r){for(var i=xn.getSymbolTotalCodewords(e),n=Cs.getTotalCodewordsCount(e,r),s=i-n,o=Cs.getBlocksCount(e,r),a=i%o,h=o-a,d=Math.floor(i/o),p=Math.floor(s/o),y=p+1,C=d-p,E=new Sd(C),v=0,k=new Array(o),B=new Array(o),U=0,A=zo.from(t.buffer),F=0;F<o;F++){var R=F<h?p:y;k[F]=A.slice(v,v+R),B[F]=E.encode(k[F]),v+=R,U=Math.max(U,R)}var O=zo.alloc(i),D=0,L,q;for(L=0;L<U;L++)for(q=0;q<o;q++)L<k[q].length&&(O[D++]=k[q][L]);for(L=0;L<C;L++)for(q=0;q<o;q++)O[D++]=B[q][L];return O}function Bd(t,e,r,i){var n;if(Nd(t))n=Xn.fromArray(t);else if(typeof t=="string"){var s=e;if(!s){var o=Xn.rawSplit(t);s=hn.getBestVersionForData(o,r)}n=Xn.fromString(t,s||40)}else throw new Error("Invalid data");var a=hn.getBestVersionForData(n,r);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=a;else if(e<a)throw new Error(`
@@ -1,4 +1,4 @@
1
- import { dE as Re, $ as je, ac as Pe, a1 as Ie } from "./index-BDhzG0Bz.mjs";
1
+ import { dE as Re, $ as je, ac as Pe, a1 as Ie } from "./index-CjwA7HmM.mjs";
2
2
  var He = {}, Bt = {}, x = {}, ge = {};
3
3
  (function(t) {
4
4
  Object.defineProperty(t, "__esModule", { value: !0 });
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var u=(d,e,t)=>e in d?m(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var i=(d,e,t)=>u(d,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./cosmwasm-BU28GqyN.js"),c=require("./index-ByG9EJHX.js");class o{constructor(e,t,s,r){i(this,"network");i(this,"chain");i(this,"rpc");i(this,"contracts");i(this,"coreAddress");this.network=e,this.chain=t,this.rpc=s,this.contracts=r;const n=this.contracts.coreBridge;if(!n)throw new Error(`Wormhole Token Bridge contract for domain ${t} not found`);this.coreAddress=n}getGuardianSet(e){throw new Error("Method not implemented.")}getGuardianSetIndex(){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,t){const[s,r]=await w.CosmwasmPlatform.chainFromRpc(e),n=t[r];if(n.network!==s)throw new Error(`Network mismatch: ${n.network} != ${s}`);return new o(s,r,e,n.contracts)}async*publishMessage(e,t,s,r){throw new Error("Method not implemented.")}async*verifyMessage(e,t){throw new Error("Not implemented.")}async parseTransaction(e){const t=await this.rpc.getTx(e);if(!t)throw new Error("No transaction found for txid: "+e);return[o.parseWormholeMessageId(this.chain,this.coreAddress,t)]}async parseMessages(e){const t=await this.rpc.getTx(e);if(!t)throw new Error("No transaction found for txid: "+e);return[o.parseWormholeMessage(this.chain,this.coreAddress,t)]}static parseWormholeMessage(e,t,s){const r=s.events.filter(a=>a.type==="wasm"&&a.attributes[0].key==="_contract_address"&&a.attributes[0].value===t);if(r.length===0)throw new Error("No wormhole message found in tx");r.length>1&&console.error(`Expected single message, found ${r.length}`);const[n]=r,h=Object.fromEntries(n.attributes.map(a=>[a.key.split(".")[1],a.value]));return c.createVAA("Uint8Array",{emitterChain:e,emitterAddress:new c.UniversalAddress(c.hex.decode(h.sender)),sequence:BigInt(h.sequence),guardianSet:0,timestamp:Number(h.block_time),consistencyLevel:0,nonce:Number(h.nonce),signatures:[],payload:c.hex.decode(h.message)})}static parseWormholeMessageId(e,t,s){const r=o.parseWormholeMessage(e,t,s);return{chain:r.emitterChain,emitter:r.emitterAddress,sequence:r.sequence}}}c.registerProtocol(c._platform$3,"WormholeCore",o);exports.CosmwasmWormholeCore=o;
1
+ "use strict";var m=Object.defineProperty;var u=(d,e,t)=>e in d?m(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var i=(d,e,t)=>u(d,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./cosmwasm-BsEhYnuw.js"),c=require("./index-CDGktAjP.js");class o{constructor(e,t,s,r){i(this,"network");i(this,"chain");i(this,"rpc");i(this,"contracts");i(this,"coreAddress");this.network=e,this.chain=t,this.rpc=s,this.contracts=r;const n=this.contracts.coreBridge;if(!n)throw new Error(`Wormhole Token Bridge contract for domain ${t} not found`);this.coreAddress=n}getGuardianSet(e){throw new Error("Method not implemented.")}getGuardianSetIndex(){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,t){const[s,r]=await w.CosmwasmPlatform.chainFromRpc(e),n=t[r];if(n.network!==s)throw new Error(`Network mismatch: ${n.network} != ${s}`);return new o(s,r,e,n.contracts)}async*publishMessage(e,t,s,r){throw new Error("Method not implemented.")}async*verifyMessage(e,t){throw new Error("Not implemented.")}async parseTransaction(e){const t=await this.rpc.getTx(e);if(!t)throw new Error("No transaction found for txid: "+e);return[o.parseWormholeMessageId(this.chain,this.coreAddress,t)]}async parseMessages(e){const t=await this.rpc.getTx(e);if(!t)throw new Error("No transaction found for txid: "+e);return[o.parseWormholeMessage(this.chain,this.coreAddress,t)]}static parseWormholeMessage(e,t,s){const r=s.events.filter(a=>a.type==="wasm"&&a.attributes[0].key==="_contract_address"&&a.attributes[0].value===t);if(r.length===0)throw new Error("No wormhole message found in tx");r.length>1&&console.error(`Expected single message, found ${r.length}`);const[n]=r,h=Object.fromEntries(n.attributes.map(a=>[a.key.split(".")[1],a.value]));return c.createVAA("Uint8Array",{emitterChain:e,emitterAddress:new c.UniversalAddress(c.hex.decode(h.sender)),sequence:BigInt(h.sequence),guardianSet:0,timestamp:Number(h.block_time),consistencyLevel:0,nonce:Number(h.nonce),signatures:[],payload:c.hex.decode(h.message)})}static parseWormholeMessageId(e,t,s){const r=o.parseWormholeMessage(e,t,s);return{chain:r.emitterChain,emitter:r.emitterAddress,sequence:r.sequence}}}c.registerProtocol(c._platform$3,"WormholeCore",o);exports.CosmwasmWormholeCore=o;
@@ -1 +1 @@
1
- "use strict";var A=Object.defineProperty;var y=(o,e,t)=>e in o?A(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var i=(o,e,t)=>y(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-ByG9EJHX.js"),g=require("./aptos-poOCeL-e.js");class f{constructor(e,t,r,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=r,this.description=n,this.parallelizable=a}}const w=[{name:"tokenBridgeAddress",...s.universalAddressItem},{name:"chain",...s.chainItem()},{name:"domainSeparator",binary:"bytes",custom:s.bytes.encode(s.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...s.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],k=o=>s.serializeLayout(w,o);class d{constructor(e,t,r,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=r,this.contracts=n,this.chainId=s.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[r,n]=await g.AptosPlatform.chainFromRpc(e),a=t[n];if(a.network!==r)throw new Error("Network mismatch "+a.network+" !== "+r);return new d(r,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(s.APTOS_SEPARATOR);let r;if(r=(await this.connection.getAccountResource(t[0],`${this.tokenBridgeAddress}::state::OriginInfo`)).data,!r)throw s.ErrNotWrapped;const n=s.toChain(parseInt(r.token_chain.number)),a=new s.UniversalAddress(r.token_address.external_address);return{chain:n,address:a}}async getTokenUniversalAddress(e){return new s.UniversalAddress(s.hex.encode(s.sha3_256(e.toString()),!0))}async getTokenNativeAddress(e,t){const r=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!r)throw new Error("Invalid asset address.");return new s.AptosAddress(r)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(s.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource(s.coalesceModuleAddress(t),`${this.tokenBridgeAddress}::state::OriginInfo`),s.toNative(this.chain,t)}async isTransferCompleted(e){const r=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data.consumed_vaas.elems.handle;try{return await this.connection.getTableItem(r,{key_type:"vector<u8>",value_type:"u8",key:`0x${s.dist.Buffer.from(s.keccak_256(e.hash)).toString("hex")}`}),!0}catch{return!1}}async getWrappedNative(){return s.toNative(this.chain,s.APTOS_COIN)}async*createAttestation(e,t){const r={chain:this.chain,address:new s.AptosAddress(e)},n=await this.getAssetFullyQualifiedType(r);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:[s.serialize(e)]},"Aptos.CreateWrappedCoinType");const r=await this.getAssetFullyQualifiedType(e.payload.token);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,type_arguments:[r],arguments:[s.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,r,n,a){const p=0n,c=0n,h=s.isNative(r)?s.APTOS_COIN:r.toString(),l=t.address.toUniversalAddress().toUint8Array(),u=s.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,type_arguments:[h],arguments:[n,u,l,c,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,type_arguments:[h],arguments:[n,u,l,p,c]},"Aptos.TransferTokens")}async*redeem(e,t,r=!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:[s.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?s.isValidAptosType(e.address.toString())?e.address.toString():null:`${d.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:r}=t.native_infos,n=await this.connection.getTableItem(r,{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}});return n?[n.account_address,String.fromCharCode(...s.hex.decode(n.module_name)),String.fromCharCode(...s.hex.decode(n.struct_name))].join(s.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,r){if(s.isNative(r.address))throw new Error("Invalid token address");const n=k({chain:r.chain,tokenBridgeAddress:new s.AptosAddress(t).toUniversalAddress(),tokenId:r.address.toUniversalAddress()});return s.hex.encode(s.sha3_256(n),!0)}createUnsignedTx(e,t,r=!1){return new f(e,this.network,this.chain,t,r)}}s.registerProtocol("Aptos","TokenBridge",d);exports.AptosTokenBridge=d;
1
+ "use strict";var A=Object.defineProperty;var y=(o,e,t)=>e in o?A(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var i=(o,e,t)=>y(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CDGktAjP.js"),g=require("./aptos-D-S8DXGs.js");class f{constructor(e,t,r,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=r,this.description=n,this.parallelizable=a}}const w=[{name:"tokenBridgeAddress",...s.universalAddressItem},{name:"chain",...s.chainItem()},{name:"domainSeparator",binary:"bytes",custom:s.bytes.encode(s.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...s.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],k=o=>s.serializeLayout(w,o);class d{constructor(e,t,r,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=r,this.contracts=n,this.chainId=s.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[r,n]=await g.AptosPlatform.chainFromRpc(e),a=t[n];if(a.network!==r)throw new Error("Network mismatch "+a.network+" !== "+r);return new d(r,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(s.APTOS_SEPARATOR);let r;if(r=(await this.connection.getAccountResource(t[0],`${this.tokenBridgeAddress}::state::OriginInfo`)).data,!r)throw s.ErrNotWrapped;const n=s.toChain(parseInt(r.token_chain.number)),a=new s.UniversalAddress(r.token_address.external_address);return{chain:n,address:a}}async getTokenUniversalAddress(e){return new s.UniversalAddress(s.hex.encode(s.sha3_256(e.toString()),!0))}async getTokenNativeAddress(e,t){const r=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!r)throw new Error("Invalid asset address.");return new s.AptosAddress(r)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(s.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource(s.coalesceModuleAddress(t),`${this.tokenBridgeAddress}::state::OriginInfo`),s.toNative(this.chain,t)}async isTransferCompleted(e){const r=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data.consumed_vaas.elems.handle;try{return await this.connection.getTableItem(r,{key_type:"vector<u8>",value_type:"u8",key:`0x${s.dist.Buffer.from(s.keccak_256(e.hash)).toString("hex")}`}),!0}catch{return!1}}async getWrappedNative(){return s.toNative(this.chain,s.APTOS_COIN)}async*createAttestation(e,t){const r={chain:this.chain,address:new s.AptosAddress(e)},n=await this.getAssetFullyQualifiedType(r);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:[s.serialize(e)]},"Aptos.CreateWrappedCoinType");const r=await this.getAssetFullyQualifiedType(e.payload.token);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,type_arguments:[r],arguments:[s.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,r,n,a){const p=0n,c=0n,h=s.isNative(r)?s.APTOS_COIN:r.toString(),l=t.address.toUniversalAddress().toUint8Array(),u=s.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,type_arguments:[h],arguments:[n,u,l,c,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,type_arguments:[h],arguments:[n,u,l,p,c]},"Aptos.TransferTokens")}async*redeem(e,t,r=!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:[s.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?s.isValidAptosType(e.address.toString())?e.address.toString():null:`${d.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:r}=t.native_infos,n=await this.connection.getTableItem(r,{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}});return n?[n.account_address,String.fromCharCode(...s.hex.decode(n.module_name)),String.fromCharCode(...s.hex.decode(n.struct_name))].join(s.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,r){if(s.isNative(r.address))throw new Error("Invalid token address");const n=k({chain:r.chain,tokenBridgeAddress:new s.AptosAddress(t).toUniversalAddress(),tokenId:r.address.toUniversalAddress()});return s.hex.encode(s.sha3_256(n),!0)}createUnsignedTx(e,t,r=!1){return new f(e,this.network,this.chain,t,r)}}s.registerProtocol("Aptos","TokenBridge",d);exports.AptosTokenBridge=d;
@@ -1,9 +1,9 @@
1
1
  var Q = Object.defineProperty;
2
2
  var X = (O, e, t) => e in O ? Q(O, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : O[e] = t;
3
3
  var d = (O, e, t) => X(O, typeof e != "symbol" ? e + "" : e, t);
4
- import { A as b, S as g, a as Y } from "./index-C1fq1xT0.mjs";
5
- import { d9 as Z, a5 as C, a8 as $, da as _, an as I, db as v, dc as q, c8 as tt, cp as S, c9 as et, p as H, ce as K, dd as y, de as u, df as k, dg as U, bM as L, dh as z, di as st, dj as V, dk as ot, bR as nt, ak as rt } from "./index-BDhzG0Bz.mjs";
6
- import { A as at } from "./algorand-BZLSulqp.mjs";
4
+ import { A as b, S as g, a as Y } from "./index-Dw4gUoPq.mjs";
5
+ import { d9 as Z, a5 as C, a8 as $, da as _, an as I, db as v, dc as q, c8 as tt, cp as S, c9 as et, p as H, ce as K, dd as y, de as u, df as k, dg as U, bM as L, dh as z, di as st, dj as V, dk as ot, bR as nt, ak as rt } from "./index-CjwA7HmM.mjs";
6
+ import { A as at } from "./algorand-qEY4HHOc.mjs";
7
7
  const G = Z.fromSignature("portal_transfer(byte[])byte[]"), c = class c {
8
8
  constructor(e, t, n, o) {
9
9
  d(this, "network");
@@ -1,8 +1,8 @@
1
- import { a0 as lf, Z as se, a1 as Xc, aK as ff, ac as Zc, aX as df, a$ as pf } from "./index-BDhzG0Bz.mjs";
1
+ import { a0 as lf, Z as se, a1 as Xc, aK as ff, ac as Zc, aX as df, a$ as pf } from "./index-CjwA7HmM.mjs";
2
2
  import { d as gf } from "./dijkstra-BZM-8g-B.mjs";
3
- import { e as wr, D as eh } from "./events-BIfEV615.mjs";
4
- import { r as mf, a as ti, g as qr, i as jt, b as Tn, I as jr, f as Wt, t as qt, c as Wo, C as yf, d as wf, m as th, W as vf, E as Nt, y as Rt, k as ho, A as bf, h as _f, e as Go, j as Af, s as Ef, l as Sf, o as rh, n as If, p as uo, q as lo, u as ih, v as ur, w as Yr } from "./index-B-bMfv9J.mjs";
5
- import { c as V, s as Mf, f as Nf, a as Ff, d as xf, g as Cf, b as On, e as nh, h as sh, B as Pf, x as oh, r as ah, H as Rf, i as ch, j as Tf } from "./index-DTj0BYI6.mjs";
3
+ import { e as wr, D as eh } from "./events-BL2eUG60.mjs";
4
+ import { r as mf, a as ti, g as qr, i as jt, b as Tn, I as jr, f as Wt, t as qt, c as Wo, C as yf, d as wf, m as th, W as vf, E as Nt, y as Rt, k as ho, A as bf, h as _f, e as Go, j as Af, s as Ef, l as Sf, o as rh, n as If, p as uo, q as lo, u as ih, v as ur, w as Yr } from "./index-BHOu1oLq.mjs";
5
+ import { c as V, s as Mf, f as Nf, a as Ff, d as xf, g as Cf, b as On, e as nh, h as sh, B as Pf, x as oh, r as ah, H as Rf, i as ch, j as Tf } from "./index-fzN-meRd.mjs";
6
6
  let Of = class extends mf {
7
7
  constructor(e) {
8
8
  super(e), this.events = new wr.EventEmitter(), this.hasRegisteredEventListeners = !1, this.connection = this.setConnection(e), this.connection.connected && this.registerEventListeners();
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ge=require("./events-CG085uVS.js"),ie=require("./index-ByG9EJHX.js"),D=require("./index-DEfagu36.js"),N=require("./index-eY_q88kc.js");var qv={};(function(a){const t=D.strictUriEncode,r=D.decodeUriComponent,s=D.splitOnFirst,o=D.filterObj,u=f=>f==null,l=Symbol("encodeFragmentIdentifier");function y(f){switch(f.arrayFormat){case"index":return m=>(w,_)=>{const P=w.length;return _===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,[R(m,f),"[",P,"]"].join("")]:[...w,[R(m,f),"[",R(P,f),"]=",R(_,f)].join("")]};case"bracket":return m=>(w,_)=>_===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,[R(m,f),"[]"].join("")]:[...w,[R(m,f),"[]=",R(_,f)].join("")];case"colon-list-separator":return m=>(w,_)=>_===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,[R(m,f),":list="].join("")]:[...w,[R(m,f),":list=",R(_,f)].join("")];case"comma":case"separator":case"bracket-separator":{const m=f.arrayFormat==="bracket-separator"?"[]=":"=";return w=>(_,P)=>P===void 0||f.skipNull&&P===null||f.skipEmptyString&&P===""?_:(P=P===null?"":P,_.length===0?[[R(w,f),m,R(P,f)].join("")]:[[_,R(P,f)].join(f.arrayFormatSeparator)])}default:return m=>(w,_)=>_===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,R(m,f)]:[...w,[R(m,f),"=",R(_,f)].join("")]}}function I(f){let m;switch(f.arrayFormat){case"index":return(w,_,P)=>{if(m=/\[(\d*)\]$/.exec(w),w=w.replace(/\[\d*\]$/,""),!m){P[w]=_;return}P[w]===void 0&&(P[w]={}),P[w][m[1]]=_};case"bracket":return(w,_,P)=>{if(m=/(\[\])$/.exec(w),w=w.replace(/\[\]$/,""),!m){P[w]=_;return}if(P[w]===void 0){P[w]=[_];return}P[w]=[].concat(P[w],_)};case"colon-list-separator":return(w,_,P)=>{if(m=/(:list)$/.exec(w),w=w.replace(/:list$/,""),!m){P[w]=_;return}if(P[w]===void 0){P[w]=[_];return}P[w]=[].concat(P[w],_)};case"comma":case"separator":return(w,_,P)=>{const U=typeof _=="string"&&_.includes(f.arrayFormatSeparator),F=typeof _=="string"&&!U&&x(_,f).includes(f.arrayFormatSeparator);_=F?x(_,f):_;const X=U||F?_.split(f.arrayFormatSeparator).map(Cr=>x(Cr,f)):_===null?_:x(_,f);P[w]=X};case"bracket-separator":return(w,_,P)=>{const U=/(\[\])$/.test(w);if(w=w.replace(/\[\]$/,""),!U){P[w]=_&&x(_,f);return}const F=_===null?[]:_.split(f.arrayFormatSeparator).map(X=>x(X,f));if(P[w]===void 0){P[w]=F;return}P[w]=[].concat(P[w],F)};default:return(w,_,P)=>{if(P[w]===void 0){P[w]=_;return}P[w]=[].concat(P[w],_)}}}function S(f){if(typeof f!="string"||f.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function R(f,m){return m.encode?m.strict?t(f):encodeURIComponent(f):f}function x(f,m){return m.decode?r(f):f}function j(f){return Array.isArray(f)?f.sort():typeof f=="object"?j(Object.keys(f)).sort((m,w)=>Number(m)-Number(w)).map(m=>f[m]):f}function B(f){const m=f.indexOf("#");return m!==-1&&(f=f.slice(0,m)),f}function k(f){let m="";const w=f.indexOf("#");return w!==-1&&(m=f.slice(w)),m}function re(f){f=B(f);const m=f.indexOf("?");return m===-1?"":f.slice(m+1)}function ne(f,m){return m.parseNumbers&&!Number.isNaN(Number(f))&&typeof f=="string"&&f.trim()!==""?f=Number(f):m.parseBooleans&&f!==null&&(f.toLowerCase()==="true"||f.toLowerCase()==="false")&&(f=f.toLowerCase()==="true"),f}function oe(f,m){m=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},m),S(m.arrayFormatSeparator);const w=I(m),_=Object.create(null);if(typeof f!="string"||(f=f.trim().replace(/^[?#&]/,""),!f))return _;for(const P of f.split("&")){if(P==="")continue;let[U,F]=s(m.decode?P.replace(/\+/g," "):P,"=");F=F===void 0?null:["comma","separator","bracket-separator"].includes(m.arrayFormat)?F:x(F,m),w(x(U,m),F,_)}for(const P of Object.keys(_)){const U=_[P];if(typeof U=="object"&&U!==null)for(const F of Object.keys(U))U[F]=ne(U[F],m);else _[P]=ne(U,m)}return m.sort===!1?_:(m.sort===!0?Object.keys(_).sort():Object.keys(_).sort(m.sort)).reduce((P,U)=>{const F=_[U];return F&&typeof F=="object"&&!Array.isArray(F)?P[U]=j(F):P[U]=F,P},Object.create(null))}a.extract=re,a.parse=oe,a.stringify=(f,m)=>{if(!f)return"";m=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},m),S(m.arrayFormatSeparator);const w=F=>m.skipNull&&u(f[F])||m.skipEmptyString&&f[F]==="",_=y(m),P={};for(const F of Object.keys(f))w(F)||(P[F]=f[F]);const U=Object.keys(P);return m.sort!==!1&&U.sort(m.sort),U.map(F=>{const X=f[F];return X===void 0?"":X===null?R(F,m):Array.isArray(X)?X.length===0&&m.arrayFormat==="bracket-separator"?R(F,m)+"[]":X.reduce(_(F),[]).join("&"):R(F,m)+"="+R(X,m)}).filter(F=>F.length>0).join("&")},a.parseUrl=(f,m)=>{m=Object.assign({decode:!0},m);const[w,_]=s(f,"#");return Object.assign({url:w.split("?")[0]||"",query:oe(re(f),m)},m&&m.parseFragmentIdentifier&&_?{fragmentIdentifier:x(_,m)}:{})},a.stringifyUrl=(f,m)=>{m=Object.assign({encode:!0,strict:!0,[l]:!0},m);const w=B(f.url).split("?")[0]||"",_=a.extract(f.url),P=a.parse(_,{sort:!1}),U=Object.assign(P,f.query);let F=a.stringify(U,m);F&&(F=`?${F}`);let X=k(f.url);return f.fragmentIdentifier&&(X=`#${m[l]?R(f.fragmentIdentifier,m):f.fragmentIdentifier}`),`${w}${F}${X}`},a.pick=(f,m,w)=>{w=Object.assign({parseFragmentIdentifier:!0,[l]:!1},w);const{url:_,query:P,fragmentIdentifier:U}=a.parseUrl(f,w);return a.stringifyUrl({url:_,query:o(P,m),fragmentIdentifier:U},w)},a.exclude=(f,m,w)=>{const _=Array.isArray(m)?P=>!m.includes(P):(P,U)=>!m(P,U);return a.pick(f,_,w)}})(qv);function Uv(a,t=[]){const r=[];return Object.keys(a).forEach(s=>{if(t.length&&!t.includes(s))return;const o=a[s];r.push(...o.accounts)}),r}const Mv={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 Lv(a,t){const{message:r,code:s}=Mv[a];return{message:r,code:s}}function so(a,t){return!!Array.isArray(a)}var Or={};/*! *****************************************************************************
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ge=require("./events-wpqGOay9.js"),ie=require("./index-CDGktAjP.js"),D=require("./index-CtJdy4GW.js"),N=require("./index-DVKptZW_.js");var qv={};(function(a){const t=D.strictUriEncode,r=D.decodeUriComponent,s=D.splitOnFirst,o=D.filterObj,u=f=>f==null,l=Symbol("encodeFragmentIdentifier");function y(f){switch(f.arrayFormat){case"index":return m=>(w,_)=>{const P=w.length;return _===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,[R(m,f),"[",P,"]"].join("")]:[...w,[R(m,f),"[",R(P,f),"]=",R(_,f)].join("")]};case"bracket":return m=>(w,_)=>_===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,[R(m,f),"[]"].join("")]:[...w,[R(m,f),"[]=",R(_,f)].join("")];case"colon-list-separator":return m=>(w,_)=>_===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,[R(m,f),":list="].join("")]:[...w,[R(m,f),":list=",R(_,f)].join("")];case"comma":case"separator":case"bracket-separator":{const m=f.arrayFormat==="bracket-separator"?"[]=":"=";return w=>(_,P)=>P===void 0||f.skipNull&&P===null||f.skipEmptyString&&P===""?_:(P=P===null?"":P,_.length===0?[[R(w,f),m,R(P,f)].join("")]:[[_,R(P,f)].join(f.arrayFormatSeparator)])}default:return m=>(w,_)=>_===void 0||f.skipNull&&_===null||f.skipEmptyString&&_===""?w:_===null?[...w,R(m,f)]:[...w,[R(m,f),"=",R(_,f)].join("")]}}function I(f){let m;switch(f.arrayFormat){case"index":return(w,_,P)=>{if(m=/\[(\d*)\]$/.exec(w),w=w.replace(/\[\d*\]$/,""),!m){P[w]=_;return}P[w]===void 0&&(P[w]={}),P[w][m[1]]=_};case"bracket":return(w,_,P)=>{if(m=/(\[\])$/.exec(w),w=w.replace(/\[\]$/,""),!m){P[w]=_;return}if(P[w]===void 0){P[w]=[_];return}P[w]=[].concat(P[w],_)};case"colon-list-separator":return(w,_,P)=>{if(m=/(:list)$/.exec(w),w=w.replace(/:list$/,""),!m){P[w]=_;return}if(P[w]===void 0){P[w]=[_];return}P[w]=[].concat(P[w],_)};case"comma":case"separator":return(w,_,P)=>{const U=typeof _=="string"&&_.includes(f.arrayFormatSeparator),F=typeof _=="string"&&!U&&x(_,f).includes(f.arrayFormatSeparator);_=F?x(_,f):_;const X=U||F?_.split(f.arrayFormatSeparator).map(Cr=>x(Cr,f)):_===null?_:x(_,f);P[w]=X};case"bracket-separator":return(w,_,P)=>{const U=/(\[\])$/.test(w);if(w=w.replace(/\[\]$/,""),!U){P[w]=_&&x(_,f);return}const F=_===null?[]:_.split(f.arrayFormatSeparator).map(X=>x(X,f));if(P[w]===void 0){P[w]=F;return}P[w]=[].concat(P[w],F)};default:return(w,_,P)=>{if(P[w]===void 0){P[w]=_;return}P[w]=[].concat(P[w],_)}}}function S(f){if(typeof f!="string"||f.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function R(f,m){return m.encode?m.strict?t(f):encodeURIComponent(f):f}function x(f,m){return m.decode?r(f):f}function j(f){return Array.isArray(f)?f.sort():typeof f=="object"?j(Object.keys(f)).sort((m,w)=>Number(m)-Number(w)).map(m=>f[m]):f}function B(f){const m=f.indexOf("#");return m!==-1&&(f=f.slice(0,m)),f}function k(f){let m="";const w=f.indexOf("#");return w!==-1&&(m=f.slice(w)),m}function re(f){f=B(f);const m=f.indexOf("?");return m===-1?"":f.slice(m+1)}function ne(f,m){return m.parseNumbers&&!Number.isNaN(Number(f))&&typeof f=="string"&&f.trim()!==""?f=Number(f):m.parseBooleans&&f!==null&&(f.toLowerCase()==="true"||f.toLowerCase()==="false")&&(f=f.toLowerCase()==="true"),f}function oe(f,m){m=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},m),S(m.arrayFormatSeparator);const w=I(m),_=Object.create(null);if(typeof f!="string"||(f=f.trim().replace(/^[?#&]/,""),!f))return _;for(const P of f.split("&")){if(P==="")continue;let[U,F]=s(m.decode?P.replace(/\+/g," "):P,"=");F=F===void 0?null:["comma","separator","bracket-separator"].includes(m.arrayFormat)?F:x(F,m),w(x(U,m),F,_)}for(const P of Object.keys(_)){const U=_[P];if(typeof U=="object"&&U!==null)for(const F of Object.keys(U))U[F]=ne(U[F],m);else _[P]=ne(U,m)}return m.sort===!1?_:(m.sort===!0?Object.keys(_).sort():Object.keys(_).sort(m.sort)).reduce((P,U)=>{const F=_[U];return F&&typeof F=="object"&&!Array.isArray(F)?P[U]=j(F):P[U]=F,P},Object.create(null))}a.extract=re,a.parse=oe,a.stringify=(f,m)=>{if(!f)return"";m=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},m),S(m.arrayFormatSeparator);const w=F=>m.skipNull&&u(f[F])||m.skipEmptyString&&f[F]==="",_=y(m),P={};for(const F of Object.keys(f))w(F)||(P[F]=f[F]);const U=Object.keys(P);return m.sort!==!1&&U.sort(m.sort),U.map(F=>{const X=f[F];return X===void 0?"":X===null?R(F,m):Array.isArray(X)?X.length===0&&m.arrayFormat==="bracket-separator"?R(F,m)+"[]":X.reduce(_(F),[]).join("&"):R(F,m)+"="+R(X,m)}).filter(F=>F.length>0).join("&")},a.parseUrl=(f,m)=>{m=Object.assign({decode:!0},m);const[w,_]=s(f,"#");return Object.assign({url:w.split("?")[0]||"",query:oe(re(f),m)},m&&m.parseFragmentIdentifier&&_?{fragmentIdentifier:x(_,m)}:{})},a.stringifyUrl=(f,m)=>{m=Object.assign({encode:!0,strict:!0,[l]:!0},m);const w=B(f.url).split("?")[0]||"",_=a.extract(f.url),P=a.parse(_,{sort:!1}),U=Object.assign(P,f.query);let F=a.stringify(U,m);F&&(F=`?${F}`);let X=k(f.url);return f.fragmentIdentifier&&(X=`#${m[l]?R(f.fragmentIdentifier,m):f.fragmentIdentifier}`),`${w}${F}${X}`},a.pick=(f,m,w)=>{w=Object.assign({parseFragmentIdentifier:!0,[l]:!1},w);const{url:_,query:P,fragmentIdentifier:U}=a.parseUrl(f,w);return a.stringifyUrl({url:_,query:o(P,m),fragmentIdentifier:U},w)},a.exclude=(f,m,w)=>{const _=Array.isArray(m)?P=>!m.includes(P):(P,U)=>!m(P,U);return a.pick(f,_,w)}})(qv);function Uv(a,t=[]){const r=[];return Object.keys(a).forEach(s=>{if(t.length&&!t.includes(s))return;const o=a[s];r.push(...o.accounts)}),r}const Mv={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 Lv(a,t){const{message:r,code:s}=Mv[a];return{message:r,code:s}}function so(a,t){return!!Array.isArray(a)}var Or={};/*! *****************************************************************************
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 += '`),te&&(T+=`' +
43
43
  function print() { __p += __j.call(arguments, '') }
44
44
  `:`;
45
45
  `)+T+`return __p
46
- }`;var Q=tu(function(){return se(d,z+"return "+T).apply(r,g)});if(Q.source=T,Fn(Q))throw Q;return Q}function Vm(e){return ae(e).toLowerCase()}function Km(e){return ae(e).toUpperCase()}function Bm(e,i,n){if(e=ae(e),e&&(n||i===r))return ha(e);if(!e||!(i=He(i)))return e;var c=ot(e),h=ot(i),d=la(c,h),g=pa(c,h)+1;return Mt(c,d,g).join("")}function Jm(e,i,n){if(e=ae(e),e&&(n||i===r))return e.slice(0,fa(e)+1);if(!e||!(i=He(i)))return e;var c=ot(e),h=pa(c,ot(i))+1;return Mt(c,0,h).join("")}function Gm(e,i,n){if(e=ae(e),e&&(n||i===r))return e.replace(Ts,"");if(!e||!(i=He(i)))return e;var c=ot(e),h=la(c,ot(i));return Mt(c,h).join("")}function Wm(e,i){var n=Cr,c=kh;if(fe(i)){var h="separator"in i?i.separator:h;n="length"in i?W(i.length):n,c="omission"in i?He(i.omission):c}e=ae(e);var d=e.length;if(hr(e)){var g=ot(e);d=g.length}if(n>=d)return e;var v=n-lr(c);if(v<1)return c;var E=g?Mt(g,0,v).join(""):e.slice(0,v);if(h===r)return E+c;if(g&&(v+=E.length-v),jn(h)){if(e.slice(v).search(h)){var C,$=E;for(h.global||(h=Qs(h.source,ae(xo.exec(h))+"g")),h.lastIndex=0;C=h.exec($);)var T=C.index;E=E.slice(0,T===r?v:T)}}else if(e.indexOf(He(h),v)!=v){var M=E.lastIndexOf(h);M>-1&&(E=E.slice(0,M))}return E+c}function Qm(e){return e=ae(e),e&&ol.test(e)?e.replace(Ao,Pp):e}var Ym=vr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Un=rc("toUpperCase");function eu(e,i,n){return e=ae(e),i=n?r:i,i===r?wp(e)?Rp(e):hp(e):e.match(i)||[]}var tu=Y(function(e,i){try{return ze(e,r,i)}catch(n){return Fn(n)?n:new J(n)}}),Zm=Et(function(e,i){return Qe(i,function(n){n=gt(n),_t(e,n,xn(e[n],e))}),e});function Xm(e){var i=e==null?0:e.length,n=H();return e=i?pe(e,function(c){if(typeof c[1]!="function")throw new Ye(l);return[n(c[0]),c[1]]}):[],Y(function(c){for(var h=-1;++h<i;){var d=e[h];if(ze(d[0],this,c))return ze(d[1],this,c)}})}function ev(e){return Pd(Xe(e,x))}function Mn(e){return function(){return e}}function tv(e,i){return e==null||e!==e?i:e}var rv=sc(),iv=sc(!0);function qe(e){return e}function Ln(e){return Fa(typeof e=="function"?e:Xe(e,x))}function sv(e){return Da(Xe(e,x))}function nv(e,i){return qa(e,Xe(i,x))}var ov=Y(function(e,i){return function(n){return Br(n,e,i)}}),av=Y(function(e,i){return function(n){return Br(e,n,i)}});function zn(e,i,n){var c=Ee(i),h=ki(i,c);n==null&&!(fe(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=ki(i,Ee(i)));var d=!(fe(n)&&"chain"in n)||!!n.chain,g=Pt(e);return Qe(h,function(v){var E=i[v];e[v]=E,g&&(e.prototype[v]=function(){var C=this.__chain__;if(d||C){var $=e(this.__wrapped__),T=$.__actions__=Fe(this.__actions__);return T.push({func:E,args:arguments,thisArg:e}),$.__chain__=C,$}return E.apply(e,Tt([this.value()],arguments))})}),e}function cv(){return Pe._===this&&(Pe._=Tp),this}function kn(){}function uv(e){return e=W(e),Y(function(i){return Ua(i,e)})}var hv=wn(pe),lv=wn(na),pv=wn(Hs);function ru(e){return On(e)?Vs(gt(e)):zd(e)}function dv(e){return function(i){return e==null?r:Yt(e,i)}}var fv=oc(),gv=oc(!0);function Hn(){return[]}function Vn(){return!1}function yv(){return{}}function mv(){return""}function vv(){return!0}function wv(e,i){if(e=W(e),e<1||e>$t)return[];var n=pt,c=Re(e,pt);i=H(i),e-=pt;for(var h=Js(c,i);++n<e;)i(n);return h}function _v(e){return G(e)?pe(e,gt):Ve(e)?[e]:Fe(Ec(ae(e)))}function bv(e){var i=++$p;return ae(e)+i}var Ev=Gi(function(e,i){return e+i},0),Iv=_n("ceil"),Pv=Gi(function(e,i){return e/i},1),Sv=_n("floor");function Ov(e){return e&&e.length?zi(e,qe,nn):r}function Rv(e,i){return e&&e.length?zi(e,H(i,2),nn):r}function Nv(e){return ca(e,qe)}function Av(e,i){return ca(e,H(i,2))}function Cv(e){return e&&e.length?zi(e,qe,un):r}function $v(e,i){return e&&e.length?zi(e,H(i,2),un):r}var xv=Gi(function(e,i){return e*i},1),Tv=_n("round"),Fv=Gi(function(e,i){return e-i},0);function jv(e){return e&&e.length?Bs(e,qe):0}function Dv(e,i){return e&&e.length?Bs(e,H(i,2)):0}return p.after=sy,p.ary=Tc,p.assign=Ky,p.assignIn=Jc,p.assignInWith=as,p.assignWith=By,p.at=Jy,p.before=Fc,p.bind=xn,p.bindAll=Zm,p.bindKey=jc,p.castArray=yy,p.chain=Cc,p.chunk=Sf,p.compact=Of,p.concat=Rf,p.cond=Xm,p.conforms=ev,p.constant=Mn,p.countBy=jg,p.create=Gy,p.curry=Dc,p.curryRight=qc,p.debounce=Uc,p.defaults=Wy,p.defaultsDeep=Qy,p.defer=ny,p.delay=oy,p.difference=Nf,p.differenceBy=Af,p.differenceWith=Cf,p.drop=$f,p.dropRight=xf,p.dropRightWhile=Tf,p.dropWhile=Ff,p.fill=jf,p.filter=qg,p.flatMap=Lg,p.flatMapDeep=zg,p.flatMapDepth=kg,p.flatten=Oc,p.flattenDeep=Df,p.flattenDepth=qf,p.flip=ay,p.flow=rv,p.flowRight=iv,p.fromPairs=Uf,p.functions=im,p.functionsIn=sm,p.groupBy=Hg,p.initial=Lf,p.intersection=zf,p.intersectionBy=kf,p.intersectionWith=Hf,p.invert=om,p.invertBy=am,p.invokeMap=Kg,p.iteratee=Ln,p.keyBy=Bg,p.keys=Ee,p.keysIn=De,p.map=ts,p.mapKeys=um,p.mapValues=hm,p.matches=sv,p.matchesProperty=nv,p.memoize=is,p.merge=lm,p.mergeWith=Gc,p.method=ov,p.methodOf=av,p.mixin=zn,p.negate=ss,p.nthArg=uv,p.omit=pm,p.omitBy=dm,p.once=cy,p.orderBy=Jg,p.over=hv,p.overArgs=uy,p.overEvery=lv,p.overSome=pv,p.partial=Tn,p.partialRight=Mc,p.partition=Gg,p.pick=fm,p.pickBy=Wc,p.property=ru,p.propertyOf=dv,p.pull=Jf,p.pullAll=Nc,p.pullAllBy=Gf,p.pullAllWith=Wf,p.pullAt=Qf,p.range=fv,p.rangeRight=gv,p.rearg=hy,p.reject=Yg,p.remove=Yf,p.rest=ly,p.reverse=Cn,p.sampleSize=Xg,p.set=ym,p.setWith=mm,p.shuffle=ey,p.slice=Zf,p.sortBy=iy,p.sortedUniq=ng,p.sortedUniqBy=og,p.split=Lm,p.spread=py,p.tail=ag,p.take=cg,p.takeRight=ug,p.takeRightWhile=hg,p.takeWhile=lg,p.tap=Og,p.throttle=dy,p.thru=es,p.toArray=Vc,p.toPairs=Qc,p.toPairsIn=Yc,p.toPath=_v,p.toPlainObject=Bc,p.transform=vm,p.unary=fy,p.union=pg,p.unionBy=dg,p.unionWith=fg,p.uniq=gg,p.uniqBy=yg,p.uniqWith=mg,p.unset=wm,p.unzip=$n,p.unzipWith=Ac,p.update=_m,p.updateWith=bm,p.values=br,p.valuesIn=Em,p.without=vg,p.words=eu,p.wrap=gy,p.xor=wg,p.xorBy=_g,p.xorWith=bg,p.zip=Eg,p.zipObject=Ig,p.zipObjectDeep=Pg,p.zipWith=Sg,p.entries=Qc,p.entriesIn=Yc,p.extend=Jc,p.extendWith=as,zn(p,p),p.add=Ev,p.attempt=tu,p.camelCase=Om,p.capitalize=Zc,p.ceil=Iv,p.clamp=Im,p.clone=my,p.cloneDeep=wy,p.cloneDeepWith=_y,p.cloneWith=vy,p.conformsTo=by,p.deburr=Xc,p.defaultTo=tv,p.divide=Pv,p.endsWith=Rm,p.eq=ct,p.escape=Nm,p.escapeRegExp=Am,p.every=Dg,p.find=Ug,p.findIndex=Pc,p.findKey=Yy,p.findLast=Mg,p.findLastIndex=Sc,p.findLastKey=Zy,p.floor=Sv,p.forEach=$c,p.forEachRight=xc,p.forIn=Xy,p.forInRight=em,p.forOwn=tm,p.forOwnRight=rm,p.get=Dn,p.gt=Ey,p.gte=Iy,p.has=nm,p.hasIn=qn,p.head=Rc,p.identity=qe,p.includes=Vg,p.indexOf=Mf,p.inRange=Pm,p.invoke=cm,p.isArguments=er,p.isArray=G,p.isArrayBuffer=Py,p.isArrayLike=je,p.isArrayLikeObject=ye,p.isBoolean=Sy,p.isBuffer=Lt,p.isDate=Oy,p.isElement=Ry,p.isEmpty=Ny,p.isEqual=Ay,p.isEqualWith=Cy,p.isError=Fn,p.isFinite=$y,p.isFunction=Pt,p.isInteger=Lc,p.isLength=ns,p.isMap=zc,p.isMatch=xy,p.isMatchWith=Ty,p.isNaN=Fy,p.isNative=jy,p.isNil=qy,p.isNull=Dy,p.isNumber=kc,p.isObject=fe,p.isObjectLike=ge,p.isPlainObject=Zr,p.isRegExp=jn,p.isSafeInteger=Uy,p.isSet=Hc,p.isString=os,p.isSymbol=Ve,p.isTypedArray=_r,p.isUndefined=My,p.isWeakMap=Ly,p.isWeakSet=zy,p.join=Vf,p.kebabCase=Cm,p.last=tt,p.lastIndexOf=Kf,p.lowerCase=$m,p.lowerFirst=xm,p.lt=ky,p.lte=Hy,p.max=Ov,p.maxBy=Rv,p.mean=Nv,p.meanBy=Av,p.min=Cv,p.minBy=$v,p.stubArray=Hn,p.stubFalse=Vn,p.stubObject=yv,p.stubString=mv,p.stubTrue=vv,p.multiply=xv,p.nth=Bf,p.noConflict=cv,p.noop=kn,p.now=rs,p.pad=Tm,p.padEnd=Fm,p.padStart=jm,p.parseInt=Dm,p.random=Sm,p.reduce=Wg,p.reduceRight=Qg,p.repeat=qm,p.replace=Um,p.result=gm,p.round=Tv,p.runInContext=b,p.sample=Zg,p.size=ty,p.snakeCase=Mm,p.some=ry,p.sortedIndex=Xf,p.sortedIndexBy=eg,p.sortedIndexOf=tg,p.sortedLastIndex=rg,p.sortedLastIndexBy=ig,p.sortedLastIndexOf=sg,p.startCase=zm,p.startsWith=km,p.subtract=Fv,p.sum=jv,p.sumBy=Dv,p.template=Hm,p.times=wv,p.toFinite=St,p.toInteger=W,p.toLength=Kc,p.toLower=Vm,p.toNumber=rt,p.toSafeInteger=Vy,p.toString=ae,p.toUpper=Km,p.trim=Bm,p.trimEnd=Jm,p.trimStart=Gm,p.truncate=Wm,p.unescape=Qm,p.uniqueId=bv,p.upperCase=Ym,p.upperFirst=Un,p.each=$c,p.eachRight=xc,p.first=Rc,zn(p,function(){var e={};return dt(p,function(i,n){ce.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Qe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Qe(["drop","take"],function(e,i){ee.prototype[e]=function(n){n=n===r?1:be(W(n),0);var c=this.__filtered__&&!i?new ee(this):this.clone();return c.__filtered__?c.__takeCount__=Re(n,c.__takeCount__):c.__views__.push({size:Re(n,pt),type:e+(c.__dir__<0?"Right":"")}),c},ee.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Qe(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Oo||n==Bh;ee.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:H(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Qe(["head","last"],function(e,i){var n="take"+(i?"Right":"");ee.prototype[e]=function(){return this[n](1).value()[0]}}),Qe(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");ee.prototype[e]=function(){return this.__filtered__?new ee(this):this[n](1)}}),ee.prototype.compact=function(){return this.filter(qe)},ee.prototype.find=function(e){return this.filter(e).head()},ee.prototype.findLast=function(e){return this.reverse().find(e)},ee.prototype.invokeMap=Y(function(e,i){return typeof e=="function"?new ee(this):this.map(function(n){return Br(n,e,i)})}),ee.prototype.reject=function(e){return this.filter(ss(H(e)))},ee.prototype.slice=function(e,i){e=W(e);var n=this;return n.__filtered__&&(e>0||i<0)?new ee(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)},ee.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ee.prototype.toArray=function(){return this.take(pt)},dt(ee.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__,v=c?[1]:arguments,E=g instanceof ee,C=v[0],$=E||G(g),T=function(Z){var te=h.apply(p,Tt([Z],v));return c&&M?te[0]:te};$&&n&&typeof C=="function"&&C.length!=1&&(E=$=!1);var M=this.__chain__,z=!!this.__actions__.length,V=d&&!M,Q=E&&!z;if(!d&&$){g=Q?g:new ee(this);var K=e.apply(g,v);return K.__actions__.push({func:es,args:[T],thisArg:r}),new Ze(K,M)}return V&&Q?e.apply(this,v):(K=this.thru(T),V?c?K.value()[0]:K.value():K)})}),Qe(["pop","push","shift","sort","splice","unshift"],function(e){var i=Oi[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(G(d)?d:[],h)}return this[n](function(g){return i.apply(G(g)?g:[],h)})}}),dt(ee.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";ce.call(gr,c)||(gr[c]=[]),gr[c].push({name:i,func:n})}}),gr[Ji(r,oe).name]=[{name:"wrapper",func:r}],ee.prototype.clone=Wp,ee.prototype.reverse=Qp,ee.prototype.value=Yp,p.prototype.at=Rg,p.prototype.chain=Ng,p.prototype.commit=Ag,p.prototype.next=Cg,p.prototype.plant=xg,p.prototype.reverse=Tg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Fg,p.prototype.first=p.prototype.head,Mr&&(p.prototype[Mr]=$g),p},pr=Np();Bt?((Bt.exports=pr)._=pr,Ms._=pr):Pe._=pr}).call(ni)})(yo,yo.exports);var Bb=Object.defineProperty,Jb=Object.defineProperties,Gb=Object.getOwnPropertyDescriptors,Zu=Object.getOwnPropertySymbols,Wb=Object.prototype.hasOwnProperty,Qb=Object.prototype.propertyIsEnumerable,Xu=(a,t,r)=>t in a?Bb(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,hs=(a,t)=>{for(var r in t||(t={}))Wb.call(t,r)&&Xu(a,r,t[r]);if(Zu)for(var r of Zu(t))Qb.call(t,r)&&Xu(a,r,t[r]);return a},Yb=(a,t)=>Jb(a,Gb(t));function Ht(a,t,r){var s;const o=Sw(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${Kb}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function nr(a){return a.includes(":")?a.split(":")[1]:a}function Uh(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function Zb(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function Xb(a={},t={}){const r=eh(a),s=eh(t);return yo.exports.merge(r,s)}function eh(a){var t,r,s,o;const u={};if(!Sr(a))return u;for(const[l,y]of Object.entries(a)){const I=_o(l)?[l]:y.chains,S=y.methods||[],R=y.events||[],x=y.rpcMap||{},j=oi(l);u[j]=Yb(hs(hs({},u[j]),y),{chains:Jn(I,(t=u[j])==null?void 0:t.chains),methods:Jn(S,(r=u[j])==null?void 0:r.methods),events:Jn(R,(s=u[j])==null?void 0:s.events),rpcMap:hs(hs({},x),(o=u[j])==null?void 0:o.rpcMap)})}return u}function eE(a){return a.includes(":")?a.split(":")[2]:a}function tE(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],y=_o(r)?[r]:s.chains?s.chains:Uh(s.accounts);t[r]={chains:y,methods:o,events:u,accounts:l}}return t}function eo(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const Mh={},de=a=>Mh[a],to=(a,t)=>{Mh[a]=t};class rE{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class iE{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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||Ht(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("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 o=parseInt(nr(r));t[o]=this.createHttpProvider(o,(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 o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,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:o}]},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 sE{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class nE{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class oE{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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),o=nr(r);t[o]=this.createHttpProvider(o,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 At(new Vt(s,de("disableProviderPing")))}}class aE{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class cE{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class uE{constructor(t){this.name="near",this.namespace=t.namespace,this.events=de("events"),this.client=de("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||Ht(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Ct.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||Ht(t,this.namespace);return typeof s>"u"?void 0:new At(new Vt(s,de("disableProviderPing")))}}var hE=Object.defineProperty,lE=Object.defineProperties,pE=Object.getOwnPropertyDescriptors,th=Object.getOwnPropertySymbols,dE=Object.prototype.hasOwnProperty,fE=Object.prototype.propertyIsEnumerable,rh=(a,t,r)=>t in a?hE(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ls=(a,t)=>{for(var r in t||(t={}))dE.call(t,r)&&rh(a,r,t[r]);if(th)for(var r of th(t))fE.call(t,r)&&rh(a,r,t[r]);return a},ro=(a,t)=>lE(a,pE(t));class So{constructor(t){this.events=new Ge.Dt,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:N.ot(N.k({level:(t==null?void 0:t.logger)||Qu})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new So(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:ls({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,N.formatJsonRpcResult(o,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:ve("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:o}=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 o().then(u=>{this.session=u,this.namespaces||(this.namespaces=tE(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Dh)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,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(ir(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 Fb.init({logger:this.providerOpts.logger||Qu,relayUrl:this.providerOpts.relayUrl||kb,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=>oi(r)))];to("client",this.client),to("events",this.events),to("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=Zb(r,this.session),o=Uh(s),u=Xb(this.namespaces,this.optionalNamespaces),l=ro(ls({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new iE({namespace:l});break;case"solana":this.rpcProviders[r]=new sE({namespace:l});break;case"cosmos":this.rpcProviders[r]=new nE({namespace:l});break;case"polkadot":this.rpcProviders[r]=new rE({namespace:l});break;case"cip34":this.rpcProviders[r]=new oE({namespace:l});break;case"elrond":this.rpcProviders[r]=new aE({namespace:l});break;case"multiversx":this.rpcProviders[r]=new cE({namespace:l});break;case"near":this.rpcProviders[r]=new uE({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 o=s.data;o&&ir(o)&&this.events.emit("accountsChanged",o.map(eE))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=oi(o),y=eo(o)!==eo(u)?`${l}:${eo(u)}`:o;this.onChainChanged(y)}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:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=ro(ls({},u),{namespaces:o}),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",ro(ls({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Ct.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:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,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=>oi(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 o=oi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${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(`${Yu}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${Yu}/${t}`)}}const gE=So,yE="wc",mE="ethereum_provider",vE=`${yE}@2:${mE}:`,wE="https://rpc.walletconnect.com/v1/",ys=["eth_sendTransaction","personal_sign"],Lh=["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"],ms=["chainChanged","accountsChanged"],zh=["chainChanged","accountsChanged","message","disconnect","connect"];var _E=Object.defineProperty,bE=Object.defineProperties,EE=Object.getOwnPropertyDescriptors,ih=Object.getOwnPropertySymbols,IE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,sh=(a,t,r)=>t in a?_E(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ci=(a,t)=>{for(var r in t||(t={}))IE.call(t,r)&&sh(a,r,t[r]);if(ih)for(var r of ih(t))PE.call(t,r)&&sh(a,r,t[r]);return a},nh=(a,t)=>bE(a,EE(t));function vs(a){return Number(a[0].split(":")[1])}function io(a){return`0x${a.toString(16)}`}function SE(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:y}=a;if(!so(t))throw new Error("Invalid chains");const I={chains:t,methods:s||ys,events:u||ms,rpcMap:ci({},t.length?{[vs(t)]:y[vs(t)]}:{})},S=u==null?void 0:u.filter(B=>!ms.includes(B)),R=s==null?void 0:s.filter(B=>!ys.includes(B));if(!r&&!l&&!o&&!(S!=null&&S.length)&&!(R!=null&&R.length))return{required:t.length?I:void 0};const x=(S==null?void 0:S.length)&&(R==null?void 0:R.length)||!r,j={chains:[...new Set(x?I.chains.concat(r||[]):r)],methods:[...new Set(I.methods.concat(o!=null&&o.length?o:Lh))],events:[...new Set(I.events.concat(l!=null&&l.length?l:zh))],rpcMap:y};return{required:t.length?I:void 0,optional:r.length?j:void 0}}class Es{constructor(){this.events=new Ge.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=vE,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 Es;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}=SE(this.rpc);try{const o=await new Promise(async(l,y)=>{var I;this.rpc.showQrModal&&((I=this.modal)==null||I.subscribeModal(S=>{!S.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),y(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(nh(ci({namespaces:ci({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(S=>{l(S)}).catch(S=>{y(new Error(S.message))})});if(!o)return;const u=Uv(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:io(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}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",io(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",nh(ci({},Lv("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",io(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,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}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 o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const y=o.length?(t==null?void 0:t.methods)||ys:[],I=o.length?(t==null?void 0:t.events)||ms:[],S=(t==null?void 0:t.optionalMethods)||[],R=(t==null?void 0:t.optionalEvents)||[],x=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),j=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(B=>this.formatChainId(B)),optionalChains:u.map(B=>this.formatChainId(B)),methods:y,events:I,optionalMethods:S,optionalEvents:R,rpcMap:x,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:j,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?vs(this.rpc.chains):vs(this.rpc.optionalChains),this.signer=await gE.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-CQ_e_FtW.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(ci({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:o}=t;r&&so(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&so(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${wE}?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 OE=Es;exports.EthereumProvider=OE;exports.OPTIONAL_EVENTS=zh;exports.OPTIONAL_METHODS=Lh;exports.REQUIRED_EVENTS=ms;exports.REQUIRED_METHODS=ys;exports.default=Es;
46
+ }`;var Q=tu(function(){return se(d,z+"return "+T).apply(r,g)});if(Q.source=T,Fn(Q))throw Q;return Q}function Vm(e){return ae(e).toLowerCase()}function Km(e){return ae(e).toUpperCase()}function Bm(e,i,n){if(e=ae(e),e&&(n||i===r))return ha(e);if(!e||!(i=He(i)))return e;var c=ot(e),h=ot(i),d=la(c,h),g=pa(c,h)+1;return Mt(c,d,g).join("")}function Jm(e,i,n){if(e=ae(e),e&&(n||i===r))return e.slice(0,fa(e)+1);if(!e||!(i=He(i)))return e;var c=ot(e),h=pa(c,ot(i))+1;return Mt(c,0,h).join("")}function Gm(e,i,n){if(e=ae(e),e&&(n||i===r))return e.replace(Ts,"");if(!e||!(i=He(i)))return e;var c=ot(e),h=la(c,ot(i));return Mt(c,h).join("")}function Wm(e,i){var n=Cr,c=kh;if(fe(i)){var h="separator"in i?i.separator:h;n="length"in i?W(i.length):n,c="omission"in i?He(i.omission):c}e=ae(e);var d=e.length;if(hr(e)){var g=ot(e);d=g.length}if(n>=d)return e;var v=n-lr(c);if(v<1)return c;var E=g?Mt(g,0,v).join(""):e.slice(0,v);if(h===r)return E+c;if(g&&(v+=E.length-v),jn(h)){if(e.slice(v).search(h)){var C,$=E;for(h.global||(h=Qs(h.source,ae(xo.exec(h))+"g")),h.lastIndex=0;C=h.exec($);)var T=C.index;E=E.slice(0,T===r?v:T)}}else if(e.indexOf(He(h),v)!=v){var M=E.lastIndexOf(h);M>-1&&(E=E.slice(0,M))}return E+c}function Qm(e){return e=ae(e),e&&ol.test(e)?e.replace(Ao,Pp):e}var Ym=vr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Un=rc("toUpperCase");function eu(e,i,n){return e=ae(e),i=n?r:i,i===r?wp(e)?Rp(e):hp(e):e.match(i)||[]}var tu=Y(function(e,i){try{return ze(e,r,i)}catch(n){return Fn(n)?n:new J(n)}}),Zm=Et(function(e,i){return Qe(i,function(n){n=gt(n),_t(e,n,xn(e[n],e))}),e});function Xm(e){var i=e==null?0:e.length,n=H();return e=i?pe(e,function(c){if(typeof c[1]!="function")throw new Ye(l);return[n(c[0]),c[1]]}):[],Y(function(c){for(var h=-1;++h<i;){var d=e[h];if(ze(d[0],this,c))return ze(d[1],this,c)}})}function ev(e){return Pd(Xe(e,x))}function Mn(e){return function(){return e}}function tv(e,i){return e==null||e!==e?i:e}var rv=sc(),iv=sc(!0);function qe(e){return e}function Ln(e){return Fa(typeof e=="function"?e:Xe(e,x))}function sv(e){return Da(Xe(e,x))}function nv(e,i){return qa(e,Xe(i,x))}var ov=Y(function(e,i){return function(n){return Br(n,e,i)}}),av=Y(function(e,i){return function(n){return Br(e,n,i)}});function zn(e,i,n){var c=Ee(i),h=ki(i,c);n==null&&!(fe(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=ki(i,Ee(i)));var d=!(fe(n)&&"chain"in n)||!!n.chain,g=Pt(e);return Qe(h,function(v){var E=i[v];e[v]=E,g&&(e.prototype[v]=function(){var C=this.__chain__;if(d||C){var $=e(this.__wrapped__),T=$.__actions__=Fe(this.__actions__);return T.push({func:E,args:arguments,thisArg:e}),$.__chain__=C,$}return E.apply(e,Tt([this.value()],arguments))})}),e}function cv(){return Pe._===this&&(Pe._=Tp),this}function kn(){}function uv(e){return e=W(e),Y(function(i){return Ua(i,e)})}var hv=wn(pe),lv=wn(na),pv=wn(Hs);function ru(e){return On(e)?Vs(gt(e)):zd(e)}function dv(e){return function(i){return e==null?r:Yt(e,i)}}var fv=oc(),gv=oc(!0);function Hn(){return[]}function Vn(){return!1}function yv(){return{}}function mv(){return""}function vv(){return!0}function wv(e,i){if(e=W(e),e<1||e>$t)return[];var n=pt,c=Re(e,pt);i=H(i),e-=pt;for(var h=Js(c,i);++n<e;)i(n);return h}function _v(e){return G(e)?pe(e,gt):Ve(e)?[e]:Fe(Ec(ae(e)))}function bv(e){var i=++$p;return ae(e)+i}var Ev=Gi(function(e,i){return e+i},0),Iv=_n("ceil"),Pv=Gi(function(e,i){return e/i},1),Sv=_n("floor");function Ov(e){return e&&e.length?zi(e,qe,nn):r}function Rv(e,i){return e&&e.length?zi(e,H(i,2),nn):r}function Nv(e){return ca(e,qe)}function Av(e,i){return ca(e,H(i,2))}function Cv(e){return e&&e.length?zi(e,qe,un):r}function $v(e,i){return e&&e.length?zi(e,H(i,2),un):r}var xv=Gi(function(e,i){return e*i},1),Tv=_n("round"),Fv=Gi(function(e,i){return e-i},0);function jv(e){return e&&e.length?Bs(e,qe):0}function Dv(e,i){return e&&e.length?Bs(e,H(i,2)):0}return p.after=sy,p.ary=Tc,p.assign=Ky,p.assignIn=Jc,p.assignInWith=as,p.assignWith=By,p.at=Jy,p.before=Fc,p.bind=xn,p.bindAll=Zm,p.bindKey=jc,p.castArray=yy,p.chain=Cc,p.chunk=Sf,p.compact=Of,p.concat=Rf,p.cond=Xm,p.conforms=ev,p.constant=Mn,p.countBy=jg,p.create=Gy,p.curry=Dc,p.curryRight=qc,p.debounce=Uc,p.defaults=Wy,p.defaultsDeep=Qy,p.defer=ny,p.delay=oy,p.difference=Nf,p.differenceBy=Af,p.differenceWith=Cf,p.drop=$f,p.dropRight=xf,p.dropRightWhile=Tf,p.dropWhile=Ff,p.fill=jf,p.filter=qg,p.flatMap=Lg,p.flatMapDeep=zg,p.flatMapDepth=kg,p.flatten=Oc,p.flattenDeep=Df,p.flattenDepth=qf,p.flip=ay,p.flow=rv,p.flowRight=iv,p.fromPairs=Uf,p.functions=im,p.functionsIn=sm,p.groupBy=Hg,p.initial=Lf,p.intersection=zf,p.intersectionBy=kf,p.intersectionWith=Hf,p.invert=om,p.invertBy=am,p.invokeMap=Kg,p.iteratee=Ln,p.keyBy=Bg,p.keys=Ee,p.keysIn=De,p.map=ts,p.mapKeys=um,p.mapValues=hm,p.matches=sv,p.matchesProperty=nv,p.memoize=is,p.merge=lm,p.mergeWith=Gc,p.method=ov,p.methodOf=av,p.mixin=zn,p.negate=ss,p.nthArg=uv,p.omit=pm,p.omitBy=dm,p.once=cy,p.orderBy=Jg,p.over=hv,p.overArgs=uy,p.overEvery=lv,p.overSome=pv,p.partial=Tn,p.partialRight=Mc,p.partition=Gg,p.pick=fm,p.pickBy=Wc,p.property=ru,p.propertyOf=dv,p.pull=Jf,p.pullAll=Nc,p.pullAllBy=Gf,p.pullAllWith=Wf,p.pullAt=Qf,p.range=fv,p.rangeRight=gv,p.rearg=hy,p.reject=Yg,p.remove=Yf,p.rest=ly,p.reverse=Cn,p.sampleSize=Xg,p.set=ym,p.setWith=mm,p.shuffle=ey,p.slice=Zf,p.sortBy=iy,p.sortedUniq=ng,p.sortedUniqBy=og,p.split=Lm,p.spread=py,p.tail=ag,p.take=cg,p.takeRight=ug,p.takeRightWhile=hg,p.takeWhile=lg,p.tap=Og,p.throttle=dy,p.thru=es,p.toArray=Vc,p.toPairs=Qc,p.toPairsIn=Yc,p.toPath=_v,p.toPlainObject=Bc,p.transform=vm,p.unary=fy,p.union=pg,p.unionBy=dg,p.unionWith=fg,p.uniq=gg,p.uniqBy=yg,p.uniqWith=mg,p.unset=wm,p.unzip=$n,p.unzipWith=Ac,p.update=_m,p.updateWith=bm,p.values=br,p.valuesIn=Em,p.without=vg,p.words=eu,p.wrap=gy,p.xor=wg,p.xorBy=_g,p.xorWith=bg,p.zip=Eg,p.zipObject=Ig,p.zipObjectDeep=Pg,p.zipWith=Sg,p.entries=Qc,p.entriesIn=Yc,p.extend=Jc,p.extendWith=as,zn(p,p),p.add=Ev,p.attempt=tu,p.camelCase=Om,p.capitalize=Zc,p.ceil=Iv,p.clamp=Im,p.clone=my,p.cloneDeep=wy,p.cloneDeepWith=_y,p.cloneWith=vy,p.conformsTo=by,p.deburr=Xc,p.defaultTo=tv,p.divide=Pv,p.endsWith=Rm,p.eq=ct,p.escape=Nm,p.escapeRegExp=Am,p.every=Dg,p.find=Ug,p.findIndex=Pc,p.findKey=Yy,p.findLast=Mg,p.findLastIndex=Sc,p.findLastKey=Zy,p.floor=Sv,p.forEach=$c,p.forEachRight=xc,p.forIn=Xy,p.forInRight=em,p.forOwn=tm,p.forOwnRight=rm,p.get=Dn,p.gt=Ey,p.gte=Iy,p.has=nm,p.hasIn=qn,p.head=Rc,p.identity=qe,p.includes=Vg,p.indexOf=Mf,p.inRange=Pm,p.invoke=cm,p.isArguments=er,p.isArray=G,p.isArrayBuffer=Py,p.isArrayLike=je,p.isArrayLikeObject=ye,p.isBoolean=Sy,p.isBuffer=Lt,p.isDate=Oy,p.isElement=Ry,p.isEmpty=Ny,p.isEqual=Ay,p.isEqualWith=Cy,p.isError=Fn,p.isFinite=$y,p.isFunction=Pt,p.isInteger=Lc,p.isLength=ns,p.isMap=zc,p.isMatch=xy,p.isMatchWith=Ty,p.isNaN=Fy,p.isNative=jy,p.isNil=qy,p.isNull=Dy,p.isNumber=kc,p.isObject=fe,p.isObjectLike=ge,p.isPlainObject=Zr,p.isRegExp=jn,p.isSafeInteger=Uy,p.isSet=Hc,p.isString=os,p.isSymbol=Ve,p.isTypedArray=_r,p.isUndefined=My,p.isWeakMap=Ly,p.isWeakSet=zy,p.join=Vf,p.kebabCase=Cm,p.last=tt,p.lastIndexOf=Kf,p.lowerCase=$m,p.lowerFirst=xm,p.lt=ky,p.lte=Hy,p.max=Ov,p.maxBy=Rv,p.mean=Nv,p.meanBy=Av,p.min=Cv,p.minBy=$v,p.stubArray=Hn,p.stubFalse=Vn,p.stubObject=yv,p.stubString=mv,p.stubTrue=vv,p.multiply=xv,p.nth=Bf,p.noConflict=cv,p.noop=kn,p.now=rs,p.pad=Tm,p.padEnd=Fm,p.padStart=jm,p.parseInt=Dm,p.random=Sm,p.reduce=Wg,p.reduceRight=Qg,p.repeat=qm,p.replace=Um,p.result=gm,p.round=Tv,p.runInContext=b,p.sample=Zg,p.size=ty,p.snakeCase=Mm,p.some=ry,p.sortedIndex=Xf,p.sortedIndexBy=eg,p.sortedIndexOf=tg,p.sortedLastIndex=rg,p.sortedLastIndexBy=ig,p.sortedLastIndexOf=sg,p.startCase=zm,p.startsWith=km,p.subtract=Fv,p.sum=jv,p.sumBy=Dv,p.template=Hm,p.times=wv,p.toFinite=St,p.toInteger=W,p.toLength=Kc,p.toLower=Vm,p.toNumber=rt,p.toSafeInteger=Vy,p.toString=ae,p.toUpper=Km,p.trim=Bm,p.trimEnd=Jm,p.trimStart=Gm,p.truncate=Wm,p.unescape=Qm,p.uniqueId=bv,p.upperCase=Ym,p.upperFirst=Un,p.each=$c,p.eachRight=xc,p.first=Rc,zn(p,function(){var e={};return dt(p,function(i,n){ce.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Qe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Qe(["drop","take"],function(e,i){ee.prototype[e]=function(n){n=n===r?1:be(W(n),0);var c=this.__filtered__&&!i?new ee(this):this.clone();return c.__filtered__?c.__takeCount__=Re(n,c.__takeCount__):c.__views__.push({size:Re(n,pt),type:e+(c.__dir__<0?"Right":"")}),c},ee.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Qe(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Oo||n==Bh;ee.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:H(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Qe(["head","last"],function(e,i){var n="take"+(i?"Right":"");ee.prototype[e]=function(){return this[n](1).value()[0]}}),Qe(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");ee.prototype[e]=function(){return this.__filtered__?new ee(this):this[n](1)}}),ee.prototype.compact=function(){return this.filter(qe)},ee.prototype.find=function(e){return this.filter(e).head()},ee.prototype.findLast=function(e){return this.reverse().find(e)},ee.prototype.invokeMap=Y(function(e,i){return typeof e=="function"?new ee(this):this.map(function(n){return Br(n,e,i)})}),ee.prototype.reject=function(e){return this.filter(ss(H(e)))},ee.prototype.slice=function(e,i){e=W(e);var n=this;return n.__filtered__&&(e>0||i<0)?new ee(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)},ee.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ee.prototype.toArray=function(){return this.take(pt)},dt(ee.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__,v=c?[1]:arguments,E=g instanceof ee,C=v[0],$=E||G(g),T=function(Z){var te=h.apply(p,Tt([Z],v));return c&&M?te[0]:te};$&&n&&typeof C=="function"&&C.length!=1&&(E=$=!1);var M=this.__chain__,z=!!this.__actions__.length,V=d&&!M,Q=E&&!z;if(!d&&$){g=Q?g:new ee(this);var K=e.apply(g,v);return K.__actions__.push({func:es,args:[T],thisArg:r}),new Ze(K,M)}return V&&Q?e.apply(this,v):(K=this.thru(T),V?c?K.value()[0]:K.value():K)})}),Qe(["pop","push","shift","sort","splice","unshift"],function(e){var i=Oi[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(G(d)?d:[],h)}return this[n](function(g){return i.apply(G(g)?g:[],h)})}}),dt(ee.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";ce.call(gr,c)||(gr[c]=[]),gr[c].push({name:i,func:n})}}),gr[Ji(r,oe).name]=[{name:"wrapper",func:r}],ee.prototype.clone=Wp,ee.prototype.reverse=Qp,ee.prototype.value=Yp,p.prototype.at=Rg,p.prototype.chain=Ng,p.prototype.commit=Ag,p.prototype.next=Cg,p.prototype.plant=xg,p.prototype.reverse=Tg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Fg,p.prototype.first=p.prototype.head,Mr&&(p.prototype[Mr]=$g),p},pr=Np();Bt?((Bt.exports=pr)._=pr,Ms._=pr):Pe._=pr}).call(ni)})(yo,yo.exports);var Bb=Object.defineProperty,Jb=Object.defineProperties,Gb=Object.getOwnPropertyDescriptors,Zu=Object.getOwnPropertySymbols,Wb=Object.prototype.hasOwnProperty,Qb=Object.prototype.propertyIsEnumerable,Xu=(a,t,r)=>t in a?Bb(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,hs=(a,t)=>{for(var r in t||(t={}))Wb.call(t,r)&&Xu(a,r,t[r]);if(Zu)for(var r of Zu(t))Qb.call(t,r)&&Xu(a,r,t[r]);return a},Yb=(a,t)=>Jb(a,Gb(t));function Ht(a,t,r){var s;const o=Sw(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${Kb}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function nr(a){return a.includes(":")?a.split(":")[1]:a}function Uh(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function Zb(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function Xb(a={},t={}){const r=eh(a),s=eh(t);return yo.exports.merge(r,s)}function eh(a){var t,r,s,o;const u={};if(!Sr(a))return u;for(const[l,y]of Object.entries(a)){const I=_o(l)?[l]:y.chains,S=y.methods||[],R=y.events||[],x=y.rpcMap||{},j=oi(l);u[j]=Yb(hs(hs({},u[j]),y),{chains:Jn(I,(t=u[j])==null?void 0:t.chains),methods:Jn(S,(r=u[j])==null?void 0:r.methods),events:Jn(R,(s=u[j])==null?void 0:s.events),rpcMap:hs(hs({},x),(o=u[j])==null?void 0:o.rpcMap)})}return u}function eE(a){return a.includes(":")?a.split(":")[2]:a}function tE(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],y=_o(r)?[r]:s.chains?s.chains:Uh(s.accounts);t[r]={chains:y,methods:o,events:u,accounts:l}}return t}function eo(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const Mh={},de=a=>Mh[a],to=(a,t)=>{Mh[a]=t};class rE{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class iE{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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||Ht(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("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 o=parseInt(nr(r));t[o]=this.createHttpProvider(o,(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 o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,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:o}]},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 sE{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class nE{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class oE{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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),o=nr(r);t[o]=this.createHttpProvider(o,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 At(new Vt(s,de("disableProviderPing")))}}class aE{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class cE{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=de("events"),this.client=de("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(Ct.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 o=nr(r);t[o]=this.createHttpProvider(o,(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||Ht(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new At(new Vt(s,de("disableProviderPing")))}}class uE{constructor(t){this.name="near",this.namespace=t.namespace,this.events=de("events"),this.client=de("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||Ht(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Ct.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||Ht(t,this.namespace);return typeof s>"u"?void 0:new At(new Vt(s,de("disableProviderPing")))}}var hE=Object.defineProperty,lE=Object.defineProperties,pE=Object.getOwnPropertyDescriptors,th=Object.getOwnPropertySymbols,dE=Object.prototype.hasOwnProperty,fE=Object.prototype.propertyIsEnumerable,rh=(a,t,r)=>t in a?hE(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ls=(a,t)=>{for(var r in t||(t={}))dE.call(t,r)&&rh(a,r,t[r]);if(th)for(var r of th(t))fE.call(t,r)&&rh(a,r,t[r]);return a},ro=(a,t)=>lE(a,pE(t));class So{constructor(t){this.events=new Ge.Dt,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:N.ot(N.k({level:(t==null?void 0:t.logger)||Qu})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new So(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:ls({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,N.formatJsonRpcResult(o,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:ve("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:o}=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 o().then(u=>{this.session=u,this.namespaces||(this.namespaces=tE(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Dh)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,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(ir(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 Fb.init({logger:this.providerOpts.logger||Qu,relayUrl:this.providerOpts.relayUrl||kb,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=>oi(r)))];to("client",this.client),to("events",this.events),to("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=Zb(r,this.session),o=Uh(s),u=Xb(this.namespaces,this.optionalNamespaces),l=ro(ls({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new iE({namespace:l});break;case"solana":this.rpcProviders[r]=new sE({namespace:l});break;case"cosmos":this.rpcProviders[r]=new nE({namespace:l});break;case"polkadot":this.rpcProviders[r]=new rE({namespace:l});break;case"cip34":this.rpcProviders[r]=new oE({namespace:l});break;case"elrond":this.rpcProviders[r]=new aE({namespace:l});break;case"multiversx":this.rpcProviders[r]=new cE({namespace:l});break;case"near":this.rpcProviders[r]=new uE({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 o=s.data;o&&ir(o)&&this.events.emit("accountsChanged",o.map(eE))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=oi(o),y=eo(o)!==eo(u)?`${l}:${eo(u)}`:o;this.onChainChanged(y)}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:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=ro(ls({},u),{namespaces:o}),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",ro(ls({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Ct.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:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,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=>oi(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 o=oi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${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(`${Yu}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${Yu}/${t}`)}}const gE=So,yE="wc",mE="ethereum_provider",vE=`${yE}@2:${mE}:`,wE="https://rpc.walletconnect.com/v1/",ys=["eth_sendTransaction","personal_sign"],Lh=["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"],ms=["chainChanged","accountsChanged"],zh=["chainChanged","accountsChanged","message","disconnect","connect"];var _E=Object.defineProperty,bE=Object.defineProperties,EE=Object.getOwnPropertyDescriptors,ih=Object.getOwnPropertySymbols,IE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,sh=(a,t,r)=>t in a?_E(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ci=(a,t)=>{for(var r in t||(t={}))IE.call(t,r)&&sh(a,r,t[r]);if(ih)for(var r of ih(t))PE.call(t,r)&&sh(a,r,t[r]);return a},nh=(a,t)=>bE(a,EE(t));function vs(a){return Number(a[0].split(":")[1])}function io(a){return`0x${a.toString(16)}`}function SE(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:y}=a;if(!so(t))throw new Error("Invalid chains");const I={chains:t,methods:s||ys,events:u||ms,rpcMap:ci({},t.length?{[vs(t)]:y[vs(t)]}:{})},S=u==null?void 0:u.filter(B=>!ms.includes(B)),R=s==null?void 0:s.filter(B=>!ys.includes(B));if(!r&&!l&&!o&&!(S!=null&&S.length)&&!(R!=null&&R.length))return{required:t.length?I:void 0};const x=(S==null?void 0:S.length)&&(R==null?void 0:R.length)||!r,j={chains:[...new Set(x?I.chains.concat(r||[]):r)],methods:[...new Set(I.methods.concat(o!=null&&o.length?o:Lh))],events:[...new Set(I.events.concat(l!=null&&l.length?l:zh))],rpcMap:y};return{required:t.length?I:void 0,optional:r.length?j:void 0}}class Es{constructor(){this.events=new Ge.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=vE,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 Es;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}=SE(this.rpc);try{const o=await new Promise(async(l,y)=>{var I;this.rpc.showQrModal&&((I=this.modal)==null||I.subscribeModal(S=>{!S.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),y(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(nh(ci({namespaces:ci({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(S=>{l(S)}).catch(S=>{y(new Error(S.message))})});if(!o)return;const u=Uv(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:io(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}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",io(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",nh(ci({},Lv("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",io(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,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}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 o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const y=o.length?(t==null?void 0:t.methods)||ys:[],I=o.length?(t==null?void 0:t.events)||ms:[],S=(t==null?void 0:t.optionalMethods)||[],R=(t==null?void 0:t.optionalEvents)||[],x=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),j=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(B=>this.formatChainId(B)),optionalChains:u.map(B=>this.formatChainId(B)),methods:y,events:I,optionalMethods:S,optionalEvents:R,rpcMap:x,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:j,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?vs(this.rpc.chains):vs(this.rpc.optionalChains),this.signer=await gE.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-BVz1aMw3.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(ci({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:o}=t;r&&so(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&so(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${wE}?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 OE=Es;exports.EthereumProvider=OE;exports.OPTIONAL_EVENTS=zh;exports.OPTIONAL_METHODS=Lh;exports.REQUIRED_EVENTS=ms;exports.REQUIRED_METHODS=ys;exports.default=Es;
@@ -1,7 +1,7 @@
1
- import { e as bt, D as No } from "./events-BIfEV615.mjs";
2
- import { a1 as $o, aQ as dw, Z as ue, ac as fw, dt as _u } from "./index-BDhzG0Bz.mjs";
3
- import { s as Rh, f as Nh, a as $h, d as Ah, c as L, g as gw, b as Ao, e as Ch, h as xh, x as Th, r as Fh, H as yw, i as Dh, j as mw } from "./index-DTj0BYI6.mjs";
4
- import { I as ur, f as dt, t as st, c as Eu, C as vw, d as ww, r as bw, a as Ar, g as qh, i as wt, b as Ps, W as _w, E as Le, y as We, o as Ss, k as Os, h as Ew, e as Iu, j as Iw, s as Pw, l as po, m as jh, n as Sw, p as Co, q as Rs, u as xo, v as Kt, w as Ow, x as Pu, z as Rw } from "./index-B-bMfv9J.mjs";
1
+ import { e as bt, D as No } from "./events-BL2eUG60.mjs";
2
+ import { a1 as $o, aQ as dw, Z as ue, ac as fw, dt as _u } from "./index-CjwA7HmM.mjs";
3
+ import { s as Rh, f as Nh, a as $h, d as Ah, c as L, g as gw, b as Ao, e as Ch, h as xh, x as Th, r as Fh, H as yw, i as Dh, j as mw } from "./index-fzN-meRd.mjs";
4
+ import { I as ur, f as dt, t as st, c as Eu, C as vw, d as ww, r as bw, a as Ar, g as qh, i as wt, b as Ps, W as _w, E as Le, y as We, o as Ss, k as Os, h as Ew, e as Iu, j as Iw, s as Pw, l as po, m as jh, n as Sw, p as Co, q as Rs, u as xo, v as Kt, w as Ow, x as Pu, z as Rw } from "./index-BHOu1oLq.mjs";
5
5
  var Nw = {};
6
6
  (function(a) {
7
7
  const t = $h, r = Ah, s = Rh, o = Nh, u = (f) => f == null, l = Symbol("encodeFragmentIdentifier");
@@ -7726,7 +7726,7 @@ class ko {
7726
7726
  if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? Is(this.rpc.chains) : Is(this.rpc.optionalChains), this.signer = await oI.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) {
7727
7727
  let r;
7728
7728
  try {
7729
- const { WalletConnectModal: s } = await import("./index-BUcxdUpo.mjs").then((o) => o.i);
7729
+ const { WalletConnectModal: s } = await import("./index-D0W1ZmqN.mjs").then((o) => o.i);
7730
7730
  r = s;
7731
7731
  } catch {
7732
7732
  throw new Error("To use QR modal, please install @walletconnect/modal package");
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-ByG9EJHX.js");exports.AutomaticCCTPRoute=t.AutomaticCCTPRoute;exports.AutomaticTokenBridgeRoute=t.AutomaticTokenBridgeRoute;exports.CCTPRoute=t.CCTPRoute;exports.DEFAULT_ROUTES=t.DEFAULT_ROUTES;exports.MAINNET=t.MAINNET;exports.MayanRoute=t.MayanRoute;exports.MayanRouteMCTP=t.MayanRouteMCTP;exports.MayanRouteSWIFT=t.MayanRouteSWIFT;exports.MayanRouteWH=t.MayanRouteWH;exports.TESTNET=t.TESTNET;exports.TokenBridgeRoute=t.TokenBridgeRoute;exports.dark=t.dark;exports.default=t.WormholeConnect;exports.light=t.light;exports.nttAutomaticRoute=t.nttAutomaticRoute;exports.nttManualRoute=t.nttManualRoute;exports.nttRoutes=t.nttRoutes;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-CDGktAjP.js");exports.AutomaticCCTPRoute=t.AutomaticCCTPRoute;exports.AutomaticTokenBridgeRoute=t.AutomaticTokenBridgeRoute;exports.CCTPRoute=t.CCTPRoute;exports.DEFAULT_ROUTES=t.DEFAULT_ROUTES;exports.MAINNET=t.MAINNET;exports.MayanRoute=t.MayanRoute;exports.MayanRouteMCTP=t.MayanRouteMCTP;exports.MayanRouteSWIFT=t.MayanRouteSWIFT;exports.MayanRouteWH=t.MayanRouteWH;exports.TESTNET=t.TESTNET;exports.TokenBridgeRoute=t.TokenBridgeRoute;exports.dark=t.dark;exports.default=t.WormholeConnect;exports.light=t.light;exports.nttAutomaticRoute=t.nttAutomaticRoute;exports.nttManualRoute=t.nttManualRoute;exports.nttRoutes=t.nttRoutes;
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { dV as d, dT as o, dW as s, dP as e, dL as u, dX as R, dZ as T, d_ as n, dY as M, dM as i, dU as r, dN as A, dK as C, dO as E, dR as m, dS as y, dQ as N } from "./index-BDhzG0Bz.mjs";
1
+ import { dV as d, dT as o, dW as s, dP as e, dL as u, dX as R, dZ as T, d_ as n, dY as M, dM as i, dU as r, dN as A, dK as C, dO as E, dR as m, dS as y, dQ as N } from "./index-CjwA7HmM.mjs";
2
2
  export {
3
3
  d as AutomaticCCTPRoute,
4
4
  o as AutomaticTokenBridgeRoute,
@@ -1,4 +1,4 @@
1
- import { V as fC, Z as p2, aS as _C, $ as LC } from "./index-BDhzG0Bz.mjs";
1
+ import { V as fC, Z as p2, aS as _C, $ as LC } from "./index-CjwA7HmM.mjs";
2
2
  var II = $0, f2 = null;
3
3
  try {
4
4
  f2 = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([